@axiom-lattice/gateway 2.1.71 → 2.1.72

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
@@ -1718,6 +1718,7 @@ async function executeSqlQuery(client, body, reply) {
1718
1718
 
1719
1719
  // src/controllers/workflow-tracking.ts
1720
1720
  import { getStoreLattice as getStoreLattice4, agentInstanceManager as agentInstanceManager4 } from "@axiom-lattice/core";
1721
+ import { MessageChunkTypes as MessageChunkTypes2 } from "@axiom-lattice/protocols";
1721
1722
  function getTenantId6(request) {
1722
1723
  const userTenantId = request.user?.tenantId;
1723
1724
  if (userTenantId) return userTenantId;
@@ -2024,34 +2025,38 @@ async function replyInboxTask(request, reply) {
2024
2025
  message: "Workflow run not found"
2025
2026
  });
2026
2027
  }
2028
+ const workspace_id = request.headers["x-workspace-id"];
2029
+ const project_id = request.headers["x-project-id"];
2027
2030
  const agent = agentInstanceManager4.getAgent({
2028
2031
  assistant_id: run.assistantId,
2029
2032
  thread_id: run.threadId,
2030
- tenant_id: tenantId
2033
+ tenant_id: tenantId,
2034
+ workspace_id,
2035
+ project_id
2031
2036
  });
2032
- try {
2033
- const queueStore = agent.getQueueStore?.() || agent.queueStore;
2034
- if (queueStore?.resetProcessingToPending) {
2035
- await queueStore.resetProcessingToPending(run.threadId);
2037
+ agent.addMessage({
2038
+ input: { message: "Clarification answers submitted" },
2039
+ command: {
2040
+ resume: {
2041
+ action: "submit",
2042
+ data: { answers },
2043
+ message: "Clarification answers submitted"
2044
+ }
2036
2045
  }
2037
- await agent.addMessage({
2038
- input: { message: "Clarification answers submitted" },
2039
- command: {
2040
- resume: {
2041
- action: "submit",
2042
- data: { answers },
2043
- message: "Clarification answers submitted"
2044
- }
2046
+ }).then((result) => {
2047
+ const stream = agent.chunkStream(
2048
+ result.messageId,
2049
+ [MessageChunkTypes2.MESSAGE_COMPLETED]
2050
+ );
2051
+ (async () => {
2052
+ for await (const _ of stream) {
2045
2053
  }
2054
+ })().catch((error) => {
2055
+ request.log.error(error, "Background chunk stream error");
2046
2056
  });
2047
- await agent.startQueueProcessorIfNeeded();
2048
- } catch (error) {
2049
- return reply.status(400).send({
2050
- success: false,
2051
- message: "Failed to resume workflow",
2052
- error: error instanceof Error ? error.message : String(error)
2053
- });
2054
- }
2057
+ }).catch((error) => {
2058
+ request.log.error(error, "Background resume failed");
2059
+ });
2055
2060
  return reply.status(200).send({
2056
2061
  success: true,
2057
2062
  message: "Resume request submitted successfully",
@@ -5369,13 +5374,13 @@ function resolveSubjectType(mappingMode, chatType) {
5369
5374
 
5370
5375
  // src/channels/lark/runner.ts
5371
5376
  import { agentInstanceManager as agentInstanceManager6 } from "@axiom-lattice/core";
5372
- import { MessageChunkTypes as MessageChunkTypes3 } from "@axiom-lattice/protocols";
5377
+ import { MessageChunkTypes as MessageChunkTypes4 } from "@axiom-lattice/protocols";
5373
5378
 
5374
5379
  // src/channels/lark/aggregator.ts
5375
- import { MessageChunkTypes as MessageChunkTypes2 } from "@axiom-lattice/protocols";
5380
+ import { MessageChunkTypes as MessageChunkTypes3 } from "@axiom-lattice/protocols";
5376
5381
  function aggregateLarkReply(messageId, chunks) {
5377
5382
  return chunks.filter(
5378
- (chunk) => chunk.type === MessageChunkTypes2.AI && chunk.data.id === messageId
5383
+ (chunk) => chunk.type === MessageChunkTypes3.AI && chunk.data.id === messageId
5379
5384
  ).map((chunk) => chunk.data.content || "").join("").trim();
5380
5385
  }
5381
5386
 
@@ -5395,7 +5400,7 @@ async function runAgentAndCollectLarkReply(input) {
5395
5400
  });
5396
5401
  const chunks = [];
5397
5402
  const stream = agent.chunkStream(result.messageId, [
5398
- MessageChunkTypes3.MESSAGE_COMPLETED
5403
+ MessageChunkTypes4.MESSAGE_COMPLETED
5399
5404
  ]);
5400
5405
  for await (const chunk of stream) {
5401
5406
  chunks.push(chunk);