@humain/humain-code 0.4.9 → 0.4.10

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.
Files changed (112) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/bundle/agent-monitor.js +1 -1
  3. package/dist/bundle/chunks/bedrock-converse-stream.js +39 -45
  4. package/dist/bundle/chunks/{chunk-6FVNSW6B.js → chunk-2QTTNAD4.js} +3353 -3938
  5. package/dist/bundle/chunks/chunk-76X5KOIA.js +28 -0
  6. package/dist/bundle/chunks/{chunk-KRMTBTWU.js → chunk-77EWF2NW.js} +1 -1
  7. package/dist/bundle/chunks/{chunk-RBKDBF5G.js → chunk-AS2Y2MO6.js} +36 -36
  8. package/dist/bundle/chunks/{chunk-4LAKI5IL.js → chunk-AUFEF24K.js} +1 -1
  9. package/dist/bundle/chunks/{chunk-P4YMUUSK.js → chunk-BCF7KZ3R.js} +739 -730
  10. package/dist/bundle/chunks/{chunk-W2QRCQBX.js → chunk-FF26YENK.js} +3 -4
  11. package/dist/bundle/chunks/{chunk-UZ5FVVCP.js → chunk-HMWAH7ZY.js} +1 -1
  12. package/dist/bundle/chunks/{chunk-F7UMX5BV.js → chunk-HSDTSUZE.js} +13 -2
  13. package/dist/bundle/chunks/chunk-I2ZWZAIV.js +751 -0
  14. package/dist/bundle/chunks/{chunk-GUUAEK6G.js → chunk-LCOHFEZZ.js} +1 -1
  15. package/dist/bundle/chunks/{chunk-Z5LYSSTY.js → chunk-QSPDLT2R.js} +2 -2
  16. package/dist/bundle/chunks/{chunk-UBQSONVR.js → chunk-R5VIAWGA.js} +103 -145
  17. package/dist/bundle/chunks/{chunk-EMYNPLY5.js → chunk-V5ZF7Q7L.js} +1 -1
  18. package/dist/bundle/chunks/{chunk-LQ4S7CRR.js → chunk-VYIIPF57.js} +1 -1
  19. package/dist/bundle/chunks/chunk-WBJN6PEI.js +43 -0
  20. package/dist/bundle/chunks/{chunk-SWRU4BOC.js → chunk-XGO43DKL.js} +1 -1
  21. package/dist/bundle/chunks/{chunk-PMISFIBM.js → chunk-XMHLSV3I.js} +1 -1
  22. package/dist/bundle/chunks/{chunk-3E4SMILM.js → chunk-YJBE3IGR.js} +14 -14
  23. package/dist/bundle/chunks/{cli-ZKT34WPW.js → cli-5ACW3WND.js} +2 -2
  24. package/dist/bundle/chunks/{compat-HEUVP6UJ.js → compat-TQKA4I7M.js} +1 -1
  25. package/dist/bundle/chunks/{dist-NU2EIVT6.js → dist-WHC67QRM.js} +676 -550
  26. package/dist/bundle/chunks/dist-cjs-RL2OCAP2.js +179 -0
  27. package/dist/bundle/chunks/{easter-egg-3d-5KKDWEIA.js → easter-egg-3d-3L3IKAT6.js} +1 -1
  28. package/dist/bundle/chunks/{esm-NCUV2DF7.js → esm-763X2IA7.js} +1 -1
  29. package/dist/bundle/chunks/event-streams-R5OECII4.js +2 -0
  30. package/dist/bundle/chunks/{execute-OSBDNQU5.js → execute-4X6G65NZ.js} +1 -1
  31. package/dist/bundle/chunks/{extract-PYRMDATF.js → extract-DLZ425VI.js} +4 -4
  32. package/dist/bundle/chunks/github-copilot.js +32 -31
  33. package/dist/bundle/chunks/{google-generative-ai-H2F5Y5H2.js → google-generative-ai-JD2FVOIX.js} +1 -1
  34. package/dist/bundle/chunks/{google-vertex-LFWD2AOO.js → google-vertex-PFBMDCBW.js} +1 -1
  35. package/dist/bundle/chunks/{host-6ZA6LK4C.js → host-4J7H7KDS.js} +1 -1
  36. package/dist/bundle/chunks/{node-XGNY74WT.js → node-W47VUEGE.js} +1 -1
  37. package/dist/bundle/chunks/{runtime-JFLZUNYP.js → runtime-SI76JZNE.js} +1 -1
  38. package/dist/bundle/chunks/virtual-modules-ID2GA4GE.js +5 -0
  39. package/dist/bundle/cli-runtime.js +3 -3
  40. package/dist/bundle/flow/package.json +1 -1
  41. package/dist/bundle/index.js +17 -17
  42. package/dist/bundle/rpc-entry.js +3 -2
  43. package/dist/core/account-reporting.d.ts +109 -0
  44. package/dist/core/account-reporting.d.ts.map +1 -0
  45. package/dist/core/account-reporting.js +328 -0
  46. package/dist/core/account-reporting.js.map +1 -0
  47. package/dist/core/agent-session.d.ts +22 -2
  48. package/dist/core/agent-session.d.ts.map +1 -1
  49. package/dist/core/agent-session.js +131 -0
  50. package/dist/core/agent-session.js.map +1 -1
  51. package/dist/core/anthropic-account-reporting.d.ts +76 -0
  52. package/dist/core/anthropic-account-reporting.d.ts.map +1 -0
  53. package/dist/core/anthropic-account-reporting.js +380 -0
  54. package/dist/core/anthropic-account-reporting.js.map +1 -0
  55. package/dist/core/bedrock-account-reporting.d.ts +82 -0
  56. package/dist/core/bedrock-account-reporting.d.ts.map +1 -0
  57. package/dist/core/bedrock-account-reporting.js +402 -0
  58. package/dist/core/bedrock-account-reporting.js.map +1 -0
  59. package/dist/core/model-runtime.d.ts +17 -0
  60. package/dist/core/model-runtime.d.ts.map +1 -1
  61. package/dist/core/model-runtime.js +64 -10
  62. package/dist/core/model-runtime.js.map +1 -1
  63. package/dist/core/oauth-account-pool.d.ts +4 -0
  64. package/dist/core/oauth-account-pool.d.ts.map +1 -1
  65. package/dist/core/oauth-account-pool.js +10 -3
  66. package/dist/core/oauth-account-pool.js.map +1 -1
  67. package/dist/humain/flow-accounts-host.d.ts +120 -0
  68. package/dist/humain/flow-accounts-host.d.ts.map +1 -0
  69. package/dist/humain/flow-accounts-host.js +346 -0
  70. package/dist/humain/flow-accounts-host.js.map +1 -0
  71. package/dist/humain/flow-command.d.ts +28 -0
  72. package/dist/humain/flow-command.d.ts.map +1 -0
  73. package/dist/humain/flow-command.js +226 -0
  74. package/dist/humain/flow-command.js.map +1 -0
  75. package/dist/humain/flow-loader.d.ts +4 -2
  76. package/dist/humain/flow-loader.d.ts.map +1 -1
  77. package/dist/humain/flow-loader.js +120 -91
  78. package/dist/humain/flow-loader.js.map +1 -1
  79. package/dist/humain/node-account-failure.d.ts +18 -0
  80. package/dist/humain/node-account-failure.d.ts.map +1 -0
  81. package/dist/humain/node-account-failure.js +73 -0
  82. package/dist/humain/node-account-failure.js.map +1 -0
  83. package/dist/humain/node-account-fallback.d.ts +85 -0
  84. package/dist/humain/node-account-fallback.d.ts.map +1 -0
  85. package/dist/humain/node-account-fallback.js +175 -0
  86. package/dist/humain/node-account-fallback.js.map +1 -0
  87. package/dist/humain/node-http.d.ts.map +1 -1
  88. package/dist/humain/node-http.js +11 -0
  89. package/dist/humain/node-http.js.map +1 -1
  90. package/dist/humain/node-provider.d.ts +4 -0
  91. package/dist/humain/node-provider.d.ts.map +1 -1
  92. package/dist/humain/node-provider.js +11 -0
  93. package/dist/humain/node-provider.js.map +1 -1
  94. package/dist/index.d.ts +4 -0
  95. package/dist/index.d.ts.map +1 -1
  96. package/dist/index.js.map +1 -1
  97. package/dist/modes/interactive/components/login-dialog.d.ts +2 -0
  98. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  99. package/dist/modes/interactive/components/login-dialog.js +5 -0
  100. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  101. package/dist/modes/interactive/interactive-mode.d.ts +26 -0
  102. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  103. package/dist/modes/interactive/interactive-mode.js +242 -19
  104. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  105. package/docs/flow-profiles.md +57 -5
  106. package/docs/flow.md +119 -37
  107. package/docs/providers.md +37 -0
  108. package/npm-shrinkwrap.json +48 -6
  109. package/package.json +3 -2
  110. package/dist/bundle/chunks/chunk-JOKJ3CEL.js +0 -27
  111. package/dist/bundle/chunks/event-streams-CGCQQL5M.js +0 -2
  112. package/dist/bundle/chunks/virtual-modules-NPWQ6NBS.js +0 -5
@@ -1,6 +1,6 @@
1
1
  # Flow Profiles
2
2
 
3
- A Flow profile selects the models, limits, and spend cap for a HUMAIN Code Flow run. Profiles are implemented in `packages/flow/src/profiles/` and validated by the `FlowProfileV1` contract in `@humain/humain-code-contracts/flow-profile`.
3
+ A Flow profile selects the models, non-monetary limits, and spending warning thresholds for a HUMAIN Code Flow run. Profiles are implemented in `packages/flow/src/profiles/` and validated by the `FlowProfileV1` contract in `@humain/humain-code-contracts/flow-profile`.
4
4
 
5
5
  ## What a profile is
6
6
 
@@ -18,6 +18,7 @@ A profile is one JSON document with `schema: "humain-flow-profile"` and `schemaV
18
18
  | `sizing` | Optional, `kind: flow` only. Classifier policy id, `mediumAt` and `largeAt` thresholds, `triageRole`, `maxEscalations` (0 or 1). |
19
19
  | `limits` | `maxAgents` 1..256, `maxConcurrent` 1..64, `maxDepth` 0..3, `maxRetries` 0..16, `inactivityMs` 1..86400000, `ciWaitMs` 0..86400000. |
20
20
  | `spend` | `runCapMicrousd`, `warnAtPct` 1..99, optional `perRoleCapMicrousd`. |
21
+ | `modelSelection` | Optional, `kind: flow` only. Independent primary and fallback choices per cost tier and capability, plus capability effort. See [Model selection](#model-selection). Direct profiles reject it. |
21
22
  | `providers` | Optional `preference` list of provider ids (max 16). |
22
23
  | `approval`, `builtIn` | `builtIn: true` marks the shipped profiles. User profiles must not set it. |
23
24
 
@@ -30,10 +31,39 @@ Validation rules:
30
31
  - A model reference may not appear twice in one primary-plus-backups (or model-plus-fallbacks) list.
31
32
  - `sizing.thresholds.mediumAt` must be at most `largeAt`.
32
33
  - A profile file whose `digest` does not match its content is rejected.
34
+ - `modelSelection`, when present, is strict: unknown tiers, capabilities, or fields are rejected, each list holds at most 8 unique models, and a model may not appear twice in one primary-plus-backups list.
35
+
36
+ ## Model selection
37
+
38
+ `modelSelection` is an optional layer on a `kind: flow` profile. It lets one profile choose models by cost tier and by capability without collapsing capabilities that share a role.
39
+
40
+ ```json
41
+ "modelSelection": {
42
+ "tiers": {
43
+ "cheap": { "primary": { "provider": "openai-codex", "model": "gpt-6-luna" } },
44
+ "premium": { "backups": [] }
45
+ },
46
+ "capabilities": {
47
+ "technical_review": {
48
+ "primary": { "provider": "anthropic", "model": "claude-sonnet-5" },
49
+ "backups": [{ "provider": "openai-codex", "model": "gpt-6.1-sol" }],
50
+ "effort": "high"
51
+ }
52
+ }
53
+ }
54
+ ```
55
+
56
+ - Tiers: `cheap`, `mid`, `premium`, `frontier`; each holds optional `primary` and `backups`. Capabilities: the identifiers in `FLOW_MODEL_SELECTION_CAPABILITIES` (`scout`, `worker`, `lead`, `technical_review`, `qa_agent`, `architect`, `triage`, and so on); each also accepts `effort` (`off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`). Role `effort` stays `low|medium|high`.
57
+ - Primary and fallbacks inherit independently. Omitted `primary` inherits the next primary layer. Omitted `backups` inherits the next fallback layer. An explicit empty `backups: []` means no fallbacks. Flow never injects defaults, so the two states survive saving.
58
+ - Fallback lists hold at most eight unique models. Models are saved as exact provider and model ids; aliases are resolved before saving.
59
+ - Primary precedence for a run: `--model` capability flag, tier flag, profile capability selection, profile tier selection, role binding, then the existing fallback subject to residency. Fallback precedence: capability backups when declared, then tier backups when declared, then role backups.
60
+ - Failure recovery switches models only to fallbacks that the applicable declaration lists, in order. Residency alone is not permission, and unlisted higher-tier upgrades or provider transport twins are not appended. With no fallbacks configured, Flow will not switch models automatically. Bounded retries of the same model remain allowed. Mandatory safety review and policy escalation are separate from failure recovery.
61
+ - The whole selection is part of the profile digest and is frozen into each run's admission, with every declared primary and fallback counted as resident. Profiles and admissions written before this field existed keep their original digests and stay readable.
62
+ - Compatibility: readers that predate `modelSelection` reject profiles and admissions that carry it (strict schemas). Update every reader that parses these documents, such as Forge or evaluation tooling, before exchanging profiles in the new format.
33
63
 
34
64
  ## Built-in profiles
35
65
 
36
- Four read-only profiles ship in `packages/flow/assets/profiles/`. All are `kind: flow` with a run cap of 50000000 microusd.
66
+ Four read-only profiles ship in `packages/flow/assets/profiles/`. All are `kind: flow` with a warning-only run threshold of 50000000 microusd ($50). The existing `runCapMicrousd`, `perRoleCapMicrousd`, and admission `spendCapMicrousd` fields retain their validated monetary values; exceeding spending thresholds never stops work. Non-monetary limits remain enforced.
37
67
 
38
68
  | Id | lead | worker | reviewer | qa |
39
69
  | --- | --- | --- | --- | --- |
@@ -81,6 +111,8 @@ Every save (editor edit, clone, import) goes through the store lock and:
81
111
  5. Writes the watermark atomically, then the new file atomically: temp file `<file>.<pid>.<uuid>.tmp`, `fsync`, rename, then `fsync` of the containing directory. Files are created with mode `0600`.
82
112
  6. Prunes backups. The newest 10 versions per id and the newest 10 corrupt backups are kept. Pruning never fails a save.
83
113
 
114
+ `/flow setup` and `/flow models` saves use the same path, so they inherit the version and digest check. A conflicting save keeps your draft and asks you to reload; it never overwrites silently.
115
+
84
116
  `remove` writes and `fsync`s a backup of the file first (aborting if that fails), deletes the profile, `fsync`s the `profiles` directory, and clears `active-profile.json` if it pointed at that id. An unparseable file is backed up as `<id>.corrupt.<ms>-<8hex>.json`.
85
117
 
86
118
  ### Lock
@@ -107,10 +139,10 @@ A malformed active pointer, or one naming a profile that cannot be loaded, throw
107
139
 
108
140
  The result carries the profile and a frozen reference `{ id, version, digest }`.
109
141
 
110
- ## `/flow-profile` command
142
+ ## `/flow profile` command
111
143
 
112
144
  ```
113
- Usage: /flow-profile [subcommand]
145
+ Usage: /flow profile [subcommand]
114
146
  list list profiles
115
147
  show <id> show a profile
116
148
  use <id> set the active profile
@@ -126,7 +158,7 @@ No subcommand opens the interactive editor.
126
158
  - `validate` checks a file without importing it.
127
159
  - An unknown subcommand prints the usage text. With no subcommand and no UI, the command runs `list`.
128
160
 
129
- Output is stripped of ANSI escapes and control characters before display, because imported profile text is untrusted.
161
+ Output is stripped of ANSI escapes and control characters before display, because imported profile text is untrusted. Model choices are edited with `/flow models` and `/flow setup`; the interactive editor edits roles, limits, and spend thresholds.
130
162
 
131
163
  ### Interactive editor
132
164
 
@@ -139,6 +171,26 @@ Edits prompt for text values: role primary as `provider/model`, fallbacks as a c
139
171
 
140
172
  The editor only uses the standard `select`, `confirm`, and `input` dialogs. It adds no key bindings. Navigation uses the configurable `tui.select.*` bindings (see [keybindings.md](keybindings.md)).
141
173
 
174
+ ## `/flow setup`
175
+
176
+ `/flow setup` is a guided, terminal-only transaction: Accounts, Profile, Models, Validate, then Review and save. Outside the terminal UI it refuses and points to `/flow models` and `/flow profile`. It also respects the Flow kill switch.
177
+
178
+ 1. **Accounts.** Connect or manage providers through the host's own sign-in dialogs; secrets never pass through chat or extension input. Opening this stage reads stored metadata only: it does not run credential commands, refresh OAuth tokens, resolve reporting credentials, or use the network. Sign-in and global account changes take effect immediately and are not undone by cancelling setup. HUMAIN Node model discovery uses the selected key; if it fails you can retry or continue without HUMAIN Node. See [Providers](providers.md#flow-account-reporting).
179
+ 2. **Profile.** `Edit active profile` is offered first and `Create new profile` second; you must choose. A built-in profile is read-only, so customizing it creates a writable copy that stays in memory. A direct (single-model) profile cannot be edited here; create a new Flow profile instead. If the active profile cannot be loaded, setup stops rather than guess.
180
+ 3. **Models.** Tier primaries and ordered fallbacks, then optional capability overrides, with source layers shown. If two or more HUMAIN Node keys are stored (or the fallback is already on) you can also turn on the Node key fallback and order the keys. That choice is saved with the account metadata after the profile is saved, not inside the profile.
181
+ 4. **Validate.** Local checks first. Live connectivity checks run only after a separate consent that says they send requests to providers and may incur charges. They cover distinct declared primaries and fallbacks and can be skipped.
182
+ 5. **Review and save.** Shows the changes, spend warning thresholds, live-check result, and the activation consequence. Choose `Save`, `Save and make active`, `Save without activating`, or `Don't save`.
183
+
184
+ Drafts live in memory until Save. Cancelling at any stage writes no profile changes. Saving goes through the store's lock and version-and-digest check. If something else changed or created the profile in the meantime, setup keeps your draft and offers `Reload and review` or `Cancel setup` (or another id for a new profile). After a reload your model choices are applied on top of the newer version, its other settings are kept, and setup warns when the newer version also changed its model choices.
185
+
186
+ Saving and activation are independent. Saving the active profile updates what future runs use with no extra activation; runs that already started keep their frozen admission. Saving any other profile does not change the active profile unless you choose `Save and make active`. If a save succeeds but activation fails, setup says `Saved profile “<name>”, but activation failed. Use /flow profile use <id> to retry.`
187
+
188
+ Setup copy that has not yet been through user copy review is tracked in the copy ledger under `docs/superpowers/specs/`.
189
+
190
+ ## Legacy conversion
191
+
192
+ Legacy `orchestrator-profiles.json` profiles are not migrated automatically. `/flow models convert <LEGACY> <NEW-ID> [--from P]` shows a preview of a new versioned profile and asks before creating it; roles, limits, and spend thresholds come from the profile named by `--from` (default: the active one). Legacy settings that a versioned profile cannot represent block the conversion with a list of reasons, so safeguards are never silently dropped. See [Migration](../../flow/docs/migration.md).
193
+
142
194
  ## Selecting a profile for a run
143
195
 
144
196
  A run selects a profile with `--profile <id>`. If the flag is omitted, the active profile, then `premium`, is used (see Resolution order). The Flow loader registers `--profile <id>` and `--flow-admission <file>`. Flow resolves the selected profile, freezes it in `runs/<id>/admission.json` before dispatch, and uses that frozen profile for the run. A profile confines dispatch to its listed role primaries and backups; escalation and mandatory review cannot select models outside it. An unavailable role primary routes to the role's first resolvable listed backup that qualifies. Nested `subagent` launches by Flow children are restricted to the profile's models (`HUMAIN_ORCHESTRATOR_RESIDENT_MODELS`); a child running a shell command can still start the CLI directly (known limit).
package/docs/flow.md CHANGED
@@ -1,26 +1,51 @@
1
1
  # Flow
2
2
 
3
- Flow is the hierarchical agent harness built into HUMAIN Code. `/flow <goal>` plans a task, dispatches child agents (scouts, leads, workers, reviewers, QA), verifies the result, and reports it. This guide describes what is implemented in this checkout. Items that are not implemented are tagged `(planned)` with the plan section that covers them (the Flow harness implementation plan, streams A1, A2, A3, C1).
3
+ Flow is the hierarchical agent harness built into HUMAIN Code. `/flow run <goal>` plans a task, dispatches child agents (scouts, leads, workers, reviewers, QA), verifies the result, and reports it. This guide describes what is implemented in this checkout. Statements about behavior this checkout has not verified (builds, live provider entitlements, macOS recovery, billing accuracy) are labeled as limits; see [Known limits](../../flow/docs/known-limits.md).
4
4
 
5
- ## Flow versus direct prompts
5
+ ## One command
6
6
 
7
- A plain prompt goes to the normal session and never touches Flow. Flow runs only when you invoke one of its commands. Flow code is not loaded at startup: HUMAIN Code registers lightweight stub commands plus the `--profile` flag, and the first stub invocation performs one memoized dynamic import of the bundled Flow package. A failed load is reported as `Failed to load Flow: <message>` and is retried on the next invocation.
7
+ Flow has one slash command, `/flow`, with subcommands. Bare `/flow` shows help. Unknown subcommands are errors and never become goals: `/flow Fix the login timeout` answers `Unknown Flow command: Fix. Use /flow help to see available commands. To start work: /flow run <goal>`.
8
8
 
9
- Stub commands: `/flow`, `/flow-continue`, `/flow-status`, `/flow-cancel`, `/flow-pause`, `/flow-resume`, `/flow-title`, `/flow-models`, `/flow-profile`, `/omsg`.
9
+ | Command | What it does |
10
+ |---|---|
11
+ | `/flow run <goal> [flags]` | Start a run. |
12
+ | `/flow list` | List recent runs in this checkout (read-only). |
13
+ | `/flow status` | Open the live progress board. |
14
+ | `/flow cancel` | Stop the active run. |
15
+ | `/flow pause`, `/flow resume` | Stop new dispatch; release it again. |
16
+ | `/flow continue [run-id]` | Recover an interrupted run after a safety check and your confirmation. |
17
+ | `/flow title <title>` | Rename the active run. |
18
+ | `/flow message <text>` | Send guidance to the running lead. |
19
+ | `/flow hide`, `/flow show` | Hide or show the Flow widget; work continues. |
20
+ | `/flow models [subcommand]` | View and change model choices. |
21
+ | `/flow profile [subcommand]` | Manage saved run profiles. |
22
+ | `/flow setup` | Connect providers and configure Flow (terminal only). |
23
+ | `/flow help [command]` | Static usage and examples. |
24
+
25
+ Help and argument completion are static: they work before Flow loads and while Flow is disabled. Flow code is not loaded at startup. HUMAIN Code registers the lightweight `/flow` command plus the `--profile` and `--flow-admission` startup flags, and the first Flow-requiring invocation performs one memoized dynamic import of the bundled Flow package. A failed load is reported as `Failed to load Flow: <message>` and retried on the next invocation. A recognized subcommand that a build does not implement answers `/flow <command> is not available in this build. Use /flow help to see supported commands.`
26
+
27
+ A plain prompt goes to the normal session and never touches Flow. The previous per-command slash names are not registered and have no aliases; see [Migration](../../flow/docs/migration.md) for the old-to-new mapping. Internal tools, `flow_*` RPC operations, and run settlement contracts are unchanged.
10
28
 
11
- ## `/flow <goal>`
29
+ Flow payloads are passed through verbatim: the goal, message, or title text after the subcommand is never split or rejoined.
30
+
31
+ ## `/flow run <goal>`
12
32
 
13
33
  ```
14
- /flow <goal> [--task-class T] [--complexity N] [--risk low|medium|high|critical]
15
- [--profile NAME] [--lead-size small|standard|large]
16
- [--workflow direct|checked|led|full]
17
- [--cheap ALIAS] [--mid ALIAS] [--premium ALIAS] [--frontier ALIAS]
18
- [--model <capability>=ALIAS] [--effort LEVEL]
19
- [--quality-floor F] [--cost-aggressiveness C] [--max-retries R]
20
- [--context FILE ...] [--with-last-reply] [--force]
34
+ /flow run <goal> [--task-class T] [--complexity N] [--risk low|medium|high|critical]
35
+ [--profile ID] [--lead-size small|standard|large]
36
+ [--workflow direct|checked|led|full] [--effort LEVEL]
37
+ [--cheap ALIAS] [--mid ALIAS] [--premium ALIAS] [--frontier ALIAS]
38
+ [--model <capability>=ALIAS]
39
+ [--quality-floor F] [--cost-aggressiveness C] [--max-retries R] [--fan-out]
40
+ [--context FILE ...] [--with-last-reply] [--force]
41
+ [--route-only] [--candidate PATH]
42
+ [--live-qa | --no-live-qa] [--live-qa-adapter ID] [--live-qa-scope SCOPE]
43
+ [--live-qa-acceptance FILE]
21
44
  ```
22
45
 
23
- Flags are honored only before or after the goal text. A `--flag` between goal words is part of the goal. An unrecognized `--flag` that ends up inside the goal text (for example, a trailing `--size small`, where the value word makes the flag part of the goal) stays in the goal and is reported once as a warning: `Unknown flag(s) kept in the /flow goal text: ...`; the run still starts. Unrecognized flags in the leading or trailing flag block refuse the run. Values are not all validated by the parser: `--complexity` is rounded and clamped to 1-10, and a non-numeric value falls back to 5. `--risk` and `--task-class` are stored as given, and the parser does not check them against a list of allowed values. The parser also accepts other flags (`--fan-out`, `--candidate`, `--route-only`, `--live-qa`, `--no-live-qa`, `--live-qa-adapter`, `--live-qa-scope`, `--live-qa-acceptance`, `--check`); this guide covers only the flags above.
46
+ Flags are honored only before or after the goal text (the leading and trailing flag blocks). A `--flag` between goal words is part of the goal. An unrecognized `--flag` that ends up inside the goal text (for example a trailing `--size small`, where the value word makes the flag part of the goal) stays in the goal and is reported once as a warning: `Unknown flag(s) kept in the /flow goal text: ...`; the run still starts. Unrecognized flags in the leading or trailing flag block refuse the run. There is no `--size` flag. On `/flow run`, `--check` and `--live` are accepted by the parser but have no effect (`src/core/args.ts:467-469`). Values are not all validated by the parser: `--complexity` is rounded and clamped to 1-10, and a non-numeric value falls back to 5. `--risk` and `--task-class` are stored as given.
47
+
48
+ `/flow help run` lists these flags. Preparing a run (parsing flags, resolving the profile, freezing the admission) is not dispatch. Admission refusals end with `Nothing was dispatched.`
24
49
 
25
50
  Auto mode:
26
51
 
@@ -55,13 +80,13 @@ The run path uses `decideSize` and `sizeToWorkflow`. Telemetry retains the class
55
80
  For LARGE and legacy runs, workflow routing still applies:
56
81
 
57
82
  - A router reads repository evidence: risk path globs, interface changes across packages, candidate file count, nearby tests, and discovered checks. High risk or a protected path forces `full`. Wide scope or unresolved scope gives `led`. A single localized low-risk file with tests gives `direct`. Otherwise `checked`.
58
- - The workflow mode controls how much of this applies: `off` (no routing), `observe` (default in `method.json`; plans and records, runs lead/full hierarchy), `enforce` (also runs the flat `direct`/`checked` path). Show or persist it with `/flow-models workflow [off|observe|enforce|default]`. The env var `HUMAIN_ORCHESTRATOR_WORKFLOW_MODE` overrides the saved setting.
83
+ - The workflow mode controls how much of this applies: `off` (no routing), `observe` (default in `method.json`; plans and records, runs lead/full hierarchy), `enforce` (also runs the flat `direct`/`checked` path). Show or persist it with `/flow models workflow [off|observe|enforce|default]`. The env var `HUMAIN_ORCHESTRATOR_WORKFLOW_MODE` overrides the saved setting.
59
84
  - `--workflow <level>` overrides the routed level, but never below the hard floor; a lower request is rejected and recorded.
60
85
  - `--lead-size small|standard|large` sets the lead size directly. Otherwise lead size comes from triage complexity and risk.
61
86
 
62
87
  ### Size override
63
88
 
64
- There is still no user-facing `--size` flag on `/flow` (`--size` in the goal is not applied; see warning above). A size override comes only from a `FlowRunAdmissionV1` `sizeOverride` (`hc --flow-admission <file>`). With admission `sizeOverride: "small"` or `"medium"`, the run uses one implementer and deterministic checks regardless of advisory workflow floors. Only an explicit implementer scope-growth report can request the LARGE pipeline; actual out-of-candidate writes still block verification. A user-facing CLI `--size` flag is `(planned)` (plan section 3 A3 deliverable 3; section 3 D2 deliverable 1).
89
+ There is no user-facing `--size` flag on `/flow run` (`--size` in the goal is not applied; see the warning above). A size override comes only from a `FlowRunAdmissionV1` `sizeOverride` (`hc --flow-admission <file>`). With admission `sizeOverride: "small"` or `"medium"`, the run uses one implementer and deterministic checks regardless of advisory workflow floors. Only an explicit implementer scope-growth report can request the LARGE pipeline; actual out-of-candidate writes still block verification.
65
90
 
66
91
  ### Escalation
67
92
 
@@ -71,51 +96,107 @@ There is still no user-facing `--size` flag on `/flow` (`--size` in the goal is
71
96
  - On verification failure, retry leads can move up one lead capability tier.
72
97
  - SMALL/MEDIUM scope-growth transitions emit the original size and destination `large` in escalation telemetry. LARGE keeps its existing architecture and verification pipeline.
73
98
 
74
- ## `--profile`
99
+ ## Profiles and model choices
100
+
101
+ A run uses a versioned Flow profile (`FlowProfileV1`) from the profile store under `<agentDir>/flow`, or one of the four built-ins. Profile selection order is: `--profile <id>` on `/flow run`, then the startup flag `hc --profile <id>`, then the active profile, then `premium`. The id must match `^[a-z0-9][a-z0-9_.:-]{0,127}$`. A direct (single-model) profile is refused: `/flow` needs a `kind: flow` profile.
75
102
 
76
- `hc --profile <id>` registers a string flag. When `/flow` runs, it validates the id against `^[a-z0-9][a-z0-9_.:-]{0,127}$` and uses it unless `/flow` itself carried `--profile`. An invalid id is rejected with an error.
103
+ Before dispatch Flow resolves the profile and freezes it, with its sizing and spend thresholds, into `runs/<id>/admission.json` (`resolveProfile`, `buildCliAdmission`; see `packages/flow/src/run-admission.ts`). Later edits to the stored profile never change a started run; recovery reads and verifies the frozen admission and its digest. See [flow-profiles.md](flow-profiles.md) for the profile format.
77
104
 
78
- Today the id selects a profile in `orchestrator-profiles.json` (model bindings per tier and capability). Precedence for models is: flags, then profile, then the cost-tier resolver. An id not defined in that file produces a warning. Manage these with `/flow-models`.
105
+ `hc --flow-admission <file>` is a string startup flag and is authoritative for every `/flow` in the session. With it, `/flow run` parses no flags: the whole argument text after `run` is the goal, and flag-like tokens (`--force`, `--candidate`, `--context`, `--profile`, `--model`, `--route-only`, `--flow-admission`, and any other `--x` or `-y`) are left in the goal, not applied, and reported once as a warning (`Ignored flag(s) in the /flow goal: ...`). Combining startup `--profile` with startup `--flow-admission` is refused before dispatch.
79
106
 
80
- The versioned Flow profile store and the frozen run admission (`resolveProfile`, `buildCliAdmission`) exist in the Flow package but are not called by the `/flow` run path. Selecting them with `--profile`, and writing `admission.json` for each run, is `(planned)` (plan section 3 A2 deliverables 6 and 9; section 3 B1 deliverable 5). See [flow-profiles.md](flow-profiles.md). `hc --flow-admission <file>` is a string startup flag and is authoritative for every `/flow` in the session. With it, `/flow` parses no flags: the whole argument text is the goal, and flag-like tokens (`--force`, `--candidate`, `--context`, `--profile`, `--model`, `--route-only`, `--flow-admission`, and any other `--x` or `-y`) are left in the goal, not applied, and reported once as a warning (`Ignored flag(s) in the /flow goal: ...`). Combining startup `--profile` with startup `--flow-admission` is refused before dispatch.
107
+ Model choice for each capability is resolved independently for the primary model and for fallbacks:
108
+
109
+ - Primary, highest precedence first: `--model <capability>=ALIAS`, then a tier flag (`--cheap`, `--mid`, `--premium`, `--frontier`), then the profile's capability selection, then its tier selection, then the role binding, then the existing fallback (subject to the frozen profile's residency).
110
+ - Fallbacks: the capability's own list when it declares one, otherwise the tier's list when it declares one, otherwise the role's backups. A list holds at most eight unique models.
111
+ - A declaration that omits `backups` inherits the next layer. An explicit empty list (`[]`) means no fallbacks: Flow will not switch models automatically for that capability. Bounded retries of the same model remain allowed.
112
+ - After a model fails, Flow switches only to a fallback that the applicable declaration lists, in order. Being resident elsewhere in the profile is not permission, and Flow does not append unlisted higher-tier upgrades or provider transport twins. A higher-tier model is used for failure recovery only when you list it.
113
+ - Mandatory safety review and policy escalation are separate from failure recovery and are not removed by this rule.
114
+
115
+ Manage choices with `/flow models` (below) or `/flow setup`. For a run with a frozen profile, the legacy `orchestrator-profiles.json` file does not supply model bindings. It still stores the workflow mode (`/flow models workflow`) and a global provider preference, and it is the input to `/flow models convert`. Existing profiles and recorded admissions stay readable and keep their digests; adding `modelSelection` to a profile changes only that profile's digest.
116
+
117
+ ### `/flow models`
118
+
119
+ `/flow models` edits the same versioned store as `/flow profile`.
120
+
121
+ | Subcommand | Behavior |
122
+ |---|---|
123
+ | `show [PROFILE]` | Resolved table for the active (or named) profile. |
124
+ | `list` | Aliases you can use and the full catalog. |
125
+ | `validate [PROFILE] [--live]` | Offline check. `--live` sends a request to each configured model, asks first, and may incur charges; it needs an interactive session. |
126
+ | `check` | Same as `validate --live`. |
127
+ | `set <capability\|tier> <ALIAS> [--profile P]` | Save a primary model choice into a writable profile (built-ins are read-only; clone one first). |
128
+ | `effort <capability> <level\|none> [--profile P]` | Save or clear an effort override. |
129
+ | `pick [PROFILE]` | Interactive (TUI): tier primaries and ordered fallbacks first, then optional capability overrides. Nothing is saved when you cancel. |
130
+ | `use <PROFILE>`, `new <PROFILE> [--from P]` | Switch the active profile; create a writable copy. |
131
+ | `convert <LEGACY> <NEW-ID> [--from P]` | Preview a legacy `orchestrator-profiles.json` profile as a new versioned profile, then ask before creating it. Unrepresentable settings block the conversion instead of being dropped. The legacy profile and recorded admissions are never rewritten. |
132
+ | `workflow [off\|observe\|enforce\|default]` | Show or persist the workflow mode. |
133
+
134
+ Changes apply to future runs. Runs already started keep their frozen settings. Aliases such as `fable-5-1`, `opus-5-5`, `sonnet-5`, `gpt-6-sol`, `gpt-6-luna`, `astra` resolve against your configured models.
135
+
136
+ ### `/flow profile`
137
+
138
+ `list`, `show <id>`, `use <id>`, `export <id>`, `import <file> [--replace]`, `validate <file>`; with no subcommand and a UI it opens the interactive editor. See [flow-profiles.md](flow-profiles.md#flow-profile-command).
139
+
140
+ ### `/flow setup`
141
+
142
+ Terminal only. Setup walks five stages: Accounts, Profile, Models, Validate, Review and save. Sign-in and global account changes take effect immediately and are not undone by cancelling setup. Everything else is a draft held in memory until Save. The full transaction, conflict handling, and activation rules are in [flow-profiles.md](flow-profiles.md#flow-setup). Account usage reporting and the HUMAIN Node catalog behavior are in [providers.md](providers.md#flow-account-reporting).
81
143
 
82
144
  ## Run control and inspection
83
145
 
84
146
  | Command | Behavior |
85
147
  |---|---|
86
- | `/flow-status` | Opens the live orchestration board (TUI only; Esc closes it without cancelling the run). Outside the TUI it points to the `orchestrator_status` tool. Reports "No orchestrator run is active." when idle. |
87
- | `/flow-cancel` | Cancels the active run (reason `user`). Reports "no active run" when idle. |
88
- | `/flow-title <title>` | Renames the active flow and shows the title on the widget border. Errors with "no active run" when idle. |
89
- | `/flow-continue [run-id]` | Previews recovery of an interrupted run in its original checkout and asks for explicit confirmation. TUI only. There is no `--yes` or `--force`. With several candidates it lists them and requires an explicit run id. It blocks when ownership, bindings, or process-lineage evidence is unsafe, and asks you to confirm each unresolved external effect. |
90
- | `/flow-models <sub>` | Subcommands: `show`, `list`, `validate [--live]`, `check`, `set`, `effort`, `use`, `new`, `pick`, `workflow`. Aliases such as `fable-5-1`, `opus-5-5`, `sonnet-5`, `gpt-6-sol`, `gpt-6-luna`, `astra` resolve against your configured models. |
91
- | `/flow-profile` | Registered as a stub only. The Flow package exports a command implementation, but it is not registered, so the stub answers `/flow-profile is not available yet`. Registering it is `(planned)` (plan section 3 B1, deliverables 3 and 4). |
148
+ | `/flow list` | Lists recent runs in this checkout, including completed ones. Read-only. See History below. |
149
+ | `/flow status` | Opens the live orchestration board (TUI only; Esc closes it without cancelling the run). Outside the TUI it answers `The progress board requires interactive mode. Use the orchestrator_status tool to inspect the run.` With no run: `No active Flow run. Start one with /flow run <goal>.` |
150
+ | `/flow cancel` | Stops the active run (reason `user`): `Stopping Flow run…`. Idle: `No active Flow run to stop.` If child processes are not confirmed gone, Flow says so instead of claiming a clean stop. |
151
+ | `/flow pause` | Stops new dispatch. Running agents finish their current turn; no new agents start. Idle: `No active Flow run to pause.` |
152
+ | `/flow resume` | Releases a pause. Idle: `No paused Flow run to resume.` Refused while Flow is disabled. |
153
+ | `/flow title <title>` | Renames the active run and shows the title on the widget border. Idle: `No active Flow run to rename.` |
154
+ | `/flow message <text>` | See Messages below. |
155
+ | `/flow hide`, `/flow show` | See Widget below. |
156
+ | `/flow continue [run-id]` | Previews recovery of an interrupted run in its original checkout and asks for explicit confirmation. TUI only. There is no `--yes` or `--force`. With several candidates it lists them and requires an explicit run id. It blocks when ownership, bindings, or process-lineage evidence is unsafe, and asks you to confirm each unresolved external effect. |
157
+
158
+ ### History: `/flow list`
159
+
160
+ `/flow list` inspects at most 200 run directories, chosen by run creation time. Flow-generated run ids (`ht-orch-<ms>-<suffix>`) carry their creation time. A directory whose id has no parseable time is ordered by directory modification time and shown as `time unknown`. Neither the owner process start time nor an invented completion time is used. Rows show run id, status, and goal, with confirmed interrupted runs first, then newest first. If more than 200 directories exist, the output says older runs are not listed.
161
+
162
+ Coverage is partial by design. Directories without a readable, safe execution snapshot, or whose snapshot belongs to another checkout or fails consistency checks, are not listed; skipped counts are reported. An empty list means `No readable Flow runs found in the inspected history`, not that no runs exist. Status comes from the saved record and owner process evidence, so an `interrupted` or `unknown` run may still be live elsewhere or unsafe to recover. Listing is separate from recovery: it never claims ownership, reconciles effects, or starts a recovery, and `/flow continue <run-id>` still performs its own safety checks and confirmation. `/flow continue` with nothing eligible says `No recoverable Flow runs found. Use /flow list to view recent runs.`
163
+
164
+ ### Widget: `/flow hide`, `/flow show`
165
+
166
+ Hide and show change only the current run's widget. Execution, telemetry, status, and cancellation are unaffected. Every new run starts visible. Opening or closing the board does not change visibility. A hidden widget stays hidden when the run finishes: its final snapshot is retained, the completed, failed, or stopped notice still appears, and `/flow show` reveals the retained final snapshot until a new run starts. Without one, `/flow show` answers `No current Flow widget to show.` Hide and show stay available for an existing run while Flow is disabled because they affect presentation only.
167
+
168
+ ### Pause semantics
92
169
 
93
- ### Pause and resume `(planned)`
170
+ `/flow pause` closes a gate that is checked before every new child dispatch. It does not interrupt a child that is already running, so the run may keep working until those children finish. `/flow resume` reopens the gate. The same control handler serves the RPC verbs `flow_pause`, `flow_resume`, `flow_status`, `flow_cancel` and `flow_message`; their contracts are in `packages/humain-code-contracts/src/flow-control.ts`.
94
171
 
95
- `/flow-pause` and `/flow-resume` are loader stubs with no Flow implementation. Invoking them after Flow loads prints `/flow-pause is not available yet` (or `/flow-resume ...`). Planned semantics (plan section 3 A2 deliverables 7 and 8; section 4.4): stop new dispatch, let running children finish their current turn, then hold until resume. Run-control contracts exist in `packages/humain-code-contracts/src/flow-control.ts`. The runtime control handlers (`flow_pause`, `flow_resume`, `flow_status`, `flow_cancel`, `flow_message`) and the `packages/flow/src/control/` module do not exist in this checkout and are `(planned)`.
172
+ ### Messages: `/flow message <text>`
96
173
 
97
- ### Mid-run messages: `/omsg <text>`
174
+ Delivery depends on the run:
98
175
 
99
- `/omsg` queues a message for the running run. The message is appended to the prompt of the next dispatched task. It is not injected into a running child, because children run without a stdin channel. A literal `\n` becomes a newline. Messages are truncated to a length cap, and the oldest message is dropped when the queue is full. With no active run it warns and does nothing.
176
+ - Live: with an active run and a steerable lead, the message is sent to the lead immediately (`Message delivered to the running lead.`).
177
+ - Held: if no lead is steerable yet (none started, the previous lead exited, or earlier held messages are still draining), the message is held and delivered in send order when a lead starts (`Message queued: the lead receives it when it starts.`). Held messages are rejected without a further notice if the run ends before a lead starts.
178
+ - Idle: with no Flow running, the message is sent to the host session as a follow-up (`No Flow is running: message sent to the host as a follow-up.`).
100
179
 
101
- Live delivery to the running lead, with queued delivery only in direct mode, is `(planned)` (plan section 3 A2 deliverable 7; section 4.4). Today `/omsg` is always queued.
180
+ A literal `\n` becomes a newline. Text over 16000 characters is rejected, and at most 32 messages are held. A message is rejected when the run is closing or cancelled, or when it names a child that is not steerable (`Message rejected: no running lead to receive it.`).
102
181
 
103
182
  ## Kill switch
104
183
 
105
- Flow can be disabled without affecting direct prompts. Either of these makes every Flow command answer `Flow disabled (<reason>). /<command> is unavailable.` before anything loads:
184
+ Flow can be disabled without affecting direct prompts. Either of these makes `/flow` subcommands that start or change work answer `Flow disabled (<reason>). /flow <command> is unavailable.` before anything loads:
106
185
 
107
186
  - Environment variable `HUMAIN_TERMINAL_FLOW_DISABLED` set to `1` or `true` (case-insensitive, trimmed).
108
187
  - Setting `flow.enabled` set to `false` in `settings.json`.
109
188
 
110
- Plain prompts do not go through Flow, so they keep working.
189
+ `/flow help` and completion keep working. `cancel`, `status`, `pause`, `hide`, and `show` stay available for an already loaded run. `resume` is refused. Plain prompts do not go through Flow, so they keep working.
111
190
 
112
191
  ## Failure handling
113
192
 
114
- - Terminal outcomes are `completed`, `failed`, or `cancelled`. A failed run is reported as a terminal notification with a title and reason text (for example "Orchestration needs attention" or "Orchestration crashed"). Each lead report carries a status of `completed`, `partial`, `blocked`, or `unknown` (parsed from its `STATUS:` line). The aggregate run outcome is separate: `blocked`, `dispatched`, or `failed`. It is `failed` when there are no leads or no lead exited cleanly, and `blocked` only when every lead exits cleanly and reports `blocked` (`src/run-outcome.ts:18-27,48-66`).
115
- - Flow does not re-run a failed `/flow` as a direct prompt. I found no such code path, so a failed run is reported, not hidden.
116
- - After a failed fresh CLI run, Flow shows the failure class (for example `Flow run failed (crash)`) and offers "Retry as Flow" or "Retry direct" through a select. Dismissing the select does nothing. There is no offer for cancelled, `budget_stop`, recovered (`/flow-continue`) or `--flow-admission` runs. "Retry as Flow" respects the kill switch and starts a new run; "Retry direct" sends the goal as a normal prompt.
117
- - Contracts for the typed settlement fields (`run_settled`, `failureClass`, `retryOffer`) exist in `packages/humain-code-contracts/src/flow-events.ts`. The spend cap enforced from an admission is `(planned)` (plan sections 3 C1, 4.3).
118
- - Spend limits today: the per-dispatch cap in `method.json` (`dispatch_spend_cap`, default mode `warn`), and the run cancellation when reported plus estimated spend exceeds `SENTINEL_CHILD_MAX_COST_USD` from a HUMAIN Sentinel parent (`packages/flow/src/extension.ts:1155-1163`).
193
+ - Terminal outcomes are `completed`, `failed`, or `cancelled` (shown as stopped). A failed run is reported as a terminal notification with a title and reason text. Each lead report carries a status of `completed`, `partial`, `blocked`, or `unknown` (parsed from its `STATUS:` line). The aggregate run outcome is separate: `blocked`, `dispatched`, or `failed`. It is `failed` when there are no leads or no lead exited cleanly, and `blocked` only when every lead exits cleanly and reports `blocked` (`src/run-outcome.ts:18-27,48-66`).
194
+ - Titles read `Flow run completed`, `Flow run failed`, `Flow run stopped`, or `Automated checks were unavailable`. Unavailable checks are never reported as passed or as a plain failure, review and QA evidence stays in the run summary, and a stopped run does not claim its edits were rolled back or that termination was confirmed without proof.
195
+ - Flow does not re-run a failed `/flow` as a direct prompt unless you choose to.
196
+ - After a failed fresh CLI run that is eligible, Flow offers "Retry with Flow", "Retry as normal prompt" or "Not now" through a select titled with the failure reason (for example `Flow run failed. Unexpected error.`). Dismissing the select does nothing. Not every failure is eligible: there is no offer for cancelled, `budget_stop`, recovered (`/flow continue`) or `--flow-admission` runs, and narrower rules apply per failure class. "Retry with Flow" respects the kill switch and starts a new run; "Retry as normal prompt" sends the goal as a normal prompt.
197
+ - Contracts for the typed settlement fields (`run_settled`, `failureClass`, `retryOffer`) exist in `packages/humain-code-contracts/src/flow-events.ts`.
198
+ - All monetary thresholds are warning-only: per-dispatch/per-role/lead limits, the frozen admission's run threshold (built-ins: $50), recovery spending ceilings, and `SENTINEL_CHILD_MAX_COST_USD`. Legacy `dispatch_spend_cap.mode=enforce` now warns, never cancels. Accurate spending telemetry and threshold warnings remain; no spending is reset or hidden. Non-monetary limits and safety checks remain enforced.
199
+ - `/flow continue <run-id>` can recover an old budget-stopped run without reset. It preserves the ledger and frozen admission, and retries unfinished leads instead of marking them successful. Confirmation, original-checkout identity, ownership/process-lineage checks, effect reconciliation, validation, and retry ceilings still apply. See [tracking.md](../../flow/docs/tracking.md#spend-accounting).
119
200
 
120
201
  ## Related
121
202
 
@@ -123,3 +204,4 @@ Plain prompts do not go through Flow, so they keep working.
123
204
  - [Flow profiles reference](../../flow/docs/profiles.md)
124
205
  - [Known limits](../../flow/docs/known-limits.md)
125
206
  - [Migration](../../flow/docs/migration.md)
207
+ - [Providers and accounts](providers.md)
package/docs/providers.md CHANGED
@@ -190,6 +190,8 @@ export AWS_REGION=us-west-2
190
190
 
191
191
  HUMAIN Code CLI also supports ECS task credentials and IRSA through the standard `AWS_CONTAINER_CREDENTIALS_*` and `AWS_WEB_IDENTITY_TOKEN_FILE` variables.
192
192
 
193
+ A bearer token authenticates inference only. Bedrock usage reporting needs AWS credentials, not a bearer token; see [Flow account reporting](#flow-account-reporting).
194
+
193
195
  ### Cloudflare AI Gateway
194
196
 
195
197
  The gateway requires a token, account ID, and gateway ID:
@@ -255,8 +257,43 @@ Node's `max_output_tokens: 0` means the output limit is unknown. The model remai
255
257
 
256
258
  Token and cache usage reported by Node flows into the normal session statistics. The supplied API does not expose account spend, remaining quota, or model prices: zero-valued internal cost fields mean pricing is unavailable, not free usage. Use HUMAIN Node for billing and account usage reports.
257
259
 
260
+ Flow setup discovers models with the selected key's `/models` call. Setup waits for a fresh, non-empty catalog for that key. An empty catalog, a rejected key, an unreachable service, or a failed refresh is shown as unavailable with the reason category, and setup offers `Retry` or `Continue without HUMAIN Node`; Flow never invents Node models or reuses another key's catalog. Keys for one Node user share that user's controls.
261
+
262
+ `Usage reporting is not yet supported for HUMAIN Node.` This sentence is shown in Advanced for the provider. The supplied API does not expose account spend or remaining quota, so no Node figures are reported.
263
+
258
264
  Failed requests include the supplied `X-Request-ID`. Temporary failures use bounded retries that respect `Retry-After`; quota and weekly-spend limits require action in Node. If a model becomes unavailable, open `/model` to refresh the catalog and select an available model. Run `/logout` and select **HUMAIN Node** to remove saved credentials; unset `HUMAIN_NODE_API_KEY` as well to disconnect an environment-based key.
259
265
 
266
+ ### Node key fallback
267
+
268
+ Use another HUMAIN Node key when this key fails or reaches a limit. It is off by default and does not make Node a subscription provider; ordinary API keys of other providers never rotate. When enabled, an ordered list of stored Node API-key accounts is tried after the serving key fails with a 401 `invalid_api_key` or `missing_api_key` (key absent, revoked, inactive or incorrect), or a 429 `rate_limit_exceeded`, `weekly_cap_exceeded`, `quota_exceeded` or `partner_credit_limit_exceeded`. On `/messages` the code is read from the Anthropic envelope's `error.type`; a generic `authentication_error` or `rate_limit_error` without a Node code never switches keys. The same request is retried on the next usable listed key, same provider and model, once per key per prompt, only before any output or tool execution. Invalid requests (400), `model_not_found` (404), outages (5xx) and unparsable or unclassified errors never switch keys.
269
+
270
+ A `Retry-After` header marks the failed key unavailable until that time. Without one, a rate-limited key is skipped for one minute and an invalid, revoked, capped or over-quota key for 30 minutes. Fallback stays on the serving key's endpoint unless the policy explicitly allows crossing endpoints. Keys that belong to one Node user share its limits, so a second key there helps only when a key is invalid or revoked.
271
+
272
+ Policy, ordered key list, user labels and environment labels (for example Production or Staging) are saved in `humain-node-accounts.json` next to `auth.json` (mode `0600`). The file holds opaque account keys and labels, never API keys. Aliases are the account labels from `/accounts`. Switch notices name aliases only: `HUMAIN Node key “<alias>” failed (<reason>). Using “<next alias>”.` Keys supplied only through `HUMAIN_NODE_API_KEY` are not stored accounts and cannot be fallback targets.
273
+
274
+ ### Flow account reporting
275
+
276
+ `/flow setup` and the account views show provider details in an Advanced section. Opening Accounts or Advanced reads stored metadata only: it does not run credential commands, refresh OAuth tokens, resolve reporting credentials, or make network requests. Reporting starts only when you choose `Refresh usage`. Paid connectivity checks are separate and need their own consent in the Validate stage (`Run live checks`). Every report names its source, account or source, UTC period, region where relevant, reset time where the source gives one, and the time it was last updated. Configured and effective accounts are labeled `Configured — not verified`; a check result is shown with the scope and time it covered.
277
+
278
+ Unsupported, unauthorized, empty, partial, stale and malformed answers are never turned into zero. Each is shown as its own state: `Account usage is unavailable: <reason>. <next action>.`, `No usage was reported for this period. This is not a zero count.`, `Partial results: ... Totals may be incomplete.`, or `Stale: last observed ...; refresh to update.` Reports are bounded by a deadline and per-request timeouts, can be cancelled, are cached separately per account, source, region and period, and show fixed safe reasons rather than provider error text.
279
+
280
+ | Provider | Source and scope |
281
+ |---|---|
282
+ | OpenAI Codex | The existing Codex weekly usage lookup for a stored `openai-codex` sign-in, shown as weekly allowance remaining with its reset time. An expired sign-in is reported as expired; reporting does not refresh it. An `openai` API key is a different provider and gets no figures, and nothing links the two. |
283
+ | Anthropic API key | Rate-limit windows (requests and tokens limit, remaining, reset) read from the response headers of requests this session already made with that key. `Refresh usage` never sends a request to Anthropic, so a key not yet used reports that no response was observed. These are API windows, never a Claude subscription allowance, and Claude subscription sign-ins report none here. |
284
+ | Anthropic organization | Usage from the Admin API usage report, a separate source that needs provisioned Admin reporting credentials and is never linked to ordinary API keys. This host has no secure provisioning path yet, so it normally reports `reporting credentials not configured`; nothing prompts for an admin secret. |
285
+ | Amazon Bedrock | Amazon CloudWatch metrics, described below. |
286
+ | HUMAIN Node | `Usage reporting is not yet supported for HUMAIN Node.` |
287
+ | Other providers | No usage reporting is claimed; Advanced shows configured state only. |
288
+
289
+ The reporting period is the current UTC calendar day. These figures are not invoices, billing totals, remaining quota, or proof of model access.
290
+
291
+ #### Bedrock CloudWatch totals
292
+
293
+ Bedrock reporting reads `Invocations`, `InputTokenCount` and `OutputTokenCount` from the `AWS/Bedrock` namespace with the `ModelId` dimension, in the region saved with the account, for the UTC period, using the AWS SDK for CloudWatch (loaded only when you refresh). Each model's series is counted once; aggregate series without `ModelId` and series with extra dimensions overlap the per-model series and are never added. Totals are regional and are not summed across regions. Flow follows every result page; if AWS answers only partly (missing pages, repeated tokens, a metric with no data, or a stopped refresh), the totals are labeled partial.
294
+
295
+ It needs AWS credentials saved through Connect (profile, SSO, role, IAM keys, or environment) plus a region, and the IAM identity needs `cloudwatch:ListMetrics` and `cloudwatch:GetMetricData`. A Bedrock API key (bearer token) cannot read CloudWatch, so it cannot report usage, and nothing falls back to another account's credentials. Without a region or AWS credentials account the report says what to connect. Metric delay, missing permissions and missing series are shown as such, not as zero.
296
+
260
297
  <a id="openai-codex-account-pooling"></a>
261
298
 
262
299
  ## Account pooling
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "@humain/humain-code",
3
- "version": "0.4.9",
3
+ "version": "0.4.10",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@humain/humain-code",
9
- "version": "0.4.9",
9
+ "version": "0.4.10",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "@humain/humain-code-contracts": "0.4.9",
12
+ "@humain/humain-code-contracts": "0.4.10",
13
13
  "@aws-sdk/client-bedrock-runtime": "3.1146.0",
14
+ "@aws-sdk/client-cloudwatch": "3.1146.0",
14
15
  "@earendil-works/pi-agent-core": "1.1.0",
15
16
  "@earendil-works/pi-ai": "1.1.0",
16
17
  "@earendil-works/pi-codemode": "1.1.0",
@@ -108,6 +109,26 @@
108
109
  "node": ">=20.0.0"
109
110
  }
110
111
  },
112
+ "node_modules/@aws-sdk/client-cloudwatch": {
113
+ "version": "3.1146.0",
114
+ "resolved": "https://registry.npmjs.org/@aws-sdk/client-cloudwatch/-/client-cloudwatch-3.1146.0.tgz",
115
+ "integrity": "sha512-K84tWT/Xe21eSZK7NzkqNT15jctmTg5QjAylDOI2PLcq6yV14ydhXmc/JFptv8kimDC3IKgN3+UoX/NSuXC1jQ==",
116
+ "license": "Apache-2.0",
117
+ "dependencies": {
118
+ "@aws-sdk/core": "^3.978.1",
119
+ "@aws-sdk/credential-provider-node": "^3.972.84",
120
+ "@aws-sdk/types": "^3.974.6",
121
+ "@smithy/core": "^3.35.0",
122
+ "@smithy/fetch-http-handler": "^5.8.0",
123
+ "@smithy/middleware-compression": "^4.6.2",
124
+ "@smithy/node-http-handler": "^4.12.1",
125
+ "@smithy/types": "^4.19.0",
126
+ "tslib": "^2.6.2"
127
+ },
128
+ "engines": {
129
+ "node": ">=20.0.0"
130
+ }
131
+ },
111
132
  "node_modules/@aws-sdk/core": {
112
133
  "version": "3.978.1",
113
134
  "resolved": "https://registry.npmjs.org/@aws-sdk/core/-/core-3.978.1.tgz",
@@ -1024,9 +1045,9 @@
1024
1045
  "hasInstallScript": true
1025
1046
  },
1026
1047
  "node_modules/@humain/humain-code-contracts": {
1027
- "version": "0.4.9",
1028
- "resolved": "https://registry.npmjs.org/@humain/humain-code-contracts/-/humain-code-contracts-0.4.9.tgz",
1029
- "integrity": "sha512-I/faw9SaHLRwJYusadiDCdcm/Das0ISRLX9QrHlKeYIYHjvn6MffFMzp9PMJbT1AEiZIjeO7bXfNsmr198t73A==",
1048
+ "version": "0.4.10",
1049
+ "resolved": "https://registry.npmjs.org/@humain/humain-code-contracts/-/humain-code-contracts-0.4.10.tgz",
1050
+ "integrity": "sha512-GhUkIhqYGZBUXonZ48OqllzcJZ/tNjvS8AFDg/JsSuFJyGjfzbkhoNIdNXcdJu1tiS3xg5hQDyAlkP2mD7ddOw==",
1030
1051
  "license": "MIT",
1031
1052
  "dependencies": {
1032
1053
  "typebox": "1.3.35"
@@ -1357,6 +1378,21 @@
1357
1378
  "node": ">=18.0.0"
1358
1379
  }
1359
1380
  },
1381
+ "node_modules/@smithy/middleware-compression": {
1382
+ "version": "4.6.2",
1383
+ "resolved": "https://registry.npmjs.org/@smithy/middleware-compression/-/middleware-compression-4.6.2.tgz",
1384
+ "integrity": "sha512-Q9d+luiRjyHT6kCL/9NyGpdZJgodh4vtvfHC6H8SqoVKrV2k9RoyI9/IloVfdCYks3/2DIi7BsYYLcda5KZS0A==",
1385
+ "license": "Apache-2.0",
1386
+ "dependencies": {
1387
+ "@smithy/core": "^3.33.2",
1388
+ "@smithy/types": "^4.17.2",
1389
+ "fflate": "0.8.3",
1390
+ "tslib": "^2.6.2"
1391
+ },
1392
+ "engines": {
1393
+ "node": ">=18.0.0"
1394
+ }
1395
+ },
1360
1396
  "node_modules/@smithy/node-http-handler": {
1361
1397
  "version": "4.12.1",
1362
1398
  "resolved": "https://registry.npmjs.org/@smithy/node-http-handler/-/node-http-handler-4.12.1.tgz",
@@ -2160,6 +2196,12 @@
2160
2196
  }
2161
2197
  ]
2162
2198
  },
2199
+ "node_modules/fflate": {
2200
+ "version": "0.8.3",
2201
+ "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.3.tgz",
2202
+ "integrity": "sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA==",
2203
+ "license": "MIT"
2204
+ },
2163
2205
  "node_modules/for-each": {
2164
2206
  "version": "0.3.5",
2165
2207
  "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humain/humain-code",
3
- "version": "0.4.9",
3
+ "version": "0.4.10",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "humainTerminalConfig": {
@@ -86,8 +86,9 @@
86
86
  "prepublishOnly": "npm run clean && npm run build && npm run shrinkwrap"
87
87
  },
88
88
  "dependencies": {
89
- "@humain/humain-code-contracts": "0.4.9",
89
+ "@humain/humain-code-contracts": "0.4.10",
90
90
  "@aws-sdk/client-bedrock-runtime": "3.1146.0",
91
+ "@aws-sdk/client-cloudwatch": "3.1146.0",
91
92
  "@earendil-works/pi-agent-core": "1.1.0",
92
93
  "@earendil-works/pi-ai": "1.1.0",
93
94
  "@earendil-works/pi-codemode": "1.1.0",
@@ -1,27 +0,0 @@
1
- import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- import{ACCOUNT_RETURN_COOLDOWN_MS,ACCOUNT_RETURN_MAX_COOLDOWN_MS,AgentExecInputError,AgentSession,AgentSessionRuntime,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ExtensionEditorComponent,ExtensionInputComponent,ExtensionRunner,ExtensionSelectorComponent,FooterComponent,
3
- InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthAccountPool,OAuthSelectorComponent,RpcClient,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,SkillInvocationMessageComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,VIRTUAL_MODEL_STATE_ENTRY,calculateContextTokens,collectEntriesForBranchSummary,compact,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,
4
- createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodemodeExtension,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLocalPowerShellOperations,createLsTool,createLsToolDefinition,createMcpExtension,createPiAgentExecutionHost,createPowerShellTool,createPowerShellToolDefinition,createReadOnlyTools,
5
- createReadTool,createReadToolDefinition,createSubagentTool,createSyntheticSourceInfo,createToolSearchExtension,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAgents,discoverAndLoadExtensions,estimateTokens,executeHumainAgentRequest,findCutPoint,findTurnStartIndex,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getFlowChildLaunchHost,getFlowControlHost,getFlowTraceProducer,
6
- getLastAssistantUsage,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,parseArgs,parseFrontmatter,parseSkillBlock,prepareBranchEntries,prepareChildLaunch,renderDiff,renderTaskWithContext,resolveCliModel,resolveModelScopeWithDiagnostics,runAgentExecMode,runPrintMode,runRpcMode,serializeConversation,shouldCompact,stripFrontmatter,
7
- withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunk-6FVNSW6B.js";import{ProjectTrustStore,hasTrustRequiringProjectResources}from"./chunk-KRMTBTWU.js";import{CURRENT_SESSION_VERSION,SessionManager,buildContextEntries,buildSessionContext,buildSessionProjection,convertToLlm,formatDimensionNote,getLatestCompactionEntry,migrateSessionEntries,parseSessionEntries,resizeImage,sessionEntryToContextMessages}from"./chunk-EMYNPLY5.js";import{readStoredCredential}from"./chunk-F7UMX5BV.js";
8
- import{DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,formatSize,getPowerShellConfig,getShellConfig,truncateHead,truncateLine,truncateTail,truncateToVisualLines}from"./chunk-PMISFIBM.js";import{ArminComponent}from"./chunk-GUUAEK6G.js";import{Container,SelectList,Theme,getAvailableThemes,getLanguageFromPath,getMarkdownTheme,getSelectListTheme,getSettingsListTheme,highlightCode,initTheme,keyHint,keyText,rawKeyHint}from"./chunk-LQ4S7CRR.js";import{HUMAIN_AGENT_EXECUTION_FAILURE_CODES,HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION,
9
- HumainAgentArtifactSchema,HumainAgentExecutionClaimSchema,HumainAgentExecutionControlsSchema,HumainAgentExecutionOutcomeSchema,HumainAgentExecutionRequestSchema,HumainAgentExecutionResponseSchema,HumainAgentRouteRefSchema,HumainAgentUsageSchema,parseHumainAgentExecutionRequest,parseHumainAgentExecutionResponse}from"./chunk-4LAKI5IL.js";import{CONFIG_DIR_NAME,UPSTREAM_PI_VERSION,VERSION,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath}from"./chunk-3E4SMILM.js";import{
10
- __export}from"./chunk-JXWJOIH4.js";var dist_exports={};__export(dist_exports,{ACCOUNT_RETURN_COOLDOWN_MS:()=>ACCOUNT_RETURN_COOLDOWN_MS,ACCOUNT_RETURN_MAX_COOLDOWN_MS:()=>ACCOUNT_RETURN_MAX_COOLDOWN_MS,AgentExecInputError:()=>AgentExecInputError,AgentSession:()=>AgentSession,AgentSessionRuntime:()=>AgentSessionRuntime,ArminComponent:()=>ArminComponent,AssistantMessageComponent:()=>AssistantMessageComponent,BashExecutionComponent:()=>BashExecutionComponent,BorderedLoader:()=>BorderedLoader,BranchSummaryMessageComponent:()=>BranchSummaryMessageComponent,
11
- CONFIG_DIR_NAME:()=>CONFIG_DIR_NAME,CURRENT_SESSION_VERSION:()=>CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent:()=>CompactionSummaryMessageComponent,CredentialSynchronizationError:()=>CredentialSynchronizationError,CustomEditor:()=>CustomEditor,CustomMessageComponent:()=>CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS:()=>DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES:()=>DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES:()=>DEFAULT_MAX_LINES,DefaultPackageManager:()=>DefaultPackageManager,DefaultResourceLoader:()=>DefaultResourceLoader,
12
- DynamicBorder:()=>DynamicBorder,ExtensionEditorComponent:()=>ExtensionEditorComponent,ExtensionInputComponent:()=>ExtensionInputComponent,ExtensionRunner:()=>ExtensionRunner,ExtensionSelectorComponent:()=>ExtensionSelectorComponent,FooterComponent:()=>FooterComponent,HUMAIN_AGENT_EXECUTION_FAILURE_CODES:()=>HUMAIN_AGENT_EXECUTION_FAILURE_CODES,HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION:()=>HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION,HumainAgentArtifactSchema:()=>HumainAgentArtifactSchema,HumainAgentExecutionClaimSchema:()=>HumainAgentExecutionClaimSchema,
13
- HumainAgentExecutionControlsSchema:()=>HumainAgentExecutionControlsSchema,HumainAgentExecutionOutcomeSchema:()=>HumainAgentExecutionOutcomeSchema,HumainAgentExecutionRequestSchema:()=>HumainAgentExecutionRequestSchema,HumainAgentExecutionResponseSchema:()=>HumainAgentExecutionResponseSchema,HumainAgentRouteRefSchema:()=>HumainAgentRouteRefSchema,HumainAgentUsageSchema:()=>HumainAgentUsageSchema,InteractiveMode:()=>InteractiveMode,LoginDialogComponent:()=>LoginDialogComponent,ModelRegistry:()=>ModelRegistry,
14
- ModelRuntime:()=>ModelRuntime,ModelSelectorComponent:()=>ModelSelectorComponent,OAuthAccountPool:()=>OAuthAccountPool,OAuthSelectorComponent:()=>OAuthSelectorComponent,ProjectTrustStore:()=>ProjectTrustStore,RpcClient:()=>RpcClient,SessionManager:()=>SessionManager,SessionSelectorComponent:()=>SessionSelectorComponent,SettingsManager:()=>SettingsManager,SettingsSelectorComponent:()=>SettingsSelectorComponent,ShowImagesSelectorComponent:()=>ShowImagesSelectorComponent,SkillInvocationMessageComponent:()=>SkillInvocationMessageComponent,
15
- Theme:()=>Theme,ThemeSelectorComponent:()=>ThemeSelectorComponent,ThinkingSelectorComponent:()=>ThinkingSelectorComponent,ToolExecutionComponent:()=>ToolExecutionComponent,TreeSelectorComponent:()=>TreeSelectorComponent,UPSTREAM_PI_VERSION:()=>UPSTREAM_PI_VERSION,UserMessageComponent:()=>UserMessageComponent,UserMessageSelectorComponent:()=>UserMessageSelectorComponent,VERSION:()=>VERSION,VIRTUAL_MODEL_STATE_ENTRY:()=>VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries:()=>buildContextEntries,buildSessionContext:()=>buildSessionContext,
16
- buildSessionProjection:()=>buildSessionProjection,calculateContextTokens:()=>calculateContextTokens,collectEntriesForBranchSummary:()=>collectEntriesForBranchSummary,compact:()=>compact,convertToLlm:()=>convertToLlm,convertToPng:()=>convertToPng,copyToClipboard:()=>copyToClipboard,createAgentSession:()=>createAgentSession,createAgentSessionFromServices:()=>createAgentSessionFromServices,createAgentSessionRuntime:()=>createAgentSessionRuntime,createAgentSessionServices:()=>createAgentSessionServices,
17
- createBashTool:()=>createBashTool,createBashToolDefinition:()=>createBashToolDefinition,createCodemodeExtension:()=>createCodemodeExtension,createCodingTools:()=>createCodingTools,createEditTool:()=>createEditTool,createEditToolDefinition:()=>createEditToolDefinition,createEventBus:()=>createEventBus,createExtensionRuntime:()=>createExtensionRuntime,createFindTool:()=>createFindTool,createFindToolDefinition:()=>createFindToolDefinition,createGrepTool:()=>createGrepTool,createGrepToolDefinition:()=>createGrepToolDefinition,
18
- createLocalBashOperations:()=>createLocalBashOperations,createLocalPowerShellOperations:()=>createLocalPowerShellOperations,createLsTool:()=>createLsTool,createLsToolDefinition:()=>createLsToolDefinition,createMcpExtension:()=>createMcpExtension,createPiAgentExecutionHost:()=>createPiAgentExecutionHost,createPowerShellTool:()=>createPowerShellTool,createPowerShellToolDefinition:()=>createPowerShellToolDefinition,createReadOnlyTools:()=>createReadOnlyTools,createReadTool:()=>createReadTool,createReadToolDefinition:()=>createReadToolDefinition,
19
- createSubagentTool:()=>createSubagentTool,createSyntheticSourceInfo:()=>createSyntheticSourceInfo,createToolSearchExtension:()=>createToolSearchExtension,createWriteTool:()=>createWriteTool,createWriteToolDefinition:()=>createWriteToolDefinition,defineTool:()=>defineTool,detectSupportedImageMimeTypeFromFile:()=>detectSupportedImageMimeTypeFromFile,discoverAgents:()=>discoverAgents,discoverAndLoadExtensions:()=>discoverAndLoadExtensions,estimateTokens:()=>estimateTokens,executeHumainAgentRequest:()=>executeHumainAgentRequest,
20
- findCutPoint:()=>findCutPoint,findTurnStartIndex:()=>findTurnStartIndex,formatDimensionNote:()=>formatDimensionNote,formatSize:()=>formatSize,formatSkillsForPrompt:()=>formatSkillsForPrompt,generateBranchSummary:()=>generateBranchSummary,generateDiffString:()=>generateDiffString,generateSummary:()=>generateSummary,generateSummaryWithUsage:()=>generateSummaryWithUsage,generateUnifiedPatch:()=>generateUnifiedPatch,getAgentDir:()=>getAgentDir,getDocsPath:()=>getDocsPath,getExamplesPath:()=>getExamplesPath,
21
- getFlowChildLaunchHost:()=>getFlowChildLaunchHost,getFlowControlHost:()=>getFlowControlHost,getFlowTraceProducer:()=>getFlowTraceProducer,getLanguageFromPath:()=>getLanguageFromPath,getLastAssistantUsage:()=>getLastAssistantUsage,getLatestCompactionEntry:()=>getLatestCompactionEntry,getMarkdownTheme:()=>getMarkdownTheme,getPackageDir:()=>getPackageDir,getPowerShellConfig:()=>getPowerShellConfig,getReadmePath:()=>getReadmePath,getSelectListTheme:()=>getSelectListTheme,getSettingsListTheme:()=>getSettingsListTheme,
22
- getShellConfig:()=>getShellConfig,hasTrustRequiringProjectResources:()=>hasTrustRequiringProjectResources,highlightCode:()=>highlightCode,initTheme:()=>initTheme,isBashToolResult:()=>isBashToolResult,isEditToolResult:()=>isEditToolResult,isFindToolResult:()=>isFindToolResult,isGrepToolResult:()=>isGrepToolResult,isLsToolResult:()=>isLsToolResult,isPowerShellToolResult:()=>isPowerShellToolResult,isReadToolResult:()=>isReadToolResult,isToolCallEventType:()=>isToolCallEventType,isWriteToolResult:()=>isWriteToolResult,
23
- keyHint:()=>keyHint,keyText:()=>keyText,loadProjectContextFiles:()=>loadProjectContextFiles,loadSkills:()=>loadSkills,loadSkillsFromDir:()=>loadSkillsFromDir,main:()=>main,migrateSessionEntries:()=>migrateSessionEntries,parseArgs:()=>parseArgs,parseFrontmatter:()=>parseFrontmatter,parseHumainAgentExecutionRequest:()=>parseHumainAgentExecutionRequest,parseHumainAgentExecutionResponse:()=>parseHumainAgentExecutionResponse,parseSessionEntries:()=>parseSessionEntries,parseSkillBlock:()=>parseSkillBlock,
24
- prepareBranchEntries:()=>prepareBranchEntries,prepareChildLaunch:()=>prepareChildLaunch,rawKeyHint:()=>rawKeyHint,readStoredCredential:()=>readStoredCredential,renderDiff:()=>renderDiff,renderTaskWithContext:()=>renderTaskWithContext,resizeImage:()=>resizeImage,resolveCliModel:()=>resolveCliModel,resolveModelScopeWithDiagnostics:()=>resolveModelScopeWithDiagnostics,runAgentExecMode:()=>runAgentExecMode,runPrintMode:()=>runPrintMode,runRpcMode:()=>runRpcMode,serializeConversation:()=>serializeConversation,
25
- sessionEntryToContextMessages:()=>sessionEntryToContextMessages,shouldCompact:()=>shouldCompact,stripFrontmatter:()=>stripFrontmatter,truncateHead:()=>truncateHead,truncateLine:()=>truncateLine,truncateTail:()=>truncateTail,truncateToVisualLines:()=>truncateToVisualLines,withFileMutationQueue:()=>withFileMutationQueue,wrapRegisteredTool:()=>wrapRegisteredTool,wrapRegisteredTools:()=>wrapRegisteredTools});var SHOW_IMAGES_SELECT_LIST_LAYOUT={minPrimaryColumnWidth:12,maxPrimaryColumnWidth:32},ShowImagesSelectorComponent=class extends Container{selectList;constructor(currentValue,onSelect,onCancel){super();let items=[{value:"yes",label:"Yes",description:"Show images inline in terminal"},{value:"no",label:"No",description:"Show text placeholder instead"}];this.addChild(new DynamicBorder),this.selectList=new SelectList(items,5,getSelectListTheme(),SHOW_IMAGES_SELECT_LIST_LAYOUT),this.selectList.setSelectedIndex(
26
- currentValue?0:1),this.selectList.onSelect=item=>{onSelect(item.value==="yes")},this.selectList.onCancel=()=>{onCancel()},this.addChild(this.selectList),this.addChild(new DynamicBorder)}getSelectList(){return this.selectList}};var THEME_SELECT_LIST_LAYOUT={minPrimaryColumnWidth:12,maxPrimaryColumnWidth:32},ThemeSelectorComponent=class extends Container{selectList;onPreview;constructor(currentTheme,onSelect,onCancel,onPreview){super(),this.onPreview=onPreview;let themes=getAvailableThemes(),themeItems=themes.map(name=>({value:name,label:name,description:name===currentTheme?"(current)":void 0}));this.addChild(new DynamicBorder),this.selectList=new SelectList(themeItems,10,getSelectListTheme(),THEME_SELECT_LIST_LAYOUT);let currentIndex=themes.
27
- indexOf(currentTheme);currentIndex!==-1&&this.selectList.setSelectedIndex(currentIndex),this.selectList.onSelect=item=>{onSelect(item.value)},this.selectList.onCancel=()=>{onCancel()},this.selectList.onSelectionChange=item=>{this.onPreview(item.value)},this.addChild(this.selectList),this.addChild(new DynamicBorder)}getSelectList(){return this.selectList}};export{ShowImagesSelectorComponent,ThemeSelectorComponent,dist_exports};