@dudko.dev/agent-web 0.0.45 → 0.0.47
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/README.md +2 -1
- package/dist/agent-web.js +153 -149
- package/dist/agent-web.js.map +1 -1
- package/dist/{chunk-236RCVAZ.js → chunk-PTJA7V23.js} +3 -2
- package/dist/chunk-PTJA7V23.js.map +1 -0
- package/dist/index.cjs +563 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +228 -2
- package/dist/index.d.ts +228 -2
- package/dist/index.js +516 -32
- package/dist/index.js.map +1 -1
- package/dist/{sandbox-7CGSIIIZ.js → sandbox-ZXWD5IWZ.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-236RCVAZ.js.map +0 -1
- /package/dist/{sandbox-7CGSIIIZ.js.map → sandbox-ZXWD5IWZ.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -177,6 +177,8 @@ interface RunSnapshot {
|
|
|
177
177
|
escalations?: number;
|
|
178
178
|
/** Helpers the model started so far (counts against `subagents.dynamic.maxChildren` on resume). */
|
|
179
179
|
subagentsSpawned?: number;
|
|
180
|
+
/** Questions `ask_user` put to the person so far (counts against `askUser.maxPerRun` on resume). */
|
|
181
|
+
questionsAsked?: number;
|
|
180
182
|
/**
|
|
181
183
|
* The attempt that wrote the snapshot: 1 for the run as first started, one more for every
|
|
182
184
|
* resume - the `attempt` of its events. A resume records its attempt BEFORE any of its events
|
|
@@ -683,6 +685,146 @@ declare const decideToolPermission: (opts: {
|
|
|
683
685
|
mcpSkills?: readonly string[];
|
|
684
686
|
}) => ToolPermission;
|
|
685
687
|
|
|
688
|
+
declare const ASK_USER_TOOL = "ask_user";
|
|
689
|
+
/** How long one question waits for the person, by default: a human is reading it. */
|
|
690
|
+
declare const ASK_USER_TIMEOUT_MS = 300000;
|
|
691
|
+
/**
|
|
692
|
+
* The longest wait a timer holds (2^31 - 1 ms, about 24.8 days). `setTimeout` fires a longer one -
|
|
693
|
+
* Infinity included - after about 1 ms, so a `timeoutMs` past it is taken as no limit at all.
|
|
694
|
+
*/
|
|
695
|
+
declare const ASK_USER_TIMEOUT_MAX_MS = 2147483647;
|
|
696
|
+
/** The most questions one run may ask, by default (its helpers' and subagents' included). */
|
|
697
|
+
declare const ASK_USER_MAX_PER_RUN = 3;
|
|
698
|
+
/** A question offers at least this many options... */
|
|
699
|
+
declare const ASK_USER_MIN_OPTIONS = 2;
|
|
700
|
+
/** ...and at most this many. */
|
|
701
|
+
declare const ASK_USER_MAX_OPTIONS = 6;
|
|
702
|
+
/** The longest question, in characters (after cleaning). */
|
|
703
|
+
declare const ASK_USER_QUESTION_MAX_CHARS = 500;
|
|
704
|
+
/** The longest option label. */
|
|
705
|
+
declare const ASK_USER_LABEL_MAX_CHARS = 80;
|
|
706
|
+
/** The longest option description. */
|
|
707
|
+
declare const ASK_USER_DESCRIPTION_MAX_CHARS = 200;
|
|
708
|
+
/** The most of a person's own words (`{ other }`) the model is given; the rest is cut. */
|
|
709
|
+
declare const ASK_USER_OTHER_MAX_CHARS = 2000;
|
|
710
|
+
/** One option of a question, as the person is shown it. Both strings are the MODEL's, cleaned. */
|
|
711
|
+
interface AskUserOption {
|
|
712
|
+
label: string;
|
|
713
|
+
description?: string;
|
|
714
|
+
}
|
|
715
|
+
/** A question as checked and cleaned: what a host shows and an event carries. */
|
|
716
|
+
interface AskUserQuestion {
|
|
717
|
+
question: string;
|
|
718
|
+
options: AskUserOption[];
|
|
719
|
+
/** The person may pick several options. */
|
|
720
|
+
multiple: boolean;
|
|
721
|
+
/** The person may answer in their own words instead of picking. */
|
|
722
|
+
allowOther: boolean;
|
|
723
|
+
}
|
|
724
|
+
/** What the host's `onQuestion` is given. Every string in it is the model's text, cleaned. */
|
|
725
|
+
interface AskUserRequest$1<TStep = unknown> extends AskUserQuestion {
|
|
726
|
+
/** Unique per question; the same id is in the two events. */
|
|
727
|
+
id: string;
|
|
728
|
+
/** The plan step whose tool call asks. */
|
|
729
|
+
step?: TStep;
|
|
730
|
+
runId?: string;
|
|
731
|
+
/** Set when a helper or a subagent of the run asks, not the run itself: its id and depth. */
|
|
732
|
+
subagent?: {
|
|
733
|
+
id: string;
|
|
734
|
+
depth: number;
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* The person's answer: the labels they picked (exactly as offered; one unless `multiple`), their
|
|
739
|
+
* own words (only when `allowOther`), or that they would rather not answer.
|
|
740
|
+
*/
|
|
741
|
+
type AskUserAnswer = {
|
|
742
|
+
choice: string[];
|
|
743
|
+
} | {
|
|
744
|
+
other: string;
|
|
745
|
+
} | {
|
|
746
|
+
declined: true;
|
|
747
|
+
};
|
|
748
|
+
interface AskUserContext {
|
|
749
|
+
/**
|
|
750
|
+
* Aborted when the question ends WITHOUT the host's answer: no answer within `timeoutMs`
|
|
751
|
+
* (`signal.reason` is an Error named 'TimeoutError'), the run was stopped, or the handler
|
|
752
|
+
* failed. Take the prompt down then: an answer given later is ignored. Never aborted once the
|
|
753
|
+
* host has answered.
|
|
754
|
+
*/
|
|
755
|
+
signal: AbortSignal;
|
|
756
|
+
}
|
|
757
|
+
/** `askUser` beside `onQuestion`, resolved: `timeoutMs` 0 = no limit of its own. */
|
|
758
|
+
interface AskUserSettings {
|
|
759
|
+
timeoutMs: number;
|
|
760
|
+
maxPerRun: number;
|
|
761
|
+
}
|
|
762
|
+
/** How a question ended. `automatic`: nobody decided (a time limit, a stop, a failed handler). */
|
|
763
|
+
type AskUserAction = 'choice' | 'other' | 'declined' | 'timeout' | 'stopped';
|
|
764
|
+
/** Why a question was closed as `declined` without the person deciding. */
|
|
765
|
+
type AskUserReason = 'handler-error' | 'invalid-answer' | 'cannot-park';
|
|
766
|
+
/** The two events of a question. Neither ever carries the person's own words. */
|
|
767
|
+
type AskUserEvent<TStep = unknown> = {
|
|
768
|
+
type: 'user.question-asked';
|
|
769
|
+
id: string;
|
|
770
|
+
question: string;
|
|
771
|
+
options: AskUserOption[];
|
|
772
|
+
multiple: boolean;
|
|
773
|
+
allowOther: boolean;
|
|
774
|
+
step?: TStep;
|
|
775
|
+
subagent?: {
|
|
776
|
+
id: string;
|
|
777
|
+
depth: number;
|
|
778
|
+
};
|
|
779
|
+
} | {
|
|
780
|
+
type: 'user.question-answered';
|
|
781
|
+
id: string;
|
|
782
|
+
action: AskUserAction;
|
|
783
|
+
/** true when nobody decided: a time limit, a stop, a failed handler, an unusable answer. */
|
|
784
|
+
automatic: boolean;
|
|
785
|
+
/** Action 'choice': the labels picked. Never the text of an `other` answer. */
|
|
786
|
+
choice?: string[];
|
|
787
|
+
/** Action 'declined' with `automatic`: why. */
|
|
788
|
+
reason?: AskUserReason;
|
|
789
|
+
};
|
|
790
|
+
/** A bad `ask_user` input: the tool call fails with this message, which says what to fix. */
|
|
791
|
+
declare class AskUserInputError extends Error {
|
|
792
|
+
constructor(message: string);
|
|
793
|
+
toJSON(): string;
|
|
794
|
+
}
|
|
795
|
+
/** The model's text as a person may be shown it: a string, invisible characters removed, trimmed. */
|
|
796
|
+
declare const cleanAskUserText: (raw: unknown, oneLine?: boolean) => string;
|
|
797
|
+
/**
|
|
798
|
+
* Check and clean the model's `ask_user` arguments: 2-6 options, no two labels alike (letter case
|
|
799
|
+
* and spaces aside), each label 1-80 characters, a description at most 200, a question of 1-500 -
|
|
800
|
+
* all measured after cleaning. An option may be given as a bare string (its label). Throws
|
|
801
|
+
* {@link AskUserInputError} with what to fix.
|
|
802
|
+
*/
|
|
803
|
+
declare const checkAskUserInput: (raw: unknown) => AskUserQuestion;
|
|
804
|
+
/** An answer as checked: what the model is told. */
|
|
805
|
+
type AskUserCheckedAnswer = {
|
|
806
|
+
kind: 'choice';
|
|
807
|
+
choice: string[];
|
|
808
|
+
} | {
|
|
809
|
+
kind: 'other';
|
|
810
|
+
text: string;
|
|
811
|
+
} | {
|
|
812
|
+
kind: 'declined';
|
|
813
|
+
};
|
|
814
|
+
/**
|
|
815
|
+
* Check the host's answer against the question: exactly one of `choice` (labels that were
|
|
816
|
+
* offered, no repeats, one unless `multiple`), `other` (a non-empty text, only when `allowOther`;
|
|
817
|
+
* cleaned and cut at {@link ASK_USER_OTHER_MAX_CHARS}) or `declined: true`. Anything else is not
|
|
818
|
+
* an answer.
|
|
819
|
+
*/
|
|
820
|
+
declare const checkAskUserAnswer: (q: AskUserQuestion, raw: unknown) => {
|
|
821
|
+
ok: true;
|
|
822
|
+
value: AskUserCheckedAnswer;
|
|
823
|
+
} | {
|
|
824
|
+
ok: false;
|
|
825
|
+
reason: string;
|
|
826
|
+
};
|
|
827
|
+
|
|
686
828
|
type ReplanMode = 'continue' | 'revise' | 'finish';
|
|
687
829
|
type Phase = 'plan' | 'execute' | 'replan' | 'synthesize';
|
|
688
830
|
/**
|
|
@@ -951,6 +1093,18 @@ type AgentEventBody =
|
|
|
951
1093
|
reason?: string;
|
|
952
1094
|
automatic: boolean;
|
|
953
1095
|
}
|
|
1096
|
+
/**
|
|
1097
|
+
* The model asked the person a question (`ask_user`, `config.askUser`): `onQuestion` is being
|
|
1098
|
+
* called. `question` and the options are the MODEL's text, cleaned - show them as plain text.
|
|
1099
|
+
* `subagent`: a helper or a subagent of the run asks. Followed by `user.question-answered` with
|
|
1100
|
+
* the same id - unless the run parked on it (the Node package only).
|
|
1101
|
+
*
|
|
1102
|
+
* `user.question-answered`: how it ended - `action` 'choice' (with the labels picked in
|
|
1103
|
+
* `choice`), 'other' (the person's own words: they go to the model as the tool's result and
|
|
1104
|
+
* NEVER into an event), 'declined', 'timeout' or 'stopped'. `automatic`: nobody decided (a time
|
|
1105
|
+
* limit, a stop, a failed handler - `reason` - or an answer that did not fit the question).
|
|
1106
|
+
*/
|
|
1107
|
+
| AskUserEvent<IPlanStep>
|
|
954
1108
|
/**
|
|
955
1109
|
* An MCP server asked the user for input during a tool call (the connection's `onElicitation`
|
|
956
1110
|
* is being called). `message`, `requestedSchema` and `url` are the SERVER's text: cleaned and
|
|
@@ -1440,6 +1594,11 @@ interface PlannerPromptContext {
|
|
|
1440
1594
|
sandbox?: string;
|
|
1441
1595
|
/** Set while `spawn_subagent` is callable (`subagents.dynamic`): when a helper is worth a step. */
|
|
1442
1596
|
subagents?: string;
|
|
1597
|
+
/**
|
|
1598
|
+
* Set while `ask_user` is callable (`config.askUser`): when a step may ask the user - the one
|
|
1599
|
+
* exception to "never plan a step that asks the user something".
|
|
1600
|
+
*/
|
|
1601
|
+
askUser?: string;
|
|
1443
1602
|
/** Set when `config.executorTiers` is on: the planner rates every step's complexity. */
|
|
1444
1603
|
tiers?: boolean;
|
|
1445
1604
|
}
|
|
@@ -1469,6 +1628,8 @@ interface ExecutorPromptContext {
|
|
|
1469
1628
|
sandbox?: string;
|
|
1470
1629
|
/** Set while `spawn_subagent` is callable (`subagents.dynamic`): when to hand work to a helper. */
|
|
1471
1630
|
subagents?: string;
|
|
1631
|
+
/** Set while `ask_user` is callable (`config.askUser`): when to ask the user, and how. */
|
|
1632
|
+
askUser?: string;
|
|
1472
1633
|
/** See `PlannerPromptContext.attachments`: this message carries no file, an earlier one did. */
|
|
1473
1634
|
attachments?: string;
|
|
1474
1635
|
}
|
|
@@ -2501,6 +2662,48 @@ declare const decisionEgressPolicy: (spec: IDecisionModelSpec) => IEgressPolicy;
|
|
|
2501
2662
|
*/
|
|
2502
2663
|
declare const resolveDecisionModel: (input: IDecisionModel | IDecisionModelSpec | undefined, credentials?: CredentialStore) => Promise<IDecisionModel | undefined>;
|
|
2503
2664
|
|
|
2665
|
+
/** What `onQuestion` is given: the model's question and options, cleaned (see the shared file). */
|
|
2666
|
+
type AskUserRequest = AskUserRequest$1<IPlanStep>;
|
|
2667
|
+
/**
|
|
2668
|
+
* Answers the agent's question: `{ choice: [label, ...] }` (labels exactly as offered; one unless
|
|
2669
|
+
* `multiple`), `{ other: text }` (only when `allowOther`) or `{ declined: true }`. The host decides,
|
|
2670
|
+
* never the model. A handler that throws, or answers with anything else, counts as "not answered".
|
|
2671
|
+
*/
|
|
2672
|
+
type AskUserHandler = (request: AskUserRequest, ctx: AskUserContext) => AskUserAnswer | Promise<AskUserAnswer>;
|
|
2673
|
+
interface AskUserConfig {
|
|
2674
|
+
/**
|
|
2675
|
+
* Who answers. Without it there is no tool - unless the agent runs as a subagent of a run that
|
|
2676
|
+
* has one (`createSubagentTool`, in-process): it then asks through that run.
|
|
2677
|
+
*/
|
|
2678
|
+
onQuestion?: AskUserHandler;
|
|
2679
|
+
/**
|
|
2680
|
+
* How long one question waits for an answer. Default 300 000 (5 minutes). `0` or `Infinity`: no
|
|
2681
|
+
* limit of its own - the question waits until the run is stopped; so does a value above
|
|
2682
|
+
* 2^31 - 1. Negative or NaN: `createAgent` throws. The step's `chatTimeoutMs` (and a subagent's
|
|
2683
|
+
* `timeoutMs`) stop while a question waits.
|
|
2684
|
+
*/
|
|
2685
|
+
timeoutMs?: number;
|
|
2686
|
+
/** Questions one run may ask, its helpers' and subagents' included. Default 3. */
|
|
2687
|
+
maxPerRun?: number;
|
|
2688
|
+
}
|
|
2689
|
+
/**
|
|
2690
|
+
* Internal - one run's way to the person (the run the host started makes it; its helpers share
|
|
2691
|
+
* it; a subagent the host defined is given its caller's, marked with `subagent`).
|
|
2692
|
+
*/
|
|
2693
|
+
interface AskUserChannel {
|
|
2694
|
+
handler: AskUserHandler;
|
|
2695
|
+
settings: AskUserSettings;
|
|
2696
|
+
/** The questions asked so far in the run the host started. */
|
|
2697
|
+
asked: {
|
|
2698
|
+
count: number;
|
|
2699
|
+
};
|
|
2700
|
+
/** Set for a subagent the host defined: every question it asks says so. */
|
|
2701
|
+
subagent?: {
|
|
2702
|
+
id: string;
|
|
2703
|
+
depth: number;
|
|
2704
|
+
};
|
|
2705
|
+
}
|
|
2706
|
+
|
|
2504
2707
|
/**
|
|
2505
2708
|
* MCP Apps: a completion an app asks the HOST's model for (`sampling/createMessage` sent by the
|
|
2506
2709
|
* view, the extension's draft revision; the request is MCP's own `CreateMessageRequest`).
|
|
@@ -2776,6 +2979,19 @@ interface BrowserAgentConfig {
|
|
|
2776
2979
|
toolSearchThreshold?: number;
|
|
2777
2980
|
/** Consent policy for tool calls: autopilot, ask before writes, ask always, read-only. */
|
|
2778
2981
|
toolApproval?: ToolApprovalConfig;
|
|
2982
|
+
/**
|
|
2983
|
+
* Let the MODEL ask the person a closed question with buttons (the `ask_user` tool: one short
|
|
2984
|
+
* question, 2-6 options, optionally several picks or an answer in their own words) instead of
|
|
2985
|
+
* guessing. Off unless set: with it off there is no tool and no prompt mentions it. The tool
|
|
2986
|
+
* exists only when someone can answer - `onQuestion`, or (for a subagent `createSubagentTool`
|
|
2987
|
+
* runs in-process) the run that called it; `true` / `{}` without a handler is "on, the handler
|
|
2988
|
+
* comes later" (`useAgent` supplies one). The host decides, never the model; at most
|
|
2989
|
+
* `maxPerRun` questions per run (default 3), each bounded by `timeoutMs` (default 5 minutes;
|
|
2990
|
+
* the step's time limit stops while it waits), a stop ends the wait at once. The question and
|
|
2991
|
+
* options are the MODEL's text, cleaned: show them as plain text. See docs/capabilities.md,
|
|
2992
|
+
* "Asking the user".
|
|
2993
|
+
*/
|
|
2994
|
+
askUser?: boolean | AskUserConfig;
|
|
2779
2995
|
/**
|
|
2780
2996
|
* MCP Apps asking this agent's model for a completion (`Agent.sampleForApp`, the app's
|
|
2781
2997
|
* `sampling/createMessage`): the caps - `maxTokens` per request (1024), `maxRequestsPerMinute`
|
|
@@ -3223,6 +3439,11 @@ interface AgentContext {
|
|
|
3223
3439
|
* the executor's prompts say when a helper is worth it.
|
|
3224
3440
|
*/
|
|
3225
3441
|
subagents?: true;
|
|
3442
|
+
/**
|
|
3443
|
+
* Set while `ask_user` is among the tools (`config.askUser`): the planner's and the executor's
|
|
3444
|
+
* prompts say when a question is worth it (the one exception to "never ask the user").
|
|
3445
|
+
*/
|
|
3446
|
+
askUser?: true;
|
|
3226
3447
|
/**
|
|
3227
3448
|
* The rendered instructions of the MCP servers whose tools are mounted (`renderMcpInstructions`);
|
|
3228
3449
|
* absent when none sent any or `config.mcpInstructions` is false. Built once, when the agent is
|
|
@@ -4620,6 +4841,11 @@ interface ToolRunContext {
|
|
|
4620
4841
|
* in-process subagent runs under them rather than wait for its own parent.
|
|
4621
4842
|
*/
|
|
4622
4843
|
sessionLocks?: () => readonly string[];
|
|
4844
|
+
/**
|
|
4845
|
+
* Internal - the run's way to the person (`config.askUser`): `ask_user` asks through it, a
|
|
4846
|
+
* helper the run starts shares it, and a subagent the host defined asks through it too.
|
|
4847
|
+
*/
|
|
4848
|
+
askUser?: AskUserChannel;
|
|
4623
4849
|
}
|
|
4624
4850
|
/** Read the run context the agent passes to a tool's execute (undefined outside a run). */
|
|
4625
4851
|
declare const toolRunContextOf: (options: unknown) => ToolRunContext | undefined;
|
|
@@ -4776,5 +5002,5 @@ declare const postStorageChange: (dbName: string | undefined, change: StorageCha
|
|
|
4776
5002
|
*/
|
|
4777
5003
|
declare const onStorageChange: (dbName: string | undefined, listener: (change: StorageChange) => void) => (() => void);
|
|
4778
5004
|
|
|
4779
|
-
export { APP_SAMPLING_MAX_IMAGES, APP_SAMPLING_MAX_IMAGE_BYTES, APP_SAMPLING_MAX_INPUT_CHARS, APP_SAMPLING_MAX_MESSAGES, APP_SAMPLING_MAX_SYSTEM_CHARS, APP_SAMPLING_MAX_TOKENS, APP_SAMPLING_PER_APP, APP_SAMPLING_PER_MINUTE, APP_SAMPLING_REASONING_TOKENS, APP_SAMPLING_RPC_CODES, AgentTool, AgentToolSet, AppSamplingError, AttachmentsNotSupportedError, ContextWindowExceededError, DECISION_PROVIDERS, DEFAULT_COMPACTION_THRESHOLD_RATIO, DEFAULT_DECISION_CONFIDENCE_THRESHOLD, DEFAULT_DECISION_TIMEOUT_MS, EgressError, FILES_STORE, FIND_TOOLS_NAME, FORGET_SKILL_TOOL, GENERATE_IMAGE_TOOL, GENERATE_SPEECH_TOOL, ImagesNotSupportedError, IndexedDBRunStore, IndexedDBStore, KEYS_STORE, 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, MODEL_TIERS, McpAppToolResult, McpElicitationReason, McpElicitationSchema, McpSkillConsent, McpSkillConsentView, MediaBudgetError, MediaError, MemoryCredentialStore, MemoryRunStore, MemorySkillStore, MemoryStore, NO_ATTACHMENT_NOTE, PipelineDefinition, PipelineEvent, PipelineNode, PipelineNodeRunner, PipelineResult, PlanSchema, PlanStepSchema, RELAY_MAX_REPLAYS_PER_SECOND, RELAY_MAX_SENDS, RELAY_MAX_SEND_CHARS, RELAY_MAX_STRING, REPLAY_NOTE, RUNS_STORE, ReplanSchema, 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, SECRETS_STORE, SESSIONS_STORE, SESSION_LOCK_MODES, SKILL_TOOL_NAMES, SPAWN_INPUT_SCHEMA, SPAWN_SUBAGENT_TOOL, STORAGE_CHANGE_KINDS, SUBAGENT_DEFAULTS, SUBAGENT_MAX_DEPTH_LIMIT, SessionBusyError, SubagentSpawnError, TOOL_APPROVAL_MODES, TOOL_APPROVAL_TIMEOUT_MS, TOOL_SEARCH_WINDOW_SHARE, TRANSCRIBE_AUDIO_TOOL, TieredPlanSchema, TieredPlanStepSchema, ToolBudgetError, ToolDeniedError, VaultCredentialStore, VaultOptions, VfsSkillStore, VirtualFileSystem, WEBLLM_DEFAULT_CONTEXT_WINDOW, WEB_FETCH_TOOL, WEB_SEARCH_TOOL, acceptMedia, adoptSubagentEvent, appSamplingRequestOf, appSamplingText, askDecisionModel, attachmentKind, buildMediaModelFromSpec, buildModelFromStage, buildSearchRequest, bytesToBase64, checkEgressUrl, checkLimits, classifyAddress, compactHistory, compactSteps, compressHistory, contextOverflowOf, contextWindowOf, createAgent, createAppSamplingLimiter, createEgressTools, createFileTools, createFindToolsTool, createGuardedFetch, createLearning, createLogger, createMedia, createPipeline, createPlan, createRunControl, createSearchTools, createSkillTools, createSubagentTool, createToolResultClearer, createWebFetchTool, createWebLLMModel, createWebSearchTool, decideReplan, decideToolPermission, decisionEgressPolicy, decisionModelFromAiSdk, decryptJSON, defaultPrompts, defineSkill, defineTool, directBrowserOk, dispatch, encryptJSON, escalationReasonOf, messageTokens as estimateMessagesTokens, estimateTokens, executeStep, fileToolBindingOf, findSecret, fitCompactionToWindow, generate, generateStructured, getOrCreateVaultKey, hostMatches, htmlToText, isAttachmentRefusal, isCodeExecutionTool, isDirectModel, isEscalatableError, isImageRefusal, isProviderSpec, isReadOnlyTool, isReplayedToolOutput, isTextMime, isWebGPUAvailable, learnedPreamble, limitModelOutput, loadSkillFromUrl, looksLikeJson, markCodeExecution, markReadOnly, matchRule, mediaTypeOf, mediaUsageOf, mergeProviderOptions, mimeFromPath, nextStrongerTier, nodeResolver, normalizePath, normalizeSkillName, normalizeSteps, normalizeUsage, onStorageChange, openAgentWebDB, outputCapNotice, parseExecutorResponse, parsePlainText, parsePlannerResponse, parseReplannerResponse, parseSearchResponse, parseSkillMarkdown, pickPipelineRoute, pickTier, postStorageChange, preloadWebLLMModel, renderActiveSkills, renderCatalog, renderSearchCatalog, renderSkillIndex, replanWanted, resolveAppSampling, resolveBudgets, resolveCaching, resolveCompaction, resolveConfig, resolveDecisionModel, resolveDynamicSubagents, resolveEgressPolicy, resolveEscalation, resolveModel, resolveResume, resolveStage, resolveThinking, runToolLoop, sanitizeSearchResults, schemaHintOf, searchEgressPolicy, searchStatusMessage, searchToolResult, searchTools, selectToolMode, serveSubagentWorker, shouldReplan, skillPreamble, sniffMediaType, splitBlocker, stageOutputCap, stageReasons, stream, supportsImages, supportsNativeTools, supportsPdf, supportsStructuredOutput, synthesizeAnswer, thinkingFor, toFilePart, toImagePart, tokenize, toolCatalogOf, toolDefinitionTokens, toolRunContextOf, unloadWebLLMModel, watchSession, webLLMContextWindow, withRollingBreakpoint, withSystem, withWebLLMContextWindow, wrapTranscript };
|
|
4780
|
-
export type { Agent, AgentContext, AgentEvent, AgentEventHandler, AgentLogger, AgentLoggerSink, AgentWebDBOptions, AppSamplingErrorCode, AppSamplingImage, AppSamplingMessage, AppSamplingOptions, AppSamplingRequest, AppSamplingResult, AppSamplingSettings, AppSamplingView, AppToolCallRequest, AttachmentKind, BrowserAgentConfig, ClearedInfo, CompactOptions, CompactResult, CompactionConfig, CompressOptions, ContextStore, CredentialStore, DecisionFallbackReason, DecisionPoint, EffectiveToolStrategy, EgressErrorCode, EncryptedBlob, EscalationConfig, EscalationReason, ExecutorPromptContext, ExecutorResult, FileToolBinding, FileToolsOptions, GenerateOptions, GuardedFetch, IAiSdkDecisionOptions, IDecisionAnswer, IDecisionCallOptions, IDecisionConfig, IDecisionEvent, IDecisionModel, IDecisionModelSpec, IDecisionOption, IDecisionOutcome, IDecisionQuestion, IDynamicSubagentsConfig, IEgressPolicy, IMedia, IMediaConfig, IMediaFile, IMediaModelSpec, IMediaOptions, IMediaRun, IMediaUsage, IPlan, IPlanStep, IResolvedDynamicSubagents, IResolvedEgressPolicy, ISandboxConfig, ISandboxError, ISandboxLimits, ISandboxResult, ISanitizedSearch, ISearchAnswer, ISearchConfig, ISearchOptions, ISearchRequest, ISearchResult, ISearchToolResult, ISearchUsage, IStepEscalation, IStepResult, ISubagentsConfig, IToolCall, ITranscription, IUsage, IWebFetchOptions, IWebSearchOptions, IndexedDBRunStoreOptions, IndexedDBStoreOptions, Learning, LearningConfig, LimitBreach, LimitKind, LoadSkillOptions, LogLevel, McpSkillOrigin, MediaImageModel, MediaKind, MediaModelKind, MediaSpeechModel, MediaTranscriptionModel, MessageEndpoint, ModelInput, ModelTier, NodeResolverOptions, OutputCap, ParentToWorker, Phase, PhaseBudgets, Pipeline, PipelineOptions, PipelineRouteOptions, PipelineRouteResult, PipelineRunOptions, PlanShape, PlannerPromptContext, PlannerResult, PromptCachingSetting, PromptParts, Prompts, ProviderModelSpec, ProviderOptionsMap, ProviderType, ProxiedToolSpec, RawAction, ReplanDecision, ReplanMode, ReplanShape, ReplanTrigger, ReplannerPromptContext, ReplannerResult, ResolvedCaching, ResolvedCompaction, ResolvedConfig, ResolvedStage, ResolvedThinking, RunControl, RunFile, RunImage, RunOptions, RunPersistence, RunResult, RunSnapshot, RunStatus, RunStoreOptions, SandboxConfig, SandboxWorkerLike, SaveSkillInput, SearchEngine, SearchFreshness, SearchProvider, SearchToolsOptions, ServeSubagentOptions, SessionHolder, SessionLockMode, SessionRunState, SessionWatch, Skill, SkillOrigin, SkillStore, StageInput, StageOverride, StepComplexity, StorageChange, StorageChangeKind, StorageChangeOp, StoredMessage, StructuredResult, SubagentDefaultTools, SubagentInfo, SubagentProfile, SubagentToolOptions, SubagentWorkerConfig, SynthesizerPromptContext, ThinkingConfig, ThinkingLevel, ThinkingSetting, ThinkingStage, TierReason, TokenLimits, ToolApprovalApp, ToolApprovalConfig, ToolApprovalContext, ToolApprovalDecision, ToolApprovalMode, ToolApprovalRequest, ToolCallMode, ToolCatalogEntry, ToolLoopCallbacks, ToolLoopOptions, ToolLoopResult, ToolMode, ToolPermission, ToolResultClearing, ToolRunContext, ToolSelectionStrategy, UsagePhase, VfsListener, VirtualFile, VirtualFileInfo, VirtualFileSystemOptions, WatchSessionOptions, WebLLMAppConfigLike, WebLLMModelOptions, WorkerLike, WorkerToParent };
|
|
5005
|
+
export { APP_SAMPLING_MAX_IMAGES, APP_SAMPLING_MAX_IMAGE_BYTES, APP_SAMPLING_MAX_INPUT_CHARS, APP_SAMPLING_MAX_MESSAGES, APP_SAMPLING_MAX_SYSTEM_CHARS, APP_SAMPLING_MAX_TOKENS, APP_SAMPLING_PER_APP, APP_SAMPLING_PER_MINUTE, APP_SAMPLING_REASONING_TOKENS, APP_SAMPLING_RPC_CODES, 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, AgentTool, AgentToolSet, AppSamplingError, AskUserInputError, AttachmentsNotSupportedError, ContextWindowExceededError, DECISION_PROVIDERS, DEFAULT_COMPACTION_THRESHOLD_RATIO, DEFAULT_DECISION_CONFIDENCE_THRESHOLD, DEFAULT_DECISION_TIMEOUT_MS, EgressError, FILES_STORE, FIND_TOOLS_NAME, FORGET_SKILL_TOOL, GENERATE_IMAGE_TOOL, GENERATE_SPEECH_TOOL, ImagesNotSupportedError, IndexedDBRunStore, IndexedDBStore, KEYS_STORE, 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, MODEL_TIERS, McpAppToolResult, McpElicitationReason, McpElicitationSchema, McpSkillConsent, McpSkillConsentView, MediaBudgetError, MediaError, MemoryCredentialStore, MemoryRunStore, MemorySkillStore, MemoryStore, NO_ATTACHMENT_NOTE, PipelineDefinition, PipelineEvent, PipelineNode, PipelineNodeRunner, PipelineResult, PlanSchema, PlanStepSchema, RELAY_MAX_REPLAYS_PER_SECOND, RELAY_MAX_SENDS, RELAY_MAX_SEND_CHARS, RELAY_MAX_STRING, REPLAY_NOTE, RUNS_STORE, ReplanSchema, 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, SECRETS_STORE, SESSIONS_STORE, SESSION_LOCK_MODES, SKILL_TOOL_NAMES, SPAWN_INPUT_SCHEMA, SPAWN_SUBAGENT_TOOL, STORAGE_CHANGE_KINDS, SUBAGENT_DEFAULTS, SUBAGENT_MAX_DEPTH_LIMIT, SessionBusyError, SubagentSpawnError, TOOL_APPROVAL_MODES, TOOL_APPROVAL_TIMEOUT_MS, TOOL_SEARCH_WINDOW_SHARE, TRANSCRIBE_AUDIO_TOOL, TieredPlanSchema, TieredPlanStepSchema, ToolBudgetError, ToolDeniedError, VaultCredentialStore, VaultOptions, VfsSkillStore, VirtualFileSystem, WEBLLM_DEFAULT_CONTEXT_WINDOW, WEB_FETCH_TOOL, WEB_SEARCH_TOOL, acceptMedia, adoptSubagentEvent, appSamplingRequestOf, appSamplingText, askDecisionModel, attachmentKind, buildMediaModelFromSpec, buildModelFromStage, buildSearchRequest, bytesToBase64, checkAskUserAnswer, checkAskUserInput, checkEgressUrl, checkLimits, classifyAddress, cleanAskUserText, compactHistory, compactSteps, compressHistory, contextOverflowOf, contextWindowOf, createAgent, createAppSamplingLimiter, createEgressTools, createFileTools, createFindToolsTool, createGuardedFetch, createLearning, createLogger, createMedia, createPipeline, createPlan, createRunControl, createSearchTools, createSkillTools, createSubagentTool, createToolResultClearer, createWebFetchTool, createWebLLMModel, createWebSearchTool, decideReplan, decideToolPermission, decisionEgressPolicy, decisionModelFromAiSdk, decryptJSON, defaultPrompts, defineSkill, defineTool, directBrowserOk, dispatch, encryptJSON, escalationReasonOf, messageTokens as estimateMessagesTokens, estimateTokens, executeStep, fileToolBindingOf, findSecret, fitCompactionToWindow, generate, generateStructured, getOrCreateVaultKey, hostMatches, htmlToText, isAttachmentRefusal, isCodeExecutionTool, isDirectModel, isEscalatableError, isImageRefusal, isProviderSpec, isReadOnlyTool, isReplayedToolOutput, isTextMime, isWebGPUAvailable, learnedPreamble, limitModelOutput, loadSkillFromUrl, looksLikeJson, markCodeExecution, markReadOnly, matchRule, mediaTypeOf, mediaUsageOf, mergeProviderOptions, mimeFromPath, nextStrongerTier, nodeResolver, normalizePath, normalizeSkillName, normalizeSteps, normalizeUsage, onStorageChange, openAgentWebDB, outputCapNotice, parseExecutorResponse, parsePlainText, parsePlannerResponse, parseReplannerResponse, parseSearchResponse, parseSkillMarkdown, pickPipelineRoute, pickTier, postStorageChange, preloadWebLLMModel, renderActiveSkills, renderCatalog, renderSearchCatalog, renderSkillIndex, replanWanted, resolveAppSampling, resolveBudgets, resolveCaching, resolveCompaction, resolveConfig, resolveDecisionModel, resolveDynamicSubagents, resolveEgressPolicy, resolveEscalation, resolveModel, resolveResume, resolveStage, resolveThinking, runToolLoop, sanitizeSearchResults, schemaHintOf, searchEgressPolicy, searchStatusMessage, searchToolResult, searchTools, selectToolMode, serveSubagentWorker, shouldReplan, skillPreamble, sniffMediaType, splitBlocker, stageOutputCap, stageReasons, stream, supportsImages, supportsNativeTools, supportsPdf, supportsStructuredOutput, synthesizeAnswer, thinkingFor, toFilePart, toImagePart, tokenize, toolCatalogOf, toolDefinitionTokens, toolRunContextOf, unloadWebLLMModel, watchSession, webLLMContextWindow, withRollingBreakpoint, withSystem, withWebLLMContextWindow, wrapTranscript };
|
|
5006
|
+
export type { Agent, AgentContext, AgentEvent, AgentEventHandler, AgentLogger, AgentLoggerSink, AgentWebDBOptions, AppSamplingErrorCode, AppSamplingImage, AppSamplingMessage, AppSamplingOptions, AppSamplingRequest, AppSamplingResult, AppSamplingSettings, AppSamplingView, AppToolCallRequest, AskUserAction, AskUserAnswer, AskUserCheckedAnswer, AskUserConfig, AskUserContext, AskUserHandler, AskUserOption, AskUserQuestion, AskUserReason, AskUserRequest, AttachmentKind, BrowserAgentConfig, ClearedInfo, CompactOptions, CompactResult, CompactionConfig, CompressOptions, ContextStore, CredentialStore, DecisionFallbackReason, DecisionPoint, EffectiveToolStrategy, EgressErrorCode, EncryptedBlob, EscalationConfig, EscalationReason, ExecutorPromptContext, ExecutorResult, FileToolBinding, FileToolsOptions, GenerateOptions, GuardedFetch, IAiSdkDecisionOptions, IDecisionAnswer, IDecisionCallOptions, IDecisionConfig, IDecisionEvent, IDecisionModel, IDecisionModelSpec, IDecisionOption, IDecisionOutcome, IDecisionQuestion, IDynamicSubagentsConfig, IEgressPolicy, IMedia, IMediaConfig, IMediaFile, IMediaModelSpec, IMediaOptions, IMediaRun, IMediaUsage, IPlan, IPlanStep, IResolvedDynamicSubagents, IResolvedEgressPolicy, ISandboxConfig, ISandboxError, ISandboxLimits, ISandboxResult, ISanitizedSearch, ISearchAnswer, ISearchConfig, ISearchOptions, ISearchRequest, ISearchResult, ISearchToolResult, ISearchUsage, IStepEscalation, IStepResult, ISubagentsConfig, IToolCall, ITranscription, IUsage, IWebFetchOptions, IWebSearchOptions, IndexedDBRunStoreOptions, IndexedDBStoreOptions, Learning, LearningConfig, LimitBreach, LimitKind, LoadSkillOptions, LogLevel, McpSkillOrigin, MediaImageModel, MediaKind, MediaModelKind, MediaSpeechModel, MediaTranscriptionModel, MessageEndpoint, ModelInput, ModelTier, NodeResolverOptions, OutputCap, ParentToWorker, Phase, PhaseBudgets, Pipeline, PipelineOptions, PipelineRouteOptions, PipelineRouteResult, PipelineRunOptions, PlanShape, PlannerPromptContext, PlannerResult, PromptCachingSetting, PromptParts, Prompts, ProviderModelSpec, ProviderOptionsMap, ProviderType, ProxiedToolSpec, RawAction, ReplanDecision, ReplanMode, ReplanShape, ReplanTrigger, ReplannerPromptContext, ReplannerResult, ResolvedCaching, ResolvedCompaction, ResolvedConfig, ResolvedStage, ResolvedThinking, RunControl, RunFile, RunImage, RunOptions, RunPersistence, RunResult, RunSnapshot, RunStatus, RunStoreOptions, SandboxConfig, SandboxWorkerLike, SaveSkillInput, SearchEngine, SearchFreshness, SearchProvider, SearchToolsOptions, ServeSubagentOptions, SessionHolder, SessionLockMode, SessionRunState, SessionWatch, Skill, SkillOrigin, SkillStore, StageInput, StageOverride, StepComplexity, StorageChange, StorageChangeKind, StorageChangeOp, StoredMessage, StructuredResult, SubagentDefaultTools, SubagentInfo, SubagentProfile, SubagentToolOptions, SubagentWorkerConfig, SynthesizerPromptContext, ThinkingConfig, ThinkingLevel, ThinkingSetting, ThinkingStage, TierReason, TokenLimits, ToolApprovalApp, ToolApprovalConfig, ToolApprovalContext, ToolApprovalDecision, ToolApprovalMode, ToolApprovalRequest, ToolCallMode, ToolCatalogEntry, ToolLoopCallbacks, ToolLoopOptions, ToolLoopResult, ToolMode, ToolPermission, ToolResultClearing, ToolRunContext, ToolSelectionStrategy, UsagePhase, VfsListener, VirtualFile, VirtualFileInfo, VirtualFileSystemOptions, WatchSessionOptions, WebLLMAppConfigLike, WebLLMModelOptions, WorkerLike, WorkerToParent };
|
package/dist/index.d.ts
CHANGED
|
@@ -177,6 +177,8 @@ interface RunSnapshot {
|
|
|
177
177
|
escalations?: number;
|
|
178
178
|
/** Helpers the model started so far (counts against `subagents.dynamic.maxChildren` on resume). */
|
|
179
179
|
subagentsSpawned?: number;
|
|
180
|
+
/** Questions `ask_user` put to the person so far (counts against `askUser.maxPerRun` on resume). */
|
|
181
|
+
questionsAsked?: number;
|
|
180
182
|
/**
|
|
181
183
|
* The attempt that wrote the snapshot: 1 for the run as first started, one more for every
|
|
182
184
|
* resume - the `attempt` of its events. A resume records its attempt BEFORE any of its events
|
|
@@ -683,6 +685,146 @@ declare const decideToolPermission: (opts: {
|
|
|
683
685
|
mcpSkills?: readonly string[];
|
|
684
686
|
}) => ToolPermission;
|
|
685
687
|
|
|
688
|
+
declare const ASK_USER_TOOL = "ask_user";
|
|
689
|
+
/** How long one question waits for the person, by default: a human is reading it. */
|
|
690
|
+
declare const ASK_USER_TIMEOUT_MS = 300000;
|
|
691
|
+
/**
|
|
692
|
+
* The longest wait a timer holds (2^31 - 1 ms, about 24.8 days). `setTimeout` fires a longer one -
|
|
693
|
+
* Infinity included - after about 1 ms, so a `timeoutMs` past it is taken as no limit at all.
|
|
694
|
+
*/
|
|
695
|
+
declare const ASK_USER_TIMEOUT_MAX_MS = 2147483647;
|
|
696
|
+
/** The most questions one run may ask, by default (its helpers' and subagents' included). */
|
|
697
|
+
declare const ASK_USER_MAX_PER_RUN = 3;
|
|
698
|
+
/** A question offers at least this many options... */
|
|
699
|
+
declare const ASK_USER_MIN_OPTIONS = 2;
|
|
700
|
+
/** ...and at most this many. */
|
|
701
|
+
declare const ASK_USER_MAX_OPTIONS = 6;
|
|
702
|
+
/** The longest question, in characters (after cleaning). */
|
|
703
|
+
declare const ASK_USER_QUESTION_MAX_CHARS = 500;
|
|
704
|
+
/** The longest option label. */
|
|
705
|
+
declare const ASK_USER_LABEL_MAX_CHARS = 80;
|
|
706
|
+
/** The longest option description. */
|
|
707
|
+
declare const ASK_USER_DESCRIPTION_MAX_CHARS = 200;
|
|
708
|
+
/** The most of a person's own words (`{ other }`) the model is given; the rest is cut. */
|
|
709
|
+
declare const ASK_USER_OTHER_MAX_CHARS = 2000;
|
|
710
|
+
/** One option of a question, as the person is shown it. Both strings are the MODEL's, cleaned. */
|
|
711
|
+
interface AskUserOption {
|
|
712
|
+
label: string;
|
|
713
|
+
description?: string;
|
|
714
|
+
}
|
|
715
|
+
/** A question as checked and cleaned: what a host shows and an event carries. */
|
|
716
|
+
interface AskUserQuestion {
|
|
717
|
+
question: string;
|
|
718
|
+
options: AskUserOption[];
|
|
719
|
+
/** The person may pick several options. */
|
|
720
|
+
multiple: boolean;
|
|
721
|
+
/** The person may answer in their own words instead of picking. */
|
|
722
|
+
allowOther: boolean;
|
|
723
|
+
}
|
|
724
|
+
/** What the host's `onQuestion` is given. Every string in it is the model's text, cleaned. */
|
|
725
|
+
interface AskUserRequest$1<TStep = unknown> extends AskUserQuestion {
|
|
726
|
+
/** Unique per question; the same id is in the two events. */
|
|
727
|
+
id: string;
|
|
728
|
+
/** The plan step whose tool call asks. */
|
|
729
|
+
step?: TStep;
|
|
730
|
+
runId?: string;
|
|
731
|
+
/** Set when a helper or a subagent of the run asks, not the run itself: its id and depth. */
|
|
732
|
+
subagent?: {
|
|
733
|
+
id: string;
|
|
734
|
+
depth: number;
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* The person's answer: the labels they picked (exactly as offered; one unless `multiple`), their
|
|
739
|
+
* own words (only when `allowOther`), or that they would rather not answer.
|
|
740
|
+
*/
|
|
741
|
+
type AskUserAnswer = {
|
|
742
|
+
choice: string[];
|
|
743
|
+
} | {
|
|
744
|
+
other: string;
|
|
745
|
+
} | {
|
|
746
|
+
declined: true;
|
|
747
|
+
};
|
|
748
|
+
interface AskUserContext {
|
|
749
|
+
/**
|
|
750
|
+
* Aborted when the question ends WITHOUT the host's answer: no answer within `timeoutMs`
|
|
751
|
+
* (`signal.reason` is an Error named 'TimeoutError'), the run was stopped, or the handler
|
|
752
|
+
* failed. Take the prompt down then: an answer given later is ignored. Never aborted once the
|
|
753
|
+
* host has answered.
|
|
754
|
+
*/
|
|
755
|
+
signal: AbortSignal;
|
|
756
|
+
}
|
|
757
|
+
/** `askUser` beside `onQuestion`, resolved: `timeoutMs` 0 = no limit of its own. */
|
|
758
|
+
interface AskUserSettings {
|
|
759
|
+
timeoutMs: number;
|
|
760
|
+
maxPerRun: number;
|
|
761
|
+
}
|
|
762
|
+
/** How a question ended. `automatic`: nobody decided (a time limit, a stop, a failed handler). */
|
|
763
|
+
type AskUserAction = 'choice' | 'other' | 'declined' | 'timeout' | 'stopped';
|
|
764
|
+
/** Why a question was closed as `declined` without the person deciding. */
|
|
765
|
+
type AskUserReason = 'handler-error' | 'invalid-answer' | 'cannot-park';
|
|
766
|
+
/** The two events of a question. Neither ever carries the person's own words. */
|
|
767
|
+
type AskUserEvent<TStep = unknown> = {
|
|
768
|
+
type: 'user.question-asked';
|
|
769
|
+
id: string;
|
|
770
|
+
question: string;
|
|
771
|
+
options: AskUserOption[];
|
|
772
|
+
multiple: boolean;
|
|
773
|
+
allowOther: boolean;
|
|
774
|
+
step?: TStep;
|
|
775
|
+
subagent?: {
|
|
776
|
+
id: string;
|
|
777
|
+
depth: number;
|
|
778
|
+
};
|
|
779
|
+
} | {
|
|
780
|
+
type: 'user.question-answered';
|
|
781
|
+
id: string;
|
|
782
|
+
action: AskUserAction;
|
|
783
|
+
/** true when nobody decided: a time limit, a stop, a failed handler, an unusable answer. */
|
|
784
|
+
automatic: boolean;
|
|
785
|
+
/** Action 'choice': the labels picked. Never the text of an `other` answer. */
|
|
786
|
+
choice?: string[];
|
|
787
|
+
/** Action 'declined' with `automatic`: why. */
|
|
788
|
+
reason?: AskUserReason;
|
|
789
|
+
};
|
|
790
|
+
/** A bad `ask_user` input: the tool call fails with this message, which says what to fix. */
|
|
791
|
+
declare class AskUserInputError extends Error {
|
|
792
|
+
constructor(message: string);
|
|
793
|
+
toJSON(): string;
|
|
794
|
+
}
|
|
795
|
+
/** The model's text as a person may be shown it: a string, invisible characters removed, trimmed. */
|
|
796
|
+
declare const cleanAskUserText: (raw: unknown, oneLine?: boolean) => string;
|
|
797
|
+
/**
|
|
798
|
+
* Check and clean the model's `ask_user` arguments: 2-6 options, no two labels alike (letter case
|
|
799
|
+
* and spaces aside), each label 1-80 characters, a description at most 200, a question of 1-500 -
|
|
800
|
+
* all measured after cleaning. An option may be given as a bare string (its label). Throws
|
|
801
|
+
* {@link AskUserInputError} with what to fix.
|
|
802
|
+
*/
|
|
803
|
+
declare const checkAskUserInput: (raw: unknown) => AskUserQuestion;
|
|
804
|
+
/** An answer as checked: what the model is told. */
|
|
805
|
+
type AskUserCheckedAnswer = {
|
|
806
|
+
kind: 'choice';
|
|
807
|
+
choice: string[];
|
|
808
|
+
} | {
|
|
809
|
+
kind: 'other';
|
|
810
|
+
text: string;
|
|
811
|
+
} | {
|
|
812
|
+
kind: 'declined';
|
|
813
|
+
};
|
|
814
|
+
/**
|
|
815
|
+
* Check the host's answer against the question: exactly one of `choice` (labels that were
|
|
816
|
+
* offered, no repeats, one unless `multiple`), `other` (a non-empty text, only when `allowOther`;
|
|
817
|
+
* cleaned and cut at {@link ASK_USER_OTHER_MAX_CHARS}) or `declined: true`. Anything else is not
|
|
818
|
+
* an answer.
|
|
819
|
+
*/
|
|
820
|
+
declare const checkAskUserAnswer: (q: AskUserQuestion, raw: unknown) => {
|
|
821
|
+
ok: true;
|
|
822
|
+
value: AskUserCheckedAnswer;
|
|
823
|
+
} | {
|
|
824
|
+
ok: false;
|
|
825
|
+
reason: string;
|
|
826
|
+
};
|
|
827
|
+
|
|
686
828
|
type ReplanMode = 'continue' | 'revise' | 'finish';
|
|
687
829
|
type Phase = 'plan' | 'execute' | 'replan' | 'synthesize';
|
|
688
830
|
/**
|
|
@@ -951,6 +1093,18 @@ type AgentEventBody =
|
|
|
951
1093
|
reason?: string;
|
|
952
1094
|
automatic: boolean;
|
|
953
1095
|
}
|
|
1096
|
+
/**
|
|
1097
|
+
* The model asked the person a question (`ask_user`, `config.askUser`): `onQuestion` is being
|
|
1098
|
+
* called. `question` and the options are the MODEL's text, cleaned - show them as plain text.
|
|
1099
|
+
* `subagent`: a helper or a subagent of the run asks. Followed by `user.question-answered` with
|
|
1100
|
+
* the same id - unless the run parked on it (the Node package only).
|
|
1101
|
+
*
|
|
1102
|
+
* `user.question-answered`: how it ended - `action` 'choice' (with the labels picked in
|
|
1103
|
+
* `choice`), 'other' (the person's own words: they go to the model as the tool's result and
|
|
1104
|
+
* NEVER into an event), 'declined', 'timeout' or 'stopped'. `automatic`: nobody decided (a time
|
|
1105
|
+
* limit, a stop, a failed handler - `reason` - or an answer that did not fit the question).
|
|
1106
|
+
*/
|
|
1107
|
+
| AskUserEvent<IPlanStep>
|
|
954
1108
|
/**
|
|
955
1109
|
* An MCP server asked the user for input during a tool call (the connection's `onElicitation`
|
|
956
1110
|
* is being called). `message`, `requestedSchema` and `url` are the SERVER's text: cleaned and
|
|
@@ -1440,6 +1594,11 @@ interface PlannerPromptContext {
|
|
|
1440
1594
|
sandbox?: string;
|
|
1441
1595
|
/** Set while `spawn_subagent` is callable (`subagents.dynamic`): when a helper is worth a step. */
|
|
1442
1596
|
subagents?: string;
|
|
1597
|
+
/**
|
|
1598
|
+
* Set while `ask_user` is callable (`config.askUser`): when a step may ask the user - the one
|
|
1599
|
+
* exception to "never plan a step that asks the user something".
|
|
1600
|
+
*/
|
|
1601
|
+
askUser?: string;
|
|
1443
1602
|
/** Set when `config.executorTiers` is on: the planner rates every step's complexity. */
|
|
1444
1603
|
tiers?: boolean;
|
|
1445
1604
|
}
|
|
@@ -1469,6 +1628,8 @@ interface ExecutorPromptContext {
|
|
|
1469
1628
|
sandbox?: string;
|
|
1470
1629
|
/** Set while `spawn_subagent` is callable (`subagents.dynamic`): when to hand work to a helper. */
|
|
1471
1630
|
subagents?: string;
|
|
1631
|
+
/** Set while `ask_user` is callable (`config.askUser`): when to ask the user, and how. */
|
|
1632
|
+
askUser?: string;
|
|
1472
1633
|
/** See `PlannerPromptContext.attachments`: this message carries no file, an earlier one did. */
|
|
1473
1634
|
attachments?: string;
|
|
1474
1635
|
}
|
|
@@ -2501,6 +2662,48 @@ declare const decisionEgressPolicy: (spec: IDecisionModelSpec) => IEgressPolicy;
|
|
|
2501
2662
|
*/
|
|
2502
2663
|
declare const resolveDecisionModel: (input: IDecisionModel | IDecisionModelSpec | undefined, credentials?: CredentialStore) => Promise<IDecisionModel | undefined>;
|
|
2503
2664
|
|
|
2665
|
+
/** What `onQuestion` is given: the model's question and options, cleaned (see the shared file). */
|
|
2666
|
+
type AskUserRequest = AskUserRequest$1<IPlanStep>;
|
|
2667
|
+
/**
|
|
2668
|
+
* Answers the agent's question: `{ choice: [label, ...] }` (labels exactly as offered; one unless
|
|
2669
|
+
* `multiple`), `{ other: text }` (only when `allowOther`) or `{ declined: true }`. The host decides,
|
|
2670
|
+
* never the model. A handler that throws, or answers with anything else, counts as "not answered".
|
|
2671
|
+
*/
|
|
2672
|
+
type AskUserHandler = (request: AskUserRequest, ctx: AskUserContext) => AskUserAnswer | Promise<AskUserAnswer>;
|
|
2673
|
+
interface AskUserConfig {
|
|
2674
|
+
/**
|
|
2675
|
+
* Who answers. Without it there is no tool - unless the agent runs as a subagent of a run that
|
|
2676
|
+
* has one (`createSubagentTool`, in-process): it then asks through that run.
|
|
2677
|
+
*/
|
|
2678
|
+
onQuestion?: AskUserHandler;
|
|
2679
|
+
/**
|
|
2680
|
+
* How long one question waits for an answer. Default 300 000 (5 minutes). `0` or `Infinity`: no
|
|
2681
|
+
* limit of its own - the question waits until the run is stopped; so does a value above
|
|
2682
|
+
* 2^31 - 1. Negative or NaN: `createAgent` throws. The step's `chatTimeoutMs` (and a subagent's
|
|
2683
|
+
* `timeoutMs`) stop while a question waits.
|
|
2684
|
+
*/
|
|
2685
|
+
timeoutMs?: number;
|
|
2686
|
+
/** Questions one run may ask, its helpers' and subagents' included. Default 3. */
|
|
2687
|
+
maxPerRun?: number;
|
|
2688
|
+
}
|
|
2689
|
+
/**
|
|
2690
|
+
* Internal - one run's way to the person (the run the host started makes it; its helpers share
|
|
2691
|
+
* it; a subagent the host defined is given its caller's, marked with `subagent`).
|
|
2692
|
+
*/
|
|
2693
|
+
interface AskUserChannel {
|
|
2694
|
+
handler: AskUserHandler;
|
|
2695
|
+
settings: AskUserSettings;
|
|
2696
|
+
/** The questions asked so far in the run the host started. */
|
|
2697
|
+
asked: {
|
|
2698
|
+
count: number;
|
|
2699
|
+
};
|
|
2700
|
+
/** Set for a subagent the host defined: every question it asks says so. */
|
|
2701
|
+
subagent?: {
|
|
2702
|
+
id: string;
|
|
2703
|
+
depth: number;
|
|
2704
|
+
};
|
|
2705
|
+
}
|
|
2706
|
+
|
|
2504
2707
|
/**
|
|
2505
2708
|
* MCP Apps: a completion an app asks the HOST's model for (`sampling/createMessage` sent by the
|
|
2506
2709
|
* view, the extension's draft revision; the request is MCP's own `CreateMessageRequest`).
|
|
@@ -2776,6 +2979,19 @@ interface BrowserAgentConfig {
|
|
|
2776
2979
|
toolSearchThreshold?: number;
|
|
2777
2980
|
/** Consent policy for tool calls: autopilot, ask before writes, ask always, read-only. */
|
|
2778
2981
|
toolApproval?: ToolApprovalConfig;
|
|
2982
|
+
/**
|
|
2983
|
+
* Let the MODEL ask the person a closed question with buttons (the `ask_user` tool: one short
|
|
2984
|
+
* question, 2-6 options, optionally several picks or an answer in their own words) instead of
|
|
2985
|
+
* guessing. Off unless set: with it off there is no tool and no prompt mentions it. The tool
|
|
2986
|
+
* exists only when someone can answer - `onQuestion`, or (for a subagent `createSubagentTool`
|
|
2987
|
+
* runs in-process) the run that called it; `true` / `{}` without a handler is "on, the handler
|
|
2988
|
+
* comes later" (`useAgent` supplies one). The host decides, never the model; at most
|
|
2989
|
+
* `maxPerRun` questions per run (default 3), each bounded by `timeoutMs` (default 5 minutes;
|
|
2990
|
+
* the step's time limit stops while it waits), a stop ends the wait at once. The question and
|
|
2991
|
+
* options are the MODEL's text, cleaned: show them as plain text. See docs/capabilities.md,
|
|
2992
|
+
* "Asking the user".
|
|
2993
|
+
*/
|
|
2994
|
+
askUser?: boolean | AskUserConfig;
|
|
2779
2995
|
/**
|
|
2780
2996
|
* MCP Apps asking this agent's model for a completion (`Agent.sampleForApp`, the app's
|
|
2781
2997
|
* `sampling/createMessage`): the caps - `maxTokens` per request (1024), `maxRequestsPerMinute`
|
|
@@ -3223,6 +3439,11 @@ interface AgentContext {
|
|
|
3223
3439
|
* the executor's prompts say when a helper is worth it.
|
|
3224
3440
|
*/
|
|
3225
3441
|
subagents?: true;
|
|
3442
|
+
/**
|
|
3443
|
+
* Set while `ask_user` is among the tools (`config.askUser`): the planner's and the executor's
|
|
3444
|
+
* prompts say when a question is worth it (the one exception to "never ask the user").
|
|
3445
|
+
*/
|
|
3446
|
+
askUser?: true;
|
|
3226
3447
|
/**
|
|
3227
3448
|
* The rendered instructions of the MCP servers whose tools are mounted (`renderMcpInstructions`);
|
|
3228
3449
|
* absent when none sent any or `config.mcpInstructions` is false. Built once, when the agent is
|
|
@@ -4620,6 +4841,11 @@ interface ToolRunContext {
|
|
|
4620
4841
|
* in-process subagent runs under them rather than wait for its own parent.
|
|
4621
4842
|
*/
|
|
4622
4843
|
sessionLocks?: () => readonly string[];
|
|
4844
|
+
/**
|
|
4845
|
+
* Internal - the run's way to the person (`config.askUser`): `ask_user` asks through it, a
|
|
4846
|
+
* helper the run starts shares it, and a subagent the host defined asks through it too.
|
|
4847
|
+
*/
|
|
4848
|
+
askUser?: AskUserChannel;
|
|
4623
4849
|
}
|
|
4624
4850
|
/** Read the run context the agent passes to a tool's execute (undefined outside a run). */
|
|
4625
4851
|
declare const toolRunContextOf: (options: unknown) => ToolRunContext | undefined;
|
|
@@ -4776,5 +5002,5 @@ declare const postStorageChange: (dbName: string | undefined, change: StorageCha
|
|
|
4776
5002
|
*/
|
|
4777
5003
|
declare const onStorageChange: (dbName: string | undefined, listener: (change: StorageChange) => void) => (() => void);
|
|
4778
5004
|
|
|
4779
|
-
export { APP_SAMPLING_MAX_IMAGES, APP_SAMPLING_MAX_IMAGE_BYTES, APP_SAMPLING_MAX_INPUT_CHARS, APP_SAMPLING_MAX_MESSAGES, APP_SAMPLING_MAX_SYSTEM_CHARS, APP_SAMPLING_MAX_TOKENS, APP_SAMPLING_PER_APP, APP_SAMPLING_PER_MINUTE, APP_SAMPLING_REASONING_TOKENS, APP_SAMPLING_RPC_CODES, AgentTool, AgentToolSet, AppSamplingError, AttachmentsNotSupportedError, ContextWindowExceededError, DECISION_PROVIDERS, DEFAULT_COMPACTION_THRESHOLD_RATIO, DEFAULT_DECISION_CONFIDENCE_THRESHOLD, DEFAULT_DECISION_TIMEOUT_MS, EgressError, FILES_STORE, FIND_TOOLS_NAME, FORGET_SKILL_TOOL, GENERATE_IMAGE_TOOL, GENERATE_SPEECH_TOOL, ImagesNotSupportedError, IndexedDBRunStore, IndexedDBStore, KEYS_STORE, 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, MODEL_TIERS, McpAppToolResult, McpElicitationReason, McpElicitationSchema, McpSkillConsent, McpSkillConsentView, MediaBudgetError, MediaError, MemoryCredentialStore, MemoryRunStore, MemorySkillStore, MemoryStore, NO_ATTACHMENT_NOTE, PipelineDefinition, PipelineEvent, PipelineNode, PipelineNodeRunner, PipelineResult, PlanSchema, PlanStepSchema, RELAY_MAX_REPLAYS_PER_SECOND, RELAY_MAX_SENDS, RELAY_MAX_SEND_CHARS, RELAY_MAX_STRING, REPLAY_NOTE, RUNS_STORE, ReplanSchema, 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, SECRETS_STORE, SESSIONS_STORE, SESSION_LOCK_MODES, SKILL_TOOL_NAMES, SPAWN_INPUT_SCHEMA, SPAWN_SUBAGENT_TOOL, STORAGE_CHANGE_KINDS, SUBAGENT_DEFAULTS, SUBAGENT_MAX_DEPTH_LIMIT, SessionBusyError, SubagentSpawnError, TOOL_APPROVAL_MODES, TOOL_APPROVAL_TIMEOUT_MS, TOOL_SEARCH_WINDOW_SHARE, TRANSCRIBE_AUDIO_TOOL, TieredPlanSchema, TieredPlanStepSchema, ToolBudgetError, ToolDeniedError, VaultCredentialStore, VaultOptions, VfsSkillStore, VirtualFileSystem, WEBLLM_DEFAULT_CONTEXT_WINDOW, WEB_FETCH_TOOL, WEB_SEARCH_TOOL, acceptMedia, adoptSubagentEvent, appSamplingRequestOf, appSamplingText, askDecisionModel, attachmentKind, buildMediaModelFromSpec, buildModelFromStage, buildSearchRequest, bytesToBase64, checkEgressUrl, checkLimits, classifyAddress, compactHistory, compactSteps, compressHistory, contextOverflowOf, contextWindowOf, createAgent, createAppSamplingLimiter, createEgressTools, createFileTools, createFindToolsTool, createGuardedFetch, createLearning, createLogger, createMedia, createPipeline, createPlan, createRunControl, createSearchTools, createSkillTools, createSubagentTool, createToolResultClearer, createWebFetchTool, createWebLLMModel, createWebSearchTool, decideReplan, decideToolPermission, decisionEgressPolicy, decisionModelFromAiSdk, decryptJSON, defaultPrompts, defineSkill, defineTool, directBrowserOk, dispatch, encryptJSON, escalationReasonOf, messageTokens as estimateMessagesTokens, estimateTokens, executeStep, fileToolBindingOf, findSecret, fitCompactionToWindow, generate, generateStructured, getOrCreateVaultKey, hostMatches, htmlToText, isAttachmentRefusal, isCodeExecutionTool, isDirectModel, isEscalatableError, isImageRefusal, isProviderSpec, isReadOnlyTool, isReplayedToolOutput, isTextMime, isWebGPUAvailable, learnedPreamble, limitModelOutput, loadSkillFromUrl, looksLikeJson, markCodeExecution, markReadOnly, matchRule, mediaTypeOf, mediaUsageOf, mergeProviderOptions, mimeFromPath, nextStrongerTier, nodeResolver, normalizePath, normalizeSkillName, normalizeSteps, normalizeUsage, onStorageChange, openAgentWebDB, outputCapNotice, parseExecutorResponse, parsePlainText, parsePlannerResponse, parseReplannerResponse, parseSearchResponse, parseSkillMarkdown, pickPipelineRoute, pickTier, postStorageChange, preloadWebLLMModel, renderActiveSkills, renderCatalog, renderSearchCatalog, renderSkillIndex, replanWanted, resolveAppSampling, resolveBudgets, resolveCaching, resolveCompaction, resolveConfig, resolveDecisionModel, resolveDynamicSubagents, resolveEgressPolicy, resolveEscalation, resolveModel, resolveResume, resolveStage, resolveThinking, runToolLoop, sanitizeSearchResults, schemaHintOf, searchEgressPolicy, searchStatusMessage, searchToolResult, searchTools, selectToolMode, serveSubagentWorker, shouldReplan, skillPreamble, sniffMediaType, splitBlocker, stageOutputCap, stageReasons, stream, supportsImages, supportsNativeTools, supportsPdf, supportsStructuredOutput, synthesizeAnswer, thinkingFor, toFilePart, toImagePart, tokenize, toolCatalogOf, toolDefinitionTokens, toolRunContextOf, unloadWebLLMModel, watchSession, webLLMContextWindow, withRollingBreakpoint, withSystem, withWebLLMContextWindow, wrapTranscript };
|
|
4780
|
-
export type { Agent, AgentContext, AgentEvent, AgentEventHandler, AgentLogger, AgentLoggerSink, AgentWebDBOptions, AppSamplingErrorCode, AppSamplingImage, AppSamplingMessage, AppSamplingOptions, AppSamplingRequest, AppSamplingResult, AppSamplingSettings, AppSamplingView, AppToolCallRequest, AttachmentKind, BrowserAgentConfig, ClearedInfo, CompactOptions, CompactResult, CompactionConfig, CompressOptions, ContextStore, CredentialStore, DecisionFallbackReason, DecisionPoint, EffectiveToolStrategy, EgressErrorCode, EncryptedBlob, EscalationConfig, EscalationReason, ExecutorPromptContext, ExecutorResult, FileToolBinding, FileToolsOptions, GenerateOptions, GuardedFetch, IAiSdkDecisionOptions, IDecisionAnswer, IDecisionCallOptions, IDecisionConfig, IDecisionEvent, IDecisionModel, IDecisionModelSpec, IDecisionOption, IDecisionOutcome, IDecisionQuestion, IDynamicSubagentsConfig, IEgressPolicy, IMedia, IMediaConfig, IMediaFile, IMediaModelSpec, IMediaOptions, IMediaRun, IMediaUsage, IPlan, IPlanStep, IResolvedDynamicSubagents, IResolvedEgressPolicy, ISandboxConfig, ISandboxError, ISandboxLimits, ISandboxResult, ISanitizedSearch, ISearchAnswer, ISearchConfig, ISearchOptions, ISearchRequest, ISearchResult, ISearchToolResult, ISearchUsage, IStepEscalation, IStepResult, ISubagentsConfig, IToolCall, ITranscription, IUsage, IWebFetchOptions, IWebSearchOptions, IndexedDBRunStoreOptions, IndexedDBStoreOptions, Learning, LearningConfig, LimitBreach, LimitKind, LoadSkillOptions, LogLevel, McpSkillOrigin, MediaImageModel, MediaKind, MediaModelKind, MediaSpeechModel, MediaTranscriptionModel, MessageEndpoint, ModelInput, ModelTier, NodeResolverOptions, OutputCap, ParentToWorker, Phase, PhaseBudgets, Pipeline, PipelineOptions, PipelineRouteOptions, PipelineRouteResult, PipelineRunOptions, PlanShape, PlannerPromptContext, PlannerResult, PromptCachingSetting, PromptParts, Prompts, ProviderModelSpec, ProviderOptionsMap, ProviderType, ProxiedToolSpec, RawAction, ReplanDecision, ReplanMode, ReplanShape, ReplanTrigger, ReplannerPromptContext, ReplannerResult, ResolvedCaching, ResolvedCompaction, ResolvedConfig, ResolvedStage, ResolvedThinking, RunControl, RunFile, RunImage, RunOptions, RunPersistence, RunResult, RunSnapshot, RunStatus, RunStoreOptions, SandboxConfig, SandboxWorkerLike, SaveSkillInput, SearchEngine, SearchFreshness, SearchProvider, SearchToolsOptions, ServeSubagentOptions, SessionHolder, SessionLockMode, SessionRunState, SessionWatch, Skill, SkillOrigin, SkillStore, StageInput, StageOverride, StepComplexity, StorageChange, StorageChangeKind, StorageChangeOp, StoredMessage, StructuredResult, SubagentDefaultTools, SubagentInfo, SubagentProfile, SubagentToolOptions, SubagentWorkerConfig, SynthesizerPromptContext, ThinkingConfig, ThinkingLevel, ThinkingSetting, ThinkingStage, TierReason, TokenLimits, ToolApprovalApp, ToolApprovalConfig, ToolApprovalContext, ToolApprovalDecision, ToolApprovalMode, ToolApprovalRequest, ToolCallMode, ToolCatalogEntry, ToolLoopCallbacks, ToolLoopOptions, ToolLoopResult, ToolMode, ToolPermission, ToolResultClearing, ToolRunContext, ToolSelectionStrategy, UsagePhase, VfsListener, VirtualFile, VirtualFileInfo, VirtualFileSystemOptions, WatchSessionOptions, WebLLMAppConfigLike, WebLLMModelOptions, WorkerLike, WorkerToParent };
|
|
5005
|
+
export { APP_SAMPLING_MAX_IMAGES, APP_SAMPLING_MAX_IMAGE_BYTES, APP_SAMPLING_MAX_INPUT_CHARS, APP_SAMPLING_MAX_MESSAGES, APP_SAMPLING_MAX_SYSTEM_CHARS, APP_SAMPLING_MAX_TOKENS, APP_SAMPLING_PER_APP, APP_SAMPLING_PER_MINUTE, APP_SAMPLING_REASONING_TOKENS, APP_SAMPLING_RPC_CODES, 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, AgentTool, AgentToolSet, AppSamplingError, AskUserInputError, AttachmentsNotSupportedError, ContextWindowExceededError, DECISION_PROVIDERS, DEFAULT_COMPACTION_THRESHOLD_RATIO, DEFAULT_DECISION_CONFIDENCE_THRESHOLD, DEFAULT_DECISION_TIMEOUT_MS, EgressError, FILES_STORE, FIND_TOOLS_NAME, FORGET_SKILL_TOOL, GENERATE_IMAGE_TOOL, GENERATE_SPEECH_TOOL, ImagesNotSupportedError, IndexedDBRunStore, IndexedDBStore, KEYS_STORE, 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, MODEL_TIERS, McpAppToolResult, McpElicitationReason, McpElicitationSchema, McpSkillConsent, McpSkillConsentView, MediaBudgetError, MediaError, MemoryCredentialStore, MemoryRunStore, MemorySkillStore, MemoryStore, NO_ATTACHMENT_NOTE, PipelineDefinition, PipelineEvent, PipelineNode, PipelineNodeRunner, PipelineResult, PlanSchema, PlanStepSchema, RELAY_MAX_REPLAYS_PER_SECOND, RELAY_MAX_SENDS, RELAY_MAX_SEND_CHARS, RELAY_MAX_STRING, REPLAY_NOTE, RUNS_STORE, ReplanSchema, 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, SECRETS_STORE, SESSIONS_STORE, SESSION_LOCK_MODES, SKILL_TOOL_NAMES, SPAWN_INPUT_SCHEMA, SPAWN_SUBAGENT_TOOL, STORAGE_CHANGE_KINDS, SUBAGENT_DEFAULTS, SUBAGENT_MAX_DEPTH_LIMIT, SessionBusyError, SubagentSpawnError, TOOL_APPROVAL_MODES, TOOL_APPROVAL_TIMEOUT_MS, TOOL_SEARCH_WINDOW_SHARE, TRANSCRIBE_AUDIO_TOOL, TieredPlanSchema, TieredPlanStepSchema, ToolBudgetError, ToolDeniedError, VaultCredentialStore, VaultOptions, VfsSkillStore, VirtualFileSystem, WEBLLM_DEFAULT_CONTEXT_WINDOW, WEB_FETCH_TOOL, WEB_SEARCH_TOOL, acceptMedia, adoptSubagentEvent, appSamplingRequestOf, appSamplingText, askDecisionModel, attachmentKind, buildMediaModelFromSpec, buildModelFromStage, buildSearchRequest, bytesToBase64, checkAskUserAnswer, checkAskUserInput, checkEgressUrl, checkLimits, classifyAddress, cleanAskUserText, compactHistory, compactSteps, compressHistory, contextOverflowOf, contextWindowOf, createAgent, createAppSamplingLimiter, createEgressTools, createFileTools, createFindToolsTool, createGuardedFetch, createLearning, createLogger, createMedia, createPipeline, createPlan, createRunControl, createSearchTools, createSkillTools, createSubagentTool, createToolResultClearer, createWebFetchTool, createWebLLMModel, createWebSearchTool, decideReplan, decideToolPermission, decisionEgressPolicy, decisionModelFromAiSdk, decryptJSON, defaultPrompts, defineSkill, defineTool, directBrowserOk, dispatch, encryptJSON, escalationReasonOf, messageTokens as estimateMessagesTokens, estimateTokens, executeStep, fileToolBindingOf, findSecret, fitCompactionToWindow, generate, generateStructured, getOrCreateVaultKey, hostMatches, htmlToText, isAttachmentRefusal, isCodeExecutionTool, isDirectModel, isEscalatableError, isImageRefusal, isProviderSpec, isReadOnlyTool, isReplayedToolOutput, isTextMime, isWebGPUAvailable, learnedPreamble, limitModelOutput, loadSkillFromUrl, looksLikeJson, markCodeExecution, markReadOnly, matchRule, mediaTypeOf, mediaUsageOf, mergeProviderOptions, mimeFromPath, nextStrongerTier, nodeResolver, normalizePath, normalizeSkillName, normalizeSteps, normalizeUsage, onStorageChange, openAgentWebDB, outputCapNotice, parseExecutorResponse, parsePlainText, parsePlannerResponse, parseReplannerResponse, parseSearchResponse, parseSkillMarkdown, pickPipelineRoute, pickTier, postStorageChange, preloadWebLLMModel, renderActiveSkills, renderCatalog, renderSearchCatalog, renderSkillIndex, replanWanted, resolveAppSampling, resolveBudgets, resolveCaching, resolveCompaction, resolveConfig, resolveDecisionModel, resolveDynamicSubagents, resolveEgressPolicy, resolveEscalation, resolveModel, resolveResume, resolveStage, resolveThinking, runToolLoop, sanitizeSearchResults, schemaHintOf, searchEgressPolicy, searchStatusMessage, searchToolResult, searchTools, selectToolMode, serveSubagentWorker, shouldReplan, skillPreamble, sniffMediaType, splitBlocker, stageOutputCap, stageReasons, stream, supportsImages, supportsNativeTools, supportsPdf, supportsStructuredOutput, synthesizeAnswer, thinkingFor, toFilePart, toImagePart, tokenize, toolCatalogOf, toolDefinitionTokens, toolRunContextOf, unloadWebLLMModel, watchSession, webLLMContextWindow, withRollingBreakpoint, withSystem, withWebLLMContextWindow, wrapTranscript };
|
|
5006
|
+
export type { Agent, AgentContext, AgentEvent, AgentEventHandler, AgentLogger, AgentLoggerSink, AgentWebDBOptions, AppSamplingErrorCode, AppSamplingImage, AppSamplingMessage, AppSamplingOptions, AppSamplingRequest, AppSamplingResult, AppSamplingSettings, AppSamplingView, AppToolCallRequest, AskUserAction, AskUserAnswer, AskUserCheckedAnswer, AskUserConfig, AskUserContext, AskUserHandler, AskUserOption, AskUserQuestion, AskUserReason, AskUserRequest, AttachmentKind, BrowserAgentConfig, ClearedInfo, CompactOptions, CompactResult, CompactionConfig, CompressOptions, ContextStore, CredentialStore, DecisionFallbackReason, DecisionPoint, EffectiveToolStrategy, EgressErrorCode, EncryptedBlob, EscalationConfig, EscalationReason, ExecutorPromptContext, ExecutorResult, FileToolBinding, FileToolsOptions, GenerateOptions, GuardedFetch, IAiSdkDecisionOptions, IDecisionAnswer, IDecisionCallOptions, IDecisionConfig, IDecisionEvent, IDecisionModel, IDecisionModelSpec, IDecisionOption, IDecisionOutcome, IDecisionQuestion, IDynamicSubagentsConfig, IEgressPolicy, IMedia, IMediaConfig, IMediaFile, IMediaModelSpec, IMediaOptions, IMediaRun, IMediaUsage, IPlan, IPlanStep, IResolvedDynamicSubagents, IResolvedEgressPolicy, ISandboxConfig, ISandboxError, ISandboxLimits, ISandboxResult, ISanitizedSearch, ISearchAnswer, ISearchConfig, ISearchOptions, ISearchRequest, ISearchResult, ISearchToolResult, ISearchUsage, IStepEscalation, IStepResult, ISubagentsConfig, IToolCall, ITranscription, IUsage, IWebFetchOptions, IWebSearchOptions, IndexedDBRunStoreOptions, IndexedDBStoreOptions, Learning, LearningConfig, LimitBreach, LimitKind, LoadSkillOptions, LogLevel, McpSkillOrigin, MediaImageModel, MediaKind, MediaModelKind, MediaSpeechModel, MediaTranscriptionModel, MessageEndpoint, ModelInput, ModelTier, NodeResolverOptions, OutputCap, ParentToWorker, Phase, PhaseBudgets, Pipeline, PipelineOptions, PipelineRouteOptions, PipelineRouteResult, PipelineRunOptions, PlanShape, PlannerPromptContext, PlannerResult, PromptCachingSetting, PromptParts, Prompts, ProviderModelSpec, ProviderOptionsMap, ProviderType, ProxiedToolSpec, RawAction, ReplanDecision, ReplanMode, ReplanShape, ReplanTrigger, ReplannerPromptContext, ReplannerResult, ResolvedCaching, ResolvedCompaction, ResolvedConfig, ResolvedStage, ResolvedThinking, RunControl, RunFile, RunImage, RunOptions, RunPersistence, RunResult, RunSnapshot, RunStatus, RunStoreOptions, SandboxConfig, SandboxWorkerLike, SaveSkillInput, SearchEngine, SearchFreshness, SearchProvider, SearchToolsOptions, ServeSubagentOptions, SessionHolder, SessionLockMode, SessionRunState, SessionWatch, Skill, SkillOrigin, SkillStore, StageInput, StageOverride, StepComplexity, StorageChange, StorageChangeKind, StorageChangeOp, StoredMessage, StructuredResult, SubagentDefaultTools, SubagentInfo, SubagentProfile, SubagentToolOptions, SubagentWorkerConfig, SynthesizerPromptContext, ThinkingConfig, ThinkingLevel, ThinkingSetting, ThinkingStage, TierReason, TokenLimits, ToolApprovalApp, ToolApprovalConfig, ToolApprovalContext, ToolApprovalDecision, ToolApprovalMode, ToolApprovalRequest, ToolCallMode, ToolCatalogEntry, ToolLoopCallbacks, ToolLoopOptions, ToolLoopResult, ToolMode, ToolPermission, ToolResultClearing, ToolRunContext, ToolSelectionStrategy, UsagePhase, VfsListener, VirtualFile, VirtualFileInfo, VirtualFileSystemOptions, WatchSessionOptions, WebLLMAppConfigLike, WebLLMModelOptions, WorkerLike, WorkerToParent };
|