@axiom-lattice/gateway 2.1.50 → 2.1.52

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.50 build /home/runner/work/agentic/agentic/packages/gateway
2
+ > @axiom-lattice/gateway@2.1.52 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
@@ -9,13 +9,13 @@
9
9
  CLI Cleaning output folder
10
10
  CJS Build start
11
11
  ESM Build start
12
- ESM dist/index.mjs 168.83 KB
13
- ESM dist/index.mjs.map 367.69 KB
14
- ESM ⚡️ Build success in 298ms
15
- CJS dist/index.js 172.24 KB
16
- CJS dist/index.js.map 367.18 KB
17
- CJS ⚡️ Build success in 321ms
12
+ CJS dist/index.js 173.70 KB
13
+ CJS dist/index.js.map 370.35 KB
14
+ CJS ⚡️ Build success in 293ms
15
+ ESM dist/index.mjs 170.28 KB
16
+ ESM dist/index.mjs.map 370.85 KB
17
+ ESM ⚡️ Build success in 293ms
18
18
  DTS Build start
19
- DTS ⚡️ Build success in 8843ms
19
+ DTS ⚡️ Build success in 9179ms
20
20
  DTS dist/index.d.ts 3.76 KB
21
21
  DTS dist/index.d.mts 3.76 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @axiom-lattice/gateway
2
2
 
3
+ ## 2.1.52
4
+
5
+ ### Patch Changes
6
+
7
+ - a8ee103: enhance agent
8
+ - Updated dependencies [a8ee103]
9
+ - @axiom-lattice/protocols@2.1.24
10
+ - @axiom-lattice/core@2.1.46
11
+ - @axiom-lattice/pg-stores@1.0.36
12
+ - @axiom-lattice/queue-redis@1.0.23
13
+
14
+ ## 2.1.51
15
+
16
+ ### Patch Changes
17
+
18
+ - 4c4ca60: fix subagent state issue
19
+ - Updated dependencies [4c4ca60]
20
+ - @axiom-lattice/pg-stores@1.0.35
21
+ - @axiom-lattice/core@2.1.45
22
+
3
23
  ## 2.1.50
4
24
 
5
25
  ### Patch Changes
package/dist/index.js CHANGED
@@ -379,6 +379,31 @@ var resumeStream = async (request, reply) => {
379
379
  });
380
380
  }
381
381
  };
382
+ var abortRun = async (request, reply) => {
383
+ try {
384
+ const { assistantId, threadId } = request.params;
385
+ const tenant_id = request.headers["x-tenant-id"];
386
+ const workspace_id = request.headers["x-workspace-id"] || "default";
387
+ const project_id = request.headers["x-project-id"] || "default";
388
+ const agent = import_core3.agentInstanceManager.getAgent({
389
+ assistant_id: assistantId,
390
+ thread_id: threadId,
391
+ tenant_id,
392
+ workspace_id,
393
+ project_id
394
+ });
395
+ await agent.abort();
396
+ reply.status(200).send({
397
+ success: true,
398
+ message: "Agent aborted"
399
+ });
400
+ } catch (error) {
401
+ reply.status(500).send({
402
+ success: false,
403
+ error: `Abort failed: ${error.message}`
404
+ });
405
+ }
406
+ };
382
407
 
383
408
  // src/controllers/memory.ts
384
409
  var import_core4 = require("@axiom-lattice/core");
@@ -597,9 +622,20 @@ function getTenantId2(request) {
597
622
  async function getThreadList(request, reply) {
598
623
  const tenantId = getTenantId2(request);
599
624
  const { assistantId } = request.params;
625
+ const metadataFilter = {};
626
+ if (request.query.workspaceId) {
627
+ metadataFilter.workspaceId = request.query.workspaceId;
628
+ }
629
+ if (request.query.projectId) {
630
+ metadataFilter.projectId = request.query.projectId;
631
+ }
600
632
  const storeLattice = (0, import_core6.getStoreLattice)("default", "thread");
601
633
  const threadStore = storeLattice.store;
602
- const threads = await threadStore.getThreadsByAssistantId(tenantId, assistantId);
634
+ const threads = await threadStore.getThreadsByAssistantId(
635
+ tenantId,
636
+ assistantId,
637
+ Object.keys(metadataFilter).length > 0 ? metadataFilter : void 0
638
+ );
603
639
  return {
604
640
  success: true,
605
641
  message: "Successfully retrieved thread list",
@@ -632,9 +668,23 @@ async function createThread(request, reply) {
632
668
  const { assistantId } = request.params;
633
669
  const data = request.body;
634
670
  const threadId = (0, import_crypto2.randomUUID)();
671
+ const workspaceId = request.headers["x-workspace-id"];
672
+ const projectId = request.headers["x-project-id"];
673
+ const enrichedMetadata = {
674
+ ...data.metadata,
675
+ tenantId
676
+ };
677
+ if (workspaceId) {
678
+ enrichedMetadata.workspaceId = workspaceId;
679
+ }
680
+ if (projectId) {
681
+ enrichedMetadata.projectId = projectId;
682
+ }
635
683
  const storeLattice = (0, import_core6.getStoreLattice)("default", "thread");
636
684
  const threadStore = storeLattice.store;
637
- const newThread = await threadStore.createThread(tenantId, assistantId, threadId, data);
685
+ const newThread = await threadStore.createThread(tenantId, assistantId, threadId, {
686
+ metadata: enrichedMetadata
687
+ });
638
688
  return reply.status(201).send({
639
689
  success: true,
640
690
  message: "Successfully created thread",
@@ -4846,6 +4896,7 @@ function registerAuthRoutes(app2, config) {
4846
4896
  var registerLatticeRoutes = (app2) => {
4847
4897
  app2.post("/api/runs", createRun);
4848
4898
  app2.post("/api/resume_stream", resumeStream);
4899
+ app2.post("/api/assistants/:assistantId/threads/:threadId/abort", abortRun);
4849
4900
  app2.get(
4850
4901
  "/api/assistants/:assistantId/:thread_id/memory",
4851
4902
  { schema: getAllMemoryItemsSchema },
@@ -5061,7 +5112,7 @@ var handleAgentTask = async (taskRequest, retryCount = 0) => {
5061
5112
  `\u5F00\u59CB\u5904\u7406\u4EFB\u52A1 [assistant_id: ${assistant_id}, thread_id: ${thread_id}]`
5062
5113
  );
5063
5114
  const agent = import_core26.agentInstanceManager.getAgent({ assistant_id, thread_id, tenant_id, workspace_id: runConfig?.workspaceId, project_id: runConfig?.projectId, custom_run_config: runConfig });
5064
- await agent.addMessage({ input, command }, import_core26.QueueMode.STEER);
5115
+ await agent.addMessage({ input, command, custom_run_config: runConfig }, import_core26.QueueMode.STEER);
5065
5116
  if (callback_event) {
5066
5117
  agent.subscribeOnce("message:completed", (evt) => {
5067
5118
  import_core26.eventBus.publish(callback_event, {