@t2000/engine 1.17.0 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -96,10 +96,10 @@ interface RecipeStep {
96
96
  cost_per_unit?: string;
97
97
  /**
98
98
  * [SPEC 7 P2.5 Layer 4] When true, this step is part of a multi-write
99
- * Payment Stream bundle group. Steps with `bundle: true` MUST resolve
99
+ * Payment Intent compile group. Steps with `bundle: true` MUST resolve
100
100
  * to confirm-tier write tools that carry `bundleable: true` in
101
101
  * `TOOL_FLAGS` (validated at recipe load time). The loader fails fast
102
- * on auto-tier writes / read-only tools / non-bundleable confirm tools
102
+ * on auto-tier writes / read-only tools / non-`bundleable` confirm tools
103
103
  * (`pay_api`, `save_contact`) inside a `bundle: true` group.
104
104
  *
105
105
  * The engine emits parallel `tool_use` blocks for `bundle: true`
@@ -915,7 +915,7 @@ interface PendingActionModifiableField {
915
915
  asset?: string;
916
916
  }
917
917
  /**
918
- * [SPEC 7 v0.4 Layer 2] One step inside a multi-write Payment Stream
918
+ * [SPEC 7 v0.4 Layer 2] One step inside a multi-write Payment Intent
919
919
  * `PendingAction`. Single-write actions never carry `steps[]`; the
920
920
  * legacy `toolName`/`toolUseId`/`input`/`attemptId` fields cover them.
921
921
  */
@@ -1005,7 +1005,7 @@ interface PendingAction {
1005
1005
  * exists to kill. Also survives session persistence so the resume call
1006
1006
  * can read it back from the rehydrated `PendingAction`.
1007
1007
  *
1008
- * **Bundles:** when `steps !== undefined` (multi-write Payment Stream),
1008
+ * **Bundles:** when `steps !== undefined` (multi-write Payment Intent),
1009
1009
  * the top-level `attemptId` mirrors `steps[0].attemptId` per SPEC 7
1010
1010
  * § Layer 2 line 463 ("`steps[0]` mirrors the top-level
1011
1011
  * toolName/toolUseId/input/attemptId for hosts that haven't been
@@ -1019,7 +1019,7 @@ interface PendingAction {
1019
1019
  attemptId: string;
1020
1020
  /**
1021
1021
  * [SPEC 7 v0.4 Layer 2] When set, this `pending_action` represents a
1022
- * multi-write Payment Stream. Single-step bundles are NOT created — the
1022
+ * multi-write Payment Intent. Single-step bundles are NOT created — the
1023
1023
  * engine emits the legacy single-write shape when N=1. Hosts that haven't
1024
1024
  * been updated read `toolName`/`toolUseId`/`input` (which mirror
1025
1025
  * `steps[0]`); newer hosts iterate `steps`.
@@ -1091,7 +1091,7 @@ interface PermissionResponse {
1091
1091
  * Each carries the step's `toolUseId` + `attemptId` so the host's resume
1092
1092
  * route can update the matching `TurnMetrics` row.
1093
1093
  *
1094
- * **Atomic semantics:** PTB execution is atomic at the Sui layer. If the
1094
+ * **Atomic semantics:** Payment Intent execution is atomic at the Sui layer. If the
1095
1095
  * host detects a bundle-level failure, it should populate every entry
1096
1096
  * with `isError: true` carrying the same error message (so the LLM
1097
1097
  * narrates the failure once, not N times).
@@ -1204,7 +1204,7 @@ interface ToolFlags {
1204
1204
  maxRetries?: number;
1205
1205
  /**
1206
1206
  * [SPEC 7 v0.4 Layer 2] Opt-in: this write tool can participate in a
1207
- * multi-write Payment Stream. When the LLM emits ≥2 `tool_use` blocks
1207
+ * multi-write Payment Intent. When the LLM emits ≥2 `tool_use` blocks
1208
1208
  * in a single assistant turn AND every block resolves to a `confirm`-tier
1209
1209
  * write tool with `bundleable: true`, the engine collapses them into one
1210
1210
  * `pending_action` with `steps[]` instead of yielding N times. Default
@@ -1215,8 +1215,8 @@ interface ToolFlags {
1215
1215
  * **Permanently non-bundleable:**
1216
1216
  * - `pay_api` — recipient/amount/currency aren't known at LLM intent
1217
1217
  * time (gateway 402 challenge resolves them at route time, after a
1218
- * network round-trip the engine has no knowledge of). PTB cannot be
1219
- * composed at compose time.
1218
+ * network round-trip the engine has no knowledge of). Payment Intent
1219
+ * cannot be composed at compose time.
1220
1220
  * - `save_contact` — Postgres-only, no on-chain effect.
1221
1221
  */
1222
1222
  bundleable?: boolean;
@@ -1690,7 +1690,7 @@ declare function validateHistory(messages: Message[]): Message[];
1690
1690
  /**
1691
1691
  * SPEC 7 v0.3 Quote-Refresh ReviewCard — per-tool result freshness budgets.
1692
1692
  *
1693
- * When a Payment Stream `pending_action` is composed at T=0 from upstream
1693
+ * When a Payment Intent `pending_action` is composed at T=0 from upstream
1694
1694
  * read results, the user may take 30–60s to read + tap APPROVE. By that
1695
1695
  * time some upstream results have drifted (Cetus quotes refresh in
1696
1696
  * ~30s; NAVI APYs change slower). The host renders a "QUOTE Ns OLD"
@@ -1755,15 +1755,15 @@ declare const REGENERATABLE_READ_TOOLS: ReadonlySet<string>;
1755
1755
  * relaxed to DAG-aware: only pairs that actually chain via
1756
1756
  * `inputCoinFromStep` need whitelist checking. Standalone steps
1757
1757
  * interleaved between chained steps run wallet-mode independently
1758
- * inside the same atomic PTB.** This unlocks Demo 1 ("swap 10% to
1758
+ * inside the same atomic Payment Intent.** This unlocks Demo 1 ("swap 10% to
1759
1759
  * SUI, save 50% as USDsui, send $100 to Mom" — 4-op DAG with one
1760
1760
  * chain at step 1→2, three standalone wallet-mode steps).
1761
1761
  *
1762
1762
  * **DAG-aware semantics.** Pre-3a: every adjacent pair gates the entire
1763
1763
  * bundle. Phase 3a+: each (i, i+1) pair contributes IF a chain is wired
1764
1764
  * (via `shouldChainCoin`). Non-chained pairs are independent — they
1765
- * each pre-fetch their own coin from the wallet inside the PTB. Atomic
1766
- * settlement at the PTB level holds either way.
1765
+ * each pre-fetch their own coin from the wallet inside the Payment Intent.
1766
+ * Atomic settlement at the Payment Intent level holds either way.
1767
1767
  *
1768
1768
  * **Phase 3b (deferred):** `swap_execute → swap_execute` whitelist add
1769
1769
  * for explicit multi-hop swap chains (rare; flag-gated when shipped).
@@ -1785,7 +1785,7 @@ declare const MAX_BUNDLE_OPS = 4;
1785
1785
  *
1786
1786
  * | Pair | Why it works at compose time today |
1787
1787
  * |---|---|
1788
- * | `swap_execute → send_transfer` | Swap's `tx.transferObjects([result.coin], sender)` lands the swap output in the wallet for the same PTB; send's `selectAndSplitCoin` finds it. |
1788
+ * | `swap_execute → send_transfer` | Swap's `tx.transferObjects([result.coin], sender)` lands the swap output in the wallet for the same Payment Intent; send's `selectAndSplitCoin` finds it. |
1789
1789
  * | `swap_execute → save_deposit` | Same mechanism — swap output is back in wallet for save's coin fetch. (P0 caveat: this currently *fails* if the wallet has zero of `swap.to` BEFORE the swap step. Phase 1's `inputCoinFromStep` fixes that. For now we accept the pair but warn the LLM in the prompt rule that wallet must hold ≥0 of target asset.) |
1790
1790
  * | `swap_execute → repay_debt` | Same as save. Same caveat. |
1791
1791
  * | `withdraw → swap_execute` | Withdraw's output is transferred to user; swap's coin fetch finds it. Same wallet caveat in reverse. |
@@ -1913,7 +1913,7 @@ declare function composeBundleFromToolResults(input: BundleCompositionInput): Pe
1913
1913
  /**
1914
1914
  * SPEC 7 v0.3 Quote-Refresh ReviewCard — engine-side bundle regeneration.
1915
1915
  *
1916
- * When a user takes 30–60s to read a multi-step Payment Stream
1916
+ * When a user takes 30–60s to read a multi-step Payment Intent
1917
1917
  * `pending_action`, the upstream read results that fed bundle composition
1918
1918
  * (Cetus quotes, NAVI APYs, wallet balances) drift. Today the user has to
1919
1919
  * either approve with stale data (Sui dry-run is the safety gate, but the
@@ -2179,11 +2179,12 @@ declare class MemorySessionStore implements SessionStore {
2179
2179
  * producesArtifact — returns images, documents, generated content
2180
2180
  * costAware — has a monetary cost the user should know about
2181
2181
  * maxRetries — max calls with same input (default: unlimited for reads, 1 for writes)
2182
- * bundleable — [SPEC 7 Layer 2] can participate in a multi-write Payment Stream
2183
- * PTB. Set on every confirm-tier write whose on-chain effect is
2184
- * fully expressible at compose time. Excluded: `pay_api` (recipient/
2185
- * amount/currency unknown until gateway 402 challenge resolves at
2186
- * route time) and `save_contact` (Postgres-only, no on-chain effect).
2182
+ * bundleable — [SPEC 7 Layer 2] can participate in a multi-write Payment
2183
+ * Intent. Set on every confirm-tier write whose on-chain effect
2184
+ * is fully expressible at compose time. Excluded: `pay_api`
2185
+ * (recipient/amount/currency unknown until gateway 402 challenge
2186
+ * resolves at route time) and `save_contact` (Postgres-only, no
2187
+ * on-chain effect).
2187
2188
  */
2188
2189
  declare const TOOL_FLAGS: Record<string, ToolFlags>;
2189
2190
  /**
@@ -3837,7 +3838,7 @@ declare function fetchAudricHistory(address: string, opts: {
3837
3838
  limit?: number;
3838
3839
  }, env?: Record<string, string>, signal?: AbortSignal): Promise<AudricHistoryRecord[] | null>;
3839
3840
 
3840
- declare const DEFAULT_SYSTEM_PROMPT = "You are Audric \u2014 a financial agent on Sui. Audric is exactly five products: Audric Passport (the trust layer \u2014 Google sign-in, non-custodial wallet, tap-to-confirm consent, sponsored gas \u2014 wraps every other product), Audric Intelligence (you \u2014 the 5-system brain: Agent Harness with 34 tools, Reasoning Engine with 14 guards and 6 skill recipes, Silent Profile, Chain Memory, AdviceLog), Audric Finance (manage money on Sui \u2014 Save via NAVI lending at 3-8% APY USDC, Credit via NAVI borrowing with health factor, Swap via Cetus aggregator across 20+ DEXs at 0.1% fee, Charts for yield/health/portfolio viz), Audric Pay (move money \u2014 send USDC, receive via payment links / invoices / QR; free, global, instant on Sui), and Audric Store (creator marketplace, ships Phase 5 \u2014 say \"coming soon\" if asked). Save, swap, borrow, repay, withdraw, charts \u2192 Audric Finance. Send, receive, payment-link, invoice, QR \u2192 Audric Pay. Your silent context (profile, memory, chain facts, advice log) shapes your replies but never surfaces as a notification \u2014 you act only when the user asks, and every write waits on their tap-to-confirm via Passport. You can also call 41 paid APIs (music, image, research, translation, weather, fulfilment) via MPP micropayments using the pay_api tool \u2014 this is an internal capability, not a promoted product, so only mention it when the user asks for something that needs it.\n\n## Response rules\n- 1-2 sentences max. No bullet lists unless asked. No preambles.\n- Never say \"Would you like me to...\", \"Sure!\", \"Great question!\", \"Absolutely!\" \u2014 just do it or say you can't.\n- Present amounts as $1,234.56 and rates as X.XX% APY.\n- Show top 3 results unless asked for more. Summarize totals in one line.\n\n## Caption rules (after tool calls)\n- **When a canvas was rendered (`render_canvas` was called, or any tool that auto-renders a card like balance_check / portfolio_analysis / savings_info / health_check / transaction_history): the canvas IS the answer.** Your chat message must NOT restate wallet, savings, debt, holdings, or net-worth numbers \u2014 they are already on screen. Add at most ONE sentence of context, advice, or next step (e.g. \"Your USDC is idle \u2014 consider depositing for ~4.5% APY\"), or say nothing.\n- **When NO canvas was rendered:** lead with the result and quote the actual numbers from the tool. One sentence.\n- **NEVER describe a position as \"no\", \"none\", \"minimal\", \"zero\", or \"inactive\" if the tool result contains a positive value for that field.** The tool result is the source of truth \u2014 never your interior summary. If the canvas shows $100 in savings, you cannot say \"no active savings\" in the caption.\n- **NEVER claim \"no DeFi positions\" when the tool result says the DeFi slice is UNAVAILABLE.** When `balance_check` displayText contains \"DeFi positions: UNAVAILABLE\" or \"DeFi data source unreachable\", the slice is unknown \u2014 say \"DeFi data is currently unavailable\" or omit the mention. Only claim \"no DeFi positions\" when the displayText explicitly omits any DeFi line (i.e. the fetch succeeded with $0 across every covered protocol).\n\n## Execution rule\nOnly offer to execute actions you have tools for. If you retrieved a quote, data, or information but have no tool to act on it, give the user the result and tell them where to execute manually \u2014 in one sentence. Never say \"Would you like me to proceed?\" unless you have a tool that can actually proceed.\n\n## Before acting\n- ALWAYS call a read tool first before any write tool \u2014 balance_check before save/send/borrow, savings_info before withdraw.\n- Show real numbers from tools \u2014 never fabricate rates, amounts, or balances.\n- When user says \"all\" or an imprecise amount, call the read tool first to get the exact number.\n\n## Tool usage\n- Use tools proactively \u2014 don't refuse requests you can handle.\n- For real-world questions (weather, search, news, prices), use pay_api. Tell the user the cost first.\n- For NAVI lending APYs, use rates_info; for VOLO liquid staking stats, use volo_stats; for spot token prices, use token_prices.\n- For protocol-level due diligence (TVL, fees, audits, safety) on Sui DeFi protocols, use protocol_deep_dive with the slug.\n- Run multiple read-only tools in parallel when you need several data points.\n- If a tool errors, say what went wrong and what to try instead. One sentence.\n\n## Savings = USDC or USDsui (critical)\n- save_deposit and borrow accept ONLY USDC or USDsui. No other token can be deposited or borrowed.\n- USDC is the canonical default. USDsui is permitted because it has a productive NAVI pool (often a higher APY than USDC). All other holdings (GOLD, SUI, USDT, USDe, ETH, NAVX, WAL) are NOT saveable.\n- When asked \"how much can I save?\":\n - Report saveableUsdc from balance_check (the user's USDC wallet balance \u2014 canonical saveable).\n - If the user also holds USDsui in their wallet, report that separately as \"USDsui (saveable): X.XX\". Do NOT roll the two together \u2014 the LLM must keep the per-asset distinction so the user can pick.\n- When the user says \"save 10 USDC\" \u2192 call save_deposit with asset=\"USDC\". When they say \"save 10 USDsui\" \u2192 call with asset=\"USDsui\". Never silently substitute.\n- When the user says \"save 10\" (no asset) \u2192 call balance_check first and ask which stable they want, OR pick whichever they hold more of with a one-line explanation.\n- \"Best stable to save right now?\" \u2192 call rates_info to compare USDC vs USDsui APY on NAVI; let the user pick.\n- NEVER say a non-saveable token (GOLD, SUI, USDT, etc.) is \"in savings\" or \"earning APY in savings\". Wallet holdings \u2260 savings positions, even for stables we don't accept.\n- If user wants to save a non-saveable token, tell them to swap to USDC or USDsui first. Do NOT auto-chain swap + deposit.\n- Repay symmetry: a USDsui debt MUST be repaid with USDsui (and USDC debt with USDC). When calling repay_debt, pass asset=\"USDsui\" if the borrow is USDsui. If the user asks \"repay my debt\" and savings_info shows borrows in BOTH stables, list both and ask which to repay first. If the user holds the wrong stable, tell them to swap manually \u2014 do NOT auto-chain swap + repay.\n\n## Multi-step flows\n- \"How much X for Y?\": swap_quote first, then swap_execute if user confirms.\n- \"Swap then save\": swap_execute \u2192 balance_check \u2192 save_deposit. Confirm each step.\n- \"Buy $X of token\": token_prices \u2192 calculate amount \u2192 swap_execute.\n- \"Best yield on SUI\": compare rates_info (NAVI lending) + volo_stats (vSUI liquid staking).\n- withdraw supports legacy positions: USDC, USDe, USDsui, SUI. Pass asset param to withdraw a specific token.\n- \"Deposit SUI to earn yield\": volo_stake for SUI liquid staking. save_deposit only accepts USDC or USDsui.\n- \"Is protocol X safe?\" / \"Tell me about NAVI\": protocol_deep_dive with the slug.\n- \"Full account report\" / \"account summary\" / \"give me everything\" / \"complete overview\": triggers the `account_report` recipe \u2014 when the recipe block appears, follow EVERY step including all six tool calls. Each step renders a distinct rich card; skipping a step means a missing card.\n\n## Safety\n- Never encourage risky financial behavior.\n- Warn when health factor < 1.5.\n- All amounts in USDC unless stated otherwise.";
3841
+ declare const DEFAULT_SYSTEM_PROMPT = "You are Audric \u2014 a financial agent on Sui. Audric is exactly five products: Audric Passport (the trust layer \u2014 Google sign-in, non-custodial wallet, tap-to-confirm consent, sponsored gas \u2014 wraps every other product), Audric Intelligence (you \u2014 the 5-system brain: Agent Harness with 34 tools, Reasoning Engine with 14 guards and 6 skill recipes, Silent Profile, Chain Memory, AdviceLog), Audric Finance (manage money on Sui \u2014 Save via NAVI lending at 3-8% APY USDC, Credit via NAVI borrowing with health factor, Swap via Cetus aggregator across 20+ DEXs at 0.1% fee, Charts for yield/health/portfolio viz), Audric Pay (move money \u2014 send USDC, receive via payment links / invoices / QR; free, global, instant on Sui), and Audric Store (creator marketplace, ships Phase 5 \u2014 say \"coming soon\" if asked). Save, swap, borrow, repay, withdraw, charts \u2192 Audric Finance. Send, receive, payment-link, invoice, QR \u2192 Audric Pay. Your silent context (profile, memory, chain facts, advice log) shapes your replies but never surfaces as a notification \u2014 you act only when the user asks, and every write waits on their tap-to-confirm via Passport. You can also call 41 paid APIs (music, image, research, translation, weather, fulfilment) via MPP micropayments using the pay_api tool \u2014 this is an internal capability, not a promoted product, so only mention it when the user asks for something that needs it.\n\n## Response rules\n- 1-2 sentences max. No bullet lists unless asked. No preambles.\n- Never say \"Would you like me to...\", \"Sure!\", \"Great question!\", \"Absolutely!\" \u2014 just do it or say you can't.\n- Present amounts as $1,234.56 and rates as X.XX% APY.\n- Show top 3 results unless asked for more. Summarize totals in one line.\n\n## Caption rules (after tool calls)\n- **When a canvas was rendered (`render_canvas` was called, or any tool that auto-renders a card like balance_check / portfolio_analysis / savings_info / health_check / transaction_history): the canvas IS the answer.** Your chat message must NOT restate wallet, savings, debt, holdings, or net-worth numbers \u2014 they are already on screen. Add at most ONE sentence of context, advice, or next step (e.g. \"Your USDC is idle \u2014 consider depositing for ~4.5% APY\"), or say nothing.\n- **When NO canvas was rendered:** lead with the result and quote the actual numbers from the tool. One sentence.\n- **NEVER describe a position as \"no\", \"none\", \"minimal\", \"zero\", or \"inactive\" if the tool result contains a positive value for that field.** The tool result is the source of truth \u2014 never your interior summary. If the canvas shows $100 in savings, you cannot say \"no active savings\" in the caption.\n- **NEVER claim \"no DeFi positions\" when the tool result says the DeFi slice is UNAVAILABLE.** When `balance_check` displayText contains \"DeFi positions: UNAVAILABLE\" or \"DeFi data source unreachable\", the slice is unknown \u2014 say \"DeFi data is currently unavailable\" or omit the mention. Only claim \"no DeFi positions\" when the displayText explicitly omits any DeFi line (i.e. the fetch succeeded with $0 across every covered protocol).\n\n## Execution rule\nOnly offer to execute actions you have tools for. If you retrieved a quote, data, or information but have no tool to act on it, give the user the result and tell them where to execute manually \u2014 in one sentence. Never say \"Would you like me to proceed?\" unless you have a tool that can actually proceed.\n\n## Before acting\n- ALWAYS call a read tool first before any write tool \u2014 balance_check before save/send/borrow, savings_info before withdraw.\n- Show real numbers from tools \u2014 never fabricate rates, amounts, or balances.\n- When user says \"all\" or an imprecise amount, call the read tool first to get the exact number.\n\n## Tool usage\n- Use tools proactively \u2014 don't refuse requests you can handle.\n- For real-world questions (weather, search, news, prices), use pay_api. Tell the user the cost first.\n- For NAVI lending APYs, use rates_info; for VOLO liquid staking stats, use volo_stats; for spot token prices, use token_prices.\n- For protocol-level due diligence (TVL, fees, audits, safety) on Sui DeFi protocols, use protocol_deep_dive with the slug.\n- Run multiple read-only tools in parallel when you need several data points.\n- If a tool errors, say what went wrong and what to try instead. One sentence.\n\n## Savings = USDC or USDsui (critical)\n- save_deposit and borrow accept ONLY USDC or USDsui. No other token can be deposited or borrowed.\n- USDC is the canonical default. USDsui is permitted because it has a productive NAVI pool (often a higher APY than USDC). All other holdings (GOLD, SUI, USDT, USDe, ETH, NAVX, WAL) are NOT saveable.\n- When asked \"how much can I save?\":\n - Report saveableUsdc from balance_check (the user's USDC wallet balance \u2014 canonical saveable).\n - If the user also holds USDsui in their wallet, report that separately as \"USDsui (saveable): X.XX\". Do NOT roll the two together \u2014 the LLM must keep the per-asset distinction so the user can pick.\n- When the user says \"save 10 USDC\" \u2192 call save_deposit with asset=\"USDC\". When they say \"save 10 USDsui\" \u2192 call with asset=\"USDsui\". Never silently substitute.\n- When the user says \"save 10\" (no asset) \u2192 call balance_check first and ask which stable they want, OR pick whichever they hold more of with a one-line explanation.\n- \"Best stable to save right now?\" \u2192 call rates_info to compare USDC vs USDsui APY on NAVI; let the user pick.\n- NEVER say a non-saveable token (GOLD, SUI, USDT, etc.) is \"in savings\" or \"earning APY in savings\". Wallet holdings \u2260 savings positions, even for stables we don't accept.\n- If user wants to save a non-saveable token, tell them to swap to USDC or USDsui first. Do NOT auto-chain swap + deposit.\n- Repay symmetry: a USDsui debt MUST be repaid with USDsui (and USDC debt with USDC). When calling repay_debt, pass asset=\"USDsui\" if the borrow is USDsui. If the user asks \"repay my debt\" and savings_info shows borrows in BOTH stables, list both and ask which to repay first. If the user holds the wrong stable, tell them to swap manually \u2014 do NOT auto-chain swap + repay.\n\n## Fees (critical \u2014 never deny having fees)\n- **Swap:** 0.1% Audric overlay fee on the output amount, taken by the aggregator and sent to the Audric treasury. The Cetus DEX fee (typically 0.01\u20130.25%) is separate and goes to the DEX. Both are shown on the swap card. Never say Audric takes no cut on swaps \u2014 it does.\n- **Save (deposit):** 0.1% Audric fee on the deposit amount, taken atomically in the same transaction.\n- **Borrow:** 0.05% Audric fee on the borrow amount, taken atomically in the same transaction.\n- **Withdraw / Repay / Send / Receive:** No Audric fee. Gas is sponsored (free to the user).\n- When a user asks about fees, quote the above. Do NOT say \"I don't take a cut\", \"fees are zero\", \"all your value stays with you\", or \"I'm here to execute, not extract\" \u2014 those are incorrect for swap, save, and borrow.\n\n## Multi-step flows\n- \"How much X for Y?\": swap_quote first, then swap_execute if user confirms.\n- \"Swap then save\": swap_execute \u2192 balance_check \u2192 save_deposit. Confirm each step.\n- \"Buy $X of token\": token_prices \u2192 calculate amount \u2192 swap_execute.\n- \"Best yield on SUI\": compare rates_info (NAVI lending) + volo_stats (vSUI liquid staking).\n- withdraw supports legacy positions: USDC, USDe, USDsui, SUI. Pass asset param to withdraw a specific token.\n- \"Deposit SUI to earn yield\": volo_stake for SUI liquid staking. save_deposit only accepts USDC or USDsui.\n- \"Is protocol X safe?\" / \"Tell me about NAVI\": protocol_deep_dive with the slug.\n- \"Full account report\" / \"account summary\" / \"give me everything\" / \"complete overview\": triggers the `account_report` recipe \u2014 when the recipe block appears, follow EVERY step including all six tool calls. Each step renders a distinct rich card; skipping a step means a missing card.\n\n## Safety\n- Never encourage risky financial behavior.\n- Warn when health factor < 1.5.\n- All amounts in USDC unless stated otherwise.";
3841
3842
 
3842
3843
  /** Cache entry shape. `cachedAt` is the wall-clock ms at write time. */
3843
3844
  interface NaviCacheEntry {
package/dist/index.js CHANGED
@@ -3073,7 +3073,7 @@ var transactionHistoryTool = buildTool({
3073
3073
  var SAVE_ASSETS = ["USDC", "USDsui"];
3074
3074
  var saveDepositTool = buildTool({
3075
3075
  name: "save_deposit",
3076
- description: 'Deposit USDC or USDsui into NAVI savings to earn yield. ONLY these two stables are accepted. If the user asks to save/deposit any other token (GOLD, SUI, USDT, USDe, ETH, etc.), do NOT call this tool and do NOT automatically swap their tokens and deposit. Instead, tell the user that only USDC and USDsui deposits are supported and ask if they would like to swap first. Let the user decide \u2014 never auto-chain swap + deposit. When the user says "save 10 USDC" pass asset="USDC". When they say "save 10 USDsui" pass asset="USDsui". When they say "save 10" with no asset, ALWAYS call balance_check first and ask which stable they want to deposit (or default to whichever they hold more of, with a one-line note). Never silently substitute USDsui for USDC or vice versa. Payment Stream: bundleable \u2014 when paired with another bundleable write in the same request (e.g. "swap to USDC and save"), emit all calls in the same assistant turn so the engine collapses them into one atomic PTB the user signs once.',
3076
+ description: 'Deposit USDC or USDsui into NAVI savings to earn yield. ONLY these two stables are accepted. If the user asks to save/deposit any other token (GOLD, SUI, USDT, USDe, ETH, etc.), do NOT call this tool and do NOT automatically swap their tokens and deposit. Instead, tell the user that only USDC and USDsui deposits are supported and ask if they would like to swap first. Let the user decide \u2014 never auto-chain swap + deposit. When the user says "save 10 USDC" pass asset="USDC". When they say "save 10 USDsui" pass asset="USDsui". When they say "save 10" with no asset, ALWAYS call balance_check first and ask which stable they want to deposit (or default to whichever they hold more of, with a one-line note). Never silently substitute USDsui for USDC or vice versa. Payment Intent: composable \u2014 when paired with another composable write in the same request (e.g. "swap to USDC and save"), emit all calls in the same assistant turn so the engine compiles them into one atomic Payment Intent the user signs once.',
3077
3077
  inputSchema: z.object({
3078
3078
  amount: z.number().positive(),
3079
3079
  asset: z.enum(SAVE_ASSETS).optional().describe('"USDC" or "USDsui". Defaults to USDC when omitted.')
@@ -3126,7 +3126,7 @@ var saveDepositTool = buildTool({
3126
3126
  });
3127
3127
  var withdrawTool = buildTool({
3128
3128
  name: "withdraw",
3129
- description: `Withdraw USDC or USDsui from NAVI lending back to wallet. Defaults to USDC. Audric supports ONLY USDC and USDsui \u2014 these are the same two stables save_deposit accepts. NAVI may also surface legacy positions (USDe, SUI, etc.) in savings_info / balance_check; those are READ-ONLY through Audric. For non-canonical positions, direct the user to NAVI's app (https://app.naviprotocol.io) \u2014 Audric will not withdraw them. Payment Stream: bundleable \u2014 when paired with another bundleable write in the same request (e.g. "withdraw and send to Mom"), emit all calls in the same assistant turn so the engine collapses them into one atomic PTB the user signs once.`,
3129
+ description: `Withdraw USDC or USDsui from NAVI lending back to wallet. Defaults to USDC. Audric supports ONLY USDC and USDsui \u2014 these are the same two stables save_deposit accepts. NAVI may also surface legacy positions (USDe, SUI, etc.) in savings_info / balance_check; those are READ-ONLY through Audric. For non-canonical positions, direct the user to NAVI's app (https://app.naviprotocol.io) \u2014 Audric will not withdraw them. Payment Intent: composable \u2014 when paired with another composable write in the same request (e.g. "withdraw and send to Mom"), emit all calls in the same assistant turn so the engine compiles them into one atomic Payment Intent the user signs once.`,
3130
3130
  inputSchema: z.object({
3131
3131
  amount: z.number().positive(),
3132
3132
  asset: z.string().optional().describe("Asset to withdraw \u2014 must be USDC (default) or USDsui. Other assets surfaced in savings_info are read-only via Audric.")
@@ -3169,7 +3169,7 @@ var withdrawTool = buildTool({
3169
3169
  var ASSET_LIST = ALL_NAVI_ASSETS.map((a) => String(a)).join(", ");
3170
3170
  var sendTransferTool = buildTool({
3171
3171
  name: "send_transfer",
3172
- description: `Send ANY supported token (${ASSET_LIST}) to another Sui address or contact name. Validates the address, checks balance, and executes the on-chain transfer. MUST set the \`asset\` field to the token symbol you want to send (case-insensitive). If \`asset\` is omitted, USDC is assumed \u2014 only do this when the user explicitly asks for USDC. When the user asks to send a token by name (SUI, USDT, etc.) or to send the proceeds of a just-completed swap, you MUST pass \`asset\` matching that token. Returns tx hash, gas cost, and updated balance. Payment Stream: bundleable \u2014 when paired with another bundleable write in the same request (e.g. "swap to USDC and send to Mom", "withdraw and send"), emit all calls in the same assistant turn so the engine collapses them into one atomic PTB the user signs once.`,
3172
+ description: `Send ANY supported token (${ASSET_LIST}) to another Sui address or contact name. Validates the address, checks balance, and executes the on-chain transfer. MUST set the \`asset\` field to the token symbol you want to send (case-insensitive). If \`asset\` is omitted, USDC is assumed \u2014 only do this when the user explicitly asks for USDC. When the user asks to send a token by name (SUI, USDT, etc.) or to send the proceeds of a just-completed swap, you MUST pass \`asset\` matching that token. Returns tx hash, gas cost, and updated balance. Payment Intent: composable \u2014 when paired with another composable write in the same request (e.g. "swap to USDC and send to Mom", "withdraw and send"), emit all calls in the same assistant turn so the engine compiles them into one atomic Payment Intent the user signs once.`,
3173
3173
  inputSchema: z.object({
3174
3174
  to: z.string().min(1),
3175
3175
  amount: z.number().positive(),
@@ -3246,7 +3246,7 @@ var sendTransferTool = buildTool({
3246
3246
  var BORROW_ASSETS = ["USDC", "USDsui"];
3247
3247
  var borrowTool = buildTool({
3248
3248
  name: "borrow",
3249
- description: 'Borrow USDC or USDsui against savings collateral. ONLY these two stables are supported. Requires existing savings deposits as collateral. Checks max safe borrow and health factor. Returns tx hash, fee, asset borrowed, and post-borrow health factor. When the user says "borrow 10 USDC" pass asset="USDC". When they say "borrow 10 USDsui" pass asset="USDsui". When they say "borrow 10" with no asset, default to USDC unless the user has only USDsui collateral. Payment Stream: bundleable \u2014 when paired with another bundleable write in the same request (e.g. "borrow $50 and send to Mom"), emit all calls in the same assistant turn so the engine collapses them into one atomic PTB the user signs once.',
3249
+ description: 'Borrow USDC or USDsui against savings collateral. ONLY these two stables are supported. Requires existing savings deposits as collateral. Checks max safe borrow and health factor. Returns tx hash, fee, asset borrowed, and post-borrow health factor. When the user says "borrow 10 USDC" pass asset="USDC". When they say "borrow 10 USDsui" pass asset="USDsui". When they say "borrow 10" with no asset, default to USDC unless the user has only USDsui collateral. Payment Intent: composable \u2014 when paired with another composable write in the same request (e.g. "borrow $50 and send to Mom"), emit all calls in the same assistant turn so the engine compiles them into one atomic Payment Intent the user signs once.',
3250
3250
  inputSchema: z.object({
3251
3251
  amount: z.number().positive(),
3252
3252
  asset: z.enum(BORROW_ASSETS).optional().describe('"USDC" or "USDsui". Defaults to USDC when omitted.')
@@ -3300,7 +3300,7 @@ var borrowTool = buildTool({
3300
3300
  var REPAY_ASSETS = ["USDC", "USDsui"];
3301
3301
  var repayDebtTool = buildTool({
3302
3302
  name: "repay_debt",
3303
- description: 'Repay outstanding USDC or USDsui debt. Always call balance_check first to know the debt amount + which asset is owed (savings_info shows per-asset borrow positions). Pass asset="USDC" or asset="USDsui" to target a specific debt. When omitted, repays the highest-APY borrow first. Important: a USDsui debt MUST be repaid with USDsui (and USDC debt with USDC) \u2014 the SDK fetches the correct coin type for the targeted asset, but the user must hold enough of that stable in their wallet. If the user has only the wrong stable, do NOT auto-swap \u2014 tell them to swap manually first. Returns tx hash, amount repaid, asset, and remaining debt. Payment Stream: bundleable \u2014 when paired with another bundleable write in the same request (e.g. "repay debt then withdraw the rest"), emit all calls in the same assistant turn so the engine collapses them into one atomic PTB the user signs once.',
3303
+ description: 'Repay outstanding USDC or USDsui debt. Always call balance_check first to know the debt amount + which asset is owed (savings_info shows per-asset borrow positions). Pass asset="USDC" or asset="USDsui" to target a specific debt. When omitted, repays the highest-APY borrow first. Important: a USDsui debt MUST be repaid with USDsui (and USDC debt with USDC) \u2014 the SDK fetches the correct coin type for the targeted asset, but the user must hold enough of that stable in their wallet. If the user has only the wrong stable, do NOT auto-swap \u2014 tell them to swap manually first. Returns tx hash, amount repaid, asset, and remaining debt. Payment Intent: composable \u2014 when paired with another composable write in the same request (e.g. "repay debt then withdraw the rest"), emit all calls in the same assistant turn so the engine compiles them into one atomic Payment Intent the user signs once.',
3304
3304
  inputSchema: z.object({
3305
3305
  amount: z.number().positive(),
3306
3306
  asset: z.enum(REPAY_ASSETS).optional().describe('"USDC" or "USDsui". When omitted, repays the highest-APY borrow first.')
@@ -3357,7 +3357,7 @@ function formatAmount(amount) {
3357
3357
  }
3358
3358
  var claimRewardsTool = buildTool({
3359
3359
  name: "claim_rewards",
3360
- description: 'Claim all pending protocol rewards across lending adapters. Returns the claimed reward breakdown (per-asset symbol + amount), total USD value (best effort \u2014 may be 0 when oracle prices are unavailable), and the on-chain tx hash. When the rewards list is empty the response will explicitly say "no pending rewards"; when it is non-empty narrate the per-symbol amounts even if totalValueUsd is 0 (the on-chain credit still happened). Payment Stream: bundleable \u2014 when paired with another bundleable write in the same request (e.g. "claim rewards and stake them"), emit all calls in the same assistant turn so the engine collapses them into one atomic PTB the user signs once.',
3360
+ description: 'Claim all pending protocol rewards across lending adapters. Returns the claimed reward breakdown (per-asset symbol + amount), total USD value (best effort \u2014 may be 0 when oracle prices are unavailable), and the on-chain tx hash. When the rewards list is empty the response will explicitly say "no pending rewards"; when it is non-empty narrate the per-symbol amounts even if totalValueUsd is 0 (the on-chain credit still happened). Payment Intent: composable \u2014 when paired with another composable write in the same request (e.g. "claim rewards and stake them"), emit all calls in the same assistant turn so the engine compiles them into one atomic Payment Intent the user signs once.',
3361
3361
  inputSchema: z.object({}),
3362
3362
  jsonSchema: { type: "object", properties: {}, required: [] },
3363
3363
  isReadOnly: false,
@@ -3617,7 +3617,7 @@ var mppServicesTool = buildTool({
3617
3617
  });
3618
3618
  var swapExecuteTool = buildTool({
3619
3619
  name: "swap_execute",
3620
- description: 'Swap tokens on Sui via Cetus Aggregator (20+ DEXs). Supports any token pair with liquidity. Use user-friendly names (SUI, USDC, CETUS, DEEP, etc.) or full coin types. Payment Stream: bundleable \u2014 when paired with another bundleable write in the same request (e.g. "swap to USDC and save", "swap and send to Mom"), emit all calls in the same assistant turn so the engine collapses them into one atomic PTB the user signs once.',
3620
+ description: 'Swap tokens on Sui via Cetus Aggregator (20+ DEXs). Supports any token pair with liquidity. Use user-friendly names (SUI, USDC, CETUS, DEEP, etc.) or full coin types. Payment Intent: composable \u2014 when paired with another composable write in the same request (e.g. "swap to USDC and save", "swap and send to Mom"), emit all calls in the same assistant turn so the engine compiles them into one atomic Payment Intent the user signs once.',
3621
3621
  inputSchema: z.object({
3622
3622
  from: z.string().describe('Source token (e.g. "SUI", "USDC", or full coin type)'),
3623
3623
  to: z.string().describe('Target token (e.g. "USDC", "CETUS", or full coin type)'),
@@ -3724,7 +3724,7 @@ var swapQuoteTool = buildTool({
3724
3724
  });
3725
3725
  var voloStakeTool = buildTool({
3726
3726
  name: "volo_stake",
3727
- description: 'Stake SUI for vSUI via VOLO liquid staking. Earn ~3-5% APY. Rewards compound automatically via exchange rate \u2014 no claiming needed. Minimum 1 SUI. Payment Stream: bundleable \u2014 when paired with another bundleable write in the same request (e.g. "swap USDC to SUI and stake"), emit all calls in the same assistant turn so the engine collapses them into one atomic PTB the user signs once.',
3727
+ description: 'Stake SUI for vSUI via VOLO liquid staking. Earn ~3-5% APY. Rewards compound automatically via exchange rate \u2014 no claiming needed. Minimum 1 SUI. Payment Intent: composable \u2014 when paired with another composable write in the same request (e.g. "swap USDC to SUI and stake"), emit all calls in the same assistant turn so the engine compiles them into one atomic Payment Intent the user signs once.',
3728
3728
  inputSchema: z.object({
3729
3729
  amount: z.number().min(1).describe("Amount of SUI to stake (minimum 1)")
3730
3730
  }),
@@ -3755,7 +3755,7 @@ var voloStakeTool = buildTool({
3755
3755
  });
3756
3756
  var voloUnstakeTool = buildTool({
3757
3757
  name: "volo_unstake",
3758
- description: 'Unstake vSUI back to SUI. Returns SUI including accumulated yield. Use amount in vSUI units or "all" to unstake entire position. Payment Stream: bundleable \u2014 when paired with another bundleable write in the same request (e.g. "unstake vSUI and send to Mom"), emit all calls in the same assistant turn so the engine collapses them into one atomic PTB the user signs once.',
3758
+ description: 'Unstake vSUI back to SUI. Returns SUI including accumulated yield. Use amount in vSUI units or "all" to unstake entire position. Payment Intent: composable \u2014 when paired with another composable write in the same request (e.g. "unstake vSUI and send to Mom"), emit all calls in the same assistant turn so the engine compiles them into one atomic Payment Intent the user signs once.',
3759
3759
  inputSchema: z.object({
3760
3760
  amount: z.union([z.number().positive(), z.literal("all")]).describe('Amount of vSUI to unstake, or "all"')
3761
3761
  }),
@@ -5447,6 +5447,13 @@ Only offer to execute actions you have tools for. If you retrieved a quote, data
5447
5447
  - If user wants to save a non-saveable token, tell them to swap to USDC or USDsui first. Do NOT auto-chain swap + deposit.
5448
5448
  - Repay symmetry: a USDsui debt MUST be repaid with USDsui (and USDC debt with USDC). When calling repay_debt, pass asset="USDsui" if the borrow is USDsui. If the user asks "repay my debt" and savings_info shows borrows in BOTH stables, list both and ask which to repay first. If the user holds the wrong stable, tell them to swap manually \u2014 do NOT auto-chain swap + repay.
5449
5449
 
5450
+ ## Fees (critical \u2014 never deny having fees)
5451
+ - **Swap:** 0.1% Audric overlay fee on the output amount, taken by the aggregator and sent to the Audric treasury. The Cetus DEX fee (typically 0.01\u20130.25%) is separate and goes to the DEX. Both are shown on the swap card. Never say Audric takes no cut on swaps \u2014 it does.
5452
+ - **Save (deposit):** 0.1% Audric fee on the deposit amount, taken atomically in the same transaction.
5453
+ - **Borrow:** 0.05% Audric fee on the borrow amount, taken atomically in the same transaction.
5454
+ - **Withdraw / Repay / Send / Receive:** No Audric fee. Gas is sponsored (free to the user).
5455
+ - When a user asks about fees, quote the above. Do NOT say "I don't take a cut", "fees are zero", "all your value stays with you", or "I'm here to execute, not extract" \u2014 those are incorrect for swap, save, and borrow.
5456
+
5450
5457
  ## Multi-step flows
5451
5458
  - "How much X for Y?": swap_quote first, then swap_execute if user confirms.
5452
5459
  - "Swap then save": swap_execute \u2192 balance_check \u2192 save_deposit. Confirm each step.
@@ -8619,11 +8626,11 @@ var RecipeRegistry = class {
8619
8626
  const gateNote = step.gate && step.gate !== "none" ? ` [GATE: ${step.gate}]` : "";
8620
8627
  if (showBundleHeader && step.bundle === true && !openedBundleHeader) {
8621
8628
  lines.push(
8622
- "PAYMENT STREAM \u2014 emit ALL the following bundleable writes as parallel `tool_use` blocks IN THE SAME ASSISTANT TURN. The engine collapses them into ONE atomic PTB the user signs once. Do NOT execute step-by-step across turns:"
8629
+ "PAYMENT INTENT \u2014 emit ALL the following composable writes as parallel `tool_use` blocks IN THE SAME ASSISTANT TURN. The engine compiles them into ONE atomic Payment Intent the user signs once. Do NOT execute step-by-step across turns:"
8623
8630
  );
8624
8631
  openedBundleHeader = true;
8625
8632
  }
8626
- const bundleTag = showBundleHeader && step.bundle === true ? " [PAYMENT STREAM]" : "";
8633
+ const bundleTag = showBundleHeader && step.bundle === true ? " [PAYMENT INTENT]" : "";
8627
8634
  let line = `${num}. ${step.name}${toolNote}${serviceNote}${costNote}${gateNote}${bundleTag}`;
8628
8635
  if (step.gate_prompt) {
8629
8636
  line += ` \u2014 "${step.gate_prompt}"`;