@t2000/engine 0.40.4 → 0.41.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
@@ -189,6 +189,19 @@ interface GuardEvent {
189
189
  tier: GuardTier;
190
190
  message?: string;
191
191
  }
192
+ /**
193
+ * [v1.4 Item 4] Per-guard metric emitted via `EngineConfig.onGuardFired`.
194
+ * Hosts (e.g. audric `TurnMetricsCollector`) accumulate these for the
195
+ * `TurnMetrics.guardsFired` JSON column. Mirrors `GuardEvent` but with
196
+ * a coarser tri-state action (allow/warn/block) so the host doesn't
197
+ * need to know the engine's verdict vocabulary.
198
+ */
199
+ interface GuardMetric {
200
+ name: string;
201
+ tier: GuardTier;
202
+ action: 'allow' | 'warn' | 'block';
203
+ injectionAdded: boolean;
204
+ }
192
205
  interface GuardConfig {
193
206
  balanceValidation?: boolean;
194
207
  healthFactor?: {
@@ -236,7 +249,14 @@ declare function createGuardRunnerState(): GuardRunnerState;
236
249
  declare function runGuards(tool: Tool, call: PendingToolCall, state: GuardRunnerState, config: GuardConfig, conversationContext: {
237
250
  fullText: string;
238
251
  lastAssistantText: string;
239
- }): GuardCheckResult;
252
+ },
253
+ /**
254
+ * [v1.4 Item 4] Optional per-guard observation hook. Fired exactly
255
+ * once per non-`pass` guard verdict (i.e. for every event that ends
256
+ * up in `events`/`injections`/`block`). Errors thrown by the host
257
+ * are caught so a misbehaving collector can't break tool execution.
258
+ */
259
+ onGuardFired?: (guard: GuardMetric) => void): GuardCheckResult;
240
260
  declare function updateGuardStateAfterToolResult(toolName: string, tool: Tool | undefined, input: unknown, result: unknown, isError: boolean, state: GuardRunnerState): void;
241
261
  declare function extractConversationText(messages: Array<{
242
262
  role: string;
@@ -338,7 +358,16 @@ declare const PERMISSION_PRESETS: {
338
358
  })[];
339
359
  };
340
360
  };
341
- declare function resolvePermissionTier(operation: string, amountUsd: number, config: UserPermissionConfig): 'auto' | 'confirm' | 'explicit';
361
+ /**
362
+ * Resolve the permission tier for a given operation + USD value.
363
+ *
364
+ * [v1.4] When `sessionSpendUsd` is supplied and adding the incoming
365
+ * `amountUsd` would push cumulative session spend over
366
+ * `config.autonomousDailyLimit`, an otherwise-`auto` tier is downgraded to
367
+ * `confirm`. This is the runtime guard for the daily autonomous spend cap.
368
+ * Tiers above `auto` are returned unchanged.
369
+ */
370
+ declare function resolvePermissionTier(operation: string, amountUsd: number, config: UserPermissionConfig, sessionSpendUsd?: number): 'auto' | 'confirm' | 'explicit';
342
371
  declare function toolNameToOperation(toolName: string): PermissionOperation | undefined;
343
372
  /**
344
373
  * Resolve the USD value of a tool call from its inputs.
@@ -391,6 +420,18 @@ type EngineEvent = {
391
420
  toolUseId: string;
392
421
  result: unknown;
393
422
  isError: boolean;
423
+ /**
424
+ * [v1.4 Item 4] True when the tool was executed by `EarlyToolDispatcher`
425
+ * (read tools dispatched concurrently before the LLM yields). Hosts
426
+ * record this in `TurnMetrics.toolsCalled[].wasEarlyDispatched`.
427
+ */
428
+ wasEarlyDispatched?: boolean;
429
+ /**
430
+ * [v1.4 Item 4] True when this result was synthesized from a previous
431
+ * identical tool call by `microcompact` deduplication, instead of
432
+ * actually re-running the tool.
433
+ */
434
+ resultDeduped?: boolean;
394
435
  } | {
395
436
  type: 'pending_action';
396
437
  action: PendingAction;
@@ -413,8 +454,36 @@ type EngineEvent = {
413
454
  data: unknown;
414
455
  title: string;
415
456
  toolUseId: string;
457
+ }
458
+ /**
459
+ * [v1.4 Item 4] Emitted exactly once per agent turn when context-window
460
+ * compaction fires. Hosts (e.g. audric `TurnMetricsCollector`) flip a
461
+ * boolean for the `TurnMetrics.compactionTriggered` column. Carries no
462
+ * payload — `compactMessages` stays a pure function.
463
+ */
464
+ | {
465
+ type: 'compaction';
416
466
  };
417
467
  type StopReason = 'end_turn' | 'tool_use' | 'max_tokens' | 'max_turns' | 'error';
468
+ /**
469
+ * [v1.4 Item 6] Describes a single input field on a `PendingAction` that
470
+ * the host UI may let the user modify before approving. Carried on the
471
+ * `pending_action` event so clients can render editable controls without
472
+ * hard-coding per-tool field metadata. See
473
+ * `packages/engine/src/tools/tool-modifiable-fields.ts` for the registry.
474
+ */
475
+ interface PendingActionModifiableField {
476
+ /** Input key on the `PendingAction.input` object (e.g. "amount", "to"). */
477
+ name: string;
478
+ /**
479
+ * UI hint for which control to render.
480
+ * - `amount` — numeric input; UI shows a "~Max" hint when balance is known.
481
+ * - `address` — Sui address input with paste/scan affordance.
482
+ */
483
+ kind: 'amount' | 'address';
484
+ /** Optional asset symbol (e.g. "USDC", "SUI", "vSUI") for amount fields. */
485
+ asset?: string;
486
+ }
418
487
  /**
419
488
  * Serializable description of a write tool that needs user approval.
420
489
  * Stored in the session so the client can act on it in a separate request.
@@ -438,6 +507,19 @@ interface PendingAction {
438
507
  _hint?: string;
439
508
  _warning?: string;
440
509
  }>;
510
+ /**
511
+ * [v1.4 Item 6] Fields the host UI may let the user modify before
512
+ * approving. Sourced from `tool-modifiable-fields.ts`. Absent (or
513
+ * empty) means the action is approve-or-deny only.
514
+ */
515
+ modifiableFields?: PendingActionModifiableField[];
516
+ /**
517
+ * [v1.4 Item 6] Monotonic turn index (assistant message count) at the
518
+ * point this pending action was emitted. Hosts use it to update the
519
+ * matching `TurnMetrics` row when the action resolves — see
520
+ * `apps/web/app/api/engine/resume/route.ts` `updateMany` clause.
521
+ */
522
+ turnIndex: number;
441
523
  }
442
524
  /**
443
525
  * Response from the client when resolving a pending action.
@@ -468,6 +550,13 @@ interface ToolContext {
468
550
  priceCache?: Map<string, number>;
469
551
  /** Per-user permission config for USD-threshold write tool gating (B.4). */
470
552
  permissionConfig?: UserPermissionConfig;
553
+ /**
554
+ * [v1.4] Cumulative USD already auto-executed in the current session.
555
+ * Used by `resolvePermissionTier` to enforce `autonomousDailyLimit` —
556
+ * downgrades `auto` to `confirm` when adding the incoming tool's USD
557
+ * value would exceed the limit. Optional; omitted = unbounded.
558
+ */
559
+ sessionSpendUsd?: number;
471
560
  }
472
561
  interface ServerPositionData {
473
562
  savings: number;
@@ -587,6 +676,29 @@ interface EngineConfig {
587
676
  priceCache?: Map<string, number>;
588
677
  /** Per-user permission config for USD-threshold write tool gating (B.4). */
589
678
  permissionConfig?: UserPermissionConfig;
679
+ /**
680
+ * [v1.4] Cumulative USD already auto-executed in the current session.
681
+ * Forwarded to `ToolContext` and consulted by `resolvePermissionTier` to
682
+ * enforce `autonomousDailyLimit`.
683
+ */
684
+ sessionSpendUsd?: number;
685
+ /**
686
+ * [v1.4] Fired after a write tool successfully auto-executes (no
687
+ * confirmation required). Hosts use this to persist cumulative spend in
688
+ * Redis. Errors are caught — the tool result is never blocked by a failure
689
+ * here.
690
+ */
691
+ onAutoExecuted?: (info: {
692
+ toolName: string;
693
+ usdValue: number;
694
+ }) => void | Promise<void>;
695
+ /**
696
+ * [v1.4 Item 4] Per-guard observation hook. Forwarded to `runGuards`
697
+ * and fired once per non-`pass` verdict so hosts can record guard
698
+ * behaviour in `TurnMetrics.guardsFired` without re-implementing the
699
+ * verdict→action mapping. Errors thrown by the host are caught.
700
+ */
701
+ onGuardFired?: (guard: GuardMetric) => void;
590
702
  }
591
703
  interface LLMProvider {
592
704
  chat(params: ChatParams): AsyncGenerator<ProviderEvent>;
@@ -709,6 +821,9 @@ declare class QueryEngine {
709
821
  private readonly contextSummarizer;
710
822
  private readonly priceCache;
711
823
  private readonly permissionConfig;
824
+ private readonly sessionSpendUsd;
825
+ private readonly onAutoExecuted;
826
+ private readonly onGuardFired;
712
827
  private matchedRecipe;
713
828
  private messages;
714
829
  private abortController;
@@ -983,15 +1098,32 @@ interface ConversationStateStore {
983
1098
  }
984
1099
  declare function buildStateContext(state: ConversationState): string;
985
1100
 
1101
+ /**
1102
+ * [v1.4 Item 4] Side-channel return from `microcompact` so callers can
1103
+ * count or surface dedup hits without re-walking the message ledger.
1104
+ * Backwards-compatible: `microcompact(messages)` still returns the
1105
+ * processed `Message[]` (now enriched), and the dedup set lives on the
1106
+ * returned array via a non-enumerable `dedupedToolUseIds` accessor that
1107
+ * the engine reads in its agent loop.
1108
+ */
1109
+ interface MicrocompactResult extends Array<Message> {
1110
+ /**
1111
+ * Tool-use IDs whose prior results were replaced with a compact
1112
+ * back-reference during this pass. Empty when nothing matched.
1113
+ */
1114
+ dedupedToolUseIds: Set<string>;
1115
+ }
986
1116
  /**
987
1117
  * Zero-cost deduplication pass: if the same tool was called with identical
988
1118
  * inputs earlier in the conversation and the result hasn't changed, replace
989
1119
  * the full prior result with a compact back-reference. Runs before any
990
1120
  * LLM-based compaction and costs nothing.
991
1121
  *
992
- * Returns a new array — does not mutate the input.
1122
+ * Returns a new array — does not mutate the input. The returned array
1123
+ * carries a `dedupedToolUseIds` property listing every tool-use ID whose
1124
+ * tool_result block was replaced with a back-reference this pass.
993
1125
  */
994
- declare function microcompact(messages: readonly Message[]): Message[];
1126
+ declare function microcompact(messages: readonly Message[]): MicrocompactResult;
995
1127
 
996
1128
  /**
997
1129
  * EarlyToolDispatcher — dispatches read-only tools mid-stream.
@@ -1421,13 +1553,10 @@ declare const healthCheckTool: Tool<{}, {
1421
1553
  declare const ratesInfoTool: Tool<{}, _t2000_sdk.RatesResult>;
1422
1554
 
1423
1555
  declare const transactionHistoryTool: Tool<{
1556
+ action?: "send" | "swap" | "lending" | "transaction" | undefined;
1424
1557
  date?: string | undefined;
1425
1558
  limit?: number | undefined;
1426
- }, {
1427
- transactions: _t2000_sdk.TransactionRecord[];
1428
- count: number;
1429
- date: string | null;
1430
- }>;
1559
+ }, Record<string, unknown>>;
1431
1560
 
1432
1561
  declare const saveDepositTool: Tool<{
1433
1562
  amount: number;
@@ -1519,21 +1648,8 @@ declare const payApiTool: Tool<{
1519
1648
 
1520
1649
  declare const mppServicesTool: Tool<{
1521
1650
  query?: string | undefined;
1522
- }, {
1523
- services: {
1524
- id: string;
1525
- name: string;
1526
- description: string;
1527
- categories: string[];
1528
- endpoints: {
1529
- url: string;
1530
- method: string;
1531
- description: string;
1532
- price: string;
1533
- }[];
1534
- }[];
1535
- total: number;
1536
- }>;
1651
+ category?: string | undefined;
1652
+ }, Record<string, unknown>>;
1537
1653
 
1538
1654
  declare const swapExecuteTool: Tool<{
1539
1655
  amount: number;
@@ -1724,15 +1840,7 @@ declare const defillamaYieldPoolsTool: Tool<{
1724
1840
  chain?: string | undefined;
1725
1841
  project?: string | undefined;
1726
1842
  minTvl?: number | undefined;
1727
- }, {
1728
- pool: string;
1729
- protocol: string;
1730
- chain: string;
1731
- apy: number;
1732
- apyBase: number | undefined;
1733
- apyReward: number | undefined;
1734
- tvl: number;
1735
- }[]>;
1843
+ }, Record<string, unknown> | unknown[]>;
1736
1844
  declare const defillamaProtocolInfoTool: Tool<{
1737
1845
  name: string;
1738
1846
  }, {
@@ -1791,6 +1899,32 @@ declare const READ_TOOLS: Tool[];
1791
1899
  declare const WRITE_TOOLS: Tool[];
1792
1900
  declare function getDefaultTools(): Tool[];
1793
1901
 
1902
+ /**
1903
+ * tool-modifiable-fields.ts — Audric Harness Correctness Spec v1.4 / Item 6
1904
+ *
1905
+ * Per-tool registry of input fields the host UI may let the user modify
1906
+ * before approving a `PendingAction`. The engine consults this registry
1907
+ * when emitting a `pending_action` event so the client can render an
1908
+ * editable control without hard-coding tool names in the UI layer.
1909
+ *
1910
+ * The plan reserves modification for amount-bearing write tools where the
1911
+ * user might want to lower the amount before confirming (e.g. "save $50"
1912
+ * → user edits to $30 → engine resumes with the modified input). Tools
1913
+ * absent from this registry have no modifiable fields and the UI renders
1914
+ * a static "approve / deny" pair.
1915
+ */
1916
+
1917
+ /**
1918
+ * Tool name → ordered list of modifiable input fields. Order matters for
1919
+ * UI rendering — the first entry typically becomes the prominent control.
1920
+ */
1921
+ declare const TOOL_MODIFIABLE_FIELDS: Record<string, PendingActionModifiableField[]>;
1922
+ /**
1923
+ * Returns the modifiable fields for a tool name, or `undefined` if the tool
1924
+ * has no modifiable inputs. Used by the engine when emitting `pending_action`.
1925
+ */
1926
+ declare function getModifiableFields(toolName: string): PendingActionModifiableField[] | undefined;
1927
+
1794
1928
  declare function requireAgent(context: ToolContext): T2000;
1795
1929
  /**
1796
1930
  * Check if context has an MCP manager with a connected NAVI server
@@ -1834,4 +1968,4 @@ declare function clearPriceCache(): void;
1834
1968
 
1835
1969
  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 40 tools, Reasoning Engine with 9 guards and 7 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- Lead with the result. After tool calls, state the outcome with real numbers. Done.\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## 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 broad market data (yields across protocols, token prices, TVL, protocol comparisons), use defillama_* tools.\n- To discover Sui protocols, use defillama_sui_protocols first, then defillama_protocol_info 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 only (critical)\n- save_deposit accepts ONLY USDC. No other token can be deposited into savings.\n- When asked \"how much can I save?\", report only the user's USDC wallet balance (saveableUsdc field from balance_check). Other tokens like GOLD, SUI, USDT are NOT saveable and NOT savings positions \u2014 they are just wallet holdings.\n- NEVER say a non-USDC token is \"in savings\" or \"earning APY in savings\" unless it appears in the savings_info positions list. Wallet holdings \u2260 savings.\n- If user wants to save non-USDC tokens, tell them to swap to USDC first. Do NOT auto-chain swap + deposit.\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\": defillama_token_prices \u2192 calculate amount \u2192 swap_execute.\n- \"Best yield on SUI\": compare rates_info (NAVI lending) + defillama_yield_pools (broader) + volo_stats.\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 is USDC only.\n- \"What protocols are on Sui?\": defillama_sui_protocols \u2192 defillama_protocol_info for details.\n\n## Safety\n- Never encourage risky financial behavior.\n- Warn when health factor < 1.5.\n- All amounts in USDC unless stated otherwise.";
1836
1970
 
1837
- export { AnthropicProvider, type AnthropicProviderConfig, type BalancePrices, type BalanceResult, BalanceTracker, type BuildToolOptions, CANVAS_TEMPLATES, type CanvasTemplate, type ChatParams, type CompactOptions, type ContentBlock, ContextBudget, type ContextBudgetConfig, type ConversationState, type ConversationStateStore, type CostSnapshot, CostTracker, type CostTrackerConfig, DEFAULT_GUARD_CONFIG, DEFAULT_PERMISSION_CONFIG, DEFAULT_SYSTEM_PROMPT, EarlyToolDispatcher, type EngineConfig, type EngineEvent, type GuardCheckResult, type GuardConfig, type GuardEvent, type GuardInjection, type GuardResult, type GuardRunnerState, type GuardTier, type GuardVerdict, type HealthFactorResult, type LLMProvider, type McpCallResult, McpClientManager, McpResponseCache, type McpServerConfig, type McpServerConnection, type McpToolAdapterConfig, type McpToolDescriptor, MemorySessionStore, type Message, NAVI_MCP_CONFIG, NAVI_MCP_URL, NAVI_SERVER_NAME, type NaviRawCoin, type NaviRawHealthFactor, type NaviRawPool, type NaviRawPosition, type NaviRawPositionsResponse, type NaviRawProtocolStats, type NaviRawRewardsResponse, type NaviReadOptions, NaviTools, type OutputConfig, PERMISSION_PRESETS, type PendingAction, type PendingReward, type PendingToolCall, type PermissionLevel, type PermissionOperation, type PermissionResponse, type PermissionRule, type PositionEntry, type PreflightResult, type ProtocolStats, type ProviderEvent, QueryEngine, READ_TOOLS, type RatesResult, type Recipe, type RecipePrerequisite, RecipeRegistry, type RecipeStep, type RecipeStepOnError, RetryTracker, type SSEEvent, type SavingsResult, type ServerPositionData, type SessionData, type SessionStore, type StateType, type StopReason, type SuiCoinBalance, type SystemBlock, type SystemPrompt, TOOL_FLAGS, type ThinkingConfig, type ThinkingEffort, type Tool, type ToolChoice, type ToolContext, type ToolDefinition, type ToolFlags, type ToolJsonSchema, type ToolResult, TxMutex, type UserFinancialProfile, type UserPermissionConfig, WRITE_TOOLS, type WalletCoin, activitySummaryTool, adaptAllMcpTools, adaptAllServerTools, adaptMcpTool, applyToolFlags, balanceCheckTool, borrowTool, budgetToolResult, buildCachedSystemPrompt, buildMcpTools, buildProactivenessInstructions, buildProfileContext, buildSelfEvaluationInstruction, buildStateContext, buildTool, claimRewardsTool, classifyEffort, clearPriceCache, compactMessages, createGuardRunnerState, defillamaChainTvlTool, defillamaPriceChangeTool, defillamaProtocolFeesTool, defillamaProtocolInfoTool, defillamaSuiProtocolsTool, defillamaTokenPricesTool, defillamaYieldPoolsTool, engineToSSE, estimateTokens, explainTxTool, extractConversationText, extractMcpText, fetchAvailableRewards, fetchBalance, fetchHealthFactor, fetchPositions, fetchProtocolStats, fetchRates, fetchSavings, fetchTokenPrices, fetchWalletCoins, findTool, getDefaultTools, getMcpManager, getToolFlags, getWalletAddress, guardArtifactPreview, guardStaleData, hasNaviMcp, healthCheckTool, loadRecipes, microcompact, mppServicesTool, parseMcpJson, parseRecipe, parseSSE, payApiTool, portfolioAnalysisTool, protocolDeepDiveTool, ratesInfoTool, registerEngineTools, renderCanvasTool, repayDebtTool, requireAgent, resolvePermissionTier, resolveUsdValue, runGuards, runTools, saveContactTool, saveDepositTool, savingsInfoTool, sendTransferTool, serializeSSE, spendingAnalyticsTool, swapExecuteTool, swapQuoteTool, toolNameToOperation, toolsToDefinitions, transactionHistoryTool, transformBalance, transformHealthFactor, transformPositions, transformRates, transformRewards, transformSavings, updateGuardStateAfterToolResult, validateHistory, voloStakeTool, voloStatsTool, voloUnstakeTool, webSearchTool, withdrawTool, yieldSummaryTool };
1971
+ export { AnthropicProvider, type AnthropicProviderConfig, type BalancePrices, type BalanceResult, BalanceTracker, type BuildToolOptions, CANVAS_TEMPLATES, type CanvasTemplate, type ChatParams, type CompactOptions, type ContentBlock, ContextBudget, type ContextBudgetConfig, type ConversationState, type ConversationStateStore, type CostSnapshot, CostTracker, type CostTrackerConfig, DEFAULT_GUARD_CONFIG, DEFAULT_PERMISSION_CONFIG, DEFAULT_SYSTEM_PROMPT, EarlyToolDispatcher, type EngineConfig, type EngineEvent, type GuardCheckResult, type GuardConfig, type GuardEvent, type GuardInjection, type GuardResult, type GuardRunnerState, type GuardTier, type GuardVerdict, type HealthFactorResult, type LLMProvider, type McpCallResult, McpClientManager, McpResponseCache, type McpServerConfig, type McpServerConnection, type McpToolAdapterConfig, type McpToolDescriptor, MemorySessionStore, type Message, NAVI_MCP_CONFIG, NAVI_MCP_URL, NAVI_SERVER_NAME, type NaviRawCoin, type NaviRawHealthFactor, type NaviRawPool, type NaviRawPosition, type NaviRawPositionsResponse, type NaviRawProtocolStats, type NaviRawRewardsResponse, type NaviReadOptions, NaviTools, type OutputConfig, PERMISSION_PRESETS, type PendingAction, type PendingActionModifiableField, type PendingReward, type PendingToolCall, type PermissionLevel, type PermissionOperation, type PermissionResponse, type PermissionRule, type PositionEntry, type PreflightResult, type ProtocolStats, type ProviderEvent, QueryEngine, READ_TOOLS, type RatesResult, type Recipe, type RecipePrerequisite, RecipeRegistry, type RecipeStep, type RecipeStepOnError, RetryTracker, type SSEEvent, type SavingsResult, type ServerPositionData, type SessionData, type SessionStore, type StateType, type StopReason, type SuiCoinBalance, type SystemBlock, type SystemPrompt, TOOL_FLAGS, TOOL_MODIFIABLE_FIELDS, type ThinkingConfig, type ThinkingEffort, type Tool, type ToolChoice, type ToolContext, type ToolDefinition, type ToolFlags, type ToolJsonSchema, type ToolResult, TxMutex, type UserFinancialProfile, type UserPermissionConfig, WRITE_TOOLS, type WalletCoin, activitySummaryTool, adaptAllMcpTools, adaptAllServerTools, adaptMcpTool, applyToolFlags, balanceCheckTool, borrowTool, budgetToolResult, buildCachedSystemPrompt, buildMcpTools, buildProactivenessInstructions, buildProfileContext, buildSelfEvaluationInstruction, buildStateContext, buildTool, claimRewardsTool, classifyEffort, clearPriceCache, compactMessages, createGuardRunnerState, defillamaChainTvlTool, defillamaPriceChangeTool, defillamaProtocolFeesTool, defillamaProtocolInfoTool, defillamaSuiProtocolsTool, defillamaTokenPricesTool, defillamaYieldPoolsTool, engineToSSE, estimateTokens, explainTxTool, extractConversationText, extractMcpText, fetchAvailableRewards, fetchBalance, fetchHealthFactor, fetchPositions, fetchProtocolStats, fetchRates, fetchSavings, fetchTokenPrices, fetchWalletCoins, findTool, getDefaultTools, getMcpManager, getModifiableFields, getToolFlags, getWalletAddress, guardArtifactPreview, guardStaleData, hasNaviMcp, healthCheckTool, loadRecipes, microcompact, mppServicesTool, parseMcpJson, parseRecipe, parseSSE, payApiTool, portfolioAnalysisTool, protocolDeepDiveTool, ratesInfoTool, registerEngineTools, renderCanvasTool, repayDebtTool, requireAgent, resolvePermissionTier, resolveUsdValue, runGuards, runTools, saveContactTool, saveDepositTool, savingsInfoTool, sendTransferTool, serializeSSE, spendingAnalyticsTool, swapExecuteTool, swapQuoteTool, toolNameToOperation, toolsToDefinitions, transactionHistoryTool, transformBalance, transformHealthFactor, transformPositions, transformRates, transformRewards, transformSavings, updateGuardStateAfterToolResult, validateHistory, voloStakeTool, voloStatsTool, voloUnstakeTool, webSearchTool, withdrawTool, yieldSummaryTool };