tensorlake 0.4.46 → 0.4.47

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.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CreatePtySessionOptions, S as SandboxOptions, R as RunOptions, a as CommandResult, b as StartProcessOptions, P as ProcessInfo, c as SendSignalResponse, O as OutputResponse, d as OutputEvent, L as ListDirectoryResponse, e as PtySessionInfo, H as HealthResponse, D as DaemonInfo, f as SandboxClientOptions, g as CreateSandboxOptions, h as CreateSandboxResponse, i as SandboxInfo, U as UpdateSandboxOptions, j as SandboxPortAccess, k as SnapshotOptions, l as CreateSnapshotResponse, m as SnapshotInfo, n as SnapshotAndWaitOptions, o as CreatePoolOptions, p as CreateSandboxPoolResponse, q as SandboxPoolInfo, r as UpdatePoolOptions, s as CreateAndConnectOptions } from './sandbox-image-B5Fa0xqb.cjs';
2
- export { t as ContainerResourcesInfo, u as ContainerState, v as CreateSandboxImageOptions, w as DirectoryEntry, x as DockerfileBuildPlan, y as DockerfileInstruction, I as Image, z as ImageBuildOperation, A as ImageBuildOperationType, A as ImageBuildOperationTypeValue, B as ImageOptions, N as NetworkConfig, E as OutputMode, F as PoolContainerInfo, G as ProcessStatus, J as SandboxImageSource, K as SandboxStatus, M as SnapshotContentMode, Q as SnapshotStatus, T as StdinMode, V as createSandboxImage, W as dockerfileContent } from './sandbox-image-B5Fa0xqb.cjs';
1
+ import { C as CreatePtySessionOptions, S as SandboxOptions, R as RunOptions, a as CommandResult, b as StartProcessOptions, P as ProcessInfo, c as SendSignalResponse, O as OutputResponse, d as OutputEvent, L as ListDirectoryResponse, e as PtySessionInfo, H as HealthResponse, D as DaemonInfo, f as SandboxClientOptions, g as CreateSandboxOptions, h as CreateSandboxResponse, i as SandboxInfo, U as UpdateSandboxOptions, j as SandboxPortAccess, k as SnapshotOptions, l as CreateSnapshotResponse, m as SnapshotInfo, n as SnapshotAndWaitOptions, o as CreatePoolOptions, p as CreateSandboxPoolResponse, q as SandboxPoolInfo, r as UpdatePoolOptions, s as CreateAndConnectOptions } from './sandbox-image-B130uMYt.cjs';
2
+ export { t as ContainerResourcesInfo, u as ContainerState, v as CreateSandboxImageOptions, w as DirectoryEntry, x as DockerfileBuildPlan, y as DockerfileInstruction, I as Image, z as ImageBuildOperation, A as ImageBuildOperationType, A as ImageBuildOperationTypeValue, B as ImageOptions, N as NetworkConfig, E as OutputMode, F as PoolContainerInfo, G as ProcessStatus, J as SandboxImageSource, K as SandboxStatus, M as SnapshotContentMode, Q as SnapshotStatus, T as StdinMode, V as createSandboxImage, W as dockerfileContent } from './sandbox-image-B130uMYt.cjs';
3
3
 
4
4
  type MouseButton = "left" | "middle" | "right";
5
5
  interface ConnectDesktopOptions {
@@ -249,7 +249,7 @@ declare class SandboxClient {
249
249
  listPools(): Promise<SandboxPoolInfo[]>;
250
250
  updatePool(poolId: string, options: UpdatePoolOptions): Promise<SandboxPoolInfo>;
251
251
  deletePool(poolId: string): Promise<void>;
252
- connect(identifier: string, proxyUrl?: string): Sandbox;
252
+ connect(identifier: string, proxyUrl?: string, routingHint?: string): Sandbox;
253
253
  createAndConnect(options?: CreateAndConnectOptions): Promise<Sandbox>;
254
254
  }
255
255
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CreatePtySessionOptions, S as SandboxOptions, R as RunOptions, a as CommandResult, b as StartProcessOptions, P as ProcessInfo, c as SendSignalResponse, O as OutputResponse, d as OutputEvent, L as ListDirectoryResponse, e as PtySessionInfo, H as HealthResponse, D as DaemonInfo, f as SandboxClientOptions, g as CreateSandboxOptions, h as CreateSandboxResponse, i as SandboxInfo, U as UpdateSandboxOptions, j as SandboxPortAccess, k as SnapshotOptions, l as CreateSnapshotResponse, m as SnapshotInfo, n as SnapshotAndWaitOptions, o as CreatePoolOptions, p as CreateSandboxPoolResponse, q as SandboxPoolInfo, r as UpdatePoolOptions, s as CreateAndConnectOptions } from './sandbox-image-B5Fa0xqb.js';
2
- export { t as ContainerResourcesInfo, u as ContainerState, v as CreateSandboxImageOptions, w as DirectoryEntry, x as DockerfileBuildPlan, y as DockerfileInstruction, I as Image, z as ImageBuildOperation, A as ImageBuildOperationType, A as ImageBuildOperationTypeValue, B as ImageOptions, N as NetworkConfig, E as OutputMode, F as PoolContainerInfo, G as ProcessStatus, J as SandboxImageSource, K as SandboxStatus, M as SnapshotContentMode, Q as SnapshotStatus, T as StdinMode, V as createSandboxImage, W as dockerfileContent } from './sandbox-image-B5Fa0xqb.js';
1
+ import { C as CreatePtySessionOptions, S as SandboxOptions, R as RunOptions, a as CommandResult, b as StartProcessOptions, P as ProcessInfo, c as SendSignalResponse, O as OutputResponse, d as OutputEvent, L as ListDirectoryResponse, e as PtySessionInfo, H as HealthResponse, D as DaemonInfo, f as SandboxClientOptions, g as CreateSandboxOptions, h as CreateSandboxResponse, i as SandboxInfo, U as UpdateSandboxOptions, j as SandboxPortAccess, k as SnapshotOptions, l as CreateSnapshotResponse, m as SnapshotInfo, n as SnapshotAndWaitOptions, o as CreatePoolOptions, p as CreateSandboxPoolResponse, q as SandboxPoolInfo, r as UpdatePoolOptions, s as CreateAndConnectOptions } from './sandbox-image-B130uMYt.js';
2
+ export { t as ContainerResourcesInfo, u as ContainerState, v as CreateSandboxImageOptions, w as DirectoryEntry, x as DockerfileBuildPlan, y as DockerfileInstruction, I as Image, z as ImageBuildOperation, A as ImageBuildOperationType, A as ImageBuildOperationTypeValue, B as ImageOptions, N as NetworkConfig, E as OutputMode, F as PoolContainerInfo, G as ProcessStatus, J as SandboxImageSource, K as SandboxStatus, M as SnapshotContentMode, Q as SnapshotStatus, T as StdinMode, V as createSandboxImage, W as dockerfileContent } from './sandbox-image-B130uMYt.js';
3
3
 
4
4
  type MouseButton = "left" | "middle" | "right";
5
5
  interface ConnectDesktopOptions {
@@ -249,7 +249,7 @@ declare class SandboxClient {
249
249
  listPools(): Promise<SandboxPoolInfo[]>;
250
250
  updatePool(poolId: string, options: UpdatePoolOptions): Promise<SandboxPoolInfo>;
251
251
  deletePool(poolId: string): Promise<void>;
252
- connect(identifier: string, proxyUrl?: string): Sandbox;
252
+ connect(identifier: string, proxyUrl?: string, routingHint?: string): Sandbox;
253
253
  createAndConnect(options?: CreateAndConnectOptions): Promise<Sandbox>;
254
254
  }
255
255
 
package/dist/index.js CHANGED
@@ -114,6 +114,9 @@ var HttpClient = class {
114
114
  if (options.hostHeader) {
115
115
  this.headers["Host"] = options.hostHeader;
116
116
  }
117
+ if (options.routingHint) {
118
+ this.headers["X-Tensorlake-Route-Hint"] = options.routingHint;
119
+ }
117
120
  }
118
121
  close() {
119
122
  this.abortController?.abort();
@@ -3087,7 +3090,8 @@ var Sandbox = class {
3087
3090
  apiKey: options.apiKey,
3088
3091
  organizationId: options.organizationId,
3089
3092
  projectId: options.projectId,
3090
- hostHeader
3093
+ hostHeader,
3094
+ routingHint: options.routingHint
3091
3095
  });
3092
3096
  }
3093
3097
  /** @internal Used by SandboxClient.createAndConnect to set ownership. */
@@ -3682,14 +3686,15 @@ var SandboxClient = class _SandboxClient {
3682
3686
  );
3683
3687
  }
3684
3688
  // --- Connect ---
3685
- connect(identifier, proxyUrl) {
3689
+ connect(identifier, proxyUrl, routingHint) {
3686
3690
  const resolvedProxy = proxyUrl ?? resolveProxyUrl(this.apiUrl);
3687
3691
  return new Sandbox({
3688
3692
  sandboxId: identifier,
3689
3693
  proxyUrl: resolvedProxy,
3690
3694
  apiKey: this.apiKey,
3691
3695
  organizationId: this.organizationId,
3692
- projectId: this.projectId
3696
+ projectId: this.projectId,
3697
+ routingHint
3693
3698
  });
3694
3699
  }
3695
3700
  async createAndConnect(options) {
@@ -3700,6 +3705,11 @@ var SandboxClient = class _SandboxClient {
3700
3705
  } else {
3701
3706
  result = await this.create(options);
3702
3707
  }
3708
+ if (result.status === "running" /* RUNNING */) {
3709
+ const sandbox = this.connect(result.sandboxId, options?.proxyUrl, result.routingHint);
3710
+ sandbox._setOwner(this);
3711
+ return sandbox;
3712
+ }
3703
3713
  const deadline = Date.now() + startupTimeout * 1e3;
3704
3714
  while (Date.now() < deadline) {
3705
3715
  const info = await this.get(result.sandboxId);