@axiom-lattice/gateway 2.1.48 → 2.1.49

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
@@ -317,7 +317,6 @@ var resumeStream = async (request, reply) => {
317
317
  workspace_id,
318
318
  project_id
319
319
  });
320
- console.log("[UI]message_id", message_id);
321
320
  const stream = agent.chunkStream(message_id, [MessageChunkTypes.THREAD_IDLE]);
322
321
  for await (const chunk of stream) {
323
322
  reply.raw.write(`data: ${JSON.stringify(chunk)}
@@ -4937,8 +4936,6 @@ var handleAgentTask = async (taskRequest, retryCount = 0) => {
4937
4936
  console.log(
4938
4937
  `\u5F00\u59CB\u5904\u7406\u4EFB\u52A1 [assistant_id: ${assistant_id}, thread_id: ${thread_id}]`
4939
4938
  );
4940
- const apiUrl = AgentTaskConsumer.agent_run_endpoint;
4941
- console.log(`apiUrl: ${apiUrl}`);
4942
4939
  const agent = agentInstanceManager4.getAgent({ assistant_id, thread_id, tenant_id, workspace_id: runConfig?.workspaceId, project_id: runConfig?.projectId, custom_run_config: runConfig });
4943
4940
  await agent.addMessage({ input, command }, QueueMode.STEER);
4944
4941
  if (callback_event) {
@@ -4949,6 +4946,13 @@ var handleAgentTask = async (taskRequest, retryCount = 0) => {
4949
4946
  config: { assistant_id, thread_id, tenant_id }
4950
4947
  });
4951
4948
  });
4949
+ agent.subscribeOnce("message:interrupted", (evt) => {
4950
+ eventBus2.publish(callback_event, {
4951
+ success: true,
4952
+ state: evt.state,
4953
+ config: { assistant_id, thread_id, tenant_id }
4954
+ });
4955
+ });
4952
4956
  }
4953
4957
  return true;
4954
4958
  } catch (error) {
@@ -5150,7 +5154,8 @@ import {
5150
5154
  loggerLatticeManager,
5151
5155
  sandboxLatticeManager as sandboxLatticeManager2,
5152
5156
  sqlDatabaseManager as sqlDatabaseManager2,
5153
- getStoreLattice as getStoreLattice12
5157
+ getStoreLattice as getStoreLattice12,
5158
+ agentInstanceManager as agentInstanceManager5
5154
5159
  } from "@axiom-lattice/core";
5155
5160
  import {
5156
5161
  LoggerType
@@ -5302,6 +5307,13 @@ var start = async (config) => {
5302
5307
  agentTaskConsumer.startPollingQueue();
5303
5308
  }
5304
5309
  }
5310
+ try {
5311
+ logger.info("Starting agent instance recovery...");
5312
+ const restoreStats = await agentInstanceManager5.restore();
5313
+ logger.info(`Agent recovery complete: ${restoreStats.restored} threads restored, ${restoreStats.errors} errors`);
5314
+ } catch (error) {
5315
+ logger.error("Agent recovery failed", { error });
5316
+ }
5305
5317
  } catch (err) {
5306
5318
  logger.error("Server start failed", { error: err });
5307
5319
  process.exit(1);