@axiom-lattice/gateway 2.1.113 → 2.1.116

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axiom-lattice/gateway",
3
- "version": "2.1.113",
3
+ "version": "2.1.116",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -41,10 +41,10 @@
41
41
  "redis": "^5.0.1",
42
42
  "uuid": "^9.0.1",
43
43
  "zod": "3.25.76",
44
- "@axiom-lattice/core": "2.1.100",
45
- "@axiom-lattice/pg-stores": "1.0.91",
46
- "@axiom-lattice/protocols": "2.1.51",
47
- "@axiom-lattice/queue-redis": "1.0.50"
44
+ "@axiom-lattice/core": "2.1.102",
45
+ "@axiom-lattice/pg-stores": "1.0.93",
46
+ "@axiom-lattice/protocols": "2.1.53",
47
+ "@axiom-lattice/queue-redis": "1.0.52"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/bcrypt": "^6.0.0",
@@ -271,11 +271,7 @@ export class AuthController {
271
271
  return {
272
272
  success: true,
273
273
  data: {
274
- tenant: {
275
- id: tenant.id,
276
- name: tenant.name,
277
- status: tenant.status,
278
- },
274
+ tenant,
279
275
  token,
280
276
  personalAssistant,
281
277
  },
@@ -48,10 +48,11 @@ export const createRun = async (
48
48
  const x_request_id = (request.headers["x-request-id"] as string) || v4();
49
49
  const user_id = getUserId(request);
50
50
 
51
- // Merge user_id into custom_run_config for downstream propagation
52
- const mergedConfig = user_id
53
- ? { ...custom_run_config, user_id }
54
- : custom_run_config;
51
+ // Merge user_id, project_id, workspace_id into custom_run_config for downstream propagation
52
+ const mergedConfig = {
53
+ ...custom_run_config,
54
+ ...(user_id && { user_id }),
55
+ };
55
56
 
56
57
  // Validate request
57
58
  if (!assistant_id) {
@@ -1,6 +1,6 @@
1
1
  import { FastifyRequest, FastifyReply } from "fastify";
2
2
  import { getStoreLattice } from "@axiom-lattice/core";
3
- import type { TaskStore, TaskItem, CreateTaskRequest, UpdateTaskRequest } from "@axiom-lattice/protocols";
3
+ import type { TaskStore, TaskItem, CreateTaskRequest, UpdateTaskRequest, TaskWorkItemStore } from "@axiom-lattice/protocols";
4
4
 
5
5
  function getTenantId(request: FastifyRequest): string {
6
6
  const userTenantId = (request as any).user?.tenantId;
@@ -36,6 +36,7 @@ export async function listTasks(
36
36
  priority: query.priority,
37
37
  ownerType: query.ownerType as 'user' | 'agent' | undefined,
38
38
  metadata: query.metadata ? JSON.parse(query.metadata) : undefined,
39
+ projectId: query.projectId,
39
40
  limit: query.limit ? parseInt(query.limit) : undefined,
40
41
  offset: query.offset ? parseInt(query.offset) : undefined,
41
42
  });
@@ -185,3 +186,29 @@ export async function completeTask(
185
186
  return reply.status(500).send({ success: false, error: error.message });
186
187
  }
187
188
  }
189
+
190
+ function getTaskWorkItemStore(): TaskWorkItemStore {
191
+ return getStoreLattice("default", "taskWorkItem").store as TaskWorkItemStore;
192
+ }
193
+
194
+ export async function listTaskWorkItems(
195
+ request: FastifyRequest<{
196
+ Params: { id: string };
197
+ Querystring: { action?: string; limit?: number; offset?: number }
198
+ }>,
199
+ reply: FastifyReply
200
+ ) {
201
+ const tenantId = getTenantId(request);
202
+ const { id } = request.params;
203
+ const { action, limit, offset } = request.query;
204
+
205
+ const store = getTaskWorkItemStore();
206
+ const items = await store.list({
207
+ tenantId,
208
+ taskId: id,
209
+ action,
210
+ limit: limit ? Number(limit) : undefined,
211
+ offset: offset ? Number(offset) : undefined
212
+ });
213
+ return reply.send({ success: true, data: items });
214
+ }
@@ -583,7 +583,7 @@ export class WorkspaceController {
583
583
  ) {
584
584
  const tenantId = this.getTenantId(request);
585
585
  const { workspaceId, projectId } = request.params;
586
- const assistantId = (request.query as any).assistantId;
586
+ const assistantId = (request.query as any).assistantId || (request.headers["x-assistant-id"] as string);
587
587
 
588
588
  const workspace = await this.workspaceStore.getWorkspaceById(
589
589
  tenantId,
@@ -635,12 +635,12 @@ export class WorkspaceController {
635
635
  ? path.posix.join(pathValue, filename)
636
636
  : path.posix.join("/project/uploads", filename);
637
637
 
638
- // Try volume backend for text files; binary files must use sandbox
639
- // (volume backend's write API is text-based and corrupts binary data)
640
638
  const isBinary = this.isBinaryContentType(filename);
641
639
  const volumeBackend = await sandboxManager.getVolumeBackendForPath(volumeConfig, realPath);
642
640
  if (volumeBackend && !isBinary) {
643
641
  await volumeBackend.write(realPath, buffer.toString("utf-8"));
642
+ } else if (volumeBackend && volumeBackend.writeBinary) {
643
+ await volumeBackend.writeBinary(realPath, buffer);
644
644
  } else {
645
645
  const sandbox = await sandboxManager.getSandboxFromConfig(volumeConfig);
646
646
  await sandbox.file.uploadFile({ file: realPath, data: buffer });
@@ -184,6 +184,7 @@ export const registerLatticeRoutes = (app: FastifyInstance, channelDeps?: { rout
184
184
  app.put("/api/tasks/:id", tasksController.updateTask);
185
185
  app.delete("/api/tasks/:id", tasksController.deleteTask);
186
186
  app.patch("/api/tasks/:id/complete", tasksController.completeTask);
187
+ app.get("/api/tasks/:id/work-items", tasksController.listTaskWorkItems);
187
188
 
188
189
  // 图表路由
189
190
  app.get<{