@united-workforce/cli 0.7.0 → 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 +32 -5
- package/dist/.build-fingerprint +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__/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-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 +23 -23
- package/dist/__tests__/setup-agent-discovery.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-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.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 +10 -3
- package/dist/commands/broker-step.d.ts.map +1 -1
- package/dist/commands/broker-step.js +231 -27
- package/dist/commands/broker-step.js.map +1 -1
- package/dist/commands/prompt.d.ts.map +1 -1
- package/dist/commands/prompt.js +42 -50
- 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 +16 -26
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/step.d.ts +48 -1
- package/dist/commands/step.d.ts.map +1 -1
- package/dist/commands/step.js +496 -3
- package/dist/commands/step.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 -6
- 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__/e2e-broker-step-suspend.test.ts +351 -0
- 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 +23 -23
- 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-list-limit-offset.test.ts +305 -0
- package/src/__tests__/thread-list-template-ms-date.test.ts +7 -2
- package/src/__tests__/thread.test.ts +29 -15
- package/src/cli.ts +1056 -483
- package/src/commands/broker-step.ts +315 -38
- package/src/commands/prompt.ts +42 -50
- package/src/commands/setup.ts +16 -28
- package/src/commands/step.ts +655 -3
- 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/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;
|
|
@@ -241,7 +239,9 @@ function mergeConfig(existing: Record<string, unknown>, args: SetupArgs): Record
|
|
|
241
239
|
}
|
|
242
240
|
|
|
243
241
|
/**
|
|
244
|
-
* 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.
|
|
245
245
|
* Returns warnings array — empty means all good.
|
|
246
246
|
*/
|
|
247
247
|
export function _checkAdapterAvailability(agentName: string): string[] {
|
|
@@ -252,20 +252,8 @@ export function _checkAdapterAvailability(agentName: string): string[] {
|
|
|
252
252
|
execFileSync("which", [binary], { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] });
|
|
253
253
|
} catch {
|
|
254
254
|
warnings.push(
|
|
255
|
-
`${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.`,
|
|
256
256
|
);
|
|
257
|
-
return warnings; // skip dependency check if adapter itself is missing
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
// uwf-hermes depends on hermes CLI
|
|
261
|
-
if (agentName === "hermes") {
|
|
262
|
-
try {
|
|
263
|
-
execFileSync("which", ["hermes"], { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] });
|
|
264
|
-
} catch {
|
|
265
|
-
warnings.push(
|
|
266
|
-
'hermes CLI not found in PATH (required by uwf-hermes). Fix: export PATH="$HOME/.hermes/hermes-agent/.venv/bin:$PATH"',
|
|
267
|
-
);
|
|
268
|
-
}
|
|
269
257
|
}
|
|
270
258
|
|
|
271
259
|
return warnings;
|