@botbotgo/agent-harness 0.0.474 → 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 +2 -2
  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 -411
  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 -1089
  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,137 +1,2 @@
1
- import { spawn } from "node:child_process";
2
- import { existsSync, openSync, readFileSync, readdirSync } from "node:fs";
3
- import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
4
- import { homedir } from "node:os";
5
- import path from "node:path";
6
- import { fileURLToPath } from "node:url";
7
- function resolveManagedServiceRoot(workspaceRoot) {
8
- return path.join(workspaceRoot, ".botbotgo", "services");
9
- }
10
- function managedServiceStatePath(workspaceRoot, service) {
11
- return path.join(resolveManagedServiceRoot(workspaceRoot), `${service}.json`);
12
- }
13
- export function managedServiceLogPath(workspaceRoot, service, stream) {
14
- return path.join(resolveManagedServiceRoot(workspaceRoot), `${service}.${stream}.log`);
15
- }
16
- export async function readManagedServiceState(workspaceRoot, service) {
17
- const statePath = managedServiceStatePath(workspaceRoot, service);
18
- if (!existsSync(statePath)) {
19
- return null;
20
- }
21
- try {
22
- return JSON.parse(await readFile(statePath, "utf8"));
23
- }
24
- catch {
25
- return null;
26
- }
27
- }
28
- export async function writeManagedServiceState(state) {
29
- const statePath = managedServiceStatePath(state.workspaceRoot, state.service);
30
- await mkdir(path.dirname(statePath), { recursive: true });
31
- await writeFile(statePath, `${JSON.stringify(state, null, 2)}\n`, "utf8");
32
- }
33
- export async function clearManagedServiceState(workspaceRoot, service) {
34
- await rm(managedServiceStatePath(workspaceRoot, service), { force: true });
35
- }
36
- export function defaultIsManagedProcessRunning(pid) {
37
- try {
38
- process.kill(pid, 0);
39
- return true;
40
- }
41
- catch {
42
- return false;
43
- }
44
- }
45
- export function defaultSignalManagedProcess(pid, signal) {
46
- process.kill(pid, signal);
47
- }
48
- function parseRequestedNodeMajor(cwd) {
49
- const nodeVersionPath = path.join(cwd, ".node-version");
50
- if (existsSync(nodeVersionPath)) {
51
- const value = readFileSync(nodeVersionPath, "utf8").trim();
52
- const major = Number.parseInt(value.replace(/^v/i, ""), 10);
53
- if (Number.isInteger(major) && major > 0) {
54
- return major;
55
- }
56
- }
57
- const packageJsonPath = path.join(cwd, "package.json");
58
- if (!existsSync(packageJsonPath)) {
59
- return undefined;
60
- }
61
- try {
62
- const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
63
- const match = packageJson.engines?.node?.match(/>=\s*(\d+)/);
64
- if (!match) {
65
- return undefined;
66
- }
67
- const major = Number.parseInt(match[1] ?? "", 10);
68
- return Number.isInteger(major) && major > 0 ? major : undefined;
69
- }
70
- catch {
71
- return undefined;
72
- }
73
- }
74
- function parseNodeMajorFromExecutable(nodePath) {
75
- const match = nodePath.match(/\/v(\d+)\.\d+\.\d+\/bin\/node$/);
76
- if (!match) {
77
- return undefined;
78
- }
79
- const major = Number.parseInt(match[1] ?? "", 10);
80
- return Number.isInteger(major) && major > 0 ? major : undefined;
81
- }
82
- function compareNodeVersionDirNames(left, right) {
83
- const leftParts = left.replace(/^v/i, "").split(".").map((part) => Number.parseInt(part, 10) || 0);
84
- const rightParts = right.replace(/^v/i, "").split(".").map((part) => Number.parseInt(part, 10) || 0);
85
- const length = Math.max(leftParts.length, rightParts.length);
86
- for (let index = 0; index < length; index += 1) {
87
- const leftValue = leftParts[index] ?? 0;
88
- const rightValue = rightParts[index] ?? 0;
89
- if (leftValue !== rightValue) {
90
- return rightValue - leftValue;
91
- }
92
- }
93
- return 0;
94
- }
95
- export function resolveManagedCliNodeExecutable(cwd, env = process.env, currentNodePath = process.execPath, currentNodeVersion = process.versions.node) {
96
- const requestedMajor = parseRequestedNodeMajor(cwd);
97
- if (!requestedMajor) {
98
- return currentNodePath;
99
- }
100
- const currentMajor = Number.parseInt(currentNodeVersion.split(".")[0] ?? "", 10);
101
- if (currentMajor === requestedMajor) {
102
- return currentNodePath;
103
- }
104
- const home = env.HOME ?? env.USERPROFILE ?? homedir();
105
- const versionsRoot = path.join(home, ".nvm", "versions", "node");
106
- if (!existsSync(versionsRoot)) {
107
- return currentNodePath;
108
- }
109
- const preferredVersion = readdirSync(versionsRoot, { withFileTypes: true })
110
- .filter((entry) => entry.isDirectory() && entry.name.startsWith(`v${requestedMajor}.`))
111
- .map((entry) => entry.name)
112
- .sort(compareNodeVersionDirNames)[0];
113
- if (!preferredVersion) {
114
- return currentNodePath;
115
- }
116
- const preferredNodePath = path.join(versionsRoot, preferredVersion, "bin", "node");
117
- if (!existsSync(preferredNodePath)) {
118
- return currentNodePath;
119
- }
120
- const preferredMajor = parseNodeMajorFromExecutable(preferredNodePath);
121
- return preferredMajor === requestedMajor ? preferredNodePath : currentNodePath;
122
- }
123
- export async function defaultSpawnManagedCliProcess(input) {
124
- await mkdir(path.dirname(input.stdoutPath), { recursive: true });
125
- const stdoutFd = openSync(input.stdoutPath, "a");
126
- const stderrFd = openSync(input.stderrPath, "a");
127
- const child = spawn(resolveManagedCliNodeExecutable(input.cwd), [fileURLToPath(import.meta.url), ...input.args], {
128
- cwd: input.cwd,
129
- detached: true,
130
- stdio: ["ignore", stdoutFd, stderrFd],
131
- });
132
- child.unref();
133
- return { pid: child.pid };
134
- }
135
- export async function sleep(ms) {
136
- await new Promise((resolve) => setTimeout(resolve, ms));
137
- }
1
+ import{spawn as S}from"node:child_process";import{existsSync as c,openSync as l,readFileSync as g,readdirSync as j}from"node:fs";import{mkdir as h,readFile as M,rm as b,writeFile as w}from"node:fs/promises";import{homedir as x}from"node:os";import i from"node:path";import{fileURLToPath as y}from"node:url";function v(e){return i.join(e,".botbotgo","services")}function p(e,r){return i.join(v(e),`${r}.json`)}function L(e,r,t){return i.join(v(e),`${r}.${t}.log`)}async function T(e,r){const t=p(e,r);if(!c(t))return null;try{return JSON.parse(await M(t,"utf8"))}catch{return null}}async function q(e){const r=p(e.workspaceRoot,e.service);await h(i.dirname(r),{recursive:!0}),await w(r,`${JSON.stringify(e,null,2)}
2
+ `,"utf8")}async function C(e,r){await b(p(e,r),{force:!0})}function D(e){try{return process.kill(e,0),!0}catch{return!1}}function U(e,r){process.kill(e,r)}function P(e){const r=i.join(e,".node-version");if(c(r)){const a=g(r,"utf8").trim(),n=Number.parseInt(a.replace(/^v/i,""),10);if(Number.isInteger(n)&&n>0)return n}const t=i.join(e,"package.json");if(c(t))try{const n=JSON.parse(g(t,"utf8")).engines?.node?.match(/>=\s*(\d+)/);if(!n)return;const o=Number.parseInt(n[1]??"",10);return Number.isInteger(o)&&o>0?o:void 0}catch{return}}function N(e){const r=e.match(/\/v(\d+)\.\d+\.\d+\/bin\/node$/);if(!r)return;const t=Number.parseInt(r[1]??"",10);return Number.isInteger(t)&&t>0?t:void 0}function I(e,r){const t=e.replace(/^v/i,"").split(".").map(o=>Number.parseInt(o,10)||0),a=r.replace(/^v/i,"").split(".").map(o=>Number.parseInt(o,10)||0),n=Math.max(t.length,a.length);for(let o=0;o<n;o+=1){const u=t[o]??0,s=a[o]??0;if(u!==s)return s-u}return 0}function k(e,r=process.env,t=process.execPath,a=process.versions.node){const n=P(e);if(!n||Number.parseInt(a.split(".")[0]??"",10)===n)return t;const u=r.HOME??r.USERPROFILE??x(),s=i.join(u,".nvm","versions","node");if(!c(s))return t;const m=j(s,{withFileTypes:!0}).filter(d=>d.isDirectory()&&d.name.startsWith(`v${n}.`)).map(d=>d.name).sort(I)[0];if(!m)return t;const f=i.join(s,m,"bin","node");return c(f)&&N(f)===n?f:t}async function H(e){await h(i.dirname(e.stdoutPath),{recursive:!0});const r=l(e.stdoutPath,"a"),t=l(e.stderrPath,"a"),a=S(k(e.cwd),[y(import.meta.url),...e.args],{cwd:e.cwd,detached:!0,stdio:["ignore",r,t]});return a.unref(),{pid:a.pid}}async function W(e){await new Promise(r=>setTimeout(r,e))}export{C as clearManagedServiceState,D as defaultIsManagedProcessRunning,U as defaultSignalManagedProcess,H as defaultSpawnManagedCliProcess,L as managedServiceLogPath,T as readManagedServiceState,k as resolveManagedCliNodeExecutable,W as sleep,q as writeManagedServiceState};
@@ -1,108 +1 @@
1
- function isTemplate(value) {
2
- return value === "deep-research" || value === "single-agent";
3
- }
4
- export function parseInitOptions(args) {
5
- const options = {};
6
- for (let index = 0; index < args.length; index += 1) {
7
- const arg = args[index];
8
- if (arg === "--with-web-search") {
9
- options.withWebSearch = true;
10
- continue;
11
- }
12
- if (arg === "--no-web-search") {
13
- options.withWebSearch = false;
14
- continue;
15
- }
16
- if (arg === "--template" || arg === "--provider" || arg === "--model") {
17
- const value = args[index + 1];
18
- if (!value) {
19
- return { error: `Missing value for ${arg}` };
20
- }
21
- if (arg === "--template") {
22
- if (!isTemplate(value)) {
23
- return { error: `Unsupported template: ${value}` };
24
- }
25
- options.template = value;
26
- }
27
- else if (arg === "--provider") {
28
- options.provider = value;
29
- }
30
- else {
31
- options.model = value;
32
- }
33
- index += 1;
34
- continue;
35
- }
36
- return { error: `Unknown option: ${arg}` };
37
- }
38
- return { options };
39
- }
40
- export function parseChatOptions(args) {
41
- let workspaceRoot;
42
- let agentId;
43
- let sessionId;
44
- let message;
45
- let requestEvents = false;
46
- let transport = "stdio";
47
- let hostname;
48
- let port;
49
- const positional = [];
50
- for (let index = 0; index < args.length; index += 1) {
51
- const arg = args[index];
52
- if (arg === "--workspace"
53
- || arg === "-w"
54
- || arg === "--agent"
55
- || arg === "--session"
56
- || arg === "--message"
57
- || arg === "--transport"
58
- || arg === "--host"
59
- || arg === "--port") {
60
- const value = args[index + 1];
61
- if (!value) {
62
- return { workspaceRoot, agentId, sessionId, message, requestEvents, transport, hostname, port, error: `Missing value for ${arg}` };
63
- }
64
- if (arg === "--workspace" || arg === "-w") {
65
- workspaceRoot = value;
66
- }
67
- else if (arg === "--agent") {
68
- agentId = value;
69
- }
70
- else if (arg === "--session") {
71
- sessionId = value;
72
- }
73
- else if (arg === "--message") {
74
- message = value;
75
- }
76
- else if (arg === "--transport") {
77
- if (value !== "stdio" && value !== "http") {
78
- return { workspaceRoot, agentId, sessionId, message, requestEvents, transport, hostname, port, error: `Unsupported chat transport: ${value}` };
79
- }
80
- transport = value;
81
- }
82
- else if (arg === "--host") {
83
- hostname = value;
84
- }
85
- else {
86
- const parsedPort = Number.parseInt(value, 10);
87
- if (!Number.isFinite(parsedPort) || parsedPort <= 0) {
88
- return { workspaceRoot, agentId, sessionId, message, requestEvents, transport, hostname, port, error: `Invalid chat port: ${value}` };
89
- }
90
- port = parsedPort;
91
- }
92
- index += 1;
93
- continue;
94
- }
95
- if (arg === "--request-events") {
96
- requestEvents = true;
97
- continue;
98
- }
99
- if (arg.startsWith("-")) {
100
- return { workspaceRoot, agentId, sessionId, message, requestEvents, transport, hostname, port, error: `Unknown option: ${arg}` };
101
- }
102
- positional.push(arg);
103
- }
104
- if (!message && positional.length > 0) {
105
- message = positional.join(" ");
106
- }
107
- return { workspaceRoot, agentId, sessionId, message, requestEvents, transport, hostname, port };
108
- }
1
+ function d(i){return i==="deep-research"||i==="single-agent"}function m(i){const n={};for(let o=0;o<i.length;o+=1){const t=i[o];if(t==="--with-web-search"){n.withWebSearch=!0;continue}if(t==="--no-web-search"){n.withWebSearch=!1;continue}if(t==="--template"||t==="--provider"||t==="--model"){const r=i[o+1];if(!r)return{error:`Missing value for ${t}`};if(t==="--template"){if(!d(r))return{error:`Unsupported template: ${r}`};n.template=r}else t==="--provider"?n.provider=r:n.model=r;o+=1;continue}return{error:`Unknown option: ${t}`}}return{options:n}}function w(i){let n,o,t,r,a=!1,p="stdio",l,u;const c=[];for(let f=0;f<i.length;f+=1){const e=i[f];if(e==="--workspace"||e==="-w"||e==="--agent"||e==="--session"||e==="--message"||e==="--transport"||e==="--host"||e==="--port"){const s=i[f+1];if(!s)return{workspaceRoot:n,agentId:o,sessionId:t,message:r,requestEvents:a,transport:p,hostname:l,port:u,error:`Missing value for ${e}`};if(e==="--workspace"||e==="-w")n=s;else if(e==="--agent")o=s;else if(e==="--session")t=s;else if(e==="--message")r=s;else if(e==="--transport"){if(s!=="stdio"&&s!=="http")return{workspaceRoot:n,agentId:o,sessionId:t,message:r,requestEvents:a,transport:p,hostname:l,port:u,error:`Unsupported chat transport: ${s}`};p=s}else if(e==="--host")l=s;else{const h=Number.parseInt(s,10);if(!Number.isFinite(h)||h<=0)return{workspaceRoot:n,agentId:o,sessionId:t,message:r,requestEvents:a,transport:p,hostname:l,port:u,error:`Invalid chat port: ${s}`};u=h}f+=1;continue}if(e==="--request-events"){a=!0;continue}if(e.startsWith("-"))return{workspaceRoot:n,agentId:o,sessionId:t,message:r,requestEvents:a,transport:p,hostname:l,port:u,error:`Unknown option: ${e}`};c.push(e)}return!r&&c.length>0&&(r=c.join(" ")),{workspaceRoot:n,agentId:o,sessionId:t,message:r,requestEvents:a,transport:p,hostname:l,port:u}}export{w as parseChatOptions,m as parseInitOptions};
@@ -1,158 +1 @@
1
- export function parseRuntimeInspectOptions(args) {
2
- let workspaceRoot;
3
- let json = false;
4
- let once = false;
5
- let pollMs = 1000;
6
- let limit = 5;
7
- let status;
8
- let state;
9
- let agentId;
10
- let sessionId;
11
- for (let index = 0; index < args.length; index += 1) {
12
- const arg = args[index];
13
- if (arg === "--workspace" || arg === "--status" || arg === "--state" || arg === "--agent" || arg === "--session" || arg === "--poll-ms" || arg === "--limit") {
14
- const value = args[index + 1];
15
- if (!value) {
16
- return { json, once, pollMs, limit, status, state, agentId, sessionId, error: `Missing value for ${arg}` };
17
- }
18
- if (arg === "--workspace") {
19
- workspaceRoot = value;
20
- }
21
- else if (arg === "--status") {
22
- status = value;
23
- }
24
- else if (arg === "--state") {
25
- state = value;
26
- }
27
- else if (arg === "--agent") {
28
- agentId = value;
29
- }
30
- else if (arg === "--session") {
31
- sessionId = value;
32
- }
33
- else if (arg === "--limit") {
34
- const parsedLimit = Number.parseInt(value, 10);
35
- if (!Number.isFinite(parsedLimit) || parsedLimit <= 0) {
36
- return { json, once, pollMs, limit, status, state, agentId, sessionId, error: `Invalid limit: ${value}` };
37
- }
38
- limit = parsedLimit;
39
- }
40
- else {
41
- const parsedPoll = Number.parseInt(value, 10);
42
- if (!Number.isFinite(parsedPoll) || parsedPoll <= 0) {
43
- return { json, once, pollMs, limit, status, state, agentId, sessionId, error: `Invalid poll interval: ${value}` };
44
- }
45
- pollMs = parsedPoll;
46
- }
47
- index += 1;
48
- continue;
49
- }
50
- if (arg === "--json") {
51
- json = true;
52
- continue;
53
- }
54
- if (arg === "--once") {
55
- once = true;
56
- continue;
57
- }
58
- return { workspaceRoot, json, once, pollMs, limit, status, state, agentId, sessionId, error: `Unknown option: ${arg}` };
59
- }
60
- return { workspaceRoot, json, once, pollMs, limit, status, state, agentId, sessionId };
61
- }
62
- export function parseRuntimeExportOptions(args) {
63
- let workspaceRoot;
64
- let sessionId;
65
- let requestId;
66
- let includeArtifacts = false;
67
- let includeArtifactContents = false;
68
- let includeRuntimeHealth = false;
69
- let json = false;
70
- for (let index = 0; index < args.length; index += 1) {
71
- const arg = args[index];
72
- if (arg === "--artifacts") {
73
- includeArtifacts = true;
74
- continue;
75
- }
76
- if (arg === "--artifact-contents") {
77
- includeArtifacts = true;
78
- includeArtifactContents = true;
79
- continue;
80
- }
81
- if (arg === "--health") {
82
- includeRuntimeHealth = true;
83
- continue;
84
- }
85
- if (arg === "--json") {
86
- json = true;
87
- continue;
88
- }
89
- if (arg === "--workspace" || arg === "--session" || arg === "--request") {
90
- const value = args[index + 1];
91
- if (!value) {
92
- return {
93
- workspaceRoot,
94
- sessionId,
95
- requestId,
96
- includeArtifacts,
97
- includeArtifactContents,
98
- includeRuntimeHealth,
99
- json,
100
- error: `Missing value for ${arg}`,
101
- };
102
- }
103
- if (arg === "--workspace") {
104
- workspaceRoot = value;
105
- }
106
- else if (arg === "--session") {
107
- sessionId = value;
108
- }
109
- else {
110
- requestId = value;
111
- }
112
- index += 1;
113
- continue;
114
- }
115
- return {
116
- workspaceRoot,
117
- sessionId,
118
- requestId,
119
- includeArtifacts,
120
- includeArtifactContents,
121
- includeRuntimeHealth,
122
- json,
123
- error: `Unknown option: ${arg}`,
124
- };
125
- }
126
- return {
127
- workspaceRoot,
128
- sessionId,
129
- requestId,
130
- includeArtifacts,
131
- includeArtifactContents,
132
- includeRuntimeHealth,
133
- json,
134
- };
135
- }
136
- export function parseScheduledRunOptions(args) {
137
- let workspaceRoot;
138
- let scheduleId;
139
- for (let index = 0; index < args.length; index += 1) {
140
- const arg = args[index];
141
- if (arg === "--workspace" || arg === "--schedule") {
142
- const value = args[index + 1];
143
- if (!value) {
144
- return { workspaceRoot, scheduleId, error: `Missing value for ${arg}` };
145
- }
146
- if (arg === "--workspace") {
147
- workspaceRoot = value;
148
- }
149
- else {
150
- scheduleId = value;
151
- }
152
- index += 1;
153
- continue;
154
- }
155
- return { workspaceRoot, scheduleId, error: `Unknown option: ${arg}` };
156
- }
157
- return { workspaceRoot, scheduleId };
158
- }
1
+ function m(u){let o,s=!1,n=!1,e=1e3,i=5,a,c,l,t;for(let f=0;f<u.length;f+=1){const r=u[f];if(r==="--workspace"||r==="--status"||r==="--state"||r==="--agent"||r==="--session"||r==="--poll-ms"||r==="--limit"){const p=u[f+1];if(!p)return{json:s,once:n,pollMs:e,limit:i,status:a,state:c,agentId:l,sessionId:t,error:`Missing value for ${r}`};if(r==="--workspace")o=p;else if(r==="--status")a=p;else if(r==="--state")c=p;else if(r==="--agent")l=p;else if(r==="--session")t=p;else if(r==="--limit"){const d=Number.parseInt(p,10);if(!Number.isFinite(d)||d<=0)return{json:s,once:n,pollMs:e,limit:i,status:a,state:c,agentId:l,sessionId:t,error:`Invalid limit: ${p}`};i=d}else{const d=Number.parseInt(p,10);if(!Number.isFinite(d)||d<=0)return{json:s,once:n,pollMs:e,limit:i,status:a,state:c,agentId:l,sessionId:t,error:`Invalid poll interval: ${p}`};e=d}f+=1;continue}if(r==="--json"){s=!0;continue}if(r==="--once"){n=!0;continue}return{workspaceRoot:o,json:s,once:n,pollMs:e,limit:i,status:a,state:c,agentId:l,sessionId:t,error:`Unknown option: ${r}`}}return{workspaceRoot:o,json:s,once:n,pollMs:e,limit:i,status:a,state:c,agentId:l,sessionId:t}}function k(u){let o,s,n,e=!1,i=!1,a=!1,c=!1;for(let l=0;l<u.length;l+=1){const t=u[l];if(t==="--artifacts"){e=!0;continue}if(t==="--artifact-contents"){e=!0,i=!0;continue}if(t==="--health"){a=!0;continue}if(t==="--json"){c=!0;continue}if(t==="--workspace"||t==="--session"||t==="--request"){const f=u[l+1];if(!f)return{workspaceRoot:o,sessionId:s,requestId:n,includeArtifacts:e,includeArtifactContents:i,includeRuntimeHealth:a,json:c,error:`Missing value for ${t}`};t==="--workspace"?o=f:t==="--session"?s=f:n=f,l+=1;continue}return{workspaceRoot:o,sessionId:s,requestId:n,includeArtifacts:e,includeArtifactContents:i,includeRuntimeHealth:a,json:c,error:`Unknown option: ${t}`}}return{workspaceRoot:o,sessionId:s,requestId:n,includeArtifacts:e,includeArtifactContents:i,includeRuntimeHealth:a,json:c}}function w(u){let o,s;for(let n=0;n<u.length;n+=1){const e=u[n];if(e==="--workspace"||e==="--schedule"){const i=u[n+1];if(!i)return{workspaceRoot:o,scheduleId:s,error:`Missing value for ${e}`};e==="--workspace"?o=i:s=i,n+=1;continue}return{workspaceRoot:o,scheduleId:s,error:`Unknown option: ${e}`}}return{workspaceRoot:o,scheduleId:s}}export{k as parseRuntimeExportOptions,m as parseRuntimeInspectOptions,w as parseScheduledRunOptions};