llmist 6.1.0 → 6.2.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
@@ -1,7 +1,7 @@
1
- import { ZodType, ZodTypeAny } from 'zod';
1
+ import { ZodTypeAny } from 'zod';
2
2
  export { z } from 'zod';
3
- import { s as AgentHooks, t as ModelRegistry, u as LLMist, C as CompactionConfig, I as IConversationManager, v as CompactionEvent, L as LLMMessage, w as CompactionStats, x as CompactionStrategy, R as ResolvedCompactionConfig, y as CompactionContext, z as CompactionResult, B as MessageContent, G as GadgetMediaOutput, H as HintTemplate, S as StreamEvent, T as TokenUsage, D as GadgetRegistry, E as MediaStore, F as AgentContextConfig, J as SubagentConfigMap, K as SubagentEvent, N as ExecutionTree, O as NodeId, b as LLMStreamChunk, P as ExecutionContext, Q as GadgetExecuteReturn, U as GadgetExample, A as AbstractGadget, V as ParsedGadgetCall, W as GadgetExecutionResult, X as MediaKind, Y as MediaMetadata, Z as GadgetExecuteResultWithMedia, _ as ProviderAdapter, $ as ModelDescriptor, a0 as ModelSpec, a1 as LLMGenerationOptions, a as LLMStream, a2 as ImageModelSpec, a3 as ImageGenerationOptions, a4 as ImageGenerationResult, a5 as SpeechModelSpec, a6 as SpeechGenerationOptions, a7 as SpeechGenerationResult } from './mock-stream-Cq1Sxezz.cjs';
4
- export { aK as AddGadgetParams, aL as AddLLMCallParams, ag as AfterGadgetExecutionAction, ah as AfterGadgetExecutionControllerContext, ai as AfterLLMCallAction, aj as AfterLLMCallControllerContext, ak as AfterLLMErrorAction, ab as AgentBuilder, al as AgentOptions, bh as AudioContentPart, bi as AudioMimeType, bj as AudioSource, aT as BaseExecutionEvent, am as BeforeGadgetExecutionAction, an as BeforeLLMCallAction, ao as ChunkInterceptorContext, aM as CompleteGadgetParams, aN as CompleteLLMCallParams, bk as ContentPart, ap as Controllers, bJ as CostEstimate, c3 as CostReportingLLMist, aH as DEFAULT_COMPACTION_CONFIG, bV as DEFAULT_HINTS, bW as DEFAULT_PROMPTS, aI as DEFAULT_SUMMARIZATION_PROMPT, ac as EventHandlers, aV as ExecutionEvent, aW as ExecutionEventType, aO as ExecutionNode, aP as ExecutionNodeType, aX as GadgetCallEvent, c1 as GadgetClass, aY as GadgetCompleteEvent, aZ as GadgetErrorEvent, a_ as GadgetEvent, c4 as GadgetExecuteResult, aq as GadgetExecutionControllerContext, aQ as GadgetNode, c2 as GadgetOrClass, ar as GadgetParameterInterceptorContext, as as GadgetResultInterceptorContext, c5 as GadgetSkippedEvent, b0 as GadgetStartEvent, aR as GadgetState, bR as HintContext, a8 as HistoryMessage, b1 as HumanInputRequiredEvent, bl as ImageBase64Source, bm as ImageContentPart, bn as ImageMimeType, bo as ImageSource, bp as ImageUrlSource, at as Interceptors, b2 as LLMCallCompleteEvent, au as LLMCallControllerContext, b3 as LLMCallErrorEvent, aS as LLMCallNode, b4 as LLMCallStartEvent, b5 as LLMCallStreamEvent, av as LLMErrorControllerContext, b6 as LLMEvent, bH as LLMMessageBuilder, aJ as LLMistOptions, aw as MessageInterceptorContext, bF as MessageRole, ax as MessageTurn, d as MockBuilder, f as MockManager, l as MockMatcher, n as MockMatcherContext, o as MockOptions, M as MockProviderAdapter, p as MockRegistration, q as MockResponse, r as MockStats, bK as ModelFeatures, bQ as ModelIdentifierParser, bL as ModelLimits, bM as ModelPricing, ay as ObserveChunkContext, az as ObserveCompactionContext, aA as ObserveGadgetCompleteContext, aB as ObserveGadgetStartContext, aC as ObserveLLMCallContext, aD as ObserveLLMCompleteContext, aE as ObserveLLMErrorContext, aF as Observers, bS as PromptContext, bT as PromptTemplate, bU as PromptTemplateConfig, bP as ProviderIdentifier, c6 as StoredMedia, b7 as StreamCompleteEvent, aG as SubagentContext, c7 as SubagentStreamEvent, bq as TextContentPart, b8 as TextEvent, b_ as TextGenerationOptions, c8 as TextOnlyAction, c9 as TextOnlyContext, ca as TextOnlyCustomHandler, cb as TextOnlyGadgetConfig, cc as TextOnlyHandler, cd as TextOnlyStrategy, a9 as TrailingMessage, aa as TrailingMessageContext, aU as TreeCompactionEvent, a$ as TreeGadgetSkippedEvent, bN as VisionAnalyzeOptions, bO as VisionAnalyzeResult, br as audioFromBase64, bs as audioFromBuffer, ad as collectEvents, ae as collectText, b$ as complete, c as createMockAdapter, e as createMockClient, h as createMockStream, i as createTextMockStream, bt as detectAudioMimeType, bu as detectImageMimeType, bG as extractMessageText, b9 as filterByDepth, ba as filterByParent, bb as filterRootEvents, g as getMockManager, bc as groupByParent, bv as imageFromBase64, bw as imageFromBuffer, bx as imageFromUrl, by as isAudioPart, bz as isDataUrl, bd as isGadgetEvent, bA as isImagePart, be as isLLMEvent, bf as isRootEvent, bg as isSubagentEvent, bB as isTextPart, m as mockLLM, bI as normalizeMessageContent, bC as parseDataUrl, bX as resolveHintTemplate, bY as resolvePromptTemplate, bZ as resolveRulesTemplate, af as runWithHandlers, c0 as stream, bD as text, bE as toBase64 } from './mock-stream-Cq1Sxezz.cjs';
3
+ import { s as AgentHooks, t as ModelRegistry, u as LLMist, C as CompactionConfig, I as IConversationManager, v as CompactionEvent, L as LLMMessage, w as CompactionStats, x as CompactionStrategy, R as ResolvedCompactionConfig, y as CompactionContext, z as CompactionResult, B as MessageContent, G as GadgetMediaOutput, H as HintTemplate, S as StreamEvent, T as TokenUsage, D as GadgetRegistry, E as MediaStore, F as AgentContextConfig, J as SubagentConfigMap, K as SubagentEvent, N as ExecutionTree, O as NodeId, b as LLMStreamChunk, P as ParsedGadgetCall, Q as GadgetExecutionResult, A as AbstractGadget, U as MediaKind, V as MediaMetadata, W as GadgetExecuteResultWithMedia, X as ExecutionContext, Y as ProviderAdapter, Z as ModelDescriptor, _ as ModelSpec, $ as LLMGenerationOptions, a as LLMStream, a0 as ImageModelSpec, a1 as ImageGenerationOptions, a2 as ImageGenerationResult, a3 as SpeechModelSpec, a4 as SpeechGenerationOptions, a5 as SpeechGenerationResult, a6 as HostExports } from './mock-stream-DG4wF-NH.cjs';
4
+ export { aJ as AddGadgetParams, aK as AddLLMCallParams, af as AfterGadgetExecutionAction, ag as AfterGadgetExecutionControllerContext, ah as AfterLLMCallAction, ai as AfterLLMCallControllerContext, aj as AfterLLMErrorAction, aa as AgentBuilder, ak as AgentOptions, bg as AudioContentPart, bh as AudioMimeType, bi as AudioSource, aS as BaseExecutionEvent, al as BeforeGadgetExecutionAction, am as BeforeLLMCallAction, an as ChunkInterceptorContext, aL as CompleteGadgetParams, aM as CompleteLLMCallParams, bj as ContentPart, ao as Controllers, bI as CostEstimate, c6 as CostReportingLLMist, c0 as CreateGadgetConfig, aG as DEFAULT_COMPACTION_CONFIG, bU as DEFAULT_HINTS, bV as DEFAULT_PROMPTS, aH as DEFAULT_SUMMARIZATION_PROMPT, ab as EventHandlers, aU as ExecutionEvent, aV as ExecutionEventType, aN as ExecutionNode, aO as ExecutionNodeType, c5 as Gadget, aW as GadgetCallEvent, c2 as GadgetClass, aX as GadgetCompleteEvent, c4 as GadgetConfig, aY as GadgetErrorEvent, aZ as GadgetEvent, c7 as GadgetExample, c8 as GadgetExecuteResult, c9 as GadgetExecuteReturn, ap as GadgetExecutionControllerContext, aP as GadgetNode, c3 as GadgetOrClass, aq as GadgetParameterInterceptorContext, ar as GadgetResultInterceptorContext, ca as GadgetSkippedEvent, a$ as GadgetStartEvent, aQ as GadgetState, bQ as HintContext, a7 as HistoryMessage, b0 as HumanInputRequiredEvent, bk as ImageBase64Source, bl as ImageContentPart, bm as ImageMimeType, bn as ImageSource, bo as ImageUrlSource, as as Interceptors, b1 as LLMCallCompleteEvent, at as LLMCallControllerContext, b2 as LLMCallErrorEvent, aR as LLMCallNode, b3 as LLMCallStartEvent, b4 as LLMCallStreamEvent, au as LLMErrorControllerContext, b5 as LLMEvent, bG as LLMMessageBuilder, aI as LLMistOptions, av as MessageInterceptorContext, bE as MessageRole, aw as MessageTurn, d as MockBuilder, f as MockManager, l as MockMatcher, n as MockMatcherContext, o as MockOptions, M as MockProviderAdapter, p as MockRegistration, q as MockResponse, r as MockStats, bJ as ModelFeatures, bP as ModelIdentifierParser, bK as ModelLimits, bL as ModelPricing, ax as ObserveChunkContext, ay as ObserveCompactionContext, az as ObserveGadgetCompleteContext, aA as ObserveGadgetStartContext, aB as ObserveLLMCallContext, aC as ObserveLLMCompleteContext, aD as ObserveLLMErrorContext, aE as Observers, bR as PromptContext, bS as PromptTemplate, bT as PromptTemplateConfig, bO as ProviderIdentifier, cb as StoredMedia, b6 as StreamCompleteEvent, aF as SubagentContext, cc as SubagentStreamEvent, bp as TextContentPart, b7 as TextEvent, bZ as TextGenerationOptions, cd as TextOnlyAction, ce as TextOnlyContext, cf as TextOnlyCustomHandler, cg as TextOnlyGadgetConfig, ch as TextOnlyHandler, ci as TextOnlyStrategy, a8 as TrailingMessage, a9 as TrailingMessageContext, aT as TreeCompactionEvent, a_ as TreeGadgetSkippedEvent, bM as VisionAnalyzeOptions, bN as VisionAnalyzeResult, bq as audioFromBase64, br as audioFromBuffer, ac as collectEvents, ad as collectText, b_ as complete, c1 as createGadget, c as createMockAdapter, e as createMockClient, h as createMockStream, i as createTextMockStream, bs as detectAudioMimeType, bt as detectImageMimeType, bF as extractMessageText, b8 as filterByDepth, b9 as filterByParent, ba as filterRootEvents, g as getMockManager, bb as groupByParent, bu as imageFromBase64, bv as imageFromBuffer, bw as imageFromUrl, bx as isAudioPart, by as isDataUrl, bc as isGadgetEvent, bz as isImagePart, bd as isLLMEvent, be as isRootEvent, bf as isSubagentEvent, bA as isTextPart, m as mockLLM, bH as normalizeMessageContent, bB as parseDataUrl, bW as resolveHintTemplate, bX as resolvePromptTemplate, bY as resolveRulesTemplate, ae as runWithHandlers, b$ as stream, bC as text, bD as toBase64 } from './mock-stream-DG4wF-NH.cjs';
5
5
  import { Logger, ILogObj } from 'tslog';
6
6
  import { MessageCreateParamsStreaming, MessageStreamEvent } from '@anthropic-ai/sdk/resources/messages';
7
7
  import OpenAI from 'openai';
@@ -1473,116 +1473,6 @@ declare function getProvider(model: string): string | undefined;
1473
1473
  */
1474
1474
  declare function getModelId(model: string): string;
1475
1475
 
1476
- /**
1477
- * Function-based gadget creation helper.
1478
- *
1479
- * For simple gadgets, use createGadget() instead of defining a class.
1480
- * Parameters are automatically typed from the Zod schema.
1481
- *
1482
- * @example
1483
- * ```typescript
1484
- * const calculator = createGadget({
1485
- * description: "Performs arithmetic operations",
1486
- * schema: z.object({
1487
- * operation: z.enum(["add", "subtract"]),
1488
- * a: z.number(),
1489
- * b: z.number(),
1490
- * }),
1491
- * execute: ({ operation, a, b }) => {
1492
- * // Automatically typed!
1493
- * return operation === "add" ? String(a + b) : String(a - b);
1494
- * },
1495
- * });
1496
- * ```
1497
- */
1498
-
1499
- /**
1500
- * Infer the TypeScript type from a Zod schema.
1501
- */
1502
- type InferSchema$1<T> = T extends ZodType<infer U> ? U : never;
1503
- /**
1504
- * Configuration for creating a function-based gadget.
1505
- */
1506
- interface CreateGadgetConfig<TSchema extends ZodType> {
1507
- /** Optional custom name (defaults to "FunctionGadget") */
1508
- name?: string;
1509
- /** Human-readable description of what the gadget does */
1510
- description: string;
1511
- /** Zod schema for parameter validation */
1512
- schema: TSchema;
1513
- /**
1514
- * Execution function with typed parameters.
1515
- * Can return string or { result, cost? }.
1516
- * Optionally receives ExecutionContext for callback-based cost reporting.
1517
- */
1518
- execute: (params: InferSchema$1<TSchema>, ctx?: ExecutionContext) => GadgetExecuteReturn | Promise<GadgetExecuteReturn>;
1519
- /** Optional timeout in milliseconds */
1520
- timeoutMs?: number;
1521
- /** Optional usage examples to help LLMs understand proper invocation */
1522
- examples?: GadgetExample<InferSchema$1<TSchema>>[];
1523
- }
1524
- /**
1525
- * Creates a gadget from a function (simpler than class-based approach).
1526
- *
1527
- * This is perfect for simple gadgets where you don't need the full
1528
- * power of a class. Parameters are automatically typed from the schema.
1529
- *
1530
- * @param config - Configuration with execute function and schema
1531
- * @returns Gadget instance ready to be registered
1532
- *
1533
- * @example
1534
- * ```typescript
1535
- * import { z } from 'zod';
1536
- * import { createGadget } from 'llmist';
1537
- *
1538
- * // Simple calculator gadget
1539
- * const calculator = createGadget({
1540
- * description: "Performs arithmetic operations",
1541
- * schema: z.object({
1542
- * operation: z.enum(["add", "subtract", "multiply", "divide"]),
1543
- * a: z.number().describe("First number"),
1544
- * b: z.number().describe("Second number"),
1545
- * }),
1546
- * execute: ({ operation, a, b }) => {
1547
- * // Parameters are automatically typed!
1548
- * switch (operation) {
1549
- * case "add": return String(a + b);
1550
- * case "subtract": return String(a - b);
1551
- * case "multiply": return String(a * b);
1552
- * case "divide": return String(a / b);
1553
- * }
1554
- * },
1555
- * });
1556
- * ```
1557
- *
1558
- * @example
1559
- * ```typescript
1560
- * // Async gadget with custom name and timeout
1561
- * const weather = createGadget({
1562
- * name: "weather",
1563
- * description: "Fetches current weather for a city",
1564
- * schema: z.object({
1565
- * city: z.string().min(1).describe("City name"),
1566
- * }),
1567
- * timeoutMs: 10000,
1568
- * execute: async ({ city }) => {
1569
- * const response = await fetch(`https://api.weather.com/${city}`);
1570
- * const data = await response.json();
1571
- * return `Weather in ${city}: ${data.description}, ${data.temp}°C`;
1572
- * },
1573
- * });
1574
- * ```
1575
- *
1576
- * @example
1577
- * ```typescript
1578
- * // Use with agent
1579
- * const agent = LLMist.createAgent()
1580
- * .withGadgets(calculator, weather)
1581
- * .ask("What's the weather in Paris and what's 10 + 5?");
1582
- * ```
1583
- */
1584
- declare function createGadget<TSchema extends ZodType>(config: CreateGadgetConfig<TSchema>): AbstractGadget;
1585
-
1586
1476
  /**
1587
1477
  * Signal that a gadget throws to indicate task completion and agent termination.
1588
1478
  *
@@ -1825,161 +1715,6 @@ declare class GadgetCallParser {
1825
1715
  reset(): void;
1826
1716
  }
1827
1717
 
1828
- /**
1829
- * Type-safe gadget factory with automatic parameter inference.
1830
- *
1831
- * Gadget eliminates the need for manual type assertions
1832
- * by automatically inferring parameter types from the Zod schema.
1833
- *
1834
- * @example
1835
- * ```typescript
1836
- * class Calculator extends Gadget({
1837
- * description: "Performs arithmetic operations",
1838
- * schema: z.object({
1839
- * operation: z.enum(["add", "subtract"]),
1840
- * a: z.number(),
1841
- * b: z.number(),
1842
- * }),
1843
- * }) {
1844
- * // ✨ params is automatically typed!
1845
- * execute(params: this['params']): string {
1846
- * const { operation, a, b } = params; // All typed!
1847
- * return operation === "add" ? String(a + b) : String(a - b);
1848
- * }
1849
- * }
1850
- * ```
1851
- */
1852
-
1853
- /**
1854
- * Infer the TypeScript type from a Zod schema.
1855
- */
1856
- type InferSchema<T> = T extends ZodType<infer U> ? U : never;
1857
- /**
1858
- * Configuration for creating a typed gadget.
1859
- */
1860
- interface GadgetConfig<TSchema extends ZodType> {
1861
- /** Human-readable description of what the gadget does */
1862
- description: string;
1863
- /** Zod schema for parameter validation */
1864
- schema: TSchema;
1865
- /** Optional custom name (defaults to class name) */
1866
- name?: string;
1867
- /** Optional timeout in milliseconds */
1868
- timeoutMs?: number;
1869
- /** Optional usage examples to help LLMs understand proper invocation */
1870
- examples?: GadgetExample<InferSchema<TSchema>>[];
1871
- }
1872
- /**
1873
- * Factory function to create a typed gadget base class.
1874
- *
1875
- * The returned class automatically infers parameter types from the Zod schema,
1876
- * eliminating the need for manual type assertions in the execute method.
1877
- *
1878
- * @param config - Configuration with description and schema
1879
- * @returns Base class to extend with typed execute method
1880
- *
1881
- * @example
1882
- * ```typescript
1883
- * import { z } from 'zod';
1884
- * import { Gadget } from 'llmist';
1885
- *
1886
- * class Calculator extends Gadget({
1887
- * description: "Performs arithmetic operations",
1888
- * schema: z.object({
1889
- * operation: z.enum(["add", "subtract", "multiply", "divide"]),
1890
- * a: z.number().describe("First number"),
1891
- * b: z.number().describe("Second number"),
1892
- * }),
1893
- * }) {
1894
- * execute(params: this['params']): string {
1895
- * // params is automatically typed as:
1896
- * // { operation: "add" | "subtract" | "multiply" | "divide"; a: number; b: number }
1897
- * const { operation, a, b } = params;
1898
- *
1899
- * switch (operation) {
1900
- * case "add": return String(a + b);
1901
- * case "subtract": return String(a - b);
1902
- * case "multiply": return String(a * b);
1903
- * case "divide": return String(a / b);
1904
- * }
1905
- * }
1906
- * }
1907
- * ```
1908
- *
1909
- * @example
1910
- * ```typescript
1911
- * // With async execution
1912
- * class WeatherGadget extends Gadget({
1913
- * description: "Fetches weather for a city",
1914
- * schema: z.object({
1915
- * city: z.string().min(1).describe("City name"),
1916
- * }),
1917
- * timeoutMs: 10000,
1918
- * }) {
1919
- * async execute(params: this['params']): Promise<string> {
1920
- * const { city } = params; // Automatically typed as { city: string }
1921
- * const weather = await fetchWeather(city);
1922
- * return `Weather in ${city}: ${weather}`;
1923
- * }
1924
- * }
1925
- * ```
1926
- */
1927
- declare function Gadget<TSchema extends ZodType>(config: GadgetConfig<TSchema>): {
1928
- new (): {
1929
- description: string;
1930
- parameterSchema: TSchema;
1931
- name: string | undefined;
1932
- timeoutMs: number | undefined;
1933
- examples: GadgetExample<InferSchema<TSchema>>[] | undefined;
1934
- /**
1935
- * Type helper property for accessing inferred parameter type.
1936
- * This is used in the execute method signature: `execute(params: this['params'])`
1937
- *
1938
- * Note: This is just for type inference - the actual params in execute()
1939
- * will be Record<string, unknown> which you can safely cast to this['params']
1940
- */
1941
- readonly params: InferSchema<TSchema>;
1942
- /**
1943
- * Execute the gadget. Subclasses should cast params to this['params'].
1944
- *
1945
- * @param params - Validated parameters from the LLM
1946
- * @param ctx - Optional execution context for cost reporting and LLM access
1947
- * @returns Result as a string, or an object with result and optional cost
1948
- *
1949
- * @example
1950
- * ```typescript
1951
- * // Simple string return (free gadget)
1952
- * execute(params: this['params']) {
1953
- * return String(params.a + params.b);
1954
- * }
1955
- *
1956
- * // Using context for callback-based cost reporting
1957
- * execute(params: this['params'], ctx) {
1958
- * ctx.reportCost(0.001);
1959
- * return "result";
1960
- * }
1961
- *
1962
- * // Using wrapped LLMist for automatic cost tracking
1963
- * async execute(params: this['params'], ctx) {
1964
- * return ctx.llmist.complete('Summarize: ' + params.text);
1965
- * }
1966
- * ```
1967
- */
1968
- execute(params: Record<string, unknown>, ctx?: ExecutionContext): GadgetExecuteReturn | Promise<GadgetExecuteReturn>;
1969
- throwIfAborted(ctx?: ExecutionContext): void;
1970
- onAbort(ctx: ExecutionContext | undefined, cleanup: () => void | Promise<void>): void;
1971
- createLinkedAbortController(ctx?: ExecutionContext): AbortController;
1972
- get instruction(): string;
1973
- getInstruction(optionsOrArgPrefix?: string | {
1974
- argPrefix?: string;
1975
- startPrefix?: string;
1976
- endPrefix?: string;
1977
- }): string;
1978
- } & {
1979
- params: InferSchema<TSchema>;
1980
- };
1981
- };
1982
-
1983
1718
  /**
1984
1719
  * Helper functions for gadget authors to easily return media outputs.
1985
1720
  *
@@ -2720,4 +2455,43 @@ declare class OpenAIChatProvider extends BaseProviderAdapter {
2720
2455
  }
2721
2456
  declare function createOpenAIProviderFromEnv(): OpenAIChatProvider | null;
2722
2457
 
2723
- export { AbortException, AbstractGadget, AgentHooks, AnthropicMessagesProvider, CompactionConfig, CompactionContext, CompactionEvent, CompactionManager, CompactionResult, CompactionStats, CompactionStrategy, ConversationManager, type CreateGadgetConfig, ExecutionContext, ExecutionTree, Gadget, GadgetCallParser, type GadgetConfig, GadgetExample, GadgetExecuteResultWithMedia, GadgetExecuteReturn, GadgetExecutionResult, GadgetExecutor, GadgetMediaOutput, GadgetOutputStore, GadgetRegistry, GeminiGenerativeProvider, HintTemplate, type HintsConfig, HookPresets, HumanInputRequiredException, HybridStrategy, IConversationManager, type IterationHintOptions, LLMGenerationOptions, LLMMessage, LLMStream, LLMStreamChunk, LLMist, type LoggerOptions, type LoggingOptions, MODEL_ALIASES, MediaKind, MediaMetadata, MediaStore, MessageContent, ModelDescriptor, ModelRegistry, ModelSpec, NodeId, OpenAIChatProvider, type ParallelGadgetHintOptions, ParsedGadgetCall, ProviderAdapter, type ResolveValueOptions, ResolvedCompactionConfig, SlidingWindowStrategy, type StoredOutput, StreamEvent, type StreamProcessingResult, StreamProcessor, type StreamProcessorOptions, SubagentEvent, SummarizationStrategy, TaskCompletionSignal, TimeoutException, TokenUsage, type ValidationIssue, type ValidationResult, createAnthropicProviderFromEnv, createGadget, createGadgetOutputViewer, createGeminiProviderFromEnv, createHints, createLogger, createMediaOutput, createOpenAIProviderFromEnv, defaultLogger, discoverProviderAdapters, getModelId, getProvider, hasProviderPrefix, iterationProgressHint, parallelGadgetHint, resolveConfig, resolveModel, resolveSubagentModel, resolveValue, resultWithAudio, resultWithFile, resultWithImage, resultWithImages, resultWithMedia, validateAndApplyDefaults, validateGadgetParams };
2458
+ /**
2459
+ * Get host llmist exports from execution context.
2460
+ *
2461
+ * External gadgets MUST use this instead of importing classes directly from 'llmist'
2462
+ * to ensure they use the same version as the host CLI, enabling proper tree sharing
2463
+ * and avoiding the "dual-package problem".
2464
+ *
2465
+ * @param ctx - The execution context passed to gadget.execute()
2466
+ * @returns The host's llmist exports (AgentBuilder, Gadget, etc.)
2467
+ * @throws Error if ctx or ctx.hostExports is undefined
2468
+ *
2469
+ * @example
2470
+ * ```typescript
2471
+ * import { getHostExports, Gadget, z } from 'llmist';
2472
+ * import type { ExecutionContext } from 'llmist';
2473
+ *
2474
+ * class BrowseWeb extends Gadget({
2475
+ * name: 'BrowseWeb',
2476
+ * description: 'Browse a website autonomously',
2477
+ * schema: z.object({ task: z.string(), url: z.string() }),
2478
+ * }) {
2479
+ * async execute(params: this['params'], ctx?: ExecutionContext) {
2480
+ * // Get host's AgentBuilder to ensure tree sharing works correctly
2481
+ * const { AgentBuilder } = getHostExports(ctx!);
2482
+ *
2483
+ * const agent = new AgentBuilder()
2484
+ * .withParentContext(ctx!)
2485
+ * .withGadgets(Navigate, Click, Screenshot)
2486
+ * .ask(params.task);
2487
+ *
2488
+ * for await (const event of agent.run()) {
2489
+ * // Events flow through host's shared tree
2490
+ * }
2491
+ * }
2492
+ * }
2493
+ * ```
2494
+ */
2495
+ declare function getHostExports(ctx: ExecutionContext): HostExports;
2496
+
2497
+ export { AbortException, AbstractGadget, AgentHooks, AnthropicMessagesProvider, CompactionConfig, CompactionContext, CompactionEvent, CompactionManager, CompactionResult, CompactionStats, CompactionStrategy, ConversationManager, ExecutionContext, ExecutionTree, GadgetCallParser, GadgetExecuteResultWithMedia, GadgetExecutionResult, GadgetExecutor, GadgetMediaOutput, GadgetOutputStore, GadgetRegistry, GeminiGenerativeProvider, HintTemplate, type HintsConfig, HookPresets, HostExports, HumanInputRequiredException, HybridStrategy, IConversationManager, type IterationHintOptions, LLMGenerationOptions, LLMMessage, LLMStream, LLMStreamChunk, LLMist, type LoggerOptions, type LoggingOptions, MODEL_ALIASES, MediaKind, MediaMetadata, MediaStore, MessageContent, ModelDescriptor, ModelRegistry, ModelSpec, NodeId, OpenAIChatProvider, type ParallelGadgetHintOptions, ParsedGadgetCall, ProviderAdapter, type ResolveValueOptions, ResolvedCompactionConfig, SlidingWindowStrategy, type StoredOutput, StreamEvent, type StreamProcessingResult, StreamProcessor, type StreamProcessorOptions, SubagentEvent, SummarizationStrategy, TaskCompletionSignal, TimeoutException, TokenUsage, type ValidationIssue, type ValidationResult, createAnthropicProviderFromEnv, createGadgetOutputViewer, createGeminiProviderFromEnv, createHints, createLogger, createMediaOutput, createOpenAIProviderFromEnv, defaultLogger, discoverProviderAdapters, getHostExports, getModelId, getProvider, hasProviderPrefix, iterationProgressHint, parallelGadgetHint, resolveConfig, resolveModel, resolveSubagentModel, resolveValue, resultWithAudio, resultWithFile, resultWithImage, resultWithImages, resultWithMedia, validateAndApplyDefaults, validateGadgetParams };