@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.
- package/README.md +3 -1234
- package/README.zh.md +3 -1191
- package/dist/acp.js +1 -1
- package/dist/api.js +1 -404
- package/dist/benchmark/checkpoint-resume-cost-benchmark.js +1 -55
- package/dist/benchmark/deepagent-local-model-benchmark.js +2 -35
- package/dist/benchmark/upstream-runtime-ab-benchmark.js +1 -179
- package/dist/cli/chat-interactive.js +25 -244
- package/dist/cli/chat-rendering.js +6 -100
- package/dist/cli/chat-stream.js +23 -512
- package/dist/cli/chat-ui.js +21 -199
- package/dist/cli/chat-workspace.js +2 -210
- package/dist/cli/main.js +21 -428
- package/dist/cli/managed-service-commands.js +9 -63
- package/dist/cli/managed-service.js +2 -137
- package/dist/cli/options-init-chat.js +1 -108
- package/dist/cli/options-runtime.js +1 -158
- package/dist/cli/options-serve.js +1 -282
- package/dist/cli/options.js +2 -19
- package/dist/cli/process-guards.js +1 -139
- package/dist/cli/request-tree.js +7 -296
- package/dist/cli/runtime-commands.js +12 -258
- package/dist/cli/runtime-output.js +16 -155
- package/dist/cli/server-commands.js +16 -270
- package/dist/cli/workspace.js +1 -67
- package/dist/cli.js +1 -7
- package/dist/client/acp.js +1 -1
- package/dist/client/in-process.js +1 -67
- package/dist/client/index.js +1 -2
- package/dist/client/types.js +0 -1
- package/dist/client.js +1 -1
- package/dist/contracts/core.js +1 -1
- package/dist/contracts/runtime-evaluation.js +0 -1
- package/dist/contracts/runtime-memory.js +0 -1
- package/dist/contracts/runtime-observability.js +0 -1
- package/dist/contracts/runtime-requests.js +0 -1
- package/dist/contracts/runtime-scheduling.js +0 -1
- package/dist/contracts/runtime.js +1 -27
- package/dist/contracts/types.js +1 -3
- package/dist/contracts/workspace.js +0 -1
- package/dist/flow/build-flow-graph.js +1 -50
- package/dist/flow/export-mermaid.js +2 -464
- package/dist/flow/export-sequence-mermaid.js +2 -325
- package/dist/flow/flow-graph-normalization.js +1 -214
- package/dist/flow/flow-graph-runtime.js +1 -107
- package/dist/flow/flow-graph-upstream.js +1 -494
- package/dist/flow/index.js +1 -3
- package/dist/flow/types.js +0 -1
- package/dist/index.js +1 -5
- package/dist/init-project.js +1 -1
- package/dist/knowledge/config.js +1 -32
- package/dist/knowledge/contracts.js +0 -1
- package/dist/knowledge/index.js +1 -2
- package/dist/knowledge/module.js +12 -909
- package/dist/knowledge/procedural/config.js +1 -125
- package/dist/knowledge/procedural/index.js +1 -2
- package/dist/knowledge/procedural/manager.js +9 -345
- package/dist/mcp.js +1 -2
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -2
- package/dist/persistence/file-store.js +3 -758
- package/dist/persistence/sqlite-request-context-store.js +5 -54
- package/dist/persistence/sqlite-request-queue-store.js +10 -108
- package/dist/persistence/sqlite-runtime.js +1 -86
- package/dist/persistence/sqlite-store.js +62 -810
- package/dist/persistence/types.js +0 -1
- package/dist/projections/presentation.js +37 -206
- package/dist/projections/request-events.js +2 -502
- package/dist/projections/upstream-events.js +1 -201
- package/dist/protocol/a2a/http-discovery.js +1 -178
- package/dist/protocol/a2a/http-rpc.js +6 -622
- package/dist/protocol/a2a/http.js +1 -138
- package/dist/protocol/a2a/task-state.js +3 -317
- package/dist/protocol/acp/client.js +8 -294
- package/dist/protocol/acp/harness-client.js +1 -218
- package/dist/protocol/acp/http.js +5 -130
- package/dist/protocol/acp/server.js +1 -310
- package/dist/protocol/acp/stdio.js +2 -69
- package/dist/protocol/ag-ui/http.js +3 -378
- package/dist/protocol/mcp/server.js +1 -428
- package/dist/resource/backend/workspace-scoped-backend.js +1 -319
- package/dist/resource/isolation.js +1 -237
- package/dist/resource/mcp/tool-support.js +3 -296
- package/dist/resource/mcp-tool-support.js +1 -2
- package/dist/resource/providers/resource-provider.js +1 -215
- package/dist/resource/resource-impl.js +1 -3
- package/dist/resource/resource-types.js +0 -1
- package/dist/resource/resource.js +1 -1
- package/dist/resource/sources.js +1 -247
- package/dist/resource/tools/function-tool-resolver.js +2 -272
- package/dist/runtime/adapter/compat/deepagent-compat.js +1 -29
- package/dist/runtime/adapter/compat/openai-compatible.js +1 -55
- package/dist/runtime/adapter/direct-builtin-utility.js +2 -90
- package/dist/runtime/adapter/flow/execution-context.js +1 -71
- package/dist/runtime/adapter/flow/invocation-flow.js +8 -425
- package/dist/runtime/adapter/flow/invoke-runtime.js +1 -20
- package/dist/runtime/adapter/flow/stream-runtime.js +11 -1395
- package/dist/runtime/adapter/invocation-result.js +2 -473
- package/dist/runtime/adapter/local-tool-invocation.js +6 -638
- package/dist/runtime/adapter/middleware/context-hygiene.js +1 -83
- package/dist/runtime/adapter/middleware-assembly.js +5 -477
- package/dist/runtime/adapter/model/invocation-request.js +3 -183
- package/dist/runtime/adapter/model/message-assembly.js +1 -28
- package/dist/runtime/adapter/model/model-providers.js +23 -1115
- package/dist/runtime/adapter/model/prompted-json-tool-call-capture.js +1 -40
- package/dist/runtime/adapter/model/prompted-json-tool-policy.js +1 -22
- package/dist/runtime/adapter/resilience.js +1 -104
- package/dist/runtime/adapter/runtime-adapter-support.js +3 -141
- package/dist/runtime/adapter/runtime-shell.js +5 -166
- package/dist/runtime/adapter/stream-event-projection.js +2 -622
- package/dist/runtime/adapter/stream-text-consumption.js +1 -18
- package/dist/runtime/adapter/terminal-status.js +2 -67
- package/dist/runtime/adapter/tool/builtin-middleware-tools.js +6 -627
- package/dist/runtime/adapter/tool/declared-middleware.js +1 -154
- package/dist/runtime/adapter/tool/interrupt-policy.js +1 -34
- package/dist/runtime/adapter/tool/provider-tool.js +1 -25
- package/dist/runtime/adapter/tool/resolved-tool.js +1 -225
- package/dist/runtime/adapter/tool/tool-arguments.js +3 -486
- package/dist/runtime/adapter/tool/tool-hitl.js +1 -346
- package/dist/runtime/adapter/tool/tool-name-mapping.js +1 -128
- package/dist/runtime/adapter/tool/tool-output-artifacts.js +2 -88
- package/dist/runtime/adapter/tool/tool-replay.js +1 -37
- package/dist/runtime/adapter/tool-resolution.js +1 -86
- package/dist/runtime/adapter/upstream-configurable-keys.js +1 -2
- package/dist/runtime/agent-runtime-adapter.js +60 -2338
- package/dist/runtime/agent-runtime-assembly.js +7 -249
- package/dist/runtime/env/runtime-env.js +1 -62
- package/dist/runtime/harness/background-runtime.js +1 -8
- package/dist/runtime/harness/bindings.js +1 -58
- package/dist/runtime/harness/events/event-bus.js +1 -16
- package/dist/runtime/harness/events/event-sink.js +1 -61
- package/dist/runtime/harness/events/events.js +1 -80
- package/dist/runtime/harness/events/listener-runtime.js +1 -13
- package/dist/runtime/harness/events/runtime-event-operations.js +1 -9
- package/dist/runtime/harness/events/streaming.js +1 -100
- package/dist/runtime/harness/events/timeline.js +1 -52
- package/dist/runtime/harness/public-shapes.js +1 -186
- package/dist/runtime/harness/run/artifact-paths.js +1 -15
- package/dist/runtime/harness/run/governance.js +1 -295
- package/dist/runtime/harness/run/helpers.js +1 -71
- package/dist/runtime/harness/run/inspection.js +1 -409
- package/dist/runtime/harness/run/operator-overview.js +1 -80
- package/dist/runtime/harness/run/queue-diagnostics.js +1 -15
- package/dist/runtime/harness/run/recovery.js +1 -162
- package/dist/runtime/harness/run/resources.js +1 -60
- package/dist/runtime/harness/run/resume.js +1 -56
- package/dist/runtime/harness/run/routing.js +1 -48
- package/dist/runtime/harness/run/run-lifecycle.js +1 -66
- package/dist/runtime/harness/run/run-operations.js +1 -217
- package/dist/runtime/harness/run/run-queue.js +1 -43
- package/dist/runtime/harness/run/run-slot-acquisition.js +1 -157
- package/dist/runtime/harness/run/session-records.js +1 -97
- package/dist/runtime/harness/run/start-run.js +1 -120
- package/dist/runtime/harness/run/startup-runtime.js +1 -69
- package/dist/runtime/harness/run/stream-run.js +8 -1418
- package/dist/runtime/harness/run/surface-semantics.js +1 -79
- package/dist/runtime/harness/runtime-defaults.js +1 -39
- package/dist/runtime/harness/system/boundary-analysis.js +1 -234
- package/dist/runtime/harness/system/health-monitor.js +1 -258
- package/dist/runtime/harness/system/inventory.js +1 -129
- package/dist/runtime/harness/system/mem0-ingestion-sync.js +5 -345
- package/dist/runtime/harness/system/policy-engine.js +1 -175
- package/dist/runtime/harness/system/runtime-memory-candidates.js +4 -110
- package/dist/runtime/harness/system/runtime-memory-consolidation.js +1 -51
- package/dist/runtime/harness/system/runtime-memory-manager.js +10 -693
- package/dist/runtime/harness/system/runtime-memory-policy.js +1 -155
- package/dist/runtime/harness/system/runtime-memory-records.js +11 -577
- package/dist/runtime/harness/system/runtime-memory-sync.js +5 -206
- package/dist/runtime/harness/system/session-memory-sync.js +3 -113
- package/dist/runtime/harness/system/skill-requirements.js +1 -112
- package/dist/runtime/harness/system/store.js +9 -365
- package/dist/runtime/harness/tool-gateway/index.js +1 -2
- package/dist/runtime/harness/tool-gateway/policy.js +1 -45
- package/dist/runtime/harness/tool-gateway/validation.js +1 -176
- package/dist/runtime/harness/tool-schema.js +1 -3
- package/dist/runtime/harness.js +3 -1490
- package/dist/runtime/index.js +1 -3
- package/dist/runtime/layout/runtime-layout.js +1 -31
- package/dist/runtime/maintenance/checkpoint-maintenance.js +2 -178
- package/dist/runtime/maintenance/file-checkpoint-saver.js +1 -106
- package/dist/runtime/maintenance/runtime-record-maintenance.js +2 -169
- package/dist/runtime/maintenance/sqlite-checkpoint-saver.js +4 -289
- package/dist/runtime/parsing/output-content.js +10 -550
- package/dist/runtime/parsing/output-parsing.js +1 -4
- package/dist/runtime/parsing/output-recovery.js +3 -213
- package/dist/runtime/parsing/output-tool-args.js +7 -663
- package/dist/runtime/parsing/stream-event-parsing.js +3 -362
- package/dist/runtime/prompts/runtime-prompts.js +4 -73
- package/dist/runtime/scheduling/system-schedule-manager.js +11 -532
- package/dist/runtime/skills/skill-metadata.js +1 -197
- package/dist/runtime/startup-tracing.js +2 -37
- package/dist/runtime/support/compiled-binding.js +1 -290
- package/dist/runtime/support/embedding-models.js +1 -118
- package/dist/runtime/support/harness-support.js +5 -137
- package/dist/runtime/support/llamaindex.js +1 -108
- package/dist/runtime/support/runtime-adapter-options.js +1 -29
- package/dist/runtime/support/runtime-factories.js +1 -51
- package/dist/runtime/support/vector-stores.js +9 -270
- package/dist/scaffold/init-project.js +54 -233
- package/dist/tooling/extensions.js +1 -311
- package/dist/tooling/module-loader.js +1 -55
- package/dist/tools.js +1 -176
- package/dist/utils/agent-display.js +1 -18
- package/dist/utils/bundled-text.js +4 -39
- package/dist/utils/compiled-binding.js +1 -33
- package/dist/utils/fs.js +2 -45
- package/dist/utils/id.js +1 -9
- package/dist/utils/message-content.js +1 -30
- package/dist/utils/object.js +1 -6
- package/dist/workspace/agent-binding-compiler.js +3 -613
- package/dist/workspace/compile.js +1 -472
- package/dist/workspace/framework-contract-validation.js +2 -322
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/object-loader-paths.js +1 -71
- package/dist/workspace/object-loader-readers.js +1 -187
- package/dist/workspace/object-loader.js +1 -754
- package/dist/workspace/resource-compilers.js +1 -374
- package/dist/workspace/support/agent-capabilities.js +1 -37
- package/dist/workspace/support/agent-execution-config.js +1 -44
- package/dist/workspace/support/discovery.js +1 -147
- package/dist/workspace/support/source-collectors.js +1 -30
- package/dist/workspace/support/source-protocols.js +2 -192
- package/dist/workspace/support/workspace-ref-utils.js +1 -362
- package/dist/workspace/tool-hydration.js +1 -280
- package/dist/workspace/validate.js +1 -99
- package/dist/workspace/yaml-object-reader.js +1 -285
- package/package.json +7 -3
|
@@ -1,282 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
export function parseTopLevelManagedServiceOptions(args) {
|
|
3
|
-
let workspaceRoot;
|
|
4
|
-
let hostname;
|
|
5
|
-
let services;
|
|
6
|
-
let acpPort;
|
|
7
|
-
let a2aPort;
|
|
8
|
-
let mcpPort;
|
|
9
|
-
let agUiPort;
|
|
10
|
-
const parsePort = (value, label) => {
|
|
11
|
-
if (!value) {
|
|
12
|
-
return { error: `Missing value for ${label}` };
|
|
13
|
-
}
|
|
14
|
-
const parsedPort = Number.parseInt(value, 10);
|
|
15
|
-
if (!Number.isFinite(parsedPort) || parsedPort < 0) {
|
|
16
|
-
return { error: `Invalid ${label} value: ${value}` };
|
|
17
|
-
}
|
|
18
|
-
return parsedPort;
|
|
19
|
-
};
|
|
20
|
-
for (let index = 0; index < args.length; index += 1) {
|
|
21
|
-
const arg = args[index];
|
|
22
|
-
if (arg === "--workspace" || arg === "-w") {
|
|
23
|
-
const value = args[index + 1];
|
|
24
|
-
if (!value) {
|
|
25
|
-
return { services: services ?? [...TOP_LEVEL_MANAGED_SERVICES], hostname, acpPort, a2aPort, mcpPort, agUiPort, error: "Missing value for --workspace" };
|
|
26
|
-
}
|
|
27
|
-
workspaceRoot = value;
|
|
28
|
-
index += 1;
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
if (arg === "--services") {
|
|
32
|
-
const value = args[index + 1];
|
|
33
|
-
if (!value) {
|
|
34
|
-
return { services: services ?? [...TOP_LEVEL_MANAGED_SERVICES], workspaceRoot, hostname, acpPort, a2aPort, mcpPort, agUiPort, error: "Missing value for --services" };
|
|
35
|
-
}
|
|
36
|
-
const parsedServices = value
|
|
37
|
-
.split(",")
|
|
38
|
-
.map((item) => item.trim())
|
|
39
|
-
.filter(Boolean);
|
|
40
|
-
if (parsedServices.length === 0) {
|
|
41
|
-
return { services: services ?? [...TOP_LEVEL_MANAGED_SERVICES], workspaceRoot, hostname, acpPort, a2aPort, mcpPort, agUiPort, error: "Missing value for --services" };
|
|
42
|
-
}
|
|
43
|
-
const invalidService = parsedServices.find((service) => !TOP_LEVEL_MANAGED_SERVICES.includes(service));
|
|
44
|
-
if (invalidService) {
|
|
45
|
-
return {
|
|
46
|
-
services: services ?? [...TOP_LEVEL_MANAGED_SERVICES],
|
|
47
|
-
workspaceRoot,
|
|
48
|
-
hostname,
|
|
49
|
-
acpPort,
|
|
50
|
-
a2aPort,
|
|
51
|
-
mcpPort,
|
|
52
|
-
agUiPort,
|
|
53
|
-
error: `Unsupported managed service: ${invalidService}`,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
services = Array.from(new Set(parsedServices));
|
|
57
|
-
index += 1;
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
if (arg === "--host") {
|
|
61
|
-
const value = args[index + 1];
|
|
62
|
-
if (!value) {
|
|
63
|
-
return { services: services ?? [...TOP_LEVEL_MANAGED_SERVICES], workspaceRoot, acpPort, a2aPort, mcpPort, agUiPort, error: "Missing value for --host" };
|
|
64
|
-
}
|
|
65
|
-
hostname = value;
|
|
66
|
-
index += 1;
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
if (arg === "--acp-port") {
|
|
70
|
-
const parsedPort = parsePort(args[index + 1], "--acp-port");
|
|
71
|
-
if (typeof parsedPort !== "number") {
|
|
72
|
-
return { services: services ?? [...TOP_LEVEL_MANAGED_SERVICES], workspaceRoot, hostname, acpPort, a2aPort, mcpPort, agUiPort, error: parsedPort.error };
|
|
73
|
-
}
|
|
74
|
-
acpPort = parsedPort;
|
|
75
|
-
index += 1;
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
if (arg === "--a2a-port") {
|
|
79
|
-
const parsedPort = parsePort(args[index + 1], "--a2a-port");
|
|
80
|
-
if (typeof parsedPort !== "number") {
|
|
81
|
-
return { services: services ?? [...TOP_LEVEL_MANAGED_SERVICES], workspaceRoot, hostname, acpPort, a2aPort, mcpPort, agUiPort, error: parsedPort.error };
|
|
82
|
-
}
|
|
83
|
-
a2aPort = parsedPort;
|
|
84
|
-
index += 1;
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
if (arg === "--mcp-port") {
|
|
88
|
-
const parsedPort = parsePort(args[index + 1], "--mcp-port");
|
|
89
|
-
if (typeof parsedPort !== "number") {
|
|
90
|
-
return { services: services ?? [...TOP_LEVEL_MANAGED_SERVICES], workspaceRoot, hostname, acpPort, a2aPort, mcpPort, agUiPort, error: parsedPort.error };
|
|
91
|
-
}
|
|
92
|
-
mcpPort = parsedPort;
|
|
93
|
-
index += 1;
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
if (arg === "--ag-ui-port") {
|
|
97
|
-
const parsedPort = parsePort(args[index + 1], "--ag-ui-port");
|
|
98
|
-
if (typeof parsedPort !== "number") {
|
|
99
|
-
return { services: services ?? [...TOP_LEVEL_MANAGED_SERVICES], workspaceRoot, hostname, acpPort, a2aPort, mcpPort, agUiPort, error: parsedPort.error };
|
|
100
|
-
}
|
|
101
|
-
agUiPort = parsedPort;
|
|
102
|
-
index += 1;
|
|
103
|
-
continue;
|
|
104
|
-
}
|
|
105
|
-
return { services: services ?? [...TOP_LEVEL_MANAGED_SERVICES], workspaceRoot, hostname, acpPort, a2aPort, mcpPort, agUiPort, error: `Unknown option: ${arg}` };
|
|
106
|
-
}
|
|
107
|
-
return {
|
|
108
|
-
workspaceRoot,
|
|
109
|
-
services: services ?? [...TOP_LEVEL_MANAGED_SERVICES],
|
|
110
|
-
hostname,
|
|
111
|
-
acpPort,
|
|
112
|
-
a2aPort,
|
|
113
|
-
mcpPort,
|
|
114
|
-
agUiPort,
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
export function parseAcpServeOptions(args, defaultTransport = "stdio") {
|
|
118
|
-
let workspaceRoot;
|
|
119
|
-
let transport = defaultTransport;
|
|
120
|
-
let hostname;
|
|
121
|
-
let port;
|
|
122
|
-
for (let index = 0; index < args.length; index += 1) {
|
|
123
|
-
const arg = args[index];
|
|
124
|
-
if (arg === "--workspace") {
|
|
125
|
-
const value = args[index + 1];
|
|
126
|
-
if (!value) {
|
|
127
|
-
return { transport, hostname, port, error: "Missing value for --workspace" };
|
|
128
|
-
}
|
|
129
|
-
workspaceRoot = value;
|
|
130
|
-
index += 1;
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
if (arg === "--transport") {
|
|
134
|
-
const value = args[index + 1];
|
|
135
|
-
if (!value) {
|
|
136
|
-
return { transport, hostname, port, error: "Missing value for --transport" };
|
|
137
|
-
}
|
|
138
|
-
if (value !== "stdio" && value !== "http") {
|
|
139
|
-
return { transport, hostname, port, error: `Unsupported ACP transport: ${value}` };
|
|
140
|
-
}
|
|
141
|
-
transport = value;
|
|
142
|
-
index += 1;
|
|
143
|
-
continue;
|
|
144
|
-
}
|
|
145
|
-
if (arg === "--host") {
|
|
146
|
-
const value = args[index + 1];
|
|
147
|
-
if (!value) {
|
|
148
|
-
return { transport, hostname, port, error: "Missing value for --host" };
|
|
149
|
-
}
|
|
150
|
-
hostname = value;
|
|
151
|
-
index += 1;
|
|
152
|
-
continue;
|
|
153
|
-
}
|
|
154
|
-
if (arg === "--port") {
|
|
155
|
-
const value = args[index + 1];
|
|
156
|
-
if (!value) {
|
|
157
|
-
return { transport, hostname, port, error: "Missing value for --port" };
|
|
158
|
-
}
|
|
159
|
-
const parsedPort = Number.parseInt(value, 10);
|
|
160
|
-
if (!Number.isFinite(parsedPort) || parsedPort < 0) {
|
|
161
|
-
return { transport, hostname, port, error: `Invalid ACP port: ${value}` };
|
|
162
|
-
}
|
|
163
|
-
port = parsedPort;
|
|
164
|
-
index += 1;
|
|
165
|
-
continue;
|
|
166
|
-
}
|
|
167
|
-
return { transport, hostname, port, error: `Unknown option: ${arg}` };
|
|
168
|
-
}
|
|
169
|
-
return { workspaceRoot, transport, hostname, port };
|
|
170
|
-
}
|
|
171
|
-
export function parseWorkspaceOnlyOptions(args) {
|
|
172
|
-
let workspaceRoot;
|
|
173
|
-
for (let index = 0; index < args.length; index += 1) {
|
|
174
|
-
const arg = args[index];
|
|
175
|
-
if (arg === "--workspace") {
|
|
176
|
-
const value = args[index + 1];
|
|
177
|
-
if (!value) {
|
|
178
|
-
return { error: "Missing value for --workspace" };
|
|
179
|
-
}
|
|
180
|
-
workspaceRoot = value;
|
|
181
|
-
index += 1;
|
|
182
|
-
continue;
|
|
183
|
-
}
|
|
184
|
-
return { error: `Unknown option: ${arg}` };
|
|
185
|
-
}
|
|
186
|
-
return { workspaceRoot };
|
|
187
|
-
}
|
|
188
|
-
export function parseHttpServeOptions(args, serviceLabel = "HTTP") {
|
|
189
|
-
let workspaceRoot;
|
|
190
|
-
let hostname;
|
|
191
|
-
let port;
|
|
192
|
-
for (let index = 0; index < args.length; index += 1) {
|
|
193
|
-
const arg = args[index];
|
|
194
|
-
if (arg === "--workspace") {
|
|
195
|
-
const value = args[index + 1];
|
|
196
|
-
if (!value) {
|
|
197
|
-
return { hostname, port, error: "Missing value for --workspace" };
|
|
198
|
-
}
|
|
199
|
-
workspaceRoot = value;
|
|
200
|
-
index += 1;
|
|
201
|
-
continue;
|
|
202
|
-
}
|
|
203
|
-
if (arg === "--host") {
|
|
204
|
-
const value = args[index + 1];
|
|
205
|
-
if (!value) {
|
|
206
|
-
return { workspaceRoot, port, error: "Missing value for --host" };
|
|
207
|
-
}
|
|
208
|
-
hostname = value;
|
|
209
|
-
index += 1;
|
|
210
|
-
continue;
|
|
211
|
-
}
|
|
212
|
-
if (arg === "--port") {
|
|
213
|
-
const value = args[index + 1];
|
|
214
|
-
if (!value) {
|
|
215
|
-
return { workspaceRoot, hostname, error: "Missing value for --port" };
|
|
216
|
-
}
|
|
217
|
-
const parsedPort = Number.parseInt(value, 10);
|
|
218
|
-
if (!Number.isFinite(parsedPort) || parsedPort < 0) {
|
|
219
|
-
return { workspaceRoot, hostname, error: `Invalid ${serviceLabel} port: ${value}` };
|
|
220
|
-
}
|
|
221
|
-
port = parsedPort;
|
|
222
|
-
index += 1;
|
|
223
|
-
continue;
|
|
224
|
-
}
|
|
225
|
-
return { workspaceRoot, hostname, port, error: `Unknown option: ${arg}` };
|
|
226
|
-
}
|
|
227
|
-
return { workspaceRoot, hostname, port };
|
|
228
|
-
}
|
|
229
|
-
export function parseRuntimeMcpServeOptions(args, defaultTransport = "stdio") {
|
|
230
|
-
let workspaceRoot;
|
|
231
|
-
let transport = defaultTransport;
|
|
232
|
-
let hostname;
|
|
233
|
-
let port;
|
|
234
|
-
for (let index = 0; index < args.length; index += 1) {
|
|
235
|
-
const arg = args[index];
|
|
236
|
-
if (arg === "--workspace") {
|
|
237
|
-
const value = args[index + 1];
|
|
238
|
-
if (!value) {
|
|
239
|
-
return { transport, hostname, port, error: "Missing value for --workspace" };
|
|
240
|
-
}
|
|
241
|
-
workspaceRoot = value;
|
|
242
|
-
index += 1;
|
|
243
|
-
continue;
|
|
244
|
-
}
|
|
245
|
-
if (arg === "--transport") {
|
|
246
|
-
const value = args[index + 1];
|
|
247
|
-
if (!value) {
|
|
248
|
-
return { transport, hostname, port, error: "Missing value for --transport" };
|
|
249
|
-
}
|
|
250
|
-
if (value !== "stdio" && value !== "streamable-http") {
|
|
251
|
-
return { transport, hostname, port, error: `Unsupported runtime MCP transport: ${value}` };
|
|
252
|
-
}
|
|
253
|
-
transport = value;
|
|
254
|
-
index += 1;
|
|
255
|
-
continue;
|
|
256
|
-
}
|
|
257
|
-
if (arg === "--host") {
|
|
258
|
-
const value = args[index + 1];
|
|
259
|
-
if (!value) {
|
|
260
|
-
return { transport, hostname, port, error: "Missing value for --host" };
|
|
261
|
-
}
|
|
262
|
-
hostname = value;
|
|
263
|
-
index += 1;
|
|
264
|
-
continue;
|
|
265
|
-
}
|
|
266
|
-
if (arg === "--port") {
|
|
267
|
-
const value = args[index + 1];
|
|
268
|
-
if (!value) {
|
|
269
|
-
return { transport, hostname, port, error: "Missing value for --port" };
|
|
270
|
-
}
|
|
271
|
-
const parsedPort = Number.parseInt(value, 10);
|
|
272
|
-
if (!Number.isFinite(parsedPort) || parsedPort < 0) {
|
|
273
|
-
return { transport, hostname, port, error: `Invalid runtime MCP port: ${value}` };
|
|
274
|
-
}
|
|
275
|
-
port = parsedPort;
|
|
276
|
-
index += 1;
|
|
277
|
-
continue;
|
|
278
|
-
}
|
|
279
|
-
return { transport, hostname, port, error: `Unknown option: ${arg}` };
|
|
280
|
-
}
|
|
281
|
-
return { workspaceRoot, transport, hostname, port };
|
|
282
|
-
}
|
|
1
|
+
const l=["acp","a2a","mcp","ag-ui"];function w(s){let a,u,r,t,e,o,i;const n=(p,f)=>{if(!p)return{error:`Missing value for ${f}`};const c=Number.parseInt(p,10);return!Number.isFinite(c)||c<0?{error:`Invalid ${f} value: ${p}`}:c};for(let p=0;p<s.length;p+=1){const f=s[p];if(f==="--workspace"||f==="-w"){const c=s[p+1];if(!c)return{services:r??[...l],hostname:u,acpPort:t,a2aPort:e,mcpPort:o,agUiPort:i,error:"Missing value for --workspace"};a=c,p+=1;continue}if(f==="--services"){const c=s[p+1];if(!c)return{services:r??[...l],workspaceRoot:a,hostname:u,acpPort:t,a2aPort:e,mcpPort:o,agUiPort:i,error:"Missing value for --services"};const v=c.split(",").map(d=>d.trim()).filter(Boolean);if(v.length===0)return{services:r??[...l],workspaceRoot:a,hostname:u,acpPort:t,a2aPort:e,mcpPort:o,agUiPort:i,error:"Missing value for --services"};const m=v.find(d=>!l.includes(d));if(m)return{services:r??[...l],workspaceRoot:a,hostname:u,acpPort:t,a2aPort:e,mcpPort:o,agUiPort:i,error:`Unsupported managed service: ${m}`};r=Array.from(new Set(v)),p+=1;continue}if(f==="--host"){const c=s[p+1];if(!c)return{services:r??[...l],workspaceRoot:a,acpPort:t,a2aPort:e,mcpPort:o,agUiPort:i,error:"Missing value for --host"};u=c,p+=1;continue}if(f==="--acp-port"){const c=n(s[p+1],"--acp-port");if(typeof c!="number")return{services:r??[...l],workspaceRoot:a,hostname:u,acpPort:t,a2aPort:e,mcpPort:o,agUiPort:i,error:c.error};t=c,p+=1;continue}if(f==="--a2a-port"){const c=n(s[p+1],"--a2a-port");if(typeof c!="number")return{services:r??[...l],workspaceRoot:a,hostname:u,acpPort:t,a2aPort:e,mcpPort:o,agUiPort:i,error:c.error};e=c,p+=1;continue}if(f==="--mcp-port"){const c=n(s[p+1],"--mcp-port");if(typeof c!="number")return{services:r??[...l],workspaceRoot:a,hostname:u,acpPort:t,a2aPort:e,mcpPort:o,agUiPort:i,error:c.error};o=c,p+=1;continue}if(f==="--ag-ui-port"){const c=n(s[p+1],"--ag-ui-port");if(typeof c!="number")return{services:r??[...l],workspaceRoot:a,hostname:u,acpPort:t,a2aPort:e,mcpPort:o,agUiPort:i,error:c.error};i=c,p+=1;continue}return{services:r??[...l],workspaceRoot:a,hostname:u,acpPort:t,a2aPort:e,mcpPort:o,agUiPort:i,error:`Unknown option: ${f}`}}return{workspaceRoot:a,services:r??[...l],hostname:u,acpPort:t,a2aPort:e,mcpPort:o,agUiPort:i}}function M(s,a="stdio"){let u,r=a,t,e;for(let o=0;o<s.length;o+=1){const i=s[o];if(i==="--workspace"){const n=s[o+1];if(!n)return{transport:r,hostname:t,port:e,error:"Missing value for --workspace"};u=n,o+=1;continue}if(i==="--transport"){const n=s[o+1];if(!n)return{transport:r,hostname:t,port:e,error:"Missing value for --transport"};if(n!=="stdio"&&n!=="http")return{transport:r,hostname:t,port:e,error:`Unsupported ACP transport: ${n}`};r=n,o+=1;continue}if(i==="--host"){const n=s[o+1];if(!n)return{transport:r,hostname:t,port:e,error:"Missing value for --host"};t=n,o+=1;continue}if(i==="--port"){const n=s[o+1];if(!n)return{transport:r,hostname:t,port:e,error:"Missing value for --port"};const p=Number.parseInt(n,10);if(!Number.isFinite(p)||p<0)return{transport:r,hostname:t,port:e,error:`Invalid ACP port: ${n}`};e=p,o+=1;continue}return{transport:r,hostname:t,port:e,error:`Unknown option: ${i}`}}return{workspaceRoot:u,transport:r,hostname:t,port:e}}function k(s){let a;for(let u=0;u<s.length;u+=1){const r=s[u];if(r==="--workspace"){const t=s[u+1];if(!t)return{error:"Missing value for --workspace"};a=t,u+=1;continue}return{error:`Unknown option: ${r}`}}return{workspaceRoot:a}}function h(s,a="HTTP"){let u,r,t;for(let e=0;e<s.length;e+=1){const o=s[e];if(o==="--workspace"){const i=s[e+1];if(!i)return{hostname:r,port:t,error:"Missing value for --workspace"};u=i,e+=1;continue}if(o==="--host"){const i=s[e+1];if(!i)return{workspaceRoot:u,port:t,error:"Missing value for --host"};r=i,e+=1;continue}if(o==="--port"){const i=s[e+1];if(!i)return{workspaceRoot:u,hostname:r,error:"Missing value for --port"};const n=Number.parseInt(i,10);if(!Number.isFinite(n)||n<0)return{workspaceRoot:u,hostname:r,error:`Invalid ${a} port: ${i}`};t=n,e+=1;continue}return{workspaceRoot:u,hostname:r,port:t,error:`Unknown option: ${o}`}}return{workspaceRoot:u,hostname:r,port:t}}function P(s,a="stdio"){let u,r=a,t,e;for(let o=0;o<s.length;o+=1){const i=s[o];if(i==="--workspace"){const n=s[o+1];if(!n)return{transport:r,hostname:t,port:e,error:"Missing value for --workspace"};u=n,o+=1;continue}if(i==="--transport"){const n=s[o+1];if(!n)return{transport:r,hostname:t,port:e,error:"Missing value for --transport"};if(n!=="stdio"&&n!=="streamable-http")return{transport:r,hostname:t,port:e,error:`Unsupported runtime MCP transport: ${n}`};r=n,o+=1;continue}if(i==="--host"){const n=s[o+1];if(!n)return{transport:r,hostname:t,port:e,error:"Missing value for --host"};t=n,o+=1;continue}if(i==="--port"){const n=s[o+1];if(!n)return{transport:r,hostname:t,port:e,error:"Missing value for --port"};const p=Number.parseInt(n,10);if(!Number.isFinite(p)||p<0)return{transport:r,hostname:t,port:e,error:`Invalid runtime MCP port: ${n}`};e=p,o+=1;continue}return{transport:r,hostname:t,port:e,error:`Unknown option: ${i}`}}return{workspaceRoot:u,transport:r,hostname:t,port:e}}export{M as parseAcpServeOptions,h as parseHttpServeOptions,P as parseRuntimeMcpServeOptions,w as parseTopLevelManagedServiceOptions,k as parseWorkspaceOnlyOptions};
|
package/dist/cli/options.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
return `Usage:
|
|
1
|
+
function e(){return`Usage:
|
|
3
2
|
agent-harness init <project-name> [--template deep-research|single-agent] [--provider <provider>] [--model <model>] [--with-web-search|--no-web-search]
|
|
4
3
|
agent-harness chat [-w <path>] [--transport stdio|http] [--host <hostname>] [--port <port>] [--agent <agentId>] [--session <sessionId>] [--message <text>]
|
|
5
4
|
agent-harness [-w <path>] [prompt]
|
|
@@ -35,20 +34,4 @@ export function renderUsage() {
|
|
|
35
34
|
Run botbotgo or agent-harness from any folder.
|
|
36
35
|
If ./config/ is absent, the runtime falls back to the bundled system defaults and bundled resources.
|
|
37
36
|
Chat defaults to the current directory as the workspace. Use -w to point at another workspace.
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
export function isTopLevelCliCommand(value) {
|
|
41
|
-
return value === "init"
|
|
42
|
-
|| value === "chat"
|
|
43
|
-
|| value === "start"
|
|
44
|
-
|| value === "stop"
|
|
45
|
-
|| value === "acp"
|
|
46
|
-
|| value === "a2a"
|
|
47
|
-
|| value === "ag-ui"
|
|
48
|
-
|| value === "mcp"
|
|
49
|
-
|| value === "runtime"
|
|
50
|
-
|| value === "runtime-mcp";
|
|
51
|
-
}
|
|
52
|
-
export { parseChatOptions, parseInitOptions } from "./options-init-chat.js";
|
|
53
|
-
export { parseAcpServeOptions, parseHttpServeOptions, parseTopLevelManagedServiceOptions, parseRuntimeMcpServeOptions, parseWorkspaceOnlyOptions, } from "./options-serve.js";
|
|
54
|
-
export { parseRuntimeExportOptions, parseRuntimeInspectOptions, parseScheduledRunOptions, } from "./options-runtime.js";
|
|
37
|
+
`}function s(t){return t==="init"||t==="chat"||t==="start"||t==="stop"||t==="acp"||t==="a2a"||t==="ag-ui"||t==="mcp"||t==="runtime"||t==="runtime-mcp"}import{parseChatOptions as o,parseInitOptions as p}from"./options-init-chat.js";import{parseAcpServeOptions as h,parseHttpServeOptions as i,parseTopLevelManagedServiceOptions as c,parseRuntimeMcpServeOptions as m,parseWorkspaceOnlyOptions as g}from"./options-serve.js";import{parseRuntimeExportOptions as u,parseRuntimeInspectOptions as w,parseScheduledRunOptions as k}from"./options-runtime.js";export{s as isTopLevelCliCommand,h as parseAcpServeOptions,o as parseChatOptions,i as parseHttpServeOptions,p as parseInitOptions,u as parseRuntimeExportOptions,w as parseRuntimeInspectOptions,m as parseRuntimeMcpServeOptions,k as parseScheduledRunOptions,c as parseTopLevelManagedServiceOptions,g as parseWorkspaceOnlyOptions,e as renderUsage};
|
|
@@ -1,139 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
const CLI_IGNORED_STDERR_WARNING_SNIPPETS = [
|
|
3
|
-
"llamaindex was already imported. This breaks constructor checks and will lead to issues!",
|
|
4
|
-
"MaxListenersExceededWarning: Possible EventEmitter memory leak detected.",
|
|
5
|
-
"(Use `node --trace-warnings ...` to show where the warning was created)",
|
|
6
|
-
];
|
|
7
|
-
export function isChatServerNoiseLine(line) {
|
|
8
|
-
const trimmed = line.trim();
|
|
9
|
-
if (!trimmed) {
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
return (trimmed.startsWith("Serving ACP over stdio from ") ||
|
|
13
|
-
trimmed === "langsmith/experimental/sandbox is in alpha. This feature is experimental, and breaking changes are expected." ||
|
|
14
|
-
trimmed === "llamaindex was already imported. This breaks constructor checks and will lead to issues!");
|
|
15
|
-
}
|
|
16
|
-
export function installCliWriteListenerGuard(streams, minimum = 64) {
|
|
17
|
-
const restore = [];
|
|
18
|
-
for (const stream of streams) {
|
|
19
|
-
if (!stream?.getMaxListeners || !stream?.setMaxListeners) {
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
const previous = stream.getMaxListeners();
|
|
23
|
-
if (previous === 0 || previous >= minimum) {
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
stream.setMaxListeners(minimum);
|
|
27
|
-
restore.push(() => stream.setMaxListeners?.(previous));
|
|
28
|
-
}
|
|
29
|
-
return () => {
|
|
30
|
-
for (const reset of restore.reverse()) {
|
|
31
|
-
reset();
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export function installCliEmitterListenerGuard(minimum = 64) {
|
|
36
|
-
const previous = EventEmitter.defaultMaxListeners;
|
|
37
|
-
const hadPrototypeMaxListeners = Object.prototype.hasOwnProperty.call(EventEmitter.prototype, "_maxListeners");
|
|
38
|
-
const previousPrototypeMaxListeners = EventEmitter.prototype._maxListeners;
|
|
39
|
-
if (previous === 0 || previous >= minimum) {
|
|
40
|
-
return () => undefined;
|
|
41
|
-
}
|
|
42
|
-
EventEmitter.defaultMaxListeners = minimum;
|
|
43
|
-
EventEmitter.prototype._maxListeners = minimum;
|
|
44
|
-
return () => {
|
|
45
|
-
EventEmitter.defaultMaxListeners = previous;
|
|
46
|
-
if (hadPrototypeMaxListeners) {
|
|
47
|
-
EventEmitter.prototype._maxListeners = previousPrototypeMaxListeners;
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
delete EventEmitter.prototype._maxListeners;
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
export function installCliStderrNoiseFilter(enabled) {
|
|
54
|
-
if (!enabled) {
|
|
55
|
-
return () => undefined;
|
|
56
|
-
}
|
|
57
|
-
const originalStderrWrite = process.stderr.write.bind(process.stderr);
|
|
58
|
-
process.stderr.write = ((chunk, encoding, callback) => {
|
|
59
|
-
const text = typeof chunk === "string"
|
|
60
|
-
? chunk
|
|
61
|
-
: chunk instanceof Uint8Array
|
|
62
|
-
? Buffer.from(chunk).toString(typeof encoding === "string" ? encoding : undefined)
|
|
63
|
-
: "";
|
|
64
|
-
if (CLI_IGNORED_STDERR_WARNING_SNIPPETS.some((snippet) => text.includes(snippet))) {
|
|
65
|
-
if (typeof encoding === "function") {
|
|
66
|
-
encoding();
|
|
67
|
-
}
|
|
68
|
-
else if (typeof callback === "function") {
|
|
69
|
-
callback();
|
|
70
|
-
}
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
if (typeof encoding === "function") {
|
|
74
|
-
return originalStderrWrite(chunk, encoding);
|
|
75
|
-
}
|
|
76
|
-
return originalStderrWrite(chunk, encoding, callback);
|
|
77
|
-
});
|
|
78
|
-
return () => {
|
|
79
|
-
process.stderr.write = originalStderrWrite;
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
export function installCliWarningFilter() {
|
|
83
|
-
const originalEmitWarning = process.emitWarning.bind(process);
|
|
84
|
-
process.emitWarning = ((warning, ...args) => {
|
|
85
|
-
const text = typeof warning === "string" ? warning : warning?.message ?? "";
|
|
86
|
-
const name = typeof warning === "string" ? String(args[1] ?? args[0] ?? "") : warning?.name ?? "";
|
|
87
|
-
if (CLI_IGNORED_STDERR_WARNING_SNIPPETS.some((snippet) => text.includes(snippet))
|
|
88
|
-
|| name === "MaxListenersExceededWarning") {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
return originalEmitWarning(warning, ...args);
|
|
92
|
-
});
|
|
93
|
-
return () => {
|
|
94
|
-
process.emitWarning = originalEmitWarning;
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
function terminateChatSubprocess(child, signal = "SIGTERM") {
|
|
98
|
-
if (child.killed || child.exitCode !== null || child.signalCode !== null) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
try {
|
|
102
|
-
child.kill(signal);
|
|
103
|
-
}
|
|
104
|
-
catch {
|
|
105
|
-
// Ignore termination races during shutdown.
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
export function installChatSubprocessExitGuard(child, host = process) {
|
|
109
|
-
let cleanedUp = false;
|
|
110
|
-
let forceKillTimer;
|
|
111
|
-
const handleParentExit = () => {
|
|
112
|
-
terminateChatSubprocess(child, "SIGTERM");
|
|
113
|
-
if (!forceKillTimer && child.exitCode === null && child.signalCode === null) {
|
|
114
|
-
forceKillTimer = setTimeout(() => {
|
|
115
|
-
terminateChatSubprocess(child, "SIGKILL");
|
|
116
|
-
}, 2_000);
|
|
117
|
-
forceKillTimer.unref?.();
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
const cleanup = () => {
|
|
121
|
-
if (cleanedUp) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
cleanedUp = true;
|
|
125
|
-
if (forceKillTimer) {
|
|
126
|
-
clearTimeout(forceKillTimer);
|
|
127
|
-
forceKillTimer = undefined;
|
|
128
|
-
}
|
|
129
|
-
host.off("beforeExit", handleParentExit);
|
|
130
|
-
host.off("exit", handleParentExit);
|
|
131
|
-
child.off("close", cleanup);
|
|
132
|
-
child.off("exit", cleanup);
|
|
133
|
-
};
|
|
134
|
-
host.on("beforeExit", handleParentExit);
|
|
135
|
-
host.on("exit", handleParentExit);
|
|
136
|
-
child.on("close", cleanup);
|
|
137
|
-
child.on("exit", cleanup);
|
|
138
|
-
return cleanup;
|
|
139
|
-
}
|
|
1
|
+
import{EventEmitter as o}from"node:events";const a=["llamaindex was already imported. This breaks constructor checks and will lead to issues!","MaxListenersExceededWarning: Possible EventEmitter memory leak detected.","(Use `node --trace-warnings ...` to show where the warning was created)"];function p(t){const e=t.trim();return e?e.startsWith("Serving ACP over stdio from ")||e==="langsmith/experimental/sandbox is in alpha. This feature is experimental, and breaking changes are expected."||e==="llamaindex was already imported. This breaks constructor checks and will lead to issues!":!0}function x(t,e=64){const s=[];for(const r of t){if(!r?.getMaxListeners||!r?.setMaxListeners)continue;const n=r.getMaxListeners();n===0||n>=e||(r.setMaxListeners(e),s.push(()=>r.setMaxListeners?.(n)))}return()=>{for(const r of s.reverse())r()}}function c(t=64){const e=o.defaultMaxListeners,s=Object.prototype.hasOwnProperty.call(o.prototype,"_maxListeners"),r=o.prototype._maxListeners;return e===0||e>=t?()=>{}:(o.defaultMaxListeners=t,o.prototype._maxListeners=t,()=>{if(o.defaultMaxListeners=e,s){o.prototype._maxListeners=r;return}delete o.prototype._maxListeners})}function d(t){if(!t)return()=>{};const e=process.stderr.write.bind(process.stderr);return process.stderr.write=((s,r,n)=>{const i=typeof s=="string"?s:s instanceof Uint8Array?Buffer.from(s).toString(typeof r=="string"?r:void 0):"";return a.some(l=>i.includes(l))?(typeof r=="function"?r():typeof n=="function"&&n(),!0):typeof r=="function"?e(s,r):e(s,r,n)}),()=>{process.stderr.write=e}}function m(){const t=process.emitWarning.bind(process);return process.emitWarning=((e,...s)=>{const r=typeof e=="string"?e:e?.message??"",n=typeof e=="string"?String(s[1]??s[0]??""):e?.name??"";if(!(a.some(i=>r.includes(i))||n==="MaxListenersExceededWarning"))return t(e,...s)}),()=>{process.emitWarning=t}}function f(t,e="SIGTERM"){if(!(t.killed||t.exitCode!==null||t.signalCode!==null))try{t.kill(e)}catch{}}function L(t,e=process){let s=!1,r;const n=()=>{f(t,"SIGTERM"),!r&&t.exitCode===null&&t.signalCode===null&&(r=setTimeout(()=>{f(t,"SIGKILL")},2e3),r.unref?.())},i=()=>{s||(s=!0,r&&(clearTimeout(r),r=void 0),e.off("beforeExit",n),e.off("exit",n),t.off("close",i),t.off("exit",i))};return e.on("beforeExit",n),e.on("exit",n),t.on("close",i),t.on("exit",i),i}export{L as installChatSubprocessExitGuard,c as installCliEmitterListenerGuard,d as installCliStderrNoiseFilter,m as installCliWarningFilter,x as installCliWriteListenerGuard,p as isChatServerNoiseLine};
|