@axiom-lattice/core 2.1.86 → 2.1.88

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
@@ -22651,7 +22651,6 @@ function getDefaultMicrosandboxRemoteConfig() {
22651
22651
  var MicrosandboxRemoteProvider = class {
22652
22652
  constructor(config) {
22653
22653
  this.config = config;
22654
- this.instances = /* @__PURE__ */ new Map();
22655
22654
  this.creating = /* @__PURE__ */ new Map();
22656
22655
  this.client = config.client ?? new MicrosandboxServiceClient({
22657
22656
  baseURL: config.baseURL,
@@ -22663,48 +22662,32 @@ var MicrosandboxRemoteProvider = class {
22663
22662
  if (inFlight) {
22664
22663
  return inFlight;
22665
22664
  }
22666
- const existing = this.instances.get(name);
22667
- if (existing) {
22668
- console.log(`[MicrosandboxRemote] createSandbox name=${name} INSTANCE_CACHE_HIT`);
22669
- return existing;
22670
- }
22671
22665
  const creation = (async () => {
22672
22666
  const tStart = Date.now();
22673
22667
  const input = this.buildEnsureInput(config);
22674
22668
  console.log(`[MicrosandboxRemote] createSandbox name=${name} calling ensureSandbox...`);
22675
22669
  await this.client.ensureSandbox(name, input);
22676
22670
  console.log(`[MicrosandboxRemote] createSandbox DONE name=${name} elapsed=${Date.now() - tStart}ms`);
22677
- const instance = new MicrosandboxRemoteInstance(name, this.client);
22678
- this.instances.set(name, instance);
22679
- return instance;
22671
+ return new MicrosandboxRemoteInstance(name, this.client);
22680
22672
  })();
22681
22673
  this.creating.set(name, creation);
22682
- creation.then(
22683
- () => {
22684
- this.creating.delete(name);
22685
- },
22686
- () => {
22687
- this.creating.delete(name);
22688
- }
22689
- );
22674
+ creation.finally(() => this.creating.delete(name));
22690
22675
  return creation;
22691
22676
  }
22692
22677
  async getSandbox(name) {
22693
- const instance = this.instances.get(name);
22694
- if (!instance) {
22678
+ const status = await this.client.getStatus(name);
22679
+ if (status.status === "unknown") {
22695
22680
  throw new Error(`Sandbox ${name} not found`);
22696
22681
  }
22697
- return instance;
22682
+ return new MicrosandboxRemoteInstance(name, this.client);
22698
22683
  }
22699
22684
  async stopSandbox(name) {
22700
22685
  try {
22701
22686
  await this.client.stopSandbox(name);
22702
22687
  } catch {
22703
22688
  }
22704
- this.instances.delete(name);
22705
22689
  }
22706
22690
  async deleteSandbox(name) {
22707
- this.instances.delete(name);
22708
22691
  await this.client.deleteSandbox(name);
22709
22692
  }
22710
22693
  createVolumeFsClient(volumeName, _pathPrefix) {
@@ -22717,7 +22700,7 @@ var MicrosandboxRemoteProvider = class {
22717
22700
  };
22718
22701
  }
22719
22702
  async listSandboxes() {
22720
- return Array.from(this.instances.values());
22703
+ return [];
22721
22704
  }
22722
22705
  buildEnsureInput(config) {
22723
22706
  const defaultMicrosandboxRemoteConfig = getDefaultMicrosandboxRemoteConfig();