@botbotgo/agent-harness 0.0.475 → 0.0.476

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 (227) hide show
  1. package/README.md +3 -1234
  2. package/README.zh.md +3 -1191
  3. package/dist/acp.js +1 -1
  4. package/dist/api.js +1 -404
  5. package/dist/benchmark/checkpoint-resume-cost-benchmark.js +1 -55
  6. package/dist/benchmark/deepagent-local-model-benchmark.js +2 -35
  7. package/dist/benchmark/upstream-runtime-ab-benchmark.js +1 -179
  8. package/dist/cli/chat-interactive.js +25 -244
  9. package/dist/cli/chat-rendering.js +6 -100
  10. package/dist/cli/chat-stream.js +23 -512
  11. package/dist/cli/chat-ui.js +21 -199
  12. package/dist/cli/chat-workspace.js +2 -210
  13. package/dist/cli/main.js +21 -428
  14. package/dist/cli/managed-service-commands.js +9 -63
  15. package/dist/cli/managed-service.js +2 -137
  16. package/dist/cli/options-init-chat.js +1 -108
  17. package/dist/cli/options-runtime.js +1 -158
  18. package/dist/cli/options-serve.js +1 -282
  19. package/dist/cli/options.js +2 -19
  20. package/dist/cli/process-guards.js +1 -139
  21. package/dist/cli/request-tree.js +7 -296
  22. package/dist/cli/runtime-commands.js +12 -258
  23. package/dist/cli/runtime-output.js +16 -155
  24. package/dist/cli/server-commands.js +16 -270
  25. package/dist/cli/workspace.js +1 -67
  26. package/dist/cli.js +1 -7
  27. package/dist/client/acp.js +1 -1
  28. package/dist/client/in-process.js +1 -67
  29. package/dist/client/index.js +1 -2
  30. package/dist/client/types.js +0 -1
  31. package/dist/client.js +1 -1
  32. package/dist/contracts/core.js +1 -1
  33. package/dist/contracts/runtime-evaluation.js +0 -1
  34. package/dist/contracts/runtime-memory.js +0 -1
  35. package/dist/contracts/runtime-observability.js +0 -1
  36. package/dist/contracts/runtime-requests.js +0 -1
  37. package/dist/contracts/runtime-scheduling.js +0 -1
  38. package/dist/contracts/runtime.js +1 -27
  39. package/dist/contracts/types.js +1 -3
  40. package/dist/contracts/workspace.js +0 -1
  41. package/dist/flow/build-flow-graph.js +1 -50
  42. package/dist/flow/export-mermaid.js +2 -464
  43. package/dist/flow/export-sequence-mermaid.js +2 -325
  44. package/dist/flow/flow-graph-normalization.js +1 -214
  45. package/dist/flow/flow-graph-runtime.js +1 -107
  46. package/dist/flow/flow-graph-upstream.js +1 -494
  47. package/dist/flow/index.js +1 -3
  48. package/dist/flow/types.js +0 -1
  49. package/dist/index.js +1 -5
  50. package/dist/init-project.js +1 -1
  51. package/dist/knowledge/config.js +1 -32
  52. package/dist/knowledge/contracts.js +0 -1
  53. package/dist/knowledge/index.js +1 -2
  54. package/dist/knowledge/module.js +12 -909
  55. package/dist/knowledge/procedural/config.js +1 -125
  56. package/dist/knowledge/procedural/index.js +1 -2
  57. package/dist/knowledge/procedural/manager.js +9 -345
  58. package/dist/mcp.js +1 -2
  59. package/dist/package-version.d.ts +1 -1
  60. package/dist/package-version.js +1 -2
  61. package/dist/persistence/file-store.js +3 -758
  62. package/dist/persistence/sqlite-request-context-store.js +5 -54
  63. package/dist/persistence/sqlite-request-queue-store.js +10 -108
  64. package/dist/persistence/sqlite-runtime.js +1 -86
  65. package/dist/persistence/sqlite-store.js +62 -810
  66. package/dist/persistence/types.js +0 -1
  67. package/dist/projections/presentation.js +37 -206
  68. package/dist/projections/request-events.js +2 -502
  69. package/dist/projections/upstream-events.js +1 -201
  70. package/dist/protocol/a2a/http-discovery.js +1 -178
  71. package/dist/protocol/a2a/http-rpc.js +6 -622
  72. package/dist/protocol/a2a/http.js +1 -138
  73. package/dist/protocol/a2a/task-state.js +3 -317
  74. package/dist/protocol/acp/client.js +8 -294
  75. package/dist/protocol/acp/harness-client.js +1 -218
  76. package/dist/protocol/acp/http.js +5 -130
  77. package/dist/protocol/acp/server.js +1 -310
  78. package/dist/protocol/acp/stdio.js +2 -69
  79. package/dist/protocol/ag-ui/http.js +3 -378
  80. package/dist/protocol/mcp/server.js +1 -428
  81. package/dist/resource/backend/workspace-scoped-backend.js +1 -319
  82. package/dist/resource/isolation.js +1 -237
  83. package/dist/resource/mcp/tool-support.js +3 -296
  84. package/dist/resource/mcp-tool-support.js +1 -2
  85. package/dist/resource/providers/resource-provider.js +1 -215
  86. package/dist/resource/resource-impl.js +1 -3
  87. package/dist/resource/resource-types.js +0 -1
  88. package/dist/resource/resource.js +1 -1
  89. package/dist/resource/sources.js +1 -247
  90. package/dist/resource/tools/function-tool-resolver.js +2 -272
  91. package/dist/runtime/adapter/compat/deepagent-compat.js +1 -29
  92. package/dist/runtime/adapter/compat/openai-compatible.js +1 -55
  93. package/dist/runtime/adapter/direct-builtin-utility.js +2 -90
  94. package/dist/runtime/adapter/flow/execution-context.js +1 -71
  95. package/dist/runtime/adapter/flow/invocation-flow.js +8 -425
  96. package/dist/runtime/adapter/flow/invoke-runtime.js +1 -20
  97. package/dist/runtime/adapter/flow/stream-runtime.js +11 -1395
  98. package/dist/runtime/adapter/invocation-result.js +2 -473
  99. package/dist/runtime/adapter/local-tool-invocation.js +6 -638
  100. package/dist/runtime/adapter/middleware/context-hygiene.js +1 -83
  101. package/dist/runtime/adapter/middleware-assembly.js +5 -477
  102. package/dist/runtime/adapter/model/invocation-request.js +3 -183
  103. package/dist/runtime/adapter/model/message-assembly.js +1 -28
  104. package/dist/runtime/adapter/model/model-providers.js +23 -1115
  105. package/dist/runtime/adapter/model/prompted-json-tool-call-capture.js +1 -40
  106. package/dist/runtime/adapter/model/prompted-json-tool-policy.js +1 -22
  107. package/dist/runtime/adapter/resilience.js +1 -104
  108. package/dist/runtime/adapter/runtime-adapter-support.js +3 -141
  109. package/dist/runtime/adapter/runtime-shell.js +5 -166
  110. package/dist/runtime/adapter/stream-event-projection.js +2 -622
  111. package/dist/runtime/adapter/stream-text-consumption.js +1 -18
  112. package/dist/runtime/adapter/terminal-status.js +2 -67
  113. package/dist/runtime/adapter/tool/builtin-middleware-tools.js +6 -627
  114. package/dist/runtime/adapter/tool/declared-middleware.js +1 -154
  115. package/dist/runtime/adapter/tool/interrupt-policy.js +1 -34
  116. package/dist/runtime/adapter/tool/provider-tool.js +1 -25
  117. package/dist/runtime/adapter/tool/resolved-tool.js +1 -225
  118. package/dist/runtime/adapter/tool/tool-arguments.js +3 -486
  119. package/dist/runtime/adapter/tool/tool-hitl.js +1 -346
  120. package/dist/runtime/adapter/tool/tool-name-mapping.js +1 -128
  121. package/dist/runtime/adapter/tool/tool-output-artifacts.js +2 -88
  122. package/dist/runtime/adapter/tool/tool-replay.js +1 -37
  123. package/dist/runtime/adapter/tool-resolution.js +1 -86
  124. package/dist/runtime/adapter/upstream-configurable-keys.js +1 -2
  125. package/dist/runtime/agent-runtime-adapter.js +60 -2338
  126. package/dist/runtime/agent-runtime-assembly.js +7 -249
  127. package/dist/runtime/env/runtime-env.js +1 -62
  128. package/dist/runtime/harness/background-runtime.js +1 -8
  129. package/dist/runtime/harness/bindings.js +1 -58
  130. package/dist/runtime/harness/events/event-bus.js +1 -16
  131. package/dist/runtime/harness/events/event-sink.js +1 -61
  132. package/dist/runtime/harness/events/events.js +1 -80
  133. package/dist/runtime/harness/events/listener-runtime.js +1 -13
  134. package/dist/runtime/harness/events/runtime-event-operations.js +1 -9
  135. package/dist/runtime/harness/events/streaming.js +1 -100
  136. package/dist/runtime/harness/events/timeline.js +1 -52
  137. package/dist/runtime/harness/public-shapes.js +1 -186
  138. package/dist/runtime/harness/run/artifact-paths.js +1 -15
  139. package/dist/runtime/harness/run/governance.js +1 -295
  140. package/dist/runtime/harness/run/helpers.js +1 -71
  141. package/dist/runtime/harness/run/inspection.js +1 -409
  142. package/dist/runtime/harness/run/operator-overview.js +1 -80
  143. package/dist/runtime/harness/run/queue-diagnostics.js +1 -15
  144. package/dist/runtime/harness/run/recovery.js +1 -162
  145. package/dist/runtime/harness/run/resources.js +1 -60
  146. package/dist/runtime/harness/run/resume.js +1 -56
  147. package/dist/runtime/harness/run/routing.js +1 -48
  148. package/dist/runtime/harness/run/run-lifecycle.js +1 -66
  149. package/dist/runtime/harness/run/run-operations.js +1 -217
  150. package/dist/runtime/harness/run/run-queue.js +1 -43
  151. package/dist/runtime/harness/run/run-slot-acquisition.js +1 -157
  152. package/dist/runtime/harness/run/session-records.js +1 -97
  153. package/dist/runtime/harness/run/start-run.js +1 -120
  154. package/dist/runtime/harness/run/startup-runtime.js +1 -69
  155. package/dist/runtime/harness/run/stream-run.js +8 -1418
  156. package/dist/runtime/harness/run/surface-semantics.js +1 -79
  157. package/dist/runtime/harness/runtime-defaults.js +1 -39
  158. package/dist/runtime/harness/system/boundary-analysis.js +1 -234
  159. package/dist/runtime/harness/system/health-monitor.js +1 -258
  160. package/dist/runtime/harness/system/inventory.js +1 -129
  161. package/dist/runtime/harness/system/mem0-ingestion-sync.js +5 -345
  162. package/dist/runtime/harness/system/policy-engine.js +1 -175
  163. package/dist/runtime/harness/system/runtime-memory-candidates.js +4 -110
  164. package/dist/runtime/harness/system/runtime-memory-consolidation.js +1 -51
  165. package/dist/runtime/harness/system/runtime-memory-manager.js +10 -693
  166. package/dist/runtime/harness/system/runtime-memory-policy.js +1 -155
  167. package/dist/runtime/harness/system/runtime-memory-records.js +11 -577
  168. package/dist/runtime/harness/system/runtime-memory-sync.js +5 -206
  169. package/dist/runtime/harness/system/session-memory-sync.js +3 -113
  170. package/dist/runtime/harness/system/skill-requirements.js +1 -112
  171. package/dist/runtime/harness/system/store.js +9 -365
  172. package/dist/runtime/harness/tool-gateway/index.js +1 -2
  173. package/dist/runtime/harness/tool-gateway/policy.js +1 -45
  174. package/dist/runtime/harness/tool-gateway/validation.js +1 -176
  175. package/dist/runtime/harness/tool-schema.js +1 -3
  176. package/dist/runtime/harness.js +3 -1490
  177. package/dist/runtime/index.js +1 -3
  178. package/dist/runtime/layout/runtime-layout.js +1 -31
  179. package/dist/runtime/maintenance/checkpoint-maintenance.js +2 -178
  180. package/dist/runtime/maintenance/file-checkpoint-saver.js +1 -106
  181. package/dist/runtime/maintenance/runtime-record-maintenance.js +2 -169
  182. package/dist/runtime/maintenance/sqlite-checkpoint-saver.js +4 -289
  183. package/dist/runtime/parsing/output-content.js +10 -550
  184. package/dist/runtime/parsing/output-parsing.js +1 -4
  185. package/dist/runtime/parsing/output-recovery.js +3 -213
  186. package/dist/runtime/parsing/output-tool-args.js +7 -663
  187. package/dist/runtime/parsing/stream-event-parsing.js +3 -362
  188. package/dist/runtime/prompts/runtime-prompts.js +4 -73
  189. package/dist/runtime/scheduling/system-schedule-manager.js +11 -532
  190. package/dist/runtime/skills/skill-metadata.js +1 -197
  191. package/dist/runtime/startup-tracing.js +2 -37
  192. package/dist/runtime/support/compiled-binding.js +1 -290
  193. package/dist/runtime/support/embedding-models.js +1 -118
  194. package/dist/runtime/support/harness-support.js +5 -137
  195. package/dist/runtime/support/llamaindex.js +1 -108
  196. package/dist/runtime/support/runtime-adapter-options.js +1 -29
  197. package/dist/runtime/support/runtime-factories.js +1 -51
  198. package/dist/runtime/support/vector-stores.js +9 -270
  199. package/dist/scaffold/init-project.js +54 -233
  200. package/dist/tooling/extensions.js +1 -311
  201. package/dist/tooling/module-loader.js +1 -55
  202. package/dist/tools.js +1 -176
  203. package/dist/utils/agent-display.js +1 -18
  204. package/dist/utils/bundled-text.js +4 -39
  205. package/dist/utils/compiled-binding.js +1 -33
  206. package/dist/utils/fs.js +2 -45
  207. package/dist/utils/id.js +1 -9
  208. package/dist/utils/message-content.js +1 -30
  209. package/dist/utils/object.js +1 -6
  210. package/dist/workspace/agent-binding-compiler.js +3 -613
  211. package/dist/workspace/compile.js +1 -472
  212. package/dist/workspace/framework-contract-validation.js +2 -322
  213. package/dist/workspace/index.js +1 -1
  214. package/dist/workspace/object-loader-paths.js +1 -71
  215. package/dist/workspace/object-loader-readers.js +1 -187
  216. package/dist/workspace/object-loader.js +1 -754
  217. package/dist/workspace/resource-compilers.js +1 -374
  218. package/dist/workspace/support/agent-capabilities.js +1 -37
  219. package/dist/workspace/support/agent-execution-config.js +1 -44
  220. package/dist/workspace/support/discovery.js +1 -147
  221. package/dist/workspace/support/source-collectors.js +1 -30
  222. package/dist/workspace/support/source-protocols.js +2 -192
  223. package/dist/workspace/support/workspace-ref-utils.js +1 -362
  224. package/dist/workspace/tool-hydration.js +1 -280
  225. package/dist/workspace/validate.js +1 -99
  226. package/dist/workspace/yaml-object-reader.js +1 -285
  227. package/package.json +7 -3
@@ -1,155 +1,16 @@
1
- function isObject(value) {
2
- return typeof value === "object" && value !== null && !Array.isArray(value);
3
- }
4
- function formatTimestamp(value) {
5
- return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
6
- }
7
- export function renderJson(value) {
8
- return `${JSON.stringify(value, null, 2)}\n`;
9
- }
10
- export function renderHealthSnapshot(snapshot, workspacePath) {
11
- const lines = [];
12
- const status = typeof snapshot.status === "string" ? snapshot.status : "unknown";
13
- lines.push(`Runtime health ${workspacePath}: ${status}`);
14
- const checks = isObject(snapshot.checks) ? snapshot.checks : {};
15
- const checkEntries = Object.entries(checks)
16
- .filter(([, value]) => isObject(value))
17
- .map(([name, value]) => {
18
- const check = value;
19
- const reason = typeof check.reason === "string" && check.reason.trim().length > 0 ? ` (${check.reason})` : "";
20
- return ` - ${name}: ${typeof check.status === "string" ? check.status : "unknown"}${reason}`;
21
- });
22
- if (checkEntries.length > 0) {
23
- lines.push("Checks:");
24
- lines.push(...checkEntries);
25
- }
26
- const stats = isObject(snapshot.stats) ? snapshot.stats : {};
27
- const statEntries = [
28
- ["activeRequestSlots", stats.activeRequestSlots],
29
- ["pendingRequestSlots", stats.pendingRequestSlots],
30
- ["pendingApprovals", stats.pendingApprovals],
31
- ["stuckRequests", stats.stuckRequests],
32
- ["llmSuccessRate1m", stats.llmSuccessRate1m],
33
- ["llmP95LatencyMs1m", stats.llmP95LatencyMs1m],
34
- ]
35
- .filter(([, value]) => typeof value === "number")
36
- .map(([name, value]) => ` - ${name}: ${value}`);
37
- if (statEntries.length > 0) {
38
- lines.push("Stats:");
39
- lines.push(...statEntries);
40
- }
41
- const symptoms = Array.isArray(snapshot.symptoms) ? snapshot.symptoms.filter(isObject) : [];
42
- if (symptoms.length > 0) {
43
- lines.push("Symptoms:");
44
- lines.push(...symptoms.map((symptom) => {
45
- const code = typeof symptom.code === "string" ? symptom.code : "unknown";
46
- const severity = typeof symptom.severity === "string" ? symptom.severity : "unknown";
47
- const message = typeof symptom.message === "string" ? symptom.message : "";
48
- return ` - ${code}: ${severity}${message ? ` (${message})` : ""}`;
49
- }));
50
- }
51
- return `${lines.join("\n")}\n`;
52
- }
53
- export function renderApprovalList(approvals) {
54
- if (approvals.length === 0) {
55
- return "No approvals matched.\n";
56
- }
57
- return approvals.map((approval) => {
58
- const status = typeof approval.status === "string" ? approval.status : "unknown";
59
- const toolName = typeof approval.toolName === "string" ? approval.toolName : "unknown_tool";
60
- const approvalId = typeof approval.approvalId === "string" ? approval.approvalId : "unknown";
61
- const sessionId = typeof approval.sessionId === "string" ? ` session=${approval.sessionId}` : "";
62
- const requestId = typeof approval.requestId === "string" ? ` request=${approval.requestId}` : "";
63
- const reason = typeof approval.approvalReason === "string" ? ` reason=${approval.approvalReason}` : "";
64
- const requestedAt = formatTimestamp(approval.requestedAt);
65
- const resolvedAt = formatTimestamp(approval.resolvedAt);
66
- const requested = requestedAt ? ` requested=${requestedAt}` : "";
67
- const resolved = resolvedAt ? ` resolved=${resolvedAt}` : "";
68
- return `${approvalId} status=${status} tool=${toolName}${sessionId}${requestId}${reason}${requested}${resolved}`;
69
- }).join("\n") + "\n";
70
- }
71
- export function renderRequestList(requests) {
72
- if (requests.length === 0) {
73
- return "No requests matched.\n";
74
- }
75
- return requests.map((request) => {
76
- const requestId = typeof request.requestId === "string" ? request.requestId : "unknown";
77
- const sessionId = typeof request.sessionId === "string" ? request.sessionId : "unknown";
78
- const agentId = typeof request.agentId === "string" ? request.agentId : "unknown";
79
- const state = typeof request.state === "string" ? request.state : "unknown";
80
- const currentAgent = typeof request.currentAgentId === "string" ? ` current=${request.currentAgentId}` : "";
81
- const resumable = typeof request.resumable === "boolean" ? ` resumable=${request.resumable}` : "";
82
- const updatedAt = formatTimestamp(request.updatedAt);
83
- const lastActivityAt = formatTimestamp(request.lastActivityAt);
84
- const updated = updatedAt ? ` updated=${updatedAt}` : "";
85
- const lastActivity = lastActivityAt ? ` activity=${lastActivityAt}` : "";
86
- return `${requestId} session=${sessionId} agent=${agentId}${currentAgent} state=${state}${resumable}${updated}${lastActivity}`;
87
- }).join("\n") + "\n";
88
- }
89
- export function renderOperatorOverview(overview, workspacePath) {
90
- const lines = [];
91
- const summary = typeof overview.summary === "string" ? overview.summary : "";
92
- lines.push(`Runtime overview ${workspacePath}`);
93
- if (summary) {
94
- lines.push(`Summary: ${summary}`);
95
- }
96
- const health = isObject(overview.health) ? overview.health : {};
97
- if (Object.keys(health).length > 0) {
98
- lines.push("");
99
- lines.push(renderHealthSnapshot(health, workspacePath).trimEnd());
100
- }
101
- const queue = isObject(overview.queue) ? overview.queue : {};
102
- if (Object.keys(queue).length > 0) {
103
- lines.push("");
104
- lines.push(`Queue: ${typeof queue.summary === "string" ? queue.summary : "unavailable"}`);
105
- }
106
- const governance = isObject(overview.governance) ? overview.governance : {};
107
- if (Object.keys(governance).length > 0) {
108
- lines.push("Governance:");
109
- lines.push(` - ${typeof governance.summary === "string" ? governance.summary : "unavailable"}`);
110
- }
111
- const approvals = isObject(overview.approvals) ? overview.approvals : {};
112
- const approvalItems = Array.isArray(approvals.items) ? approvals.items.filter(isObject) : [];
113
- lines.push(`Pending approvals: ${typeof approvals.total === "number" ? approvals.total : approvalItems.length}`);
114
- if (approvalItems.length > 0) {
115
- lines.push(renderApprovalList(approvalItems).trimEnd());
116
- }
117
- const requests = isObject(overview.requests) ? overview.requests : {};
118
- const requestItems = Array.isArray(requests.items) ? requests.items.filter(isObject) : [];
119
- lines.push(`Active requests: ${typeof requests.total === "number" ? requests.total : requestItems.length}`);
120
- if (requestItems.length > 0) {
121
- lines.push(renderRequestList(requestItems).trimEnd());
122
- }
123
- return `${lines.join("\n")}\n`;
124
- }
125
- export function renderBoundaryAnalysis(analysis, workspacePath) {
126
- const lines = [];
127
- const summary = isObject(analysis.summary) ? analysis.summary : {};
128
- const findings = Array.isArray(analysis.findings) ? analysis.findings.filter(isObject) : [];
129
- const errors = typeof summary.errorCount === "number" ? summary.errorCount : 0;
130
- const warnings = typeof summary.warningCount === "number" ? summary.warningCount : 0;
131
- const info = typeof summary.infoCount === "number" ? summary.infoCount : 0;
132
- lines.push(`Runtime boundary analysis ${workspacePath}`);
133
- lines.push(`Findings: errors=${errors} warnings=${warnings} info=${info}`);
134
- const agents = typeof summary.agentCount === "number" ? summary.agentCount : undefined;
135
- const tools = typeof summary.toolCount === "number" ? summary.toolCount : undefined;
136
- const skills = typeof summary.skillCount === "number" ? summary.skillCount : undefined;
137
- if (agents !== undefined || tools !== undefined || skills !== undefined) {
138
- lines.push(`Inventory: agents=${agents ?? "unknown"} tools=${tools ?? "unknown"} skills=${skills ?? "unknown"}`);
139
- }
140
- if (findings.length === 0) {
141
- lines.push("No boundary findings.");
142
- return `${lines.join("\n")}\n`;
143
- }
144
- lines.push("Boundary findings:");
145
- for (const finding of findings) {
146
- const severity = typeof finding.severity === "string" ? finding.severity : "unknown";
147
- const code = typeof finding.code === "string" ? finding.code : "unknown";
148
- const message = typeof finding.message === "string" ? finding.message : "";
149
- const agent = typeof finding.agentId === "string" ? ` agent=${finding.agentId}` : "";
150
- const tool = typeof finding.toolName === "string" ? ` tool=${finding.toolName}` : "";
151
- const skill = typeof finding.skillName === "string" ? ` skill=${finding.skillName}` : "";
152
- lines.push(` - ${severity} ${code}:${agent}${tool}${skill}${message ? ` ${message}` : ""}`);
153
- }
154
- return `${lines.join("\n")}\n`;
155
- }
1
+ function l(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function m(t){return typeof t=="string"&&t.trim().length>0?t.trim():null}function R(t){return`${JSON.stringify(t,null,2)}
2
+ `}function A(t,n){const e=[],r=typeof t.status=="string"?t.status:"unknown";e.push(`Runtime health ${n}: ${r}`);const d=l(t.checks)?t.checks:{},f=Object.entries(d).filter(([,s])=>l(s)).map(([s,i])=>{const o=i,g=typeof o.reason=="string"&&o.reason.trim().length>0?` (${o.reason})`:"";return` - ${s}: ${typeof o.status=="string"?o.status:"unknown"}${g}`});f.length>0&&(e.push("Checks:"),e.push(...f));const u=l(t.stats)?t.stats:{},a=[["activeRequestSlots",u.activeRequestSlots],["pendingRequestSlots",u.pendingRequestSlots],["pendingApprovals",u.pendingApprovals],["stuckRequests",u.stuckRequests],["llmSuccessRate1m",u.llmSuccessRate1m],["llmP95LatencyMs1m",u.llmP95LatencyMs1m]].filter(([,s])=>typeof s=="number").map(([s,i])=>` - ${s}: ${i}`);a.length>0&&(e.push("Stats:"),e.push(...a));const c=Array.isArray(t.symptoms)?t.symptoms.filter(l):[];return c.length>0&&(e.push("Symptoms:"),e.push(...c.map(s=>{const i=typeof s.code=="string"?s.code:"unknown",o=typeof s.severity=="string"?s.severity:"unknown",g=typeof s.message=="string"?s.message:"";return` - ${i}: ${o}${g?` (${g})`:""}`}))),`${e.join(`
3
+ `)}
4
+ `}function I(t){return t.length===0?`No approvals matched.
5
+ `:t.map(n=>{const e=typeof n.status=="string"?n.status:"unknown",r=typeof n.toolName=="string"?n.toolName:"unknown_tool",d=typeof n.approvalId=="string"?n.approvalId:"unknown",f=typeof n.sessionId=="string"?` session=${n.sessionId}`:"",u=typeof n.requestId=="string"?` request=${n.requestId}`:"",a=typeof n.approvalReason=="string"?` reason=${n.approvalReason}`:"",c=m(n.requestedAt),s=m(n.resolvedAt),i=c?` requested=${c}`:"",o=s?` resolved=${s}`:"";return`${d} status=${e} tool=${r}${f}${u}${a}${i}${o}`}).join(`
6
+ `)+`
7
+ `}function b(t){return t.length===0?`No requests matched.
8
+ `:t.map(n=>{const e=typeof n.requestId=="string"?n.requestId:"unknown",r=typeof n.sessionId=="string"?n.sessionId:"unknown",d=typeof n.agentId=="string"?n.agentId:"unknown",f=typeof n.state=="string"?n.state:"unknown",u=typeof n.currentAgentId=="string"?` current=${n.currentAgentId}`:"",a=typeof n.resumable=="boolean"?` resumable=${n.resumable}`:"",c=m(n.updatedAt),s=m(n.lastActivityAt),i=c?` updated=${c}`:"",o=s?` activity=${s}`:"";return`${e} session=${r} agent=${d}${u} state=${f}${a}${i}${o}`}).join(`
9
+ `)+`
10
+ `}function q(t,n){const e=[],r=typeof t.summary=="string"?t.summary:"";e.push(`Runtime overview ${n}`),r&&e.push(`Summary: ${r}`);const d=l(t.health)?t.health:{};Object.keys(d).length>0&&(e.push(""),e.push(A(d,n).trimEnd()));const f=l(t.queue)?t.queue:{};Object.keys(f).length>0&&(e.push(""),e.push(`Queue: ${typeof f.summary=="string"?f.summary:"unavailable"}`));const u=l(t.governance)?t.governance:{};Object.keys(u).length>0&&(e.push("Governance:"),e.push(` - ${typeof u.summary=="string"?u.summary:"unavailable"}`));const a=l(t.approvals)?t.approvals:{},c=Array.isArray(a.items)?a.items.filter(l):[];e.push(`Pending approvals: ${typeof a.total=="number"?a.total:c.length}`),c.length>0&&e.push(I(c).trimEnd());const s=l(t.requests)?t.requests:{},i=Array.isArray(s.items)?s.items.filter(l):[];return e.push(`Active requests: ${typeof s.total=="number"?s.total:i.length}`),i.length>0&&e.push(b(i).trimEnd()),`${e.join(`
11
+ `)}
12
+ `}function C(t,n){const e=[],r=l(t.summary)?t.summary:{},d=Array.isArray(t.findings)?t.findings.filter(l):[],f=typeof r.errorCount=="number"?r.errorCount:0,u=typeof r.warningCount=="number"?r.warningCount:0,a=typeof r.infoCount=="number"?r.infoCount:0;e.push(`Runtime boundary analysis ${n}`),e.push(`Findings: errors=${f} warnings=${u} info=${a}`);const c=typeof r.agentCount=="number"?r.agentCount:void 0,s=typeof r.toolCount=="number"?r.toolCount:void 0,i=typeof r.skillCount=="number"?r.skillCount:void 0;if((c!==void 0||s!==void 0||i!==void 0)&&e.push(`Inventory: agents=${c??"unknown"} tools=${s??"unknown"} skills=${i??"unknown"}`),d.length===0)return e.push("No boundary findings."),`${e.join(`
13
+ `)}
14
+ `;e.push("Boundary findings:");for(const o of d){const g=typeof o.severity=="string"?o.severity:"unknown",p=typeof o.code=="string"?o.code:"unknown",y=typeof o.message=="string"?o.message:"",$=typeof o.agentId=="string"?` agent=${o.agentId}`:"",h=typeof o.toolName=="string"?` tool=${o.toolName}`:"",k=typeof o.skillName=="string"?` skill=${o.skillName}`:"";e.push(` - ${g} ${p}:${$}${h}${k}${y?` ${y}`:""}`)}return`${e.join(`
15
+ `)}
16
+ `}export{I as renderApprovalList,C as renderBoundaryAnalysis,A as renderHealthSnapshot,R as renderJson,q as renderOperatorOverview,b as renderRequestList};
@@ -1,270 +1,16 @@
1
- import { parseAcpServeOptions, parseHttpServeOptions, parseRuntimeMcpServeOptions, parseWorkspaceOnlyOptions, renderUsage } from "./options.js";
2
- import { startManagedHttpService, stopManagedHttpService } from "./managed-service-commands.js";
3
- import { resolveCliWorkspaceRoot, validateCliWorkspaceRoot } from "./workspace.js";
4
- function resolveValidatedWorkspace(cwd, workspaceRoot, stderr) {
5
- const workspacePath = resolveCliWorkspaceRoot(cwd, workspaceRoot);
6
- const workspaceError = validateCliWorkspaceRoot(workspacePath, workspaceRoot);
7
- if (workspaceError) {
8
- stderr(`${workspaceError}\n`);
9
- return undefined;
10
- }
11
- return workspacePath;
12
- }
13
- export async function handleAcpCommand(subcommandAndArgs, io, deps) {
14
- const [subcommand, ...subcommandArgs] = subcommandAndArgs;
15
- const { cwd, stderr } = io;
16
- const { createHarness, serveAcp, serveAcpHttp, spawnManagedCliProcess, isManagedProcessRunning, signalManagedProcess } = deps;
17
- if (subcommand !== "serve" && subcommand !== "start" && subcommand !== "stop") {
18
- stderr(renderUsage());
19
- return 1;
20
- }
21
- const parsedStop = subcommand === "stop" ? parseWorkspaceOnlyOptions(subcommandArgs) : undefined;
22
- const parsedServe = subcommand !== "stop"
23
- ? parseAcpServeOptions(subcommandArgs, subcommand === "start" ? "http" : "stdio")
24
- : undefined;
25
- const parseError = parsedStop?.error ?? parsedServe?.error;
26
- if (parseError) {
27
- stderr(`${parseError}\n`);
28
- stderr(renderUsage());
29
- return 1;
30
- }
31
- try {
32
- const workspaceRoot = parsedStop?.workspaceRoot ?? parsedServe?.workspaceRoot;
33
- const workspacePath = resolveValidatedWorkspace(cwd, workspaceRoot, stderr);
34
- if (!workspacePath) {
35
- return 1;
36
- }
37
- if (subcommand === "start") {
38
- if (!parsedServe) {
39
- stderr(renderUsage());
40
- return 1;
41
- }
42
- if (parsedServe.transport !== "http") {
43
- stderr("ACP start only supports --transport http. Use `acp serve --transport stdio` for stdio clients.\n");
44
- return 1;
45
- }
46
- const args = ["acp", "serve", "--workspace", workspacePath, "--transport", "http"];
47
- if (parsedServe.hostname) {
48
- args.push("--host", parsedServe.hostname);
49
- }
50
- if (typeof parsedServe.port === "number") {
51
- args.push("--port", String(parsedServe.port));
52
- }
53
- return startManagedHttpService({ service: "acp", workspacePath, args, stderr, spawnManagedCliProcess, isManagedProcessRunning });
54
- }
55
- if (subcommand === "stop") {
56
- return stopManagedHttpService({ service: "acp", workspacePath, stderr, isManagedProcessRunning, signalManagedProcess });
57
- }
58
- if (!parsedServe) {
59
- stderr(renderUsage());
60
- return 1;
61
- }
62
- const runtime = await createHarness(workspacePath);
63
- if (parsedServe.transport === "http") {
64
- const server = await serveAcpHttp(runtime, {
65
- hostname: parsedServe.hostname,
66
- port: parsedServe.port,
67
- });
68
- stderr(`Serving ACP over http from ${workspacePath} at ${server.rpcUrl} (events ${server.eventsUrl})\n`);
69
- await server.completed;
70
- }
71
- else {
72
- stderr(`Serving ACP over stdio from ${workspacePath}\n`);
73
- const server = serveAcp(runtime);
74
- await server.completed;
75
- }
76
- await runtime.stop();
77
- return 0;
78
- }
79
- catch (error) {
80
- const message = error instanceof Error ? error.message : String(error);
81
- stderr(`${message}\n`);
82
- return 1;
83
- }
84
- }
85
- export async function handleAgUiCommand(subcommandAndArgs, io, deps) {
86
- const [subcommand, ...subcommandArgs] = subcommandAndArgs;
87
- const { cwd, stderr } = io;
88
- const { createHarness, serveAgUi, spawnManagedCliProcess, isManagedProcessRunning, signalManagedProcess } = deps;
89
- if (subcommand !== "serve" && subcommand !== "start" && subcommand !== "stop") {
90
- stderr(renderUsage());
91
- return 1;
92
- }
93
- const parsedStop = subcommand === "stop" ? parseWorkspaceOnlyOptions(subcommandArgs) : undefined;
94
- const parsedServe = subcommand !== "stop" ? parseHttpServeOptions(subcommandArgs, "AG-UI") : undefined;
95
- const parseError = parsedStop?.error ?? parsedServe?.error;
96
- if (parseError) {
97
- stderr(`${parseError}\n`);
98
- stderr(renderUsage());
99
- return 1;
100
- }
101
- try {
102
- const workspaceRoot = parsedStop?.workspaceRoot ?? parsedServe?.workspaceRoot;
103
- const workspacePath = resolveValidatedWorkspace(cwd, workspaceRoot, stderr);
104
- if (!workspacePath) {
105
- return 1;
106
- }
107
- if (subcommand === "start") {
108
- const args = ["ag-ui", "serve", "--workspace", workspacePath];
109
- if (parsedServe?.hostname) {
110
- args.push("--host", parsedServe.hostname);
111
- }
112
- if (typeof parsedServe?.port === "number") {
113
- args.push("--port", String(parsedServe.port));
114
- }
115
- return startManagedHttpService({ service: "ag-ui", workspacePath, args, stderr, spawnManagedCliProcess, isManagedProcessRunning });
116
- }
117
- if (subcommand === "stop") {
118
- return stopManagedHttpService({ service: "ag-ui", workspacePath, stderr, isManagedProcessRunning, signalManagedProcess });
119
- }
120
- if (!parsedServe) {
121
- stderr(renderUsage());
122
- return 1;
123
- }
124
- const runtime = await createHarness(workspacePath);
125
- const server = await serveAgUi(runtime, {
126
- hostname: parsedServe.hostname,
127
- port: parsedServe.port,
128
- });
129
- stderr(`Serving AG-UI over http from ${workspacePath} at ${server.runUrl}\n`);
130
- await server.completed;
131
- await runtime.stop();
132
- return 0;
133
- }
134
- catch (error) {
135
- const message = error instanceof Error ? error.message : String(error);
136
- stderr(`${message}\n`);
137
- return 1;
138
- }
139
- }
140
- export async function handleA2aCommand(subcommandAndArgs, io, deps) {
141
- const [subcommand, ...subcommandArgs] = subcommandAndArgs;
142
- const { cwd, stderr } = io;
143
- const { createHarness, serveA2a, spawnManagedCliProcess, isManagedProcessRunning, signalManagedProcess } = deps;
144
- if (subcommand !== "serve" && subcommand !== "start" && subcommand !== "stop") {
145
- stderr(renderUsage());
146
- return 1;
147
- }
148
- const parsedStop = subcommand === "stop" ? parseWorkspaceOnlyOptions(subcommandArgs) : undefined;
149
- const parsedServe = subcommand !== "stop" ? parseHttpServeOptions(subcommandArgs, "A2A") : undefined;
150
- const parseError = parsedStop?.error ?? parsedServe?.error;
151
- if (parseError) {
152
- stderr(`${parseError}\n`);
153
- stderr(renderUsage());
154
- return 1;
155
- }
156
- try {
157
- const workspaceRoot = parsedStop?.workspaceRoot ?? parsedServe?.workspaceRoot;
158
- const workspacePath = resolveValidatedWorkspace(cwd, workspaceRoot, stderr);
159
- if (!workspacePath) {
160
- return 1;
161
- }
162
- if (subcommand === "start") {
163
- const args = ["a2a", "serve", "--workspace", workspacePath];
164
- if (parsedServe?.hostname) {
165
- args.push("--host", parsedServe.hostname);
166
- }
167
- if (typeof parsedServe?.port === "number") {
168
- args.push("--port", String(parsedServe.port));
169
- }
170
- return startManagedHttpService({ service: "a2a", workspacePath, args, stderr, spawnManagedCliProcess, isManagedProcessRunning });
171
- }
172
- if (subcommand === "stop") {
173
- return stopManagedHttpService({ service: "a2a", workspacePath, stderr, isManagedProcessRunning, signalManagedProcess });
174
- }
175
- if (!parsedServe) {
176
- stderr(renderUsage());
177
- return 1;
178
- }
179
- const runtime = await createHarness(workspacePath);
180
- const server = await serveA2a(runtime, {
181
- hostname: parsedServe.hostname,
182
- port: parsedServe.port,
183
- });
184
- stderr(`Serving A2A over http from ${workspacePath} at ${server.rpcUrl} (card ${server.agentCardUrl})\n`);
185
- await server.completed;
186
- await runtime.stop();
187
- return 0;
188
- }
189
- catch (error) {
190
- const message = error instanceof Error ? error.message : String(error);
191
- stderr(`${message}\n`);
192
- return 1;
193
- }
194
- }
195
- export async function handleMcpCommand(subcommandAndArgs, io, deps) {
196
- const [subcommand, ...subcommandArgs] = subcommandAndArgs;
197
- const { cwd, stderr } = io;
198
- const { createHarness, serveRuntimeMcp, serveRuntimeMcpStreamableHttp, spawnManagedCliProcess, isManagedProcessRunning, signalManagedProcess } = deps;
199
- if (subcommand !== "serve" && subcommand !== "start" && subcommand !== "stop") {
200
- stderr(renderUsage());
201
- return 1;
202
- }
203
- const parsedStop = subcommand === "stop" ? parseWorkspaceOnlyOptions(subcommandArgs) : undefined;
204
- const parsedServe = subcommand !== "stop"
205
- ? parseRuntimeMcpServeOptions(subcommandArgs, subcommand === "start" ? "streamable-http" : "stdio")
206
- : undefined;
207
- const parseError = parsedStop?.error ?? parsedServe?.error;
208
- if (parseError) {
209
- stderr(`${parseError}\n`);
210
- stderr(renderUsage());
211
- return 1;
212
- }
213
- try {
214
- const workspaceRoot = parsedStop?.workspaceRoot ?? parsedServe?.workspaceRoot;
215
- const workspacePath = resolveValidatedWorkspace(cwd, workspaceRoot, stderr);
216
- if (!workspacePath) {
217
- return 1;
218
- }
219
- if (subcommand === "start") {
220
- if (!parsedServe) {
221
- stderr(renderUsage());
222
- return 1;
223
- }
224
- if (parsedServe.transport !== "streamable-http") {
225
- stderr("MCP start only supports --transport streamable-http. Use `mcp serve --transport stdio` for stdio clients.\n");
226
- return 1;
227
- }
228
- const args = ["mcp", "serve", "--workspace", workspacePath, "--transport", "streamable-http"];
229
- if (parsedServe.hostname) {
230
- args.push("--host", parsedServe.hostname);
231
- }
232
- if (typeof parsedServe.port === "number") {
233
- args.push("--port", String(parsedServe.port));
234
- }
235
- return startManagedHttpService({ service: "mcp", workspacePath, args, stderr, spawnManagedCliProcess, isManagedProcessRunning });
236
- }
237
- if (subcommand === "stop") {
238
- return stopManagedHttpService({ service: "mcp", workspacePath, stderr, isManagedProcessRunning, signalManagedProcess });
239
- }
240
- if (!parsedServe) {
241
- stderr(renderUsage());
242
- return 1;
243
- }
244
- const runtime = await createHarness(workspacePath);
245
- if (parsedServe.transport === "streamable-http") {
246
- const server = await serveRuntimeMcpStreamableHttp(runtime, {
247
- hostname: parsedServe.hostname,
248
- port: parsedServe.port,
249
- });
250
- stderr(`Serving runtime MCP over streamable HTTP from ${workspacePath} at ${server.url}\n`);
251
- await server.completed;
252
- }
253
- else {
254
- stderr(`Serving runtime MCP over stdio from ${workspacePath}\n`);
255
- const server = await serveRuntimeMcp(runtime);
256
- await new Promise((resolve, reject) => {
257
- process.stdin.on("end", resolve);
258
- process.stdin.on("error", reject);
259
- });
260
- await server.close();
261
- }
262
- await runtime.stop();
263
- return 0;
264
- }
265
- catch (error) {
266
- const message = error instanceof Error ? error.message : String(error);
267
- stderr(`${message}\n`);
268
- return 1;
269
- }
270
- }
1
+ import{parseAcpServeOptions as y,parseHttpServeOptions as R,parseRuntimeMcpServeOptions as U,parseWorkspaceOnlyOptions as P,renderUsage as u}from"./options.js";import{startManagedHttpService as A,stopManagedHttpService as M}from"./managed-service-commands.js";import{resolveCliWorkspaceRoot as H,validateCliWorkspaceRoot as E}from"./workspace.js";function $(d,m,f){const t=H(d,m),c=E(t,m);if(c){f(`${c}
2
+ `);return}return t}async function G(d,m,f){const[t,...c]=d,{cwd:w,stderr:r}=m,{createHarness:l,serveAcp:S,serveAcpHttp:k,spawnManagedCliProcess:g,isManagedProcessRunning:v,signalManagedProcess:h}=f;if(t!=="serve"&&t!=="start"&&t!=="stop")return r(u()),1;const o=t==="stop"?P(c):void 0,e=t!=="stop"?y(c,t==="start"?"http":"stdio"):void 0,p=o?.error??e?.error;if(p)return r(`${p}
3
+ `),r(u()),1;try{const s=o?.workspaceRoot??e?.workspaceRoot,n=$(w,s,r);if(!n)return 1;if(t==="start"){if(!e)return r(u()),1;if(e.transport!=="http")return r("ACP start only supports --transport http. Use `acp serve --transport stdio` for stdio clients.\n"),1;const a=["acp","serve","--workspace",n,"--transport","http"];return e.hostname&&a.push("--host",e.hostname),typeof e.port=="number"&&a.push("--port",String(e.port)),A({service:"acp",workspacePath:n,args:a,stderr:r,spawnManagedCliProcess:g,isManagedProcessRunning:v})}if(t==="stop")return M({service:"acp",workspacePath:n,stderr:r,isManagedProcessRunning:v,signalManagedProcess:h});if(!e)return r(u()),1;const i=await l(n);if(e.transport==="http"){const a=await k(i,{hostname:e.hostname,port:e.port});r(`Serving ACP over http from ${n} at ${a.rpcUrl} (events ${a.eventsUrl})
4
+ `),await a.completed}else r(`Serving ACP over stdio from ${n}
5
+ `),await S(i).completed;return await i.stop(),0}catch(s){const n=s instanceof Error?s.message:String(s);return r(`${n}
6
+ `),1}}async function I(d,m,f){const[t,...c]=d,{cwd:w,stderr:r}=m,{createHarness:l,serveAgUi:S,spawnManagedCliProcess:k,isManagedProcessRunning:g,signalManagedProcess:v}=f;if(t!=="serve"&&t!=="start"&&t!=="stop")return r(u()),1;const h=t==="stop"?P(c):void 0,o=t!=="stop"?R(c,"AG-UI"):void 0,e=h?.error??o?.error;if(e)return r(`${e}
7
+ `),r(u()),1;try{const p=h?.workspaceRoot??o?.workspaceRoot,s=$(w,p,r);if(!s)return 1;if(t==="start"){const a=["ag-ui","serve","--workspace",s];return o?.hostname&&a.push("--host",o.hostname),typeof o?.port=="number"&&a.push("--port",String(o.port)),A({service:"ag-ui",workspacePath:s,args:a,stderr:r,spawnManagedCliProcess:k,isManagedProcessRunning:g})}if(t==="stop")return M({service:"ag-ui",workspacePath:s,stderr:r,isManagedProcessRunning:g,signalManagedProcess:v});if(!o)return r(u()),1;const n=await l(s),i=await S(n,{hostname:o.hostname,port:o.port});return r(`Serving AG-UI over http from ${s} at ${i.runUrl}
8
+ `),await i.completed,await n.stop(),0}catch(p){const s=p instanceof Error?p.message:String(p);return r(`${s}
9
+ `),1}}async function T(d,m,f){const[t,...c]=d,{cwd:w,stderr:r}=m,{createHarness:l,serveA2a:S,spawnManagedCliProcess:k,isManagedProcessRunning:g,signalManagedProcess:v}=f;if(t!=="serve"&&t!=="start"&&t!=="stop")return r(u()),1;const h=t==="stop"?P(c):void 0,o=t!=="stop"?R(c,"A2A"):void 0,e=h?.error??o?.error;if(e)return r(`${e}
10
+ `),r(u()),1;try{const p=h?.workspaceRoot??o?.workspaceRoot,s=$(w,p,r);if(!s)return 1;if(t==="start"){const a=["a2a","serve","--workspace",s];return o?.hostname&&a.push("--host",o.hostname),typeof o?.port=="number"&&a.push("--port",String(o.port)),A({service:"a2a",workspacePath:s,args:a,stderr:r,spawnManagedCliProcess:k,isManagedProcessRunning:g})}if(t==="stop")return M({service:"a2a",workspacePath:s,stderr:r,isManagedProcessRunning:g,signalManagedProcess:v});if(!o)return r(u()),1;const n=await l(s),i=await S(n,{hostname:o.hostname,port:o.port});return r(`Serving A2A over http from ${s} at ${i.rpcUrl} (card ${i.agentCardUrl})
11
+ `),await i.completed,await n.stop(),0}catch(p){const s=p instanceof Error?p.message:String(p);return r(`${s}
12
+ `),1}}async function V(d,m,f){const[t,...c]=d,{cwd:w,stderr:r}=m,{createHarness:l,serveRuntimeMcp:S,serveRuntimeMcpStreamableHttp:k,spawnManagedCliProcess:g,isManagedProcessRunning:v,signalManagedProcess:h}=f;if(t!=="serve"&&t!=="start"&&t!=="stop")return r(u()),1;const o=t==="stop"?P(c):void 0,e=t!=="stop"?U(c,t==="start"?"streamable-http":"stdio"):void 0,p=o?.error??e?.error;if(p)return r(`${p}
13
+ `),r(u()),1;try{const s=o?.workspaceRoot??e?.workspaceRoot,n=$(w,s,r);if(!n)return 1;if(t==="start"){if(!e)return r(u()),1;if(e.transport!=="streamable-http")return r("MCP start only supports --transport streamable-http. Use `mcp serve --transport stdio` for stdio clients.\n"),1;const a=["mcp","serve","--workspace",n,"--transport","streamable-http"];return e.hostname&&a.push("--host",e.hostname),typeof e.port=="number"&&a.push("--port",String(e.port)),A({service:"mcp",workspacePath:n,args:a,stderr:r,spawnManagedCliProcess:g,isManagedProcessRunning:v})}if(t==="stop")return M({service:"mcp",workspacePath:n,stderr:r,isManagedProcessRunning:v,signalManagedProcess:h});if(!e)return r(u()),1;const i=await l(n);if(e.transport==="streamable-http"){const a=await k(i,{hostname:e.hostname,port:e.port});r(`Serving runtime MCP over streamable HTTP from ${n} at ${a.url}
14
+ `),await a.completed}else{r(`Serving runtime MCP over stdio from ${n}
15
+ `);const a=await S(i);await new Promise((b,C)=>{process.stdin.on("end",b),process.stdin.on("error",C)}),await a.close()}return await i.stop(),0}catch(s){const n=s instanceof Error?s.message:String(s);return r(`${n}
16
+ `),1}}export{T as handleA2aCommand,G as handleAcpCommand,I as handleAgUiCommand,V as handleMcpCommand};
@@ -1,67 +1 @@
1
- import { existsSync, readdirSync, statSync } from "node:fs";
2
- import path from "node:path";
3
- import { fileURLToPath } from "node:url";
4
- export function resolveCliWorkspaceRoot(cwd, inputPath) {
5
- const resolved = path.resolve(cwd, inputPath ?? ".");
6
- if (existsSync(path.join(resolved, "config", "runtime", "workspace.yaml"))) {
7
- return resolved;
8
- }
9
- if (path.basename(resolved) === "config" && hasCliConfigYaml(resolved)) {
10
- return path.dirname(resolved);
11
- }
12
- return resolved;
13
- }
14
- export function getWorkspaceConfigPath(workspaceRoot) {
15
- return path.join(workspaceRoot, "config", "runtime", "workspace.yaml");
16
- }
17
- export function hasCliConfigYaml(configRoot) {
18
- if (!existsSync(configRoot) || !statSync(configRoot).isDirectory()) {
19
- return false;
20
- }
21
- const pending = [configRoot];
22
- while (pending.length > 0) {
23
- const current = pending.pop();
24
- for (const entry of readdirSync(current, { withFileTypes: true })) {
25
- if (entry.isDirectory()) {
26
- if (entry.name === "node_modules") {
27
- continue;
28
- }
29
- pending.push(path.join(current, entry.name));
30
- continue;
31
- }
32
- if (entry.isFile() && /\.ya?ml$/i.test(entry.name)) {
33
- return true;
34
- }
35
- }
36
- }
37
- return false;
38
- }
39
- export function validateCliWorkspaceRoot(workspaceRoot, inputPath) {
40
- if (!existsSync(workspaceRoot)) {
41
- return undefined;
42
- }
43
- if (!statSync(workspaceRoot).isDirectory()) {
44
- const workspaceLabel = inputPath ? "Workspace path" : "Current directory";
45
- return `${workspaceLabel} is not a directory: ${workspaceRoot}`;
46
- }
47
- return undefined;
48
- }
49
- export function resolveCliConfigRoot(workspaceRoot) {
50
- if (path.basename(workspaceRoot) === "config") {
51
- return workspaceRoot;
52
- }
53
- return path.join(workspaceRoot, "config");
54
- }
55
- export function resolveFrameworkCliWorkspaceRoot(resolved) {
56
- const baseName = path.basename(resolved);
57
- if (baseName === "dist") {
58
- return resolved;
59
- }
60
- if (baseName === "src") {
61
- return path.dirname(resolved);
62
- }
63
- return resolved;
64
- }
65
- export function frameworkCliWorkspaceRoot() {
66
- return resolveFrameworkCliWorkspaceRoot(fileURLToPath(new URL("..", import.meta.url)));
67
- }
1
+ import{existsSync as o,readdirSync as u,statSync as a}from"node:fs";import t from"node:path";import{fileURLToPath as f}from"node:url";function d(e,r){const n=t.resolve(e,r??".");return o(t.join(n,"config","runtime","workspace.yaml"))?n:t.basename(n)==="config"&&s(n)?t.dirname(n):n}function y(e){return t.join(e,"config","runtime","workspace.yaml")}function s(e){if(!o(e)||!a(e).isDirectory())return!1;const r=[e];for(;r.length>0;){const n=r.pop();for(const i of u(n,{withFileTypes:!0})){if(i.isDirectory()){if(i.name==="node_modules")continue;r.push(t.join(n,i.name));continue}if(i.isFile()&&/\.ya?ml$/i.test(i.name))return!0}}return!1}function C(e,r){if(o(e)&&!a(e).isDirectory())return`${r?"Workspace path":"Current directory"} is not a directory: ${e}`}function g(e){return t.basename(e)==="config"?e:t.join(e,"config")}function c(e){const r=t.basename(e);return r==="dist"?e:r==="src"?t.dirname(e):e}function h(){return c(f(new URL("..",import.meta.url)))}export{h as frameworkCliWorkspaceRoot,y as getWorkspaceConfigPath,s as hasCliConfigYaml,g as resolveCliConfigRoot,d as resolveCliWorkspaceRoot,c as resolveFrameworkCliWorkspaceRoot,C as validateCliWorkspaceRoot};
package/dist/cli.js CHANGED
@@ -1,8 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export * from "./cli/main.js";
3
- import { runCli, resolveInvokedCliHref } from "./cli/main.js";
4
- const invokedPath = resolveInvokedCliHref(process.argv[1]);
5
- if (import.meta.url === invokedPath) {
6
- const exitCode = await runCli(process.argv.slice(2));
7
- process.exit(exitCode);
8
- }
2
+ export*from"./cli/main.js";import{runCli as o,resolveInvokedCliHref as r}from"./cli/main.js";const i=r(process.argv[1]);if(import.meta.url===i){const e=await o(process.argv.slice(2));process.exit(e)}
@@ -1 +1 @@
1
- export * from "../protocol/acp/harness-client.js";
1
+ export*from"../protocol/acp/harness-client.js";
@@ -1,67 +1 @@
1
- import { cancelRequest, createAgentHarness, getApproval, getHealth, getOperatorOverview, getRequestPlanState, getRequest, getSession, listApprovals, listRequestEvents, listRequests, listRequestTraceItems, listSessionSummaries, listSessions, request, resolveApproval, subscribe, stop, } from "../api.js";
2
- export class InProcessHarnessClient {
3
- runtime;
4
- constructor(runtime) {
5
- this.runtime = runtime;
6
- }
7
- request(options) {
8
- return request(this.runtime, options);
9
- }
10
- resolveApproval(options) {
11
- return resolveApproval(this.runtime, options);
12
- }
13
- cancelRequest(options) {
14
- return cancelRequest(this.runtime, options);
15
- }
16
- subscribe(listener) {
17
- return subscribe(this.runtime, listener);
18
- }
19
- listSessions(filter) {
20
- return listSessions(this.runtime, filter);
21
- }
22
- listSessionSummaries(filter) {
23
- return listSessionSummaries(this.runtime, filter);
24
- }
25
- listRequests(filter) {
26
- return listRequests(this.runtime, filter);
27
- }
28
- getSession(sessionId) {
29
- return getSession(this.runtime, sessionId);
30
- }
31
- getRequest(requestId) {
32
- return getRequest(this.runtime, requestId);
33
- }
34
- listApprovals(filter) {
35
- return listApprovals(this.runtime, filter);
36
- }
37
- getApproval(approvalId) {
38
- return getApproval(this.runtime, approvalId);
39
- }
40
- getRequestPlanState(input) {
41
- return getRequestPlanState(this.runtime, input);
42
- }
43
- listRequestEvents(input) {
44
- return listRequestEvents(this.runtime, input);
45
- }
46
- listRequestTraceItems(input) {
47
- return listRequestTraceItems(this.runtime, input);
48
- }
49
- getHealth() {
50
- return getHealth(this.runtime);
51
- }
52
- getOperatorOverview(options) {
53
- return getOperatorOverview(this.runtime, options);
54
- }
55
- async stop() {
56
- await stop(this.runtime);
57
- }
58
- }
59
- export function createInProcessHarnessClient(runtime) {
60
- return new InProcessHarnessClient(runtime);
61
- }
62
- export async function createAgentHarnessClient(workspaceRoot, options) {
63
- const runtime = workspaceRoot === undefined
64
- ? await createAgentHarness()
65
- : await createAgentHarness(workspaceRoot, options);
66
- return new InProcessHarnessClient(runtime);
67
- }
1
+ import{cancelRequest as i,createAgentHarness as r,getApproval as u,getHealth as a,getOperatorOverview as l,getRequestPlanState as m,getRequest as o,getSession as c,listApprovals as h,listRequestEvents as p,listRequests as g,listRequestTraceItems as q,listSessionSummaries as v,listSessions as R,request as S,resolveApproval as A,subscribe as w,stop as H}from"../api.js";class s{runtime;constructor(e){this.runtime=e}request(e){return S(this.runtime,e)}resolveApproval(e){return A(this.runtime,e)}cancelRequest(e){return i(this.runtime,e)}subscribe(e){return w(this.runtime,e)}listSessions(e){return R(this.runtime,e)}listSessionSummaries(e){return v(this.runtime,e)}listRequests(e){return g(this.runtime,e)}getSession(e){return c(this.runtime,e)}getRequest(e){return o(this.runtime,e)}listApprovals(e){return h(this.runtime,e)}getApproval(e){return u(this.runtime,e)}getRequestPlanState(e){return m(this.runtime,e)}listRequestEvents(e){return p(this.runtime,e)}listRequestTraceItems(e){return q(this.runtime,e)}getHealth(){return a(this.runtime)}getOperatorOverview(e){return l(this.runtime,e)}async stop(){await H(this.runtime)}}function f(t){return new s(t)}async function I(t,e){const n=t===void 0?await r():await r(t,e);return new s(n)}export{s as InProcessHarnessClient,I as createAgentHarnessClient,f as createInProcessHarnessClient};
@@ -1,2 +1 @@
1
- export { AcpHarnessClient, createAcpHarnessClient, createAcpHttpHarnessClient, createAcpStdioHarnessClient } from "../protocol/acp/harness-client.js";
2
- export { InProcessHarnessClient, createAgentHarnessClient, createInProcessHarnessClient } from "./in-process.js";
1
+ import{AcpHarnessClient as s,createAcpHarnessClient as t,createAcpHttpHarnessClient as n,createAcpStdioHarnessClient as a}from"../protocol/acp/harness-client.js";import{InProcessHarnessClient as i,createAgentHarnessClient as H,createInProcessHarnessClient as l}from"./in-process.js";export{s as AcpHarnessClient,i as InProcessHarnessClient,t as createAcpHarnessClient,n as createAcpHttpHarnessClient,a as createAcpStdioHarnessClient,H as createAgentHarnessClient,l as createInProcessHarnessClient};
@@ -1 +0,0 @@
1
- export {};
package/dist/client.js CHANGED
@@ -1 +1 @@
1
- export * from "./client/index.js";
1
+ export*from"./client/index.js";