@tangle-network/sandbox 0.9.7 → 0.10.1
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/README.md +28 -0
- package/dist/agent/index.d.ts +2 -2
- package/dist/auth/index.js +66 -25
- package/dist/{client-DWkQOg1k.d.ts → client-BgKAw8YA.d.ts} +22 -2
- package/dist/{client-BZSkXIEp.js → client-DeHvk634.js} +121 -83
- package/dist/collaboration/index.js +1 -1
- package/dist/{collaboration-BxlfZ2Uh.js → collaboration-D17lnOJX.js} +1 -1
- package/dist/core.d.ts +3 -3
- package/dist/core.js +3 -3
- package/dist/{errors-DZsfJUuc.js → errors-DSz87Rkk.js} +10 -1
- package/dist/{errors-1Se5ATyZ.d.ts → errors-H9268M_g.d.ts} +5 -1
- package/dist/{index-DLH5MBrq.d.ts → index-DS4SOkKG.d.ts} +9 -4
- package/dist/index.d.ts +470 -7
- package/dist/index.js +562 -10
- package/dist/intelligence/index.js +1 -1
- package/dist/{sandbox-B6qbvsur.d.ts → sandbox-Bm2C9Phd.d.ts} +843 -164
- package/dist/{sandbox-bDWrUu8i.js → sandbox-CeimsfC8.js} +682 -164
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-CMGJEZit.js → tangle-DayyZe-i.js} +115 -37
- package/package.json +3 -3
|
@@ -343,6 +343,24 @@ interface CreateSandboxOptions {
|
|
|
343
343
|
* @default false
|
|
344
344
|
*/
|
|
345
345
|
bare?: boolean;
|
|
346
|
+
/**
|
|
347
|
+
* Provision a public preview URL for this sandbox (the default). Set to
|
|
348
|
+
* `false` for the fast lane: the server skips the public-edge tunnel
|
|
349
|
+
* (public URL allocation, tunnel readiness, and scarce public IP capacity),
|
|
350
|
+
* which is the largest single term in create latency. Use it for workloads
|
|
351
|
+
* that reach the sandbox only through the SDK / exec — benchmark fleets, CI,
|
|
352
|
+
* RL rollouts — where no browser-facing URL is needed. `exec()`, streaming,
|
|
353
|
+
* `stop`/`resume`/`branch` are unaffected; only the public preview URL is
|
|
354
|
+
* absent. Omit (or leave `true`) for interactive sandboxes.
|
|
355
|
+
*
|
|
356
|
+
* @default true
|
|
357
|
+
* @example
|
|
358
|
+
* ```typescript
|
|
359
|
+
* // 1000-way benchmark fork — no preview URLs, faster + no subnet pressure
|
|
360
|
+
* await client.sandboxes.create({ publicEdge: false })
|
|
361
|
+
* ```
|
|
362
|
+
*/
|
|
363
|
+
publicEdge?: boolean;
|
|
346
364
|
/**
|
|
347
365
|
* Infrastructure driver selection.
|
|
348
366
|
* Controls how the sandbox is provisioned and isolated.
|
|
@@ -433,6 +451,15 @@ interface CreateSandboxOptions {
|
|
|
433
451
|
name?: string;
|
|
434
452
|
/** Resource limits (CPU cores, memory, disk) */
|
|
435
453
|
resources?: SandboxResources;
|
|
454
|
+
/**
|
|
455
|
+
* Attach an on-demand GPU worker during sandbox creation.
|
|
456
|
+
*
|
|
457
|
+
* Requires `resources.accelerator` so the workload shape and the lease
|
|
458
|
+
* spend caps are both explicit. Docker and Firecracker sandboxes use the
|
|
459
|
+
* same lease path; the GPU is a temporary external worker, not host
|
|
460
|
+
* placement.
|
|
461
|
+
*/
|
|
462
|
+
gpuLease?: CreateGpuLeaseOptions;
|
|
436
463
|
/** Environment variables injected into the sandbox */
|
|
437
464
|
env?: Record<string, string>;
|
|
438
465
|
/**
|
|
@@ -472,6 +499,17 @@ interface CreateSandboxOptions {
|
|
|
472
499
|
* instead of Tangle's managed storage.
|
|
473
500
|
*/
|
|
474
501
|
storage?: StorageConfig;
|
|
502
|
+
/**
|
|
503
|
+
* Run as a throwaway sandbox: the home directory is NOT persisted across restarts.
|
|
504
|
+
*
|
|
505
|
+
* By default an egress-enabled sandbox is provisioned a persistent home
|
|
506
|
+
* volume (so a stop/resume workspace keeps its state). Set `ephemeral: true` for
|
|
507
|
+
* a one-shot run — a benchmark case, a CI job, any box that produces output and
|
|
508
|
+
* is deleted — to skip that volume and run on a writable scratch home. Egress
|
|
509
|
+
* still works; you only lose the home directory on restart, which a throwaway box
|
|
510
|
+
* never relies on. Independent of `storage`/snapshots (durability stays opt-in).
|
|
511
|
+
*/
|
|
512
|
+
ephemeral?: boolean;
|
|
475
513
|
/** Snapshot ID to restore from when creating the sandbox */
|
|
476
514
|
fromSnapshot?: string;
|
|
477
515
|
/** Source sandbox ID that owns the snapshot (required when fromSnapshot is set) */
|
|
@@ -742,6 +780,8 @@ interface SandboxInfo {
|
|
|
742
780
|
expiresAt?: Date;
|
|
743
781
|
/** Error message if status is 'failed' */
|
|
744
782
|
error?: string;
|
|
783
|
+
/** GPU lease attached during sandbox creation, when requested. */
|
|
784
|
+
gpuLease?: GpuLease;
|
|
745
785
|
/**
|
|
746
786
|
* Startup phase breakdown, present only on the create response (the
|
|
747
787
|
* platform emits it once, at provision time). Use
|
|
@@ -754,6 +794,110 @@ interface SandboxInfo {
|
|
|
754
794
|
/** Source of the egress policy */
|
|
755
795
|
egressPolicySource?: "sandbox" | "team" | "platform";
|
|
756
796
|
}
|
|
797
|
+
/** Basic health reported by the runtime inside a sandbox. */
|
|
798
|
+
interface SandboxRuntimeHealth {
|
|
799
|
+
status: string;
|
|
800
|
+
docker: {
|
|
801
|
+
enabled: boolean;
|
|
802
|
+
status: string;
|
|
803
|
+
dockerHost?: string;
|
|
804
|
+
error?: string;
|
|
805
|
+
};
|
|
806
|
+
backends: {
|
|
807
|
+
total: number;
|
|
808
|
+
byType: Record<string, number>;
|
|
809
|
+
pending: number;
|
|
810
|
+
};
|
|
811
|
+
timestamp: string;
|
|
812
|
+
}
|
|
813
|
+
/** Public preview link associated with a listening runtime port. */
|
|
814
|
+
interface SandboxPortPreviewLink {
|
|
815
|
+
previewId: string;
|
|
816
|
+
url: string;
|
|
817
|
+
status: string;
|
|
818
|
+
}
|
|
819
|
+
/** One process listening on a port inside a sandbox. */
|
|
820
|
+
interface SandboxPortBinding {
|
|
821
|
+
pid: number;
|
|
822
|
+
processName: string;
|
|
823
|
+
commandPath: string;
|
|
824
|
+
port: number;
|
|
825
|
+
protocol: "tcp" | "udp";
|
|
826
|
+
localAddress: string;
|
|
827
|
+
family: "tcp4" | "tcp6" | "udp4" | "udp6";
|
|
828
|
+
allowlisted: boolean;
|
|
829
|
+
firstSeenAt: string;
|
|
830
|
+
lastSeenAt: string;
|
|
831
|
+
previewLink?: SandboxPortPreviewLink;
|
|
832
|
+
}
|
|
833
|
+
/** Options for creating an interactive terminal. */
|
|
834
|
+
interface SandboxTerminalCreateOptions {
|
|
835
|
+
name?: string;
|
|
836
|
+
description?: string;
|
|
837
|
+
shell?: string;
|
|
838
|
+
cwd?: string;
|
|
839
|
+
cols?: number;
|
|
840
|
+
rows?: number;
|
|
841
|
+
}
|
|
842
|
+
/** Runtime request context used to attribute terminal events to an agent session. */
|
|
843
|
+
interface SandboxTerminalRequestOptions {
|
|
844
|
+
sessionId?: string;
|
|
845
|
+
}
|
|
846
|
+
/** Interactive terminal metadata returned by the runtime. */
|
|
847
|
+
interface SandboxTerminalInfo {
|
|
848
|
+
sessionId: string;
|
|
849
|
+
connectionId?: string;
|
|
850
|
+
name?: string;
|
|
851
|
+
description?: string;
|
|
852
|
+
shell?: string;
|
|
853
|
+
command?: string;
|
|
854
|
+
cwd?: string;
|
|
855
|
+
cols?: number;
|
|
856
|
+
rows?: number;
|
|
857
|
+
createdAt?: string;
|
|
858
|
+
lastActivityAt?: string;
|
|
859
|
+
isRunning?: boolean;
|
|
860
|
+
exitCode?: number;
|
|
861
|
+
exitSignal?: string;
|
|
862
|
+
/** WebSocket path for terminal input/output. */
|
|
863
|
+
streamUrl?: string;
|
|
864
|
+
history?: unknown[];
|
|
865
|
+
}
|
|
866
|
+
/** Interactive terminal operations. Input/output flows over `streamUrl`. */
|
|
867
|
+
interface SandboxTerminalManager {
|
|
868
|
+
create(options?: SandboxTerminalCreateOptions, request?: SandboxTerminalRequestOptions): Promise<SandboxTerminalInfo>;
|
|
869
|
+
/** Send input through the runtime's HTTP fallback for an existing terminal. */
|
|
870
|
+
input(terminalId: string, data: string, request?: SandboxTerminalRequestOptions): Promise<void>;
|
|
871
|
+
list(): Promise<SandboxTerminalInfo[]>;
|
|
872
|
+
get(sessionId: string): Promise<SandboxTerminalInfo | null>;
|
|
873
|
+
}
|
|
874
|
+
/** Runtime-local agent profile. */
|
|
875
|
+
interface SandboxRuntimeProfile {
|
|
876
|
+
name: string;
|
|
877
|
+
description?: string;
|
|
878
|
+
systemPrompt?: string;
|
|
879
|
+
tools?: string[];
|
|
880
|
+
mcpServers?: string[];
|
|
881
|
+
env?: Record<string, string>;
|
|
882
|
+
model?: {
|
|
883
|
+
provider?: string;
|
|
884
|
+
model?: string;
|
|
885
|
+
};
|
|
886
|
+
}
|
|
887
|
+
/** Runtime-local profile listing and selected default. */
|
|
888
|
+
interface SandboxRuntimeProfileList {
|
|
889
|
+
profiles: SandboxRuntimeProfile[];
|
|
890
|
+
defaultProfile?: string;
|
|
891
|
+
}
|
|
892
|
+
/** Profile summary returned before a sandbox runtime exists. */
|
|
893
|
+
interface SandboxProfileSummary {
|
|
894
|
+
id: string;
|
|
895
|
+
name: string;
|
|
896
|
+
description?: string;
|
|
897
|
+
model?: string;
|
|
898
|
+
tags?: string[];
|
|
899
|
+
extends?: string;
|
|
900
|
+
}
|
|
757
901
|
/**
|
|
758
902
|
* Raw TEE attestation evidence returned by the sandbox runtime.
|
|
759
903
|
*
|
|
@@ -1383,6 +1527,12 @@ interface ResumeOptions {
|
|
|
1383
1527
|
interface UsageInfo {
|
|
1384
1528
|
/** Total compute minutes used today */
|
|
1385
1529
|
computeMinutes: number;
|
|
1530
|
+
/** GPU lease seconds billed today */
|
|
1531
|
+
gpuSeconds: number;
|
|
1532
|
+
/** Customer-billed GPU lease spend today in USD */
|
|
1533
|
+
gpuCostUsd: number;
|
|
1534
|
+
/** Provider GPU lease cost basis today in USD */
|
|
1535
|
+
gpuProviderCostUsd: number;
|
|
1386
1536
|
/** Number of currently active sandboxes */
|
|
1387
1537
|
activeSandboxes: number;
|
|
1388
1538
|
/** Total sandboxes created (lifetime) */
|
|
@@ -1543,6 +1693,8 @@ type SessionStatus = "queued" | "running" | "completed" | "failed" | "cancelled"
|
|
|
1543
1693
|
interface SessionInfo {
|
|
1544
1694
|
/** Stable session id assigned by the sandbox runtime. */
|
|
1545
1695
|
id: string;
|
|
1696
|
+
/** Parent session id when this session was forked from another session. */
|
|
1697
|
+
parentId?: string;
|
|
1546
1698
|
/** Current lifecycle state. */
|
|
1547
1699
|
status: SessionStatus;
|
|
1548
1700
|
/** Backend identifier (e.g. provider name). */
|
|
@@ -1570,6 +1722,136 @@ interface SessionListOptions {
|
|
|
1570
1722
|
/** Filter by backend identifier. */
|
|
1571
1723
|
backend?: string;
|
|
1572
1724
|
}
|
|
1725
|
+
/** Options for creating a runtime agent session. */
|
|
1726
|
+
interface CreateSessionOptions {
|
|
1727
|
+
title?: string;
|
|
1728
|
+
parentId?: string;
|
|
1729
|
+
backend: BackendConfig;
|
|
1730
|
+
}
|
|
1731
|
+
/** Backend credentials forwarded to the platform if a sandbox must restart. */
|
|
1732
|
+
interface SessionBackendCredentials {
|
|
1733
|
+
apiKey: string;
|
|
1734
|
+
baseUrl?: string;
|
|
1735
|
+
}
|
|
1736
|
+
/** One content part accepted by the runtime session message endpoint. */
|
|
1737
|
+
type SessionMessageInputPart = PromptInputPart | {
|
|
1738
|
+
type: "reasoning";
|
|
1739
|
+
text: string;
|
|
1740
|
+
} | {
|
|
1741
|
+
type: "tool";
|
|
1742
|
+
tool: string;
|
|
1743
|
+
state: {
|
|
1744
|
+
status: "pending" | "running" | "completed" | "failed";
|
|
1745
|
+
input?: unknown;
|
|
1746
|
+
output?: unknown;
|
|
1747
|
+
};
|
|
1748
|
+
} | {
|
|
1749
|
+
type: "step-start";
|
|
1750
|
+
} | {
|
|
1751
|
+
type: "step-finish";
|
|
1752
|
+
reason?: string;
|
|
1753
|
+
tokens?: {
|
|
1754
|
+
total?: number;
|
|
1755
|
+
input?: number;
|
|
1756
|
+
output?: number;
|
|
1757
|
+
reasoning?: number;
|
|
1758
|
+
cache?: {
|
|
1759
|
+
write?: number;
|
|
1760
|
+
read?: number;
|
|
1761
|
+
};
|
|
1762
|
+
};
|
|
1763
|
+
cost?: number;
|
|
1764
|
+
};
|
|
1765
|
+
/** Message body accepted by `SandboxSession.sendMessage`. */
|
|
1766
|
+
interface SendSessionMessageRequest {
|
|
1767
|
+
messageId?: string;
|
|
1768
|
+
parts: SessionMessageInputPart[];
|
|
1769
|
+
system?: string;
|
|
1770
|
+
agent?: string;
|
|
1771
|
+
model?: {
|
|
1772
|
+
providerId: string;
|
|
1773
|
+
modelId: string;
|
|
1774
|
+
};
|
|
1775
|
+
reasoningEffort?: "low" | "medium" | "high";
|
|
1776
|
+
turnId?: string;
|
|
1777
|
+
interactions?: BackendConfig["interactions"];
|
|
1778
|
+
}
|
|
1779
|
+
/** Per-call controls for `SandboxSession.sendMessage`. */
|
|
1780
|
+
interface SendSessionMessageOptions {
|
|
1781
|
+
credentials?: SessionBackendCredentials;
|
|
1782
|
+
timeoutMs?: number;
|
|
1783
|
+
signal?: AbortSignal;
|
|
1784
|
+
}
|
|
1785
|
+
/** Response returned after a session message finishes processing. */
|
|
1786
|
+
interface SentSessionMessage {
|
|
1787
|
+
info: {
|
|
1788
|
+
id: string;
|
|
1789
|
+
role: "user" | "assistant" | "system";
|
|
1790
|
+
timestamp?: string;
|
|
1791
|
+
};
|
|
1792
|
+
parts: unknown[];
|
|
1793
|
+
}
|
|
1794
|
+
/** Canonical portable profile attached to a task session. */
|
|
1795
|
+
type TaskSessionProfile = AgentProfile & {
|
|
1796
|
+
name: string;
|
|
1797
|
+
};
|
|
1798
|
+
/** Options for creating an isolated background task session. */
|
|
1799
|
+
interface CreateTaskSessionOptions {
|
|
1800
|
+
sessionId: string;
|
|
1801
|
+
backend: BackendConfig;
|
|
1802
|
+
title: string;
|
|
1803
|
+
profile?: TaskSessionProfile;
|
|
1804
|
+
parentSessionId?: string;
|
|
1805
|
+
isolateFileWrites?: boolean;
|
|
1806
|
+
}
|
|
1807
|
+
/** Task-session metadata returned at creation time. */
|
|
1808
|
+
interface TaskSessionInfo {
|
|
1809
|
+
id: string;
|
|
1810
|
+
title?: string;
|
|
1811
|
+
parentSessionId?: string;
|
|
1812
|
+
worktreeInfo?: {
|
|
1813
|
+
worktreePath: string;
|
|
1814
|
+
branchName: string;
|
|
1815
|
+
baseCommitSha: string;
|
|
1816
|
+
};
|
|
1817
|
+
profile?: TaskSessionProfile;
|
|
1818
|
+
}
|
|
1819
|
+
/** One changed file in an isolated task session. */
|
|
1820
|
+
interface TaskSessionFileChange {
|
|
1821
|
+
file: string;
|
|
1822
|
+
operation: "added" | "modified" | "deleted";
|
|
1823
|
+
additions: number;
|
|
1824
|
+
deletions: number;
|
|
1825
|
+
}
|
|
1826
|
+
/** Current diff and commit history for an isolated task session. */
|
|
1827
|
+
interface TaskSessionChanges {
|
|
1828
|
+
sessionId: string;
|
|
1829
|
+
files: TaskSessionFileChange[];
|
|
1830
|
+
diff: string;
|
|
1831
|
+
commits: Array<{
|
|
1832
|
+
sha: string;
|
|
1833
|
+
message: string;
|
|
1834
|
+
date: string;
|
|
1835
|
+
}>;
|
|
1836
|
+
worktreeInfo: {
|
|
1837
|
+
worktreePath: string;
|
|
1838
|
+
branchName: string;
|
|
1839
|
+
baseCommitSha: string;
|
|
1840
|
+
headCommitSha?: string;
|
|
1841
|
+
};
|
|
1842
|
+
}
|
|
1843
|
+
/** Options for merging task-session changes into the main workspace. */
|
|
1844
|
+
interface CommitTaskSessionOptions {
|
|
1845
|
+
message?: string;
|
|
1846
|
+
files?: string[];
|
|
1847
|
+
}
|
|
1848
|
+
/** Result of merging task-session changes into the main workspace. */
|
|
1849
|
+
interface TaskSessionCommitResult {
|
|
1850
|
+
success: true;
|
|
1851
|
+
commitSha?: string;
|
|
1852
|
+
conflicts?: string[];
|
|
1853
|
+
appliedFiles: number;
|
|
1854
|
+
}
|
|
1573
1855
|
/**
|
|
1574
1856
|
* Options for `SandboxSession.events()` streaming.
|
|
1575
1857
|
*/
|
|
@@ -1604,6 +1886,28 @@ interface ListMessagesOptions {
|
|
|
1604
1886
|
/** Only return messages newer than this Unix-ms timestamp. */
|
|
1605
1887
|
since?: number;
|
|
1606
1888
|
}
|
|
1889
|
+
/**
|
|
1890
|
+
* Options for `box.session(id).fork()` — create a new session from an
|
|
1891
|
+
* existing conversation, optionally at a message boundary.
|
|
1892
|
+
*/
|
|
1893
|
+
interface SessionForkOptions {
|
|
1894
|
+
/** Fork at this message boundary. */
|
|
1895
|
+
messageId?: string;
|
|
1896
|
+
/** Target backend type for cross-backend forks. Defaults to parent backend. */
|
|
1897
|
+
targetBackend?: BackendType;
|
|
1898
|
+
/** Model override for the target backend. */
|
|
1899
|
+
targetModel?: {
|
|
1900
|
+
provider?: string;
|
|
1901
|
+
model?: string;
|
|
1902
|
+
apiKey?: string;
|
|
1903
|
+
baseUrl?: string;
|
|
1904
|
+
};
|
|
1905
|
+
/**
|
|
1906
|
+
* Files to include. The runtime currently rejects non-empty file lists;
|
|
1907
|
+
* exposed here so the SDK type tracks the wire contract exactly.
|
|
1908
|
+
*/
|
|
1909
|
+
files?: string[];
|
|
1910
|
+
}
|
|
1607
1911
|
/**
|
|
1608
1912
|
* One message on a session — user, assistant, or system. The metadata
|
|
1609
1913
|
* field carries the durability marker set by the sidecar:
|
|
@@ -1817,6 +2121,10 @@ interface BatchTask {
|
|
|
1817
2121
|
/** Per-task timeout in milliseconds */
|
|
1818
2122
|
timeoutMs?: number;
|
|
1819
2123
|
}
|
|
2124
|
+
/** Backend configuration accepted by batch execution, including named profiles. */
|
|
2125
|
+
type BatchBackend = Omit<Partial<BackendConfig>, "type"> & {
|
|
2126
|
+
type?: BackendType | `${BackendType}:${string}`;
|
|
2127
|
+
};
|
|
1820
2128
|
/**
|
|
1821
2129
|
* Options for batch execution.
|
|
1822
2130
|
*/
|
|
@@ -1831,11 +2139,38 @@ interface BatchOptions {
|
|
|
1831
2139
|
* Use `backend.profile` with a string for a named profile or a provider-neutral
|
|
1832
2140
|
* `AgentProfile` object for inline profile configuration.
|
|
1833
2141
|
*/
|
|
1834
|
-
backend?:
|
|
2142
|
+
backend?: BatchBackend;
|
|
2143
|
+
/** Run every task against each backend for comparison. */
|
|
2144
|
+
backends?: BatchBackend[];
|
|
2145
|
+
/** User identifier attached to the batch for platform attribution. */
|
|
2146
|
+
userId?: string;
|
|
2147
|
+
/** Partner identifier attached to the batch for credit attribution. */
|
|
2148
|
+
partnerId?: string;
|
|
2149
|
+
/** Request identifier used in events and metrics. */
|
|
2150
|
+
identifier?: string;
|
|
2151
|
+
/** Workload class used by capacity and lifecycle policy. */
|
|
2152
|
+
executionClass?: "project" | "simulation" | "background";
|
|
2153
|
+
/** Capacity to provision before execution starts. */
|
|
2154
|
+
desiredCapacity?: number;
|
|
2155
|
+
/** Maximum time to wait for requested capacity. */
|
|
2156
|
+
provisionTimeoutMs?: number;
|
|
1835
2157
|
/** Keep sandboxes alive after completion (default: false) */
|
|
1836
2158
|
persistent?: boolean;
|
|
2159
|
+
/** Lifecycle policy for persistent batch sandboxes. */
|
|
2160
|
+
lifecycle?: {
|
|
2161
|
+
idleTimeoutMs?: number;
|
|
2162
|
+
coldTimeoutMs?: number;
|
|
2163
|
+
};
|
|
2164
|
+
/** Use deterministic mock model responses. Intended for tests. */
|
|
2165
|
+
mock?: boolean;
|
|
1837
2166
|
/** Milliseconds to keep non-persistent batch sandboxes alive after completion. */
|
|
1838
2167
|
graceMs?: number;
|
|
2168
|
+
/** Repository cloned into persistent batch workspaces. */
|
|
2169
|
+
git?: GitConfig;
|
|
2170
|
+
/** Full replacement for the default agent system prompt. */
|
|
2171
|
+
systemPrompt?: string;
|
|
2172
|
+
/** Instructions appended to the default agent system prompt. */
|
|
2173
|
+
instructions?: string;
|
|
1839
2174
|
/**
|
|
1840
2175
|
* AbortSignal to cancel the batch mid-stream. When aborted, the HTTP
|
|
1841
2176
|
* request to `/batch/run` is torn down; the SSE generator stops
|
|
@@ -1847,6 +2182,14 @@ interface BatchOptions {
|
|
|
1847
2182
|
*/
|
|
1848
2183
|
signal?: AbortSignal;
|
|
1849
2184
|
}
|
|
2185
|
+
/** Complete request accepted by `runBatch` and `streamBatch`. */
|
|
2186
|
+
interface BatchRunRequest extends Omit<BatchOptions, "signal"> {
|
|
2187
|
+
tasks: BatchTask[];
|
|
2188
|
+
}
|
|
2189
|
+
/** Per-call controls that are not serialized into a batch request. */
|
|
2190
|
+
interface BatchRunOptions {
|
|
2191
|
+
signal?: AbortSignal;
|
|
2192
|
+
}
|
|
1850
2193
|
/**
|
|
1851
2194
|
* Result of a single task in a batch.
|
|
1852
2195
|
*/
|
|
@@ -1865,6 +2208,16 @@ interface BatchTaskResult {
|
|
|
1865
2208
|
retries: number;
|
|
1866
2209
|
/** Token usage if available */
|
|
1867
2210
|
tokensUsed?: number;
|
|
2211
|
+
/** Backend identifier for multi-backend batches. */
|
|
2212
|
+
backend?: string;
|
|
2213
|
+
/** Human-readable backend label emitted by the server. */
|
|
2214
|
+
backendLabel?: string;
|
|
2215
|
+
/** Model identifier emitted by the server. */
|
|
2216
|
+
backendModel?: string;
|
|
2217
|
+
/** Runtime session created for this task execution. */
|
|
2218
|
+
sessionId?: string;
|
|
2219
|
+
/** Sandbox used for this task execution. */
|
|
2220
|
+
sandboxId?: string;
|
|
1868
2221
|
}
|
|
1869
2222
|
/**
|
|
1870
2223
|
* Summary of batch execution.
|
|
@@ -1883,23 +2236,145 @@ interface BatchResult {
|
|
|
1883
2236
|
/** Individual task results */
|
|
1884
2237
|
results: BatchTaskResult[];
|
|
1885
2238
|
}
|
|
1886
|
-
/**
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
2239
|
+
/** Token and tool usage emitted when one batch task completes. */
|
|
2240
|
+
interface BatchTaskUsage {
|
|
2241
|
+
inputTokens: number;
|
|
2242
|
+
outputTokens: number;
|
|
2243
|
+
cacheReadTokens?: number;
|
|
2244
|
+
cacheWriteTokens?: number;
|
|
2245
|
+
toolCallCount?: number;
|
|
2246
|
+
}
|
|
2247
|
+
/** Per-backend aggregate emitted by `batch.completed`. */
|
|
2248
|
+
interface BatchBackendStats {
|
|
2249
|
+
backend: string;
|
|
2250
|
+
backendLabel?: string;
|
|
2251
|
+
backendModel?: string;
|
|
2252
|
+
success: number;
|
|
2253
|
+
failure: number;
|
|
2254
|
+
retries: number;
|
|
2255
|
+
successRate: number;
|
|
2256
|
+
}
|
|
2257
|
+
/** Sidecars allocated to one backend configuration. */
|
|
2258
|
+
interface BatchSidecarGroup {
|
|
2259
|
+
backend: string;
|
|
2260
|
+
sidecarIds: string[];
|
|
2261
|
+
}
|
|
2262
|
+
interface BatchTaskEventIdentity {
|
|
2263
|
+
taskId: string;
|
|
2264
|
+
backend: string;
|
|
2265
|
+
backendLabel?: string;
|
|
2266
|
+
backendModel?: string;
|
|
2267
|
+
}
|
|
2268
|
+
/** Data payloads keyed by the SSE event name emitted by `/batch/run`. */
|
|
2269
|
+
interface BatchEventDataMap {
|
|
2270
|
+
"batch.provisioning": {
|
|
2271
|
+
desiredCapacity: number;
|
|
2272
|
+
currentCapacity: number;
|
|
2273
|
+
provisionTimeoutMs: number;
|
|
2274
|
+
};
|
|
2275
|
+
"batch.provisioned": {
|
|
2276
|
+
capacity: number;
|
|
2277
|
+
};
|
|
2278
|
+
"batch.started": {
|
|
2279
|
+
taskCount: number;
|
|
2280
|
+
backendCount: number;
|
|
2281
|
+
totalExecutions: number;
|
|
2282
|
+
maxConcurrent: number;
|
|
2283
|
+
scalingMode: string;
|
|
2284
|
+
backends: string[];
|
|
2285
|
+
};
|
|
2286
|
+
"sidecars.allocated": {
|
|
2287
|
+
count: number;
|
|
2288
|
+
groups: BatchSidecarGroup[];
|
|
2289
|
+
};
|
|
2290
|
+
"batch.completed": {
|
|
2291
|
+
taskCount: number;
|
|
2292
|
+
backendCount: number;
|
|
2293
|
+
totalExecutions: number;
|
|
2294
|
+
totalSuccess: number;
|
|
2295
|
+
totalFailure: number;
|
|
2296
|
+
totalRetries: number;
|
|
2297
|
+
successRate: number;
|
|
2298
|
+
byBackend: BatchBackendStats[];
|
|
2299
|
+
};
|
|
2300
|
+
"batch.failed": {
|
|
2301
|
+
error: string;
|
|
2302
|
+
backends?: string[];
|
|
2303
|
+
};
|
|
2304
|
+
"batch.persistent": {
|
|
2305
|
+
message: string;
|
|
2306
|
+
sidecarCount: number;
|
|
2307
|
+
};
|
|
2308
|
+
"batch.grace_period": {
|
|
2309
|
+
message: string;
|
|
2310
|
+
sidecarCount: number;
|
|
2311
|
+
graceMs: number;
|
|
2312
|
+
sidecarIds: string[];
|
|
2313
|
+
};
|
|
2314
|
+
"task.started": BatchTaskEventIdentity & {
|
|
2315
|
+
sidecarId: string;
|
|
2316
|
+
projectRef?: string;
|
|
2317
|
+
attempt: number;
|
|
2318
|
+
};
|
|
2319
|
+
"task.message.delta": BatchTaskEventIdentity & {
|
|
2320
|
+
sidecarId: string;
|
|
2321
|
+
projectRef?: string;
|
|
2322
|
+
value: string;
|
|
2323
|
+
part: Record<string, unknown>;
|
|
2324
|
+
};
|
|
2325
|
+
"task.reasoning": BatchTaskEventIdentity & {
|
|
2326
|
+
sidecarId: string;
|
|
2327
|
+
projectRef?: string;
|
|
2328
|
+
value: string;
|
|
2329
|
+
part: Record<string, unknown>;
|
|
2330
|
+
};
|
|
2331
|
+
"task.tool.updated": BatchTaskEventIdentity & {
|
|
2332
|
+
sidecarId: string;
|
|
2333
|
+
projectRef?: string;
|
|
2334
|
+
part: Record<string, unknown>;
|
|
2335
|
+
};
|
|
2336
|
+
"task.completed": BatchTaskEventIdentity & {
|
|
2337
|
+
durationMs: number;
|
|
2338
|
+
attempt: number;
|
|
2339
|
+
retries: number;
|
|
2340
|
+
sidecarId: string;
|
|
2341
|
+
projectRef?: string;
|
|
2342
|
+
resultSummary?: string;
|
|
2343
|
+
sessionId?: string;
|
|
2344
|
+
usage: BatchTaskUsage;
|
|
2345
|
+
};
|
|
2346
|
+
"task.failed": BatchTaskEventIdentity & {
|
|
2347
|
+
durationMs: number;
|
|
2348
|
+
attempt: number;
|
|
2349
|
+
retries: number;
|
|
2350
|
+
error: string;
|
|
2351
|
+
sidecarId?: string;
|
|
2352
|
+
};
|
|
2353
|
+
"task.retry": BatchTaskEventIdentity & {
|
|
2354
|
+
attempt: number;
|
|
2355
|
+
maxRetries: number;
|
|
2356
|
+
error: string;
|
|
2357
|
+
delayMs: number;
|
|
2358
|
+
};
|
|
2359
|
+
"backend.completed": {
|
|
2360
|
+
backend: string;
|
|
2361
|
+
backendLabel?: string;
|
|
2362
|
+
backendModel?: string;
|
|
2363
|
+
success: number;
|
|
2364
|
+
failure: number;
|
|
2365
|
+
retries: number;
|
|
2366
|
+
successRate: number;
|
|
2367
|
+
};
|
|
2368
|
+
"sidecar.releasing": {
|
|
2369
|
+
sidecarId: string;
|
|
2370
|
+
};
|
|
1902
2371
|
}
|
|
2372
|
+
/** Discriminated SSE event from a batch execution. */
|
|
2373
|
+
type BatchEvent = { [K in keyof BatchEventDataMap]: {
|
|
2374
|
+
type: K;
|
|
2375
|
+
data: BatchEventDataMap[K]; /** Optional SSE id used by reconnecting consumers. */
|
|
2376
|
+
id?: string;
|
|
2377
|
+
} }[keyof BatchEventDataMap];
|
|
1903
2378
|
/**
|
|
1904
2379
|
* Stable worker identifier inside a sandbox fleet.
|
|
1905
2380
|
*
|
|
@@ -2421,74 +2896,24 @@ interface ListSandboxFleetOptions extends ListSandboxOptions {
|
|
|
2421
2896
|
fleetId: string;
|
|
2422
2897
|
}
|
|
2423
2898
|
/**
|
|
2424
|
-
* Options for
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
/** Keep sandbox running after checkpoint (default: false - sandbox stops) */
|
|
2430
|
-
leaveRunning?: boolean;
|
|
2431
|
-
/** Also create a filesystem snapshot for data consistency */
|
|
2432
|
-
includeSnapshot?: boolean;
|
|
2433
|
-
}
|
|
2434
|
-
/**
|
|
2435
|
-
* Result of a checkpoint operation.
|
|
2436
|
-
*/
|
|
2437
|
-
interface CheckpointResult {
|
|
2438
|
-
/** Unique checkpoint identifier */
|
|
2439
|
-
checkpointId: string;
|
|
2440
|
-
/** When the checkpoint was created */
|
|
2441
|
-
createdAt: Date;
|
|
2442
|
-
/** Size of checkpoint in bytes (memory state) */
|
|
2443
|
-
sizeBytes?: number;
|
|
2444
|
-
/** Tags applied to the checkpoint */
|
|
2445
|
-
tags: string[];
|
|
2446
|
-
}
|
|
2447
|
-
/**
|
|
2448
|
-
* Information about an existing checkpoint.
|
|
2449
|
-
*/
|
|
2450
|
-
interface CheckpointInfo {
|
|
2451
|
-
/** Unique checkpoint identifier */
|
|
2452
|
-
checkpointId: string;
|
|
2453
|
-
/** Sandbox this checkpoint belongs to */
|
|
2454
|
-
sandboxId: string;
|
|
2455
|
-
/** When the checkpoint was created */
|
|
2456
|
-
createdAt: Date;
|
|
2457
|
-
/** Tags applied to the checkpoint */
|
|
2458
|
-
tags: string[];
|
|
2459
|
-
/** Size of checkpoint in bytes */
|
|
2460
|
-
sizeBytes?: number;
|
|
2461
|
-
/** Whether checkpoint includes memory state */
|
|
2462
|
-
hasMemoryState: boolean;
|
|
2463
|
-
/** Whether checkpoint includes filesystem snapshot */
|
|
2464
|
-
hasFilesystemSnapshot: boolean;
|
|
2465
|
-
}
|
|
2466
|
-
/**
|
|
2467
|
-
* Options for forking a sandbox from a checkpoint.
|
|
2899
|
+
* Options for branching a running sandbox into N copy-on-write children.
|
|
2900
|
+
*
|
|
2901
|
+
* Branch forks a LIVE VM's memory into many children at once (Firecracker
|
|
2902
|
+
* UFFD copy-on-write): the children share the parent's clean pages and the
|
|
2903
|
+
* parent stays running. For durable filesystem state use snapshots instead.
|
|
2468
2904
|
*/
|
|
2469
|
-
interface
|
|
2470
|
-
/**
|
|
2471
|
-
name?: string;
|
|
2472
|
-
/** Override environment variables in the fork */
|
|
2905
|
+
interface BranchOptions {
|
|
2906
|
+
/** Override environment variables in every child. */
|
|
2473
2907
|
env?: Record<string, string>;
|
|
2474
|
-
/**
|
|
2475
|
-
|
|
2476
|
-
|
|
2908
|
+
/**
|
|
2909
|
+
* Custom metadata applied to every child.
|
|
2910
|
+
*
|
|
2911
|
+
* Resource overrides are intentionally NOT accepted: a live branch restores
|
|
2912
|
+
* the parent's memory copy-on-write into each child, which requires
|
|
2913
|
+
* matching resources — children always inherit the parent's.
|
|
2914
|
+
*/
|
|
2477
2915
|
metadata?: Record<string, unknown>;
|
|
2478
2916
|
}
|
|
2479
|
-
/**
|
|
2480
|
-
* Result of a fork operation.
|
|
2481
|
-
*/
|
|
2482
|
-
interface ForkResult {
|
|
2483
|
-
/** The newly created sandbox instance */
|
|
2484
|
-
sandbox: SandboxInfo;
|
|
2485
|
-
/** The checkpoint that was forked from */
|
|
2486
|
-
sourceCheckpoint: CheckpointInfo;
|
|
2487
|
-
/** ID of the source sandbox */
|
|
2488
|
-
sourceId: string;
|
|
2489
|
-
/** Time taken to fork in milliseconds */
|
|
2490
|
-
forkTimeMs: number;
|
|
2491
|
-
}
|
|
2492
2917
|
/**
|
|
2493
2918
|
* Infrastructure driver identifier.
|
|
2494
2919
|
*
|
|
@@ -2520,6 +2945,104 @@ interface SandboxAccelerator {
|
|
|
2520
2945
|
/** Minimum device memory in megabytes when the exact GPU class is flexible. */
|
|
2521
2946
|
memoryMB?: number;
|
|
2522
2947
|
}
|
|
2948
|
+
declare const GPU_LEASE_PROVIDER_NAMES: readonly ["runpod", "vast-ai", "lambda-labs", "tensordock", "paperspace", "aws", "gcp", "azure", "crusoe", "fluidstack"];
|
|
2949
|
+
type GpuLeaseProviderName = (typeof GPU_LEASE_PROVIDER_NAMES)[number];
|
|
2950
|
+
interface GpuLeaseProviderSelection {
|
|
2951
|
+
strategy: "explicit" | "cheapest";
|
|
2952
|
+
selectedProvider: GpuLeaseProviderName;
|
|
2953
|
+
requestedProvider?: GpuLeaseProviderName;
|
|
2954
|
+
candidates: Array<{
|
|
2955
|
+
provider: GpuLeaseProviderName;
|
|
2956
|
+
accelerator: SandboxAccelerator & {
|
|
2957
|
+
count: number;
|
|
2958
|
+
};
|
|
2959
|
+
providerInstanceType?: string;
|
|
2960
|
+
region?: string;
|
|
2961
|
+
pricingSource?: "live" | "configured" | "static";
|
|
2962
|
+
providerCostPerHourUsd: number;
|
|
2963
|
+
customerPricePerHourUsd: number;
|
|
2964
|
+
maxLifetimeSeconds: number;
|
|
2965
|
+
estimatedProviderCostUsd: number;
|
|
2966
|
+
estimatedCustomerCostUsd: number;
|
|
2967
|
+
}>;
|
|
2968
|
+
rejected: Array<{
|
|
2969
|
+
provider: GpuLeaseProviderName;
|
|
2970
|
+
error: string;
|
|
2971
|
+
}>;
|
|
2972
|
+
}
|
|
2973
|
+
type GpuLeaseStatus = "provisioning" | "ready" | "detaching" | "destroyed" | "failed";
|
|
2974
|
+
interface GpuLeaseBilling {
|
|
2975
|
+
seconds: number;
|
|
2976
|
+
providerCostUsd: number;
|
|
2977
|
+
customerCostUsd: number;
|
|
2978
|
+
providerCostPerHourUsd: number;
|
|
2979
|
+
customerPricePerHourUsd: number;
|
|
2980
|
+
startedAt: string;
|
|
2981
|
+
stoppedAt: string;
|
|
2982
|
+
}
|
|
2983
|
+
interface GpuLease {
|
|
2984
|
+
id: string;
|
|
2985
|
+
projectRef: string;
|
|
2986
|
+
ownerUserId: string;
|
|
2987
|
+
productId?: string;
|
|
2988
|
+
provider: GpuLeaseProviderName;
|
|
2989
|
+
providerLeaseId?: string;
|
|
2990
|
+
providerInstanceType?: string;
|
|
2991
|
+
region?: string;
|
|
2992
|
+
workerUrl?: string;
|
|
2993
|
+
status: GpuLeaseStatus;
|
|
2994
|
+
accelerator: SandboxAccelerator & {
|
|
2995
|
+
count: number;
|
|
2996
|
+
};
|
|
2997
|
+
image?: string;
|
|
2998
|
+
maxSpendUsd: number;
|
|
2999
|
+
maxLifetimeSeconds: number;
|
|
3000
|
+
idleTimeoutSeconds?: number;
|
|
3001
|
+
providerCostPerHourUsd?: number;
|
|
3002
|
+
customerPricePerHourUsd?: number;
|
|
3003
|
+
estimatedProviderCostUsd?: number;
|
|
3004
|
+
estimatedCustomerCostUsd?: number;
|
|
3005
|
+
providerSelection?: GpuLeaseProviderSelection;
|
|
3006
|
+
createdAt: string;
|
|
3007
|
+
updatedAt: string;
|
|
3008
|
+
readyAt?: string;
|
|
3009
|
+
lastUsedAt?: string;
|
|
3010
|
+
destroyedAt?: string;
|
|
3011
|
+
failure?: string;
|
|
3012
|
+
billing?: GpuLeaseBilling;
|
|
3013
|
+
}
|
|
3014
|
+
interface AttachGpuLeaseOptions {
|
|
3015
|
+
provider?: GpuLeaseProviderName;
|
|
3016
|
+
accelerator: SandboxAccelerator;
|
|
3017
|
+
image?: string;
|
|
3018
|
+
env?: Record<string, string>;
|
|
3019
|
+
maxSpendUsd: number;
|
|
3020
|
+
maxLifetimeSeconds: number;
|
|
3021
|
+
idleTimeoutSeconds?: number;
|
|
3022
|
+
}
|
|
3023
|
+
type CreateGpuLeaseOptions = Omit<AttachGpuLeaseOptions, "accelerator">;
|
|
3024
|
+
interface GpuLeaseExecOptions {
|
|
3025
|
+
command: string;
|
|
3026
|
+
timeoutMs?: number;
|
|
3027
|
+
env?: Record<string, string>;
|
|
3028
|
+
cwd?: string;
|
|
3029
|
+
}
|
|
3030
|
+
interface GpuLeaseCommandResult {
|
|
3031
|
+
exitCode: number;
|
|
3032
|
+
stdout: string;
|
|
3033
|
+
stderr: string;
|
|
3034
|
+
durationMs?: number;
|
|
3035
|
+
}
|
|
3036
|
+
interface GpuLeaseExecResult {
|
|
3037
|
+
lease: GpuLease;
|
|
3038
|
+
result: GpuLeaseCommandResult;
|
|
3039
|
+
}
|
|
3040
|
+
interface GpuLeaseManager {
|
|
3041
|
+
attach(options: AttachGpuLeaseOptions): Promise<GpuLease>;
|
|
3042
|
+
list(): Promise<GpuLease[]>;
|
|
3043
|
+
exec(leaseId: string, options: GpuLeaseExecOptions): Promise<GpuLeaseExecResult>;
|
|
3044
|
+
detach(leaseId: string): Promise<GpuLease>;
|
|
3045
|
+
}
|
|
2523
3046
|
/**
|
|
2524
3047
|
* Infrastructure driver configuration.
|
|
2525
3048
|
*
|
|
@@ -2751,10 +3274,18 @@ interface BackendConfig {
|
|
|
2751
3274
|
question?: boolean;
|
|
2752
3275
|
plan?: boolean;
|
|
2753
3276
|
};
|
|
2754
|
-
/**
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
3277
|
+
/** Runtime session metadata used for attribution and workspace selection. */
|
|
3278
|
+
metadata?: {
|
|
3279
|
+
containerType?: string;
|
|
3280
|
+
telemetry?: {
|
|
3281
|
+
otlp: {
|
|
3282
|
+
endpoint: string;
|
|
3283
|
+
headers: string;
|
|
3284
|
+
};
|
|
3285
|
+
resourceAttributes: Record<string, string>;
|
|
3286
|
+
};
|
|
3287
|
+
[key: string]: unknown;
|
|
3288
|
+
};
|
|
2758
3289
|
}
|
|
2759
3290
|
/**
|
|
2760
3291
|
* Backend capabilities.
|
|
@@ -3728,6 +4259,71 @@ interface FileInfo {
|
|
|
3728
4259
|
/** Last access time */
|
|
3729
4260
|
accessTime: Date;
|
|
3730
4261
|
}
|
|
4262
|
+
/** File metadata returned by the recursive workspace tree endpoint. */
|
|
4263
|
+
interface FileTreeFile {
|
|
4264
|
+
path: string;
|
|
4265
|
+
size: number;
|
|
4266
|
+
/** File modification time as Unix milliseconds. */
|
|
4267
|
+
mtime: number;
|
|
4268
|
+
}
|
|
4269
|
+
/** Options for recursively scanning a workspace tree. */
|
|
4270
|
+
interface FileTreeOptions {
|
|
4271
|
+
sessionId?: string;
|
|
4272
|
+
maxDepth?: number;
|
|
4273
|
+
}
|
|
4274
|
+
/** Recursive workspace tree with scan statistics. */
|
|
4275
|
+
interface FileTreeResult {
|
|
4276
|
+
root: string;
|
|
4277
|
+
directories: string[];
|
|
4278
|
+
files: FileTreeFile[];
|
|
4279
|
+
stats: {
|
|
4280
|
+
totalDirectories: number;
|
|
4281
|
+
totalFiles: number;
|
|
4282
|
+
scanDurationMs: number;
|
|
4283
|
+
truncated: boolean;
|
|
4284
|
+
};
|
|
4285
|
+
}
|
|
4286
|
+
/** File content and metadata returned by a batch read. */
|
|
4287
|
+
interface FileReadResult {
|
|
4288
|
+
path: string;
|
|
4289
|
+
content: string;
|
|
4290
|
+
encoding: "utf8" | "base64";
|
|
4291
|
+
hash: string;
|
|
4292
|
+
size: number;
|
|
4293
|
+
/** File modification time as Unix milliseconds. */
|
|
4294
|
+
mtime: number;
|
|
4295
|
+
}
|
|
4296
|
+
/** One file that could not be read during a partial-success batch. */
|
|
4297
|
+
interface FileReadError {
|
|
4298
|
+
path: string;
|
|
4299
|
+
error: string;
|
|
4300
|
+
code?: string;
|
|
4301
|
+
}
|
|
4302
|
+
/** Options for reading files in a batch. */
|
|
4303
|
+
interface FileReadBatchOptions {
|
|
4304
|
+
encoding?: "utf8" | "base64";
|
|
4305
|
+
sessionId?: string;
|
|
4306
|
+
}
|
|
4307
|
+
/** Partial-success result from a batch file read. */
|
|
4308
|
+
interface FileReadBatchResult {
|
|
4309
|
+
files: FileReadResult[];
|
|
4310
|
+
errors: FileReadError[];
|
|
4311
|
+
stats: {
|
|
4312
|
+
requested: number;
|
|
4313
|
+
succeeded: number;
|
|
4314
|
+
failed: number;
|
|
4315
|
+
};
|
|
4316
|
+
}
|
|
4317
|
+
/** Metadata returned after a successful file write. */
|
|
4318
|
+
interface FileWriteResult {
|
|
4319
|
+
path: string;
|
|
4320
|
+
hash: string;
|
|
4321
|
+
size: number;
|
|
4322
|
+
/** File modification time as Unix milliseconds. */
|
|
4323
|
+
mtime: number;
|
|
4324
|
+
/** Encoding echoed by runtimes that include it in write responses. */
|
|
4325
|
+
encoding?: "utf8" | "base64";
|
|
4326
|
+
}
|
|
3731
4327
|
/**
|
|
3732
4328
|
* Options for uploading files.
|
|
3733
4329
|
*/
|
|
@@ -3778,6 +4374,8 @@ interface ListOptions {
|
|
|
3778
4374
|
all?: boolean;
|
|
3779
4375
|
/** Include full metadata (like ls -l) */
|
|
3780
4376
|
long?: boolean;
|
|
4377
|
+
/** Task session id for session-specific workspace isolation. */
|
|
4378
|
+
sessionId?: string;
|
|
3781
4379
|
}
|
|
3782
4380
|
/**
|
|
3783
4381
|
* Options for creating directories.
|
|
@@ -3794,6 +4392,8 @@ interface MkdirOptions {
|
|
|
3794
4392
|
interface DeleteOptions {
|
|
3795
4393
|
/** Recursively delete directories (like rm -rf) */
|
|
3796
4394
|
recursive?: boolean;
|
|
4395
|
+
/** Agent session whose workspace and change history receive the deletion. */
|
|
4396
|
+
sessionId?: string;
|
|
3797
4397
|
}
|
|
3798
4398
|
/**
|
|
3799
4399
|
* File system operations for sandboxes. Access via `sandbox.fs`.
|
|
@@ -3858,6 +4458,10 @@ interface WriteManyFile {
|
|
|
3858
4458
|
interface WriteFileOptions {
|
|
3859
4459
|
/** Unix mode bits applied after write, e.g. 0o755. */
|
|
3860
4460
|
mode?: number;
|
|
4461
|
+
/** Encoding of `content` on the wire. */
|
|
4462
|
+
encoding?: "utf8" | "base64";
|
|
4463
|
+
/** Agent session whose workspace and change history receive the write. */
|
|
4464
|
+
sessionId?: string;
|
|
3861
4465
|
}
|
|
3862
4466
|
/** Options for {@link FileSystem.writeMany}. */
|
|
3863
4467
|
interface WriteManyOptions {
|
|
@@ -3879,6 +4483,10 @@ interface FileSystem {
|
|
|
3879
4483
|
* @throws NotFoundError if file doesn't exist
|
|
3880
4484
|
*/
|
|
3881
4485
|
read(path: string): Promise<string>;
|
|
4486
|
+
/** Read up to any number of files with content metadata and per-file errors. */
|
|
4487
|
+
readBatch(paths: string[], options?: FileReadBatchOptions): Promise<FileReadBatchResult>;
|
|
4488
|
+
/** Recursively scan the workspace and return file metadata. */
|
|
4489
|
+
tree(path: string, options?: FileTreeOptions): Promise<FileTreeResult>;
|
|
3882
4490
|
/**
|
|
3883
4491
|
* Write string content to a file.
|
|
3884
4492
|
* For binary files, use upload() instead.
|
|
@@ -3887,7 +4495,7 @@ interface FileSystem {
|
|
|
3887
4495
|
* @param path - Path to file (relative to workspace)
|
|
3888
4496
|
* @param content - Content to write
|
|
3889
4497
|
*/
|
|
3890
|
-
write(path: string, content: string, options?: WriteFileOptions): Promise<
|
|
4498
|
+
write(path: string, content: string, options?: WriteFileOptions): Promise<FileWriteResult>;
|
|
3891
4499
|
/**
|
|
3892
4500
|
* Write many files in one paced, retry-aware batch.
|
|
3893
4501
|
*
|
|
@@ -4354,6 +4962,10 @@ interface SandboxSessionHost extends InteractiveSessionHost {
|
|
|
4354
4962
|
_sessionEvents(id: string, opts?: SessionEventStreamOptions): AsyncGenerator<SandboxEvent>;
|
|
4355
4963
|
_sessionResult(id: string): Promise<PromptResult>;
|
|
4356
4964
|
_sessionCancel(id: string): Promise<void>;
|
|
4965
|
+
_sessionDelete(id: string): Promise<void>;
|
|
4966
|
+
_sessionSendMessage(id: string, request: SendSessionMessageRequest, options?: SendSessionMessageOptions): Promise<SentSessionMessage>;
|
|
4967
|
+
messages(opts: ListMessagesOptions): Promise<SessionMessage[]>;
|
|
4968
|
+
_sessionFork(id: string, opts?: SessionForkOptions): Promise<SessionInfo>;
|
|
4357
4969
|
_respondToPermission(id: string, permissionID: string, options: RespondToPermissionOptions): Promise<void>;
|
|
4358
4970
|
_interrupt(id: string): Promise<InterruptResult>;
|
|
4359
4971
|
_answerQuestion(id: string, answers: Record<string, string[]>): Promise<void>;
|
|
@@ -4400,12 +5012,22 @@ declare class SandboxSession {
|
|
|
4400
5012
|
* (e.g. `dispatchPrompt`).
|
|
4401
5013
|
*/
|
|
4402
5014
|
result(): Promise<PromptResult>;
|
|
5015
|
+
/**
|
|
5016
|
+
* List persisted messages for this session, including in-flight assistant
|
|
5017
|
+
* content when the runtime has flushed partial output.
|
|
5018
|
+
*/
|
|
5019
|
+
messages(opts?: Omit<ListMessagesOptions, "sessionId">): Promise<SessionMessage[]>;
|
|
4403
5020
|
/**
|
|
4404
5021
|
* Continue this session with an additional prompt. Equivalent to
|
|
4405
5022
|
* `box.prompt(message, { ...opts, sessionId: this.id })` but reads
|
|
4406
5023
|
* naturally on a Session reference.
|
|
4407
5024
|
*/
|
|
4408
5025
|
prompt(message: string | PromptInputPart[], opts?: PromptOptions): Promise<PromptResult>;
|
|
5026
|
+
/**
|
|
5027
|
+
* Send a structured message through the session message endpoint. Model and
|
|
5028
|
+
* message identifiers are translated to the runtime's wire names by the SDK.
|
|
5029
|
+
*/
|
|
5030
|
+
sendMessage(request: SendSessionMessageRequest, options?: SendSessionMessageOptions): Promise<SentSessionMessage>;
|
|
4409
5031
|
/**
|
|
4410
5032
|
* Abort the session's in-flight execution; the session and its messages
|
|
4411
5033
|
* are preserved (this does not delete the session). Void-returning alias
|
|
@@ -4415,6 +5037,17 @@ declare class SandboxSession {
|
|
|
4415
5037
|
* aborting a session with nothing in flight is a no-op.
|
|
4416
5038
|
*/
|
|
4417
5039
|
cancel(): Promise<void>;
|
|
5040
|
+
/** Delete this session and its persisted runtime state. */
|
|
5041
|
+
delete(): Promise<void>;
|
|
5042
|
+
/**
|
|
5043
|
+
* Fork this session into a new queued session. The fork shares the
|
|
5044
|
+
* parent workspace and copies conversation history up to `messageId`
|
|
5045
|
+
* when supplied.
|
|
5046
|
+
*/
|
|
5047
|
+
fork(opts?: SessionForkOptions): Promise<{
|
|
5048
|
+
session: SandboxSession;
|
|
5049
|
+
info: SessionInfo;
|
|
5050
|
+
}>;
|
|
4418
5051
|
/**
|
|
4419
5052
|
* Drive this session's harness in INTERACTIVE mode: spawn its native TUI,
|
|
4420
5053
|
* stream the live framebuffer, and inject prompts as keystrokes. Distinct
|
|
@@ -4444,6 +5077,23 @@ declare class SandboxSession {
|
|
|
4444
5077
|
answer(answers: Record<string, string[]>): Promise<void>;
|
|
4445
5078
|
}
|
|
4446
5079
|
//#endregion
|
|
5080
|
+
//#region src/task-session.d.ts
|
|
5081
|
+
/** @internal Operations implemented by `SandboxInstance`. */
|
|
5082
|
+
interface SandboxTaskSessionHost extends SandboxSessionHost {
|
|
5083
|
+
_taskSessionChanges(id: string): Promise<TaskSessionChanges>;
|
|
5084
|
+
_taskSessionCommit(id: string, options?: CommitTaskSessionOptions): Promise<TaskSessionCommitResult>;
|
|
5085
|
+
}
|
|
5086
|
+
/** A background task session with isolated changeset operations. */
|
|
5087
|
+
declare class SandboxTaskSession extends SandboxSession {
|
|
5088
|
+
private readonly taskBox;
|
|
5089
|
+
/** @internal Apps should call `box.taskSession(id)`. */
|
|
5090
|
+
constructor(taskBox: SandboxTaskSessionHost, id: string);
|
|
5091
|
+
/** Read the task's isolated file changes. */
|
|
5092
|
+
changes(): Promise<TaskSessionChanges>;
|
|
5093
|
+
/** Apply all or a selected subset of the task's isolated file changes. */
|
|
5094
|
+
commit(options?: CommitTaskSessionOptions): Promise<TaskSessionCommitResult>;
|
|
5095
|
+
}
|
|
5096
|
+
//#endregion
|
|
4447
5097
|
//#region src/trace-exporter.d.ts
|
|
4448
5098
|
type JsonObject = {
|
|
4449
5099
|
[key: string]: JsonValue;
|
|
@@ -4469,6 +5119,18 @@ declare function toOtelJson(bundle: TraceExportBundle, serviceName?: string): Js
|
|
|
4469
5119
|
declare function otelTraceIdForTangleTrace(traceId: string): string;
|
|
4470
5120
|
//#endregion
|
|
4471
5121
|
//#region src/sandbox.d.ts
|
|
5122
|
+
/**
|
|
5123
|
+
* Result of registering a sidecar session mapping. `reprovisionRequired` is
|
|
5124
|
+
* true when the server reports the mapped sidecar is stale (HTTP 410) and the
|
|
5125
|
+
* caller must reprovision the sandbox before retrying.
|
|
5126
|
+
*/
|
|
5127
|
+
interface SessionMappingResult {
|
|
5128
|
+
success: boolean;
|
|
5129
|
+
sessionId: string;
|
|
5130
|
+
sidecarSessionId?: string;
|
|
5131
|
+
reprovisionRequired: boolean;
|
|
5132
|
+
code?: string;
|
|
5133
|
+
}
|
|
4472
5134
|
/**
|
|
4473
5135
|
* HTTP client interface for making requests.
|
|
4474
5136
|
*/
|
|
@@ -4529,6 +5191,7 @@ declare class SandboxInstance {
|
|
|
4529
5191
|
private readonly client;
|
|
4530
5192
|
private info;
|
|
4531
5193
|
private readonly defaultRuntimeBackend?;
|
|
5194
|
+
private readonly runtime;
|
|
4532
5195
|
constructor(client: HttpClient, info: SandboxInfo, defaultRuntimeBackend?: BackendConfig);
|
|
4533
5196
|
/** Unique sandbox identifier */
|
|
4534
5197
|
get id(): string;
|
|
@@ -4550,6 +5213,8 @@ declare class SandboxInstance {
|
|
|
4550
5213
|
get expiresAt(): Date | undefined;
|
|
4551
5214
|
/** Error message if status is 'failed' */
|
|
4552
5215
|
get error(): string | undefined;
|
|
5216
|
+
/** GPU lease attached during sandbox creation, when requested. */
|
|
5217
|
+
get gpuLease(): GpuLease | undefined;
|
|
4553
5218
|
/** Web terminal URL for browser-based access */
|
|
4554
5219
|
get url(): string | undefined;
|
|
4555
5220
|
/**
|
|
@@ -4745,7 +5410,7 @@ declare class SandboxInstance {
|
|
|
4745
5410
|
* await box.write("/tmp/config.json", JSON.stringify(config));
|
|
4746
5411
|
* ```
|
|
4747
5412
|
*/
|
|
4748
|
-
write(path: string, content: string, options?: WriteFileOptions): Promise<
|
|
5413
|
+
write(path: string, content: string, options?: WriteFileOptions): Promise<FileWriteResult>;
|
|
4749
5414
|
/**
|
|
4750
5415
|
* Write many files in one paced, retry-aware batch — see
|
|
4751
5416
|
* {@link FileSystem.writeMany}. Each file goes through {@link write}; a small
|
|
@@ -4760,6 +5425,7 @@ declare class SandboxInstance {
|
|
|
4760
5425
|
* Returns the complete response after the agent finishes.
|
|
4761
5426
|
*/
|
|
4762
5427
|
prompt(message: string | PromptInputPart[], options?: PromptOptions): Promise<PromptResult>;
|
|
5428
|
+
private logStreamCheckpoint;
|
|
4763
5429
|
/**
|
|
4764
5430
|
* Stream events from an agent prompt.
|
|
4765
5431
|
* Use this for real-time updates during agent execution.
|
|
@@ -4882,6 +5548,14 @@ declare class SandboxInstance {
|
|
|
4882
5548
|
* ```
|
|
4883
5549
|
*/
|
|
4884
5550
|
search(pattern: string, options?: SearchOptions): AsyncGenerator<SearchMatch>;
|
|
5551
|
+
/** Basic health reported by the runtime inside this sandbox. */
|
|
5552
|
+
runtimeHealth(): Promise<SandboxRuntimeHealth>;
|
|
5553
|
+
/** Return the runtime's current listening-port snapshot. */
|
|
5554
|
+
ports(): Promise<SandboxPortBinding[]>;
|
|
5555
|
+
/** Interactive terminal operations for this runtime. */
|
|
5556
|
+
get terminals(): SandboxTerminalManager;
|
|
5557
|
+
/** List profiles installed in this sandbox runtime. */
|
|
5558
|
+
listProfiles(): Promise<SandboxRuntimeProfileList>;
|
|
4885
5559
|
/**
|
|
4886
5560
|
* Live whole-sandbox resource usage (memory + CPU) from the container cgroup.
|
|
4887
5561
|
*
|
|
@@ -4965,6 +5639,8 @@ declare class SandboxInstance {
|
|
|
4965
5639
|
* ```
|
|
4966
5640
|
*/
|
|
4967
5641
|
get fs(): FileSystem;
|
|
5642
|
+
private fsReadBatch;
|
|
5643
|
+
private fsTree;
|
|
4968
5644
|
private fsUpload;
|
|
4969
5645
|
private fsDownload;
|
|
4970
5646
|
private fsUploadDir;
|
|
@@ -5128,12 +5804,23 @@ declare class SandboxInstance {
|
|
|
5128
5804
|
* ```
|
|
5129
5805
|
*/
|
|
5130
5806
|
get egress(): EgressManager;
|
|
5807
|
+
/**
|
|
5808
|
+
* On-demand GPU leases attached to this sandbox.
|
|
5809
|
+
*
|
|
5810
|
+
* The base sandbox stays cheap; `attach` starts a temporary external GPU
|
|
5811
|
+
* worker with an explicit spend cap, and `detach` destroys it.
|
|
5812
|
+
*/
|
|
5813
|
+
get gpu(): GpuLeaseManager;
|
|
5131
5814
|
private networkUpdate;
|
|
5132
5815
|
private networkExposePort;
|
|
5133
5816
|
private networkListUrls;
|
|
5134
5817
|
private networkGetConfig;
|
|
5135
5818
|
private egressGet;
|
|
5136
5819
|
private egressUpdate;
|
|
5820
|
+
private gpuAttach;
|
|
5821
|
+
private gpuList;
|
|
5822
|
+
private gpuExec;
|
|
5823
|
+
private gpuDetach;
|
|
5137
5824
|
/**
|
|
5138
5825
|
* Validate CIDR notation (IPv4 and IPv6)
|
|
5139
5826
|
*/
|
|
@@ -5257,91 +5944,46 @@ declare class SandboxInstance {
|
|
|
5257
5944
|
*/
|
|
5258
5945
|
restoreFromStorage(storage: SnapshotOptions["storage"], options?: RestoreSnapshotOptions): Promise<SnapshotResult | null>;
|
|
5259
5946
|
/**
|
|
5260
|
-
*
|
|
5261
|
-
*
|
|
5262
|
-
*
|
|
5263
|
-
* enabling true pause/resume and fork operations. Unlike snapshots which
|
|
5264
|
-
* only preserve filesystem state, checkpoints preserve process memory,
|
|
5265
|
-
* open file descriptors, and execution state.
|
|
5266
|
-
*
|
|
5267
|
-
* **Requirements:** CRIU must be available on the host. Check availability
|
|
5268
|
-
* with `client.criuStatus()` before calling.
|
|
5269
|
-
*
|
|
5270
|
-
* **Note:** By default, checkpoint stops the sandbox. Use `leaveRunning: true`
|
|
5271
|
-
* to keep it running (creates a copy-on-write checkpoint).
|
|
5272
|
-
*
|
|
5273
|
-
* @param options - Checkpoint options
|
|
5274
|
-
* @returns Checkpoint result with ID and metadata
|
|
5275
|
-
*
|
|
5276
|
-
* @example Basic checkpoint (stops sandbox)
|
|
5277
|
-
* ```typescript
|
|
5278
|
-
* const checkpoint = await box.checkpoint();
|
|
5279
|
-
* console.log(`Checkpoint: ${checkpoint.checkpointId}`);
|
|
5280
|
-
* // Sandbox is now stopped, resume with box.resume()
|
|
5281
|
-
* ```
|
|
5282
|
-
*
|
|
5283
|
-
* @example Checkpoint without stopping
|
|
5284
|
-
* ```typescript
|
|
5285
|
-
* const checkpoint = await box.checkpoint({
|
|
5286
|
-
* tags: ["before-deploy"],
|
|
5287
|
-
* leaveRunning: true,
|
|
5288
|
-
* });
|
|
5289
|
-
* // Sandbox continues running
|
|
5290
|
-
* ```
|
|
5947
|
+
* @deprecated CRIU checkpoints were removed. To branch live memory into
|
|
5948
|
+
* copy-on-write children of a running sandbox use {@link branch}; for durable
|
|
5949
|
+
* filesystem state use {@link snapshot}. This method now throws.
|
|
5291
5950
|
*/
|
|
5292
|
-
checkpoint(
|
|
5951
|
+
checkpoint(): never;
|
|
5293
5952
|
/**
|
|
5294
|
-
*
|
|
5295
|
-
*
|
|
5296
|
-
* @returns Array of checkpoint metadata
|
|
5297
|
-
*
|
|
5298
|
-
* @example
|
|
5299
|
-
* ```typescript
|
|
5300
|
-
* const checkpoints = await box.listCheckpoints();
|
|
5301
|
-
* for (const cp of checkpoints) {
|
|
5302
|
-
* console.log(`${cp.checkpointId}: ${cp.createdAt}`);
|
|
5303
|
-
* }
|
|
5304
|
-
* ```
|
|
5953
|
+
* @deprecated CRIU checkpoints were removed. List durable filesystem state
|
|
5954
|
+
* with {@link listSnapshots}. This method now throws.
|
|
5305
5955
|
*/
|
|
5306
|
-
listCheckpoints():
|
|
5956
|
+
listCheckpoints(): never;
|
|
5307
5957
|
/**
|
|
5308
|
-
*
|
|
5309
|
-
*
|
|
5310
|
-
* @param checkpointId - ID of the checkpoint to delete
|
|
5958
|
+
* @deprecated CRIU checkpoints were removed. This method now throws.
|
|
5311
5959
|
*/
|
|
5312
|
-
deleteCheckpoint(
|
|
5960
|
+
deleteCheckpoint(): never;
|
|
5313
5961
|
/**
|
|
5314
|
-
*
|
|
5315
|
-
*
|
|
5316
|
-
*
|
|
5317
|
-
*
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
*
|
|
5322
|
-
*
|
|
5323
|
-
*
|
|
5324
|
-
*
|
|
5325
|
-
*
|
|
5326
|
-
*
|
|
5327
|
-
* @returns The new sandbox instance
|
|
5962
|
+
* @deprecated Forking from a CRIU checkpoint was removed. Use {@link branch}
|
|
5963
|
+
* to fork a running sandbox's live memory into copy-on-write children, or
|
|
5964
|
+
* `client.create({ fromSnapshot })` to provision from durable disk state.
|
|
5965
|
+
* This method now throws.
|
|
5966
|
+
*/
|
|
5967
|
+
fork(): never;
|
|
5968
|
+
/**
|
|
5969
|
+
* Branch this RUNNING sandbox into `count` copy-on-write children
|
|
5970
|
+
* (Morph Infinibranch parity). Unlike {@link fork} — which rehydrates one
|
|
5971
|
+
* sandbox from a CRIU checkpoint — branch forks the live VM's memory into
|
|
5972
|
+
* many children at once via Firecracker UFFD copy-on-write: the children
|
|
5973
|
+
* share the parent's clean pages instead of each copying full guest
|
|
5974
|
+
* memory. The parent stays running.
|
|
5328
5975
|
*
|
|
5329
|
-
* @
|
|
5330
|
-
*
|
|
5331
|
-
*
|
|
5332
|
-
* const forked = await box.fork(checkpoint.checkpointId);
|
|
5333
|
-
* // forked has same memory state as box at checkpoint time
|
|
5334
|
-
* ```
|
|
5976
|
+
* @param count - Number of children to create (must be >= 1).
|
|
5977
|
+
* @param options - Per-child overrides.
|
|
5978
|
+
* @returns Exactly `count` new sandbox instances.
|
|
5335
5979
|
*
|
|
5336
|
-
* @example
|
|
5980
|
+
* @example
|
|
5337
5981
|
* ```typescript
|
|
5338
|
-
* const
|
|
5339
|
-
*
|
|
5340
|
-
* env: { EXPERIMENT: "true" },
|
|
5341
|
-
* });
|
|
5982
|
+
* const [a, b, c] = await box.branch(3);
|
|
5983
|
+
* // a, b, c each share box's memory state at branch time
|
|
5342
5984
|
* ```
|
|
5343
5985
|
*/
|
|
5344
|
-
|
|
5986
|
+
branch(count: number, options?: BranchOptions): Promise<SandboxInstance[]>;
|
|
5345
5987
|
/**
|
|
5346
5988
|
* Stop the sandbox (keeps state for resume).
|
|
5347
5989
|
*/
|
|
@@ -5395,7 +6037,6 @@ declare class SandboxInstance {
|
|
|
5395
6037
|
* delivers progress callbacks while waiting for a target status.
|
|
5396
6038
|
*/
|
|
5397
6039
|
private waitForWithSSE;
|
|
5398
|
-
private parseCheckpointInfo;
|
|
5399
6040
|
private ensureRunning;
|
|
5400
6041
|
private runtimeFetch;
|
|
5401
6042
|
/**
|
|
@@ -5424,9 +6065,24 @@ declare class SandboxInstance {
|
|
|
5424
6065
|
* ```
|
|
5425
6066
|
*/
|
|
5426
6067
|
registerSessionMapping(opts: {
|
|
6068
|
+
sessionId: string;
|
|
6069
|
+
userId: string; /** The runtime (sidecar) session id this agent session routes to. */
|
|
6070
|
+
runtimeSessionId: string; /** Optional container id for direct routing. */
|
|
6071
|
+
sidecarId?: string; /** Optional projectRef so the server can detect a stale sidecar. */
|
|
6072
|
+
projectRef?: string;
|
|
6073
|
+
}): Promise<SessionMappingResult>;
|
|
6074
|
+
/**
|
|
6075
|
+
* Remove the sidecar session mapping for an agent session. Sandbox deletion
|
|
6076
|
+
* also cleans mappings, so this is only needed to release a mapping while the
|
|
6077
|
+
* sandbox stays alive.
|
|
6078
|
+
*/
|
|
6079
|
+
unregisterSessionMapping(opts: {
|
|
5427
6080
|
sessionId: string;
|
|
5428
6081
|
userId: string;
|
|
5429
|
-
}): Promise<
|
|
6082
|
+
}): Promise<{
|
|
6083
|
+
success: boolean;
|
|
6084
|
+
sessionId: string;
|
|
6085
|
+
}>;
|
|
5430
6086
|
private parseInfo;
|
|
5431
6087
|
private sleep;
|
|
5432
6088
|
/**
|
|
@@ -5435,6 +6091,20 @@ declare class SandboxInstance {
|
|
|
5435
6091
|
* Use {@link sessions} to discover existing session ids.
|
|
5436
6092
|
*/
|
|
5437
6093
|
session(id: string): SandboxSession;
|
|
6094
|
+
/** Create an agent session and return both its handle and initial metadata. */
|
|
6095
|
+
createSession(options: CreateSessionOptions): Promise<{
|
|
6096
|
+
session: SandboxSession;
|
|
6097
|
+
info: SessionInfo;
|
|
6098
|
+
}>;
|
|
6099
|
+
/** Delete an agent session by id. */
|
|
6100
|
+
deleteSession(id: string): Promise<void>;
|
|
6101
|
+
/** Get a lazy background-task session reference. */
|
|
6102
|
+
taskSession(id: string): SandboxTaskSession;
|
|
6103
|
+
/** Create a background task session. Dispatch work with `session.sendMessage()`. */
|
|
6104
|
+
createTaskSession(options: CreateTaskSessionOptions): Promise<{
|
|
6105
|
+
session: SandboxTaskSession;
|
|
6106
|
+
info: TaskSessionInfo;
|
|
6107
|
+
}>;
|
|
5438
6108
|
/**
|
|
5439
6109
|
* List sessions on this sandbox, optionally filtering by status. Returns
|
|
5440
6110
|
* `SandboxSession` instances paired with their last-known
|
|
@@ -5470,6 +6140,15 @@ declare class SandboxInstance {
|
|
|
5470
6140
|
* abort stamps `interrupted: true` explicitly.
|
|
5471
6141
|
*/
|
|
5472
6142
|
messages(opts: ListMessagesOptions): Promise<SessionMessage[]>;
|
|
6143
|
+
/** @internal — invoked by SandboxSession.sendMessage(). */
|
|
6144
|
+
_sessionSendMessage(id: string, request: SendSessionMessageRequest, options?: SendSessionMessageOptions): Promise<SentSessionMessage>;
|
|
6145
|
+
/** @internal — invoked by SandboxSession.delete(). */
|
|
6146
|
+
_sessionDelete(id: string): Promise<void>;
|
|
6147
|
+
/** @internal — invoked by SandboxTaskSession.changes(). */
|
|
6148
|
+
_taskSessionChanges(id: string): Promise<TaskSessionChanges>;
|
|
6149
|
+
/** @internal — invoked by SandboxTaskSession.commit(). */
|
|
6150
|
+
_taskSessionCommit(id: string, options?: CommitTaskSessionOptions): Promise<TaskSessionCommitResult>;
|
|
6151
|
+
_sessionFork(id: string, opts?: SessionForkOptions): Promise<SessionInfo>;
|
|
5473
6152
|
/**
|
|
5474
6153
|
* Look up a cached turn result by idempotency key. Returns the cached
|
|
5475
6154
|
* payload if a turn with this `turnId` previously completed on the
|
|
@@ -5555,4 +6234,4 @@ declare class SandboxInstance {
|
|
|
5555
6234
|
_answerQuestion(id: string, answers: Record<string, string[]>): Promise<void>;
|
|
5556
6235
|
}
|
|
5557
6236
|
//#endregion
|
|
5558
|
-
export {
|
|
6237
|
+
export { CodeExecutionResult as $, AgentProfileFileMount as $i, ReconcileSandboxFleetsResult as $n, SandboxTraceOptions as $r, GitDiff as $t, AddUserOptions as A, TaskSessionFileChange as Ai, PreviewLinkInfo as An, SandboxFleetWorkspace as Ar, FileReadBatchOptions as At, BatchBackendStats as B, TurnDriveResult as Bi, PromptOptions as Bn, SandboxResourceUsage as Br, FleetDispatchResultBuffer as Bt, SandboxMcpConfig as C, StartupOperation as Ci, MintScopedTokenOptions as Cn, SandboxFleetPolicy as Cr, DriverType as Ct, buildSandboxMcpConfig as D, TaskResult as Di, NonHostAgentDriverConfig as Dn, SandboxFleetTraceExport as Dr, ExecOptions as Dt, buildControlPlaneMcpConfig as E, TaskOptions as Ei, NetworkManager as En, SandboxFleetTraceEvent as Er, EventStreamOptions as Et, BackendInfo as F, TeeAttestationResponse as Fi, ProcessManager as Fn, SandboxIntelligenceEnvelope as Fr, FileTreeFile as Ft, BatchRunOptions as G, WaitForOptions as Gi, ProvisionStep as Gn, SandboxStatus as Gr, FleetMachineId as Gt, BatchEventDataMap as H, UploadOptions as Hi, ProvisionEvent as Hn, SandboxRuntimeHealth as Hr, FleetDispatchStreamOptions as Ht, BackendManager as I, TeePublicKey as Ii, ProcessSignal as In, SandboxPermissionsConfig as Ir, FileTreeOptions as It, BatchTask as J, WriteManyOptions as Ji, PublishPublicTemplateOptions as Jn, SandboxTerminalManager as Jr, GPU_LEASE_PROVIDER_NAMES as Jt, BatchRunRequest as K, WriteFileOptions as Ki, PublicTemplateInfo as Kn, SandboxTerminalCreateOptions as Kr, FleetPromptDispatchOptions as Kt, BackendStatus as L, TeePublicKeyResponse as Li, ProcessSpawnOptions as Ln, SandboxPortBinding as Lr, FileTreeResult as Lt, AttachSandboxFleetMachineOptions as M, TaskSessionProfile as Mi, Process as Mn, SandboxFleetWorkspaceRestoreResult as Mr, FileReadError as Mt, BackendCapabilities as N, TeeAttestationOptions as Ni, ProcessInfo as Nn, SandboxFleetWorkspaceSnapshotResult as Nr, FileReadResult as Nt, AcceleratorKind as O, TaskSessionChanges as Oi, PermissionLevel as On, SandboxFleetTraceOptions as Or, ExecResult as Ot, BackendConfig as P, TeeAttestationReport as Pi, ProcessLogEntry as Pn, SandboxInfo as Pr, FileSystem as Pt, CodeExecutionOptions as Q, AgentProfileConnection as Qi, ReconcileSandboxFleetsOptions as Qn, SandboxTraceExport as Qr, GitConfig as Qt, BackendType as R, TokenRefreshHandler as Ri, ProcessStatus as Rn, SandboxPortPreviewLink as Rr, FileWriteResult as Rt, SANDBOX_MCP_SERVER_NAME as S, StartupDiagnostics as Si, McpServerConfig as Sn, SandboxFleetOperationsSummary as Sr, DriverInfo as St, SandboxMcpServerEntry as T, SubscriptionInfo as Ti, NetworkConfig as Tn, SandboxFleetTraceBundle as Tr, EgressPolicy as Tt, BatchOptions as U, UploadProgress as Ui, ProvisionResult as Un, SandboxRuntimeProfile as Ur, FleetExecDispatchOptions as Ut, BatchEvent as V, UpdateUserOptions as Vi, PromptResult as Vn, SandboxResources as Vr, FleetDispatchResultBufferOptions as Vt, BatchResult as W, UsageInfo as Wi, ProvisionStatus as Wn, SandboxRuntimeProfileList as Wr, FleetExecDispatchResult as Wt, BatchTaskUsage as X, AgentProfileCapabilities as Xi, ReapExpiredSandboxFleetsOptions as Xn, SandboxTraceBundle as Xr, GitBranch as Xt, BatchTaskResult as Y, AgentProfile as Yi, PublishPublicTemplateVersionOptions as Yn, SandboxTerminalRequestOptions as Yr, GitAuth as Yt, BranchOptions as Z, AgentProfileConfidential as Zi, ReapExpiredSandboxFleetsResult as Zn, SandboxTraceEvent as Zr, GitCommit as Zt, RespondToPermissionOptions as _, SessionStatus as _i, IntelligenceReportWindow as _n, SandboxFleetMachineMeteredUsage as _r, DispatchedSession as _t, TraceExportSink as a, AgentProfileResources as aa, SecretInfo as ai, GpuLeaseExecResult as an, SandboxEnvironment as ar, CreateGpuLeaseOptions as at, BuildSandboxMcpConfigOptions as b, SnapshotResult as bi, ListSandboxFleetOptions as bn, SandboxFleetManifest as br, DriveTurnOptions as bt, otelTraceIdForTangleTrace as c, AgentSubagentProfile as ca, SendSessionMessageRequest as ci, GpuLeaseStatus as cn, SandboxFleetArtifactSpec as cr, CreateSandboxFleetOptions as ct, SandboxSession as d, defineInlineResource as da, SessionEventStreamOptions as di, HostAgentRuntimeBackend as dn, SandboxFleetDispatchResponse as dr, CreateSandboxOptions as dt, AgentProfileMcpServer as ea, SandboxUser as ei, GitStatus as en, RunCodeOptions as er, CodeLanguage as et, InteractiveAuthFile as f, mergeAgentProfiles as fa, SessionForkOptions as fi, InstalledTool as fn, SandboxFleetDriverCapability as fr, CreateSessionOptions as ft, InterruptResult as g, SessionMessageInputPart as gi, IntelligenceReportSubjectType as gn, SandboxFleetMachine as gr, DispatchPromptOptions as gt, InteractiveSessionInfo as h, SessionMessage as hi, IntelligenceReportCompareTo as hn, SandboxFleetIntelligenceEnvelope as hr, DirectoryPermission as ht, TraceExportResult as i, AgentProfileResourceRef as ia, SearchOptions as ii, GpuLeaseExecOptions as in, SandboxConnection as ir, CompletedTurnResult as it, AttachGpuLeaseOptions as j, TaskSessionInfo as ji, PreviewLinkManager as jn, SandboxFleetWorkspaceReconcileResult as jr, FileReadBatchResult as jt, AccessPolicyRule as k, TaskSessionCommitResult as ki, PermissionsManager as kn, SandboxFleetUsage as kr, FileInfo as kt, toOtelJson as l, defineAgentProfile as la, SentSessionMessage as li, GpuType as ln, SandboxFleetCostEstimate as lr, CreateSandboxFleetTokenOptions as lt, InteractiveSessionHost as m, SessionListOptions as mi, IntelligenceReportBudget as mn, SandboxFleetInfo as mr, DeleteOptions as mt, SandboxInstance as n, AgentProfilePermissionValue as na, ScopedTokenScope as ni, GpuLeaseBilling as nn, SSHCredentials as nr, CodeResultPart as nt, buildTraceExportPayload as o, AgentProfileValidationIssue as oa, SecretsManager as oi, GpuLeaseManager as on, SandboxEvent as or, CreateIntelligenceReportOptions as ot, InteractiveSessionHandle as p, SessionInfo as pi, IntelligenceReport as pn, SandboxFleetDriverTimings as pr, CreateTaskSessionOptions as pt, BatchSidecarGroup as q, WriteManyFile as qi, PublicTemplateVersionInfo as qn, SandboxTerminalInfo as qr, FleetPromptDispatchResult as qt, TraceExportFormat as r, AgentProfilePrompt as ra, SearchMatch as ri, GpuLeaseCommandResult as rn, SandboxClientConfig as rr, CommitTaskSessionOptions as rt, exportTraceBundle as s, AgentProfileValidationResult as sa, SendSessionMessageOptions as si, GpuLeaseProviderName as sn, SandboxFleetArtifact as sr, CreateRequestOptions as st, HttpClient as t, AgentProfileModelHints as ta, ScopedToken as ti, GpuLease as tn, SSHCommandDescriptor as tr, CodeResult as tt, SandboxTaskSession as u, defineGitHubResource as ua, SessionBackendCredentials as ui, HostAgentDriverConfig as un, SandboxFleetDispatchFailureClass as ur, CreateSandboxFleetWithCoordinatorOptions as ut, StartInteractiveOptions as v, SnapshotInfo as vi, ListMessagesOptions as vn, SandboxFleetMachineRecord as vr, DownloadOptions as vt, SandboxMcpEndpoint as w, StorageConfig as wi, MkdirOptions as wn, SandboxFleetToken as wr, EgressManager as wt, CONTROL_PLANE_MCP_SERVER_NAME as x, SshKeysManager as xi, ListSandboxOptions as xn, SandboxFleetManifestMachine as xr, DriverConfig as xt, BuildControlPlaneMcpConfigOptions as y, SnapshotOptions as yi, ListOptions as yn, SandboxFleetMachineSpec as yr, DownloadProgress as yt, BatchBackend as z, ToolsConfig as zi, PromptInputPart as zn, SandboxProfileSummary as zr, FleetDispatchCancelResult as zt };
|