llmist 16.2.3 → 16.2.5

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
@@ -1896,7 +1896,7 @@ interface Observers {
1896
1896
  onRateLimitThrottle?: (context: ObserveRateLimitThrottleContext) => void | Promise<void>;
1897
1897
  /** Called when a retry attempt is made after a failed LLM call */
1898
1898
  onRetryAttempt?: (context: ObserveRetryAttemptContext) => void | Promise<void>;
1899
- /** Called when a skill is activated (via UseSkill gadget or pre-activation) */
1899
+ /** Called when a skill is activated (via LoadSkill gadget or pre-activation) */
1900
1900
  onSkillActivated?: (context: ObserveSkillActivatedContext) => void | Promise<void>;
1901
1901
  }
1902
1902
  /**
@@ -7328,11 +7328,14 @@ declare class CompactionManager {
7328
7328
  private readonly model;
7329
7329
  private readonly config;
7330
7330
  private readonly strategy;
7331
+ private readonly logger;
7331
7332
  private modelLimits?;
7333
+ private hasWarnedModelNotFound;
7334
+ private hasWarnedNoTokenCounting;
7332
7335
  private totalCompactions;
7333
7336
  private totalTokensSaved;
7334
7337
  private lastTokenCount;
7335
- constructor(client: LLMist, model: string, config?: CompactionConfig);
7338
+ constructor(client: LLMist, model: string, config?: CompactionConfig, logger?: Logger<ILogObj>);
7336
7339
  /**
7337
7340
  * Check if compaction is needed and perform it if so.
7338
7341
  *
@@ -7350,6 +7353,22 @@ declare class CompactionManager {
7350
7353
  * @returns CompactionEvent with compaction details
7351
7354
  */
7352
7355
  compact(conversation: IConversationManager, iteration: number, precomputed?: PrecomputedTokens): Promise<CompactionEvent | null>;
7356
+ /**
7357
+ * Feed API-reported input token count for reactive threshold checking.
7358
+ * Call this after each LLM response with the actual inputTokens from usage.
7359
+ */
7360
+ updateUsage(inputTokens: number): void;
7361
+ /**
7362
+ * Check if compaction should trigger based on API-reported usage.
7363
+ * Unlike checkAndCompact() which uses estimated token counts,
7364
+ * this uses the ground-truth token count from the last LLM response.
7365
+ */
7366
+ shouldCompactFromUsage(): boolean;
7367
+ /**
7368
+ * Resolve and cache model limits from registry. Warns once if not found.
7369
+ * @returns true if limits are available, false otherwise
7370
+ */
7371
+ private resolveModelLimits;
7353
7372
  /**
7354
7373
  * Get compaction statistics.
7355
7374
  */
@@ -8613,20 +8632,16 @@ declare class GadgetCallParser {
8613
8632
  /**
8614
8633
  * Character-to-token ratio for fallback token estimation.
8615
8634
  *
8616
- * Rationale: When native token counting APIs fail, we estimate tokens using
8617
- * a rough heuristic of 4 characters per token. This is based on empirical
8618
- * observations across multiple LLM providers:
8619
- * - OpenAI's GPT models average ~4 chars/token for English text
8620
- * - Anthropic's Claude models have similar characteristics
8621
- * - Gemini models also approximate this ratio
8622
- *
8623
- * This is intentionally conservative to avoid underestimating token usage.
8624
- * While not perfectly accurate, it provides a reasonable fallback when
8625
- * precise tokenization is unavailable.
8635
+ * Used only when tiktoken (the primary fallback) is unavailable. A value of 2
8636
+ * errs on the side of overestimating token count, which is safer for
8637
+ * compaction triggers and output limiting.
8626
8638
  *
8627
- * Reference: https://help.openai.com/en/articles/4936856-what-are-tokens-and-how-to-count-them
8639
+ * Rationale: The previous value of 4 was based on English prose averages, but
8640
+ * agentic sessions are dominated by JSON, code, and structured data where the
8641
+ * real ratio is ~1.5-2.5 chars/token. A 4-char estimate underestimated tokens
8642
+ * by up to 250%, causing compaction and output limiting to never trigger.
8628
8643
  */
8629
- declare const FALLBACK_CHARS_PER_TOKEN = 4;
8644
+ declare const FALLBACK_CHARS_PER_TOKEN = 2;
8630
8645
 
8631
8646
  /**
8632
8647
  * Subagent creation helper for gadget authors.
@@ -9554,8 +9569,14 @@ declare abstract class OpenAICompatibleProvider<TConfig extends OpenAICompatible
9554
9569
  protected executeStreamRequest(payload: Parameters<OpenAI["chat"]["completions"]["create"]>[0], signal?: AbortSignal): Promise<AsyncIterable<ChatCompletionChunk>>;
9555
9570
  protected normalizeProviderStream(iterable: AsyncIterable<unknown>): LLMStream;
9556
9571
  /**
9557
- * Count tokens using character-based fallback estimation.
9558
- * Most meta-providers don't have a native token counting API.
9572
+ * Count tokens using tiktoken o200k_base encoding.
9573
+ *
9574
+ * While o200k_base isn't model-exact for non-OpenAI models routed through
9575
+ * meta-providers like OpenRouter, BPE tokenizers with 200K vocab produce
9576
+ * counts within 10-20% of true values — far better than the character-based
9577
+ * fallback which can be off by 250% for JSON/code-heavy content.
9578
+ *
9579
+ * Falls back to character-based estimation if tiktoken fails.
9559
9580
  */
9560
9581
  countTokens(messages: LLMMessage[], descriptor: ModelDescriptor, _spec?: ModelSpec): Promise<number>;
9561
9582
  }
@@ -10047,6 +10068,28 @@ declare function resolveInstructions(instructions: string, options?: {
10047
10068
  enableShellPreprocessing?: boolean;
10048
10069
  }): string;
10049
10070
 
10071
+ /**
10072
+ * LoadSkill meta-gadget — bridges the skill system into the gadget execution pipeline.
10073
+ *
10074
+ * When skills are registered with an agent, this gadget is auto-created and added
10075
+ * to the gadget registry. The LLM can invoke it like any other gadget, and the
10076
+ * skill's instructions are returned as the gadget result.
10077
+ *
10078
+ * This approach requires zero changes to the stream processor or agent loop.
10079
+ *
10080
+ * @module skills/load-skill-gadget
10081
+ */
10082
+
10083
+ /** Name for the auto-generated LoadSkill gadget. */
10084
+ declare const LOAD_SKILL_GADGET_NAME = "LoadSkill";
10085
+ /**
10086
+ * Create the LoadSkill meta-gadget from a skill registry.
10087
+ *
10088
+ * The gadget description includes a summary of all available skills,
10089
+ * so the LLM knows what skills exist and when to load them.
10090
+ */
10091
+ declare function createLoadSkillGadget(registry: SkillRegistry): AbstractGadget;
10092
+
10050
10093
  /**
10051
10094
  * Filesystem-based skill discovery and loading.
10052
10095
  *
@@ -10133,28 +10176,6 @@ declare function parseSkillContent(content: string, sourcePath: string, source:
10133
10176
  */
10134
10177
  declare function validateMetadata(metadata: SkillMetadata): string[];
10135
10178
 
10136
- /**
10137
- * UseSkill meta-gadget — bridges the skill system into the gadget execution pipeline.
10138
- *
10139
- * When skills are registered with an agent, this gadget is auto-created and added
10140
- * to the gadget registry. The LLM can invoke it like any other gadget, and the
10141
- * skill's instructions are returned as the gadget result.
10142
- *
10143
- * This approach requires zero changes to the stream processor or agent loop.
10144
- *
10145
- * @module skills/use-skill-gadget
10146
- */
10147
-
10148
- /** Name for the auto-generated UseSkill gadget. */
10149
- declare const USE_SKILL_GADGET_NAME = "UseSkill";
10150
- /**
10151
- * Create the UseSkill meta-gadget from a skill registry.
10152
- *
10153
- * The gadget description includes a summary of all available skills,
10154
- * so the LLM knows what skills exist and when to use them.
10155
- */
10156
- declare function createUseSkillGadget(registry: SkillRegistry): AbstractGadget;
10157
-
10158
10179
  /**
10159
10180
  * Config resolution utility for subagent gadgets.
10160
10181
  *
@@ -10584,4 +10605,4 @@ declare const timing: {
10584
10605
  */
10585
10606
  declare function getHostExports(ctx: ExecutionContext): HostExports;
10586
10607
 
10587
- 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, DEFAULT_COMPACTION_CONFIG, DEFAULT_HINTS, 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, 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 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, type LoggerOptions, type LoggingOptions, MODEL_ALIASES, 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 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, USE_SKILL_GADGET_NAME, type ValidationIssue, type ValidationResult, type VisionAnalyzeOptions, type VisionAnalyzeResult, audioFromBase64, audioFromBuffer, collectEvents, collectText, complete, createAnthropicProviderFromEnv, createFileLoggingState, createGadget, createGadgetOutputViewer, createGeminiProviderFromEnv, createHints, createHuggingFaceProviderFromEnv, createLogger, createMediaOutput, createOpenAIProviderFromEnv, createOpenRouterProviderFromEnv, createSubagent, createUseSkillGadget, defaultLogger, detectAudioMimeType, detectImageMimeType, discoverProviderAdapters, discoverSkills, extractMessageText, extractRetryAfterMs, filterByDepth, filterByParent, filterRootEvents, format, formatBytes, formatCallNumber, formatDate, formatDuration, formatLLMError, formatLlmRequest, gadgetError, gadgetSuccess, 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, listPresets, listSubagents, loadSkillsFromDirectory, normalizeMessageContent, parallelGadgetHint, parseDataUrl, parseFrontmatter, parseManifest, parseMetadata, parseRetryAfterHeader, parseSkillContent, parseSkillFile, randomDelay, resetFileLoggingState, resolveConfig, resolveHintTemplate, resolveInstructions, resolveModel, resolvePromptTemplate, resolveRateLimitConfig, resolveRetryConfig, resolveRulesTemplate, resolveSubagentModel, resolveSubagentTimeout, resolveValue, resultWithAudio, resultWithFile, resultWithImage, resultWithImages, resultWithMedia, runWithHandlers, scanResources, schemaToJSONSchema, stream, stripProviderPrefix, substituteArguments, substituteVariables, text, timing, toBase64, truncate, validateAndApplyDefaults, validateGadgetParams, validateGadgetSchema, validateMetadata, withErrorHandling, withRetry, withTimeout };
10608
+ 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, DEFAULT_COMPACTION_CONFIG, DEFAULT_HINTS, 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, 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 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, 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 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, audioFromBase64, audioFromBuffer, collectEvents, collectText, complete, createAnthropicProviderFromEnv, createFileLoggingState, createGadget, createGadgetOutputViewer, createGeminiProviderFromEnv, createHints, createHuggingFaceProviderFromEnv, createLoadSkillGadget, createLogger, createMediaOutput, createOpenAIProviderFromEnv, createOpenRouterProviderFromEnv, createSubagent, defaultLogger, detectAudioMimeType, detectImageMimeType, discoverProviderAdapters, discoverSkills, extractMessageText, extractRetryAfterMs, filterByDepth, filterByParent, filterRootEvents, format, formatBytes, formatCallNumber, formatDate, formatDuration, formatLLMError, formatLlmRequest, gadgetError, gadgetSuccess, 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, listPresets, listSubagents, loadSkillsFromDirectory, normalizeMessageContent, parallelGadgetHint, parseDataUrl, parseFrontmatter, parseManifest, parseMetadata, parseRetryAfterHeader, parseSkillContent, parseSkillFile, randomDelay, resetFileLoggingState, resolveConfig, resolveHintTemplate, resolveInstructions, resolveModel, resolvePromptTemplate, resolveRateLimitConfig, resolveRetryConfig, resolveRulesTemplate, resolveSubagentModel, resolveSubagentTimeout, resolveValue, resultWithAudio, resultWithFile, resultWithImage, resultWithImages, resultWithMedia, runWithHandlers, scanResources, schemaToJSONSchema, stream, stripProviderPrefix, substituteArguments, substituteVariables, text, timing, toBase64, truncate, validateAndApplyDefaults, validateGadgetParams, validateGadgetSchema, validateMetadata, withErrorHandling, withRetry, withTimeout };
package/dist/index.d.ts CHANGED
@@ -1896,7 +1896,7 @@ interface Observers {
1896
1896
  onRateLimitThrottle?: (context: ObserveRateLimitThrottleContext) => void | Promise<void>;
1897
1897
  /** Called when a retry attempt is made after a failed LLM call */
1898
1898
  onRetryAttempt?: (context: ObserveRetryAttemptContext) => void | Promise<void>;
1899
- /** Called when a skill is activated (via UseSkill gadget or pre-activation) */
1899
+ /** Called when a skill is activated (via LoadSkill gadget or pre-activation) */
1900
1900
  onSkillActivated?: (context: ObserveSkillActivatedContext) => void | Promise<void>;
1901
1901
  }
1902
1902
  /**
@@ -7328,11 +7328,14 @@ declare class CompactionManager {
7328
7328
  private readonly model;
7329
7329
  private readonly config;
7330
7330
  private readonly strategy;
7331
+ private readonly logger;
7331
7332
  private modelLimits?;
7333
+ private hasWarnedModelNotFound;
7334
+ private hasWarnedNoTokenCounting;
7332
7335
  private totalCompactions;
7333
7336
  private totalTokensSaved;
7334
7337
  private lastTokenCount;
7335
- constructor(client: LLMist, model: string, config?: CompactionConfig);
7338
+ constructor(client: LLMist, model: string, config?: CompactionConfig, logger?: Logger<ILogObj>);
7336
7339
  /**
7337
7340
  * Check if compaction is needed and perform it if so.
7338
7341
  *
@@ -7350,6 +7353,22 @@ declare class CompactionManager {
7350
7353
  * @returns CompactionEvent with compaction details
7351
7354
  */
7352
7355
  compact(conversation: IConversationManager, iteration: number, precomputed?: PrecomputedTokens): Promise<CompactionEvent | null>;
7356
+ /**
7357
+ * Feed API-reported input token count for reactive threshold checking.
7358
+ * Call this after each LLM response with the actual inputTokens from usage.
7359
+ */
7360
+ updateUsage(inputTokens: number): void;
7361
+ /**
7362
+ * Check if compaction should trigger based on API-reported usage.
7363
+ * Unlike checkAndCompact() which uses estimated token counts,
7364
+ * this uses the ground-truth token count from the last LLM response.
7365
+ */
7366
+ shouldCompactFromUsage(): boolean;
7367
+ /**
7368
+ * Resolve and cache model limits from registry. Warns once if not found.
7369
+ * @returns true if limits are available, false otherwise
7370
+ */
7371
+ private resolveModelLimits;
7353
7372
  /**
7354
7373
  * Get compaction statistics.
7355
7374
  */
@@ -8613,20 +8632,16 @@ declare class GadgetCallParser {
8613
8632
  /**
8614
8633
  * Character-to-token ratio for fallback token estimation.
8615
8634
  *
8616
- * Rationale: When native token counting APIs fail, we estimate tokens using
8617
- * a rough heuristic of 4 characters per token. This is based on empirical
8618
- * observations across multiple LLM providers:
8619
- * - OpenAI's GPT models average ~4 chars/token for English text
8620
- * - Anthropic's Claude models have similar characteristics
8621
- * - Gemini models also approximate this ratio
8622
- *
8623
- * This is intentionally conservative to avoid underestimating token usage.
8624
- * While not perfectly accurate, it provides a reasonable fallback when
8625
- * precise tokenization is unavailable.
8635
+ * Used only when tiktoken (the primary fallback) is unavailable. A value of 2
8636
+ * errs on the side of overestimating token count, which is safer for
8637
+ * compaction triggers and output limiting.
8626
8638
  *
8627
- * Reference: https://help.openai.com/en/articles/4936856-what-are-tokens-and-how-to-count-them
8639
+ * Rationale: The previous value of 4 was based on English prose averages, but
8640
+ * agentic sessions are dominated by JSON, code, and structured data where the
8641
+ * real ratio is ~1.5-2.5 chars/token. A 4-char estimate underestimated tokens
8642
+ * by up to 250%, causing compaction and output limiting to never trigger.
8628
8643
  */
8629
- declare const FALLBACK_CHARS_PER_TOKEN = 4;
8644
+ declare const FALLBACK_CHARS_PER_TOKEN = 2;
8630
8645
 
8631
8646
  /**
8632
8647
  * Subagent creation helper for gadget authors.
@@ -9554,8 +9569,14 @@ declare abstract class OpenAICompatibleProvider<TConfig extends OpenAICompatible
9554
9569
  protected executeStreamRequest(payload: Parameters<OpenAI["chat"]["completions"]["create"]>[0], signal?: AbortSignal): Promise<AsyncIterable<ChatCompletionChunk>>;
9555
9570
  protected normalizeProviderStream(iterable: AsyncIterable<unknown>): LLMStream;
9556
9571
  /**
9557
- * Count tokens using character-based fallback estimation.
9558
- * Most meta-providers don't have a native token counting API.
9572
+ * Count tokens using tiktoken o200k_base encoding.
9573
+ *
9574
+ * While o200k_base isn't model-exact for non-OpenAI models routed through
9575
+ * meta-providers like OpenRouter, BPE tokenizers with 200K vocab produce
9576
+ * counts within 10-20% of true values — far better than the character-based
9577
+ * fallback which can be off by 250% for JSON/code-heavy content.
9578
+ *
9579
+ * Falls back to character-based estimation if tiktoken fails.
9559
9580
  */
9560
9581
  countTokens(messages: LLMMessage[], descriptor: ModelDescriptor, _spec?: ModelSpec): Promise<number>;
9561
9582
  }
@@ -10047,6 +10068,28 @@ declare function resolveInstructions(instructions: string, options?: {
10047
10068
  enableShellPreprocessing?: boolean;
10048
10069
  }): string;
10049
10070
 
10071
+ /**
10072
+ * LoadSkill meta-gadget — bridges the skill system into the gadget execution pipeline.
10073
+ *
10074
+ * When skills are registered with an agent, this gadget is auto-created and added
10075
+ * to the gadget registry. The LLM can invoke it like any other gadget, and the
10076
+ * skill's instructions are returned as the gadget result.
10077
+ *
10078
+ * This approach requires zero changes to the stream processor or agent loop.
10079
+ *
10080
+ * @module skills/load-skill-gadget
10081
+ */
10082
+
10083
+ /** Name for the auto-generated LoadSkill gadget. */
10084
+ declare const LOAD_SKILL_GADGET_NAME = "LoadSkill";
10085
+ /**
10086
+ * Create the LoadSkill meta-gadget from a skill registry.
10087
+ *
10088
+ * The gadget description includes a summary of all available skills,
10089
+ * so the LLM knows what skills exist and when to load them.
10090
+ */
10091
+ declare function createLoadSkillGadget(registry: SkillRegistry): AbstractGadget;
10092
+
10050
10093
  /**
10051
10094
  * Filesystem-based skill discovery and loading.
10052
10095
  *
@@ -10133,28 +10176,6 @@ declare function parseSkillContent(content: string, sourcePath: string, source:
10133
10176
  */
10134
10177
  declare function validateMetadata(metadata: SkillMetadata): string[];
10135
10178
 
10136
- /**
10137
- * UseSkill meta-gadget — bridges the skill system into the gadget execution pipeline.
10138
- *
10139
- * When skills are registered with an agent, this gadget is auto-created and added
10140
- * to the gadget registry. The LLM can invoke it like any other gadget, and the
10141
- * skill's instructions are returned as the gadget result.
10142
- *
10143
- * This approach requires zero changes to the stream processor or agent loop.
10144
- *
10145
- * @module skills/use-skill-gadget
10146
- */
10147
-
10148
- /** Name for the auto-generated UseSkill gadget. */
10149
- declare const USE_SKILL_GADGET_NAME = "UseSkill";
10150
- /**
10151
- * Create the UseSkill meta-gadget from a skill registry.
10152
- *
10153
- * The gadget description includes a summary of all available skills,
10154
- * so the LLM knows what skills exist and when to use them.
10155
- */
10156
- declare function createUseSkillGadget(registry: SkillRegistry): AbstractGadget;
10157
-
10158
10179
  /**
10159
10180
  * Config resolution utility for subagent gadgets.
10160
10181
  *
@@ -10584,4 +10605,4 @@ declare const timing: {
10584
10605
  */
10585
10606
  declare function getHostExports(ctx: ExecutionContext): HostExports;
10586
10607
 
10587
- 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, DEFAULT_COMPACTION_CONFIG, DEFAULT_HINTS, 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, 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 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, type LoggerOptions, type LoggingOptions, MODEL_ALIASES, 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 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, USE_SKILL_GADGET_NAME, type ValidationIssue, type ValidationResult, type VisionAnalyzeOptions, type VisionAnalyzeResult, audioFromBase64, audioFromBuffer, collectEvents, collectText, complete, createAnthropicProviderFromEnv, createFileLoggingState, createGadget, createGadgetOutputViewer, createGeminiProviderFromEnv, createHints, createHuggingFaceProviderFromEnv, createLogger, createMediaOutput, createOpenAIProviderFromEnv, createOpenRouterProviderFromEnv, createSubagent, createUseSkillGadget, defaultLogger, detectAudioMimeType, detectImageMimeType, discoverProviderAdapters, discoverSkills, extractMessageText, extractRetryAfterMs, filterByDepth, filterByParent, filterRootEvents, format, formatBytes, formatCallNumber, formatDate, formatDuration, formatLLMError, formatLlmRequest, gadgetError, gadgetSuccess, 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, listPresets, listSubagents, loadSkillsFromDirectory, normalizeMessageContent, parallelGadgetHint, parseDataUrl, parseFrontmatter, parseManifest, parseMetadata, parseRetryAfterHeader, parseSkillContent, parseSkillFile, randomDelay, resetFileLoggingState, resolveConfig, resolveHintTemplate, resolveInstructions, resolveModel, resolvePromptTemplate, resolveRateLimitConfig, resolveRetryConfig, resolveRulesTemplate, resolveSubagentModel, resolveSubagentTimeout, resolveValue, resultWithAudio, resultWithFile, resultWithImage, resultWithImages, resultWithMedia, runWithHandlers, scanResources, schemaToJSONSchema, stream, stripProviderPrefix, substituteArguments, substituteVariables, text, timing, toBase64, truncate, validateAndApplyDefaults, validateGadgetParams, validateGadgetSchema, validateMetadata, withErrorHandling, withRetry, withTimeout };
10608
+ 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, DEFAULT_COMPACTION_CONFIG, DEFAULT_HINTS, 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, 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 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, 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 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, audioFromBase64, audioFromBuffer, collectEvents, collectText, complete, createAnthropicProviderFromEnv, createFileLoggingState, createGadget, createGadgetOutputViewer, createGeminiProviderFromEnv, createHints, createHuggingFaceProviderFromEnv, createLoadSkillGadget, createLogger, createMediaOutput, createOpenAIProviderFromEnv, createOpenRouterProviderFromEnv, createSubagent, defaultLogger, detectAudioMimeType, detectImageMimeType, discoverProviderAdapters, discoverSkills, extractMessageText, extractRetryAfterMs, filterByDepth, filterByParent, filterRootEvents, format, formatBytes, formatCallNumber, formatDate, formatDuration, formatLLMError, formatLlmRequest, gadgetError, gadgetSuccess, 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, listPresets, listSubagents, loadSkillsFromDirectory, normalizeMessageContent, parallelGadgetHint, parseDataUrl, parseFrontmatter, parseManifest, parseMetadata, parseRetryAfterHeader, parseSkillContent, parseSkillFile, randomDelay, resetFileLoggingState, resolveConfig, resolveHintTemplate, resolveInstructions, resolveModel, resolvePromptTemplate, resolveRateLimitConfig, resolveRetryConfig, resolveRulesTemplate, resolveSubagentModel, resolveSubagentTimeout, resolveValue, resultWithAudio, resultWithFile, resultWithImage, resultWithImages, resultWithMedia, runWithHandlers, scanResources, schemaToJSONSchema, stream, stripProviderPrefix, substituteArguments, substituteVariables, text, timing, toBase64, truncate, validateAndApplyDefaults, validateGadgetParams, validateGadgetSchema, validateMetadata, withErrorHandling, withRetry, withTimeout };