@copilotkit/shared 1.72.1-canary.sp-longthread-perf → 1.73.1
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 +22 -0
- package/dist/attachments/content.cjs +17 -0
- package/dist/attachments/content.cjs.map +1 -0
- package/dist/attachments/content.d.cts +9 -0
- package/dist/attachments/content.d.cts.map +1 -0
- package/dist/attachments/content.d.mts +9 -0
- package/dist/attachments/content.d.mts.map +1 -0
- package/dist/attachments/content.mjs +16 -0
- package/dist/attachments/content.mjs.map +1 -0
- package/dist/event-transforms/index.cjs +15 -0
- package/dist/event-transforms/index.d.cts +4 -0
- package/dist/event-transforms/index.d.mts +4 -0
- package/dist/event-transforms/index.mjs +5 -0
- package/dist/event-transforms/open-generative-ui-middleware.cjs +286 -0
- package/dist/event-transforms/open-generative-ui-middleware.cjs.map +1 -0
- package/dist/event-transforms/open-generative-ui-middleware.d.cts +60 -0
- package/dist/event-transforms/open-generative-ui-middleware.d.cts.map +1 -0
- package/dist/event-transforms/open-generative-ui-middleware.d.mts +60 -0
- package/dist/event-transforms/open-generative-ui-middleware.d.mts.map +1 -0
- package/dist/event-transforms/open-generative-ui-middleware.mjs +283 -0
- package/dist/event-transforms/open-generative-ui-middleware.mjs.map +1 -0
- package/dist/event-transforms/recorded-events.cjs +59 -0
- package/dist/event-transforms/recorded-events.cjs.map +1 -0
- package/dist/event-transforms/recorded-events.d.cts +23 -0
- package/dist/event-transforms/recorded-events.d.cts.map +1 -0
- package/dist/event-transforms/recorded-events.d.mts +23 -0
- package/dist/event-transforms/recorded-events.d.mts.map +1 -0
- package/dist/event-transforms/recorded-events.mjs +58 -0
- package/dist/event-transforms/recorded-events.mjs.map +1 -0
- package/dist/finalize-events.cjs +92 -71
- package/dist/finalize-events.cjs.map +1 -1
- package/dist/finalize-events.d.cts +20 -1
- package/dist/finalize-events.d.cts.map +1 -1
- package/dist/finalize-events.d.mts +20 -1
- package/dist/finalize-events.d.mts.map +1 -1
- package/dist/finalize-events.mjs +92 -72
- package/dist/finalize-events.mjs.map +1 -1
- package/dist/index.cjs +9 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +4 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +4 -2
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +316 -71
- package/dist/index.umd.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/types/message.d.cts +3 -3
- package/dist/types/message.d.cts.map +1 -1
- package/dist/types/message.d.mts +3 -3
- package/dist/types/message.d.mts.map +1 -1
- package/dist/utils/index.cjs +1 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +1 -0
- package/dist/utils/index.d.cts.map +1 -1
- package/dist/utils/index.d.mts +1 -0
- package/dist/utils/index.d.mts.map +1 -1
- package/dist/utils/index.mjs +1 -0
- package/dist/utils/index.mjs.map +1 -1
- package/dist/utils/row-render-keys.cjs +206 -0
- package/dist/utils/row-render-keys.cjs.map +1 -0
- package/dist/utils/row-render-keys.d.cts +65 -0
- package/dist/utils/row-render-keys.d.cts.map +1 -0
- package/dist/utils/row-render-keys.d.mts +65 -0
- package/dist/utils/row-render-keys.d.mts.map +1 -0
- package/dist/utils/row-render-keys.mjs +201 -0
- package/dist/utils/row-render-keys.mjs.map +1 -0
- package/package.json +12 -1
- package/src/__tests__/root-entry-browser-safety.test.ts +7 -1
- package/src/attachments/content.test.ts +48 -0
- package/src/attachments/content.ts +16 -0
- package/src/attachments/index.ts +2 -0
- package/src/event-transforms/index.ts +5 -0
- package/src/event-transforms/open-generative-ui-middleware.ts +392 -0
- package/src/event-transforms/recorded-events.test.ts +166 -0
- package/src/event-transforms/recorded-events.ts +74 -0
- package/src/finalize-events.test.ts +146 -0
- package/src/finalize-events.ts +124 -124
- package/src/index.ts +6 -1
- package/src/utils/__tests__/row-render-keys.test.ts +388 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/row-render-keys.ts +263 -0
- package/tsdown.config.ts +7 -4
package/dist/finalize-events.cjs
CHANGED
|
@@ -1,73 +1,80 @@
|
|
|
1
1
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
-
const require_random_id = require('./utils/random-id.cjs');
|
|
3
2
|
let _ag_ui_client = require("@ag-ui/client");
|
|
4
3
|
|
|
5
4
|
//#region src/finalize-events.ts
|
|
6
5
|
const defaultStopMessage = "Run stopped by user";
|
|
7
6
|
const defaultAbruptEndMessage = "Run ended without emitting a terminal event";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Incremental finalizer for a streamed AG-UI run. Feed every event to
|
|
9
|
+
* `observe`; when the stream ends without a terminal event, `finalize` returns
|
|
10
|
+
* the closers for text messages and tool calls still open plus a terminal
|
|
11
|
+
* event. Closed lifecycles are forgotten at once and payloads are never kept,
|
|
12
|
+
* so a caller does not have to retain the event array for this purpose.
|
|
13
|
+
*/
|
|
14
|
+
function createRunEventFinalizer() {
|
|
13
15
|
const openMessageIds = /* @__PURE__ */ new Set();
|
|
14
16
|
const openToolCalls = /* @__PURE__ */ new Map();
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
17
|
+
let terminalEventObserved = false;
|
|
18
|
+
const observe = (event) => {
|
|
19
|
+
if (terminalEventObserved) return;
|
|
20
|
+
switch (event.type) {
|
|
21
|
+
case _ag_ui_client.EventType.TEXT_MESSAGE_START: {
|
|
22
|
+
const messageId = event.messageId;
|
|
23
|
+
if (messageId) openMessageIds.add(messageId);
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
case _ag_ui_client.EventType.TEXT_MESSAGE_END: {
|
|
27
|
+
const messageId = event.messageId;
|
|
28
|
+
if (typeof messageId === "string") openMessageIds.delete(messageId);
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
case _ag_ui_client.EventType.TOOL_CALL_START: {
|
|
32
|
+
const toolCallId = event.toolCallId;
|
|
33
|
+
if (toolCallId && !openToolCalls.has(toolCallId)) openToolCalls.set(toolCallId, {
|
|
34
|
+
hasEnd: false,
|
|
35
|
+
hasResult: false
|
|
36
|
+
});
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
case _ag_ui_client.EventType.TOOL_CALL_END:
|
|
40
|
+
case _ag_ui_client.EventType.TOOL_CALL_RESULT: {
|
|
41
|
+
const toolCallId = event.toolCallId;
|
|
42
|
+
if (!toolCallId) break;
|
|
43
|
+
const info = openToolCalls.get(toolCallId);
|
|
44
|
+
if (!info) break;
|
|
45
|
+
if (event.type === _ag_ui_client.EventType.TOOL_CALL_END) info.hasEnd = true;
|
|
46
|
+
else info.hasResult = true;
|
|
47
|
+
if (info.hasEnd && info.hasResult) openToolCalls.delete(toolCallId);
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
case _ag_ui_client.EventType.RUN_FINISHED:
|
|
51
|
+
case _ag_ui_client.EventType.RUN_ERROR:
|
|
52
|
+
terminalEventObserved = true;
|
|
53
|
+
openMessageIds.clear();
|
|
54
|
+
openToolCalls.clear();
|
|
55
|
+
break;
|
|
56
|
+
default: break;
|
|
33
57
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const info = toolCallId ? openToolCalls.get(toolCallId) : void 0;
|
|
43
|
-
if (info) info.hasResult = true;
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
default: break;
|
|
47
|
-
}
|
|
48
|
-
if (events.some((event) => event.type === _ag_ui_client.EventType.RUN_FINISHED || event.type === _ag_ui_client.EventType.RUN_ERROR)) return appended;
|
|
49
|
-
for (const messageId of openMessageIds) {
|
|
50
|
-
const endEvent = {
|
|
58
|
+
};
|
|
59
|
+
const finalize = (options = {}) => {
|
|
60
|
+
if (terminalEventObserved) return [];
|
|
61
|
+
const { stopRequested = false, interruptionMessage } = options;
|
|
62
|
+
const resolvedStopMessage = interruptionMessage ?? defaultStopMessage;
|
|
63
|
+
const resolvedAbruptMessage = interruptionMessage && interruptionMessage !== defaultStopMessage ? interruptionMessage : defaultAbruptEndMessage;
|
|
64
|
+
const appended = [];
|
|
65
|
+
for (const messageId of openMessageIds) appended.push({
|
|
51
66
|
type: _ag_ui_client.EventType.TEXT_MESSAGE_END,
|
|
52
67
|
messageId
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
for (const [toolCallId, info] of openToolCalls) {
|
|
58
|
-
if (!info.hasEnd) {
|
|
59
|
-
const endEvent = {
|
|
68
|
+
});
|
|
69
|
+
for (const [toolCallId, info] of openToolCalls) {
|
|
70
|
+
if (!info.hasEnd) appended.push({
|
|
60
71
|
type: _ag_ui_client.EventType.TOOL_CALL_END,
|
|
61
72
|
toolCallId
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
appended.push(endEvent);
|
|
65
|
-
}
|
|
66
|
-
if (!info.hasResult) {
|
|
67
|
-
const resultEvent = {
|
|
73
|
+
});
|
|
74
|
+
if (!info.hasResult) appended.push({
|
|
68
75
|
type: _ag_ui_client.EventType.TOOL_CALL_RESULT,
|
|
69
76
|
toolCallId,
|
|
70
|
-
messageId: `${toolCallId
|
|
77
|
+
messageId: `${toolCallId}-result`,
|
|
71
78
|
role: "tool",
|
|
72
79
|
content: JSON.stringify(stopRequested ? {
|
|
73
80
|
status: "stopped",
|
|
@@ -78,27 +85,41 @@ function finalizeRunEvents(events, options = {}) {
|
|
|
78
85
|
reason: "missing_terminal_event",
|
|
79
86
|
message: resolvedAbruptMessage
|
|
80
87
|
})
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
if (stopRequested) appended.push({ type: _ag_ui_client.EventType.RUN_FINISHED });
|
|
91
|
+
else {
|
|
92
|
+
const errorEvent = {
|
|
93
|
+
type: _ag_ui_client.EventType.RUN_ERROR,
|
|
94
|
+
message: resolvedAbruptMessage,
|
|
95
|
+
code: "INCOMPLETE_STREAM"
|
|
81
96
|
};
|
|
82
|
-
|
|
83
|
-
appended.push(resultEvent);
|
|
97
|
+
appended.push(errorEvent);
|
|
84
98
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
terminalEventObserved = true;
|
|
100
|
+
openMessageIds.clear();
|
|
101
|
+
openToolCalls.clear();
|
|
102
|
+
return appended;
|
|
103
|
+
};
|
|
104
|
+
return {
|
|
105
|
+
observe,
|
|
106
|
+
finalize
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Array form of {@link createRunEventFinalizer} for callers that already keep
|
|
111
|
+
* the run's events (runners persist them). Appends the closers to `events` in
|
|
112
|
+
* place and returns them.
|
|
113
|
+
*/
|
|
114
|
+
function finalizeRunEvents(events, options = {}) {
|
|
115
|
+
const finalizer = createRunEventFinalizer();
|
|
116
|
+
for (const event of events) finalizer.observe(event);
|
|
117
|
+
const appended = finalizer.finalize(options);
|
|
118
|
+
events.push(...appended);
|
|
99
119
|
return appended;
|
|
100
120
|
}
|
|
101
121
|
|
|
102
122
|
//#endregion
|
|
123
|
+
exports.createRunEventFinalizer = createRunEventFinalizer;
|
|
103
124
|
exports.finalizeRunEvents = finalizeRunEvents;
|
|
104
125
|
//# sourceMappingURL=finalize-events.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finalize-events.cjs","names":["EventType"
|
|
1
|
+
{"version":3,"file":"finalize-events.cjs","names":["EventType"],"sources":["../src/finalize-events.ts"],"sourcesContent":["import type { BaseEvent, RunErrorEvent } from \"@ag-ui/client\";\nimport { EventType } from \"@ag-ui/client\";\n\nexport interface FinalizeRunOptions {\n stopRequested?: boolean;\n interruptionMessage?: string;\n}\n\nexport interface RunEventFinalizer {\n /** Observe one streamed event. Only the ids of open lifecycles are kept. */\n observe(event: BaseEvent): void;\n /** Return the events that close an interrupted or abruptly ended stream. */\n finalize(options?: FinalizeRunOptions): BaseEvent[];\n}\n\nconst defaultStopMessage = \"Run stopped by user\";\nconst defaultAbruptEndMessage = \"Run ended without emitting a terminal event\";\n\ninterface OpenToolCall {\n hasEnd: boolean;\n hasResult: boolean;\n}\n\n/**\n * Incremental finalizer for a streamed AG-UI run. Feed every event to\n * `observe`; when the stream ends without a terminal event, `finalize` returns\n * the closers for text messages and tool calls still open plus a terminal\n * event. Closed lifecycles are forgotten at once and payloads are never kept,\n * so a caller does not have to retain the event array for this purpose.\n */\nexport function createRunEventFinalizer(): RunEventFinalizer {\n const openMessageIds = new Set<string>();\n const openToolCalls = new Map<string, OpenToolCall>();\n let terminalEventObserved = false;\n\n const observe = (event: BaseEvent) => {\n if (terminalEventObserved) return;\n\n switch (event.type) {\n case EventType.TEXT_MESSAGE_START: {\n const messageId = (event as { messageId?: string }).messageId;\n if (messageId) openMessageIds.add(messageId);\n break;\n }\n case EventType.TEXT_MESSAGE_END: {\n const messageId = (event as { messageId?: string }).messageId;\n if (typeof messageId === \"string\") openMessageIds.delete(messageId);\n break;\n }\n case EventType.TOOL_CALL_START: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n if (toolCallId && !openToolCalls.has(toolCallId)) {\n openToolCalls.set(toolCallId, { hasEnd: false, hasResult: false });\n }\n break;\n }\n case EventType.TOOL_CALL_END:\n case EventType.TOOL_CALL_RESULT: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n if (!toolCallId) break;\n const info = openToolCalls.get(toolCallId);\n if (!info) break;\n\n if (event.type === EventType.TOOL_CALL_END) info.hasEnd = true;\n else info.hasResult = true;\n if (info.hasEnd && info.hasResult) openToolCalls.delete(toolCallId);\n break;\n }\n case EventType.RUN_FINISHED:\n case EventType.RUN_ERROR:\n terminalEventObserved = true;\n openMessageIds.clear();\n openToolCalls.clear();\n break;\n default:\n break;\n }\n };\n\n const finalize = (options: FinalizeRunOptions = {}): BaseEvent[] => {\n if (terminalEventObserved) return [];\n\n const { stopRequested = false, interruptionMessage } = options;\n const resolvedStopMessage = interruptionMessage ?? defaultStopMessage;\n const resolvedAbruptMessage =\n interruptionMessage && interruptionMessage !== defaultStopMessage\n ? interruptionMessage\n : defaultAbruptEndMessage;\n const appended: BaseEvent[] = [];\n\n for (const messageId of openMessageIds) {\n appended.push({\n type: EventType.TEXT_MESSAGE_END,\n messageId,\n } as BaseEvent);\n }\n\n for (const [toolCallId, info] of openToolCalls) {\n if (!info.hasEnd) {\n appended.push({\n type: EventType.TOOL_CALL_END,\n toolCallId,\n } as BaseEvent);\n }\n\n if (!info.hasResult) {\n appended.push({\n type: EventType.TOOL_CALL_RESULT,\n toolCallId,\n messageId: `${toolCallId}-result`,\n role: \"tool\",\n content: JSON.stringify(\n stopRequested\n ? {\n status: \"stopped\",\n reason: \"stop_requested\",\n message: resolvedStopMessage,\n }\n : {\n status: \"error\",\n reason: \"missing_terminal_event\",\n message: resolvedAbruptMessage,\n },\n ),\n } as BaseEvent);\n }\n }\n\n if (stopRequested) {\n appended.push({ type: EventType.RUN_FINISHED } as BaseEvent);\n } else {\n const errorEvent: RunErrorEvent = {\n type: EventType.RUN_ERROR,\n message: resolvedAbruptMessage,\n code: \"INCOMPLETE_STREAM\",\n };\n appended.push(errorEvent);\n }\n\n terminalEventObserved = true;\n openMessageIds.clear();\n openToolCalls.clear();\n return appended;\n };\n\n return { observe, finalize };\n}\n\n/**\n * Array form of {@link createRunEventFinalizer} for callers that already keep\n * the run's events (runners persist them). Appends the closers to `events` in\n * place and returns them.\n */\nexport function finalizeRunEvents(\n events: BaseEvent[],\n options: FinalizeRunOptions = {},\n): BaseEvent[] {\n const finalizer = createRunEventFinalizer();\n for (const event of events) finalizer.observe(event);\n\n const appended = finalizer.finalize(options);\n events.push(...appended);\n return appended;\n}\n"],"mappings":";;;;AAeA,MAAM,qBAAqB;AAC3B,MAAM,0BAA0B;;;;;;;;AAchC,SAAgB,0BAA6C;CAC3D,MAAM,iCAAiB,IAAI,KAAa;CACxC,MAAM,gCAAgB,IAAI,KAA2B;CACrD,IAAI,wBAAwB;CAE5B,MAAM,WAAW,UAAqB;AACpC,MAAI,sBAAuB;AAE3B,UAAQ,MAAM,MAAd;GACE,KAAKA,wBAAU,oBAAoB;IACjC,MAAM,YAAa,MAAiC;AACpD,QAAI,UAAW,gBAAe,IAAI,UAAU;AAC5C;;GAEF,KAAKA,wBAAU,kBAAkB;IAC/B,MAAM,YAAa,MAAiC;AACpD,QAAI,OAAO,cAAc,SAAU,gBAAe,OAAO,UAAU;AACnE;;GAEF,KAAKA,wBAAU,iBAAiB;IAC9B,MAAM,aAAc,MAAkC;AACtD,QAAI,cAAc,CAAC,cAAc,IAAI,WAAW,CAC9C,eAAc,IAAI,YAAY;KAAE,QAAQ;KAAO,WAAW;KAAO,CAAC;AAEpE;;GAEF,KAAKA,wBAAU;GACf,KAAKA,wBAAU,kBAAkB;IAC/B,MAAM,aAAc,MAAkC;AACtD,QAAI,CAAC,WAAY;IACjB,MAAM,OAAO,cAAc,IAAI,WAAW;AAC1C,QAAI,CAAC,KAAM;AAEX,QAAI,MAAM,SAASA,wBAAU,cAAe,MAAK,SAAS;QACrD,MAAK,YAAY;AACtB,QAAI,KAAK,UAAU,KAAK,UAAW,eAAc,OAAO,WAAW;AACnE;;GAEF,KAAKA,wBAAU;GACf,KAAKA,wBAAU;AACb,4BAAwB;AACxB,mBAAe,OAAO;AACtB,kBAAc,OAAO;AACrB;GACF,QACE;;;CAIN,MAAM,YAAY,UAA8B,EAAE,KAAkB;AAClE,MAAI,sBAAuB,QAAO,EAAE;EAEpC,MAAM,EAAE,gBAAgB,OAAO,wBAAwB;EACvD,MAAM,sBAAsB,uBAAuB;EACnD,MAAM,wBACJ,uBAAuB,wBAAwB,qBAC3C,sBACA;EACN,MAAM,WAAwB,EAAE;AAEhC,OAAK,MAAM,aAAa,eACtB,UAAS,KAAK;GACZ,MAAMA,wBAAU;GAChB;GACD,CAAc;AAGjB,OAAK,MAAM,CAAC,YAAY,SAAS,eAAe;AAC9C,OAAI,CAAC,KAAK,OACR,UAAS,KAAK;IACZ,MAAMA,wBAAU;IAChB;IACD,CAAc;AAGjB,OAAI,CAAC,KAAK,UACR,UAAS,KAAK;IACZ,MAAMA,wBAAU;IAChB;IACA,WAAW,GAAG,WAAW;IACzB,MAAM;IACN,SAAS,KAAK,UACZ,gBACI;KACE,QAAQ;KACR,QAAQ;KACR,SAAS;KACV,GACD;KACE,QAAQ;KACR,QAAQ;KACR,SAAS;KACV,CACN;IACF,CAAc;;AAInB,MAAI,cACF,UAAS,KAAK,EAAE,MAAMA,wBAAU,cAAc,CAAc;OACvD;GACL,MAAM,aAA4B;IAChC,MAAMA,wBAAU;IAChB,SAAS;IACT,MAAM;IACP;AACD,YAAS,KAAK,WAAW;;AAG3B,0BAAwB;AACxB,iBAAe,OAAO;AACtB,gBAAc,OAAO;AACrB,SAAO;;AAGT,QAAO;EAAE;EAAS;EAAU;;;;;;;AAQ9B,SAAgB,kBACd,QACA,UAA8B,EAAE,EACnB;CACb,MAAM,YAAY,yBAAyB;AAC3C,MAAK,MAAM,SAAS,OAAQ,WAAU,QAAQ,MAAM;CAEpD,MAAM,WAAW,UAAU,SAAS,QAAQ;AAC5C,QAAO,KAAK,GAAG,SAAS;AACxB,QAAO"}
|
|
@@ -5,7 +5,26 @@ interface FinalizeRunOptions {
|
|
|
5
5
|
stopRequested?: boolean;
|
|
6
6
|
interruptionMessage?: string;
|
|
7
7
|
}
|
|
8
|
+
interface RunEventFinalizer {
|
|
9
|
+
/** Observe one streamed event. Only the ids of open lifecycles are kept. */
|
|
10
|
+
observe(event: BaseEvent): void;
|
|
11
|
+
/** Return the events that close an interrupted or abruptly ended stream. */
|
|
12
|
+
finalize(options?: FinalizeRunOptions): BaseEvent[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Incremental finalizer for a streamed AG-UI run. Feed every event to
|
|
16
|
+
* `observe`; when the stream ends without a terminal event, `finalize` returns
|
|
17
|
+
* the closers for text messages and tool calls still open plus a terminal
|
|
18
|
+
* event. Closed lifecycles are forgotten at once and payloads are never kept,
|
|
19
|
+
* so a caller does not have to retain the event array for this purpose.
|
|
20
|
+
*/
|
|
21
|
+
declare function createRunEventFinalizer(): RunEventFinalizer;
|
|
22
|
+
/**
|
|
23
|
+
* Array form of {@link createRunEventFinalizer} for callers that already keep
|
|
24
|
+
* the run's events (runners persist them). Appends the closers to `events` in
|
|
25
|
+
* place and returns them.
|
|
26
|
+
*/
|
|
8
27
|
declare function finalizeRunEvents(events: BaseEvent[], options?: FinalizeRunOptions): BaseEvent[];
|
|
9
28
|
//#endregion
|
|
10
|
-
export { finalizeRunEvents };
|
|
29
|
+
export { FinalizeRunOptions, RunEventFinalizer, createRunEventFinalizer, finalizeRunEvents };
|
|
11
30
|
//# sourceMappingURL=finalize-events.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finalize-events.d.cts","names":[],"sources":["../src/finalize-events.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"finalize-events.d.cts","names":[],"sources":["../src/finalize-events.ts"],"mappings":";;;UAGiB,kBAAA;EACf,aAAA;EACA,mBAAA;AAAA;AAAA,UAGe,iBAAA;EAJf;EAMA,OAAA,CAAQ,KAAA,EAAO,SAAA;EAFA;EAIf,QAAA,CAAS,OAAA,GAAU,kBAAA,GAAqB,SAAA;AAAA;;;;;;;;iBAkB1B,uBAAA,CAAA,GAA2B,iBAAA;;;;;;iBA2H3B,iBAAA,CACd,MAAA,EAAQ,SAAA,IACR,OAAA,GAAS,kBAAA,GACR,SAAA"}
|
|
@@ -5,7 +5,26 @@ interface FinalizeRunOptions {
|
|
|
5
5
|
stopRequested?: boolean;
|
|
6
6
|
interruptionMessage?: string;
|
|
7
7
|
}
|
|
8
|
+
interface RunEventFinalizer {
|
|
9
|
+
/** Observe one streamed event. Only the ids of open lifecycles are kept. */
|
|
10
|
+
observe(event: BaseEvent): void;
|
|
11
|
+
/** Return the events that close an interrupted or abruptly ended stream. */
|
|
12
|
+
finalize(options?: FinalizeRunOptions): BaseEvent[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Incremental finalizer for a streamed AG-UI run. Feed every event to
|
|
16
|
+
* `observe`; when the stream ends without a terminal event, `finalize` returns
|
|
17
|
+
* the closers for text messages and tool calls still open plus a terminal
|
|
18
|
+
* event. Closed lifecycles are forgotten at once and payloads are never kept,
|
|
19
|
+
* so a caller does not have to retain the event array for this purpose.
|
|
20
|
+
*/
|
|
21
|
+
declare function createRunEventFinalizer(): RunEventFinalizer;
|
|
22
|
+
/**
|
|
23
|
+
* Array form of {@link createRunEventFinalizer} for callers that already keep
|
|
24
|
+
* the run's events (runners persist them). Appends the closers to `events` in
|
|
25
|
+
* place and returns them.
|
|
26
|
+
*/
|
|
8
27
|
declare function finalizeRunEvents(events: BaseEvent[], options?: FinalizeRunOptions): BaseEvent[];
|
|
9
28
|
//#endregion
|
|
10
|
-
export { finalizeRunEvents };
|
|
29
|
+
export { FinalizeRunOptions, RunEventFinalizer, createRunEventFinalizer, finalizeRunEvents };
|
|
11
30
|
//# sourceMappingURL=finalize-events.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finalize-events.d.mts","names":[],"sources":["../src/finalize-events.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"finalize-events.d.mts","names":[],"sources":["../src/finalize-events.ts"],"mappings":";;;UAGiB,kBAAA;EACf,aAAA;EACA,mBAAA;AAAA;AAAA,UAGe,iBAAA;EAJf;EAMA,OAAA,CAAQ,KAAA,EAAO,SAAA;EAFA;EAIf,QAAA,CAAS,OAAA,GAAU,kBAAA,GAAqB,SAAA;AAAA;;;;;;;;iBAkB1B,uBAAA,CAAA,GAA2B,iBAAA;;;;;;iBA2H3B,iBAAA,CACd,MAAA,EAAQ,SAAA,IACR,OAAA,GAAS,kBAAA,GACR,SAAA"}
|
package/dist/finalize-events.mjs
CHANGED
|
@@ -1,72 +1,79 @@
|
|
|
1
|
-
import { randomUUID } from "./utils/random-id.mjs";
|
|
2
1
|
import { EventType } from "@ag-ui/client";
|
|
3
2
|
|
|
4
3
|
//#region src/finalize-events.ts
|
|
5
4
|
const defaultStopMessage = "Run stopped by user";
|
|
6
5
|
const defaultAbruptEndMessage = "Run ended without emitting a terminal event";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Incremental finalizer for a streamed AG-UI run. Feed every event to
|
|
8
|
+
* `observe`; when the stream ends without a terminal event, `finalize` returns
|
|
9
|
+
* the closers for text messages and tool calls still open plus a terminal
|
|
10
|
+
* event. Closed lifecycles are forgotten at once and payloads are never kept,
|
|
11
|
+
* so a caller does not have to retain the event array for this purpose.
|
|
12
|
+
*/
|
|
13
|
+
function createRunEventFinalizer() {
|
|
12
14
|
const openMessageIds = /* @__PURE__ */ new Set();
|
|
13
15
|
const openToolCalls = /* @__PURE__ */ new Map();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
let terminalEventObserved = false;
|
|
17
|
+
const observe = (event) => {
|
|
18
|
+
if (terminalEventObserved) return;
|
|
19
|
+
switch (event.type) {
|
|
20
|
+
case EventType.TEXT_MESSAGE_START: {
|
|
21
|
+
const messageId = event.messageId;
|
|
22
|
+
if (messageId) openMessageIds.add(messageId);
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
case EventType.TEXT_MESSAGE_END: {
|
|
26
|
+
const messageId = event.messageId;
|
|
27
|
+
if (typeof messageId === "string") openMessageIds.delete(messageId);
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
case EventType.TOOL_CALL_START: {
|
|
31
|
+
const toolCallId = event.toolCallId;
|
|
32
|
+
if (toolCallId && !openToolCalls.has(toolCallId)) openToolCalls.set(toolCallId, {
|
|
33
|
+
hasEnd: false,
|
|
34
|
+
hasResult: false
|
|
35
|
+
});
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
case EventType.TOOL_CALL_END:
|
|
39
|
+
case EventType.TOOL_CALL_RESULT: {
|
|
40
|
+
const toolCallId = event.toolCallId;
|
|
41
|
+
if (!toolCallId) break;
|
|
42
|
+
const info = openToolCalls.get(toolCallId);
|
|
43
|
+
if (!info) break;
|
|
44
|
+
if (event.type === EventType.TOOL_CALL_END) info.hasEnd = true;
|
|
45
|
+
else info.hasResult = true;
|
|
46
|
+
if (info.hasEnd && info.hasResult) openToolCalls.delete(toolCallId);
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
case EventType.RUN_FINISHED:
|
|
50
|
+
case EventType.RUN_ERROR:
|
|
51
|
+
terminalEventObserved = true;
|
|
52
|
+
openMessageIds.clear();
|
|
53
|
+
openToolCalls.clear();
|
|
54
|
+
break;
|
|
55
|
+
default: break;
|
|
32
56
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const info = toolCallId ? openToolCalls.get(toolCallId) : void 0;
|
|
42
|
-
if (info) info.hasResult = true;
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
default: break;
|
|
46
|
-
}
|
|
47
|
-
if (events.some((event) => event.type === EventType.RUN_FINISHED || event.type === EventType.RUN_ERROR)) return appended;
|
|
48
|
-
for (const messageId of openMessageIds) {
|
|
49
|
-
const endEvent = {
|
|
57
|
+
};
|
|
58
|
+
const finalize = (options = {}) => {
|
|
59
|
+
if (terminalEventObserved) return [];
|
|
60
|
+
const { stopRequested = false, interruptionMessage } = options;
|
|
61
|
+
const resolvedStopMessage = interruptionMessage ?? defaultStopMessage;
|
|
62
|
+
const resolvedAbruptMessage = interruptionMessage && interruptionMessage !== defaultStopMessage ? interruptionMessage : defaultAbruptEndMessage;
|
|
63
|
+
const appended = [];
|
|
64
|
+
for (const messageId of openMessageIds) appended.push({
|
|
50
65
|
type: EventType.TEXT_MESSAGE_END,
|
|
51
66
|
messageId
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
for (const [toolCallId, info] of openToolCalls) {
|
|
57
|
-
if (!info.hasEnd) {
|
|
58
|
-
const endEvent = {
|
|
67
|
+
});
|
|
68
|
+
for (const [toolCallId, info] of openToolCalls) {
|
|
69
|
+
if (!info.hasEnd) appended.push({
|
|
59
70
|
type: EventType.TOOL_CALL_END,
|
|
60
71
|
toolCallId
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
appended.push(endEvent);
|
|
64
|
-
}
|
|
65
|
-
if (!info.hasResult) {
|
|
66
|
-
const resultEvent = {
|
|
72
|
+
});
|
|
73
|
+
if (!info.hasResult) appended.push({
|
|
67
74
|
type: EventType.TOOL_CALL_RESULT,
|
|
68
75
|
toolCallId,
|
|
69
|
-
messageId: `${toolCallId
|
|
76
|
+
messageId: `${toolCallId}-result`,
|
|
70
77
|
role: "tool",
|
|
71
78
|
content: JSON.stringify(stopRequested ? {
|
|
72
79
|
status: "stopped",
|
|
@@ -77,27 +84,40 @@ function finalizeRunEvents(events, options = {}) {
|
|
|
77
84
|
reason: "missing_terminal_event",
|
|
78
85
|
message: resolvedAbruptMessage
|
|
79
86
|
})
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (stopRequested) appended.push({ type: EventType.RUN_FINISHED });
|
|
90
|
+
else {
|
|
91
|
+
const errorEvent = {
|
|
92
|
+
type: EventType.RUN_ERROR,
|
|
93
|
+
message: resolvedAbruptMessage,
|
|
94
|
+
code: "INCOMPLETE_STREAM"
|
|
80
95
|
};
|
|
81
|
-
|
|
82
|
-
appended.push(resultEvent);
|
|
96
|
+
appended.push(errorEvent);
|
|
83
97
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
+
terminalEventObserved = true;
|
|
99
|
+
openMessageIds.clear();
|
|
100
|
+
openToolCalls.clear();
|
|
101
|
+
return appended;
|
|
102
|
+
};
|
|
103
|
+
return {
|
|
104
|
+
observe,
|
|
105
|
+
finalize
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Array form of {@link createRunEventFinalizer} for callers that already keep
|
|
110
|
+
* the run's events (runners persist them). Appends the closers to `events` in
|
|
111
|
+
* place and returns them.
|
|
112
|
+
*/
|
|
113
|
+
function finalizeRunEvents(events, options = {}) {
|
|
114
|
+
const finalizer = createRunEventFinalizer();
|
|
115
|
+
for (const event of events) finalizer.observe(event);
|
|
116
|
+
const appended = finalizer.finalize(options);
|
|
117
|
+
events.push(...appended);
|
|
98
118
|
return appended;
|
|
99
119
|
}
|
|
100
120
|
|
|
101
121
|
//#endregion
|
|
102
|
-
export { finalizeRunEvents };
|
|
122
|
+
export { createRunEventFinalizer, finalizeRunEvents };
|
|
103
123
|
//# sourceMappingURL=finalize-events.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finalize-events.mjs","names":[],"sources":["../src/finalize-events.ts"],"sourcesContent":["import type { BaseEvent, RunErrorEvent } from \"@ag-ui/client\";\nimport { EventType } from \"@ag-ui/client\";\
|
|
1
|
+
{"version":3,"file":"finalize-events.mjs","names":[],"sources":["../src/finalize-events.ts"],"sourcesContent":["import type { BaseEvent, RunErrorEvent } from \"@ag-ui/client\";\nimport { EventType } from \"@ag-ui/client\";\n\nexport interface FinalizeRunOptions {\n stopRequested?: boolean;\n interruptionMessage?: string;\n}\n\nexport interface RunEventFinalizer {\n /** Observe one streamed event. Only the ids of open lifecycles are kept. */\n observe(event: BaseEvent): void;\n /** Return the events that close an interrupted or abruptly ended stream. */\n finalize(options?: FinalizeRunOptions): BaseEvent[];\n}\n\nconst defaultStopMessage = \"Run stopped by user\";\nconst defaultAbruptEndMessage = \"Run ended without emitting a terminal event\";\n\ninterface OpenToolCall {\n hasEnd: boolean;\n hasResult: boolean;\n}\n\n/**\n * Incremental finalizer for a streamed AG-UI run. Feed every event to\n * `observe`; when the stream ends without a terminal event, `finalize` returns\n * the closers for text messages and tool calls still open plus a terminal\n * event. Closed lifecycles are forgotten at once and payloads are never kept,\n * so a caller does not have to retain the event array for this purpose.\n */\nexport function createRunEventFinalizer(): RunEventFinalizer {\n const openMessageIds = new Set<string>();\n const openToolCalls = new Map<string, OpenToolCall>();\n let terminalEventObserved = false;\n\n const observe = (event: BaseEvent) => {\n if (terminalEventObserved) return;\n\n switch (event.type) {\n case EventType.TEXT_MESSAGE_START: {\n const messageId = (event as { messageId?: string }).messageId;\n if (messageId) openMessageIds.add(messageId);\n break;\n }\n case EventType.TEXT_MESSAGE_END: {\n const messageId = (event as { messageId?: string }).messageId;\n if (typeof messageId === \"string\") openMessageIds.delete(messageId);\n break;\n }\n case EventType.TOOL_CALL_START: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n if (toolCallId && !openToolCalls.has(toolCallId)) {\n openToolCalls.set(toolCallId, { hasEnd: false, hasResult: false });\n }\n break;\n }\n case EventType.TOOL_CALL_END:\n case EventType.TOOL_CALL_RESULT: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n if (!toolCallId) break;\n const info = openToolCalls.get(toolCallId);\n if (!info) break;\n\n if (event.type === EventType.TOOL_CALL_END) info.hasEnd = true;\n else info.hasResult = true;\n if (info.hasEnd && info.hasResult) openToolCalls.delete(toolCallId);\n break;\n }\n case EventType.RUN_FINISHED:\n case EventType.RUN_ERROR:\n terminalEventObserved = true;\n openMessageIds.clear();\n openToolCalls.clear();\n break;\n default:\n break;\n }\n };\n\n const finalize = (options: FinalizeRunOptions = {}): BaseEvent[] => {\n if (terminalEventObserved) return [];\n\n const { stopRequested = false, interruptionMessage } = options;\n const resolvedStopMessage = interruptionMessage ?? defaultStopMessage;\n const resolvedAbruptMessage =\n interruptionMessage && interruptionMessage !== defaultStopMessage\n ? interruptionMessage\n : defaultAbruptEndMessage;\n const appended: BaseEvent[] = [];\n\n for (const messageId of openMessageIds) {\n appended.push({\n type: EventType.TEXT_MESSAGE_END,\n messageId,\n } as BaseEvent);\n }\n\n for (const [toolCallId, info] of openToolCalls) {\n if (!info.hasEnd) {\n appended.push({\n type: EventType.TOOL_CALL_END,\n toolCallId,\n } as BaseEvent);\n }\n\n if (!info.hasResult) {\n appended.push({\n type: EventType.TOOL_CALL_RESULT,\n toolCallId,\n messageId: `${toolCallId}-result`,\n role: \"tool\",\n content: JSON.stringify(\n stopRequested\n ? {\n status: \"stopped\",\n reason: \"stop_requested\",\n message: resolvedStopMessage,\n }\n : {\n status: \"error\",\n reason: \"missing_terminal_event\",\n message: resolvedAbruptMessage,\n },\n ),\n } as BaseEvent);\n }\n }\n\n if (stopRequested) {\n appended.push({ type: EventType.RUN_FINISHED } as BaseEvent);\n } else {\n const errorEvent: RunErrorEvent = {\n type: EventType.RUN_ERROR,\n message: resolvedAbruptMessage,\n code: \"INCOMPLETE_STREAM\",\n };\n appended.push(errorEvent);\n }\n\n terminalEventObserved = true;\n openMessageIds.clear();\n openToolCalls.clear();\n return appended;\n };\n\n return { observe, finalize };\n}\n\n/**\n * Array form of {@link createRunEventFinalizer} for callers that already keep\n * the run's events (runners persist them). Appends the closers to `events` in\n * place and returns them.\n */\nexport function finalizeRunEvents(\n events: BaseEvent[],\n options: FinalizeRunOptions = {},\n): BaseEvent[] {\n const finalizer = createRunEventFinalizer();\n for (const event of events) finalizer.observe(event);\n\n const appended = finalizer.finalize(options);\n events.push(...appended);\n return appended;\n}\n"],"mappings":";;;AAeA,MAAM,qBAAqB;AAC3B,MAAM,0BAA0B;;;;;;;;AAchC,SAAgB,0BAA6C;CAC3D,MAAM,iCAAiB,IAAI,KAAa;CACxC,MAAM,gCAAgB,IAAI,KAA2B;CACrD,IAAI,wBAAwB;CAE5B,MAAM,WAAW,UAAqB;AACpC,MAAI,sBAAuB;AAE3B,UAAQ,MAAM,MAAd;GACE,KAAK,UAAU,oBAAoB;IACjC,MAAM,YAAa,MAAiC;AACpD,QAAI,UAAW,gBAAe,IAAI,UAAU;AAC5C;;GAEF,KAAK,UAAU,kBAAkB;IAC/B,MAAM,YAAa,MAAiC;AACpD,QAAI,OAAO,cAAc,SAAU,gBAAe,OAAO,UAAU;AACnE;;GAEF,KAAK,UAAU,iBAAiB;IAC9B,MAAM,aAAc,MAAkC;AACtD,QAAI,cAAc,CAAC,cAAc,IAAI,WAAW,CAC9C,eAAc,IAAI,YAAY;KAAE,QAAQ;KAAO,WAAW;KAAO,CAAC;AAEpE;;GAEF,KAAK,UAAU;GACf,KAAK,UAAU,kBAAkB;IAC/B,MAAM,aAAc,MAAkC;AACtD,QAAI,CAAC,WAAY;IACjB,MAAM,OAAO,cAAc,IAAI,WAAW;AAC1C,QAAI,CAAC,KAAM;AAEX,QAAI,MAAM,SAAS,UAAU,cAAe,MAAK,SAAS;QACrD,MAAK,YAAY;AACtB,QAAI,KAAK,UAAU,KAAK,UAAW,eAAc,OAAO,WAAW;AACnE;;GAEF,KAAK,UAAU;GACf,KAAK,UAAU;AACb,4BAAwB;AACxB,mBAAe,OAAO;AACtB,kBAAc,OAAO;AACrB;GACF,QACE;;;CAIN,MAAM,YAAY,UAA8B,EAAE,KAAkB;AAClE,MAAI,sBAAuB,QAAO,EAAE;EAEpC,MAAM,EAAE,gBAAgB,OAAO,wBAAwB;EACvD,MAAM,sBAAsB,uBAAuB;EACnD,MAAM,wBACJ,uBAAuB,wBAAwB,qBAC3C,sBACA;EACN,MAAM,WAAwB,EAAE;AAEhC,OAAK,MAAM,aAAa,eACtB,UAAS,KAAK;GACZ,MAAM,UAAU;GAChB;GACD,CAAc;AAGjB,OAAK,MAAM,CAAC,YAAY,SAAS,eAAe;AAC9C,OAAI,CAAC,KAAK,OACR,UAAS,KAAK;IACZ,MAAM,UAAU;IAChB;IACD,CAAc;AAGjB,OAAI,CAAC,KAAK,UACR,UAAS,KAAK;IACZ,MAAM,UAAU;IAChB;IACA,WAAW,GAAG,WAAW;IACzB,MAAM;IACN,SAAS,KAAK,UACZ,gBACI;KACE,QAAQ;KACR,QAAQ;KACR,SAAS;KACV,GACD;KACE,QAAQ;KACR,QAAQ;KACR,SAAS;KACV,CACN;IACF,CAAc;;AAInB,MAAI,cACF,UAAS,KAAK,EAAE,MAAM,UAAU,cAAc,CAAc;OACvD;GACL,MAAM,aAA4B;IAChC,MAAM,UAAU;IAChB,SAAS;IACT,MAAM;IACP;AACD,YAAS,KAAK,WAAW;;AAG3B,0BAAwB;AACxB,iBAAe,OAAO;AACtB,gBAAc,OAAO;AACrB,SAAO;;AAGT,QAAO;EAAE;EAAS;EAAU;;;;;;;AAQ9B,SAAgB,kBACd,QACA,UAA8B,EAAE,EACnB;CACb,MAAM,YAAY,yBAAyB;AAC3C,MAAK,MAAM,SAAS,OAAQ,WAAU,QAAQ,MAAM;CAEpD,MAAM,WAAW,UAAU,SAAS,QAAQ;AAC5C,QAAO,KAAK,GAAG,SAAS;AACxB,QAAO"}
|
package/dist/index.cjs
CHANGED
|
@@ -10,6 +10,7 @@ const require_inspector_visibility = require('./utils/inspector-visibility.cjs')
|
|
|
10
10
|
const require_types = require('./utils/types.cjs');
|
|
11
11
|
const require_random_id = require('./utils/random-id.cjs');
|
|
12
12
|
const require_requests = require('./utils/requests.cjs');
|
|
13
|
+
const require_row_render_keys = require('./utils/row-render-keys.cjs');
|
|
13
14
|
const require_index = require('./utils/index.cjs');
|
|
14
15
|
const require_index$1 = require('./constants/index.cjs');
|
|
15
16
|
const require_telemetry_disabled = require('./telemetry/telemetry-disabled.cjs');
|
|
@@ -18,6 +19,7 @@ const require_model_host = require('./telemetry/model-host.cjs');
|
|
|
18
19
|
const require_lambda_client = require('./telemetry/lambda-client.cjs');
|
|
19
20
|
const require_debug = require('./debug.cjs');
|
|
20
21
|
const require_standard_schema = require('./standard-schema.cjs');
|
|
22
|
+
const require_content = require('./attachments/content.cjs');
|
|
21
23
|
const require_utils = require('./attachments/utils.cjs');
|
|
22
24
|
const require_logger = require('./logger.cjs');
|
|
23
25
|
const require_finalize_events = require('./finalize-events.cjs');
|
|
@@ -106,10 +108,14 @@ exports.UNSAMPLED_RATE = require_sampling.UNSAMPLED_RATE;
|
|
|
106
108
|
exports.UpgradeRequiredError = require_errors.UpgradeRequiredError;
|
|
107
109
|
exports.actionParametersToJsonSchema = require_json_schema.actionParametersToJsonSchema;
|
|
108
110
|
exports.classifyModelHost = require_model_host.classifyModelHost;
|
|
111
|
+
exports.commitRowKeyStore = require_row_render_keys.commitRowKeyStore;
|
|
109
112
|
exports.computeSamplingMeta = require_sampling.computeSamplingMeta;
|
|
110
113
|
exports.convertJsonSchemaToZodSchema = require_json_schema.convertJsonSchemaToZodSchema;
|
|
111
114
|
exports.copyToClipboard = require_clipboard.copyToClipboard;
|
|
115
|
+
exports.createAttachmentContent = require_content.createAttachmentContent;
|
|
112
116
|
exports.createLicenseContextValue = createLicenseContextValue;
|
|
117
|
+
exports.createRowKeyStore = require_row_render_keys.createRowKeyStore;
|
|
118
|
+
exports.createRunEventFinalizer = require_finalize_events.createRunEventFinalizer;
|
|
113
119
|
exports.dataToUUID = require_random_id.dataToUUID;
|
|
114
120
|
exports.ensureStructuredError = require_errors.ensureStructuredError;
|
|
115
121
|
exports.exceedsMaxSize = require_utils.exceedsMaxSize;
|
|
@@ -142,12 +148,15 @@ exports.parseJson = require_index.parseJson;
|
|
|
142
148
|
exports.parseTelemetryIdFromLicense = require_lambda_client.parseTelemetryIdFromLicense;
|
|
143
149
|
exports.partialJSONParse = require_index.partialJSONParse;
|
|
144
150
|
exports.phoenixExponentialBackoff = require_index.phoenixExponentialBackoff;
|
|
151
|
+
exports.pruneRowKeyStore = require_row_render_keys.pruneRowKeyStore;
|
|
145
152
|
exports.publicApiKeyRequired = require_console_styling.publicApiKeyRequired;
|
|
146
153
|
exports.randomId = require_random_id.randomId;
|
|
147
154
|
exports.randomUUID = require_random_id.randomUUID;
|
|
148
155
|
exports.readBody = require_requests.readBody;
|
|
149
156
|
exports.readFileAsBase64 = require_utils.readFileAsBase64;
|
|
150
157
|
exports.resolveDebugConfig = require_debug.resolveDebugConfig;
|
|
158
|
+
exports.resolveRowRenderKeys = require_row_render_keys.resolveRowRenderKeys;
|
|
159
|
+
exports.resolveRowRenderKeysById = require_row_render_keys.resolveRowRenderKeysById;
|
|
151
160
|
exports.safeParseToolArgs = require_index.safeParseToolArgs;
|
|
152
161
|
exports.schemaToJsonSchema = require_standard_schema.schemaToJsonSchema;
|
|
153
162
|
exports.shouldEnableInspector = require_inspector_visibility.shouldEnableInspector;
|