@axiom-lattice/core 2.1.81 → 2.1.82

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,
@@ -5901,30 +5912,45 @@ var SandboxLatticeManager = class _SandboxLatticeManager extends BaseLatticeMana
5901
5912
  async getVolumeBackendForPath(config, filePath) {
5902
5913
  const provider = this._requireProvider();
5903
5914
  if (!provider.createVolumeFsClient) {
5915
+ console.log(`[getVolumeBackendForPath] provider has no createVolumeFsClient, returning null`);
5904
5916
  return null;
5905
5917
  }
5906
5918
  const tenantId = config.tenantId ?? "default";
5907
5919
  const mapping = this._resolveVolumeForPath(config, tenantId, filePath);
5908
- if (!mapping) return null;
5920
+ if (!mapping) {
5921
+ console.log(`[getVolumeBackendForPath] no volume mapping for path=${filePath}`);
5922
+ return null;
5923
+ }
5924
+ console.log(`[getVolumeBackendForPath] path=${filePath} volume=${mapping.volumeName} prefix=${mapping.pathPrefix}`);
5909
5925
  const client = provider.createVolumeFsClient(mapping.volumeName, mapping.pathPrefix);
5910
5926
  return new VolumeFilesystem(stripPrefixClient(client, mapping.pathPrefix), mapping.pathPrefix);
5911
5927
  }
5912
5928
  _resolveVolumeForPath(config, tenantId, filePath) {
5913
5929
  const normalized = normalizeExternalSandboxPath(filePath);
5930
+ console.log(`[_resolveVolumeForPath] filePath=${filePath} normalized=${normalized} assistant_id=${config.assistant_id} projectId=${config.projectId}`);
5914
5931
  if (normalized === "/root/.agents" || normalized.startsWith("/root/.agents/")) {
5932
+ console.log(`[_resolveVolumeForPath] \u2192 skills volume`);
5915
5933
  return {
5916
5934
  volumeName: buildNamedVolumeName("s", "skills", tenantId),
5917
5935
  pathPrefix: "/root/.agents"
5918
5936
  };
5919
5937
  }
5920
5938
  if (normalized === "/agent" || normalized.startsWith("/agent/")) {
5921
- if (!config.assistant_id) return null;
5939
+ if (!config.assistant_id) {
5940
+ console.log(`[_resolveVolumeForPath] agent volume but no assistant_id, returning null`);
5941
+ return null;
5942
+ }
5943
+ console.log(`[_resolveVolumeForPath] \u2192 agent volume`);
5922
5944
  return {
5923
5945
  volumeName: buildNamedVolumeName("a", "agent", tenantId, config.assistant_id),
5924
5946
  pathPrefix: "/agent"
5925
5947
  };
5926
5948
  }
5927
- if (!config.projectId) return null;
5949
+ if (!config.projectId) {
5950
+ console.log(`[_resolveVolumeForPath] project volume but no projectId, returning null`);
5951
+ return null;
5952
+ }
5953
+ console.log(`[_resolveVolumeForPath] \u2192 project volume`);
5928
5954
  return {
5929
5955
  volumeName: buildNamedVolumeName("p", "project", tenantId, config.workspaceId, config.projectId),
5930
5956
  pathPrefix: "/project"
@@ -13914,10 +13940,12 @@ var SandboxFilesystem = class {
13914
13940
  }
13915
13941
  async lsInfo(dirPath) {
13916
13942
  try {
13943
+ console.log(`[SandboxFilesystem.lsInfo] calling sandbox.file.listPath(${dirPath})`);
13917
13944
  const result = await this.sandbox.file.listPath(dirPath, { recursive: false });
13945
+ console.log(`[SandboxFilesystem.lsInfo] got ${result.files.length} entries`);
13918
13946
  return result.files;
13919
13947
  } catch (e) {
13920
- console.error(`Error listing files in ${dirPath}:`, e);
13948
+ console.error(`[SandboxFilesystem.lsInfo] error listing ${dirPath}:`, e);
13921
13949
  return [];
13922
13950
  }
13923
13951
  }