@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.d.mts CHANGED
@@ -952,6 +952,12 @@ declare class MetricsServerManager {
952
952
  * @param key - Server key (optional, uses default if not provided)
953
953
  */
954
954
  getConfig(tenantId: string, key?: string): Promise<MetricsServerConfig>;
955
+ /**
956
+ * Ensure server configs are loaded from the store.
957
+ * Public wrapper around the internal lazy-loading mechanism.
958
+ * Safe to call multiple times — loading happens at most once.
959
+ */
960
+ ensureLoaded(): Promise<void>;
955
961
  /**
956
962
  * Check if a metrics server is registered for a tenant
957
963
  * @param tenantId - Tenant identifier
package/dist/index.d.ts CHANGED
@@ -952,6 +952,12 @@ declare class MetricsServerManager {
952
952
  * @param key - Server key (optional, uses default if not provided)
953
953
  */
954
954
  getConfig(tenantId: string, key?: string): Promise<MetricsServerConfig>;
955
+ /**
956
+ * Ensure server configs are loaded from the store.
957
+ * Public wrapper around the internal lazy-loading mechanism.
958
+ * Safe to call multiple times — loading happens at most once.
959
+ */
960
+ ensureLoaded(): Promise<void>;
955
961
  /**
956
962
  * Check if a metrics server is registered for a tenant
957
963
  * @param tenantId - Tenant identifier
package/dist/index.js CHANGED
@@ -5630,7 +5630,8 @@ function getTenantIdFromConfig2(exeConfig, getTenantId2) {
5630
5630
  const runConfig = exeConfig?.configurable?.runConfig || {};
5631
5631
  return runConfig.tenantId || (getTenantId2 ? getTenantId2() : "default");
5632
5632
  }
5633
- function filterServerKeysByTenant(serverKeys, tenantId, manager = metricsServerManager) {
5633
+ async function filterServerKeysByTenant(serverKeys, tenantId, manager = metricsServerManager) {
5634
+ await manager.ensureLoaded();
5634
5635
  return serverKeys.filter((key) => {
5635
5636
  return manager.hasServer(tenantId, key);
5636
5637
  });
@@ -6408,6 +6409,14 @@ var MetricsServerManager = class _MetricsServerManager {
6408
6409
  }
6409
6410
  return config;
6410
6411
  }
6412
+ /**
6413
+ * Ensure server configs are loaded from the store.
6414
+ * Public wrapper around the internal lazy-loading mechanism.
6415
+ * Safe to call multiple times — loading happens at most once.
6416
+ */
6417
+ async ensureLoaded() {
6418
+ await this._ensureLoaded();
6419
+ }
6411
6420
  /**
6412
6421
  * Check if a metrics server is registered for a tenant
6413
6422
  * @param tenantId - Tenant identifier
@@ -6548,7 +6557,7 @@ ${serverKeys.map(
6548
6557
  if (connectAll) {
6549
6558
  effectiveServerKeys = (await metricsServerManager.getServerKeys(tenantId)).map((s) => s.key);
6550
6559
  }
6551
- const filteredServerKeys = filterServerKeysByTenant(effectiveServerKeys, tenantId);
6560
+ const filteredServerKeys = await filterServerKeysByTenant(effectiveServerKeys, tenantId);
6552
6561
  const runConfig = _exeConfig?.configurable?.runConfig || {};
6553
6562
  const metricsDataSource = runConfig.metricsDataSource;
6554
6563
  if (metricsDataSource) {
@@ -6667,7 +6676,7 @@ ${serverKeys.map(
6667
6676
  if (connectAll) {
6668
6677
  effectiveServerKeys = (await metricsServerManager.getServerKeys(tenantId)).map((s) => s.key);
6669
6678
  }
6670
- const filteredServerKeys = filterServerKeysByTenant(effectiveServerKeys, tenantId);
6679
+ const filteredServerKeys = await filterServerKeysByTenant(effectiveServerKeys, tenantId);
6671
6680
  const runConfig = _exeConfig?.configurable?.runConfig || {};
6672
6681
  const metricsDataSource = runConfig.metricsDataSource;
6673
6682
  const serverKey = metricsDataSource?.serverKey || inputServerKey;
@@ -6825,7 +6834,7 @@ ${serverKeys.map(
6825
6834
  if (connectAll) {
6826
6835
  effectiveServerKeys = (await metricsServerManager.getServerKeys(tenantId)).map((s) => s.key);
6827
6836
  }
6828
- const filteredServerKeys = filterServerKeysByTenant(effectiveServerKeys, tenantId);
6837
+ const filteredServerKeys = await filterServerKeysByTenant(effectiveServerKeys, tenantId);
6829
6838
  const runConfig = _exeConfig?.configurable?.runConfig || {};
6830
6839
  const metricsDataSource = runConfig.metricsDataSource;
6831
6840
  const serverKey = metricsDataSource?.serverKey || inputServerKey;
@@ -7061,7 +7070,7 @@ ${serverKeys.map(
7061
7070
  if (connectAll) {
7062
7071
  effectiveServerKeys = (await metricsServerManager.getServerKeys(tenantId)).map((s) => s.key);
7063
7072
  }
7064
- const filteredServerKeys = filterServerKeysByTenant(effectiveServerKeys, tenantId);
7073
+ const filteredServerKeys = await filterServerKeysByTenant(effectiveServerKeys, tenantId);
7065
7074
  const runConfig = _exeConfig?.configurable?.runConfig || {};
7066
7075
  const metricsDataSource = runConfig.metricsDataSource;
7067
7076
  const serverKey = metricsDataSource?.serverKey || inputServerKey;
@@ -7142,7 +7151,7 @@ ${serverKeys.map(
7142
7151
  if (connectAll) {
7143
7152
  effectiveServerKeys = (await metricsServerManager.getServerKeys(tenantId)).map((s) => s.key);
7144
7153
  }
7145
- const filteredServerKeys = filterServerKeysByTenant(effectiveServerKeys, tenantId);
7154
+ const filteredServerKeys = await filterServerKeysByTenant(effectiveServerKeys, tenantId);
7146
7155
  const runConfig = _exeConfig?.configurable?.runConfig || {};
7147
7156
  const metricsDataSource = runConfig.metricsDataSource;
7148
7157
  const serverKey = metricsDataSource?.serverKey || inputServerKey;
@@ -7247,7 +7256,7 @@ ${serverKeys.map(
7247
7256
  if (connectAll) {
7248
7257
  effectiveServerKeys = (await metricsServerManager.getServerKeys(tenantId)).map((s) => s.key);
7249
7258
  }
7250
- const filteredServerKeys = filterServerKeysByTenant(effectiveServerKeys, tenantId);
7259
+ const filteredServerKeys = await filterServerKeysByTenant(effectiveServerKeys, tenantId);
7251
7260
  const runConfig = _exeConfig?.configurable?.runConfig || {};
7252
7261
  const metricsDataSource = runConfig.metricsDataSource;
7253
7262
  const serverKey = metricsDataSource?.serverKey || inputServerKey;
@@ -7387,7 +7396,7 @@ ${serverKeys.map(
7387
7396
  if (connectAll) {
7388
7397
  effectiveServerKeys = (await metricsServerManager.getServerKeys(tenantId)).map((s) => s.key);
7389
7398
  }
7390
- const filteredServerKeys = filterServerKeysByTenant(effectiveServerKeys, tenantId);
7399
+ const filteredServerKeys = await filterServerKeysByTenant(effectiveServerKeys, tenantId);
7391
7400
  const runConfig = _exeConfig?.configurable?.runConfig || {};
7392
7401
  const metricsDataSource = runConfig.metricsDataSource;
7393
7402
  const serverKey = metricsDataSource?.serverKey || inputServerKey;
@@ -7448,7 +7457,9 @@ var VolumeFilesystem = class {
7448
7457
  this.mountPrefix = mountPrefix;
7449
7458
  }
7450
7459
  async lsInfo(path3) {
7460
+ console.log(`[VolumeFilesystem.lsInfo] path=${path3} mountPrefix=${this.mountPrefix}`);
7451
7461
  const entries = await this.client.list(path3);
7462
+ console.log(`[VolumeFilesystem.lsInfo] got ${entries.length} entries`);
7452
7463
  const prefix = this.mountPrefix.endsWith("/") ? this.mountPrefix : this.mountPrefix + "/";
7453
7464
  return entries.map((entry) => ({
7454
7465
  path: entry.path.startsWith("/") ? entry.path : prefix + entry.path,
@@ -7612,9 +7623,6 @@ var SandboxLatticeManager = class _SandboxLatticeManager extends BaseLatticeMana
7612
7623
  return this.keys();
7613
7624
  }
7614
7625
  resolvePolicy(config) {
7615
- if (config.vmIsolation) {
7616
- return { vmIsolation: config.vmIsolation };
7617
- }
7618
7626
  if (config.projectId) {
7619
7627
  return { vmIsolation: "project" };
7620
7628
  }
@@ -7640,30 +7648,45 @@ var SandboxLatticeManager = class _SandboxLatticeManager extends BaseLatticeMana
7640
7648
  async getVolumeBackendForPath(config, filePath) {
7641
7649
  const provider = this._requireProvider();
7642
7650
  if (!provider.createVolumeFsClient) {
7651
+ console.log(`[getVolumeBackendForPath] provider has no createVolumeFsClient, returning null`);
7643
7652
  return null;
7644
7653
  }
7645
7654
  const tenantId = config.tenantId ?? "default";
7646
7655
  const mapping = this._resolveVolumeForPath(config, tenantId, filePath);
7647
- if (!mapping) return null;
7656
+ if (!mapping) {
7657
+ console.log(`[getVolumeBackendForPath] no volume mapping for path=${filePath}`);
7658
+ return null;
7659
+ }
7660
+ console.log(`[getVolumeBackendForPath] path=${filePath} volume=${mapping.volumeName} prefix=${mapping.pathPrefix}`);
7648
7661
  const client = provider.createVolumeFsClient(mapping.volumeName, mapping.pathPrefix);
7649
7662
  return new VolumeFilesystem(stripPrefixClient(client, mapping.pathPrefix), mapping.pathPrefix);
7650
7663
  }
7651
7664
  _resolveVolumeForPath(config, tenantId, filePath) {
7652
7665
  const normalized = normalizeExternalSandboxPath(filePath);
7666
+ console.log(`[_resolveVolumeForPath] filePath=${filePath} normalized=${normalized} assistant_id=${config.assistant_id} projectId=${config.projectId}`);
7653
7667
  if (normalized === "/root/.agents" || normalized.startsWith("/root/.agents/")) {
7668
+ console.log(`[_resolveVolumeForPath] \u2192 skills volume`);
7654
7669
  return {
7655
7670
  volumeName: buildNamedVolumeName("s", "skills", tenantId),
7656
7671
  pathPrefix: "/root/.agents"
7657
7672
  };
7658
7673
  }
7659
7674
  if (normalized === "/agent" || normalized.startsWith("/agent/")) {
7660
- if (!config.assistant_id) return null;
7675
+ if (!config.assistant_id) {
7676
+ console.log(`[_resolveVolumeForPath] agent volume but no assistant_id, returning null`);
7677
+ return null;
7678
+ }
7679
+ console.log(`[_resolveVolumeForPath] \u2192 agent volume`);
7661
7680
  return {
7662
7681
  volumeName: buildNamedVolumeName("a", "agent", tenantId, config.assistant_id),
7663
7682
  pathPrefix: "/agent"
7664
7683
  };
7665
7684
  }
7666
- if (!config.projectId) return null;
7685
+ if (!config.projectId) {
7686
+ console.log(`[_resolveVolumeForPath] project volume but no projectId, returning null`);
7687
+ return null;
7688
+ }
7689
+ console.log(`[_resolveVolumeForPath] \u2192 project volume`);
7667
7690
  return {
7668
7691
  volumeName: buildNamedVolumeName("p", "project", tenantId, config.workspaceId, config.projectId),
7669
7692
  pathPrefix: "/project"
@@ -15640,10 +15663,12 @@ var SandboxFilesystem = class {
15640
15663
  }
15641
15664
  async lsInfo(dirPath) {
15642
15665
  try {
15666
+ console.log(`[SandboxFilesystem.lsInfo] calling sandbox.file.listPath(${dirPath})`);
15643
15667
  const result = await this.sandbox.file.listPath(dirPath, { recursive: false });
15668
+ console.log(`[SandboxFilesystem.lsInfo] got ${result.files.length} entries`);
15644
15669
  return result.files;
15645
15670
  } catch (e) {
15646
- console.error(`Error listing files in ${dirPath}:`, e);
15671
+ console.error(`[SandboxFilesystem.lsInfo] error listing ${dirPath}:`, e);
15647
15672
  return [];
15648
15673
  }
15649
15674
  }
@@ -15785,6 +15810,7 @@ function createFilesystemBackendFactory(middlewareConfigs) {
15785
15810
  return async (stateAndStore) => {
15786
15811
  const { tenantId, workspaceId, projectId, assistant_id, threadId } = stateAndStore;
15787
15812
  const sandboxManager = getSandBoxManager();
15813
+ console.log(`[filesystemBackend] creating sandbox: tenantId=${tenantId} workspaceId=${workspaceId} projectId=${projectId} assistant_id=${assistant_id} threadId=${threadId} vmIsolation=${filesystemConfig.config?.vmIsolation || "(default)"}`);
15788
15814
  const sandbox = await sandboxManager.getSandboxFromConfig({
15789
15815
  assistant_id: assistant_id || "",
15790
15816
  thread_id: threadId || "",
@@ -24233,6 +24259,7 @@ var MicrosandboxServiceClient = class {
24233
24259
  );
24234
24260
  }
24235
24261
  async volumeFsList(volumeName, path3) {
24262
+ console.log(`[volumeFsList] volume=${volumeName} path="${path3}" url=POST /api/volumes/${encodeURIComponent(volumeName)}/fs/list`);
24236
24263
  const result = await this.request(
24237
24264
  `/api/volumes/${encodeURIComponent(volumeName)}/fs/list`,
24238
24265
  {
@@ -24240,6 +24267,10 @@ var MicrosandboxServiceClient = class {
24240
24267
  body: { path: path3 }
24241
24268
  }
24242
24269
  );
24270
+ console.log(
24271
+ `[volumeFsList] result: ${result.entries.length} entries:`,
24272
+ result.entries.map((e) => `${e.path} (kind=${e.kind})`).join(", ")
24273
+ );
24243
24274
  return result.entries;
24244
24275
  }
24245
24276
  async volumeFsDownload(volumeName, path3) {