@axiom-lattice/gateway 2.1.46 → 2.1.48
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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +20 -0
- package/dist/index.js +24 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/controllers/memory.ts +9 -1
- package/src/controllers/run.ts +22 -9
package/dist/index.mjs
CHANGED
|
@@ -200,9 +200,9 @@ var getAgentGraph = async (request, reply) => {
|
|
|
200
200
|
// src/controllers/run.ts
|
|
201
201
|
import { v4 } from "uuid";
|
|
202
202
|
import {
|
|
203
|
-
Agent,
|
|
204
203
|
agentInstanceManager as agentInstanceManager2
|
|
205
204
|
} from "@axiom-lattice/core";
|
|
205
|
+
import { MessageChunkTypes } from "@axiom-lattice/protocols";
|
|
206
206
|
var createRun = async (request, reply) => {
|
|
207
207
|
try {
|
|
208
208
|
const {
|
|
@@ -247,9 +247,8 @@ var createRun = async (request, reply) => {
|
|
|
247
247
|
command,
|
|
248
248
|
custom_run_config
|
|
249
249
|
});
|
|
250
|
-
const stream = agent.chunkStream(result.messageId);
|
|
250
|
+
const stream = agent.chunkStream(result.messageId, [MessageChunkTypes.MESSAGE_COMPLETED]);
|
|
251
251
|
for await (const chunk of stream) {
|
|
252
|
-
console.log(input.message, chunk.data.content);
|
|
253
252
|
const success = reply.raw.write(`data: ${JSON.stringify(chunk)}
|
|
254
253
|
|
|
255
254
|
`);
|
|
@@ -292,11 +291,14 @@ var createRun = async (request, reply) => {
|
|
|
292
291
|
};
|
|
293
292
|
var resumeStream = async (request, reply) => {
|
|
294
293
|
try {
|
|
295
|
-
const { thread_id, message_id, known_content, poll_interval } = request.body;
|
|
296
|
-
|
|
294
|
+
const { thread_id, message_id, assistant_id, known_content, poll_interval } = request.body;
|
|
295
|
+
const tenant_id = request.headers["x-tenant-id"];
|
|
296
|
+
const workspace_id = request.headers["x-workspace-id"];
|
|
297
|
+
const project_id = request.headers["x-project-id"];
|
|
298
|
+
if (!thread_id || !message_id || !assistant_id || known_content === void 0) {
|
|
297
299
|
reply.status(400).send({
|
|
298
300
|
success: false,
|
|
299
|
-
error: "thread_id, message_id, and known_content are required"
|
|
301
|
+
error: "thread_id, message_id, assistant_id, and known_content are required"
|
|
300
302
|
});
|
|
301
303
|
return;
|
|
302
304
|
}
|
|
@@ -308,12 +310,15 @@ var resumeStream = async (request, reply) => {
|
|
|
308
310
|
"Access-Control-Allow-Origin": "*"
|
|
309
311
|
});
|
|
310
312
|
try {
|
|
311
|
-
const agent =
|
|
312
|
-
assistant_id
|
|
313
|
+
const agent = agentInstanceManager2.getAgent({
|
|
314
|
+
assistant_id,
|
|
313
315
|
thread_id,
|
|
314
|
-
tenant_id
|
|
316
|
+
tenant_id,
|
|
317
|
+
workspace_id,
|
|
318
|
+
project_id
|
|
315
319
|
});
|
|
316
|
-
|
|
320
|
+
console.log("[UI]message_id", message_id);
|
|
321
|
+
const stream = agent.chunkStream(message_id, [MessageChunkTypes.THREAD_IDLE]);
|
|
317
322
|
for await (const chunk of stream) {
|
|
318
323
|
reply.raw.write(`data: ${JSON.stringify(chunk)}
|
|
319
324
|
|
|
@@ -446,9 +451,13 @@ var getAgentState = async (request, reply) => {
|
|
|
446
451
|
reply.status(500).send(result);
|
|
447
452
|
return;
|
|
448
453
|
}
|
|
454
|
+
const normalizedPendingMessages = pendingMessages.map((msg) => ({
|
|
455
|
+
...msg,
|
|
456
|
+
content: typeof msg.content === "object" && msg.content !== null ? msg.content.message || JSON.stringify(msg.content) : String(msg.content || "")
|
|
457
|
+
}));
|
|
449
458
|
const mergedResult = {
|
|
450
459
|
...result,
|
|
451
|
-
pendingMessages
|
|
460
|
+
pendingMessages: normalizedPendingMessages
|
|
452
461
|
};
|
|
453
462
|
reply.send(mergedResult);
|
|
454
463
|
} catch (error) {
|