@tangle-network/sandbox 0.13.0-develop.20260726092610.cc3ee18 → 0.13.0-develop.20260726131324.13697aa
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 +254 -1295
- package/dist/agent/index.d.ts +11 -11
- package/dist/auth/index.d.ts +1 -1
- package/dist/{client-BDejoJQR.d.ts → client-CdpU6vjj.d.ts} +23 -28
- package/dist/{client-DS8qSxCp.js → client-Cz6oQM1P.js} +86 -78
- package/dist/collaboration/index.d.ts +1 -1
- package/dist/core.d.ts +5 -5
- package/dist/core.js +3 -3
- package/dist/{index-DwjU-4s_.d.ts → index-Cl5Vyyz7.d.ts} +2 -2
- package/dist/index.d.ts +3323 -516
- package/dist/index.js +271 -328
- package/dist/intelligence/index.d.ts +2 -2
- package/dist/intelligence/index.js +3 -3
- package/dist/local-cli-auth-DHBoF3wi.js +35 -0
- package/dist/openai/index.d.ts +1 -1
- package/dist/{runtime-api-BFtk4_HK.js → runtime-api-fZ4UDwOY.js} +30 -17
- package/dist/runtime.d.ts +2 -3
- package/dist/runtime.js +1 -1
- package/dist/{sandbox-CxflW4z4.d.ts → sandbox-Bz7kCFtN.d.ts} +11 -78
- package/dist/{sandbox-DXuuroty.js → sandbox-kHfb3J4x.js} +36 -217
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-46aLycNc.js → tangle-BdbEHJRy.js} +9 -31
- package/dist/{types-DFYV3JSL.d.ts → types-Ch78hv3k.d.ts} +218 -331
- package/package.json +7 -5
- /package/dist/{errors-C8HMx78o.d.ts → errors-BzMmpmqU.d.ts} +0 -0
- /package/dist/{index-DKzapw-9.d.ts → index-Cp1KYanB.d.ts} +0 -0
- /package/dist/{index-CyHojkuA.d.ts → index-DtRFVx5U.d.ts} +0 -0
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as CodeExecutionResult,
|
|
2
|
-
import { n as SandboxInstance } from "../sandbox-
|
|
3
|
-
import { i as
|
|
1
|
+
import { C as CodeExecutionResult, S as CodeExecutionOptions, T as CodeResultPart, w as CodeLanguage } from "../types-Ch78hv3k.js";
|
|
2
|
+
import { n as SandboxInstance } from "../sandbox-Bz7kCFtN.js";
|
|
3
|
+
import { i as Sandbox } from "../client-CdpU6vjj.js";
|
|
4
4
|
import * as _$_modelcontextprotocol_sdk_server_index_js0 from "@modelcontextprotocol/sdk/server/index.js";
|
|
5
5
|
|
|
6
6
|
//#region src/agent/tools/_specs.d.ts
|
|
@@ -226,7 +226,7 @@ declare function anthropicTools(box: SandboxInstance, options?: AnthropicToolPac
|
|
|
226
226
|
//#endregion
|
|
227
227
|
//#region src/agent/tools/fleet/_specs.d.ts
|
|
228
228
|
interface FleetToolHandlerContext {
|
|
229
|
-
client:
|
|
229
|
+
client: Sandbox;
|
|
230
230
|
}
|
|
231
231
|
interface FleetToolSpec<TArgs = Record<string, unknown>, TResult = unknown> {
|
|
232
232
|
name: string;
|
|
@@ -286,7 +286,7 @@ interface AnthropicFleetToolPack {
|
|
|
286
286
|
is_error?: boolean;
|
|
287
287
|
}>;
|
|
288
288
|
}
|
|
289
|
-
declare function anthropicFleetTools(client:
|
|
289
|
+
declare function anthropicFleetTools(client: Sandbox, options?: FleetToolPackOptions): AnthropicFleetToolPack;
|
|
290
290
|
interface OpenAIFleetTool {
|
|
291
291
|
type: "function";
|
|
292
292
|
function: {
|
|
@@ -315,13 +315,13 @@ interface OpenAIFleetToolPack {
|
|
|
315
315
|
content: string;
|
|
316
316
|
}>;
|
|
317
317
|
}
|
|
318
|
-
declare function openaiFleetTools(client:
|
|
319
|
-
declare function vercelAiFleetTools(client:
|
|
320
|
-
declare function mastraFleetTools(client:
|
|
318
|
+
declare function openaiFleetTools(client: Sandbox, options?: FleetToolPackOptions): OpenAIFleetToolPack;
|
|
319
|
+
declare function vercelAiFleetTools(client: Sandbox, options?: FleetToolPackOptions): Promise<Record<string, unknown>>;
|
|
320
|
+
declare function mastraFleetTools(client: Sandbox, options?: FleetToolPackOptions): Promise<Record<string, unknown>>;
|
|
321
321
|
//#endregion
|
|
322
322
|
//#region src/agent/tools/lifecycle/_specs.d.ts
|
|
323
323
|
interface LifecycleToolHandlerContext {
|
|
324
|
-
client:
|
|
324
|
+
client: Sandbox;
|
|
325
325
|
}
|
|
326
326
|
interface LifecycleToolSpec<TArgs = Record<string, unknown>, TResult = unknown> {
|
|
327
327
|
name: string;
|
|
@@ -376,7 +376,7 @@ interface AnthropicLifecycleToolPack {
|
|
|
376
376
|
is_error?: boolean;
|
|
377
377
|
}>;
|
|
378
378
|
}
|
|
379
|
-
declare function anthropicLifecycleTools(client:
|
|
379
|
+
declare function anthropicLifecycleTools(client: Sandbox, options?: LifecycleToolPackOptions): AnthropicLifecycleToolPack;
|
|
380
380
|
interface OpenAILifecycleTool {
|
|
381
381
|
type: "function";
|
|
382
382
|
function: {
|
|
@@ -405,7 +405,7 @@ interface OpenAILifecycleToolPack {
|
|
|
405
405
|
content: string;
|
|
406
406
|
}>;
|
|
407
407
|
}
|
|
408
|
-
declare function openaiLifecycleTools(client:
|
|
408
|
+
declare function openaiLifecycleTools(client: Sandbox, options?: LifecycleToolPackOptions): OpenAILifecycleToolPack;
|
|
409
409
|
//#endregion
|
|
410
410
|
//#region src/agent/tools/mastra.d.ts
|
|
411
411
|
interface MastraToolPackOptions {
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as ReadTokenPayload, a as issueCollaborationToken, c as issueSessionScopedToken, d as AnyTokenPayload, f as BatchScopedTokenPayload, g as ProjectScopedTokenPayload, h as IssueCollaborationTokenOptions, i as issueBatchScopedToken, l as unsafeDecodeToken, m as CollaborationTokenPayload, n as getTokenTTL, o as issueProjectScopedToken, p as CollaborationAccess, r as isTokenExpiringSoon, s as issueReadToken, t as ProductTokenIssuer, u as verifyToken, v as SessionScopedTokenPayload, y as TokenScope } from "../index-
|
|
1
|
+
import { _ as ReadTokenPayload, a as issueCollaborationToken, c as issueSessionScopedToken, d as AnyTokenPayload, f as BatchScopedTokenPayload, g as ProjectScopedTokenPayload, h as IssueCollaborationTokenOptions, i as issueBatchScopedToken, l as unsafeDecodeToken, m as CollaborationTokenPayload, n as getTokenTTL, o as issueProjectScopedToken, p as CollaborationAccess, r as isTokenExpiringSoon, s as issueReadToken, t as ProductTokenIssuer, u as verifyToken, v as SessionScopedTokenPayload, y as TokenScope } from "../index-DtRFVx5U.js";
|
|
2
2
|
export { AnyTokenPayload, BatchScopedTokenPayload, CollaborationAccess, CollaborationTokenPayload, IssueCollaborationTokenOptions, ProductTokenIssuer, ProjectScopedTokenPayload, ReadTokenPayload, SessionScopedTokenPayload, TokenScope, getTokenTTL, isTokenExpiringSoon, issueBatchScopedToken, issueCollaborationToken, issueProjectScopedToken, issueReadToken, issueSessionScopedToken, unsafeDecodeToken, verifyToken };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $n as
|
|
2
|
-
import { c as TraceExportResult, l as TraceExportSink, n as SandboxInstance, t as HttpClient } from "./sandbox-
|
|
1
|
+
import { $n as SandboxFleetDispatchResponse, $t as ListSandboxOptions, A as CreateRequestOptions, An as ReapExpiredSandboxFleetsResult, Ci as TokenRefreshHandler, Cr as SandboxInfo, Ct as FleetMachineId, Dn as PublishPublicTemplateOptions, En as PublicTemplateVersionInfo, Gi as BatchEvent, Gn as SandboxConfig, Gt as IntelligenceReportBudget, Jt as IntelligenceReportWindow, Kt as IntelligenceReportCompareTo, M as CreateSandboxFleetTokenOptions, Mn as ReconcileSandboxFleetsResult, N as CreateSandboxFleetWithCoordinatorOptions, On as PublishPublicTemplateVersionOptions, P as CreateSandboxOptions, Qt as ListSandboxFleetOptions, Sr as SandboxIdentity, St as FleetExecDispatchResult, Tn as PublicTemplateInfo, Tt as FleetPromptDispatchResult, Wt as IntelligenceReport, Xn as SandboxFleetArtifactSpec, Yn as SandboxFleetArtifact, Zn as SandboxFleetCostEstimate, _r as SandboxFleetUsage, _t as FleetDispatchResultBufferOptions, a as AttachSandboxFleetMachineOptions, bn as PromptResult, br as SandboxFleetWorkspaceRestoreResult, bt as FleetDriveTurnRequest, ci as SshKeysManager, cr as SandboxFleetManifest, er as SandboxFleetDriverCapability, et as ExecOptions, fi as SubscriptionInfo, fr as SandboxFleetToken, g as BatchRunRequest, gr as SandboxFleetTraceOptions, gt as FleetDispatchResultBuffer, h as BatchRunOptions, ht as FleetDispatchCancelResult, j as CreateSandboxFleetOptions, jn as ReconcileSandboxFleetsOptions, k as CreateIntelligenceReportOptions, ki as UsageInfo, kn as ReapExpiredSandboxFleetsOptions, m as BatchResult, nr as SandboxFleetInfo, or as SandboxFleetMachineRecord, pr as SandboxFleetTraceBundle, qn as SandboxEnvironment, qr as SecretsManager, tt as ExecResult, ur as SandboxFleetOperationsSummary, vn as PromptInputPart, vt as FleetDispatchStreamOptions, wt as FleetPromptDispatchOptions, xr as SandboxFleetWorkspaceSnapshotResult, xt as FleetExecDispatchOptions, yn as PromptOptions, yr as SandboxFleetWorkspaceReconcileResult, yt as FleetDriveTurnOutcome } from "./types-Ch78hv3k.js";
|
|
2
|
+
import { c as TraceExportResult, l as TraceExportSink, n as SandboxInstance, t as HttpClient } from "./sandbox-Bz7kCFtN.js";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/sse-parser.d.ts
|
|
5
5
|
/**
|
|
@@ -8,7 +8,7 @@ import { c as TraceExportResult, l as TraceExportSink, n as SandboxInstance, t a
|
|
|
8
8
|
* EventSource stream parsing for SDK consumers. Implements the
|
|
9
9
|
* subset of the SSE spec (§9.2.6) that the platform actually emits —
|
|
10
10
|
* LF and CRLF terminators, `event:` / `data:` / `id:` fields, and
|
|
11
|
-
* multi-line `data:` dispatch. Used by `
|
|
11
|
+
* multi-line `data:` dispatch. Used by `Sandbox.streamBatch`
|
|
12
12
|
* and by the web dashboard's batch page; exported so downstream
|
|
13
13
|
* surfaces don't maintain their own copies.
|
|
14
14
|
*
|
|
@@ -64,10 +64,10 @@ declare function parseSSEStream(body: ReadableStream<Uint8Array> | null | undefi
|
|
|
64
64
|
//#endregion
|
|
65
65
|
//#region src/fleet.d.ts
|
|
66
66
|
/**
|
|
67
|
-
* The subset of `
|
|
67
|
+
* The subset of `Sandbox` the fleet classes drive. Declared here
|
|
68
68
|
* rather than importing the concrete class so `fleet.ts` stays a leaf of
|
|
69
69
|
* `client.ts` — `client.ts` constructs `SandboxFleetClient`, so the reverse
|
|
70
|
-
* import would form a cycle. `
|
|
70
|
+
* import would form a cycle. `Sandbox` satisfies this structurally.
|
|
71
71
|
*/
|
|
72
72
|
interface FleetClientHost {
|
|
73
73
|
create(options?: CreateSandboxOptions): Promise<SandboxInstance>;
|
|
@@ -225,7 +225,7 @@ interface SessionBroadcastResult {
|
|
|
225
225
|
* import { Sandbox } from "@tangle-network/sandbox";
|
|
226
226
|
*
|
|
227
227
|
* const client = new Sandbox({
|
|
228
|
-
* apiKey: "
|
|
228
|
+
* apiKey: "sk-tan-...",
|
|
229
229
|
* baseUrl: "https://your-sandbox-api.example.com",
|
|
230
230
|
* });
|
|
231
231
|
*
|
|
@@ -242,7 +242,7 @@ interface SessionBroadcastResult {
|
|
|
242
242
|
* await box.delete();
|
|
243
243
|
* ```
|
|
244
244
|
*/
|
|
245
|
-
declare class
|
|
245
|
+
declare class Sandbox implements HttpClient {
|
|
246
246
|
private readonly baseUrl;
|
|
247
247
|
private readonly apiKey;
|
|
248
248
|
private readonly timeoutMs;
|
|
@@ -251,7 +251,7 @@ declare class SandboxClient implements HttpClient {
|
|
|
251
251
|
private _sshKeys;
|
|
252
252
|
private _fleets;
|
|
253
253
|
private _intelligence;
|
|
254
|
-
constructor(config:
|
|
254
|
+
constructor(config: SandboxConfig);
|
|
255
255
|
/**
|
|
256
256
|
* Fleet operations for agent-managed groups of sandboxes.
|
|
257
257
|
*
|
|
@@ -285,8 +285,6 @@ declare class SandboxClient implements HttpClient {
|
|
|
285
285
|
*/
|
|
286
286
|
get secrets(): SecretsManager;
|
|
287
287
|
get sshKeys(): SshKeysManager;
|
|
288
|
-
/** List agent profiles registered by the Sandbox API. */
|
|
289
|
-
listProfiles(): Promise<SandboxProfileSummary[]>;
|
|
290
288
|
/** Deliver a server-originated event to a mapped product session. */
|
|
291
289
|
broadcastSessionEvent(sessionId: string, event: SessionBroadcastEvent): Promise<SessionBroadcastResult>;
|
|
292
290
|
/** Deliver a product payload through SessionGateway's `onAgentEvent`. */
|
|
@@ -454,7 +452,7 @@ declare class SandboxClient implements HttpClient {
|
|
|
454
452
|
* Run multiple tasks in parallel across sandboxes.
|
|
455
453
|
* Returns the aggregated results after all tasks complete.
|
|
456
454
|
*
|
|
457
|
-
* @param
|
|
455
|
+
* @param request - Complete batch request
|
|
458
456
|
* @param options - Batch execution options
|
|
459
457
|
* @returns Aggregated batch results
|
|
460
458
|
*
|
|
@@ -472,21 +470,22 @@ declare class SandboxClient implements HttpClient {
|
|
|
472
470
|
*
|
|
473
471
|
* @example
|
|
474
472
|
* ```typescript
|
|
475
|
-
* const result = await client.runBatch(
|
|
476
|
-
*
|
|
477
|
-
*
|
|
478
|
-
*
|
|
473
|
+
* const result = await client.runBatch({
|
|
474
|
+
* tasks: [
|
|
475
|
+
* { id: "task-1", message: "Analyze this file" },
|
|
476
|
+
* { id: "task-2", message: "Generate a summary" },
|
|
477
|
+
* ],
|
|
478
|
+
* });
|
|
479
479
|
* console.log(`Success rate: ${result.successRate}%`);
|
|
480
480
|
* ```
|
|
481
481
|
*/
|
|
482
482
|
runBatch(request: BatchRunRequest, options?: BatchRunOptions): Promise<BatchResult>;
|
|
483
|
-
runBatch(tasks: BatchTask[], options?: BatchOptions): Promise<BatchResult>;
|
|
484
483
|
/**
|
|
485
484
|
* Stream events from a batch execution.
|
|
486
485
|
* Use this for real-time progress updates during batch processing.
|
|
487
486
|
*
|
|
488
|
-
* @param
|
|
489
|
-
* @param options -
|
|
487
|
+
* @param request - Complete batch request
|
|
488
|
+
* @param options - Per-call controls
|
|
490
489
|
*
|
|
491
490
|
* @throws {@link TimeoutError} if the server hasn't begun responding
|
|
492
491
|
* before the deadline (pre-stream timeout).
|
|
@@ -499,7 +498,7 @@ declare class SandboxClient implements HttpClient {
|
|
|
499
498
|
*
|
|
500
499
|
* @example
|
|
501
500
|
* ```typescript
|
|
502
|
-
* for await (const event of client.streamBatch(tasks)) {
|
|
501
|
+
* for await (const event of client.streamBatch({ tasks })) {
|
|
503
502
|
* if (event.type === "task.completed") {
|
|
504
503
|
* console.log(`Task ${event.data.taskId} completed`);
|
|
505
504
|
* }
|
|
@@ -507,7 +506,6 @@ declare class SandboxClient implements HttpClient {
|
|
|
507
506
|
* ```
|
|
508
507
|
*/
|
|
509
508
|
streamBatch(request: BatchRunRequest, options?: BatchRunOptions): AsyncGenerator<BatchEvent>;
|
|
510
|
-
streamBatch(tasks: BatchTask[], options?: BatchOptions): AsyncGenerator<BatchEvent>;
|
|
511
509
|
/**
|
|
512
510
|
* Make an authenticated HTTP request to the API.
|
|
513
511
|
* This is exposed for use by SandboxInstance.
|
|
@@ -553,7 +551,7 @@ declare class SandboxClient implements HttpClient {
|
|
|
553
551
|
*/
|
|
554
552
|
declare class IntelligenceClient {
|
|
555
553
|
private readonly client;
|
|
556
|
-
constructor(client:
|
|
554
|
+
constructor(client: Sandbox);
|
|
557
555
|
/**
|
|
558
556
|
* Create an intelligence report over the given subject.
|
|
559
557
|
*
|
|
@@ -599,7 +597,7 @@ declare class IntelligenceClient {
|
|
|
599
597
|
*/
|
|
600
598
|
declare class EnvironmentsClient {
|
|
601
599
|
private readonly client;
|
|
602
|
-
constructor(client:
|
|
600
|
+
constructor(client: Sandbox);
|
|
603
601
|
/**
|
|
604
602
|
* List available development environments.
|
|
605
603
|
*
|
|
@@ -623,7 +621,7 @@ declare class EnvironmentsClient {
|
|
|
623
621
|
}
|
|
624
622
|
declare class PublicTemplatesClient {
|
|
625
623
|
private readonly client;
|
|
626
|
-
constructor(client:
|
|
624
|
+
constructor(client: Sandbox);
|
|
627
625
|
list(options?: {
|
|
628
626
|
query?: string;
|
|
629
627
|
tag?: string;
|
|
@@ -722,7 +720,7 @@ interface InviteTeamMemberOptions {
|
|
|
722
720
|
*/
|
|
723
721
|
declare class TeamsClient {
|
|
724
722
|
private readonly client;
|
|
725
|
-
constructor(client:
|
|
723
|
+
constructor(client: Sandbox);
|
|
726
724
|
list(): Promise<Team[]>;
|
|
727
725
|
create(options: CreateTeamOptions): Promise<Team>;
|
|
728
726
|
get(teamId: string): Promise<Team>;
|
|
@@ -754,8 +752,5 @@ declare class TeamsClient {
|
|
|
754
752
|
createTemplate(teamId: string, options: CreateTeamTemplateOptions): Promise<TeamTemplateRecord>;
|
|
755
753
|
deleteTemplate(teamId: string, templateId: string): Promise<void>;
|
|
756
754
|
}
|
|
757
|
-
/**
|
|
758
|
-
* Alias for SandboxClient for cleaner imports.
|
|
759
|
-
*/
|
|
760
755
|
//#endregion
|
|
761
|
-
export { Team as a, SessionBroadcastEvent as c, SandboxFleetClient as d, ParseSSEStreamOptions as f,
|
|
756
|
+
export { Team as a, SessionBroadcastEvent as c, SandboxFleetClient as d, ParseSSEStreamOptions as f, Sandbox as i, SessionBroadcastResult as l, parseSSEStream as m, IntelligenceClient as n, TeamInvitation as o, ParsedSSEEvent as p, InviteTeamMemberOptions as r, TeamMember as s, CreateTeamOptions as t, SandboxFleet as u };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as encodeTextForWire, i as SANDBOX_PROXY_REQUEST_MAX_BYTES, o as combineAbortSignals, s as encodePromptForWire } from "./runtime-api-
|
|
1
|
+
import { c as encodeTextForWire, i as SANDBOX_PROXY_REQUEST_MAX_BYTES, l as assertCurrentBackendType, o as combineAbortSignals, s as encodePromptForWire, u as normalizeRuntimeBackendConfig } from "./runtime-api-fZ4UDwOY.js";
|
|
2
2
|
import { a as NotFoundError, c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, o as PartialFailureError, p as parseErrorResponse, t as AuthError } from "./errors-D9fFOWX9.js";
|
|
3
|
-
import { g as exportTraceBundle, m as normalizeConnection, n as createSandboxInstanceFromResponse, r as normalizeStartupDiagnostics, y as parseSSEStream } from "./sandbox-
|
|
3
|
+
import { g as exportTraceBundle, m as normalizeConnection, n as createSandboxInstanceFromResponse, r as normalizeStartupDiagnostics, y as parseSSEStream } from "./sandbox-kHfb3J4x.js";
|
|
4
4
|
//#region src/fleet.ts
|
|
5
5
|
const FLEET_ID_META = "tangle.fleet.id";
|
|
6
6
|
const MACHINE_ID_META = "tangle.fleet.machine_id";
|
|
@@ -128,7 +128,7 @@ function assertMachineDescriptorPolicy(machineId, options, policy) {
|
|
|
128
128
|
const driverType = options.driver?.type;
|
|
129
129
|
if (policy?.allowedDrivers && driverType && !policy.allowedDrivers.includes(driverType)) throw new ValidationError(`Fleet machine '${machineId}' requested driver '${driverType}' outside policy.allowedDrivers`, { "policy.allowedDrivers": "exceeded" });
|
|
130
130
|
const environment = options.environment;
|
|
131
|
-
if (policy?.
|
|
131
|
+
if (policy?.allowedEnvironments && environment && !policy.allowedEnvironments.includes(environment)) throw new ValidationError(`Fleet machine '${machineId}' requested environment '${environment}' outside policy.allowedEnvironments`, { "policy.allowedEnvironments": "exceeded" });
|
|
132
132
|
const templateId = options.templateId ?? options.publicTemplateId;
|
|
133
133
|
if (policy?.allowedTemplateIds && templateId && !policy.allowedTemplateIds.includes(templateId)) throw new ValidationError(`Fleet machine '${machineId}' requested template '${templateId}' outside policy.allowedTemplateIds`, { "policy.allowedTemplateIds": "exceeded" });
|
|
134
134
|
if (policy?.allowAccelerators === false && (options.resources?.accelerator?.count ?? (options.resources?.accelerator ? 1 : 0)) > 0) throw new ValidationError(`Fleet machine '${machineId}' requested accelerators but policy.allowAccelerators is false`, { "policy.allowAccelerators": "exceeded" });
|
|
@@ -213,8 +213,7 @@ function promptDispatchBody(message, options) {
|
|
|
213
213
|
type: "prompt",
|
|
214
214
|
parts: encodePromptForWire(message),
|
|
215
215
|
sessionId: options?.sessionId,
|
|
216
|
-
|
|
217
|
-
backend: options?.backend,
|
|
216
|
+
backend: normalizeRuntimeBackendConfig(options?.backend),
|
|
218
217
|
context: options?.context,
|
|
219
218
|
timeoutMs: options?.timeoutMs,
|
|
220
219
|
machines: options?.machines,
|
|
@@ -1394,47 +1393,12 @@ function withRequestContextHeaders(response, path, method) {
|
|
|
1394
1393
|
});
|
|
1395
1394
|
}
|
|
1396
1395
|
async function resolveLocalCliAuthFiles(backendType) {
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
return discoverLocalCliAuthFiles(backendType);
|
|
1400
|
-
} catch {
|
|
1401
|
-
return discoverLocalCliAuthFilesFallback(backendType);
|
|
1402
|
-
}
|
|
1403
|
-
}
|
|
1404
|
-
async function discoverLocalCliAuthFilesFallback(backendType) {
|
|
1405
|
-
try {
|
|
1406
|
-
const [{ existsSync, readFileSync }, { homedir }, { join }] = await Promise.all([
|
|
1407
|
-
import("node:fs"),
|
|
1408
|
-
import("node:os"),
|
|
1409
|
-
import("node:path")
|
|
1410
|
-
]);
|
|
1411
|
-
const homeDir = homedir();
|
|
1412
|
-
const authFiles = (backendType === "codex" ? [".codex/auth.json"] : [".claude/.credentials.json", ".claude/settings.json"]).flatMap((path) => {
|
|
1413
|
-
const absolutePath = join(homeDir, path);
|
|
1414
|
-
if (!existsSync(absolutePath)) return [];
|
|
1415
|
-
return [{
|
|
1416
|
-
path,
|
|
1417
|
-
content: readFileSync(absolutePath, "utf8"),
|
|
1418
|
-
mode: 384
|
|
1419
|
-
}];
|
|
1420
|
-
});
|
|
1421
|
-
return authFiles.length ? authFiles : void 0;
|
|
1422
|
-
} catch {
|
|
1423
|
-
return;
|
|
1424
|
-
}
|
|
1396
|
+
const { discoverLocalCliAuthFiles } = await import("./local-cli-auth-DHBoF3wi.js");
|
|
1397
|
+
return discoverLocalCliAuthFiles(backendType);
|
|
1425
1398
|
}
|
|
1426
1399
|
async function describeLocalCliAuthExpectation(backendType) {
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
} catch {
|
|
1430
|
-
return backendType === "codex" ? "~/.codex/auth.json" : "~/.claude/.credentials.json or ~/.claude/settings.json";
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
async function importLocalCliRegistry() {
|
|
1434
|
-
return await import(
|
|
1435
|
-
/* @vite-ignore */
|
|
1436
|
-
["@tangle-network", "cli-agent-registry"].join("/")
|
|
1437
|
-
);
|
|
1400
|
+
const { describeLocalCliAuthExpectation: describe } = await import("./local-cli-auth-DHBoF3wi.js");
|
|
1401
|
+
return describe(backendType);
|
|
1438
1402
|
}
|
|
1439
1403
|
async function hydrateLocalCliBackendAuth(backend, baseUrl, trustLocalCliAuth) {
|
|
1440
1404
|
if (!backend) return void 0;
|
|
@@ -1470,7 +1434,7 @@ async function hydrateLocalCliBackendAuth(backend, baseUrl, trustLocalCliAuth) {
|
|
|
1470
1434
|
* import { Sandbox } from "@tangle-network/sandbox";
|
|
1471
1435
|
*
|
|
1472
1436
|
* const client = new Sandbox({
|
|
1473
|
-
* apiKey: "
|
|
1437
|
+
* apiKey: "sk-tan-...",
|
|
1474
1438
|
* baseUrl: "https://your-sandbox-api.example.com",
|
|
1475
1439
|
* });
|
|
1476
1440
|
*
|
|
@@ -1487,7 +1451,7 @@ async function hydrateLocalCliBackendAuth(backend, baseUrl, trustLocalCliAuth) {
|
|
|
1487
1451
|
* await box.delete();
|
|
1488
1452
|
* ```
|
|
1489
1453
|
*/
|
|
1490
|
-
var
|
|
1454
|
+
var Sandbox = class {
|
|
1491
1455
|
baseUrl;
|
|
1492
1456
|
apiKey;
|
|
1493
1457
|
timeoutMs;
|
|
@@ -1551,15 +1515,6 @@ var SandboxClient = class {
|
|
|
1551
1515
|
if (!this._sshKeys) this._sshKeys = new SshKeysManagerImpl(this);
|
|
1552
1516
|
return this._sshKeys;
|
|
1553
1517
|
}
|
|
1554
|
-
/** List agent profiles registered by the Sandbox API. */
|
|
1555
|
-
async listProfiles() {
|
|
1556
|
-
const response = await this.fetch("/profiles");
|
|
1557
|
-
if (!response.ok) {
|
|
1558
|
-
const body = await response.text();
|
|
1559
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
1560
|
-
}
|
|
1561
|
-
return (await response.json()).profiles ?? [];
|
|
1562
|
-
}
|
|
1563
1518
|
/** Deliver a server-originated event to a mapped product session. */
|
|
1564
1519
|
async broadcastSessionEvent(sessionId, event) {
|
|
1565
1520
|
return broadcastSessionEvent(this, sessionId, event);
|
|
@@ -1626,6 +1581,7 @@ var SandboxClient = class {
|
|
|
1626
1581
|
* ```
|
|
1627
1582
|
*/
|
|
1628
1583
|
async create(options, requestOptions) {
|
|
1584
|
+
if (options?.backend?.type !== void 0) assertCurrentBackendType(options.backend.type);
|
|
1629
1585
|
const timeoutMs = requestOptions?.timeoutMs ?? (options?.gpuLease ? DEFAULT_GPU_CREATE_TIMEOUT_MS : DEFAULT_CREATE_TIMEOUT_MS);
|
|
1630
1586
|
const idempotencyKey = options?.idempotencyKey ?? generateIdempotencyKey();
|
|
1631
1587
|
const deadline = Date.now() + timeoutMs;
|
|
@@ -1692,7 +1648,7 @@ var SandboxClient = class {
|
|
|
1692
1648
|
resources,
|
|
1693
1649
|
gpuLease: options?.gpuLease,
|
|
1694
1650
|
sshEnabled: options?.sshEnabled,
|
|
1695
|
-
sshPublicKeys: options?.sshPublicKeys
|
|
1651
|
+
sshPublicKeys: options?.sshPublicKeys,
|
|
1696
1652
|
sshKeyIds: options?.sshKeyIds,
|
|
1697
1653
|
webTerminalEnabled: options?.webTerminalEnabled,
|
|
1698
1654
|
maxLifetimeSeconds: options?.maxLifetimeSeconds,
|
|
@@ -1993,29 +1949,57 @@ var SandboxClient = class {
|
|
|
1993
1949
|
}
|
|
1994
1950
|
return await response.json();
|
|
1995
1951
|
}
|
|
1996
|
-
|
|
1997
|
-
|
|
1952
|
+
/**
|
|
1953
|
+
* Run multiple tasks in parallel across sandboxes.
|
|
1954
|
+
* Returns the aggregated results after all tasks complete.
|
|
1955
|
+
*
|
|
1956
|
+
* @param request - Complete batch request
|
|
1957
|
+
* @param options - Batch execution options
|
|
1958
|
+
* @returns Aggregated batch results
|
|
1959
|
+
*
|
|
1960
|
+
* @throws {@link TimeoutError} if the server hasn't begun responding
|
|
1961
|
+
* before the deadline (pre-stream timeout).
|
|
1962
|
+
* @throws {@link ValidationError} / {@link QuotaError} / other typed
|
|
1963
|
+
* SDK errors if the server rejects the request before streaming.
|
|
1964
|
+
* @throws `DOMException` with `name === "AbortError"` if
|
|
1965
|
+
* `options.signal` fires OR the safety-valve deadline fires
|
|
1966
|
+
* AFTER streaming has begun — parseSSEStream can't distinguish
|
|
1967
|
+
* the source mid-stream. Callers that need to tell cancel from
|
|
1968
|
+
* timeout should check `options.signal?.aborted` in their catch.
|
|
1969
|
+
* @throws `Error` with the server message if the stream emits a
|
|
1970
|
+
* `batch.failed` event.
|
|
1971
|
+
*
|
|
1972
|
+
* @example
|
|
1973
|
+
* ```typescript
|
|
1974
|
+
* const result = await client.runBatch({
|
|
1975
|
+
* tasks: [
|
|
1976
|
+
* { id: "task-1", message: "Analyze this file" },
|
|
1977
|
+
* { id: "task-2", message: "Generate a summary" },
|
|
1978
|
+
* ],
|
|
1979
|
+
* });
|
|
1980
|
+
* console.log(`Success rate: ${result.successRate}%`);
|
|
1981
|
+
* ```
|
|
1982
|
+
*/
|
|
1983
|
+
async runBatch(request, options) {
|
|
1998
1984
|
const results = [];
|
|
1999
1985
|
let totalRetries = 0;
|
|
2000
|
-
|
|
2001
|
-
for await (const event of stream) {
|
|
1986
|
+
for await (const event of this.streamBatch(request, options)) {
|
|
2002
1987
|
if (event.type === "task.completed") {
|
|
2003
1988
|
const data = event.data;
|
|
2004
|
-
const usageTotal = (data.usage?.inputTokens ?? 0) + (data.usage?.outputTokens ?? 0);
|
|
2005
1989
|
results.push({
|
|
2006
1990
|
taskId: data.taskId,
|
|
2007
1991
|
success: true,
|
|
2008
|
-
|
|
2009
|
-
durationMs: data.durationMs
|
|
2010
|
-
retries: data.retries
|
|
2011
|
-
|
|
1992
|
+
resultSummary: data.resultSummary,
|
|
1993
|
+
durationMs: data.durationMs,
|
|
1994
|
+
retries: data.retries,
|
|
1995
|
+
usage: data.usage,
|
|
2012
1996
|
backend: data.backend,
|
|
2013
1997
|
backendLabel: data.backendLabel,
|
|
2014
1998
|
backendModel: data.backendModel,
|
|
2015
1999
|
sessionId: data.sessionId,
|
|
2016
2000
|
sandboxId: data.sidecarId
|
|
2017
2001
|
});
|
|
2018
|
-
totalRetries += data.retries
|
|
2002
|
+
totalRetries += data.retries;
|
|
2019
2003
|
}
|
|
2020
2004
|
if (event.type === "task.failed") {
|
|
2021
2005
|
const data = event.data;
|
|
@@ -2023,14 +2007,14 @@ var SandboxClient = class {
|
|
|
2023
2007
|
taskId: data.taskId,
|
|
2024
2008
|
success: false,
|
|
2025
2009
|
error: data.error,
|
|
2026
|
-
durationMs: data.durationMs
|
|
2027
|
-
retries: data.retries
|
|
2010
|
+
durationMs: data.durationMs,
|
|
2011
|
+
retries: data.retries,
|
|
2028
2012
|
backend: data.backend,
|
|
2029
2013
|
backendLabel: data.backendLabel,
|
|
2030
2014
|
backendModel: data.backendModel,
|
|
2031
2015
|
sandboxId: data.sidecarId
|
|
2032
2016
|
});
|
|
2033
|
-
totalRetries += data.retries
|
|
2017
|
+
totalRetries += data.retries;
|
|
2034
2018
|
}
|
|
2035
2019
|
if (event.type === "batch.failed") {
|
|
2036
2020
|
const data = event.data;
|
|
@@ -2040,7 +2024,7 @@ var SandboxClient = class {
|
|
|
2040
2024
|
const succeeded = results.filter((r) => r.success).length;
|
|
2041
2025
|
const failed = results.filter((r) => !r.success).length;
|
|
2042
2026
|
return {
|
|
2043
|
-
totalTasks: tasks.length,
|
|
2027
|
+
totalTasks: request.tasks.length,
|
|
2044
2028
|
succeeded,
|
|
2045
2029
|
failed,
|
|
2046
2030
|
totalRetries,
|
|
@@ -2048,13 +2032,37 @@ var SandboxClient = class {
|
|
|
2048
2032
|
results
|
|
2049
2033
|
};
|
|
2050
2034
|
}
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2035
|
+
/**
|
|
2036
|
+
* Stream events from a batch execution.
|
|
2037
|
+
* Use this for real-time progress updates during batch processing.
|
|
2038
|
+
*
|
|
2039
|
+
* @param request - Complete batch request
|
|
2040
|
+
* @param options - Per-call controls
|
|
2041
|
+
*
|
|
2042
|
+
* @throws {@link TimeoutError} if the server hasn't begun responding
|
|
2043
|
+
* before the deadline (pre-stream timeout).
|
|
2044
|
+
* @throws {@link ValidationError} / {@link QuotaError} / other typed
|
|
2045
|
+
* SDK errors if the server rejects the request before streaming.
|
|
2046
|
+
* @throws `DOMException` with `name === "AbortError"` if
|
|
2047
|
+
* `options.signal` fires OR the safety-valve deadline fires
|
|
2048
|
+
* AFTER streaming has begun. Distinguish via
|
|
2049
|
+
* `options.signal?.aborted` in the consumer's catch.
|
|
2050
|
+
*
|
|
2051
|
+
* @example
|
|
2052
|
+
* ```typescript
|
|
2053
|
+
* for await (const event of client.streamBatch({ tasks })) {
|
|
2054
|
+
* if (event.type === "task.completed") {
|
|
2055
|
+
* console.log(`Task ${event.data.taskId} completed`);
|
|
2056
|
+
* }
|
|
2057
|
+
* }
|
|
2058
|
+
* ```
|
|
2059
|
+
*/
|
|
2060
|
+
async *streamBatch(request, options) {
|
|
2061
|
+
if (request.backend?.type !== void 0) assertCurrentBackendType(request.backend.type, "backend.type");
|
|
2062
|
+
request.backends?.forEach((backend, index) => {
|
|
2063
|
+
if (backend.type !== void 0) assertCurrentBackendType(backend.type, `backends[${index}].type`);
|
|
2064
|
+
});
|
|
2065
|
+
const userSignal = options?.signal;
|
|
2058
2066
|
const url = `${this.baseUrl}/batch/run`;
|
|
2059
2067
|
const resolvedTimeoutMs = request.timeoutMs ?? 3e5;
|
|
2060
2068
|
const requestBody = JSON.stringify({
|
|
@@ -2703,4 +2711,4 @@ var TeamsClient = class {
|
|
|
2703
2711
|
}
|
|
2704
2712
|
};
|
|
2705
2713
|
//#endregion
|
|
2706
|
-
export { splitInlineProfileSkills as a, SandboxFleetClient as c, splitInlineProfileFileMounts as i,
|
|
2714
|
+
export { splitInlineProfileSkills as a, SandboxFleetClient as c, splitInlineProfileFileMounts as i, Sandbox as n, validateDeferredProfileFileMounts as o, materializeProfileFileMounts as r, SandboxFleet as s, IntelligenceClient as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as CollaborationTransportConfig, a as CollaborationClient, c as CollaborationClientConfig, d as CollaborationDocumentRef, f as CollaborationFileBridgeOptions, g as CollaborationTokenRefreshResponse, h as CollaborationTokenRefreshRequest, i as parseCollaborationDocumentId, l as CollaborationDocumentAdapter, m as CollaborationPermissions, n as buildCollaborationDocumentId, o as CollaborationBootstrapRequest, p as CollaborationFileEvent, r as normalizeCollaborationPath, s as CollaborationBootstrapResponse, t as CollaborationFileBridge, u as CollaborationDocumentChange, v as SaveCollaborationSnapshotRequest, y as SaveCollaborationSnapshotResponse } from "../index-
|
|
1
|
+
import { _ as CollaborationTransportConfig, a as CollaborationClient, c as CollaborationClientConfig, d as CollaborationDocumentRef, f as CollaborationFileBridgeOptions, g as CollaborationTokenRefreshResponse, h as CollaborationTokenRefreshRequest, i as parseCollaborationDocumentId, l as CollaborationDocumentAdapter, m as CollaborationPermissions, n as buildCollaborationDocumentId, o as CollaborationBootstrapRequest, p as CollaborationFileEvent, r as normalizeCollaborationPath, s as CollaborationBootstrapResponse, t as CollaborationFileBridge, u as CollaborationDocumentChange, v as SaveCollaborationSnapshotRequest, y as SaveCollaborationSnapshotResponse } from "../index-Cp1KYanB.js";
|
|
2
2
|
export { CollaborationBootstrapRequest, CollaborationBootstrapResponse, CollaborationClient, CollaborationClientConfig, CollaborationDocumentAdapter, CollaborationDocumentChange, CollaborationDocumentRef, CollaborationFileBridge, CollaborationFileBridgeOptions, CollaborationFileEvent, CollaborationPermissions, CollaborationTokenRefreshRequest, CollaborationTokenRefreshResponse, CollaborationTransportConfig, SaveCollaborationSnapshotRequest, SaveCollaborationSnapshotResponse, buildCollaborationDocumentId, normalizeCollaborationPath, parseCollaborationDocumentId };
|
package/dist/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as WorkspaceImagePublishResult, i as WorkspaceImagePublishRequestOptions, n as SandboxInstance, o as WorkspaceImages, r as WorkspaceImagePublishInput } from "./sandbox-
|
|
3
|
-
import { i as
|
|
4
|
-
import { a as NotFoundError, c as SandboxError, d as ServerError, f as StateError, i as NetworkError, l as SandboxErrorJson, m as ValidationError, n as CapabilityError, o as PartialFailureError, p as TimeoutError, s as QuotaError, t as AuthError, u as SandboxFailureDetail } from "./errors-
|
|
5
|
-
export { AuthError, CapabilityError, type CreateSandboxOptions, type ExecOptions, type ExecResult, type NetworkConfig, NetworkError, NotFoundError, PartialFailureError, type PreviewLinkInfo, type PreviewLinkManager, QuotaError,
|
|
1
|
+
import { Ar as SandboxStatus, Cr as SandboxInfo, Gn as SandboxConfig, P as CreateSandboxOptions, cn as PreviewLinkInfo, et as ExecOptions, ln as PreviewLinkManager, rn as NetworkConfig, tt as ExecResult, vn as PromptInputPart } from "./types-Ch78hv3k.js";
|
|
2
|
+
import { a as WorkspaceImagePublishResult, i as WorkspaceImagePublishRequestOptions, n as SandboxInstance, o as WorkspaceImages, r as WorkspaceImagePublishInput } from "./sandbox-Bz7kCFtN.js";
|
|
3
|
+
import { i as Sandbox } from "./client-CdpU6vjj.js";
|
|
4
|
+
import { a as NotFoundError, c as SandboxError, d as ServerError, f as StateError, i as NetworkError, l as SandboxErrorJson, m as ValidationError, n as CapabilityError, o as PartialFailureError, p as TimeoutError, s as QuotaError, t as AuthError, u as SandboxFailureDetail } from "./errors-BzMmpmqU.js";
|
|
5
|
+
export { AuthError, CapabilityError, type CreateSandboxOptions, type ExecOptions, type ExecResult, type NetworkConfig, NetworkError, NotFoundError, PartialFailureError, type PreviewLinkInfo, type PreviewLinkManager, type PromptInputPart, QuotaError, Sandbox, type SandboxConfig, SandboxError, type SandboxErrorJson, type SandboxFailureDetail, type SandboxInfo, SandboxInstance, type SandboxStatus, ServerError, StateError, TimeoutError, ValidationError, type WorkspaceImagePublishInput, type WorkspaceImagePublishRequestOptions, type WorkspaceImagePublishResult, WorkspaceImages };
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { a as NotFoundError, c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, l as ServerError, n as CapabilityError, o as PartialFailureError, s as QuotaError, t as AuthError, u as StateError } from "./errors-D9fFOWX9.js";
|
|
2
|
-
import { i as WorkspaceImages, t as SandboxInstance } from "./sandbox-
|
|
3
|
-
import { n as
|
|
4
|
-
export { AuthError, CapabilityError, NetworkError, NotFoundError, PartialFailureError, QuotaError,
|
|
2
|
+
import { i as WorkspaceImages, t as SandboxInstance } from "./sandbox-kHfb3J4x.js";
|
|
3
|
+
import { n as Sandbox } from "./client-Cz6oQM1P.js";
|
|
4
|
+
export { AuthError, CapabilityError, NetworkError, NotFoundError, PartialFailureError, QuotaError, Sandbox, SandboxError, SandboxInstance, ServerError, StateError, TimeoutError, ValidationError, WorkspaceImages };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as SandboxInstance, t as HttpClient } from "./sandbox-
|
|
1
|
+
import { P as CreateSandboxOptions } from "./types-Ch78hv3k.js";
|
|
2
|
+
import { n as SandboxInstance, t as HttpClient } from "./sandbox-Bz7kCFtN.js";
|
|
3
3
|
|
|
4
4
|
//#region src/tangle/abi.d.ts
|
|
5
5
|
/**
|