@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,362 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const MAX_STREAM_OBJECT_KEYS = 64;
|
|
5
|
-
const MAX_STREAM_ARRAY_ITEMS = 64;
|
|
6
|
-
const MAX_STREAM_SANITIZE_DEPTH = 6;
|
|
7
|
-
const LARGE_CONTEXT_KEYS = new Set([
|
|
8
|
-
"input",
|
|
9
|
-
"inputs",
|
|
10
|
-
"messages",
|
|
11
|
-
"history",
|
|
12
|
-
"context",
|
|
13
|
-
"attachments",
|
|
14
|
-
"files",
|
|
15
|
-
"conversation",
|
|
16
|
-
"transcript",
|
|
17
|
-
]);
|
|
18
|
-
function truncatePreview(value, maxChars) {
|
|
19
|
-
if (value.length <= maxChars) {
|
|
20
|
-
return value;
|
|
21
|
-
}
|
|
22
|
-
return `${value.slice(0, Math.max(0, maxChars - 15))}\n...[truncated]`;
|
|
23
|
-
}
|
|
24
|
-
function summarizeLargeText(value) {
|
|
25
|
-
if (value.length <= MAX_STREAM_INLINE_TEXT_CHARS) {
|
|
26
|
-
return value;
|
|
27
|
-
}
|
|
28
|
-
return {
|
|
29
|
-
truncated: true,
|
|
30
|
-
originalSizeChars: value.length,
|
|
31
|
-
preview: truncatePreview(value, STREAM_PREVIEW_TEXT_CHARS),
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function sanitizeStreamPayloadValue(value, depth) {
|
|
35
|
-
if (typeof value === "string") {
|
|
36
|
-
return summarizeLargeText(value);
|
|
37
|
-
}
|
|
38
|
-
if (value === null
|
|
39
|
-
|| value === undefined
|
|
40
|
-
|| typeof value === "number"
|
|
41
|
-
|| typeof value === "boolean") {
|
|
42
|
-
return value;
|
|
43
|
-
}
|
|
44
|
-
if (depth >= MAX_STREAM_SANITIZE_DEPTH) {
|
|
45
|
-
let serialized = "";
|
|
46
|
-
try {
|
|
47
|
-
serialized = JSON.stringify(value);
|
|
48
|
-
}
|
|
49
|
-
catch {
|
|
50
|
-
serialized = String(value);
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
truncated: true,
|
|
54
|
-
reason: "max-depth",
|
|
55
|
-
originalSizeChars: serialized.length,
|
|
56
|
-
preview: truncatePreview(serialized, STREAM_PREVIEW_TEXT_CHARS),
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
if (Array.isArray(value)) {
|
|
60
|
-
const limited = value
|
|
61
|
-
.slice(0, MAX_STREAM_ARRAY_ITEMS)
|
|
62
|
-
.map((entry) => sanitizeStreamPayloadValue(entry, depth + 1));
|
|
63
|
-
return value.length > MAX_STREAM_ARRAY_ITEMS
|
|
64
|
-
? {
|
|
65
|
-
items: limited,
|
|
66
|
-
truncated: true,
|
|
67
|
-
originalLength: value.length,
|
|
68
|
-
}
|
|
69
|
-
: limited;
|
|
70
|
-
}
|
|
71
|
-
if (typeof value === "object") {
|
|
72
|
-
const entries = Object.entries(value);
|
|
73
|
-
const limitedEntries = entries.slice(0, MAX_STREAM_OBJECT_KEYS);
|
|
74
|
-
const sanitized = Object.fromEntries(limitedEntries.map(([key, entry]) => [key, sanitizeStreamPayloadValue(entry, depth + 1)]));
|
|
75
|
-
if (entries.length > MAX_STREAM_OBJECT_KEYS) {
|
|
76
|
-
sanitized.__truncatedKeys = {
|
|
77
|
-
truncated: true,
|
|
78
|
-
originalKeyCount: entries.length,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
return sanitized;
|
|
82
|
-
}
|
|
83
|
-
return String(value);
|
|
84
|
-
}
|
|
85
|
-
export function sanitizeStreamPayload(value) {
|
|
86
|
-
return sanitizeStreamPayloadValue(value, 0);
|
|
87
|
-
}
|
|
88
|
-
function summarizeOpaquePayload(value) {
|
|
89
|
-
if (value === null || value === undefined) {
|
|
90
|
-
return value;
|
|
91
|
-
}
|
|
92
|
-
if (typeof value === "string") {
|
|
93
|
-
return {
|
|
94
|
-
truncated: true,
|
|
95
|
-
reason: "omitted-large-context",
|
|
96
|
-
originalSizeChars: value.length,
|
|
97
|
-
preview: truncatePreview(value, STREAM_PREVIEW_TEXT_CHARS),
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
let serialized = "";
|
|
101
|
-
try {
|
|
102
|
-
serialized = JSON.stringify(value);
|
|
103
|
-
}
|
|
104
|
-
catch {
|
|
105
|
-
serialized = String(value);
|
|
106
|
-
}
|
|
107
|
-
return {
|
|
108
|
-
truncated: true,
|
|
109
|
-
reason: "omitted-large-context",
|
|
110
|
-
originalSizeChars: serialized.length,
|
|
111
|
-
preview: truncatePreview(serialized, STREAM_PREVIEW_TEXT_CHARS),
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
function sanitizeRetainedEventDataField(key, value) {
|
|
115
|
-
if (LARGE_CONTEXT_KEYS.has(key)) {
|
|
116
|
-
if (key === "input" && typeof value === "object" && value && !Array.isArray(value)) {
|
|
117
|
-
const typed = value;
|
|
118
|
-
const taskSubagentType = typeof typed.subagent_type === "string"
|
|
119
|
-
? typed.subagent_type
|
|
120
|
-
: undefined;
|
|
121
|
-
if (taskSubagentType) {
|
|
122
|
-
return { subagent_type: taskSubagentType };
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return summarizeOpaquePayload(value);
|
|
126
|
-
}
|
|
127
|
-
return sanitizeStreamPayload(value);
|
|
128
|
-
}
|
|
129
|
-
export function sanitizeRetainedUpstreamEvent(event) {
|
|
130
|
-
if (typeof event !== "object" || !event || Array.isArray(event)) {
|
|
131
|
-
return sanitizeStreamPayload(event);
|
|
132
|
-
}
|
|
133
|
-
const typed = event;
|
|
134
|
-
const retained = {};
|
|
135
|
-
for (const [key, value] of Object.entries(typed)) {
|
|
136
|
-
if (key === "data" && typeof value === "object" && value && !Array.isArray(value)) {
|
|
137
|
-
const data = value;
|
|
138
|
-
retained.data = Object.fromEntries(Object.entries(data).map(([dataKey, dataValue]) => [dataKey, sanitizeRetainedEventDataField(dataKey, dataValue)]));
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
retained[key] = sanitizeStreamPayload(value);
|
|
142
|
-
}
|
|
143
|
-
return retained;
|
|
144
|
-
}
|
|
145
|
-
function parseMaybeJson(value) {
|
|
146
|
-
const trimmed = value.trim();
|
|
147
|
-
if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) {
|
|
148
|
-
return value;
|
|
149
|
-
}
|
|
150
|
-
try {
|
|
151
|
-
return JSON.parse(trimmed);
|
|
152
|
-
}
|
|
153
|
-
catch {
|
|
154
|
-
return value;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function unwrapToolMessageOutput(value) {
|
|
158
|
-
if (typeof value !== "object" || !value || Array.isArray(value)) {
|
|
159
|
-
return value;
|
|
160
|
-
}
|
|
161
|
-
const record = value;
|
|
162
|
-
if (typeof record.content === "string") {
|
|
163
|
-
return parseMaybeJson(record.content);
|
|
164
|
-
}
|
|
165
|
-
const kwargs = typeof record.kwargs === "object" && record.kwargs !== null
|
|
166
|
-
? record.kwargs
|
|
167
|
-
: undefined;
|
|
168
|
-
if (typeof kwargs?.content === "string") {
|
|
169
|
-
return parseMaybeJson(kwargs.content);
|
|
170
|
-
}
|
|
171
|
-
return value;
|
|
172
|
-
}
|
|
173
|
-
function readToolErrorText(value) {
|
|
174
|
-
if (typeof value === "string") {
|
|
175
|
-
return value;
|
|
176
|
-
}
|
|
177
|
-
if (value instanceof Error) {
|
|
178
|
-
return value.message;
|
|
179
|
-
}
|
|
180
|
-
if (typeof value !== "object" || !value) {
|
|
181
|
-
return "";
|
|
182
|
-
}
|
|
183
|
-
const record = value;
|
|
184
|
-
for (const candidate of [record.error, record.message, record.detail, record.details]) {
|
|
185
|
-
if (typeof candidate === "string" && candidate.trim()) {
|
|
186
|
-
return candidate;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
return "";
|
|
190
|
-
}
|
|
191
|
-
function isErrorLikeToolOutput(value) {
|
|
192
|
-
const message = readToolErrorText(value).trim();
|
|
193
|
-
if (!message) {
|
|
194
|
-
return false;
|
|
195
|
-
}
|
|
196
|
-
const firstNonEmptyLine = message
|
|
197
|
-
.split("\n")
|
|
198
|
-
.map((line) => line.trim())
|
|
199
|
-
.find((line) => line.length > 0) ?? "";
|
|
200
|
-
if (!firstNonEmptyLine) {
|
|
201
|
-
return false;
|
|
202
|
-
}
|
|
203
|
-
return /^(error|exception|failed|failure|denied|timed out|timeout|not permitted|eperm|eacces)\b:?/i.test(firstNonEmptyLine)
|
|
204
|
-
|| /^command failed:/i.test(firstNonEmptyLine)
|
|
205
|
-
|| /^stderr:/i.test(firstNonEmptyLine);
|
|
206
|
-
}
|
|
207
|
-
function isToolMessageLike(value) {
|
|
208
|
-
if (typeof value !== "object" || value === null) {
|
|
209
|
-
return false;
|
|
210
|
-
}
|
|
211
|
-
const typed = value;
|
|
212
|
-
if (typed.type === "tool" || typed.lc_direct_tool_output === true || typeof typed.tool_call_id === "string") {
|
|
213
|
-
return true;
|
|
214
|
-
}
|
|
215
|
-
if (typeof typed.lc_kwargs === "object" && typed.lc_kwargs !== null) {
|
|
216
|
-
const lcKwargs = typed.lc_kwargs;
|
|
217
|
-
return lcKwargs.type === "tool" || lcKwargs.lc_direct_tool_output === true || typeof lcKwargs.tool_call_id === "string";
|
|
218
|
-
}
|
|
219
|
-
return false;
|
|
220
|
-
}
|
|
221
|
-
function isDirectToolOutputPayload(value) {
|
|
222
|
-
if (Array.isArray(value)) {
|
|
223
|
-
return value.some((item) => isDirectToolOutputPayload(item));
|
|
224
|
-
}
|
|
225
|
-
if (typeof value !== "object" || value === null) {
|
|
226
|
-
return false;
|
|
227
|
-
}
|
|
228
|
-
const typed = value;
|
|
229
|
-
if (typed.lc_direct_tool_output === true) {
|
|
230
|
-
return true;
|
|
231
|
-
}
|
|
232
|
-
if (Array.isArray(typed.messages) && typed.messages.length > 0 && typed.messages.every((message) => isToolMessageLike(message))) {
|
|
233
|
-
return true;
|
|
234
|
-
}
|
|
235
|
-
return (isDirectToolOutputPayload(typed.update)
|
|
236
|
-
|| isDirectToolOutputPayload(typed.output)
|
|
237
|
-
|| isDirectToolOutputPayload(typed.data));
|
|
238
|
-
}
|
|
239
|
-
export function extractTerminalStreamOutput(event) {
|
|
240
|
-
if (typeof event !== "object" || !event)
|
|
241
|
-
return "";
|
|
242
|
-
const typed = event;
|
|
243
|
-
if (typed.event === "on_chat_model_end") {
|
|
244
|
-
if (hasToolCalls(typed.data?.output))
|
|
245
|
-
return "";
|
|
246
|
-
return extractVisibleOutput(typed.data?.output);
|
|
247
|
-
}
|
|
248
|
-
if (typed.event === "on_chain_end") {
|
|
249
|
-
if (typed.run_type === "tool")
|
|
250
|
-
return "";
|
|
251
|
-
if (isDirectToolOutputPayload(typed.data?.output))
|
|
252
|
-
return "";
|
|
253
|
-
const name = typeof typed.name === "string" ? typed.name : "";
|
|
254
|
-
if (/middleware|after_model/i.test(name))
|
|
255
|
-
return "";
|
|
256
|
-
return extractVisibleOutput(typed.data?.output);
|
|
257
|
-
}
|
|
258
|
-
return "";
|
|
259
|
-
}
|
|
260
|
-
export function extractReasoningStreamOutput(event) {
|
|
261
|
-
if (typeof event !== "object" || !event)
|
|
262
|
-
return "";
|
|
263
|
-
const typed = event;
|
|
264
|
-
return typed.event === "on_chat_model_stream" ? extractReasoningText(typed.data?.chunk) : "";
|
|
265
|
-
}
|
|
266
|
-
export function extractVisibleStreamOutput(event) {
|
|
267
|
-
if (typeof event !== "object" || !event)
|
|
268
|
-
return "";
|
|
269
|
-
const typed = event;
|
|
270
|
-
return typed.event === "on_chat_model_stream" ? readTextContent(typed.data?.chunk) : "";
|
|
271
|
-
}
|
|
272
|
-
export function extractStateStreamOutput(event) {
|
|
273
|
-
if (typeof event !== "object" || !event)
|
|
274
|
-
return "";
|
|
275
|
-
const typed = event;
|
|
276
|
-
if (typed.event !== "on_chain_stream") {
|
|
277
|
-
return "";
|
|
278
|
-
}
|
|
279
|
-
const chunk = typed.data?.chunk;
|
|
280
|
-
if (typeof chunk !== "object" || !chunk) {
|
|
281
|
-
return "";
|
|
282
|
-
}
|
|
283
|
-
const record = chunk;
|
|
284
|
-
if (!("messages" in record) && !("output" in record)) {
|
|
285
|
-
return "";
|
|
286
|
-
}
|
|
287
|
-
return extractVisibleOutput(chunk);
|
|
288
|
-
}
|
|
289
|
-
export function extractToolResult(event) {
|
|
290
|
-
if (typeof event !== "object" || !event)
|
|
291
|
-
return null;
|
|
292
|
-
const typed = event;
|
|
293
|
-
const isToolEnd = typed.event === "on_tool_end" || (typed.event === "on_chain_end" && typed.run_type === "tool");
|
|
294
|
-
const isToolError = typed.event === "on_tool_error" || (typed.event === "on_chain_error" && typed.run_type === "tool");
|
|
295
|
-
const toolName = typeof typed.name === "string" ? typed.name : "";
|
|
296
|
-
if ((!isToolEnd && !isToolError) || !toolName) {
|
|
297
|
-
return null;
|
|
298
|
-
}
|
|
299
|
-
const rawOutput = isToolError ? typed.data?.error ?? typed.data?.output : typed.data?.output;
|
|
300
|
-
const normalizedOutput = typeof rawOutput === "string"
|
|
301
|
-
? parseMaybeJson(rawOutput)
|
|
302
|
-
: unwrapToolMessageOutput(rawOutput);
|
|
303
|
-
return {
|
|
304
|
-
toolName,
|
|
305
|
-
output: sanitizeStreamPayload(normalizedOutput),
|
|
306
|
-
isError: isToolError || isErrorLikeToolOutput(normalizedOutput),
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
export function extractInterruptPayload(event) {
|
|
310
|
-
if (typeof event !== "object" || !event)
|
|
311
|
-
return null;
|
|
312
|
-
const typed = event;
|
|
313
|
-
if (typed.event === "on_chain_stream") {
|
|
314
|
-
const chunk = typed.data?.chunk;
|
|
315
|
-
if (typeof chunk === "object" && chunk && "__interrupt__" in chunk) {
|
|
316
|
-
return JSON.stringify(chunk.__interrupt__);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
if (typed.event === "on_chain_end") {
|
|
320
|
-
const output = typed.data?.output;
|
|
321
|
-
if (typeof output === "object" && output && "__interrupt__" in output) {
|
|
322
|
-
return JSON.stringify(output.__interrupt__);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
return null;
|
|
326
|
-
}
|
|
327
|
-
export function normalizeTerminalOutputKey(value) {
|
|
328
|
-
return value.trim();
|
|
329
|
-
}
|
|
330
|
-
export function computeIncrementalOutput(accumulated, next) {
|
|
331
|
-
if (!next) {
|
|
332
|
-
return { accumulated, delta: "" };
|
|
333
|
-
}
|
|
334
|
-
if (!accumulated) {
|
|
335
|
-
return { accumulated: next, delta: next };
|
|
336
|
-
}
|
|
337
|
-
if (next === accumulated || accumulated.endsWith(next)) {
|
|
338
|
-
return { accumulated, delta: "" };
|
|
339
|
-
}
|
|
340
|
-
if (next.startsWith(accumulated)) {
|
|
341
|
-
return {
|
|
342
|
-
accumulated: next,
|
|
343
|
-
delta: next.slice(accumulated.length),
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
const overlapLength = Math.min(accumulated.length, next.length);
|
|
347
|
-
for (let size = overlapLength; size > 0; size -= 1) {
|
|
348
|
-
if (accumulated.slice(-size) === next.slice(0, size)) {
|
|
349
|
-
return {
|
|
350
|
-
accumulated: accumulated + next.slice(size),
|
|
351
|
-
delta: next.slice(size),
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
return {
|
|
356
|
-
accumulated: accumulated + next,
|
|
357
|
-
delta: next,
|
|
358
|
-
};
|
|
359
|
-
}
|
|
360
|
-
export function readStreamDelta(chunk) {
|
|
361
|
-
return readTextContent(chunk);
|
|
362
|
-
}
|
|
1
|
+
import{extractReasoningText as h,extractVisibleOutput as p,hasToolCalls as b,readTextContent as y}from"./output-parsing.js";const S=12e3,u=2e3,l=64,g=64,T=6,E=new Set(["input","inputs","messages","history","context","attachments","files","conversation","transcript"]);function a(t,r){return t.length<=r?t:`${t.slice(0,Math.max(0,r-15))}
|
|
2
|
+
...[truncated]`}function A(t){return t.length<=S?t:{truncated:!0,originalSizeChars:t.length,preview:a(t,u)}}function d(t,r){if(typeof t=="string")return A(t);if(t==null||typeof t=="number"||typeof t=="boolean")return t;if(r>=T){let e="";try{e=JSON.stringify(t)}catch{e=String(t)}return{truncated:!0,reason:"max-depth",originalSizeChars:e.length,preview:a(e,u)}}if(Array.isArray(t)){const e=t.slice(0,g).map(n=>d(n,r+1));return t.length>g?{items:e,truncated:!0,originalLength:t.length}:e}if(typeof t=="object"){const e=Object.entries(t),n=e.slice(0,l),o=Object.fromEntries(n.map(([i,s])=>[i,d(s,r+1)]));return e.length>l&&(o.__truncatedKeys={truncated:!0,originalKeyCount:e.length}),o}return String(t)}function f(t){return d(t,0)}function O(t){if(t==null)return t;if(typeof t=="string")return{truncated:!0,reason:"omitted-large-context",originalSizeChars:t.length,preview:a(t,u)};let r="";try{r=JSON.stringify(t)}catch{r=String(t)}return{truncated:!0,reason:"omitted-large-context",originalSizeChars:r.length,preview:a(r,u)}}function j(t,r){if(E.has(t)){if(t==="input"&&typeof r=="object"&&r&&!Array.isArray(r)){const e=r,n=typeof e.subagent_type=="string"?e.subagent_type:void 0;if(n)return{subagent_type:n}}return O(r)}return f(r)}function M(t){if(typeof t!="object"||!t||Array.isArray(t))return f(t);const r=t,e={};for(const[n,o]of Object.entries(r)){if(n==="data"&&typeof o=="object"&&o&&!Array.isArray(o)){const i=o;e.data=Object.fromEntries(Object.entries(i).map(([s,m])=>[s,j(s,m)]));continue}e[n]=f(o)}return e}function _(t){const r=t.trim();if(!r.startsWith("{")&&!r.startsWith("["))return t;try{return JSON.parse(r)}catch{return t}}function w(t){if(typeof t!="object"||!t||Array.isArray(t))return t;const r=t;if(typeof r.content=="string")return _(r.content);const e=typeof r.kwargs=="object"&&r.kwargs!==null?r.kwargs:void 0;return typeof e?.content=="string"?_(e.content):t}function k(t){if(typeof t=="string")return t;if(t instanceof Error)return t.message;if(typeof t!="object"||!t)return"";const r=t;for(const e of[r.error,r.message,r.detail,r.details])if(typeof e=="string"&&e.trim())return e;return""}function z(t){const r=k(t).trim();if(!r)return!1;const e=r.split(`
|
|
3
|
+
`).map(n=>n.trim()).find(n=>n.length>0)??"";return e?/^(error|exception|failed|failure|denied|timed out|timeout|not permitted|eperm|eacces)\b:?/i.test(e)||/^command failed:/i.test(e)||/^stderr:/i.test(e):!1}function R(t){if(typeof t!="object"||t===null)return!1;const r=t;if(r.type==="tool"||r.lc_direct_tool_output===!0||typeof r.tool_call_id=="string")return!0;if(typeof r.lc_kwargs=="object"&&r.lc_kwargs!==null){const e=r.lc_kwargs;return e.type==="tool"||e.lc_direct_tool_output===!0||typeof e.tool_call_id=="string"}return!1}function c(t){if(Array.isArray(t))return t.some(e=>c(e));if(typeof t!="object"||t===null)return!1;const r=t;return r.lc_direct_tool_output===!0||Array.isArray(r.messages)&&r.messages.length>0&&r.messages.every(e=>R(e))?!0:c(r.update)||c(r.output)||c(r.data)}function N(t){if(typeof t!="object"||!t)return"";const r=t;if(r.event==="on_chat_model_end")return b(r.data?.output)?"":p(r.data?.output);if(r.event==="on_chain_end"){if(r.run_type==="tool"||c(r.data?.output))return"";const e=typeof r.name=="string"?r.name:"";return/middleware|after_model/i.test(e)?"":p(r.data?.output)}return""}function C(t){if(typeof t!="object"||!t)return"";const r=t;return r.event==="on_chat_model_stream"?h(r.data?.chunk):""}function I(t){if(typeof t!="object"||!t)return"";const r=t;return r.event==="on_chat_model_stream"?y(r.data?.chunk):""}function L(t){if(typeof t!="object"||!t)return"";const r=t;if(r.event!=="on_chain_stream")return"";const e=r.data?.chunk;if(typeof e!="object"||!e)return"";const n=e;return!("messages"in n)&&!("output"in n)?"":p(e)}function P(t){if(typeof t!="object"||!t)return null;const r=t,e=r.event==="on_tool_end"||r.event==="on_chain_end"&&r.run_type==="tool",n=r.event==="on_tool_error"||r.event==="on_chain_error"&&r.run_type==="tool",o=typeof r.name=="string"?r.name:"";if(!e&&!n||!o)return null;const i=n?r.data?.error??r.data?.output:r.data?.output,s=typeof i=="string"?_(i):w(i);return{toolName:o,output:f(s),isError:n||z(s)}}function J(t){if(typeof t!="object"||!t)return null;const r=t;if(r.event==="on_chain_stream"){const e=r.data?.chunk;if(typeof e=="object"&&e&&"__interrupt__"in e)return JSON.stringify(e.__interrupt__)}if(r.event==="on_chain_end"){const e=r.data?.output;if(typeof e=="object"&&e&&"__interrupt__"in e)return JSON.stringify(e.__interrupt__)}return null}function X(t){return t.trim()}function K(t,r){if(!r)return{accumulated:t,delta:""};if(!t)return{accumulated:r,delta:r};if(r===t||t.endsWith(r))return{accumulated:t,delta:""};if(r.startsWith(t))return{accumulated:r,delta:r.slice(t.length)};const e=Math.min(t.length,r.length);for(let n=e;n>0;n-=1)if(t.slice(-n)===r.slice(0,n))return{accumulated:t+r.slice(n),delta:r.slice(n)};return{accumulated:t+r,delta:r}}function W(t){return y(t)}export{K as computeIncrementalOutput,J as extractInterruptPayload,C as extractReasoningStreamOutput,L as extractStateStreamOutput,N as extractTerminalStreamOutput,P as extractToolResult,I as extractVisibleStreamOutput,X as normalizeTerminalOutputKey,W as readStreamDelta,M as sanitizeRetainedUpstreamEvent,f as sanitizeStreamPayload};
|
|
@@ -1,73 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
export const WORKSPACE_BOUNDARY_GUIDANCE = readRuntimePrompt("workspace-boundary-guidance");
|
|
6
|
-
export const DEFAULT_SUBAGENT_PROMPT = readRuntimePrompt("default-subagent");
|
|
7
|
-
export const STRICT_TOOL_JSON_INSTRUCTION = readRuntimePrompt("strict-tool-json");
|
|
8
|
-
export const BROWSER_CAPABILITY_DISCLAIMER_RECOVERY_INSTRUCTION = readRuntimePrompt("browser-capability-disclaimer-recovery");
|
|
9
|
-
export const INVALID_TOOL_SELECTION_RECOVERY_INSTRUCTION = readRuntimePrompt("invalid-tool-selection-recovery");
|
|
10
|
-
export const WRITE_TODOS_FULL_ENTRY_INSTRUCTION = readRuntimePrompt("write-todos-full-entry");
|
|
11
|
-
export const WRITE_TODOS_NON_EMPTY_INITIAL_LIST_INSTRUCTION = readRuntimePrompt("write-todos-non-empty-initial-list");
|
|
12
|
-
export const WRITE_TODOS_REQUIRED_PLAN_INSTRUCTION = readRuntimePrompt("write-todos-required-plan");
|
|
13
|
-
export const EXECUTION_WITH_TOOL_EVIDENCE_INSTRUCTION = readRuntimePrompt("execution-with-tool-evidence");
|
|
14
|
-
export const EXECUTION_WITH_TOOL_EVIDENCE_RETRY_INSTRUCTION = readRuntimePrompt("execution-with-tool-evidence-retry");
|
|
15
|
-
export const REQUIRED_EXECUTION_CONTINUATION_INSTRUCTION = readRuntimePrompt("required-execution-continuation");
|
|
16
|
-
export const DELEGATED_TASK_FAILURE_RECOVERY_INSTRUCTION = readRuntimePrompt("delegated-task-failure-recovery");
|
|
17
|
-
export const DELEGATION_ONLY_RECOVERY_INSTRUCTION = readRuntimePrompt("delegation-only-recovery");
|
|
18
|
-
export const INTERNAL_RUNTIME_SPILL_PATH_INSTRUCTION = readRuntimePrompt("internal-runtime-spill-path");
|
|
19
|
-
export const WORKSPACE_RELATIVE_PATH_INSTRUCTION = readRuntimePrompt("workspace-relative-path");
|
|
20
|
-
export function renderDurableMemoryContextPrompt(memoryContext) {
|
|
21
|
-
return renderBundledTemplate("prompts/runtime/durable-memory-context.md", {
|
|
22
|
-
memoryContext: memoryContext.trim(),
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
export function renderSlashCommandSkillInstruction(input) {
|
|
26
|
-
return renderBundledTemplate("prompts/runtime/slash-command-skill.md", {
|
|
27
|
-
skillQualifier: input.skillQualifier,
|
|
28
|
-
skillName: input.skillName,
|
|
29
|
-
argumentText: JSON.stringify(input.argumentText),
|
|
30
|
-
dryRunHint: input.dryRunHint,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
export function renderRuntimeMemoryManagerPrompt(input) {
|
|
34
|
-
const existing = input.existingRecords.length === 0
|
|
35
|
-
? "(none)"
|
|
36
|
-
: input.existingRecords
|
|
37
|
-
.map((record) => `- scope=${record.scope}; kind=${record.kind}; summary=${record.summary}; status=${record.status};${record.knowledgeIdentity ? ` knowledge_identity=${record.knowledgeIdentity}; knowledge_operation=${record.knowledgeOperation ?? "create"};` : ""}${record.operationalRule ? ` operational_rule=${record.operationalRule.trigger}->${record.operationalRule.action}(${record.operationalRule.target})[${record.operationalRule.effect ?? "apply"}];` : ""} content=${record.content.replace(/\s+/g, " ").slice(0, 220)}`)
|
|
38
|
-
.join("\n");
|
|
39
|
-
const values = {
|
|
40
|
-
sessionId: input.sessionId,
|
|
41
|
-
requestId: input.requestId,
|
|
42
|
-
candidateJson: JSON.stringify(input.candidate, null, 2),
|
|
43
|
-
existingRecords: existing,
|
|
44
|
-
};
|
|
45
|
-
return input.template
|
|
46
|
-
? renderTemplateText(input.template, values)
|
|
47
|
-
: renderBundledTemplate("prompts/runtime/memory-manager.md", values);
|
|
48
|
-
}
|
|
49
|
-
export function renderRuntimeMemoryMutationReconciliationPrompt(input) {
|
|
50
|
-
const existing = input.existingRecords.length === 0
|
|
51
|
-
? "(none)"
|
|
52
|
-
: input.existingRecords
|
|
53
|
-
.map((record) => `- knowledge_identity=${record.knowledgeIdentity ?? "(none)"}; scope=${record.scope}; kind=${record.kind}; status=${record.status}; summary=${record.summary};${record.operationalRule ? ` operational_rule=${record.operationalRule.trigger}->${record.operationalRule.action}(${record.operationalRule.target})[${record.operationalRule.effect ?? "apply"}];` : ""} content=${record.content.replace(/\s+/g, " ").slice(0, 220)}`)
|
|
54
|
-
.join("\n");
|
|
55
|
-
return renderBundledTemplate("prompts/runtime/memory-mutation-reconciliation.md", {
|
|
56
|
-
candidateJson: JSON.stringify(input.candidate, null, 2),
|
|
57
|
-
existingRecords: existing,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
export function renderProceduralMemoryManagerPrompt(input) {
|
|
61
|
-
const existing = input.existingRecords.length === 0
|
|
62
|
-
? "(none)"
|
|
63
|
-
: input.existingRecords
|
|
64
|
-
.map((record) => `- scope=${record.scope}; kind=${record.kind}; status=${record.status}; summary=${record.summary}; content=${record.content.replace(/\s+/g, " ").slice(0, 220)}`)
|
|
65
|
-
.join("\n");
|
|
66
|
-
return renderBundledTemplate("prompts/runtime/procedural-memory-manager.md", {
|
|
67
|
-
sessionId: input.sessionId,
|
|
68
|
-
requestId: input.requestId,
|
|
69
|
-
focus: input.focus.join(", "),
|
|
70
|
-
candidateJson: JSON.stringify(input.candidate, null, 2),
|
|
71
|
-
existingRecords: existing,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
1
|
+
import{readBundledText as r,renderBundledTemplate as s,renderTemplateText as a}from"../../utils/bundled-text.js";function n(e){return r(`prompts/runtime/${e}.md`).trim()}const m=n("workspace-boundary-guidance"),I=n("default-subagent"),T=n("strict-tool-json"),R=n("browser-capability-disclaimer-recovery"),u=n("invalid-tool-selection-recovery"),c=n("write-todos-full-entry"),p=n("write-todos-non-empty-initial-list"),d=n("write-todos-required-plan"),_=n("execution-with-tool-evidence"),N=n("execution-with-tool-evidence-retry"),O=n("required-execution-continuation"),E=n("delegated-task-failure-recovery"),g=n("delegation-only-recovery"),x=n("internal-runtime-spill-path"),y=n("workspace-relative-path");function C(e){return s("prompts/runtime/durable-memory-context.md",{memoryContext:e.trim()})}function S(e){return s("prompts/runtime/slash-command-skill.md",{skillQualifier:e.skillQualifier,skillName:e.skillName,argumentText:JSON.stringify(e.argumentText),dryRunHint:e.dryRunHint})}function $(e){const i=e.existingRecords.length===0?"(none)":e.existingRecords.map(o=>`- scope=${o.scope}; kind=${o.kind}; summary=${o.summary}; status=${o.status};${o.knowledgeIdentity?` knowledge_identity=${o.knowledgeIdentity}; knowledge_operation=${o.knowledgeOperation??"create"};`:""}${o.operationalRule?` operational_rule=${o.operationalRule.trigger}->${o.operationalRule.action}(${o.operationalRule.target})[${o.operationalRule.effect??"apply"}];`:""} content=${o.content.replace(/\s+/g," ").slice(0,220)}`).join(`
|
|
2
|
+
`),t={sessionId:e.sessionId,requestId:e.requestId,candidateJson:JSON.stringify(e.candidate,null,2),existingRecords:i};return e.template?a(e.template,t):s("prompts/runtime/memory-manager.md",t)}function U(e){const i=e.existingRecords.length===0?"(none)":e.existingRecords.map(t=>`- knowledge_identity=${t.knowledgeIdentity??"(none)"}; scope=${t.scope}; kind=${t.kind}; status=${t.status}; summary=${t.summary};${t.operationalRule?` operational_rule=${t.operationalRule.trigger}->${t.operationalRule.action}(${t.operationalRule.target})[${t.operationalRule.effect??"apply"}];`:""} content=${t.content.replace(/\s+/g," ").slice(0,220)}`).join(`
|
|
3
|
+
`);return s("prompts/runtime/memory-mutation-reconciliation.md",{candidateJson:JSON.stringify(e.candidate,null,2),existingRecords:i})}function f(e){const i=e.existingRecords.length===0?"(none)":e.existingRecords.map(t=>`- scope=${t.scope}; kind=${t.kind}; status=${t.status}; summary=${t.summary}; content=${t.content.replace(/\s+/g," ").slice(0,220)}`).join(`
|
|
4
|
+
`);return s("prompts/runtime/procedural-memory-manager.md",{sessionId:e.sessionId,requestId:e.requestId,focus:e.focus.join(", "),candidateJson:JSON.stringify(e.candidate,null,2),existingRecords:i})}export{R as BROWSER_CAPABILITY_DISCLAIMER_RECOVERY_INSTRUCTION,I as DEFAULT_SUBAGENT_PROMPT,E as DELEGATED_TASK_FAILURE_RECOVERY_INSTRUCTION,g as DELEGATION_ONLY_RECOVERY_INSTRUCTION,_ as EXECUTION_WITH_TOOL_EVIDENCE_INSTRUCTION,N as EXECUTION_WITH_TOOL_EVIDENCE_RETRY_INSTRUCTION,x as INTERNAL_RUNTIME_SPILL_PATH_INSTRUCTION,u as INVALID_TOOL_SELECTION_RECOVERY_INSTRUCTION,O as REQUIRED_EXECUTION_CONTINUATION_INSTRUCTION,T as STRICT_TOOL_JSON_INSTRUCTION,m as WORKSPACE_BOUNDARY_GUIDANCE,y as WORKSPACE_RELATIVE_PATH_INSTRUCTION,c as WRITE_TODOS_FULL_ENTRY_INSTRUCTION,p as WRITE_TODOS_NON_EMPTY_INITIAL_LIST_INSTRUCTION,d as WRITE_TODOS_REQUIRED_PLAN_INSTRUCTION,C as renderDurableMemoryContextPrompt,f as renderProceduralMemoryManagerPrompt,$ as renderRuntimeMemoryManagerPrompt,U as renderRuntimeMemoryMutationReconciliationPrompt,S as renderSlashCommandSkillInstruction};
|