@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.
Files changed (111) hide show
  1. package/README.md +32 -5
  2. package/dist/.build-fingerprint +1 -0
  3. package/dist/__tests__/broker-step-active-turns.test.d.ts +20 -0
  4. package/dist/__tests__/broker-step-active-turns.test.d.ts.map +1 -0
  5. package/dist/__tests__/broker-step-active-turns.test.js +428 -0
  6. package/dist/__tests__/broker-step-active-turns.test.js.map +1 -0
  7. package/dist/__tests__/broker-step-turn-chain-phase2.test.d.ts +13 -0
  8. package/dist/__tests__/broker-step-turn-chain-phase2.test.d.ts.map +1 -0
  9. package/dist/__tests__/broker-step-turn-chain-phase2.test.js +429 -0
  10. package/dist/__tests__/broker-step-turn-chain-phase2.test.js.map +1 -0
  11. package/dist/__tests__/e2e-broker-step-suspend.test.d.ts +18 -0
  12. package/dist/__tests__/e2e-broker-step-suspend.test.d.ts.map +1 -0
  13. package/dist/__tests__/e2e-broker-step-suspend.test.js +313 -0
  14. package/dist/__tests__/e2e-broker-step-suspend.test.js.map +1 -0
  15. package/dist/__tests__/e2e-thread-resume-timeout-suspend.test.d.ts +28 -0
  16. package/dist/__tests__/e2e-thread-resume-timeout-suspend.test.d.ts.map +1 -0
  17. package/dist/__tests__/e2e-thread-resume-timeout-suspend.test.js +322 -0
  18. package/dist/__tests__/e2e-thread-resume-timeout-suspend.test.js.map +1 -0
  19. package/dist/__tests__/log-tag-validity.test.d.ts +2 -0
  20. package/dist/__tests__/log-tag-validity.test.d.ts.map +1 -0
  21. package/dist/__tests__/log-tag-validity.test.js +110 -0
  22. package/dist/__tests__/log-tag-validity.test.js.map +1 -0
  23. package/dist/__tests__/setup-agent-discovery.test.js +23 -23
  24. package/dist/__tests__/setup-agent-discovery.test.js.map +1 -1
  25. package/dist/__tests__/step-show-json.test.js +5 -5
  26. package/dist/__tests__/step-show-json.test.js.map +1 -1
  27. package/dist/__tests__/step-show-text.test.d.ts +2 -0
  28. package/dist/__tests__/step-show-text.test.d.ts.map +1 -0
  29. package/dist/__tests__/step-show-text.test.js +192 -0
  30. package/dist/__tests__/step-show-text.test.js.map +1 -0
  31. package/dist/__tests__/step-turns-cli-subprocess.test.d.ts +21 -0
  32. package/dist/__tests__/step-turns-cli-subprocess.test.d.ts.map +1 -0
  33. package/dist/__tests__/step-turns-cli-subprocess.test.js +356 -0
  34. package/dist/__tests__/step-turns-cli-subprocess.test.js.map +1 -0
  35. package/dist/__tests__/step-turns-panorama-phase3.test.d.ts +21 -0
  36. package/dist/__tests__/step-turns-panorama-phase3.test.d.ts.map +1 -0
  37. package/dist/__tests__/step-turns-panorama-phase3.test.js +476 -0
  38. package/dist/__tests__/step-turns-panorama-phase3.test.js.map +1 -0
  39. package/dist/__tests__/step-turns.test.d.ts +24 -0
  40. package/dist/__tests__/step-turns.test.d.ts.map +1 -0
  41. package/dist/__tests__/step-turns.test.js +646 -0
  42. package/dist/__tests__/step-turns.test.js.map +1 -0
  43. package/dist/__tests__/store-turn-chain.test.d.ts +2 -0
  44. package/dist/__tests__/store-turn-chain.test.d.ts.map +1 -0
  45. package/dist/__tests__/store-turn-chain.test.js +341 -0
  46. package/dist/__tests__/store-turn-chain.test.js.map +1 -0
  47. package/dist/__tests__/thread-list-limit-offset.test.d.ts +24 -0
  48. package/dist/__tests__/thread-list-limit-offset.test.d.ts.map +1 -0
  49. package/dist/__tests__/thread-list-limit-offset.test.js +254 -0
  50. package/dist/__tests__/thread-list-limit-offset.test.js.map +1 -0
  51. package/dist/__tests__/thread-list-template-ms-date.test.js +7 -2
  52. package/dist/__tests__/thread-list-template-ms-date.test.js.map +1 -1
  53. package/dist/__tests__/thread.test.js +28 -14
  54. package/dist/__tests__/thread.test.js.map +1 -1
  55. package/dist/cli.js +910 -344
  56. package/dist/cli.js.map +1 -1
  57. package/dist/commands/broker-step.d.ts +10 -3
  58. package/dist/commands/broker-step.d.ts.map +1 -1
  59. package/dist/commands/broker-step.js +231 -27
  60. package/dist/commands/broker-step.js.map +1 -1
  61. package/dist/commands/prompt.d.ts.map +1 -1
  62. package/dist/commands/prompt.js +42 -50
  63. package/dist/commands/prompt.js.map +1 -1
  64. package/dist/commands/setup.d.ts +6 -4
  65. package/dist/commands/setup.d.ts.map +1 -1
  66. package/dist/commands/setup.js +16 -26
  67. package/dist/commands/setup.js.map +1 -1
  68. package/dist/commands/step.d.ts +48 -1
  69. package/dist/commands/step.d.ts.map +1 -1
  70. package/dist/commands/step.js +496 -3
  71. package/dist/commands/step.js.map +1 -1
  72. package/dist/output-mappers.d.ts +8 -0
  73. package/dist/output-mappers.d.ts.map +1 -1
  74. package/dist/output-mappers.js +72 -18
  75. package/dist/output-mappers.js.map +1 -1
  76. package/dist/schemas.d.ts +3 -0
  77. package/dist/schemas.d.ts.map +1 -1
  78. package/dist/schemas.js +17 -3
  79. package/dist/schemas.js.map +1 -1
  80. package/dist/store.d.ts +147 -1
  81. package/dist/store.d.ts.map +1 -1
  82. package/dist/store.js +254 -1
  83. package/dist/store.js.map +1 -1
  84. package/dist/text-renderers.d.ts.map +1 -1
  85. package/dist/text-renderers.js +27 -2
  86. package/dist/text-renderers.js.map +1 -1
  87. package/package.json +7 -6
  88. package/src/__tests__/broker-step-active-turns.test.ts +509 -0
  89. package/src/__tests__/broker-step-turn-chain-phase2.test.ts +525 -0
  90. package/src/__tests__/e2e-broker-step-suspend.test.ts +351 -0
  91. package/src/__tests__/e2e-thread-resume-timeout-suspend.test.ts +360 -0
  92. package/src/__tests__/log-tag-validity.test.ts +124 -0
  93. package/src/__tests__/setup-agent-discovery.test.ts +23 -23
  94. package/src/__tests__/step-show-json.test.ts +5 -5
  95. package/src/__tests__/step-show-text.test.ts +236 -0
  96. package/src/__tests__/step-turns-cli-subprocess.test.ts +411 -0
  97. package/src/__tests__/step-turns-panorama-phase3.test.ts +579 -0
  98. package/src/__tests__/step-turns.test.ts +734 -0
  99. package/src/__tests__/store-turn-chain.test.ts +386 -0
  100. package/src/__tests__/thread-list-limit-offset.test.ts +305 -0
  101. package/src/__tests__/thread-list-template-ms-date.test.ts +7 -2
  102. package/src/__tests__/thread.test.ts +29 -15
  103. package/src/cli.ts +1056 -483
  104. package/src/commands/broker-step.ts +315 -38
  105. package/src/commands/prompt.ts +42 -50
  106. package/src/commands/setup.ts +16 -28
  107. package/src/commands/step.ts +655 -3
  108. package/src/output-mappers.ts +99 -21
  109. package/src/schemas.ts +32 -2
  110. package/src/store.ts +297 -2
  111. package/src/text-renderers.ts +35 -2
@@ -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;
@@ -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 (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.
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: 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.`,
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;