@ekairos/thread 1.22.19-beta.feature-core-thread-registry-sync.0 → 1.22.21-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.
package/dist/reactors/types.d.ts
CHANGED
|
@@ -43,6 +43,6 @@ export type ThreadReactorParams<Context = unknown, Env extends ThreadEnvironment
|
|
|
43
43
|
maxModelSteps: number;
|
|
44
44
|
sendStart: boolean;
|
|
45
45
|
silent: boolean;
|
|
46
|
-
writable
|
|
46
|
+
writable?: WritableStream<UIMessageChunk>;
|
|
47
47
|
};
|
|
48
48
|
export type ThreadReactor<Context = unknown, Env extends ThreadEnvironment = ThreadEnvironment> = (params: ThreadReactorParams<Context, Env>) => Promise<ThreadReactionResult>;
|
|
@@ -21,7 +21,7 @@ export declare function executeReaction(params: {
|
|
|
21
21
|
maxSteps: number;
|
|
22
22
|
sendStart?: boolean;
|
|
23
23
|
silent?: boolean;
|
|
24
|
-
writable
|
|
24
|
+
writable?: WritableStream<UIMessageChunk>;
|
|
25
25
|
executionId?: string;
|
|
26
26
|
contextId?: string;
|
|
27
27
|
stepId?: string;
|
|
@@ -187,7 +187,22 @@ export async function executeReaction(params) {
|
|
|
187
187
|
controller.enqueue(chunk);
|
|
188
188
|
},
|
|
189
189
|
}));
|
|
190
|
-
|
|
190
|
+
if (params.writable) {
|
|
191
|
+
await uiStream.pipeTo(params.writable, { preventClose: true });
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
const reader = uiStream.getReader();
|
|
195
|
+
try {
|
|
196
|
+
while (true) {
|
|
197
|
+
const { done } = await reader.read();
|
|
198
|
+
if (done)
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
finally {
|
|
203
|
+
reader.releaseLock();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
191
206
|
const assistantEvent = await finishPromise;
|
|
192
207
|
const finishedAtMs = Date.now();
|
|
193
208
|
const toolCalls = extractToolCallsFromParts(assistantEvent?.content?.parts);
|
package/dist/thread.engine.js
CHANGED
|
@@ -58,7 +58,7 @@ function contextThreadIdOrNull(context) {
|
|
|
58
58
|
: null;
|
|
59
59
|
}
|
|
60
60
|
async function emitThreadEvents(params) {
|
|
61
|
-
if (params.silent || params.events.length === 0)
|
|
61
|
+
if (params.silent || !params.writable || params.events.length === 0)
|
|
62
62
|
return;
|
|
63
63
|
await writeThreadEvents({ events: params.events, writable: params.writable });
|
|
64
64
|
}
|
|
@@ -146,15 +146,6 @@ export class Thread {
|
|
|
146
146
|
namespace: `context:${String(currentContext.id)}`,
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
|
-
// Reactor/steps always receive a stream argument.
|
|
150
|
-
// In silent mode (or when no workflow writable is available), we use an in-memory sink.
|
|
151
|
-
if (!writable) {
|
|
152
|
-
writable = new WritableStream({
|
|
153
|
-
write() {
|
|
154
|
-
// noop
|
|
155
|
-
},
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
149
|
const contextSelector = params.contextIdentifier?.id
|
|
159
150
|
? { id: String(params.contextIdentifier.id) }
|
|
160
151
|
: params.contextIdentifier?.key
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ekairos/thread",
|
|
3
|
-
"version": "1.22.
|
|
3
|
+
"version": "1.22.21-beta.development.0",
|
|
4
4
|
"description": "Pulzar Thread - Workflow-based AI Threads",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
},
|
|
115
115
|
"dependencies": {
|
|
116
116
|
"@ai-sdk/openai": "^2.0.52",
|
|
117
|
-
"@ekairos/domain": "^1.22.
|
|
117
|
+
"@ekairos/domain": "^1.22.21-beta.development.0",
|
|
118
118
|
"@instantdb/admin": "0.22.126",
|
|
119
119
|
"@instantdb/core": "0.22.126",
|
|
120
120
|
"@vercel/mcp-adapter": "^1.0.0",
|