@arnilo/prism 0.1.3 → 0.1.5
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/CHANGELOG.md +10 -0
- package/dist/agent-approval.d.ts +49 -0
- package/dist/agent-approval.js +178 -0
- package/dist/agent-run-lifecycle.d.ts +5 -1
- package/dist/agent-run-lifecycle.js +211 -3
- package/dist/agent-session.d.ts +98 -0
- package/dist/agent-session.js +1811 -0
- package/dist/agent-tool-dispatch.d.ts +13 -0
- package/dist/agent-tool-dispatch.js +92 -0
- package/dist/agents.d.ts +16 -9
- package/dist/agents.js +14 -2267
- package/dist/cli-init.d.ts +0 -2
- package/dist/cli-init.js +0 -2
- package/dist/cli-runner.js +1 -1
- package/dist/contracts-core.d.ts +1396 -0
- package/dist/contracts-core.js +119 -0
- package/dist/contracts-protocol.d.ts +594 -0
- package/dist/contracts-protocol.js +2 -0
- package/dist/contracts-run-state.d.ts +285 -0
- package/dist/contracts-run-state.js +77 -0
- package/dist/contracts.d.ts +7 -2269
- package/dist/contracts.js +7 -192
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/rpc.js +2 -1
- package/docs/agent-loops.md +1 -1
- package/docs/agent-session-runtime.md +4 -2
- package/docs/browser-automation.md +13 -9
- package/docs/coding-agent-tools.md +1 -2
- package/docs/compaction-observational-memory.md +5 -6
- package/docs/index.md +4 -4
- package/docs/migration.md +114 -1
- package/docs/performance.md +10 -0
- package/docs/provider-conformance.md +2 -2
- package/docs/provider-layer.md +1 -1
- package/docs/provider-packages.md +1 -1
- package/docs/provider-primitives.md +1 -1
- package/docs/public-contracts.md +4 -2
- package/docs/release-and-install.md +64 -0
- package/docs/tool-execution-primitives.md +3 -3
- package/docs/tools.md +2 -2
- package/docs/use-case-model-selection.md +12 -11
- package/package.json +2 -2
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import type { AgentSessionCloneOptions, AgentSessionForkOptions, CompactionOptions, CompactionResult, ContentBlock, ErrorInfo, JsonObject, JsonValue, Message, ModelConfig, RunLimitBreach, SessionEntry, ToolCallContent, Usage } from "./contracts-core.js";
|
|
2
|
+
import type { AgentEvent, RunOptions, ToolEffectKind } from "./contracts-protocol.js";
|
|
3
|
+
import type { CheckpointStore, OwnershipScope, SubscribeOptions } from "./contracts-core.js";
|
|
4
|
+
export type AgentRunStatus = "succeeded" | "failed" | "aborted" | "suspended" | "denied";
|
|
5
|
+
export type AgentRunInterruptionKind = "input_guardrail" | "tool_approval" | "elicitation";
|
|
6
|
+
export type ApprovalOutcome = "allow_once" | "allow_for_run" | "reject_once" | "reject_for_run";
|
|
7
|
+
export type PendingDecisionKind = "tool_approval" | "elicitation";
|
|
8
|
+
/** Redacted match scope for one pending or sticky decision; never contains raw tool arguments. */
|
|
9
|
+
export interface DecisionScope {
|
|
10
|
+
readonly toolName?: string;
|
|
11
|
+
readonly effectKind?: ToolEffectKind;
|
|
12
|
+
/** Redacted principal reference (tenant/kind/id); never a credential. */
|
|
13
|
+
readonly identity?: string;
|
|
14
|
+
/** Bounded argument-value constraints; deep-equal matched per key. */
|
|
15
|
+
readonly actionConstraints?: Readonly<Record<string, JsonValue>>;
|
|
16
|
+
/** SHA-256 of canonical JSON arguments; present instead of raw arguments. */
|
|
17
|
+
readonly argumentsHash?: string;
|
|
18
|
+
}
|
|
19
|
+
/** One redacted, unresolved approval request inside a suspended durable run. */
|
|
20
|
+
export interface PendingDecision {
|
|
21
|
+
/** Unique within the run; nested runs use supervisor-prefixed ids. */
|
|
22
|
+
readonly approvalId: string;
|
|
23
|
+
readonly kind: PendingDecisionKind;
|
|
24
|
+
readonly toolCallId?: string;
|
|
25
|
+
readonly scope: DecisionScope;
|
|
26
|
+
/** Bounded, redacted. */
|
|
27
|
+
readonly reason: string;
|
|
28
|
+
/** Typed payload contract for elicitation decisions. */
|
|
29
|
+
readonly elicitationSchema?: JsonObject;
|
|
30
|
+
/** Delegation chain, root-first; core-written, never client-supplied. */
|
|
31
|
+
readonly attribution?: {
|
|
32
|
+
readonly path: readonly string[];
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** Redacted safe-boundary descriptor; never contains tool arguments. */
|
|
36
|
+
export interface AgentRunInterruption {
|
|
37
|
+
readonly kind: AgentRunInterruptionKind;
|
|
38
|
+
readonly reason: string;
|
|
39
|
+
readonly toolCallId?: string;
|
|
40
|
+
readonly toolName?: string;
|
|
41
|
+
/** All unresolved approval requests of this suspension; absent for legacy single approvals. */
|
|
42
|
+
readonly pendingDecisions?: readonly PendingDecision[];
|
|
43
|
+
}
|
|
44
|
+
/** One host decision applied to one pending approval request. */
|
|
45
|
+
export interface RunDecision {
|
|
46
|
+
readonly approvalId: string;
|
|
47
|
+
readonly outcome: ApprovalOutcome;
|
|
48
|
+
/** Bounded to 2 KiB; redacted. */
|
|
49
|
+
readonly reason?: string;
|
|
50
|
+
/** Revalidated (schema, guardrails, policy) before dispatch; produces a new arguments hash. */
|
|
51
|
+
readonly modifiedArguments?: JsonObject;
|
|
52
|
+
/** Elicitation payload; validated against the pending decision's elicitationSchema. */
|
|
53
|
+
readonly elicitation?: JsonObject;
|
|
54
|
+
}
|
|
55
|
+
/** Run-scoped sticky decision; exact scope match, rechecked against policy, dropped at run end. */
|
|
56
|
+
export interface StickyDecision {
|
|
57
|
+
readonly scope: DecisionScope;
|
|
58
|
+
readonly outcome: "allow_for_run" | "reject_for_run";
|
|
59
|
+
readonly reason?: string;
|
|
60
|
+
readonly decidedAt: string;
|
|
61
|
+
/** Delegation path when the sticky was created for a nested-run decision. */
|
|
62
|
+
readonly attribution?: {
|
|
63
|
+
readonly path: readonly string[];
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** Root-visible link between one nested approval and the child-run approval id. */
|
|
67
|
+
export interface NestedRunApproval {
|
|
68
|
+
/** Root-visible approval id (hashed, non-enumerating across runs). */
|
|
69
|
+
readonly id: string;
|
|
70
|
+
/** Approval id as the nested run recorded it. */
|
|
71
|
+
readonly childApprovalId: string;
|
|
72
|
+
}
|
|
73
|
+
/** Root-visible link between a suspended nested run and the tool call that hosted it. */
|
|
74
|
+
export interface NestedRunRef {
|
|
75
|
+
readonly runId: string;
|
|
76
|
+
readonly sessionId?: string;
|
|
77
|
+
readonly toolCallId: string;
|
|
78
|
+
/** Redacted delegation path (child ids, root first). */
|
|
79
|
+
readonly path: readonly string[];
|
|
80
|
+
readonly approvals: readonly NestedRunApproval[];
|
|
81
|
+
/** Decisions persisted by a partial batch, keyed by root-visible approval id. */
|
|
82
|
+
readonly decisions?: Readonly<Record<string, RunDecision>>;
|
|
83
|
+
}
|
|
84
|
+
/** Outcome of resuming a nested run through the host-supplied hook. */
|
|
85
|
+
export type NestedRunOutcome = {
|
|
86
|
+
readonly status: "suspended";
|
|
87
|
+
readonly pendingDecisions: readonly PendingDecision[];
|
|
88
|
+
} | {
|
|
89
|
+
readonly status: "completed";
|
|
90
|
+
readonly value?: JsonValue;
|
|
91
|
+
} | {
|
|
92
|
+
readonly status: "failed";
|
|
93
|
+
readonly code: string;
|
|
94
|
+
readonly message: string;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Host hook that resumes a nested run (supervisor child) with child-visible decisions.
|
|
98
|
+
* Used both when a nested suspension first surfaces (sticky auto-apply) and when root
|
|
99
|
+
* decisions route back to the child on resume.
|
|
100
|
+
*/
|
|
101
|
+
export type ResumeNestedRun = (nested: {
|
|
102
|
+
readonly ref: AgentRunRef;
|
|
103
|
+
readonly toolCallId: string;
|
|
104
|
+
readonly path: readonly string[];
|
|
105
|
+
}, decisions: readonly RunDecision[]) => Promise<NestedRunOutcome>;
|
|
106
|
+
/**
|
|
107
|
+
* Thrown by a delegated-run host (e.g. the supervisor) when a nested run suspends on
|
|
108
|
+
* pending decisions inside a tool execution. Core converts it into a root suspension
|
|
109
|
+
* with attributed, root-visible approval ids; the dispatching wrapper attaches `toolCall`.
|
|
110
|
+
*/
|
|
111
|
+
export declare class AgentDelegationSuspendedError extends Error {
|
|
112
|
+
readonly ref: AgentRunRef;
|
|
113
|
+
readonly pendingDecisions: readonly PendingDecision[];
|
|
114
|
+
/** Redacted delegation path (child ids) used when decisions carry no attribution. */
|
|
115
|
+
readonly path?: readonly string[] | undefined;
|
|
116
|
+
readonly code = "ERR_PRISM_DELEGATION_SUSPENDED";
|
|
117
|
+
toolCall?: ToolCallContent;
|
|
118
|
+
constructor(ref: AgentRunRef, pendingDecisions: readonly PendingDecision[],
|
|
119
|
+
/** Redacted delegation path (child ids) used when decisions carry no attribution. */
|
|
120
|
+
path?: readonly string[] | undefined);
|
|
121
|
+
}
|
|
122
|
+
/** Shared decision-contract violations. Unknown and foreign approval ids share one non-enumerating error. */
|
|
123
|
+
export declare class AgentDecisionError extends Error {
|
|
124
|
+
readonly code: "ERR_PRISM_DECISION_STALE" | "ERR_PRISM_DECISION_UNKNOWN" | "ERR_PRISM_DECISION_DUPLICATE" | "ERR_PRISM_DECISION_SCOPE" | "ERR_PRISM_DECISION_INVALID" | "ERR_PRISM_DECISION_LIMIT";
|
|
125
|
+
constructor(code: "ERR_PRISM_DECISION_STALE" | "ERR_PRISM_DECISION_UNKNOWN" | "ERR_PRISM_DECISION_DUPLICATE" | "ERR_PRISM_DECISION_SCOPE" | "ERR_PRISM_DECISION_INVALID" | "ERR_PRISM_DECISION_LIMIT", message: string, options?: {
|
|
126
|
+
readonly cause?: unknown;
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
export declare const DEFAULT_MAX_PENDING_DECISIONS = 32;
|
|
130
|
+
export declare const HARD_MAX_PENDING_DECISIONS = 128;
|
|
131
|
+
export declare const DEFAULT_MAX_STICKY_DECISIONS = 64;
|
|
132
|
+
export declare const HARD_MAX_STICKY_DECISIONS = 256;
|
|
133
|
+
export declare const MAX_DECISION_REASON_BYTES: number;
|
|
134
|
+
export declare const HARD_MAX_DECISION_REASON_BYTES: number;
|
|
135
|
+
export declare const MAX_ELICITATION_BYTES: number;
|
|
136
|
+
export declare const HARD_MAX_ELICITATION_BYTES: number;
|
|
137
|
+
export declare const MAX_ACTION_CONSTRAINTS = 32;
|
|
138
|
+
export declare const HARD_MAX_ACTION_CONSTRAINTS = 64;
|
|
139
|
+
/** Maximum delegation attribution depth for surfaced nested pending decisions. */
|
|
140
|
+
export declare const MAX_ATTRIBUTION_DEPTH = 8;
|
|
141
|
+
export declare const MAX_ACTION_CONSTRAINT_BYTES: number;
|
|
142
|
+
export declare const HARD_MAX_ACTION_CONSTRAINT_BYTES: number;
|
|
143
|
+
export interface AgentRunStateOptions {
|
|
144
|
+
readonly checkpoints: CheckpointStore;
|
|
145
|
+
/** Host-authored immutable revision required for durable runs. */
|
|
146
|
+
readonly definitionRevision: string;
|
|
147
|
+
/** Suspend every tool call before its side effect. */
|
|
148
|
+
readonly interruptBeforeTool?: boolean;
|
|
149
|
+
readonly maxStateBytes?: number;
|
|
150
|
+
readonly fencingToken?: number;
|
|
151
|
+
/** Enables sticky auto-apply when a nested suspension first surfaces during this run. */
|
|
152
|
+
readonly resumeNestedRun?: ResumeNestedRun;
|
|
153
|
+
/**
|
|
154
|
+
* Opt-in (plan 015 Task 4): persist the session's loaded-skill names in the run-state
|
|
155
|
+
* checkpoint and restore them on resume. Names only — bodies reload via `load_skill`.
|
|
156
|
+
* Default off: checkpoint shape is identical to 0.1.2.
|
|
157
|
+
*/
|
|
158
|
+
readonly persistSessionState?: boolean;
|
|
159
|
+
}
|
|
160
|
+
/** Versioned, redacted checkpoint payload. Treat as opaque except status/version/interruption. */
|
|
161
|
+
export interface AgentRunState {
|
|
162
|
+
readonly schemaVersion: 1;
|
|
163
|
+
readonly agentId: string;
|
|
164
|
+
readonly definitionRevision: string;
|
|
165
|
+
readonly fingerprint: string;
|
|
166
|
+
readonly runId: string;
|
|
167
|
+
readonly sessionId: string;
|
|
168
|
+
readonly leafId?: string;
|
|
169
|
+
readonly model: ModelConfig;
|
|
170
|
+
readonly status: AgentRunStatus | "running";
|
|
171
|
+
readonly interruption?: AgentRunInterruption;
|
|
172
|
+
readonly version?: number;
|
|
173
|
+
}
|
|
174
|
+
export interface AgentRunResume {
|
|
175
|
+
readonly expectedVersion: number;
|
|
176
|
+
/** Legacy single-approval path; `approve` allows all pending once, `deny` terminates the run denied. */
|
|
177
|
+
readonly decision?: "approve" | "deny";
|
|
178
|
+
/** Batch decision path; exactly one of decision/decisions. Applied as one atomic CAS transition. */
|
|
179
|
+
readonly decisions?: readonly RunDecision[];
|
|
180
|
+
}
|
|
181
|
+
export interface AgentRunResumeOptions {
|
|
182
|
+
readonly checkpoints: CheckpointStore;
|
|
183
|
+
/** Current host-authored revision; must exactly match the checkpoint. */
|
|
184
|
+
readonly definitionRevision: string;
|
|
185
|
+
readonly ownership?: OwnershipScope;
|
|
186
|
+
readonly fencingToken?: number;
|
|
187
|
+
/** Routes root decisions for nested-run approvals back to the child (e.g. supervisor). */
|
|
188
|
+
readonly resumeNestedRun?: ResumeNestedRun;
|
|
189
|
+
/** Opt-in (plan 015 Task 4): restore persisted loaded-skill names into the resumed session catalog. */
|
|
190
|
+
readonly persistSessionState?: boolean;
|
|
191
|
+
}
|
|
192
|
+
/** Bounded, abortable options for `resumeAgentRunStream()`. */
|
|
193
|
+
export interface AgentRunResumeStreamOptions extends AgentRunResumeOptions, SubscribeOptions {
|
|
194
|
+
readonly signal?: AbortSignal;
|
|
195
|
+
}
|
|
196
|
+
export interface AgentRunRef {
|
|
197
|
+
readonly runId: string;
|
|
198
|
+
readonly sessionId?: string;
|
|
199
|
+
}
|
|
200
|
+
export interface AgentRunStatusResult {
|
|
201
|
+
readonly state: AgentRunState;
|
|
202
|
+
readonly version: number;
|
|
203
|
+
}
|
|
204
|
+
export declare class AgentRunStateError extends Error {
|
|
205
|
+
readonly code = "ERR_PRISM_AGENT_RUN_STATE";
|
|
206
|
+
constructor(message: string);
|
|
207
|
+
}
|
|
208
|
+
/** Durable-loop contract violations: hook-less custom strategy on a durable run, invalid snapshot, or revision drift. */
|
|
209
|
+
export declare class AgentLoopStateError extends Error {
|
|
210
|
+
readonly code: "ERR_PRISM_LOOP_NOT_DURABLE" | "ERR_PRISM_LOOP_SNAPSHOT" | "ERR_PRISM_LOOP_REVISION";
|
|
211
|
+
constructor(code: "ERR_PRISM_LOOP_NOT_DURABLE" | "ERR_PRISM_LOOP_SNAPSHOT" | "ERR_PRISM_LOOP_REVISION", message: string, options?: {
|
|
212
|
+
readonly cause?: unknown;
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
/** Terminal result of `session.run()` / `session.prompt()`. Failed and aborted runs throw {@link AgentRunError} with this shape attached. */
|
|
216
|
+
export interface AgentRunResult {
|
|
217
|
+
readonly sessionId: string;
|
|
218
|
+
readonly runId: string;
|
|
219
|
+
readonly status: AgentRunStatus;
|
|
220
|
+
/** Branch leaf after the run settles. */
|
|
221
|
+
readonly leafId?: string;
|
|
222
|
+
/** Concatenated text blocks from the final assistant message, or `""` when none. */
|
|
223
|
+
readonly text: string;
|
|
224
|
+
/** Content blocks from the final assistant message, or `[]` when none. */
|
|
225
|
+
readonly content: readonly ContentBlock[];
|
|
226
|
+
/** Final assistant message when the run produced one. */
|
|
227
|
+
readonly message?: Message;
|
|
228
|
+
/** Aggregate usage across provider turns (`run_total` scope). */
|
|
229
|
+
readonly usage?: Usage;
|
|
230
|
+
/** Present when the run hit a configured resource ceiling. */
|
|
231
|
+
readonly limit?: RunLimitBreach;
|
|
232
|
+
/** Present when `status` is `"failed"` or when a failed attempt still produced partial output. */
|
|
233
|
+
readonly error?: ErrorInfo;
|
|
234
|
+
/** String form of the abort reason when `status` is `"aborted"`. */
|
|
235
|
+
readonly abortReason?: string;
|
|
236
|
+
/** Present for durable suspended/terminal runs. Payload is redacted and bounded. */
|
|
237
|
+
readonly runState?: AgentRunState;
|
|
238
|
+
/** Present only while awaiting an operator decision. */
|
|
239
|
+
readonly interruption?: AgentRunInterruption;
|
|
240
|
+
}
|
|
241
|
+
export declare class AgentRunError extends Error {
|
|
242
|
+
readonly result: AgentRunResult;
|
|
243
|
+
constructor(result: AgentRunResult, options?: {
|
|
244
|
+
readonly cause?: unknown;
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
/** Mid-run steer queue: default pending message count (fail closed at this cap). */
|
|
248
|
+
export declare const DEFAULT_MAX_PENDING_STEERS = 8;
|
|
249
|
+
/** Absolute pending steer count ceiling if hosts later expose overrides. */
|
|
250
|
+
export declare const HARD_MAX_PENDING_STEERS = 32;
|
|
251
|
+
/** Mid-run steer queue: default total UTF-8 byte budget across pending messages. */
|
|
252
|
+
export declare const DEFAULT_MAX_PENDING_STEER_BYTES: number;
|
|
253
|
+
/** Absolute pending steer byte ceiling if hosts later expose overrides. */
|
|
254
|
+
export declare const HARD_MAX_PENDING_STEER_BYTES: number;
|
|
255
|
+
export interface SteerOptions {
|
|
256
|
+
/**
|
|
257
|
+
* When true, abort the in-flight provider stream and continue the same run after
|
|
258
|
+
* injecting steered user text. Default false: inject before the next provider turn
|
|
259
|
+
* (after the current tool batch completes).
|
|
260
|
+
*/
|
|
261
|
+
readonly softInterrupt?: boolean;
|
|
262
|
+
}
|
|
263
|
+
export interface AgentSession {
|
|
264
|
+
readonly id: string;
|
|
265
|
+
/** Current branch leaf entry id; advances on every append/run and is re-pointed by `checkout`.
|
|
266
|
+
* Undefined until the first entry lands (a fresh session with no history). */
|
|
267
|
+
readonly leafId: string | undefined;
|
|
268
|
+
run(input: string | Message | readonly Message[], options?: RunOptions): Promise<AgentRunResult>;
|
|
269
|
+
prompt(input: string, options?: RunOptions): Promise<AgentRunResult>;
|
|
270
|
+
/**
|
|
271
|
+
* Enqueue user text into an active run. Default injects before the next provider turn.
|
|
272
|
+
* `softInterrupt: true` aborts the current provider stream, then continues the same run.
|
|
273
|
+
* Fails closed when no run is active or the pending queue exceeds caps.
|
|
274
|
+
*/
|
|
275
|
+
steer(input: string | Message | readonly Message[], options?: SteerOptions): void;
|
|
276
|
+
/** Subscribe first, then start exactly one run and yield only that run's events until it terminates. */
|
|
277
|
+
stream(input: string | Message | readonly Message[], options?: RunOptions & SubscribeOptions): AsyncIterable<AgentEvent>;
|
|
278
|
+
compact(options?: CompactionOptions): Promise<CompactionResult>;
|
|
279
|
+
subscribe(options?: SubscribeOptions): AsyncIterable<AgentEvent>;
|
|
280
|
+
abort(reason?: unknown): void;
|
|
281
|
+
entries(): Promise<readonly SessionEntry[]>;
|
|
282
|
+
checkout(leafId?: string): Promise<void>;
|
|
283
|
+
fork(options?: AgentSessionForkOptions): AgentSession;
|
|
284
|
+
clone(options?: AgentSessionCloneOptions): Promise<AgentSession>;
|
|
285
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thrown by a delegated-run host (e.g. the supervisor) when a nested run suspends on
|
|
3
|
+
* pending decisions inside a tool execution. Core converts it into a root suspension
|
|
4
|
+
* with attributed, root-visible approval ids; the dispatching wrapper attaches `toolCall`.
|
|
5
|
+
*/
|
|
6
|
+
export class AgentDelegationSuspendedError extends Error {
|
|
7
|
+
ref;
|
|
8
|
+
pendingDecisions;
|
|
9
|
+
path;
|
|
10
|
+
code = "ERR_PRISM_DELEGATION_SUSPENDED";
|
|
11
|
+
toolCall;
|
|
12
|
+
constructor(ref, pendingDecisions,
|
|
13
|
+
/** Redacted delegation path (child ids) used when decisions carry no attribution. */
|
|
14
|
+
path) {
|
|
15
|
+
super("Delegated run suspended");
|
|
16
|
+
this.ref = ref;
|
|
17
|
+
this.pendingDecisions = pendingDecisions;
|
|
18
|
+
this.path = path;
|
|
19
|
+
this.name = "AgentDelegationSuspendedError";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/** Shared decision-contract violations. Unknown and foreign approval ids share one non-enumerating error. */
|
|
23
|
+
export class AgentDecisionError extends Error {
|
|
24
|
+
code;
|
|
25
|
+
constructor(code, message, options) {
|
|
26
|
+
super(message, options);
|
|
27
|
+
this.code = code;
|
|
28
|
+
this.name = "AgentDecisionError";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export const DEFAULT_MAX_PENDING_DECISIONS = 32;
|
|
32
|
+
export const HARD_MAX_PENDING_DECISIONS = 128;
|
|
33
|
+
export const DEFAULT_MAX_STICKY_DECISIONS = 64;
|
|
34
|
+
export const HARD_MAX_STICKY_DECISIONS = 256;
|
|
35
|
+
export const MAX_DECISION_REASON_BYTES = 2 * 1024;
|
|
36
|
+
export const HARD_MAX_DECISION_REASON_BYTES = 8 * 1024;
|
|
37
|
+
export const MAX_ELICITATION_BYTES = 16 * 1024;
|
|
38
|
+
export const HARD_MAX_ELICITATION_BYTES = 64 * 1024;
|
|
39
|
+
export const MAX_ACTION_CONSTRAINTS = 32;
|
|
40
|
+
export const HARD_MAX_ACTION_CONSTRAINTS = 64;
|
|
41
|
+
/** Maximum delegation attribution depth for surfaced nested pending decisions. */
|
|
42
|
+
export const MAX_ATTRIBUTION_DEPTH = 8;
|
|
43
|
+
export const MAX_ACTION_CONSTRAINT_BYTES = 4 * 1024;
|
|
44
|
+
export const HARD_MAX_ACTION_CONSTRAINT_BYTES = 16 * 1024;
|
|
45
|
+
export class AgentRunStateError extends Error {
|
|
46
|
+
code = "ERR_PRISM_AGENT_RUN_STATE";
|
|
47
|
+
constructor(message) {
|
|
48
|
+
super(message);
|
|
49
|
+
this.name = "AgentRunStateError";
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/** Durable-loop contract violations: hook-less custom strategy on a durable run, invalid snapshot, or revision drift. */
|
|
53
|
+
export class AgentLoopStateError extends Error {
|
|
54
|
+
code;
|
|
55
|
+
constructor(code, message, options) {
|
|
56
|
+
super(message, options);
|
|
57
|
+
this.code = code;
|
|
58
|
+
this.name = "AgentLoopStateError";
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export class AgentRunError extends Error {
|
|
62
|
+
result;
|
|
63
|
+
constructor(result, options) {
|
|
64
|
+
super(result.error?.message ?? (result.status === "aborted" ? "Agent run aborted" : "Agent run failed"), options);
|
|
65
|
+
this.name = "AgentRunError";
|
|
66
|
+
this.result = result;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/** Mid-run steer queue: default pending message count (fail closed at this cap). */
|
|
70
|
+
export const DEFAULT_MAX_PENDING_STEERS = 8;
|
|
71
|
+
/** Absolute pending steer count ceiling if hosts later expose overrides. */
|
|
72
|
+
export const HARD_MAX_PENDING_STEERS = 32;
|
|
73
|
+
/** Mid-run steer queue: default total UTF-8 byte budget across pending messages. */
|
|
74
|
+
export const DEFAULT_MAX_PENDING_STEER_BYTES = 64 * 1024;
|
|
75
|
+
/** Absolute pending steer byte ceiling if hosts later expose overrides. */
|
|
76
|
+
export const HARD_MAX_PENDING_STEER_BYTES = 256 * 1024;
|
|
77
|
+
//# sourceMappingURL=contracts-run-state.js.map
|