@dudko.dev/agent 0.0.53 → 0.0.55

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
@@ -1010,6 +1010,141 @@ declare const adoptSubagentEvent: <E extends {
1010
1010
  type: string;
1011
1011
  }>(event: E, parentId: string) => E;
1012
1012
 
1013
+ declare const ASK_USER_TOOL = "ask_user";
1014
+ /** How long one question waits for the person, by default: a human is reading it. */
1015
+ declare const ASK_USER_TIMEOUT_MS = 300000;
1016
+ /**
1017
+ * The longest wait a timer holds (2^31 - 1 ms, about 24.8 days). `setTimeout` fires a longer one -
1018
+ * Infinity included - after about 1 ms, so a `timeoutMs` past it is taken as no limit at all.
1019
+ */
1020
+ declare const ASK_USER_TIMEOUT_MAX_MS = 2147483647;
1021
+ /** The most questions one run may ask, by default (its helpers' and subagents' included). */
1022
+ declare const ASK_USER_MAX_PER_RUN = 3;
1023
+ /** A question offers at least this many options... */
1024
+ declare const ASK_USER_MIN_OPTIONS = 2;
1025
+ /** ...and at most this many. */
1026
+ declare const ASK_USER_MAX_OPTIONS = 6;
1027
+ /** The longest question, in characters (after cleaning). */
1028
+ declare const ASK_USER_QUESTION_MAX_CHARS = 500;
1029
+ /** The longest option label. */
1030
+ declare const ASK_USER_LABEL_MAX_CHARS = 80;
1031
+ /** The longest option description. */
1032
+ declare const ASK_USER_DESCRIPTION_MAX_CHARS = 200;
1033
+ /** The most of a person's own words (`{ other }`) the model is given; the rest is cut. */
1034
+ declare const ASK_USER_OTHER_MAX_CHARS = 2000;
1035
+ /** One option of a question, as the person is shown it. Both strings are the MODEL's, cleaned. */
1036
+ interface AskUserOption {
1037
+ label: string;
1038
+ description?: string;
1039
+ }
1040
+ /** A question as checked and cleaned: what a host shows and an event carries. */
1041
+ interface AskUserQuestion {
1042
+ question: string;
1043
+ options: AskUserOption[];
1044
+ /** The person may pick several options. */
1045
+ multiple: boolean;
1046
+ /** The person may answer in their own words instead of picking. */
1047
+ allowOther: boolean;
1048
+ }
1049
+ /** What the host's `onQuestion` is given. Every string in it is the model's text, cleaned. */
1050
+ interface AskUserRequest<TStep = unknown> extends AskUserQuestion {
1051
+ /** Unique per question; the same id is in the two events. */
1052
+ id: string;
1053
+ /** The plan step whose tool call asks. */
1054
+ step?: TStep;
1055
+ runId?: string;
1056
+ /** Set when a helper or a subagent of the run asks, not the run itself: its id and depth. */
1057
+ subagent?: {
1058
+ id: string;
1059
+ depth: number;
1060
+ };
1061
+ }
1062
+ /**
1063
+ * The person's answer: the labels they picked (exactly as offered; one unless `multiple`), their
1064
+ * own words (only when `allowOther`), or that they would rather not answer.
1065
+ */
1066
+ type AskUserAnswer = {
1067
+ choice: string[];
1068
+ } | {
1069
+ other: string;
1070
+ } | {
1071
+ declined: true;
1072
+ };
1073
+ interface AskUserContext {
1074
+ /**
1075
+ * Aborted when the question ends WITHOUT the host's answer: no answer within `timeoutMs`
1076
+ * (`signal.reason` is an Error named 'TimeoutError'), the run was stopped, or the handler
1077
+ * failed. Take the prompt down then: an answer given later is ignored. Never aborted once the
1078
+ * host has answered.
1079
+ */
1080
+ signal: AbortSignal;
1081
+ }
1082
+ /** How a question ended. `automatic`: nobody decided (a time limit, a stop, a failed handler). */
1083
+ type AskUserAction = 'choice' | 'other' | 'declined' | 'timeout' | 'stopped';
1084
+ /** Why a question was closed as `declined` without the person deciding. */
1085
+ type AskUserReason = 'handler-error' | 'invalid-answer' | 'cannot-park';
1086
+ /** The two events of a question. Neither ever carries the person's own words. */
1087
+ type AskUserEvent<TStep = unknown> = {
1088
+ type: 'user.question-asked';
1089
+ id: string;
1090
+ question: string;
1091
+ options: AskUserOption[];
1092
+ multiple: boolean;
1093
+ allowOther: boolean;
1094
+ step?: TStep;
1095
+ subagent?: {
1096
+ id: string;
1097
+ depth: number;
1098
+ };
1099
+ } | {
1100
+ type: 'user.question-answered';
1101
+ id: string;
1102
+ action: AskUserAction;
1103
+ /** true when nobody decided: a time limit, a stop, a failed handler, an unusable answer. */
1104
+ automatic: boolean;
1105
+ /** Action 'choice': the labels picked. Never the text of an `other` answer. */
1106
+ choice?: string[];
1107
+ /** Action 'declined' with `automatic`: why. */
1108
+ reason?: AskUserReason;
1109
+ };
1110
+ /** A bad `ask_user` input: the tool call fails with this message, which says what to fix. */
1111
+ declare class AskUserInputError extends Error {
1112
+ constructor(message: string);
1113
+ toJSON(): string;
1114
+ }
1115
+ /** The model's text as a person may be shown it: a string, invisible characters removed, trimmed. */
1116
+ declare const cleanAskUserText: (raw: unknown, oneLine?: boolean) => string;
1117
+ /**
1118
+ * Check and clean the model's `ask_user` arguments: 2-6 options, no two labels alike (letter case
1119
+ * and spaces aside), each label 1-80 characters, a description at most 200, a question of 1-500 -
1120
+ * all measured after cleaning. An option may be given as a bare string (its label). Throws
1121
+ * {@link AskUserInputError} with what to fix.
1122
+ */
1123
+ declare const checkAskUserInput: (raw: unknown) => AskUserQuestion;
1124
+ /** An answer as checked: what the model is told. */
1125
+ type AskUserCheckedAnswer = {
1126
+ kind: 'choice';
1127
+ choice: string[];
1128
+ } | {
1129
+ kind: 'other';
1130
+ text: string;
1131
+ } | {
1132
+ kind: 'declined';
1133
+ };
1134
+ /**
1135
+ * Check the host's answer against the question: exactly one of `choice` (labels that were
1136
+ * offered, no repeats, one unless `multiple`), `other` (a non-empty text, only when `allowOther`;
1137
+ * cleaned and cut at {@link ASK_USER_OTHER_MAX_CHARS}) or `declined: true`. Anything else is not
1138
+ * an answer.
1139
+ */
1140
+ declare const checkAskUserAnswer: (q: AskUserQuestion, raw: unknown) => {
1141
+ ok: true;
1142
+ value: AskUserCheckedAnswer;
1143
+ } | {
1144
+ ok: false;
1145
+ reason: string;
1146
+ };
1147
+
1013
1148
  type ProviderType = 'openai' | 'anthropic' | 'openai-compatible' | 'google' | 'xai' | 'azure' | 'amazon-bedrock' | 'google-vertex' | 'deepseek' | 'gateway' | 'cloudflare';
1014
1149
  type AgentModel = Exclude<LanguageModel, string>;
1015
1150
  type LogLevel = 'none' | 'error' | 'warn' | 'info' | 'debug';
@@ -1128,6 +1263,16 @@ type ToolApprovalAnswer = boolean | {
1128
1263
  type ToolApprovalDecision = ToolApprovalAnswer | {
1129
1264
  park: true;
1130
1265
  };
1266
+ type IAskUserRequest = AskUserRequest<IPlanStep>;
1267
+ type AskUserDecision = AskUserAnswer | {
1268
+ park: true;
1269
+ };
1270
+ type AskUserHandler = (request: IAskUserRequest, ctx: AskUserContext) => AskUserDecision | Promise<AskUserDecision>;
1271
+ interface IAskUserConfig {
1272
+ onQuestion?: AskUserHandler;
1273
+ timeoutMs?: number;
1274
+ maxPerRun?: number;
1275
+ }
1131
1276
  interface IToolApprovalConfig {
1132
1277
  mode?: ToolApprovalMode;
1133
1278
  rules?: Record<string, ToolPermission>;
@@ -1211,6 +1356,7 @@ interface IAgentConfig {
1211
1356
  compaction?: ICompactionConfig;
1212
1357
  skills?: ISkill[];
1213
1358
  toolApproval?: IToolApprovalConfig;
1359
+ askUser?: boolean | IAskUserConfig;
1214
1360
  toolSearchThreshold?: number;
1215
1361
  mcpConnectTimeoutMs?: number;
1216
1362
  onElicitation?: McpElicitationHandler;
@@ -1404,7 +1550,7 @@ type AgentEventBody = {
1404
1550
  reason?: string;
1405
1551
  automatic: boolean;
1406
1552
  parked?: true;
1407
- } | {
1553
+ } | AskUserEvent<IPlanStep> | {
1408
1554
  type: 'mcp.elicitation-requested';
1409
1555
  id: string;
1410
1556
  server: string;
@@ -1607,6 +1753,7 @@ interface IRunSnapshot {
1607
1753
  }[];
1608
1754
  escalations?: number;
1609
1755
  subagentsSpawned?: number;
1756
+ questionsAsked?: number;
1610
1757
  attempt?: number;
1611
1758
  leaseOwner?: string;
1612
1759
  parked?: IParkedRun;
@@ -2705,5 +2852,5 @@ declare const REMOTE_SUBAGENT_LIMITS: {
2705
2852
  */
2706
2853
  declare const createSubagentTool: (opts: ISubagentToolOptions) => Tool;
2707
2854
 
2708
- 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 };
2709
- export type { AgentEvent, AgentModel, 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 };
2855
+ export { ASK_USER_DESCRIPTION_MAX_CHARS, ASK_USER_LABEL_MAX_CHARS, ASK_USER_MAX_OPTIONS, ASK_USER_MAX_PER_RUN, ASK_USER_MIN_OPTIONS, ASK_USER_OTHER_MAX_CHARS, ASK_USER_QUESTION_MAX_CHARS, ASK_USER_TIMEOUT_MAX_MS, ASK_USER_TIMEOUT_MS, ASK_USER_TOOL, AskUserInputError, 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, checkAskUserAnswer, checkAskUserInput, checkAuthorizationResponseIssuer, checkEgressUrl, checkLimits, checkRedirect, classifyAddress, cleanAskUserText, 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 };
2856
+ export type { AgentEvent, AgentModel, AgentStage, AskUserAction, AskUserAnswer, AskUserCheckedAnswer, AskUserContext, AskUserDecision, AskUserHandler, AskUserOption, AskUserQuestion, AskUserReason, BudgetKind, DecisionFallbackReason, DecisionPoint, EgressErrorCode, EnterpriseAssertionAlgorithm, EnterpriseAssertionAudience, EnterpriseAssertionType, EnterpriseOAuthHop, EnterpriseOAuthLog, EnterprisePrivateKey, EscalationReason, EventHandler, IAgent, IAgentConfig, IAgentRunOptions, IAgentRunResult, IAgentStageOverride, IAiSdkDecisionOptions, IAskUserConfig, IAskUserRequest, 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 };
package/dist/index.d.ts CHANGED
@@ -1010,6 +1010,141 @@ declare const adoptSubagentEvent: <E extends {
1010
1010
  type: string;
1011
1011
  }>(event: E, parentId: string) => E;
1012
1012
 
1013
+ declare const ASK_USER_TOOL = "ask_user";
1014
+ /** How long one question waits for the person, by default: a human is reading it. */
1015
+ declare const ASK_USER_TIMEOUT_MS = 300000;
1016
+ /**
1017
+ * The longest wait a timer holds (2^31 - 1 ms, about 24.8 days). `setTimeout` fires a longer one -
1018
+ * Infinity included - after about 1 ms, so a `timeoutMs` past it is taken as no limit at all.
1019
+ */
1020
+ declare const ASK_USER_TIMEOUT_MAX_MS = 2147483647;
1021
+ /** The most questions one run may ask, by default (its helpers' and subagents' included). */
1022
+ declare const ASK_USER_MAX_PER_RUN = 3;
1023
+ /** A question offers at least this many options... */
1024
+ declare const ASK_USER_MIN_OPTIONS = 2;
1025
+ /** ...and at most this many. */
1026
+ declare const ASK_USER_MAX_OPTIONS = 6;
1027
+ /** The longest question, in characters (after cleaning). */
1028
+ declare const ASK_USER_QUESTION_MAX_CHARS = 500;
1029
+ /** The longest option label. */
1030
+ declare const ASK_USER_LABEL_MAX_CHARS = 80;
1031
+ /** The longest option description. */
1032
+ declare const ASK_USER_DESCRIPTION_MAX_CHARS = 200;
1033
+ /** The most of a person's own words (`{ other }`) the model is given; the rest is cut. */
1034
+ declare const ASK_USER_OTHER_MAX_CHARS = 2000;
1035
+ /** One option of a question, as the person is shown it. Both strings are the MODEL's, cleaned. */
1036
+ interface AskUserOption {
1037
+ label: string;
1038
+ description?: string;
1039
+ }
1040
+ /** A question as checked and cleaned: what a host shows and an event carries. */
1041
+ interface AskUserQuestion {
1042
+ question: string;
1043
+ options: AskUserOption[];
1044
+ /** The person may pick several options. */
1045
+ multiple: boolean;
1046
+ /** The person may answer in their own words instead of picking. */
1047
+ allowOther: boolean;
1048
+ }
1049
+ /** What the host's `onQuestion` is given. Every string in it is the model's text, cleaned. */
1050
+ interface AskUserRequest<TStep = unknown> extends AskUserQuestion {
1051
+ /** Unique per question; the same id is in the two events. */
1052
+ id: string;
1053
+ /** The plan step whose tool call asks. */
1054
+ step?: TStep;
1055
+ runId?: string;
1056
+ /** Set when a helper or a subagent of the run asks, not the run itself: its id and depth. */
1057
+ subagent?: {
1058
+ id: string;
1059
+ depth: number;
1060
+ };
1061
+ }
1062
+ /**
1063
+ * The person's answer: the labels they picked (exactly as offered; one unless `multiple`), their
1064
+ * own words (only when `allowOther`), or that they would rather not answer.
1065
+ */
1066
+ type AskUserAnswer = {
1067
+ choice: string[];
1068
+ } | {
1069
+ other: string;
1070
+ } | {
1071
+ declined: true;
1072
+ };
1073
+ interface AskUserContext {
1074
+ /**
1075
+ * Aborted when the question ends WITHOUT the host's answer: no answer within `timeoutMs`
1076
+ * (`signal.reason` is an Error named 'TimeoutError'), the run was stopped, or the handler
1077
+ * failed. Take the prompt down then: an answer given later is ignored. Never aborted once the
1078
+ * host has answered.
1079
+ */
1080
+ signal: AbortSignal;
1081
+ }
1082
+ /** How a question ended. `automatic`: nobody decided (a time limit, a stop, a failed handler). */
1083
+ type AskUserAction = 'choice' | 'other' | 'declined' | 'timeout' | 'stopped';
1084
+ /** Why a question was closed as `declined` without the person deciding. */
1085
+ type AskUserReason = 'handler-error' | 'invalid-answer' | 'cannot-park';
1086
+ /** The two events of a question. Neither ever carries the person's own words. */
1087
+ type AskUserEvent<TStep = unknown> = {
1088
+ type: 'user.question-asked';
1089
+ id: string;
1090
+ question: string;
1091
+ options: AskUserOption[];
1092
+ multiple: boolean;
1093
+ allowOther: boolean;
1094
+ step?: TStep;
1095
+ subagent?: {
1096
+ id: string;
1097
+ depth: number;
1098
+ };
1099
+ } | {
1100
+ type: 'user.question-answered';
1101
+ id: string;
1102
+ action: AskUserAction;
1103
+ /** true when nobody decided: a time limit, a stop, a failed handler, an unusable answer. */
1104
+ automatic: boolean;
1105
+ /** Action 'choice': the labels picked. Never the text of an `other` answer. */
1106
+ choice?: string[];
1107
+ /** Action 'declined' with `automatic`: why. */
1108
+ reason?: AskUserReason;
1109
+ };
1110
+ /** A bad `ask_user` input: the tool call fails with this message, which says what to fix. */
1111
+ declare class AskUserInputError extends Error {
1112
+ constructor(message: string);
1113
+ toJSON(): string;
1114
+ }
1115
+ /** The model's text as a person may be shown it: a string, invisible characters removed, trimmed. */
1116
+ declare const cleanAskUserText: (raw: unknown, oneLine?: boolean) => string;
1117
+ /**
1118
+ * Check and clean the model's `ask_user` arguments: 2-6 options, no two labels alike (letter case
1119
+ * and spaces aside), each label 1-80 characters, a description at most 200, a question of 1-500 -
1120
+ * all measured after cleaning. An option may be given as a bare string (its label). Throws
1121
+ * {@link AskUserInputError} with what to fix.
1122
+ */
1123
+ declare const checkAskUserInput: (raw: unknown) => AskUserQuestion;
1124
+ /** An answer as checked: what the model is told. */
1125
+ type AskUserCheckedAnswer = {
1126
+ kind: 'choice';
1127
+ choice: string[];
1128
+ } | {
1129
+ kind: 'other';
1130
+ text: string;
1131
+ } | {
1132
+ kind: 'declined';
1133
+ };
1134
+ /**
1135
+ * Check the host's answer against the question: exactly one of `choice` (labels that were
1136
+ * offered, no repeats, one unless `multiple`), `other` (a non-empty text, only when `allowOther`;
1137
+ * cleaned and cut at {@link ASK_USER_OTHER_MAX_CHARS}) or `declined: true`. Anything else is not
1138
+ * an answer.
1139
+ */
1140
+ declare const checkAskUserAnswer: (q: AskUserQuestion, raw: unknown) => {
1141
+ ok: true;
1142
+ value: AskUserCheckedAnswer;
1143
+ } | {
1144
+ ok: false;
1145
+ reason: string;
1146
+ };
1147
+
1013
1148
  type ProviderType = 'openai' | 'anthropic' | 'openai-compatible' | 'google' | 'xai' | 'azure' | 'amazon-bedrock' | 'google-vertex' | 'deepseek' | 'gateway' | 'cloudflare';
1014
1149
  type AgentModel = Exclude<LanguageModel, string>;
1015
1150
  type LogLevel = 'none' | 'error' | 'warn' | 'info' | 'debug';
@@ -1128,6 +1263,16 @@ type ToolApprovalAnswer = boolean | {
1128
1263
  type ToolApprovalDecision = ToolApprovalAnswer | {
1129
1264
  park: true;
1130
1265
  };
1266
+ type IAskUserRequest = AskUserRequest<IPlanStep>;
1267
+ type AskUserDecision = AskUserAnswer | {
1268
+ park: true;
1269
+ };
1270
+ type AskUserHandler = (request: IAskUserRequest, ctx: AskUserContext) => AskUserDecision | Promise<AskUserDecision>;
1271
+ interface IAskUserConfig {
1272
+ onQuestion?: AskUserHandler;
1273
+ timeoutMs?: number;
1274
+ maxPerRun?: number;
1275
+ }
1131
1276
  interface IToolApprovalConfig {
1132
1277
  mode?: ToolApprovalMode;
1133
1278
  rules?: Record<string, ToolPermission>;
@@ -1211,6 +1356,7 @@ interface IAgentConfig {
1211
1356
  compaction?: ICompactionConfig;
1212
1357
  skills?: ISkill[];
1213
1358
  toolApproval?: IToolApprovalConfig;
1359
+ askUser?: boolean | IAskUserConfig;
1214
1360
  toolSearchThreshold?: number;
1215
1361
  mcpConnectTimeoutMs?: number;
1216
1362
  onElicitation?: McpElicitationHandler;
@@ -1404,7 +1550,7 @@ type AgentEventBody = {
1404
1550
  reason?: string;
1405
1551
  automatic: boolean;
1406
1552
  parked?: true;
1407
- } | {
1553
+ } | AskUserEvent<IPlanStep> | {
1408
1554
  type: 'mcp.elicitation-requested';
1409
1555
  id: string;
1410
1556
  server: string;
@@ -1607,6 +1753,7 @@ interface IRunSnapshot {
1607
1753
  }[];
1608
1754
  escalations?: number;
1609
1755
  subagentsSpawned?: number;
1756
+ questionsAsked?: number;
1610
1757
  attempt?: number;
1611
1758
  leaseOwner?: string;
1612
1759
  parked?: IParkedRun;
@@ -2705,5 +2852,5 @@ declare const REMOTE_SUBAGENT_LIMITS: {
2705
2852
  */
2706
2853
  declare const createSubagentTool: (opts: ISubagentToolOptions) => Tool;
2707
2854
 
2708
- 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 };
2709
- export type { AgentEvent, AgentModel, 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 };
2855
+ export { ASK_USER_DESCRIPTION_MAX_CHARS, ASK_USER_LABEL_MAX_CHARS, ASK_USER_MAX_OPTIONS, ASK_USER_MAX_PER_RUN, ASK_USER_MIN_OPTIONS, ASK_USER_OTHER_MAX_CHARS, ASK_USER_QUESTION_MAX_CHARS, ASK_USER_TIMEOUT_MAX_MS, ASK_USER_TIMEOUT_MS, ASK_USER_TOOL, AskUserInputError, 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, checkAskUserAnswer, checkAskUserInput, checkAuthorizationResponseIssuer, checkEgressUrl, checkLimits, checkRedirect, classifyAddress, cleanAskUserText, 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 };
2856
+ export type { AgentEvent, AgentModel, AgentStage, AskUserAction, AskUserAnswer, AskUserCheckedAnswer, AskUserContext, AskUserDecision, AskUserHandler, AskUserOption, AskUserQuestion, AskUserReason, BudgetKind, DecisionFallbackReason, DecisionPoint, EgressErrorCode, EnterpriseAssertionAlgorithm, EnterpriseAssertionAudience, EnterpriseAssertionType, EnterpriseOAuthHop, EnterpriseOAuthLog, EnterprisePrivateKey, EscalationReason, EventHandler, IAgent, IAgentConfig, IAgentRunOptions, IAgentRunResult, IAgentStageOverride, IAiSdkDecisionOptions, IAskUserConfig, IAskUserRequest, 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 };