@tangle-network/sandbox 0.49.0 → 0.51.0

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.
@@ -402,6 +402,215 @@ declare class InteractiveSessionHandle {
402
402
  stopLifecycle(options?: InteractiveRequestOptions): Promise<AgentInteractiveSessionStopAcknowledgement>;
403
403
  }
404
404
  //#endregion
405
+ //#region src/lines.d.ts
406
+ /** The transport a line carries. Lines support Inkbox iMessage today. */
407
+ type LineTransport = "imessage" | "sms" | "whatsapp" | "email";
408
+ /** What a role's members share and may do in the attached sandbox. */
409
+ interface LineRole {
410
+ /** `shared`: the member's turns see other shared members' recent exchanges. `own`: they see none, and nobody sees theirs. */
411
+ context: "own" | "shared";
412
+ /** `chat`: the member's session has no shell and no file writes. */
413
+ tools: "act" | "chat";
414
+ }
415
+ /** A sender an attachment admits. */
416
+ interface LineMemberSpec {
417
+ /** E.164 number, or the email / Apple ID the sender texts from. */
418
+ address: string;
419
+ /** A role name from the attachment's `roles`. */
420
+ role: string;
421
+ label?: string;
422
+ }
423
+ /** Per-attachment bounds. */
424
+ interface LineLimits {
425
+ turnsPerMemberPerDay: number;
426
+ noticesPerSenderPerDay: number;
427
+ noticesPerLinePerDay: number;
428
+ }
429
+ /**
430
+ * An HTTPS endpoint that checks each agent answer before Hub sends it.
431
+ *
432
+ * Hub posts `{ ...context, candidate }` with `Authorization: Bearer <secret>`,
433
+ * where `candidate` is the agent's final text. A 2xx JSON response with an
434
+ * `answer` string is the exact body Hub stores and sends, unchanged. A 4xx
435
+ * refuses the answer; a 408, 429, 5xx or timeout is retried. Hub never sends
436
+ * the agent's own text on a gated line, and refuses an answer over 4,000
437
+ * characters instead of cutting it.
438
+ *
439
+ * A gated attachment must reject unknown senders, so no self-enrolled sender
440
+ * can reach a gated answer.
441
+ */
442
+ interface LineReplyGate {
443
+ url: string;
444
+ /** Sent as a bearer token; write-only, kept in the Hub vault. */
445
+ secret: string;
446
+ /** Up to 8 fixed string fields sent with every candidate. */
447
+ context?: Record<string, string>;
448
+ /** `owner`: answer only declared members with the owner role. Default `members`. */
449
+ audience?: "owner" | "members";
450
+ }
451
+ /** How Hub answers an admitted message. */
452
+ interface LineRespondAgent {
453
+ kind: "agent";
454
+ /** Backend for member sessions. Omit to use the sandbox's default. */
455
+ backend?: Partial<BackendConfig>;
456
+ gate?: LineReplyGate;
457
+ }
458
+ /** The stored respond config; the gate's secret is never returned. */
459
+ interface LineRespondView {
460
+ kind: "agent";
461
+ backend?: Partial<BackendConfig>;
462
+ gate?: Omit<LineReplyGate, "secret"> & {
463
+ audience: "owner" | "members";
464
+ };
465
+ }
466
+ interface LineAttachOptions {
467
+ /** A line id (`ln_...`) or an address of one of your lines. */
468
+ number: string;
469
+ /** `personal`: one owner member. `shared`: many members, one thread each. */
470
+ mode: "personal" | "shared";
471
+ members: LineMemberSpec[];
472
+ /** Default `reject`. `guest` (shared mode) admits unknown senders with the `guest` role. */
473
+ unknownSenders?: "reject" | "guest";
474
+ /** Default: owner and member share context and act; guest is own-context and chat-only. */
475
+ roles?: Record<string, LineRole>;
476
+ respond?: LineRespondAgent;
477
+ limits?: Partial<LineLimits>;
478
+ clientReference?: string;
479
+ }
480
+ /** Input to `client.lines.fromConnection()`. */
481
+ interface LineFromConnectionInput {
482
+ /** A Hub connection id for an Inkbox identity with iMessage enabled. */
483
+ connectionId: string;
484
+ transport: "imessage";
485
+ label?: string;
486
+ /** Your idempotency reference: the same value returns the same line. */
487
+ clientReference?: string;
488
+ }
489
+ /** Fields a member update may change. */
490
+ interface LineMemberPatch {
491
+ role?: string;
492
+ label?: string;
493
+ }
494
+ interface LineMember {
495
+ id: string;
496
+ lineId: string;
497
+ attachmentId: string;
498
+ address: string;
499
+ role: string;
500
+ label: string | null;
501
+ source: "declared" | "guest" | "onboarded";
502
+ /** `invited` until the member's first message, which is their consent. */
503
+ status: "invited" | "active" | "stopped" | "removed";
504
+ createdAt: string;
505
+ }
506
+ interface LineAttachment {
507
+ id: string;
508
+ lineId: string;
509
+ sandboxId: string;
510
+ mode: "personal" | "shared";
511
+ unknownSenders: "reject" | "guest" | "onboard";
512
+ roles: Record<string, LineRole>;
513
+ respond: LineRespondView;
514
+ limits: LineLimits;
515
+ status: "active" | "suspended" | "detached";
516
+ clientReference: string | null;
517
+ createdAt: string;
518
+ updatedAt: string;
519
+ /** Present on the attach response. */
520
+ members?: LineMember[];
521
+ }
522
+ interface Line {
523
+ id: string;
524
+ transport: LineTransport;
525
+ /** E.164 number, or `@handle` for an identity on Inkbox's shared iMessage router. */
526
+ address: string;
527
+ /** For a shared-router line, the text a person sends to `routerAddress` to reach this line. */
528
+ connect: string | null;
529
+ routerAddress: string | null;
530
+ connectionId: string;
531
+ label: string | null;
532
+ clientReference: string | null;
533
+ status: "active" | "suspended" | "released";
534
+ attachment: LineAttachment | null;
535
+ createdAt: string;
536
+ updatedAt: string;
537
+ }
538
+ interface LineThread {
539
+ id: string;
540
+ lineId: string;
541
+ memberId: string;
542
+ sandboxId: string;
543
+ /** The agent session this member's turns run in. */
544
+ sessionId: string;
545
+ lastMessageAt: string | null;
546
+ status: "active" | "closed";
547
+ createdAt: string;
548
+ }
549
+ interface LineMessage {
550
+ id: string;
551
+ threadId: string | null;
552
+ memberId: string | null;
553
+ direction: "in" | "out";
554
+ kind: "agent" | "notice" | "send";
555
+ text: string | null;
556
+ status: string;
557
+ errorCode: string | null;
558
+ /** Latency marks in milliseconds after the message arrived. */
559
+ timeline: Record<string, number | string> | null;
560
+ createdAt: string;
561
+ }
562
+ /** The part of the SDK's HTTP client lines use. */
563
+ interface LinesHttpClient {
564
+ fetch(path: string, options?: RequestInit): Promise<Response>;
565
+ }
566
+ /** `client.lines`: your lines, their members and their threads. */
567
+ declare class LinesClient {
568
+ private readonly http;
569
+ constructor(http: LinesHttpClient);
570
+ /**
571
+ * Create a line from a connected Inkbox identity, or return the line that
572
+ * already exists for it. Hub reuses the connection's inbound webhook and
573
+ * never re-keys the connection.
574
+ */
575
+ fromConnection(input: LineFromConnectionInput): Promise<Line>;
576
+ /** Your lines. `sandboxId` narrows to lines attached to that sandbox. */
577
+ list(options?: {
578
+ sandboxId?: string;
579
+ }): Promise<Line[]>;
580
+ get(lineId: string): Promise<Line>;
581
+ /** A line id for a line id or one of your lines' addresses. */
582
+ resolve(number: string): Promise<string>;
583
+ /** Members of the line's active attachment. */
584
+ members(lineId: string): {
585
+ list(): Promise<LineMember[]>;
586
+ add(spec: LineMemberSpec): Promise<LineMember>;
587
+ update(memberId: string, patch: LineMemberPatch): Promise<LineMember>;
588
+ remove(memberId: string): Promise<void>;
589
+ };
590
+ /** Threads of a line (one per member) and their messages, newest first. */
591
+ threads(lineId: string): {
592
+ list(): Promise<LineThread[]>;
593
+ messages(threadId: string): Promise<LineMessage[]>;
594
+ };
595
+ }
596
+ /** `sandbox.lines`: attach lines to this sandbox. */
597
+ declare class SandboxLines {
598
+ private readonly http;
599
+ private readonly sandboxId;
600
+ private readonly lines;
601
+ constructor(http: LinesHttpClient, sandboxId: string);
602
+ /**
603
+ * Attach a line to this sandbox. Hub checks that your API key can run this
604
+ * sandbox, and each turn runs as a short-lived child of that key. Attaching
605
+ * again with the same options returns the same attachment.
606
+ */
607
+ attach(options: LineAttachOptions): Promise<LineAttachment>;
608
+ /** Lines attached to this sandbox. */
609
+ list(): Promise<Line[]>;
610
+ /** Detach a line (by id or address) from this sandbox. */
611
+ detach(number: string): Promise<void>;
612
+ }
613
+ //#endregion
405
614
  //#region src/session.d.ts
406
615
  /**
407
616
  * The subset of `SandboxInstance` a `SandboxSession` drives. Declared here
@@ -1853,6 +2062,7 @@ declare class SandboxInstance {
1853
2062
  private consumerConnectionReady;
1854
2063
  private hasFreshStatus;
1855
2064
  private ensureRunning;
2065
+ private ensureRunningForPrompt;
1856
2066
  private assertFilesystemIncarnationReady;
1857
2067
  private runtimeFetch;
1858
2068
  /**
@@ -1914,6 +2124,11 @@ declare class SandboxInstance {
1914
2124
  * Use {@link sessions} to discover existing session ids.
1915
2125
  */
1916
2126
  session(id: string): SandboxSession;
2127
+ /**
2128
+ * Lines attached to this sandbox. `attach()` binds a line so Hub runs each
2129
+ * member's messages here, one session per member.
2130
+ */
2131
+ get lines(): SandboxLines;
1917
2132
  /** Create an agent session and return both its handle and initial metadata. */
1918
2133
  createSession(options: CreateSessionOptions): Promise<{
1919
2134
  session: SandboxSession;
@@ -2118,4 +2333,4 @@ declare class SandboxInstance {
2118
2333
  }): Promise<DurablePlanDecisionResult>;
2119
2334
  }
2120
2335
  //#endregion
2121
- export { SandboxMcpEndpoint as $, InterruptResult as A, InteractiveAttachRequest as B, InteractiveSessionHost as C, InteractiveSessionStartOptions as D, InteractiveSessionRef as E, InteractiveTerminalMetadata as F, SandboxInteractionConflict as G, InteractiveSessionControllerOptions as H, createInteractiveTerminalCapture as I, BuildControlPlaneMcpConfigOptions as J, SandboxInteractionResolution as K, createInteractiveTerminalSession as L, agentInteractiveSessionPromptRequestDigest as M, InteractiveTerminalCapture as N, InteractiveSessionStartResult as O, InteractiveTerminalFrameLog as P, SandboxMcpConfig as Q, BrowserInteractiveSessionController as R, InteractiveSessionHandleOptions as S, InteractiveSessionInfo as T, InteractiveSessionControllerTransport as U, InteractiveSessionController as V, SandboxInteractionCommandResult as W, CONTROL_PLANE_MCP_SERVER_NAME as X, BuildSandboxMcpConfigOptions as Y, SANDBOX_MCP_SERVER_NAME as Z, AgentInteractiveTerminalSession$1 as _, WorkspaceImagePublishRequestOptions as a, InteractiveSessionControlClaim as b, TraceExportFormat as c, buildTraceExportPayload as d, SandboxMcpServerEntry as et, exportTraceBundle as f, SandboxSession as g, SandboxTaskSession as h, WorkspaceImagePublishInput as i, RespondToPermissionOptions as j, InteractiveStopCommand as k, TraceExportResult as l, toOtelJson as m, HttpClient as n, buildSandboxMcpConfig as nt, WorkspaceImagePublishResult as o, otelTraceIdForTangleTrace as p, SandboxInteractionResult as q, SandboxInstance as r, WorkspaceImages as s, ForkAcknowledgement as t, buildControlPlaneMcpConfig as tt, TraceExportSink as u, InteractiveControlClaimRequest as v, InteractiveSessionIncarnationId as w, InteractiveSessionHandle as x, InteractivePromptCommand as y, BrowserInteractiveSessionControllerOptions as z };
2336
+ export { createInteractiveTerminalCapture as $, LineThread as A, InteractiveSessionHost as B, LineMemberPatch as C, LineRespondAgent as D, LineReplyGate as E, InteractiveControlClaimRequest as F, InteractiveSessionStartResult as G, InteractiveSessionInfo as H, InteractivePromptCommand as I, RespondToPermissionOptions as J, InteractiveStopCommand as K, InteractiveSessionControlClaim as L, LinesClient as M, SandboxLines as N, LineRespondView as O, AgentInteractiveTerminalSession$1 as P, InteractiveTerminalMetadata as Q, InteractiveSessionHandle as R, LineMember as S, LineMessage as T, InteractiveSessionRef as U, InteractiveSessionIncarnationId as V, InteractiveSessionStartOptions as W, InteractiveTerminalCapture as X, agentInteractiveSessionPromptRequestDigest as Y, InteractiveTerminalFrameLog as Z, Line as _, SandboxMcpServerEntry as _t, WorkspaceImagePublishRequestOptions as a, InteractiveSessionControllerOptions as at, LineFromConnectionInput as b, TraceExportFormat as c, SandboxInteractionConflict as ct, buildTraceExportPayload as d, BuildControlPlaneMcpConfigOptions as dt, createInteractiveTerminalSession as et, exportTraceBundle as f, BuildSandboxMcpConfigOptions as ft, SandboxSession as g, SandboxMcpEndpoint as gt, SandboxTaskSession as h, SandboxMcpConfig as ht, WorkspaceImagePublishInput as i, InteractiveSessionController as it, LineTransport as j, LineRole as k, TraceExportResult as l, SandboxInteractionResolution as lt, toOtelJson as m, SANDBOX_MCP_SERVER_NAME as mt, HttpClient as n, BrowserInteractiveSessionControllerOptions as nt, WorkspaceImagePublishResult as o, InteractiveSessionControllerTransport as ot, otelTraceIdForTangleTrace as p, CONTROL_PLANE_MCP_SERVER_NAME as pt, InterruptResult as q, SandboxInstance as r, InteractiveAttachRequest as rt, WorkspaceImages as s, SandboxInteractionCommandResult as st, ForkAcknowledgement as t, BrowserInteractiveSessionController as tt, TraceExportSink as u, SandboxInteractionResult as ut, LineAttachOptions as v, buildControlPlaneMcpConfig as vt, LineMemberSpec as w, LineLimits as x, LineAttachment as y, buildSandboxMcpConfig as yt, InteractiveSessionHandleOptions as z };
@@ -1,2 +1,2 @@
1
- import { a as TANGLE_JOBS_CONTRACT, c as ITangleJobsAbi, d as SandboxCreateResponseParamTypes, f as SandboxIdParamTypes, i as TANGLE_CHAIN_ID, l as JsonResponseParamTypes, n as JOB_SANDBOX_CREATE, o as TangleSandboxClientConfig, r as JOB_SANDBOX_DELETE, s as AgentSandboxBlueprintAbi, t as TangleSandboxClient, u as SandboxCreateParamTypes } from "../index-7j5JIro1.js";
1
+ import { a as TANGLE_JOBS_CONTRACT, c as ITangleJobsAbi, d as SandboxCreateResponseParamTypes, f as SandboxIdParamTypes, i as TANGLE_CHAIN_ID, l as JsonResponseParamTypes, n as JOB_SANDBOX_CREATE, o as TangleSandboxClientConfig, r as JOB_SANDBOX_DELETE, s as AgentSandboxBlueprintAbi, t as TangleSandboxClient, u as SandboxCreateParamTypes } from "../index-D3q4u0kQ.js";
2
2
  export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient, TangleSandboxClientConfig };
@@ -1,2 +1,2 @@
1
- import { a as TANGLE_JOBS_CONTRACT, c as JsonResponseParamTypes, d as SandboxIdParamTypes, i as TANGLE_CHAIN_ID, l as SandboxCreateParamTypes, n as JOB_SANDBOX_CREATE, o as AgentSandboxBlueprintAbi, r as JOB_SANDBOX_DELETE, s as ITangleJobsAbi, t as TangleSandboxClient, u as SandboxCreateResponseParamTypes } from "../tangle-BWqu6gaT.js";
1
+ import { a as TANGLE_JOBS_CONTRACT, c as JsonResponseParamTypes, d as SandboxIdParamTypes, i as TANGLE_CHAIN_ID, l as SandboxCreateParamTypes, n as JOB_SANDBOX_CREATE, o as AgentSandboxBlueprintAbi, r as JOB_SANDBOX_DELETE, s as ITangleJobsAbi, t as TangleSandboxClient, u as SandboxCreateResponseParamTypes } from "../tangle-qQ5nzHZV.js";
2
2
  export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient };
@@ -1,5 +1,5 @@
1
1
  import { _ as parseErrorResponse } from "./errors-CmYPVl-k.js";
2
- import { n as createSandboxInstanceFromResponse } from "./sandbox-BotrtJlw.js";
2
+ import { n as createSandboxInstanceFromResponse } from "./sandbox-D9m16QdB.js";
3
3
  //#region src/tangle/abi.ts
4
4
  /**
5
5
  * Tangle Contract ABI Definitions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/sandbox",
3
- "version": "0.49.0",
3
+ "version": "0.51.0",
4
4
  "description": "Client SDK for the Tangle Sandbox platform - build AI agent applications with dev containers",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -138,10 +138,10 @@
138
138
  "ws": "^8.20.0",
139
139
  "yjs": "13.6.30",
140
140
  "@repo/shared": "0.0.0",
141
- "@tangle-network/agent-profile-materialize": "0.20.1",
142
- "@tangle-network/cli-agent-registry": "0.4.6",
143
- "@tangle-network/runtime-contracts": "0.7.0",
144
- "@tangle-network/sse-core": "0.0.0"
141
+ "@tangle-network/agent-profile-materialize": "0.20.2",
142
+ "@tangle-network/cli-agent-registry": "0.4.7",
143
+ "@tangle-network/sse-core": "0.0.0",
144
+ "@tangle-network/runtime-contracts": "0.7.1"
145
145
  },
146
146
  "scripts": {
147
147
  "build": "node scripts/build-dist.mjs",