@linnlabs/linnkit 0.8.0
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/CHANGELOG.md +84 -0
- package/LICENSE +21 -0
- package/README.md +178 -0
- package/README.zh-CN.md +182 -0
- package/dist/agent-invocation-BHcNfrBV.d.cts +30 -0
- package/dist/agent-invocation-BznDaXDs.d.ts +30 -0
- package/dist/agentEvents-DEB7Fy_J.d.cts +81 -0
- package/dist/agentEvents-DEB7Fy_J.d.ts +81 -0
- package/dist/agentSpec-EkmviZjy.d.cts +2621 -0
- package/dist/agentSpec-EkmviZjy.d.ts +2621 -0
- package/dist/ai-engine.types-BpeU_XQG.d.cts +158 -0
- package/dist/ai-engine.types-vZRnQcJa.d.ts +158 -0
- package/dist/audit-BaRUGaqv.d.cts +307 -0
- package/dist/audit-BaRUGaqv.d.ts +307 -0
- package/dist/audit-CtcfART1.d.ts +33 -0
- package/dist/audit-LeOrm2hX.d.cts +33 -0
- package/dist/checkpointMarker-DAI3wUQu.d.cts +8 -0
- package/dist/checkpointMarker-DAI3wUQu.d.ts +8 -0
- package/dist/cli.cjs +8028 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +4 -0
- package/dist/cli.d.ts +4 -0
- package/dist/cli.js +8025 -0
- package/dist/cli.js.map +1 -0
- package/dist/context-manager.cjs +8704 -0
- package/dist/context-manager.cjs.map +1 -0
- package/dist/context-manager.d.cts +2190 -0
- package/dist/context-manager.d.ts +2190 -0
- package/dist/context-manager.js +8650 -0
- package/dist/context-manager.js.map +1 -0
- package/dist/context-trace-DRi5M4lX.d.ts +239 -0
- package/dist/context-trace-HE2qY5Q-.d.cts +239 -0
- package/dist/contracts.cjs +1333 -0
- package/dist/contracts.cjs.map +1 -0
- package/dist/contracts.d.cts +8 -0
- package/dist/contracts.d.ts +8 -0
- package/dist/contracts.js +1214 -0
- package/dist/contracts.js.map +1 -0
- package/dist/defaultGraphExecutor-BBswR8wn.d.ts +624 -0
- package/dist/defaultGraphExecutor-BIjJj7WF.d.cts +624 -0
- package/dist/execution-CAIypb41.d.cts +129 -0
- package/dist/execution-CAIypb41.d.ts +129 -0
- package/dist/index-CHqwkvGp.d.ts +149 -0
- package/dist/index-CJeWHopy.d.ts +584 -0
- package/dist/index-Cm-JbzTH.d.cts +1450 -0
- package/dist/index-Cvr23YCl.d.cts +23 -0
- package/dist/index-DDzuSb0n.d.ts +23 -0
- package/dist/index-DO4dQgf2.d.cts +584 -0
- package/dist/index-DRBWi1fy.d.ts +1450 -0
- package/dist/index-Dl5PLgAv.d.cts +149 -0
- package/dist/index.cjs +9577 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +89 -0
- package/dist/index.d.ts +89 -0
- package/dist/index.js +9563 -0
- package/dist/index.js.map +1 -0
- package/dist/messages-XthmnHZ3.d.cts +8007 -0
- package/dist/messages-XthmnHZ3.d.ts +8007 -0
- package/dist/ports-DaatKJXp.d.cts +90 -0
- package/dist/ports-DnLuKfpE.d.ts +90 -0
- package/dist/ports.cjs +4 -0
- package/dist/ports.cjs.map +1 -0
- package/dist/ports.d.cts +7 -0
- package/dist/ports.d.ts +7 -0
- package/dist/ports.js +3 -0
- package/dist/ports.js.map +1 -0
- package/dist/quickstart.cjs +7697 -0
- package/dist/quickstart.cjs.map +1 -0
- package/dist/quickstart.d.cts +24 -0
- package/dist/quickstart.d.ts +24 -0
- package/dist/quickstart.js +7691 -0
- package/dist/quickstart.js.map +1 -0
- package/dist/runAgent-CPj_9e58.d.ts +88 -0
- package/dist/runAgent-HYKlXbVr.d.cts +88 -0
- package/dist/runHandle-CyXvzgzk.d.ts +239 -0
- package/dist/runHandle-D3gPsD7B.d.cts +239 -0
- package/dist/runtime-kernel/events.cjs +1485 -0
- package/dist/runtime-kernel/events.cjs.map +1 -0
- package/dist/runtime-kernel/events.d.cts +8 -0
- package/dist/runtime-kernel/events.d.ts +8 -0
- package/dist/runtime-kernel/events.js +1475 -0
- package/dist/runtime-kernel/events.js.map +1 -0
- package/dist/runtime-kernel.cjs +8656 -0
- package/dist/runtime-kernel.cjs.map +1 -0
- package/dist/runtime-kernel.d.cts +19 -0
- package/dist/runtime-kernel.d.ts +19 -0
- package/dist/runtime-kernel.js +8568 -0
- package/dist/runtime-kernel.js.map +1 -0
- package/dist/sse-vPyrOPa0.d.cts +1687 -0
- package/dist/sse-vPyrOPa0.d.ts +1687 -0
- package/dist/testkit.cjs +10613 -0
- package/dist/testkit.cjs.map +1 -0
- package/dist/testkit.d.cts +284 -0
- package/dist/testkit.d.ts +284 -0
- package/dist/testkit.js +10593 -0
- package/dist/testkit.js.map +1 -0
- package/dist/todo-B1PmDlp3.d.cts +2253 -0
- package/dist/todo-B1PmDlp3.d.ts +2253 -0
- package/dist/tokenizer-DFL4I7-I.d.ts +28 -0
- package/dist/tokenizer-DH_JXv-H.d.cts +28 -0
- package/dist/toolContracts-Blll0241.d.ts +463 -0
- package/dist/toolContracts-CLkQmhTG.d.cts +463 -0
- package/docs/README.md +76 -0
- package/docs/integration/01-installation.md +94 -0
- package/docs/integration/02-quickstart.md +104 -0
- package/docs/integration/README.md +223 -0
- package/docs/integration/agent-registration-guide.md +330 -0
- package/docs/integration/audit.md +64 -0
- package/docs/integration/child-runs.md +87 -0
- package/docs/integration/constraints-and-pitfalls.md +87 -0
- package/docs/integration/context-engineering.md +650 -0
- package/docs/integration/context-fences.md +289 -0
- package/docs/integration/glossary.md +69 -0
- package/docs/integration/llm-provider.md +76 -0
- package/docs/integration/persistence.md +44 -0
- package/docs/integration/realtime.md +76 -0
- package/docs/integration/run-supervisor.md +69 -0
- package/docs/integration/telemetry.md +48 -0
- package/docs/integration/testing.md +95 -0
- package/docs/integration/tool-development-guide.md +362 -0
- package/docs/integration/tool-history.md +202 -0
- package/docs/integration/tools.md +188 -0
- package/package.json +115 -0
|
@@ -0,0 +1,1485 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var zod = require('zod');
|
|
4
|
+
|
|
5
|
+
// src/runtime-kernel/events/agentEvents.ts
|
|
6
|
+
function isRecord(value) {
|
|
7
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
8
|
+
}
|
|
9
|
+
function isMarkedAsSseDispatched(event) {
|
|
10
|
+
return isRecord(event) && event["__dispatched_via_sse__"] === true;
|
|
11
|
+
}
|
|
12
|
+
function readAgentEventAnswerId(event) {
|
|
13
|
+
if (!isRecord(event)) return void 0;
|
|
14
|
+
const snake = event["answer_id"];
|
|
15
|
+
if (typeof snake === "string" && snake.trim().length > 0) {
|
|
16
|
+
return snake.trim();
|
|
17
|
+
}
|
|
18
|
+
const camel = event["answerId"];
|
|
19
|
+
if (typeof camel === "string" && camel.trim().length > 0) {
|
|
20
|
+
return camel.trim();
|
|
21
|
+
}
|
|
22
|
+
return void 0;
|
|
23
|
+
}
|
|
24
|
+
function readAgentEventSeq(event) {
|
|
25
|
+
if (!isRecord(event)) return void 0;
|
|
26
|
+
const value = event["seq"];
|
|
27
|
+
return Number.isInteger(value) ? Number(value) : void 0;
|
|
28
|
+
}
|
|
29
|
+
var ProviderReasoningDetails = zod.z.array(zod.z.unknown());
|
|
30
|
+
var ToolCallExtraContent = zod.z.object({
|
|
31
|
+
google: zod.z.object({
|
|
32
|
+
thought_signature: zod.z.string().optional()
|
|
33
|
+
}).passthrough().optional()
|
|
34
|
+
}).passthrough();
|
|
35
|
+
var ToolCallWire = zod.z.object({
|
|
36
|
+
id: zod.z.string(),
|
|
37
|
+
type: zod.z.literal("function"),
|
|
38
|
+
function: zod.z.object({
|
|
39
|
+
name: zod.z.string(),
|
|
40
|
+
arguments: zod.z.string()
|
|
41
|
+
}),
|
|
42
|
+
extra_content: ToolCallExtraContent.optional()
|
|
43
|
+
}).passthrough();
|
|
44
|
+
zod.z.object({
|
|
45
|
+
messageType: zod.z.literal("summary"),
|
|
46
|
+
originalMessageCount: zod.z.number().int().positive(),
|
|
47
|
+
compressionRatio: zod.z.number().min(0).max(1).optional(),
|
|
48
|
+
includedOldSummary: zod.z.boolean(),
|
|
49
|
+
replacedMessageIds: zod.z.array(zod.z.string()),
|
|
50
|
+
summarySeq: zod.z.number().int().nonnegative()
|
|
51
|
+
});
|
|
52
|
+
zod.z.object({
|
|
53
|
+
tool_calls: zod.z.array(ToolCallWire),
|
|
54
|
+
reasoning_details: ProviderReasoningDetails.optional()
|
|
55
|
+
});
|
|
56
|
+
zod.z.object({
|
|
57
|
+
tool_name: zod.z.string(),
|
|
58
|
+
args: zod.z.record(zod.z.unknown()).optional(),
|
|
59
|
+
tool_call_id: zod.z.string()
|
|
60
|
+
});
|
|
61
|
+
var ImageInfoMeta = zod.z.object({
|
|
62
|
+
url: zod.z.string().optional(),
|
|
63
|
+
width: zod.z.number().int().positive().optional(),
|
|
64
|
+
height: zod.z.number().int().positive().optional(),
|
|
65
|
+
format: zod.z.string().optional(),
|
|
66
|
+
size: zod.z.number().int().nonnegative().optional()
|
|
67
|
+
});
|
|
68
|
+
zod.z.object({
|
|
69
|
+
taskType: zod.z.string().optional(),
|
|
70
|
+
taskId: zod.z.string().optional(),
|
|
71
|
+
taskStatus: zod.z.enum(["requested", "in_progress", "completed", "failed"]).optional(),
|
|
72
|
+
taskTrackingInfo: zod.z.object({
|
|
73
|
+
startTime: zod.z.number().optional(),
|
|
74
|
+
endTime: zod.z.number().optional(),
|
|
75
|
+
duration: zod.z.number().optional(),
|
|
76
|
+
retryCount: zod.z.number().int().nonnegative().optional(),
|
|
77
|
+
lastError: zod.z.string().optional()
|
|
78
|
+
}).optional()
|
|
79
|
+
});
|
|
80
|
+
var PersistentMetadata = zod.z.object({
|
|
81
|
+
messageType: zod.z.literal("summary").optional(),
|
|
82
|
+
originalMessageCount: zod.z.number().int().positive().optional(),
|
|
83
|
+
compressionRatio: zod.z.number().min(0).max(1).optional(),
|
|
84
|
+
includedOldSummary: zod.z.boolean().optional(),
|
|
85
|
+
replacedMessageIds: zod.z.array(zod.z.string()).optional(),
|
|
86
|
+
summarySeq: zod.z.number().int().nonnegative().optional(),
|
|
87
|
+
tool_calls: zod.z.array(ToolCallWire).optional(),
|
|
88
|
+
reasoning_details: ProviderReasoningDetails.optional(),
|
|
89
|
+
tool_name: zod.z.string().optional(),
|
|
90
|
+
args: zod.z.record(zod.z.unknown()).optional(),
|
|
91
|
+
tool_call_id: zod.z.string().optional(),
|
|
92
|
+
raw_output: zod.z.string().optional(),
|
|
93
|
+
image_info: ImageInfoMeta.optional(),
|
|
94
|
+
taskType: zod.z.string().optional(),
|
|
95
|
+
taskId: zod.z.string().optional(),
|
|
96
|
+
taskStatus: zod.z.enum(["requested", "in_progress", "completed", "failed"]).optional(),
|
|
97
|
+
taskTrackingInfo: zod.z.object({
|
|
98
|
+
startTime: zod.z.number().optional(),
|
|
99
|
+
endTime: zod.z.number().optional(),
|
|
100
|
+
duration: zod.z.number().optional(),
|
|
101
|
+
retryCount: zod.z.number().int().nonnegative().optional(),
|
|
102
|
+
lastError: zod.z.string().optional()
|
|
103
|
+
}).optional(),
|
|
104
|
+
fenceKind: zod.z.string().optional(),
|
|
105
|
+
fenceAttrs: zod.z.record(zod.z.unknown()).optional(),
|
|
106
|
+
fencePlacement: zod.z.string().optional()
|
|
107
|
+
}).passthrough();
|
|
108
|
+
var BaseMessage = zod.z.object({
|
|
109
|
+
id: zod.z.string(),
|
|
110
|
+
content: zod.z.string(),
|
|
111
|
+
timestamp: zod.z.number().int().nonnegative(),
|
|
112
|
+
metadata: PersistentMetadata.optional()
|
|
113
|
+
});
|
|
114
|
+
var SystemMessage = BaseMessage.extend({
|
|
115
|
+
role: zod.z.literal("system"),
|
|
116
|
+
type: zod.z.enum(["system_prompt", "history_summary", "context_injection"])
|
|
117
|
+
});
|
|
118
|
+
var UserMessage = BaseMessage.extend({
|
|
119
|
+
role: zod.z.literal("user"),
|
|
120
|
+
type: zod.z.enum([
|
|
121
|
+
"user_input",
|
|
122
|
+
"context_injection",
|
|
123
|
+
"context_before",
|
|
124
|
+
"context_after",
|
|
125
|
+
"document_fragment",
|
|
126
|
+
"task_request",
|
|
127
|
+
"image"
|
|
128
|
+
])
|
|
129
|
+
});
|
|
130
|
+
var AssistantMessage = BaseMessage.extend({
|
|
131
|
+
role: zod.z.literal("assistant"),
|
|
132
|
+
type: zod.z.enum([
|
|
133
|
+
"thought",
|
|
134
|
+
"final_answer",
|
|
135
|
+
"tool_code",
|
|
136
|
+
"tool_calls",
|
|
137
|
+
"task_completion"
|
|
138
|
+
])
|
|
139
|
+
});
|
|
140
|
+
var ToolMessage = BaseMessage.extend({
|
|
141
|
+
role: zod.z.literal("tool"),
|
|
142
|
+
type: zod.z.literal("tool_output")
|
|
143
|
+
});
|
|
144
|
+
zod.z.discriminatedUnion("role", [
|
|
145
|
+
SystemMessage,
|
|
146
|
+
UserMessage,
|
|
147
|
+
AssistantMessage,
|
|
148
|
+
ToolMessage
|
|
149
|
+
]);
|
|
150
|
+
var SerializableJsonValueSchema = zod.z.lazy(
|
|
151
|
+
() => zod.z.union([
|
|
152
|
+
zod.z.string(),
|
|
153
|
+
zod.z.number(),
|
|
154
|
+
zod.z.boolean(),
|
|
155
|
+
zod.z.null(),
|
|
156
|
+
zod.z.array(SerializableJsonValueSchema),
|
|
157
|
+
zod.z.record(zod.z.string(), SerializableJsonValueSchema)
|
|
158
|
+
])
|
|
159
|
+
);
|
|
160
|
+
var SerializableJsonRecord = zod.z.record(zod.z.string(), SerializableJsonValueSchema);
|
|
161
|
+
var AgentSpecMessageType = zod.z.enum([
|
|
162
|
+
"system_prompt",
|
|
163
|
+
"history_summary",
|
|
164
|
+
"context_injection",
|
|
165
|
+
"user_input",
|
|
166
|
+
"context_before",
|
|
167
|
+
"context_after",
|
|
168
|
+
"document_fragment",
|
|
169
|
+
"task_request",
|
|
170
|
+
"image",
|
|
171
|
+
"thought",
|
|
172
|
+
"final_answer",
|
|
173
|
+
"tool_code",
|
|
174
|
+
"tool_calls",
|
|
175
|
+
"task_completion",
|
|
176
|
+
"tool_output"
|
|
177
|
+
]);
|
|
178
|
+
var AgentSpecBudgetPolicy = zod.z.object({
|
|
179
|
+
maxTokens: zod.z.number().int().positive().optional(),
|
|
180
|
+
reservedForResponse: zod.z.number().int().nonnegative().optional(),
|
|
181
|
+
workingMemoryBudgetPercentage: zod.z.number().min(0).max(1).optional()
|
|
182
|
+
});
|
|
183
|
+
var AgentSpecToolHistoryPolicy = zod.z.object({
|
|
184
|
+
strategy: zod.z.enum(["per-pair", "per-run", "none"]).optional(),
|
|
185
|
+
keepLatestToolPairs: zod.z.number().int().nonnegative().optional(),
|
|
186
|
+
keepLatestRuns: zod.z.number().int().nonnegative().optional(),
|
|
187
|
+
maxInteractionGroups: zod.z.number().int().nonnegative().optional(),
|
|
188
|
+
overflowStrategy: zod.z.enum(["keep-latest", "fail-fast"]).optional(),
|
|
189
|
+
maxPairTokens: zod.z.number().int().nonnegative().optional(),
|
|
190
|
+
maxOutputSummaryTokens: zod.z.number().int().nonnegative().optional()
|
|
191
|
+
});
|
|
192
|
+
var AgentSpecToolObservationGovernancePolicy = zod.z.object({
|
|
193
|
+
enabled: zod.z.boolean().optional(),
|
|
194
|
+
maxChars: zod.z.number().int().positive().optional(),
|
|
195
|
+
maxLines: zod.z.number().int().positive().optional()
|
|
196
|
+
});
|
|
197
|
+
var AgentSpecToolOutputPolicy = zod.z.object({
|
|
198
|
+
observationGovernance: AgentSpecToolObservationGovernancePolicy.optional()
|
|
199
|
+
});
|
|
200
|
+
var AgentSpecProviderReplayPolicy = zod.z.object({
|
|
201
|
+
provider: zod.z.string().min(1).optional(),
|
|
202
|
+
requiresReasoningDetailsForToolReplay: zod.z.boolean().optional(),
|
|
203
|
+
missingSidecarBehavior: zod.z.enum(["allow", "degrade_to_text", "provider_empty_replay_field"]).optional()
|
|
204
|
+
});
|
|
205
|
+
var AgentSpecSummarizationPolicy = zod.z.object({
|
|
206
|
+
triggerThreshold: zod.z.number().min(0).max(1).optional(),
|
|
207
|
+
budgetPercentage: zod.z.number().min(0).max(1).optional(),
|
|
208
|
+
oldestMessagesPercentage: zod.z.number().min(0).max(1).optional(),
|
|
209
|
+
agentId: zod.z.string().min(1).optional(),
|
|
210
|
+
failureBehavior: zod.z.enum(["fail-fast", "continue-if-within-budget"]).optional()
|
|
211
|
+
});
|
|
212
|
+
var AgentSpecMustKeepTruncationRule = zod.z.object({
|
|
213
|
+
fenceKind: zod.z.string().min(1),
|
|
214
|
+
maxBudgetFraction: zod.z.number().gt(0).max(1),
|
|
215
|
+
strategyName: zod.z.string().min(1)
|
|
216
|
+
});
|
|
217
|
+
var AgentSpecMustKeepPolicy = zod.z.object({
|
|
218
|
+
alwaysKeepTypes: zod.z.array(AgentSpecMessageType).optional(),
|
|
219
|
+
alwaysKeepFenceKinds: zod.z.array(zod.z.string().min(1)).optional(),
|
|
220
|
+
truncationRules: zod.z.array(AgentSpecMustKeepTruncationRule).optional()
|
|
221
|
+
});
|
|
222
|
+
var AgentSpecWorkingMemoryPolicy = zod.z.object({
|
|
223
|
+
maxRecentToolInteractions: zod.z.number().int().nonnegative().optional(),
|
|
224
|
+
minToolInteractionsToKeep: zod.z.number().int().nonnegative().optional(),
|
|
225
|
+
toolPairingSearchRange: zod.z.number().int().positive().optional()
|
|
226
|
+
});
|
|
227
|
+
var AgentSpecCheckpointPolicy = zod.z.object({
|
|
228
|
+
keepPairsBefore: zod.z.number().int().nonnegative().optional(),
|
|
229
|
+
triggerToolName: zod.z.string().min(1).optional()
|
|
230
|
+
});
|
|
231
|
+
var AgentSpecReasoningRetentionPolicy = zod.z.object({
|
|
232
|
+
keepLatestThoughts: zod.z.number().int().nonnegative().optional()
|
|
233
|
+
});
|
|
234
|
+
var AgentSpecTokenEstimationPolicy = zod.z.object({
|
|
235
|
+
encoding: zod.z.string().min(1).optional(),
|
|
236
|
+
avgCharsPerToken: zod.z.number().positive().optional(),
|
|
237
|
+
toolCallOverhead: zod.z.number().int().nonnegative().optional()
|
|
238
|
+
});
|
|
239
|
+
var AgentSpecSystemReminderTrigger = zod.z.object({
|
|
240
|
+
kind: zod.z.string().min(1),
|
|
241
|
+
threshold: zod.z.number().nonnegative().optional(),
|
|
242
|
+
value: zod.z.union([zod.z.string(), zod.z.number(), zod.z.boolean()]).optional(),
|
|
243
|
+
moduloStep: zod.z.boolean().optional(),
|
|
244
|
+
toolName: zod.z.string().min(1).optional(),
|
|
245
|
+
period: zod.z.number().int().positive().optional(),
|
|
246
|
+
minStep: zod.z.number().int().nonnegative().optional(),
|
|
247
|
+
ratio: zod.z.number().min(0).max(1).optional(),
|
|
248
|
+
config: SerializableJsonRecord.optional()
|
|
249
|
+
});
|
|
250
|
+
var AgentSpecSystemReminderExtraRule = zod.z.object({
|
|
251
|
+
id: zod.z.string().min(1),
|
|
252
|
+
trigger: AgentSpecSystemReminderTrigger,
|
|
253
|
+
contentTemplate: zod.z.string().min(1),
|
|
254
|
+
contentArgs: SerializableJsonRecord.optional()
|
|
255
|
+
});
|
|
256
|
+
var AgentSpecSystemReminderPolicy = zod.z.object({
|
|
257
|
+
enabledRuleIds: zod.z.array(zod.z.string().min(1)).nullable().optional(),
|
|
258
|
+
disabledRuleIds: zod.z.array(zod.z.string().min(1)).optional(),
|
|
259
|
+
thresholds: zod.z.object({
|
|
260
|
+
toolCallStreak: zod.z.number().int().nonnegative().optional(),
|
|
261
|
+
taskstateReflectionPeriod: zod.z.number().int().positive().optional(),
|
|
262
|
+
budgetWarningRatio: zod.z.number().min(0).max(1).optional(),
|
|
263
|
+
lastStepsHintThreshold: zod.z.number().int().nonnegative().optional()
|
|
264
|
+
}).optional(),
|
|
265
|
+
extraRules: zod.z.array(AgentSpecSystemReminderExtraRule).optional()
|
|
266
|
+
}).superRefine((value, ctx) => {
|
|
267
|
+
if (value.enabledRuleIds !== void 0 && value.enabledRuleIds !== null && value.disabledRuleIds?.length) {
|
|
268
|
+
ctx.addIssue({
|
|
269
|
+
code: zod.z.ZodIssueCode.custom,
|
|
270
|
+
path: ["disabledRuleIds"],
|
|
271
|
+
message: "enabledRuleIds and disabledRuleIds cannot be configured at the same time"
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
var AgentSpecContextTracePolicy = zod.z.object({
|
|
276
|
+
enabled: zod.z.boolean().optional(),
|
|
277
|
+
includeMessageIds: zod.z.boolean().optional(),
|
|
278
|
+
includeTokenBreakdown: zod.z.boolean().optional(),
|
|
279
|
+
maxTraceEvents: zod.z.number().int().positive().optional()
|
|
280
|
+
});
|
|
281
|
+
var AgentSpecContextPolicy = zod.z.object({
|
|
282
|
+
profileId: zod.z.string().min(1),
|
|
283
|
+
budget: AgentSpecBudgetPolicy.optional(),
|
|
284
|
+
toolHistory: AgentSpecToolHistoryPolicy.optional(),
|
|
285
|
+
toolOutput: AgentSpecToolOutputPolicy.optional(),
|
|
286
|
+
providerReplay: AgentSpecProviderReplayPolicy.optional(),
|
|
287
|
+
summarization: AgentSpecSummarizationPolicy.optional(),
|
|
288
|
+
mustKeep: AgentSpecMustKeepPolicy.optional(),
|
|
289
|
+
workingMemory: AgentSpecWorkingMemoryPolicy.optional(),
|
|
290
|
+
checkpoint: AgentSpecCheckpointPolicy.optional(),
|
|
291
|
+
reasoningRetention: AgentSpecReasoningRetentionPolicy.optional(),
|
|
292
|
+
tokenEstimation: AgentSpecTokenEstimationPolicy.optional(),
|
|
293
|
+
systemReminder: AgentSpecSystemReminderPolicy.optional(),
|
|
294
|
+
contextTrace: AgentSpecContextTracePolicy.optional()
|
|
295
|
+
});
|
|
296
|
+
var JsonRecord = zod.z.record(zod.z.string(), zod.z.unknown());
|
|
297
|
+
var ToolArgsSchemaSpec = JsonRecord.superRefine((value, ctx) => {
|
|
298
|
+
const parse = value["parse"];
|
|
299
|
+
const safeParse = value["safeParse"];
|
|
300
|
+
const definition = value["_def"];
|
|
301
|
+
if (typeof parse === "function" && typeof safeParse === "function" && definition !== void 0) {
|
|
302
|
+
ctx.addIssue({
|
|
303
|
+
code: zod.z.ZodIssueCode.custom,
|
|
304
|
+
message: "argsSchema must be a serializable record, not a runtime zod schema"
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
var AgentCapability = zod.z.string().min(1);
|
|
309
|
+
var ToolBindingSpec = zod.z.object({
|
|
310
|
+
toolId: zod.z.string().min(1),
|
|
311
|
+
bindingId: zod.z.string().min(1).optional(),
|
|
312
|
+
argsSchema: ToolArgsSchemaSpec.optional(),
|
|
313
|
+
config: JsonRecord.optional(),
|
|
314
|
+
metadata: JsonRecord.optional()
|
|
315
|
+
});
|
|
316
|
+
var AgentSpecModelHints = zod.z.object({
|
|
317
|
+
preferredProviders: zod.z.array(zod.z.string().min(1)).optional(),
|
|
318
|
+
preferredModels: zod.z.array(zod.z.string().min(1)).optional(),
|
|
319
|
+
fallbackChain: zod.z.array(zod.z.string().min(1)).optional()
|
|
320
|
+
});
|
|
321
|
+
var AgentSpecAuditConfig = zod.z.object({
|
|
322
|
+
redactionLevel: zod.z.enum(["none", "standard", "strict"]).optional(),
|
|
323
|
+
pii: zod.z.boolean().optional()
|
|
324
|
+
});
|
|
325
|
+
zod.z.object({
|
|
326
|
+
id: zod.z.string().min(1),
|
|
327
|
+
version: zod.z.string().min(1),
|
|
328
|
+
role: zod.z.string().optional(),
|
|
329
|
+
description: zod.z.string().optional(),
|
|
330
|
+
capabilities: zod.z.array(AgentCapability),
|
|
331
|
+
tools: zod.z.array(ToolBindingSpec),
|
|
332
|
+
contextPolicy: AgentSpecContextPolicy,
|
|
333
|
+
modelHints: AgentSpecModelHints.optional(),
|
|
334
|
+
audit: AgentSpecAuditConfig.optional(),
|
|
335
|
+
metadata: JsonRecord.optional()
|
|
336
|
+
});
|
|
337
|
+
var JsonRecord2 = zod.z.record(zod.z.string(), zod.z.unknown());
|
|
338
|
+
var AUDIT_DECISION_OUTCOMES = [
|
|
339
|
+
"allowed",
|
|
340
|
+
"denied",
|
|
341
|
+
"fallback",
|
|
342
|
+
"retry",
|
|
343
|
+
"cancelled",
|
|
344
|
+
"paused",
|
|
345
|
+
"resumed",
|
|
346
|
+
"requested",
|
|
347
|
+
"recorded"
|
|
348
|
+
];
|
|
349
|
+
var AuditActor = zod.z.object({
|
|
350
|
+
kind: zod.z.enum(["system", "host", "agent", "model", "tool", "user"]),
|
|
351
|
+
id: zod.z.string().min(1).optional(),
|
|
352
|
+
name: zod.z.string().min(1).optional()
|
|
353
|
+
});
|
|
354
|
+
var AuditDecision = zod.z.object({
|
|
355
|
+
outcome: zod.z.enum(AUDIT_DECISION_OUTCOMES),
|
|
356
|
+
reason: zod.z.string().optional(),
|
|
357
|
+
policy: zod.z.string().optional(),
|
|
358
|
+
metadata: JsonRecord2.optional()
|
|
359
|
+
});
|
|
360
|
+
var AuditEvidence = zod.z.object({
|
|
361
|
+
kind: zod.z.string().min(1),
|
|
362
|
+
ref: zod.z.string().min(1).optional(),
|
|
363
|
+
summary: zod.z.string().optional(),
|
|
364
|
+
metadata: JsonRecord2.optional()
|
|
365
|
+
});
|
|
366
|
+
var AuditCostDelta = zod.z.object({
|
|
367
|
+
tokensInput: zod.z.number().int().nonnegative().optional(),
|
|
368
|
+
tokensOutput: zod.z.number().int().nonnegative().optional(),
|
|
369
|
+
totalCostUsd: zod.z.number().nonnegative().optional(),
|
|
370
|
+
latencyMs: zod.z.number().nonnegative().optional()
|
|
371
|
+
});
|
|
372
|
+
var AuditScope = zod.z.object({
|
|
373
|
+
conversationId: zod.z.string().min(1).optional(),
|
|
374
|
+
runId: zod.z.string().min(1).optional(),
|
|
375
|
+
parentRunId: zod.z.string().min(1).optional(),
|
|
376
|
+
turnId: zod.z.string().min(1).optional(),
|
|
377
|
+
traceId: zod.z.string().min(1).optional(),
|
|
378
|
+
agentSpecId: zod.z.string().min(1).optional(),
|
|
379
|
+
toolCallId: zod.z.string().min(1).optional(),
|
|
380
|
+
toolName: zod.z.string().min(1).optional(),
|
|
381
|
+
modelId: zod.z.string().min(1).optional(),
|
|
382
|
+
nodeId: zod.z.string().min(1).optional(),
|
|
383
|
+
metadata: JsonRecord2.optional()
|
|
384
|
+
});
|
|
385
|
+
var AuditEnvelope = zod.z.object({
|
|
386
|
+
envelopeId: zod.z.string().min(1),
|
|
387
|
+
runId: zod.z.string().min(1),
|
|
388
|
+
parentRunId: zod.z.string().min(1).optional(),
|
|
389
|
+
ts: zod.z.number().int().nonnegative(),
|
|
390
|
+
actor: AuditActor,
|
|
391
|
+
action: zod.z.string().min(1),
|
|
392
|
+
decision: AuditDecision.optional(),
|
|
393
|
+
evidence: zod.z.array(AuditEvidence).optional(),
|
|
394
|
+
costDelta: AuditCostDelta.optional(),
|
|
395
|
+
scope: AuditScope.optional()
|
|
396
|
+
});
|
|
397
|
+
var BaseEvent = zod.z.object({
|
|
398
|
+
id: zod.z.string(),
|
|
399
|
+
conversation_id: zod.z.string(),
|
|
400
|
+
timestamp: zod.z.number(),
|
|
401
|
+
metadata: zod.z.record(zod.z.unknown()).optional(),
|
|
402
|
+
version: zod.z.literal(1).default(1),
|
|
403
|
+
turn_id: zod.z.string(),
|
|
404
|
+
ephemeral: zod.z.boolean().optional()
|
|
405
|
+
});
|
|
406
|
+
var ToolCallPhase = zod.z.enum(["start", "update", "complete", "error"]);
|
|
407
|
+
var Status = zod.z.enum(["loading", "success", "error"]);
|
|
408
|
+
var AgentTodoStatus = zod.z.enum(["pending", "in_progress", "completed", "cancelled"]);
|
|
409
|
+
var AgentTodoItem = zod.z.object({
|
|
410
|
+
id: zod.z.string(),
|
|
411
|
+
content: zod.z.string(),
|
|
412
|
+
status: AgentTodoStatus
|
|
413
|
+
});
|
|
414
|
+
var ProviderReasoningDetailsPayload = zod.z.array(zod.z.unknown());
|
|
415
|
+
var ToolCallDecisionPayload = zod.z.object({
|
|
416
|
+
args: zod.z.record(zod.z.any()).optional(),
|
|
417
|
+
tool_calls: zod.z.array(zod.z.unknown()).optional(),
|
|
418
|
+
/**
|
|
419
|
+
* 不透明 provider reasoning replay blocks。
|
|
420
|
+
*
|
|
421
|
+
* RuntimeEvent 层的标准位置是 assistant 产出事件携带 reasoning_details;
|
|
422
|
+
* context-manager 会把它回放到 AiMessage.metadata.reasoning_details。
|
|
423
|
+
*/
|
|
424
|
+
reasoning_details: ProviderReasoningDetailsPayload.optional()
|
|
425
|
+
}).passthrough();
|
|
426
|
+
zod.z.discriminatedUnion("type", [
|
|
427
|
+
BaseEvent.extend({
|
|
428
|
+
type: zod.z.literal("user_input"),
|
|
429
|
+
content: zod.z.string(),
|
|
430
|
+
raw_content: zod.z.string().optional(),
|
|
431
|
+
source: zod.z.enum(["user", "editor", "system"]).default("user")
|
|
432
|
+
}),
|
|
433
|
+
BaseEvent.extend({
|
|
434
|
+
type: zod.z.literal("thought"),
|
|
435
|
+
content: zod.z.string(),
|
|
436
|
+
thought_message_id: zod.z.string().optional(),
|
|
437
|
+
delta: zod.z.string().optional(),
|
|
438
|
+
is_complete: zod.z.boolean().default(false)
|
|
439
|
+
}),
|
|
440
|
+
BaseEvent.extend({
|
|
441
|
+
type: zod.z.literal("tool_call_decision"),
|
|
442
|
+
tool_name: zod.z.string(),
|
|
443
|
+
tool_call_id: zod.z.string(),
|
|
444
|
+
phase: ToolCallPhase,
|
|
445
|
+
status: Status,
|
|
446
|
+
args: zod.z.record(zod.z.any()).optional(),
|
|
447
|
+
payload: ToolCallDecisionPayload.optional(),
|
|
448
|
+
parent_tool_call_id: zod.z.string().optional(),
|
|
449
|
+
meta: zod.z.record(zod.z.any()).optional()
|
|
450
|
+
}),
|
|
451
|
+
BaseEvent.extend({
|
|
452
|
+
type: zod.z.literal("tool_process"),
|
|
453
|
+
tool_name: zod.z.string(),
|
|
454
|
+
tool_call_id: zod.z.string(),
|
|
455
|
+
phase: ToolCallPhase,
|
|
456
|
+
status: Status,
|
|
457
|
+
args: zod.z.record(zod.z.any()).optional(),
|
|
458
|
+
payload: zod.z.record(zod.z.any()).optional(),
|
|
459
|
+
parent_tool_call_id: zod.z.string().optional(),
|
|
460
|
+
meta: zod.z.record(zod.z.any()).optional()
|
|
461
|
+
}),
|
|
462
|
+
BaseEvent.extend({
|
|
463
|
+
type: zod.z.literal("tool_output"),
|
|
464
|
+
tool_name: zod.z.string(),
|
|
465
|
+
tool_call_id: zod.z.string(),
|
|
466
|
+
status: zod.z.enum(["success", "error"]),
|
|
467
|
+
output: zod.z.any().optional(),
|
|
468
|
+
payload: zod.z.record(zod.z.any()).optional(),
|
|
469
|
+
error: zod.z.string().optional(),
|
|
470
|
+
duration_ms: zod.z.number().optional()
|
|
471
|
+
}),
|
|
472
|
+
BaseEvent.extend({
|
|
473
|
+
type: zod.z.literal("todo_updated"),
|
|
474
|
+
todo_list_id: zod.z.string(),
|
|
475
|
+
todo_list_version: zod.z.number().int().nonnegative(),
|
|
476
|
+
items: zod.z.array(AgentTodoItem)
|
|
477
|
+
}),
|
|
478
|
+
BaseEvent.extend({
|
|
479
|
+
type: zod.z.literal("subrun_trace"),
|
|
480
|
+
parent_tool_call_id: zod.z.string(),
|
|
481
|
+
subrun_id: zod.z.string(),
|
|
482
|
+
subrun_parent_id: zod.z.string().optional(),
|
|
483
|
+
kind: zod.z.enum([
|
|
484
|
+
"thought_delta",
|
|
485
|
+
"thought_complete",
|
|
486
|
+
"tool_call_decision",
|
|
487
|
+
"tool_process",
|
|
488
|
+
"tool_output",
|
|
489
|
+
"final_answer_chunk",
|
|
490
|
+
"final_answer"
|
|
491
|
+
]),
|
|
492
|
+
delta: zod.z.string().optional(),
|
|
493
|
+
content: zod.z.string().optional(),
|
|
494
|
+
tool_name: zod.z.string().optional(),
|
|
495
|
+
tool_call_id: zod.z.string().optional(),
|
|
496
|
+
phase: ToolCallPhase.optional(),
|
|
497
|
+
status: Status.optional(),
|
|
498
|
+
args: zod.z.unknown().optional(),
|
|
499
|
+
output: zod.z.unknown().optional(),
|
|
500
|
+
duration_ms: zod.z.number().optional(),
|
|
501
|
+
meta: zod.z.record(zod.z.unknown()).optional()
|
|
502
|
+
}),
|
|
503
|
+
BaseEvent.extend({
|
|
504
|
+
type: zod.z.literal("requires_user_interaction"),
|
|
505
|
+
form: zod.z.any().optional(),
|
|
506
|
+
interaction_type: zod.z.string().optional(),
|
|
507
|
+
prompt: zod.z.string().optional()
|
|
508
|
+
}),
|
|
509
|
+
BaseEvent.extend({
|
|
510
|
+
type: zod.z.literal("audit_envelope"),
|
|
511
|
+
envelope: AuditEnvelope
|
|
512
|
+
}),
|
|
513
|
+
BaseEvent.extend({
|
|
514
|
+
type: zod.z.literal("final_answer"),
|
|
515
|
+
answer_id: zod.z.string(),
|
|
516
|
+
content: zod.z.string(),
|
|
517
|
+
is_complete: zod.z.boolean().default(true),
|
|
518
|
+
reasoning_details: ProviderReasoningDetailsPayload.optional(),
|
|
519
|
+
meta: zod.z.record(zod.z.any()).optional()
|
|
520
|
+
}),
|
|
521
|
+
BaseEvent.extend({
|
|
522
|
+
type: zod.z.literal("final_answer_chunk"),
|
|
523
|
+
answer_id: zod.z.string(),
|
|
524
|
+
seq: zod.z.number().int().nonnegative(),
|
|
525
|
+
content: zod.z.string(),
|
|
526
|
+
is_last: zod.z.boolean().optional()
|
|
527
|
+
}),
|
|
528
|
+
BaseEvent.extend({
|
|
529
|
+
type: zod.z.literal("history_summary"),
|
|
530
|
+
content: zod.z.string(),
|
|
531
|
+
replaced_message_ids: zod.z.array(zod.z.string()),
|
|
532
|
+
summary_seq: zod.z.number().int().nonnegative(),
|
|
533
|
+
original_message_count: zod.z.number().int().nonnegative().optional(),
|
|
534
|
+
compression_ratio: zod.z.number().min(0).max(1).optional(),
|
|
535
|
+
included_old_summary: zod.z.boolean().optional()
|
|
536
|
+
}),
|
|
537
|
+
BaseEvent.extend({
|
|
538
|
+
type: zod.z.literal("error"),
|
|
539
|
+
error: zod.z.string(),
|
|
540
|
+
details: zod.z.any().optional(),
|
|
541
|
+
error_code: zod.z.string().optional(),
|
|
542
|
+
retryable: zod.z.boolean().optional()
|
|
543
|
+
}),
|
|
544
|
+
BaseEvent.extend({
|
|
545
|
+
type: zod.z.literal("control"),
|
|
546
|
+
op: zod.z.enum(["truncate_after", "replace", "redo", "branch"]),
|
|
547
|
+
target_id: zod.z.string().optional(),
|
|
548
|
+
reason: zod.z.string().optional(),
|
|
549
|
+
meta: zod.z.any().optional()
|
|
550
|
+
}),
|
|
551
|
+
BaseEvent.extend({
|
|
552
|
+
type: zod.z.literal("stream_end"),
|
|
553
|
+
reason: zod.z.enum(["complete", "error", "interrupted", "timeout"]).optional(),
|
|
554
|
+
reason_message: zod.z.string().optional(),
|
|
555
|
+
stats: zod.z.object({
|
|
556
|
+
total_events: zod.z.number().optional(),
|
|
557
|
+
duration_ms: zod.z.number().optional(),
|
|
558
|
+
error_count: zod.z.number().optional()
|
|
559
|
+
}).optional()
|
|
560
|
+
})
|
|
561
|
+
]);
|
|
562
|
+
var createThoughtEvent = (id, conversationId, turnId, content, options = {}) => ({
|
|
563
|
+
type: "thought",
|
|
564
|
+
id,
|
|
565
|
+
conversation_id: conversationId,
|
|
566
|
+
turn_id: turnId,
|
|
567
|
+
timestamp: Date.now(),
|
|
568
|
+
version: 1,
|
|
569
|
+
content,
|
|
570
|
+
is_complete: false,
|
|
571
|
+
...options
|
|
572
|
+
});
|
|
573
|
+
var createToolCallDecisionEvent = (id, conversationId, turnId, toolName, toolCallId, options = {}) => ({
|
|
574
|
+
type: "tool_call_decision",
|
|
575
|
+
id,
|
|
576
|
+
conversation_id: conversationId,
|
|
577
|
+
turn_id: turnId,
|
|
578
|
+
timestamp: Date.now(),
|
|
579
|
+
version: 1,
|
|
580
|
+
tool_name: toolName,
|
|
581
|
+
tool_call_id: toolCallId,
|
|
582
|
+
phase: "start",
|
|
583
|
+
status: "loading",
|
|
584
|
+
...options
|
|
585
|
+
});
|
|
586
|
+
var createToolProcessEvent = (id, conversationId, turnId, toolName, toolCallId, options = {}) => ({
|
|
587
|
+
type: "tool_process",
|
|
588
|
+
id,
|
|
589
|
+
conversation_id: conversationId,
|
|
590
|
+
turn_id: turnId,
|
|
591
|
+
timestamp: Date.now(),
|
|
592
|
+
version: 1,
|
|
593
|
+
tool_name: toolName,
|
|
594
|
+
tool_call_id: toolCallId,
|
|
595
|
+
phase: "start",
|
|
596
|
+
status: "loading",
|
|
597
|
+
...options
|
|
598
|
+
});
|
|
599
|
+
var createToolOutputEvent = (id, conversationId, turnId, toolName, toolCallId, output, status = "success", options = {}) => ({
|
|
600
|
+
type: "tool_output",
|
|
601
|
+
id,
|
|
602
|
+
conversation_id: conversationId,
|
|
603
|
+
turn_id: turnId,
|
|
604
|
+
timestamp: Date.now(),
|
|
605
|
+
version: 1,
|
|
606
|
+
tool_name: toolName,
|
|
607
|
+
tool_call_id: toolCallId,
|
|
608
|
+
status,
|
|
609
|
+
output,
|
|
610
|
+
...options
|
|
611
|
+
});
|
|
612
|
+
var createFinalAnswerEvent = (id, conversationId, turnId, answerId, content, options = {}) => ({
|
|
613
|
+
type: "final_answer",
|
|
614
|
+
id,
|
|
615
|
+
conversation_id: conversationId,
|
|
616
|
+
turn_id: turnId,
|
|
617
|
+
timestamp: Date.now(),
|
|
618
|
+
version: 1,
|
|
619
|
+
answer_id: answerId,
|
|
620
|
+
content,
|
|
621
|
+
is_complete: true,
|
|
622
|
+
...options
|
|
623
|
+
});
|
|
624
|
+
var createFinalAnswerChunkEvent = (id, conversationId, turnId, answerId, seq, content, options = {}) => ({
|
|
625
|
+
type: "final_answer_chunk",
|
|
626
|
+
id,
|
|
627
|
+
conversation_id: conversationId,
|
|
628
|
+
turn_id: turnId,
|
|
629
|
+
timestamp: Date.now(),
|
|
630
|
+
version: 1,
|
|
631
|
+
answer_id: answerId,
|
|
632
|
+
seq,
|
|
633
|
+
content,
|
|
634
|
+
...options
|
|
635
|
+
});
|
|
636
|
+
var createErrorEvent = (id, conversationId, turnId, error, options = {}) => ({
|
|
637
|
+
type: "error",
|
|
638
|
+
id,
|
|
639
|
+
conversation_id: conversationId,
|
|
640
|
+
turn_id: turnId,
|
|
641
|
+
timestamp: Date.now(),
|
|
642
|
+
version: 1,
|
|
643
|
+
error,
|
|
644
|
+
...options
|
|
645
|
+
});
|
|
646
|
+
var ExecutionTraceContext = zod.z.object({
|
|
647
|
+
execution_id: zod.z.string().describe("The unique identifier for a single, complete execution flow."),
|
|
648
|
+
trace_id: zod.z.string().optional().describe("An optional trace ID for correlating logs in an APM system.")
|
|
649
|
+
});
|
|
650
|
+
zod.z.object({
|
|
651
|
+
seq: zod.z.number().int().nonnegative().describe("A monotonically increasing sequence number within a single execution."),
|
|
652
|
+
timestamp: zod.z.number().describe("The high-precision timestamp of when the event occurred."),
|
|
653
|
+
trace: ExecutionTraceContext,
|
|
654
|
+
source: zod.z.string().describe("The origin of the event, e.g., 'ai', 'tool:file_reader', 'system:summary'."),
|
|
655
|
+
payload: zod.z.unknown(),
|
|
656
|
+
render_hint: zod.z.object({
|
|
657
|
+
card: zod.z.enum(["normal", "collapsible", "none", "image", "interactive"]).optional().describe("Hint for how the UI card should be rendered."),
|
|
658
|
+
content: zod.z.enum(["markdown", "text", "json", "image_url", "code"]).default("text").describe("Hint for how the content itself should be interpreted.")
|
|
659
|
+
}).optional(),
|
|
660
|
+
run_location: zod.z.enum(["frontend", "backend"]).optional().describe("Specifies where a tool action should be or was executed.")
|
|
661
|
+
});
|
|
662
|
+
var BaseSSEEvent = zod.z.object({
|
|
663
|
+
id: zod.z.string(),
|
|
664
|
+
timestamp: zod.z.number(),
|
|
665
|
+
conversation_id: zod.z.string(),
|
|
666
|
+
turn_id: zod.z.string(),
|
|
667
|
+
metadata: zod.z.record(zod.z.unknown()).optional()
|
|
668
|
+
});
|
|
669
|
+
var SSEThoughtEvent = BaseSSEEvent.extend({
|
|
670
|
+
type: zod.z.literal("thought"),
|
|
671
|
+
thought_message_id: zod.z.string().optional(),
|
|
672
|
+
delta: zod.z.string().optional(),
|
|
673
|
+
content: zod.z.string().optional(),
|
|
674
|
+
is_complete: zod.z.boolean().default(false)
|
|
675
|
+
});
|
|
676
|
+
var SSEFinalAnswerChunkEvent = BaseSSEEvent.extend({
|
|
677
|
+
type: zod.z.literal("final_answer_chunk"),
|
|
678
|
+
answer_id: zod.z.string(),
|
|
679
|
+
seq: zod.z.number().int().nonnegative(),
|
|
680
|
+
chunk: zod.z.string(),
|
|
681
|
+
is_last: zod.z.boolean().optional()
|
|
682
|
+
});
|
|
683
|
+
var SSEFinalAnswerEvent = BaseSSEEvent.extend({
|
|
684
|
+
type: zod.z.literal("final_answer"),
|
|
685
|
+
answer_id: zod.z.string(),
|
|
686
|
+
content: zod.z.string(),
|
|
687
|
+
meta: zod.z.record(zod.z.any()).optional()
|
|
688
|
+
});
|
|
689
|
+
var SSEMarkdownChunkEvent = BaseSSEEvent.extend({
|
|
690
|
+
type: zod.z.literal("markdown_chunk"),
|
|
691
|
+
content_type: zod.z.enum(["text", "code", "table", "image"]).default("text"),
|
|
692
|
+
text: zod.z.string(),
|
|
693
|
+
seq: zod.z.number().optional()
|
|
694
|
+
});
|
|
695
|
+
var BaseSSEToolLifecycleEvent = BaseSSEEvent.extend({
|
|
696
|
+
tool_name: zod.z.string(),
|
|
697
|
+
tool_call_id: zod.z.string(),
|
|
698
|
+
phase: zod.z.enum(["start", "update", "complete", "error"]),
|
|
699
|
+
status: zod.z.enum(["loading", "success", "error"]),
|
|
700
|
+
args: zod.z.any().optional(),
|
|
701
|
+
payload: zod.z.any().optional(),
|
|
702
|
+
meta: zod.z.record(zod.z.any()).optional()
|
|
703
|
+
});
|
|
704
|
+
var SSEToolCallDecisionEvent = BaseSSEToolLifecycleEvent.extend({
|
|
705
|
+
type: zod.z.literal("tool_call_decision")
|
|
706
|
+
});
|
|
707
|
+
var SSEToolProcessEvent = BaseSSEToolLifecycleEvent.extend({
|
|
708
|
+
type: zod.z.literal("tool_process")
|
|
709
|
+
});
|
|
710
|
+
var SSEToolOutputEvent = BaseSSEEvent.extend({
|
|
711
|
+
type: zod.z.literal("tool_output"),
|
|
712
|
+
tool_name: zod.z.string(),
|
|
713
|
+
tool_call_id: zod.z.string(),
|
|
714
|
+
status: zod.z.enum(["success", "error"]),
|
|
715
|
+
output: zod.z.any().optional(),
|
|
716
|
+
payload: zod.z.record(zod.z.any()).optional(),
|
|
717
|
+
duration_ms: zod.z.number().optional()
|
|
718
|
+
});
|
|
719
|
+
var SSETodoUpdatedEvent = BaseSSEEvent.extend({
|
|
720
|
+
type: zod.z.literal("todo_updated"),
|
|
721
|
+
todo_list_id: zod.z.string(),
|
|
722
|
+
todo_list_version: zod.z.number().int().nonnegative(),
|
|
723
|
+
items: zod.z.array(zod.z.object({
|
|
724
|
+
id: zod.z.string(),
|
|
725
|
+
content: zod.z.string(),
|
|
726
|
+
status: zod.z.enum(["pending", "in_progress", "completed", "cancelled"])
|
|
727
|
+
}))
|
|
728
|
+
});
|
|
729
|
+
var SSESubRunTraceEvent = BaseSSEEvent.extend({
|
|
730
|
+
type: zod.z.literal("subrun_trace"),
|
|
731
|
+
parent_tool_call_id: zod.z.string(),
|
|
732
|
+
subrun_id: zod.z.string(),
|
|
733
|
+
subrun_parent_id: zod.z.string().optional(),
|
|
734
|
+
kind: zod.z.enum([
|
|
735
|
+
"thought_delta",
|
|
736
|
+
"thought_complete",
|
|
737
|
+
"tool_call_decision",
|
|
738
|
+
"tool_process",
|
|
739
|
+
"tool_output",
|
|
740
|
+
"final_answer_chunk",
|
|
741
|
+
"final_answer"
|
|
742
|
+
]),
|
|
743
|
+
delta: zod.z.string().optional(),
|
|
744
|
+
content: zod.z.string().optional(),
|
|
745
|
+
tool_name: zod.z.string().optional(),
|
|
746
|
+
tool_call_id: zod.z.string().optional(),
|
|
747
|
+
phase: zod.z.enum(["start", "update", "complete", "error"]).optional(),
|
|
748
|
+
status: zod.z.enum(["loading", "success", "error"]).optional(),
|
|
749
|
+
args: zod.z.unknown().optional(),
|
|
750
|
+
output: zod.z.unknown().optional(),
|
|
751
|
+
duration_ms: zod.z.number().optional(),
|
|
752
|
+
meta: zod.z.record(zod.z.unknown()).optional()
|
|
753
|
+
});
|
|
754
|
+
var SSERequiresUserInteractionEvent = BaseSSEEvent.extend({
|
|
755
|
+
type: zod.z.literal("requires_user_interaction"),
|
|
756
|
+
form: zod.z.any().optional(),
|
|
757
|
+
interaction_type: zod.z.string().optional(),
|
|
758
|
+
prompt: zod.z.string().optional()
|
|
759
|
+
});
|
|
760
|
+
var SSEErrorEvent = BaseSSEEvent.extend({
|
|
761
|
+
type: zod.z.literal("error"),
|
|
762
|
+
error: zod.z.string(),
|
|
763
|
+
details: zod.z.any().optional(),
|
|
764
|
+
error_code: zod.z.string().optional(),
|
|
765
|
+
retryable: zod.z.boolean().optional()
|
|
766
|
+
});
|
|
767
|
+
var SSEStreamEndEvent = BaseSSEEvent.extend({
|
|
768
|
+
type: zod.z.literal("stream_end"),
|
|
769
|
+
reason: zod.z.enum(["complete", "error", "interrupted", "timeout"]).optional(),
|
|
770
|
+
reason_message: zod.z.string().optional(),
|
|
771
|
+
stats: zod.z.object({
|
|
772
|
+
total_events: zod.z.number().optional(),
|
|
773
|
+
duration_ms: zod.z.number().optional(),
|
|
774
|
+
error_count: zod.z.number().optional(),
|
|
775
|
+
benchmark: zod.z.record(zod.z.unknown()).optional()
|
|
776
|
+
}).optional()
|
|
777
|
+
});
|
|
778
|
+
var SSEHistorySummaryEvent = BaseSSEEvent.extend({
|
|
779
|
+
type: zod.z.literal("history_summary"),
|
|
780
|
+
summary_id: zod.z.string(),
|
|
781
|
+
content: zod.z.string(),
|
|
782
|
+
original_message_count: zod.z.number().int().nonnegative(),
|
|
783
|
+
summary_seq: zod.z.number().int().nonnegative()
|
|
784
|
+
});
|
|
785
|
+
var SSESummarizationStartEvent = BaseSSEEvent.extend({
|
|
786
|
+
type: zod.z.literal("summarization_start"),
|
|
787
|
+
originalMessages: zod.z.number().optional()
|
|
788
|
+
});
|
|
789
|
+
var SSESummarizationEndEvent = BaseSSEEvent.extend({
|
|
790
|
+
type: zod.z.literal("summarization_end"),
|
|
791
|
+
originalMessages: zod.z.number().optional(),
|
|
792
|
+
compressedMessages: zod.z.number().optional(),
|
|
793
|
+
compressionRatio: zod.z.string().optional(),
|
|
794
|
+
timeSaved: zod.z.string().optional()
|
|
795
|
+
});
|
|
796
|
+
var SSESummarizationErrorEvent = BaseSSEEvent.extend({
|
|
797
|
+
type: zod.z.literal("summarization_error"),
|
|
798
|
+
error: zod.z.string()
|
|
799
|
+
});
|
|
800
|
+
zod.z.discriminatedUnion("type", [
|
|
801
|
+
SSEThoughtEvent,
|
|
802
|
+
SSEFinalAnswerChunkEvent,
|
|
803
|
+
SSEFinalAnswerEvent,
|
|
804
|
+
SSEMarkdownChunkEvent,
|
|
805
|
+
SSEToolCallDecisionEvent,
|
|
806
|
+
SSEToolProcessEvent,
|
|
807
|
+
SSEToolOutputEvent,
|
|
808
|
+
SSETodoUpdatedEvent,
|
|
809
|
+
SSESubRunTraceEvent,
|
|
810
|
+
SSERequiresUserInteractionEvent,
|
|
811
|
+
SSEErrorEvent,
|
|
812
|
+
SSEStreamEndEvent,
|
|
813
|
+
SSEHistorySummaryEvent,
|
|
814
|
+
SSESummarizationStartEvent,
|
|
815
|
+
SSESummarizationEndEvent,
|
|
816
|
+
SSESummarizationErrorEvent
|
|
817
|
+
]);
|
|
818
|
+
var createSSEThoughtEvent = (id, conversationId, turnId, options = {}) => ({
|
|
819
|
+
type: "thought",
|
|
820
|
+
id,
|
|
821
|
+
timestamp: Date.now(),
|
|
822
|
+
conversation_id: conversationId,
|
|
823
|
+
turn_id: turnId,
|
|
824
|
+
is_complete: false,
|
|
825
|
+
...options
|
|
826
|
+
});
|
|
827
|
+
var createSSEFinalAnswerChunkEvent = (id, conversationId, turnId, answerId, seq, chunk, options = {}) => ({
|
|
828
|
+
type: "final_answer_chunk",
|
|
829
|
+
id,
|
|
830
|
+
timestamp: Date.now(),
|
|
831
|
+
conversation_id: conversationId,
|
|
832
|
+
turn_id: turnId,
|
|
833
|
+
answer_id: answerId,
|
|
834
|
+
seq,
|
|
835
|
+
chunk,
|
|
836
|
+
...options
|
|
837
|
+
});
|
|
838
|
+
var createSSEFinalAnswerEvent = (id, conversationId, turnId, answerId, content, options = {}) => ({
|
|
839
|
+
type: "final_answer",
|
|
840
|
+
id,
|
|
841
|
+
timestamp: Date.now(),
|
|
842
|
+
conversation_id: conversationId,
|
|
843
|
+
turn_id: turnId,
|
|
844
|
+
answer_id: answerId,
|
|
845
|
+
content,
|
|
846
|
+
...options
|
|
847
|
+
});
|
|
848
|
+
var createSSEToolCallDecisionEvent = (id, conversationId, turnId, toolName, toolCallId, phase, status, options = {}) => ({
|
|
849
|
+
type: "tool_call_decision",
|
|
850
|
+
id,
|
|
851
|
+
timestamp: Date.now(),
|
|
852
|
+
conversation_id: conversationId,
|
|
853
|
+
turn_id: turnId,
|
|
854
|
+
tool_name: toolName,
|
|
855
|
+
tool_call_id: toolCallId,
|
|
856
|
+
phase,
|
|
857
|
+
status,
|
|
858
|
+
...options
|
|
859
|
+
});
|
|
860
|
+
var createSSEToolProcessEvent = (id, conversationId, turnId, toolName, toolCallId, phase, status, options = {}) => ({
|
|
861
|
+
type: "tool_process",
|
|
862
|
+
id,
|
|
863
|
+
timestamp: Date.now(),
|
|
864
|
+
conversation_id: conversationId,
|
|
865
|
+
turn_id: turnId,
|
|
866
|
+
tool_name: toolName,
|
|
867
|
+
tool_call_id: toolCallId,
|
|
868
|
+
phase,
|
|
869
|
+
status,
|
|
870
|
+
...options
|
|
871
|
+
});
|
|
872
|
+
var createSSEToolOutputEvent = (id, conversationId, turnId, toolName, toolCallId, status, output, options = {}) => ({
|
|
873
|
+
type: "tool_output",
|
|
874
|
+
id,
|
|
875
|
+
timestamp: Date.now(),
|
|
876
|
+
conversation_id: conversationId,
|
|
877
|
+
turn_id: turnId,
|
|
878
|
+
tool_name: toolName,
|
|
879
|
+
tool_call_id: toolCallId,
|
|
880
|
+
status,
|
|
881
|
+
output,
|
|
882
|
+
...options
|
|
883
|
+
});
|
|
884
|
+
var createSSEErrorEvent = (id, conversationId, turnId, error, options = {}) => ({
|
|
885
|
+
type: "error",
|
|
886
|
+
id,
|
|
887
|
+
timestamp: Date.now(),
|
|
888
|
+
conversation_id: conversationId,
|
|
889
|
+
turn_id: turnId,
|
|
890
|
+
error,
|
|
891
|
+
...options
|
|
892
|
+
});
|
|
893
|
+
|
|
894
|
+
// src/shared/ids.ts
|
|
895
|
+
function isoRandomUUID() {
|
|
896
|
+
const c = globalThis.crypto;
|
|
897
|
+
if (c && typeof c.randomUUID === "function") {
|
|
898
|
+
return c.randomUUID();
|
|
899
|
+
}
|
|
900
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (ch) => {
|
|
901
|
+
const r = Math.random() * 16 | 0;
|
|
902
|
+
const v = ch === "x" ? r : r & 3 | 8;
|
|
903
|
+
return v.toString(16);
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
function shortRandomId(prefix) {
|
|
907
|
+
return `${prefix}-${isoRandomUUID().replace(/-/g, "").slice(0, 12)}`;
|
|
908
|
+
}
|
|
909
|
+
function generateMessageId() {
|
|
910
|
+
return shortRandomId("msg");
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
// src/runtime-kernel/events/provider-sidecar.ts
|
|
914
|
+
var isRecord2 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
915
|
+
var isToolCallWire = (value) => {
|
|
916
|
+
if (!isRecord2(value)) return false;
|
|
917
|
+
if (typeof value.id !== "string") return false;
|
|
918
|
+
if (value.type !== "function") return false;
|
|
919
|
+
const fn = value.function;
|
|
920
|
+
return isRecord2(fn) && typeof fn.name === "string" && typeof fn.arguments === "string";
|
|
921
|
+
};
|
|
922
|
+
function resolveToolDisplayOptions(toolName, toolPresentationPort) {
|
|
923
|
+
return toolPresentationPort?.getDisplayOptions(toolName);
|
|
924
|
+
}
|
|
925
|
+
function readAnswerIdFromEvent(event) {
|
|
926
|
+
if (!isRecord2(event)) return void 0;
|
|
927
|
+
const value = event["answerId"];
|
|
928
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
929
|
+
}
|
|
930
|
+
function readMetaFromEvent(event) {
|
|
931
|
+
if (!isRecord2(event)) return void 0;
|
|
932
|
+
const value = event["meta"];
|
|
933
|
+
return isRecord2(value) ? value : void 0;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
// src/runtime-kernel/events/agent-to-runtime.ts
|
|
937
|
+
function agentEventToRuntime(agentEvent, context, options = {}) {
|
|
938
|
+
if (!agentEvent || typeof agentEvent !== "object") return null;
|
|
939
|
+
if (isRecord2(agentEvent) && agentEvent["type"] === "history_summary") {
|
|
940
|
+
const evt = agentEvent;
|
|
941
|
+
if (context.metadata) {
|
|
942
|
+
evt.metadata = { ...evt.metadata ?? {}, ...context.metadata };
|
|
943
|
+
}
|
|
944
|
+
return evt;
|
|
945
|
+
}
|
|
946
|
+
const typed = agentEvent;
|
|
947
|
+
const { conversationId, turnId } = context;
|
|
948
|
+
const timestamp = typed.timestamp ?? context.timestamp ?? Date.now();
|
|
949
|
+
const id = typed.id ?? generateMessageId();
|
|
950
|
+
const contextMeta = context.metadata;
|
|
951
|
+
switch (typed.type) {
|
|
952
|
+
case "thought":
|
|
953
|
+
return mapThoughtToRuntime(typed, context, options, id, timestamp);
|
|
954
|
+
case "tool_call_decision":
|
|
955
|
+
case "tool_process":
|
|
956
|
+
return mapToolProgressToRuntime(typed, context, options, id, timestamp);
|
|
957
|
+
case "observation": {
|
|
958
|
+
const observationEvent = typed;
|
|
959
|
+
const toolName = observationEvent.tool_name || "unknown_tool";
|
|
960
|
+
const toolCallId = observationEvent.tool_call_id || `call_${id}`;
|
|
961
|
+
const success = observationEvent.success ?? !/^错误[::]/i.test(String(observationEvent.output ?? ""));
|
|
962
|
+
const payload = observationEvent.payload || {};
|
|
963
|
+
const event = createToolOutputEvent(
|
|
964
|
+
id,
|
|
965
|
+
conversationId,
|
|
966
|
+
turnId,
|
|
967
|
+
toolName,
|
|
968
|
+
toolCallId,
|
|
969
|
+
observationEvent.output,
|
|
970
|
+
success ? "success" : "error",
|
|
971
|
+
{ timestamp, payload, duration_ms: payload.duration_ms }
|
|
972
|
+
);
|
|
973
|
+
event.ephemeral = false;
|
|
974
|
+
if (contextMeta) event.metadata = { ...event.metadata ?? {}, ...contextMeta };
|
|
975
|
+
return event;
|
|
976
|
+
}
|
|
977
|
+
case "final_answer": {
|
|
978
|
+
const finalAnswerEvent = typed;
|
|
979
|
+
const answerIdFromSnake = typeof finalAnswerEvent.answer_id === "string" && finalAnswerEvent.answer_id.trim().length > 0 ? finalAnswerEvent.answer_id.trim() : void 0;
|
|
980
|
+
return createFinalAnswerEvent(
|
|
981
|
+
id,
|
|
982
|
+
conversationId,
|
|
983
|
+
turnId,
|
|
984
|
+
answerIdFromSnake ?? readAnswerIdFromEvent(finalAnswerEvent) ?? `answer_${turnId}`,
|
|
985
|
+
finalAnswerEvent.answer ?? "",
|
|
986
|
+
{
|
|
987
|
+
timestamp,
|
|
988
|
+
reasoning_details: Array.isArray(finalAnswerEvent.reasoning_details) ? finalAnswerEvent.reasoning_details : void 0,
|
|
989
|
+
meta: readMetaFromEvent(finalAnswerEvent)
|
|
990
|
+
}
|
|
991
|
+
);
|
|
992
|
+
}
|
|
993
|
+
case "error": {
|
|
994
|
+
const errorEvent = typed;
|
|
995
|
+
return createErrorEvent(id, conversationId, turnId, errorEvent.error ?? "Unknown error", {
|
|
996
|
+
timestamp,
|
|
997
|
+
details: errorEvent.details
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
case "stream_chunk":
|
|
1001
|
+
return mapStreamChunkToRuntime(typed, context, id, timestamp);
|
|
1002
|
+
default:
|
|
1003
|
+
return null;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
function mapThoughtToRuntime(thoughtEvent, context, options, id, timestamp) {
|
|
1007
|
+
const isComplete = "is_complete" in thoughtEvent ? Boolean(thoughtEvent.is_complete) : false;
|
|
1008
|
+
if (options.skipIncomplete && !isComplete) return null;
|
|
1009
|
+
const thoughtMessageId = typeof thoughtEvent.thought_message_id === "string" && thoughtEvent.thought_message_id.length > 0 ? thoughtEvent.thought_message_id : void 0;
|
|
1010
|
+
const runtimeEvent = createThoughtEvent(id, context.conversationId, context.turnId, thoughtEvent.content ?? "", {
|
|
1011
|
+
timestamp,
|
|
1012
|
+
thought_message_id: thoughtMessageId,
|
|
1013
|
+
delta: thoughtEvent.delta,
|
|
1014
|
+
is_complete: isComplete
|
|
1015
|
+
});
|
|
1016
|
+
if (!isComplete) runtimeEvent.ephemeral = true;
|
|
1017
|
+
const thoughtMeta = isRecord2(thoughtEvent.meta) ? thoughtEvent.meta : void 0;
|
|
1018
|
+
if (context.metadata || thoughtMeta) {
|
|
1019
|
+
runtimeEvent.metadata = { ...runtimeEvent.metadata ?? {}, ...context.metadata ?? {}, ...thoughtMeta ?? {} };
|
|
1020
|
+
}
|
|
1021
|
+
return runtimeEvent;
|
|
1022
|
+
}
|
|
1023
|
+
function mapToolProgressToRuntime(toolEvent, context, options, id, timestamp) {
|
|
1024
|
+
const toolName = toolEvent.tool_name || "unknown_tool";
|
|
1025
|
+
const toolCallId = toolEvent.tool_call_id || `call_${id}`;
|
|
1026
|
+
const meta = toolEvent.meta && typeof toolEvent.meta === "object" ? { ...toolEvent.meta } : {};
|
|
1027
|
+
const displayOptions = resolveToolDisplayOptions(toolName, options.toolPresentationPort);
|
|
1028
|
+
if (displayOptions && !meta.displayOptions) meta.displayOptions = displayOptions;
|
|
1029
|
+
const event = toolEvent.type === "tool_call_decision" ? createToolCallDecisionEvent(id, context.conversationId, context.turnId, toolName, toolCallId, {
|
|
1030
|
+
timestamp,
|
|
1031
|
+
phase: toolEvent.phase ?? "start",
|
|
1032
|
+
status: toolEvent.status ?? "loading",
|
|
1033
|
+
args: toolEvent.tool_args || {},
|
|
1034
|
+
payload: toolEvent.payload || {},
|
|
1035
|
+
meta
|
|
1036
|
+
}) : createToolProcessEvent(id, context.conversationId, context.turnId, toolName, toolCallId, {
|
|
1037
|
+
timestamp,
|
|
1038
|
+
phase: toolEvent.phase ?? "start",
|
|
1039
|
+
status: toolEvent.status ?? "loading",
|
|
1040
|
+
args: toolEvent.tool_args || {},
|
|
1041
|
+
payload: toolEvent.payload || {},
|
|
1042
|
+
meta
|
|
1043
|
+
});
|
|
1044
|
+
event.ephemeral = meta.ephemeral === true;
|
|
1045
|
+
if (context.metadata) event.metadata = { ...event.metadata ?? {}, ...context.metadata };
|
|
1046
|
+
return event;
|
|
1047
|
+
}
|
|
1048
|
+
function mapStreamChunkToRuntime(streamEvent, context, id, timestamp) {
|
|
1049
|
+
const text = streamEvent.content ?? "";
|
|
1050
|
+
if (!text) return null;
|
|
1051
|
+
const answerId = readAgentEventAnswerId(streamEvent) ?? `answer_${context.turnId}`;
|
|
1052
|
+
const seq = readAgentEventSeq(streamEvent) ?? 0;
|
|
1053
|
+
const isLast = Boolean(
|
|
1054
|
+
"isLast" in streamEvent && streamEvent.isLast || "is_last" in streamEvent && streamEvent.is_last
|
|
1055
|
+
);
|
|
1056
|
+
const chunkEvent = createFinalAnswerChunkEvent(id, context.conversationId, context.turnId, answerId, seq, text, {
|
|
1057
|
+
timestamp,
|
|
1058
|
+
is_last: isLast
|
|
1059
|
+
});
|
|
1060
|
+
chunkEvent.ephemeral = true;
|
|
1061
|
+
if (context.metadata) chunkEvent.metadata = { ...chunkEvent.metadata ?? {}, ...context.metadata };
|
|
1062
|
+
return chunkEvent;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
// src/runtime-kernel/events/runtime-to-ai-message.ts
|
|
1066
|
+
function applyRuntimeEventToMemory(event, memory) {
|
|
1067
|
+
if (!event || !memory) return;
|
|
1068
|
+
switch (event.type) {
|
|
1069
|
+
case "user_input": {
|
|
1070
|
+
const userEvent = event;
|
|
1071
|
+
memory.addUserMessage(userEvent.content || "", userEvent.id);
|
|
1072
|
+
break;
|
|
1073
|
+
}
|
|
1074
|
+
case "tool_call_decision":
|
|
1075
|
+
applyToolCallDecision(event, memory);
|
|
1076
|
+
break;
|
|
1077
|
+
case "tool_output":
|
|
1078
|
+
applyToolOutput(event, memory);
|
|
1079
|
+
break;
|
|
1080
|
+
case "final_answer": {
|
|
1081
|
+
const answerEvent = event;
|
|
1082
|
+
const answerContent = answerEvent.content || "";
|
|
1083
|
+
if (answerContent.trim()) {
|
|
1084
|
+
const metadata = Array.isArray(answerEvent.reasoning_details) ? { reasoning_details: answerEvent.reasoning_details } : void 0;
|
|
1085
|
+
memory.addAssistantMessage(answerContent, "final_answer", metadata, answerEvent.id);
|
|
1086
|
+
}
|
|
1087
|
+
break;
|
|
1088
|
+
}
|
|
1089
|
+
case "thought": {
|
|
1090
|
+
const thoughtEvent = event;
|
|
1091
|
+
memory.addAssistantMessage(thoughtEvent.content || "", "thought", void 0, thoughtEvent.id);
|
|
1092
|
+
break;
|
|
1093
|
+
}
|
|
1094
|
+
case "history_summary":
|
|
1095
|
+
applyHistorySummary(event, memory);
|
|
1096
|
+
break;
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
function applyToolCallDecision(event, memory) {
|
|
1100
|
+
const payload = event.payload || {};
|
|
1101
|
+
const toolCalls = Array.isArray(payload.tool_calls) ? payload.tool_calls.filter(isToolCallWire) : [];
|
|
1102
|
+
const toolArgs = event.args || payload.args || {};
|
|
1103
|
+
const toolCallId = event.tool_call_id || (toolCalls.length > 0 ? toolCalls[0].id : `call_${event.id || Date.now()}`);
|
|
1104
|
+
const normalizedToolCalls = toolCalls.length > 0 ? toolCalls : [
|
|
1105
|
+
{
|
|
1106
|
+
id: toolCallId,
|
|
1107
|
+
type: "function",
|
|
1108
|
+
function: { name: event.tool_name, arguments: JSON.stringify(toolArgs || {}) }
|
|
1109
|
+
}
|
|
1110
|
+
];
|
|
1111
|
+
const reasoningDetails = Array.isArray(payload.reasoning_details) ? payload.reasoning_details : void 0;
|
|
1112
|
+
memory.addAssistantMessage(
|
|
1113
|
+
null,
|
|
1114
|
+
"tool_calls",
|
|
1115
|
+
{
|
|
1116
|
+
tool_calls: normalizedToolCalls,
|
|
1117
|
+
...reasoningDetails ? { reasoning_details: reasoningDetails } : {}
|
|
1118
|
+
},
|
|
1119
|
+
event.id
|
|
1120
|
+
);
|
|
1121
|
+
}
|
|
1122
|
+
function applyToolOutput(event, memory) {
|
|
1123
|
+
if (!event.tool_call_id) return;
|
|
1124
|
+
const payload = event.payload || {};
|
|
1125
|
+
const outputValue = payload.result ?? payload.output ?? event.output;
|
|
1126
|
+
let serializedOutput;
|
|
1127
|
+
if (typeof outputValue === "string") {
|
|
1128
|
+
serializedOutput = outputValue;
|
|
1129
|
+
} else {
|
|
1130
|
+
try {
|
|
1131
|
+
serializedOutput = JSON.stringify(outputValue ?? "");
|
|
1132
|
+
} catch {
|
|
1133
|
+
serializedOutput = String(outputValue ?? "");
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
memory.addToolResponse(String(event.tool_call_id), serializedOutput, event.tool_name, event.id);
|
|
1137
|
+
}
|
|
1138
|
+
function applyHistorySummary(summaryEvent, memory) {
|
|
1139
|
+
const summaryMetadata = {
|
|
1140
|
+
messageType: "summary",
|
|
1141
|
+
generatedBy: summaryEvent.generated_by || "AgentSummarizationProvider",
|
|
1142
|
+
originalMessageCount: summaryEvent.original_message_count,
|
|
1143
|
+
compressionRatio: summaryEvent.compression_ratio,
|
|
1144
|
+
includedOldSummary: summaryEvent.included_old_summary,
|
|
1145
|
+
replacesStartMessageId: summaryEvent.replaces_start_message_id,
|
|
1146
|
+
replacesEndMessageId: summaryEvent.replaces_end_message_id,
|
|
1147
|
+
replacedMessageIds: Array.isArray(summaryEvent.replaced_message_ids) ? summaryEvent.replaced_message_ids : [],
|
|
1148
|
+
summarySeq: summaryEvent.summary_seq || 0
|
|
1149
|
+
};
|
|
1150
|
+
const summaryMessage = {
|
|
1151
|
+
id: summaryEvent.id,
|
|
1152
|
+
role: "system",
|
|
1153
|
+
type: "history_summary",
|
|
1154
|
+
content: summaryEvent.content || "",
|
|
1155
|
+
timestamp: summaryEvent.timestamp,
|
|
1156
|
+
metadata: summaryMetadata
|
|
1157
|
+
};
|
|
1158
|
+
memory.appendMessage(summaryMessage);
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
// src/runtime-kernel/events/sse-projection.ts
|
|
1162
|
+
function agentEventToSSE(agentEvent, context, options = {}) {
|
|
1163
|
+
if (!agentEvent || typeof agentEvent !== "object") return null;
|
|
1164
|
+
if (options.skipAlreadyDispatched && isMarkedAsSseDispatched(agentEvent)) return null;
|
|
1165
|
+
const { conversationId, turnId } = context;
|
|
1166
|
+
const timestamp = agentEvent.timestamp ?? context.timestamp ?? Date.now();
|
|
1167
|
+
const id = agentEvent.id ?? generateMessageId();
|
|
1168
|
+
const contextMeta = context.metadata;
|
|
1169
|
+
switch (agentEvent.type) {
|
|
1170
|
+
case "thought": {
|
|
1171
|
+
const thoughtEvent = agentEvent;
|
|
1172
|
+
const rawContent = "content" in thoughtEvent ? thoughtEvent.content : "";
|
|
1173
|
+
const delta = "delta" in thoughtEvent ? thoughtEvent.delta : "";
|
|
1174
|
+
const isComplete = "is_complete" in thoughtEvent ? Boolean(thoughtEvent.is_complete) : false;
|
|
1175
|
+
const thoughtMessageId = typeof thoughtEvent.thought_message_id === "string" && thoughtEvent.thought_message_id.length > 0 ? thoughtEvent.thought_message_id : void 0;
|
|
1176
|
+
const sse = createSSEThoughtEvent(id, conversationId, turnId, {
|
|
1177
|
+
thought_message_id: thoughtMessageId,
|
|
1178
|
+
content: isComplete ? rawContent ?? "" : void 0,
|
|
1179
|
+
delta: !isComplete ? delta ?? rawContent : void 0,
|
|
1180
|
+
is_complete: isComplete
|
|
1181
|
+
});
|
|
1182
|
+
sse.timestamp = timestamp;
|
|
1183
|
+
const thoughtMeta = isRecord2(thoughtEvent.meta) ? thoughtEvent.meta : void 0;
|
|
1184
|
+
if (contextMeta || thoughtMeta) {
|
|
1185
|
+
sse.metadata = { ...contextMeta ?? {}, ...thoughtMeta ?? {} };
|
|
1186
|
+
}
|
|
1187
|
+
return sse;
|
|
1188
|
+
}
|
|
1189
|
+
case "tool_call_decision":
|
|
1190
|
+
case "tool_process":
|
|
1191
|
+
return mapToolProgressToSse(agentEvent, context, options, id, timestamp);
|
|
1192
|
+
case "observation": {
|
|
1193
|
+
const observationEvent = agentEvent;
|
|
1194
|
+
const toolName = observationEvent.tool_name || "unknown_tool";
|
|
1195
|
+
const toolCallId = observationEvent.tool_call_id || `call_${id}`;
|
|
1196
|
+
const status = observationEvent.success === false ? "error" : "success";
|
|
1197
|
+
const payload = observationEvent.payload || {};
|
|
1198
|
+
const duration = payload.duration_ms;
|
|
1199
|
+
const sse = createSSEToolOutputEvent(
|
|
1200
|
+
id,
|
|
1201
|
+
conversationId,
|
|
1202
|
+
turnId,
|
|
1203
|
+
toolName,
|
|
1204
|
+
toolCallId,
|
|
1205
|
+
status,
|
|
1206
|
+
observationEvent.output,
|
|
1207
|
+
{ timestamp, payload, duration_ms: duration }
|
|
1208
|
+
);
|
|
1209
|
+
sse.timestamp = timestamp;
|
|
1210
|
+
if (contextMeta) sse.metadata = contextMeta;
|
|
1211
|
+
return sse;
|
|
1212
|
+
}
|
|
1213
|
+
case "stream_chunk": {
|
|
1214
|
+
const streamEvent = agentEvent;
|
|
1215
|
+
const text = streamEvent.content ?? "";
|
|
1216
|
+
if (!text) return null;
|
|
1217
|
+
const answerId = readAgentEventAnswerId(streamEvent) ?? `answer_${turnId}`;
|
|
1218
|
+
const seq = readAgentEventSeq(streamEvent) ?? 0;
|
|
1219
|
+
const isLast = Boolean(
|
|
1220
|
+
"isLast" in streamEvent && streamEvent.isLast || "is_last" in streamEvent && streamEvent.is_last
|
|
1221
|
+
);
|
|
1222
|
+
const sse = createSSEFinalAnswerChunkEvent(id, conversationId, turnId, answerId, seq, text, {
|
|
1223
|
+
is_last: isLast
|
|
1224
|
+
});
|
|
1225
|
+
sse.timestamp = timestamp;
|
|
1226
|
+
if (contextMeta) sse.metadata = contextMeta;
|
|
1227
|
+
return sse;
|
|
1228
|
+
}
|
|
1229
|
+
case "final_answer": {
|
|
1230
|
+
const finalAnswerEvent = agentEvent;
|
|
1231
|
+
const answer = finalAnswerEvent.answer ?? "";
|
|
1232
|
+
const answerIdFromSnake = typeof finalAnswerEvent.answer_id === "string" && finalAnswerEvent.answer_id.trim().length > 0 ? finalAnswerEvent.answer_id.trim() : void 0;
|
|
1233
|
+
const answerId = answerIdFromSnake ?? readAnswerIdFromEvent(finalAnswerEvent) ?? `answer_${turnId}`;
|
|
1234
|
+
const sse = createSSEFinalAnswerEvent(id, conversationId, turnId, answerId, answer, {
|
|
1235
|
+
meta: readMetaFromEvent(finalAnswerEvent)
|
|
1236
|
+
});
|
|
1237
|
+
sse.timestamp = timestamp;
|
|
1238
|
+
if (contextMeta) sse.metadata = contextMeta;
|
|
1239
|
+
return sse;
|
|
1240
|
+
}
|
|
1241
|
+
case "error": {
|
|
1242
|
+
const errorEvent = agentEvent;
|
|
1243
|
+
const sse = createSSEErrorEvent(id, conversationId, turnId, errorEvent.error ?? "Unknown error", {
|
|
1244
|
+
details: errorEvent.details
|
|
1245
|
+
});
|
|
1246
|
+
sse.timestamp = timestamp;
|
|
1247
|
+
if (contextMeta) sse.metadata = contextMeta;
|
|
1248
|
+
return sse;
|
|
1249
|
+
}
|
|
1250
|
+
default:
|
|
1251
|
+
return null;
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
function mapToolProgressToSse(agentEvent, context, options, id, timestamp) {
|
|
1255
|
+
const toolName = agentEvent.tool_name || "unknown_tool";
|
|
1256
|
+
const toolCallId = agentEvent.tool_call_id || `call_${id}`;
|
|
1257
|
+
const phase = agentEvent.phase ?? "start";
|
|
1258
|
+
const status = agentEvent.status ?? "loading";
|
|
1259
|
+
const args = agentEvent.tool_args || {};
|
|
1260
|
+
const payload = agentEvent.payload || {};
|
|
1261
|
+
const meta = agentEvent.meta && typeof agentEvent.meta === "object" ? { ...agentEvent.meta } : {};
|
|
1262
|
+
const displayOptions = resolveToolDisplayOptions(toolName, options.toolPresentationPort);
|
|
1263
|
+
if (displayOptions && !meta.displayOptions) meta.displayOptions = displayOptions;
|
|
1264
|
+
const sse = agentEvent.type === "tool_call_decision" ? createSSEToolCallDecisionEvent(id, context.conversationId, context.turnId, toolName, toolCallId, phase, status, {
|
|
1265
|
+
timestamp,
|
|
1266
|
+
args,
|
|
1267
|
+
payload,
|
|
1268
|
+
meta
|
|
1269
|
+
}) : createSSEToolProcessEvent(id, context.conversationId, context.turnId, toolName, toolCallId, phase, status, {
|
|
1270
|
+
timestamp,
|
|
1271
|
+
args,
|
|
1272
|
+
payload,
|
|
1273
|
+
meta
|
|
1274
|
+
});
|
|
1275
|
+
sse.timestamp = timestamp;
|
|
1276
|
+
if (context.metadata) sse.metadata = context.metadata;
|
|
1277
|
+
return sse;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
// src/runtime-kernel/events/eventMappers.ts
|
|
1281
|
+
var eventMapper = {
|
|
1282
|
+
/**
|
|
1283
|
+
* 将 AgentEvent 转换为 SSEEvent。
|
|
1284
|
+
*/
|
|
1285
|
+
agentToSse: agentEventToSSE,
|
|
1286
|
+
/**
|
|
1287
|
+
* 将 AgentEvent 转换为 RuntimeEvent。
|
|
1288
|
+
*/
|
|
1289
|
+
agentToRuntime: agentEventToRuntime,
|
|
1290
|
+
/**
|
|
1291
|
+
* 将 RuntimeEvent 应用到 ConversationMemoryPort。
|
|
1292
|
+
*/
|
|
1293
|
+
applyToMemory: applyRuntimeEventToMemory,
|
|
1294
|
+
/**
|
|
1295
|
+
* 批量处理 AgentEvent → SSEEvent + RuntimeEvent。
|
|
1296
|
+
*/
|
|
1297
|
+
agentToBoth: (agentEvent, context, options = {}) => {
|
|
1298
|
+
const sseEvent = agentEventToSSE(agentEvent, context, options.sseOptions);
|
|
1299
|
+
const runtimeEvent = agentEventToRuntime(agentEvent, context, options.runtimeOptions);
|
|
1300
|
+
return { sseEvent, runtimeEvent };
|
|
1301
|
+
},
|
|
1302
|
+
/**
|
|
1303
|
+
* 批量重建内存。
|
|
1304
|
+
*/
|
|
1305
|
+
rebuildMemory: (events, memory) => {
|
|
1306
|
+
for (const event of events) {
|
|
1307
|
+
applyRuntimeEventToMemory(event, memory);
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
};
|
|
1311
|
+
|
|
1312
|
+
// src/runtime-kernel/events/eventGovernance.ts
|
|
1313
|
+
function isRecord3(value) {
|
|
1314
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
1315
|
+
}
|
|
1316
|
+
function isToolCallDecisionEvent(event) {
|
|
1317
|
+
return event.type === "tool_call_decision";
|
|
1318
|
+
}
|
|
1319
|
+
function isToolProcessEvent(event) {
|
|
1320
|
+
return event.type === "tool_process";
|
|
1321
|
+
}
|
|
1322
|
+
function isTodoUpdatedRuntimeEvent(event) {
|
|
1323
|
+
return event.type === "todo_updated";
|
|
1324
|
+
}
|
|
1325
|
+
function isSubRunTraceRuntimeEvent(event) {
|
|
1326
|
+
return event.type === "subrun_trace";
|
|
1327
|
+
}
|
|
1328
|
+
function isStreamEndRuntimeEvent(event) {
|
|
1329
|
+
return event.type === "stream_end";
|
|
1330
|
+
}
|
|
1331
|
+
function isRequiresUserInteractionRuntimeEvent(event) {
|
|
1332
|
+
return event.type === "requires_user_interaction";
|
|
1333
|
+
}
|
|
1334
|
+
function isAuditEnvelopeRuntimeEvent(event) {
|
|
1335
|
+
return event.type === "audit_envelope";
|
|
1336
|
+
}
|
|
1337
|
+
function isControlRuntimeEvent(event) {
|
|
1338
|
+
return event.type === "control";
|
|
1339
|
+
}
|
|
1340
|
+
function isHiddenUserInputEvent(event) {
|
|
1341
|
+
if (event.type !== "user_input") {
|
|
1342
|
+
return false;
|
|
1343
|
+
}
|
|
1344
|
+
const metadata = isRecord3(event.metadata) ? event.metadata : void 0;
|
|
1345
|
+
const ui = metadata && isRecord3(metadata.ui) ? metadata.ui : void 0;
|
|
1346
|
+
return ui?.presentation === "hidden";
|
|
1347
|
+
}
|
|
1348
|
+
function isEmptyTerminalAssistantRuntimeEvent(event) {
|
|
1349
|
+
if (event.type !== "thought" && event.type !== "final_answer") {
|
|
1350
|
+
return false;
|
|
1351
|
+
}
|
|
1352
|
+
return event.content.trim().length === 0;
|
|
1353
|
+
}
|
|
1354
|
+
function shouldPersistRuntimeEvent(event) {
|
|
1355
|
+
return describeRuntimeEventLifecycle(event).persist;
|
|
1356
|
+
}
|
|
1357
|
+
function shouldReplayRuntimeEventToUi(event) {
|
|
1358
|
+
return describeRuntimeEventLifecycle(event).replayToUi;
|
|
1359
|
+
}
|
|
1360
|
+
function shouldEnterAgentContext(event) {
|
|
1361
|
+
return describeRuntimeEventLifecycle(event).enterAgentContext;
|
|
1362
|
+
}
|
|
1363
|
+
function isCheckpointHistorySummaryEvent(event) {
|
|
1364
|
+
if (event.type !== "history_summary") {
|
|
1365
|
+
return false;
|
|
1366
|
+
}
|
|
1367
|
+
const metadata = isRecord3(event.metadata) ? event.metadata : void 0;
|
|
1368
|
+
return metadata?.summary_kind === "checkpoint";
|
|
1369
|
+
}
|
|
1370
|
+
function getRuntimeEventUiProjectionKind(event) {
|
|
1371
|
+
if (isHiddenUserInputEvent(event)) {
|
|
1372
|
+
return "hidden";
|
|
1373
|
+
}
|
|
1374
|
+
switch (event.type) {
|
|
1375
|
+
case "user_input":
|
|
1376
|
+
return "user_input";
|
|
1377
|
+
case "thought":
|
|
1378
|
+
return "thought";
|
|
1379
|
+
case "final_answer":
|
|
1380
|
+
return "final_answer";
|
|
1381
|
+
case "final_answer_chunk":
|
|
1382
|
+
return "final_answer_chunk";
|
|
1383
|
+
case "tool_call_decision":
|
|
1384
|
+
return "tool_call_decision";
|
|
1385
|
+
case "tool_process":
|
|
1386
|
+
return "tool_process";
|
|
1387
|
+
case "tool_output":
|
|
1388
|
+
return "tool_output";
|
|
1389
|
+
case "requires_user_interaction":
|
|
1390
|
+
return "requires_user_interaction";
|
|
1391
|
+
case "audit_envelope":
|
|
1392
|
+
return "audit_envelope";
|
|
1393
|
+
case "todo_updated":
|
|
1394
|
+
return "todo_updated";
|
|
1395
|
+
case "subrun_trace":
|
|
1396
|
+
return "subrun_trace";
|
|
1397
|
+
case "error":
|
|
1398
|
+
return "error";
|
|
1399
|
+
case "stream_end":
|
|
1400
|
+
return "stream_end";
|
|
1401
|
+
case "history_summary":
|
|
1402
|
+
return isCheckpointHistorySummaryEvent(event) ? "checkpoint_history_summary" : "history_summary";
|
|
1403
|
+
default:
|
|
1404
|
+
return "unsupported";
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
function describeRuntimeEventLifecycle(event) {
|
|
1408
|
+
const uiProjectionKind = getRuntimeEventUiProjectionKind(event);
|
|
1409
|
+
const persist = event.ephemeral !== true && !isToolProcessEvent(event);
|
|
1410
|
+
const replayToUi = uiProjectionKind !== "hidden" && uiProjectionKind !== "audit_envelope" && uiProjectionKind !== "final_answer_chunk" && uiProjectionKind !== "unsupported";
|
|
1411
|
+
const enterAgentContext = (() => {
|
|
1412
|
+
if (isTodoUpdatedRuntimeEvent(event)) {
|
|
1413
|
+
return false;
|
|
1414
|
+
}
|
|
1415
|
+
if (isSubRunTraceRuntimeEvent(event)) {
|
|
1416
|
+
return false;
|
|
1417
|
+
}
|
|
1418
|
+
if (isStreamEndRuntimeEvent(event)) {
|
|
1419
|
+
return false;
|
|
1420
|
+
}
|
|
1421
|
+
if (isRequiresUserInteractionRuntimeEvent(event)) {
|
|
1422
|
+
return false;
|
|
1423
|
+
}
|
|
1424
|
+
if (isAuditEnvelopeRuntimeEvent(event)) {
|
|
1425
|
+
return false;
|
|
1426
|
+
}
|
|
1427
|
+
if (isControlRuntimeEvent(event)) {
|
|
1428
|
+
return false;
|
|
1429
|
+
}
|
|
1430
|
+
if (isHiddenUserInputEvent(event)) {
|
|
1431
|
+
return false;
|
|
1432
|
+
}
|
|
1433
|
+
if (isToolProcessEvent(event)) {
|
|
1434
|
+
return false;
|
|
1435
|
+
}
|
|
1436
|
+
if (event.type === "final_answer_chunk") {
|
|
1437
|
+
return false;
|
|
1438
|
+
}
|
|
1439
|
+
if (isEmptyTerminalAssistantRuntimeEvent(event)) {
|
|
1440
|
+
return false;
|
|
1441
|
+
}
|
|
1442
|
+
return true;
|
|
1443
|
+
})();
|
|
1444
|
+
const realtimeChannel = (() => {
|
|
1445
|
+
switch (uiProjectionKind) {
|
|
1446
|
+
case "thought":
|
|
1447
|
+
case "final_answer":
|
|
1448
|
+
case "final_answer_chunk":
|
|
1449
|
+
case "tool_call_decision":
|
|
1450
|
+
case "tool_process":
|
|
1451
|
+
case "tool_output":
|
|
1452
|
+
case "requires_user_interaction":
|
|
1453
|
+
case "todo_updated":
|
|
1454
|
+
case "subrun_trace":
|
|
1455
|
+
case "error":
|
|
1456
|
+
return "event_bus_sse";
|
|
1457
|
+
case "audit_envelope":
|
|
1458
|
+
return "none";
|
|
1459
|
+
default:
|
|
1460
|
+
return "none";
|
|
1461
|
+
}
|
|
1462
|
+
})();
|
|
1463
|
+
return {
|
|
1464
|
+
uiProjectionKind,
|
|
1465
|
+
persist,
|
|
1466
|
+
replayToUi,
|
|
1467
|
+
enterAgentContext,
|
|
1468
|
+
realtimeChannel
|
|
1469
|
+
};
|
|
1470
|
+
}
|
|
1471
|
+
function shouldEmitRuntimeEventToSse(event) {
|
|
1472
|
+
return describeRuntimeEventLifecycle(event).realtimeChannel === "event_bus_sse";
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
exports.describeRuntimeEventLifecycle = describeRuntimeEventLifecycle;
|
|
1476
|
+
exports.eventMapper = eventMapper;
|
|
1477
|
+
exports.getRuntimeEventUiProjectionKind = getRuntimeEventUiProjectionKind;
|
|
1478
|
+
exports.isCheckpointHistorySummaryEvent = isCheckpointHistorySummaryEvent;
|
|
1479
|
+
exports.isToolCallDecisionEvent = isToolCallDecisionEvent;
|
|
1480
|
+
exports.shouldEmitRuntimeEventToSse = shouldEmitRuntimeEventToSse;
|
|
1481
|
+
exports.shouldEnterAgentContext = shouldEnterAgentContext;
|
|
1482
|
+
exports.shouldPersistRuntimeEvent = shouldPersistRuntimeEvent;
|
|
1483
|
+
exports.shouldReplayRuntimeEventToUi = shouldReplayRuntimeEventToUi;
|
|
1484
|
+
//# sourceMappingURL=events.cjs.map
|
|
1485
|
+
//# sourceMappingURL=events.cjs.map
|