@axiom-lattice/core 2.1.81 → 2.1.83

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
@@ -3894,7 +3894,8 @@ function getTenantIdFromConfig2(exeConfig, getTenantId2) {
3894
3894
  const runConfig = exeConfig?.configurable?.runConfig || {};
3895
3895
  return runConfig.tenantId || (getTenantId2 ? getTenantId2() : "default");
3896
3896
  }
3897
- function filterServerKeysByTenant(serverKeys, tenantId, manager = metricsServerManager) {
3897
+ async function filterServerKeysByTenant(serverKeys, tenantId, manager = metricsServerManager) {
3898
+ await manager.ensureLoaded();
3898
3899
  return serverKeys.filter((key) => {
3899
3900
  return manager.hasServer(tenantId, key);
3900
3901
  });
@@ -4672,6 +4673,14 @@ var MetricsServerManager = class _MetricsServerManager {
4672
4673
  }
4673
4674
  return config;
4674
4675
  }
4676
+ /**
4677
+ * Ensure server configs are loaded from the store.
4678
+ * Public wrapper around the internal lazy-loading mechanism.
4679
+ * Safe to call multiple times — loading happens at most once.
4680
+ */
4681
+ async ensureLoaded() {
4682
+ await this._ensureLoaded();
4683
+ }
4675
4684
  /**
4676
4685
  * Check if a metrics server is registered for a tenant
4677
4686
  * @param tenantId - Tenant identifier
@@ -4812,7 +4821,7 @@ ${serverKeys.map(
4812
4821
  if (connectAll) {
4813
4822
  effectiveServerKeys = (await metricsServerManager.getServerKeys(tenantId)).map((s) => s.key);
4814
4823
  }
4815
- const filteredServerKeys = filterServerKeysByTenant(effectiveServerKeys, tenantId);
4824
+ const filteredServerKeys = await filterServerKeysByTenant(effectiveServerKeys, tenantId);
4816
4825
  const runConfig = _exeConfig?.configurable?.runConfig || {};
4817
4826
  const metricsDataSource = runConfig.metricsDataSource;
4818
4827
  if (metricsDataSource) {
@@ -4931,7 +4940,7 @@ ${serverKeys.map(
4931
4940
  if (connectAll) {
4932
4941
  effectiveServerKeys = (await metricsServerManager.getServerKeys(tenantId)).map((s) => s.key);
4933
4942
  }
4934
- const filteredServerKeys = filterServerKeysByTenant(effectiveServerKeys, tenantId);
4943
+ const filteredServerKeys = await filterServerKeysByTenant(effectiveServerKeys, tenantId);
4935
4944
  const runConfig = _exeConfig?.configurable?.runConfig || {};
4936
4945
  const metricsDataSource = runConfig.metricsDataSource;
4937
4946
  const serverKey = metricsDataSource?.serverKey || inputServerKey;
@@ -5089,7 +5098,7 @@ ${serverKeys.map(
5089
5098
  if (connectAll) {
5090
5099
  effectiveServerKeys = (await metricsServerManager.getServerKeys(tenantId)).map((s) => s.key);
5091
5100
  }
5092
- const filteredServerKeys = filterServerKeysByTenant(effectiveServerKeys, tenantId);
5101
+ const filteredServerKeys = await filterServerKeysByTenant(effectiveServerKeys, tenantId);
5093
5102
  const runConfig = _exeConfig?.configurable?.runConfig || {};
5094
5103
  const metricsDataSource = runConfig.metricsDataSource;
5095
5104
  const serverKey = metricsDataSource?.serverKey || inputServerKey;
@@ -5325,7 +5334,7 @@ ${serverKeys.map(
5325
5334
  if (connectAll) {
5326
5335
  effectiveServerKeys = (await metricsServerManager.getServerKeys(tenantId)).map((s) => s.key);
5327
5336
  }
5328
- const filteredServerKeys = filterServerKeysByTenant(effectiveServerKeys, tenantId);
5337
+ const filteredServerKeys = await filterServerKeysByTenant(effectiveServerKeys, tenantId);
5329
5338
  const runConfig = _exeConfig?.configurable?.runConfig || {};
5330
5339
  const metricsDataSource = runConfig.metricsDataSource;
5331
5340
  const serverKey = metricsDataSource?.serverKey || inputServerKey;
@@ -5406,7 +5415,7 @@ ${serverKeys.map(
5406
5415
  if (connectAll) {
5407
5416
  effectiveServerKeys = (await metricsServerManager.getServerKeys(tenantId)).map((s) => s.key);
5408
5417
  }
5409
- const filteredServerKeys = filterServerKeysByTenant(effectiveServerKeys, tenantId);
5418
+ const filteredServerKeys = await filterServerKeysByTenant(effectiveServerKeys, tenantId);
5410
5419
  const runConfig = _exeConfig?.configurable?.runConfig || {};
5411
5420
  const metricsDataSource = runConfig.metricsDataSource;
5412
5421
  const serverKey = metricsDataSource?.serverKey || inputServerKey;
@@ -5511,7 +5520,7 @@ ${serverKeys.map(
5511
5520
  if (connectAll) {
5512
5521
  effectiveServerKeys = (await metricsServerManager.getServerKeys(tenantId)).map((s) => s.key);
5513
5522
  }
5514
- const filteredServerKeys = filterServerKeysByTenant(effectiveServerKeys, tenantId);
5523
+ const filteredServerKeys = await filterServerKeysByTenant(effectiveServerKeys, tenantId);
5515
5524
  const runConfig = _exeConfig?.configurable?.runConfig || {};
5516
5525
  const metricsDataSource = runConfig.metricsDataSource;
5517
5526
  const serverKey = metricsDataSource?.serverKey || inputServerKey;
@@ -5651,7 +5660,7 @@ ${serverKeys.map(
5651
5660
  if (connectAll) {
5652
5661
  effectiveServerKeys = (await metricsServerManager.getServerKeys(tenantId)).map((s) => s.key);
5653
5662
  }
5654
- const filteredServerKeys = filterServerKeysByTenant(effectiveServerKeys, tenantId);
5663
+ const filteredServerKeys = await filterServerKeysByTenant(effectiveServerKeys, tenantId);
5655
5664
  const runConfig = _exeConfig?.configurable?.runConfig || {};
5656
5665
  const metricsDataSource = runConfig.metricsDataSource;
5657
5666
  const serverKey = metricsDataSource?.serverKey || inputServerKey;
@@ -5709,7 +5718,9 @@ var VolumeFilesystem = class {
5709
5718
  this.mountPrefix = mountPrefix;
5710
5719
  }
5711
5720
  async lsInfo(path3) {
5721
+ console.log(`[VolumeFilesystem.lsInfo] path=${path3} mountPrefix=${this.mountPrefix}`);
5712
5722
  const entries = await this.client.list(path3);
5723
+ console.log(`[VolumeFilesystem.lsInfo] got ${entries.length} entries`);
5713
5724
  const prefix = this.mountPrefix.endsWith("/") ? this.mountPrefix : this.mountPrefix + "/";
5714
5725
  return entries.map((entry) => ({
5715
5726
  path: entry.path.startsWith("/") ? entry.path : prefix + entry.path,
@@ -5873,9 +5884,6 @@ var SandboxLatticeManager = class _SandboxLatticeManager extends BaseLatticeMana
5873
5884
  return this.keys();
5874
5885
  }
5875
5886
  resolvePolicy(config) {
5876
- if (config.vmIsolation) {
5877
- return { vmIsolation: config.vmIsolation };
5878
- }
5879
5887
  if (config.projectId) {
5880
5888
  return { vmIsolation: "project" };
5881
5889
  }
@@ -5901,30 +5909,45 @@ var SandboxLatticeManager = class _SandboxLatticeManager extends BaseLatticeMana
5901
5909
  async getVolumeBackendForPath(config, filePath) {
5902
5910
  const provider = this._requireProvider();
5903
5911
  if (!provider.createVolumeFsClient) {
5912
+ console.log(`[getVolumeBackendForPath] provider has no createVolumeFsClient, returning null`);
5904
5913
  return null;
5905
5914
  }
5906
5915
  const tenantId = config.tenantId ?? "default";
5907
5916
  const mapping = this._resolveVolumeForPath(config, tenantId, filePath);
5908
- if (!mapping) return null;
5917
+ if (!mapping) {
5918
+ console.log(`[getVolumeBackendForPath] no volume mapping for path=${filePath}`);
5919
+ return null;
5920
+ }
5921
+ console.log(`[getVolumeBackendForPath] path=${filePath} volume=${mapping.volumeName} prefix=${mapping.pathPrefix}`);
5909
5922
  const client = provider.createVolumeFsClient(mapping.volumeName, mapping.pathPrefix);
5910
5923
  return new VolumeFilesystem(stripPrefixClient(client, mapping.pathPrefix), mapping.pathPrefix);
5911
5924
  }
5912
5925
  _resolveVolumeForPath(config, tenantId, filePath) {
5913
5926
  const normalized = normalizeExternalSandboxPath(filePath);
5927
+ console.log(`[_resolveVolumeForPath] filePath=${filePath} normalized=${normalized} assistant_id=${config.assistant_id} projectId=${config.projectId}`);
5914
5928
  if (normalized === "/root/.agents" || normalized.startsWith("/root/.agents/")) {
5929
+ console.log(`[_resolveVolumeForPath] \u2192 skills volume`);
5915
5930
  return {
5916
5931
  volumeName: buildNamedVolumeName("s", "skills", tenantId),
5917
5932
  pathPrefix: "/root/.agents"
5918
5933
  };
5919
5934
  }
5920
5935
  if (normalized === "/agent" || normalized.startsWith("/agent/")) {
5921
- if (!config.assistant_id) return null;
5936
+ if (!config.assistant_id) {
5937
+ console.log(`[_resolveVolumeForPath] agent volume but no assistant_id, returning null`);
5938
+ return null;
5939
+ }
5940
+ console.log(`[_resolveVolumeForPath] \u2192 agent volume`);
5922
5941
  return {
5923
5942
  volumeName: buildNamedVolumeName("a", "agent", tenantId, config.assistant_id),
5924
5943
  pathPrefix: "/agent"
5925
5944
  };
5926
5945
  }
5927
- if (!config.projectId) return null;
5946
+ if (!config.projectId) {
5947
+ console.log(`[_resolveVolumeForPath] project volume but no projectId, returning null`);
5948
+ return null;
5949
+ }
5950
+ console.log(`[_resolveVolumeForPath] \u2192 project volume`);
5928
5951
  return {
5929
5952
  volumeName: buildNamedVolumeName("p", "project", tenantId, config.workspaceId, config.projectId),
5930
5953
  pathPrefix: "/project"
@@ -13914,10 +13937,12 @@ var SandboxFilesystem = class {
13914
13937
  }
13915
13938
  async lsInfo(dirPath) {
13916
13939
  try {
13940
+ console.log(`[SandboxFilesystem.lsInfo] calling sandbox.file.listPath(${dirPath})`);
13917
13941
  const result = await this.sandbox.file.listPath(dirPath, { recursive: false });
13942
+ console.log(`[SandboxFilesystem.lsInfo] got ${result.files.length} entries`);
13918
13943
  return result.files;
13919
13944
  } catch (e) {
13920
- console.error(`Error listing files in ${dirPath}:`, e);
13945
+ console.error(`[SandboxFilesystem.lsInfo] error listing ${dirPath}:`, e);
13921
13946
  return [];
13922
13947
  }
13923
13948
  }
@@ -14059,6 +14084,7 @@ function createFilesystemBackendFactory(middlewareConfigs) {
14059
14084
  return async (stateAndStore) => {
14060
14085
  const { tenantId, workspaceId, projectId, assistant_id, threadId } = stateAndStore;
14061
14086
  const sandboxManager = getSandBoxManager();
14087
+ console.log(`[filesystemBackend] creating sandbox: tenantId=${tenantId} workspaceId=${workspaceId} projectId=${projectId} assistant_id=${assistant_id} threadId=${threadId} vmIsolation=${filesystemConfig.config?.vmIsolation || "(default)"}`);
14062
14088
  const sandbox = await sandboxManager.getSandboxFromConfig({
14063
14089
  assistant_id: assistant_id || "",
14064
14090
  thread_id: threadId || "",
@@ -22521,6 +22547,7 @@ var MicrosandboxServiceClient = class {
22521
22547
  );
22522
22548
  }
22523
22549
  async volumeFsList(volumeName, path3) {
22550
+ console.log(`[volumeFsList] volume=${volumeName} path="${path3}" url=POST /api/volumes/${encodeURIComponent(volumeName)}/fs/list`);
22524
22551
  const result = await this.request(
22525
22552
  `/api/volumes/${encodeURIComponent(volumeName)}/fs/list`,
22526
22553
  {
@@ -22528,6 +22555,10 @@ var MicrosandboxServiceClient = class {
22528
22555
  body: { path: path3 }
22529
22556
  }
22530
22557
  );
22558
+ console.log(
22559
+ `[volumeFsList] result: ${result.entries.length} entries:`,
22560
+ result.entries.map((e) => `${e.path} (kind=${e.kind})`).join(", ")
22561
+ );
22531
22562
  return result.entries;
22532
22563
  }
22533
22564
  async volumeFsDownload(volumeName, path3) {