@tangle-network/agent-app 0.44.60 → 0.45.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/dist/assistant/index.js +1 -1
- package/dist/chat-routes/index.js +1 -1
- package/dist/{chunk-S4YW2Y52.js → chunk-BATKJP3P.js} +1 -1
- package/dist/chunk-BATKJP3P.js.map +1 -0
- package/dist/{chunk-APFJITYT.js → chunk-EC7CUA4L.js} +2 -340
- package/dist/chunk-EC7CUA4L.js.map +1 -0
- package/dist/sandbox/index.d.ts +11 -502
- package/dist/sandbox/index.js +1 -35
- package/dist/web-react/index.js +1 -1
- package/dist/web-react/terminal.d.ts +9 -13
- package/dist/web-react/terminal.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-APFJITYT.js.map +0 -1
- package/dist/chunk-S4YW2Y52.js.map +0 -1
package/dist/sandbox/index.d.ts
CHANGED
|
@@ -261,68 +261,7 @@ declare function statSandboxFileSize(box: SandboxExecChannel, absolutePath: stri
|
|
|
261
261
|
* mismatch is reported, never returned as a short buffer. */
|
|
262
262
|
declare function readSandboxBinaryBytes(box: SandboxExecChannel, absolutePath: string, expectedSize: number, options?: SandboxExecOptions): Promise<SandboxFileBytesOutcome>;
|
|
263
263
|
|
|
264
|
-
/**
|
|
265
|
-
* Define identity details for a terminal proxy including user, workspace, and sandbox identifiers
|
|
266
|
-
*
|
|
267
|
-
* @deprecated Identity shape for the same-origin proxy terminal transport,
|
|
268
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
269
|
-
* with `createSandboxTerminalConnectionRoute` (`src/sandbox/terminal-connection.ts`)
|
|
270
|
-
* instead. Three apps still import this seam; retirement is tracked in #350
|
|
271
|
-
* and removal is a major.
|
|
272
|
-
*/
|
|
273
|
-
interface TerminalProxyIdentity {
|
|
274
|
-
userId: string;
|
|
275
|
-
workspaceId: string;
|
|
276
|
-
sandboxId: string;
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Generate a signed token for TerminalProxyIdentity with an expiration based on TTL milliseconds
|
|
280
|
-
*
|
|
281
|
-
* @deprecated Mints a token for the same-origin proxy terminal transport,
|
|
282
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
283
|
-
* with `createSandboxTerminalConnectionRoute` (`src/sandbox/terminal-connection.ts`)
|
|
284
|
-
* instead. Three apps still import this seam; retirement is tracked in #350
|
|
285
|
-
* and removal is a major.
|
|
286
|
-
*/
|
|
287
|
-
declare function mintTerminalProxyToken(secret: string, identity: TerminalProxyIdentity, ttlMs?: number, now?: () => number): Promise<Outcome<{
|
|
288
|
-
token: string;
|
|
289
|
-
expiresAt: Date;
|
|
290
|
-
}>>;
|
|
291
|
-
/**
|
|
292
|
-
* Verify the authenticity and validity of a terminal proxy token against expected identity and timestamp
|
|
293
|
-
*
|
|
294
|
-
* @deprecated Verifies a token for the same-origin proxy terminal transport,
|
|
295
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
296
|
-
* with `createSandboxTerminalConnectionRoute` (`src/sandbox/terminal-connection.ts`)
|
|
297
|
-
* instead. Three apps still import this seam; retirement is tracked in #350
|
|
298
|
-
* and removal is a major.
|
|
299
|
-
*/
|
|
300
|
-
declare function verifyTerminalProxyToken(secret: string, token: string, expected: TerminalProxyIdentity, now?: () => number): Promise<boolean>;
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* The same-origin PROXY terminal transport: connection handler -> HMAC proxy
|
|
304
|
-
* token -> runtime proxy -> WebSocket upgrade relay, with a worker in the
|
|
305
|
-
* data path for every terminal byte. Epic #343 / decision #341 moved the
|
|
306
|
-
* fleet default to the browser-direct scoped-token transport in
|
|
307
|
-
* `./terminal-connection.ts` — the product's server authenticates +
|
|
308
|
-
* provisions once, mints an SDK scoped token, and the browser connects
|
|
309
|
-
* `TerminalView` straight to the sidecar with no worker relay. Nothing here
|
|
310
|
-
* is removed (three apps still import this seam); retirement is tracked in
|
|
311
|
-
* #350 and removal is a major.
|
|
312
|
-
*
|
|
313
|
-
* KEPT / DEPRECATED split in this file:
|
|
314
|
-
*
|
|
315
|
-
* | export | status |
|
|
316
|
-
* | ---------------------------------------------- | ----------------------------------- |
|
|
317
|
-
* | `createWorkspaceSandboxManager` + friends | KEPT — generic box lifecycle, used by both transports |
|
|
318
|
-
* | `WorkspaceSandboxInstanceLike` | KEPT — same reason |
|
|
319
|
-
* | `createWorkspaceSandboxConnectionHandler` | `@deprecated` — proxy connection route |
|
|
320
|
-
* | `createWorkspaceSandboxRuntimeProxyHandler` | `@deprecated` — proxy runtime relay |
|
|
321
|
-
* | `createWorkspaceSandboxTerminalUpgradeHandler` | `@deprecated` — proxy WS upgrade relay |
|
|
322
|
-
* | `createSandboxTerminalToken` / `verifySandboxTerminalToken` | `@deprecated` — proxy HMAC token |
|
|
323
|
-
* | every other exported helper below | `@deprecated` — exists only to serve the proxy relay |
|
|
324
|
-
*/
|
|
325
|
-
/** Define the shape of a workspace sandbox instance including its connection details and status */
|
|
264
|
+
/** Define the shape of a workspace sandbox instance including its connection details and status. */
|
|
326
265
|
interface WorkspaceSandboxInstanceLike {
|
|
327
266
|
id: string;
|
|
328
267
|
name?: string;
|
|
@@ -335,12 +274,12 @@ interface WorkspaceSandboxInstanceLike {
|
|
|
335
274
|
authTokenExpiresAt?: string;
|
|
336
275
|
} | null;
|
|
337
276
|
}
|
|
338
|
-
/** Define the context containing workspace and user identifiers for sandbox environment operations */
|
|
277
|
+
/** Define the context containing workspace and user identifiers for sandbox environment operations. */
|
|
339
278
|
interface WorkspaceSandboxEnsureContext {
|
|
340
279
|
workspaceId: string;
|
|
341
280
|
userId: string;
|
|
342
281
|
}
|
|
343
|
-
/** Define configuration options for managing
|
|
282
|
+
/** Define configuration options for managing workspace sandboxes. */
|
|
344
283
|
interface WorkspaceSandboxManagerOptions<TClient, TBox extends WorkspaceSandboxInstanceLike, TEnsureOptions = void> {
|
|
345
284
|
getClient: (ctx: WorkspaceSandboxEnsureContext) => Promise<TClient> | TClient;
|
|
346
285
|
nameForWorkspace: (workspaceId: string, ctx: WorkspaceSandboxEnsureContext) => string;
|
|
@@ -357,444 +296,15 @@ interface WorkspaceSandboxManagerOptions<TClient, TBox extends WorkspaceSandboxI
|
|
|
357
296
|
prepareCreated?: (box: TBox, ctx: WorkspaceSandboxEnsureContext, options: TEnsureOptions) => Promise<TBox | void>;
|
|
358
297
|
onListError?: (error: unknown, ctx: WorkspaceSandboxEnsureContext) => void;
|
|
359
298
|
}
|
|
360
|
-
/** Manage workspace sandboxes by ensuring their creation and retrieval for specified users */
|
|
299
|
+
/** Manage workspace sandboxes by ensuring their creation and retrieval for specified users. */
|
|
361
300
|
interface WorkspaceSandboxManager<TBox extends WorkspaceSandboxInstanceLike, TEnsureOptions = void> {
|
|
362
301
|
ensureWorkspaceSandbox: (workspaceId: string, userId: string, options?: TEnsureOptions) => Promise<TBox>;
|
|
363
302
|
}
|
|
364
|
-
/** Create a manager to handle workspace sandbox instances with client and options configuration */
|
|
365
|
-
declare function createWorkspaceSandboxManager<TClient, TBox extends WorkspaceSandboxInstanceLike, TEnsureOptions = void>(opts: WorkspaceSandboxManagerOptions<TClient, TBox, TEnsureOptions>): WorkspaceSandboxManager<TBox, TEnsureOptions>;
|
|
366
|
-
/**
|
|
367
|
-
* Define options for generating a sandbox terminal token including secret and expiration settings
|
|
368
|
-
*
|
|
369
|
-
* @deprecated Options for the same-origin proxy terminal transport's HMAC
|
|
370
|
-
* token, superseded by the browser-direct scoped-token transport — build the
|
|
371
|
-
* route with `createSandboxTerminalConnectionRoute`
|
|
372
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
373
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
374
|
-
*/
|
|
375
|
-
interface SandboxTerminalTokenOptions {
|
|
376
|
-
secret?: string;
|
|
377
|
-
expiresInMs?: number;
|
|
378
|
-
now?: () => number;
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* Resolve the identity type used for sandbox terminal token subjects
|
|
382
|
-
*
|
|
383
|
-
* @deprecated Identity alias for the same-origin proxy terminal transport,
|
|
384
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
385
|
-
* with `createSandboxTerminalConnectionRoute`
|
|
386
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
387
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
388
|
-
*/
|
|
389
|
-
type SandboxTerminalTokenSubject = TerminalProxyIdentity;
|
|
390
|
-
/**
|
|
391
|
-
* Provide token and expiration details for a sandbox terminal session
|
|
392
|
-
*
|
|
393
|
-
* @deprecated Result shape for the same-origin proxy terminal transport's
|
|
394
|
-
* HMAC token, superseded by the browser-direct scoped-token transport —
|
|
395
|
-
* build the route with `createSandboxTerminalConnectionRoute`
|
|
396
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
397
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
398
|
-
*/
|
|
399
|
-
interface SandboxTerminalTokenResult {
|
|
400
|
-
token: string;
|
|
401
|
-
expiresAt: Date;
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Generate a sandbox terminal token for a given subject with specified options
|
|
405
|
-
*
|
|
406
|
-
* @deprecated Mints a token for the same-origin proxy terminal transport,
|
|
407
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
408
|
-
* with `createSandboxTerminalConnectionRoute`
|
|
409
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
410
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
411
|
-
*/
|
|
412
|
-
declare function createSandboxTerminalToken(subject: SandboxTerminalTokenSubject, opts: SandboxTerminalTokenOptions): Promise<SandboxTerminalTokenResult>;
|
|
413
|
-
/**
|
|
414
|
-
* Verify the validity of a sandbox terminal token against the expected identity and options
|
|
415
|
-
*
|
|
416
|
-
* @deprecated Verifies a token for the same-origin proxy terminal transport,
|
|
417
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
418
|
-
* with `createSandboxTerminalConnectionRoute`
|
|
419
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
420
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
421
|
-
*/
|
|
422
|
-
declare function verifySandboxTerminalToken(token: string, expected: SandboxTerminalTokenSubject, opts: SandboxTerminalTokenOptions): Promise<boolean>;
|
|
423
|
-
/**
|
|
424
|
-
* Represent an authenticated user within a sandbox environment with a unique identifier
|
|
425
|
-
*
|
|
426
|
-
* @deprecated Exists only to serve the same-origin proxy terminal transport,
|
|
427
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
428
|
-
* with `createSandboxTerminalConnectionRoute`
|
|
429
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
430
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
431
|
-
*/
|
|
432
|
-
interface AuthenticatedSandboxUser {
|
|
433
|
-
id: string;
|
|
434
|
-
}
|
|
435
|
-
/**
|
|
436
|
-
* Define options to handle workspace sandbox connections with user authentication and access control
|
|
437
|
-
*
|
|
438
|
-
* @deprecated Options for the same-origin proxy terminal connection handler,
|
|
439
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
440
|
-
* with `createSandboxTerminalConnectionRoute`
|
|
441
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
442
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
443
|
-
*/
|
|
444
|
-
interface WorkspaceSandboxConnectionHandlerOptions<TBox extends WorkspaceSandboxInstanceLike> {
|
|
445
|
-
requireUser: (request: Request) => Promise<AuthenticatedSandboxUser>;
|
|
446
|
-
requireWorkspaceAccess: (args: {
|
|
447
|
-
request: Request;
|
|
448
|
-
userId: string;
|
|
449
|
-
workspaceId: string;
|
|
450
|
-
}) => Promise<void>;
|
|
451
|
-
ensureWorkspaceSandbox: (workspaceId: string, userId: string) => Promise<TBox>;
|
|
452
|
-
tokenSecret: string | (() => string | undefined);
|
|
453
|
-
tokenExpiresInMs?: number;
|
|
454
|
-
proxyRuntimeUrl?: (args: {
|
|
455
|
-
request: Request;
|
|
456
|
-
workspaceId: string;
|
|
457
|
-
sandboxId: string;
|
|
458
|
-
box: TBox;
|
|
459
|
-
}) => string;
|
|
460
|
-
exposeDirectSidecar?: boolean;
|
|
461
|
-
}
|
|
462
|
-
/**
|
|
463
|
-
* Define arguments required to establish a workspace sandbox connection
|
|
464
|
-
*
|
|
465
|
-
* @deprecated Argument shape for the same-origin proxy terminal connection
|
|
466
|
-
* handler, superseded by the browser-direct scoped-token transport — build
|
|
467
|
-
* the route with `createSandboxTerminalConnectionRoute`
|
|
468
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
469
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
470
|
-
*/
|
|
471
|
-
interface WorkspaceSandboxConnectionArgs {
|
|
472
|
-
request: Request;
|
|
473
|
-
params: {
|
|
474
|
-
workspaceId?: string;
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
/**
|
|
478
|
-
* Create a handler to resolve workspace sandbox connections with user and access validation
|
|
479
|
-
*
|
|
480
|
-
* @deprecated The same-origin proxy terminal transport is superseded by the
|
|
481
|
-
* browser-direct scoped-token transport — build the route with
|
|
482
|
-
* `createSandboxTerminalConnectionRoute` (`src/sandbox/terminal-connection.ts`)
|
|
483
|
-
* instead. Three apps still import this seam; retirement is tracked in #350
|
|
484
|
-
* and removal is a major.
|
|
485
|
-
*/
|
|
486
|
-
declare function createWorkspaceSandboxConnectionHandler<TBox extends WorkspaceSandboxInstanceLike>(opts: WorkspaceSandboxConnectionHandlerOptions<TBox>): ({ request, params }: WorkspaceSandboxConnectionArgs) => Promise<Response>;
|
|
487
|
-
/**
|
|
488
|
-
* Define credentials required to access the sandbox API environment
|
|
489
|
-
*
|
|
490
|
-
* @deprecated Exists only to serve the same-origin proxy terminal transport,
|
|
491
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
492
|
-
* with `createSandboxTerminalConnectionRoute`
|
|
493
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
494
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
495
|
-
*/
|
|
496
|
-
interface SandboxApiCredentials {
|
|
497
|
-
baseUrl: string;
|
|
498
|
-
apiKey: string;
|
|
499
|
-
}
|
|
500
|
-
/**
|
|
501
|
-
* Build the sandbox API's sidecar-proxy base for a box:
|
|
502
|
-
* `{baseUrl}/v1/sidecar-proxy/{sandboxId}`.
|
|
503
|
-
*
|
|
504
|
-
* This is the ONLY upstream that serves the interactive terminal. Measured on
|
|
505
|
-
* production (`sandbox.tangle.tools`, one box, `ws` client, same credential in
|
|
506
|
-
* every arm):
|
|
507
|
-
*
|
|
508
|
-
* | upstream base | result |
|
|
509
|
-
* |----------------------------------------|---------------------------------|
|
|
510
|
-
* | `/v1/sidecar-proxy/{id}` | 101 -> `ready` 2551ms -> shell |
|
|
511
|
-
* | `/v1/sandboxes/{id}/runtime/` | HTTP 500 |
|
|
512
|
-
* | `connection.runtimeUrl` (the box host) | 101 then close 1000, 0 bytes |
|
|
513
|
-
*
|
|
514
|
-
* The box's own `connection.runtimeUrl` (`https://sandbox-*.tangle.sh`) accepts
|
|
515
|
-
* the upgrade — its Caddy front end upgrades every path, including ones that do
|
|
516
|
-
* not exist — and then hangs up without a PTY. A 101 from that host therefore
|
|
517
|
-
* proves nothing; only a `ready` control frame does. Two products shipped a
|
|
518
|
-
* terminal against it and rendered a permanent spinner.
|
|
519
|
-
*
|
|
520
|
-
* Exported so no product writes the path literal a fourth time.
|
|
521
|
-
*
|
|
522
|
-
* @deprecated Exists only to serve the same-origin proxy terminal transport,
|
|
523
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
524
|
-
* with `createSandboxTerminalConnectionRoute`
|
|
525
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
526
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
527
|
-
*/
|
|
528
|
-
declare function sandboxSidecarProxyUrl(baseUrl: string, sandboxId: string): string;
|
|
529
|
-
/**
|
|
530
|
-
* Define a connection configuration for sandbox runtime including URL and optional server-side auth token
|
|
531
|
-
*
|
|
532
|
-
* @deprecated Exists only to serve the same-origin proxy terminal transport,
|
|
533
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
534
|
-
* with `createSandboxTerminalConnectionRoute`
|
|
535
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
536
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
537
|
-
*/
|
|
538
|
-
interface SandboxRuntimeConnection {
|
|
539
|
-
runtimeUrl: string;
|
|
540
|
-
/** Server-side sidecar bearer. Must authorize terminal routes; never expose it to browser code. */
|
|
541
|
-
authToken?: string;
|
|
542
|
-
}
|
|
543
|
-
/**
|
|
544
|
-
* Define options for handling workspace sandbox runtime proxy including user, access, credentials, and connection retrieval
|
|
545
|
-
*
|
|
546
|
-
* @deprecated Options for the same-origin proxy terminal runtime relay,
|
|
547
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
548
|
-
* with `createSandboxTerminalConnectionRoute`
|
|
549
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
550
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
551
|
-
*/
|
|
552
|
-
interface WorkspaceSandboxRuntimeProxyHandlerOptions {
|
|
553
|
-
requireUser: (request: Request) => Promise<AuthenticatedSandboxUser>;
|
|
554
|
-
requireWorkspaceAccess: (args: {
|
|
555
|
-
request: Request;
|
|
556
|
-
userId: string;
|
|
557
|
-
workspaceId: string;
|
|
558
|
-
sandboxId: string;
|
|
559
|
-
}) => Promise<void>;
|
|
560
|
-
getSandboxApiCredentials: (args: {
|
|
561
|
-
request: Request;
|
|
562
|
-
userId: string;
|
|
563
|
-
workspaceId: string;
|
|
564
|
-
sandboxId: string;
|
|
565
|
-
}) => Promise<SandboxApiCredentials>;
|
|
566
|
-
getSandboxRuntimeConnection?: (args: {
|
|
567
|
-
request: Request;
|
|
568
|
-
userId: string;
|
|
569
|
-
workspaceId: string;
|
|
570
|
-
sandboxId: string;
|
|
571
|
-
}) => Promise<SandboxRuntimeConnection | null | undefined>;
|
|
572
|
-
tokenSecret: string | (() => string | undefined);
|
|
573
|
-
fetch?: typeof fetch;
|
|
574
|
-
forwardHeaders?: string[];
|
|
575
|
-
}
|
|
576
|
-
/**
|
|
577
|
-
* Define arguments for proxying runtime requests within a workspace sandbox environment
|
|
578
|
-
*
|
|
579
|
-
* @deprecated Argument shape for the same-origin proxy terminal runtime
|
|
580
|
-
* relay, superseded by the browser-direct scoped-token transport — build the
|
|
581
|
-
* route with `createSandboxTerminalConnectionRoute`
|
|
582
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
583
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
584
|
-
*/
|
|
585
|
-
interface WorkspaceSandboxRuntimeProxyArgs {
|
|
586
|
-
request: Request;
|
|
587
|
-
params: {
|
|
588
|
-
workspaceId?: string;
|
|
589
|
-
sandboxId?: string;
|
|
590
|
-
'*'?: string;
|
|
591
|
-
};
|
|
592
|
-
}
|
|
593
|
-
/**
|
|
594
|
-
* Create a proxy handler to resolve sandbox runtime requests with user and workspace access validation
|
|
595
|
-
*
|
|
596
|
-
* @deprecated The same-origin proxy terminal transport is superseded by the
|
|
597
|
-
* browser-direct scoped-token transport — build the route with
|
|
598
|
-
* `createSandboxTerminalConnectionRoute` (`src/sandbox/terminal-connection.ts`)
|
|
599
|
-
* instead. Three apps still import this seam; retirement is tracked in #350
|
|
600
|
-
* and removal is a major.
|
|
601
|
-
*/
|
|
602
|
-
declare function createWorkspaceSandboxRuntimeProxyHandler(opts: WorkspaceSandboxRuntimeProxyHandlerOptions): ({ request, params }: WorkspaceSandboxRuntimeProxyArgs) => Promise<Response>;
|
|
603
|
-
/**
|
|
604
|
-
* Define the structure for matching a sandbox terminal WebSocket with workspace and path details
|
|
605
|
-
*
|
|
606
|
-
* @deprecated Exists only to serve the same-origin proxy terminal transport,
|
|
607
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
608
|
-
* with `createSandboxTerminalConnectionRoute`
|
|
609
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
610
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
611
|
-
*/
|
|
612
|
-
interface SandboxTerminalWsMatch {
|
|
613
|
-
workspaceId: string;
|
|
614
|
-
sandboxId: string;
|
|
615
|
-
subPath: string;
|
|
616
|
-
}
|
|
617
|
-
/**
|
|
618
|
-
* Parse a same-origin terminal-WS pathname into its parts, or `null` when the
|
|
619
|
-
* path is not a sandbox terminal WebSocket. Matches the default `runtimeUrl`
|
|
620
|
-
* convention emitted by {@link createWorkspaceSandboxConnectionHandler}
|
|
621
|
-
* (`/api/workspaces/:workspaceId/sandbox/runtime/:sandboxId`) with a canonical
|
|
622
|
-
* `terminals/:id/ws` sub-path. `subPath` is left URL-encoded for re-use in the
|
|
623
|
-
* upstream URL; the ids are decoded for auth checks.
|
|
624
|
-
*
|
|
625
|
-
* @deprecated Parses a path for the same-origin proxy terminal transport,
|
|
626
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
627
|
-
* with `createSandboxTerminalConnectionRoute`
|
|
628
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
629
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
630
|
-
*/
|
|
631
|
-
declare function matchSandboxTerminalWsPath(pathname: string): SandboxTerminalWsMatch | null;
|
|
632
303
|
/**
|
|
633
|
-
*
|
|
634
|
-
*
|
|
635
|
-
* @deprecated Exists only to serve the same-origin proxy terminal transport,
|
|
636
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
637
|
-
* with `createSandboxTerminalConnectionRoute`
|
|
638
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
639
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
640
|
-
*/
|
|
641
|
-
declare function isSandboxTerminalWsUpgrade(request: Request): boolean;
|
|
642
|
-
/**
|
|
643
|
-
* Define options to handle user authentication, workspace access, and sandbox API credential retrieval
|
|
644
|
-
*
|
|
645
|
-
* @deprecated Options for the same-origin proxy terminal WS upgrade relay,
|
|
646
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
647
|
-
* with `createSandboxTerminalConnectionRoute`
|
|
648
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
649
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
304
|
+
* Create a generic name-keyed sandbox lifecycle manager for products that
|
|
305
|
+
* drive their own SDK or box types.
|
|
650
306
|
*/
|
|
651
|
-
|
|
652
|
-
requireUser: (request: Request) => Promise<AuthenticatedSandboxUser>;
|
|
653
|
-
requireWorkspaceAccess: (args: {
|
|
654
|
-
request: Request;
|
|
655
|
-
userId: string;
|
|
656
|
-
workspaceId: string;
|
|
657
|
-
sandboxId: string;
|
|
658
|
-
}) => Promise<void>;
|
|
659
|
-
getSandboxApiCredentials: (args: {
|
|
660
|
-
request: Request;
|
|
661
|
-
userId: string;
|
|
662
|
-
workspaceId: string;
|
|
663
|
-
sandboxId: string;
|
|
664
|
-
}) => Promise<SandboxApiCredentials>;
|
|
665
|
-
getSandboxRuntimeConnection?: (args: {
|
|
666
|
-
request: Request;
|
|
667
|
-
userId: string;
|
|
668
|
-
workspaceId: string;
|
|
669
|
-
sandboxId: string;
|
|
670
|
-
}) => Promise<SandboxRuntimeConnection | null | undefined>;
|
|
671
|
-
tokenSecret: string | (() => string | undefined);
|
|
672
|
-
fetch?: typeof fetch;
|
|
673
|
-
}
|
|
674
|
-
/**
|
|
675
|
-
* Build a Worker-entry handler that proxies a sandbox terminal WebSocket
|
|
676
|
-
* upgrade to the sandbox API runtime proxy. Returns `null` when the request is
|
|
677
|
-
* not a terminal WS upgrade, so the caller can fall through to its normal
|
|
678
|
-
* request handler:
|
|
679
|
-
*
|
|
680
|
-
* ```ts
|
|
681
|
-
* const handled = await handleSandboxTerminalUpgrade(request)
|
|
682
|
-
* if (handled) return handled
|
|
683
|
-
* ```
|
|
684
|
-
*
|
|
685
|
-
* @deprecated The same-origin proxy terminal transport is superseded by the
|
|
686
|
-
* browser-direct scoped-token transport — build the route with
|
|
687
|
-
* `createSandboxTerminalConnectionRoute` (`src/sandbox/terminal-connection.ts`)
|
|
688
|
-
* instead. Three apps still import this seam; retirement is tracked in #350
|
|
689
|
-
* and removal is a major.
|
|
690
|
-
*/
|
|
691
|
-
declare function createWorkspaceSandboxTerminalUpgradeHandler(opts: WorkspaceSandboxTerminalUpgradeHandlerOptions): (request: Request) => Promise<Response | null>;
|
|
692
|
-
/**
|
|
693
|
-
* A response-like shape carrying just what the subprotocol echo decision reads.
|
|
694
|
-
*
|
|
695
|
-
* @deprecated Exists only to serve the same-origin proxy terminal transport,
|
|
696
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
697
|
-
* with `createSandboxTerminalConnectionRoute`
|
|
698
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
699
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
700
|
-
*/
|
|
701
|
-
interface TerminalUpgradeResponseLike {
|
|
702
|
-
status: number;
|
|
703
|
-
statusText?: string;
|
|
704
|
-
headers: Headers;
|
|
705
|
-
}
|
|
706
|
-
/**
|
|
707
|
-
* Decide whether a terminal upgrade's 101 needs the browser's own subprotocol
|
|
708
|
-
* echoed back onto it, and return the headers to answer with. `null` means
|
|
709
|
-
* "pass the upstream response through untouched".
|
|
710
|
-
*
|
|
711
|
-
* Why this exists: the browser's terminal credential rides in a
|
|
712
|
-
* `bearer.<base64url>` WebSocket subprotocol, because a browser cannot set
|
|
713
|
-
* `Authorization` on a WS handshake. That subprotocol is a browser-to-Worker
|
|
714
|
-
* credential, so it is stripped before the upstream hop — and the upstream then
|
|
715
|
-
* answers the 101 selecting nothing. A browser MUST fail the connection when a
|
|
716
|
-
* 101 selects no subprotocol after it offered one (RFC 6455 s4.1), so the socket
|
|
717
|
-
* dies on open and the terminal renders a spinner forever.
|
|
718
|
-
*
|
|
719
|
-
* Kept as a pure function because a 101 `Response` cannot be constructed off
|
|
720
|
-
* Workers, so this is the only part of the decision a test can drive directly.
|
|
721
|
-
*
|
|
722
|
-
* @deprecated Exists only to serve the same-origin proxy terminal transport,
|
|
723
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
724
|
-
* with `createSandboxTerminalConnectionRoute`
|
|
725
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
726
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
727
|
-
*/
|
|
728
|
-
declare function terminalUpgradeSubprotocolEcho(upstream: TerminalUpgradeResponseLike, browserProtocol: string | null): {
|
|
729
|
-
status: number;
|
|
730
|
-
statusText: string;
|
|
731
|
-
headers: Headers;
|
|
732
|
-
} | null;
|
|
733
|
-
/**
|
|
734
|
-
* The exact `bearer.*` subprotocol string the browser offered, so it can be
|
|
735
|
-
* echoed verbatim on the 101. Returns null when the browser offered none.
|
|
736
|
-
*
|
|
737
|
-
* Takes the raw `Sec-WebSocket-Protocol` value rather than the `Headers`, to
|
|
738
|
-
* match its siblings `bearerSubprotocolToken` and `stripBearerSubprotocol` —
|
|
739
|
-
* one shape for the whole family, and the caller reads the header once.
|
|
740
|
-
*
|
|
741
|
-
* @deprecated Exists only to serve the same-origin proxy terminal transport,
|
|
742
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
743
|
-
* with `createSandboxTerminalConnectionRoute`
|
|
744
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
745
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
746
|
-
*/
|
|
747
|
-
declare function selectedBearerSubprotocol(value: string | null): string | null;
|
|
748
|
-
/**
|
|
749
|
-
* Build proxy headers for sandbox runtime including authorization and forwarded headers
|
|
750
|
-
*
|
|
751
|
-
* @deprecated Exists only to serve the same-origin proxy terminal transport,
|
|
752
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
753
|
-
* with `createSandboxTerminalConnectionRoute`
|
|
754
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
755
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
756
|
-
*/
|
|
757
|
-
declare function buildSandboxRuntimeProxyHeaders(source: Headers, sandboxApiKey: string, forwardHeaders?: string[]): Headers;
|
|
758
|
-
/**
|
|
759
|
-
* Encode a runtime path by URI-encoding each valid segment and returning null for invalid segments
|
|
760
|
-
*
|
|
761
|
-
* @deprecated Exists only to serve the same-origin proxy terminal transport,
|
|
762
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
763
|
-
* with `createSandboxTerminalConnectionRoute`
|
|
764
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
765
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
766
|
-
*/
|
|
767
|
-
declare function encodeSandboxRuntimePath(runtimePath: string): string | null;
|
|
768
|
-
/**
|
|
769
|
-
* Extract the token from a bearer authorization string or return null if invalid or missing
|
|
770
|
-
*
|
|
771
|
-
* @deprecated Exists only to serve the same-origin proxy terminal transport,
|
|
772
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
773
|
-
* with `createSandboxTerminalConnectionRoute`
|
|
774
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
775
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
776
|
-
*/
|
|
777
|
-
declare function bearerToken(value: string | null): string | null;
|
|
778
|
-
/**
|
|
779
|
-
* Resolve and decode a bearer token from a comma-separated subprotocol string or return null
|
|
780
|
-
*
|
|
781
|
-
* @deprecated Exists only to serve the same-origin proxy terminal transport,
|
|
782
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
783
|
-
* with `createSandboxTerminalConnectionRoute`
|
|
784
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
785
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
786
|
-
*/
|
|
787
|
-
declare function bearerSubprotocolToken(value: string | null): string | null;
|
|
788
|
-
/**
|
|
789
|
-
* Resolve the terminal token from request headers using Authorization or Sec-WebSocket-Protocol fields
|
|
790
|
-
*
|
|
791
|
-
* @deprecated Exists only to serve the same-origin proxy terminal transport,
|
|
792
|
-
* superseded by the browser-direct scoped-token transport — build the route
|
|
793
|
-
* with `createSandboxTerminalConnectionRoute`
|
|
794
|
-
* (`src/sandbox/terminal-connection.ts`) instead. Three apps still import
|
|
795
|
-
* this seam; retirement is tracked in #350 and removal is a major.
|
|
796
|
-
*/
|
|
797
|
-
declare function terminalTokenFromRequest(headers: Headers): string | null;
|
|
307
|
+
declare function createWorkspaceSandboxManager<TClient, TBox extends WorkspaceSandboxInstanceLike, TEnsureOptions = void>(opts: WorkspaceSandboxManagerOptions<TClient, TBox, TEnsureOptions>): WorkspaceSandboxManager<TBox, TEnsureOptions>;
|
|
798
308
|
|
|
799
309
|
/**
|
|
800
310
|
* Browser-direct scoped-token terminal connection route (#341/#349).
|
|
@@ -803,10 +313,9 @@ declare function terminalTokenFromRequest(headers: Headers): string | null;
|
|
|
803
313
|
* — the product's server authenticates the request and provisions/resolves
|
|
804
314
|
* the sandbox exactly once, mints a short-lived SDK scoped token
|
|
805
315
|
* (`box.mintScopedToken`), and hands the browser just enough to connect
|
|
806
|
-
* `TerminalView` straight to the sidecar. No worker relays terminal bytes
|
|
807
|
-
*
|
|
808
|
-
*
|
|
809
|
-
* (retirement tracked in #350; nothing removed, three apps still import it).
|
|
316
|
+
* `TerminalView` straight to the sidecar. No worker relays terminal bytes.
|
|
317
|
+
* The deprecated same-origin relay was removed in #350 after the fleet
|
|
318
|
+
* migrated, leaving this as the package's only terminal transport.
|
|
810
319
|
*
|
|
811
320
|
* VERIFIED PLATFORM CONTRACT (`@tangle-network/sandbox` 0.15.2 + the
|
|
812
321
|
* orchestrator/sidecar enforcement source, verified 2026-07-30):
|
|
@@ -1747,4 +1256,4 @@ declare function isTerminalPromptEvent(event: unknown): boolean;
|
|
|
1747
1256
|
/** Resolve the interactive question text from a structured event or return null if none found */
|
|
1748
1257
|
declare function detectInteractiveQuestion(event: unknown): string | null;
|
|
1749
1258
|
|
|
1750
|
-
export { type AppToolDescriptor, type
|
|
1259
|
+
export { type AppToolDescriptor, type BuildAppToolMcpServersOptions, type BuildSandboxToolFileMountsOptions, type D1PrewarmClaimStoreOptions, DEFAULT_PREWARM_CLAIM_TABLE, DEFAULT_SANDBOX_RESOURCES, DEFAULT_SIDECAR_PROCESS_PATTERN, type DriveSandboxTurnOptions, ENV_TOTAL_MAX_BYTES, ENV_VALUE_MAX_BYTES, type EnsureWorkspaceSandboxOptions, type LivenessProbeConfig, type MemberSyncSeam, type ModelSelection, type ModelSelectionError, type ModelSelectionFailure, type ModelSelectionSource, type Outcome, PREWARM_CLAIM_TABLE_DDL, PROVISION_PAYLOAD_MAX_BYTES, type PeekWorkspaceSandboxOutcome, type PrewarmClaimD1Like, type PrewarmClaimStore, type PrewarmDecision, type PrewarmEvent, type PrewarmOutcome, type PrewarmResult, type ProfileComposeOptions, type PromptInputPart, type ProviderResolutionConfig, type ProvisionPayloadSections, type ProvisionProfileSection, type ResolveSandboxClientCredentialsOptions, type ResolvedModel, type SandboxBuildContext, type SandboxClientCredentials, type SandboxCredentialEnvironment, SandboxEgressPolicyMismatchError, type SandboxEgressPolicySource, type SandboxExecChannel, type SandboxExecOptions, type SandboxExistingBoxStage, type SandboxFileBytesOutcome, type SandboxFileSizeOutcome, SandboxModelResolutionError, type SandboxPermissionLevel, type SandboxPrewarmScope, type SandboxPrewarmer, type SandboxPrewarmerOptions, type SandboxReadiness, SandboxRecoveryFailedError, type SandboxRecoveryPhase, type SandboxResourceConfig, type SandboxRestoreSpec, SandboxRuntimeAuthRefreshError, type SandboxRuntimeConfig, type SandboxScope, type SandboxStepTransition, type SandboxTerminalConnectionRouteOptions, type SandboxToolPathOptions, type SandboxToolSpec, type ScopedTokenResult, type SecretStore, type StoppedSandboxResumeFailure, type StoppedSandboxResumeRecovery, type StreamSandboxPromptOptions, type TerminalConnectionBoxLike, type WorkspaceSandboxEnsureContext, type WorkspaceSandboxInstanceLike, type WorkspaceSandboxManager, type WorkspaceSandboxManagerOptions, type WriteProfileFilesOptions, assertEnvWithinLimits, assertProvisionPayloadWithinCap, attachReasoningEffort, buildAppToolMcpServers, buildSandboxToolFileMounts, buildSandboxToolPathSetupScript, classifySeveredStream, collectSandboxPromptText, createD1PrewarmClaimStore, createSandboxPrewarmer, createSandboxTerminalConnectionRoute, createWorkspaceSandboxManager, deferredCorpusHash, deleteSecret, detectInteractiveQuestion, driveSandboxTurn, ensureWorkspaceSandbox, flattenHistory, getClient, isTerminalPromptEvent, mergeExtraMcp, mergeHistoryIntoParts, mintSandboxScopedToken, peekWorkspaceSandbox, readSandboxBinaryBytes, readSecret, requireTransportableModel, resetClientCache, resolveModel, resolveModelSelection, resolveSandboxClientCredentials, runSandboxPrompt, runSandboxToolPathSetup, sandboxToolBinDir, sandboxToolPath, sandboxToolRootDir, secretStoreFromClient, shellQuote, splitDeferredProfileFiles, statSandboxFileSize, storeSecret, streamSandboxPrompt, syncSandboxMemberAdd, syncSandboxMemberRemove, syncSandboxMemberRole, writeProfileFilesToBox };
|