@ax-llm/ax 19.0.28 → 19.0.30

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ax-llm/ax",
3
- "version": "19.0.28",
3
+ "version": "19.0.30",
4
4
  "type": "module",
5
5
  "description": "The best library to work with LLMs",
6
6
  "repository": {
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: ax-agent-optimize
3
3
  description: This skill helps an LLM generate correct AxAgent tuning and evaluation code using @ax-llm/ax. Use when the user asks about agent.optimize(...), judgeOptions, eval datasets, optimization targets, saved optimizedProgram artifacts, or recursive optimization guidance.
4
- version: "19.0.28"
4
+ version: "19.0.30"
5
5
  ---
6
6
 
7
7
  # AxAgent Optimize Codegen Rules (@ax-llm/ax)
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: ax-agent
3
3
  description: This skill helps an LLM generate correct AxAgent code using @ax-llm/ax. Use when the user asks about agent(), child agents, namespaced functions, discovery mode, shared fields, llmQuery(...), RLM code execution, recursionOptions, or agent runtime behavior. For tuning and eval with agent.optimize(...), use ax-agent-optimize.
4
- version: "19.0.28"
4
+ version: "19.0.30"
5
5
  ---
6
6
 
7
7
  # AxAgent Codegen Rules (@ax-llm/ax)
@@ -114,6 +114,7 @@ Practical rule:
114
114
  - If `functions.discovery` is `true`, call `listModuleFunctions(...)` first, then `getFunctionDefinitions(...)`, then call only discovered functions.
115
115
  - In stdout-mode RLM, non-final turns must emit exactly one `console.log(...)` and stop immediately after it.
116
116
  - Never combine `console.log(...)` with `final(...)` or `askClarification(...)` in the same actor turn.
117
+ - Inside actor-authored JavaScript, `final(...)` and `askClarification(...)` end the current turn immediately; code after them is dead code.
117
118
  - If a host-side `AxAgentFunction` needs to end the current actor turn, use `extra.protocol.final(...)` or `extra.protocol.askClarification(...)`.
118
119
  - If a child agent needs parent inputs such as `audience`, use `fields.shared` or `fields.globallyShared`.
119
120
  - `llmQuery(...)` failures may come back as `[ERROR] ...`; do not assume success.
@@ -368,9 +369,10 @@ askClarification({
368
369
  ```
369
370
 
370
371
  - Supported `type` values are `text`, `number`, `date`, `single_choice`, and `multiple_choice`.
371
- - Choice payloads require a non-empty `choices` array.
372
+ - `single_choice` payloads with missing, empty, or malformed `choices` are downgraded to a plain clarification question instead of failing the turn.
373
+ - `multiple_choice` payloads must include at least two valid choices; otherwise the actor turn fails with a corrective runtime error that tells the model how to fix the call.
372
374
  - Choice entries may be strings or `{ label, value? }` objects.
373
- - Invalid clarification payloads are treated as actor-turn runtime errors, not as successful clarification completions.
375
+ - Invalid clarification payloads such as a missing `question` are still treated as actor-turn runtime errors, not as successful clarification completions.
374
376
 
375
377
  What `AxAgentState` contains:
376
378
 
@@ -621,7 +623,7 @@ Use it for:
621
623
  Important:
622
624
 
623
625
  - `output` is not raw stdout; it is the formatted replay string used in the action log.
624
- - `result` is the raw runtime result before Ax formats/truncates it.
626
+ - `result` is the raw runtime result before Ax applies type-aware serialization and budget-proportional truncation.
625
627
  - `thought` is optional and only appears when the underlying `AxGen` call had `showThoughts` enabled and the provider actually returned a thought field.
626
628
 
627
629
  Good pattern:
@@ -654,7 +656,7 @@ Use these top-level controls consistently:
654
656
  - `mode`: controls whether `llmQuery(...)` stays simple or delegates to recursive child agents in advanced mode
655
657
  - `recursionOptions.maxDepth`: limits recursive `llmQuery(...)` depth
656
658
  - `maxSubAgentCalls`: shared delegated-call budget across the whole run, including recursive children
657
- - `maxRuntimeChars`: runtime/output truncation cap for console logs, tool results, and interpreter output replay
659
+ - `maxRuntimeChars`: runtime/output truncation ceiling for console logs, tool results, and interpreter output replay. The actual limit is computed dynamically each turn based on remaining context budget (see **Dynamic Output Truncation** below)
658
660
  - `summarizerOptions`: default model/options for the internal checkpoint summarizer
659
661
  - `actorOptions`: actor-only forward options such as `description`, `model`, `modelConfig`, `thinkingTokenBudget`, and `showThoughts`
660
662
  - `actorModelPolicy`: actor-only model override rules based on consecutive error turns or discovery fetches from listed namespaces
@@ -700,7 +702,7 @@ const researchAgent = agent('query:string -> answer:string', {
700
702
  Semantics:
701
703
 
702
704
  - `mode` stays top-level; there is no `recursionOptions.mode`.
703
- - `maxRuntimeChars` controls runtime/output truncation only. It is separate from `contextPolicy.budget`.
705
+ - `maxRuntimeChars` sets the truncation ceiling and is separate from `contextPolicy.budget`. The effective limit per turn is computed dynamically (see below).
704
706
  - `summarizerOptions` tunes only the internal checkpoint summarizer. It does not change actor or responder model selection.
705
707
  - The current merged actor model stays the default base model. `actorModelPolicy` only overrides it when a rule matches.
706
708
  - `actorModelPolicy` only switches the actor model. It does not change `responderOptions.model`.
@@ -716,6 +718,23 @@ When choosing these options for a user:
716
718
  - Keep `actorOptions` focused on actor-only forward concerns such as `description`, `model`, `modelConfig`, `thinkingTokenBudget`, and `showThoughts`.
717
719
  - Use `actorModelPolicy` when the actor is the bottleneck and you want the responder to stay fixed.
718
720
 
721
+ ## Dynamic Output Truncation
722
+
723
+ Runtime output truncation is **budget-proportional** and **type-aware**:
724
+
725
+ **Budget-proportional sizing**: The effective truncation limit scales with remaining context budget. Early turns (empty action log) use the full `maxRuntimeChars` ceiling. As the action log fills toward `targetPromptChars`, the limit decays linearly down to 15% of the ceiling, hard-floored at 400 chars. This means early turns preserve more output detail while later turns conserve context for reasoning.
726
+
727
+ **Type-aware serialization**: Non-string runtime output is serialized with structural awareness before the char-budget truncation pass:
728
+
729
+ - **Large arrays** (>10 items): first 3 + last 2 items are kept; middle items replaced with `... [N hidden items]`.
730
+ - **Deep objects** (>3 levels): nested values beyond depth 3 replaced with `[Object]` or `[Array(N)]`.
731
+ - **Error stack traces**: first 3 + last 1 stack frames kept; middle frames replaced with `... [N frames hidden]`.
732
+ - **Simple values**: standard `JSON.stringify` passthrough.
733
+
734
+ This means the actor sees structurally informative output even when the char budget is tight, rather than a blindly head-truncated string.
735
+
736
+ Users do not need to configure this behavior — it is automatic. `maxRuntimeChars` sets the upper bound; the dynamic system only ever reduces, never exceeds it.
737
+
719
738
  ## Actor Prompt Controls
720
739
 
721
740
  Use `actorOptions` for actor-only forward options and `responderOptions` for responder-only tuning.
package/skills/ax-ai.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: ax-ai
3
3
  description: This skill helps an LLM generate correct AI provider setup and configuration code using @ax-llm/ax. Use when the user asks about ai(), providers, models, presets, embeddings, extended thinking, context caching, or mentions OpenAI/Anthropic/Google/Azure/Groq/DeepSeek/Mistral/Cohere/Together/Ollama/HuggingFace/Reka/OpenRouter with @ax-llm/ax.
4
- version: "19.0.28"
4
+ version: "19.0.30"
5
5
  ---
6
6
 
7
7
  # AI Provider Codegen Rules (@ax-llm/ax)
package/skills/ax-flow.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: ax-flow
3
3
  description: This skill helps an LLM generate correct AxFlow workflow code using @ax-llm/ax. Use when the user asks about flow(), AxFlow, workflow orchestration, parallel execution, DAG workflows, conditional routing, map/reduce patterns, or multi-node AI pipelines.
4
- version: "19.0.28"
4
+ version: "19.0.30"
5
5
  ---
6
6
 
7
7
  # AxFlow Codegen Rules (@ax-llm/ax)
package/skills/ax-gen.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: ax-gen
3
3
  description: This skill helps an LLM generate correct AxGen code using @ax-llm/ax. Use when the user asks about ax(), AxGen, generators, forward(), streamingForward(), assertions, field processors, step hooks, self-tuning, or structured outputs.
4
- version: "19.0.28"
4
+ version: "19.0.30"
5
5
  ---
6
6
 
7
7
  # AxGen Codegen Rules (@ax-llm/ax)
package/skills/ax-gepa.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: ax-gepa
3
3
  description: This skill helps an LLM generate correct AxGEPA optimization code using @ax-llm/ax. Use when the user asks about AxGEPA, GEPA, Pareto optimization, multi-objective prompt tuning, reflective prompt evolution, validationExamples, maxMetricCalls, or optimizing a generator, flow, or agent tree.
4
- version: "19.0.28"
4
+ version: "19.0.30"
5
5
  ---
6
6
 
7
7
  # AxGEPA Codegen Rules (@ax-llm/ax)
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: ax-learn
3
3
  description: This skill helps an LLM generate correct AxLearn code using @ax-llm/ax. Use when the user asks about self-improving agents, trace-backed learning, feedback-aware updates, or AxLearn modes.
4
- version: "19.0.28"
4
+ version: "19.0.30"
5
5
  ---
6
6
 
7
7
  # AxLearn Codegen Rules (@ax-llm/ax)
package/skills/ax-llm.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: ax
3
3
  description: This skill helps with using the @ax-llm/ax TypeScript library for building LLM applications. Use when the user asks about ax(), ai(), f(), s(), agent(), flow(), AxGen, AxAgent, AxFlow, signatures, streaming, or mentions @ax-llm/ax.
4
- version: "19.0.28"
4
+ version: "19.0.30"
5
5
  ---
6
6
 
7
7
  # Ax Library (@ax-llm/ax) Quick Reference
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: ax-signature
3
3
  description: This skill helps an LLM generate correct DSPy signature code using @ax-llm/ax. Use when the user asks about signatures, s(), f(), field types, string syntax, fluent builder API, validation constraints, or type-safe inputs/outputs.
4
- version: "19.0.28"
4
+ version: "19.0.30"
5
5
  ---
6
6
 
7
7
  # Ax Signature Reference