tensorlake 0.5.126 → 0.5.127

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.
@@ -49,7 +49,7 @@ var init_defaults = __esm({
49
49
  "src/defaults.ts"() {
50
50
  "use strict";
51
51
  init_cjs_shims();
52
- SDK_VERSION = "0.5.126";
52
+ SDK_VERSION = "0.5.127";
53
53
  API_URL = process.env.TENSORLAKE_API_URL ?? "https://api.tensorlake.ai";
54
54
  API_KEY = process.env.TENSORLAKE_API_KEY ?? void 0;
55
55
  NAMESPACE = process.env.INDEXIFY_NAMESPACE ?? "default";
@@ -3664,13 +3664,15 @@ init_cloud_client();
3664
3664
 
3665
3665
  // src/filesystem.ts
3666
3666
  init_cjs_shims();
3667
- var import_node_child_process = require("child_process");
3668
3667
  var import_node_crypto5 = require("crypto");
3668
+
3669
+ // src/mount-cli.ts
3670
+ init_cjs_shims();
3671
+ var import_node_child_process = require("child_process");
3669
3672
  var import_node_fs2 = require("fs");
3670
3673
  var import_node_os2 = require("os");
3671
3674
  var import_node_path3 = require("path");
3672
3675
  var import_node_util2 = require("util");
3673
- init_defaults();
3674
3676
 
3675
3677
  // src/filesystem-models.ts
3676
3678
  init_cjs_shims();
@@ -3750,14 +3752,71 @@ var ReadOnlyMountNotSupportedError = class extends MountError {
3750
3752
  }
3751
3753
  };
3752
3754
  var CliNotFoundError = class extends MountError {
3753
- constructor(detail) {
3755
+ constructor(detail, command = "fs") {
3754
3756
  super(
3755
- `Mount operations require the Tensorlake CLI (\`tl\`) with \`tl fs\` support: ${detail}. Install or upgrade it with: curl -fsSL https://tensorlake.ai/install.sh | sh`
3757
+ `Mount operations require the Tensorlake CLI (\`tl\`) with \`tl ${command}\` support: ${detail}. Install or upgrade it with: curl -fsSL https://tensorlake.ai/install.sh | sh`
3756
3758
  );
3757
3759
  this.name = "CliNotFoundError";
3758
3760
  }
3759
3761
  };
3760
3762
 
3763
+ // src/mount-cli.ts
3764
+ var execFileAsync = (0, import_node_util2.promisify)(import_node_child_process.execFile);
3765
+ var MountCli = class {
3766
+ constructor(command, envOverrides) {
3767
+ this.command = command;
3768
+ this.envOverrides = envOverrides;
3769
+ }
3770
+ binary = null;
3771
+ async findCli() {
3772
+ const candidates = [];
3773
+ if (process.env.TENSORLAKE_CLI) candidates.push(process.env.TENSORLAKE_CLI);
3774
+ candidates.push("tl");
3775
+ const installed = (0, import_node_path3.join)((0, import_node_os2.homedir)(), ".tensorlake", "bin", "tl");
3776
+ try {
3777
+ (0, import_node_fs2.accessSync)(installed, import_node_fs2.constants.F_OK);
3778
+ candidates.push(installed);
3779
+ } catch {
3780
+ }
3781
+ const support = this.command === "git" ? "git mount" : "fs";
3782
+ const probe = this.command === "git" ? ["git", "mount", "--help"] : ["fs", "--help"];
3783
+ let unsupported = null;
3784
+ for (const candidate of candidates) {
3785
+ try {
3786
+ await execFileAsync(candidate, probe, { timeout: 15e3 });
3787
+ return candidate;
3788
+ } catch (error) {
3789
+ if (error.code !== "ENOENT") unsupported = candidate;
3790
+ }
3791
+ }
3792
+ throw new CliNotFoundError(
3793
+ unsupported ? `\`tl\` at ${unsupported} does not support \`tl ${support}\` (upgrade required)` : "`tl` was not found on PATH",
3794
+ support
3795
+ );
3796
+ }
3797
+ async run(args, timeoutMs = 3e5) {
3798
+ if (this.binary === null) this.binary = await this.findCli();
3799
+ try {
3800
+ const { stdout } = await execFileAsync(this.binary, [this.command, ...args], {
3801
+ timeout: timeoutMs,
3802
+ env: { ...process.env, ...this.envOverrides },
3803
+ maxBuffer: 16 * 1024 * 1024
3804
+ });
3805
+ return stdout;
3806
+ } catch (error) {
3807
+ const failure = error;
3808
+ if (failure.killed) {
3809
+ throw new MountError(`\`tl ${this.command} ${args[0]}\` timed out after ${timeoutMs}ms`);
3810
+ }
3811
+ const detail = (failure.stderr || failure.stdout || String(error)).trim();
3812
+ throw new MountError(`\`tl ${this.command} ${args.join(" ")}\` failed: ${detail}`);
3813
+ }
3814
+ }
3815
+ };
3816
+
3817
+ // src/filesystem.ts
3818
+ init_defaults();
3819
+
3761
3820
  // src/native-sandbox.ts
3762
3821
  init_cjs_shims();
3763
3822
  init_errors();
@@ -3981,7 +4040,7 @@ function createWorkerBinding(runtime) {
3981
4040
  };
3982
4041
  }
3983
4042
  var runtimeKey = /* @__PURE__ */ Symbol.for(
3984
- `tensorlake.native.worker.${false ? "source" : "0.5.126"}.v1`
4043
+ `tensorlake.native.worker.${false ? "source" : "0.5.127"}.v1`
3985
4044
  );
3986
4045
  var runtimes = globalThis;
3987
4046
  function workerBinding() {
@@ -3998,7 +4057,6 @@ function loadNativeSandboxBinding() {
3998
4057
 
3999
4058
  // src/filesystem.ts
4000
4059
  init_sandbox_image();
4001
- var execFileAsync = (0, import_node_util2.promisify)(import_node_child_process.execFile);
4002
4060
  var FILESYSTEM_REPO_KIND = "filesystem";
4003
4061
  function translateNativeError(error, notFound) {
4004
4062
  const message = error instanceof Error ? error.message : String(error);
@@ -4030,58 +4088,9 @@ async function callNative(fn, notFound) {
4030
4088
  throw translateNativeError(error, notFound);
4031
4089
  }
4032
4090
  }
4033
- var FsCli = class {
4034
- binary = null;
4035
- envOverrides;
4091
+ var FsCli = class extends MountCli {
4036
4092
  constructor(envOverrides) {
4037
- this.envOverrides = envOverrides;
4038
- }
4039
- async findCli() {
4040
- const candidates = [];
4041
- if (process.env.TENSORLAKE_CLI) {
4042
- candidates.push(process.env.TENSORLAKE_CLI);
4043
- }
4044
- candidates.push("tl");
4045
- const installed = (0, import_node_path3.join)((0, import_node_os2.homedir)(), ".tensorlake", "bin", "tl");
4046
- try {
4047
- (0, import_node_fs2.accessSync)(installed, import_node_fs2.constants.F_OK);
4048
- candidates.push(installed);
4049
- } catch {
4050
- }
4051
- let unsupported = null;
4052
- for (const candidate of candidates) {
4053
- try {
4054
- await execFileAsync(candidate, ["fs", "--help"], { timeout: 15e3 });
4055
- return candidate;
4056
- } catch (error) {
4057
- if (error.code !== "ENOENT") {
4058
- unsupported = candidate;
4059
- }
4060
- }
4061
- }
4062
- throw new CliNotFoundError(
4063
- unsupported ? `\`tl\` at ${unsupported} does not support \`tl fs\` (upgrade required)` : "`tl` was not found on PATH"
4064
- );
4065
- }
4066
- async run(args, timeoutMs = 3e5) {
4067
- if (this.binary === null) {
4068
- this.binary = await this.findCli();
4069
- }
4070
- try {
4071
- const { stdout } = await execFileAsync(this.binary, ["fs", ...args], {
4072
- timeout: timeoutMs,
4073
- env: { ...process.env, ...this.envOverrides },
4074
- maxBuffer: 16 * 1024 * 1024
4075
- });
4076
- return stdout;
4077
- } catch (error) {
4078
- const failure = error;
4079
- if (failure.killed) {
4080
- throw new MountError(`\`tl fs ${args[0]}\` timed out after ${timeoutMs}ms`);
4081
- }
4082
- const detail = (failure.stderr || failure.stdout || String(error)).trim();
4083
- throw new MountError(`\`tl fs ${args.join(" ")}\` failed: ${detail}`);
4084
- }
4093
+ super("fs", envOverrides);
4085
4094
  }
4086
4095
  // Flags always precede a `--` end-of-options separator so caller-supplied
4087
4096
  // names/paths can never be parsed as CLI flags (e.g. a path literally