llmist 18.1.0 → 18.3.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
@@ -1929,6 +1929,27 @@ interface ObserveGadgetStartContext {
1929
1929
  /** Present when event is from a subagent (undefined for top-level agent) */
1930
1930
  subagentContext?: SubagentContext;
1931
1931
  }
1932
+ /**
1933
+ * Context for a progressive gadget-argument partial.
1934
+ * Read-only observation point. Values are RAW/uncoerced — see `GadgetArgsPartialEvent`.
1935
+ *
1936
+ * Unlike `onGadgetExecutionStart`, this fires BEFORE the gadget call is complete
1937
+ * (and before any ExecutionTree node exists for the gadget), repeatedly, as the
1938
+ * argument value streams in. The same `invocationId` later appears on the gadget's
1939
+ * `gadget_call` event and (if it executes) its start/complete contexts.
1940
+ */
1941
+ interface ObserveGadgetArgsPartialContext {
1942
+ iteration: number;
1943
+ invocationId: string;
1944
+ gadgetName: string;
1945
+ fieldPath: string;
1946
+ value: string;
1947
+ delta: string;
1948
+ isFieldComplete: boolean;
1949
+ logger: Logger<ILogObj>;
1950
+ /** Present when event is from a subagent (undefined for top-level agent) */
1951
+ subagentContext?: SubagentContext;
1952
+ }
1932
1953
  /**
1933
1954
  * Context provided when a gadget execution completes.
1934
1955
  * Read-only observation point.
@@ -2005,6 +2026,12 @@ interface Observers {
2005
2026
  onLLMCallError?: (context: ObserveLLMErrorContext) => void | Promise<void>;
2006
2027
  /** Called when a gadget execution starts */
2007
2028
  onGadgetExecutionStart?: (context: ObserveGadgetStartContext) => void | Promise<void>;
2029
+ /**
2030
+ * Called for each progressive argument partial while a gadget call is still
2031
+ * streaming (before its `gadget_call`). Read-only; awaited in emission order.
2032
+ * Values are RAW/uncoerced and should be treated as best-effort. Keep cheap.
2033
+ */
2034
+ onGadgetArgsPartial?: (context: ObserveGadgetArgsPartialContext) => void | Promise<void>;
2008
2035
  /** Called when a gadget execution completes (success or error) */
2009
2036
  onGadgetExecutionComplete?: (context: ObserveGadgetCompleteContext) => void | Promise<void>;
2010
2037
  /** Called when a gadget is skipped due to a failed dependency */
@@ -2999,6 +3026,15 @@ interface RetryConfig {
2999
3026
  * @default 120000 (2 minutes)
3000
3027
  */
3001
3028
  maxRetryAfterMs?: number;
3029
+ /**
3030
+ * Whether to treat an empty completion (a 200-OK response with no text,
3031
+ * no tool calls, and no reasoning) as a transient failure and retry it.
3032
+ * When all attempts come back empty, an `EmptyCompletionError` is thrown
3033
+ * rather than committing a silent blank turn. Only takes effect when
3034
+ * `enabled` is true.
3035
+ * @default true
3036
+ */
3037
+ retryOnEmpty?: boolean;
3002
3038
  }
3003
3039
  /**
3004
3040
  * Resolved retry configuration with all defaults applied.
@@ -3015,6 +3051,7 @@ interface ResolvedRetryConfig {
3015
3051
  shouldRetry?: (error: Error) => boolean;
3016
3052
  respectRetryAfter: boolean;
3017
3053
  maxRetryAfterMs: number;
3054
+ retryOnEmpty: boolean;
3018
3055
  }
3019
3056
  /**
3020
3057
  * Default retry configuration values.
@@ -3966,6 +4003,39 @@ interface GadgetSkippedEvent {
3966
4003
  /** The error message from the failed dependency */
3967
4004
  failedDependencyError: string;
3968
4005
  }
4006
+ /**
4007
+ * Emitted repeatedly while a gadget call is still streaming, surfacing the
4008
+ * GROWING RAW value of one argument field BEFORE the gadget block terminates.
4009
+ *
4010
+ * Use this for progressive UIs (e.g. a form field that fills in live as the
4011
+ * agent streams a long text value).
4012
+ *
4013
+ * Important semantics:
4014
+ * - Values are RAW and UNCOERCED. The authoritative, validated/coerced
4015
+ * parameters arrive later on the single `gadget_call` event.
4016
+ * - `invocationId` is identical across every partial for a gadget AND its
4017
+ * final `gadget_call`, so consumers can correlate them.
4018
+ * - All partials for an invocation are emitted BEFORE that invocation's
4019
+ * `gadget_call`.
4020
+ * - Prefer `value` (replace) over `delta` (append) for correctness; `delta`
4021
+ * is a convenience that can occasionally differ by a trailing newline.
4022
+ * - A partial does NOT guarantee the gadget will execute (it may still be
4023
+ * skipped by `maxGadgetsPerResponse` or fail validation).
4024
+ */
4025
+ interface GadgetArgsPartialEvent {
4026
+ type: "gadget_args_partial";
4027
+ /** Stable invocation id (same on all partials + the final `gadget_call`). */
4028
+ invocationId: string;
4029
+ gadgetName: string;
4030
+ /** JSON-pointer-ish path of the field, e.g. "title", "config/timeout", "items/0". */
4031
+ fieldPath: string;
4032
+ /** Full accumulated RAW value for this field so far (one trailing newline stripped). */
4033
+ value: string;
4034
+ /** Text appended since the previous partial for this field ("" if only completion flipped). */
4035
+ delta: string;
4036
+ /** True once a later `!!!ARG:` or the terminator proves this field's value is final. */
4037
+ isFieldComplete: boolean;
4038
+ }
3969
4039
  /**
3970
4040
  * Event emitted when stream processing completes, containing metadata.
3971
4041
  * This allows the async generator to "return" metadata while still yielding events.
@@ -3997,7 +4067,7 @@ type StreamEvent = {
3997
4067
  } | {
3998
4068
  type: "gadget_call";
3999
4069
  call: ParsedGadgetCall;
4000
- } | {
4070
+ } | GadgetArgsPartialEvent | {
4001
4071
  type: "gadget_result";
4002
4072
  result: GadgetExecutionResult;
4003
4073
  } | GadgetSkippedEvent | {
@@ -5145,6 +5215,19 @@ interface EventHandlers {
5145
5215
  parametersRaw: string;
5146
5216
  dependencies: string[];
5147
5217
  }) => void | Promise<void>;
5218
+ /**
5219
+ * Called for each progressive argument partial while a gadget call is still
5220
+ * streaming (before `onGadgetCall`). Values are RAW/uncoerced; prefer `value`
5221
+ * (replace) over `delta` (append). Great for live form-fill UIs.
5222
+ */
5223
+ onGadgetArgsPartial?: (partial: {
5224
+ gadgetName: string;
5225
+ invocationId: string;
5226
+ fieldPath: string;
5227
+ value: string;
5228
+ delta: string;
5229
+ isFieldComplete: boolean;
5230
+ }) => void | Promise<void>;
5148
5231
  /** Called when a gadget execution completes */
5149
5232
  onGadgetResult?: (result: {
5150
5233
  gadgetName: string;
@@ -8021,6 +8104,10 @@ declare class StreamProcessor {
8021
8104
  private readonly logger;
8022
8105
  private readonly parser;
8023
8106
  private readonly tree?;
8107
+ /** LLM-call node these gadgets hang off; used to derive subagentContext for partials. */
8108
+ private readonly parentNodeId?;
8109
+ /** Parent agent observers (subagent visibility) — also notified for arg partials. */
8110
+ private readonly parentObservers?;
8024
8111
  private responseText;
8025
8112
  private readonly dependencyResolver;
8026
8113
  /** Queue of completed gadget results ready to be yielded (for real-time streaming) */
@@ -8086,6 +8173,23 @@ declare const GADGET_ARG_PREFIX = "!!!ARG:";
8086
8173
  /**
8087
8174
  * Error utilities for llmist.
8088
8175
  */
8176
+ /**
8177
+ * Thrown when an LLM provider returns a completion with no usable output —
8178
+ * no text, no tool calls, and no reasoning — typically a transient provider
8179
+ * glitch (e.g. a 200-OK response with an empty body). The retry orchestrator
8180
+ * treats this as a retryable failure; if every attempt comes back empty it
8181
+ * surfaces this error rather than committing a silent blank turn.
8182
+ */
8183
+ declare class EmptyCompletionError extends Error {
8184
+ /** Agent iteration on which the empty completion was observed. */
8185
+ readonly iteration: number;
8186
+ /** Finish reason reported alongside the empty body (often null). */
8187
+ readonly finishReason: string | null;
8188
+ constructor(params: {
8189
+ iteration: number;
8190
+ finishReason: string | null;
8191
+ });
8192
+ }
8089
8193
  /**
8090
8194
  * Detects if an error is an abort/cancellation error from any provider.
8091
8195
  *
@@ -8803,9 +8907,13 @@ interface StreamParserOptions {
8803
8907
  declare class GadgetCallParser {
8804
8908
  private buffer;
8805
8909
  private lastEmittedTextOffset;
8910
+ /** Non-null only while a single trailing gadget block is mid-stream. */
8911
+ private currentPartial;
8806
8912
  private readonly startPrefix;
8807
8913
  private readonly endPrefix;
8808
8914
  private readonly argPrefix;
8915
+ /** Length of the longest marker; `maxMarkerLength - 1` is the scan-resume overlap. */
8916
+ private readonly maxMarkerLength;
8809
8917
  constructor(options?: StreamParserOptions);
8810
8918
  /**
8811
8919
  * Extract and consume text up to the given index.
@@ -8835,6 +8943,43 @@ declare class GadgetCallParser {
8835
8943
  */
8836
8944
  private parseParameters;
8837
8945
  feed(chunk: string): Generator<StreamEvent>;
8946
+ /** Create fresh partial-tracking state for a newly-started streaming gadget. */
8947
+ private newPartialState;
8948
+ /**
8949
+ * Emit per-field "growing value" partials for an in-progress (or, when
8950
+ * `allComplete`, a just-completed) gadget body delimited by [bodyStart, bodyEnd).
8951
+ *
8952
+ * Incremental by design: each call resumes the `!!!ARG:` scan near where the last
8953
+ * one stopped (backing off by one marker's worth so a marker split across a chunk
8954
+ * boundary is still found) and only re-touches the in-progress field, so a long
8955
+ * streamed body costs O(new bytes) per feed instead of O(body). Every field except
8956
+ * the in-progress (last) one is complete — a following `!!!ARG:` terminated it; the
8957
+ * last field is tentative unless `allComplete`. The tentative field holds back any
8958
+ * suffix that is a partial prefix of a gadget marker so it never leaks into a value.
8959
+ *
8960
+ * We deliberately do NOT run stripMarkdownFences here: an unbalanced opening fence
8961
+ * sits before the first `!!!ARG:` (never emitted) and the authoritative gadget_call
8962
+ * still strips fences from the full raw parameters.
8963
+ */
8964
+ private emitArgPartials;
8965
+ /**
8966
+ * Emit a single field whose `!!!ARG:` marker starts at `markerAbs` and whose value
8967
+ * runs to `valueEndAbs` (the next marker, or the body end). Mirrors the per-field
8968
+ * semantics of the old split-based emitter: field-path line, hold-back for a
8969
+ * tentative value, single trailing-newline strip.
8970
+ */
8971
+ private emitFieldRange;
8972
+ /**
8973
+ * Emit a single partial for a field, but only when its value grew or it newly
8974
+ * completed — keeping event volume proportional to field growth, not characters.
8975
+ */
8976
+ private emitFieldDelta;
8977
+ /**
8978
+ * Length of the longest suffix of `value` that is a proper prefix of any gadget
8979
+ * marker (start/end/arg). Used to hold back the beginning of an incoming marker
8980
+ * so it never appears inside a streamed value.
8981
+ */
8982
+ private trailingPartialMarkerLength;
8838
8983
  finalize(): Generator<StreamEvent>;
8839
8984
  reset(): void;
8840
8985
  }
@@ -11120,4 +11265,4 @@ declare const timing: {
11120
11265
  */
11121
11266
  declare function getHostExports(ctx: ExecutionContext): HostExports;
11122
11267
 
11123
- 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, 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 };
11268
+ 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, 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 };
package/dist/index.d.ts CHANGED
@@ -1929,6 +1929,27 @@ interface ObserveGadgetStartContext {
1929
1929
  /** Present when event is from a subagent (undefined for top-level agent) */
1930
1930
  subagentContext?: SubagentContext;
1931
1931
  }
1932
+ /**
1933
+ * Context for a progressive gadget-argument partial.
1934
+ * Read-only observation point. Values are RAW/uncoerced — see `GadgetArgsPartialEvent`.
1935
+ *
1936
+ * Unlike `onGadgetExecutionStart`, this fires BEFORE the gadget call is complete
1937
+ * (and before any ExecutionTree node exists for the gadget), repeatedly, as the
1938
+ * argument value streams in. The same `invocationId` later appears on the gadget's
1939
+ * `gadget_call` event and (if it executes) its start/complete contexts.
1940
+ */
1941
+ interface ObserveGadgetArgsPartialContext {
1942
+ iteration: number;
1943
+ invocationId: string;
1944
+ gadgetName: string;
1945
+ fieldPath: string;
1946
+ value: string;
1947
+ delta: string;
1948
+ isFieldComplete: boolean;
1949
+ logger: Logger<ILogObj>;
1950
+ /** Present when event is from a subagent (undefined for top-level agent) */
1951
+ subagentContext?: SubagentContext;
1952
+ }
1932
1953
  /**
1933
1954
  * Context provided when a gadget execution completes.
1934
1955
  * Read-only observation point.
@@ -2005,6 +2026,12 @@ interface Observers {
2005
2026
  onLLMCallError?: (context: ObserveLLMErrorContext) => void | Promise<void>;
2006
2027
  /** Called when a gadget execution starts */
2007
2028
  onGadgetExecutionStart?: (context: ObserveGadgetStartContext) => void | Promise<void>;
2029
+ /**
2030
+ * Called for each progressive argument partial while a gadget call is still
2031
+ * streaming (before its `gadget_call`). Read-only; awaited in emission order.
2032
+ * Values are RAW/uncoerced and should be treated as best-effort. Keep cheap.
2033
+ */
2034
+ onGadgetArgsPartial?: (context: ObserveGadgetArgsPartialContext) => void | Promise<void>;
2008
2035
  /** Called when a gadget execution completes (success or error) */
2009
2036
  onGadgetExecutionComplete?: (context: ObserveGadgetCompleteContext) => void | Promise<void>;
2010
2037
  /** Called when a gadget is skipped due to a failed dependency */
@@ -2999,6 +3026,15 @@ interface RetryConfig {
2999
3026
  * @default 120000 (2 minutes)
3000
3027
  */
3001
3028
  maxRetryAfterMs?: number;
3029
+ /**
3030
+ * Whether to treat an empty completion (a 200-OK response with no text,
3031
+ * no tool calls, and no reasoning) as a transient failure and retry it.
3032
+ * When all attempts come back empty, an `EmptyCompletionError` is thrown
3033
+ * rather than committing a silent blank turn. Only takes effect when
3034
+ * `enabled` is true.
3035
+ * @default true
3036
+ */
3037
+ retryOnEmpty?: boolean;
3002
3038
  }
3003
3039
  /**
3004
3040
  * Resolved retry configuration with all defaults applied.
@@ -3015,6 +3051,7 @@ interface ResolvedRetryConfig {
3015
3051
  shouldRetry?: (error: Error) => boolean;
3016
3052
  respectRetryAfter: boolean;
3017
3053
  maxRetryAfterMs: number;
3054
+ retryOnEmpty: boolean;
3018
3055
  }
3019
3056
  /**
3020
3057
  * Default retry configuration values.
@@ -3966,6 +4003,39 @@ interface GadgetSkippedEvent {
3966
4003
  /** The error message from the failed dependency */
3967
4004
  failedDependencyError: string;
3968
4005
  }
4006
+ /**
4007
+ * Emitted repeatedly while a gadget call is still streaming, surfacing the
4008
+ * GROWING RAW value of one argument field BEFORE the gadget block terminates.
4009
+ *
4010
+ * Use this for progressive UIs (e.g. a form field that fills in live as the
4011
+ * agent streams a long text value).
4012
+ *
4013
+ * Important semantics:
4014
+ * - Values are RAW and UNCOERCED. The authoritative, validated/coerced
4015
+ * parameters arrive later on the single `gadget_call` event.
4016
+ * - `invocationId` is identical across every partial for a gadget AND its
4017
+ * final `gadget_call`, so consumers can correlate them.
4018
+ * - All partials for an invocation are emitted BEFORE that invocation's
4019
+ * `gadget_call`.
4020
+ * - Prefer `value` (replace) over `delta` (append) for correctness; `delta`
4021
+ * is a convenience that can occasionally differ by a trailing newline.
4022
+ * - A partial does NOT guarantee the gadget will execute (it may still be
4023
+ * skipped by `maxGadgetsPerResponse` or fail validation).
4024
+ */
4025
+ interface GadgetArgsPartialEvent {
4026
+ type: "gadget_args_partial";
4027
+ /** Stable invocation id (same on all partials + the final `gadget_call`). */
4028
+ invocationId: string;
4029
+ gadgetName: string;
4030
+ /** JSON-pointer-ish path of the field, e.g. "title", "config/timeout", "items/0". */
4031
+ fieldPath: string;
4032
+ /** Full accumulated RAW value for this field so far (one trailing newline stripped). */
4033
+ value: string;
4034
+ /** Text appended since the previous partial for this field ("" if only completion flipped). */
4035
+ delta: string;
4036
+ /** True once a later `!!!ARG:` or the terminator proves this field's value is final. */
4037
+ isFieldComplete: boolean;
4038
+ }
3969
4039
  /**
3970
4040
  * Event emitted when stream processing completes, containing metadata.
3971
4041
  * This allows the async generator to "return" metadata while still yielding events.
@@ -3997,7 +4067,7 @@ type StreamEvent = {
3997
4067
  } | {
3998
4068
  type: "gadget_call";
3999
4069
  call: ParsedGadgetCall;
4000
- } | {
4070
+ } | GadgetArgsPartialEvent | {
4001
4071
  type: "gadget_result";
4002
4072
  result: GadgetExecutionResult;
4003
4073
  } | GadgetSkippedEvent | {
@@ -5145,6 +5215,19 @@ interface EventHandlers {
5145
5215
  parametersRaw: string;
5146
5216
  dependencies: string[];
5147
5217
  }) => void | Promise<void>;
5218
+ /**
5219
+ * Called for each progressive argument partial while a gadget call is still
5220
+ * streaming (before `onGadgetCall`). Values are RAW/uncoerced; prefer `value`
5221
+ * (replace) over `delta` (append). Great for live form-fill UIs.
5222
+ */
5223
+ onGadgetArgsPartial?: (partial: {
5224
+ gadgetName: string;
5225
+ invocationId: string;
5226
+ fieldPath: string;
5227
+ value: string;
5228
+ delta: string;
5229
+ isFieldComplete: boolean;
5230
+ }) => void | Promise<void>;
5148
5231
  /** Called when a gadget execution completes */
5149
5232
  onGadgetResult?: (result: {
5150
5233
  gadgetName: string;
@@ -8021,6 +8104,10 @@ declare class StreamProcessor {
8021
8104
  private readonly logger;
8022
8105
  private readonly parser;
8023
8106
  private readonly tree?;
8107
+ /** LLM-call node these gadgets hang off; used to derive subagentContext for partials. */
8108
+ private readonly parentNodeId?;
8109
+ /** Parent agent observers (subagent visibility) — also notified for arg partials. */
8110
+ private readonly parentObservers?;
8024
8111
  private responseText;
8025
8112
  private readonly dependencyResolver;
8026
8113
  /** Queue of completed gadget results ready to be yielded (for real-time streaming) */
@@ -8086,6 +8173,23 @@ declare const GADGET_ARG_PREFIX = "!!!ARG:";
8086
8173
  /**
8087
8174
  * Error utilities for llmist.
8088
8175
  */
8176
+ /**
8177
+ * Thrown when an LLM provider returns a completion with no usable output —
8178
+ * no text, no tool calls, and no reasoning — typically a transient provider
8179
+ * glitch (e.g. a 200-OK response with an empty body). The retry orchestrator
8180
+ * treats this as a retryable failure; if every attempt comes back empty it
8181
+ * surfaces this error rather than committing a silent blank turn.
8182
+ */
8183
+ declare class EmptyCompletionError extends Error {
8184
+ /** Agent iteration on which the empty completion was observed. */
8185
+ readonly iteration: number;
8186
+ /** Finish reason reported alongside the empty body (often null). */
8187
+ readonly finishReason: string | null;
8188
+ constructor(params: {
8189
+ iteration: number;
8190
+ finishReason: string | null;
8191
+ });
8192
+ }
8089
8193
  /**
8090
8194
  * Detects if an error is an abort/cancellation error from any provider.
8091
8195
  *
@@ -8803,9 +8907,13 @@ interface StreamParserOptions {
8803
8907
  declare class GadgetCallParser {
8804
8908
  private buffer;
8805
8909
  private lastEmittedTextOffset;
8910
+ /** Non-null only while a single trailing gadget block is mid-stream. */
8911
+ private currentPartial;
8806
8912
  private readonly startPrefix;
8807
8913
  private readonly endPrefix;
8808
8914
  private readonly argPrefix;
8915
+ /** Length of the longest marker; `maxMarkerLength - 1` is the scan-resume overlap. */
8916
+ private readonly maxMarkerLength;
8809
8917
  constructor(options?: StreamParserOptions);
8810
8918
  /**
8811
8919
  * Extract and consume text up to the given index.
@@ -8835,6 +8943,43 @@ declare class GadgetCallParser {
8835
8943
  */
8836
8944
  private parseParameters;
8837
8945
  feed(chunk: string): Generator<StreamEvent>;
8946
+ /** Create fresh partial-tracking state for a newly-started streaming gadget. */
8947
+ private newPartialState;
8948
+ /**
8949
+ * Emit per-field "growing value" partials for an in-progress (or, when
8950
+ * `allComplete`, a just-completed) gadget body delimited by [bodyStart, bodyEnd).
8951
+ *
8952
+ * Incremental by design: each call resumes the `!!!ARG:` scan near where the last
8953
+ * one stopped (backing off by one marker's worth so a marker split across a chunk
8954
+ * boundary is still found) and only re-touches the in-progress field, so a long
8955
+ * streamed body costs O(new bytes) per feed instead of O(body). Every field except
8956
+ * the in-progress (last) one is complete — a following `!!!ARG:` terminated it; the
8957
+ * last field is tentative unless `allComplete`. The tentative field holds back any
8958
+ * suffix that is a partial prefix of a gadget marker so it never leaks into a value.
8959
+ *
8960
+ * We deliberately do NOT run stripMarkdownFences here: an unbalanced opening fence
8961
+ * sits before the first `!!!ARG:` (never emitted) and the authoritative gadget_call
8962
+ * still strips fences from the full raw parameters.
8963
+ */
8964
+ private emitArgPartials;
8965
+ /**
8966
+ * Emit a single field whose `!!!ARG:` marker starts at `markerAbs` and whose value
8967
+ * runs to `valueEndAbs` (the next marker, or the body end). Mirrors the per-field
8968
+ * semantics of the old split-based emitter: field-path line, hold-back for a
8969
+ * tentative value, single trailing-newline strip.
8970
+ */
8971
+ private emitFieldRange;
8972
+ /**
8973
+ * Emit a single partial for a field, but only when its value grew or it newly
8974
+ * completed — keeping event volume proportional to field growth, not characters.
8975
+ */
8976
+ private emitFieldDelta;
8977
+ /**
8978
+ * Length of the longest suffix of `value` that is a proper prefix of any gadget
8979
+ * marker (start/end/arg). Used to hold back the beginning of an incoming marker
8980
+ * so it never appears inside a streamed value.
8981
+ */
8982
+ private trailingPartialMarkerLength;
8838
8983
  finalize(): Generator<StreamEvent>;
8839
8984
  reset(): void;
8840
8985
  }
@@ -11120,4 +11265,4 @@ declare const timing: {
11120
11265
  */
11121
11266
  declare function getHostExports(ctx: ExecutionContext): HostExports;
11122
11267
 
11123
- 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, 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 };
11268
+ 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, 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 };