@axiom-lattice/gateway 10.2.1 → 10.2.2

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/dist/index.mjs CHANGED
@@ -35,7 +35,7 @@ import {
35
35
  setRunTaskWakePublisher,
36
36
  setRunTaskWakeStatsSource,
37
37
  wakeRunTaskQueue
38
- } from "./chunk-67CDUQM3.mjs";
38
+ } from "./chunk-JNP5T5N4.mjs";
39
39
  import {
40
40
  claimDedupKey,
41
41
  createRateLimitService,
@@ -10524,7 +10524,7 @@ var SandboxService = class {
10524
10524
  var sandboxService = new SandboxService();
10525
10525
 
10526
10526
  // src/controllers/sandbox.ts
10527
- import { getSandBoxManager as getSandBoxManager2 } from "@axiom-lattice/core";
10527
+ import { getSandBoxManager as getSandBoxManager2, resolveSandboxAgentsPathAlias } from "@axiom-lattice/core";
10528
10528
  function registerSandboxProxyRoutes(app2) {
10529
10529
  app2.post(
10530
10530
  "/api/assistants/:assistantId/threads/:threadId/sandbox/uploadfile",
@@ -10596,7 +10596,8 @@ function registerSandboxProxyRoutes(app2) {
10596
10596
  vmIsolation
10597
10597
  });
10598
10598
  try {
10599
- const resolvedPath = filePath.startsWith("/") ? filePath : `/${filePath}`;
10599
+ const aliasedPath = resolveSandboxAgentsPathAlias(filePath);
10600
+ const resolvedPath = aliasedPath.startsWith("/") ? aliasedPath : `/${aliasedPath}`;
10600
10601
  const filename = getFilenameFromPath(resolvedPath);
10601
10602
  const inferredContentType = getContentTypeFromFilename(filename);
10602
10603
  try {
@@ -10624,7 +10625,7 @@ import { constants as fsConstants } from "fs";
10624
10625
  import * as os2 from "os";
10625
10626
  import { getStoreLattice as getStoreLattice16 } from "@axiom-lattice/core";
10626
10627
  import { SandboxFilesystem, FilesystemBackend } from "@axiom-lattice/core";
10627
- import { getSandBoxManager as getSandBoxManager3 } from "@axiom-lattice/core";
10628
+ import { getSandBoxManager as getSandBoxManager3, resolveSandboxAgentsPathAlias as resolveSandboxAgentsPathAlias2 } from "@axiom-lattice/core";
10628
10629
  import { v4 as uuidv4 } from "uuid";
10629
10630
 
10630
10631
  // src/services/collaboration/RoomCoordinatorProvisioner.ts
@@ -11353,7 +11354,10 @@ var WorkspaceController = class {
11353
11354
  if (!workspace) {
11354
11355
  throw new Error("Workspace not found");
11355
11356
  }
11356
- console.log(`[getBackend] storageType=${workspace.storageType} filePath=${filePath}`);
11357
+ const resolvedPath = filePath !== void 0 && workspace.storageType === "sandbox" ? resolveSandboxAgentsPathAlias2(filePath) : filePath;
11358
+ console.log(
11359
+ `[getBackend] storageType=${workspace.storageType} filePath=${filePath} resolvedPath=${resolvedPath}`
11360
+ );
11357
11361
  if (workspace.storageType === "sandbox") {
11358
11362
  const sandboxManager = getSandBoxManager3();
11359
11363
  const volumeConfig = {
@@ -11363,11 +11367,11 @@ var WorkspaceController = class {
11363
11367
  workspaceId,
11364
11368
  projectId
11365
11369
  };
11366
- console.log(`[getBackend] trying volume backend for path=${filePath} assistant_id=${assistantId}`);
11367
- const volumeBackend = await sandboxManager.getVolumeBackendForPath(volumeConfig, filePath || "/project");
11370
+ console.log(`[getBackend] trying volume backend for path=${resolvedPath} assistant_id=${assistantId}`);
11371
+ const volumeBackend = await sandboxManager.getVolumeBackendForPath(volumeConfig, resolvedPath || "/project");
11368
11372
  if (volumeBackend) {
11369
11373
  console.log(`[getBackend] using VolumeFilesystem`);
11370
- return { backend: volumeBackend, workspace };
11374
+ return { backend: volumeBackend, workspace, resolvedPath };
11371
11375
  }
11372
11376
  console.log(`[getBackend] volume not found, falling back to SandboxFilesystem`);
11373
11377
  const sandbox = await sandboxManager.getSandboxFromConfig(volumeConfig);
@@ -11376,7 +11380,8 @@ var WorkspaceController = class {
11376
11380
  backend: new SandboxFilesystem({
11377
11381
  sandboxInstance: sandbox
11378
11382
  }),
11379
- workspace
11383
+ workspace,
11384
+ resolvedPath
11380
11385
  };
11381
11386
  }
11382
11387
  const rootDir = filesystemRootDirectory(
@@ -11390,7 +11395,8 @@ var WorkspaceController = class {
11390
11395
  rootDir,
11391
11396
  virtualMode: true
11392
11397
  }),
11393
- workspace
11398
+ workspace,
11399
+ resolvedPath
11394
11400
  };
11395
11401
  }
11396
11402
  async downloadFile(request, reply) {
@@ -11402,8 +11408,14 @@ var WorkspaceController = class {
11402
11408
  return reply.status(400).send({ success: false, error: "Path is required" });
11403
11409
  }
11404
11410
  try {
11405
- const { workspace } = await this.getBackend(tenantId, workspaceId, projectId, assistantId);
11406
- const resolvedPath = filePath;
11411
+ const { workspace, resolvedPath: aliasedPath } = await this.getBackend(
11412
+ tenantId,
11413
+ workspaceId,
11414
+ projectId,
11415
+ assistantId,
11416
+ filePath
11417
+ );
11418
+ const resolvedPath = aliasedPath ?? filePath;
11407
11419
  if (workspace.storageType === "sandbox") {
11408
11420
  const sandboxManager = getSandBoxManager3();
11409
11421
  const volumeConfig = {
@@ -11465,6 +11477,7 @@ var WorkspaceController = class {
11465
11477
  if (!project || project.workspaceId !== workspaceId) {
11466
11478
  throw new FolderDownloadError(404, "PROJECT_NOT_FOUND", "Project not found");
11467
11479
  }
11480
+ const resolvedFolderPath = storedWorkspace.storageType === "sandbox" ? resolveSandboxAgentsPathAlias2(folderPath) : folderPath;
11468
11481
  if (storedWorkspace.storageType === "sandbox") {
11469
11482
  const sandboxManager = getSandBoxManager3();
11470
11483
  const volumeConfig = {
@@ -11480,7 +11493,7 @@ var WorkspaceController = class {
11480
11493
  }
11481
11494
  let packed;
11482
11495
  try {
11483
- packed = await sandbox.packDirectory(folderPath);
11496
+ packed = await sandbox.packDirectory(resolvedFolderPath);
11484
11497
  if (packed.size === void 0) {
11485
11498
  throw new FolderDownloadError(502, "BACKEND_UNSUPPORTED", "Backend does not report packed archive size");
11486
11499
  }
@@ -11504,7 +11517,7 @@ var WorkspaceController = class {
11504
11517
  workspaceId,
11505
11518
  projectId,
11506
11519
  assistantId,
11507
- folderPath
11520
+ resolvedFolderPath
11508
11521
  );
11509
11522
  if (!backend.lsInfo) {
11510
11523
  throw new FolderDownloadError(502, "BACKEND_UNSUPPORTED", "Backend does not support folder downloads");
@@ -11512,7 +11525,7 @@ var WorkspaceController = class {
11512
11525
  let listEntries2;
11513
11526
  if (workspace.storageType !== "sandbox") {
11514
11527
  const root = filesystemRootDirectory(tenantId, workspaceId, projectId);
11515
- const target = path2.resolve(root, `.${folderPath.startsWith("/") ? folderPath : `/${folderPath}`}`);
11528
+ const target = path2.resolve(root, `.${resolvedFolderPath.startsWith("/") ? resolvedFolderPath : `/${resolvedFolderPath}`}`);
11516
11529
  const contained = await resolvePathWithinRoot(root, target).catch((error) => {
11517
11530
  if (error instanceof Error && error.code === "ENOENT") {
11518
11531
  throw new FolderDownloadError(404, "FOLDER_NOT_FOUND", "Folder not found");
@@ -11531,7 +11544,7 @@ var WorkspaceController = class {
11531
11544
  if (!stat2.isDirectory()) {
11532
11545
  throw new FolderDownloadError(400, "NOT_A_FOLDER", "Path is not a folder");
11533
11546
  }
11534
- } else if (folderPath) {
11547
+ } else if (resolvedFolderPath) {
11535
11548
  const sandboxManager = getSandBoxManager3();
11536
11549
  const volumeConfig = {
11537
11550
  assistant_id: assistantId || "",
@@ -11540,11 +11553,11 @@ var WorkspaceController = class {
11540
11553
  workspaceId,
11541
11554
  projectId
11542
11555
  };
11543
- const volume = await sandboxManager.getVolumeBackendForPath(volumeConfig, folderPath);
11556
+ const volume = await sandboxManager.getVolumeBackendForPath(volumeConfig, resolvedFolderPath);
11544
11557
  if (!volume) {
11545
11558
  const sandbox = await sandboxManager.getSandboxFromConfig(volumeConfig);
11546
11559
  try {
11547
- await sandbox.file.listPath(folderPath, { recursive: false });
11560
+ await sandbox.file.listPath(resolvedFolderPath, { recursive: false });
11548
11561
  } catch (error) {
11549
11562
  const code = error instanceof Error ? error.code : void 0;
11550
11563
  const message = error instanceof Error ? error.message : String(error);
@@ -11564,7 +11577,7 @@ var WorkspaceController = class {
11564
11577
  if (!listEntries2) {
11565
11578
  listEntries2 = async (directoryPath) => backend.lsInfo(directoryPath);
11566
11579
  }
11567
- const folderName = path2.basename(folderPath.replace(/\/$/, "")) || "folder";
11580
+ const folderName = path2.basename(resolvedFolderPath.replace(/\/$/, "")) || "folder";
11568
11581
  const prefix = `${folderName}/`;
11569
11582
  const entries = [{ name: prefix, data: Buffer.alloc(0), directory: true }];
11570
11583
  let totalSize = 0;
@@ -11676,7 +11689,7 @@ var WorkspaceController = class {
11676
11689
  throw new FolderDownloadError(400, "ENTRY_LIMIT", "Folder contains too many entries");
11677
11690
  }
11678
11691
  const childPath = child.path;
11679
- if (childPath.includes("\\") || childPath.split("/").includes("..") || !childPath.startsWith(folderPath.endsWith("/") ? folderPath : `${folderPath}/`)) {
11692
+ if (childPath.includes("\\") || childPath.split("/").includes("..") || !childPath.startsWith(resolvedFolderPath.endsWith("/") ? resolvedFolderPath : `${resolvedFolderPath}/`)) {
11680
11693
  throw new FolderDownloadError(400, "INVALID_PATH", "Folder contains an unsafe child path");
11681
11694
  }
11682
11695
  if (workspace.storageType !== "sandbox") {
@@ -11713,10 +11726,10 @@ var WorkspaceController = class {
11713
11726
  }
11714
11727
  };
11715
11728
  if (workspace.storageType === "sandbox") {
11716
- await collect(folderPath, prefix);
11729
+ await collect(resolvedFolderPath, prefix);
11717
11730
  } else {
11718
11731
  const root = filesystemRoot;
11719
- const target = path2.resolve(root, `.${folderPath.startsWith("/") ? folderPath : `/${folderPath}`}`);
11732
+ const target = path2.resolve(root, `.${resolvedFolderPath.startsWith("/") ? resolvedFolderPath : `/${resolvedFolderPath}`}`);
11720
11733
  await collectFilesystem(target, prefix);
11721
11734
  }
11722
11735
  const zip = createZip(entries);
@@ -11744,8 +11757,14 @@ var WorkspaceController = class {
11744
11757
  return reply.status(400).send({ success: false, error: "Path is required" });
11745
11758
  }
11746
11759
  try {
11747
- const { workspace } = await this.getBackend(tenantId, workspaceId, projectId, assistantId);
11748
- const resolvedPath = filePath;
11760
+ const { workspace, resolvedPath: aliasedPath } = await this.getBackend(
11761
+ tenantId,
11762
+ workspaceId,
11763
+ projectId,
11764
+ assistantId,
11765
+ filePath
11766
+ );
11767
+ const resolvedPath = aliasedPath ?? filePath;
11749
11768
  if (workspace.storageType === "sandbox") {
11750
11769
  const sandboxManager = getSandBoxManager3();
11751
11770
  const volumeConfig = {
@@ -11843,9 +11862,10 @@ var WorkspaceController = class {
11843
11862
  const path5 = request.query.path || "/";
11844
11863
  const assistantId = request.query.assistantId;
11845
11864
  console.log(`[listPath] tenantId=${tenantId} workspaceId=${workspaceId} projectId=${projectId} path=${path5} assistantId=${assistantId}`);
11846
- const { backend } = await this.getBackend(tenantId, workspaceId, projectId, assistantId, path5);
11847
- console.log(`[listPath] backend type=${backend.constructor.name} calling lsInfo(${path5})`);
11848
- const files = await backend.lsInfo(path5);
11865
+ const { backend, resolvedPath } = await this.getBackend(tenantId, workspaceId, projectId, assistantId, path5);
11866
+ const targetPath = resolvedPath ?? path5;
11867
+ console.log(`[listPath] backend type=${backend.constructor.name} calling lsInfo(${targetPath})`);
11868
+ const files = await backend.lsInfo(targetPath);
11849
11869
  console.log(`[listPath] result count=${files.length}`);
11850
11870
  return { success: true, data: files };
11851
11871
  }
@@ -11853,8 +11873,8 @@ var WorkspaceController = class {
11853
11873
  const tenantId = this.getTenantId(request);
11854
11874
  const { workspaceId, projectId } = request.params;
11855
11875
  const { path: path5, offset = 0, limit = 1e3, assistantId } = request.query;
11856
- const { backend } = await this.getBackend(tenantId, workspaceId, projectId, assistantId, path5);
11857
- const content = await backend.read(path5, Number(offset), Number(limit));
11876
+ const { backend, resolvedPath } = await this.getBackend(tenantId, workspaceId, projectId, assistantId, path5);
11877
+ const content = await backend.read(resolvedPath ?? path5, Number(offset), Number(limit));
11858
11878
  return { success: true, data: { content, offset, limit } };
11859
11879
  }
11860
11880
  /**
@@ -45034,7 +45054,7 @@ var start = async (config) => {
45034
45054
  await routes.oidcDeploymentGuard;
45035
45055
  try {
45036
45056
  const { A2AAuthService: A2AAuthService2, parseEnvKeys: parseEnvKeys2 } = await import("./A2AAuthService-UKN53ZGP.mjs");
45037
- const { registerA2AStandardRoutes } = await import("./a2a-standard-OANCQYQ2.mjs");
45057
+ const { registerA2AStandardRoutes } = await import("./a2a-standard-HZP5F74J.mjs");
45038
45058
  const a2a = await import("./a2a-YLKZE5JG.mjs");
45039
45059
  const a2aKeyStore = getStoreLattice44("default", "a2aApiKey").store;
45040
45060
  const assistantStore = getStoreLattice44("default", "assistant").store;
@@ -45067,12 +45087,12 @@ var start = async (config) => {
45067
45087
  const { registerOpenRoutes } = await import("./open-PCOORPQ5.mjs");
45068
45088
  const { registerOpenSessionRoutes } = await import("./open-session-CLZT3HVG.mjs");
45069
45089
  const { registerOpenCatalogRoutes } = await import("./open-catalog-NVGP6SQP.mjs");
45070
- const { registerOpenFilesRoutes } = await import("./open-files-JPB2NBL6.mjs");
45090
+ const { registerOpenFilesRoutes } = await import("./open-files-WK4SQHE3.mjs");
45071
45091
  const { registerOpenAuditRoutes } = await import("./open-audit-UJ3NXCGW.mjs");
45072
45092
  const { registerOpenExposureRoutes } = await import("./open-exposure-HGYT5VFC.mjs");
45073
45093
  const { openLattice } = await import("./openLattice-D5YTSZBY.mjs");
45074
45094
  const { createKbProvider } = await import("./kbProvider-2D6DZ34N.mjs");
45075
- const { createOpenSandboxProvider } = await import("./sandboxProvider-FILMFVIM.mjs");
45095
+ const { createOpenSandboxProvider } = await import("./sandboxProvider-LA6B5SKU.mjs");
45076
45096
  const { createAgentProvider } = await import("./agentProvider-X4FVQPKW.mjs");
45077
45097
  const { registerExposedPluginTools } = await import("./registerExposedPlugins-2JGXSMAL.mjs");
45078
45098
  const { CollectionService: CollectionService2 } = await import("./collection_service-RTRJEQFL.mjs");