@axiom-lattice/core 2.1.87 → 2.1.89
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 +22 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +14 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5741,7 +5741,8 @@ var VolumeFilesystem = class {
|
|
|
5741
5741
|
}).join("\n");
|
|
5742
5742
|
}
|
|
5743
5743
|
async readRaw(filePath) {
|
|
5744
|
-
const
|
|
5744
|
+
const buf = await this.client.readRaw(filePath);
|
|
5745
|
+
const content = buf.toString("utf-8");
|
|
5745
5746
|
const lines = content.split("\n");
|
|
5746
5747
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
5747
5748
|
return {
|
|
@@ -5750,6 +5751,12 @@ var VolumeFilesystem = class {
|
|
|
5750
5751
|
modified_at: now
|
|
5751
5752
|
};
|
|
5752
5753
|
}
|
|
5754
|
+
async readBinary(filePath) {
|
|
5755
|
+
return this.client.readRaw(filePath);
|
|
5756
|
+
}
|
|
5757
|
+
async writeBinary(filePath, data) {
|
|
5758
|
+
await this.client.writeRaw(filePath, data);
|
|
5759
|
+
}
|
|
5753
5760
|
grepRaw(_pattern, _path, _glob) {
|
|
5754
5761
|
throw new Error("Not supported on volume backend");
|
|
5755
5762
|
}
|
|
@@ -22651,7 +22658,6 @@ function getDefaultMicrosandboxRemoteConfig() {
|
|
|
22651
22658
|
var MicrosandboxRemoteProvider = class {
|
|
22652
22659
|
constructor(config) {
|
|
22653
22660
|
this.config = config;
|
|
22654
|
-
this.instances = /* @__PURE__ */ new Map();
|
|
22655
22661
|
this.creating = /* @__PURE__ */ new Map();
|
|
22656
22662
|
this.client = config.client ?? new MicrosandboxServiceClient({
|
|
22657
22663
|
baseURL: config.baseURL,
|
|
@@ -22663,48 +22669,32 @@ var MicrosandboxRemoteProvider = class {
|
|
|
22663
22669
|
if (inFlight) {
|
|
22664
22670
|
return inFlight;
|
|
22665
22671
|
}
|
|
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
22672
|
const creation = (async () => {
|
|
22672
22673
|
const tStart = Date.now();
|
|
22673
22674
|
const input = this.buildEnsureInput(config);
|
|
22674
22675
|
console.log(`[MicrosandboxRemote] createSandbox name=${name} calling ensureSandbox...`);
|
|
22675
22676
|
await this.client.ensureSandbox(name, input);
|
|
22676
22677
|
console.log(`[MicrosandboxRemote] createSandbox DONE name=${name} elapsed=${Date.now() - tStart}ms`);
|
|
22677
|
-
|
|
22678
|
-
this.instances.set(name, instance);
|
|
22679
|
-
return instance;
|
|
22678
|
+
return new MicrosandboxRemoteInstance(name, this.client);
|
|
22680
22679
|
})();
|
|
22681
22680
|
this.creating.set(name, creation);
|
|
22682
|
-
creation.
|
|
22683
|
-
() => {
|
|
22684
|
-
this.creating.delete(name);
|
|
22685
|
-
},
|
|
22686
|
-
() => {
|
|
22687
|
-
this.creating.delete(name);
|
|
22688
|
-
}
|
|
22689
|
-
);
|
|
22681
|
+
creation.finally(() => this.creating.delete(name));
|
|
22690
22682
|
return creation;
|
|
22691
22683
|
}
|
|
22692
22684
|
async getSandbox(name) {
|
|
22693
|
-
const
|
|
22694
|
-
if (
|
|
22685
|
+
const status = await this.client.getStatus(name);
|
|
22686
|
+
if (status.status === "unknown") {
|
|
22695
22687
|
throw new Error(`Sandbox ${name} not found`);
|
|
22696
22688
|
}
|
|
22697
|
-
return
|
|
22689
|
+
return new MicrosandboxRemoteInstance(name, this.client);
|
|
22698
22690
|
}
|
|
22699
22691
|
async stopSandbox(name) {
|
|
22700
22692
|
try {
|
|
22701
22693
|
await this.client.stopSandbox(name);
|
|
22702
22694
|
} catch {
|
|
22703
22695
|
}
|
|
22704
|
-
this.instances.delete(name);
|
|
22705
22696
|
}
|
|
22706
22697
|
async deleteSandbox(name) {
|
|
22707
|
-
this.instances.delete(name);
|
|
22708
22698
|
await this.client.deleteSandbox(name);
|
|
22709
22699
|
}
|
|
22710
22700
|
createVolumeFsClient(volumeName, _pathPrefix) {
|
|
@@ -22717,7 +22707,7 @@ var MicrosandboxRemoteProvider = class {
|
|
|
22717
22707
|
};
|
|
22718
22708
|
}
|
|
22719
22709
|
async listSandboxes() {
|
|
22720
|
-
return
|
|
22710
|
+
return [];
|
|
22721
22711
|
}
|
|
22722
22712
|
buildEnsureInput(config) {
|
|
22723
22713
|
const defaultMicrosandboxRemoteConfig = getDefaultMicrosandboxRemoteConfig();
|