@axiom-lattice/gateway 2.1.24 → 2.1.26

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.24 build /home/runner/work/agentic/agentic/packages/gateway
2
+ > @axiom-lattice/gateway@2.1.26 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 83.88 KB
13
- ESM dist/index.mjs.map 200.51 KB
14
- ESM ⚡️ Build success in 157ms
15
- CJS dist/index.js 86.51 KB
16
- CJS dist/index.js.map 200.54 KB
17
- CJS ⚡️ Build success in 159ms
12
+ CJS dist/index.js 86.95 KB
13
+ CJS dist/index.js.map 201.27 KB
14
+ CJS ⚡️ Build success in 210ms
15
+ ESM dist/index.mjs 84.32 KB
16
+ ESM dist/index.mjs.map 201.30 KB
17
+ ESM ⚡️ Build success in 212ms
18
18
  DTS Build start
19
- DTS ⚡️ Build success in 9870ms
19
+ DTS ⚡️ Build success in 9339ms
20
20
  DTS dist/index.d.ts 3.72 KB
21
21
  DTS dist/index.d.mts 3.72 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @axiom-lattice/gateway
2
2
 
3
+ ## 2.1.26
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [67461e9]
8
+ - @axiom-lattice/core@2.1.21
9
+
10
+ ## 2.1.25
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [2b69e6d]
15
+ - @axiom-lattice/protocols@2.1.12
16
+ - @axiom-lattice/core@2.1.20
17
+ - @axiom-lattice/queue-redis@1.0.11
18
+
3
19
  ## 2.1.24
4
20
 
5
21
  ### Patch Changes
package/dist/index.js CHANGED
@@ -334,75 +334,80 @@ async function getAssistant(request, reply) {
334
334
  data: assistant
335
335
  };
336
336
  }
337
+ async function upsertAssistant(id, data, reply, requireFields = false) {
338
+ const storeLattice = (0, import_core2.getStoreLattice)("default", "assistant");
339
+ const assistantStore = storeLattice.store;
340
+ const exists = await assistantStore.hasAssistant(id);
341
+ let assistant;
342
+ if (exists) {
343
+ assistant = await assistantStore.updateAssistant(id, data);
344
+ if (!assistant) {
345
+ return reply.status(500).send({
346
+ success: false,
347
+ message: "Failed to update assistant"
348
+ });
349
+ }
350
+ import_core3.eventBus.publish("assistant:updated", { id: assistant.id, name: assistant.name });
351
+ return {
352
+ success: true,
353
+ message: "Updated assistant",
354
+ data: assistant
355
+ };
356
+ }
357
+ if (requireFields) {
358
+ const createData = data;
359
+ if (!createData.name || !createData.graphDefinition) {
360
+ return reply.status(400).send({
361
+ success: false,
362
+ message: "name and graphDefinition are required"
363
+ });
364
+ }
365
+ }
366
+ assistant = await assistantStore.createAssistant(id, data);
367
+ import_core3.eventBus.publish("assistant:created", { id: assistant.id, name: assistant.name });
368
+ return reply.status(201).send({
369
+ success: true,
370
+ message: "Created assistant",
371
+ data: assistant
372
+ });
373
+ }
337
374
  async function createAssistant(request, reply) {
338
375
  const data = request.body;
339
- if (!data.name) {
376
+ if (!data.name || !data.graphDefinition) {
340
377
  return reply.status(400).send({
341
378
  success: false,
342
- message: "name is required"
379
+ message: "name and graphDefinition are required"
343
380
  });
344
381
  }
345
- if (!data.graphDefinition) {
346
- return reply.status(400).send({
347
- success: false,
348
- message: "graphDefinition is required"
349
- });
350
- }
351
- const id = (0, import_crypto.randomUUID)();
352
- const storeLattice = (0, import_core2.getStoreLattice)("default", "assistant");
353
- const assistantStore = storeLattice.store;
354
- const newAssistant = await assistantStore.createAssistant(id, data);
355
- return reply.status(201).send({
356
- success: true,
357
- message: "Successfully created assistant",
358
- data: newAssistant
359
- });
382
+ const id = data.id ?? (0, import_crypto.randomUUID)();
383
+ return upsertAssistant(id, data, reply, true);
360
384
  }
361
385
  async function updateAssistant(request, reply) {
362
386
  const { id } = request.params;
363
387
  const updates = request.body;
364
- const agentConfigs = await (0, import_core3.getAllAgentConfigs)();
365
- const isCodeConfigured = agentConfigs.some((config) => config.key === id);
366
- if (isCodeConfigured) {
367
- return reply.status(403).send({
368
- success: false,
369
- message: "Cannot update code-configured assistant. Only stored assistants can be updated."
370
- });
371
- }
372
- const storeLattice = (0, import_core2.getStoreLattice)("default", "assistant");
373
- const assistantStore = storeLattice.store;
374
- const exists = await assistantStore.hasAssistant(id);
375
- if (!exists) {
376
- return reply.status(404).send({
377
- success: false,
378
- message: "Assistant not found"
379
- });
380
- }
381
- const updatedAssistant = await assistantStore.updateAssistant(id, updates);
382
- if (!updatedAssistant) {
383
- return reply.status(500).send({
384
- success: false,
385
- message: "Failed to update assistant"
386
- });
387
- }
388
- return {
389
- success: true,
390
- message: "Successfully updated assistant",
391
- data: updatedAssistant
392
- };
388
+ return upsertAssistant(id, updates, reply, false);
393
389
  }
394
390
  async function deleteAssistant(request, reply) {
395
391
  const { id } = request.params;
392
+ const storeLattice = (0, import_core2.getStoreLattice)("default", "assistant");
393
+ const assistantStore = storeLattice.store;
396
394
  const agentConfigs = await (0, import_core3.getAllAgentConfigs)();
397
395
  const isCodeConfigured = agentConfigs.some((config) => config.key === id);
398
396
  if (isCodeConfigured) {
399
- return reply.status(403).send({
400
- success: false,
401
- message: "Cannot delete code-configured assistant. Only stored assistants can be deleted."
402
- });
397
+ const exists2 = await assistantStore.hasAssistant(id);
398
+ if (!exists2) {
399
+ return reply.status(404).send({
400
+ success: false,
401
+ message: "Assistant not found (code-configured assistants cannot be deleted from code, only from store)"
402
+ });
403
+ }
404
+ await assistantStore.deleteAssistant(id);
405
+ import_core3.eventBus.publish("assistant:deleted", { id });
406
+ return {
407
+ success: true,
408
+ message: "Deleted assistant from store (code-configured registration remains)"
409
+ };
403
410
  }
404
- const storeLattice = (0, import_core2.getStoreLattice)("default", "assistant");
405
- const assistantStore = storeLattice.store;
406
411
  const exists = await assistantStore.hasAssistant(id);
407
412
  if (!exists) {
408
413
  return reply.status(404).send({
@@ -417,6 +422,7 @@ async function deleteAssistant(request, reply) {
417
422
  message: "Failed to delete assistant"
418
423
  });
419
424
  }
425
+ import_core3.eventBus.publish("assistant:deleted", { id });
420
426
  return {
421
427
  success: true,
422
428
  message: "Successfully deleted assistant"
@@ -2124,13 +2130,17 @@ var ERROR_HTML = `<!DOCTYPE html>
2124
2130
  </body>
2125
2131
  </html>`;
2126
2132
  var SandboxService = class {
2127
- getSandboxConfig(assistantId) {
2133
+ getFilesystemIsolatedLevel(assistantId) {
2128
2134
  const agentConfig = (0, import_core12.getAgentConfig)(assistantId);
2129
2135
  if (!agentConfig) {
2130
2136
  return null;
2131
2137
  }
2132
2138
  const agentLattice = (0, import_core12.getAgentLattice)(assistantId);
2133
- return agentLattice?.config?.connectedSandbox || null;
2139
+ const filesystemConfig = agentLattice?.config?.middleware?.find((m) => m.type === "filesystem");
2140
+ if (!filesystemConfig) {
2141
+ return null;
2142
+ }
2143
+ return filesystemConfig.config?.isolatedLevel || null;
2134
2144
  }
2135
2145
  computeSandboxName(assistantId, threadId, isolatedLevel) {
2136
2146
  let sandboxName;
@@ -2226,11 +2236,10 @@ function registerSandboxProxyRoutes(app2) {
2226
2236
  async (request, reply) => {
2227
2237
  console.log("[Sandbox Upload] Route matched:", request.url);
2228
2238
  const { assistantId, threadId } = request.params;
2229
- const sandboxConfig = sandboxService.getSandboxConfig(assistantId);
2230
- if (!sandboxConfig) {
2239
+ const isolatedLevel = sandboxService.getFilesystemIsolatedLevel(assistantId);
2240
+ if (!isolatedLevel) {
2231
2241
  return reply.status(500).send({ error: "Assistant sandbox config not found" });
2232
2242
  }
2233
- const { isolatedLevel } = sandboxConfig;
2234
2243
  const sandboxName = sandboxService.computeSandboxName(
2235
2244
  assistantId,
2236
2245
  threadId,
@@ -2273,11 +2282,10 @@ function registerSandboxProxyRoutes(app2) {
2273
2282
  if (!filePath || typeof filePath !== "string") {
2274
2283
  return reply.status(400).send({ error: "Query parameter 'path' is required" });
2275
2284
  }
2276
- const sandboxConfig = sandboxService.getSandboxConfig(assistantId);
2277
- if (!sandboxConfig) {
2278
- return reply.status(404).send({ error: "Assistant sandbox config not found" });
2285
+ const isolatedLevel = sandboxService.getFilesystemIsolatedLevel(assistantId);
2286
+ if (!isolatedLevel) {
2287
+ return reply.status(500).send({ error: "Assistant filesystem isolated level not found" });
2279
2288
  }
2280
- const { isolatedLevel } = sandboxConfig;
2281
2289
  const sandboxName = sandboxService.computeSandboxName(
2282
2290
  assistantId,
2283
2291
  threadId,