@ekairos/events 1.22.44-beta.development.0 → 1.22.45-beta.development.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.
|
@@ -248,8 +248,11 @@ export function assertValidContextPartChunkIdentity(input) {
|
|
|
248
248
|
if (!isActionChunk && typeof input.actionRef !== "undefined") {
|
|
249
249
|
throw new Error(`Invalid ${fieldLabel(label, "actionRef")}: only action chunks can carry actionRef.`);
|
|
250
250
|
}
|
|
251
|
-
if (isActionChunk
|
|
252
|
-
assertPartIdentityString(input.actionRef, fieldLabel(label, "actionRef"));
|
|
251
|
+
if (isActionChunk) {
|
|
252
|
+
const actionRef = assertPartIdentityString(input.actionRef, fieldLabel(label, "actionRef"));
|
|
253
|
+
if (actionRef !== providerPartId) {
|
|
254
|
+
throw new Error(`Invalid ${fieldLabel(label, "actionRef")}: action chunks require actionRef to match providerPartId.`);
|
|
255
|
+
}
|
|
253
256
|
}
|
|
254
257
|
const stepId = normalizeIdentityField(input.stepId);
|
|
255
258
|
if (!stepId)
|
|
@@ -8,5 +8,6 @@ export type MapAiSdkChunkToContextEventParams = {
|
|
|
8
8
|
itemId?: string;
|
|
9
9
|
provider?: string;
|
|
10
10
|
sequence: number;
|
|
11
|
+
actionNameByRef?: Map<string, string>;
|
|
11
12
|
};
|
|
12
13
|
export declare function mapAiSdkChunkToContextEvent(params: MapAiSdkChunkToContextEventParams): ChunkEmittedEvent;
|
|
@@ -103,6 +103,7 @@ function buildNormalizedData(chunk) {
|
|
|
103
103
|
"inputTextDelta",
|
|
104
104
|
"outputTextDelta",
|
|
105
105
|
"state",
|
|
106
|
+
"actionName",
|
|
106
107
|
"toolName",
|
|
107
108
|
"toolCallId",
|
|
108
109
|
"input",
|
|
@@ -153,6 +154,24 @@ export function mapAiSdkChunkToContextEvent(params) {
|
|
|
153
154
|
});
|
|
154
155
|
const actionRef = readString(chunk, "toolCallId") ??
|
|
155
156
|
readString(chunk, "id");
|
|
157
|
+
let data = buildNormalizedData(chunk);
|
|
158
|
+
if (chunkType.startsWith("chunk.action_") && actionRef) {
|
|
159
|
+
const observedActionName = readString(chunk, "actionName") ??
|
|
160
|
+
readString(chunk, "toolName") ??
|
|
161
|
+
readString(data, "actionName") ??
|
|
162
|
+
readString(data, "toolName");
|
|
163
|
+
if (observedActionName) {
|
|
164
|
+
params.actionNameByRef?.set(actionRef, observedActionName);
|
|
165
|
+
}
|
|
166
|
+
const knownActionName = observedActionName ?? params.actionNameByRef?.get(actionRef);
|
|
167
|
+
if (knownActionName) {
|
|
168
|
+
data = {
|
|
169
|
+
...data,
|
|
170
|
+
actionName: readString(data, "actionName") ?? knownActionName,
|
|
171
|
+
toolName: readString(data, "toolName") ?? knownActionName,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
}
|
|
156
175
|
return {
|
|
157
176
|
type: "chunk.emitted",
|
|
158
177
|
at: new Date().toISOString(),
|
|
@@ -169,7 +188,7 @@ export function mapAiSdkChunkToContextEvent(params) {
|
|
|
169
188
|
provider: params.provider,
|
|
170
189
|
providerChunkType,
|
|
171
190
|
sequence: params.sequence,
|
|
172
|
-
data
|
|
191
|
+
data,
|
|
173
192
|
raw: sanitizeRaw(chunk),
|
|
174
193
|
};
|
|
175
194
|
}
|
|
@@ -135,6 +135,7 @@ export async function executeAiSdkReaction(params) {
|
|
|
135
135
|
const modelId = typeof params.model === "string" ? params.model : "";
|
|
136
136
|
const mappedProvider = modelId.includes("/") ? modelId.split("/")[0] || "ai-sdk" : "ai-sdk";
|
|
137
137
|
const contextStepStreamWriter = params.contextStepStream?.getWriter();
|
|
138
|
+
const actionNameByRef = new Map();
|
|
138
139
|
try {
|
|
139
140
|
const uiStream = result
|
|
140
141
|
.toUIMessageStream({
|
|
@@ -173,6 +174,7 @@ export async function executeAiSdkReaction(params) {
|
|
|
173
174
|
itemId: params.eventId,
|
|
174
175
|
provider: mappedProvider,
|
|
175
176
|
sequence: ++chunkSequence,
|
|
177
|
+
actionNameByRef,
|
|
176
178
|
});
|
|
177
179
|
const persistedChunk = createContextStepStreamChunk({
|
|
178
180
|
at: mapped.at,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ekairos/events",
|
|
3
|
-
"version": "1.22.
|
|
3
|
+
"version": "1.22.45-beta.development.0",
|
|
4
4
|
"description": "Ekairos Events - Context-first workflow runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
},
|
|
128
128
|
"dependencies": {
|
|
129
129
|
"@ai-sdk/openai": "^2.0.52",
|
|
130
|
-
"@ekairos/domain": "^1.22.
|
|
130
|
+
"@ekairos/domain": "^1.22.45-beta.development.0",
|
|
131
131
|
"@instantdb/admin": "0.22.158",
|
|
132
132
|
"@instantdb/core": "0.22.142",
|
|
133
133
|
"@vercel/mcp-adapter": "^1.0.0",
|