@axiom-lattice/gateway 2.1.70 → 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,29 +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
- await agent.addMessage({
2034
- input: { message: "Clarification answers submitted" },
2035
- command: {
2036
- resume: {
2037
- action: "submit",
2038
- data: { answers },
2039
- message: "Clarification answers submitted"
2040
- }
2037
+ agent.addMessage({
2038
+ input: { message: "Clarification answers submitted" },
2039
+ command: {
2040
+ resume: {
2041
+ action: "submit",
2042
+ data: { answers },
2043
+ message: "Clarification answers submitted"
2041
2044
  }
2045
+ }
2046
+ }).then((result) => {
2047
+ const stream = agent.chunkStream(
2048
+ result.messageId,
2049
+ [MessageChunkTypes2.MESSAGE_COMPLETED]
2050
+ );
2051
+ (async () => {
2052
+ for await (const _ of stream) {
2053
+ }
2054
+ })().catch((error) => {
2055
+ request.log.error(error, "Background chunk stream error");
2042
2056
  });
2043
- } catch (error) {
2044
- return reply.status(400).send({
2045
- success: false,
2046
- message: "Failed to resume workflow",
2047
- error: error instanceof Error ? error.message : String(error)
2048
- });
2049
- }
2057
+ }).catch((error) => {
2058
+ request.log.error(error, "Background resume failed");
2059
+ });
2050
2060
  return reply.status(200).send({
2051
2061
  success: true,
2052
2062
  message: "Resume request submitted successfully",
@@ -5364,13 +5374,13 @@ function resolveSubjectType(mappingMode, chatType) {
5364
5374
 
5365
5375
  // src/channels/lark/runner.ts
5366
5376
  import { agentInstanceManager as agentInstanceManager6 } from "@axiom-lattice/core";
5367
- import { MessageChunkTypes as MessageChunkTypes3 } from "@axiom-lattice/protocols";
5377
+ import { MessageChunkTypes as MessageChunkTypes4 } from "@axiom-lattice/protocols";
5368
5378
 
5369
5379
  // src/channels/lark/aggregator.ts
5370
- import { MessageChunkTypes as MessageChunkTypes2 } from "@axiom-lattice/protocols";
5380
+ import { MessageChunkTypes as MessageChunkTypes3 } from "@axiom-lattice/protocols";
5371
5381
  function aggregateLarkReply(messageId, chunks) {
5372
5382
  return chunks.filter(
5373
- (chunk) => chunk.type === MessageChunkTypes2.AI && chunk.data.id === messageId
5383
+ (chunk) => chunk.type === MessageChunkTypes3.AI && chunk.data.id === messageId
5374
5384
  ).map((chunk) => chunk.data.content || "").join("").trim();
5375
5385
  }
5376
5386
 
@@ -5390,7 +5400,7 @@ async function runAgentAndCollectLarkReply(input) {
5390
5400
  });
5391
5401
  const chunks = [];
5392
5402
  const stream = agent.chunkStream(result.messageId, [
5393
- MessageChunkTypes3.MESSAGE_COMPLETED
5403
+ MessageChunkTypes4.MESSAGE_COMPLETED
5394
5404
  ]);
5395
5405
  for await (const chunk of stream) {
5396
5406
  chunks.push(chunk);