@theokit/sdk 2.24.0 → 2.26.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/CHANGELOG.md +57 -0
- package/dist/a2a/index.cjs +464 -195
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.js +464 -195
- package/dist/a2a/index.js.map +1 -1
- package/dist/create-skill.d.ts +8 -0
- package/dist/{cron-vjod0qVQ.d.ts → cron-BR1NCSk1.d.cts} +77 -4
- package/dist/{cron-Bd2oRD7A.d.cts → cron-DgEQCJ2i.d.ts} +77 -4
- package/dist/cron.cjs +430 -184
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- package/dist/cron.js +430 -184
- package/dist/cron.js.map +1 -1
- package/dist/{errors-DRS-kqOK.d.ts → errors-CbY3pxY7.d.ts} +1 -1
- package/dist/{errors-DIKBXffg.d.cts → errors-DLMNb4Ka.d.cts} +1 -1
- package/dist/errors.d.cts +2 -2
- package/dist/eval.cjs +430 -184
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +430 -184
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +523 -190
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +93 -7
- package/dist/index.d.ts +93 -7
- package/dist/index.js +520 -191
- package/dist/index.js.map +1 -1
- package/dist/internal/runtime/local-agent/local-agent-bootstrap.d.ts +2 -4
- package/dist/internal/runtime/processors/run-processors.d.ts +10 -0
- package/dist/internal/runtime/processors/tripwire-run.d.ts +16 -0
- package/dist/internal/runtime/processors/wrap-output-run.d.ts +18 -0
- package/dist/internal/runtime/skills/skill-frontmatter.d.ts +6 -0
- package/dist/{run-Cr0C6cOM.d.cts → run-CdWiihyU.d.cts} +109 -2
- package/dist/{run-Cr0C6cOM.d.ts → run-CdWiihyU.d.ts} +109 -2
- package/dist/skills.cjs.map +1 -1
- package/dist/skills.js.map +1 -1
- package/dist/types/agent.d.ts +67 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/processors.d.ts +84 -0
- package/dist/types/run-events.d.ts +11 -1
- package/dist/types/run.d.ts +12 -0
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { ProvidersManagerImpl } from "../config/providers-manager.js";
|
|
11
11
|
import { FileContextManager } from "../context/context-manager.js";
|
|
12
12
|
import { type PluginMetadata, PluginsManager } from "../plugins/plugins-manager.js";
|
|
13
|
-
import { type
|
|
13
|
+
import { type SkillsHandle, SkillsManager } from "../skills/skills-manager.js";
|
|
14
14
|
export declare function registerLocalAgent(args: {
|
|
15
15
|
agentId: string;
|
|
16
16
|
model: ModelSelection | undefined;
|
|
@@ -21,9 +21,7 @@ export interface BootstrappedSubmanagers {
|
|
|
21
21
|
context?: FileContextManager;
|
|
22
22
|
providers?: ProvidersManagerImpl;
|
|
23
23
|
skillsManager?: SkillsManager;
|
|
24
|
-
skills?:
|
|
25
|
-
list: () => Promise<SkillMetadata[]>;
|
|
26
|
-
};
|
|
24
|
+
skills?: SkillsHandle;
|
|
27
25
|
pluginsManager?: PluginsManager;
|
|
28
26
|
plugins?: {
|
|
29
27
|
list: () => Promise<PluginMetadata[]>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SE24 — the guardrail processor runner. Runs an ordered processor pipeline over
|
|
3
|
+
* a string payload (the user message for input, the model's text for output).
|
|
4
|
+
* Each processor may rewrite the payload (return a string), `abort()` (→ a
|
|
5
|
+
* tripwire that short-circuits the rest), or `warn()` (fire `onViolation`,
|
|
6
|
+
* continue). A processor's own bug (a non-abort throw) propagates (fail-fast).
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SE24 — a terminal {@link Run} born from an input-processor `abort()`. It never
|
|
3
|
+
* reached the model: `wait()` resolves to a `cancelled` {@link RunResult}
|
|
4
|
+
* carrying the tripwire; `stream()` yields no content messages. The `tripwire`
|
|
5
|
+
* run-event is emitted by the caller via `SendOptions.onRunEvent` before this
|
|
6
|
+
* run is returned.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
import type { ProcessorTripwire } from "../../../types/processors.js";
|
|
11
|
+
import type { Run } from "../../../types/run.js";
|
|
12
|
+
export declare function createTripwireRun(args: {
|
|
13
|
+
agentId: string;
|
|
14
|
+
tripwire: ProcessorTripwire;
|
|
15
|
+
model: ModelSelection | undefined;
|
|
16
|
+
}): Run;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SE24 — wrap a {@link Run} so its `wait()` result passes through the output
|
|
3
|
+
* processors before reaching the caller. A processor may redact/rewrite the
|
|
4
|
+
* final text or `abort()` → the result becomes `cancelled` with a tripwire (and
|
|
5
|
+
* a `tripwire` run-event is emitted). Streaming output redaction is deferred
|
|
6
|
+
* (v1 processes the buffered `wait()` path only); a Proxy preserves every other
|
|
7
|
+
* Run member (`stream`, `cancel`, `conversation`, …).
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
import type { Run } from "../../../types/run.js";
|
|
12
|
+
import { type RunEventSink } from "../../../types/run-events.js";
|
|
13
|
+
export declare function wrapRunWithOutputProcessors(args: {
|
|
14
|
+
run: Run;
|
|
15
|
+
processors: readonly Processor[];
|
|
16
|
+
agentId: string;
|
|
17
|
+
onRunEvent: RunEventSink | undefined;
|
|
18
|
+
}): Run;
|
|
@@ -1 +1,7 @@
|
|
|
1
1
|
export type SkillFrontmatterErrorCode = "missing_frontmatter" | "schema_invalid";
|
|
2
|
+
/**
|
|
3
|
+
* SE20 — return a SKILL.md's BODY (everything after the frontmatter block), trimmed.
|
|
4
|
+
* When there is no frontmatter block, the whole file is the body. Reuses the same
|
|
5
|
+
* frontmatter regex as {@link parseSkillFrontmatter} (DRY).
|
|
6
|
+
*/
|
|
7
|
+
export declare function stripSkillFrontmatter(raw: string): string;
|
|
@@ -87,7 +87,17 @@ interface ToolResultGuardOptions {
|
|
|
87
87
|
*
|
|
88
88
|
* @public
|
|
89
89
|
*/
|
|
90
|
-
type RunEvent = RunToolProgressEvent | RunRateLimitEvent | RunPermissionDeniedEvent | RunTaskStartedEvent | RunTaskUpdatedEvent | RunTaskCompletedEvent | RunCompactBoundaryEvent;
|
|
90
|
+
type RunEvent = RunToolProgressEvent | RunRateLimitEvent | RunPermissionDeniedEvent | RunTaskStartedEvent | RunTaskUpdatedEvent | RunTaskCompletedEvent | RunCompactBoundaryEvent | RunTripwireEvent;
|
|
91
|
+
/**
|
|
92
|
+
* SE24 — a guardrail processor called `abort()`; the run stops with a tripwire.
|
|
93
|
+
* Delivered via {@link SendOptions.onRunEvent} (mirrors the `RunResult.tripwire`
|
|
94
|
+
* surfaced on `wait()`).
|
|
95
|
+
*/
|
|
96
|
+
interface RunTripwireEvent {
|
|
97
|
+
readonly type: "tripwire";
|
|
98
|
+
readonly reason: string;
|
|
99
|
+
readonly processorId: string;
|
|
100
|
+
}
|
|
91
101
|
/** A tool call is being dispatched (before its result). */
|
|
92
102
|
interface RunToolProgressEvent {
|
|
93
103
|
readonly type: "tool_progress";
|
|
@@ -154,6 +164,91 @@ type RunEventSink = (event: RunEvent) => void;
|
|
|
154
164
|
*/
|
|
155
165
|
declare function emitRunEvent(sink: RunEventSink | undefined, event: RunEvent): void;
|
|
156
166
|
|
|
167
|
+
/**
|
|
168
|
+
* SE24 — guardrail processor pipeline. A `Processor` inspects/transforms/blocks
|
|
169
|
+
* the user message (input) or the model's final text (output). Processors run in
|
|
170
|
+
* order; each may rewrite its payload, `abort(reason)` to stop the run (surfaced
|
|
171
|
+
* as {@link RunResult.tripwire} + a `tripwire` run-event), or `warn()` to report
|
|
172
|
+
* a non-blocking violation. The pipeline is provider-agnostic and carries NO LLM
|
|
173
|
+
* — an LLM-classifier processor is the consumer's (delegated, see the guardrails
|
|
174
|
+
* ADR). Mirrors Mastra's `inputProcessors` / `outputProcessors`.
|
|
175
|
+
*
|
|
176
|
+
* @public
|
|
177
|
+
*/
|
|
178
|
+
/**
|
|
179
|
+
* A policy violation surfaced to a processor's {@link Processor.onViolation}
|
|
180
|
+
* callback — on `abort()` (blocking) AND on `warn()` (non-blocking).
|
|
181
|
+
*
|
|
182
|
+
* @public
|
|
183
|
+
*/
|
|
184
|
+
interface ProcessorViolation {
|
|
185
|
+
processorId: string;
|
|
186
|
+
message: string;
|
|
187
|
+
detail?: unknown;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Controls available to a processor while it runs: `abort()` stops the run with
|
|
191
|
+
* a tripwire; `warn()` reports a non-blocking violation and continues.
|
|
192
|
+
*
|
|
193
|
+
* @public
|
|
194
|
+
*/
|
|
195
|
+
interface ProcessorControls {
|
|
196
|
+
/** Stop the run immediately with a tripwire. Throws — code after it never runs. */
|
|
197
|
+
abort(reason: string): never;
|
|
198
|
+
/** Report a non-blocking violation (fires `onViolation`); the run continues. */
|
|
199
|
+
warn(message: string, detail?: unknown): void;
|
|
200
|
+
}
|
|
201
|
+
/** Context passed to {@link Processor.processInput}. @public */
|
|
202
|
+
interface InputProcessorContext extends ProcessorControls {
|
|
203
|
+
/** The user message text for this send. */
|
|
204
|
+
message: string;
|
|
205
|
+
agentId: string;
|
|
206
|
+
}
|
|
207
|
+
/** Context passed to {@link Processor.processOutput}. @public */
|
|
208
|
+
interface OutputProcessorContext extends ProcessorControls {
|
|
209
|
+
/** The model's final assistant text for this run. */
|
|
210
|
+
text: string;
|
|
211
|
+
agentId: string;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* A guardrail processor. Provide `processInput` (runs before the LLM) and/or
|
|
215
|
+
* `processOutput` (runs on the final text). A processor's `strategy` (block /
|
|
216
|
+
* rewrite / redact / warn) is expressed via the {@link ProcessorControls}:
|
|
217
|
+
* return the transformed payload to rewrite/redact, `abort()` to block, `warn()`
|
|
218
|
+
* to report without blocking. The core ships no strategy enum — strategies are a
|
|
219
|
+
* processor-level convention over these primitives.
|
|
220
|
+
*
|
|
221
|
+
* @public
|
|
222
|
+
*/
|
|
223
|
+
interface Processor {
|
|
224
|
+
/** Stable id — surfaced on {@link ProcessorViolation} and {@link RunResult.tripwire}. */
|
|
225
|
+
id: string;
|
|
226
|
+
/**
|
|
227
|
+
* Transform or block the user message before it reaches the model. Return the
|
|
228
|
+
* (possibly rewritten) text; returning nothing (void) preserves the message
|
|
229
|
+
* unchanged. May be `async`.
|
|
230
|
+
*/
|
|
231
|
+
processInput?(ctx: InputProcessorContext): string | Promise<string> | void;
|
|
232
|
+
/**
|
|
233
|
+
* Transform or block the model's final text before it reaches the caller.
|
|
234
|
+
* Return the (possibly redacted) text; returning nothing (void) preserves the
|
|
235
|
+
* text unchanged. May be `async`.
|
|
236
|
+
*/
|
|
237
|
+
processOutput?(ctx: OutputProcessorContext): string | Promise<string> | void;
|
|
238
|
+
/** Fires on `abort()` and `warn()`. Errors thrown here are swallowed (never break the pipeline). */
|
|
239
|
+
onViolation?(violation: ProcessorViolation): void;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* The tripwire detail attached to {@link RunResult.tripwire} when a processor
|
|
243
|
+
* aborts, and carried by the `tripwire` run-event.
|
|
244
|
+
*
|
|
245
|
+
* @public
|
|
246
|
+
*/
|
|
247
|
+
interface ProcessorTripwire {
|
|
248
|
+
reason: string;
|
|
249
|
+
processorId: string;
|
|
250
|
+
}
|
|
251
|
+
|
|
157
252
|
/**
|
|
158
253
|
* Type-leaf — primitives shared between `agent.ts`, `run.ts`, and
|
|
159
254
|
* `messages.ts`. Extracted to break LOW type-only cycles #5 and #7
|
|
@@ -886,6 +981,18 @@ interface RunResult {
|
|
|
886
981
|
id: string;
|
|
887
982
|
status: "finished" | "error" | "cancelled";
|
|
888
983
|
result?: string;
|
|
984
|
+
/**
|
|
985
|
+
* SE24 — set when a guardrail processor called `abort()`. The run stops
|
|
986
|
+
* (`status: "cancelled"`) and `tripwire` carries the blocking reason +
|
|
987
|
+
* processor id. `undefined` on every non-guardrail outcome. A
|
|
988
|
+
* `throwOnError: true` agent resolves normally on a tripwire (status is
|
|
989
|
+
* `"cancelled"`, not `"error"`). On an OUTPUT block the model already ran, so
|
|
990
|
+
* `usage`/`cost` survive (billing) while `result` is suppressed; an INPUT
|
|
991
|
+
* block never reaches the model, so `usage` is absent.
|
|
992
|
+
*
|
|
993
|
+
* @public
|
|
994
|
+
*/
|
|
995
|
+
tripwire?: ProcessorTripwire;
|
|
889
996
|
model?: ModelSelection;
|
|
890
997
|
durationMs?: number;
|
|
891
998
|
git?: RunGitInfo;
|
|
@@ -1290,4 +1397,4 @@ interface GenerateRunResult<O> {
|
|
|
1290
1397
|
};
|
|
1291
1398
|
}
|
|
1292
1399
|
|
|
1293
|
-
export { type
|
|
1400
|
+
export { type SDKStatusMessage as $, type AgentConversationTurn as A, type RunOperation as B, type CustomTool as C, type DoomLoopThresholds as D, type RunPermissionDeniedEvent as E, type RunRateLimitEvent as F, type GenerateOptions as G, type RunStatus as H, type ImageBlock as I, type RunTaskCompletedEvent as J, type RunTaskStartedEvent as K, type RunTaskUpdatedEvent as L, type ModelSelection as M, type RunToCompletionOptions as N, type OutputProcessorContext as O, type Processor as P, type RunToCompletionResult as Q, type RunResult as R, type SDKMessage as S, type ToolResultContentBlock as T, type RunToolProgressEvent as U, type RunTripwireEvent as V, type SDKAssistantMessage as W, type SDKImage as X, type SDKImageDimension as Y, type SDKObjectDelta as Z, type SDKRequestMessage as _, type McpServerConfig as a, type SDKSystemMessage as a0, type SDKTaskMessage as a1, type SDKThinkingMessage as a2, type SDKToolUseMessage as a3, type SDKUserMessage as a4, type SDKUserMessageEvent as a5, type SendOptions as a6, type ShellCommand as a7, type ShellConversationTurn as a8, type ShellOutput as a9, type ShellOutputDeltaUpdate as aa, type StepCompletedUpdate as ab, type StepStartedUpdate as ac, type StreamToCompletionResult as ad, type SummaryCompletedUpdate as ae, type SummaryStartedUpdate as af, type SummaryUpdate as ag, type TextBlock as ah, type TextDeltaUpdate as ai, type ThinkingCompletedUpdate as aj, type ThinkingDeltaUpdate as ak, type ThinkingMessage as al, type TokenDeltaUpdate as am, type TokenUsage as an, type ToolCall as ao, type ToolCallCompletedUpdate as ap, type ToolCallStartedUpdate as aq, type ToolContextMessage as ar, type ToolResult as as, type ToolResultGuardOptions as at, type ToolUseBlock as au, type TurnEndedUpdate as av, type UserMessage as aw, type UserMessageAppendedUpdate as ax, emitRunEvent as ay, type Run as b, type MessageOrigin as c, type AssistantMessage as d, type ConversationStep as e, type ConversationTurn as f, type CostBreakdown as g, type CostSource as h, type CostStatus as i, type GenerateRunResult as j, type InputProcessorContext as k, type InteractionUpdate as l, type McpAuthConfig as m, type McpHttpServerConfig as n, type McpOAuthConfig as o, type McpStdioServerConfig as p, type ModelParameterValue as q, type PartialToolCallUpdate as r, type ProcessorControls as s, type ProcessorTripwire as t, type ProcessorViolation as u, type RunCompactBoundaryEvent as v, type RunErrorDetail as w, type RunEvent as x, type RunEventSink as y, type RunGitInfo as z };
|
|
@@ -87,7 +87,17 @@ interface ToolResultGuardOptions {
|
|
|
87
87
|
*
|
|
88
88
|
* @public
|
|
89
89
|
*/
|
|
90
|
-
type RunEvent = RunToolProgressEvent | RunRateLimitEvent | RunPermissionDeniedEvent | RunTaskStartedEvent | RunTaskUpdatedEvent | RunTaskCompletedEvent | RunCompactBoundaryEvent;
|
|
90
|
+
type RunEvent = RunToolProgressEvent | RunRateLimitEvent | RunPermissionDeniedEvent | RunTaskStartedEvent | RunTaskUpdatedEvent | RunTaskCompletedEvent | RunCompactBoundaryEvent | RunTripwireEvent;
|
|
91
|
+
/**
|
|
92
|
+
* SE24 — a guardrail processor called `abort()`; the run stops with a tripwire.
|
|
93
|
+
* Delivered via {@link SendOptions.onRunEvent} (mirrors the `RunResult.tripwire`
|
|
94
|
+
* surfaced on `wait()`).
|
|
95
|
+
*/
|
|
96
|
+
interface RunTripwireEvent {
|
|
97
|
+
readonly type: "tripwire";
|
|
98
|
+
readonly reason: string;
|
|
99
|
+
readonly processorId: string;
|
|
100
|
+
}
|
|
91
101
|
/** A tool call is being dispatched (before its result). */
|
|
92
102
|
interface RunToolProgressEvent {
|
|
93
103
|
readonly type: "tool_progress";
|
|
@@ -154,6 +164,91 @@ type RunEventSink = (event: RunEvent) => void;
|
|
|
154
164
|
*/
|
|
155
165
|
declare function emitRunEvent(sink: RunEventSink | undefined, event: RunEvent): void;
|
|
156
166
|
|
|
167
|
+
/**
|
|
168
|
+
* SE24 — guardrail processor pipeline. A `Processor` inspects/transforms/blocks
|
|
169
|
+
* the user message (input) or the model's final text (output). Processors run in
|
|
170
|
+
* order; each may rewrite its payload, `abort(reason)` to stop the run (surfaced
|
|
171
|
+
* as {@link RunResult.tripwire} + a `tripwire` run-event), or `warn()` to report
|
|
172
|
+
* a non-blocking violation. The pipeline is provider-agnostic and carries NO LLM
|
|
173
|
+
* — an LLM-classifier processor is the consumer's (delegated, see the guardrails
|
|
174
|
+
* ADR). Mirrors Mastra's `inputProcessors` / `outputProcessors`.
|
|
175
|
+
*
|
|
176
|
+
* @public
|
|
177
|
+
*/
|
|
178
|
+
/**
|
|
179
|
+
* A policy violation surfaced to a processor's {@link Processor.onViolation}
|
|
180
|
+
* callback — on `abort()` (blocking) AND on `warn()` (non-blocking).
|
|
181
|
+
*
|
|
182
|
+
* @public
|
|
183
|
+
*/
|
|
184
|
+
interface ProcessorViolation {
|
|
185
|
+
processorId: string;
|
|
186
|
+
message: string;
|
|
187
|
+
detail?: unknown;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Controls available to a processor while it runs: `abort()` stops the run with
|
|
191
|
+
* a tripwire; `warn()` reports a non-blocking violation and continues.
|
|
192
|
+
*
|
|
193
|
+
* @public
|
|
194
|
+
*/
|
|
195
|
+
interface ProcessorControls {
|
|
196
|
+
/** Stop the run immediately with a tripwire. Throws — code after it never runs. */
|
|
197
|
+
abort(reason: string): never;
|
|
198
|
+
/** Report a non-blocking violation (fires `onViolation`); the run continues. */
|
|
199
|
+
warn(message: string, detail?: unknown): void;
|
|
200
|
+
}
|
|
201
|
+
/** Context passed to {@link Processor.processInput}. @public */
|
|
202
|
+
interface InputProcessorContext extends ProcessorControls {
|
|
203
|
+
/** The user message text for this send. */
|
|
204
|
+
message: string;
|
|
205
|
+
agentId: string;
|
|
206
|
+
}
|
|
207
|
+
/** Context passed to {@link Processor.processOutput}. @public */
|
|
208
|
+
interface OutputProcessorContext extends ProcessorControls {
|
|
209
|
+
/** The model's final assistant text for this run. */
|
|
210
|
+
text: string;
|
|
211
|
+
agentId: string;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* A guardrail processor. Provide `processInput` (runs before the LLM) and/or
|
|
215
|
+
* `processOutput` (runs on the final text). A processor's `strategy` (block /
|
|
216
|
+
* rewrite / redact / warn) is expressed via the {@link ProcessorControls}:
|
|
217
|
+
* return the transformed payload to rewrite/redact, `abort()` to block, `warn()`
|
|
218
|
+
* to report without blocking. The core ships no strategy enum — strategies are a
|
|
219
|
+
* processor-level convention over these primitives.
|
|
220
|
+
*
|
|
221
|
+
* @public
|
|
222
|
+
*/
|
|
223
|
+
interface Processor {
|
|
224
|
+
/** Stable id — surfaced on {@link ProcessorViolation} and {@link RunResult.tripwire}. */
|
|
225
|
+
id: string;
|
|
226
|
+
/**
|
|
227
|
+
* Transform or block the user message before it reaches the model. Return the
|
|
228
|
+
* (possibly rewritten) text; returning nothing (void) preserves the message
|
|
229
|
+
* unchanged. May be `async`.
|
|
230
|
+
*/
|
|
231
|
+
processInput?(ctx: InputProcessorContext): string | Promise<string> | void;
|
|
232
|
+
/**
|
|
233
|
+
* Transform or block the model's final text before it reaches the caller.
|
|
234
|
+
* Return the (possibly redacted) text; returning nothing (void) preserves the
|
|
235
|
+
* text unchanged. May be `async`.
|
|
236
|
+
*/
|
|
237
|
+
processOutput?(ctx: OutputProcessorContext): string | Promise<string> | void;
|
|
238
|
+
/** Fires on `abort()` and `warn()`. Errors thrown here are swallowed (never break the pipeline). */
|
|
239
|
+
onViolation?(violation: ProcessorViolation): void;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* The tripwire detail attached to {@link RunResult.tripwire} when a processor
|
|
243
|
+
* aborts, and carried by the `tripwire` run-event.
|
|
244
|
+
*
|
|
245
|
+
* @public
|
|
246
|
+
*/
|
|
247
|
+
interface ProcessorTripwire {
|
|
248
|
+
reason: string;
|
|
249
|
+
processorId: string;
|
|
250
|
+
}
|
|
251
|
+
|
|
157
252
|
/**
|
|
158
253
|
* Type-leaf — primitives shared between `agent.ts`, `run.ts`, and
|
|
159
254
|
* `messages.ts`. Extracted to break LOW type-only cycles #5 and #7
|
|
@@ -886,6 +981,18 @@ interface RunResult {
|
|
|
886
981
|
id: string;
|
|
887
982
|
status: "finished" | "error" | "cancelled";
|
|
888
983
|
result?: string;
|
|
984
|
+
/**
|
|
985
|
+
* SE24 — set when a guardrail processor called `abort()`. The run stops
|
|
986
|
+
* (`status: "cancelled"`) and `tripwire` carries the blocking reason +
|
|
987
|
+
* processor id. `undefined` on every non-guardrail outcome. A
|
|
988
|
+
* `throwOnError: true` agent resolves normally on a tripwire (status is
|
|
989
|
+
* `"cancelled"`, not `"error"`). On an OUTPUT block the model already ran, so
|
|
990
|
+
* `usage`/`cost` survive (billing) while `result` is suppressed; an INPUT
|
|
991
|
+
* block never reaches the model, so `usage` is absent.
|
|
992
|
+
*
|
|
993
|
+
* @public
|
|
994
|
+
*/
|
|
995
|
+
tripwire?: ProcessorTripwire;
|
|
889
996
|
model?: ModelSelection;
|
|
890
997
|
durationMs?: number;
|
|
891
998
|
git?: RunGitInfo;
|
|
@@ -1290,4 +1397,4 @@ interface GenerateRunResult<O> {
|
|
|
1290
1397
|
};
|
|
1291
1398
|
}
|
|
1292
1399
|
|
|
1293
|
-
export { type
|
|
1400
|
+
export { type SDKStatusMessage as $, type AgentConversationTurn as A, type RunOperation as B, type CustomTool as C, type DoomLoopThresholds as D, type RunPermissionDeniedEvent as E, type RunRateLimitEvent as F, type GenerateOptions as G, type RunStatus as H, type ImageBlock as I, type RunTaskCompletedEvent as J, type RunTaskStartedEvent as K, type RunTaskUpdatedEvent as L, type ModelSelection as M, type RunToCompletionOptions as N, type OutputProcessorContext as O, type Processor as P, type RunToCompletionResult as Q, type RunResult as R, type SDKMessage as S, type ToolResultContentBlock as T, type RunToolProgressEvent as U, type RunTripwireEvent as V, type SDKAssistantMessage as W, type SDKImage as X, type SDKImageDimension as Y, type SDKObjectDelta as Z, type SDKRequestMessage as _, type McpServerConfig as a, type SDKSystemMessage as a0, type SDKTaskMessage as a1, type SDKThinkingMessage as a2, type SDKToolUseMessage as a3, type SDKUserMessage as a4, type SDKUserMessageEvent as a5, type SendOptions as a6, type ShellCommand as a7, type ShellConversationTurn as a8, type ShellOutput as a9, type ShellOutputDeltaUpdate as aa, type StepCompletedUpdate as ab, type StepStartedUpdate as ac, type StreamToCompletionResult as ad, type SummaryCompletedUpdate as ae, type SummaryStartedUpdate as af, type SummaryUpdate as ag, type TextBlock as ah, type TextDeltaUpdate as ai, type ThinkingCompletedUpdate as aj, type ThinkingDeltaUpdate as ak, type ThinkingMessage as al, type TokenDeltaUpdate as am, type TokenUsage as an, type ToolCall as ao, type ToolCallCompletedUpdate as ap, type ToolCallStartedUpdate as aq, type ToolContextMessage as ar, type ToolResult as as, type ToolResultGuardOptions as at, type ToolUseBlock as au, type TurnEndedUpdate as av, type UserMessage as aw, type UserMessageAppendedUpdate as ax, emitRunEvent as ay, type Run as b, type MessageOrigin as c, type AssistantMessage as d, type ConversationStep as e, type ConversationTurn as f, type CostBreakdown as g, type CostSource as h, type CostStatus as i, type GenerateRunResult as j, type InputProcessorContext as k, type InteractionUpdate as l, type McpAuthConfig as m, type McpHttpServerConfig as n, type McpOAuthConfig as o, type McpStdioServerConfig as p, type ModelParameterValue as q, type PartialToolCallUpdate as r, type ProcessorControls as s, type ProcessorTripwire as t, type ProcessorViolation as u, type RunCompactBoundaryEvent as v, type RunErrorDetail as w, type RunEvent as x, type RunEventSink as y, type RunGitInfo as z };
|