@dudko.dev/agent 0.0.49 → 0.0.51

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/index.d.cts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { OAuthClientProvider, FetchLike, OAuthClientMetadata, OAuthClientInformationMixed, OAuthTokens, OAuthDiscoveryState } from '@modelcontextprotocol/client';
2
2
  import { Experimental_DecisionModel, ToolSet, Tool, ImageModel, SpeechModel, TranscriptionModel, LanguageModel, SystemModelMessage, ModelMessage } from 'ai';
3
+ import { PipelineEvent, PipelineNode, PipelineDefinition, PipelineResult, PipelineNodeRunner } from './pipeline-engine.cjs';
4
+ export { PIPELINE_LIMITS, PIPELINE_ROUTER_SYSTEM, PipelineAbortBehaviour, PipelineCondition, PipelineEdge, PipelineGraphRunOptions, PipelineIssue, PipelineNodeContext, PipelineNodeError, PipelineNodeEvent, PipelineNodeInput, PipelineNodeOutput, PipelineNodeSource, PipelinePlan, PipelineRoute, PipelineStop, PipelineTraceEntry, PipelineUsage, PipelineValidation, PipelineValidationError, matchPipelineRoute, normalizePipeline, preparePipeline, renderPipelineNodeInput, renderPipelineRoutePrompt, runPipelineGraph, testPipelineCondition, validatePipeline } from './pipeline-engine.cjs';
3
5
  import { JsonWebKey, KeyObject } from 'node:crypto';
4
6
 
5
7
  /**
@@ -128,201 +130,6 @@ interface IAiSdkDecisionOptions {
128
130
  }
129
131
  declare const decisionModelFromAiSdk: (model: Experimental_DecisionModel, options?: IAiSdkDecisionOptions) => IDecisionModel;
130
132
 
131
- interface PipelineDefinition {
132
- version: 1;
133
- name?: string;
134
- entry: string;
135
- nodes: PipelineNode[];
136
- edges: PipelineEdge[];
137
- limits?: {
138
- maxNodeVisits?: number;
139
- maxRuns?: number;
140
- };
141
- }
142
- interface PipelineNode {
143
- id: string;
144
- name?: string;
145
- instructions?: string;
146
- model?: string;
147
- skills?: string[];
148
- tools?: string[];
149
- mcpServers?: string[];
150
- routes?: PipelineRoute[];
151
- join?: 'all' | 'any';
152
- settings?: Record<string, unknown>;
153
- position?: {
154
- x: number;
155
- y: number;
156
- };
157
- }
158
- interface PipelineRoute {
159
- label: string;
160
- description?: string;
161
- }
162
- type PipelineCondition = {
163
- kind: 'always';
164
- } | {
165
- kind: 'contains';
166
- text: string;
167
- caseSensitive?: boolean;
168
- } | {
169
- kind: 'matches';
170
- pattern: string;
171
- flags?: string;
172
- } | {
173
- kind: 'route';
174
- label: string;
175
- } | {
176
- kind: 'otherwise';
177
- };
178
- interface PipelineEdge {
179
- id?: string;
180
- from: string;
181
- to: string;
182
- when?: PipelineCondition;
183
- }
184
- declare const PIPELINE_LIMITS: {
185
- readonly maxNodeVisits: 3;
186
- readonly maxRuns: 25;
187
- readonly maxNodeVisitsCeiling: 100;
188
- readonly maxRunsCeiling: 1000;
189
- readonly maxNodes: 200;
190
- readonly maxEdges: 1000;
191
- readonly maxRoutes: 20;
192
- readonly maxPatternLength: 500;
193
- readonly maxPatternProgram: 1000;
194
- readonly conditionInputChars: 50000;
195
- };
196
- interface PipelineUsage {
197
- inputTokens: number;
198
- outputTokens: number;
199
- totalTokens: number;
200
- reasoningTokens?: number;
201
- cachedInputTokens?: number;
202
- cacheWriteTokens?: number;
203
- }
204
- interface PipelineNodeSource {
205
- nodeId: string;
206
- name?: string;
207
- text: string;
208
- }
209
- interface PipelineNodeInput {
210
- request: string;
211
- from: PipelineNodeSource[];
212
- visit: number;
213
- }
214
- interface PipelineNodeOutput {
215
- text: string;
216
- usage?: PipelineUsage;
217
- route?: string;
218
- }
219
- interface PipelineNodeContext<E = never> {
220
- signal: AbortSignal;
221
- pipeline: PipelineDefinition;
222
- emit: (event: E) => void;
223
- }
224
- type PipelineNodeRunner<E = never> = (node: PipelineNode, input: PipelineNodeInput, ctx: PipelineNodeContext<E>) => Promise<PipelineNodeOutput>;
225
- type PipelineStop = 'maxRuns' | 'maxNodeVisits' | 'aborted';
226
- type PipelineEvent = {
227
- type: 'pipeline.started';
228
- pipeline?: string;
229
- } | {
230
- type: 'pipeline.node.started';
231
- nodeId: string;
232
- visit: number;
233
- from: string[];
234
- } | {
235
- type: 'pipeline.node.finished';
236
- nodeId: string;
237
- visit: number;
238
- text: string;
239
- route?: string;
240
- usage?: PipelineUsage;
241
- } | {
242
- type: 'pipeline.node.failed';
243
- nodeId: string;
244
- visit: number;
245
- error: string;
246
- } | {
247
- type: 'pipeline.node.skipped';
248
- nodeId: string;
249
- from: string[];
250
- reason: 'maxRuns' | 'maxNodeVisits';
251
- } | {
252
- type: 'pipeline.edge';
253
- from: string;
254
- to: string;
255
- edgeId: string;
256
- visit: number;
257
- fired: boolean;
258
- } | {
259
- type: 'pipeline.finished';
260
- stoppedBy?: PipelineStop;
261
- runs: number;
262
- };
263
- type PipelineTraceEntry = {
264
- type: 'node';
265
- nodeId: string;
266
- visit: number;
267
- wave: number;
268
- from: string[];
269
- text: string;
270
- route?: string;
271
- usage?: PipelineUsage;
272
- } | {
273
- type: 'edge';
274
- from: string;
275
- to: string;
276
- edgeId: string;
277
- visit: number;
278
- fired: boolean;
279
- } | {
280
- type: 'dropped';
281
- nodeId: string;
282
- from: string[];
283
- reason: 'maxRuns' | 'maxNodeVisits';
284
- };
285
- interface PipelineResult {
286
- text: string;
287
- outputs: Record<string, {
288
- visit: number;
289
- text: string;
290
- route?: string;
291
- }[]>;
292
- trace: PipelineTraceEntry[];
293
- usage: PipelineUsage;
294
- stoppedBy?: PipelineStop;
295
- runs: number;
296
- }
297
- interface PipelineIssue {
298
- code: string;
299
- message: string;
300
- nodeId?: string;
301
- edgeId?: string;
302
- edgeIndex?: number;
303
- }
304
- interface PipelineValidation {
305
- ok: boolean;
306
- errors: PipelineIssue[];
307
- warnings: PipelineIssue[];
308
- }
309
- declare class PipelineValidationError extends Error {
310
- errors: PipelineIssue[];
311
- constructor(errors: PipelineIssue[]);
312
- }
313
- declare class PipelineNodeError extends Error {
314
- nodeId: string;
315
- visit: number;
316
- constructor(nodeId: string, visit: number, cause: unknown);
317
- }
318
- declare const testPipelineCondition: (when: PipelineCondition | undefined, output: {
319
- text: string;
320
- route?: string;
321
- }, matcher?: (text: string) => boolean) => boolean;
322
- declare const normalizePipeline: (definition: PipelineDefinition) => PipelineDefinition;
323
- declare const validatePipeline: (definition: PipelineDefinition) => PipelineValidation;
324
- declare const renderPipelineNodeInput: (input: PipelineNodeInput) => string;
325
-
326
133
  type EgressErrorCode = 'disabled' | 'bad-url' | 'bad-protocol' | 'bad-port' | 'bad-method' | 'credentials-in-url' | 'denied-host' | 'not-allowed-host' | 'denied-address' | 'dns' | 'bad-redirect' | 'too-many-redirects' | 'too-large' | 'timeout';
327
134
  declare class EgressError extends Error {
328
135
  readonly code: EgressErrorCode;
@@ -876,9 +683,15 @@ interface McpServerProtocol {
876
683
  * (`selectMcpSkills`), the files of a loaded skill the model may read (`resolveMcpSkillFile`),
877
684
  * the preamble a skill's text is loaded under, the mark that carries a server's skills on its
878
685
  * tools (`markMcpSkills` / `collectMcpSkillSources`), a skill the model names by URI
879
- * (`mcpSkillUriRefusal`, `resolveMcpSkillServer`: `skills/get` to that one server only) and the
686
+ * (`mcpSkillUriRefusal`, `resolveMcpSkillServer`: `skills/get` to that one server only), the
880
687
  * person's consent before a skill's text enters the model's context (`decideMcpSkillConsent`,
881
- * `mcpSkillConsentView`). Pure, no imports.
688
+ * `mcpSkillConsentView`) and a directory of a skill (`skillDirectoryOf`, `resolveMcpSkillPath`,
689
+ * `skillDirectoryListing` - for every kind of skill - and, for a server that serves
690
+ * `resources/directory/read`, `compareMcpSkillDirectory`) and, for a server the host trusts with
691
+ * its generated skills (`skills: { dynamic: true }`), the snapshot such a skill is read into
692
+ * before anyone is asked (`startMcpSkillWalk`, `takeMcpSkillWalkListing`,
693
+ * `mcpSkillSnapshotBytesRefusal`, `mcpSkillSnapshotEntry`). Pure, no imports (a digest is
694
+ * computed with the platform's WebCrypto, `globalThis.crypto.subtle`, or a function passed in).
882
695
  *
883
696
  * A server's skills are third-party text. They reach the model only as knowledge, under
884
697
  * `mcpSkillPreamble`, and - unless the host vetted the server (`consent: 'never'`) - only after a
@@ -915,19 +728,47 @@ declare const MCP_SKILL_FILE_MAX_CHARS = 32000;
915
728
  * naming rules;
916
729
  * - a description to show in the catalog;
917
730
  * - `resources` is the complete list of its files (Resources): `"dynamic"` content is declined
918
- * (a host MAY: there is nothing to verify it against), anything else is invalid;
731
+ * (a host MAY: there is nothing to verify it against, and a consent could not bind to its
732
+ * content) - unless `options.dynamic` (the server's `skills: { dynamic: true }`: the host
733
+ * trusts that server with its generated skills, which are then read into a snapshot before
734
+ * anyone is asked, see {@link mcpSkillSnapshotEntry}); anything else is invalid;
919
735
  * - every file is `SKILL.md` or a file inside the skill's directory, listed once, with a
920
736
  * `sha256:` digest and a byte size, and `SKILL.md` is listed;
921
737
  * - at most {@link MCP_SKILL_MAX_RESOURCES} files and {@link MCP_SKILL_MAX_TOTAL_BYTES} bytes
922
- * (Limits: "both limits are checkable from the entry alone").
738
+ * (Limits: "both limits are checkable from the entry alone"; a generated skill's are counted
739
+ * on what its snapshot reads).
923
740
  */
924
- declare const mcpSkillEntryRefusal: (entry: unknown) => string | undefined;
741
+ declare const mcpSkillEntryRefusal: (entry: unknown, options?: {
742
+ dynamic?: boolean;
743
+ }) => string | undefined;
925
744
  /**
926
745
  * How a skill of a server is introduced wherever its text is shown to the model (its
927
746
  * instructions, and each file of it): third-party knowledge that cannot change the rules. The
928
747
  * wording is the guard.
929
748
  */
930
749
  declare const mcpSkillPreamble: (server: string, uri: string) => string;
750
+ /**
751
+ * The most entries of one `resources/directory/read` answer looked at: the specification's 512
752
+ * files per skill, and room for the directories among them. The rest are not looked at.
753
+ */
754
+ declare const MCP_SKILL_DIRECTORY_ENTRIES_MAX: number;
755
+ /** What `read_skill_file` answers for a directory of a skill (every path inside the skill). */
756
+ interface SkillDirectoryListing {
757
+ /** The skill's name in the catalog. */
758
+ name: string;
759
+ /** The directory: `.` for the skill's root, else its path inside the skill. */
760
+ directory: string;
761
+ /** Its files (each read with `read_skill_file`), sorted. */
762
+ files: string[];
763
+ /** Its subdirectories (each listed the same way), sorted. */
764
+ directories: string[];
765
+ /** How many more it holds than the two lists show ({@link MCP_SKILL_FILES_SHOWN_MAX} in all). */
766
+ more?: number;
767
+ /** Shown above, but no longer listed by the skill's MCP server: a read of them will fail. */
768
+ notServed?: string[];
769
+ /** The skill changed on its MCP server since it was loaded ({@link mcpSkillDirectoryNote}). */
770
+ note?: string;
771
+ }
931
772
  /** The longest URI `load_skill` sends to a server, in characters. */
932
773
  declare const MCP_SKILL_URI_MAX_CHARS = 512;
933
774
  /**
@@ -957,6 +798,16 @@ interface McpSkillsOptions {
957
798
  * vetted (its skills load as soon as the model asks). Whatever the approval mode says.
958
799
  */
959
800
  consent?: McpSkillConsent;
801
+ /**
802
+ * `true`: also take this server's GENERATED skills (`"resources": "dynamic"` - no checksums;
803
+ * declined by default). When one would enter the model's context, the agent first reads all
804
+ * of it - `SKILL.md` and, if the server serves `resources/directory/read`, every file its
805
+ * directories list, within the specification's limits - computes each file's digest itself,
806
+ * and holds that copy in memory: the person approves that copy (the consent binds to its
807
+ * digests), and the model is given only that copy, never a later read. Per server, for a
808
+ * server you trust with this; there is no agent-wide switch.
809
+ */
810
+ dynamic?: boolean;
960
811
  }
961
812
  /** `skills` on a server's config: `true`, or options (on, with them); `false` / absent: off. */
962
813
  type McpSkillsSetting = boolean | McpSkillsOptions;
@@ -988,9 +839,104 @@ interface McpSkillConsentView {
988
839
  byUri?: true;
989
840
  /** It sits inside this skill of the same server, whose approval does not cover it. */
990
841
  nestedIn?: string;
842
+ /**
843
+ * Generated by the server (`"resources": "dynamic"`, taken with `skills: { dynamic: true }`):
844
+ * there are no checksums. The size, the files and the text are those of the copy the agent just
845
+ * read (its snapshot), and only that copy is used - say so.
846
+ */
847
+ dynamic?: true;
848
+ /**
849
+ * (with `dynamic`) The server cannot list the skill's files (no `resources/directory/read`): the
850
+ * copy is its `SKILL.md` alone, and no other file of it can be read.
851
+ */
852
+ noFileListing?: true;
991
853
  /** Asked for this run only (`'ask'`) or, on a yes, for the agent's life (`'once-per-skill'`). */
992
854
  consent: Exclude<McpSkillConsent, 'never'>;
993
855
  }
856
+ /**
857
+ * The most directories one snapshot reads (`resources/directory/read`, the skill's root
858
+ * included). One read is one directory, its pages walked by the SDK (bounded by its own page cap).
859
+ */
860
+ declare const MCP_SKILL_SNAPSHOT_MAX_DIRECTORIES = 64;
861
+ /** The deepest directory of a skill a snapshot reads: its root is 0, `templates` 1, ... */
862
+ declare const MCP_SKILL_SNAPSHOT_MAX_DEPTH = 8;
863
+ /** The most bytes the snapshots of one agent hold in memory together. */
864
+ declare const MCP_SKILL_SNAPSHOTS_MAX_BYTES: number;
865
+
866
+ interface IRunLease {
867
+ acquire: (runId: string, options: IRunLeaseOptions) => boolean | Promise<boolean>;
868
+ renew: (runId: string, options: IRunLeaseOptions) => boolean | Promise<boolean>;
869
+ release: (runId: string, options: {
870
+ owner: string;
871
+ }) => void | Promise<void>;
872
+ ttlMs?: number;
873
+ owner?: string;
874
+ }
875
+ interface IRunLeaseOptions {
876
+ owner: string;
877
+ ttlMs: number;
878
+ }
879
+ type RunLeaseLostReason = 'refused' | 'error' | 'expired';
880
+ declare class RunLeaseError extends Error {
881
+ readonly runId: string;
882
+ readonly owner: string;
883
+ readonly lost: boolean;
884
+ readonly reason: RunLeaseLostReason;
885
+ constructor(runId: string, owner: string, lost: boolean, reason: RunLeaseLostReason, detail?: string, options?: {
886
+ cause?: unknown;
887
+ });
888
+ toJSON(): string;
889
+ }
890
+ declare const RUN_LEASE_DEFAULT_TTL_MS = 30000;
891
+
892
+ declare const isModelCallRefused: (err: unknown, seen?: Set<unknown>) => boolean;
893
+ declare const redactHeaders: (headers: Record<string, string> | undefined) => Record<string, string> | undefined;
894
+ type IFilledUsage = Required<Omit<IUsage, 'decisionCalls' | keyof IMediaUsage>> & Pick<IUsage, 'decisionCalls'> & Partial<IMediaUsage>;
895
+ interface ISdkUsageLike {
896
+ inputTokens?: number;
897
+ outputTokens?: number;
898
+ totalTokens?: number;
899
+ inputTokenDetails?: {
900
+ cacheReadTokens?: number;
901
+ cacheWriteTokens?: number;
902
+ };
903
+ outputTokenDetails?: {
904
+ reasoningTokens?: number;
905
+ };
906
+ decisionCalls?: number;
907
+ reasoningTokens?: number;
908
+ cachedInputTokens?: number;
909
+ mediaCalls?: number;
910
+ imagesGenerated?: number;
911
+ speechCharacters?: number;
912
+ transcriptionSeconds?: number;
913
+ }
914
+ declare const normalizeUsage: (usage: ISdkUsageLike | undefined | null) => IFilledUsage;
915
+ declare const isAuthError: (err: unknown, seen?: Set<unknown>) => boolean;
916
+ declare const addUsage: (a: IUsage, b: IUsage) => IFilledUsage;
917
+
918
+ type ModelCallStage = AgentStage | 'compaction' | 'route';
919
+ interface IModelCall {
920
+ runId?: string;
921
+ stage: ModelCallStage;
922
+ provider?: string;
923
+ modelId: string;
924
+ estimatedInputTokens?: number;
925
+ maxOutputTokens?: number;
926
+ }
927
+ interface ISharedLimits {
928
+ beforeModelCall: (call: IModelCall, context: {
929
+ signal?: AbortSignal;
930
+ }) => void | Promise<void>;
931
+ afterModelCall?: (call: IModelCall, usage: IUsage, outcome: {
932
+ ok: boolean;
933
+ }) => void | Promise<void>;
934
+ }
935
+ declare class ModelCallRefusedError extends Error {
936
+ readonly call: IModelCall;
937
+ constructor(call: IModelCall, cause: unknown);
938
+ toJSON(): string;
939
+ }
994
940
 
995
941
  declare const SPAWN_SUBAGENT_TOOL = "spawn_subagent";
996
942
  type SubagentDefaultTools = 'read-only' | 'all';
@@ -1049,7 +995,7 @@ declare const SPAWN_INPUT_SCHEMA: {
1049
995
  readonly description: "Optional: the names of YOUR tools the helper may use. Only tools you have can be named. Omit it for the default set; pass [] for a helper that only reasons.";
1050
996
  };
1051
997
  };
1052
- readonly required: readonly ["task"];
998
+ readonly required: string[];
1053
999
  readonly additionalProperties: false;
1054
1000
  };
1055
1001
  /**
@@ -1173,11 +1119,14 @@ interface IToolApprovalRequest {
1173
1119
  interface IToolApprovalContext {
1174
1120
  signal: AbortSignal;
1175
1121
  }
1176
- type ToolApprovalDecision = boolean | {
1122
+ type ToolApprovalAnswer = boolean | {
1177
1123
  approved: boolean;
1178
1124
  reason?: string;
1179
1125
  remember?: boolean;
1180
1126
  };
1127
+ type ToolApprovalDecision = ToolApprovalAnswer | {
1128
+ park: true;
1129
+ };
1181
1130
  interface IToolApprovalConfig {
1182
1131
  mode?: ToolApprovalMode;
1183
1132
  rules?: Record<string, ToolPermission>;
@@ -1274,6 +1223,8 @@ interface IAgentConfig {
1274
1223
  llmMaxRetries?: number;
1275
1224
  maxConcurrentRuns?: number;
1276
1225
  persistence?: IPersistence;
1226
+ runLease?: IRunLease;
1227
+ sharedLimits?: ISharedLimits;
1277
1228
  toolSelectionStrategy?: ToolSelectionStrategy;
1278
1229
  inputSanitizer?: (toolName: string, input: unknown) => unknown | Promise<unknown>;
1279
1230
  outputSanitizer?: (toolName: string, output: unknown) => unknown | Promise<unknown>;
@@ -1451,6 +1402,7 @@ type AgentEventBody = {
1451
1402
  approved: boolean;
1452
1403
  reason?: string;
1453
1404
  automatic: boolean;
1405
+ parked?: true;
1454
1406
  } | {
1455
1407
  type: 'mcp.elicitation-requested';
1456
1408
  id: string;
@@ -1547,6 +1499,20 @@ type AgentEventBody = {
1547
1499
  } | {
1548
1500
  type: 'revisions.exceeded';
1549
1501
  cap: number;
1502
+ } | {
1503
+ type: 'lease.lost';
1504
+ owner: string;
1505
+ reason: RunLeaseLostReason;
1506
+ error?: string;
1507
+ } | {
1508
+ type: 'run.parked';
1509
+ items: ParkedItem[];
1510
+ at: number;
1511
+ } | {
1512
+ type: 'journal.diverged';
1513
+ position: string;
1514
+ kind: 'model' | 'tool';
1515
+ stage?: ModelCallStage;
1550
1516
  } | {
1551
1517
  type: 'error';
1552
1518
  error: Error;
@@ -1554,6 +1520,8 @@ type AgentEventBody = {
1554
1520
  } | PipelineEvent;
1555
1521
  type AgentEvent = AgentEventBody & {
1556
1522
  runId?: string;
1523
+ seq?: number;
1524
+ attempt?: number;
1557
1525
  nodeId?: string;
1558
1526
  visit?: number;
1559
1527
  };
@@ -1571,9 +1539,39 @@ interface IAgentRunOptions {
1571
1539
  onEvent?: EventHandler;
1572
1540
  onStepStart?: (info: IStepStartInfo) => void;
1573
1541
  resumeFromRunId?: string;
1542
+ runId?: string;
1574
1543
  control?: RunControl;
1544
+ answers?: Record<string, ParkAnswer>;
1545
+ }
1546
+ type ToolResultAnswer = {
1547
+ output: unknown;
1548
+ } | {
1549
+ error: string;
1550
+ };
1551
+ type ParkAnswer = ToolApprovalAnswer | ToolResultAnswer;
1552
+ type ParkedItem = {
1553
+ id: string;
1554
+ kind: 'approval';
1555
+ request: IToolApprovalRequest;
1556
+ } | {
1557
+ id: string;
1558
+ kind: 'tool';
1559
+ toolName: string;
1560
+ input: unknown;
1561
+ note?: string;
1562
+ step?: IPlanStep;
1563
+ subagent?: {
1564
+ id: string;
1565
+ depth: number;
1566
+ };
1567
+ };
1568
+ interface IParkedRun {
1569
+ runId: string;
1570
+ items: ParkedItem[];
1571
+ at: number;
1575
1572
  }
1576
1573
  interface IAgentRunResult {
1574
+ runId?: string;
1577
1575
  text: string;
1578
1576
  plan: IPlan;
1579
1577
  trace: IStepResult[];
@@ -1581,11 +1579,12 @@ interface IAgentRunResult {
1581
1579
  usage: IUsage;
1582
1580
  compactedHistory?: IConversationTurn[];
1583
1581
  undelivered?: string[];
1582
+ parked?: IParkedRun;
1584
1583
  }
1585
1584
  interface IRunSnapshot {
1586
1585
  runId: string;
1587
1586
  startedAt: number;
1588
- status: 'executing' | 'complete' | 'failed' | 'cancelled';
1587
+ status: 'executing' | 'waiting' | 'complete' | 'failed' | 'cancelled';
1589
1588
  input: string;
1590
1589
  history?: IConversationTurn[];
1591
1590
  plan?: IPlan;
@@ -1607,13 +1606,79 @@ interface IRunSnapshot {
1607
1606
  }[];
1608
1607
  escalations?: number;
1609
1608
  subagentsSpawned?: number;
1609
+ attempt?: number;
1610
+ leaseOwner?: string;
1611
+ parked?: IParkedRun;
1610
1612
  }
1611
1613
  interface IPersistence {
1612
1614
  onRunStart?: (snapshot: IRunSnapshot) => void | Promise<void>;
1613
1615
  onStepComplete?: (snapshot: IRunSnapshot) => void | Promise<void>;
1614
1616
  onRunComplete?: (snapshot: IRunSnapshot) => void | Promise<void>;
1617
+ onRunResume?: (snapshot: IRunSnapshot) => void | Promise<void>;
1618
+ onRunPark?: (snapshot: IRunSnapshot) => void | Promise<void>;
1615
1619
  loadRun?: (runId: string) => IRunSnapshot | null | Promise<IRunSnapshot | null>;
1620
+ journal?: IRunJournal;
1621
+ }
1622
+ interface IRunJournal {
1623
+ append: (runId: string, entry: IJournalEntry) => void | Promise<void>;
1624
+ load: (runId: string) => IJournalEntry[] | Promise<IJournalEntry[]>;
1625
+ }
1626
+ interface IJournalEntryBase {
1627
+ id: string;
1628
+ position: string;
1629
+ attempt: number;
1630
+ at: number;
1616
1631
  }
1632
+ interface IJournalModelEntry extends IJournalEntryBase {
1633
+ kind: 'model';
1634
+ stage: ModelCallStage;
1635
+ hash: string;
1636
+ call: 'stream' | 'generate';
1637
+ response: {
1638
+ parts?: Record<string, unknown>[];
1639
+ content?: Record<string, unknown>[];
1640
+ finishReason: unknown;
1641
+ providerMetadata?: unknown;
1642
+ meta?: {
1643
+ id?: string;
1644
+ modelId?: string;
1645
+ timestamp?: string;
1646
+ };
1647
+ };
1648
+ usage: IUsage;
1649
+ }
1650
+ interface IJournalToolEntry extends IJournalEntryBase {
1651
+ kind: 'tool';
1652
+ parent: string;
1653
+ tool: string;
1654
+ hash: string;
1655
+ ok: boolean;
1656
+ model?: unknown;
1657
+ output?: unknown;
1658
+ error?: {
1659
+ name: string;
1660
+ message: string;
1661
+ };
1662
+ answered?: true;
1663
+ }
1664
+ interface IJournalPendingEntry extends IJournalEntryBase {
1665
+ kind: 'pending';
1666
+ parent: string;
1667
+ hash: string;
1668
+ item: ParkedItem;
1669
+ }
1670
+ interface IJournalAnswerEntry extends IJournalEntryBase {
1671
+ kind: 'answer';
1672
+ parent: string;
1673
+ hash: string;
1674
+ itemId: string;
1675
+ answer: {
1676
+ approved: boolean;
1677
+ reason?: string;
1678
+ remember?: boolean;
1679
+ };
1680
+ }
1681
+ type IJournalEntry = IJournalModelEntry | IJournalToolEntry | IJournalPendingEntry | IJournalAnswerEntry;
1617
1682
 
1618
1683
  interface ICloseOptions {
1619
1684
  waitForRuns?: boolean;
@@ -1650,6 +1715,7 @@ interface IAgent {
1650
1715
  reconnect: () => Promise<void>;
1651
1716
  close: (options?: ICloseOptions) => Promise<void>;
1652
1717
  activeRuns: () => number;
1718
+ readonly leaseOwner?: string;
1653
1719
  }
1654
1720
  declare const createAgent: (config: IAgentConfig, baseEventHandler?: EventHandler) => Promise<IAgent>;
1655
1721
 
@@ -1706,33 +1772,41 @@ declare const TOOL_APPROVAL_TIMEOUT_MS = 300000;
1706
1772
  declare const REPLAY_NOTE = "[not run again: this exact call already succeeded in an earlier attempt at this step, and its effect is in place. Its result then:]";
1707
1773
  declare const isReplayedToolOutput: (output: unknown) => boolean;
1708
1774
 
1775
+ /** The bounds on what comes from outside the run (a deferred call's note, an answer). */
1776
+ declare const JOURNAL_LIMITS: Readonly<{
1777
+ noteChars: 2000;
1778
+ answerChars: 1000000;
1779
+ errorChars: 4000;
1780
+ answerDepth: 64;
1781
+ }>;
1782
+ declare const DEFERRED: unique symbol;
1783
+ /** What `deferResult()` returns. Opaque: return it from a tool's `execute`. */
1784
+ interface IDeferredResult {
1785
+ readonly [DEFERRED]: true;
1786
+ readonly note?: string;
1787
+ }
1788
+ /**
1789
+ * Return this from a tool's `execute` when its result will come from outside the run, later (a
1790
+ * long job, a webhook, a review in another system). The run parks at the end of the tool round;
1791
+ * the host resumes it with the result as the answer to that item. Needs `persistence.journal`:
1792
+ * without it the call fails with a clear error. `note` (clipped, invisible characters removed)
1793
+ * is shown with the parked item.
1794
+ */
1795
+ declare const deferResult: (options?: {
1796
+ note?: string;
1797
+ }) => IDeferredResult;
1798
+ declare const isDeferredResult: (value: unknown) => value is IDeferredResult;
1799
+ /** An append to (or a read of) the journal failed: the run cannot go on with an exact record. */
1800
+ declare class JournalError extends Error {
1801
+ constructor(message: string, options?: {
1802
+ cause?: unknown;
1803
+ });
1804
+ toJSON(): string;
1805
+ }
1806
+
1709
1807
  declare const getCurrentRunId: () => string | undefined;
1710
1808
  declare const getCurrentRunSandbox: () => string | undefined;
1711
1809
 
1712
- declare const redactHeaders: (headers: Record<string, string> | undefined) => Record<string, string> | undefined;
1713
- type IFilledUsage = Required<Omit<IUsage, 'decisionCalls' | keyof IMediaUsage>> & Pick<IUsage, 'decisionCalls'> & Partial<IMediaUsage>;
1714
- interface ISdkUsageLike {
1715
- inputTokens?: number;
1716
- outputTokens?: number;
1717
- totalTokens?: number;
1718
- inputTokenDetails?: {
1719
- cacheReadTokens?: number;
1720
- cacheWriteTokens?: number;
1721
- };
1722
- outputTokenDetails?: {
1723
- reasoningTokens?: number;
1724
- };
1725
- decisionCalls?: number;
1726
- reasoningTokens?: number;
1727
- cachedInputTokens?: number;
1728
- mediaCalls?: number;
1729
- imagesGenerated?: number;
1730
- speechCharacters?: number;
1731
- transcriptionSeconds?: number;
1732
- }
1733
- declare const normalizeUsage: (usage: ISdkUsageLike | undefined | null) => IFilledUsage;
1734
- declare const addUsage: (a: IUsage, b: IUsage) => IFilledUsage;
1735
-
1736
1810
  /**
1737
1811
  * OAuth 2.1 for remote MCP servers, from Node.
1738
1812
  *
@@ -2546,6 +2620,16 @@ interface Pipeline {
2546
2620
  run: (options: PipelineRunOptions) => Promise<PipelineResult>;
2547
2621
  close: () => Promise<void>;
2548
2622
  }
2623
+ interface PipelineRouteOptions {
2624
+ config: IAgentConfig;
2625
+ signal?: AbortSignal;
2626
+ onEvent?: EventHandler;
2627
+ }
2628
+ interface PipelineRouteResult {
2629
+ route?: string;
2630
+ usage: IUsage;
2631
+ }
2632
+ declare const pickPipelineRoute: (node: PipelineNode, text: string, options: PipelineRouteOptions) => Promise<PipelineRouteResult>;
2549
2633
  declare const createPipeline: (definition: PipelineDefinition, options: PipelineOptions) => Pipeline;
2550
2634
  type PipelineModelConfig = Pick<IAgentConfig, 'model'> & Partial<Pick<IAgentConfig, 'providerType' | 'baseURL' | 'apiKey' | 'providerOptions' | 'planner' | 'synthesizer' | 'executorTiers'>>;
2551
2635
  interface NodeResolverOptions {
@@ -2558,23 +2642,59 @@ interface NodeResolverOptions {
2558
2642
  }
2559
2643
  declare const nodeResolver: (options: NodeResolverOptions) => NonNullable<PipelineOptions["resolveNode"]>;
2560
2644
 
2561
- type SubagentIsolation = 'worker' | 'in-process';
2645
+ type SubagentIsolation = 'worker' | 'in-process' | 'remote';
2562
2646
  interface ISubagentProfile {
2563
2647
  description: string;
2564
2648
  config?: Partial<IAgentConfig>;
2565
2649
  }
2566
- interface ISubagentToolOptions {
2650
+ interface ISubagentToolBase {
2567
2651
  name: string;
2568
2652
  description: string;
2569
- config: IAgentConfig;
2570
- isolation?: SubagentIsolation;
2571
- tools?: ToolSet;
2572
2653
  maxConcurrent?: number;
2573
2654
  timeoutMs?: number;
2574
2655
  outputMaxChars?: number;
2575
2656
  readOnly?: boolean;
2657
+ }
2658
+ interface ILocalSubagentToolOptions extends ISubagentToolBase {
2659
+ config: IAgentConfig;
2660
+ isolation?: 'worker' | 'in-process';
2661
+ tools?: ToolSet;
2576
2662
  profiles?: Record<string, ISubagentProfile>;
2663
+ dispatch?: never;
2577
2664
  }
2665
+ interface IRemoteSubagentTask {
2666
+ id: string;
2667
+ name: string;
2668
+ profile?: string;
2669
+ input: string;
2670
+ parentRunId?: string;
2671
+ rootRunId?: string;
2672
+ depth: number;
2673
+ }
2674
+ interface IRemoteSubagentContext {
2675
+ signal: AbortSignal;
2676
+ emit: (event: AgentEvent) => void;
2677
+ }
2678
+ interface IRemoteSubagentResult {
2679
+ text: string;
2680
+ usage?: IUsage;
2681
+ }
2682
+ type RemoteSubagentDispatch = (task: IRemoteSubagentTask, context: IRemoteSubagentContext) => Promise<IRemoteSubagentResult | IDeferredResult>;
2683
+ interface IRemoteSubagentToolOptions extends ISubagentToolBase {
2684
+ isolation: 'remote';
2685
+ dispatch: RemoteSubagentDispatch;
2686
+ profiles?: Record<string, {
2687
+ description: string;
2688
+ }>;
2689
+ config?: never;
2690
+ tools?: never;
2691
+ }
2692
+ type ISubagentToolOptions = ILocalSubagentToolOptions | IRemoteSubagentToolOptions;
2693
+ declare const REMOTE_SUBAGENT_LIMITS: {
2694
+ readonly maxEvents: 10000;
2695
+ readonly maxEventChars: 64000;
2696
+ readonly maxTypeChars: 64;
2697
+ };
2578
2698
  /**
2579
2699
  * Expose a whole agent as ONE tool of a parent agent: input `{ task }`,
2580
2700
  * output the child's final text. Calls in one model step run in parallel
@@ -2584,5 +2704,5 @@ interface ISubagentToolOptions {
2584
2704
  */
2585
2705
  declare const createSubagentTool: (opts: ISubagentToolOptions) => Tool;
2586
2706
 
2587
- export { DEFAULT_COMPACTION_THRESHOLD_RATIO, DEFAULT_DECISION_CONFIDENCE_THRESHOLD, DEFAULT_DECISION_TIMEOUT_MS, DirSkillStore, ENTERPRISE_MANAGED_AUTHORIZATION_EXTENSION, EgressError, EnterpriseOAuthError, FORGET_SKILL_TOOL, FileOAuthStore, GENERATE_IMAGE_TOOL, GENERATE_SPEECH_TOOL, MCP_ELICITATION_MAX_PER_RUN, MCP_ELICITATION_MAX_PER_TOOL_CALL, MCP_ELICITATION_TIMEOUT_MS, MCP_INSTRUCTIONS_MAX_CHARS_PER_SERVER, MCP_INSTRUCTIONS_MAX_CHARS_TOTAL, MCP_MODERN_PROTOCOL_VERSION, MCP_SKILLS_EXTENSION, MCP_SKILLS_MAX_PER_SERVER, MCP_SKILLS_MAX_TOTAL, MCP_SKILL_BODY_MAX_CHARS, MCP_SKILL_CONSENTS, MCP_SKILL_CONSENT_DEFAULT, MCP_SKILL_DESCRIPTION_MAX_CHARS, MCP_SKILL_FILE_MAX_CHARS, MCP_SKILL_MAX_RESOURCES, MCP_SKILL_MAX_TOTAL_BYTES, MCP_SKILL_URI_MAX_CHARS, MEDIA_AUDIO_TYPES, MEDIA_DEFAULT_MAX_CALLS, MEDIA_FOLDER, MEDIA_IMAGE_TYPES, MEDIA_MAX_ATTACHED_AUDIO, MEDIA_MAX_AUDIO_INPUT_BYTES, MEDIA_MAX_IMAGE_BYTES, MEDIA_MAX_PROMPT_CHARS, MEDIA_MAX_SPEECH_BYTES, MEDIA_MAX_SPEECH_CHARS, MEDIA_MAX_TRANSCRIPT_CHARS, MEDIA_TIMEOUT_MS, MediaBudgetError, MediaError, MemoryOAuthStore, MemorySkillStore, NodeEnterpriseOAuthProvider, NodeOAuthProvider, PIPELINE_LIMITS, PipelineNodeError, PipelineValidationError, REPLAY_NOTE, RUN_JS_TOOL, SAVE_SKILL_TOOL, SEARCH_API_BASE_URL, SEARCH_DEFAULT_MAX_RESULTS, SEARCH_GOOGLE_DEFAULT_MODEL, SEARCH_GOOGLE_NOTE, SEARCH_MAX_QUERY_CHARS, SEARCH_MAX_RESULTS, SEARCH_MAX_SNIPPET_CHARS, SEARCH_MAX_SUMMARY_CHARS, SEARCH_MAX_TITLE_CHARS, SEARCH_MAX_TOTAL_CHARS, SEARCH_MAX_URL_CHARS, SEARCH_PROVIDERS, SPAWN_INPUT_SCHEMA, SPAWN_SUBAGENT_TOOL, SUBAGENT_DEFAULTS, SUBAGENT_MAX_DEPTH_LIMIT, SUMMARY_PREFIX, SandboxUnavailableError, SubagentSpawnError, TOOL_APPROVAL_TIMEOUT_MS, TRANSCRIBE_AUDIO_TOOL, ToolBudgetError, ToolDeniedError, WEB_FETCH_TOOL, WEB_SEARCH_TOOL, acceptMedia, addUsage, adoptSubagentEvent, askDecisionModel, beginMcpOAuth, buildInstructions, buildMediaModelFromStage, buildSearchRequest, checkAuthorizationResponseIssuer, checkEgressUrl, checkLimits, checkRedirect, classifyAddress, compactHistory, createAgent, createEgressTools, createEnterpriseOAuthProvider, createLearning, createMedia, createNodeOAuthProvider, createPipeline, createRunControl, createSafeFetch, createSandboxTool, createSandboxTools, createSearchTools, createSubagentTool, createToolResultClearer, createWebFetchTool, createWebSearchTool, decideToolPermission, decisionModelFromAiSdk, defineSkill, estimateTokens, findSecret, finishMcpOAuth, getCurrentRunId, getCurrentRunSandbox, hostMatches, htmlToText, isCodeExecutionTool, isReadOnlyTool, isReplayedToolOutput, loadSkillsFromDir, markCodeExecution, markReadOnly, matchToolRule, mcpSkillEntryRefusal, mcpSkillPreamble, mcpSkillUriRefusal, mediaUsageOf, mergeProviderOptions, nodeResolver, normalizeMcpElicitationSchema, normalizePipeline, normalizeSkillName, normalizeUsage, parseSearchResponse, parseSkillMarkdown, redactHeaders, renderMcpInstructions, renderPipelineNodeInput, resolveCompaction, resolveDynamicSubagents, resolveEgressPolicy, resolveLimits, resolvePromptCaching, resolveSandboxLimits, resolveThinking, sanitizeSearchResults, searchEgressPolicy, searchStatusMessage, searchToolResult, searchTools, sniffMediaType, testPipelineCondition, truncateToolModelOutput, validateMcpElicitationContent, validatePipeline, withRollingBreakpoint, withToolOutputLimit, wrapTranscript };
2588
- export type { AgentEvent, AgentStage, BudgetKind, DecisionFallbackReason, DecisionPoint, EgressErrorCode, EnterpriseAssertionAlgorithm, EnterpriseAssertionAudience, EnterpriseAssertionType, EnterpriseOAuthHop, EnterpriseOAuthLog, EnterprisePrivateKey, EscalationReason, EventHandler, IAgent, IAgentConfig, IAgentRunOptions, IAgentRunResult, IAgentStageOverride, IAiSdkDecisionOptions, IClearedInfo, ICloseOptions, ICompactHistoryOptions, ICompactHistoryResult, ICompactOptions, ICompactResult, ICompactionConfig, IConversationTurn, IDecisionAnswer, IDecisionCallOptions, IDecisionConfig, IDecisionEvent, IDecisionModel, IDecisionOption, IDecisionOutcome, IDecisionQuestion, IDynamicSubagentsConfig, IEgressPolicy, IEnterpriseIdpOptions, IEnterpriseOAuthProviderOptions, IEscalationConfig, ILearning, ILearningConfig, ILimitBreach, IMcpHttpServerConfig, IMcpServerConfig, IMcpSkillOrigin, IMcpStdioServerConfig, IMedia, IMediaConfig, IMediaFile, IMediaModelSpec, IMediaUsage, INodeOAuthProviderOptions, IOAuthRequestOptions, IOAuthStore, IPersistence, IPlan, IPlanStep, IResolvedAddress, IResolvedDynamicSubagents, IResolvedThinking, IRunFile, IRunSnapshot, ISandboxConfig, ISandboxError, ISandboxLimits, ISandboxResult, ISanitizedSearch, ISaveSkillInput, ISearchAnswer, ISearchConfig, ISearchOptions, ISearchRequest, ISearchResult, ISearchToolResult, ISearchToolsOptions, ISearchUsage, ISkill, ISkillOrigin, ISkillStore, IStepEscalation, IStepResult, IStepStartInfo, ISubagentProfile, ISubagentToolOptions, ISubagentsConfig, IThinkingConfig, ITokenLimits, IToolApprovalConfig, IToolApprovalContext, IToolApprovalRequest, IToolCatalogEntry, IToolDecision, IToolDecisionInput, IToolResultClearing, ITranscription, IUsage, IWebSearchOptions, LogLevel, McpElicitationContent, McpElicitationContext, McpElicitationFieldSchema, McpElicitationHandler, McpElicitationOptions, McpElicitationReason, McpElicitationRequest, McpElicitationResult, McpElicitationSchema, McpOAuthRegistration, McpOAuthRegistrationKind, McpProtocolMode, McpServerInstructions, McpServerProtocol, McpSkillConsent, McpSkillConsentView, McpSkillsOptions, McpSkillsSetting, MediaImageModel, MediaKind, MediaModelKind, MediaSpeechModel, MediaTranscriptionModel, ModelTier, NodeResolverOptions, Pipeline, PipelineCondition, PipelineDefinition, PipelineEdge, PipelineEvent, PipelineIssue, PipelineModelConfig, PipelineNode, PipelineNodeContext, PipelineNodeInput, PipelineNodeOutput, PipelineNodeRunner, PipelineNodeSource, PipelineOptions, PipelineResult, PipelineRoute, PipelineRunOptions, PipelineStop, PipelineTraceEntry, PipelineUsage, PipelineValidation, PromptCachingSetting, ProviderType, ReplanCause, ReplanTrigger, RunControl, SafeFetch, SearchEngine, SearchFreshness, SearchProvider, StepComplexity, SubagentDefaultTools, SubagentInfo, SubagentIsolation, ThinkingLevel, ThinkingSetting, TierReason, TokenLimitKind, ToolApprovalDecision, ToolApprovalMode, ToolPermission, ToolSelectionStrategy, UsagePhase };
2707
+ export { DEFAULT_COMPACTION_THRESHOLD_RATIO, DEFAULT_DECISION_CONFIDENCE_THRESHOLD, DEFAULT_DECISION_TIMEOUT_MS, DirSkillStore, ENTERPRISE_MANAGED_AUTHORIZATION_EXTENSION, EgressError, EnterpriseOAuthError, FORGET_SKILL_TOOL, FileOAuthStore, GENERATE_IMAGE_TOOL, GENERATE_SPEECH_TOOL, JOURNAL_LIMITS, JournalError, MCP_ELICITATION_MAX_PER_RUN, MCP_ELICITATION_MAX_PER_TOOL_CALL, MCP_ELICITATION_TIMEOUT_MS, MCP_INSTRUCTIONS_MAX_CHARS_PER_SERVER, MCP_INSTRUCTIONS_MAX_CHARS_TOTAL, MCP_MODERN_PROTOCOL_VERSION, MCP_SKILLS_EXTENSION, MCP_SKILLS_MAX_PER_SERVER, MCP_SKILLS_MAX_TOTAL, MCP_SKILL_BODY_MAX_CHARS, MCP_SKILL_CONSENTS, MCP_SKILL_CONSENT_DEFAULT, MCP_SKILL_DESCRIPTION_MAX_CHARS, MCP_SKILL_DIRECTORY_ENTRIES_MAX, MCP_SKILL_FILE_MAX_CHARS, MCP_SKILL_MAX_RESOURCES, MCP_SKILL_MAX_TOTAL_BYTES, MCP_SKILL_SNAPSHOTS_MAX_BYTES, MCP_SKILL_SNAPSHOT_MAX_DEPTH, MCP_SKILL_SNAPSHOT_MAX_DIRECTORIES, MCP_SKILL_URI_MAX_CHARS, MEDIA_AUDIO_TYPES, MEDIA_DEFAULT_MAX_CALLS, MEDIA_FOLDER, MEDIA_IMAGE_TYPES, MEDIA_MAX_ATTACHED_AUDIO, MEDIA_MAX_AUDIO_INPUT_BYTES, MEDIA_MAX_IMAGE_BYTES, MEDIA_MAX_PROMPT_CHARS, MEDIA_MAX_SPEECH_BYTES, MEDIA_MAX_SPEECH_CHARS, MEDIA_MAX_TRANSCRIPT_CHARS, MEDIA_TIMEOUT_MS, MediaBudgetError, MediaError, MemoryOAuthStore, MemorySkillStore, ModelCallRefusedError, NodeEnterpriseOAuthProvider, NodeOAuthProvider, PipelineDefinition, PipelineEvent, PipelineNode, PipelineNodeRunner, PipelineResult, REMOTE_SUBAGENT_LIMITS, REPLAY_NOTE, RUN_JS_TOOL, RUN_LEASE_DEFAULT_TTL_MS, RunLeaseError, SAVE_SKILL_TOOL, SEARCH_API_BASE_URL, SEARCH_DEFAULT_MAX_RESULTS, SEARCH_GOOGLE_DEFAULT_MODEL, SEARCH_GOOGLE_NOTE, SEARCH_MAX_QUERY_CHARS, SEARCH_MAX_RESULTS, SEARCH_MAX_SNIPPET_CHARS, SEARCH_MAX_SUMMARY_CHARS, SEARCH_MAX_TITLE_CHARS, SEARCH_MAX_TOTAL_CHARS, SEARCH_MAX_URL_CHARS, SEARCH_PROVIDERS, SPAWN_INPUT_SCHEMA, SPAWN_SUBAGENT_TOOL, SUBAGENT_DEFAULTS, SUBAGENT_MAX_DEPTH_LIMIT, SUMMARY_PREFIX, SandboxUnavailableError, SubagentSpawnError, TOOL_APPROVAL_TIMEOUT_MS, TRANSCRIBE_AUDIO_TOOL, ToolBudgetError, ToolDeniedError, WEB_FETCH_TOOL, WEB_SEARCH_TOOL, acceptMedia, addUsage, adoptSubagentEvent, askDecisionModel, beginMcpOAuth, buildInstructions, buildMediaModelFromStage, buildSearchRequest, checkAuthorizationResponseIssuer, checkEgressUrl, checkLimits, checkRedirect, classifyAddress, compactHistory, createAgent, createEgressTools, createEnterpriseOAuthProvider, createLearning, createMedia, createNodeOAuthProvider, createPipeline, createRunControl, createSafeFetch, createSandboxTool, createSandboxTools, createSearchTools, createSubagentTool, createToolResultClearer, createWebFetchTool, createWebSearchTool, decideToolPermission, decisionModelFromAiSdk, deferResult, defineSkill, estimateTokens, findSecret, finishMcpOAuth, getCurrentRunId, getCurrentRunSandbox, hostMatches, htmlToText, isAuthError, isCodeExecutionTool, isDeferredResult, isModelCallRefused, isReadOnlyTool, isReplayedToolOutput, loadSkillsFromDir, markCodeExecution, markReadOnly, matchToolRule, mcpSkillEntryRefusal, mcpSkillPreamble, mcpSkillUriRefusal, mediaUsageOf, mergeProviderOptions, nodeResolver, normalizeMcpElicitationSchema, normalizeSkillName, normalizeUsage, parseSearchResponse, parseSkillMarkdown, pickPipelineRoute, redactHeaders, renderMcpInstructions, resolveCompaction, resolveDynamicSubagents, resolveEgressPolicy, resolveLimits, resolvePromptCaching, resolveSandboxLimits, resolveThinking, sanitizeSearchResults, searchEgressPolicy, searchStatusMessage, searchToolResult, searchTools, sniffMediaType, truncateToolModelOutput, validateMcpElicitationContent, withRollingBreakpoint, withToolOutputLimit, wrapTranscript };
2708
+ export type { AgentEvent, AgentStage, BudgetKind, DecisionFallbackReason, DecisionPoint, EgressErrorCode, EnterpriseAssertionAlgorithm, EnterpriseAssertionAudience, EnterpriseAssertionType, EnterpriseOAuthHop, EnterpriseOAuthLog, EnterprisePrivateKey, EscalationReason, EventHandler, IAgent, IAgentConfig, IAgentRunOptions, IAgentRunResult, IAgentStageOverride, IAiSdkDecisionOptions, IClearedInfo, ICloseOptions, ICompactHistoryOptions, ICompactHistoryResult, ICompactOptions, ICompactResult, ICompactionConfig, IConversationTurn, IDecisionAnswer, IDecisionCallOptions, IDecisionConfig, IDecisionEvent, IDecisionModel, IDecisionOption, IDecisionOutcome, IDecisionQuestion, IDeferredResult, IDynamicSubagentsConfig, IEgressPolicy, IEnterpriseIdpOptions, IEnterpriseOAuthProviderOptions, IEscalationConfig, IJournalAnswerEntry, IJournalEntry, IJournalModelEntry, IJournalPendingEntry, IJournalToolEntry, ILearning, ILearningConfig, ILimitBreach, ILocalSubagentToolOptions, IMcpHttpServerConfig, IMcpServerConfig, IMcpSkillOrigin, IMcpStdioServerConfig, IMedia, IMediaConfig, IMediaFile, IMediaModelSpec, IMediaUsage, IModelCall, INodeOAuthProviderOptions, IOAuthRequestOptions, IOAuthStore, IParkedRun, IPersistence, IPlan, IPlanStep, IRemoteSubagentContext, IRemoteSubagentResult, IRemoteSubagentTask, IRemoteSubagentToolOptions, IResolvedAddress, IResolvedDynamicSubagents, IResolvedThinking, IRunFile, IRunJournal, IRunLease, IRunLeaseOptions, IRunSnapshot, ISandboxConfig, ISandboxError, ISandboxLimits, ISandboxResult, ISanitizedSearch, ISaveSkillInput, ISearchAnswer, ISearchConfig, ISearchOptions, ISearchRequest, ISearchResult, ISearchToolResult, ISearchToolsOptions, ISearchUsage, ISharedLimits, ISkill, ISkillOrigin, ISkillStore, IStepEscalation, IStepResult, IStepStartInfo, ISubagentProfile, ISubagentToolOptions, ISubagentsConfig, IThinkingConfig, ITokenLimits, IToolApprovalConfig, IToolApprovalContext, IToolApprovalRequest, IToolCatalogEntry, IToolDecision, IToolDecisionInput, IToolResultClearing, ITranscription, IUsage, IWebSearchOptions, LogLevel, McpElicitationContent, McpElicitationContext, McpElicitationFieldSchema, McpElicitationHandler, McpElicitationOptions, McpElicitationReason, McpElicitationRequest, McpElicitationResult, McpElicitationSchema, McpOAuthRegistration, McpOAuthRegistrationKind, McpProtocolMode, McpServerInstructions, McpServerProtocol, McpSkillConsent, McpSkillConsentView, McpSkillsOptions, McpSkillsSetting, MediaImageModel, MediaKind, MediaModelKind, MediaSpeechModel, MediaTranscriptionModel, ModelCallStage, ModelTier, NodeResolverOptions, ParkAnswer, ParkedItem, Pipeline, PipelineModelConfig, PipelineOptions, PipelineRouteOptions, PipelineRouteResult, PipelineRunOptions, PromptCachingSetting, ProviderType, RemoteSubagentDispatch, ReplanCause, ReplanTrigger, RunControl, RunLeaseLostReason, SafeFetch, SearchEngine, SearchFreshness, SearchProvider, SkillDirectoryListing, StepComplexity, SubagentDefaultTools, SubagentInfo, SubagentIsolation, ThinkingLevel, ThinkingSetting, TierReason, TokenLimitKind, ToolApprovalAnswer, ToolApprovalDecision, ToolApprovalMode, ToolPermission, ToolResultAnswer, ToolSelectionStrategy, UsagePhase };