feat(cli): doc wait command (multi-target wait-all)

weknora doc wait <doc-id> [<doc-id>...] blocks until every given document
reaches a terminal parse_status (completed / failed), --timeout expires,
or the user interrupts (SIGINT).

* --timeout DURATION (default 10m; exit 124 on timeout, matches GNU
  timeout(1) convention)
* --interval DURATION (default 2s; exponential backoff to 15s + jitter)
* Multi-id polled concurrently (max 5 parallel)
* Exit code priority 1 > 124 > 0 (failed > timeout > completed)

New typed errors:
* operation.timeout → exit 124
* operation.failed → exit 1
* operation.cancelled → exit 1 (main raises to 130 on signal)

server.session_create_failed gets a special case in ExitCode to map to
exit 1 (workflow failure, not transient retry).

doc view and doc download positional id namespaced to <doc-id>.
This commit is contained in:
nullkey
2026-05-18 01:38:01 +08:00
committed by lyingbug
parent 567d7ac74e
commit 7eeb3bec5d
11 changed files with 654 additions and 49 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ type DownloadService interface {
func NewCmdDownload(f *cmdutil.Factory) *cobra.Command {
opts := &DownloadOptions{}
cmd := &cobra.Command{
Use: "download <id>",
Use: "download <doc-id>",
Short: "Download a document by ID",
Long: `Streams the document bytes to disk (or stdout with --output -).