llmist 18.2.0 → 18.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1534,6 +1534,12 @@ interface ModelFeatures {
1534
1534
  structuredOutputs?: boolean;
1535
1535
  /** Supports fine-tuning */
1536
1536
  fineTuning?: boolean;
1537
+ /**
1538
+ * Discoverability flag: the model can also run deep research via
1539
+ * `client.research` (see the research model catalog for capabilities
1540
+ * and research-specific pricing).
1541
+ */
1542
+ research?: boolean;
1537
1543
  }
1538
1544
  interface ModelSpec {
1539
1545
  /** Provider identifier (e.g., 'openai', 'anthropic', 'gemini') */
@@ -1929,6 +1935,27 @@ interface ObserveGadgetStartContext {
1929
1935
  /** Present when event is from a subagent (undefined for top-level agent) */
1930
1936
  subagentContext?: SubagentContext;
1931
1937
  }
1938
+ /**
1939
+ * Context for a progressive gadget-argument partial.
1940
+ * Read-only observation point. Values are RAW/uncoerced — see `GadgetArgsPartialEvent`.
1941
+ *
1942
+ * Unlike `onGadgetExecutionStart`, this fires BEFORE the gadget call is complete
1943
+ * (and before any ExecutionTree node exists for the gadget), repeatedly, as the
1944
+ * argument value streams in. The same `invocationId` later appears on the gadget's
1945
+ * `gadget_call` event and (if it executes) its start/complete contexts.
1946
+ */
1947
+ interface ObserveGadgetArgsPartialContext {
1948
+ iteration: number;
1949
+ invocationId: string;
1950
+ gadgetName: string;
1951
+ fieldPath: string;
1952
+ value: string;
1953
+ delta: string;
1954
+ isFieldComplete: boolean;
1955
+ logger: Logger<ILogObj>;
1956
+ /** Present when event is from a subagent (undefined for top-level agent) */
1957
+ subagentContext?: SubagentContext;
1958
+ }
1932
1959
  /**
1933
1960
  * Context provided when a gadget execution completes.
1934
1961
  * Read-only observation point.
@@ -2005,6 +2032,12 @@ interface Observers {
2005
2032
  onLLMCallError?: (context: ObserveLLMErrorContext) => void | Promise<void>;
2006
2033
  /** Called when a gadget execution starts */
2007
2034
  onGadgetExecutionStart?: (context: ObserveGadgetStartContext) => void | Promise<void>;
2035
+ /**
2036
+ * Called for each progressive argument partial while a gadget call is still
2037
+ * streaming (before its `gadget_call`). Read-only; awaited in emission order.
2038
+ * Values are RAW/uncoerced and should be treated as best-effort. Keep cheap.
2039
+ */
2040
+ onGadgetArgsPartial?: (context: ObserveGadgetArgsPartialContext) => void | Promise<void>;
2008
2041
  /** Called when a gadget execution completes (success or error) */
2009
2042
  onGadgetExecutionComplete?: (context: ObserveGadgetCompleteContext) => void | Promise<void>;
2010
2043
  /** Called when a gadget is skipped due to a failed dependency */
@@ -2667,6 +2700,375 @@ interface SpeechModelSpec {
2667
2700
  };
2668
2701
  }
2669
2702
 
2703
+ /**
2704
+ * Deep Research — normalized types.
2705
+ *
2706
+ * Deep research runs are long-lived (minutes to an hour), server-side agentic
2707
+ * jobs that browse the web and return cited reports. This module defines the
2708
+ * provider-independent surface: options, the normalized event union, the final
2709
+ * result, and the serializable job reference used to re-attach to a running
2710
+ * background job after a disconnect or process restart.
2711
+ */
2712
+
2713
+ /**
2714
+ * Lifecycle status of a research job.
2715
+ *
2716
+ * Superset of provider statuses:
2717
+ * - OpenAI Responses: `queued | in_progress | completed | failed | cancelled | incomplete`
2718
+ * - Gemini Interactions adds `requires_action` and `budget_exceeded`
2719
+ */
2720
+ type ResearchStatus = "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "cancelled" | "incomplete" | "budget_exceeded";
2721
+ /**
2722
+ * Data-source / auxiliary tools a research run may use.
2723
+ *
2724
+ * Providers map these to their native tool shapes (e.g. `web_search` becomes
2725
+ * OpenAI's `web_search_preview`). Which types a given model accepts is
2726
+ * declared in {@link ResearchModelSpec.capabilities.tools}.
2727
+ */
2728
+ type ResearchToolConfig = {
2729
+ type: "web_search";
2730
+ } | {
2731
+ type: "file_search";
2732
+ vectorStoreIds: string[];
2733
+ } | {
2734
+ type: "mcp";
2735
+ serverLabel: string;
2736
+ serverUrl: string;
2737
+ requireApproval?: "never";
2738
+ } | {
2739
+ type: "code_interpreter";
2740
+ };
2741
+ /** Union of the tool type discriminators. */
2742
+ type ResearchToolType = ResearchToolConfig["type"];
2743
+ /** Tool types that count as a data source (OpenAI requires at least one). */
2744
+ declare const RESEARCH_DATA_SOURCE_TOOL_TYPES: readonly ResearchToolType[];
2745
+ /**
2746
+ * Options for starting a research run.
2747
+ */
2748
+ interface ResearchOptions {
2749
+ /**
2750
+ * Model identifier, optionally provider-prefixed:
2751
+ * `"openai:gpt-5.5-pro"`, `"gemini:deep-research-preview-04-2026"`,
2752
+ * `"openrouter:perplexity/sonar-deep-research"`.
2753
+ */
2754
+ model: string;
2755
+ /** The research question / brief. */
2756
+ query: string;
2757
+ /**
2758
+ * System-level guidance. Folded into the input on providers without a
2759
+ * system slot (OpenAI deep research), mapped to `system_instruction`
2760
+ * (Gemini) or a system message (OpenRouter) elsewhere.
2761
+ */
2762
+ systemPrompt?: string;
2763
+ /**
2764
+ * Run as a server-side background job (survives disconnects; enables
2765
+ * {@link ResearchJob.toRef} / attach). Defaults to the model's
2766
+ * `capabilities.background`. Requesting `true` on a provider without
2767
+ * background support is a validation error.
2768
+ */
2769
+ background?: boolean;
2770
+ /**
2771
+ * Data-source / auxiliary tools. Defaults to the model's
2772
+ * `requiredTools`. Tools outside the model's `capabilities.tools`
2773
+ * are rejected before any network call.
2774
+ */
2775
+ tools?: ResearchToolConfig[];
2776
+ /** Cap on total built-in tool calls (cost control; OpenAI `max_tool_calls`). */
2777
+ maxToolCalls?: number;
2778
+ /** Reasoning configuration (mapped per provider: summaries, effort, thinking). */
2779
+ reasoning?: ReasoningConfig;
2780
+ /**
2781
+ * Continue from a previous **completed** research job (Gemini
2782
+ * `previous_interaction_id`). Rejected on models without follow-up support.
2783
+ */
2784
+ previousJobId?: string;
2785
+ /**
2786
+ * Overall time budget for the run as observed by this client. Expiry aborts
2787
+ * the transport (the server-side job keeps running and stays attachable) and
2788
+ * surfaces a `ResearchTimeoutError`. Defaults to
2789
+ * `min(RESEARCH_DEFAULT_TIMEOUT_MS, spec.maxDurationMs)`.
2790
+ */
2791
+ timeoutMs?: number;
2792
+ /**
2793
+ * Aborts the transport only — a background job keeps running server-side
2794
+ * and can be re-attached via its ref. Use {@link ResearchJob.cancel} to stop
2795
+ * the job on the server.
2796
+ */
2797
+ signal?: AbortSignal;
2798
+ /** Provider-specific passthrough (same spirit as `LLMGenerationOptions.extra`). */
2799
+ extra?: Record<string, unknown>;
2800
+ }
2801
+ /** A citation attached to the research report. */
2802
+ interface ResearchCitation {
2803
+ url: string;
2804
+ title?: string;
2805
+ /** Start offset of the cited span in the report text, when provided. */
2806
+ startIndex?: number;
2807
+ /** End offset of the cited span in the report text, when provided. */
2808
+ endIndex?: number;
2809
+ /** Excerpt of the cited source content, when provided (OpenRouter). */
2810
+ content?: string;
2811
+ }
2812
+ /** Token usage extended with research-specific dimensions. */
2813
+ interface ResearchUsage extends TokenUsage {
2814
+ /** Number of web searches performed, when the provider reports it. */
2815
+ searches?: number;
2816
+ /** Estimated cost in USD, computed from catalog pricing when available. */
2817
+ costUSD?: number;
2818
+ }
2819
+ /** Error payload carried by `error` events. */
2820
+ interface ResearchErrorInfo {
2821
+ message: string;
2822
+ code?: string;
2823
+ /** Whether retrying (or resuming) may succeed. */
2824
+ retryable: boolean;
2825
+ }
2826
+ /**
2827
+ * Normalized research event union.
2828
+ *
2829
+ * Every event may carry a `cursor` (provider stream position: OpenAI
2830
+ * `sequence_number`, Gemini `event_id`) used for lossless resume, and a
2831
+ * `rawEvent` escape hatch with the provider's original payload.
2832
+ */
2833
+ type ResearchEvent = {
2834
+ cursor?: string;
2835
+ rawEvent?: unknown;
2836
+ } & ({
2837
+ type: "created";
2838
+ /** Server-side job id; `null` on providers without job handles (OpenRouter). */
2839
+ jobId: string | null;
2840
+ } | {
2841
+ type: "status";
2842
+ status: ResearchStatus;
2843
+ } | {
2844
+ type: "phase";
2845
+ /** Coarse activity phase. Providers may emit additional phase strings. */
2846
+ phase: "planning" | "searching" | "reasoning" | "writing" | (string & {});
2847
+ } | {
2848
+ type: "thinking";
2849
+ delta: string;
2850
+ } | {
2851
+ type: "search";
2852
+ action: "search" | "open_page" | "find_in_page";
2853
+ status: "started" | "completed";
2854
+ query?: string;
2855
+ url?: string;
2856
+ } | {
2857
+ type: "tool";
2858
+ tool: "code_interpreter" | "file_search" | "mcp";
2859
+ status: "started" | "completed";
2860
+ detail?: string;
2861
+ } | {
2862
+ type: "text";
2863
+ delta: string;
2864
+ } | {
2865
+ type: "citation";
2866
+ citation: ResearchCitation;
2867
+ } | {
2868
+ type: "usage";
2869
+ usage: ResearchUsage;
2870
+ } | {
2871
+ type: "error";
2872
+ error: ResearchErrorInfo;
2873
+ } | {
2874
+ type: "done";
2875
+ result: ResearchDoneInfo;
2876
+ });
2877
+ /**
2878
+ * Terminal payload emitted by provider normalizers on `done`.
2879
+ *
2880
+ * Providers fill what they know; the job's collector merges it with
2881
+ * accumulated stream state (text deltas, citations, usage) into the final
2882
+ * {@link ResearchResult}. `report` may be empty when the report was fully
2883
+ * streamed as `text` deltas.
2884
+ */
2885
+ interface ResearchDoneInfo {
2886
+ status: ResearchStatus;
2887
+ /** Full report text when the provider returns it wholesale (else ""). */
2888
+ report: string;
2889
+ citations?: ResearchCitation[];
2890
+ usage?: ResearchUsage;
2891
+ /** Final provider object (response / interaction / last chunk). */
2892
+ raw?: unknown;
2893
+ }
2894
+ /** Final result of a research run. */
2895
+ interface ResearchResult {
2896
+ /** Server-side job id, or `null` on providers without job handles. */
2897
+ jobId: string | null;
2898
+ /** Adapter provider id that ran the job (e.g. "openai", "mock"). */
2899
+ provider: string;
2900
+ /** Model / agent id (unprefixed). */
2901
+ model: string;
2902
+ status: ResearchStatus;
2903
+ /** The research report text. */
2904
+ report: string;
2905
+ /** Deduplicated citations. */
2906
+ citations: ResearchCitation[];
2907
+ usage: ResearchUsage;
2908
+ /** Wall-clock duration observed by this client, when measurable. */
2909
+ durationMs?: number;
2910
+ /** Final provider payload, when available. */
2911
+ raw?: unknown;
2912
+ }
2913
+ /**
2914
+ * JSON-serializable reference to a background research job.
2915
+ *
2916
+ * Round-trip contract: `JSON.parse(JSON.stringify(ref))` is a valid ref, and
2917
+ * `client.research.attach(ref)` resumes the event stream from `cursor` —
2918
+ * across process restarts.
2919
+ */
2920
+ interface ResearchJobRef {
2921
+ /** Adapter provider id (e.g. "openai", "gemini", "mock"). */
2922
+ provider: string;
2923
+ /** Model / agent id (unprefixed). */
2924
+ model: string;
2925
+ /** Server-side job id. */
2926
+ jobId: string;
2927
+ /** Last observed stream cursor; resume yields events strictly after it. */
2928
+ cursor?: string;
2929
+ /** ISO timestamp of job creation, when known. */
2930
+ startedAt?: string;
2931
+ }
2932
+ /** Snapshot returned by status polls. */
2933
+ interface ResearchStatusSnapshot {
2934
+ status: ResearchStatus;
2935
+ /** Present when the job reached a terminal state and the result is available. */
2936
+ result?: ResearchResult;
2937
+ }
2938
+ /**
2939
+ * Handle to a research run.
2940
+ *
2941
+ * The job is itself async-iterable (equivalent to iterating
2942
+ * {@link ResearchJob.events}). The event stream may be consumed **once**.
2943
+ */
2944
+ interface ResearchJob extends AsyncIterable<ResearchEvent> {
2945
+ /** Server-side job id once known (`created` event), else `null`. */
2946
+ readonly jobId: string | null;
2947
+ /** Adapter provider id. */
2948
+ readonly provider: string;
2949
+ /** Model / agent id (unprefixed). */
2950
+ readonly model: string;
2951
+ /**
2952
+ * Live event stream. Auto-reconnects with the last cursor on transient
2953
+ * stream drops when the model is resumable. Single consumption only.
2954
+ */
2955
+ events(): AsyncIterable<ResearchEvent>;
2956
+ /**
2957
+ * Final result. Drains the event stream internally when not already
2958
+ * consumed; otherwise resolves when iteration completes.
2959
+ */
2960
+ result(): Promise<ResearchResult>;
2961
+ /**
2962
+ * One-shot server-side status poll.
2963
+ * @throws ResearchNotPollableError on providers without status polling.
2964
+ */
2965
+ status(): Promise<ResearchStatus>;
2966
+ /**
2967
+ * Cancel the job server-side where supported; otherwise aborts the
2968
+ * transport. See {@link ResearchOptions.signal} for the abort-vs-cancel
2969
+ * distinction.
2970
+ */
2971
+ cancel(): Promise<void>;
2972
+ /**
2973
+ * Serializable reference for later {@link ResearchNamespaceLike.attach}.
2974
+ * @throws ResearchJobNotResumableError when the job has no server-side id.
2975
+ */
2976
+ toRef(): ResearchJobRef;
2977
+ }
2978
+
2979
+ /**
2980
+ * Research model catalog types.
2981
+ *
2982
+ * Research-capable models get their own catalog (mirroring the image/speech
2983
+ * media catalogs) instead of overloading `ModelSpec`: Gemini research "agents"
2984
+ * have no chat/context-window semantics, and research pricing has dimensions
2985
+ * (`perThousandSearches`, `internalReasoning`) that `ModelPricing` lacks.
2986
+ *
2987
+ * Research capability is **catalog-driven** — nothing outside a catalog file
2988
+ * should test model-id strings.
2989
+ */
2990
+
2991
+ /**
2992
+ * Research pricing. Token rates are USD per 1M tokens.
2993
+ */
2994
+ interface ResearchPricing {
2995
+ /** USD per 1M input tokens. */
2996
+ input: number;
2997
+ /** USD per 1M output tokens. */
2998
+ output: number;
2999
+ /** USD per 1M cached input tokens (defaults to `input` when omitted). */
3000
+ cachedInput?: number;
3001
+ /**
3002
+ * USD per 1M internal reasoning tokens, when the provider prices them
3003
+ * separately from output (Perplexity sonar-deep-research: 3.0). When set,
3004
+ * reasoning tokens are billed at this rate and excluded from `output`.
3005
+ */
3006
+ internalReasoning?: number;
3007
+ /**
3008
+ * USD per 1,000 web searches (OpenAI web search: 10, Perplexity
3009
+ * sonar-deep-research: 5, sonar-pro-search: 18, Gemini: 14 post-free-tier).
3010
+ */
3011
+ perThousandSearches?: number;
3012
+ }
3013
+ /** Capability flags for a research model/agent. */
3014
+ interface ResearchCapabilities {
3015
+ /** Whether live event streaming is supported (gpt-5.5-pro: false → create+poll). */
3016
+ streaming: boolean;
3017
+ /** Whether server-side background jobs are supported. */
3018
+ background: boolean;
3019
+ /** Whether a dropped stream can resume from a cursor. */
3020
+ resumable: boolean;
3021
+ /** Whether follow-up runs can reference a previous job (Gemini). */
3022
+ followUps?: boolean;
3023
+ /** Tool types accepted by this model (empty = tools are provider-managed). */
3024
+ tools: ResearchToolType[];
3025
+ }
3026
+ /** Lifecycle metadata for a research model/agent. */
3027
+ interface ResearchModelMetadata {
3028
+ releaseDate?: string;
3029
+ /** Date the provider announced deprecation. */
3030
+ deprecationDate?: string;
3031
+ /**
3032
+ * Date the provider removes the model (ISO date). Starting a run past this
3033
+ * date throws `ResearchDeprecatedModelError`; within the warning window a
3034
+ * warning is logged.
3035
+ */
3036
+ shutdownDate?: string;
3037
+ /** Recommended replacement model id, surfaced in deprecation errors. */
3038
+ replacement?: string;
3039
+ notes?: string;
3040
+ }
3041
+ /**
3042
+ * A research-capable model, agent, or preset.
3043
+ */
3044
+ interface ResearchModelSpec {
3045
+ /** Provider adapter id (e.g. "openai", "gemini", "openrouter"). */
3046
+ provider: string;
3047
+ /** Model id, agent id, or preset id (unprefixed). */
3048
+ modelId: string;
3049
+ /**
3050
+ * - `"model"` — a regular model doing research via tools (OpenAI, OpenRouter)
3051
+ * - `"agent"` — a provider-managed research agent (Gemini Interactions)
3052
+ * - `"preset"` — an llmist-orchestrated research preset (reserved; future Anthropic track)
3053
+ */
3054
+ kind: "model" | "agent" | "preset";
3055
+ displayName: string;
3056
+ /** Context window in tokens (undefined for agents/presets). */
3057
+ contextWindow?: number;
3058
+ /** Max output tokens (undefined for agents/presets). */
3059
+ maxOutputTokens?: number;
3060
+ pricing: ResearchPricing;
3061
+ capabilities: ResearchCapabilities;
3062
+ /**
3063
+ * Tools injected when the caller supplies none (e.g. OpenAI research
3064
+ * requires at least one data source → `[{type: "web_search"}]`).
3065
+ */
3066
+ requiredTools?: ResearchToolConfig[];
3067
+ /** Provider-enforced maximum run duration (Gemini: 60 minutes). */
3068
+ maxDurationMs?: number;
3069
+ metadata?: ResearchModelMetadata;
3070
+ }
3071
+
2670
3072
  interface ProviderAdapter {
2671
3073
  readonly providerId: string;
2672
3074
  /**
@@ -2731,6 +3133,43 @@ interface ProviderAdapter {
2731
3133
  * @returns Promise resolving to the generation result with audio and cost
2732
3134
  */
2733
3135
  generateSpeech?(options: SpeechGenerationOptions): Promise<SpeechGenerationResult>;
3136
+ /**
3137
+ * Get research model/agent specifications for this provider.
3138
+ * Returns undefined if the provider doesn't support research.
3139
+ */
3140
+ getResearchModelSpecs?(): ResearchModelSpec[];
3141
+ /**
3142
+ * Check if this provider supports deep research for a given model/agent id.
3143
+ * @param modelId - Model or agent identifier (unprefixed)
3144
+ */
3145
+ supportsResearch?(modelId: string): boolean;
3146
+ /**
3147
+ * Start a research run as a normalized event stream.
3148
+ *
3149
+ * Contract:
3150
+ * - The first emitted event MUST be `created` (with the server-side job id,
3151
+ * or `null` on providers without job handles).
3152
+ * - Providers without live streaming implement create + poll internally,
3153
+ * emitting `status` heartbeats and a final `text` + `done`.
3154
+ * - Events SHOULD carry a `cursor` when the provider supports resume.
3155
+ *
3156
+ * @param options - Research options (validated by the namespace before this call)
3157
+ * @param descriptor - Parsed model descriptor
3158
+ * @param spec - Catalog spec when the model is cataloged
3159
+ */
3160
+ startResearch?(options: ResearchOptions, descriptor: ModelDescriptor, spec?: ResearchModelSpec): AsyncIterable<ResearchEvent>;
3161
+ /**
3162
+ * Re-attach to a background research job, yielding events strictly after
3163
+ * `ref.cursor` (or all events when no cursor is set).
3164
+ */
3165
+ resumeResearch?(ref: ResearchJobRef, signal?: AbortSignal): AsyncIterable<ResearchEvent>;
3166
+ /**
3167
+ * One-shot status poll for a background research job. Returns the terminal
3168
+ * result when the job has completed.
3169
+ */
3170
+ getResearchStatus?(ref: ResearchJobRef): Promise<ResearchStatusSnapshot>;
3171
+ /** Cancel a background research job server-side. */
3172
+ cancelResearch?(ref: ResearchJobRef): Promise<void>;
2734
3173
  }
2735
3174
 
2736
3175
  /**
@@ -3976,6 +4415,39 @@ interface GadgetSkippedEvent {
3976
4415
  /** The error message from the failed dependency */
3977
4416
  failedDependencyError: string;
3978
4417
  }
4418
+ /**
4419
+ * Emitted repeatedly while a gadget call is still streaming, surfacing the
4420
+ * GROWING RAW value of one argument field BEFORE the gadget block terminates.
4421
+ *
4422
+ * Use this for progressive UIs (e.g. a form field that fills in live as the
4423
+ * agent streams a long text value).
4424
+ *
4425
+ * Important semantics:
4426
+ * - Values are RAW and UNCOERCED. The authoritative, validated/coerced
4427
+ * parameters arrive later on the single `gadget_call` event.
4428
+ * - `invocationId` is identical across every partial for a gadget AND its
4429
+ * final `gadget_call`, so consumers can correlate them.
4430
+ * - All partials for an invocation are emitted BEFORE that invocation's
4431
+ * `gadget_call`.
4432
+ * - Prefer `value` (replace) over `delta` (append) for correctness; `delta`
4433
+ * is a convenience that can occasionally differ by a trailing newline.
4434
+ * - A partial does NOT guarantee the gadget will execute (it may still be
4435
+ * skipped by `maxGadgetsPerResponse` or fail validation).
4436
+ */
4437
+ interface GadgetArgsPartialEvent {
4438
+ type: "gadget_args_partial";
4439
+ /** Stable invocation id (same on all partials + the final `gadget_call`). */
4440
+ invocationId: string;
4441
+ gadgetName: string;
4442
+ /** JSON-pointer-ish path of the field, e.g. "title", "config/timeout", "items/0". */
4443
+ fieldPath: string;
4444
+ /** Full accumulated RAW value for this field so far (one trailing newline stripped). */
4445
+ value: string;
4446
+ /** Text appended since the previous partial for this field ("" if only completion flipped). */
4447
+ delta: string;
4448
+ /** True once a later `!!!ARG:` or the terminator proves this field's value is final. */
4449
+ isFieldComplete: boolean;
4450
+ }
3979
4451
  /**
3980
4452
  * Event emitted when stream processing completes, containing metadata.
3981
4453
  * This allows the async generator to "return" metadata while still yielding events.
@@ -4007,7 +4479,7 @@ type StreamEvent = {
4007
4479
  } | {
4008
4480
  type: "gadget_call";
4009
4481
  call: ParsedGadgetCall;
4010
- } | {
4482
+ } | GadgetArgsPartialEvent | {
4011
4483
  type: "gadget_result";
4012
4484
  result: GadgetExecutionResult;
4013
4485
  } | GadgetSkippedEvent | {
@@ -5155,6 +5627,19 @@ interface EventHandlers {
5155
5627
  parametersRaw: string;
5156
5628
  dependencies: string[];
5157
5629
  }) => void | Promise<void>;
5630
+ /**
5631
+ * Called for each progressive argument partial while a gadget call is still
5632
+ * streaming (before `onGadgetCall`). Values are RAW/uncoerced; prefer `value`
5633
+ * (replace) over `delta` (append). Great for live form-fill UIs.
5634
+ */
5635
+ onGadgetArgsPartial?: (partial: {
5636
+ gadgetName: string;
5637
+ invocationId: string;
5638
+ fieldPath: string;
5639
+ value: string;
5640
+ delta: string;
5641
+ isFieldComplete: boolean;
5642
+ }) => void | Promise<void>;
5158
5643
  /** Called when a gadget execution completes */
5159
5644
  onGadgetResult?: (result: {
5160
5645
  gadgetName: string;
@@ -5400,6 +5885,52 @@ declare class AgentBuilder {
5400
5885
  build(): Agent;
5401
5886
  }
5402
5887
 
5888
+ /**
5889
+ * Research namespace — `client.research`.
5890
+ *
5891
+ * Mirrors the image/speech capability namespaces: dispatches to the first
5892
+ * adapter (in priority order) that supports the model, after validating the
5893
+ * request against the model's catalog spec. Providers plug in via the
5894
+ * optional research methods on {@link ProviderAdapter}.
5895
+ */
5896
+
5897
+ declare class ResearchNamespace {
5898
+ private readonly adapters;
5899
+ private readonly parser;
5900
+ private readonly now;
5901
+ private readonly logger;
5902
+ constructor(adapters: ProviderAdapter[], parser: ModelIdentifierParser, now?: () => number, logger?: Logger<ILogObj>);
5903
+ /**
5904
+ * Start a research run. Returns immediately; the provider stream opens
5905
+ * lazily on first iteration (or on `result()`).
5906
+ */
5907
+ start(options: ResearchOptions): ResearchJob;
5908
+ /**
5909
+ * Re-attach to a background research job from a serialized ref.
5910
+ * No network happens until the returned job is iterated.
5911
+ */
5912
+ attach(ref: ResearchJobRef): ResearchJob;
5913
+ /** One-shot status poll for a job ref. */
5914
+ get(ref: ResearchJobRef): Promise<ResearchStatusSnapshot>;
5915
+ /** Cancel a background job server-side. */
5916
+ cancel(ref: ResearchJobRef): Promise<void>;
5917
+ /** All research-capable models/agents across registered providers. */
5918
+ listModels(): ResearchModelSpec[];
5919
+ /** Whether any registered provider supports research for this model. */
5920
+ supportsModel(model: string): boolean;
5921
+ private findResearchAdapter;
5922
+ private findAdapterByProviderId;
5923
+ private findSpec;
5924
+ private describeAvailableModels;
5925
+ /**
5926
+ * Pre-flight validation against the catalog spec — fails fast before any
5927
+ * network call and applies spec-driven defaults.
5928
+ */
5929
+ private validate;
5930
+ private resolveTools;
5931
+ private enforceLifecycle;
5932
+ }
5933
+
5403
5934
  /**
5404
5935
  * Image Generation Namespace
5405
5936
  *
@@ -5691,6 +6222,12 @@ declare class LLMist {
5691
6222
  readonly image: ImageNamespace;
5692
6223
  readonly speech: SpeechNamespace;
5693
6224
  readonly vision: VisionNamespace;
6225
+ /**
6226
+ * Deep research — long-running, server-side research jobs with cited
6227
+ * reports (OpenAI Responses, Gemini Interactions, OpenRouter research
6228
+ * models). See docs/specs/002-deep-research.md.
6229
+ */
6230
+ readonly research: ResearchNamespace;
5694
6231
  constructor();
5695
6232
  constructor(adapters: ProviderAdapter[]);
5696
6233
  constructor(adapters: ProviderAdapter[], defaultProvider: string);
@@ -8031,6 +8568,10 @@ declare class StreamProcessor {
8031
8568
  private readonly logger;
8032
8569
  private readonly parser;
8033
8570
  private readonly tree?;
8571
+ /** LLM-call node these gadgets hang off; used to derive subagentContext for partials. */
8572
+ private readonly parentNodeId?;
8573
+ /** Parent agent observers (subagent visibility) — also notified for arg partials. */
8574
+ private readonly parentObservers?;
8034
8575
  private responseText;
8035
8576
  private readonly dependencyResolver;
8036
8577
  /** Queue of completed gadget results ready to be yielded (for real-time streaming) */
@@ -8830,9 +9371,13 @@ interface StreamParserOptions {
8830
9371
  declare class GadgetCallParser {
8831
9372
  private buffer;
8832
9373
  private lastEmittedTextOffset;
9374
+ /** Non-null only while a single trailing gadget block is mid-stream. */
9375
+ private currentPartial;
8833
9376
  private readonly startPrefix;
8834
9377
  private readonly endPrefix;
8835
9378
  private readonly argPrefix;
9379
+ /** Length of the longest marker; `maxMarkerLength - 1` is the scan-resume overlap. */
9380
+ private readonly maxMarkerLength;
8836
9381
  constructor(options?: StreamParserOptions);
8837
9382
  /**
8838
9383
  * Extract and consume text up to the given index.
@@ -8862,6 +9407,43 @@ declare class GadgetCallParser {
8862
9407
  */
8863
9408
  private parseParameters;
8864
9409
  feed(chunk: string): Generator<StreamEvent>;
9410
+ /** Create fresh partial-tracking state for a newly-started streaming gadget. */
9411
+ private newPartialState;
9412
+ /**
9413
+ * Emit per-field "growing value" partials for an in-progress (or, when
9414
+ * `allComplete`, a just-completed) gadget body delimited by [bodyStart, bodyEnd).
9415
+ *
9416
+ * Incremental by design: each call resumes the `!!!ARG:` scan near where the last
9417
+ * one stopped (backing off by one marker's worth so a marker split across a chunk
9418
+ * boundary is still found) and only re-touches the in-progress field, so a long
9419
+ * streamed body costs O(new bytes) per feed instead of O(body). Every field except
9420
+ * the in-progress (last) one is complete — a following `!!!ARG:` terminated it; the
9421
+ * last field is tentative unless `allComplete`. The tentative field holds back any
9422
+ * suffix that is a partial prefix of a gadget marker so it never leaks into a value.
9423
+ *
9424
+ * We deliberately do NOT run stripMarkdownFences here: an unbalanced opening fence
9425
+ * sits before the first `!!!ARG:` (never emitted) and the authoritative gadget_call
9426
+ * still strips fences from the full raw parameters.
9427
+ */
9428
+ private emitArgPartials;
9429
+ /**
9430
+ * Emit a single field whose `!!!ARG:` marker starts at `markerAbs` and whose value
9431
+ * runs to `valueEndAbs` (the next marker, or the body end). Mirrors the per-field
9432
+ * semantics of the old split-based emitter: field-path line, hold-back for a
9433
+ * tentative value, single trailing-newline strip.
9434
+ */
9435
+ private emitFieldRange;
9436
+ /**
9437
+ * Emit a single partial for a field, but only when its value grew or it newly
9438
+ * completed — keeping event volume proportional to field growth, not characters.
9439
+ */
9440
+ private emitFieldDelta;
9441
+ /**
9442
+ * Length of the longest suffix of `value` that is a proper prefix of any gadget
9443
+ * marker (start/end/arg). Used to hold back the beginning of an incoming marker
9444
+ * so it never appears inside a streamed value.
9445
+ */
9446
+ private trailingPartialMarkerLength;
8865
9447
  finalize(): Generator<StreamEvent>;
8866
9448
  reset(): void;
8867
9449
  }
@@ -9159,6 +9741,118 @@ declare function mcpToolToGadget(tool: McpToolDescriptor, client: McpClient, opt
9159
9741
  */
9160
9742
  declare const FALLBACK_CHARS_PER_TOKEN = 2;
9161
9743
 
9744
+ /**
9745
+ * Aggregates a research event stream into a final {@link ResearchResult}.
9746
+ *
9747
+ * Provider normalizers emit what they know; the collector merges streamed
9748
+ * state (text deltas, citations, usage) with the terminal `done` payload:
9749
+ * - report: `done.report` wins when non-empty, else accumulated text deltas
9750
+ * - citations: union of streamed + done citations, deduplicated
9751
+ * - usage: last-write-wins for token fields, max for cumulative counters
9752
+ * - costUSD: computed from catalog pricing when a spec is provided
9753
+ */
9754
+
9755
+ interface ResearchResultContext {
9756
+ provider: string;
9757
+ model: string;
9758
+ jobId: string | null;
9759
+ }
9760
+ declare class ResearchResultCollector {
9761
+ private readonly spec?;
9762
+ private readonly now;
9763
+ private reportParts;
9764
+ private citations;
9765
+ private usage;
9766
+ private lastStatus;
9767
+ private doneReport;
9768
+ private doneRaw;
9769
+ private hasDone;
9770
+ private firstEventAt;
9771
+ private terminalAt;
9772
+ /**
9773
+ * Terminal error info from an `error` event.
9774
+ * @internal Read by tests only — not part of the public consumer contract.
9775
+ */
9776
+ terminalError: ResearchErrorInfo | undefined;
9777
+ constructor(spec?: ResearchModelSpec | undefined, now?: () => number);
9778
+ ingest(event: ResearchEvent): void;
9779
+ toResult(context: ResearchResultContext): ResearchResult;
9780
+ /** Whether a terminal event (`done` or `error`) was ingested. */
9781
+ get isTerminal(): boolean;
9782
+ private addCitation;
9783
+ private mergeUsage;
9784
+ }
9785
+
9786
+ /**
9787
+ * Research cost estimation.
9788
+ *
9789
+ * Separate from `ModelRegistry.estimateCost` because research pricing has
9790
+ * dimensions the chat cost model lacks: per-search fees and separately-priced
9791
+ * internal reasoning tokens (see {@link ResearchPricing}).
9792
+ */
9793
+
9794
+ /**
9795
+ * Estimate the USD cost of a research run.
9796
+ *
9797
+ * Semantics:
9798
+ * - `cachedInputTokens` are a subset of `inputTokens` and billed at
9799
+ * `cachedInput` (falling back to `input` when unset).
9800
+ * - `reasoningTokens` are a subset of `outputTokens`. When
9801
+ * `internalReasoning` is priced, reasoning tokens are billed at that rate
9802
+ * and excluded from the output rate; otherwise they remain part of output.
9803
+ * - `searches` are billed at `perThousandSearches / 1000` each.
9804
+ */
9805
+ declare function estimateResearchCost(pricing: ResearchPricing, usage: ResearchUsage): number;
9806
+
9807
+ /**
9808
+ * Typed errors for the research surface.
9809
+ *
9810
+ * Follows the core error convention (plain `Error` subclasses with `name`
9811
+ * set) — see `core/errors.ts`.
9812
+ */
9813
+ /** Thrown when no registered provider supports research for the given model. */
9814
+ declare class ResearchNotSupportedError extends Error {
9815
+ constructor(message: string);
9816
+ }
9817
+ /**
9818
+ * Thrown when a job cannot produce a serializable ref (no server-side job id —
9819
+ * e.g. OpenRouter research runs) or a ref cannot be resumed on its provider.
9820
+ */
9821
+ declare class ResearchJobNotResumableError extends Error {
9822
+ constructor(message: string);
9823
+ }
9824
+ /** Thrown when status polling is requested on a provider without it. */
9825
+ declare class ResearchNotPollableError extends Error {
9826
+ constructor(message: string);
9827
+ }
9828
+ /**
9829
+ * Thrown when the client-side time budget expires. The transport is aborted;
9830
+ * a background job keeps running server-side and its ref stays valid.
9831
+ */
9832
+ declare class ResearchTimeoutError extends Error {
9833
+ readonly timeoutMs: number;
9834
+ constructor(timeoutMs: number);
9835
+ }
9836
+ /** Thrown when starting a run on a model past its announced shutdown date. */
9837
+ declare class ResearchDeprecatedModelError extends Error {
9838
+ readonly modelId: string;
9839
+ readonly shutdownDate: string;
9840
+ readonly replacement?: string;
9841
+ constructor(params: {
9842
+ modelId: string;
9843
+ shutdownDate: string;
9844
+ replacement?: string;
9845
+ });
9846
+ }
9847
+ /** Thrown when options fail pre-flight validation against the model's spec. */
9848
+ declare class ResearchValidationError extends Error {
9849
+ constructor(message: string);
9850
+ }
9851
+ /** Thrown when a job's event stream is consumed more than once. */
9852
+ declare class ResearchStreamConsumedError extends Error {
9853
+ constructor();
9854
+ }
9855
+
9162
9856
  /**
9163
9857
  * Subagent creation helper for gadget authors.
9164
9858
  *
@@ -9890,6 +10584,12 @@ declare class GeminiGenerativeProvider extends BaseProviderAdapter {
9890
10584
  getSpeechModelSpecs(): SpeechModelSpec[];
9891
10585
  supportsSpeechGeneration(modelId: string): boolean;
9892
10586
  generateSpeech(options: SpeechGenerationOptions): Promise<SpeechGenerationResult>;
10587
+ getResearchModelSpecs(): ResearchModelSpec[];
10588
+ supportsResearch(agentId: string): boolean;
10589
+ startResearch(options: ResearchOptions, descriptor: ModelDescriptor, spec?: ResearchModelSpec): AsyncIterable<ResearchEvent>;
10590
+ resumeResearch(ref: ResearchJobRef, signal?: AbortSignal): AsyncIterable<ResearchEvent>;
10591
+ getResearchStatus(ref: ResearchJobRef): Promise<ResearchStatusSnapshot>;
10592
+ cancelResearch(ref: ResearchJobRef): Promise<void>;
9893
10593
  protected buildApiRequest(options: LLMGenerationOptions, descriptor: ModelDescriptor, _spec: ModelSpec | undefined, messages: LLMMessage[]): {
9894
10594
  model: string;
9895
10595
  contents: GeminiContent[];
@@ -10171,6 +10871,12 @@ declare class OpenAIChatProvider extends BaseProviderAdapter {
10171
10871
  getSpeechModelSpecs(): SpeechModelSpec[];
10172
10872
  supportsSpeechGeneration(modelId: string): boolean;
10173
10873
  generateSpeech(options: SpeechGenerationOptions): Promise<SpeechGenerationResult>;
10874
+ getResearchModelSpecs(): ResearchModelSpec[];
10875
+ supportsResearch(modelId: string): boolean;
10876
+ startResearch(options: ResearchOptions, descriptor: ModelDescriptor, spec?: ResearchModelSpec): AsyncIterable<ResearchEvent>;
10877
+ resumeResearch(ref: ResearchJobRef, signal?: AbortSignal): AsyncIterable<ResearchEvent>;
10878
+ getResearchStatus(ref: ResearchJobRef): Promise<ResearchStatusSnapshot>;
10879
+ cancelResearch(ref: ResearchJobRef): Promise<void>;
10174
10880
  protected buildApiRequest(options: LLMGenerationOptions, descriptor: ModelDescriptor, spec: ModelSpec | undefined, messages: LLMMessage[]): Parameters<OpenAI["chat"]["completions"]["create"]>[0];
10175
10881
  /**
10176
10882
  * Convert an LLMMessage to OpenAI's ChatCompletionMessageParam.
@@ -10294,6 +11000,9 @@ declare class OpenRouterProvider extends OpenAICompatibleProvider<OpenRouterConf
10294
11000
  protected readonly providerAlias = "or";
10295
11001
  constructor(client: OpenAI, config?: OpenRouterConfig);
10296
11002
  getModelSpecs(): ModelSpec[];
11003
+ getResearchModelSpecs(): ResearchModelSpec[];
11004
+ supportsResearch(modelId: string): boolean;
11005
+ startResearch(options: ResearchOptions, descriptor: ModelDescriptor, _spec?: ResearchModelSpec): AsyncIterable<ResearchEvent>;
10297
11006
  /**
10298
11007
  * Override buildApiRequest to inject reasoning parameters and cache_control breakpoints.
10299
11008
  * OpenRouter normalizes reasoning into the standard OpenAI format,
@@ -11147,4 +11856,4 @@ declare const timing: {
11147
11856
  */
11148
11857
  declare function getHostExports(ctx: ExecutionContext): HostExports;
11149
11858
 
11150
- export { AbortException, AbstractGadget, type AddGadgetParams, type AddLLMCallParams, type AfterGadgetExecutionAction, type AfterGadgetExecutionControllerContext, type AfterLLMCallAction, type AfterLLMCallControllerContext, type AfterLLMErrorAction, Agent, AgentBuilder, type AgentHooks, type AgentOptions, AnthropicMessagesProvider, type AudioContentPart, type AudioMimeType, type AudioSource, type BaseExecutionEvent, BaseSessionManager, type BeforeGadgetExecutionAction, type BeforeLLMCallAction, type BeforeSkillActivationAction, BudgetPricingUnavailableError, type CachingConfig, type CachingScope, type ChunkInterceptorContext, type CompactionConfig, type CompactionContext, type CompactionEvent, CompactionManager, type CompactionResult, type CompactionStats, type CompactionStrategy, type CompleteGadgetParams, type CompleteLLMCallParams, type ContentPart, type Controllers, ConversationManager, type CostEstimate, type CostReportingLLMist, type CreateGadgetConfig, type CreateMcpServerOptions, DEFAULT_COMPACTION_CONFIG, DEFAULT_HINTS, DEFAULT_MCP_COMMAND_ALLOWLIST, DEFAULT_PROMPTS, DEFAULT_RATE_LIMIT_CONFIG, DEFAULT_RETRY_CONFIG, DEFAULT_SUMMARIZATION_PROMPT, EmptyCompletionError, type EventHandlers, type ExecutionContext, type ExecutionEvent, type ExecutionEventType, type ExecutionNode, type ExecutionNodeType, ExecutionTree, FALLBACK_CHARS_PER_TOKEN, type FileLoggingOptions, type FileLoggingState, type FileWrittenInfo, type FormatLLMErrorContext, GADGET_ARG_PREFIX, GADGET_END_PREFIX, GADGET_START_PREFIX, Gadget, type GadgetCallEvent, GadgetCallParser, type GadgetClass, type GadgetCompleteEvent, type GadgetConfig, type GadgetErrorEvent, type GadgetEvent, type GadgetExample, type GadgetExecuteResult, type GadgetExecuteResultWithMedia, type GadgetExecuteReturn, type GadgetExecutionControllerContext, type GadgetExecutionMode, type GadgetExecutionResult, GadgetExecutor, type GadgetExecutorOptions, type GadgetFactoryExports, type GadgetMediaOutput, type GadgetNode, type GadgetOrClass, GadgetOutputStore, type GadgetParameterInterceptorContext, GadgetRegistry, type GadgetResultInterceptorContext, type GadgetSkippedEvent, type GadgetStartEvent, type GadgetState, GeminiGenerativeProvider, type HintContext, type HintTemplate, type HintsConfig, type HistoryMessage, HookPresets, type HostExports, type HttpMcpServerSpec, HuggingFaceProvider, type HumanInputRequiredEvent, HumanInputRequiredException, HybridStrategy, type IConversationManager, type ISessionManager, type ImageBase64Source, type ImageContentPart, type ImageGenerationOptions, type ImageGenerationResult, type ImageMimeType, type ImageModelSpec, type ImageSource, type ImageUrlSource, type Interceptors, type IterationHintOptions, type JSONSchemaLike, JsonSchemaConversionError, type LLMCallCompleteEvent, type LLMCallControllerContext, type LLMCallErrorEvent, type LLMCallNode, type LLMCallStartEvent, type LLMCallStreamEvent, type LLMErrorControllerContext, type LLMEvent, type LLMGenerationOptions, type LLMMessage, LLMMessageBuilder, type LLMResponseEndEvent, type LLMStream, type LLMStreamChunk, LLMist, type LLMistOptions, type LLMistPackageManifest, LOAD_SKILL_GADGET_NAME, type LoggerOptions, type LoggingOptions, MODEL_ALIASES, McpClient, type McpClientOptions, McpConnectError, type McpContentBlock, McpError, McpLifecycle, type McpServerCapabilities, type McpServerHandle, type McpServerSpec, type McpToolAdapterOptions, McpToolCallError, type McpToolDescriptor, type McpToolResult, McpUntrustedCommandError, type MediaKind, type MediaMetadata, MediaStore, type MessageContent, type MessageInterceptorContext, type MessageRole, type MessageTurn, type ModelDescriptor, type ModelFeatures, ModelIdentifierParser, type ModelLimits, type ModelPricing, ModelRegistry, type ModelSpec, type NodeId, type ObserveChunkContext, type ObserveCompactionContext, type ObserveGadgetCompleteContext, type ObserveGadgetStartContext, type ObserveLLMCallContext, type ObserveLLMCompleteContext, type ObserveLLMErrorContext, type ObserveRateLimitThrottleContext, type ObserveRetryAttemptContext, type ObserveSkillActivatedContext, type Observers, OpenAIChatProvider, type OpenAICompatibleConfig, OpenAICompatibleProvider, type OpenRouterConfig, OpenRouterProvider, type OpenRouterRouting, type OutputLimitConfig, type ParallelGadgetHintOptions, type ParsedGadgetCall, type ParsedSkill, type PrefixConfig, type PresetDefinition, type PromptContext, type PromptTemplate, type PromptTemplateConfig, type ProviderAdapter, type ProviderIdentifier, type RateLimitConfig, type RateLimitStats, RateLimitTracker, type ReasoningConfig, type ReasoningEffort, type ResolveValueOptions, type ResolvedCompactionConfig, type ResolvedRateLimitConfig, type ResolvedRetryConfig, type RetryConfig, type RetryOptions, type SessionManifestEntry, SimpleSessionManager, Skill, type SkillActivation, type SkillActivationControllerContext, type SkillActivationOptions, type SkillInstructionInterceptorContext, type SkillMetadata, SkillRegistry, type SkillResource, type SkillSource, SlidingWindowStrategy, type SpeechGenerationOptions, type SpeechGenerationResult, type SpeechModelSpec, type StdioMcpServerSpec, type StoredMedia, type StoredOutput, type StreamCompleteEvent, type StreamEvent, type StreamProcessingResult, StreamProcessor, type StreamProcessorOptions, type SubagentConfig, type SubagentConfigMap, type SubagentContext, type SubagentManifestEntry, type SubagentOptions, SummarizationStrategy, TaskCompletionSignal, type TextContentPart, type TextEvent, type TextGenerationOptions, type TextOnlyAction, type TextOnlyContext, type TextOnlyCustomHandler, type TextOnlyGadgetConfig, type TextOnlyHandler, type TextOnlyStrategy, type ThinkingChunk, type ThinkingEvent, TimeoutException, type TokenUsage, type TrailingMessage, type TrailingMessageContext, type CompactionEvent$1 as TreeCompactionEvent, type TreeConfig, type GadgetSkippedEvent$1 as TreeGadgetSkippedEvent, type TriggeredLimitInfo, type ValidationIssue, type ValidationResult, type VisionAnalyzeOptions, type VisionAnalyzeResult, assertCommandAllowed, audioFromBase64, audioFromBuffer, collectEvents, collectText, complete, createAnthropicProviderFromEnv, createFileLoggingState, createGadget, createGadgetOutputViewer, createGeminiProviderFromEnv, createHints, createHuggingFaceProviderFromEnv, createLoadSkillGadget, createLogger, createMcpServer, createMediaOutput, createOpenAIProviderFromEnv, createOpenRouterProviderFromEnv, createSubagent, defaultLogger, detectAudioMimeType, detectImageMimeType, discoverProviderAdapters, discoverSkills, extractMessageText, extractRetryAfterMs, filterByDepth, filterByParent, filterRootEvents, format, formatBytes, formatCallNumber, formatDate, formatDuration, formatLLMError, formatLlmRequest, gadgetError, gadgetResultToMcpContent, gadgetSuccess, gadgetToMcpTool, getErrorMessage, getHostExports, getModelId, getPresetGadgets, getProvider, getSubagent, groupByParent, hasHostExports, hasPreset, hasProviderPrefix, hasSubagents, humanDelay, imageFromBase64, imageFromBuffer, imageFromUrl, isAbortError, isAudioPart, isDataUrl, isGadgetEvent, isImagePart, isLLMEvent, isLikelyContextOverflow, isRetryableError, isRootEvent, isSubagentEvent, isTextPart, iterationProgressHint, jsonSchemaToZod, listPresets, listSubagents, loadSkillsFromDirectory, mcpToolToGadget, normalizeMessageContent, parallelGadgetHint, parseDataUrl, parseFrontmatter, parseManifest, parseMetadata, parseRetryAfterHeader, parseSkillContent, parseSkillFile, randomDelay, renderSkillForMcpPrompt, resetFileLoggingState, resolveConfig, resolveHintTemplate, resolveInstructions, resolveModel, resolvePromptTemplate, resolveRateLimitConfig, resolveRetryConfig, resolveRulesTemplate, resolveSubagentModel, resolveSubagentTimeout, resolveValue, resultWithAudio, resultWithFile, resultWithImage, resultWithImages, resultWithMedia, runGadgetForMcp, runWithHandlers, scanResources, schemaToJSONSchema, skillToMcpPrompt, stream, stripProviderPrefix, substituteArguments, substituteVariables, text, timing, toBase64, truncate, validateAndApplyDefaults, validateGadgetParams, validateGadgetSchema, validateMetadata, withErrorHandling, withRetry, withTimeout };
11859
+ export { AbortException, AbstractGadget, type AddGadgetParams, type AddLLMCallParams, type AfterGadgetExecutionAction, type AfterGadgetExecutionControllerContext, type AfterLLMCallAction, type AfterLLMCallControllerContext, type AfterLLMErrorAction, Agent, AgentBuilder, type AgentHooks, type AgentOptions, AnthropicMessagesProvider, type AudioContentPart, type AudioMimeType, type AudioSource, type BaseExecutionEvent, BaseSessionManager, type BeforeGadgetExecutionAction, type BeforeLLMCallAction, type BeforeSkillActivationAction, BudgetPricingUnavailableError, type CachingConfig, type CachingScope, type ChunkInterceptorContext, type CompactionConfig, type CompactionContext, type CompactionEvent, CompactionManager, type CompactionResult, type CompactionStats, type CompactionStrategy, type CompleteGadgetParams, type CompleteLLMCallParams, type ContentPart, type Controllers, ConversationManager, type CostEstimate, type CostReportingLLMist, type CreateGadgetConfig, type CreateMcpServerOptions, DEFAULT_COMPACTION_CONFIG, DEFAULT_HINTS, DEFAULT_MCP_COMMAND_ALLOWLIST, DEFAULT_PROMPTS, DEFAULT_RATE_LIMIT_CONFIG, DEFAULT_RETRY_CONFIG, DEFAULT_SUMMARIZATION_PROMPT, EmptyCompletionError, type EventHandlers, type ExecutionContext, type ExecutionEvent, type ExecutionEventType, type ExecutionNode, type ExecutionNodeType, ExecutionTree, FALLBACK_CHARS_PER_TOKEN, type FileLoggingOptions, type FileLoggingState, type FileWrittenInfo, type FormatLLMErrorContext, GADGET_ARG_PREFIX, GADGET_END_PREFIX, GADGET_START_PREFIX, Gadget, type GadgetArgsPartialEvent, type GadgetCallEvent, GadgetCallParser, type GadgetClass, type GadgetCompleteEvent, type GadgetConfig, type GadgetErrorEvent, type GadgetEvent, type GadgetExample, type GadgetExecuteResult, type GadgetExecuteResultWithMedia, type GadgetExecuteReturn, type GadgetExecutionControllerContext, type GadgetExecutionMode, type GadgetExecutionResult, GadgetExecutor, type GadgetExecutorOptions, type GadgetFactoryExports, type GadgetMediaOutput, type GadgetNode, type GadgetOrClass, GadgetOutputStore, type GadgetParameterInterceptorContext, GadgetRegistry, type GadgetResultInterceptorContext, type GadgetSkippedEvent, type GadgetStartEvent, type GadgetState, GeminiGenerativeProvider, type HintContext, type HintTemplate, type HintsConfig, type HistoryMessage, HookPresets, type HostExports, type HttpMcpServerSpec, HuggingFaceProvider, type HumanInputRequiredEvent, HumanInputRequiredException, HybridStrategy, type IConversationManager, type ISessionManager, type ImageBase64Source, type ImageContentPart, type ImageGenerationOptions, type ImageGenerationResult, type ImageMimeType, type ImageModelSpec, type ImageSource, type ImageUrlSource, type Interceptors, type IterationHintOptions, type JSONSchemaLike, JsonSchemaConversionError, type LLMCallCompleteEvent, type LLMCallControllerContext, type LLMCallErrorEvent, type LLMCallNode, type LLMCallStartEvent, type LLMCallStreamEvent, type LLMErrorControllerContext, type LLMEvent, type LLMGenerationOptions, type LLMMessage, LLMMessageBuilder, type LLMResponseEndEvent, type LLMStream, type LLMStreamChunk, LLMist, type LLMistOptions, type LLMistPackageManifest, LOAD_SKILL_GADGET_NAME, type LoggerOptions, type LoggingOptions, MODEL_ALIASES, McpClient, type McpClientOptions, McpConnectError, type McpContentBlock, McpError, McpLifecycle, type McpServerCapabilities, type McpServerHandle, type McpServerSpec, type McpToolAdapterOptions, McpToolCallError, type McpToolDescriptor, type McpToolResult, McpUntrustedCommandError, type MediaKind, type MediaMetadata, MediaStore, type MessageContent, type MessageInterceptorContext, type MessageRole, type MessageTurn, type ModelDescriptor, type ModelFeatures, ModelIdentifierParser, type ModelLimits, type ModelPricing, ModelRegistry, type ModelSpec, type NodeId, type ObserveChunkContext, type ObserveCompactionContext, type ObserveGadgetArgsPartialContext, type ObserveGadgetCompleteContext, type ObserveGadgetStartContext, type ObserveLLMCallContext, type ObserveLLMCompleteContext, type ObserveLLMErrorContext, type ObserveRateLimitThrottleContext, type ObserveRetryAttemptContext, type ObserveSkillActivatedContext, type Observers, OpenAIChatProvider, type OpenAICompatibleConfig, OpenAICompatibleProvider, type OpenRouterConfig, OpenRouterProvider, type OpenRouterRouting, type OutputLimitConfig, type ParallelGadgetHintOptions, type ParsedGadgetCall, type ParsedSkill, type PrefixConfig, type PresetDefinition, type PromptContext, type PromptTemplate, type PromptTemplateConfig, type ProviderAdapter, type ProviderIdentifier, RESEARCH_DATA_SOURCE_TOOL_TYPES, type RateLimitConfig, type RateLimitStats, RateLimitTracker, type ReasoningConfig, type ReasoningEffort, type ResearchCapabilities, type ResearchCitation, ResearchDeprecatedModelError, type ResearchDoneInfo, type ResearchErrorInfo, type ResearchEvent, type ResearchJob, ResearchJobNotResumableError, type ResearchJobRef, type ResearchModelMetadata, type ResearchModelSpec, ResearchNamespace, ResearchNotPollableError, ResearchNotSupportedError, type ResearchOptions, type ResearchPricing, type ResearchResult, ResearchResultCollector, type ResearchStatus, type ResearchStatusSnapshot, ResearchStreamConsumedError, ResearchTimeoutError, type ResearchToolConfig, type ResearchToolType, type ResearchUsage, ResearchValidationError, type ResolveValueOptions, type ResolvedCompactionConfig, type ResolvedRateLimitConfig, type ResolvedRetryConfig, type RetryConfig, type RetryOptions, type SessionManifestEntry, SimpleSessionManager, Skill, type SkillActivation, type SkillActivationControllerContext, type SkillActivationOptions, type SkillInstructionInterceptorContext, type SkillMetadata, SkillRegistry, type SkillResource, type SkillSource, SlidingWindowStrategy, type SpeechGenerationOptions, type SpeechGenerationResult, type SpeechModelSpec, type StdioMcpServerSpec, type StoredMedia, type StoredOutput, type StreamCompleteEvent, type StreamEvent, type StreamProcessingResult, StreamProcessor, type StreamProcessorOptions, type SubagentConfig, type SubagentConfigMap, type SubagentContext, type SubagentManifestEntry, type SubagentOptions, SummarizationStrategy, TaskCompletionSignal, type TextContentPart, type TextEvent, type TextGenerationOptions, type TextOnlyAction, type TextOnlyContext, type TextOnlyCustomHandler, type TextOnlyGadgetConfig, type TextOnlyHandler, type TextOnlyStrategy, type ThinkingChunk, type ThinkingEvent, TimeoutException, type TokenUsage, type TrailingMessage, type TrailingMessageContext, type CompactionEvent$1 as TreeCompactionEvent, type TreeConfig, type GadgetSkippedEvent$1 as TreeGadgetSkippedEvent, type TriggeredLimitInfo, type ValidationIssue, type ValidationResult, type VisionAnalyzeOptions, type VisionAnalyzeResult, assertCommandAllowed, audioFromBase64, audioFromBuffer, collectEvents, collectText, complete, createAnthropicProviderFromEnv, createFileLoggingState, createGadget, createGadgetOutputViewer, createGeminiProviderFromEnv, createHints, createHuggingFaceProviderFromEnv, createLoadSkillGadget, createLogger, createMcpServer, createMediaOutput, createOpenAIProviderFromEnv, createOpenRouterProviderFromEnv, createSubagent, defaultLogger, detectAudioMimeType, detectImageMimeType, discoverProviderAdapters, discoverSkills, estimateResearchCost, extractMessageText, extractRetryAfterMs, filterByDepth, filterByParent, filterRootEvents, format, formatBytes, formatCallNumber, formatDate, formatDuration, formatLLMError, formatLlmRequest, gadgetError, gadgetResultToMcpContent, gadgetSuccess, gadgetToMcpTool, getErrorMessage, getHostExports, getModelId, getPresetGadgets, getProvider, getSubagent, groupByParent, hasHostExports, hasPreset, hasProviderPrefix, hasSubagents, humanDelay, imageFromBase64, imageFromBuffer, imageFromUrl, isAbortError, isAudioPart, isDataUrl, isGadgetEvent, isImagePart, isLLMEvent, isLikelyContextOverflow, isRetryableError, isRootEvent, isSubagentEvent, isTextPart, iterationProgressHint, jsonSchemaToZod, listPresets, listSubagents, loadSkillsFromDirectory, mcpToolToGadget, normalizeMessageContent, parallelGadgetHint, parseDataUrl, parseFrontmatter, parseManifest, parseMetadata, parseRetryAfterHeader, parseSkillContent, parseSkillFile, randomDelay, renderSkillForMcpPrompt, resetFileLoggingState, resolveConfig, resolveHintTemplate, resolveInstructions, resolveModel, resolvePromptTemplate, resolveRateLimitConfig, resolveRetryConfig, resolveRulesTemplate, resolveSubagentModel, resolveSubagentTimeout, resolveValue, resultWithAudio, resultWithFile, resultWithImage, resultWithImages, resultWithMedia, runGadgetForMcp, runWithHandlers, scanResources, schemaToJSONSchema, skillToMcpPrompt, stream, stripProviderPrefix, substituteArguments, substituteVariables, text, timing, toBase64, truncate, validateAndApplyDefaults, validateGadgetParams, validateGadgetSchema, validateMetadata, withErrorHandling, withRetry, withTimeout };