@united-workforce/cli 0.6.1 → 0.8.1

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 (167) hide show
  1. package/README.md +120 -5
  2. package/dist/.build-fingerprint +1 -1
  3. package/dist/__tests__/agent-resolution-llm-free.test.js +9 -2
  4. package/dist/__tests__/agent-resolution-llm-free.test.js.map +1 -1
  5. package/dist/__tests__/broker-prompt.test.d.ts +10 -0
  6. package/dist/__tests__/broker-prompt.test.d.ts.map +1 -0
  7. package/dist/__tests__/broker-prompt.test.js +129 -0
  8. package/dist/__tests__/broker-prompt.test.js.map +1 -0
  9. package/dist/__tests__/broker-step-active-turns.test.d.ts +20 -0
  10. package/dist/__tests__/broker-step-active-turns.test.d.ts.map +1 -0
  11. package/dist/__tests__/broker-step-active-turns.test.js +428 -0
  12. package/dist/__tests__/broker-step-active-turns.test.js.map +1 -0
  13. package/dist/__tests__/broker-step-turn-chain-phase2.test.d.ts +13 -0
  14. package/dist/__tests__/broker-step-turn-chain-phase2.test.d.ts.map +1 -0
  15. package/dist/__tests__/broker-step-turn-chain-phase2.test.js +429 -0
  16. package/dist/__tests__/broker-step-turn-chain-phase2.test.js.map +1 -0
  17. package/dist/__tests__/config.test.js +33 -37
  18. package/dist/__tests__/config.test.js.map +1 -1
  19. package/dist/__tests__/e2e-broker-step-suspend.test.d.ts +18 -0
  20. package/dist/__tests__/e2e-broker-step-suspend.test.d.ts.map +1 -0
  21. package/dist/__tests__/e2e-broker-step-suspend.test.js +313 -0
  22. package/dist/__tests__/e2e-broker-step-suspend.test.js.map +1 -0
  23. package/dist/__tests__/e2e-broker-step.test.d.ts +13 -0
  24. package/dist/__tests__/e2e-broker-step.test.d.ts.map +1 -0
  25. package/dist/__tests__/e2e-broker-step.test.js +278 -0
  26. package/dist/__tests__/e2e-broker-step.test.js.map +1 -0
  27. package/dist/__tests__/e2e-mock-agent.test.js +1 -1
  28. package/dist/__tests__/e2e-mock-agent.test.js.map +1 -1
  29. package/dist/__tests__/e2e-thread-resume-timeout-suspend.test.d.ts +28 -0
  30. package/dist/__tests__/e2e-thread-resume-timeout-suspend.test.d.ts.map +1 -0
  31. package/dist/__tests__/e2e-thread-resume-timeout-suspend.test.js +322 -0
  32. package/dist/__tests__/e2e-thread-resume-timeout-suspend.test.js.map +1 -0
  33. package/dist/__tests__/log-tag-validity.test.d.ts +2 -0
  34. package/dist/__tests__/log-tag-validity.test.d.ts.map +1 -0
  35. package/dist/__tests__/log-tag-validity.test.js +110 -0
  36. package/dist/__tests__/log-tag-validity.test.js.map +1 -0
  37. package/dist/__tests__/setup-agent-discovery.test.js +35 -23
  38. package/dist/__tests__/setup-agent-discovery.test.js.map +1 -1
  39. package/dist/__tests__/setup-no-llm.test.js +5 -2
  40. package/dist/__tests__/setup-no-llm.test.js.map +1 -1
  41. package/dist/__tests__/step-ask.test.js +9 -6
  42. package/dist/__tests__/step-ask.test.js.map +1 -1
  43. package/dist/__tests__/step-show-json.test.js +5 -5
  44. package/dist/__tests__/step-show-json.test.js.map +1 -1
  45. package/dist/__tests__/step-show-text.test.d.ts +2 -0
  46. package/dist/__tests__/step-show-text.test.d.ts.map +1 -0
  47. package/dist/__tests__/step-show-text.test.js +192 -0
  48. package/dist/__tests__/step-show-text.test.js.map +1 -0
  49. package/dist/__tests__/step-turns-cli-subprocess.test.d.ts +21 -0
  50. package/dist/__tests__/step-turns-cli-subprocess.test.d.ts.map +1 -0
  51. package/dist/__tests__/step-turns-cli-subprocess.test.js +356 -0
  52. package/dist/__tests__/step-turns-cli-subprocess.test.js.map +1 -0
  53. package/dist/__tests__/step-turns-panorama-phase3.test.d.ts +21 -0
  54. package/dist/__tests__/step-turns-panorama-phase3.test.d.ts.map +1 -0
  55. package/dist/__tests__/step-turns-panorama-phase3.test.js +476 -0
  56. package/dist/__tests__/step-turns-panorama-phase3.test.js.map +1 -0
  57. package/dist/__tests__/step-turns.test.d.ts +24 -0
  58. package/dist/__tests__/step-turns.test.d.ts.map +1 -0
  59. package/dist/__tests__/step-turns.test.js +646 -0
  60. package/dist/__tests__/step-turns.test.js.map +1 -0
  61. package/dist/__tests__/store-turn-chain.test.d.ts +2 -0
  62. package/dist/__tests__/store-turn-chain.test.d.ts.map +1 -0
  63. package/dist/__tests__/store-turn-chain.test.js +341 -0
  64. package/dist/__tests__/store-turn-chain.test.js.map +1 -0
  65. package/dist/__tests__/thread-agent-failure-suspended.test.js +3 -3
  66. package/dist/__tests__/thread-agent-failure-suspended.test.js.map +1 -1
  67. package/dist/__tests__/thread-list-limit-offset.test.d.ts +24 -0
  68. package/dist/__tests__/thread-list-limit-offset.test.d.ts.map +1 -0
  69. package/dist/__tests__/thread-list-limit-offset.test.js +254 -0
  70. package/dist/__tests__/thread-list-limit-offset.test.js.map +1 -0
  71. package/dist/__tests__/thread-list-template-ms-date.test.js +7 -2
  72. package/dist/__tests__/thread-list-template-ms-date.test.js.map +1 -1
  73. package/dist/__tests__/thread-poke.test.js +6 -6
  74. package/dist/__tests__/thread-poke.test.js.map +1 -1
  75. package/dist/__tests__/thread-resume.test.js +2 -2
  76. package/dist/__tests__/thread-resume.test.js.map +1 -1
  77. package/dist/__tests__/thread-suspend-step.test.js +1 -1
  78. package/dist/__tests__/thread-suspend-step.test.js.map +1 -1
  79. package/dist/__tests__/thread.test.js +28 -14
  80. package/dist/__tests__/thread.test.js.map +1 -1
  81. package/dist/cli.js +910 -344
  82. package/dist/cli.js.map +1 -1
  83. package/dist/commands/broker-step.d.ts +117 -0
  84. package/dist/commands/broker-step.d.ts.map +1 -0
  85. package/dist/commands/broker-step.js +654 -0
  86. package/dist/commands/broker-step.js.map +1 -0
  87. package/dist/commands/config.d.ts.map +1 -1
  88. package/dist/commands/config.js +2 -23
  89. package/dist/commands/config.js.map +1 -1
  90. package/dist/commands/prompt.d.ts.map +1 -1
  91. package/dist/commands/prompt.js +43 -51
  92. package/dist/commands/prompt.js.map +1 -1
  93. package/dist/commands/setup.d.ts +6 -4
  94. package/dist/commands/setup.d.ts.map +1 -1
  95. package/dist/commands/setup.js +24 -27
  96. package/dist/commands/setup.js.map +1 -1
  97. package/dist/commands/step.d.ts +54 -6
  98. package/dist/commands/step.d.ts.map +1 -1
  99. package/dist/commands/step.js +484 -134
  100. package/dist/commands/step.js.map +1 -1
  101. package/dist/commands/thread.d.ts +4 -0
  102. package/dist/commands/thread.d.ts.map +1 -1
  103. package/dist/commands/thread.js +77 -151
  104. package/dist/commands/thread.js.map +1 -1
  105. package/dist/output-mappers.d.ts +8 -0
  106. package/dist/output-mappers.d.ts.map +1 -1
  107. package/dist/output-mappers.js +72 -18
  108. package/dist/output-mappers.js.map +1 -1
  109. package/dist/schemas.d.ts +3 -0
  110. package/dist/schemas.d.ts.map +1 -1
  111. package/dist/schemas.js +17 -3
  112. package/dist/schemas.js.map +1 -1
  113. package/dist/store.d.ts +147 -1
  114. package/dist/store.d.ts.map +1 -1
  115. package/dist/store.js +254 -1
  116. package/dist/store.js.map +1 -1
  117. package/dist/text-renderers.d.ts.map +1 -1
  118. package/dist/text-renderers.js +27 -2
  119. package/dist/text-renderers.js.map +1 -1
  120. package/package.json +7 -5
  121. package/src/__tests__/agent-resolution-llm-free.test.ts +14 -2
  122. package/src/__tests__/broker-prompt.test.ts +142 -0
  123. package/src/__tests__/broker-step-active-turns.test.ts +509 -0
  124. package/src/__tests__/broker-step-turn-chain-phase2.test.ts +525 -0
  125. package/src/__tests__/config.test.ts +35 -39
  126. package/src/__tests__/e2e-broker-step-suspend.test.ts +351 -0
  127. package/src/__tests__/e2e-broker-step.test.ts +320 -0
  128. package/src/__tests__/e2e-mock-agent.test.ts +1 -1
  129. package/src/__tests__/e2e-thread-resume-timeout-suspend.test.ts +360 -0
  130. package/src/__tests__/log-tag-validity.test.ts +124 -0
  131. package/src/__tests__/setup-agent-discovery.test.ts +35 -23
  132. package/src/__tests__/setup-no-llm.test.ts +5 -2
  133. package/src/__tests__/step-ask.test.ts +9 -6
  134. package/src/__tests__/step-show-json.test.ts +5 -5
  135. package/src/__tests__/step-show-text.test.ts +236 -0
  136. package/src/__tests__/step-turns-cli-subprocess.test.ts +411 -0
  137. package/src/__tests__/step-turns-panorama-phase3.test.ts +579 -0
  138. package/src/__tests__/step-turns.test.ts +734 -0
  139. package/src/__tests__/store-turn-chain.test.ts +386 -0
  140. package/src/__tests__/thread-agent-failure-suspended.test.ts +3 -3
  141. package/src/__tests__/thread-list-limit-offset.test.ts +305 -0
  142. package/src/__tests__/thread-list-template-ms-date.test.ts +7 -2
  143. package/src/__tests__/thread-poke.test.ts +6 -6
  144. package/src/__tests__/thread-resume.test.ts +2 -2
  145. package/src/__tests__/thread-suspend-step.test.ts +1 -1
  146. package/src/__tests__/thread.test.ts +29 -15
  147. package/src/cli.ts +1056 -483
  148. package/src/commands/broker-step.ts +913 -0
  149. package/src/commands/config.ts +2 -24
  150. package/src/commands/prompt.ts +43 -51
  151. package/src/commands/setup.ts +25 -29
  152. package/src/commands/step.ts +645 -176
  153. package/src/commands/thread.ts +87 -192
  154. package/src/output-mappers.ts +99 -21
  155. package/src/schemas.ts +32 -2
  156. package/src/store.ts +297 -2
  157. package/src/text-renderers.ts +35 -2
  158. package/dist/__tests__/adapter-json-roundtrip.test.d.ts +0 -2
  159. package/dist/__tests__/adapter-json-roundtrip.test.d.ts.map +0 -1
  160. package/dist/__tests__/adapter-json-roundtrip.test.js +0 -160
  161. package/dist/__tests__/adapter-json-roundtrip.test.js.map +0 -1
  162. package/dist/__tests__/spawn-agent-json.test.d.ts +0 -2
  163. package/dist/__tests__/spawn-agent-json.test.d.ts.map +0 -1
  164. package/dist/__tests__/spawn-agent-json.test.js +0 -79
  165. package/dist/__tests__/spawn-agent-json.test.js.map +0 -1
  166. package/src/__tests__/adapter-json-roundtrip.test.ts +0 -193
  167. package/src/__tests__/spawn-agent-json.test.ts +0 -100
@@ -14,7 +14,7 @@ const VALID_CONFIG_KEYS: Record<
14
14
  > = {
15
15
  agents: {
16
16
  nested: true,
17
- knownFields: ["command", "args"],
17
+ knownFields: ["host", "gateway"],
18
18
  },
19
19
  agentOverrides: {
20
20
  nested: true,
@@ -203,26 +203,6 @@ export async function cmdConfigGet(storageRoot: string, key: string): Promise<un
203
203
  return value;
204
204
  }
205
205
 
206
- /**
207
- * Parse value for args key (must be JSON array)
208
- */
209
- function parseArgsValue(value: string): unknown {
210
- if (value.startsWith("[")) {
211
- try {
212
- const parsed = JSON.parse(value);
213
- if (!Array.isArray(parsed)) {
214
- throw new Error("Value must be an array");
215
- }
216
- return parsed;
217
- } catch (error) {
218
- throw new Error(
219
- `Invalid JSON array for args key: ${error instanceof Error ? error.message : String(error)}`,
220
- );
221
- }
222
- }
223
- throw new Error("Value for 'args' key must be a JSON array starting with '['");
224
- }
225
-
226
206
  /**
227
207
  * Parse value for a top-level string array key (must be JSON array of strings).
228
208
  */
@@ -292,12 +272,10 @@ export async function cmdConfigSet(
292
272
 
293
273
  const lastSegment = path[path.length - 1];
294
274
 
295
- // Parse value if it's for an array key (args, workflowPaths)
275
+ // Parse value if it's for an array key (workflowPaths)
296
276
  let parsedValue: unknown = value;
297
277
  if (path[0] === "workflowPaths") {
298
278
  parsedValue = parseStringArrayValue(value, "workflowPaths");
299
- } else if (lastSegment === "args") {
300
- parsedValue = parseArgsValue(value);
301
279
  } else if (lastSegment === "maxRunning") {
302
280
  const num = Number(value);
303
281
  if (!Number.isInteger(num) || num < 1) {
@@ -82,71 +82,57 @@ npm prefix -g # global prefix; bin is <prefix>/bin
82
82
 
83
83
  **All checks must pass before continuing.** If you had to modify PATH, verify the change persists by opening a new shell or sourcing your shell config.
84
84
 
85
- ### Step 1 — Discover agents and install adapter
85
+ ### Step 1 — Install the CLI and pick an integration path
86
86
 
87
- **First, detect which supported agents are already installed on the user's machine:**
87
+ uwf reaches an LLM/agent backend through one of two paths after Phase 4
88
+ cleanup (#381):
88
89
 
89
- \`\`\`bash
90
- # Check for Hermes Agent
91
- which hermes 2>/dev/null && hermes --version
92
-
93
- # Check for Claude Code
94
- which claude 2>/dev/null && claude --version # should show "X.Y.Z (Claude Code)"
95
- \`\`\`
96
-
97
- **Based on the results:**
90
+ - **Sumeru gateway via broker (preferred)** — your gateway runs out-of-process
91
+ and listens on \`http://host:port\`. The broker
92
+ (\`@united-workforce/broker\`) calls its \`send\` / \`resume\` / \`poke\` HTTP
93
+ endpoints. Most agents (chat sessions, hosted services, CLI subprocesses you
94
+ wrap) should ship as gateways.
95
+ - **In-process \`createAgent\` adapter** a local Node binary that runs inside
96
+ the same process as \`uwf\`. Used for tools-bearing OpenAI-compatible loops
97
+ (\`@united-workforce/agent-builtin\` ships \`uwf-builtin\`) or scripted E2E
98
+ fixtures (\`@united-workforce/agent-mock\` ships \`uwf-mock\`).
98
99
 
99
- - **Only hermes found** install \`uwf-hermes\` adapter
100
- - **Only claude found** → install \`uwf-claude-code\` adapter
101
- - **Both found** → ask the user which agent they want uwf to use as default
102
- - **Neither found** → the user must install at least one agent first:
103
- - Hermes Agent: https://hermes-agent.nousresearch.com/docs
104
- - Claude Code: \`npm install -g @anthropic-ai/claude-code\`
105
-
106
- **Install the uwf CLI and the chosen adapter** using pnpm or npm:
100
+ **Install the uwf CLI** with pnpm or npm:
107
101
 
108
102
  \`\`\`bash
109
- # CLI (required)
110
103
  pnpm add -g @united-workforce/cli # or: npm install -g @united-workforce/cli
111
-
112
- # Adapter — install the one matching the detected agent:
113
- pnpm add -g @united-workforce/agent-hermes # or: npm i -g @united-workforce/agent-hermes
114
- pnpm add -g @united-workforce/agent-claude-code # or: npm i -g @united-workforce/agent-claude-code
115
104
  \`\`\`
116
105
 
117
- **⚠ Adapter versions are independent from CLI versions.** Do NOT try to match adapter version to CLI version. Just install \`@latest\` (the default).
106
+ If you plan to use the in-process built-in adapter, install it too:
107
+
108
+ \`\`\`bash
109
+ pnpm add -g @united-workforce/agent-builtin # ships uwf-builtin
110
+ \`\`\`
118
111
 
119
- **After installing, verify that \`uwf\` and the adapter are available in PATH:**
112
+ **Verify that \`uwf\` is available in PATH:**
120
113
 
121
114
  \`\`\`bash
122
115
  uwf --version # should print ${CLI_VERSION}
123
- uwf-hermes --version # or: uwf-claude-code --version
124
116
  \`\`\`
125
117
 
126
- If either command is not found, the global bin directory is not in the current shell's PATH. **You must fix this before continuing:**
118
+ If \`uwf\` is not found, the global bin directory is not in the current shell's PATH. **You must fix this before continuing:**
127
119
 
128
120
  1. Find where the binary was installed:
129
121
  \`\`\`bash
130
- find ~/.local ~/.hermes /usr/local -name uwf -type f 2>/dev/null
131
- npm prefix -g # global prefix bin is <prefix>/bin
122
+ pnpm bin -g # for pnpm
123
+ npm prefix -g # for npm (bin is <prefix>/bin)
132
124
  \`\`\`
133
125
  2. Add the directory to PATH permanently by appending to the user's shell config (e.g. \`~/.bashrc\`, \`~/.zshrc\`, \`~/.profile\`, or fish config):
134
126
  \`\`\`bash
135
127
  export PATH="<global-bin-dir>:$PATH"
136
128
  \`\`\`
137
- 3. Source the updated config or open a new shell, then re-verify the commands work.
138
-
139
- **uwf-hermes** also requires the Hermes ACP plugin. Verify with \`hermes acp --help\`. If not available, install it:
140
- \`\`\`bash
141
- # Option A: install into hermes venv (recommended)
142
- source ~/.hermes/hermes-agent/.venv/bin/activate && pip install hermes-agent[acp]
129
+ 3. Source the updated config or open a new shell, then re-verify the command works.
143
130
 
144
- # Option B: pipx
145
- pipx install 'hermes-agent[acp]'
146
-
147
- # Option C: if installed from source
148
- pip install -e '.[acp]'
149
- \`\`\`
131
+ **Legacy note:** The old per-agent CLI binaries and their npm packages have
132
+ been moved to \`legacy-packages/\` and are no longer published. If you
133
+ previously installed any \`@united-workforce/agent-*\` package targeting an
134
+ external chat CLI, uninstall it and either run a Sumeru gateway or use
135
+ \`uwf-builtin\`.
150
136
 
151
137
  ### Step 2 — Configure default agent
152
138
 
@@ -162,20 +148,20 @@ Or configure non-interactively:
162
148
  uwf setup --agent <adapter-command>
163
149
  \`\`\`
164
150
 
165
- **Note:** \`--agent\` takes the adapter **command name** (e.g. \`uwf-hermes\`, \`uwf-claude-code\`), not the npm package name.
151
+ **Note:** \`--agent\` takes an alias declared in your \`agents\` map (e.g. \`builtin\`, \`my-gateway\`) — **not** an adapter command name. Each alias resolves to a \`{host, gateway}\` Sumeru endpoint that the broker contacts over HTTP. \`uwf thread exec --agent\` additionally accepts an inline \`"<host> <gateway>"\` pair for ad-hoc routing.
166
152
 
167
153
  Config is saved to \`~/.uwf/config.yaml\`:
168
154
 
169
155
  \`\`\`yaml
170
156
  agents:
171
- hermes:
172
- command: uwf-hermes
173
- args: []
174
- defaultAgent: hermes
157
+ my-gateway:
158
+ host: http://127.0.0.1:7900
159
+ gateway: my-gateway
160
+ defaultAgent: my-gateway
175
161
  agentOverrides: {}
176
162
  \`\`\`
177
163
 
178
- **LLM configuration** is per-adapter — each adapter manages its own provider, model, and API key settings independently (typically via environment variables like \`CLAUDE_MODEL\`, \`ANTHROPIC_API_KEY\`, etc.). The engine config (\`~/.uwf/config.yaml\`) is LLM-free.
164
+ **LLM configuration** is per-adapter — Sumeru gateways own their own provider/model/API-key settings, and in-process adapters store theirs under \`~/.uwf/agents/<name>.yaml\`. The engine config (\`~/.uwf/config.yaml\`) is LLM-free.
179
165
 
180
166
  Verify with \`cat ~/.uwf/config.yaml\`.
181
167
 
@@ -261,16 +247,22 @@ npm install -g @united-workforce/cli@latest
261
247
  uwf --version # should print ${CLI_VERSION}
262
248
  \`\`\`
263
249
 
264
- Also update your adapter(s):
250
+ Also update any in-process adapter you have installed (skip if you only use
251
+ Sumeru gateways via the broker):
265
252
 
266
253
  \`\`\`bash
267
254
  # pnpm
268
- pnpm add -g @united-workforce/agent-hermes@latest
255
+ pnpm add -g @united-workforce/agent-builtin@latest
269
256
 
270
257
  # npm
271
- npm install -g @united-workforce/agent-hermes@latest
258
+ npm install -g @united-workforce/agent-builtin@latest
272
259
  \`\`\`
273
260
 
261
+ If you previously had any \`@united-workforce/agent-*\` package targeting an
262
+ external chat CLI installed globally, uninstall it — those packages are
263
+ archived under \`legacy-packages/\` as of #381 and no longer published. Reach
264
+ the same backends via a Sumeru gateway in \`~/.uwf/config.yaml\` instead.
265
+
274
266
  ### Step 2 — Regenerate skills
275
267
 
276
268
  Skill content is bundled with the CLI — always regenerate after upgrading:
@@ -92,7 +92,7 @@ export function _parseWhichOutput(text: string): string[] {
92
92
 
93
93
  /**
94
94
  * Discover uwf-* agent binaries in PATH.
95
- * Returns sorted list of binary names (e.g., ["uwf-hermes", "uwf-claude-code"]).
95
+ * Returns sorted list of binary names (e.g., ["uwf-builtin", "uwf-mock"]).
96
96
  */
97
97
  export async function _discoverAgents(): Promise<string[]> {
98
98
  try {
@@ -106,7 +106,7 @@ export async function _discoverAgents(): Promise<string[]> {
106
106
 
107
107
  async function _tryWhichDiscovery(): Promise<string[] | null> {
108
108
  try {
109
- const text = execFileSync("which", ["-a", "uwf-hermes", "uwf-claude-code", "uwf-cursor"], {
109
+ const text = execFileSync("which", ["-a", "uwf-builtin", "uwf-mock"], {
110
110
  encoding: "utf-8",
111
111
  stdio: ["pipe", "pipe", "pipe"],
112
112
  });
@@ -136,13 +136,11 @@ export function _isBackspace(c: string): boolean {
136
136
 
137
137
  /** Known agent binary → display label mapping. */
138
138
  const KNOWN_AGENTS: Record<string, string> = {
139
- "uwf-hermes": "Hermes (hermes-agent)",
140
- "uwf-claude-code": "Claude Code",
141
- "uwf-cursor": "Cursor",
142
- "uwf-builtin": "Built-in (lightweight, no external agent)",
139
+ "uwf-builtin": "Built-in (in-process OpenAI-compatible tools loop)",
140
+ "uwf-mock": "Mock (scripted fixtures for E2E tests)",
143
141
  };
144
142
 
145
- /** Extract short agent name from binary name: uwf-claude-codeclaude-code */
143
+ /** Extract short agent name from binary name: uwf-builtinbuiltin */
146
144
  export function _agentNameFromBinary(binary: string): string {
147
145
  return binary.replace(/^uwf-/, "");
148
146
  }
@@ -161,7 +159,7 @@ export function _printAgentMenu(agents: string[]): void {
161
159
 
162
160
  /**
163
161
  * Interactive agent selection. Discovers uwf-* binaries, lets user pick default.
164
- * Returns short agent name (e.g. "hermes", "claude-code").
162
+ * Returns short agent name (e.g. "builtin", "my-gateway").
165
163
  */
166
164
  export async function _promptAgentSelection(
167
165
  rl: ReturnType<typeof createInterface>,
@@ -172,17 +170,17 @@ export async function _promptAgentSelection(
172
170
  if (agents.length === 0) {
173
171
  console.log(" No uwf-* agent binaries found in PATH.\n");
174
172
  console.log(" Install one first, for example:");
175
- console.log(" npm i -g @united-workforce/agent-hermes");
176
- console.log(" npm i -g @united-workforce/agent-claude-code\n");
173
+ console.log(" npm i -g @united-workforce/agent-builtin");
174
+ console.log(" Or configure a Sumeru gateway in ~/.uwf/config.yaml under agents.<name>.host\n");
177
175
  const manual = (
178
- await rl.question("Agent binary name (e.g. uwf-hermes), or press Enter to skip: ")
176
+ await rl.question("Agent name (e.g. uwf-builtin or my-gateway), or press Enter to skip: ")
179
177
  ).trim();
180
- if (!manual) return "hermes";
178
+ if (!manual) return "builtin";
181
179
  return _agentNameFromBinary(manual.startsWith("uwf-") ? manual : `uwf-${manual}`);
182
180
  }
183
181
 
184
182
  if (agents.length === 1) {
185
- const name = _agentNameFromBinary(agents[0] ?? "uwf-hermes");
183
+ const name = _agentNameFromBinary(agents[0] ?? "uwf-builtin");
186
184
  const label = KNOWN_AGENTS[agents[0] ?? ""] ?? agents[0];
187
185
  console.log(` Found 1 agent: ${label} — auto-selected.\n`);
188
186
  return name;
@@ -192,7 +190,7 @@ export async function _promptAgentSelection(
192
190
  const choice = (await rl.question(`Choose default agent [1-${agents.length}]: `)).trim();
193
191
  const n = Number.parseInt(choice, 10);
194
192
  if (!Number.isNaN(n) && n >= 1 && n <= agents.length) {
195
- const selected = agents[n - 1] ?? "uwf-hermes";
193
+ const selected = agents[n - 1] ?? "uwf-builtin";
196
194
  const name = _agentNameFromBinary(selected);
197
195
  console.log(` → ${name}\n`);
198
196
  return name;
@@ -205,6 +203,14 @@ export async function _promptAgentSelection(
205
203
 
206
204
  // ──────────────────────────────────────────────────────────────────────────────
207
205
 
206
+ /**
207
+ * Default Sumeru host used when seeding a fresh agents.<alias> entry.
208
+ * Phase 3 (#380) breaking change — agents are routed through the broker via
209
+ * `host` + `gateway`, replacing the legacy `command` + `args` CLI binary
210
+ * path.
211
+ */
212
+ const DEFAULT_SUMERU_HOST = "http://127.0.0.1:7900";
213
+
208
214
  /**
209
215
  * Merge setup args into config.yaml structure. Non-destructive — preserves
210
216
  * existing entries (including agentOverrides). Engine config is LLM-free, so
@@ -219,7 +225,7 @@ function mergeConfig(existing: Record<string, unknown>, args: SetupArgs): Record
219
225
 
220
226
  const agentName = _agentNameFromBinary(args.agent);
221
227
  if (!agents[agentName]) {
222
- agents[agentName] = { command: `uwf-${agentName}`, args: [] };
228
+ agents[agentName] = { host: DEFAULT_SUMERU_HOST, gateway: agentName };
223
229
  }
224
230
 
225
231
  const merged: Record<string, unknown> = {
@@ -233,7 +239,9 @@ function mergeConfig(existing: Record<string, unknown>, args: SetupArgs): Record
233
239
  }
234
240
 
235
241
  /**
236
- * Check if the configured adapter binary (and its dependencies) are in PATH.
242
+ * Check if the configured adapter binary is in PATH (for in-process adapters).
243
+ * Sumeru gateway agents (configured via host/gateway in config.yaml) skip
244
+ * this check since they are reached over HTTP rather than as local binaries.
237
245
  * Returns warnings array — empty means all good.
238
246
  */
239
247
  export function _checkAdapterAvailability(agentName: string): string[] {
@@ -244,20 +252,8 @@ export function _checkAdapterAvailability(agentName: string): string[] {
244
252
  execFileSync("which", [binary], { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] });
245
253
  } catch {
246
254
  warnings.push(
247
- `${binary} not found in PATH. Install it: pnpm add -g @united-workforce/agent-${agentName}`,
255
+ `${binary} not found in PATH. Install it (e.g. pnpm add -g @united-workforce/agent-${agentName}), or configure a Sumeru gateway under agents.${agentName}.host in ~/.uwf/config.yaml.`,
248
256
  );
249
- return warnings; // skip dependency check if adapter itself is missing
250
- }
251
-
252
- // uwf-hermes depends on hermes CLI
253
- if (agentName === "hermes") {
254
- try {
255
- execFileSync("which", ["hermes"], { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] });
256
- } catch {
257
- warnings.push(
258
- 'hermes CLI not found in PATH (required by uwf-hermes). Fix: export PATH="$HOME/.hermes/hermes-agent/.venv/bin:$PATH"',
259
- );
260
- }
261
257
  }
262
258
 
263
259
  return warnings;