@ax-llm/ax 19.0.27 → 19.0.29

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/index.d.cts CHANGED
@@ -1004,6 +1004,18 @@ interface AxAIServiceImpl<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TCha
1004
1004
  * Returns cache operations to execute and the modified request.
1005
1005
  */
1006
1006
  prepareCachedChatReq?(req: Readonly<AxInternalChatRequest<TModel>>, options: Readonly<AxAIServiceOptions>, existingCacheName?: string): Promise<AxPreparedChatRequest<TChatRequest>>;
1007
+ /**
1008
+ * Optional: Return tool/function-call state that becomes part of the
1009
+ * provider's immutable explicit-cache prefix.
1010
+ *
1011
+ * This is used for cache identity and token estimation when a provider
1012
+ * treats tool state as cached prefix state even if the generic request does
1013
+ * not mark functions with `cache: true`.
1014
+ */
1015
+ getContextCacheToolState?(req: Readonly<AxInternalChatRequest<TModel>>, options: Readonly<AxAIServiceOptions>): {
1016
+ functions?: AxChatRequest['functions'];
1017
+ functionCall?: AxChatRequest['functionCall'];
1018
+ } | undefined;
1007
1019
  /**
1008
1020
  * Optional: Build a context cache creation operation.
1009
1021
  * Called when a new cache needs to be created from the request.
@@ -2942,6 +2954,7 @@ declare class AxGen<IN = any, OUT extends AxGenOut = any> extends AxProgram<IN,
2942
2954
  setInstruction(instruction: string): void;
2943
2955
  getInstruction(): string | undefined;
2944
2956
  clearInstruction(): void;
2957
+ private getEffectiveContextCache;
2945
2958
  private renderPromptWithMetricsForInternalUse;
2946
2959
  private renderPromptForInternalUse;
2947
2960
  /** @internal */
@@ -3172,6 +3185,8 @@ declare class AxPromptTemplate {
3172
3185
  */
3173
3186
  private buildOutputFieldsSection;
3174
3187
  private renderSingleValueUserContent;
3188
+ private formatUserContent;
3189
+ private buildLegacyMultimodalExampleMessage;
3175
3190
  private renderInternal;
3176
3191
  render: <T = any>(values: T | ReadonlyArray<AxMessage<T>>, options: Readonly<{
3177
3192
  skipSystemPrompt?: boolean;
@@ -3753,6 +3768,7 @@ declare class AxBaseAI<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TChatRe
3753
3768
  private corsProxy?;
3754
3769
  private retry?;
3755
3770
  private customLabels?;
3771
+ private contextCache?;
3756
3772
  private modelInfo;
3757
3773
  private modelUsage?;
3758
3774
  private embedModelUsage?;
@@ -3833,6 +3849,7 @@ declare class AxBaseAI<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TChatRe
3833
3849
  * Use an existing cache by name to prepare the chat request.
3834
3850
  */
3835
3851
  private useCacheByName;
3852
+ private getContextCacheToolState;
3836
3853
  /**
3837
3854
  * Execute a context cache operation (create/update/delete).
3838
3855
  */
@@ -10271,8 +10288,12 @@ type AxAgentOptions<IN extends AxGenIn = AxGenIn> = Omit<AxProgramForwardOptions
10271
10288
  maxBatchedLlmQueryConcurrency?: number;
10272
10289
  /** Maximum Actor turns before forcing Responder (default: 10). */
10273
10290
  maxTurns?: number;
10291
+ /** Maximum characters to keep from runtime output and console/log replay. */
10292
+ maxRuntimeChars?: number;
10274
10293
  /** Context replay, checkpointing, and runtime-state policy. */
10275
10294
  contextPolicy?: AxContextPolicyConfig;
10295
+ /** Default options for the internal checkpoint summarizer. */
10296
+ summarizerOptions?: Omit<AxProgramForwardOptions<string>, 'functions'>;
10276
10297
  /** Output field names the Actor should produce (in addition to javascriptCode). */
10277
10298
  actorFields?: string[];
10278
10299
  /**
@@ -10684,7 +10705,7 @@ interface AxCodeSession {
10684
10705
  * replaying their full code blocks. Reliability-first
10685
10706
  * defaults still preserve recent evidence before deleting older low-value steps.
10686
10707
  * Best when token pressure matters more than raw replay detail.
10687
- * - `checkpointed`: Keep full replay until the rendered actor prompt crosses a threshold, then
10708
+ * - `checkpointed`: Keep full replay until the rendered actor prompt grows beyond the selected budget, then
10688
10709
  * replace older successful history with a checkpoint summary while keeping recent
10689
10710
  * actions and unresolved errors fully visible. Best when you want conservative,
10690
10711
  * debugging-friendly replay until prompt pressure becomes real.
@@ -10702,7 +10723,7 @@ interface AxContextPolicyConfig {
10702
10723
  * - `full`: prefer raw replay of earlier actions
10703
10724
  * - `adaptive`: balance replay detail with checkpoint compression while keeping more recent evidence visible
10704
10725
  * - `lean`: prefer live state + compact summaries over raw replay detail
10705
- * - `checkpointed`: keep full replay until the rendered actor prompt crosses a threshold, then replace older successful turns with a checkpoint summary
10726
+ * - `checkpointed`: keep full replay until the rendered actor prompt grows beyond the selected budget, then replace older successful turns with a checkpoint summary
10706
10727
  */
10707
10728
  preset?: AxContextPolicyPreset;
10708
10729
  /** Overall prompt budget and compression aggressiveness. */
@@ -10726,8 +10747,12 @@ interface AxRLMConfig {
10726
10747
  maxBatchedLlmQueryConcurrency?: number;
10727
10748
  /** Maximum Actor turns before forcing Responder (default: 10). */
10728
10749
  maxTurns?: number;
10750
+ /** Maximum characters to keep from runtime output and console/log replay (default: 3000). */
10751
+ maxRuntimeChars?: number;
10729
10752
  /** Context replay, checkpointing, and runtime-state policy. */
10730
10753
  contextPolicy?: AxContextPolicyConfig;
10754
+ /** Default options for the internal checkpoint summarizer. */
10755
+ summarizerOptions?: Omit<AxProgramForwardOptions<string>, 'functions'>;
10731
10756
  /** Output field names the Actor should produce (in addition to javascriptCode). */
10732
10757
  actorFields?: string[];
10733
10758
  /**
package/index.d.ts CHANGED
@@ -1004,6 +1004,18 @@ interface AxAIServiceImpl<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TCha
1004
1004
  * Returns cache operations to execute and the modified request.
1005
1005
  */
1006
1006
  prepareCachedChatReq?(req: Readonly<AxInternalChatRequest<TModel>>, options: Readonly<AxAIServiceOptions>, existingCacheName?: string): Promise<AxPreparedChatRequest<TChatRequest>>;
1007
+ /**
1008
+ * Optional: Return tool/function-call state that becomes part of the
1009
+ * provider's immutable explicit-cache prefix.
1010
+ *
1011
+ * This is used for cache identity and token estimation when a provider
1012
+ * treats tool state as cached prefix state even if the generic request does
1013
+ * not mark functions with `cache: true`.
1014
+ */
1015
+ getContextCacheToolState?(req: Readonly<AxInternalChatRequest<TModel>>, options: Readonly<AxAIServiceOptions>): {
1016
+ functions?: AxChatRequest['functions'];
1017
+ functionCall?: AxChatRequest['functionCall'];
1018
+ } | undefined;
1007
1019
  /**
1008
1020
  * Optional: Build a context cache creation operation.
1009
1021
  * Called when a new cache needs to be created from the request.
@@ -2942,6 +2954,7 @@ declare class AxGen<IN = any, OUT extends AxGenOut = any> extends AxProgram<IN,
2942
2954
  setInstruction(instruction: string): void;
2943
2955
  getInstruction(): string | undefined;
2944
2956
  clearInstruction(): void;
2957
+ private getEffectiveContextCache;
2945
2958
  private renderPromptWithMetricsForInternalUse;
2946
2959
  private renderPromptForInternalUse;
2947
2960
  /** @internal */
@@ -3172,6 +3185,8 @@ declare class AxPromptTemplate {
3172
3185
  */
3173
3186
  private buildOutputFieldsSection;
3174
3187
  private renderSingleValueUserContent;
3188
+ private formatUserContent;
3189
+ private buildLegacyMultimodalExampleMessage;
3175
3190
  private renderInternal;
3176
3191
  render: <T = any>(values: T | ReadonlyArray<AxMessage<T>>, options: Readonly<{
3177
3192
  skipSystemPrompt?: boolean;
@@ -3753,6 +3768,7 @@ declare class AxBaseAI<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TChatRe
3753
3768
  private corsProxy?;
3754
3769
  private retry?;
3755
3770
  private customLabels?;
3771
+ private contextCache?;
3756
3772
  private modelInfo;
3757
3773
  private modelUsage?;
3758
3774
  private embedModelUsage?;
@@ -3833,6 +3849,7 @@ declare class AxBaseAI<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TChatRe
3833
3849
  * Use an existing cache by name to prepare the chat request.
3834
3850
  */
3835
3851
  private useCacheByName;
3852
+ private getContextCacheToolState;
3836
3853
  /**
3837
3854
  * Execute a context cache operation (create/update/delete).
3838
3855
  */
@@ -10271,8 +10288,12 @@ type AxAgentOptions<IN extends AxGenIn = AxGenIn> = Omit<AxProgramForwardOptions
10271
10288
  maxBatchedLlmQueryConcurrency?: number;
10272
10289
  /** Maximum Actor turns before forcing Responder (default: 10). */
10273
10290
  maxTurns?: number;
10291
+ /** Maximum characters to keep from runtime output and console/log replay. */
10292
+ maxRuntimeChars?: number;
10274
10293
  /** Context replay, checkpointing, and runtime-state policy. */
10275
10294
  contextPolicy?: AxContextPolicyConfig;
10295
+ /** Default options for the internal checkpoint summarizer. */
10296
+ summarizerOptions?: Omit<AxProgramForwardOptions<string>, 'functions'>;
10276
10297
  /** Output field names the Actor should produce (in addition to javascriptCode). */
10277
10298
  actorFields?: string[];
10278
10299
  /**
@@ -10684,7 +10705,7 @@ interface AxCodeSession {
10684
10705
  * replaying their full code blocks. Reliability-first
10685
10706
  * defaults still preserve recent evidence before deleting older low-value steps.
10686
10707
  * Best when token pressure matters more than raw replay detail.
10687
- * - `checkpointed`: Keep full replay until the rendered actor prompt crosses a threshold, then
10708
+ * - `checkpointed`: Keep full replay until the rendered actor prompt grows beyond the selected budget, then
10688
10709
  * replace older successful history with a checkpoint summary while keeping recent
10689
10710
  * actions and unresolved errors fully visible. Best when you want conservative,
10690
10711
  * debugging-friendly replay until prompt pressure becomes real.
@@ -10702,7 +10723,7 @@ interface AxContextPolicyConfig {
10702
10723
  * - `full`: prefer raw replay of earlier actions
10703
10724
  * - `adaptive`: balance replay detail with checkpoint compression while keeping more recent evidence visible
10704
10725
  * - `lean`: prefer live state + compact summaries over raw replay detail
10705
- * - `checkpointed`: keep full replay until the rendered actor prompt crosses a threshold, then replace older successful turns with a checkpoint summary
10726
+ * - `checkpointed`: keep full replay until the rendered actor prompt grows beyond the selected budget, then replace older successful turns with a checkpoint summary
10706
10727
  */
10707
10728
  preset?: AxContextPolicyPreset;
10708
10729
  /** Overall prompt budget and compression aggressiveness. */
@@ -10726,8 +10747,12 @@ interface AxRLMConfig {
10726
10747
  maxBatchedLlmQueryConcurrency?: number;
10727
10748
  /** Maximum Actor turns before forcing Responder (default: 10). */
10728
10749
  maxTurns?: number;
10750
+ /** Maximum characters to keep from runtime output and console/log replay (default: 3000). */
10751
+ maxRuntimeChars?: number;
10729
10752
  /** Context replay, checkpointing, and runtime-state policy. */
10730
10753
  contextPolicy?: AxContextPolicyConfig;
10754
+ /** Default options for the internal checkpoint summarizer. */
10755
+ summarizerOptions?: Omit<AxProgramForwardOptions<string>, 'functions'>;
10731
10756
  /** Output field names the Actor should produce (in addition to javascriptCode). */
10732
10757
  actorFields?: string[];
10733
10758
  /**