@axiom-lattice/gateway 2.1.24 → 2.1.25
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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +9 -0
- package/dist/index.js +69 -61
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +76 -68
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/controllers/assistant.ts +77 -77
- package/src/controllers/sandbox.ts +5 -7
- package/src/services/sandbox_service.ts +8 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @axiom-lattice/gateway@2.1.
|
|
2
|
+
> @axiom-lattice/gateway@2.1.25 build /home/runner/work/agentic/agentic/packages/gateway
|
|
3
3
|
> tsup src/index.ts --format cjs,esm --dts --clean --sourcemap
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
[34mCLI[39m Cleaning output folder
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
12
|
+
[32mCJS[39m [1mdist/index.js [22m[32m86.95 KB[39m
|
|
13
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m201.27 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 175ms
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m84.32 KB[39m
|
|
16
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m201.30 KB[39m
|
|
17
|
+
[32mESM[39m ⚡️ Build success in 176ms
|
|
18
18
|
[34mDTS[39m Build start
|
|
19
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
+
[32mDTS[39m ⚡️ Build success in 9121ms
|
|
20
20
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.72 KB[39m
|
|
21
21
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m3.72 KB[39m
|
package/CHANGELOG.md
CHANGED
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
|
|
379
|
+
message: "name and graphDefinition are required"
|
|
343
380
|
});
|
|
344
381
|
}
|
|
345
|
-
|
|
346
|
-
|
|
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
|
-
|
|
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
|
-
|
|
400
|
-
|
|
401
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
2230
|
-
if (!
|
|
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
|
|
2277
|
-
if (!
|
|
2278
|
-
return reply.status(
|
|
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,
|