@axiom-lattice/gateway 2.1.47 → 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/dist/index.mjs CHANGED
@@ -202,6 +202,7 @@ import { v4 } from "uuid";
202
202
  import {
203
203
  agentInstanceManager as agentInstanceManager2
204
204
  } from "@axiom-lattice/core";
205
+ import { MessageChunkTypes } from "@axiom-lattice/protocols";
205
206
  var createRun = async (request, reply) => {
206
207
  try {
207
208
  const {
@@ -246,9 +247,8 @@ var createRun = async (request, reply) => {
246
247
  command,
247
248
  custom_run_config
248
249
  });
249
- const stream = agent.chunkStream(result.messageId);
250
+ const stream = agent.chunkStream(result.messageId, [MessageChunkTypes.MESSAGE_COMPLETED]);
250
251
  for await (const chunk of stream) {
251
- console.log(input.message, chunk.data.content);
252
252
  const success = reply.raw.write(`data: ${JSON.stringify(chunk)}
253
253
 
254
254
  `);
@@ -317,7 +317,8 @@ var resumeStream = async (request, reply) => {
317
317
  workspace_id,
318
318
  project_id
319
319
  });
320
- const stream = agent.chunkStream(message_id, known_content);
320
+ console.log("[UI]message_id", message_id);
321
+ const stream = agent.chunkStream(message_id, [MessageChunkTypes.THREAD_IDLE]);
321
322
  for await (const chunk of stream) {
322
323
  reply.raw.write(`data: ${JSON.stringify(chunk)}
323
324
 
@@ -450,9 +451,13 @@ var getAgentState = async (request, reply) => {
450
451
  reply.status(500).send(result);
451
452
  return;
452
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
+ }));
453
458
  const mergedResult = {
454
459
  ...result,
455
- pendingMessages
460
+ pendingMessages: normalizedPendingMessages
456
461
  };
457
462
  reply.send(mergedResult);
458
463
  } catch (error) {