tensorlake 0.5.77 → 0.5.85

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
@@ -103,6 +103,36 @@ interface NativeSandboxClient {
103
103
  connectProxy(proxyUrl: string, sandboxId: string, routingHint?: string | null, requestTimeoutSec?: number | null): NativeSandboxProxyClient;
104
104
  selectSandboxProxyUrl(sandboxId: string, sandboxUrl?: string | null, ingressEndpoint?: string | null, explicitProxyUrl?: string | null): string;
105
105
  }
106
+ interface NativeRepositoryClient {
107
+ gitRepoUrl(repo: string): string;
108
+ createRepo(repo: string, defaultBranch?: string | null): Promise<TracedJson>;
109
+ listRepos(): Promise<TracedJson>;
110
+ deleteRepo(repo: string): Promise<string>;
111
+ forkRepo(repo: string, baseRepo: string): Promise<TracedJson>;
112
+ archiveRepo(repo: string): Promise<string>;
113
+ restoreRepo(repo: string): Promise<string>;
114
+ repoInfo(repo: string): Promise<TracedJson>;
115
+ listBranches(repo: string): Promise<TracedJson>;
116
+ listRefs(repo: string): Promise<TracedJson>;
117
+ deleteBranch(repo: string, branch: string): Promise<string>;
118
+ listOperations(repo: string): Promise<TracedJson>;
119
+ gitCredential(repo?: string | null): Promise<string>;
120
+ commitStatus(repo: string, jobId: string): Promise<TracedJson>;
121
+ pushWorktree(repo: string, root: string, branch: string, message: string, expectOid?: string | null): Promise<TracedJson>;
122
+ mergeRepo(repo: string, ours: string, theirs: string, preflight: boolean, deep: boolean, materialize: boolean, message?: string | null, base?: string | null): Promise<TracedJson>;
123
+ commitConflicts(repo: string, commit: string): Promise<TracedJson>;
124
+ createFilesystem(name: string): Promise<string>;
125
+ listFilesystems(): Promise<TracedJson>;
126
+ filesystemMeta(name: string): Promise<TracedJson>;
127
+ deleteFilesystem(name: string): Promise<string>;
128
+ filesystemRefStatus(name: string, refspec: string): Promise<TracedJson>;
129
+ readFilesystemFile(name: string, path: string, version: string): Promise<TracedBytes>;
130
+ listFilesystemTree(name: string, dirPath: string, version: string): Promise<TracedJson>;
131
+ pushFilesystemFiles(name: string, files: Array<{
132
+ path: string;
133
+ content: Buffer;
134
+ }>, deletes: string[], message: string, branch: string, idempotencyKey?: string | null): Promise<TracedJson>;
135
+ }
106
136
 
107
137
  declare enum SandboxStatus {
108
138
  PENDING = "pending",
@@ -1440,6 +1470,231 @@ declare function listFileSystems(): Promise<FileSystem[]>;
1440
1470
  /** Delete a registered file system by its id (e.g. `file_system_...`). */
1441
1471
  declare function deleteFileSystem(fileSystemId: string): Promise<void>;
1442
1472
 
1473
+ /** One filesystem as returned by listing/point-read endpoints. */
1474
+ interface FilesystemInfo {
1475
+ name: string;
1476
+ fullName: string;
1477
+ defaultBranch: string;
1478
+ status: string;
1479
+ kind: string;
1480
+ }
1481
+ /** Remote status of a filesystem: identity plus current head. */
1482
+ interface FilesystemStatus {
1483
+ name: string;
1484
+ status: string;
1485
+ defaultBranch: string;
1486
+ /**
1487
+ * Commit hash the default branch currently points at; null for an empty
1488
+ * filesystem that has never been written to.
1489
+ */
1490
+ headCommit: string | null;
1491
+ /** Server-side movement counter for the default branch, when reported. */
1492
+ generation: number | null;
1493
+ }
1494
+ /** One directory entry from a filesystem listing. */
1495
+ interface FileEntry {
1496
+ name: string;
1497
+ /** Path of the entry relative to the filesystem root. */
1498
+ path: string;
1499
+ /** Git blob/tree object id. */
1500
+ oid: string;
1501
+ /** Raw git mode (0o100644 file, 0o100755 executable, 0o120000 symlink, 0o40000 dir). */
1502
+ mode: number;
1503
+ /** Blob size in bytes when cheaply known server-side. */
1504
+ size: number | null;
1505
+ isDir: boolean;
1506
+ isSymlink: boolean;
1507
+ }
1508
+ /** A durable version of the filesystem (a commit). */
1509
+ interface Snapshot {
1510
+ /** Commit hash — pass as `version` to read the filesystem at this point. */
1511
+ commit: string;
1512
+ tree: string;
1513
+ refName: string;
1514
+ parent: string | null;
1515
+ /** False when the write was a no-op (content identical to the parent). */
1516
+ created: boolean;
1517
+ message: string;
1518
+ }
1519
+ /**
1520
+ * Status of a local mount as reported by `tl fs status --json`.
1521
+ *
1522
+ * The mount daemon's JSON is versioned independently of this SDK, so only
1523
+ * stable fields are typed; the full payload is preserved in `raw`.
1524
+ */
1525
+ interface MountStatus {
1526
+ /** Local mount path. */
1527
+ path: string;
1528
+ /** Filesystem name this mount serves, when reported. */
1529
+ filesystem: string | null;
1530
+ /** Whether the daemon reports the mount as healthy/active. */
1531
+ mounted: boolean;
1532
+ /** Complete parsed JSON payload from the CLI. */
1533
+ raw: Record<string, unknown>;
1534
+ }
1535
+ declare class FilesystemError extends Error {
1536
+ constructor(message: string);
1537
+ }
1538
+ declare class FilesystemNotFoundError extends FilesystemError {
1539
+ readonly filesystemName: string;
1540
+ constructor(name: string);
1541
+ }
1542
+ declare class FileNotFoundInFilesystemError extends FilesystemError {
1543
+ readonly filesystem: string;
1544
+ readonly path: string;
1545
+ constructor(filesystem: string, path: string);
1546
+ }
1547
+ declare class FilesystemAPIError extends FilesystemError {
1548
+ readonly statusCode: number;
1549
+ constructor(statusCode: number, message: string);
1550
+ }
1551
+ declare class MountError extends FilesystemError {
1552
+ constructor(message: string);
1553
+ }
1554
+ declare class CliNotFoundError extends MountError {
1555
+ constructor(detail: string);
1556
+ }
1557
+
1558
+ /**
1559
+ * Client for Tensorlake filesystems.
1560
+ *
1561
+ * A filesystem is a durable, versioned file tree that lives in Tensorlake
1562
+ * Cloud. Every write produces a {@link Snapshot} (a durable version), files
1563
+ * can be read at any version, and a filesystem can be mounted to a local
1564
+ * path through the `tl` CLI's FUSE/FSKit daemon.
1565
+ *
1566
+ * Reads and writes are served by the shared Rust cloud-sdk core (the same
1567
+ * engine behind the `tl` CLI), so uploads get content-defined chunking,
1568
+ * dedup, transient retries, and idempotent commit reattachment for free.
1569
+ *
1570
+ * @example
1571
+ * const client = new FilesystemClient(); // env-based auth
1572
+ * const fs = await client.create("my-data");
1573
+ * await fs.writeFile("docs/hello.txt", "hi");
1574
+ * console.log(await fs.readText("docs/hello.txt"));
1575
+ * const snapshot = await fs.snapshot("after first write");
1576
+ *
1577
+ * const mount = await fs.mount("/mnt/my-data"); // requires the `tl` CLI
1578
+ * // ... use it as a normal directory
1579
+ * await mount.unmount();
1580
+ */
1581
+
1582
+ interface FilesystemClientOptions {
1583
+ apiKey?: string;
1584
+ apiUrl?: string;
1585
+ organizationId?: string;
1586
+ projectId?: string;
1587
+ /** @internal Test seam: bypass the native binding loader. */
1588
+ nativeClient?: NativeRepositoryClient;
1589
+ }
1590
+ /**
1591
+ * Runs `tl fs ...` commands for local mount operations.
1592
+ *
1593
+ * Mounting a filesystem to a local path is served by a FUSE (Linux) / FSKit
1594
+ * (macOS) daemon that ships only inside the Tensorlake CLI, so the SDK drives
1595
+ * mounts by invoking `tl fs mount/unmount/snapshot/status`. Everything else
1596
+ * goes through the Rust core and does not need the CLI.
1597
+ */
1598
+ declare class FsCli {
1599
+ private binary;
1600
+ private readonly envOverrides;
1601
+ constructor(envOverrides: Record<string, string>);
1602
+ private findCli;
1603
+ private run;
1604
+ mount(filesystem: string, localPath: string, readonly: boolean): Promise<void>;
1605
+ unmount(localPath: string, discard: boolean): Promise<void>;
1606
+ snapshot(localPath: string, message?: string): Promise<void>;
1607
+ status(localPath?: string): Promise<Record<string, unknown>>;
1608
+ }
1609
+ /** Manages the filesystems of one Tensorlake project. */
1610
+ declare class FilesystemClient {
1611
+ private readonly native;
1612
+ private readonly cli;
1613
+ /**
1614
+ * Any option left unset is resolved from the environment
1615
+ * (`TENSORLAKE_API_KEY` / `TENSORLAKE_PAT`, `TENSORLAKE_API_URL`,
1616
+ * `TENSORLAKE_ORGANIZATION_ID`, `TENSORLAKE_PROJECT_ID`).
1617
+ */
1618
+ constructor(options?: FilesystemClientOptions);
1619
+ /** Create a new filesystem and return a handle to it. */
1620
+ create(name: string): Promise<Filesystem>;
1621
+ /** Return a handle to an existing filesystem (verifies it exists). */
1622
+ get(name: string): Promise<Filesystem>;
1623
+ /** List all filesystems in the project. */
1624
+ list(): Promise<FilesystemInfo[]>;
1625
+ /** Permanently delete a filesystem and all its snapshots. */
1626
+ delete(name: string): Promise<void>;
1627
+ /** Mount a filesystem to a local path (requires the `tl` CLI). */
1628
+ mount(name: string, localPath: string, readonly?: boolean): Promise<FilesystemMount>;
1629
+ /**
1630
+ * Unmount a locally mounted filesystem.
1631
+ *
1632
+ * `discard: true` drops local changes that were not yet uploaded.
1633
+ */
1634
+ unmount(localPath: string, discard?: boolean): Promise<void>;
1635
+ /** Status of a local mount (defaults to the mount containing CWD). */
1636
+ mountStatus(localPath?: string): Promise<MountStatus>;
1637
+ }
1638
+ type FileData = Uint8Array | string;
1639
+ /** Handle to one filesystem; reads/writes go through the Rust core. */
1640
+ declare class Filesystem {
1641
+ private readonly client;
1642
+ private readonly native;
1643
+ private readonly cli;
1644
+ readonly name: string;
1645
+ private defaultBranch;
1646
+ /** @internal — obtain instances via `FilesystemClient.create()` / `.get()`. */
1647
+ constructor(client: FilesystemClient, native: NativeRepositoryClient, cli: FsCli, name: string, defaultBranch?: string | null);
1648
+ /**
1649
+ * The filesystem's default branch — the target of every write and the
1650
+ * default version of every read, so writes and `status()` can never
1651
+ * silently disagree on a non-"main" filesystem.
1652
+ */
1653
+ private branch;
1654
+ /** Write one file. Returns the snapshot (version) the write produced. */
1655
+ writeFile(path: string, data: FileData, message?: string): Promise<Snapshot>;
1656
+ /** Write several files (and/or delete paths) in one atomic snapshot. */
1657
+ writeFiles(files: Map<string, FileData> | Record<string, FileData>, message?: string, deletes?: string[]): Promise<Snapshot>;
1658
+ /** Delete one file. Returns the snapshot the deletion produced. */
1659
+ deleteFile(path: string, message?: string): Promise<Snapshot>;
1660
+ /**
1661
+ * Return the filesystem's current version as a snapshot.
1662
+ *
1663
+ * Writes already create snapshots implicitly; this pins the current head
1664
+ * without changing any content.
1665
+ */
1666
+ snapshot(message?: string): Promise<Snapshot>;
1667
+ /**
1668
+ * Read a file's bytes at `version` (branch, ref, or snapshot commit;
1669
+ * defaults to the filesystem's default branch).
1670
+ */
1671
+ readFile(path: string, version?: string): Promise<Uint8Array>;
1672
+ /** Read a file as UTF-8 text at `version`. Throws on non-UTF-8 content. */
1673
+ readText(path: string, version?: string): Promise<string>;
1674
+ /** List one directory (non-recursive) at `version`. */
1675
+ listFiles(dirPath?: string, version?: string): Promise<FileEntry[]>;
1676
+ /** Remote status: identity plus the current head snapshot. */
1677
+ status(): Promise<FilesystemStatus>;
1678
+ /** Mount this filesystem to a local path (requires the `tl` CLI). */
1679
+ mount(localPath: string, readonly?: boolean): Promise<FilesystemMount>;
1680
+ }
1681
+ /** A filesystem mounted to a local path via the `tl` CLI daemon. */
1682
+ declare class FilesystemMount {
1683
+ private readonly client;
1684
+ private readonly cli;
1685
+ readonly filesystem: string;
1686
+ readonly path: string;
1687
+ readonly readonly: boolean;
1688
+ /** @internal — obtain instances via `FilesystemClient.mount()`. */
1689
+ constructor(client: FilesystemClient, cli: FsCli, filesystem: string, path: string, readonly: boolean);
1690
+ /** Flush pending local changes into a durable snapshot. */
1691
+ snapshot(message?: string): Promise<void>;
1692
+ /** Local mount status as reported by the mount daemon. */
1693
+ status(): Promise<MountStatus>;
1694
+ /** Unmount; `discard: true` drops changes not yet uploaded. */
1695
+ unmount(discard?: boolean): Promise<void>;
1696
+ }
1697
+
1443
1698
  /**
1444
1699
  * Build a public sandbox URL from a server-provided ingress endpoint.
1445
1700
  *
@@ -1509,4 +1764,4 @@ declare class RequestExecutionError extends Error {
1509
1764
  constructor(message: string, functionName?: string);
1510
1765
  }
1511
1766
 
1512
- export { APIClient, ApiKeyIntrospection, ApplicationBuildContext, ApplicationBuildResponse, ApplicationManifest, ApplicationSummary, type ArchivedSandboxInfo, BinaryPayload, type Branch, BuildInfo, BuildLogEntry, type CheckpointOptions, type CheckpointType, CloudClient, CloudClientOptions, type CommandResult, type CommitJobError, type CommitJobReadBack, type CommitJobStatus, type ConflictPath, type ConflictTerm, type ConnectDesktopOptions, type ConnectOptions, type ContainerResourcesInfo, ContainerState, type CopiedSandboxResponse, type CopySandboxOptions, type CopySandboxResponse, type CreateAndConnectOptions, CreateApplicationBuildRequest, type CreatePoolOptions, type CreatePtyOptions, type CreatePtySessionOptions, type CreateSandboxOptions, type CreateSandboxPoolResponse, type CreateSandboxResponse, type CreateSnapshotResponse, type CreateTunnelOptions, type DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, type DirectoryEntry, FileSystem, type FileSystemMount, type GPUResources, type GetSandboxLogsOptions, type GitCredential, type GitRef, type GitRepository, type HealthResponse, type ListArchivedSandboxesOptions, type ListArchivedSandboxesResponse, type ListDirectoryResponse, type ManagedProcessExit, type ManagedProcessHealthStatus, type ManagedProcessInfo, type ManagedProcessStatus, type MergeConflict, type MergeConflictRecord, type MergeEntry, type MergeOptions, type MergeReport, type MergeStats, type MouseButton, type NetworkConfig, NewSecret, type Operation, type OperationRef, type OutputEvent, OutputMode, type OutputResponse, type PoolContainerInfo, PoolInUseError, PoolNotFoundError, type ProcessHealthCheck, type ProcessHealthCheckType, type ProcessInfo, ProcessStatus, type ProcessUser, type ProcessUserSpec, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, type PtySessionInfo, type PushReport, type PushWorktreeOptions, RemoteAPIError, RepositoryClient, type RepositoryClientOptions, type RepositoryHandle, type RepositoryInfo, RequestExecutionError, RequestFailedError, RequestInput, RequestMetadata, RequestNotFinishedError, RequestOutput, type RestartPolicy, type RestartPolicyConfig, type RunOptions, Sandbox, SandboxClient, type SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, type SandboxInfo, type SandboxLogLevel, type SandboxLogSignal, type SandboxLogsResponse, SandboxNotFoundError, type SandboxOptions, type SandboxPoolInfo, type SandboxPortAccess, type SandboxProcessLogFilter, type SandboxProcessLogFiltersResponse, SandboxStatus, SandboxTemplate, Secret, SecretsList, type SendSignalResponse, type SnapshotAndWaitOptions, type SnapshotInfo, type SnapshotOptions, SnapshotStatus, type SnapshotType, type SnapshotWaitCondition, StartImageBuildRequest, type StartProcessOptions, StdinMode, type SuspendResumeOptions, TcpTunnel, type TunnelAddress, type UpdatePoolOptions, UpsertSecretResponse, createFileSystem, deleteFileSystem, listFileSystems, sandboxUrlFromIngressEndpoint };
1767
+ export { APIClient, ApiKeyIntrospection, ApplicationBuildContext, ApplicationBuildResponse, ApplicationManifest, ApplicationSummary, type ArchivedSandboxInfo, BinaryPayload, type Branch, BuildInfo, BuildLogEntry, type CheckpointOptions, type CheckpointType, CliNotFoundError, CloudClient, CloudClientOptions, type CommandResult, type CommitJobError, type CommitJobReadBack, type CommitJobStatus, type ConflictPath, type ConflictTerm, type ConnectDesktopOptions, type ConnectOptions, type ContainerResourcesInfo, ContainerState, type CopiedSandboxResponse, type CopySandboxOptions, type CopySandboxResponse, type CreateAndConnectOptions, CreateApplicationBuildRequest, type CreatePoolOptions, type CreatePtyOptions, type CreatePtySessionOptions, type CreateSandboxOptions, type CreateSandboxPoolResponse, type CreateSandboxResponse, type CreateSnapshotResponse, type CreateTunnelOptions, type DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, type DirectoryEntry, type FileEntry, FileNotFoundInFilesystemError, FileSystem, type FileSystemMount, Filesystem, FilesystemAPIError, FilesystemClient, type FilesystemClientOptions, FilesystemError, type FilesystemInfo, FilesystemMount, FilesystemNotFoundError, type FilesystemStatus, type GPUResources, type GetSandboxLogsOptions, type GitCredential, type GitRef, type GitRepository, type HealthResponse, type ListArchivedSandboxesOptions, type ListArchivedSandboxesResponse, type ListDirectoryResponse, type ManagedProcessExit, type ManagedProcessHealthStatus, type ManagedProcessInfo, type ManagedProcessStatus, type MergeConflict, type MergeConflictRecord, type MergeEntry, type MergeOptions, type MergeReport, type MergeStats, MountError, type MountStatus, type MouseButton, type NetworkConfig, NewSecret, type Operation, type OperationRef, type OutputEvent, OutputMode, type OutputResponse, type PoolContainerInfo, PoolInUseError, PoolNotFoundError, type ProcessHealthCheck, type ProcessHealthCheckType, type ProcessInfo, ProcessStatus, type ProcessUser, type ProcessUserSpec, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, type PtySessionInfo, type PushReport, type PushWorktreeOptions, RemoteAPIError, RepositoryClient, type RepositoryClientOptions, type RepositoryHandle, type RepositoryInfo, RequestExecutionError, RequestFailedError, RequestInput, RequestMetadata, RequestNotFinishedError, RequestOutput, type RestartPolicy, type RestartPolicyConfig, type RunOptions, Sandbox, SandboxClient, type SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, type SandboxInfo, type SandboxLogLevel, type SandboxLogSignal, type SandboxLogsResponse, SandboxNotFoundError, type SandboxOptions, type SandboxPoolInfo, type SandboxPortAccess, type SandboxProcessLogFilter, type SandboxProcessLogFiltersResponse, SandboxStatus, SandboxTemplate, Secret, SecretsList, type SendSignalResponse, type Snapshot, type SnapshotAndWaitOptions, type SnapshotInfo, type SnapshotOptions, SnapshotStatus, type SnapshotType, type SnapshotWaitCondition, StartImageBuildRequest, type StartProcessOptions, StdinMode, type SuspendResumeOptions, TcpTunnel, type TunnelAddress, type UpdatePoolOptions, UpsertSecretResponse, createFileSystem, deleteFileSystem, listFileSystems, sandboxUrlFromIngressEndpoint };
package/dist/index.d.ts CHANGED
@@ -103,6 +103,36 @@ interface NativeSandboxClient {
103
103
  connectProxy(proxyUrl: string, sandboxId: string, routingHint?: string | null, requestTimeoutSec?: number | null): NativeSandboxProxyClient;
104
104
  selectSandboxProxyUrl(sandboxId: string, sandboxUrl?: string | null, ingressEndpoint?: string | null, explicitProxyUrl?: string | null): string;
105
105
  }
106
+ interface NativeRepositoryClient {
107
+ gitRepoUrl(repo: string): string;
108
+ createRepo(repo: string, defaultBranch?: string | null): Promise<TracedJson>;
109
+ listRepos(): Promise<TracedJson>;
110
+ deleteRepo(repo: string): Promise<string>;
111
+ forkRepo(repo: string, baseRepo: string): Promise<TracedJson>;
112
+ archiveRepo(repo: string): Promise<string>;
113
+ restoreRepo(repo: string): Promise<string>;
114
+ repoInfo(repo: string): Promise<TracedJson>;
115
+ listBranches(repo: string): Promise<TracedJson>;
116
+ listRefs(repo: string): Promise<TracedJson>;
117
+ deleteBranch(repo: string, branch: string): Promise<string>;
118
+ listOperations(repo: string): Promise<TracedJson>;
119
+ gitCredential(repo?: string | null): Promise<string>;
120
+ commitStatus(repo: string, jobId: string): Promise<TracedJson>;
121
+ pushWorktree(repo: string, root: string, branch: string, message: string, expectOid?: string | null): Promise<TracedJson>;
122
+ mergeRepo(repo: string, ours: string, theirs: string, preflight: boolean, deep: boolean, materialize: boolean, message?: string | null, base?: string | null): Promise<TracedJson>;
123
+ commitConflicts(repo: string, commit: string): Promise<TracedJson>;
124
+ createFilesystem(name: string): Promise<string>;
125
+ listFilesystems(): Promise<TracedJson>;
126
+ filesystemMeta(name: string): Promise<TracedJson>;
127
+ deleteFilesystem(name: string): Promise<string>;
128
+ filesystemRefStatus(name: string, refspec: string): Promise<TracedJson>;
129
+ readFilesystemFile(name: string, path: string, version: string): Promise<TracedBytes>;
130
+ listFilesystemTree(name: string, dirPath: string, version: string): Promise<TracedJson>;
131
+ pushFilesystemFiles(name: string, files: Array<{
132
+ path: string;
133
+ content: Buffer;
134
+ }>, deletes: string[], message: string, branch: string, idempotencyKey?: string | null): Promise<TracedJson>;
135
+ }
106
136
 
107
137
  declare enum SandboxStatus {
108
138
  PENDING = "pending",
@@ -1440,6 +1470,231 @@ declare function listFileSystems(): Promise<FileSystem[]>;
1440
1470
  /** Delete a registered file system by its id (e.g. `file_system_...`). */
1441
1471
  declare function deleteFileSystem(fileSystemId: string): Promise<void>;
1442
1472
 
1473
+ /** One filesystem as returned by listing/point-read endpoints. */
1474
+ interface FilesystemInfo {
1475
+ name: string;
1476
+ fullName: string;
1477
+ defaultBranch: string;
1478
+ status: string;
1479
+ kind: string;
1480
+ }
1481
+ /** Remote status of a filesystem: identity plus current head. */
1482
+ interface FilesystemStatus {
1483
+ name: string;
1484
+ status: string;
1485
+ defaultBranch: string;
1486
+ /**
1487
+ * Commit hash the default branch currently points at; null for an empty
1488
+ * filesystem that has never been written to.
1489
+ */
1490
+ headCommit: string | null;
1491
+ /** Server-side movement counter for the default branch, when reported. */
1492
+ generation: number | null;
1493
+ }
1494
+ /** One directory entry from a filesystem listing. */
1495
+ interface FileEntry {
1496
+ name: string;
1497
+ /** Path of the entry relative to the filesystem root. */
1498
+ path: string;
1499
+ /** Git blob/tree object id. */
1500
+ oid: string;
1501
+ /** Raw git mode (0o100644 file, 0o100755 executable, 0o120000 symlink, 0o40000 dir). */
1502
+ mode: number;
1503
+ /** Blob size in bytes when cheaply known server-side. */
1504
+ size: number | null;
1505
+ isDir: boolean;
1506
+ isSymlink: boolean;
1507
+ }
1508
+ /** A durable version of the filesystem (a commit). */
1509
+ interface Snapshot {
1510
+ /** Commit hash — pass as `version` to read the filesystem at this point. */
1511
+ commit: string;
1512
+ tree: string;
1513
+ refName: string;
1514
+ parent: string | null;
1515
+ /** False when the write was a no-op (content identical to the parent). */
1516
+ created: boolean;
1517
+ message: string;
1518
+ }
1519
+ /**
1520
+ * Status of a local mount as reported by `tl fs status --json`.
1521
+ *
1522
+ * The mount daemon's JSON is versioned independently of this SDK, so only
1523
+ * stable fields are typed; the full payload is preserved in `raw`.
1524
+ */
1525
+ interface MountStatus {
1526
+ /** Local mount path. */
1527
+ path: string;
1528
+ /** Filesystem name this mount serves, when reported. */
1529
+ filesystem: string | null;
1530
+ /** Whether the daemon reports the mount as healthy/active. */
1531
+ mounted: boolean;
1532
+ /** Complete parsed JSON payload from the CLI. */
1533
+ raw: Record<string, unknown>;
1534
+ }
1535
+ declare class FilesystemError extends Error {
1536
+ constructor(message: string);
1537
+ }
1538
+ declare class FilesystemNotFoundError extends FilesystemError {
1539
+ readonly filesystemName: string;
1540
+ constructor(name: string);
1541
+ }
1542
+ declare class FileNotFoundInFilesystemError extends FilesystemError {
1543
+ readonly filesystem: string;
1544
+ readonly path: string;
1545
+ constructor(filesystem: string, path: string);
1546
+ }
1547
+ declare class FilesystemAPIError extends FilesystemError {
1548
+ readonly statusCode: number;
1549
+ constructor(statusCode: number, message: string);
1550
+ }
1551
+ declare class MountError extends FilesystemError {
1552
+ constructor(message: string);
1553
+ }
1554
+ declare class CliNotFoundError extends MountError {
1555
+ constructor(detail: string);
1556
+ }
1557
+
1558
+ /**
1559
+ * Client for Tensorlake filesystems.
1560
+ *
1561
+ * A filesystem is a durable, versioned file tree that lives in Tensorlake
1562
+ * Cloud. Every write produces a {@link Snapshot} (a durable version), files
1563
+ * can be read at any version, and a filesystem can be mounted to a local
1564
+ * path through the `tl` CLI's FUSE/FSKit daemon.
1565
+ *
1566
+ * Reads and writes are served by the shared Rust cloud-sdk core (the same
1567
+ * engine behind the `tl` CLI), so uploads get content-defined chunking,
1568
+ * dedup, transient retries, and idempotent commit reattachment for free.
1569
+ *
1570
+ * @example
1571
+ * const client = new FilesystemClient(); // env-based auth
1572
+ * const fs = await client.create("my-data");
1573
+ * await fs.writeFile("docs/hello.txt", "hi");
1574
+ * console.log(await fs.readText("docs/hello.txt"));
1575
+ * const snapshot = await fs.snapshot("after first write");
1576
+ *
1577
+ * const mount = await fs.mount("/mnt/my-data"); // requires the `tl` CLI
1578
+ * // ... use it as a normal directory
1579
+ * await mount.unmount();
1580
+ */
1581
+
1582
+ interface FilesystemClientOptions {
1583
+ apiKey?: string;
1584
+ apiUrl?: string;
1585
+ organizationId?: string;
1586
+ projectId?: string;
1587
+ /** @internal Test seam: bypass the native binding loader. */
1588
+ nativeClient?: NativeRepositoryClient;
1589
+ }
1590
+ /**
1591
+ * Runs `tl fs ...` commands for local mount operations.
1592
+ *
1593
+ * Mounting a filesystem to a local path is served by a FUSE (Linux) / FSKit
1594
+ * (macOS) daemon that ships only inside the Tensorlake CLI, so the SDK drives
1595
+ * mounts by invoking `tl fs mount/unmount/snapshot/status`. Everything else
1596
+ * goes through the Rust core and does not need the CLI.
1597
+ */
1598
+ declare class FsCli {
1599
+ private binary;
1600
+ private readonly envOverrides;
1601
+ constructor(envOverrides: Record<string, string>);
1602
+ private findCli;
1603
+ private run;
1604
+ mount(filesystem: string, localPath: string, readonly: boolean): Promise<void>;
1605
+ unmount(localPath: string, discard: boolean): Promise<void>;
1606
+ snapshot(localPath: string, message?: string): Promise<void>;
1607
+ status(localPath?: string): Promise<Record<string, unknown>>;
1608
+ }
1609
+ /** Manages the filesystems of one Tensorlake project. */
1610
+ declare class FilesystemClient {
1611
+ private readonly native;
1612
+ private readonly cli;
1613
+ /**
1614
+ * Any option left unset is resolved from the environment
1615
+ * (`TENSORLAKE_API_KEY` / `TENSORLAKE_PAT`, `TENSORLAKE_API_URL`,
1616
+ * `TENSORLAKE_ORGANIZATION_ID`, `TENSORLAKE_PROJECT_ID`).
1617
+ */
1618
+ constructor(options?: FilesystemClientOptions);
1619
+ /** Create a new filesystem and return a handle to it. */
1620
+ create(name: string): Promise<Filesystem>;
1621
+ /** Return a handle to an existing filesystem (verifies it exists). */
1622
+ get(name: string): Promise<Filesystem>;
1623
+ /** List all filesystems in the project. */
1624
+ list(): Promise<FilesystemInfo[]>;
1625
+ /** Permanently delete a filesystem and all its snapshots. */
1626
+ delete(name: string): Promise<void>;
1627
+ /** Mount a filesystem to a local path (requires the `tl` CLI). */
1628
+ mount(name: string, localPath: string, readonly?: boolean): Promise<FilesystemMount>;
1629
+ /**
1630
+ * Unmount a locally mounted filesystem.
1631
+ *
1632
+ * `discard: true` drops local changes that were not yet uploaded.
1633
+ */
1634
+ unmount(localPath: string, discard?: boolean): Promise<void>;
1635
+ /** Status of a local mount (defaults to the mount containing CWD). */
1636
+ mountStatus(localPath?: string): Promise<MountStatus>;
1637
+ }
1638
+ type FileData = Uint8Array | string;
1639
+ /** Handle to one filesystem; reads/writes go through the Rust core. */
1640
+ declare class Filesystem {
1641
+ private readonly client;
1642
+ private readonly native;
1643
+ private readonly cli;
1644
+ readonly name: string;
1645
+ private defaultBranch;
1646
+ /** @internal — obtain instances via `FilesystemClient.create()` / `.get()`. */
1647
+ constructor(client: FilesystemClient, native: NativeRepositoryClient, cli: FsCli, name: string, defaultBranch?: string | null);
1648
+ /**
1649
+ * The filesystem's default branch — the target of every write and the
1650
+ * default version of every read, so writes and `status()` can never
1651
+ * silently disagree on a non-"main" filesystem.
1652
+ */
1653
+ private branch;
1654
+ /** Write one file. Returns the snapshot (version) the write produced. */
1655
+ writeFile(path: string, data: FileData, message?: string): Promise<Snapshot>;
1656
+ /** Write several files (and/or delete paths) in one atomic snapshot. */
1657
+ writeFiles(files: Map<string, FileData> | Record<string, FileData>, message?: string, deletes?: string[]): Promise<Snapshot>;
1658
+ /** Delete one file. Returns the snapshot the deletion produced. */
1659
+ deleteFile(path: string, message?: string): Promise<Snapshot>;
1660
+ /**
1661
+ * Return the filesystem's current version as a snapshot.
1662
+ *
1663
+ * Writes already create snapshots implicitly; this pins the current head
1664
+ * without changing any content.
1665
+ */
1666
+ snapshot(message?: string): Promise<Snapshot>;
1667
+ /**
1668
+ * Read a file's bytes at `version` (branch, ref, or snapshot commit;
1669
+ * defaults to the filesystem's default branch).
1670
+ */
1671
+ readFile(path: string, version?: string): Promise<Uint8Array>;
1672
+ /** Read a file as UTF-8 text at `version`. Throws on non-UTF-8 content. */
1673
+ readText(path: string, version?: string): Promise<string>;
1674
+ /** List one directory (non-recursive) at `version`. */
1675
+ listFiles(dirPath?: string, version?: string): Promise<FileEntry[]>;
1676
+ /** Remote status: identity plus the current head snapshot. */
1677
+ status(): Promise<FilesystemStatus>;
1678
+ /** Mount this filesystem to a local path (requires the `tl` CLI). */
1679
+ mount(localPath: string, readonly?: boolean): Promise<FilesystemMount>;
1680
+ }
1681
+ /** A filesystem mounted to a local path via the `tl` CLI daemon. */
1682
+ declare class FilesystemMount {
1683
+ private readonly client;
1684
+ private readonly cli;
1685
+ readonly filesystem: string;
1686
+ readonly path: string;
1687
+ readonly readonly: boolean;
1688
+ /** @internal — obtain instances via `FilesystemClient.mount()`. */
1689
+ constructor(client: FilesystemClient, cli: FsCli, filesystem: string, path: string, readonly: boolean);
1690
+ /** Flush pending local changes into a durable snapshot. */
1691
+ snapshot(message?: string): Promise<void>;
1692
+ /** Local mount status as reported by the mount daemon. */
1693
+ status(): Promise<MountStatus>;
1694
+ /** Unmount; `discard: true` drops changes not yet uploaded. */
1695
+ unmount(discard?: boolean): Promise<void>;
1696
+ }
1697
+
1443
1698
  /**
1444
1699
  * Build a public sandbox URL from a server-provided ingress endpoint.
1445
1700
  *
@@ -1509,4 +1764,4 @@ declare class RequestExecutionError extends Error {
1509
1764
  constructor(message: string, functionName?: string);
1510
1765
  }
1511
1766
 
1512
- export { APIClient, ApiKeyIntrospection, ApplicationBuildContext, ApplicationBuildResponse, ApplicationManifest, ApplicationSummary, type ArchivedSandboxInfo, BinaryPayload, type Branch, BuildInfo, BuildLogEntry, type CheckpointOptions, type CheckpointType, CloudClient, CloudClientOptions, type CommandResult, type CommitJobError, type CommitJobReadBack, type CommitJobStatus, type ConflictPath, type ConflictTerm, type ConnectDesktopOptions, type ConnectOptions, type ContainerResourcesInfo, ContainerState, type CopiedSandboxResponse, type CopySandboxOptions, type CopySandboxResponse, type CreateAndConnectOptions, CreateApplicationBuildRequest, type CreatePoolOptions, type CreatePtyOptions, type CreatePtySessionOptions, type CreateSandboxOptions, type CreateSandboxPoolResponse, type CreateSandboxResponse, type CreateSnapshotResponse, type CreateTunnelOptions, type DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, type DirectoryEntry, FileSystem, type FileSystemMount, type GPUResources, type GetSandboxLogsOptions, type GitCredential, type GitRef, type GitRepository, type HealthResponse, type ListArchivedSandboxesOptions, type ListArchivedSandboxesResponse, type ListDirectoryResponse, type ManagedProcessExit, type ManagedProcessHealthStatus, type ManagedProcessInfo, type ManagedProcessStatus, type MergeConflict, type MergeConflictRecord, type MergeEntry, type MergeOptions, type MergeReport, type MergeStats, type MouseButton, type NetworkConfig, NewSecret, type Operation, type OperationRef, type OutputEvent, OutputMode, type OutputResponse, type PoolContainerInfo, PoolInUseError, PoolNotFoundError, type ProcessHealthCheck, type ProcessHealthCheckType, type ProcessInfo, ProcessStatus, type ProcessUser, type ProcessUserSpec, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, type PtySessionInfo, type PushReport, type PushWorktreeOptions, RemoteAPIError, RepositoryClient, type RepositoryClientOptions, type RepositoryHandle, type RepositoryInfo, RequestExecutionError, RequestFailedError, RequestInput, RequestMetadata, RequestNotFinishedError, RequestOutput, type RestartPolicy, type RestartPolicyConfig, type RunOptions, Sandbox, SandboxClient, type SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, type SandboxInfo, type SandboxLogLevel, type SandboxLogSignal, type SandboxLogsResponse, SandboxNotFoundError, type SandboxOptions, type SandboxPoolInfo, type SandboxPortAccess, type SandboxProcessLogFilter, type SandboxProcessLogFiltersResponse, SandboxStatus, SandboxTemplate, Secret, SecretsList, type SendSignalResponse, type SnapshotAndWaitOptions, type SnapshotInfo, type SnapshotOptions, SnapshotStatus, type SnapshotType, type SnapshotWaitCondition, StartImageBuildRequest, type StartProcessOptions, StdinMode, type SuspendResumeOptions, TcpTunnel, type TunnelAddress, type UpdatePoolOptions, UpsertSecretResponse, createFileSystem, deleteFileSystem, listFileSystems, sandboxUrlFromIngressEndpoint };
1767
+ export { APIClient, ApiKeyIntrospection, ApplicationBuildContext, ApplicationBuildResponse, ApplicationManifest, ApplicationSummary, type ArchivedSandboxInfo, BinaryPayload, type Branch, BuildInfo, BuildLogEntry, type CheckpointOptions, type CheckpointType, CliNotFoundError, CloudClient, CloudClientOptions, type CommandResult, type CommitJobError, type CommitJobReadBack, type CommitJobStatus, type ConflictPath, type ConflictTerm, type ConnectDesktopOptions, type ConnectOptions, type ContainerResourcesInfo, ContainerState, type CopiedSandboxResponse, type CopySandboxOptions, type CopySandboxResponse, type CreateAndConnectOptions, CreateApplicationBuildRequest, type CreatePoolOptions, type CreatePtyOptions, type CreatePtySessionOptions, type CreateSandboxOptions, type CreateSandboxPoolResponse, type CreateSandboxResponse, type CreateSnapshotResponse, type CreateTunnelOptions, type DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, type DirectoryEntry, type FileEntry, FileNotFoundInFilesystemError, FileSystem, type FileSystemMount, Filesystem, FilesystemAPIError, FilesystemClient, type FilesystemClientOptions, FilesystemError, type FilesystemInfo, FilesystemMount, FilesystemNotFoundError, type FilesystemStatus, type GPUResources, type GetSandboxLogsOptions, type GitCredential, type GitRef, type GitRepository, type HealthResponse, type ListArchivedSandboxesOptions, type ListArchivedSandboxesResponse, type ListDirectoryResponse, type ManagedProcessExit, type ManagedProcessHealthStatus, type ManagedProcessInfo, type ManagedProcessStatus, type MergeConflict, type MergeConflictRecord, type MergeEntry, type MergeOptions, type MergeReport, type MergeStats, MountError, type MountStatus, type MouseButton, type NetworkConfig, NewSecret, type Operation, type OperationRef, type OutputEvent, OutputMode, type OutputResponse, type PoolContainerInfo, PoolInUseError, PoolNotFoundError, type ProcessHealthCheck, type ProcessHealthCheckType, type ProcessInfo, ProcessStatus, type ProcessUser, type ProcessUserSpec, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, type PtySessionInfo, type PushReport, type PushWorktreeOptions, RemoteAPIError, RepositoryClient, type RepositoryClientOptions, type RepositoryHandle, type RepositoryInfo, RequestExecutionError, RequestFailedError, RequestInput, RequestMetadata, RequestNotFinishedError, RequestOutput, type RestartPolicy, type RestartPolicyConfig, type RunOptions, Sandbox, SandboxClient, type SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, type SandboxInfo, type SandboxLogLevel, type SandboxLogSignal, type SandboxLogsResponse, SandboxNotFoundError, type SandboxOptions, type SandboxPoolInfo, type SandboxPortAccess, type SandboxProcessLogFilter, type SandboxProcessLogFiltersResponse, SandboxStatus, SandboxTemplate, Secret, SecretsList, type SendSignalResponse, type Snapshot, type SnapshotAndWaitOptions, type SnapshotInfo, type SnapshotOptions, SnapshotStatus, type SnapshotType, type SnapshotWaitCondition, StartImageBuildRequest, type StartProcessOptions, StdinMode, type SuspendResumeOptions, TcpTunnel, type TunnelAddress, type UpdatePoolOptions, UpsertSecretResponse, createFileSystem, deleteFileSystem, listFileSystems, sandboxUrlFromIngressEndpoint };