scoped-execution-protocol 0.0.0-stage → 2.0.0-rc.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.
- package/LICENSE +21 -0
- package/dist/apps.d.ts +90 -0
- package/dist/apps.js +231 -0
- package/dist/bridges/a2a.d.ts +55 -0
- package/dist/bridges/a2a.js +360 -0
- package/dist/bridges/agui.d.ts +25 -0
- package/dist/bridges/agui.js +82 -0
- package/dist/bridges/host.d.ts +36 -0
- package/dist/bridges/host.js +93 -0
- package/dist/bridges/http.d.ts +12 -0
- package/dist/bridges/http.js +55 -0
- package/dist/bridges/index.d.ts +7 -0
- package/dist/bridges/index.js +7 -0
- package/dist/bridges/mcp-proxy.d.ts +39 -0
- package/dist/bridges/mcp-proxy.js +122 -0
- package/dist/bridges/mcp.d.ts +88 -0
- package/dist/bridges/mcp.js +571 -0
- package/dist/bridges/providers.d.ts +16 -0
- package/dist/bridges/providers.js +9 -0
- package/dist/canonical.d.ts +3 -0
- package/dist/canonical.js +46 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +10 -0
- package/dist/kernel.d.ts +416 -0
- package/dist/kernel.js +1927 -0
- package/dist/pending.d.ts +56 -0
- package/dist/pending.js +72 -0
- package/dist/policy.d.ts +20 -0
- package/dist/policy.js +100 -0
- package/dist/privacy.d.ts +52 -0
- package/dist/privacy.js +273 -0
- package/dist/state.d.ts +59 -0
- package/dist/state.js +125 -0
- package/dist/store.d.ts +59 -0
- package/dist/store.js +270 -0
- package/dist/transport.d.ts +108 -0
- package/dist/transport.js +358 -0
- package/dist/types.d.ts +167 -0
- package/dist/types.js +98 -0
- package/package.json +69 -6
- package/README.md +0 -3
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./canonical.js";
|
|
2
|
+
export * from "./types.js";
|
|
3
|
+
export * from "./privacy.js";
|
|
4
|
+
export { ResultProjection } from "./policy.js";
|
|
5
|
+
export * from "./store.js";
|
|
6
|
+
export * from "./apps.js";
|
|
7
|
+
export * from "./state.js";
|
|
8
|
+
export * from "./transport.js";
|
|
9
|
+
export * from "./kernel.js";
|
|
10
|
+
export { PendingCancelled } from "./pending.js";
|
package/dist/kernel.d.ts
ADDED
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
import { AppConnector, CredentialVault } from "./apps.js";
|
|
2
|
+
import { Reducer } from "./privacy.js";
|
|
3
|
+
import type { ToolContext } from "./pending.js";
|
|
4
|
+
import { ResultProjection } from "./policy.js";
|
|
5
|
+
import { HandleStore } from "./store.js";
|
|
6
|
+
import { ReplayGuard } from "./transport.js";
|
|
7
|
+
import { type BudgetLimit, type CapabilityToken, type Clearance, type CoreEnvelope, type DataPolicy, type EffectClass, type ElicitationRequest, type HardRail, type ProjectionMode, type RefHandle } from "./types.js";
|
|
8
|
+
/** What `AgentKernel.verifyAuditChainReport` found: the verdict, why, and what was and was not checked. */
|
|
9
|
+
export interface AuditChainReport {
|
|
10
|
+
ok: boolean;
|
|
11
|
+
/** `ok`, `ok_truncated`, or the failure (`malformed_entry`, `genesis_mismatch`, `chain_broken`, `hash_mismatch`, `malformed_anchor`, `anchor_mismatch`, `tail_truncated`, `entry_missing`, `anchor_before_window`). */
|
|
12
|
+
reason: string;
|
|
13
|
+
message: string;
|
|
14
|
+
entries: number;
|
|
15
|
+
first_seq: number | null;
|
|
16
|
+
last_seq: number | null;
|
|
17
|
+
/** The first retained entry is not the first ever logged: the log rolled over, or its head was cut. The log alone cannot say which. */
|
|
18
|
+
head_dropped: boolean;
|
|
19
|
+
anchors_checked: number;
|
|
20
|
+
/** Sequence numbers of anchors older than the oldest retained entry, which could not be checked. */
|
|
21
|
+
anchors_unverifiable: number[];
|
|
22
|
+
at_index?: number;
|
|
23
|
+
at_seq?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface AuditEntry {
|
|
26
|
+
seq: number;
|
|
27
|
+
ts_ms: number;
|
|
28
|
+
event: string;
|
|
29
|
+
branch: string;
|
|
30
|
+
target: string | null;
|
|
31
|
+
effect: string | null;
|
|
32
|
+
status: string;
|
|
33
|
+
ref_id: string | null;
|
|
34
|
+
details?: Record<string, unknown>;
|
|
35
|
+
prev_hash: string;
|
|
36
|
+
entry_hash: string;
|
|
37
|
+
}
|
|
38
|
+
export declare class CausalDAG {
|
|
39
|
+
private readonly maxNodes;
|
|
40
|
+
readonly branches: Map<string, string | null>;
|
|
41
|
+
readonly branchTaint: Map<string, boolean>;
|
|
42
|
+
private readonly children;
|
|
43
|
+
private readonly parents;
|
|
44
|
+
private seq;
|
|
45
|
+
constructor(maxNodes?: number);
|
|
46
|
+
descendants(node: string): Set<string>;
|
|
47
|
+
append(branch: string, _kind: string, _summary: string, opts?: {
|
|
48
|
+
tainted?: boolean;
|
|
49
|
+
extraParents?: string[];
|
|
50
|
+
}): string;
|
|
51
|
+
fork(fromBranch: string, newBranch: string, reason?: string): string;
|
|
52
|
+
merge(sourceBranch: string, targetBranch: string, summary?: string): string;
|
|
53
|
+
}
|
|
54
|
+
export declare function flattenToolName(targetName: string): string;
|
|
55
|
+
export declare function selectRelevantTargets<T extends {
|
|
56
|
+
name: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
}>(targets: T[], query?: string, maxTools?: number): T[];
|
|
59
|
+
export declare function attenuateCapability(parent: CapabilityToken, child: Partial<CapabilityToken>): CapabilityToken;
|
|
60
|
+
export declare class BudgetAccount {
|
|
61
|
+
private usedTokens;
|
|
62
|
+
private usedCostMicros;
|
|
63
|
+
private readonly startedAtMs;
|
|
64
|
+
readonly limit: BudgetLimit;
|
|
65
|
+
constructor(limit: BudgetLimit, startedAtMs?: number);
|
|
66
|
+
checkAndConsume(opts: {
|
|
67
|
+
tokens?: number;
|
|
68
|
+
costMicros?: number;
|
|
69
|
+
teardown?: boolean;
|
|
70
|
+
nowMs?: number;
|
|
71
|
+
}): void;
|
|
72
|
+
}
|
|
73
|
+
export interface TargetConfig {
|
|
74
|
+
name: string;
|
|
75
|
+
fn: (args: Record<string, unknown>, credential?: unknown, context?: ToolContext) => unknown | Promise<unknown>;
|
|
76
|
+
effect?: EffectClass;
|
|
77
|
+
/** Run in the background and return a pending `REF#N` at once. Read and idempotent tools only. */
|
|
78
|
+
longRunning?: boolean;
|
|
79
|
+
untrusted?: boolean;
|
|
80
|
+
externalEgress?: boolean;
|
|
81
|
+
description?: string;
|
|
82
|
+
inputSchema?: Record<string, unknown>;
|
|
83
|
+
appId?: string;
|
|
84
|
+
requiredScopes?: string[];
|
|
85
|
+
requiresHumanApproval?: boolean;
|
|
86
|
+
hiddenFromFlatPrefix?: boolean;
|
|
87
|
+
sinkClearance?: Clearance;
|
|
88
|
+
outputPolicy?: DataPolicy;
|
|
89
|
+
metadataPolicy?: DataPolicy;
|
|
90
|
+
undoFactory?: (args: Record<string, unknown>, result: unknown) => () => void;
|
|
91
|
+
stateSnapshot?: (args: Record<string, unknown>) => unknown;
|
|
92
|
+
resultProjection?: ResultProjection;
|
|
93
|
+
previewRequiresEffect?: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface CallResult {
|
|
96
|
+
preview: boolean;
|
|
97
|
+
pausedForHuman?: boolean;
|
|
98
|
+
pausedForElicitation?: boolean;
|
|
99
|
+
elicitation?: ElicitationRequest;
|
|
100
|
+
handle: RefHandle | null;
|
|
101
|
+
confirmToken?: string;
|
|
102
|
+
compensateHandle?: string;
|
|
103
|
+
idempotentReplay?: boolean;
|
|
104
|
+
/** The handle was issued before its result exists. Inspect it for status. */
|
|
105
|
+
pending?: boolean;
|
|
106
|
+
}
|
|
107
|
+
export declare class AgentKernel {
|
|
108
|
+
readonly agentId: string;
|
|
109
|
+
readonly store: HandleStore;
|
|
110
|
+
readonly budget: BudgetAccount;
|
|
111
|
+
readonly rails: HardRail[];
|
|
112
|
+
readonly vault: CredentialVault;
|
|
113
|
+
private modelSubstrateClearance;
|
|
114
|
+
substrate: string;
|
|
115
|
+
readonly mode: ProjectionMode;
|
|
116
|
+
readonly inlineMaxBytes: number;
|
|
117
|
+
readonly includeOrientation: boolean;
|
|
118
|
+
readonly autoCommitWithinRails: boolean;
|
|
119
|
+
readonly autoPreviewOnGate: boolean;
|
|
120
|
+
readonly enableBranching: boolean;
|
|
121
|
+
/** Advisory cache lifetime for catalog views (`inspect` catalog and the MCP list methods); undefined means no hint. */
|
|
122
|
+
readonly catalogTtlMs: number | undefined;
|
|
123
|
+
private readonly schemaBudgetBytes;
|
|
124
|
+
private readonly catalogBudgetChars;
|
|
125
|
+
private readonly previewBudgetChars;
|
|
126
|
+
readonly supportedProfiles: string[];
|
|
127
|
+
readonly dag: CausalDAG;
|
|
128
|
+
readonly prompts: Map<string, {
|
|
129
|
+
name: string;
|
|
130
|
+
template: string;
|
|
131
|
+
description: string;
|
|
132
|
+
arguments: Array<Record<string, unknown>>;
|
|
133
|
+
}>;
|
|
134
|
+
activeBranch: string;
|
|
135
|
+
onEvent?: (entry: AuditEntry) => void;
|
|
136
|
+
/** Receives `(rootHash, seq)` every `checkpointEvery` audit entries, for a host to sign or ship to an append-only sink. */
|
|
137
|
+
onCheckpoint?: (rootHash: string, seq: number) => void;
|
|
138
|
+
private readonly checkpointEvery;
|
|
139
|
+
/** Automatic checkpoints that the sink refused. A sink that keeps failing is a chain nobody is anchoring: alarm on this. */
|
|
140
|
+
auditCheckpointFailures: number;
|
|
141
|
+
private readonly budgetPerInboundCall;
|
|
142
|
+
private readonly requestBudgets;
|
|
143
|
+
private readonly maxAuditEntries;
|
|
144
|
+
private readonly preTaintCaps;
|
|
145
|
+
private readonly branchCapabilities;
|
|
146
|
+
private readonly branchPolicies;
|
|
147
|
+
readonly targets: Map<string, TargetConfig>;
|
|
148
|
+
private flatToTarget;
|
|
149
|
+
readonly apps: Map<string, AppConnector>;
|
|
150
|
+
readonly appCatalogs: Map<string, RefHandle>;
|
|
151
|
+
readonly resourceIndex: Map<string, AppConnector>;
|
|
152
|
+
private resourceLeases;
|
|
153
|
+
private elicitations;
|
|
154
|
+
private leases;
|
|
155
|
+
private inFlightLeases;
|
|
156
|
+
private compensations;
|
|
157
|
+
private pendingHandles;
|
|
158
|
+
private pendingWarnings;
|
|
159
|
+
private railTotals;
|
|
160
|
+
private cachedPrefix;
|
|
161
|
+
private auditLog;
|
|
162
|
+
private auditSeq;
|
|
163
|
+
private auditPrevHash;
|
|
164
|
+
private idempotencyCache;
|
|
165
|
+
private idempotencyInFlight;
|
|
166
|
+
private pending;
|
|
167
|
+
private uncertain;
|
|
168
|
+
constructor(opts?: {
|
|
169
|
+
agentId?: string;
|
|
170
|
+
mode?: ProjectionMode;
|
|
171
|
+
budget?: BudgetLimit | BudgetAccount;
|
|
172
|
+
rails?: HardRail[];
|
|
173
|
+
vault?: CredentialVault;
|
|
174
|
+
capability?: CapabilityToken;
|
|
175
|
+
substrateClearance?: Clearance;
|
|
176
|
+
store?: HandleStore;
|
|
177
|
+
railTotals?: Map<string, number>;
|
|
178
|
+
dag?: CausalDAG;
|
|
179
|
+
maxStoreBytes?: number;
|
|
180
|
+
maxStoreItems?: number;
|
|
181
|
+
inlineMaxBytes?: number;
|
|
182
|
+
includeOrientation?: boolean;
|
|
183
|
+
autoCommitWithinRails?: boolean;
|
|
184
|
+
autoPreviewOnGate?: boolean;
|
|
185
|
+
schemaBudgetBytes?: number;
|
|
186
|
+
catalogBudgetChars?: number;
|
|
187
|
+
previewBudgetChars?: number;
|
|
188
|
+
enableBranching?: boolean;
|
|
189
|
+
catalogTtlMs?: number;
|
|
190
|
+
substrate?: string;
|
|
191
|
+
onEvent?: (entry: AuditEntry) => void;
|
|
192
|
+
maxAuditEntries?: number;
|
|
193
|
+
onCheckpoint?: (rootHash: string, seq: number) => void;
|
|
194
|
+
checkpointEvery?: number;
|
|
195
|
+
});
|
|
196
|
+
get substrateClearance(): Clearance;
|
|
197
|
+
get capability(): CapabilityToken;
|
|
198
|
+
set capability(cap: CapabilityToken);
|
|
199
|
+
private get branchTainted();
|
|
200
|
+
private get branchPolicy();
|
|
201
|
+
private set branchPolicy(value);
|
|
202
|
+
private auditTail;
|
|
203
|
+
private recordAudit;
|
|
204
|
+
private appendAudit;
|
|
205
|
+
exportAuditLog(): AuditEntry[];
|
|
206
|
+
/**
|
|
207
|
+
* Ship the current chain head `[rootHash, seq]` to `onCheckpoint` now, for a timer or at shutdown. The hash commits to
|
|
208
|
+
* every earlier entry, so one signed or externally stored pair anchors the whole log up to `seq`. Resolves to `null`
|
|
209
|
+
* when nothing has been logged. Unlike the automatic checkpoints, a failure in the sink is raised to the caller.
|
|
210
|
+
*/
|
|
211
|
+
checkpoint(): Promise<[string, number] | null>;
|
|
212
|
+
/**
|
|
213
|
+
* Verify hash-chain integrity of an exported audit log.
|
|
214
|
+
*
|
|
215
|
+
* A chain alone proves consistency, not authenticity: whoever can write the whole log can rewrite it and recompute
|
|
216
|
+
* every hash. Pass the `[rootHash, seq]` pairs a host shipped to an external sink and the log must also contain each
|
|
217
|
+
* one unchanged. A log shorter than a checkpoint has lost its tail and fails.
|
|
218
|
+
*
|
|
219
|
+
* A checkpoint older than the first retained entry cannot be checked, and it fails by default. Deleting the head of a
|
|
220
|
+
* log leaves a suffix that is still internally consistent, so skipping such anchors would let that cut pass. A log that
|
|
221
|
+
* legitimately rolled over (see `maxAuditEntries`) looks exactly the same, so `allowTruncated: true` is the operator
|
|
222
|
+
* saying "this log is a ring buffer". Use `verifyAuditChainReport` to see which anchors were checked and why a log failed.
|
|
223
|
+
*/
|
|
224
|
+
static verifyAuditChain(entries: AuditEntry[], checkpoints?: Iterable<readonly [string, number]>, opts?: {
|
|
225
|
+
allowTruncated?: boolean;
|
|
226
|
+
}): Promise<boolean>;
|
|
227
|
+
/**
|
|
228
|
+
* `verifyAuditChain` with the evidence: `ok`, a `reason` code, a `message`, and what was and was not checked.
|
|
229
|
+
*
|
|
230
|
+
* Reasons for `ok: false`: `malformed_entry`, `genesis_mismatch`, `chain_broken` and `hash_mismatch` (the log is
|
|
231
|
+
* inconsistent: tampered or corrupt), `malformed_anchor`, `anchor_mismatch` (an entry no longer matches an anchor:
|
|
232
|
+
* rewritten), `tail_truncated` (entries after an anchor are gone), `entry_missing` (an anchor falls inside the retained
|
|
233
|
+
* range but its entry is absent), and `anchor_before_window` (an anchor predates the oldest retained entry: a rolled-over
|
|
234
|
+
* log and a cut head cannot be told apart from the log alone). `ok: true` has reason `ok`, or `ok_truncated` when
|
|
235
|
+
* `allowTruncated` let anchors older than the window go unchecked. `anchors_unverifiable` lists those anchors' sequence
|
|
236
|
+
* numbers and `anchors_checked` counts the ones that matched.
|
|
237
|
+
*/
|
|
238
|
+
static verifyAuditChainReport(entries: AuditEntry[], checkpoints?: Iterable<readonly [string, number]>, opts?: {
|
|
239
|
+
allowTruncated?: boolean;
|
|
240
|
+
}): Promise<AuditChainReport>;
|
|
241
|
+
registerTool(cfg: TargetConfig): void;
|
|
242
|
+
registerPrompt(name: string, template: string, opts?: {
|
|
243
|
+
description?: string;
|
|
244
|
+
arguments?: Array<Record<string, unknown>>;
|
|
245
|
+
}): void;
|
|
246
|
+
listPublicApps(clearance: Clearance): string[];
|
|
247
|
+
/**
|
|
248
|
+
* The one rule for who may learn that a target exists: its name, effect, description and input schema. The caller
|
|
249
|
+
* must be cleared for the target's output, and whoever reads the metadata for its `metadataPolicy`, which defaults to
|
|
250
|
+
* the output policy. `reader` is the narrower party when there is one (a model behind its substrate) and defaults to
|
|
251
|
+
* the caller. The immutable prefix, flat export, catalog snapshots, inbound MCP and the A2A card all apply this rule,
|
|
252
|
+
* so no listing shows what another one hides.
|
|
253
|
+
*/
|
|
254
|
+
metadataVisibleTo(spec: TargetConfig, clearance: Clearance, reader?: Clearance): boolean;
|
|
255
|
+
/**
|
|
256
|
+
* A catalog snapshot is stored as public, yet it names every target and resource of its app. It is shown only to a
|
|
257
|
+
* caller cleared for all of them, so it can never reveal what `listPublicTools` hides from the same caller. The
|
|
258
|
+
* stored snapshot and its content-addressed id never change: this gates reads only.
|
|
259
|
+
*/
|
|
260
|
+
catalogVisibleTo(appId: string, clearance: Clearance, reader?: Clearance): boolean;
|
|
261
|
+
/** True when `ref` (a `REF#` or full id) is the catalog snapshot of an app this caller may not see. */
|
|
262
|
+
catalogHiddenFrom(ref: string, clearance: Clearance, reader?: Clearance): boolean;
|
|
263
|
+
listPublicTools(clearance: Clearance): Array<{
|
|
264
|
+
name: string;
|
|
265
|
+
description: string;
|
|
266
|
+
inputSchema: Record<string, unknown>;
|
|
267
|
+
effect: EffectClass;
|
|
268
|
+
}>;
|
|
269
|
+
connectApp(connector: AppConnector): Promise<RefHandle>;
|
|
270
|
+
readResource(uri: string, opts?: {
|
|
271
|
+
subscribe?: boolean;
|
|
272
|
+
callerClearance?: Clearance;
|
|
273
|
+
}): Promise<{
|
|
274
|
+
uri: string;
|
|
275
|
+
handle: RefHandle;
|
|
276
|
+
}>;
|
|
277
|
+
notifyResourceChanged(uri: string, newValue: unknown): Promise<boolean>;
|
|
278
|
+
approvePreview(confirmToken: string): void;
|
|
279
|
+
rejectPreview(confirmToken: string): void;
|
|
280
|
+
commitApprovedPreview(confirmToken: string): Promise<CallResult>;
|
|
281
|
+
teardown(opts?: {
|
|
282
|
+
cascade?: boolean;
|
|
283
|
+
}): {
|
|
284
|
+
rolled_back: string[];
|
|
285
|
+
errors: Array<{
|
|
286
|
+
handle_id: string;
|
|
287
|
+
error: string;
|
|
288
|
+
}>;
|
|
289
|
+
cancelled_pending: string[];
|
|
290
|
+
};
|
|
291
|
+
swapSubstrate(substrate: string, substrateClearance: Clearance): void;
|
|
292
|
+
routeReference(target: string, argument: string, pointer: string, args?: Record<string, unknown>): Promise<CallResult>;
|
|
293
|
+
rollbackCompensation(handleId: string): {
|
|
294
|
+
status: string;
|
|
295
|
+
rolled_back: string[];
|
|
296
|
+
};
|
|
297
|
+
rollbackHandle(handleId: string, holdOwner?: [string, string]): boolean;
|
|
298
|
+
rollbackAllLifo(): string[];
|
|
299
|
+
resolveElicitation(elicitId: string, response: Record<string, unknown>): Promise<RefHandle>;
|
|
300
|
+
resolveElicitationResponse(elicitId: string, response: Record<string, unknown>): ElicitationRequest;
|
|
301
|
+
/** Project one reference for another host context under the original data policy. */
|
|
302
|
+
projectHandoff(ref: string, receiver: AgentKernel, projection: ResultProjection, extract?: (raw: unknown) => unknown): Promise<RefHandle>;
|
|
303
|
+
redact(refOrShort: string, reducer: Reducer, label?: string): Promise<RefHandle>;
|
|
304
|
+
private taintBranch;
|
|
305
|
+
branch(op: "fork" | "merge" | "switch", name: string, reason?: string): {
|
|
306
|
+
op: string;
|
|
307
|
+
branch?: string;
|
|
308
|
+
from?: string;
|
|
309
|
+
into?: string;
|
|
310
|
+
node_id: string;
|
|
311
|
+
tainted?: boolean;
|
|
312
|
+
};
|
|
313
|
+
private reserveRails;
|
|
314
|
+
private refundRails;
|
|
315
|
+
/**
|
|
316
|
+
* Keep a failed call's reservation counted against the cap and issue a receipt for the host to reconcile. Resolves to
|
|
317
|
+
* `null` when nothing was reserved (no spend rail applies, or every amount is zero): there is no money at stake, so the
|
|
318
|
+
* failure is reported as it always was. Holding means simply not refunding the amount the counter already includes.
|
|
319
|
+
*/
|
|
320
|
+
private holdUncertain;
|
|
321
|
+
/** Receipts for calls whose outcome is unknown, oldest first. Hold amounts are per spend rail. In memory, like the TypeScript spend ledger. */
|
|
322
|
+
uncertainSpend(): Array<Record<string, unknown>>;
|
|
323
|
+
/**
|
|
324
|
+
* Resolve an `uncertain` hold once the host has checked the external system. `committed: true` confirms the effect
|
|
325
|
+
* happened: the amount stays counted for good. `committed: false` confirms it did not: the amount is released back
|
|
326
|
+
* under the cap. A receipt resolves exactly once.
|
|
327
|
+
*/
|
|
328
|
+
reconcileSpend(receipt: string, opts: {
|
|
329
|
+
committed: boolean;
|
|
330
|
+
}): Promise<{
|
|
331
|
+
receipt: string;
|
|
332
|
+
outcome: "committed" | "released";
|
|
333
|
+
target: string;
|
|
334
|
+
held: Record<string, number>;
|
|
335
|
+
}>;
|
|
336
|
+
call(target: string, args: Record<string, unknown>, opts?: {
|
|
337
|
+
preview?: boolean;
|
|
338
|
+
confirmToken?: string;
|
|
339
|
+
tokensCost?: number;
|
|
340
|
+
teardown?: boolean;
|
|
341
|
+
inboundTaint?: "instruction" | "trusted_data" | "untrusted_data";
|
|
342
|
+
idempotencyKey?: string;
|
|
343
|
+
scope?: string;
|
|
344
|
+
branch?: string;
|
|
345
|
+
namespace?: string;
|
|
346
|
+
}): Promise<CallResult>;
|
|
347
|
+
/** Refuse background execution where it cannot be owned, before anything is charged or reserved. */
|
|
348
|
+
private guardPending;
|
|
349
|
+
/** Start the tool in the background and hand back a `REF#N` that has no result yet. A tool must be async: a blocking one blocks the event loop. */
|
|
350
|
+
private launchPending;
|
|
351
|
+
private trimPending;
|
|
352
|
+
/** Apply a finished outcome. Concurrent pulls share one settlement, so a result is committed exactly once. */
|
|
353
|
+
private settleRecord;
|
|
354
|
+
private applyOutcome;
|
|
355
|
+
/** Drop a running call. Its reservation stays held: a started read cannot be proven to have cost nothing. */
|
|
356
|
+
private cancelRecord;
|
|
357
|
+
/** Settle every finished background call. */
|
|
358
|
+
settlePending(): Promise<Array<{
|
|
359
|
+
ref: string;
|
|
360
|
+
status: string;
|
|
361
|
+
}>>;
|
|
362
|
+
/** Host-side cancel of one running call. Returns false when it is unknown or already finished. */
|
|
363
|
+
cancelPending(ref: string): boolean;
|
|
364
|
+
/** Status view for a call with no result. `null` means the ref is not pending (or has completed). */
|
|
365
|
+
pendingStatus(ref: string, clearance?: Clearance): Promise<Record<string, unknown> | null>;
|
|
366
|
+
exportActiveTools(opts?: {
|
|
367
|
+
query?: string;
|
|
368
|
+
maxTools?: number;
|
|
369
|
+
flat?: boolean;
|
|
370
|
+
}): Array<Record<string, unknown>>;
|
|
371
|
+
inspect(ref: string, view?: "l0" | "fields" | "raw", keys?: string[]): Promise<Record<string, unknown>>;
|
|
372
|
+
dispatchToolCall(toolName: string, args: Record<string, unknown>): Promise<unknown>;
|
|
373
|
+
private dispatchModelTarget;
|
|
374
|
+
spawnInternalAgent(agentId: string, opts?: {
|
|
375
|
+
allowedActions?: string[];
|
|
376
|
+
maxEffect?: EffectClass;
|
|
377
|
+
credentialScopes?: string[];
|
|
378
|
+
dropCredentials?: boolean;
|
|
379
|
+
clearance?: Clearance;
|
|
380
|
+
substrateClearance?: Clearance;
|
|
381
|
+
mode?: ProjectionMode;
|
|
382
|
+
}): AgentKernel;
|
|
383
|
+
spawnSystem2Escalation(mode?: "standard" | "compact"): AgentKernel;
|
|
384
|
+
handleEnvelope(envelopeOrLine: CoreEnvelope | string, opts?: {
|
|
385
|
+
signingSecret?: string | Uint8Array;
|
|
386
|
+
replayGuard?: ReplayGuard;
|
|
387
|
+
callerClearance?: Clearance;
|
|
388
|
+
railsCache?: Map<string, HardRail[]>;
|
|
389
|
+
/** Require `payload.iat_ms` to be within this many milliseconds of now. */
|
|
390
|
+
freshnessWindowMs?: number;
|
|
391
|
+
/** The advisory `SXP-Target` / `SXP-Effect` headers: never acted on, only required to agree with the authenticated envelope. */
|
|
392
|
+
wireHints?: Record<string, string>;
|
|
393
|
+
}): Promise<CoreEnvelope>;
|
|
394
|
+
callInbound(bridge: string, namespace: string, target: string, args: Record<string, unknown>, opts: {
|
|
395
|
+
preview: boolean;
|
|
396
|
+
confirmToken?: string;
|
|
397
|
+
capability: CapabilityToken;
|
|
398
|
+
idempotencyKey?: string;
|
|
399
|
+
scope?: string;
|
|
400
|
+
}): Promise<CallResult>;
|
|
401
|
+
private confirmationRequired;
|
|
402
|
+
private modelCallCapability;
|
|
403
|
+
private modelTargetVisible;
|
|
404
|
+
private modelOutputWithheld;
|
|
405
|
+
private orderedModelTargets;
|
|
406
|
+
private checkModelRef;
|
|
407
|
+
private catalogView;
|
|
408
|
+
projectReference(ref: string): {
|
|
409
|
+
ref: string;
|
|
410
|
+
value: unknown;
|
|
411
|
+
truncated: boolean;
|
|
412
|
+
redacted: boolean;
|
|
413
|
+
};
|
|
414
|
+
projectImmutablePrefix(): string;
|
|
415
|
+
projectTurn(): string;
|
|
416
|
+
}
|