@hagicode/cli 0.1.0-dev.38.1.49d2c87 → 0.1.0-dev.41.1.8543fd3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -86,11 +86,12 @@ Every operation command resolves the backend base URL on each invocation, in thi
86
86
 
87
87
  ```json
88
88
  {
89
- "baseUrl": "https://hagicode.example.com"
89
+ "baseUrl": "https://hagicode.example.com",
90
+ "steer": false
90
91
  }
91
92
  ```
92
93
 
93
- If none of the three is set, the command exits with code `2` and sends no backend request.
94
+ If none of the three is set, the command exits with code `2` and sends no backend request. The `steer` key is the default for `hagi chat send`, `hagi proposal send`, and `hagi hagitask send` (see [Steer](#steer-send-option)); it must be `true` or `false`.
94
95
 
95
96
  Operation commands send requests without a credential by default. Pass `--token` (or set `HAGI_API_TOKEN`) only when your backend requires one.
96
97
 
@@ -110,17 +111,19 @@ $ echo $?
110
111
  hagi
111
112
  |-- project list | repositories | create | update | delete
112
113
  | `-- monospecs show | init | set | validate | reload | clone | remove-checkout
113
- |-- proposal list | create | optimize-description | generate | annotate | execute | archive | status | complete | send
114
+ |-- proposal list | create | optimize-description | generate | annotate | execute | archive | status | complete | send | get | messages
114
115
  |-- vault list | create | update | delete
115
116
  | `-- files list | preview
116
117
  |-- chat list | create | archive | delete | send
117
- |-- hagitask list | schema | create | send
118
+ |-- hagitask list | schema | create | send | get | messages
118
119
  |-- plan list | get | create | update | enable | disable | delete | run
119
120
  `-- skills local list | enable | disable | uninstall
120
121
  gallery search | detail | install
121
122
  trusted list | upsert | delete | reset
122
123
  ```
123
124
 
125
+ The `send` commands of `chat`, `proposal`, and `hagitask` also take `--steer` and `--no-steer`, and `HAGI_SEND_STEER` sets the default. See [Steer](#steer-send-option).
126
+
124
127
  ## Example Setup
125
128
 
126
129
  The examples in the family sections run in order against a local backend. They assume:
@@ -243,6 +246,14 @@ hagi proposal status --session-id "$PROPOSAL_ID" --status Reviewing
243
246
  hagi proposal send --session-id "$PROPOSAL_ID" --content "Please continue"
244
247
  ```
245
248
 
249
+ Steer the message into the running turn, from the environment, or with a normal send that overrides the environment:
250
+
251
+ ```bash
252
+ hagi proposal send --session-id "$PROPOSAL_ID" --content "Please continue" --steer
253
+ HAGI_SEND_STEER=1 hagi proposal send --session-id "$PROPOSAL_ID" --content "Please continue"
254
+ hagi proposal send --session-id "$PROPOSAL_ID" --content "Please continue" --no-steer
255
+ ```
256
+
246
257
  The next steps are AI lifecycle actions and need a backend with an AI executor. `optimize-description` writes the optimized title, description, and proposal name to the session in one backend step, and `generate` needs that name. Without the AI executor, or before the name exists, the backend answers with a 400 that names the missing state:
247
258
 
248
259
  ```bash
@@ -260,6 +271,17 @@ hagi proposal complete --session-id "$PROPOSAL_ID"
260
271
  hagi proposal archive --session-id "$PROPOSAL_ID"
261
272
  ```
262
273
 
274
+ ### Follow a Run
275
+
276
+ `proposal get` reads one session. With `--wait` it polls until the status settles, so the next lifecycle command runs at the right time. `proposal messages` reads the session's messages, newest first.
277
+
278
+ ```bash
279
+ hagi proposal get --session-id "$PROPOSAL_ID" --wait --json
280
+ hagi proposal messages --session-id "$PROPOSAL_ID" --last 1 --json
281
+ ```
282
+
283
+ The options are the same as `hagitask get`. WaitingForReply counts as settled, because a person must answer. Which stage each command starts is in [references/openspec-workflow.md](skills/hagi/references/openspec-workflow.md).
284
+
263
285
  ### Explicit Lifecycle Sequence
264
286
 
265
287
  The CLI keeps proposal lifecycle actions explicit and non-interactive. Each command maps to one backend action:
@@ -341,6 +363,9 @@ Send a message, archive, and delete:
341
363
 
342
364
  ```bash
343
365
  hagi chat send --session-id "$CHAT_ID" --content "Summarize the current diff"
366
+ hagi chat send --session-id "$CHAT_ID" --content "Summarize the current diff" --steer
367
+ HAGI_SEND_STEER=1 hagi chat send --session-id "$CHAT_ID" --content "Summarize the current diff"
368
+ hagi chat send --session-id "$CHAT_ID" --content "Summarize the current diff" --no-steer
344
369
  hagi chat archive --session-id "$CHAT_ID"
345
370
  hagi chat delete --session-id "$CHAT_ID"
346
371
  ```
@@ -357,8 +382,8 @@ hagi hagitask list --json
357
382
  `hagitask schema` shows one task's target scope, commands, parameters, requirements and scenes. Each required parameter is marked `yes`. The `--json` output adds the input JSON Schema and an example request body:
358
383
 
359
384
  ```bash
360
- hagi hagitask schema --task-id compose-commit
361
- hagi hagitask schema --task-id compose-commit --json
385
+ hagi hagitask schema --task-id <task-id>
386
+ hagi hagitask schema --task-id <task-id> --json
362
387
  ```
363
388
 
364
389
  Write the input file. Its keys are the parameter keys the schema lists under `inputs`, plus the `targets` and `targetScopes` keys when the schema's scope lists targets. For example, `input.json` for a task with one required input:
@@ -375,17 +400,28 @@ Create the session from that task and input. The new id is read from `session.se
375
400
 
376
401
  ```bash
377
402
  HAGITASK_ID=$(hagi hagitask create \
378
- --title "Auto compose commit" \
403
+ --title "Auto task" \
379
404
  --project-id "$PROJECT_ID" \
380
- --task-id compose-commit \
405
+ --task-id <task-id> \
381
406
  --input input.json \
407
+ --json | json_field '.session.sessionId')
408
+ ```
409
+
410
+ Super Commit is a prompt, not a preset task. It has no schema and takes no `--input`. Start it with its prompt id, and pass the Git options it accepts:
411
+
412
+ ```bash
413
+ SUPER_COMMIT_ID=$(hagi hagitask create \
414
+ --title "Commit the CLI changes" \
415
+ --project-id "$PROJECT_ID" \
416
+ --prompt-id auto-compose-commit.en-US \
382
417
  --repository-path repos/cli \
383
- --need-push \
384
418
  --target-branch-mode new-custom \
385
419
  --target-branch-name feature/cli-completion \
386
420
  --json | json_field '.session.sessionId')
387
421
  ```
388
422
 
423
+ Start a Super Commit only when the user asked for it. Add `--need-push` only when the user asked for a push. See [references/super-commit.md](skills/hagi/references/super-commit.md) for the options, the branch modes, the result and the explicit-request rule.
424
+
389
425
  Use `--prompt-id` instead of `--task-id` for a prompt template with no structured input. `--input` needs `--task-id`. Input is read from a file, or from stdin with `--input -`. The CLI only checks that the input is a JSON object. The backend checks the keys and values. It rejects a key that the schema does not list, and a missing required value. Its error is printed unchanged, and no session is reported as created. `--hero-selection-mode` takes `first` (the default) or `random`.
390
426
 
391
427
  The backend must have a hero available for the task's script. Without one, `hagitask create` fails with a 400 whose error is `no-executable-hero`.
@@ -396,6 +432,23 @@ Send a follow-up message to the HagiTask session:
396
432
  hagi hagitask send --session-id "$HAGITASK_ID" --content "Retry with a smaller diff"
397
433
  ```
398
434
 
435
+ Steer the message into the running task, from the environment, or with a normal send that overrides the environment:
436
+
437
+ ```bash
438
+ hagi hagitask send --session-id "$HAGITASK_ID" --content "Retry with a smaller diff" --steer
439
+ HAGI_SEND_STEER=1 hagi hagitask send --session-id "$HAGITASK_ID" --content "Retry with a smaller diff"
440
+ hagi hagitask send --session-id "$HAGITASK_ID" --content "Retry with a smaller diff" --no-steer
441
+ ```
442
+
443
+ Read one HagiTask session, or wait until its status settles, and read its messages:
444
+
445
+ ```bash
446
+ hagi hagitask get --session-id "$SUPER_COMMIT_ID" --wait --timeout 900 --json
447
+ hagi hagitask messages --session-id "$SUPER_COMMIT_ID" --last 1 --json
448
+ ```
449
+
450
+ `hagitask get` reads one session. With `--wait` it polls every `--interval` seconds (default 5) until the status is no longer Optimizing, Openspecing, Executing or Archiving. `--timeout` (default 900) and `--grace` (default 10, `0` disables) are seconds, and `--timeout`, `--interval` and `--grace` need `--wait`. `--interval` must be less than `--timeout`. A timeout exits `31` and prints the last status. `hagitask messages --last <n>` reads the n newest messages; `--json` prints the list unchanged.
451
+
399
452
  **Migration from AutoTask:** `hagi hagitask create` and `hagi hagitask send` replace `hagi autotask create` and `hagi autotask send`. There is no `autotask` alias, so an `autotask` command now fails as an unknown command. Read the task schema with `hagitask schema` to find the input keys that replace the old flags.
400
453
 
401
454
  ## Plan Commands
@@ -595,6 +648,45 @@ hagi skills trusted delete --provider-id example-provider
595
648
  hagi skills trusted reset
596
649
  ```
597
650
 
651
+ ## Steer (send option)
652
+
653
+ `hagi chat send`, `hagi proposal send`, and `hagi hagitask send` deliver a message in one of two ways:
654
+
655
+ - **Normal send** (default): the message waits behind the running turn, as before.
656
+ - **Steer**: the message is inserted into the running turn through the backend's `SteerSession` RPC. The CLI makes one call.
657
+
658
+ Steer is off unless you ask for it. The first source that is set decides, in this order:
659
+
660
+ 1. `--steer` (on) or `--no-steer` (off) on the command.
661
+ 2. `HAGI_SEND_STEER`: `1`, `true`, `yes`, `on` turn Steer on; `0`, `false`, `no`, `off` turn it off. Case and surrounding spaces are ignored. Any other value exits with code `2` and sends no request.
662
+ 3. `"steer": true` or `"steer": false` in the config file. Any other type exits with code `2` and names the file.
663
+ 4. The default, `false`.
664
+
665
+ A lower source is not read once a higher one is set, so `--no-steer` works even when `HAGI_SEND_STEER` holds a value the CLI does not recognize.
666
+
667
+ ### Outcomes
668
+
669
+ - `steered`: a running task took the message. It does not guarantee the text was used: the backend can return a steered message to the queue when the run ends.
670
+ - `queued`: no running task took the message, so it was sent as the next message. This is a success and exits with code `0`. The backend also answers `queued` for an idle session, where the message starts a run at once.
671
+
672
+ Human output adds `steer`, `effective`, `outcome`, and `messageId` rows, and a line saying no running task took the message for `queued`. `--json` keeps `sessionId`, `message`, and `requested`, and adds a `steer` object: `{ requested, source, effective, outcome?, messageId?, reason? }`. `source` is `flag`, `env`, `config`, or `default`. `reason` appears only when Steer was requested but not used. On the Steer path `message` is `Steered` or `Queued`.
673
+
674
+ ### Conflicts and fallback
675
+
676
+ Steer carries text only, so it cannot be combined with `--mode` or `--executor-type`:
677
+
678
+ - `--steer` with either option exits with code `2` and sends nothing.
679
+ - When Steer comes only from `HAGI_SEND_STEER` or the config file, the command sends a normal message with the options and records the reason in `steer.reason`.
680
+ - When Steer comes only from `HAGI_SEND_STEER` or the config file and the backend does not implement `SteerSession`, the command sends a normal message and records the reason `the backend does not support Steer`. An explicit `--steer` reports the backend error instead.
681
+
682
+ A queued Steer is always sent in `Edit` mode. A session that must keep another mode should send with `--no-steer --mode <mode>`.
683
+
684
+ Steer works with the executors the backend supports. For any other executor, the backend answers `queued`.
685
+
686
+ ### Unattended messaging
687
+
688
+ For session-to-session messages sent by an orchestrator without a person watching, set `HAGI_SEND_STEER=1` in its environment. Add `--no-steer` to a single call that must go through the normal queue.
689
+
598
690
  ## Environment Variables
599
691
 
600
692
  The CLI resolves runtime settings centrally before every command. Explicit flags always override environment variables.
@@ -604,6 +696,7 @@ The CLI resolves runtime settings centrally before every command. Explicit flags
604
696
  | `HAGI_API_BASE_URL` | Backend base URL, used when `--base-url` is not given. Overrides the config file. Required when neither is set. |
605
697
  | `HAGI_API_TOKEN` | Bearer token attached as `Authorization: Bearer <token>`. |
606
698
  | `HAGI_API_LANG` | Shared `Accept-Language` header value. |
699
+ | `HAGI_SEND_STEER` | Turns Steer on (`1`, `true`, `yes`, `on`) or off (`0`, `false`, `no`, `off`) for the send commands, ignoring case and surrounding spaces. Any other value exits with code `2`. Overridden by `--steer` / `--no-steer`. Order: flag, then this variable, then the `steer` config key, then `false`. |
607
700
 
608
701
  ## Backend Transport
609
702
 
@@ -624,6 +717,7 @@ Stable non-zero exits used by the CLI. The HTTP numbers are the equivalents of t
624
717
  | `24` | HTTP 404 |
625
718
  | `29` | HTTP 409 |
626
719
  | `30` | Operation failed: the backend returned a refusal, for example `skills local enable` or `disable` on a name that is not a built-in skill, an invalid MonoSpecs configuration from `project monospecs validate`, or a failed clone from `project monospecs clone` or `set --clone` |
720
+ | `31` | Wait timed out: `--wait` on `proposal get` or `hagitask get` reached `--timeout` before the session settled. The last status is printed. Not a success, and not a backend error |
627
721
  | `40` | Other HTTP 4xx |
628
722
  | `50` | HTTP 5xx |
629
723
  | `60` | Transport or connection failure |