@axiom-lattice/gateway 2.1.77 → 2.1.78

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @axiom-lattice/gateway@2.1.77 build /home/runner/work/agentic/agentic/packages/gateway
2
+ > @axiom-lattice/gateway@2.1.78 build /home/runner/work/agentic/agentic/packages/gateway
3
3
  > tsup src/index.ts --format cjs,esm --dts --clean --sourcemap
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -18,15 +18,15 @@
18
18
  You need to set the output format to "esm" for "import.meta" to work correctly.
19
19
 
20
20
 
21
- CJS dist/index.js 236.85 KB
22
- CJS dist/index.js.map 498.40 KB
23
- CJS ⚡️ Build success in 395ms
21
+ CJS dist/index.js 238.86 KB
22
+ CJS dist/index.js.map 502.08 KB
23
+ CJS ⚡️ Build success in 404ms
24
+ ESM dist/index.mjs 234.16 KB
24
25
  ESM dist/sender-PX32VSHB.mjs 873.00 B
25
- ESM dist/index.mjs 232.14 KB
26
+ ESM dist/index.mjs.map 500.57 KB
26
27
  ESM dist/sender-PX32VSHB.mjs.map 2.07 KB
27
- ESM dist/index.mjs.map 496.86 KB
28
- ESM ⚡️ Build success in 397ms
28
+ ESM ⚡️ Build success in 407ms
29
29
  DTS Build start
30
- DTS ⚡️ Build success in 13178ms
30
+ DTS ⚡️ Build success in 13939ms
31
31
  DTS dist/index.d.ts 5.01 KB
32
32
  DTS dist/index.d.mts 5.01 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @axiom-lattice/gateway
2
2
 
3
+ ## 2.1.78
4
+
5
+ ### Patch Changes
6
+
7
+ - 6446394: up workflow
8
+ - Updated dependencies [6446394]
9
+ - @axiom-lattice/pg-stores@1.0.58
10
+ - @axiom-lattice/protocols@2.1.35
11
+ - @axiom-lattice/core@2.1.68
12
+ - @axiom-lattice/agent-eval@2.1.62
13
+ - @axiom-lattice/queue-redis@1.0.34
14
+
3
15
  ## 2.1.77
4
16
 
5
17
  ### Patch Changes
package/dist/index.js CHANGED
@@ -2029,6 +2029,41 @@ async function getWorkflowRun(request, reply) {
2029
2029
  return reply.status(500).send({ success: false, message: "Failed to retrieve workflow run" });
2030
2030
  }
2031
2031
  }
2032
+ async function deleteWorkflowRun(request, reply) {
2033
+ const { runId } = request.params;
2034
+ const tenantId = getTenantId6(request);
2035
+ try {
2036
+ const store = getTrackingStore();
2037
+ if (!store) {
2038
+ return reply.status(404).send({ success: false, message: "No workflow tracking store configured" });
2039
+ }
2040
+ const run = await store.getWorkflowRun(runId);
2041
+ if (!run) {
2042
+ return reply.status(404).send({ success: false, message: "Workflow run not found" });
2043
+ }
2044
+ if (run.status === "running") {
2045
+ try {
2046
+ const workspace_id = request.headers["x-workspace-id"];
2047
+ const project_id = request.headers["x-project-id"];
2048
+ const agent = import_core13.agentInstanceManager.getAgent({
2049
+ assistant_id: run.assistantId,
2050
+ thread_id: run.threadId,
2051
+ tenant_id: tenantId,
2052
+ workspace_id,
2053
+ project_id
2054
+ });
2055
+ await agent.abort();
2056
+ } catch (err) {
2057
+ request.log.warn({ runId, error: err.message }, "Failed to abort agent, deleting tracking records anyway");
2058
+ }
2059
+ }
2060
+ await store.deleteWorkflowRun(runId);
2061
+ return { success: true, message: "Workflow run deleted" };
2062
+ } catch (error) {
2063
+ request.log.error(error, "Failed to delete workflow run");
2064
+ return reply.status(500).send({ success: false, message: "Failed to delete workflow run" });
2065
+ }
2066
+ }
2032
2067
  async function getRunSteps(request, reply) {
2033
2068
  const { runId } = request.params;
2034
2069
  const { step_type, status: stepStatus } = request.query;
@@ -2101,6 +2136,14 @@ async function replyInboxTask(request, reply) {
2101
2136
  workspace_id,
2102
2137
  project_id
2103
2138
  });
2139
+ const runStatus = await agent.getRunStatus();
2140
+ if (runStatus !== import_core13.ThreadStatus.INTERRUPTED) {
2141
+ return reply.status(409).send({
2142
+ success: false,
2143
+ message: `Cannot resume: graph is not interrupted (current status: ${runStatus})`,
2144
+ data: { runId: run.id, assistantId: run.assistantId, threadId: run.threadId, status: runStatus }
2145
+ });
2146
+ }
2104
2147
  agent.addMessage({
2105
2148
  input: { message: "Clarification answers submitted" },
2106
2149
  command: {
@@ -6579,7 +6622,7 @@ var registerLatticeRoutes = (app2, channelDeps) => {
6579
6622
  const inboundMessage = {
6580
6623
  channel: msg.channel,
6581
6624
  channelInstallationId: msg.channelInstallationId || "",
6582
- tenantId: msg.tenantId || "default",
6625
+ tenantId: msg.tenantId,
6583
6626
  sender: {
6584
6627
  id: msg.sender.id,
6585
6628
  displayName: msg.sender.displayName
@@ -6620,6 +6663,7 @@ var registerLatticeRoutes = (app2, channelDeps) => {
6620
6663
  getWorkflowRuns
6621
6664
  );
6622
6665
  app2.get("/api/workflows/runs/:runId", getWorkflowRun);
6666
+ app2.delete("/api/workflows/runs/:runId", deleteWorkflowRun);
6623
6667
  app2.get("/api/workflows/runs/:runId/steps", getRunSteps);
6624
6668
  app2.get("/api/workflows/runs/:runId/tasks", getRunTasks);
6625
6669
  app2.post("/api/workflows/inbox/reply", replyInboxTask);
@@ -6655,11 +6699,17 @@ var MessageRouter = class {
6655
6699
  };
6656
6700
  try {
6657
6701
  await this.runMiddlewares(ctx, async () => {
6702
+ const tenantId = message.tenantId || (await this.installationStore.getInstallationById(message.channelInstallationId))?.tenantId;
6703
+ if (!tenantId) {
6704
+ throw new Error(
6705
+ "tenantId is required: provide it in the message or ensure the channelInstallation has a tenantId"
6706
+ );
6707
+ }
6658
6708
  let binding = await this.bindingRegistry.resolve({
6659
6709
  channel: message.channel,
6660
6710
  senderId: message.sender.id,
6661
6711
  channelInstallationId: message.channelInstallationId,
6662
- tenantId: message.tenantId
6712
+ tenantId
6663
6713
  });
6664
6714
  if (!binding) {
6665
6715
  const installation = await this.installationStore.getInstallationById(
@@ -6675,7 +6725,7 @@ var MessageRouter = class {
6675
6725
  id: "fallback",
6676
6726
  channel: message.channel,
6677
6727
  channelInstallationId: message.channelInstallationId,
6678
- tenantId: message.tenantId,
6728
+ tenantId,
6679
6729
  senderId: message.sender.id,
6680
6730
  agentId: installation.fallbackAgentId,
6681
6731
  threadId: void 0,
@@ -6701,7 +6751,7 @@ var MessageRouter = class {
6701
6751
  const threadStore = (0, import_core28.getStoreLattice)("default", "thread").store;
6702
6752
  const newThreadId = (0, import_crypto8.randomUUID)();
6703
6753
  const newThread = await threadStore.createThread(
6704
- message.tenantId,
6754
+ tenantId,
6705
6755
  ctx.binding.agentId,
6706
6756
  newThreadId,
6707
6757
  {
@@ -6722,7 +6772,7 @@ var MessageRouter = class {
6722
6772
  }
6723
6773
  }
6724
6774
  const agent = import_core28.agentInstanceManager.getAgent({
6725
- tenant_id: message.tenantId,
6775
+ tenant_id: tenantId,
6726
6776
  assistant_id: ctx.binding.agentId,
6727
6777
  thread_id: threadId,
6728
6778
  workspace_id: ctx.binding.workspaceId || "",