@dudko.dev/agent 0.0.48 → 0.0.50

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.ts CHANGED
@@ -370,9 +370,10 @@ declare const createSafeFetch: (policy?: IEgressPolicy) => SafeFetch;
370
370
 
371
371
  /**
372
372
  * What the `web_search` tools of the two agent packages share: the result shape and its caps, how
373
- * a search engine's answer is cleaned before a model reads it, and the built-in adapters as pure
374
- * request builders and response parsers (one HTTP call each). Pure, no imports: the request itself
375
- * is made by each package's own safe fetch.
373
+ * a search engine's answer is cleaned before a model reads it, and the one built-in provider
374
+ * (Google Search through Gemini grounding) as a pure request builder and response parser (one
375
+ * HTTP call). Pure, no imports, no clock: the request itself is made by each package's own safe
376
+ * fetch.
376
377
  *
377
378
  * This file is a COPY, byte for byte, in `@dudko.dev/agent` (`src/web-search-shared.ts`) and
378
379
  * `@dudko.dev/agent-web` (`src/tools/web-search-shared.ts`): change both. The Node package's
@@ -416,11 +417,24 @@ interface ISearchOptions {
416
417
  * returns is treated like a built-in adapter's answer - cleaned, capped and filtered.
417
418
  */
418
419
  type SearchEngine = (query: string, options: ISearchOptions) => Promise<ISearchResult[]>;
419
- /** The hosted search APIs with a built-in adapter. */
420
- type SearchProvider = 'brave' | 'tavily' | 'searxng';
420
+ /**
421
+ * The built-in provider. One: Google Search through the Gemini API's grounding (`google_search`),
422
+ * which needs a Gemini (Google AI Studio) key and nothing else. Any other search API is the
423
+ * host's `engine` function.
424
+ */
425
+ type SearchProvider = 'google';
421
426
  declare const SEARCH_PROVIDERS: readonly SearchProvider[];
422
- /** Where each hosted API lives. SearXNG is self-hosted: its `baseURL` is the host's to give. */
423
- declare const SEARCH_API_BASE_URL: Record<'brave' | 'tavily', string>;
427
+ /** Where the provider's API lives (a `baseURL` of the host - a gateway - replaces it). */
428
+ declare const SEARCH_API_BASE_URL: Record<SearchProvider, string>;
429
+ /**
430
+ * The model the grounding call is made with when the host names none: the cheapest one that
431
+ * answered a free-tier key with grounding on the day it was measured (2026-11-26).
432
+ */
433
+ declare const SEARCH_GOOGLE_DEFAULT_MODEL = "gemini-2.5-flash-lite";
434
+ /** The most of the grounding model's answer a model sees as `summary`. */
435
+ declare const SEARCH_MAX_SUMMARY_CHARS = 1000;
436
+ /** Said in every result of the google provider: what its URLs and its text are. */
437
+ declare const SEARCH_GOOGLE_NOTE: string;
424
438
  /** One HTTP call to a search API. The key, if any, is in `headers` only - never in the URL. */
425
439
  interface ISearchRequest {
426
440
  url: string;
@@ -435,19 +449,48 @@ interface ISearchRequestInput {
435
449
  freshness?: SearchFreshness;
436
450
  apiKey?: string;
437
451
  baseURL?: string;
452
+ /** The Gemini model that makes the grounding call (default SEARCH_GOOGLE_DEFAULT_MODEL). */
453
+ model?: string;
454
+ /** The current time in ms, for `freshness` (this file reads no clock). */
455
+ now?: number;
456
+ }
457
+ /** What a search spent in model tokens, as the API reported it. */
458
+ interface ISearchUsage {
459
+ inputTokens: number;
460
+ outputTokens: number;
461
+ totalTokens: number;
462
+ reasoningTokens: number;
463
+ }
464
+ /** A provider's answer, parsed: raw third-party values until `sanitizeSearchResults`. */
465
+ interface ISearchAnswer {
466
+ results: unknown[];
467
+ /** The grounding model's whole answer (raw). */
468
+ summary?: unknown;
469
+ /** Absent when the API reported none. */
470
+ usage?: ISearchUsage;
438
471
  }
439
472
  /**
440
- * The request for one query, per the API's public documentation:
441
- * - brave: GET {base}/res/v1/web/search?q=&count= header X-Subscription-Token
442
- * - tavily: POST {base}/search { query, max_results } header Authorization: Bearer
443
- * - searxng: GET {base}/search?q=&format=json no key
473
+ * The request for one query, per the Gemini API's public documentation:
474
+ * POST {base}/v1beta/models/{model}:generateContent header x-goog-api-key
475
+ * { systemInstruction, contents: [the query], tools: [{ google_search }], generationConfig }
476
+ * The query is the only text of the conversation in it. The API has no result count: the list
477
+ * is cut on the way back.
444
478
  */
445
479
  declare const buildSearchRequest: (input: ISearchRequestInput) => ISearchRequest;
446
480
  /**
447
- * The results inside an API's JSON answer, mapped to `{ title, url, snippet, date }` and nothing
448
- * else. Still raw third-party values: `sanitizeSearchResults` is what makes them safe to show.
481
+ * What a grounded answer holds, mapped to results of `{ title, url, snippet }` and nothing else,
482
+ * the model's answer, and what the call spent. A source is a `groundingChunks[].web` (`uri` is a
483
+ * Google redirect link, `title` the site's name); its snippet is the pieces of the answer that
484
+ * `groundingSupports` attribute to it (fragments as the API cut them, joined with an ellipsis). Still raw third-party values: `sanitizeSearchResults` is
485
+ * what makes them safe to show.
449
486
  */
450
- declare const parseSearchResponse: (provider: SearchProvider, json: unknown) => unknown[];
487
+ declare const parseSearchResponse: (provider: SearchProvider, json: unknown) => ISearchAnswer;
488
+ /**
489
+ * What a failed call says to the model: the provider, the model, the status, the API's own error
490
+ * code word and what it usually means. Never the error's text: that is third-party text, and may
491
+ * echo what was sent. `body` is the parsed error body, if there was one.
492
+ */
493
+ declare const searchStatusMessage: (provider: SearchProvider, status: number, model?: string, body?: unknown) => string;
451
494
  interface ISanitizedSearch {
452
495
  results: ISearchResult[];
453
496
  /** Results dropped because the host's egress policy does not let the model reach them. */
@@ -458,18 +501,37 @@ interface ISanitizedSearch {
458
501
  /**
459
502
  * What a model sees of an engine's answer. `raw` is whatever came back - nothing about it is
460
503
  * trusted: a result needs a valid http(s) URL, every field is cleaned and capped, duplicates go,
461
- * `accepts` (the egress policy) drops links the model could not fetch, and the list stops at
462
- * `maxResults` and at SEARCH_MAX_TOTAL_CHARS.
504
+ * `accepts` (the egress policy; it is also handed the result's raw title) drops links the model
505
+ * could not fetch, and the list stops at `maxResults` and at SEARCH_MAX_TOTAL_CHARS.
463
506
  */
464
507
  declare const sanitizeSearchResults: (raw: unknown, options?: {
465
508
  maxResults?: number;
466
- accepts?: (url: URL) => boolean;
509
+ accepts?: (url: URL, title: unknown) => boolean;
467
510
  }) => ISanitizedSearch;
511
+ /** What `web_search` returns to the model. */
512
+ interface ISearchToolResult {
513
+ query: string;
514
+ results: ISearchResult[];
515
+ /** The google provider, when no source came with a snippet: the grounding model's answer, cut. */
516
+ summary?: string;
517
+ /** The google provider: what its URLs and its text are. */
518
+ note?: string;
519
+ filtered?: number;
520
+ truncated?: true;
521
+ untrusted: true;
522
+ }
523
+ /**
524
+ * The tool's result, from the cleaned list and - for the google provider - the parsed answer.
525
+ * The model's `summary` is attached only when there are sources, none of them carries a snippet
526
+ * and none was filtered out: a summary cannot be cut to the sources that remain.
527
+ */
528
+ declare const searchToolResult: (query: string, clean: ISanitizedSearch, answer?: ISearchAnswer) => ISearchToolResult;
468
529
 
469
530
  interface ISearchConfig {
470
531
  engine?: SearchEngine;
471
532
  provider?: SearchProvider;
472
533
  apiKey?: string;
534
+ model?: string;
473
535
  baseURL?: string;
474
536
  maxResults?: number;
475
537
  allowPrivateNetwork?: boolean;
@@ -601,6 +663,399 @@ interface IMedia {
601
663
  }
602
664
  declare const createMedia: (config: IAgentConfig) => Promise<IMedia | undefined>;
603
665
 
666
+ /**
667
+ * MCP elicitation, the part the two agent packages share: a server asks the user for input in
668
+ * the middle of a tool call, the HOST answers through a callback, and the call goes on. Pure, no
669
+ * imports: the limits, what a request must look like before a host sees it, what an answer must
670
+ * look like before a server sees it, the one function that asks, and the two ways a tool call
671
+ * with questions is driven (`elicitation/create` requests on the 2025 revisions, `input_required`
672
+ * results on 2026-07-28).
673
+ *
674
+ * A consent boundary. The server's text is third-party data: cleaned and capped here, shown only
675
+ * to the host's callback and in the `mcp.elicitation-requested` event, never put into a prompt.
676
+ * The answer goes to the server that asked and nowhere else: nothing in this file logs, emits or
677
+ * returns a value the user entered - events and errors carry field NAMES only.
678
+ *
679
+ * This file is a COPY, byte for byte, in `@dudko.dev/agent` (`src/mcp-elicitation.ts`) and
680
+ * `@dudko.dev/agent-web` (`src/mcp/elicitation.ts`): change both. The Node package's
681
+ * `tests/mcp-elicitation-shared.test.ts` compares the two files and tests every guard here; each
682
+ * needs a mutation check.
683
+ */
684
+ /** How long one question waits for the host's answer, by default: a human is reading it. */
685
+ declare const MCP_ELICITATION_TIMEOUT_MS = 300000;
686
+ /** The most questions one tool call may ask, by default. */
687
+ declare const MCP_ELICITATION_MAX_PER_TOOL_CALL = 5;
688
+ /** The most questions one run may be asked, by default (its helpers' calls included). */
689
+ declare const MCP_ELICITATION_MAX_PER_RUN = 20;
690
+ /** One field of a form: the flat subset of JSON Schema the specification allows, nothing else. */
691
+ interface McpElicitationFieldSchema {
692
+ type: 'string' | 'number' | 'integer' | 'boolean' | 'array';
693
+ title?: string;
694
+ description?: string;
695
+ default?: string | number | boolean | string[];
696
+ /** string */
697
+ minLength?: number;
698
+ maxLength?: number;
699
+ format?: 'email' | 'uri' | 'date' | 'date-time';
700
+ /** string: single-select, plain (`enumNames`: the older titled form). */
701
+ enum?: string[];
702
+ enumNames?: string[];
703
+ /** string: single-select with titles. */
704
+ oneOf?: {
705
+ const: string;
706
+ title: string;
707
+ }[];
708
+ /** number / integer */
709
+ minimum?: number;
710
+ maximum?: number;
711
+ /** array: multi-select. */
712
+ minItems?: number;
713
+ maxItems?: number;
714
+ items?: {
715
+ type?: 'string';
716
+ enum?: string[];
717
+ anyOf?: {
718
+ const: string;
719
+ title: string;
720
+ }[];
721
+ };
722
+ }
723
+ /** The form a server asks for, as a host is shown it: checked, cleaned and capped. */
724
+ interface McpElicitationSchema {
725
+ type: 'object';
726
+ properties: Record<string, McpElicitationFieldSchema>;
727
+ required?: string[];
728
+ }
729
+ /** What the host's callback is given. Every string in it is third-party text. */
730
+ interface McpElicitationRequest {
731
+ /** Unique per question; the same id is in the two events. */
732
+ id: string;
733
+ /** The server that asks: its key in the host's configuration. */
734
+ server: string;
735
+ /** The tool call during which it asks: the tool's name as the model called it. */
736
+ tool: string;
737
+ mode: 'form' | 'url';
738
+ /** The server's words, cleaned and capped (MCP_ELICITATION_MESSAGE_MAX_CHARS). */
739
+ message: string;
740
+ /** Form mode: the fields to fill in. */
741
+ requestedSchema?: McpElicitationSchema;
742
+ /**
743
+ * URL mode: the link the server wants the user to open. It is only handed over: nothing in
744
+ * these packages fetches or opens it. https, or http on a loopback host.
745
+ */
746
+ url?: string;
747
+ /** URL mode on the 2025 revisions: the server's id for this interaction. */
748
+ elicitationId?: string;
749
+ runId?: string;
750
+ /** Set when a helper the model started is the one whose call asks (`elicitation.subagents`). */
751
+ subagent?: {
752
+ id: string;
753
+ depth: number;
754
+ };
755
+ }
756
+ type McpElicitationContent = Record<string, string | number | boolean | string[]>;
757
+ /**
758
+ * The host's answer. `accept` carries the form's values (form mode) or nothing (URL mode: it
759
+ * says the user agreed to open the link); `decline` is a no; `cancel` is "dismissed".
760
+ */
761
+ type McpElicitationResult = {
762
+ action: 'accept';
763
+ content?: McpElicitationContent;
764
+ } | {
765
+ action: 'decline';
766
+ } | {
767
+ action: 'cancel';
768
+ };
769
+ interface McpElicitationContext {
770
+ /** Aborted when the answer is no longer wanted: the run stopped, or the time ran out. */
771
+ signal: AbortSignal;
772
+ }
773
+ /** `onElicitation`: the host decides, never the model. */
774
+ type McpElicitationHandler = (request: McpElicitationRequest, ctx: McpElicitationContext) => McpElicitationResult | Promise<McpElicitationResult>;
775
+ /** The `elicitation` settings beside `onElicitation`. */
776
+ interface McpElicitationOptions {
777
+ /**
778
+ * How long one question waits for an answer. Default 300 000. `0` or `Infinity` = no limit of
779
+ * its own (the question waits until the run is stopped), and so is a value above 2^31 - 1 (about
780
+ * 24.8 days, the most a timer holds). Negative or NaN: a configuration error.
781
+ */
782
+ timeoutMs?: number;
783
+ /** Questions one tool call may ask. Default 5. */
784
+ maxPerToolCall?: number;
785
+ /** Questions one run may be asked. Default 20. */
786
+ maxPerRun?: number;
787
+ /** Also accept URL mode (a link to open). Default false: only forms are declared. */
788
+ url?: boolean;
789
+ /**
790
+ * Let a tool call made by a helper (a subagent) ask the user too. Default false: such a
791
+ * question is cancelled without the callback being called.
792
+ */
793
+ subagents?: boolean;
794
+ }
795
+ /** Why a question was answered without the host deciding. */
796
+ type McpElicitationReason = 'unsupported-schema' | 'unsupported-mode' | 'insecure-url' | 'invalid-request' | 'subagent' | 'cap-per-call' | 'cap-per-run' | 'handler-error' | 'timeout' | 'invalid-answer' | 'aborted' | 'step-timeout' | 'after-failure' | 'no-tool-call';
797
+ type Checked<T> = {
798
+ ok: true;
799
+ value: T;
800
+ } | {
801
+ ok: false;
802
+ reason: string;
803
+ };
804
+ /**
805
+ * The form a server asked for, reduced to what the specification allows a form to be: a flat
806
+ * object of strings, numbers, booleans and selects. Anything else - a nested object, a list of
807
+ * objects, a type union, an unknown format, too many fields or options, a name that could not
808
+ * be sent back verbatim - is refused with a reason (the caller declines the request). Keywords
809
+ * outside the subset are dropped; titles and descriptions are cleaned and capped.
810
+ */
811
+ declare const normalizeMcpElicitationSchema: (raw: unknown) => Checked<McpElicitationSchema>;
812
+ /**
813
+ * An accepted form, checked against the schema it answers: every value of the type and within
814
+ * the limits its field states, every required field there, and NO field the form did not ask
815
+ * for (what the server did not request is not sent to it). The result is a fresh object holding
816
+ * only the form's own fields. A refusal names the field and the rule, never the value.
817
+ */
818
+ declare const validateMcpElicitationContent: (schema: McpElicitationSchema, content: unknown) => Checked<McpElicitationContent>;
819
+
820
+ /**
821
+ * What the MCP connectors of the two agent packages share: how a server's `instructions` reach a
822
+ * system prompt, how a tool result's `structuredContent` reaches the model, and what the
823
+ * per-server `protocol` option means. Pure, no imports.
824
+ *
825
+ * This file is a COPY, byte for byte, in `@dudko.dev/agent` (`src/mcp-shared.ts`) and
826
+ * `@dudko.dev/agent-web` (`src/mcp/shared.ts`): change both. The Node package's
827
+ * `tests/mcp-shared.test.ts` compares the two files and tests every cap and guard here.
828
+ */
829
+ /** The `instructions` one connected MCP server returned in its `initialize` result. */
830
+ interface McpServerInstructions {
831
+ /** The server's name: its key in the host's configuration. */
832
+ server: string;
833
+ instructions: string;
834
+ }
835
+ /** The most one server's instructions take in a system prompt, in characters. */
836
+ declare const MCP_INSTRUCTIONS_MAX_CHARS_PER_SERVER = 2000;
837
+ /** The most all servers' instructions take together, in characters. */
838
+ declare const MCP_INSTRUCTIONS_MAX_CHARS_TOTAL = 8000;
839
+ /**
840
+ * The system-prompt section for the servers' instructions, or '' when no server sent any (the
841
+ * prompt is then exactly what it was). Each server's text is capped
842
+ * (MCP_INSTRUCTIONS_MAX_CHARS_PER_SERVER), so is the sum (MCP_INSTRUCTIONS_MAX_CHARS_TOTAL, in
843
+ * the order given: a server past the total is named as omitted), and every line of it is
844
+ * prefixed with "| ", so a server cannot write something that reads as a heading of this prompt
845
+ * or as another server's note.
846
+ */
847
+ declare const renderMcpInstructions: (list: readonly McpServerInstructions[] | undefined) => string;
848
+ /**
849
+ * Which revisions of the protocol a connection to one server may use (the server config's
850
+ * `protocol`):
851
+ *
852
+ * - `'legacy'` (default): the 2025 revisions, the `initialize` handshake. Nothing of the 2026
853
+ * revision is sent.
854
+ * - `'auto'`: ask first (`server/discover`); a server that answers with 2026-07-28 is spoken to
855
+ * that way, any other is given the 2025 handshake. Decided once, at connect.
856
+ * - `'modern'`: 2026-07-28 only. A server that does not offer it fails the connect.
857
+ */
858
+ type McpProtocolMode = 'legacy' | 'auto' | 'modern';
859
+ /** The revision `protocol: 'modern'` pins: the one this connector is tested against. */
860
+ declare const MCP_MODERN_PROTOCOL_VERSION = "2026-07-28";
861
+ /** What a connection negotiated with one server. */
862
+ interface McpServerProtocol {
863
+ /** The server's name: its key in the host's configuration. */
864
+ server: string;
865
+ /** The protocol revision in use, e.g. `2025-11-25` or `2026-07-28`. */
866
+ version: string;
867
+ /** `modern` from 2026-07-28 on (stateless, `server/discover`), `legacy` before. */
868
+ era: 'legacy' | 'modern';
869
+ }
870
+
871
+ /**
872
+ * MCP Skills (the `io.modelcontextprotocol/skills` extension, SEP-2640, Beta; written against
873
+ * base revision 2026-07-28): what the two agent packages share about a server's skills. The
874
+ * rules on a server's entries (`mcpSkillEntryRefusal`), the names a skill gets in the agent's
875
+ * catalog (`assignMcpSkillNames`: namespaced by the host's label of the server), the caps
876
+ * (`selectMcpSkills`), the files of a loaded skill the model may read (`resolveMcpSkillFile`),
877
+ * the preamble a skill's text is loaded under, the mark that carries a server's skills on its
878
+ * tools (`markMcpSkills` / `collectMcpSkillSources`), a skill the model names by URI
879
+ * (`mcpSkillUriRefusal`, `resolveMcpSkillServer`: `skills/get` to that one server only), the
880
+ * person's consent before a skill's text enters the model's context (`decideMcpSkillConsent`,
881
+ * `mcpSkillConsentView`) and a directory of a skill (`skillDirectoryOf`, `resolveMcpSkillPath`,
882
+ * `skillDirectoryListing` - for every kind of skill - and, for a server that serves
883
+ * `resources/directory/read`, `compareMcpSkillDirectory`) and, for a server the host trusts with
884
+ * its generated skills (`skills: { dynamic: true }`), the snapshot such a skill is read into
885
+ * before anyone is asked (`startMcpSkillWalk`, `takeMcpSkillWalkListing`,
886
+ * `mcpSkillSnapshotBytesRefusal`, `mcpSkillSnapshotEntry`). Pure, no imports (a digest is
887
+ * computed with the platform's WebCrypto, `globalThis.crypto.subtle`, or a function passed in).
888
+ *
889
+ * A server's skills are third-party text. They reach the model only as knowledge, under
890
+ * `mcpSkillPreamble`, and - unless the host vetted the server (`consent: 'never'`) - only after a
891
+ * person saw them and said yes; nothing here (or anywhere) reads a skill's frontmatter beyond its
892
+ * `name` and `description` - `allowed-tools` included - and a file a skill bundles is read as
893
+ * text, never run.
894
+ *
895
+ * This file is a COPY, byte for byte, in `@dudko.dev/agent` (`src/mcp-skills.ts`) and
896
+ * `@dudko.dev/agent-web` (`src/mcp/skills.ts`): change both. The Node package's
897
+ * `tests/mcp-skills-shared.test.ts` compares the two files and tests every rule and cap here.
898
+ */
899
+ /** The extension's identifier, in the client's and the server's `extensions` capability. */
900
+ declare const MCP_SKILLS_EXTENSION = "io.modelcontextprotocol/skills";
901
+ /** The specification's limits (Limits): files per skill, `SKILL.md` included. */
902
+ declare const MCP_SKILL_MAX_RESOURCES = 512;
903
+ /** The specification's limits (Limits): the sum of `size` over a skill's files, in bytes. */
904
+ declare const MCP_SKILL_MAX_TOTAL_BYTES: number;
905
+ /** The most skills one server puts in the agent's catalog. */
906
+ declare const MCP_SKILLS_MAX_PER_SERVER = 32;
907
+ /** The most skills all servers put in the agent's catalog together. */
908
+ declare const MCP_SKILLS_MAX_TOTAL = 64;
909
+ /** The most a catalog entry (the description and its origin tag) takes, in characters. */
910
+ declare const MCP_SKILL_DESCRIPTION_MAX_CHARS = 300;
911
+ /** The most of a skill's instructions (its `SKILL.md` body) the model is given, in characters. */
912
+ declare const MCP_SKILL_BODY_MAX_CHARS = 16000;
913
+ /** The most of one file of a skill the model is given, in characters. */
914
+ declare const MCP_SKILL_FILE_MAX_CHARS = 32000;
915
+ /**
916
+ * Why the agent does not take a skill entry from a server, or `undefined` when it does. The
917
+ * specification's rules on an entry, checked before anything of the skill is read:
918
+ *
919
+ * - its `uri` is a `SKILL.md` inside a named directory, whose last segment is the skill's
920
+ * frontmatter `name` (Resource Mapping; Frontmatter), and that name follows the Agent Skills
921
+ * naming rules;
922
+ * - a description to show in the catalog;
923
+ * - `resources` is the complete list of its files (Resources): `"dynamic"` content is declined
924
+ * (a host MAY: there is nothing to verify it against, and a consent could not bind to its
925
+ * content) - unless `options.dynamic` (the server's `skills: { dynamic: true }`: the host
926
+ * trusts that server with its generated skills, which are then read into a snapshot before
927
+ * anyone is asked, see {@link mcpSkillSnapshotEntry}); anything else is invalid;
928
+ * - every file is `SKILL.md` or a file inside the skill's directory, listed once, with a
929
+ * `sha256:` digest and a byte size, and `SKILL.md` is listed;
930
+ * - at most {@link MCP_SKILL_MAX_RESOURCES} files and {@link MCP_SKILL_MAX_TOTAL_BYTES} bytes
931
+ * (Limits: "both limits are checkable from the entry alone"; a generated skill's are counted
932
+ * on what its snapshot reads).
933
+ */
934
+ declare const mcpSkillEntryRefusal: (entry: unknown, options?: {
935
+ dynamic?: boolean;
936
+ }) => string | undefined;
937
+ /**
938
+ * How a skill of a server is introduced wherever its text is shown to the model (its
939
+ * instructions, and each file of it): third-party knowledge that cannot change the rules. The
940
+ * wording is the guard.
941
+ */
942
+ declare const mcpSkillPreamble: (server: string, uri: string) => string;
943
+ /**
944
+ * The most entries of one `resources/directory/read` answer looked at: the specification's 512
945
+ * files per skill, and room for the directories among them. The rest are not looked at.
946
+ */
947
+ declare const MCP_SKILL_DIRECTORY_ENTRIES_MAX: number;
948
+ /** What `read_skill_file` answers for a directory of a skill (every path inside the skill). */
949
+ interface SkillDirectoryListing {
950
+ /** The skill's name in the catalog. */
951
+ name: string;
952
+ /** The directory: `.` for the skill's root, else its path inside the skill. */
953
+ directory: string;
954
+ /** Its files (each read with `read_skill_file`), sorted. */
955
+ files: string[];
956
+ /** Its subdirectories (each listed the same way), sorted. */
957
+ directories: string[];
958
+ /** How many more it holds than the two lists show ({@link MCP_SKILL_FILES_SHOWN_MAX} in all). */
959
+ more?: number;
960
+ /** Shown above, but no longer listed by the skill's MCP server: a read of them will fail. */
961
+ notServed?: string[];
962
+ /** The skill changed on its MCP server since it was loaded ({@link mcpSkillDirectoryNote}). */
963
+ note?: string;
964
+ }
965
+ /** The longest URI `load_skill` sends to a server, in characters. */
966
+ declare const MCP_SKILL_URI_MAX_CHARS = 512;
967
+ /**
968
+ * Why `load_skill` does not ask a server for the skill at `uri`, or `undefined` when it may. Checked
969
+ * before any request: a `skill://` URI - the conventional scheme; a URI the MODEL hands over (it
970
+ * read it in third-party text) is taken in no other, though a listing may use any - of the
971
+ * `SKILL.md` of a named directory, whose last segment is a skill name, within
972
+ * {@link MCP_SKILL_URI_MAX_CHARS}, with nothing invisible and no space in it.
973
+ */
974
+ declare const mcpSkillUriRefusal: (uri: unknown) => string | undefined;
975
+ /** When a person is asked before a server's skill enters the model's context. */
976
+ type McpSkillConsent = 'ask' | 'once-per-skill' | 'never';
977
+ /** Every value of {@link McpSkillConsent}. */
978
+ declare const MCP_SKILL_CONSENTS: readonly McpSkillConsent[];
979
+ /**
980
+ * The default: asked the first time a skill would enter the context in the agent's life, and again
981
+ * only when its entry changed - often enough that every text a person did not see is shown, seldom
982
+ * enough that a yes still means something.
983
+ */
984
+ declare const MCP_SKILL_CONSENT_DEFAULT: McpSkillConsent;
985
+ /** `skills` on a server's config, as an object. */
986
+ interface McpSkillsOptions {
987
+ /**
988
+ * `'once-per-skill'` (default): a person is asked the first time each skill would enter the
989
+ * model's context, and a yes holds for the agent's life while the skill's entry is the same;
990
+ * `'ask'`: asked in every run that loads it; `'never'`: never asked - for a server the host
991
+ * vetted (its skills load as soon as the model asks). Whatever the approval mode says.
992
+ */
993
+ consent?: McpSkillConsent;
994
+ /**
995
+ * `true`: also take this server's GENERATED skills (`"resources": "dynamic"` - no checksums;
996
+ * declined by default). When one would enter the model's context, the agent first reads all
997
+ * of it - `SKILL.md` and, if the server serves `resources/directory/read`, every file its
998
+ * directories list, within the specification's limits - computes each file's digest itself,
999
+ * and holds that copy in memory: the person approves that copy (the consent binds to its
1000
+ * digests), and the model is given only that copy, never a later read. Per server, for a
1001
+ * server you trust with this; there is no agent-wide switch.
1002
+ */
1003
+ dynamic?: boolean;
1004
+ }
1005
+ /** `skills` on a server's config: `true`, or options (on, with them); `false` / absent: off. */
1006
+ type McpSkillsSetting = boolean | McpSkillsOptions;
1007
+ /**
1008
+ * What a person is shown before a server's skill enters the model's context - the request's
1009
+ * `skill` (the core's `tool.approval-requested` event). Every string is the SERVER's, cleaned:
1010
+ * show it as plain text, captioned as the server's.
1011
+ */
1012
+ interface McpSkillConsentView {
1013
+ /** The host's label of the server that serves it. */
1014
+ server: string;
1015
+ /** Its name in the agent's catalog (`<server>/<skill>`). */
1016
+ name: string;
1017
+ /** Its frontmatter name. */
1018
+ skill: string;
1019
+ /** The URI of its `SKILL.md` (cleaned, at most 200 characters). */
1020
+ uri: string;
1021
+ /** The description from its entry, on one line, at most {@link MCP_SKILL_DESCRIPTION_MAX_CHARS}. */
1022
+ description: string;
1023
+ /** Bytes of its `SKILL.md`, and of all its files. */
1024
+ size: number;
1025
+ totalSize: number;
1026
+ /** Its other files, by path (at most {@link MCP_SKILL_FILES_SHOWN_MAX}), and how many there are. */
1027
+ files: string[];
1028
+ fileCount: number;
1029
+ /** Its instructions exactly as the model would read them ({@link mcpSkillBodyPreview}). */
1030
+ body: string;
1031
+ /** Named by URI (`skills/get`), not in the server's listing. */
1032
+ byUri?: true;
1033
+ /** It sits inside this skill of the same server, whose approval does not cover it. */
1034
+ nestedIn?: string;
1035
+ /**
1036
+ * Generated by the server (`"resources": "dynamic"`, taken with `skills: { dynamic: true }`):
1037
+ * there are no checksums. The size, the files and the text are those of the copy the agent just
1038
+ * read (its snapshot), and only that copy is used - say so.
1039
+ */
1040
+ dynamic?: true;
1041
+ /**
1042
+ * (with `dynamic`) The server cannot list the skill's files (no `resources/directory/read`): the
1043
+ * copy is its `SKILL.md` alone, and no other file of it can be read.
1044
+ */
1045
+ noFileListing?: true;
1046
+ /** Asked for this run only (`'ask'`) or, on a yes, for the agent's life (`'once-per-skill'`). */
1047
+ consent: Exclude<McpSkillConsent, 'never'>;
1048
+ }
1049
+ /**
1050
+ * The most directories one snapshot reads (`resources/directory/read`, the skill's root
1051
+ * included). One read is one directory, its pages walked by the SDK (bounded by its own page cap).
1052
+ */
1053
+ declare const MCP_SKILL_SNAPSHOT_MAX_DIRECTORIES = 64;
1054
+ /** The deepest directory of a skill a snapshot reads: its root is 0, `templates` 1, ... */
1055
+ declare const MCP_SKILL_SNAPSHOT_MAX_DEPTH = 8;
1056
+ /** The most bytes the snapshots of one agent hold in memory together. */
1057
+ declare const MCP_SKILL_SNAPSHOTS_MAX_BYTES: number;
1058
+
604
1059
  declare const SPAWN_SUBAGENT_TOOL = "spawn_subagent";
605
1060
  type SubagentDefaultTools = 'read-only' | 'all';
606
1061
  interface IDynamicSubagentsConfig {
@@ -738,6 +1193,11 @@ interface ISkill {
738
1193
  content: string;
739
1194
  }[];
740
1195
  origin?: ISkillOrigin;
1196
+ mcp?: IMcpSkillOrigin;
1197
+ }
1198
+ interface IMcpSkillOrigin {
1199
+ server: string;
1200
+ uri: string;
741
1201
  }
742
1202
  interface ISkillOrigin {
743
1203
  kind: 'learned';
@@ -771,6 +1231,11 @@ interface IToolApprovalRequest {
771
1231
  id: string;
772
1232
  depth: number;
773
1233
  };
1234
+ mcpSkills?: string[];
1235
+ skill?: McpSkillConsentView;
1236
+ }
1237
+ interface IToolApprovalContext {
1238
+ signal: AbortSignal;
774
1239
  }
775
1240
  type ToolApprovalDecision = boolean | {
776
1241
  approved: boolean;
@@ -780,7 +1245,7 @@ type ToolApprovalDecision = boolean | {
780
1245
  interface IToolApprovalConfig {
781
1246
  mode?: ToolApprovalMode;
782
1247
  rules?: Record<string, ToolPermission>;
783
- onRequest?: (req: IToolApprovalRequest) => ToolApprovalDecision | Promise<ToolApprovalDecision>;
1248
+ onRequest?: (req: IToolApprovalRequest, ctx: IToolApprovalContext) => ToolApprovalDecision | Promise<ToolApprovalDecision>;
784
1249
  timeoutMs?: number;
785
1250
  }
786
1251
  type PromptCachingSetting = boolean | {
@@ -800,6 +1265,8 @@ interface IMcpHttpServerConfig {
800
1265
  authProvider?: OAuthClientProvider;
801
1266
  fetch?: FetchLike;
802
1267
  connectTimeoutMs?: number;
1268
+ protocol?: McpProtocolMode;
1269
+ skills?: McpSkillsSetting;
803
1270
  }
804
1271
  interface IMcpStdioServerConfig {
805
1272
  command: string;
@@ -807,6 +1274,8 @@ interface IMcpStdioServerConfig {
807
1274
  env?: Record<string, string>;
808
1275
  cwd?: string;
809
1276
  connectTimeoutMs?: number;
1277
+ protocol?: McpProtocolMode;
1278
+ skills?: McpSkillsSetting;
810
1279
  }
811
1280
  type IMcpServerConfig = IMcpHttpServerConfig | IMcpStdioServerConfig;
812
1281
  interface IAgentStageOverride {
@@ -858,6 +1327,11 @@ interface IAgentConfig {
858
1327
  toolApproval?: IToolApprovalConfig;
859
1328
  toolSearchThreshold?: number;
860
1329
  mcpConnectTimeoutMs?: number;
1330
+ onElicitation?: McpElicitationHandler;
1331
+ elicitation?: McpElicitationOptions;
1332
+ mcpSkills?: {
1333
+ consent?: McpSkillConsent;
1334
+ };
861
1335
  mcpInstructions?: boolean;
862
1336
  promptCaching?: PromptCachingSetting;
863
1337
  llmTimeoutMs?: number;
@@ -920,7 +1394,7 @@ interface IStepResult {
920
1394
  }
921
1395
  type ReplanTrigger = 'failure' | 'always' | ((result: IStepResult) => boolean | Promise<boolean>);
922
1396
  type ReplanCause = 'last-step' | 'clean-step' | 'llm-decision' | 'user-message' | 'decision-model';
923
- type UsagePhase = 'plan' | 'execute' | 'replan' | 'synthesize' | 'compact' | 'subagent' | 'decision' | 'media';
1397
+ type UsagePhase = 'plan' | 'execute' | 'replan' | 'synthesize' | 'compact' | 'subagent' | 'decision' | 'media' | 'search';
924
1398
  type AgentEventBody = {
925
1399
  type: 'plan.thought-delta';
926
1400
  delta: string;
@@ -1015,6 +1489,7 @@ type AgentEventBody = {
1015
1489
  type: 'skill.activated';
1016
1490
  name: string;
1017
1491
  by: 'plan' | 'tool';
1492
+ server?: string;
1018
1493
  } | {
1019
1494
  type: 'tools.discovered';
1020
1495
  step: IPlanStep;
@@ -1031,6 +1506,8 @@ type AgentEventBody = {
1031
1506
  id: string;
1032
1507
  depth: number;
1033
1508
  };
1509
+ mcpSkills?: string[];
1510
+ skill?: McpSkillConsentView;
1034
1511
  } | {
1035
1512
  type: 'tool.approval-resolved';
1036
1513
  id: string;
@@ -1038,6 +1515,29 @@ type AgentEventBody = {
1038
1515
  approved: boolean;
1039
1516
  reason?: string;
1040
1517
  automatic: boolean;
1518
+ } | {
1519
+ type: 'mcp.elicitation-requested';
1520
+ id: string;
1521
+ server: string;
1522
+ tool: string;
1523
+ mode: 'form' | 'url';
1524
+ message: string;
1525
+ requestedSchema?: McpElicitationSchema;
1526
+ url?: string;
1527
+ step?: IPlanStep;
1528
+ subagent?: {
1529
+ id: string;
1530
+ depth: number;
1531
+ };
1532
+ } | {
1533
+ type: 'mcp.elicitation-answered';
1534
+ id: string;
1535
+ server: string;
1536
+ tool: string;
1537
+ action: 'accept' | 'decline' | 'cancel';
1538
+ automatic: boolean;
1539
+ reason?: McpElicitationReason;
1540
+ fields?: string[];
1041
1541
  } | {
1042
1542
  type: 'subagent.start';
1043
1543
  id: string;
@@ -1204,6 +1704,7 @@ interface IAgent {
1204
1704
  name: string;
1205
1705
  description: string;
1206
1706
  learned?: true;
1707
+ server?: string;
1207
1708
  }[];
1208
1709
  listLearnedSkills: () => ISkill[];
1209
1710
  forgetSkill: (name: string) => Promise<boolean>;
@@ -1228,6 +1729,8 @@ declare class ToolDeniedError extends Error {
1228
1729
  }
1229
1730
  declare const markReadOnly: <T extends object>(tool: T, readOnly?: boolean) => T;
1230
1731
  declare const isReadOnlyTool: (tool: unknown) => boolean;
1732
+ declare const markCodeExecution: <T extends object>(tool: T, codeExecution?: boolean) => T;
1733
+ declare const isCodeExecutionTool: (tool: unknown) => boolean;
1231
1734
  /**
1232
1735
  * The most specific rule matching `name`: an exact key wins, then the
1233
1736
  * longest matching '*' glob (ties: the first declared). Pure.
@@ -1243,18 +1746,26 @@ interface IToolDecisionInput {
1243
1746
  rules?: Record<string, ToolPermission>;
1244
1747
  remembered?: ReadonlySet<string>;
1245
1748
  builtIn?: boolean;
1749
+ codeExecution?: boolean;
1750
+ mcpSkills?: readonly string[];
1246
1751
  }
1247
1752
  interface IToolDecision {
1248
1753
  permission: ToolPermission;
1249
- source: 'builtin' | 'remembered' | 'rule' | 'mode';
1754
+ source: 'builtin' | 'remembered' | 'rule' | 'mode' | 'mcp-skill';
1250
1755
  rule?: string;
1251
1756
  }
1252
1757
  /**
1253
1758
  * Decide one call. Pure. Order: built-in -> remembered "always allow" ->
1254
1759
  * most specific rule -> mode default (autopilot: allow; read-only: allow if
1255
1760
  * readOnly else deny; ask-writes: allow if readOnly else ask; ask-all: ask).
1761
+ * Then one rule that only ever tightens: a call that runs code while the run acts on an MCP
1762
+ * server's skill is asked when it would have been allowed - by the mode, a rule or an "always
1763
+ * allow" alike (the Skills extension: no code runs here on a server's skill without a person's
1764
+ * approval). A deny stays a deny.
1256
1765
  */
1257
1766
  declare const decideToolPermission: (input: IToolDecisionInput) => IToolDecision;
1767
+ /** How long a question waits for a decision when `toolApproval.timeoutMs` is not set: 5 minutes. */
1768
+ declare const TOOL_APPROVAL_TIMEOUT_MS = 300000;
1258
1769
 
1259
1770
  declare const REPLAY_NOTE = "[not run again: this exact call already succeeded in an earlier attempt at this step, and its effect is in place. Its result then:]";
1260
1771
  declare const isReplayedToolOutput: (output: unknown) => boolean;
@@ -1290,8 +1801,9 @@ declare const addUsage: (a: IUsage, b: IUsage) => IFilledUsage;
1290
1801
  * OAuth 2.1 for remote MCP servers, from Node.
1291
1802
  *
1292
1803
  * The MCP SDK owns the protocol - discovery (RFC 9728), dynamic client
1293
- * registration (RFC 7591) or a client ID metadata document (CIMD), PKCE, the
1294
- * code exchange and the refresh on 401. What it does not own, and what this
1804
+ * registration (RFC 7591) or a client ID metadata document (CIMD) -
1805
+ * automatically or one of them only (`registration`) - PKCE, the code exchange
1806
+ * and the refresh on 401. What it does not own, and what this
1295
1807
  * module supplies, is WHERE the resulting tokens live between processes, HOW an
1296
1808
  * operator is asked to authorize, and the check of the `iss` parameter on the
1297
1809
  * way back (RFC 9207).
@@ -1339,6 +1851,25 @@ declare class MemoryOAuthStore implements IOAuthStore {
1339
1851
  set(key: string, value: string): Promise<void>;
1340
1852
  delete(key: string): Promise<void>;
1341
1853
  }
1854
+ /**
1855
+ * How the OAuth client is registered with a server's authorization server
1856
+ * (`INodeOAuthProviderOptions.registration`):
1857
+ *
1858
+ * - `'auto'` (the default): by the client ID metadata document (CIMD) when the
1859
+ * authorization server advertises `client_id_metadata_document_supported` and
1860
+ * a `clientMetadataUrl` is set, by dynamic client registration (DCR, RFC 7591)
1861
+ * otherwise. A client already in the store is used as it is.
1862
+ * - `'cimd'`: by the metadata document only. Needs `clientMetadataUrl`. An
1863
+ * authorization server that does not advertise support is refused before
1864
+ * anything is sent to its registration endpoint.
1865
+ * - `'dcr'`: by dynamic registration only, even with a `clientMetadataUrl` set:
1866
+ * the SDK is never shown the URL.
1867
+ *
1868
+ * The browser package has the same option, with the same names; change both.
1869
+ */
1870
+ type McpOAuthRegistration = 'auto' | 'cimd' | 'dcr';
1871
+ /** How a stored client was registered: see {@link NodeOAuthProvider.registrationKind}. */
1872
+ type McpOAuthRegistrationKind = 'cimd' | 'dcr';
1342
1873
  interface INodeOAuthProviderOptions {
1343
1874
  /** The MCP endpoint being authorized. */
1344
1875
  serverUrl: string;
@@ -1362,9 +1893,20 @@ interface INodeOAuthProviderOptions {
1362
1893
  * this URL is used as the `client_id` and no dynamic registration is made;
1363
1894
  * otherwise registration runs as before. A registration already in the store
1364
1895
  * wins over both. Must be https with a non-root path, and the document served
1365
- * there must list the same `redirect_uris` as `redirectUrl`.
1896
+ * there must list the same `redirect_uris` as `redirectUrl`. With
1897
+ * `registration: 'dcr'` it is never used as the `client_id`.
1366
1898
  */
1367
1899
  clientMetadataUrl?: string;
1900
+ /**
1901
+ * How the client is registered: `'auto'` (default; as described for
1902
+ * `clientMetadataUrl`), `'cimd'` (the metadata document only: needs
1903
+ * `clientMetadataUrl`, and an authorization server without support is refused
1904
+ * before any registration request) or `'dcr'` (dynamic registration only).
1905
+ * A stored client of the other kind is not reused: it is forgotten, with the
1906
+ * tokens issued to it, and the operator authorizes again. See
1907
+ * {@link McpOAuthRegistration}.
1908
+ */
1909
+ registration?: McpOAuthRegistration;
1368
1910
  /** Defaults to a 0600 JSON file under ~/.agent. */
1369
1911
  store?: IOAuthStore;
1370
1912
  /** Treat the access token as expired this many seconds early. Default 30. */
@@ -1410,20 +1952,65 @@ declare class NodeOAuthProvider implements OAuthClientProvider {
1410
1952
  private readonly _redirectUrl;
1411
1953
  private readonly _clientMetadata;
1412
1954
  private readonly _clientMetadataUrl?;
1955
+ private readonly _registration;
1413
1956
  private readonly skewMs;
1414
1957
  private readonly onAuthorizationUrl?;
1958
+ /** Once per provider: a stored client of the other kind is forgotten (see `settle`). */
1959
+ private settled?;
1415
1960
  constructor(opts: INodeOAuthProviderOptions);
1416
1961
  get redirectUrl(): string;
1417
1962
  get clientMetadata(): OAuthClientMetadata;
1418
- /** The client ID metadata document URL (CIMD), when one was configured. */
1963
+ /**
1964
+ * The client ID metadata document URL (CIMD), when one was configured - and
1965
+ * not with `registration: 'dcr'`: the SDK uses this getter to decide, so a
1966
+ * URL it cannot see is a URL it never uses as the `client_id`.
1967
+ */
1419
1968
  get clientMetadataUrl(): string | undefined;
1969
+ /** How this provider registers its client: `'auto'`, `'cimd'` or `'dcr'`. */
1970
+ get registration(): McpOAuthRegistration;
1420
1971
  private key;
1421
1972
  private readJSON;
1422
1973
  state(): Promise<string>;
1423
1974
  /** Single-use CSRF check for the value that comes back on the redirect. */
1424
1975
  verifyState(returned: string | undefined): Promise<boolean>;
1976
+ /** The stored client, without our stamp, and how it was registered. */
1977
+ private readClient;
1978
+ private kindOf;
1979
+ /**
1980
+ * May this provider use the stored client? Under `'auto'` any; under `'cimd'`
1981
+ * only the configured document itself; under `'dcr'` only one that was not
1982
+ * registered by a document.
1983
+ */
1984
+ private fits;
1985
+ /** The client and the tokens issued to it go together: a token belongs to a client. */
1986
+ private forgetClient;
1987
+ /**
1988
+ * Under `'cimd'` / `'dcr'`, before the first read of the client or a token: a
1989
+ * stored client of the other kind (registered under another setting) is
1990
+ * forgotten with its tokens, so the setting is never served by the old
1991
+ * client - not even by its access token, which the transport would otherwise
1992
+ * keep sending until it expires. Once per provider (its setting is fixed); a
1993
+ * failure is not remembered.
1994
+ */
1995
+ private settle;
1996
+ /**
1997
+ * `'cimd'` with no usable client: the SDK is about to choose between the
1998
+ * document and a dynamic registration, by the authorization server metadata
1999
+ * it has just saved (`saveDiscoveryState` comes first). Without support it
2000
+ * would register - so it is stopped HERE, before any request is made, and
2001
+ * what discovery found is forgotten, so the next attempt reads the server's
2002
+ * metadata again (a server that starts supporting CIMD is noticed).
2003
+ */
2004
+ private assertCimdSupported;
1425
2005
  clientInformation(): Promise<OAuthClientInformationMixed | undefined>;
1426
2006
  saveClientInformation(info: OAuthClientInformationMixed): Promise<void>;
2007
+ /**
2008
+ * How the stored client was registered: `'cimd'` (its `client_id` is the
2009
+ * client ID metadata document), `'dcr'` (registered dynamically - or saved by
2010
+ * the host), or undefined when there is none this provider would use. Read it
2011
+ * after an authorization to tell the operator which way was taken.
2012
+ */
2013
+ registrationKind(): Promise<McpOAuthRegistrationKind | undefined>;
1427
2014
  tokens(): Promise<OAuthTokens | undefined>;
1428
2015
  saveTokens(tokens: OAuthTokens): Promise<void>;
1429
2016
  saveCodeVerifier(verifier: string): Promise<void>;
@@ -1484,34 +2071,6 @@ declare const finishMcpOAuth: (provider: NodeOAuthProvider, callback: {
1484
2071
  iss?: string;
1485
2072
  }, opts?: IOAuthRequestOptions) => Promise<void>;
1486
2073
 
1487
- /**
1488
- * What the MCP connectors of the two agent packages share: how a server's `instructions` reach a
1489
- * system prompt, and how a tool result's `structuredContent` reaches the model. Pure, no imports.
1490
- *
1491
- * This file is a COPY, byte for byte, in `@dudko.dev/agent` (`src/mcp-shared.ts`) and
1492
- * `@dudko.dev/agent-web` (`src/mcp/shared.ts`): change both. The Node package's
1493
- * `tests/mcp-shared.test.ts` compares the two files and tests every cap and guard here.
1494
- */
1495
- /** The `instructions` one connected MCP server returned in its `initialize` result. */
1496
- interface McpServerInstructions {
1497
- /** The server's name: its key in the host's configuration. */
1498
- server: string;
1499
- instructions: string;
1500
- }
1501
- /** The most one server's instructions take in a system prompt, in characters. */
1502
- declare const MCP_INSTRUCTIONS_MAX_CHARS_PER_SERVER = 2000;
1503
- /** The most all servers' instructions take together, in characters. */
1504
- declare const MCP_INSTRUCTIONS_MAX_CHARS_TOTAL = 8000;
1505
- /**
1506
- * The system-prompt section for the servers' instructions, or '' when no server sent any (the
1507
- * prompt is then exactly what it was). Each server's text is capped
1508
- * (MCP_INSTRUCTIONS_MAX_CHARS_PER_SERVER), so is the sum (MCP_INSTRUCTIONS_MAX_CHARS_TOTAL, in
1509
- * the order given: a server past the total is named as omitted), and every line of it is
1510
- * prefixed with "| ", so a server cannot write something that reads as a heading of this prompt
1511
- * or as another server's note.
1512
- */
1513
- declare const renderMcpInstructions: (list: readonly McpServerInstructions[] | undefined) => string;
1514
-
1515
2074
  /**
1516
2075
  * Enterprise-Managed Authorization for remote MCP servers (the MCP extension
1517
2076
  * `io.modelcontextprotocol/enterprise-managed-authorization`, also called Cross
@@ -2089,5 +2648,5 @@ interface ISubagentToolOptions {
2089
2648
  */
2090
2649
  declare const createSubagentTool: (opts: ISubagentToolOptions) => Tool;
2091
2650
 
2092
- export { DEFAULT_COMPACTION_THRESHOLD_RATIO, DEFAULT_DECISION_CONFIDENCE_THRESHOLD, DEFAULT_DECISION_TIMEOUT_MS, DirSkillStore, ENTERPRISE_MANAGED_AUTHORIZATION_EXTENSION, EgressError, EnterpriseOAuthError, FORGET_SKILL_TOOL, FileOAuthStore, GENERATE_IMAGE_TOOL, GENERATE_SPEECH_TOOL, MCP_INSTRUCTIONS_MAX_CHARS_PER_SERVER, MCP_INSTRUCTIONS_MAX_CHARS_TOTAL, MEDIA_AUDIO_TYPES, MEDIA_DEFAULT_MAX_CALLS, MEDIA_FOLDER, MEDIA_IMAGE_TYPES, MEDIA_MAX_ATTACHED_AUDIO, MEDIA_MAX_AUDIO_INPUT_BYTES, MEDIA_MAX_IMAGE_BYTES, MEDIA_MAX_PROMPT_CHARS, MEDIA_MAX_SPEECH_BYTES, MEDIA_MAX_SPEECH_CHARS, MEDIA_MAX_TRANSCRIPT_CHARS, MEDIA_TIMEOUT_MS, MediaBudgetError, MediaError, MemoryOAuthStore, MemorySkillStore, NodeEnterpriseOAuthProvider, NodeOAuthProvider, PIPELINE_LIMITS, PipelineNodeError, PipelineValidationError, REPLAY_NOTE, RUN_JS_TOOL, SAVE_SKILL_TOOL, SEARCH_API_BASE_URL, SEARCH_DEFAULT_MAX_RESULTS, SEARCH_MAX_QUERY_CHARS, SEARCH_MAX_RESULTS, SEARCH_MAX_SNIPPET_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, TRANSCRIBE_AUDIO_TOOL, ToolBudgetError, ToolDeniedError, WEB_FETCH_TOOL, WEB_SEARCH_TOOL, acceptMedia, addUsage, adoptSubagentEvent, askDecisionModel, beginMcpOAuth, buildInstructions, buildMediaModelFromStage, buildSearchRequest, checkAuthorizationResponseIssuer, checkEgressUrl, checkLimits, checkRedirect, classifyAddress, compactHistory, createAgent, createEgressTools, createEnterpriseOAuthProvider, createLearning, createMedia, createNodeOAuthProvider, createPipeline, createRunControl, createSafeFetch, createSandboxTool, createSandboxTools, createSearchTools, createSubagentTool, createToolResultClearer, createWebFetchTool, createWebSearchTool, decideToolPermission, decisionModelFromAiSdk, defineSkill, estimateTokens, findSecret, finishMcpOAuth, getCurrentRunId, getCurrentRunSandbox, hostMatches, htmlToText, isReadOnlyTool, isReplayedToolOutput, loadSkillsFromDir, markReadOnly, matchToolRule, mediaUsageOf, mergeProviderOptions, nodeResolver, normalizePipeline, normalizeSkillName, normalizeUsage, parseSearchResponse, parseSkillMarkdown, redactHeaders, renderMcpInstructions, renderPipelineNodeInput, resolveCompaction, resolveDynamicSubagents, resolveEgressPolicy, resolveLimits, resolvePromptCaching, resolveSandboxLimits, resolveThinking, sanitizeSearchResults, searchEgressPolicy, searchTools, sniffMediaType, testPipelineCondition, truncateToolModelOutput, validatePipeline, withRollingBreakpoint, withToolOutputLimit, wrapTranscript };
2093
- export type { AgentEvent, AgentStage, BudgetKind, DecisionFallbackReason, DecisionPoint, EgressErrorCode, EnterpriseAssertionAlgorithm, EnterpriseAssertionAudience, EnterpriseAssertionType, EnterpriseOAuthHop, EnterpriseOAuthLog, EnterprisePrivateKey, EscalationReason, EventHandler, IAgent, IAgentConfig, IAgentRunOptions, IAgentRunResult, IAgentStageOverride, IAiSdkDecisionOptions, IClearedInfo, ICloseOptions, ICompactHistoryOptions, ICompactHistoryResult, ICompactOptions, ICompactResult, ICompactionConfig, IConversationTurn, IDecisionAnswer, IDecisionCallOptions, IDecisionConfig, IDecisionEvent, IDecisionModel, IDecisionOption, IDecisionOutcome, IDecisionQuestion, IDynamicSubagentsConfig, IEgressPolicy, IEnterpriseIdpOptions, IEnterpriseOAuthProviderOptions, IEscalationConfig, ILearning, ILearningConfig, ILimitBreach, IMcpHttpServerConfig, IMcpServerConfig, IMcpStdioServerConfig, IMedia, IMediaConfig, IMediaFile, IMediaModelSpec, IMediaUsage, INodeOAuthProviderOptions, IOAuthRequestOptions, IOAuthStore, IPersistence, IPlan, IPlanStep, IResolvedAddress, IResolvedDynamicSubagents, IResolvedThinking, IRunFile, IRunSnapshot, ISandboxConfig, ISandboxError, ISandboxLimits, ISandboxResult, ISanitizedSearch, ISaveSkillInput, ISearchConfig, ISearchOptions, ISearchRequest, ISearchResult, ISearchToolsOptions, ISkill, ISkillOrigin, ISkillStore, IStepEscalation, IStepResult, IStepStartInfo, ISubagentProfile, ISubagentToolOptions, ISubagentsConfig, IThinkingConfig, ITokenLimits, IToolApprovalConfig, IToolApprovalRequest, IToolCatalogEntry, IToolDecision, IToolDecisionInput, IToolResultClearing, ITranscription, IUsage, IWebSearchOptions, LogLevel, McpServerInstructions, MediaImageModel, MediaKind, MediaModelKind, MediaSpeechModel, MediaTranscriptionModel, ModelTier, NodeResolverOptions, Pipeline, PipelineCondition, PipelineDefinition, PipelineEdge, PipelineEvent, PipelineIssue, PipelineModelConfig, PipelineNode, PipelineNodeContext, PipelineNodeInput, PipelineNodeOutput, PipelineNodeRunner, PipelineNodeSource, PipelineOptions, PipelineResult, PipelineRoute, PipelineRunOptions, PipelineStop, PipelineTraceEntry, PipelineUsage, PipelineValidation, PromptCachingSetting, ProviderType, ReplanCause, ReplanTrigger, RunControl, SafeFetch, SearchEngine, SearchFreshness, SearchProvider, StepComplexity, SubagentDefaultTools, SubagentInfo, SubagentIsolation, ThinkingLevel, ThinkingSetting, TierReason, TokenLimitKind, ToolApprovalDecision, ToolApprovalMode, ToolPermission, ToolSelectionStrategy, UsagePhase };
2651
+ export { DEFAULT_COMPACTION_THRESHOLD_RATIO, DEFAULT_DECISION_CONFIDENCE_THRESHOLD, DEFAULT_DECISION_TIMEOUT_MS, DirSkillStore, ENTERPRISE_MANAGED_AUTHORIZATION_EXTENSION, EgressError, EnterpriseOAuthError, FORGET_SKILL_TOOL, FileOAuthStore, GENERATE_IMAGE_TOOL, GENERATE_SPEECH_TOOL, MCP_ELICITATION_MAX_PER_RUN, MCP_ELICITATION_MAX_PER_TOOL_CALL, MCP_ELICITATION_TIMEOUT_MS, MCP_INSTRUCTIONS_MAX_CHARS_PER_SERVER, MCP_INSTRUCTIONS_MAX_CHARS_TOTAL, MCP_MODERN_PROTOCOL_VERSION, MCP_SKILLS_EXTENSION, MCP_SKILLS_MAX_PER_SERVER, MCP_SKILLS_MAX_TOTAL, MCP_SKILL_BODY_MAX_CHARS, MCP_SKILL_CONSENTS, MCP_SKILL_CONSENT_DEFAULT, MCP_SKILL_DESCRIPTION_MAX_CHARS, MCP_SKILL_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, NodeEnterpriseOAuthProvider, NodeOAuthProvider, PIPELINE_LIMITS, PipelineNodeError, PipelineValidationError, REPLAY_NOTE, RUN_JS_TOOL, SAVE_SKILL_TOOL, SEARCH_API_BASE_URL, SEARCH_DEFAULT_MAX_RESULTS, SEARCH_GOOGLE_DEFAULT_MODEL, SEARCH_GOOGLE_NOTE, SEARCH_MAX_QUERY_CHARS, SEARCH_MAX_RESULTS, SEARCH_MAX_SNIPPET_CHARS, SEARCH_MAX_SUMMARY_CHARS, SEARCH_MAX_TITLE_CHARS, SEARCH_MAX_TOTAL_CHARS, SEARCH_MAX_URL_CHARS, SEARCH_PROVIDERS, SPAWN_INPUT_SCHEMA, SPAWN_SUBAGENT_TOOL, SUBAGENT_DEFAULTS, SUBAGENT_MAX_DEPTH_LIMIT, SUMMARY_PREFIX, SandboxUnavailableError, SubagentSpawnError, TOOL_APPROVAL_TIMEOUT_MS, TRANSCRIBE_AUDIO_TOOL, ToolBudgetError, ToolDeniedError, WEB_FETCH_TOOL, WEB_SEARCH_TOOL, acceptMedia, addUsage, adoptSubagentEvent, askDecisionModel, beginMcpOAuth, buildInstructions, buildMediaModelFromStage, buildSearchRequest, checkAuthorizationResponseIssuer, checkEgressUrl, checkLimits, checkRedirect, classifyAddress, compactHistory, createAgent, createEgressTools, createEnterpriseOAuthProvider, createLearning, createMedia, createNodeOAuthProvider, createPipeline, createRunControl, createSafeFetch, createSandboxTool, createSandboxTools, createSearchTools, createSubagentTool, createToolResultClearer, createWebFetchTool, createWebSearchTool, decideToolPermission, decisionModelFromAiSdk, defineSkill, estimateTokens, findSecret, finishMcpOAuth, getCurrentRunId, getCurrentRunSandbox, hostMatches, htmlToText, isCodeExecutionTool, isReadOnlyTool, isReplayedToolOutput, loadSkillsFromDir, markCodeExecution, markReadOnly, matchToolRule, mcpSkillEntryRefusal, mcpSkillPreamble, mcpSkillUriRefusal, mediaUsageOf, mergeProviderOptions, nodeResolver, normalizeMcpElicitationSchema, normalizePipeline, normalizeSkillName, normalizeUsage, parseSearchResponse, parseSkillMarkdown, redactHeaders, renderMcpInstructions, renderPipelineNodeInput, resolveCompaction, resolveDynamicSubagents, resolveEgressPolicy, resolveLimits, resolvePromptCaching, resolveSandboxLimits, resolveThinking, sanitizeSearchResults, searchEgressPolicy, searchStatusMessage, searchToolResult, searchTools, sniffMediaType, testPipelineCondition, truncateToolModelOutput, validateMcpElicitationContent, validatePipeline, withRollingBreakpoint, withToolOutputLimit, wrapTranscript };
2652
+ export type { AgentEvent, AgentStage, BudgetKind, DecisionFallbackReason, DecisionPoint, EgressErrorCode, EnterpriseAssertionAlgorithm, EnterpriseAssertionAudience, EnterpriseAssertionType, EnterpriseOAuthHop, EnterpriseOAuthLog, EnterprisePrivateKey, EscalationReason, EventHandler, IAgent, IAgentConfig, IAgentRunOptions, IAgentRunResult, IAgentStageOverride, IAiSdkDecisionOptions, IClearedInfo, ICloseOptions, ICompactHistoryOptions, ICompactHistoryResult, ICompactOptions, ICompactResult, ICompactionConfig, IConversationTurn, IDecisionAnswer, IDecisionCallOptions, IDecisionConfig, IDecisionEvent, IDecisionModel, IDecisionOption, IDecisionOutcome, IDecisionQuestion, IDynamicSubagentsConfig, IEgressPolicy, IEnterpriseIdpOptions, IEnterpriseOAuthProviderOptions, IEscalationConfig, ILearning, ILearningConfig, ILimitBreach, IMcpHttpServerConfig, IMcpServerConfig, IMcpSkillOrigin, IMcpStdioServerConfig, IMedia, IMediaConfig, IMediaFile, IMediaModelSpec, IMediaUsage, INodeOAuthProviderOptions, IOAuthRequestOptions, IOAuthStore, IPersistence, IPlan, IPlanStep, IResolvedAddress, IResolvedDynamicSubagents, IResolvedThinking, IRunFile, IRunSnapshot, ISandboxConfig, ISandboxError, ISandboxLimits, ISandboxResult, ISanitizedSearch, ISaveSkillInput, ISearchAnswer, ISearchConfig, ISearchOptions, ISearchRequest, ISearchResult, ISearchToolResult, ISearchToolsOptions, ISearchUsage, ISkill, ISkillOrigin, ISkillStore, IStepEscalation, IStepResult, IStepStartInfo, ISubagentProfile, ISubagentToolOptions, ISubagentsConfig, IThinkingConfig, ITokenLimits, IToolApprovalConfig, IToolApprovalContext, IToolApprovalRequest, IToolCatalogEntry, IToolDecision, IToolDecisionInput, IToolResultClearing, ITranscription, IUsage, IWebSearchOptions, LogLevel, McpElicitationContent, McpElicitationContext, McpElicitationFieldSchema, McpElicitationHandler, McpElicitationOptions, McpElicitationReason, McpElicitationRequest, McpElicitationResult, McpElicitationSchema, McpOAuthRegistration, McpOAuthRegistrationKind, McpProtocolMode, McpServerInstructions, McpServerProtocol, McpSkillConsent, McpSkillConsentView, McpSkillsOptions, McpSkillsSetting, MediaImageModel, MediaKind, MediaModelKind, MediaSpeechModel, MediaTranscriptionModel, ModelTier, NodeResolverOptions, Pipeline, PipelineCondition, PipelineDefinition, PipelineEdge, PipelineEvent, PipelineIssue, PipelineModelConfig, PipelineNode, PipelineNodeContext, PipelineNodeInput, PipelineNodeOutput, PipelineNodeRunner, PipelineNodeSource, PipelineOptions, PipelineResult, PipelineRoute, PipelineRunOptions, PipelineStop, PipelineTraceEntry, PipelineUsage, PipelineValidation, PromptCachingSetting, ProviderType, ReplanCause, ReplanTrigger, RunControl, SafeFetch, SearchEngine, SearchFreshness, SearchProvider, SkillDirectoryListing, StepComplexity, SubagentDefaultTools, SubagentInfo, SubagentIsolation, ThinkingLevel, ThinkingSetting, TierReason, TokenLimitKind, ToolApprovalDecision, ToolApprovalMode, ToolPermission, ToolSelectionStrategy, UsagePhase };