@tangle-network/agent-app 0.60.115 → 0.60.117

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.
Files changed (91) hide show
  1. package/dist/VaultPane-OWOPGPXP.js +7 -0
  2. package/dist/assistant/index.js +11 -11
  3. package/dist/chat-react/index.js +4 -4
  4. package/dist/chat-routes/index.js +13 -6
  5. package/dist/chat-routes/index.js.map +1 -1
  6. package/dist/chat-routes/wire.d.ts +3 -1
  7. package/dist/chat-store/index.js +2 -2
  8. package/dist/{chunk-Y4WLCFDZ.js → chunk-2FLSODOX.js} +6 -6
  9. package/dist/{chunk-6XE77PTT.js → chunk-2NHJNINW.js} +1 -1
  10. package/dist/chunk-2NHJNINW.js.map +1 -0
  11. package/dist/{chunk-56GPDCOJ.js → chunk-7DXRHQZO.js} +7 -7
  12. package/dist/chunk-BTEVD7HG.js +198 -0
  13. package/dist/chunk-BTEVD7HG.js.map +1 -0
  14. package/dist/{chunk-RQSYR4AV.js → chunk-CLB4IQEG.js} +5 -5
  15. package/dist/{chunk-F2FH354I.js → chunk-D52LB6UQ.js} +2 -2
  16. package/dist/chunk-FVI2MHUL.js +1152 -0
  17. package/dist/chunk-FVI2MHUL.js.map +1 -0
  18. package/dist/{chunk-4G7HH6WQ.js → chunk-GU7OZFU7.js} +2 -2
  19. package/dist/{chunk-OGDEUCNW.js → chunk-JGLK5RDK.js} +176 -1
  20. package/dist/chunk-JGLK5RDK.js.map +1 -0
  21. package/dist/{chunk-FJQUMIM6.js → chunk-JZUSVGRJ.js} +3 -3
  22. package/dist/{chunk-AB63T2LM.js → chunk-KBJZMR4E.js} +8 -1
  23. package/dist/chunk-KBJZMR4E.js.map +1 -0
  24. package/dist/{chunk-JCSHTJT6.js → chunk-MGON3FE6.js} +22 -3
  25. package/dist/chunk-MGON3FE6.js.map +1 -0
  26. package/dist/{chunk-RQSNTJTW.js → chunk-MO7PDQRZ.js} +526 -187
  27. package/dist/chunk-MO7PDQRZ.js.map +1 -0
  28. package/dist/{chunk-MEUNTJL5.js → chunk-N3CYCSKK.js} +6 -1
  29. package/dist/chunk-N3CYCSKK.js.map +1 -0
  30. package/dist/journeys/cli.d.ts +2 -0
  31. package/dist/journeys/cli.js +165 -0
  32. package/dist/journeys/cli.js.map +1 -0
  33. package/dist/journeys/config.d.ts +96 -0
  34. package/dist/journeys/index.d.ts +18 -0
  35. package/dist/journeys/index.js +731 -0
  36. package/dist/journeys/index.js.map +1 -0
  37. package/dist/journeys/journey.d.ts +173 -0
  38. package/dist/journeys/page-reading.d.ts +42 -0
  39. package/dist/journeys/report.d.ts +51 -0
  40. package/dist/journeys/score.d.ts +115 -0
  41. package/dist/journeys/scrub.d.ts +21 -0
  42. package/dist/journeys/send.d.ts +46 -0
  43. package/dist/journeys/session.d.ts +27 -0
  44. package/dist/journeys/trace-zip.d.ts +28 -0
  45. package/dist/journeys/video.d.ts +53 -0
  46. package/dist/public-consultation/index.d.ts +2 -2
  47. package/dist/public-consultation/index.js +3 -3
  48. package/dist/runtime/index.js +1 -1
  49. package/dist/runtime/router-turn.d.ts +23 -2
  50. package/dist/runtime/router-turn.js +1 -1
  51. package/dist/sandbox/index.d.ts +2 -0
  52. package/dist/sandbox/index.js +13 -1
  53. package/dist/sandbox/sandbox-exec-tool.d.ts +68 -0
  54. package/dist/sandbox/sandbox-run-tool.d.ts +70 -0
  55. package/dist/studio-react/index.js +2 -2
  56. package/dist/teams/index.js +10 -6
  57. package/dist/teams/invitations-api.js +6 -3
  58. package/dist/teams/invitations-api.js.map +1 -1
  59. package/dist/teams/invitations.d.ts +4 -0
  60. package/dist/teams/members-api.js +2 -1
  61. package/dist/teams-react/components/InviteForm.d.ts +20 -0
  62. package/dist/teams-react/contracts.d.ts +2 -0
  63. package/dist/teams-react/index.js +196 -217
  64. package/dist/teams-react/index.js.map +1 -1
  65. package/dist/vault/VaultContentResults.d.ts +29 -0
  66. package/dist/vault/VaultHistoryPanel.d.ts +20 -0
  67. package/dist/vault/VaultPane.d.ts +3 -1
  68. package/dist/vault/contracts.d.ts +38 -0
  69. package/dist/vault/index.js +1 -1
  70. package/dist/vault/lazy.js +1 -1
  71. package/dist/web-react/index.js +25 -25
  72. package/dist/workspace-export/index.js +4 -193
  73. package/dist/workspace-export/index.js.map +1 -1
  74. package/dist/workspace-react/index.js +9 -7
  75. package/dist/workspace-react/index.js.map +1 -1
  76. package/dist/workspace-react/workspace-list.d.ts +7 -1
  77. package/package.json +8 -2
  78. package/dist/VaultPane-JUSNGOV7.js +0 -7
  79. package/dist/chunk-6XE77PTT.js.map +0 -1
  80. package/dist/chunk-AB63T2LM.js.map +0 -1
  81. package/dist/chunk-JCSHTJT6.js.map +0 -1
  82. package/dist/chunk-MEUNTJL5.js.map +0 -1
  83. package/dist/chunk-OGDEUCNW.js.map +0 -1
  84. package/dist/chunk-RQSNTJTW.js.map +0 -1
  85. /package/dist/{VaultPane-JUSNGOV7.js.map → VaultPane-OWOPGPXP.js.map} +0 -0
  86. /package/dist/{chunk-Y4WLCFDZ.js.map → chunk-2FLSODOX.js.map} +0 -0
  87. /package/dist/{chunk-56GPDCOJ.js.map → chunk-7DXRHQZO.js.map} +0 -0
  88. /package/dist/{chunk-RQSYR4AV.js.map → chunk-CLB4IQEG.js.map} +0 -0
  89. /package/dist/{chunk-F2FH354I.js.map → chunk-D52LB6UQ.js.map} +0 -0
  90. /package/dist/{chunk-4G7HH6WQ.js.map → chunk-GU7OZFU7.js.map} +0 -0
  91. /package/dist/{chunk-FJQUMIM6.js.map → chunk-JZUSVGRJ.js.map} +0 -0
@@ -0,0 +1,28 @@
1
+ interface ZipEntryInfo {
2
+ readonly name: string;
3
+ readonly method: number;
4
+ readonly crc32: number;
5
+ readonly compressedSize: number;
6
+ readonly uncompressedSize: number;
7
+ readonly localOffset: number;
8
+ readonly dosTime: number;
9
+ readonly dosDate: number;
10
+ }
11
+ /** Every entry in the central directory, sizes and offsets resolved through zip64 extras. */
12
+ export declare function readCentralDirectory(fd: number): ZipEntryInfo[];
13
+ /** One entry's stored bytes, still compressed. */
14
+ export declare function readRaw(fd: number, entry: ZipEntryInfo): Buffer;
15
+ /** One entry's content. */
16
+ export declare function inflateEntry(entry: ZipEntryInfo, raw: Buffer): Buffer;
17
+ interface ZipWriter {
18
+ /** Add an entry from its content (deflated here). */
19
+ add(name: string, content: Buffer, from?: Pick<ZipEntryInfo, 'dosTime' | 'dosDate'>): void;
20
+ /** Add an entry exactly as another archive stored it. */
21
+ copy(entry: ZipEntryInfo, raw: Buffer): void;
22
+ close(): void;
23
+ }
24
+ /** Write a zip to `path`, entries in the order added. `forceZip64` exercises the large-archive records in tests. */
25
+ export declare function createZipWriter(path: string, opts?: {
26
+ forceZip64?: boolean;
27
+ }): ZipWriter;
28
+ export {};
@@ -0,0 +1,53 @@
1
+ export interface Chapter {
2
+ /** Epoch ms. */
3
+ at: number;
4
+ caption: string;
5
+ /** Context label, or null for every context. */
6
+ label: string | null;
7
+ kind: 'step' | 'wait';
8
+ /** Epoch ms a wait ended. */
9
+ until?: number;
10
+ }
11
+ export interface Cue {
12
+ start: number;
13
+ end: number;
14
+ text: string;
15
+ }
16
+ export interface HighlightSegment {
17
+ /** Source range, seconds. */
18
+ a: number;
19
+ b: number;
20
+ /** Speed-up factor. */
21
+ k: number;
22
+ text: string;
23
+ }
24
+ export declare const MAX_HIGHLIGHTS_S = 178;
25
+ export declare function probeSeconds(file: string): number;
26
+ /** Chapters on the video's own clock; each caption holds until the next. */
27
+ export declare function chapterCues(chapters: readonly Chapter[], t0: number, duration: number): Cue[];
28
+ /**
29
+ * The highlights cut: which source ranges, at what speed, under which caption.
30
+ * A wait longer than 6 s plays in about 5 s; an idle stretch longer than 15 s
31
+ * plays in about 10 s; then everything scales to fit {@link MAX_HIGHLIGHTS_S}.
32
+ */
33
+ export declare function highlightPlan(chapters: readonly Chapter[], t0: number, duration: number): HighlightSegment[];
34
+ interface PostProcessInput {
35
+ webm: string;
36
+ /** Raw working folder on the host; keeps the webm and chapters for a rebuild. */
37
+ workDir: string;
38
+ videoDir: string;
39
+ label: string;
40
+ /** Epoch ms the recorded page was created. */
41
+ t0: number;
42
+ wallSeconds: number;
43
+ chapters: readonly Chapter[];
44
+ speedup2x: boolean;
45
+ }
46
+ export declare function postProcessVideo(o: PostProcessInput): string[];
47
+ /** Re-render from a raw folder after editing `<label>.chapters.json` by hand. */
48
+ export declare function rebuildVideo(rawLabelDir: string, videoDir: string, label: string, speedup2x: boolean): string[];
49
+ /** Seconds at which to grab frames: one per caption (1.5 s in), at most `max`, evenly spread. */
50
+ export declare function frameTimes(srt: string | null, times: readonly number[], max?: number): number[];
51
+ /** PNG frames of a video, named by label and timestamp, into `outDir`. */
52
+ export declare function extractFrames(video: string, srtFile: string | null, outDir: string, times: readonly number[], max?: number): string[];
53
+ export {};
@@ -102,8 +102,8 @@ interface GatewayConsultationContext {
102
102
  /** Compose gateway admission, scoped knowledge and the maintained persisted chat route. */
103
103
  export declare function createPublicConsultation(options: PublicConsultationOptions): {
104
104
  authorizeConsumer(agent: ConsultationAgent, consumer: ConsultationConsumer): Promise<{
105
- reason?: undefined;
106
105
  allow: true;
106
+ reason?: undefined;
107
107
  code?: undefined;
108
108
  } | {
109
109
  allow: false;
@@ -121,9 +121,9 @@ export declare function createPublicConsultation(options: PublicConsultationOpti
121
121
  executionBudget?: ChatTurnExecutionLimits;
122
122
  maxOutputTokens?: number;
123
123
  }) => Promise<{
124
+ start?: undefined;
124
125
  status: 'unsupported';
125
126
  reason: string;
126
- start?: undefined;
127
127
  } | {
128
128
  reason?: undefined;
129
129
  status: 'prepared';
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  createChatTurnRoutes,
3
3
  streamChatRouteAsSandboxEvents
4
- } from "../chunk-FJQUMIM6.js";
4
+ } from "../chunk-JZUSVGRJ.js";
5
5
  import "../chunk-Q7WEEN7P.js";
6
6
  import "../chunk-UTAIRVOK.js";
7
7
  import "../chunk-RN4WPTBH.js";
8
8
  import "../chunk-3NCPXNBZ.js";
9
- import "../chunk-4G7HH6WQ.js";
9
+ import "../chunk-GU7OZFU7.js";
10
10
  import "../chunk-ZVEEWGDK.js";
11
- import "../chunk-6XE77PTT.js";
11
+ import "../chunk-2NHJNINW.js";
12
12
  import "../chunk-TXD5HXLE.js";
13
13
  import "../chunk-Z4RD5UF7.js";
14
14
  import "../chunk-YG66IHDU.js";
@@ -13,7 +13,7 @@ import {
13
13
  toLoopEvents,
14
14
  turnKnowledgeInstructions,
15
15
  workspaceKnowledgeForTurn
16
- } from "../chunk-JCSHTJT6.js";
16
+ } from "../chunk-MGON3FE6.js";
17
17
  import {
18
18
  DEFAULT_TANGLE_BILLING_ENFORCEMENT_ENV_VAR,
19
19
  DEFAULT_TANGLE_ROUTER_BASE_URL,
@@ -23,7 +23,24 @@ export interface RouterTurnTool {
23
23
  description: string;
24
24
  /** JSON Schema for the arguments object. */
25
25
  inputSchema: Record<string, unknown>;
26
- run(args: Record<string, unknown>): Promise<unknown>;
26
+ run(args: Record<string, unknown>, context: RouterTurnToolContext): Promise<unknown>;
27
+ }
28
+ /** What a running tool gets besides its arguments. */
29
+ export interface RouterTurnToolContext {
30
+ /**
31
+ * Report a typed side event while the tool runs (a graph edit, a file written, a
32
+ * progress step). It streams at once as a `tool_event` and is recorded in the
33
+ * outcome's `toolEvents`. Events sent after the call settles are dropped.
34
+ */
35
+ emit(kind: string, data?: unknown): void;
36
+ }
37
+ /** One side event a tool reported while it ran. */
38
+ export interface RouterTurnToolEvent {
39
+ callId: string;
40
+ toolName: string;
41
+ kind: string;
42
+ data: unknown;
43
+ at: number;
27
44
  }
28
45
  /** What the turn is doing, in the order it happens, for a live view. */
29
46
  export type RouterTurnEvent = {
@@ -60,7 +77,9 @@ export type RouterTurnEvent = {
60
77
  type: 'usage';
61
78
  promptTokens: number;
62
79
  completionTokens: number;
63
- };
80
+ } | ({
81
+ type: 'tool_event';
82
+ } & RouterTurnToolEvent);
64
83
  export interface RouterTurnFailure {
65
84
  /** `model_http_<status>`, `model_unavailable`, `turn_<stopReason>` or `router_unconfigured`. */
66
85
  code: string;
@@ -83,6 +102,8 @@ export interface RouterTurnOutcome {
83
102
  completionTokens: number;
84
103
  modelCalls: number;
85
104
  };
105
+ /** Every side event the turn's tools reported, in order (at most 500). */
106
+ toolEvents: RouterTurnToolEvent[];
86
107
  failure?: RouterTurnFailure;
87
108
  }
88
109
  export interface RouterTurnOptions {
@@ -5,7 +5,7 @@ import {
5
5
  runRouterTurn,
6
6
  turnKnowledgeInstructions,
7
7
  workspaceKnowledgeForTurn
8
- } from "../chunk-JCSHTJT6.js";
8
+ } from "../chunk-MGON3FE6.js";
9
9
  import "../chunk-D6UJEOZQ.js";
10
10
  import "../chunk-7YA4QNTU.js";
11
11
  export {
@@ -874,6 +874,8 @@ export declare function detectInteractiveQuestion(event: unknown): string | null
874
874
  export * from './workspace-sandbox-manager';
875
875
  export * from './terminal-connection';
876
876
  export * from './prewarm';
877
+ export * from './sandbox-run-tool';
878
+ export * from './sandbox-exec-tool';
877
879
  export * from './prewarm-claim-d1';
878
880
  export * from './prewarm-route';
879
881
  export * from './foreground-single-flight';
@@ -12,11 +12,14 @@ import {
12
12
  PROVISION_PAYLOAD_MAX_BYTES,
13
13
  PYPI_EGRESS_DOMAINS,
14
14
  SANDBOX_DISPATCH_TRANSIENT_DEADLINE_MS,
15
+ SANDBOX_EXEC_DESCRIPTION,
16
+ SANDBOX_RUN_DESCRIPTION,
15
17
  SandboxEgressPolicyMismatchError,
16
18
  SandboxFilesystemNotReadyError,
17
19
  SandboxModelResolutionError,
18
20
  SandboxProvisioningFailedElsewhereError,
19
21
  SandboxRecoveryFailedError,
22
+ SandboxRunError,
20
23
  SandboxRuntimeAuthRefreshError,
21
24
  WARM_LEASE_DECLINED_UNTIL_DDL,
22
25
  WARM_LEASE_PENDING_DDL,
@@ -40,7 +43,9 @@ import {
40
43
  createD1PrewarmClaimStore,
41
44
  createD1WarmLeaseStore,
42
45
  createEscalationSpeculator,
46
+ createSandboxExecTool,
43
47
  createSandboxPrewarmer,
48
+ createSandboxRunTool,
44
49
  createSandboxTerminalConnectionRoute,
45
50
  createWarmLeases,
46
51
  createWorkspacePrewarmRoute,
@@ -74,6 +79,7 @@ import {
74
79
  runSandboxPrompt,
75
80
  runSandboxToolPathSetup,
76
81
  sandboxPrewarmClaimKey,
82
+ sandboxPromptRunner,
77
83
  sandboxToolBinDir,
78
84
  sandboxToolPath,
79
85
  sandboxToolRootDir,
@@ -90,7 +96,7 @@ import {
90
96
  warmBinOf,
91
97
  warmWeekdayOf,
92
98
  writeProfileFilesToBox
93
- } from "../chunk-OGDEUCNW.js";
99
+ } from "../chunk-JGLK5RDK.js";
94
100
  import {
95
101
  EGRESS_PROXY_RECOVERY_PHASE,
96
102
  EGRESS_PROXY_RECOVERY_REQUIRED,
@@ -156,12 +162,15 @@ export {
156
162
  PYPI_EGRESS_DOMAINS,
157
163
  SANDBOX_BACKING_CONTAINER_MISSING_CODE,
158
164
  SANDBOX_DISPATCH_TRANSIENT_DEADLINE_MS,
165
+ SANDBOX_EXEC_DESCRIPTION,
166
+ SANDBOX_RUN_DESCRIPTION,
159
167
  SANDBOX_TRANSIENT_DEADLINE_MS,
160
168
  SandboxEgressPolicyMismatchError,
161
169
  SandboxFilesystemNotReadyError,
162
170
  SandboxModelResolutionError,
163
171
  SandboxProvisioningFailedElsewhereError,
164
172
  SandboxRecoveryFailedError,
173
+ SandboxRunError,
165
174
  SandboxRuntimeAuthRefreshError,
166
175
  SandboxTransientDeadlineError,
167
176
  WARM_LEASE_DECLINED_UNTIL_DDL,
@@ -195,7 +204,9 @@ export {
195
204
  createD1PrewarmClaimStore,
196
205
  createD1WarmLeaseStore,
197
206
  createEscalationSpeculator,
207
+ createSandboxExecTool,
198
208
  createSandboxPrewarmer,
209
+ createSandboxRunTool,
199
210
  createSandboxTerminalConnectionRoute,
200
211
  createWarmLeases,
201
212
  createWorkspacePrewarmRoute,
@@ -244,6 +255,7 @@ export {
244
255
  runSandboxPrompt,
245
256
  runSandboxToolPathSetup,
246
257
  sandboxPrewarmClaimKey,
258
+ sandboxPromptRunner,
247
259
  sandboxToolBinDir,
248
260
  sandboxToolPath,
249
261
  sandboxToolRootDir,
@@ -0,0 +1,68 @@
1
+ /**
2
+ * `createSandboxExecTool`: the `sandbox_exec` tool a Router turn calls to run
3
+ * one command in the product's box — a toolkit script, a converter, a check —
4
+ * and read its exit code and output. Unlike `sandbox_run` it starts no box
5
+ * agent: the Router model stays in charge and the box only executes.
6
+ *
7
+ * WHY. Tax's Router default lost its Python form toolkit because the lane had
8
+ * no way to reach a box: 685 tool calls, 0 form fills (2026-10). A toolkit
9
+ * the product mounts in the box is reachable from the Router lane only
10
+ * through a command tool.
11
+ *
12
+ * NEVER SILENT. A box that cannot start or be prepared, and a command that
13
+ * cannot run or outruns its cap, come back as a typed `SandboxRunError`
14
+ * (`sandbox_unavailable`, `sandbox_failed`) the model must report. A command
15
+ * that runs and exits non-zero is a result, not a failure: the model reads
16
+ * its exit code and stderr and can correct itself.
17
+ *
18
+ * `prepare` runs once per tool, before the first command (install a runtime,
19
+ * copy the session's documents in). `allow` is the product's command policy.
20
+ */
21
+ import type { SandboxInstance } from '@tangle-network/sandbox';
22
+ import { SandboxRunError } from './sandbox-run-tool';
23
+ export interface SandboxExecToolOptions {
24
+ /** The box commands run in. The product provisions, binds and bills it. A throw is
25
+ * `sandbox_unavailable`, unless it is a `SandboxRunError`, which is kept as it is. */
26
+ box(signal: AbortSignal): Promise<SandboxInstance>;
27
+ /** Once per tool, before the first command: install a runtime, sync files in. */
28
+ prepare?(box: SandboxInstance, signal: AbortSignal): Promise<void>;
29
+ /** Default working directory. */
30
+ cwd?: string;
31
+ env?: Record<string, string>;
32
+ /** Cap for one command, box start and prepare included. Default 2 minutes. */
33
+ timeoutMs?: number;
34
+ /** Characters of stdout and of stderr returned to the model, each. Default 20 000 (the tail is kept). */
35
+ maxOutputChars?: number;
36
+ /** The product's command policy: a string refuses the command with that reason. */
37
+ allow?(command: string): string | null;
38
+ /** After each command, the files the product wants the model to know about (e.g. its output folder). */
39
+ listFiles?(box: SandboxInstance, signal: AbortSignal): Promise<string[]>;
40
+ signal?: AbortSignal;
41
+ /** The box's warm lease, so a call is recorded as a turn on it. */
42
+ warm?: {
43
+ leases: {
44
+ turn(key: string): Promise<unknown>;
45
+ };
46
+ key: string;
47
+ };
48
+ onFailure?(error: SandboxRunError): void;
49
+ name?: string;
50
+ description?: string;
51
+ }
52
+ export interface SandboxExecResult {
53
+ exitCode: number;
54
+ stdout: string;
55
+ stderr: string;
56
+ /** True when stdout or stderr was cut to `maxOutputChars`. */
57
+ truncated: boolean;
58
+ ms: number;
59
+ files?: string[];
60
+ }
61
+ export interface SandboxExecTool {
62
+ name: string;
63
+ description: string;
64
+ inputSchema: Record<string, unknown>;
65
+ run(args: Record<string, unknown>): Promise<SandboxExecResult>;
66
+ }
67
+ export declare const SANDBOX_EXEC_DESCRIPTION: string;
68
+ export declare function createSandboxExecTool(options: SandboxExecToolOptions): SandboxExecTool;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * `createSandboxRunTool`: the `sandbox_run` tool a Router turn calls when the
3
+ * work needs a computer — run code, read a PDF or a sheet, fill a form with a
4
+ * Python toolkit. The conversational turn stays on the Router engine
5
+ * (`./router-turn`); only this call enters the box, and its final answer comes
6
+ * back to the model as the tool result.
7
+ *
8
+ * NEVER SILENT. A box that cannot start, a run that fails and a run that ends
9
+ * with no answer each come back as a typed failure (`sandbox_unavailable`,
10
+ * `sandbox_failed`, `sandbox_empty`) that the model reads and must report. A
11
+ * product that leaves this tool out when it cannot place a box drops the
12
+ * capability without the model or the user knowing; mount the tool and let it
13
+ * fail instead.
14
+ *
15
+ * WARM LEASES. When the product passes `warm`, the call counts as a turn on the
16
+ * box's lease (`leases.turn(key)`), so an `escalation-likely` warm from
17
+ * `createEscalationSpeculator` is recorded as used. The default name is the
18
+ * one the speculator listens for (`DEFAULT_ESCALATION_TOOLS`).
19
+ */
20
+ import type { SandboxInstance } from '@tangle-network/sandbox';
21
+ import { type SandboxRuntimeConfig, type StreamSandboxPromptOptions } from './index';
22
+ export type SandboxRunFailureCode = 'sandbox_unavailable' | 'sandbox_failed' | 'sandbox_empty' | 'invalid_arguments';
23
+ /** A typed `sandbox_run` failure. `code` and `message` are what the model reads. */
24
+ export declare class SandboxRunError extends Error {
25
+ readonly code: SandboxRunFailureCode;
26
+ constructor(code: SandboxRunFailureCode, message: string, options?: {
27
+ cause?: unknown;
28
+ });
29
+ }
30
+ export interface SandboxRunToolOptions {
31
+ /** The box this call runs in. The product provisions, binds and bills it; this module never
32
+ * creates one. A throw is reported to the model as `sandbox_unavailable`, unless it is a
33
+ * `SandboxRunError`, whose own code and message are kept (an unpaid account, for example). */
34
+ box(signal: AbortSignal): Promise<SandboxInstance>;
35
+ /** Runs the task on the box and returns the box agent's final answer: {@link sandboxPromptRunner}
36
+ * for the shell's own prompt path, or the product's runner (skill placement, app-tool MCP, a spend tap). */
37
+ runTask(box: SandboxInstance, task: string, options: {
38
+ signal: AbortSignal;
39
+ timeoutMs: number;
40
+ }): Promise<string>;
41
+ /** Wall-clock cap for one call, box start included. Default 5 minutes. */
42
+ timeoutMs?: number;
43
+ /** Cancels a call in flight, for example the turn's own signal. */
44
+ signal?: AbortSignal;
45
+ /** The box's warm lease, so the call is recorded as a turn on it. */
46
+ warm?: {
47
+ leases: {
48
+ turn(key: string): Promise<unknown>;
49
+ };
50
+ key: string;
51
+ };
52
+ /** Every failure with its cause, for the product's logs. The model only reads the typed message. */
53
+ onFailure?(error: SandboxRunError): void;
54
+ name?: string;
55
+ description?: string;
56
+ }
57
+ /** The tool shape `runRouterTurn` takes (`RouterTurnTool`), kept structural so this module does not import the engine. */
58
+ export interface SandboxRunTool {
59
+ name: string;
60
+ description: string;
61
+ inputSchema: Record<string, unknown>;
62
+ run(args: Record<string, unknown>): Promise<{
63
+ answer: string;
64
+ ms: number;
65
+ }>;
66
+ }
67
+ export declare const SANDBOX_RUN_DESCRIPTION: string;
68
+ /** The default `runTask`: the shell's own `runSandboxPrompt`, unattended (questions refused). */
69
+ export declare function sandboxPromptRunner(shell: SandboxRuntimeConfig, prompt?: Omit<StreamSandboxPromptOptions, 'signal' | 'history'>): SandboxRunToolOptions['runTask'];
70
+ export declare function createSandboxRunTool(options: SandboxRunToolOptions): SandboxRunTool;
@@ -39,9 +39,8 @@ import {
39
39
  } from "../chunk-PT7H37YH.js";
40
40
  import {
41
41
  useInfiniteScroll
42
- } from "../chunk-Y4WLCFDZ.js";
42
+ } from "../chunk-2FLSODOX.js";
43
43
  import "../chunk-XEURJVS5.js";
44
- import "../chunk-SJWIZT7B.js";
45
44
  import {
46
45
  CheckGlyph,
47
46
  ChevronDown,
@@ -51,6 +50,7 @@ import {
51
50
  PopoverSurface,
52
51
  usePopover
53
52
  } from "../chunk-HG4OONJA.js";
53
+ import "../chunk-SJWIZT7B.js";
54
54
  import {
55
55
  ProviderLogo
56
56
  } from "../chunk-MLG6XKPV.js";
@@ -1,16 +1,18 @@
1
1
  import {
2
+ generateInviteToken,
3
+ isInviteTokenShape,
4
+ validateInviteToken
5
+ } from "../chunk-DJ4VJIH5.js";
6
+ import {
7
+ INVITATION_EMAIL_HINT,
2
8
  INVITATION_EXPIRY_DAYS,
3
9
  generateInvitationToken,
4
10
  getInvitationExpiresAt,
5
11
  inviteUrlForToken,
12
+ isInvitationEmail,
6
13
  normalizeInvitationEmail,
7
14
  parseInvitationPermission
8
- } from "../chunk-AB63T2LM.js";
9
- import {
10
- generateInviteToken,
11
- isInviteTokenShape,
12
- validateInviteToken
13
- } from "../chunk-DJ4VJIH5.js";
15
+ } from "../chunk-KBJZMR4E.js";
14
16
  import {
15
17
  ASSIGNABLE_WORKSPACE_ROLES,
16
18
  ORGANIZATION_ROLES,
@@ -28,6 +30,7 @@ import {
28
30
  } from "../chunk-6XIAPIW6.js";
29
31
  export {
30
32
  ASSIGNABLE_WORKSPACE_ROLES,
33
+ INVITATION_EMAIL_HINT,
31
34
  INVITATION_EXPIRY_DAYS,
32
35
  ORGANIZATION_ROLES,
33
36
  ORGANIZATION_ROLE_RANK,
@@ -41,6 +44,7 @@ export {
41
44
  hasWorkspaceRole,
42
45
  inviteUrlForToken,
43
46
  isAssignableWorkspaceRole,
47
+ isInvitationEmail,
44
48
  isInviteTokenShape,
45
49
  normalizeInvitationEmail,
46
50
  organizationRoleGrantsWorkspaceOwner,
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  SeatLimitError
3
- } from "../chunk-MEUNTJL5.js";
3
+ } from "../chunk-N3CYCSKK.js";
4
+ import "../chunk-DJ4VJIH5.js";
4
5
  import {
6
+ INVITATION_EMAIL_HINT,
5
7
  generateInvitationToken,
6
8
  getInvitationExpiresAt,
7
9
  inviteUrlForToken,
10
+ isInvitationEmail,
8
11
  normalizeInvitationEmail,
9
12
  parseInvitationPermission
10
- } from "../chunk-AB63T2LM.js";
11
- import "../chunk-DJ4VJIH5.js";
13
+ } from "../chunk-KBJZMR4E.js";
12
14
  import {
13
15
  hasWorkspaceRole
14
16
  } from "../chunk-6XIAPIW6.js";
@@ -40,6 +42,7 @@ function createInvitationsApi(opts) {
40
42
  }
41
43
  const email = normalizeInvitationEmail(input.email);
42
44
  if (!email) return { succeeded: false, status: 400, error: "Missing email" };
45
+ if (!isInvitationEmail(email)) return { succeeded: false, status: 400, error: INVITATION_EMAIL_HINT };
43
46
  const organizationId = accessRow.organization.id;
44
47
  const workspaceName = accessRow.workspace.name;
45
48
  await expirePendingInvitations(input.workspaceId, email, now);