llmist 3.0.0 → 4.0.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.
@@ -986,6 +986,25 @@ interface GadgetSkippedEvent {
986
986
  /** The error message from the failed dependency */
987
987
  failedDependencyError: string;
988
988
  }
989
+ /**
990
+ * Event emitted when stream processing completes, containing metadata.
991
+ * This allows the async generator to "return" metadata while still yielding events.
992
+ */
993
+ interface StreamCompletionEvent {
994
+ type: "stream_complete";
995
+ /** The reason the LLM stopped generating (e.g., "stop", "tool_use") */
996
+ finishReason: string | null;
997
+ /** Token usage statistics from the LLM call */
998
+ usage?: TokenUsage;
999
+ /** Raw response text from the LLM */
1000
+ rawResponse: string;
1001
+ /** Final message after all interceptors applied */
1002
+ finalMessage: string;
1003
+ /** Whether any gadgets were executed during this iteration */
1004
+ didExecuteGadgets: boolean;
1005
+ /** Whether to break the agent loop (e.g., TaskComplete was called) */
1006
+ shouldBreakLoop: boolean;
1007
+ }
989
1008
  type StreamEvent = {
990
1009
  type: "text";
991
1010
  content: string;
@@ -1003,7 +1022,57 @@ type StreamEvent = {
1003
1022
  } | {
1004
1023
  type: "compaction";
1005
1024
  event: CompactionEvent;
1006
- };
1025
+ } | SubagentStreamEvent | StreamCompletionEvent;
1026
+ /** Event for forwarding subagent activity through the stream */
1027
+ interface SubagentStreamEvent {
1028
+ type: "subagent_event";
1029
+ subagentEvent: SubagentEvent;
1030
+ }
1031
+ /**
1032
+ * Information about an LLM call within a subagent.
1033
+ * Used by parent agents to display real-time progress of subagent LLM calls.
1034
+ */
1035
+ interface LLMCallInfo {
1036
+ /** Iteration number within the subagent loop */
1037
+ iteration: number;
1038
+ /** Model identifier (e.g., "sonnet", "gpt-4o") */
1039
+ model: string;
1040
+ /** Input tokens sent to the LLM */
1041
+ inputTokens?: number;
1042
+ /** Output tokens received from the LLM */
1043
+ outputTokens?: number;
1044
+ /** Reason the LLM stopped generating (e.g., "stop", "tool_use") */
1045
+ finishReason?: string;
1046
+ /** Elapsed time in milliseconds */
1047
+ elapsedMs?: number;
1048
+ }
1049
+ /**
1050
+ * Event emitted by subagent gadgets to report internal agent activity.
1051
+ * Enables real-time display of subagent LLM calls and gadget executions.
1052
+ *
1053
+ * @example
1054
+ * ```typescript
1055
+ * // Forwarding events from subagent to parent
1056
+ * for await (const event of subagent.run()) {
1057
+ * ctx.onSubagentEvent?.({
1058
+ * type: event.type === "gadget_call" ? "gadget_call" : "gadget_result",
1059
+ * gadgetInvocationId: parentInvocationId,
1060
+ * depth: 1,
1061
+ * event,
1062
+ * });
1063
+ * }
1064
+ * ```
1065
+ */
1066
+ interface SubagentEvent {
1067
+ /** Type of subagent event */
1068
+ type: "llm_call_start" | "llm_call_end" | "gadget_call" | "gadget_result";
1069
+ /** Invocation ID of the parent gadget this subagent event belongs to */
1070
+ gadgetInvocationId: string;
1071
+ /** Nesting depth (1 = direct child, 2 = grandchild, etc.) */
1072
+ depth: number;
1073
+ /** The actual event data - either a StreamEvent or LLMCallInfo */
1074
+ event: StreamEvent | LLMCallInfo;
1075
+ }
1007
1076
 
1008
1077
  type TextOnlyHandler = TextOnlyStrategy | TextOnlyGadgetConfig | TextOnlyCustomHandler;
1009
1078
  /**
@@ -1314,6 +1383,39 @@ interface ExecutionContext {
1314
1383
  * ```
1315
1384
  */
1316
1385
  subagentConfig?: SubagentConfigMap;
1386
+ /**
1387
+ * Unique invocation ID for this gadget execution.
1388
+ * Used by `withParentContext()` to identify which parent gadget
1389
+ * nested events belong to.
1390
+ */
1391
+ invocationId?: string;
1392
+ /**
1393
+ * Callback for subagent gadgets to report internal events to the parent.
1394
+ *
1395
+ * When provided, subagent gadgets (like BrowseWeb) can use this callback
1396
+ * to report their internal LLM calls and gadget executions in real-time.
1397
+ * This enables the parent agent to display subagent progress indicators.
1398
+ *
1399
+ * **Recommended:** Use `builder.withParentContext(ctx)` instead of calling
1400
+ * this directly - it handles all the forwarding automatically.
1401
+ *
1402
+ * @example
1403
+ * ```typescript
1404
+ * // In a subagent gadget like BrowseWeb - just ONE LINE needed:
1405
+ * execute: async (params, ctx) => {
1406
+ * const agent = new AgentBuilder(client)
1407
+ * .withModel(model)
1408
+ * .withGadgets(Navigate, Click)
1409
+ * .withParentContext(ctx) // <-- Enables automatic event forwarding!
1410
+ * .ask(task);
1411
+ *
1412
+ * for await (const event of agent.run()) {
1413
+ * // Events automatically forwarded - just process normally
1414
+ * }
1415
+ * }
1416
+ * ```
1417
+ */
1418
+ onSubagentEvent?: (event: SubagentEvent) => void;
1317
1419
  }
1318
1420
  /**
1319
1421
  * Parent agent configuration passed to gadgets.
@@ -2940,6 +3042,34 @@ declare function collectText(agentGenerator: AsyncGenerator<StreamEvent>): Promi
2940
3042
  * @module agent/hooks
2941
3043
  */
2942
3044
 
3045
+ /**
3046
+ * Metadata present when an event originates from a subagent.
3047
+ * Undefined for top-level agent events.
3048
+ *
3049
+ * When using subagent gadgets (like BrowseWeb), hook observers receive events
3050
+ * from both the main agent AND subagents. Check this context to distinguish.
3051
+ *
3052
+ * @example
3053
+ * ```typescript
3054
+ * observers: {
3055
+ * onLLMCallStart: (ctx) => {
3056
+ * if (ctx.subagentContext) {
3057
+ * // Event from a subagent
3058
+ * console.log(`↳ Subagent LLM (depth=${ctx.subagentContext.depth})`);
3059
+ * } else {
3060
+ * // Event from the main agent
3061
+ * console.log('Main agent LLM call');
3062
+ * }
3063
+ * }
3064
+ * }
3065
+ * ```
3066
+ */
3067
+ interface SubagentContext {
3068
+ /** Invocation ID of the parent gadget that spawned this subagent */
3069
+ parentGadgetInvocationId: string;
3070
+ /** Nesting depth: 1 = direct child, 2 = grandchild, etc. */
3071
+ depth: number;
3072
+ }
2943
3073
  /**
2944
3074
  * Context provided when an LLM call starts.
2945
3075
  * Read-only observation point.
@@ -2948,6 +3078,8 @@ interface ObserveLLMCallContext {
2948
3078
  iteration: number;
2949
3079
  options: Readonly<LLMGenerationOptions>;
2950
3080
  logger: Logger<ILogObj>;
3081
+ /** Present when event is from a subagent (undefined for top-level agent) */
3082
+ subagentContext?: SubagentContext;
2951
3083
  }
2952
3084
  /**
2953
3085
  * Context provided when an LLM call is ready to execute.
@@ -2960,6 +3092,8 @@ interface ObserveLLMCallReadyContext {
2960
3092
  /** Final options after any controller modifications (e.g., trailing messages) */
2961
3093
  options: Readonly<LLMGenerationOptions>;
2962
3094
  logger: Logger<ILogObj>;
3095
+ /** Present when event is from a subagent (undefined for top-level agent) */
3096
+ subagentContext?: SubagentContext;
2963
3097
  }
2964
3098
  /**
2965
3099
  * Context provided when an LLM call completes successfully.
@@ -2976,6 +3110,8 @@ interface ObserveLLMCompleteContext {
2976
3110
  /** The final message that will be added to history (after interceptors) */
2977
3111
  finalMessage: string;
2978
3112
  logger: Logger<ILogObj>;
3113
+ /** Present when event is from a subagent (undefined for top-level agent) */
3114
+ subagentContext?: SubagentContext;
2979
3115
  }
2980
3116
  /**
2981
3117
  * Context provided when an LLM call fails.
@@ -2988,6 +3124,8 @@ interface ObserveLLMErrorContext {
2988
3124
  /** Whether the error was recovered by a controller */
2989
3125
  recovered: boolean;
2990
3126
  logger: Logger<ILogObj>;
3127
+ /** Present when event is from a subagent (undefined for top-level agent) */
3128
+ subagentContext?: SubagentContext;
2991
3129
  }
2992
3130
  /**
2993
3131
  * Context provided when a gadget execution starts.
@@ -3000,6 +3138,8 @@ interface ObserveGadgetStartContext {
3000
3138
  /** Parameters after controller modifications */
3001
3139
  parameters: Readonly<Record<string, unknown>>;
3002
3140
  logger: Logger<ILogObj>;
3141
+ /** Present when event is from a subagent (undefined for top-level agent) */
3142
+ subagentContext?: SubagentContext;
3003
3143
  }
3004
3144
  /**
3005
3145
  * Context provided when a gadget execution completes.
@@ -3020,6 +3160,8 @@ interface ObserveGadgetCompleteContext {
3020
3160
  /** Cost of gadget execution in USD. 0 if gadget didn't report cost. */
3021
3161
  cost?: number;
3022
3162
  logger: Logger<ILogObj>;
3163
+ /** Present when event is from a subagent (undefined for top-level agent) */
3164
+ subagentContext?: SubagentContext;
3023
3165
  }
3024
3166
  /**
3025
3167
  * Context provided when a gadget is skipped due to a failed dependency.
@@ -3035,6 +3177,8 @@ interface ObserveGadgetSkippedContext {
3035
3177
  /** The error message from the failed dependency */
3036
3178
  failedDependencyError: string;
3037
3179
  logger: Logger<ILogObj>;
3180
+ /** Present when event is from a subagent (undefined for top-level agent) */
3181
+ subagentContext?: SubagentContext;
3038
3182
  }
3039
3183
  /**
3040
3184
  * Context provided for each stream chunk.
@@ -3049,6 +3193,8 @@ interface ObserveChunkContext {
3049
3193
  /** Token usage if available (providers send usage at stream start/end) */
3050
3194
  usage?: TokenUsage;
3051
3195
  logger: Logger<ILogObj>;
3196
+ /** Present when event is from a subagent (undefined for top-level agent) */
3197
+ subagentContext?: SubagentContext;
3052
3198
  }
3053
3199
  /**
3054
3200
  * Observers: Read-only hooks for side effects.
@@ -3091,6 +3237,8 @@ interface ObserveCompactionContext {
3091
3237
  stats: CompactionStats;
3092
3238
  /** Logger instance */
3093
3239
  logger: Logger<ILogObj>;
3240
+ /** Present when event is from a subagent (undefined for top-level agent) */
3241
+ subagentContext?: SubagentContext;
3094
3242
  }
3095
3243
  /**
3096
3244
  * Context provided when the agent is aborted via AbortSignal.
@@ -3103,6 +3251,8 @@ interface ObserveAbortContext {
3103
3251
  reason?: unknown;
3104
3252
  /** Logger instance */
3105
3253
  logger: Logger<ILogObj>;
3254
+ /** Present when event is from a subagent (undefined for top-level agent) */
3255
+ subagentContext?: SubagentContext;
3106
3256
  }
3107
3257
  /**
3108
3258
  * Context for chunk interception.
@@ -3475,6 +3625,8 @@ interface AgentOptions {
3475
3625
  signal?: AbortSignal;
3476
3626
  /** Subagent-specific configuration overrides (from CLI config) */
3477
3627
  subagentConfig?: SubagentConfigMap;
3628
+ /** Callback for subagent gadgets to report subagent events to parent */
3629
+ onSubagentEvent?: (event: SubagentEvent) => void;
3478
3630
  }
3479
3631
  /**
3480
3632
  * Agent: Lean orchestrator that delegates to StreamProcessor.
@@ -3519,11 +3671,19 @@ declare class Agent {
3519
3671
  private readonly signal?;
3520
3672
  private readonly agentContextConfig;
3521
3673
  private readonly subagentConfig?;
3674
+ private readonly userSubagentEventCallback?;
3675
+ private readonly pendingSubagentEvents;
3676
+ private readonly onSubagentEvent;
3522
3677
  /**
3523
3678
  * Creates a new Agent instance.
3524
3679
  * @internal This constructor is private. Use LLMist.createAgent() or AgentBuilder instead.
3525
3680
  */
3526
3681
  constructor(key: typeof AGENT_INTERNAL_KEY, options: AgentOptions);
3682
+ /**
3683
+ * Flush pending subagent events as StreamEvents.
3684
+ * Called from run() to yield queued subagent events from subagent gadgets.
3685
+ */
3686
+ private flushPendingSubagentEvents;
3527
3687
  /**
3528
3688
  * Get the gadget registry for this agent.
3529
3689
  *
@@ -3729,6 +3889,8 @@ declare class AgentBuilder {
3729
3889
  private signal?;
3730
3890
  private trailingMessage?;
3731
3891
  private subagentConfig?;
3892
+ private subagentEventCallback?;
3893
+ private parentContext?;
3732
3894
  constructor(client?: LLMist);
3733
3895
  /**
3734
3896
  * Set the model to use.
@@ -4144,6 +4306,62 @@ declare class AgentBuilder {
4144
4306
  * ```
4145
4307
  */
4146
4308
  withSubagentConfig(config: SubagentConfigMap): this;
4309
+ /**
4310
+ * Set the callback for subagent events.
4311
+ *
4312
+ * Subagent gadgets (like BrowseWeb) can use ExecutionContext.onSubagentEvent
4313
+ * to report their internal LLM calls and gadget executions in real-time.
4314
+ * This callback receives those events, enabling hierarchical progress display.
4315
+ *
4316
+ * @param callback - Function to handle subagent events
4317
+ * @returns This builder for chaining
4318
+ *
4319
+ * @example
4320
+ * ```typescript
4321
+ * .withSubagentEventCallback((event) => {
4322
+ * if (event.type === "llm_call_start") {
4323
+ * console.log(` Subagent LLM #${event.event.iteration} starting...`);
4324
+ * } else if (event.type === "gadget_call") {
4325
+ * console.log(` ⏵ ${event.event.call.gadgetName}...`);
4326
+ * }
4327
+ * })
4328
+ * ```
4329
+ */
4330
+ withSubagentEventCallback(callback: (event: SubagentEvent) => void): this;
4331
+ /**
4332
+ * Enable automatic subagent event forwarding to parent agent.
4333
+ *
4334
+ * When building a subagent inside a gadget, call this method to automatically
4335
+ * forward all LLM calls and gadget events to the parent agent. This enables
4336
+ * hierarchical progress display without any manual event handling.
4337
+ *
4338
+ * The method extracts `invocationId` and `onSubagentEvent` from the execution
4339
+ * context and sets up automatic forwarding via hooks and event wrapping.
4340
+ *
4341
+ * @param ctx - ExecutionContext passed to the gadget's execute() method
4342
+ * @param depth - Nesting depth (default: 1 for direct child)
4343
+ * @returns This builder for chaining
4344
+ *
4345
+ * @example
4346
+ * ```typescript
4347
+ * // In a subagent gadget like BrowseWeb - ONE LINE enables auto-forwarding:
4348
+ * execute: async (params, ctx) => {
4349
+ * const agent = new AgentBuilder(client)
4350
+ * .withModel(model)
4351
+ * .withGadgets(Navigate, Click, Screenshot)
4352
+ * .withParentContext(ctx) // <-- This is all you need!
4353
+ * .ask(params.task);
4354
+ *
4355
+ * for await (const event of agent.run()) {
4356
+ * // Events automatically forwarded - just process normally
4357
+ * if (event.type === "text") {
4358
+ * result = event.content;
4359
+ * }
4360
+ * }
4361
+ * }
4362
+ * ```
4363
+ */
4364
+ withParentContext(ctx: ExecutionContext, depth?: number): this;
4147
4365
  /**
4148
4366
  * Add an ephemeral trailing message that appears at the end of each LLM request.
4149
4367
  *
@@ -4193,7 +4411,9 @@ declare class AgentBuilder {
4193
4411
  */
4194
4412
  withSyntheticGadgetCall(gadgetName: string, parameters: Record<string, unknown>, result: string): this;
4195
4413
  /**
4196
- * Compose the final hooks, including trailing message if configured.
4414
+ * Compose the final hooks, including:
4415
+ * - Trailing message injection (if configured)
4416
+ * - Subagent event forwarding for LLM calls (if parentContext is set)
4197
4417
  */
4198
4418
  private composeHooks;
4199
4419
  /**
@@ -5101,4 +5321,4 @@ declare function createTextMockStream(text: string, options?: {
5101
5321
  usage?: MockResponse["usage"];
5102
5322
  }): LLMStream;
5103
5323
 
5104
- export { type ImageModelSpec as $, AbstractGadget as A, type MessageContent as B, type CompactionConfig as C, GadgetRegistry as D, MediaStore as E, type AgentContextConfig as F, type GadgetMediaOutput as G, type HintTemplate as H, type IConversationManager as I, type SubagentConfigMap as J, type ExecutionContext as K, type LLMMessage as L, MockProviderAdapter as M, type GadgetExecuteReturn as N, type GadgetExample as O, type ParsedGadgetCall as P, type GadgetExecutionResult as Q, type ResolvedCompactionConfig as R, type StreamEvent as S, type TokenUsage as T, type MediaKind as U, type MediaMetadata as V, type GadgetExecuteResultWithMedia as W, type ProviderAdapter as X, type ModelDescriptor as Y, type ModelSpec as Z, type LLMGenerationOptions as _, type LLMStream as a, parseDataUrl as a$, type ImageGenerationOptions as a0, type ImageGenerationResult as a1, type SpeechModelSpec as a2, type SpeechGenerationOptions as a3, type SpeechGenerationResult as a4, type HistoryMessage as a5, type TrailingMessage as a6, type TrailingMessageContext as a7, AgentBuilder as a8, type EventHandlers as a9, type ObserveLLMCompleteContext as aA, type ObserveLLMErrorContext as aB, type Observers as aC, DEFAULT_COMPACTION_CONFIG as aD, DEFAULT_SUMMARIZATION_PROMPT as aE, type LLMistOptions as aF, type AudioContentPart as aG, type AudioMimeType as aH, type AudioSource as aI, type ContentPart as aJ, type ImageBase64Source as aK, type ImageContentPart as aL, type ImageMimeType as aM, type ImageSource as aN, type ImageUrlSource as aO, type TextContentPart as aP, audioFromBase64 as aQ, audioFromBuffer as aR, detectAudioMimeType as aS, detectImageMimeType as aT, imageFromBase64 as aU, imageFromBuffer as aV, imageFromUrl as aW, isAudioPart as aX, isDataUrl as aY, isImagePart as aZ, isTextPart as a_, collectEvents as aa, collectText as ab, runWithHandlers as ac, type AfterGadgetExecutionAction as ad, type AfterGadgetExecutionControllerContext as ae, type AfterLLMCallAction as af, type AfterLLMCallControllerContext as ag, type AfterLLMErrorAction as ah, type AgentOptions as ai, type BeforeGadgetExecutionAction as aj, type BeforeLLMCallAction as ak, type ChunkInterceptorContext as al, type Controllers as am, type GadgetExecutionControllerContext as an, type GadgetParameterInterceptorContext as ao, type GadgetResultInterceptorContext as ap, type Interceptors as aq, type LLMCallControllerContext as ar, type LLMErrorControllerContext as as, type MessageInterceptorContext as at, type MessageTurn as au, type ObserveChunkContext as av, type ObserveCompactionContext as aw, type ObserveGadgetCompleteContext as ax, type ObserveGadgetStartContext as ay, type ObserveLLMCallContext as az, type LLMStreamChunk as b, text as b0, toBase64 as b1, type MessageRole as b2, extractMessageText as b3, LLMMessageBuilder as b4, normalizeMessageContent as b5, type CostEstimate as b6, type ModelFeatures as b7, type ModelLimits as b8, type ModelPricing as b9, type TextOnlyHandler as bA, type TextOnlyStrategy as bB, type VisionAnalyzeOptions as ba, type VisionAnalyzeResult as bb, type ProviderIdentifier as bc, ModelIdentifierParser as bd, type HintContext as be, type PromptContext as bf, type PromptTemplate as bg, type PromptTemplateConfig as bh, DEFAULT_HINTS as bi, DEFAULT_PROMPTS as bj, resolveHintTemplate as bk, resolvePromptTemplate as bl, resolveRulesTemplate as bm, type TextGenerationOptions as bn, complete as bo, stream as bp, type GadgetClass as bq, type GadgetOrClass as br, type CostReportingLLMist as bs, type GadgetExecuteResult as bt, type GadgetSkippedEvent as bu, type StoredMedia as bv, type TextOnlyAction as bw, type TextOnlyContext as bx, type TextOnlyCustomHandler as by, type TextOnlyGadgetConfig as bz, createMockAdapter as c, MockBuilder as d, createMockClient as e, MockManager as f, getMockManager as g, createMockStream as h, createTextMockStream as i, type MockAudioData as j, type MockImageData as k, type MockMatcher as l, mockLLM as m, type MockMatcherContext as n, type MockOptions as o, type MockRegistration as p, type MockResponse as q, type MockStats as r, type AgentHooks as s, ModelRegistry as t, LLMist as u, type CompactionEvent as v, type CompactionStats as w, type CompactionStrategy as x, type CompactionContext as y, type CompactionResult as z };
5324
+ export { type LLMGenerationOptions as $, AbstractGadget as A, type MessageContent as B, type CompactionConfig as C, GadgetRegistry as D, MediaStore as E, type AgentContextConfig as F, type GadgetMediaOutput as G, type HintTemplate as H, type IConversationManager as I, type SubagentConfigMap as J, type SubagentEvent as K, type LLMMessage as L, MockProviderAdapter as M, type ExecutionContext as N, type GadgetExecuteReturn as O, type GadgetExample as P, type ParsedGadgetCall as Q, type ResolvedCompactionConfig as R, type StreamEvent as S, type TokenUsage as T, type GadgetExecutionResult as U, type MediaKind as V, type MediaMetadata as W, type GadgetExecuteResultWithMedia as X, type ProviderAdapter as Y, type ModelDescriptor as Z, type ModelSpec as _, type LLMStream as a, isImagePart as a$, type ImageModelSpec as a0, type ImageGenerationOptions as a1, type ImageGenerationResult as a2, type SpeechModelSpec as a3, type SpeechGenerationOptions as a4, type SpeechGenerationResult as a5, type HistoryMessage as a6, type TrailingMessage as a7, type TrailingMessageContext as a8, AgentBuilder as a9, type ObserveLLMCallContext as aA, type ObserveLLMCompleteContext as aB, type ObserveLLMErrorContext as aC, type Observers as aD, type SubagentContext as aE, DEFAULT_COMPACTION_CONFIG as aF, DEFAULT_SUMMARIZATION_PROMPT as aG, type LLMistOptions as aH, type AudioContentPart as aI, type AudioMimeType as aJ, type AudioSource as aK, type ContentPart as aL, type ImageBase64Source as aM, type ImageContentPart as aN, type ImageMimeType as aO, type ImageSource as aP, type ImageUrlSource as aQ, type TextContentPart as aR, audioFromBase64 as aS, audioFromBuffer as aT, detectAudioMimeType as aU, detectImageMimeType as aV, imageFromBase64 as aW, imageFromBuffer as aX, imageFromUrl as aY, isAudioPart as aZ, isDataUrl as a_, type EventHandlers as aa, collectEvents as ab, collectText as ac, runWithHandlers as ad, type AfterGadgetExecutionAction as ae, type AfterGadgetExecutionControllerContext as af, type AfterLLMCallAction as ag, type AfterLLMCallControllerContext as ah, type AfterLLMErrorAction as ai, type AgentOptions as aj, type BeforeGadgetExecutionAction as ak, type BeforeLLMCallAction as al, type ChunkInterceptorContext as am, type Controllers as an, type GadgetExecutionControllerContext as ao, type GadgetParameterInterceptorContext as ap, type GadgetResultInterceptorContext as aq, type Interceptors as ar, type LLMCallControllerContext as as, type LLMErrorControllerContext as at, type MessageInterceptorContext as au, type MessageTurn as av, type ObserveChunkContext as aw, type ObserveCompactionContext as ax, type ObserveGadgetCompleteContext as ay, type ObserveGadgetStartContext as az, type LLMStreamChunk as b, isTextPart as b0, parseDataUrl as b1, text as b2, toBase64 as b3, type MessageRole as b4, extractMessageText as b5, LLMMessageBuilder as b6, normalizeMessageContent as b7, type CostEstimate as b8, type ModelFeatures as b9, type TextOnlyContext as bA, type TextOnlyCustomHandler as bB, type TextOnlyGadgetConfig as bC, type TextOnlyHandler as bD, type TextOnlyStrategy as bE, type ModelLimits as ba, type ModelPricing as bb, type VisionAnalyzeOptions as bc, type VisionAnalyzeResult as bd, type ProviderIdentifier as be, ModelIdentifierParser as bf, type HintContext as bg, type PromptContext as bh, type PromptTemplate as bi, type PromptTemplateConfig as bj, DEFAULT_HINTS as bk, DEFAULT_PROMPTS as bl, resolveHintTemplate as bm, resolvePromptTemplate as bn, resolveRulesTemplate as bo, type TextGenerationOptions as bp, complete as bq, stream as br, type GadgetClass as bs, type GadgetOrClass as bt, type CostReportingLLMist as bu, type GadgetExecuteResult as bv, type GadgetSkippedEvent as bw, type StoredMedia as bx, type SubagentStreamEvent as by, type TextOnlyAction as bz, createMockAdapter as c, MockBuilder as d, createMockClient as e, MockManager as f, getMockManager as g, createMockStream as h, createTextMockStream as i, type MockAudioData as j, type MockImageData as k, type MockMatcher as l, mockLLM as m, type MockMatcherContext as n, type MockOptions as o, type MockRegistration as p, type MockResponse as q, type MockStats as r, type AgentHooks as s, ModelRegistry as t, LLMist as u, type CompactionEvent as v, type CompactionStats as w, type CompactionStrategy as x, type CompactionContext as y, type CompactionResult as z };