@tangle-network/agent-app 0.63.29 → 0.63.30
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/chat-routes/default-backend.d.ts +19 -2
- package/dist/chat-routes/hybrid-producer.d.ts +7 -2
- package/dist/chat-routes/index.js +3 -3
- package/dist/chat-routes/route-storage.d.ts +1 -1
- package/dist/chat-routes/router-producer.d.ts +2 -1
- package/dist/chat-routes/turn-route-contracts.d.ts +1 -1
- package/dist/{chunk-56JUV4DK.js → chunk-5AUZR655.js} +3335 -3020
- package/dist/chunk-5AUZR655.js.map +1 -0
- package/dist/{chunk-QUT3T2IN.js → chunk-L3QR274L.js} +11 -3
- package/dist/chunk-L3QR274L.js.map +1 -0
- package/dist/{chunk-DCJCZ7EP.js → chunk-QLZ6A73E.js} +37 -19
- package/dist/chunk-QLZ6A73E.js.map +1 -0
- package/dist/model-resolution/index.js +1 -1
- package/dist/public-consultation/index.js +3 -3
- package/dist/sandbox/computer-files.d.ts +67 -0
- package/dist/sandbox/computer-receipts.d.ts +46 -0
- package/dist/sandbox/computer-step.d.ts +78 -0
- package/dist/sandbox/index.d.ts +4 -0
- package/dist/sandbox/index.js +23 -1
- package/dist/sandbox/router-models.d.ts +26 -0
- package/dist/sandbox/sandbox-run-tool.d.ts +5 -4
- package/package.json +1 -1
- package/dist/chunk-56JUV4DK.js.map +0 -1
- package/dist/chunk-DCJCZ7EP.js.map +0 -1
- package/dist/chunk-QUT3T2IN.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createChatTurnRoutes,
|
|
3
3
|
streamChatRouteAsSandboxEvents
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-QLZ6A73E.js";
|
|
5
5
|
import "../chunk-CWO2LHXH.js";
|
|
6
6
|
import "../chunk-DPTNKH22.js";
|
|
7
7
|
import "../chunk-4DBHC63F.js";
|
|
8
8
|
import "../chunk-RN4WPTBH.js";
|
|
9
9
|
import "../chunk-MM6RLOXF.js";
|
|
10
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-5AUZR655.js";
|
|
11
11
|
import "../chunk-F4TUZYMX.js";
|
|
12
12
|
import "../chunk-MH74DY2I.js";
|
|
13
13
|
import "../chunk-6LMM3OVX.js";
|
|
@@ -22,7 +22,7 @@ import "../chunk-ALIWB2P3.js";
|
|
|
22
22
|
import "../chunk-N5RWYR5N.js";
|
|
23
23
|
import "../chunk-3Q3UEWKK.js";
|
|
24
24
|
import "../chunk-QGJOT6R6.js";
|
|
25
|
-
import "../chunk-
|
|
25
|
+
import "../chunk-L3QR274L.js";
|
|
26
26
|
import "../chunk-XELWWXJJ.js";
|
|
27
27
|
import "../chunk-DSMGS4IV.js";
|
|
28
28
|
import "../chunk-ACB7KOQ6.js";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The files a computer step leaves in the workspace, and what the model may
|
|
3
|
+
* truthfully tell the member about them.
|
|
4
|
+
*
|
|
5
|
+
* A box keeps workspace files under one directory; the app's Vault is a
|
|
6
|
+
* different store, and a file the box agent saves proves nothing about it.
|
|
7
|
+
* So the step lists the box's tree before and after the run, saves each new or
|
|
8
|
+
* changed file through the app's `save`, and appends one receipt line to the
|
|
9
|
+
* answer. That line is the only statement about Vault contents the model may
|
|
10
|
+
* relay ({@link COMPUTER_FILES_GUIDANCE}). Legal learned this in production:
|
|
11
|
+
* a child saved a file outside the Vault and the model said it was saved (#547).
|
|
12
|
+
*/
|
|
13
|
+
import type { SandboxInstance } from '@tangle-network/sandbox';
|
|
14
|
+
/** One file the step wrote, at its path relative to the Vault root. */
|
|
15
|
+
export interface ComputerVaultFile {
|
|
16
|
+
path: string;
|
|
17
|
+
content: string;
|
|
18
|
+
size: number;
|
|
19
|
+
}
|
|
20
|
+
/** The app's Vault, as a computer step sees it. */
|
|
21
|
+
export interface ComputerVault {
|
|
22
|
+
/** Absolute directory on the box that holds the workspace's files. */
|
|
23
|
+
root: string;
|
|
24
|
+
/** Store one file the step wrote. A throw leaves it on the computer only, named in the receipt. */
|
|
25
|
+
save(file: ComputerVaultFile, step: {
|
|
26
|
+
executionId: string;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
/** Why the Vault cannot hold this file, or null when it can. Default: text kinds up to 512 KB. */
|
|
29
|
+
refuse?(path: string, size: number): string | null;
|
|
30
|
+
/** Most files one step saves. Default 20. */
|
|
31
|
+
maxFiles?: number;
|
|
32
|
+
}
|
|
33
|
+
/** Path relative to the root, mapped to the file's size and modification time. */
|
|
34
|
+
export type ComputerFileListing = {
|
|
35
|
+
succeeded: true;
|
|
36
|
+
files: Record<string, {
|
|
37
|
+
size: number;
|
|
38
|
+
mtime: number;
|
|
39
|
+
}>;
|
|
40
|
+
} | {
|
|
41
|
+
succeeded: false;
|
|
42
|
+
error: string;
|
|
43
|
+
};
|
|
44
|
+
/** What one step saved, and what it left on the computer only (with the reason). */
|
|
45
|
+
export interface ComputerFileReceipt {
|
|
46
|
+
checked: boolean;
|
|
47
|
+
saved: string[];
|
|
48
|
+
computerOnly: Array<{
|
|
49
|
+
path: string;
|
|
50
|
+
reason: string;
|
|
51
|
+
}>;
|
|
52
|
+
/** The receipt line appended to the step's answer. */
|
|
53
|
+
text: string;
|
|
54
|
+
}
|
|
55
|
+
/** Appended to the Router model's prompt whenever a computer step copies files into the Vault. */
|
|
56
|
+
export declare const COMPUTER_FILES_GUIDANCE: string;
|
|
57
|
+
/** Appended to the task the box agent receives, so a member's relative path lands under the Vault root. */
|
|
58
|
+
export declare function computerFileContract(root: string, task: string): string;
|
|
59
|
+
/** The box's tree under `root`. A tree the box cannot list completely is a failure, never a partial listing. */
|
|
60
|
+
export declare function listComputerFiles(box: SandboxInstance, root: string): Promise<ComputerFileListing>;
|
|
61
|
+
/** Save what the step wrote since `before` into the Vault and return its receipt. */
|
|
62
|
+
export declare function saveComputerFiles(input: {
|
|
63
|
+
box: SandboxInstance;
|
|
64
|
+
vault: ComputerVault;
|
|
65
|
+
before: ComputerFileListing;
|
|
66
|
+
executionId: string;
|
|
67
|
+
}): Promise<ComputerFileReceipt>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Computer-step receipts: the durable record of one `sandbox_run` call, keyed
|
|
3
|
+
* by its step id (the turn's execution, the session and the tool call).
|
|
4
|
+
*
|
|
5
|
+
* `prepared` is written before the task is sent and holds the Vault listing
|
|
6
|
+
* taken then, so a repeated call after a lost request still copies the files
|
|
7
|
+
* the first send wrote. `settled` holds the answer the model read, the model
|
|
8
|
+
* that ran and the file receipt; a repeated call returns it and sends nothing.
|
|
9
|
+
* A receipt holds no credential.
|
|
10
|
+
*/
|
|
11
|
+
import type { ComputerFileListing, ComputerFileReceipt } from './computer-files';
|
|
12
|
+
export interface ComputerStepReceipt {
|
|
13
|
+
stepId: string;
|
|
14
|
+
state: 'prepared' | 'settled';
|
|
15
|
+
sessionId: string;
|
|
16
|
+
model?: string;
|
|
17
|
+
/** The Vault listing before the first send, while `prepared`. */
|
|
18
|
+
before?: ComputerFileListing;
|
|
19
|
+
/** The answer the model read, file receipt line included, once `settled`. */
|
|
20
|
+
answer?: string;
|
|
21
|
+
files?: ComputerFileReceipt;
|
|
22
|
+
updatedAt: number;
|
|
23
|
+
}
|
|
24
|
+
export interface ComputerStepReceipts {
|
|
25
|
+
read(stepId: string): Promise<ComputerStepReceipt | null>;
|
|
26
|
+
/** A `settled` receipt is final: a later `prepared` write for the same step never replaces it. */
|
|
27
|
+
write(receipt: ComputerStepReceipt): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
/** The D1 surface the store uses. A real `D1Database` satisfies it. */
|
|
30
|
+
export interface ComputerStepReceiptD1Like {
|
|
31
|
+
prepare(query: string): {
|
|
32
|
+
bind(...values: unknown[]): {
|
|
33
|
+
first<T = Record<string, unknown>>(): Promise<T | null>;
|
|
34
|
+
run(): Promise<unknown>;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export declare const DEFAULT_COMPUTER_STEP_RECEIPT_TABLE = "computer_step_receipts";
|
|
39
|
+
/** Paste into a product migration; the store never runs DDL. Times are epoch ms. */
|
|
40
|
+
export declare const COMPUTER_STEP_RECEIPT_TABLE_DDL = "CREATE TABLE IF NOT EXISTS computer_step_receipts (\n step_id TEXT PRIMARY KEY,\n state TEXT NOT NULL,\n receipt TEXT NOT NULL,\n updated_at INTEGER NOT NULL\n);\nCREATE INDEX IF NOT EXISTS computer_step_receipts_by_age ON computer_step_receipts (updated_at)";
|
|
41
|
+
/** Receipts in one D1 table, shared by every isolate. Rows older than `retentionMs` (default 30 days) are pruned. */
|
|
42
|
+
export declare function createD1ComputerStepReceipts(db: ComputerStepReceiptD1Like, options?: {
|
|
43
|
+
table?: string;
|
|
44
|
+
retentionMs?: number;
|
|
45
|
+
now?: () => number;
|
|
46
|
+
}): ComputerStepReceipts;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `createComputerStep`: what one `sandbox_run` call does on the workspace box,
|
|
3
|
+
* owned once for every app. GTM, Creative and Legal each wrote this step, and
|
|
4
|
+
* each break on 2026-10-24 was in one of those copies (agent-app-lessons.md,
|
|
5
|
+
* "Computer steps"). The step:
|
|
6
|
+
*
|
|
7
|
+
* - runs the first of the turn's models the box key allows: the box calls the
|
|
8
|
+
* Router on its own key, whose models are the payer's sandbox policy
|
|
9
|
+
* (`readSandboxRouterModels`), so a model outside it is refused before a token;
|
|
10
|
+
* a run that ends refused for its model (`provider_disabled`, quota) moves to the
|
|
11
|
+
* next allowed one under its own execution id;
|
|
12
|
+
* - takes its session as one value, `{ id, isolated }`, which sets both
|
|
13
|
+
* `secretProfileIsolation` and the send witness;
|
|
14
|
+
* - sends under a step id derived from the turn, the session and the tool call,
|
|
15
|
+
* so a repeated call attaches to its run instead of sending a second one;
|
|
16
|
+
* - keeps a durable receipt (`receipts`): a repeated call returns it and sends nothing;
|
|
17
|
+
* - copies what the box agent wrote under the Vault root into the app's Vault
|
|
18
|
+
* (`files`) and appends the receipt line the model may relay.
|
|
19
|
+
*
|
|
20
|
+
* The product keeps the prompt path when it has its own (`run`); otherwise the
|
|
21
|
+
* step uses agent-app's `runSandboxPrompt` over the product's shell.
|
|
22
|
+
*/
|
|
23
|
+
import type { SandboxInstance } from '@tangle-network/sandbox';
|
|
24
|
+
import type { SandboxRuntimeConfig } from './configuration';
|
|
25
|
+
import type { StreamSandboxPromptOptions } from './prompt-options';
|
|
26
|
+
import { type ComputerVault } from './computer-files';
|
|
27
|
+
import type { ComputerStepReceipts } from './computer-receipts';
|
|
28
|
+
import type { Outcome } from './outcome';
|
|
29
|
+
import type { SandboxRunToolOptions, SandboxTaskOptions } from './sandbox-run-tool';
|
|
30
|
+
/** The box session one computer step runs in. */
|
|
31
|
+
export interface ComputerStepSession {
|
|
32
|
+
id: string;
|
|
33
|
+
/** A secret-isolated native session the product prepared before the send. */
|
|
34
|
+
isolated?: boolean;
|
|
35
|
+
}
|
|
36
|
+
/** What a product's own prompt path receives for one step. */
|
|
37
|
+
export interface ComputerStepRun extends SandboxTaskOptions {
|
|
38
|
+
/** Stable for the turn, the session and the tool call: send under it as both execution and turn id. */
|
|
39
|
+
executionId?: string;
|
|
40
|
+
session?: ComputerStepSession;
|
|
41
|
+
/** Set only when the box key's policy constrains the turn's models; otherwise run the product's model. */
|
|
42
|
+
model?: string;
|
|
43
|
+
/** The send witness: pass it as the prompt's `onDispatch`, or call it exactly at the send. */
|
|
44
|
+
onDispatch(): void;
|
|
45
|
+
}
|
|
46
|
+
export interface ComputerStepOptions {
|
|
47
|
+
/** agent-app's prompt path over the product's shell. */
|
|
48
|
+
shell?: SandboxRuntimeConfig;
|
|
49
|
+
/** That path's options, other than the ones the step owns. `onDispatch` here observes the step's own witness. */
|
|
50
|
+
prompt?: Omit<StreamSandboxPromptOptions, 'sessionId' | 'executionId' | 'turnId' | 'secretProfileIsolation' | 'signal' | 'timeoutMs' | 'trace' | 'traceParent' | 'disallowQuestions' | 'history'>;
|
|
51
|
+
/** The product's own prompt path, instead of `shell`. Returns the box agent's final answer. */
|
|
52
|
+
run?(box: SandboxInstance, task: string, step: ComputerStepRun): Promise<string>;
|
|
53
|
+
/** `run` passes `step.onDispatch` to a send that calls it (agent-app's `streamSandboxPrompt`, `runSandboxPrompt`
|
|
54
|
+
* and `driveSandboxTurn` do), so a failure before it fired was never sent. Without it, every `run` failure is
|
|
55
|
+
* unconfirmed. The `shell` path always witnesses. */
|
|
56
|
+
runWitnessesDispatch?: boolean;
|
|
57
|
+
/** The turn's execution id; with the tool call id it makes the step id. Without it each call sends fresh. */
|
|
58
|
+
parentExecutionId?: string;
|
|
59
|
+
/** The session: one value, or prepared per box (a secret-isolated session). A failure there is never sent. */
|
|
60
|
+
session?: ComputerStepSession | ((box: SandboxInstance, signal: AbortSignal) => Promise<ComputerStepSession>);
|
|
61
|
+
/** The turn's models in preference order and the box key's allow-list (`readSandboxRouterModels`). */
|
|
62
|
+
models?: {
|
|
63
|
+
preferred: readonly string[];
|
|
64
|
+
allowed(signal: AbortSignal): Promise<Outcome<readonly string[] | null>>;
|
|
65
|
+
};
|
|
66
|
+
/** Copy each file the step wrote under the Vault root into the product's Vault. */
|
|
67
|
+
files?: ComputerVault;
|
|
68
|
+
/** The product's filesystem contract, applied to every task. */
|
|
69
|
+
frame?(task: string): string;
|
|
70
|
+
/** Durable step receipts (`createD1ComputerStepReceipts`). */
|
|
71
|
+
receipts?: ComputerStepReceipts;
|
|
72
|
+
}
|
|
73
|
+
export interface ComputerStep {
|
|
74
|
+
runTask: SandboxRunToolOptions['runTask'];
|
|
75
|
+
/** What the Router model must be told about this step's answers. */
|
|
76
|
+
guidance?: string;
|
|
77
|
+
}
|
|
78
|
+
export declare function createComputerStep(options: ComputerStepOptions): ComputerStep;
|
package/dist/sandbox/index.d.ts
CHANGED
|
@@ -14,6 +14,10 @@ export * from './workspace-sandbox-manager';
|
|
|
14
14
|
export * from './terminal-connection';
|
|
15
15
|
export * from './prewarm';
|
|
16
16
|
export * from './sandbox-run-tool';
|
|
17
|
+
export * from './computer-step';
|
|
18
|
+
export * from './computer-files';
|
|
19
|
+
export * from './computer-receipts';
|
|
20
|
+
export * from './router-models';
|
|
17
21
|
export * from './sandbox-exec-tool';
|
|
18
22
|
export * from './prewarm-claim-d1';
|
|
19
23
|
export * from './prewarm-route';
|
package/dist/sandbox/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
COMPUTER_FILES_GUIDANCE,
|
|
3
|
+
COMPUTER_STEP_RECEIPT_TABLE_DDL,
|
|
4
|
+
DEFAULT_COMPUTER_STEP_RECEIPT_TABLE,
|
|
2
5
|
DEFAULT_ESCALATION_TOOLS,
|
|
3
6
|
DEFAULT_FOREGROUND_PROVISION_CLAIM_TTL_SECONDS,
|
|
4
7
|
DEFAULT_FOREGROUND_PROVISION_POLL_INTERVAL_MS,
|
|
@@ -43,7 +46,10 @@ import {
|
|
|
43
46
|
buildSandboxToolPathSetupScript,
|
|
44
47
|
classifySeveredStream,
|
|
45
48
|
collectSandboxPromptText,
|
|
49
|
+
computerFileContract,
|
|
46
50
|
createCacheReuseStore,
|
|
51
|
+
createComputerStep,
|
|
52
|
+
createD1ComputerStepReceipts,
|
|
47
53
|
createD1PrewarmClaimStore,
|
|
48
54
|
createD1WarmLeaseStore,
|
|
49
55
|
createD1WarmReceiptStore,
|
|
@@ -69,11 +75,14 @@ import {
|
|
|
69
75
|
getClient,
|
|
70
76
|
isAutomatedPrewarmRequest,
|
|
71
77
|
isTerminalPromptEvent,
|
|
78
|
+
listComputerFiles,
|
|
72
79
|
mergeExtraMcp,
|
|
73
80
|
mergeHistoryIntoParts,
|
|
74
81
|
mintSandboxScopedToken,
|
|
82
|
+
modelWithinAllowList,
|
|
75
83
|
peekWorkspaceSandbox,
|
|
76
84
|
predictColdArrival,
|
|
85
|
+
readSandboxRouterModels,
|
|
77
86
|
requireTransportableModel,
|
|
78
87
|
resetClientCache,
|
|
79
88
|
resolveModel,
|
|
@@ -91,6 +100,7 @@ import {
|
|
|
91
100
|
sandboxToolBinDir,
|
|
92
101
|
sandboxToolPath,
|
|
93
102
|
sandboxToolRootDir,
|
|
103
|
+
saveComputerFiles,
|
|
94
104
|
secretStoreFromClient,
|
|
95
105
|
storeSecret,
|
|
96
106
|
streamSandboxPrompt,
|
|
@@ -103,7 +113,7 @@ import {
|
|
|
103
113
|
warmKey,
|
|
104
114
|
warmReceiptId,
|
|
105
115
|
warmWeekdayOf
|
|
106
|
-
} from "../chunk-
|
|
116
|
+
} from "../chunk-5AUZR655.js";
|
|
107
117
|
import {
|
|
108
118
|
createWarmCache
|
|
109
119
|
} from "../chunk-F4TUZYMX.js";
|
|
@@ -152,6 +162,8 @@ import "../chunk-ALIWB2P3.js";
|
|
|
152
162
|
import "../chunk-N5RWYR5N.js";
|
|
153
163
|
import "../chunk-3Q3UEWKK.js";
|
|
154
164
|
import "../chunk-QGJOT6R6.js";
|
|
165
|
+
import "../chunk-L3QR274L.js";
|
|
166
|
+
import "../chunk-XELWWXJJ.js";
|
|
155
167
|
import "../chunk-DSMGS4IV.js";
|
|
156
168
|
import "../chunk-ACB7KOQ6.js";
|
|
157
169
|
import "../chunk-6A7MYOUI.js";
|
|
@@ -174,6 +186,9 @@ import "../chunk-ELX5YITO.js";
|
|
|
174
186
|
import "../chunk-HY57QRRW.js";
|
|
175
187
|
import "../chunk-TXD5HXLE.js";
|
|
176
188
|
export {
|
|
189
|
+
COMPUTER_FILES_GUIDANCE,
|
|
190
|
+
COMPUTER_STEP_RECEIPT_TABLE_DDL,
|
|
191
|
+
DEFAULT_COMPUTER_STEP_RECEIPT_TABLE,
|
|
177
192
|
DEFAULT_ESCALATION_TOOLS,
|
|
178
193
|
DEFAULT_FOREGROUND_PROVISION_CLAIM_TTL_SECONDS,
|
|
179
194
|
DEFAULT_FOREGROUND_PROVISION_POLL_INTERVAL_MS,
|
|
@@ -232,7 +247,10 @@ export {
|
|
|
232
247
|
classifySandboxTransientFailure,
|
|
233
248
|
classifySeveredStream,
|
|
234
249
|
collectSandboxPromptText,
|
|
250
|
+
computerFileContract,
|
|
235
251
|
createCacheReuseStore,
|
|
252
|
+
createComputerStep,
|
|
253
|
+
createD1ComputerStepReceipts,
|
|
236
254
|
createD1PrewarmClaimStore,
|
|
237
255
|
createD1WarmLeaseStore,
|
|
238
256
|
createD1WarmReceiptStore,
|
|
@@ -272,15 +290,18 @@ export {
|
|
|
272
290
|
isWorkspaceSandboxRecoveryCode,
|
|
273
291
|
isWorkspaceSandboxRecoveryState,
|
|
274
292
|
isWorkspaceSandboxSnapshotRestoreError,
|
|
293
|
+
listComputerFiles,
|
|
275
294
|
mergeExtraMcp,
|
|
276
295
|
mergeHistoryIntoParts,
|
|
277
296
|
mintSandboxScopedToken,
|
|
297
|
+
modelWithinAllowList,
|
|
278
298
|
peekWorkspaceSandbox,
|
|
279
299
|
plannedHostRestart,
|
|
280
300
|
predictColdArrival,
|
|
281
301
|
preferredWorkspaceSandboxRecoveryBoxKey,
|
|
282
302
|
readDuringPlannedHostRestart,
|
|
283
303
|
readSandboxBinaryBytes,
|
|
304
|
+
readSandboxRouterModels,
|
|
284
305
|
requireTransportableModel,
|
|
285
306
|
resetClientCache,
|
|
286
307
|
resolveModel,
|
|
@@ -300,6 +321,7 @@ export {
|
|
|
300
321
|
sandboxToolPath,
|
|
301
322
|
sandboxToolRootDir,
|
|
302
323
|
sandboxTransientBackoffMs,
|
|
324
|
+
saveComputerFiles,
|
|
303
325
|
secretStoreFromClient,
|
|
304
326
|
serializeSandboxProvisioningError,
|
|
305
327
|
shellQuote,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The models a workspace box may call. Platform mints every box's Router key
|
|
3
|
+
* (`auto:sandbox:router:<box>`) under the payer's sandbox policy, and the
|
|
4
|
+
* Sandbox API sends that key with every run in place of any per-turn key. A
|
|
5
|
+
* paying customer's policy names no models (`null`); a company account's
|
|
6
|
+
* (operator, smoke, acceptance, staff) names only its flat-plan models, so a
|
|
7
|
+
* box asked for any other model is refused before it writes a token.
|
|
8
|
+
* `GET /v1/keys/sandbox-router-models` reports that policy for the calling key
|
|
9
|
+
* without returning key material.
|
|
10
|
+
*
|
|
11
|
+
* Creative #739, Legal #546 and GTM each kept a copy of this read; a computer
|
|
12
|
+
* step asked for a model its box key refuses failed every call.
|
|
13
|
+
*/
|
|
14
|
+
import { type Outcome } from './outcome';
|
|
15
|
+
export interface ReadSandboxRouterModelsOptions {
|
|
16
|
+
/** Platform's origin (`TANGLE_PLATFORM_URL`); any path on it is ignored. */
|
|
17
|
+
platformUrl: string;
|
|
18
|
+
/** A key of the payer whose sandbox policy applies: the member's linked key, or the owner's sandbox key. */
|
|
19
|
+
apiKey: string;
|
|
20
|
+
signal?: AbortSignal;
|
|
21
|
+
fetch?: typeof fetch;
|
|
22
|
+
}
|
|
23
|
+
/** Platform's model policy for a box minted under the payer of `apiKey`: the allowed models, or `null` for any. */
|
|
24
|
+
export declare function readSandboxRouterModels(options: ReadSandboxRouterModelsOptions): Promise<Outcome<string[] | null>>;
|
|
25
|
+
/** The first preferred model the policy allows, else the policy's own first model; `null` allows the first preference. */
|
|
26
|
+
export declare function modelWithinAllowList(preferred: readonly string[], allowedModels: readonly string[] | null): string | undefined;
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import type { SandboxInstance } from '@tangle-network/sandbox';
|
|
22
22
|
import type { TurnSpan, TurnTrace } from '../turn-trace/recorder';
|
|
23
|
-
import {
|
|
23
|
+
import type { SandboxRuntimeConfig } from './configuration';
|
|
24
|
+
import type { StreamSandboxPromptOptions } from './prompt-options';
|
|
24
25
|
import { SandboxRunError } from './sandbox-run-error';
|
|
25
26
|
export { SandboxRunError, type SandboxRunFailureCode } from './sandbox-run-error';
|
|
26
27
|
/** The engine's per-call tool context (`RouterTurnToolContext`), kept structural so this module does not import the engine. */
|
|
@@ -91,9 +92,9 @@ export declare const SANDBOX_RUN_DESCRIPTION: string;
|
|
|
91
92
|
/** The redacted cause chain of a computer-step failure, one line, for a durable record: each cause's name, code,
|
|
92
93
|
* status and message, outermost first, credentials and signed URLs removed. */
|
|
93
94
|
export declare function sandboxRunFailureDetail(error: unknown): string;
|
|
94
|
-
/** The shell's unattended runner
|
|
95
|
-
*
|
|
96
|
-
* retry of that exact call stays idempotent. Without callId,
|
|
95
|
+
/** The shell's unattended runner: {@link createComputerStep} over the shell, with the session and isolation the
|
|
96
|
+
* prompt names. A supplied execution/turn id seeds the step id with the actual tool callId: different calls stay
|
|
97
|
+
* separate and a retry of that exact call stays idempotent. Without callId, each call sends fresh.
|
|
97
98
|
*
|
|
98
99
|
* Its failure follows the send witness, in a shared and an isolated session alike: a failure before the prompt
|
|
99
100
|
* was handed to the SDK is `sandbox_unavailable` (nothing runs on the box, so the turn may use it again); after
|
package/package.json
CHANGED