@hagicode/cli 0.1.0-dev.39.1.c7a4f44 → 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
 
@@ -121,6 +122,8 @@ hagi
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
@@ -352,6 +363,9 @@ Send a message, archive, and delete:
352
363
 
353
364
  ```bash
354
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
355
369
  hagi chat archive --session-id "$CHAT_ID"
356
370
  hagi chat delete --session-id "$CHAT_ID"
357
371
  ```
@@ -418,6 +432,14 @@ Send a follow-up message to the HagiTask session:
418
432
  hagi hagitask send --session-id "$HAGITASK_ID" --content "Retry with a smaller diff"
419
433
  ```
420
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
+
421
443
  Read one HagiTask session, or wait until its status settles, and read its messages:
422
444
 
423
445
  ```bash
@@ -626,6 +648,45 @@ hagi skills trusted delete --provider-id example-provider
626
648
  hagi skills trusted reset
627
649
  ```
628
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
+
629
690
  ## Environment Variables
630
691
 
631
692
  The CLI resolves runtime settings centrally before every command. Explicit flags always override environment variables.
@@ -635,6 +696,7 @@ The CLI resolves runtime settings centrally before every command. Explicit flags
635
696
  | `HAGI_API_BASE_URL` | Backend base URL, used when `--base-url` is not given. Overrides the config file. Required when neither is set. |
636
697
  | `HAGI_API_TOKEN` | Bearer token attached as `Authorization: Bearer <token>`. |
637
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`. |
638
700
 
639
701
  ## Backend Transport
640
702