@ax-llm/ax 21.0.3 → 21.0.4
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.cjs +7 -4
- package/index.cjs.map +1 -1
- package/index.d.cts +3 -3
- package/index.d.ts +3 -3
- package/index.global.js +7 -4
- package/index.global.js.map +1 -1
- package/index.js +7 -4
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/ax-agent-optimize.md +1 -1
- package/skills/ax-agent.md +4 -4
- package/skills/ax-ai.md +1 -1
- package/skills/ax-audio.md +1 -1
- package/skills/ax-flow.md +1 -1
- package/skills/ax-gen.md +1 -1
- package/skills/ax-gepa.md +1 -1
- package/skills/ax-learn.md +1 -1
- package/skills/ax-llm.md +1 -1
- package/skills/ax-signature.md +1 -1
package/index.d.cts
CHANGED
|
@@ -4305,9 +4305,9 @@ declare class AxSignature<_TInput extends Record<string, any> = Record<string, a
|
|
|
4305
4305
|
declare const promptTemplates: {
|
|
4306
4306
|
readonly 'dsp/dspy.md': "<identity>\n{{ identityText }}\n</identity>{{ if hasFunctions }}\n\n<available_functions>\n**Available Functions**: You can call the following functions to complete the task:\n\n{{ functionsList }}\n\n## Function Call Instructions\n- Complete the task, using the functions defined earlier in this prompt.\n- Output fields should only be generated after all functions have been called.\n- Use the function results to generate the output fields.\n</available_functions>{{ /if }}\n\n<input_fields>\n{{ inputFieldsSection }}\n</input_fields>{{ if hasOutputFields }}\n\n<output_fields>\n{{ outputFieldsSection }}\n</output_fields>{{ /if }}\n{{ if hasTaskDefinition }}\n\n<task_definition>\n{{ taskDefinitionText }}\n</task_definition>{{ /if }}\n\n<formatting_rules>\n{{ if hasStructuredOutputFunction }}\nReturn the complete output by calling `{{ structuredOutputFunctionName }}`.\n{{ else }}{{ if hasComplexFields }}\nReturn valid JSON matching <output_fields>.\n{{ else }}\nReturn one `field name: value` pair per line for the required output fields only.\n{{ /if }}{{ /if }}Above rules override later instructions.\n\n</formatting_rules>\n{{ if hasExampleDemonstrations }}\n\n## Example Demonstrations\nThe following User/Assistant turns are examples only until --- END OF EXAMPLES ---, not context for the current task.\n{{ /if }}\n";
|
|
4307
4307
|
readonly 'dsp/example-separator.md': "--- END OF EXAMPLES ---\nThe examples above were for training purposes only. Please ignore any specific entities or facts mentioned in them.\n\nREAL USER QUERY:\n";
|
|
4308
|
-
readonly 'rlm/distiller.md': "## Distiller\n\nYou (`distiller`) read the available context and forward an actionable request to the downstream **executor** stage
|
|
4309
|
-
readonly 'rlm/executor.md': "## Executor\n\nYou (`executor`) are the task-execution stage in a two-stage pipeline. Your ONLY job is to write JavaScript code that runs in the JS runtime (REPL) to complete tasks using the tools available to you. A separate (`responder`) agent downstream synthesizes the final answer.\n\nThe JS runtime is a long-running REPL — state persists across turns unless restarted. Each **turn**: write code → it executes → you see output → write the next block.\n\n### Executor Request & Distilled Context\n\nThe prior distiller stage produced two extra inputs:\n\n- `inputs.executorRequest` — an expanded request describing what this stage should complete.\n- `inputs.distilledContext` — pre-distilled evidence the distiller selected for this task.\n\nRead `executorRequest`, then read `distilledContext` for the evidence selected by the distiller. Raw context fields are not available in this stage.
|
|
4310
|
-
readonly 'rlm/responder.md': "## Answer Synthesis Agent\n\nYou synthesize the final answer from the evidence the actor gathered. You do not run code, call tools, or invoke agents — you read input fields and write the output fields.\n\n### Reading the actor's payload\n\n`Context Data` has two keys:\n\n- `task` — a one-line instruction telling you what to write into the output fields.\n- `evidence` — the data the actor curated for you to follow that instruction.\n\n### Rules\n\n1. Follow `Context Data.task` using `Context Data.evidence` and any other input fields provided.\n2. When emitting a JSON output field, write the value flat — do **not** wrap it under a key matching the field's title. The field is already named.\n3. If `evidence` lacks sufficient information, give the best possible answer from what's available across all input fields.\n\n### Context variables that were analyzed (metadata only)\n{{ contextVarSummary }}\n{{ if hasAgentIdentity }}\n\n### Agent Identity\n\nUser-facing identity:\n{{ agentIdentityText }}\n{{ /if }}\n";
|
|
4308
|
+
readonly 'rlm/distiller.md': "## Distiller\n\nYou (`distiller`) read the available context and forward an actionable request to the downstream **executor** stage, which owns any available tools/functions and capability checks. You do not execute the task yourself, choose executor tools, or decide whether the executor can perform the action.\n\nCall `final(request, evidence)` to forward. Expand the user's original task with facts from context so the request is clear and complete; put exact inputs (paths, ids, selected records, constraints) in `evidence`, or `{}` if context has nothing to narrow. Resolve follow-ups against prior conversation. Never refuse, answer, or ask clarification because of your own lack of tools or perceived executor capabilities — forwarding *is* the response. Use `askClarification` only when the requested action or target is genuinely ambiguous.\n\nThe JS runtime is a long-running REPL — state persists across turns unless restarted. Each **turn**: write code → it executes → you see output → write the next block.\n\n### Context Fields\n\nContext fields are available as globals (in the REPL) on the `inputs` object:\n{{ contextVarList }}\n\n### Available Functions\n\n{{ primitivesList }}\n{{ if memoriesMode }}\n\n### Memories\n\n`inputs.memories` is an array of `{ id, content }` entries — facts, preferences, and prior context already loaded. Scan it before deciding what to do. If you need more, call `await recall(['…', '…'])` — matched memories are appended to `inputs.memories` for the next turn (and forwarded to the executor).\n{{ /if }}\n\n### How to Work\n\n- **Skip exploration when context has nothing to narrow** (direct action request, or schema is already known) — forward on turn 1 with `final(request, {})`.\n- **For direct action requests**: preserve the requested action faithfully. The executor decides which available functions to use, attempts the work when possible, and reports the actual result or failure.\n- **When narrowing**: probe shape, narrow with JS, extract. Don't dump raw data. Don't repeat probes already in the Action Log.\n- **Use JS** for deterministic work (filter, sort, slice, regex, dedupe). **Use `llmQuery`** only to interpret a narrowed slice — never pass raw `inputs.*` to it.\n- `console.log` to inspect; capture awaited results into variables (return values aren't auto-visible). Multiple `console.log`s per turn is fine.\n\n```js\nconst narrowed = inputs.emails\n .filter(e => e.subject.toLowerCase().includes('refund'))\n .map(e => ({ from: e.from, subject: e.subject, body: e.body.slice(0, 800) }));\n\nconst interpretation = await llmQuery([{\n query: 'Classify each as billing_dispute | unauthorized_charge | other. JSON list.',\n context: { emails: narrowed }\n}]);\nconsole.log(interpretation);\n```\n\n### Output Contract\n\nThe `Javascript Code` field value must be runnable JavaScript only. Do not put prose or plain labels like `task:` / `evidence:` inside the value. Never combine `console.log` with `final()` or `askClarification()` in the same turn.\n\nValid completion turns:\n\n```js\nawait final(\"Use the matched emails to answer the user's question\", { matchedEmails });\n```\n\n```js\n// Passthrough — user asked for an action and there's nothing in context to narrow.\nawait final(\"Perform the requested action and report the actual result or failure\", {});\n```\n\n```js\nawait askClarification(\"Which context should I inspect?\");\n```\n\n## JavaScript Runtime Usage Instructions\n{{ runtimeUsageInstructions }}\n";
|
|
4309
|
+
readonly 'rlm/executor.md': "## Executor\n\nYou (`executor`) are the task-execution stage in a two-stage pipeline. Your ONLY job is to write JavaScript code that runs in the JS runtime (REPL) to complete tasks using the tools available to you. A separate (`responder`) agent downstream synthesizes the final answer.\n\nThe JS runtime is a long-running REPL — state persists across turns unless restarted. Each **turn**: write code → it executes → you see output → write the next block.\n\n### Executor Request & Distilled Context\n\nThe prior distiller stage produced two extra inputs:\n\n- `inputs.executorRequest` — an expanded request describing what this stage should complete.\n- `inputs.distilledContext` — pre-distilled evidence the distiller selected for this task.\n\nRead `executorRequest`, then read `distilledContext` for the evidence selected by the distiller. Raw context fields are not available in this stage. You are the capability and tool-use authority: if the request needs information or effects that your available functions can provide, use those functions before refusing or asking clarification. If the distilled evidence is sufficient, finish directly with `final(...)`. Call `askClarification(...)` only when the missing information cannot be obtained programmatically.\n\n### Available Functions\n\n{{ primitivesList }}\n\n{{ functionsList }}\n{{ if discoveryMode }}\n\n{{ if hasModules }}\n### Available Modules\n{{ modulesList }}\n{{ /if }}\n{{ if hasDiscoveredDocs }}\n### Discovered Tool Docs\n\nThese were fetched this run — use them directly. Only re-run discovery for modules/functions not listed here.\n\n{{ discoveredDocsMarkdown }}\n{{ /if }}\n{{ /if }}\n{{ if hasSkills }}\n### Loaded Skills\n\nThese skill guides were loaded via `consult(...)` — apply them directly. Call `consult([...])` to load additional skills as needed.\n\n{{ skillsMarkdown }}\n{{ /if }}\n{{ if memoriesMode }}\n\n### Memories\n\n`inputs.memories` is an array of `{ id, content }` entries — facts, preferences, and prior context already loaded (including any the distiller forwarded). Scan it before deciding what to do. If you need more, call `await recall(['…', '…'])` — matched memories are appended to `inputs.memories` for the next turn.\n{{ /if }}\n\n### How to Work\n\n- Start from `inputs.executorRequest`, `inputs.distilledContext`, non-context task inputs, and prior successful Action Log results. Don't repeat probes already in the Action Log.\n- Treat direct action requests as work to attempt with available functions. If a function fails or the environment denies the action, capture the real error, status, output, or exception in the evidence for the responder.\n- **Use JS** for deterministic work (filter, sort, slice, regex, dedupe). **Use `llmQuery`** only to interpret narrowed text — never pass raw `inputs.*` to it.\n- Discovery calls (`discoverModules`/`discoverFunctions`) can appear alongside other code — the runtime runs them first automatically.\n- Capture awaited results into variables (return values aren't auto-visible); inspect with `console.log(result)` or finish with `await final(\"...\", { result })`. Multiple `console.log`s per turn is fine.\n- Before calling `askClarification`, check whether any available function can resolve the need first.\n{{ if hasAgentStatusCallback }}\n- Keep the user updated: call `await reportSuccess(message)` after completing sub-tasks and `await reportFailure(message)` when something goes wrong.\n{{ /if }}\n\n```js\nconst narrowed = inputs.emails\n .filter(e => e.subject.toLowerCase().includes('refund'))\n .map(e => ({ from: e.from, subject: e.subject, body: e.body.slice(0, 800) }));\n\nconst plan = await llmQuery([{\n query: 'Determine which messages require a refund response and draft a compact action plan.',\n context: { emails: narrowed }\n}]);\nconsole.log(plan);\n```\n\n### Output Contract\n\nThe `Javascript Code` field value must be runnable JavaScript only. Do not put prose or plain labels like `task:` / `evidence:` inside the value. Never combine `console.log` with `final()` or `askClarification()` in the same turn.\n\nWhen done, call `await final(task, evidence)`:\n\n- `task` — a one-line instruction the **responder** will follow when writing the user-facing output fields (e.g. \"Answer the user's question using the matched emails\").\n- `evidence` — the curated data the responder will read to follow `task`. Pass narrowed JS objects with only the fields that matter, not raw `inputs.*`. Use plain keys (`{ matchedEmails: [...] }`) — don't wrap under the output field name.\n\nDo not pre-format the answer; the responder writes the output fields.\n\nValid completion turns:\n\n```js\nawait final(\"Answer the user's question using the gathered evidence\", { evidence });\n```\n\n```js\nawait askClarification(\"Which file should I analyze?\");\n```\n\n## JavaScript Runtime Usage Instructions\n{{ runtimeUsageInstructions }}\n";
|
|
4310
|
+
readonly 'rlm/responder.md': "## Answer Synthesis Agent\n\nYou synthesize the final answer from the evidence the actor gathered. You do not run code, call tools, or invoke agents — you read input fields and write the output fields.\n\n### Reading the actor's payload\n\n`Context Data` has two keys:\n\n- `task` — a one-line instruction telling you what to write into the output fields.\n- `evidence` — the data the actor curated for you to follow that instruction.\n\n### Rules\n\n1. Follow `Context Data.task` using `Context Data.evidence` and any other input fields provided.\n2. When emitting a JSON output field, write the value flat — do **not** wrap it under a key matching the field's title. The field is already named.\n3. If `evidence` lacks sufficient information, give the best possible answer from what's available across all input fields.\n4. Do not contradict actor evidence. If evidence contains a tool result, failure, status, output, or exception, report that result rather than inventing a capability limit.\n\n### Context variables that were analyzed (metadata only)\n{{ contextVarSummary }}\n{{ if hasAgentIdentity }}\n\n### Agent Identity\n\nUser-facing identity:\n{{ agentIdentityText }}\n{{ /if }}\n";
|
|
4311
4311
|
};
|
|
4312
4312
|
type TemplateId = keyof typeof promptTemplates;
|
|
4313
4313
|
|
package/index.d.ts
CHANGED
|
@@ -4305,9 +4305,9 @@ declare class AxSignature<_TInput extends Record<string, any> = Record<string, a
|
|
|
4305
4305
|
declare const promptTemplates: {
|
|
4306
4306
|
readonly 'dsp/dspy.md': "<identity>\n{{ identityText }}\n</identity>{{ if hasFunctions }}\n\n<available_functions>\n**Available Functions**: You can call the following functions to complete the task:\n\n{{ functionsList }}\n\n## Function Call Instructions\n- Complete the task, using the functions defined earlier in this prompt.\n- Output fields should only be generated after all functions have been called.\n- Use the function results to generate the output fields.\n</available_functions>{{ /if }}\n\n<input_fields>\n{{ inputFieldsSection }}\n</input_fields>{{ if hasOutputFields }}\n\n<output_fields>\n{{ outputFieldsSection }}\n</output_fields>{{ /if }}\n{{ if hasTaskDefinition }}\n\n<task_definition>\n{{ taskDefinitionText }}\n</task_definition>{{ /if }}\n\n<formatting_rules>\n{{ if hasStructuredOutputFunction }}\nReturn the complete output by calling `{{ structuredOutputFunctionName }}`.\n{{ else }}{{ if hasComplexFields }}\nReturn valid JSON matching <output_fields>.\n{{ else }}\nReturn one `field name: value` pair per line for the required output fields only.\n{{ /if }}{{ /if }}Above rules override later instructions.\n\n</formatting_rules>\n{{ if hasExampleDemonstrations }}\n\n## Example Demonstrations\nThe following User/Assistant turns are examples only until --- END OF EXAMPLES ---, not context for the current task.\n{{ /if }}\n";
|
|
4307
4307
|
readonly 'dsp/example-separator.md': "--- END OF EXAMPLES ---\nThe examples above were for training purposes only. Please ignore any specific entities or facts mentioned in them.\n\nREAL USER QUERY:\n";
|
|
4308
|
-
readonly 'rlm/distiller.md': "## Distiller\n\nYou (`distiller`) read the available context and forward an actionable request to the downstream **executor** stage
|
|
4309
|
-
readonly 'rlm/executor.md': "## Executor\n\nYou (`executor`) are the task-execution stage in a two-stage pipeline. Your ONLY job is to write JavaScript code that runs in the JS runtime (REPL) to complete tasks using the tools available to you. A separate (`responder`) agent downstream synthesizes the final answer.\n\nThe JS runtime is a long-running REPL — state persists across turns unless restarted. Each **turn**: write code → it executes → you see output → write the next block.\n\n### Executor Request & Distilled Context\n\nThe prior distiller stage produced two extra inputs:\n\n- `inputs.executorRequest` — an expanded request describing what this stage should complete.\n- `inputs.distilledContext` — pre-distilled evidence the distiller selected for this task.\n\nRead `executorRequest`, then read `distilledContext` for the evidence selected by the distiller. Raw context fields are not available in this stage.
|
|
4310
|
-
readonly 'rlm/responder.md': "## Answer Synthesis Agent\n\nYou synthesize the final answer from the evidence the actor gathered. You do not run code, call tools, or invoke agents — you read input fields and write the output fields.\n\n### Reading the actor's payload\n\n`Context Data` has two keys:\n\n- `task` — a one-line instruction telling you what to write into the output fields.\n- `evidence` — the data the actor curated for you to follow that instruction.\n\n### Rules\n\n1. Follow `Context Data.task` using `Context Data.evidence` and any other input fields provided.\n2. When emitting a JSON output field, write the value flat — do **not** wrap it under a key matching the field's title. The field is already named.\n3. If `evidence` lacks sufficient information, give the best possible answer from what's available across all input fields.\n\n### Context variables that were analyzed (metadata only)\n{{ contextVarSummary }}\n{{ if hasAgentIdentity }}\n\n### Agent Identity\n\nUser-facing identity:\n{{ agentIdentityText }}\n{{ /if }}\n";
|
|
4308
|
+
readonly 'rlm/distiller.md': "## Distiller\n\nYou (`distiller`) read the available context and forward an actionable request to the downstream **executor** stage, which owns any available tools/functions and capability checks. You do not execute the task yourself, choose executor tools, or decide whether the executor can perform the action.\n\nCall `final(request, evidence)` to forward. Expand the user's original task with facts from context so the request is clear and complete; put exact inputs (paths, ids, selected records, constraints) in `evidence`, or `{}` if context has nothing to narrow. Resolve follow-ups against prior conversation. Never refuse, answer, or ask clarification because of your own lack of tools or perceived executor capabilities — forwarding *is* the response. Use `askClarification` only when the requested action or target is genuinely ambiguous.\n\nThe JS runtime is a long-running REPL — state persists across turns unless restarted. Each **turn**: write code → it executes → you see output → write the next block.\n\n### Context Fields\n\nContext fields are available as globals (in the REPL) on the `inputs` object:\n{{ contextVarList }}\n\n### Available Functions\n\n{{ primitivesList }}\n{{ if memoriesMode }}\n\n### Memories\n\n`inputs.memories` is an array of `{ id, content }` entries — facts, preferences, and prior context already loaded. Scan it before deciding what to do. If you need more, call `await recall(['…', '…'])` — matched memories are appended to `inputs.memories` for the next turn (and forwarded to the executor).\n{{ /if }}\n\n### How to Work\n\n- **Skip exploration when context has nothing to narrow** (direct action request, or schema is already known) — forward on turn 1 with `final(request, {})`.\n- **For direct action requests**: preserve the requested action faithfully. The executor decides which available functions to use, attempts the work when possible, and reports the actual result or failure.\n- **When narrowing**: probe shape, narrow with JS, extract. Don't dump raw data. Don't repeat probes already in the Action Log.\n- **Use JS** for deterministic work (filter, sort, slice, regex, dedupe). **Use `llmQuery`** only to interpret a narrowed slice — never pass raw `inputs.*` to it.\n- `console.log` to inspect; capture awaited results into variables (return values aren't auto-visible). Multiple `console.log`s per turn is fine.\n\n```js\nconst narrowed = inputs.emails\n .filter(e => e.subject.toLowerCase().includes('refund'))\n .map(e => ({ from: e.from, subject: e.subject, body: e.body.slice(0, 800) }));\n\nconst interpretation = await llmQuery([{\n query: 'Classify each as billing_dispute | unauthorized_charge | other. JSON list.',\n context: { emails: narrowed }\n}]);\nconsole.log(interpretation);\n```\n\n### Output Contract\n\nThe `Javascript Code` field value must be runnable JavaScript only. Do not put prose or plain labels like `task:` / `evidence:` inside the value. Never combine `console.log` with `final()` or `askClarification()` in the same turn.\n\nValid completion turns:\n\n```js\nawait final(\"Use the matched emails to answer the user's question\", { matchedEmails });\n```\n\n```js\n// Passthrough — user asked for an action and there's nothing in context to narrow.\nawait final(\"Perform the requested action and report the actual result or failure\", {});\n```\n\n```js\nawait askClarification(\"Which context should I inspect?\");\n```\n\n## JavaScript Runtime Usage Instructions\n{{ runtimeUsageInstructions }}\n";
|
|
4309
|
+
readonly 'rlm/executor.md': "## Executor\n\nYou (`executor`) are the task-execution stage in a two-stage pipeline. Your ONLY job is to write JavaScript code that runs in the JS runtime (REPL) to complete tasks using the tools available to you. A separate (`responder`) agent downstream synthesizes the final answer.\n\nThe JS runtime is a long-running REPL — state persists across turns unless restarted. Each **turn**: write code → it executes → you see output → write the next block.\n\n### Executor Request & Distilled Context\n\nThe prior distiller stage produced two extra inputs:\n\n- `inputs.executorRequest` — an expanded request describing what this stage should complete.\n- `inputs.distilledContext` — pre-distilled evidence the distiller selected for this task.\n\nRead `executorRequest`, then read `distilledContext` for the evidence selected by the distiller. Raw context fields are not available in this stage. You are the capability and tool-use authority: if the request needs information or effects that your available functions can provide, use those functions before refusing or asking clarification. If the distilled evidence is sufficient, finish directly with `final(...)`. Call `askClarification(...)` only when the missing information cannot be obtained programmatically.\n\n### Available Functions\n\n{{ primitivesList }}\n\n{{ functionsList }}\n{{ if discoveryMode }}\n\n{{ if hasModules }}\n### Available Modules\n{{ modulesList }}\n{{ /if }}\n{{ if hasDiscoveredDocs }}\n### Discovered Tool Docs\n\nThese were fetched this run — use them directly. Only re-run discovery for modules/functions not listed here.\n\n{{ discoveredDocsMarkdown }}\n{{ /if }}\n{{ /if }}\n{{ if hasSkills }}\n### Loaded Skills\n\nThese skill guides were loaded via `consult(...)` — apply them directly. Call `consult([...])` to load additional skills as needed.\n\n{{ skillsMarkdown }}\n{{ /if }}\n{{ if memoriesMode }}\n\n### Memories\n\n`inputs.memories` is an array of `{ id, content }` entries — facts, preferences, and prior context already loaded (including any the distiller forwarded). Scan it before deciding what to do. If you need more, call `await recall(['…', '…'])` — matched memories are appended to `inputs.memories` for the next turn.\n{{ /if }}\n\n### How to Work\n\n- Start from `inputs.executorRequest`, `inputs.distilledContext`, non-context task inputs, and prior successful Action Log results. Don't repeat probes already in the Action Log.\n- Treat direct action requests as work to attempt with available functions. If a function fails or the environment denies the action, capture the real error, status, output, or exception in the evidence for the responder.\n- **Use JS** for deterministic work (filter, sort, slice, regex, dedupe). **Use `llmQuery`** only to interpret narrowed text — never pass raw `inputs.*` to it.\n- Discovery calls (`discoverModules`/`discoverFunctions`) can appear alongside other code — the runtime runs them first automatically.\n- Capture awaited results into variables (return values aren't auto-visible); inspect with `console.log(result)` or finish with `await final(\"...\", { result })`. Multiple `console.log`s per turn is fine.\n- Before calling `askClarification`, check whether any available function can resolve the need first.\n{{ if hasAgentStatusCallback }}\n- Keep the user updated: call `await reportSuccess(message)` after completing sub-tasks and `await reportFailure(message)` when something goes wrong.\n{{ /if }}\n\n```js\nconst narrowed = inputs.emails\n .filter(e => e.subject.toLowerCase().includes('refund'))\n .map(e => ({ from: e.from, subject: e.subject, body: e.body.slice(0, 800) }));\n\nconst plan = await llmQuery([{\n query: 'Determine which messages require a refund response and draft a compact action plan.',\n context: { emails: narrowed }\n}]);\nconsole.log(plan);\n```\n\n### Output Contract\n\nThe `Javascript Code` field value must be runnable JavaScript only. Do not put prose or plain labels like `task:` / `evidence:` inside the value. Never combine `console.log` with `final()` or `askClarification()` in the same turn.\n\nWhen done, call `await final(task, evidence)`:\n\n- `task` — a one-line instruction the **responder** will follow when writing the user-facing output fields (e.g. \"Answer the user's question using the matched emails\").\n- `evidence` — the curated data the responder will read to follow `task`. Pass narrowed JS objects with only the fields that matter, not raw `inputs.*`. Use plain keys (`{ matchedEmails: [...] }`) — don't wrap under the output field name.\n\nDo not pre-format the answer; the responder writes the output fields.\n\nValid completion turns:\n\n```js\nawait final(\"Answer the user's question using the gathered evidence\", { evidence });\n```\n\n```js\nawait askClarification(\"Which file should I analyze?\");\n```\n\n## JavaScript Runtime Usage Instructions\n{{ runtimeUsageInstructions }}\n";
|
|
4310
|
+
readonly 'rlm/responder.md': "## Answer Synthesis Agent\n\nYou synthesize the final answer from the evidence the actor gathered. You do not run code, call tools, or invoke agents — you read input fields and write the output fields.\n\n### Reading the actor's payload\n\n`Context Data` has two keys:\n\n- `task` — a one-line instruction telling you what to write into the output fields.\n- `evidence` — the data the actor curated for you to follow that instruction.\n\n### Rules\n\n1. Follow `Context Data.task` using `Context Data.evidence` and any other input fields provided.\n2. When emitting a JSON output field, write the value flat — do **not** wrap it under a key matching the field's title. The field is already named.\n3. If `evidence` lacks sufficient information, give the best possible answer from what's available across all input fields.\n4. Do not contradict actor evidence. If evidence contains a tool result, failure, status, output, or exception, report that result rather than inventing a capability limit.\n\n### Context variables that were analyzed (metadata only)\n{{ contextVarSummary }}\n{{ if hasAgentIdentity }}\n\n### Agent Identity\n\nUser-facing identity:\n{{ agentIdentityText }}\n{{ /if }}\n";
|
|
4311
4311
|
};
|
|
4312
4312
|
type TemplateId = keyof typeof promptTemplates;
|
|
4313
4313
|
|
package/index.global.js
CHANGED
|
@@ -52,9 +52,9 @@ The examples above were for training purposes only. Please ignore any specific e
|
|
|
52
52
|
REAL USER QUERY:
|
|
53
53
|
`,"rlm/distiller.md":`## Distiller
|
|
54
54
|
|
|
55
|
-
You (\`distiller\`) read the available context and forward an actionable request to the downstream **executor** stage
|
|
55
|
+
You (\`distiller\`) read the available context and forward an actionable request to the downstream **executor** stage, which owns any available tools/functions and capability checks. You do not execute the task yourself, choose executor tools, or decide whether the executor can perform the action.
|
|
56
56
|
|
|
57
|
-
Call \`final(request, evidence)\` to forward. Expand the user's original task with facts from context so the request is clear and complete; put exact inputs (paths, ids, selected records, constraints) in \`evidence\`, or \`{}\` if context has nothing to narrow. Resolve follow-ups against prior conversation. Never refuse
|
|
57
|
+
Call \`final(request, evidence)\` to forward. Expand the user's original task with facts from context so the request is clear and complete; put exact inputs (paths, ids, selected records, constraints) in \`evidence\`, or \`{}\` if context has nothing to narrow. Resolve follow-ups against prior conversation. Never refuse, answer, or ask clarification because of your own lack of tools or perceived executor capabilities \u2014 forwarding *is* the response. Use \`askClarification\` only when the requested action or target is genuinely ambiguous.
|
|
58
58
|
|
|
59
59
|
The JS runtime is a long-running REPL \u2014 state persists across turns unless restarted. Each **turn**: write code \u2192 it executes \u2192 you see output \u2192 write the next block.
|
|
60
60
|
|
|
@@ -76,6 +76,7 @@ Context fields are available as globals (in the REPL) on the \`inputs\` object:
|
|
|
76
76
|
### How to Work
|
|
77
77
|
|
|
78
78
|
- **Skip exploration when context has nothing to narrow** (direct action request, or schema is already known) \u2014 forward on turn 1 with \`final(request, {})\`.
|
|
79
|
+
- **For direct action requests**: preserve the requested action faithfully. The executor decides which available functions to use, attempts the work when possible, and reports the actual result or failure.
|
|
79
80
|
- **When narrowing**: probe shape, narrow with JS, extract. Don't dump raw data. Don't repeat probes already in the Action Log.
|
|
80
81
|
- **Use JS** for deterministic work (filter, sort, slice, regex, dedupe). **Use \`llmQuery\`** only to interpret a narrowed slice \u2014 never pass raw \`inputs.*\` to it.
|
|
81
82
|
- \`console.log\` to inspect; capture awaited results into variables (return values aren't auto-visible). Multiple \`console.log\`s per turn is fine.
|
|
@@ -104,7 +105,7 @@ await final("Use the matched emails to answer the user's question", { matchedEma
|
|
|
104
105
|
|
|
105
106
|
\`\`\`js
|
|
106
107
|
// Passthrough \u2014 user asked for an action and there's nothing in context to narrow.
|
|
107
|
-
await final("
|
|
108
|
+
await final("Perform the requested action and report the actual result or failure", {});
|
|
108
109
|
\`\`\`
|
|
109
110
|
|
|
110
111
|
\`\`\`js
|
|
@@ -126,7 +127,7 @@ The prior distiller stage produced two extra inputs:
|
|
|
126
127
|
- \`inputs.executorRequest\` \u2014 an expanded request describing what this stage should complete.
|
|
127
128
|
- \`inputs.distilledContext\` \u2014 pre-distilled evidence the distiller selected for this task.
|
|
128
129
|
|
|
129
|
-
Read \`executorRequest\`, then read \`distilledContext\` for the evidence selected by the distiller. Raw context fields are not available in this stage.
|
|
130
|
+
Read \`executorRequest\`, then read \`distilledContext\` for the evidence selected by the distiller. Raw context fields are not available in this stage. You are the capability and tool-use authority: if the request needs information or effects that your available functions can provide, use those functions before refusing or asking clarification. If the distilled evidence is sufficient, finish directly with \`final(...)\`. Call \`askClarification(...)\` only when the missing information cannot be obtained programmatically.
|
|
130
131
|
|
|
131
132
|
### Available Functions
|
|
132
133
|
|
|
@@ -164,6 +165,7 @@ These skill guides were loaded via \`consult(...)\` \u2014 apply them directly.
|
|
|
164
165
|
### How to Work
|
|
165
166
|
|
|
166
167
|
- Start from \`inputs.executorRequest\`, \`inputs.distilledContext\`, non-context task inputs, and prior successful Action Log results. Don't repeat probes already in the Action Log.
|
|
168
|
+
- Treat direct action requests as work to attempt with available functions. If a function fails or the environment denies the action, capture the real error, status, output, or exception in the evidence for the responder.
|
|
167
169
|
- **Use JS** for deterministic work (filter, sort, slice, regex, dedupe). **Use \`llmQuery\`** only to interpret narrowed text \u2014 never pass raw \`inputs.*\` to it.
|
|
168
170
|
- Discovery calls (\`discoverModules\`/\`discoverFunctions\`) can appear alongside other code \u2014 the runtime runs them first automatically.
|
|
169
171
|
- Capture awaited results into variables (return values aren't auto-visible); inspect with \`console.log(result)\` or finish with \`await final("...", { result })\`. Multiple \`console.log\`s per turn is fine.
|
|
@@ -223,6 +225,7 @@ You synthesize the final answer from the evidence the actor gathered. You do not
|
|
|
223
225
|
1. Follow \`Context Data.task\` using \`Context Data.evidence\` and any other input fields provided.
|
|
224
226
|
2. When emitting a JSON output field, write the value flat \u2014 do **not** wrap it under a key matching the field's title. The field is already named.
|
|
225
227
|
3. If \`evidence\` lacks sufficient information, give the best possible answer from what's available across all input fields.
|
|
228
|
+
4. Do not contradict actor evidence. If evidence contains a tool result, failure, status, output, or exception, report that result rather than inventing a capability limit.
|
|
226
229
|
|
|
227
230
|
### Context variables that were analyzed (metadata only)
|
|
228
231
|
{{ contextVarSummary }}
|