@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.
- package/README.md +120 -5
- package/dist/.build-fingerprint +1 -1
- package/dist/__tests__/agent-resolution-llm-free.test.js +9 -2
- package/dist/__tests__/agent-resolution-llm-free.test.js.map +1 -1
- package/dist/__tests__/broker-prompt.test.d.ts +10 -0
- package/dist/__tests__/broker-prompt.test.d.ts.map +1 -0
- package/dist/__tests__/broker-prompt.test.js +129 -0
- package/dist/__tests__/broker-prompt.test.js.map +1 -0
- package/dist/__tests__/broker-step-active-turns.test.d.ts +20 -0
- package/dist/__tests__/broker-step-active-turns.test.d.ts.map +1 -0
- package/dist/__tests__/broker-step-active-turns.test.js +428 -0
- package/dist/__tests__/broker-step-active-turns.test.js.map +1 -0
- package/dist/__tests__/broker-step-turn-chain-phase2.test.d.ts +13 -0
- package/dist/__tests__/broker-step-turn-chain-phase2.test.d.ts.map +1 -0
- package/dist/__tests__/broker-step-turn-chain-phase2.test.js +429 -0
- package/dist/__tests__/broker-step-turn-chain-phase2.test.js.map +1 -0
- package/dist/__tests__/config.test.js +33 -37
- package/dist/__tests__/config.test.js.map +1 -1
- package/dist/__tests__/e2e-broker-step-suspend.test.d.ts +18 -0
- package/dist/__tests__/e2e-broker-step-suspend.test.d.ts.map +1 -0
- package/dist/__tests__/e2e-broker-step-suspend.test.js +313 -0
- package/dist/__tests__/e2e-broker-step-suspend.test.js.map +1 -0
- package/dist/__tests__/e2e-broker-step.test.d.ts +13 -0
- package/dist/__tests__/e2e-broker-step.test.d.ts.map +1 -0
- package/dist/__tests__/e2e-broker-step.test.js +278 -0
- package/dist/__tests__/e2e-broker-step.test.js.map +1 -0
- package/dist/__tests__/e2e-mock-agent.test.js +1 -1
- package/dist/__tests__/e2e-mock-agent.test.js.map +1 -1
- package/dist/__tests__/e2e-thread-resume-timeout-suspend.test.d.ts +28 -0
- package/dist/__tests__/e2e-thread-resume-timeout-suspend.test.d.ts.map +1 -0
- package/dist/__tests__/e2e-thread-resume-timeout-suspend.test.js +322 -0
- package/dist/__tests__/e2e-thread-resume-timeout-suspend.test.js.map +1 -0
- package/dist/__tests__/log-tag-validity.test.d.ts +2 -0
- package/dist/__tests__/log-tag-validity.test.d.ts.map +1 -0
- package/dist/__tests__/log-tag-validity.test.js +110 -0
- package/dist/__tests__/log-tag-validity.test.js.map +1 -0
- package/dist/__tests__/setup-agent-discovery.test.js +35 -23
- package/dist/__tests__/setup-agent-discovery.test.js.map +1 -1
- package/dist/__tests__/setup-no-llm.test.js +5 -2
- package/dist/__tests__/setup-no-llm.test.js.map +1 -1
- package/dist/__tests__/step-ask.test.js +9 -6
- package/dist/__tests__/step-ask.test.js.map +1 -1
- package/dist/__tests__/step-show-json.test.js +5 -5
- package/dist/__tests__/step-show-json.test.js.map +1 -1
- package/dist/__tests__/step-show-text.test.d.ts +2 -0
- package/dist/__tests__/step-show-text.test.d.ts.map +1 -0
- package/dist/__tests__/step-show-text.test.js +192 -0
- package/dist/__tests__/step-show-text.test.js.map +1 -0
- package/dist/__tests__/step-turns-cli-subprocess.test.d.ts +21 -0
- package/dist/__tests__/step-turns-cli-subprocess.test.d.ts.map +1 -0
- package/dist/__tests__/step-turns-cli-subprocess.test.js +356 -0
- package/dist/__tests__/step-turns-cli-subprocess.test.js.map +1 -0
- package/dist/__tests__/step-turns-panorama-phase3.test.d.ts +21 -0
- package/dist/__tests__/step-turns-panorama-phase3.test.d.ts.map +1 -0
- package/dist/__tests__/step-turns-panorama-phase3.test.js +476 -0
- package/dist/__tests__/step-turns-panorama-phase3.test.js.map +1 -0
- package/dist/__tests__/step-turns.test.d.ts +24 -0
- package/dist/__tests__/step-turns.test.d.ts.map +1 -0
- package/dist/__tests__/step-turns.test.js +646 -0
- package/dist/__tests__/step-turns.test.js.map +1 -0
- package/dist/__tests__/store-turn-chain.test.d.ts +2 -0
- package/dist/__tests__/store-turn-chain.test.d.ts.map +1 -0
- package/dist/__tests__/store-turn-chain.test.js +341 -0
- package/dist/__tests__/store-turn-chain.test.js.map +1 -0
- package/dist/__tests__/thread-agent-failure-suspended.test.js +3 -3
- package/dist/__tests__/thread-agent-failure-suspended.test.js.map +1 -1
- package/dist/__tests__/thread-list-limit-offset.test.d.ts +24 -0
- package/dist/__tests__/thread-list-limit-offset.test.d.ts.map +1 -0
- package/dist/__tests__/thread-list-limit-offset.test.js +254 -0
- package/dist/__tests__/thread-list-limit-offset.test.js.map +1 -0
- package/dist/__tests__/thread-list-template-ms-date.test.js +7 -2
- package/dist/__tests__/thread-list-template-ms-date.test.js.map +1 -1
- package/dist/__tests__/thread-poke.test.js +6 -6
- package/dist/__tests__/thread-poke.test.js.map +1 -1
- package/dist/__tests__/thread-resume.test.js +2 -2
- package/dist/__tests__/thread-resume.test.js.map +1 -1
- package/dist/__tests__/thread-suspend-step.test.js +1 -1
- package/dist/__tests__/thread-suspend-step.test.js.map +1 -1
- package/dist/__tests__/thread.test.js +28 -14
- package/dist/__tests__/thread.test.js.map +1 -1
- package/dist/cli.js +910 -344
- package/dist/cli.js.map +1 -1
- package/dist/commands/broker-step.d.ts +117 -0
- package/dist/commands/broker-step.d.ts.map +1 -0
- package/dist/commands/broker-step.js +654 -0
- package/dist/commands/broker-step.js.map +1 -0
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +2 -23
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/prompt.d.ts.map +1 -1
- package/dist/commands/prompt.js +43 -51
- package/dist/commands/prompt.js.map +1 -1
- package/dist/commands/setup.d.ts +6 -4
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +24 -27
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/step.d.ts +54 -6
- package/dist/commands/step.d.ts.map +1 -1
- package/dist/commands/step.js +484 -134
- package/dist/commands/step.js.map +1 -1
- package/dist/commands/thread.d.ts +4 -0
- package/dist/commands/thread.d.ts.map +1 -1
- package/dist/commands/thread.js +77 -151
- package/dist/commands/thread.js.map +1 -1
- package/dist/output-mappers.d.ts +8 -0
- package/dist/output-mappers.d.ts.map +1 -1
- package/dist/output-mappers.js +72 -18
- package/dist/output-mappers.js.map +1 -1
- package/dist/schemas.d.ts +3 -0
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +17 -3
- package/dist/schemas.js.map +1 -1
- package/dist/store.d.ts +147 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +254 -1
- package/dist/store.js.map +1 -1
- package/dist/text-renderers.d.ts.map +1 -1
- package/dist/text-renderers.js +27 -2
- package/dist/text-renderers.js.map +1 -1
- package/package.json +7 -5
- package/src/__tests__/agent-resolution-llm-free.test.ts +14 -2
- package/src/__tests__/broker-prompt.test.ts +142 -0
- package/src/__tests__/broker-step-active-turns.test.ts +509 -0
- package/src/__tests__/broker-step-turn-chain-phase2.test.ts +525 -0
- package/src/__tests__/config.test.ts +35 -39
- package/src/__tests__/e2e-broker-step-suspend.test.ts +351 -0
- package/src/__tests__/e2e-broker-step.test.ts +320 -0
- package/src/__tests__/e2e-mock-agent.test.ts +1 -1
- package/src/__tests__/e2e-thread-resume-timeout-suspend.test.ts +360 -0
- package/src/__tests__/log-tag-validity.test.ts +124 -0
- package/src/__tests__/setup-agent-discovery.test.ts +35 -23
- package/src/__tests__/setup-no-llm.test.ts +5 -2
- package/src/__tests__/step-ask.test.ts +9 -6
- package/src/__tests__/step-show-json.test.ts +5 -5
- package/src/__tests__/step-show-text.test.ts +236 -0
- package/src/__tests__/step-turns-cli-subprocess.test.ts +411 -0
- package/src/__tests__/step-turns-panorama-phase3.test.ts +579 -0
- package/src/__tests__/step-turns.test.ts +734 -0
- package/src/__tests__/store-turn-chain.test.ts +386 -0
- package/src/__tests__/thread-agent-failure-suspended.test.ts +3 -3
- package/src/__tests__/thread-list-limit-offset.test.ts +305 -0
- package/src/__tests__/thread-list-template-ms-date.test.ts +7 -2
- package/src/__tests__/thread-poke.test.ts +6 -6
- package/src/__tests__/thread-resume.test.ts +2 -2
- package/src/__tests__/thread-suspend-step.test.ts +1 -1
- package/src/__tests__/thread.test.ts +29 -15
- package/src/cli.ts +1056 -483
- package/src/commands/broker-step.ts +913 -0
- package/src/commands/config.ts +2 -24
- package/src/commands/prompt.ts +43 -51
- package/src/commands/setup.ts +25 -29
- package/src/commands/step.ts +645 -176
- package/src/commands/thread.ts +87 -192
- package/src/output-mappers.ts +99 -21
- package/src/schemas.ts +32 -2
- package/src/store.ts +297 -2
- package/src/text-renderers.ts +35 -2
- package/dist/__tests__/adapter-json-roundtrip.test.d.ts +0 -2
- package/dist/__tests__/adapter-json-roundtrip.test.d.ts.map +0 -1
- package/dist/__tests__/adapter-json-roundtrip.test.js +0 -160
- package/dist/__tests__/adapter-json-roundtrip.test.js.map +0 -1
- package/dist/__tests__/spawn-agent-json.test.d.ts +0 -2
- package/dist/__tests__/spawn-agent-json.test.d.ts.map +0 -1
- package/dist/__tests__/spawn-agent-json.test.js +0 -79
- package/dist/__tests__/spawn-agent-json.test.js.map +0 -1
- package/src/__tests__/adapter-json-roundtrip.test.ts +0 -193
- package/src/__tests__/spawn-agent-json.test.ts +0 -100
package/src/commands/config.ts
CHANGED
|
@@ -14,7 +14,7 @@ const VALID_CONFIG_KEYS: Record<
|
|
|
14
14
|
> = {
|
|
15
15
|
agents: {
|
|
16
16
|
nested: true,
|
|
17
|
-
knownFields: ["
|
|
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 (
|
|
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) {
|
package/src/commands/prompt.ts
CHANGED
|
@@ -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 —
|
|
85
|
+
### Step 1 — Install the CLI and pick an integration path
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
uwf reaches an LLM/agent backend through one of two paths after Phase 4
|
|
88
|
+
cleanup (#381):
|
|
88
89
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
**
|
|
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
|
|
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
|
-
|
|
131
|
-
npm prefix -g
|
|
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
|
|
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
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
|
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
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
defaultAgent:
|
|
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 —
|
|
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
|
|
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-
|
|
255
|
+
pnpm add -g @united-workforce/agent-builtin@latest
|
|
269
256
|
|
|
270
257
|
# npm
|
|
271
|
-
npm install -g @united-workforce/agent-
|
|
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:
|
package/src/commands/setup.ts
CHANGED
|
@@ -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-
|
|
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-
|
|
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-
|
|
140
|
-
"uwf-
|
|
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-
|
|
143
|
+
/** Extract short agent name from binary name: uwf-builtin → builtin */
|
|
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. "
|
|
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-
|
|
176
|
-
console.log("
|
|
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
|
|
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 "
|
|
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-
|
|
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-
|
|
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] = {
|
|
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
|
|
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
|
|
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;
|