@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 CHANGED
@@ -1410,6 +1410,26 @@ interface BackendProtocol {
1410
1410
  * @returns Raw file content as FileData
1411
1411
  */
1412
1412
  readRaw(filePath: string): MaybePromise<FileData>;
1413
+ /**
1414
+ * Read file content as raw binary Buffer.
1415
+ *
1416
+ * Optional method for backends that support binary file access.
1417
+ * Backends that store files as text (StateBackend, MemoryBackend, StoreBackend)
1418
+ * may omit this method.
1419
+ *
1420
+ * @param filePath - Absolute file path
1421
+ * @returns Raw file content as Buffer
1422
+ */
1423
+ readBinary?(filePath: string): Promise<Buffer>;
1424
+ /**
1425
+ * Write raw binary data to a file.
1426
+ *
1427
+ * Optional method for backends that support binary file writing.
1428
+ *
1429
+ * @param filePath - Absolute file path
1430
+ * @param data - Binary data to write
1431
+ */
1432
+ writeBinary?(filePath: string, data: Buffer): Promise<void>;
1413
1433
  /**
1414
1434
  * Structured search results or error string for invalid input.
1415
1435
  *
@@ -4228,7 +4248,6 @@ interface MicrosandboxRemoteProviderConfig extends MicrosandboxServiceClientConf
4228
4248
  declare class MicrosandboxRemoteProvider implements SandboxProvider {
4229
4249
  private readonly config;
4230
4250
  private readonly client;
4231
- private readonly instances;
4232
4251
  private readonly creating;
4233
4252
  constructor(config: MicrosandboxRemoteProviderConfig);
4234
4253
  createSandbox(name: string, config: RunSandboxConfig): Promise<SandboxInstance>;
@@ -5583,6 +5602,8 @@ declare class VolumeFilesystem implements BackendProtocol {
5583
5602
  lsInfo(path: string): Promise<FileInfo[]>;
5584
5603
  read(filePath: string, offset?: number, limit?: number): Promise<string>;
5585
5604
  readRaw(filePath: string): Promise<FileData>;
5605
+ readBinary(filePath: string): Promise<Buffer>;
5606
+ writeBinary(filePath: string, data: Buffer): Promise<void>;
5586
5607
  grepRaw(_pattern: string, _path?: string | null, _glob?: string | null): string | GrepMatch[];
5587
5608
  globInfo(_pattern: string, _path?: string): FileInfo[];
5588
5609
  write(filePath: string, content: string): Promise<WriteResult>;
package/dist/index.d.ts CHANGED
@@ -1410,6 +1410,26 @@ interface BackendProtocol {
1410
1410
  * @returns Raw file content as FileData
1411
1411
  */
1412
1412
  readRaw(filePath: string): MaybePromise<FileData>;
1413
+ /**
1414
+ * Read file content as raw binary Buffer.
1415
+ *
1416
+ * Optional method for backends that support binary file access.
1417
+ * Backends that store files as text (StateBackend, MemoryBackend, StoreBackend)
1418
+ * may omit this method.
1419
+ *
1420
+ * @param filePath - Absolute file path
1421
+ * @returns Raw file content as Buffer
1422
+ */
1423
+ readBinary?(filePath: string): Promise<Buffer>;
1424
+ /**
1425
+ * Write raw binary data to a file.
1426
+ *
1427
+ * Optional method for backends that support binary file writing.
1428
+ *
1429
+ * @param filePath - Absolute file path
1430
+ * @param data - Binary data to write
1431
+ */
1432
+ writeBinary?(filePath: string, data: Buffer): Promise<void>;
1413
1433
  /**
1414
1434
  * Structured search results or error string for invalid input.
1415
1435
  *
@@ -4228,7 +4248,6 @@ interface MicrosandboxRemoteProviderConfig extends MicrosandboxServiceClientConf
4228
4248
  declare class MicrosandboxRemoteProvider implements SandboxProvider {
4229
4249
  private readonly config;
4230
4250
  private readonly client;
4231
- private readonly instances;
4232
4251
  private readonly creating;
4233
4252
  constructor(config: MicrosandboxRemoteProviderConfig);
4234
4253
  createSandbox(name: string, config: RunSandboxConfig): Promise<SandboxInstance>;
@@ -5583,6 +5602,8 @@ declare class VolumeFilesystem implements BackendProtocol {
5583
5602
  lsInfo(path: string): Promise<FileInfo[]>;
5584
5603
  read(filePath: string, offset?: number, limit?: number): Promise<string>;
5585
5604
  readRaw(filePath: string): Promise<FileData>;
5605
+ readBinary(filePath: string): Promise<Buffer>;
5606
+ writeBinary(filePath: string, data: Buffer): Promise<void>;
5586
5607
  grepRaw(_pattern: string, _path?: string | null, _glob?: string | null): string | GrepMatch[];
5587
5608
  globInfo(_pattern: string, _path?: string): FileInfo[];
5588
5609
  write(filePath: string, content: string): Promise<WriteResult>;
package/dist/index.js CHANGED
@@ -7482,7 +7482,8 @@ var VolumeFilesystem = class {
7482
7482
  }).join("\n");
7483
7483
  }
7484
7484
  async readRaw(filePath) {
7485
- const content = await this.client.read(filePath);
7485
+ const buf = await this.client.readRaw(filePath);
7486
+ const content = buf.toString("utf-8");
7486
7487
  const lines = content.split("\n");
7487
7488
  const now = (/* @__PURE__ */ new Date()).toISOString();
7488
7489
  return {
@@ -7491,6 +7492,12 @@ var VolumeFilesystem = class {
7491
7492
  modified_at: now
7492
7493
  };
7493
7494
  }
7495
+ async readBinary(filePath) {
7496
+ return this.client.readRaw(filePath);
7497
+ }
7498
+ async writeBinary(filePath, data) {
7499
+ await this.client.writeRaw(filePath, data);
7500
+ }
7494
7501
  grepRaw(_pattern, _path, _glob) {
7495
7502
  throw new Error("Not supported on volume backend");
7496
7503
  }
@@ -24365,7 +24372,6 @@ function getDefaultMicrosandboxRemoteConfig() {
24365
24372
  var MicrosandboxRemoteProvider = class {
24366
24373
  constructor(config) {
24367
24374
  this.config = config;
24368
- this.instances = /* @__PURE__ */ new Map();
24369
24375
  this.creating = /* @__PURE__ */ new Map();
24370
24376
  this.client = config.client ?? new MicrosandboxServiceClient({
24371
24377
  baseURL: config.baseURL,
@@ -24377,48 +24383,32 @@ var MicrosandboxRemoteProvider = class {
24377
24383
  if (inFlight) {
24378
24384
  return inFlight;
24379
24385
  }
24380
- const existing = this.instances.get(name);
24381
- if (existing) {
24382
- console.log(`[MicrosandboxRemote] createSandbox name=${name} INSTANCE_CACHE_HIT`);
24383
- return existing;
24384
- }
24385
24386
  const creation = (async () => {
24386
24387
  const tStart = Date.now();
24387
24388
  const input = this.buildEnsureInput(config);
24388
24389
  console.log(`[MicrosandboxRemote] createSandbox name=${name} calling ensureSandbox...`);
24389
24390
  await this.client.ensureSandbox(name, input);
24390
24391
  console.log(`[MicrosandboxRemote] createSandbox DONE name=${name} elapsed=${Date.now() - tStart}ms`);
24391
- const instance = new MicrosandboxRemoteInstance(name, this.client);
24392
- this.instances.set(name, instance);
24393
- return instance;
24392
+ return new MicrosandboxRemoteInstance(name, this.client);
24394
24393
  })();
24395
24394
  this.creating.set(name, creation);
24396
- creation.then(
24397
- () => {
24398
- this.creating.delete(name);
24399
- },
24400
- () => {
24401
- this.creating.delete(name);
24402
- }
24403
- );
24395
+ creation.finally(() => this.creating.delete(name));
24404
24396
  return creation;
24405
24397
  }
24406
24398
  async getSandbox(name) {
24407
- const instance = this.instances.get(name);
24408
- if (!instance) {
24399
+ const status = await this.client.getStatus(name);
24400
+ if (status.status === "unknown") {
24409
24401
  throw new Error(`Sandbox ${name} not found`);
24410
24402
  }
24411
- return instance;
24403
+ return new MicrosandboxRemoteInstance(name, this.client);
24412
24404
  }
24413
24405
  async stopSandbox(name) {
24414
24406
  try {
24415
24407
  await this.client.stopSandbox(name);
24416
24408
  } catch {
24417
24409
  }
24418
- this.instances.delete(name);
24419
24410
  }
24420
24411
  async deleteSandbox(name) {
24421
- this.instances.delete(name);
24422
24412
  await this.client.deleteSandbox(name);
24423
24413
  }
24424
24414
  createVolumeFsClient(volumeName, _pathPrefix) {
@@ -24431,7 +24421,7 @@ var MicrosandboxRemoteProvider = class {
24431
24421
  };
24432
24422
  }
24433
24423
  async listSandboxes() {
24434
- return Array.from(this.instances.values());
24424
+ return [];
24435
24425
  }
24436
24426
  buildEnsureInput(config) {
24437
24427
  const defaultMicrosandboxRemoteConfig = getDefaultMicrosandboxRemoteConfig();