keyring-agent-core 0.2.42 → 0.2.44

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
@@ -564,12 +564,6 @@ interface ChatMessage {
564
564
  * Only set on role === 'assistant' (the final user-facing answer).
565
565
  */
566
566
  subagents?: string[];
567
- /**
568
- * Suggested follow-up prompts attached to this assistant turn. Persisted with
569
- * history so that when a session is restored, the FE can re-render the same
570
- * suggestion chips next to the message. Only set on role === 'assistant'.
571
- */
572
- suggestedPrompts?: string[];
573
567
  /**
574
568
  * UI payloads (forms / confirms / result widgets) emitted by tools during
575
569
  * this turn. Persisted with history so the FE can re-render these widgets
@@ -597,6 +591,20 @@ interface ChatMessage {
597
591
  _intermediate?: boolean;
598
592
  timestamp: number;
599
593
  }
594
+ /**
595
+ * Message to return instead of a tool's form, keyed by tool name.
596
+ *
597
+ * The value is the text the assistant should convey to the user — write it in
598
+ * whatever wording you want them to hear (a link is fine). The model still
599
+ * translates it into the user's language, so plain English works.
600
+ *
601
+ * @example
602
+ * {
603
+ * 'open-swap-token-form': 'You can swap tokens directly in the app: https://app.example',
604
+ * 'open-buy-token-form': 'Buying is available in the app.',
605
+ * }
606
+ */
607
+ type NoFormToolMessages = Record<string, string>;
600
608
  /** Describes a parameter for a tool */
601
609
  interface ToolParameter {
602
610
  name: string;
@@ -628,14 +636,6 @@ interface ToolDefinition {
628
636
  category?: string;
629
637
  /** Whether this tool returns plain data, a UI payload, or an unsigned action. Default 'data'. */
630
638
  kind?: ToolKind;
631
- /**
632
- * When true, AgentCore skips generating `suggestedPrompts` for any turn in
633
- * which this tool was executed. Use on tools that already drive the user to
634
- * a concrete next step (e.g. pool action forms, wallet-action forms) where
635
- * generic suggestions add noise instead of helping.
636
- * Default false.
637
- */
638
- noSuggestions?: boolean;
639
639
  }
640
640
  /**
641
641
  * UI payload emitted by a tool. The FE has pre-built components keyed by
@@ -658,6 +658,31 @@ interface UIPayload<TProps = Record<string, unknown>> {
658
658
  */
659
659
  language?: string;
660
660
  }
661
+ /** One NFT card in the {@link WalletNftListProps} gallery. */
662
+ interface WalletNftCardProps {
663
+ /** Display name, e.g. "Bored Ape #1234" (falls back to "#<tokenId>"). */
664
+ name: string;
665
+ /** Token id as a decimal string. */
666
+ tokenId: string;
667
+ /** Collection contract address (0x…). */
668
+ contractAddress: string;
669
+ /**
670
+ * Loadable image: an http(s) URL or a `data:` URI (incl. `data:image/svg+xml`).
671
+ * `null` when no image could be resolved — the FE shows a placeholder card.
672
+ */
673
+ image: string | null;
674
+ /** Human-readable chain name, e.g. "Base". */
675
+ chain: string;
676
+ }
677
+ /** Props for the `WalletNftList` component — one collection's NFTs to display. */
678
+ interface WalletNftListProps {
679
+ /** Wallet whose NFTs these are (0x…). */
680
+ walletAddress: string;
681
+ /** Collection name shown as the gallery heading. */
682
+ collectionName: string;
683
+ /** The NFTs to render, in display order. */
684
+ nfts: WalletNftCardProps[];
685
+ }
661
686
  /** Identifies a chain in BE↔FE payloads. */
662
687
  interface ChainRef {
663
688
  /** Hex chain id, e.g. "0x2105" for Base */
@@ -799,6 +824,9 @@ interface WalletActionProps {
799
824
  action: WalletActionType;
800
825
  /** Hex chain id, e.g. "0x1", "0x2105". Falls back to userContext.chain. */
801
826
  chainId: string;
827
+ /** Human-readable chain name for display, e.g. "Ethereum", "Base". Derived
828
+ * from `chainId` via `chainLabel`; falls back to the raw id when unknown. */
829
+ chainName: string;
802
830
  /** Connected wallet that will sign the tx. */
803
831
  walletAddress: string;
804
832
  /**
@@ -1009,10 +1037,8 @@ interface ConfirmAddLiquidityTxProps {
1009
1037
  * button below the assistant message. When the user clicks, the FE submits
1010
1038
  * `prompt` as the next user message.
1011
1039
  *
1012
- * Distinct from `AgentResponse.suggestedPrompts`: those are LLM-generated
1013
- * generic follow-ups; these are deterministic, tool-emitted picker / disambig
1014
- * buttons (e.g. "Send USDC", "Send WETH" when the user said "send token"
1015
- * without naming one).
1040
+ * These are deterministic, tool-emitted picker / disambig buttons (e.g.
1041
+ * "Send USDC", "Send WETH" when the user said "send token" without naming one).
1016
1042
  */
1017
1043
  interface SuggestedAction {
1018
1044
  /** Button label shown to the user. */
@@ -1226,17 +1252,32 @@ interface LLMProviderConfig {
1226
1252
  maxTokens?: number;
1227
1253
  /** Temperature (0-2) */
1228
1254
  temperature?: number;
1229
- /** Base URL for the Gemini API proxy. Defaults to "https://nft.keyring.app/api/gemini-stable" */
1255
+ /**
1256
+ * Bring-your-own Gemini API key. When set, the core talks DIRECTLY to
1257
+ * `https://generativelanguage.googleapis.com` with this key instead of
1258
+ * routing through the Keyring proxy — and the {@link AgentConfig.secretKey}
1259
+ * licence gate is skipped, since no Keyring-hosted resource is consumed.
1260
+ * Omit it to use the proxy (which requires a valid `secretKey`).
1261
+ */
1262
+ apiKey?: string;
1263
+ /**
1264
+ * Base URL override. Defaults to the Keyring proxy
1265
+ * ("https://nft.keyring.app/api/gemini-stable"), or to
1266
+ * "https://generativelanguage.googleapis.com" when {@link apiKey} is set.
1267
+ */
1230
1268
  baseUrl?: string;
1231
1269
  }
1232
1270
  interface AgentConfig {
1233
1271
  /**
1234
- * License gate. AgentCore refuses to construct unless this value exactly
1235
- * matches the `SECRET_KEY` environment variable present at runtime. Required —
1236
- * omitting it (or passing a value that does not match `process.env.SECRET_KEY`)
1237
- * throws from the constructor before any provider/tool is initialised.
1272
+ * License gate for the Keyring-hosted Gemini proxy. Validated on the first
1273
+ * `chat()` call: if it does not match the key this bundle was built with, the
1274
+ * call throws before any LLM request is made.
1275
+ *
1276
+ * Optional ONLY in bring-your-own-key mode — when {@link LLMProviderConfig.apiKey}
1277
+ * is set the core calls the Gemini API directly and the gate is skipped.
1278
+ * Without an `llm.apiKey`, this is required.
1238
1279
  */
1239
- secretKey: string;
1280
+ secretKey?: string;
1240
1281
  /** LLM provider configuration */
1241
1282
  llm: LLMProviderConfig;
1242
1283
  /**
@@ -1309,12 +1350,6 @@ interface AgentConfig {
1309
1350
  * around 0.7 typically gives better KB recall in production.
1310
1351
  */
1311
1352
  kbAnswerThreshold?: number;
1312
- /**
1313
- * Whether to generate suggested follow-up prompts after each answer.
1314
- * Default true. Set to false to skip the extra LLM call and omit
1315
- * `suggestedPrompts` from every response.
1316
- */
1317
- generateSuggestions?: boolean;
1318
1353
  /** Moralis AI tool config. Set to false to disable the built-in Moralis tool. */
1319
1354
  moralis?: {
1320
1355
  /** Base URL for Moralis proxy (default: https://nft.keyring.app) */
@@ -1334,14 +1369,6 @@ interface AgentConfig {
1334
1369
  subagents?: {
1335
1370
  wallet?: boolean;
1336
1371
  'wallet-action'?: boolean;
1337
- /**
1338
- * Redirect-only variant of `wallet-action`. Instead of emitting in-chat
1339
- * forms, every tool just tells the user they can perform the action
1340
- * directly in the app (using `walletActionAppLink` when set). Mutually
1341
- * exclusive with `wallet-action`: enabling this (true) turns
1342
- * `wallet-action` off. Defaults to false.
1343
- */
1344
- 'wallet-action-app'?: boolean;
1345
1372
  token?: boolean;
1346
1373
  nft?: boolean;
1347
1374
  /**
@@ -1398,22 +1425,24 @@ interface AgentConfig {
1398
1425
  isProduction?: boolean;
1399
1426
  } | false;
1400
1427
  /**
1401
- * Website link for the NFT notice tools (`get-wallet-nfts`,
1402
- * `get-nft-metadata`, `get-nft-contract-info`). Supplied at AgentCore
1403
- * construction.
1428
+ * Tools that must NOT open a form in this deployment, mapped to the message
1429
+ * the user gets instead (e.g. "you can swap in the app: <link>").
1404
1430
  *
1405
- * Each tool emits a fixed message containing the phrase "this website". When
1406
- * this URL is set, that phrase is rendered as a Markdown link to it; when
1407
- * omitted, it stays as plain text. A single link is shared by all NFT tools.
1408
- */
1409
- nftLink?: string;
1410
- /**
1411
- * Link to the app where wallet actions are performed, used ONLY by the
1412
- * redirect-only `wallet-action-app` subagent. When set, its tools surface
1413
- * this URL as plain text so the user can open the app; when omitted, they
1414
- * just tell the user the action is done in the app.
1431
+ * Use this when a deployment exposes a smaller surface than the full one —
1432
+ * say an app build with no in-chat swap/buy. A named tool keeps its name and
1433
+ * routing (so the intent still lands on it) but collects nothing and never
1434
+ * runs: it just relays your message, translated into the user's language.
1435
+ *
1436
+ * Any registered tool can be named. Tools left out behave normally, and
1437
+ * omitting this entirely leaves every tool as-is.
1438
+ *
1439
+ * @example
1440
+ * noFormTools: {
1441
+ * 'open-swap-token-form': 'You can swap tokens in the app: https://app.example',
1442
+ * 'open-buy-token-form': 'Buying is available in the app.',
1443
+ * }
1415
1444
  */
1416
- walletActionAppLink?: string;
1445
+ noFormTools?: NoFormToolMessages;
1417
1446
  }
1418
1447
  interface LLMToolCall {
1419
1448
  toolName: string;
@@ -1447,6 +1476,19 @@ interface ChatOptions {
1447
1476
  * use the provider default.
1448
1477
  */
1449
1478
  maxOutputTokens?: number;
1479
+ /**
1480
+ * Gemini 2.5 thinking budget, in tokens. These models spend reasoning
1481
+ * ("thinking") tokens that count AGAINST `maxOutputTokens` before any visible
1482
+ * output — so a tight `maxOutputTokens` cap on a thinking model can be consumed
1483
+ * entirely by reasoning, cutting the turn off with `MAX_TOKENS` before a single
1484
+ * JSON byte is emitted. For the short, schema-bound JSON calls that carry a
1485
+ * `maxOutputTokens` cap, thinking adds no value, so it is disabled by default
1486
+ * (budget 0) whenever a cap is set — making the cap apply fully to real output.
1487
+ * Pass an explicit value to override: `0` forces thinking off, `-1` restores the
1488
+ * model's dynamic budget, a positive number sets a fixed budget. Leave unset to
1489
+ * use the cap-driven default.
1490
+ */
1491
+ thinkingBudget?: number;
1450
1492
  /**
1451
1493
  * Force the model to call one of the supplied `tools` instead of answering in
1452
1494
  * text (Gemini `functionCallingConfig.mode = "ANY"`). Used by action subagents
@@ -1665,8 +1707,6 @@ interface AgentResponse {
1665
1707
  * Format: 8-char hex derived from timestamp + random — unique within a session.
1666
1708
  */
1667
1709
  messageId: string;
1668
- /** Suggested follow-up prompts for the user */
1669
- suggestedPrompts?: string[];
1670
1710
  /**
1671
1711
  * UI components the FE should render this turn. Each entry is emitted by a
1672
1712
  * tool with kind='ui' or 'action'. Order preserved (subagent execution order).
@@ -1675,8 +1715,7 @@ interface AgentResponse {
1675
1715
  uiActions?: UIPayload[];
1676
1716
  /**
1677
1717
  * Tool-emitted clickable buttons aggregated across all subagent tool calls
1678
- * this turn. Distinct from `suggestedPrompts` (LLM-generated generic
1679
- * follow-ups) — these are deterministic disambiguation / picker buttons.
1718
+ * this turn — deterministic disambiguation / picker buttons.
1680
1719
  */
1681
1720
  actionButtons?: SuggestedAction[];
1682
1721
  /** Full ReAct trace (for debugging / logging) — flattened across all subagents */
@@ -1714,6 +1753,11 @@ declare class AgentCore {
1714
1753
  private debug;
1715
1754
  /** Caller-supplied license key; validated lazily on first chat() via assertLicense(). */
1716
1755
  private readonly secretKey;
1756
+ /**
1757
+ * True when the caller supplied their own Gemini API key (`llm.apiKey`), so
1758
+ * every LLM call goes straight to Google and the licence gate does not apply.
1759
+ */
1760
+ private readonly ownGeminiKey;
1717
1761
  /** True once the license has passed, so we only hash-check once. */
1718
1762
  private licenseChecked;
1719
1763
  private userContext;
@@ -1731,7 +1775,6 @@ declare class AgentCore {
1731
1775
  private vectorKBAutoIngestPromise;
1732
1776
  private autoIngestEnabled;
1733
1777
  private kbAnswerThreshold;
1734
- private suggestionsEnabled;
1735
1778
  private historyLoaded;
1736
1779
  private historyLoadingPromise;
1737
1780
  /**
@@ -1795,8 +1838,8 @@ declare class AgentCore {
1795
1838
  * args (e.g. a token-info screen that always calls `get-token-info`). Versus
1796
1839
  * `chat()` it saves ~3-4 LLM calls (no rewrite, no router, no per-tool ReAct
1797
1840
  * reasoning) and removes the risk of the LLM mis-parsing args, while still
1798
- * turning the raw tool DATA into a natural-language answer (+ suggestions,
1799
- * uiActions, actionButtons) so the FE renders it exactly like a chat turn.
1841
+ * turning the raw tool DATA into a natural-language answer (+ uiActions,
1842
+ * actionButtons) so the FE renders it exactly like a chat turn.
1800
1843
  *
1801
1844
  * Differs from {@link invokeTool}: invokeTool returns the tool's own `summary`
1802
1845
  * (+ UI) with NO LLM pass — right for action/UI tools (forms, redirects).
@@ -1809,7 +1852,6 @@ declare class AgentCore {
1809
1852
  */
1810
1853
  runTool(name: string, args: Record<string, unknown>, options?: {
1811
1854
  userMessage?: string;
1812
- generateSuggestions?: boolean;
1813
1855
  language?: string;
1814
1856
  signal?: AbortSignal;
1815
1857
  }): Promise<AgentResponse>;
@@ -1829,7 +1871,6 @@ declare class AgentCore {
1829
1871
  * `challenge` is the opaque blob from `X402PaymentRequiredProps.challenge`.
1830
1872
  */
1831
1873
  submitX402Payment(challenge: unknown, signature: string, options?: {
1832
- generateSuggestions?: boolean;
1833
1874
  userQuery?: string;
1834
1875
  }): Promise<AgentResponse>;
1835
1876
  /** Turn paid-API data into a natural-language answer for the original question. */
@@ -1869,13 +1910,16 @@ declare class AgentCore {
1869
1910
  * raw key, so the bundle never contains the key itself. When no key was baked
1870
1911
  * in (local dev build with no SECRET_KEY) the hash is empty and the gate is a
1871
1912
  * no-op. Cached after the first pass so we only hash once.
1913
+ *
1914
+ * The gate exists to protect the Keyring-hosted Gemini proxy. A caller that
1915
+ * brings their own Gemini API key (`llm.apiKey`) talks to Google directly and
1916
+ * consumes nothing of ours, so no secretKey is required in that mode.
1872
1917
  */
1873
1918
  private assertLicense;
1874
1919
  /**
1875
1920
  * Process a user message and return an answer. Main entry point.
1876
1921
  */
1877
1922
  chat(userMessage: string, options?: {
1878
- generateSuggestions?: boolean;
1879
1923
  language?: string;
1880
1924
  signal?: AbortSignal;
1881
1925
  }): Promise<AgentResponse>;
@@ -1901,13 +1945,6 @@ declare class AgentCore {
1901
1945
  * 'action' attach a `ui` field to their ToolResult; the FE renders one
1902
1946
  * component per entry in the order they were produced.
1903
1947
  */
1904
- /**
1905
- * Return true when ANY tool successfully executed across the dispatched
1906
- * subagents carries `noSuggestions: true` in its registry definition. Used to
1907
- * skip the suggester for turns where the user is already pointed at a
1908
- * concrete next action (a form / preview).
1909
- */
1910
- private subResultsTriggerNoSuggestions;
1911
1948
  /**
1912
1949
  * Aggregate `actionButtons` emitted by tools across all subagent tool calls
1913
1950
  * this turn (e.g. a token-picker after the user said "send token" without
@@ -1984,7 +2021,6 @@ declare class AgentCore {
1984
2021
  private synthesiserHistory;
1985
2022
  private mergeTrace;
1986
2023
  private finaliseAnswer;
1987
- private generateSuggestions;
1988
2024
  getHistory(): ChatMessage[];
1989
2025
  /**
1990
2026
  * History filtered down to user-facing messages only — the user's prompts
@@ -1994,13 +2030,6 @@ declare class AgentCore {
1994
2030
  * (a pure tool-call turn). Use this to seed a chat UI on mount.
1995
2031
  */
1996
2032
  getDisplayHistory(): ChatMessage[];
1997
- /**
1998
- * Suggested follow-up prompts attached to the most recent final assistant
1999
- * turn, or `[]` if none. Used to re-seed suggestion chips after restoring
2000
- * a persisted session — the chips travel with the assistant message in
2001
- * storage, so this just locates the last one.
2002
- */
2003
- getLastSuggestions(): string[];
2004
2033
  clearHistory(): Promise<void>;
2005
2034
  restoreHistory(data: {
2006
2035
  messages: ChatMessage[];
@@ -2229,6 +2258,13 @@ declare class WebsiteTrustKeyringAgent {
2229
2258
  * sized just above the real output keeps latency from the odd rambling turn
2230
2259
  * without ever truncating a valid reply. Omit to fall back to the provider
2231
2260
  * default (4096).
2261
+ * - `thinkingBudget` controls the Gemini 2.5 reasoning budget (tokens count
2262
+ * AGAINST `maxOutputTokens`). The provider defaults it to 0 whenever a
2263
+ * `maxOutputTokens` cap is set, so a formatting/extraction call spends its
2264
+ * whole budget on real output. The one call that needs real reasoning —
2265
+ * {@link investigate}, which must correctly judge official vs. look-alike —
2266
+ * passes an explicit positive budget AND a cap wide enough to hold thinking +
2267
+ * JSON, so accuracy is preserved without re-triggering MAX_TOKENS.
2232
2268
  */
2233
2269
  private askJson;
2234
2270
  /**
@@ -2399,7 +2435,7 @@ declare const WALLET_ACTION_AGENT_TOOL_NAMES: readonly ["open-send-native-form",
2399
2435
  declare function createWalletActionAgent(llm: LLMProvider, registry: ToolRegistry, options?: SubagentOptions): Subagent;
2400
2436
 
2401
2437
  /** Built-in subagent ids. */
2402
- type DefaultSubagentName = 'wallet' | 'wallet-action' | 'wallet-action-app' | 'token' | 'nft' | 'nfc' | 'pool' | 'pool-subgraph' | 'ai';
2438
+ type DefaultSubagentName = 'wallet' | 'wallet-action' | 'token' | 'nft' | 'nfc' | 'pool' | 'pool-subgraph' | 'ai';
2403
2439
  /**
2404
2440
  * Per-subagent enable flags. Default for every key is `true` EXCEPT
2405
2441
  * `pool-subgraph`, which defaults to `false` because it is mutually exclusive
@@ -2411,10 +2447,6 @@ type DefaultSubagentName = 'wallet' | 'wallet-action' | 'wallet-action-app' | 't
2411
2447
  * Turning `pool-subgraph` on automatically turns `pool` off unless the caller
2412
2448
  * has explicitly enabled `pool: true`. This prevents two pool agents from
2413
2449
  * competing for the same user query.
2414
- *
2415
- * Similarly, `wallet-action-app` (default off) is the redirect-only variant of
2416
- * `wallet-action`: enabling it turns `wallet-action` off. The two are mutually
2417
- * exclusive — only one wallet-action agent ever exists.
2418
2450
  */
2419
2451
  type SubagentToggles = Partial<Record<DefaultSubagentName, boolean>>;
2420
2452
  /**
@@ -2427,17 +2459,27 @@ type SubagentToggles = Partial<Record<DefaultSubagentName, boolean>>;
2427
2459
  declare function createDefaultSubagents(llm: LLMProvider, registry: ToolRegistry, options?: SubagentOptions, toggles?: SubagentToggles): Subagent[];
2428
2460
 
2429
2461
  /**
2430
- * LLM provider that calls the Gemini-compatible proxy via fetch.
2431
- * No API key required — the proxy handles authentication.
2462
+ * LLM provider for the Gemini generateContent API. Two transports:
2463
+ *
2464
+ * • **Direct** — when `config.apiKey` is set, requests go straight to
2465
+ * {@link DIRECT_BASE_URL} authenticated with that key (`x-goog-api-key`).
2466
+ * • **Proxy** (default) — no key needed; {@link PROXY_BASE_URL} authenticates
2467
+ * on our behalf. Gated by the AgentCore licence check.
2468
+ *
2469
+ * The wire format is identical either way, so only the URL + headers differ.
2432
2470
  */
2433
2471
  declare class GeminiProvider implements LLMProvider {
2434
2472
  private model;
2435
2473
  private maxTokens;
2436
2474
  private temperature;
2437
2475
  private baseUrl;
2476
+ /** Caller's own Gemini key. Empty when running through the proxy. */
2477
+ private apiKey;
2438
2478
  /** Per-turn signal applied to every request until cleared. See setRequestSignal. */
2439
2479
  private requestSignal?;
2440
2480
  constructor(config: LLMProviderConfig);
2481
+ /** True when talking to Google directly with the caller's own key. */
2482
+ get isDirect(): boolean;
2441
2483
  /** @see LLMProvider.setRequestSignal */
2442
2484
  setRequestSignal(signal?: AbortSignal): void;
2443
2485
  chat(messages: ChatMessage[], tools?: ToolDefinition[], options?: ChatOptions): Promise<LLMResponse>;
@@ -2459,6 +2501,37 @@ declare abstract class BaseTool implements Tool {
2459
2501
  execute(args: Record<string, unknown>, userContext?: UserContext): Promise<ToolResult>;
2460
2502
  }
2461
2503
 
2504
+ /**
2505
+ * Replaces a tool that would open a form with one that just delivers a message.
2506
+ *
2507
+ * Some deployments expose a smaller surface than others — e.g. an app build with
2508
+ * no swap/buy screens in chat. Rather than maintaining a parallel set of
2509
+ * redirect-only tools (which drifts out of sync with the real ones), the real
2510
+ * tool is swapped out for this wrapper at registration time.
2511
+ *
2512
+ * It deliberately keeps the wrapped tool's `name` and `description` so the
2513
+ * router still picks it for the same intents, but drops the parameters (nothing
2514
+ * is collected) and never runs the original tool — so no API calls, no chain
2515
+ * reads, and no chance of a failure in work whose result would be discarded.
2516
+ */
2517
+ declare class NoFormTool implements Tool {
2518
+ readonly name: string;
2519
+ readonly description: string;
2520
+ readonly category?: string;
2521
+ /** Nothing is collected — the tool only relays a message. */
2522
+ readonly parameters: ToolParameter[];
2523
+ private readonly message;
2524
+ constructor(tool: Tool, message: string);
2525
+ execute(): Promise<ToolResult>;
2526
+ }
2527
+ /**
2528
+ * Register `tool`, or — when `messages` names it — a {@link NoFormTool} standing
2529
+ * in for it. Centralizes the check so every call site stays a one-liner.
2530
+ */
2531
+ declare function registerMaybeNoForm(registry: {
2532
+ register: (tool: Tool) => void;
2533
+ }, tool: Tool, messages?: NoFormToolMessages): void;
2534
+
2462
2535
  /**
2463
2536
  * MoralisService — Moralis Web3 API + Cortex AI proxy.
2464
2537
  *
@@ -2584,6 +2657,22 @@ interface NFTItem {
2584
2657
  collection_logo?: string;
2585
2658
  collection_banner_image?: string;
2586
2659
  }
2660
+ /**
2661
+ * One row of `GET /{address}/nft/collections` — an NFT collection the wallet
2662
+ * holds, rather than an individual token.
2663
+ */
2664
+ interface NFTCollectionItem {
2665
+ token_address: string;
2666
+ contract_type: 'ERC721' | 'ERC1155' | string;
2667
+ name?: string;
2668
+ symbol?: string;
2669
+ /** How many tokens of this collection the wallet holds. */
2670
+ count?: number;
2671
+ possible_spam?: boolean;
2672
+ verified_collection?: boolean;
2673
+ collection_logo?: string;
2674
+ collection_banner_image?: string;
2675
+ }
2587
2676
  type NFTContractMetadata = {
2588
2677
  token_address: string;
2589
2678
  name: string;
@@ -3088,6 +3177,31 @@ interface WalletDefiSummaryResponse {
3088
3177
  total_unclaimed_usd_value: number;
3089
3178
  protocols: DefiProtocolSummary[];
3090
3179
  }
3180
+ /** Raw response from v1 GET /wallets/{address}/defi/summary */
3181
+ interface WalletDefiSummaryV1Response {
3182
+ meta: {
3183
+ syncedAt?: Record<string, number | string>;
3184
+ unsupportedChains?: string[];
3185
+ failedChains?: string[];
3186
+ };
3187
+ result: {
3188
+ activeProtocols?: number;
3189
+ totalPositions?: number;
3190
+ totalUsd?: number;
3191
+ totalUnclaimedUsd?: number | null;
3192
+ protocols?: Array<{
3193
+ protocolId?: string;
3194
+ protocolName?: string;
3195
+ protocolUrl?: string;
3196
+ protocolLogo?: string;
3197
+ chainId?: string;
3198
+ positionCount?: number;
3199
+ totalUsd?: number;
3200
+ totalUnclaimedUsd?: number | null;
3201
+ accountHealthFactor?: number | null;
3202
+ }>;
3203
+ };
3204
+ }
3091
3205
  /**
3092
3206
  * A single token line inside a DeFi position (supplied, borrowed, reward, …).
3093
3207
  * Mirrors Moralis's `defiPositionToken` shape.
@@ -3423,7 +3537,16 @@ declare class MoralisService {
3423
3537
  chain?: string;
3424
3538
  }): Promise<MoralisApiResponse<TokenMetadata>>;
3425
3539
  /**
3426
- * Get NFTs owned by a wallet.
3540
+ * Get NFTs owned by a wallet, following Moralis' cursor pagination to the END
3541
+ * and aggregating every page into ONE `result` array — so callers get the
3542
+ * wallet's complete set (for the chain / collection filter) in a single call
3543
+ * rather than just the first page. Paging starts from the caller-supplied
3544
+ * `cursor` when given, and stops when Moralis returns no next cursor or the
3545
+ * {@link MAX_NFT_PAGES} safety cap is reached (the trailing `cursor` in the
3546
+ * response is then non-empty, so a caller could resume if it ever needs to).
3547
+ *
3548
+ * A page that fails after we've already gathered rows returns what we have
3549
+ * (best-effort); a failure on the very first page surfaces the error.
3427
3550
  */
3428
3551
  getWalletNFTs(params: {
3429
3552
  address: string;
@@ -3440,6 +3563,32 @@ declare class MoralisService {
3440
3563
  page?: number;
3441
3564
  page_size?: number;
3442
3565
  }>>;
3566
+ /**
3567
+ * Fetch ONE page of a wallet's NFTs, with retry/backoff. Internal helper for
3568
+ * {@link getWalletNFTs} — the cursor-following loop lives there; this just
3569
+ * resolves a single page (or a failure). A 400 is a deterministic client error,
3570
+ * so it breaks out of the retry loop immediately.
3571
+ */
3572
+ private fetchWalletNftsPage;
3573
+ /**
3574
+ * Get the NFT collections a wallet holds — one row per collection rather than
3575
+ * one per token. Used to let the user pick a collection before we fetch the
3576
+ * individual NFTs inside it.
3577
+ *
3578
+ * Moralis docs: https://docs.moralis.com/data-api/evm/wallet/nft-collections
3579
+ */
3580
+ getWalletNftCollections(params: {
3581
+ address: string;
3582
+ chain?: string;
3583
+ limit?: number;
3584
+ excludeSpam?: boolean;
3585
+ cursor?: string;
3586
+ }): Promise<MoralisApiResponse<{
3587
+ result: NFTCollectionItem[];
3588
+ cursor?: string;
3589
+ page?: number;
3590
+ page_size?: number;
3591
+ }>>;
3443
3592
  /**
3444
3593
  * Get the full metadata for a single NFT identified by its contract address
3445
3594
  * and token id via the Moralis `GET /nft/{address}/{token_id}` endpoint.
@@ -4987,51 +5136,63 @@ declare class TransactionByHashTool extends BaseTool {
4987
5136
  }>;
4988
5137
  }
4989
5138
 
4990
- /** Config for an NFT message tool — the optional website link it points to. */
4991
- interface NftMessageToolConfig {
4992
- /**
4993
- * Destination URL. When set, the "this website" phrase in the message becomes
4994
- * a Markdown link to it; when omitted/blank, the phrase stays plain text.
4995
- */
4996
- url?: string;
4997
- }
4998
- /**
4999
- * Shared base for the canned-message NFT notice tools (`get-wallet-nfts`,
5000
- * `get-nft-metadata`, `get-nft-contract-info`).
5001
- *
5002
- * Each tool emits one fixed sentence that points the user at a website. The
5003
- * phrase "this website" is rendered as a Markdown link to `config.url` when one
5004
- * was supplied at AgentCore construction; otherwise it stays plain text. The
5005
- * tool takes no arguments — it returns the fully-built Markdown message plus
5006
- * `_instructions` telling the agent to reply with it verbatim.
5007
- */
5008
- declare abstract class BaseNftMessageTool extends BaseTool {
5009
- kind: ToolKind;
5010
- category: string;
5011
- noSuggestions: boolean;
5012
- parameters: ToolParameter[];
5013
- /** The phrase inside the template that links to the website. */
5014
- protected readonly linkPhrase = "this website";
5015
- /** Message template containing the literal `{link}` placeholder. */
5016
- protected abstract readonly template: string;
5017
- /** Resolved (trimmed) URL, or undefined when none was configured. */
5018
- protected readonly url?: string;
5019
- constructor(config?: NftMessageToolConfig);
5020
- protected run(): Promise<unknown>;
5021
- }
5022
-
5023
- type WalletNFTsToolConfig = NftMessageToolConfig;
5139
+ type WalletNFTsToolConfig = MoralisServiceConfig;
5024
5140
  /**
5025
5141
  * Tool: get-wallet-nfts
5026
5142
  *
5027
- * Points the user to the NFT website instead of returning on-chain holdings.
5028
- * Emits a fixed NFT website notice; "this website" links to the configured
5029
- * `nftLink` URL when set, otherwise it stays plain text.
5143
+ * Two-step NFT browser. Only ERC-721 is reported in either step; ERC-1155
5144
+ * (editions / semi-fungibles) is filtered out.
5145
+ *
5146
+ * 1. No collection named ("show my NFTs") → list the wallet's COLLECTIONS via
5147
+ * `GET /{address}/nft/collections` and render one picker button per
5148
+ * collection, labelled with just the collection name.
5149
+ * 2. A collection named (the user typed it, or clicked a button, which submits
5150
+ * the collection name + contract address) → list the NFTs inside it via
5151
+ * `GET /{address}/nft`, each with image, name and token id.
5152
+ *
5153
+ * Moralis docs:
5154
+ * https://docs.moralis.com/data-api/evm/wallet/nft-collections
5155
+ * https://docs.moralis.com/data-api/evm/wallet/nft-balances
5030
5156
  */
5031
- declare class WalletNFTsTool extends BaseNftMessageTool {
5157
+ declare class WalletNFTsTool extends BaseTool {
5032
5158
  name: string;
5033
5159
  description: string;
5034
- protected readonly template = "Please view your NFT collection on {link} for more details";
5160
+ category: string;
5161
+ parameters: ToolParameter[];
5162
+ private service;
5163
+ constructor(config?: WalletNFTsToolConfig);
5164
+ protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
5165
+ ui: UIPayload<WalletNftListProps>;
5166
+ _instructions: string;
5167
+ walletAddress: string;
5168
+ collectionName: string;
5169
+ nftCount: number;
5170
+ error?: undefined;
5171
+ } | {
5172
+ error: string;
5173
+ } | {
5174
+ actionButtons?: SuggestedAction[] | undefined;
5175
+ _instructions: string;
5176
+ walletAddress: string;
5177
+ collectionCount: number;
5178
+ collections: {
5179
+ name: string;
5180
+ contractAddress: string;
5181
+ chain: string;
5182
+ nftCount: number | null;
5183
+ }[];
5184
+ error?: undefined;
5185
+ }>;
5186
+ private listCollections;
5187
+ private listNfts;
5188
+ /**
5189
+ * Resolve the image of every matched NFT from its on-chain `tokenURI`, grouped
5190
+ * by chain so each chain costs a single Multicall3 round-trip. Returns an array
5191
+ * positionally aligned with `matched`; each entry is a loadable image URL or
5192
+ * `null` when the on-chain URI was missing/unresolvable. Best-effort — any
5193
+ * failure degrades to `null` (and thus the Moralis fallback), never throwing.
5194
+ */
5195
+ private resolveOnchainImages;
5035
5196
  }
5036
5197
 
5037
5198
  /**
@@ -5120,7 +5281,6 @@ declare class NfcBuyTool extends BaseTool {
5120
5281
  kind: ToolKind;
5121
5282
  name: string;
5122
5283
  category: string;
5123
- noSuggestions: boolean;
5124
5284
  description: string;
5125
5285
  parameters: ToolParameter[];
5126
5286
  private llm?;
@@ -5604,7 +5764,6 @@ declare class OpenAddLiquidityFormTool extends BaseTool {
5604
5764
  name: string;
5605
5765
  kind: ToolKind;
5606
5766
  category: string;
5607
- noSuggestions: boolean;
5608
5767
  description: string;
5609
5768
  parameters: ToolParameter[];
5610
5769
  private uniswap;
@@ -5689,7 +5848,6 @@ declare class PreviewAddLiquidityTool extends BaseTool {
5689
5848
  name: string;
5690
5849
  kind: ToolKind;
5691
5850
  category: string;
5692
- noSuggestions: boolean;
5693
5851
  description: string;
5694
5852
  parameters: ToolParameter[];
5695
5853
  private pool;
@@ -5736,7 +5894,6 @@ declare class PoolPriceRangesTool extends BaseTool {
5736
5894
  name: string;
5737
5895
  description: string;
5738
5896
  category: string;
5739
- noSuggestions: boolean;
5740
5897
  parameters: ToolParameter[];
5741
5898
  private service;
5742
5899
  constructor(config?: PoolPriceRangesToolConfig);
@@ -5758,7 +5915,6 @@ declare class ManageLiquidityRedirectTool extends BaseTool {
5758
5915
  name: string;
5759
5916
  description: string;
5760
5917
  category: string;
5761
- noSuggestions: boolean;
5762
5918
  parameters: ToolParameter[];
5763
5919
  protected run(args: Record<string, unknown>): Promise<{
5764
5920
  _instructions: string;
@@ -5781,7 +5937,6 @@ declare class SubgraphPoolSearchTool extends BaseTool {
5781
5937
  name: string;
5782
5938
  description: string;
5783
5939
  category: string;
5784
- noSuggestions: boolean;
5785
5940
  parameters: ToolParameter[];
5786
5941
  private service;
5787
5942
  constructor(config?: SubgraphPoolSearchToolConfig);
@@ -5856,7 +6011,6 @@ declare class SubgraphTrendingPoolsTool extends BaseTool {
5856
6011
  name: string;
5857
6012
  description: string;
5858
6013
  category: string;
5859
- noSuggestions: boolean;
5860
6014
  parameters: ToolParameter[];
5861
6015
  private service;
5862
6016
  constructor(config?: SubgraphTrendingPoolsToolConfig);
@@ -5909,7 +6063,6 @@ declare class SubgraphPoolByAddressTool extends BaseTool {
5909
6063
  name: string;
5910
6064
  description: string;
5911
6065
  category: string;
5912
- noSuggestions: boolean;
5913
6066
  parameters: ToolParameter[];
5914
6067
  private service;
5915
6068
  constructor(config?: SubgraphPoolByAddressToolConfig);
@@ -5973,7 +6126,6 @@ declare class SubgraphPoolByPositionIdTool extends BaseTool {
5973
6126
  name: string;
5974
6127
  description: string;
5975
6128
  category: string;
5976
- noSuggestions: boolean;
5977
6129
  parameters: ToolParameter[];
5978
6130
  private service;
5979
6131
  constructor(config?: SubgraphPoolByPositionIdToolConfig);
@@ -6049,7 +6201,6 @@ declare class SubgraphPositionDetailTool extends BaseTool {
6049
6201
  name: string;
6050
6202
  description: string;
6051
6203
  category: string;
6052
- noSuggestions: boolean;
6053
6204
  parameters: ToolParameter[];
6054
6205
  private service;
6055
6206
  constructor(config?: SubgraphPositionDetailToolConfig);
@@ -6158,7 +6309,6 @@ declare class SubgraphCoinPoolPairsTool extends BaseTool {
6158
6309
  name: string;
6159
6310
  description: string;
6160
6311
  category: string;
6161
- noSuggestions: boolean;
6162
6312
  parameters: ToolParameter[];
6163
6313
  private service;
6164
6314
  constructor(config?: SubgraphCoinPoolPairsToolConfig);
@@ -6223,7 +6373,6 @@ declare class SubgraphAddPoolTool extends BaseTool {
6223
6373
  name: string;
6224
6374
  description: string;
6225
6375
  category: string;
6226
- noSuggestions: boolean;
6227
6376
  parameters: ToolParameter[];
6228
6377
  private service;
6229
6378
  private linkAddLiquidity?;
@@ -6401,9 +6550,23 @@ interface ResolvedToken {
6401
6550
  declare abstract class BaseWalletActionTool extends BaseTool {
6402
6551
  kind: ToolKind;
6403
6552
  category: string;
6404
- noSuggestions: boolean;
6405
6553
  protected abstract readonly actionType: WalletActionType;
6406
6554
  protected abstract readonly component: string;
6555
+ /**
6556
+ * Build the UI payload the FE renders for this action. The default wraps the
6557
+ * resolved `parameters` in the shared {@link WalletActionProps} shape under
6558
+ * this tool's own `component` — which is all the send/approve forms need.
6559
+ *
6560
+ * Override to emit a component with a DIFFERENT props shape (the way
6561
+ * BuyTokenTool / SwapTokenTool ship their own): return any `UIPayload` and
6562
+ * the base forwards it untouched. `parameters` stays the tool's own resolved
6563
+ * map, so an override can pick from it or ignore it entirely.
6564
+ */
6565
+ protected buildUI(input: {
6566
+ parameters: Record<string, string>;
6567
+ chainId: string;
6568
+ walletAddress: string;
6569
+ }): UIPayload<unknown>;
6407
6570
  /**
6408
6571
  * The fields the *user* is expected to fill in the form, with a friendly,
6409
6572
  * user-facing label (in English — the LLM translates to the user's language).
@@ -6666,25 +6829,36 @@ declare class SendTokenTool extends BaseWalletActionTool {
6666
6829
  * Resolve the user's named token from their wallet balances in ONE call,
6667
6830
  * which doubles as the ownership check: a token to send must be held.
6668
6831
  *
6669
- * - Found with a non-zero balance → `{ token }` (address + symbol + decimals).
6832
+ * - Found with a non-zero balance → `{ token, spendable }` (address + symbol
6833
+ * + decimals, plus the held balance the form caps the amount against).
6670
6834
  * - Found but zero / not held → `{ error: 'no_balance' }`.
6671
6835
  * - Balances unavailable (no moralis / no wallet) → fall back to
6672
6836
  * {@link BaseWalletActionTool.resolveTokenRef} so resolution still works;
6673
- * we can't verify ownership in that case, so we don't block.
6837
+ * we can't verify ownership in that case, so we don't block. No balance was
6838
+ * read, so `spendable` is omitted.
6674
6839
  */
6675
6840
  private findOwnedTokenForSend;
6676
6841
  /**
6677
6842
  * Build a token-picker click-prompt from the LLM-supplied, already-localized
6678
6843
  * template (in the user's language) by substituting placeholders:
6679
6844
  * {symbol} → token symbol {amount} → the amount (or '') {to} → recipient 0x… (or '')
6680
- * The localized verb ("send"/"gửi"/…) and the "to" preposition live INSIDE
6681
- * the template, so we only ever substitute concrete values. The click-prompt
6682
- * is re-submitted as a fresh user turn, so keeping it in the user's language
6683
- * keeps that follow-up turn in the same language. Falls back to an English
6684
- * template when the LLM omits one. The full "{to}"-phrase is dropped when no
6685
- * recipient is known, so a trailing "đến"/"to" never dangles.
6845
+ * {chain} → chain name (or dropped)
6846
+ * The localized verb ("send"/"gửi"/…), the "to" preposition, and the "on
6847
+ * <chain>" preposition live INSIDE the template, so we only ever substitute
6848
+ * concrete values. The click-prompt is re-submitted as a fresh user turn, so
6849
+ * keeping it in the user's language keeps that follow-up turn in the same
6850
+ * language. Falls back to an English template when the LLM omits one. The full
6851
+ * "{to}"/"{chain}"-phrase (placeholder + its adjacent preposition) is dropped
6852
+ * when its value is unknown, so a trailing "đến"/"to"/"on" never dangles.
6686
6853
  */
6687
6854
  private buildSendPrompt;
6855
+ /**
6856
+ * Substitute a placeholder with its value, or — when the value is missing —
6857
+ * drop the placeholder together with its adjacent preposition token, which may
6858
+ * sit BEFORE it ("... to {to}", "... on {chain}") or AFTER it in languages with
6859
+ * postpositions ("{chain} で ..."). Try both, then remove any stray brace.
6860
+ */
6861
+ private fillOrDropPhrase;
6688
6862
  }
6689
6863
 
6690
6864
  /**
@@ -6758,7 +6932,6 @@ declare class BuyTokenTool extends BaseTool {
6758
6932
  name: string;
6759
6933
  kind: ToolKind;
6760
6934
  category: string;
6761
- noSuggestions: boolean;
6762
6935
  private readonly moralis?;
6763
6936
  /** Trending tokens come from Pantograph (top-gainers), not Moralis. */
6764
6937
  private readonly pantograph?;
@@ -7066,7 +7239,6 @@ declare class SwapTokenTool extends BaseTool {
7066
7239
  name: string;
7067
7240
  kind: ToolKind;
7068
7241
  category: string;
7069
- noSuggestions: boolean;
7070
7242
  private readonly moralis?;
7071
7243
  /** Trending tokens come from Pantograph (top-gainers), not Moralis. */
7072
7244
  private readonly pantograph?;
@@ -7249,10 +7421,6 @@ declare class SwapTokenTool extends BaseTool {
7249
7421
  private formatPrice;
7250
7422
  }
7251
7423
 
7252
- /** Optional NFT website link, shown when more than one owned NFT matches. */
7253
- interface SendNftToolConfig {
7254
- url?: string;
7255
- }
7256
7424
  /**
7257
7425
  * Tool: open-send-nft-form
7258
7426
  *
@@ -7261,20 +7429,20 @@ interface SendNftToolConfig {
7261
7429
  * { contract_address, token_id, to_address, token_standard, amount, maxAmount, nft_name }
7262
7430
  *
7263
7431
  * Resolution rules (in order):
7264
- * - No identifier at all → emit a fixed "no NFT specified" notice.
7432
+ * - No identifier at all → ask the user for the contract, token id and
7433
+ * recipient; nothing to pre-fill, so no form is opened.
7265
7434
  * - contract_address + token_id → confirm ownership; emit form (image + name +
7266
7435
  * token_standard + maxAmount come from the wallet row). Not held → error.
7267
7436
  * - contract_address only → list the user's holdings in that collection.
7268
- * • 0 → error • 1 → form • >1 → website notice.
7437
+ * • 0 → error • 1 → form pre-filled • >1 → empty form.
7269
7438
  * - token_id only → list all owned NFTs whose token_id matches.
7270
- * • 0 → error • 1 → form • >1 → website notice.
7439
+ * • 0 → error • 1 → form pre-filled • >1 → empty form.
7271
7440
  * - nft_name only → fuzzy-match against owned NFTs' names.
7272
- * • 0 → error • 1 → form • >1 → website notice.
7441
+ * • 0 → error • 1 → form pre-filled • >1 → empty form.
7273
7442
  *
7274
7443
  * When more than one owned NFT matches we cannot safely pick one for the user,
7275
- * so we return a fixed notice pointing them to the NFT website (Markdown link
7276
- * when `url` is configured, plain text otherwise) — matching the pattern used
7277
- * by the other NFT notice tools.
7444
+ * so we still open the form (carrying only what the user typed) and let the FE
7445
+ * handle the selection.
7278
7446
  */
7279
7447
  declare class SendNftTool extends BaseWalletActionTool {
7280
7448
  name: string;
@@ -7284,25 +7452,9 @@ declare class SendNftTool extends BaseWalletActionTool {
7284
7452
  readonly key: "to_address";
7285
7453
  readonly label: "the recipient address";
7286
7454
  }];
7287
- /** Resolved (trimmed) NFT website URL, used when >1 owned NFTs match. */
7288
- private readonly url?;
7289
- constructor(config?: MoralisServiceConfig, options?: SendNftToolConfig);
7290
7455
  description: string;
7291
7456
  parameters: ToolParameter[];
7292
- protected buildParameters(args: Record<string, unknown>, userContext?: UserContext): Promise<Record<string, string> | {
7293
- error: "no_nft_specified" | "multiple_nfts_matched";
7294
- message: string;
7295
- _instructions: string;
7296
- }>;
7297
- /**
7298
- * Fixed "go to the NFT website" notice. Used whenever we cannot safely
7299
- * resolve a single NFT to pre-fill the form — either the user named none
7300
- * (`no_nft_specified`) or more than one owned NFT matched
7301
- * (`multiple_nfts_matched`). The phrase "this website" becomes a Markdown
7302
- * link when a URL is configured; otherwise it stays plain text. Mirrors the
7303
- * pattern used by the other NFT notice tools.
7304
- */
7305
- private websiteNotice;
7457
+ protected buildParameters(args: Record<string, unknown>, userContext?: UserContext): Promise<Record<string, string>>;
7306
7458
  private normaliseString;
7307
7459
  private normaliseTokenId;
7308
7460
  private normaliseAmountInt;
@@ -7312,77 +7464,6 @@ declare class SendNftTool extends BaseWalletActionTool {
7312
7464
  private paramsFromNft;
7313
7465
  }
7314
7466
 
7315
- /**
7316
- * Config for the redirect-only wallet-action tools used by the
7317
- * `wallet-action-app` subagent.
7318
- */
7319
- interface WalletActionAppToolConfig {
7320
- /**
7321
- * Optional link to the app where the user performs the action. When set, the
7322
- * tool surfaces it as plain text so the user can open the app directly. When
7323
- * omitted, the tool just tells the user the action is done in the app.
7324
- */
7325
- appLink?: string;
7326
- /**
7327
- * Optional NFT website link, used ONLY by the send-NFT tool. Mirrors the
7328
- * `wallet-action` SendNftTool: when set, the notice carries a clickable
7329
- * Markdown link to this URL; when omitted, the website phrase stays plain
7330
- * text. Separate from `appLink` because sending an NFT is done on the NFT
7331
- * website, not the wallet-action app.
7332
- */
7333
- nftLink?: string;
7334
- }
7335
- interface ActionSpec {
7336
- /** Tool name — mirrors the matching `wallet-action` form tool it replaces. */
7337
- name: string;
7338
- /** Routing description so the agent picks this tool for the matching intent. */
7339
- description: string;
7340
- /** Human phrase used in the redirect message, e.g. "send a token". */
7341
- what: string;
7342
- /**
7343
- * Which link the redirect points to. `'app'` (default) → the wallet-action
7344
- * app (`appLink`); `'nft'` → the NFT website (`nftLink`), matching how the
7345
- * `wallet-action` SendNftTool points NFT sends to the NFT site.
7346
- */
7347
- linkKind?: 'app' | 'nft';
7348
- }
7349
- /**
7350
- * Redirect-only wallet-action tool.
7351
- *
7352
- * The `wallet-action-app` subagent is a variant of `wallet-action` for
7353
- * deployments where the action is NOT performed in chat. Instead of emitting a
7354
- * pre-filled form, every tool returns a static instruction telling the user
7355
- * they can perform the action directly in the app. No API calls, no chain
7356
- * reads, no parameters.
7357
- */
7358
- declare class WalletActionAppTool extends BaseTool {
7359
- name: string;
7360
- description: string;
7361
- category: string;
7362
- noSuggestions: boolean;
7363
- parameters: ToolParameter[];
7364
- private readonly what;
7365
- private readonly linkKind;
7366
- private readonly appLink?;
7367
- private readonly nftLink?;
7368
- constructor(spec: ActionSpec, config?: WalletActionAppToolConfig);
7369
- protected run(): Promise<{
7370
- message: string;
7371
- _instructions: string;
7372
- } | {
7373
- url?: string | undefined;
7374
- _instructions: string;
7375
- }>;
7376
- /**
7377
- * Fixed "go to the NFT website" notice — byte-for-byte the same pattern as
7378
- * the `wallet-action` SendNftTool: the website phrase becomes a clickable
7379
- * Markdown link when `nftLink` is configured, plain text otherwise.
7380
- */
7381
- private nftWebsiteNotice;
7382
- }
7383
- /** Create the full set of redirect-only wallet-action tools. */
7384
- declare function createWalletActionAppTools(config?: WalletActionAppToolConfig): WalletActionAppTool[];
7385
-
7386
7467
  /**
7387
7468
  * Shared JSON-RPC client + default public RPC endpoints.
7388
7469
  *
@@ -7998,4 +8079,4 @@ declare class AbortError extends Error {
7998
8079
  */
7999
8080
  declare function isAbortError(err: unknown): boolean;
8000
8081
 
8001
- export { AI_AGENT_TOOL_NAMES, AbortError, type AddLiquidityFormProps, type AddLiquiditySummary, type AffiliateFee, type AgentConfig, AgentCore, type AgentResponse, ApproveTokenTool, BaseNftAiTool, BaseNftMessageTool, BaseSwapService, BaseTool, BaseWalletActionTool, type BuyTokenConfirmTxProps, type BuyTokenSide, BuyTokenTool, type ChainMeta, type ChainRef, type ChainSelector, ChatHistory, type ChatMessage, type ChatOptions, type ChatRole, type CheckApprovalParams, type CheckApprovalResult, type ConfirmAddLiquidityTxProps, type CortexResponse, DEFAULT_CHAIN, DEFAULT_PROVIDER, DEFAULT_RPC_BY_CHAIN, DebridgeAdapter, type DecodedCall, type DecodedEvent, type DecodedParam, type DefaultSubagentName, type DefiPosition, type DefiPositionDetails, type DefiPositionToken, type DefiProtocolSummary, EstimatePoolYieldTool, type EstimatePoolYieldToolConfig, type ExchangeProviderConfig, type ExecuteSwapParams, type ExecuteSwapResult, GeminiProvider, GeminiSearchAiTool, type GeminiSearchAiToolConfig, HEX_TO_PANTOGRAPH, type HolderChangePeriod, type HolderSupplyTier, type HttpMethod, type IngestKnowledgeBaseInput, type IngestKnowledgeBaseResult, type InputTokenInfo, type KBSearchResult, KnowledgeBase, type KnowledgeBaseEntry, type KnowledgeBaseProvider, type LLMProvider, type LLMProviderConfig, type LLMResponse, type LLMToolCall, ManageLiquidityRedirectTool, type MarketplaceLink, type MoralisApiResponse, MoralisService, type MoralisServiceConfig, NFC_AGENT_TOOL_NAMES, NFC_AMAZON_DEFAULT_DOMAIN, NFC_AMAZON_DOMAINS, NFTContractInfoTool, type NFTContractMetadata, type NFTItem, type NFTLastSale, type NFTMetadata, NFTMetadataTool, NFT_AGENT_TOOL_NAMES, type NativeTokenInfo, NfcBuyTool, NfcInfoTool, type NftMessageToolConfig, type NftTransferLastSale, OpenAddLiquidityFormTool, type OpenAddLiquidityFormToolConfig, POOL_AGENT_TOOL_NAMES, PantographService, type PantographServiceConfig, type PaymentToken, PoolByAddressTool, type PoolByAddressToolConfig, PoolDetailTool, type PoolDetailToolConfig, type PoolDisplayInfo, PoolFallbackAiTool, type PoolFallbackAiToolConfig, type PoolOnchainInfo, PoolPriceRangesTool, type PoolPriceRangesToolConfig, PoolSearchTool, type PoolSearchToolConfig, PoolService, type PoolServiceConfig, type PresetInputs, PreviewAddLiquidityTool, type PreviewAddLiquidityToolConfig, type PriceBounds, type PriceRangePrefill, type ProviderName, type QuickRate, type RangePreset, type ReActPhase, type ReActStep, type ReActTrace, RelayAdapter, type ResolvedRange, Router, type RouterAssignment, type RouterDecision, SUPPORTED_CHAINS, SUPPORTED_CHAINS_LABEL, SWAP_PROVIDER_CONFIG, SendNativeTool, SendNftTool, SendTokenTool, type StorageProvider, Subagent, type SubagentCard, type SubagentOptions, type SubagentParams, type SubagentResult, type SubagentTask, type SubagentToggles, SubgraphAddPoolTool, type SubgraphAddPoolToolConfig, SubgraphCoinPoolPairsTool, type SubgraphCoinPoolPairsToolConfig, SubgraphPoolByAddressTool, type SubgraphPoolByAddressToolConfig, SubgraphPoolByPositionIdTool, type SubgraphPoolByPositionIdToolConfig, SubgraphPoolSearchTool, type SubgraphPoolSearchToolConfig, SubgraphPositionDetailTool, type SubgraphPositionDetailToolConfig, SubgraphTrendingPoolsTool, type SubgraphTrendingPoolsToolConfig, type SuggestedAction, Summarizer, type SupportedChainId, type SupportedChainName, type SwapQuoteParams, type SwapQuoteResult, type SwapServiceConfig, SwapServiceFactory, type SwapTokenConfirmTxProps, SwapTokenTool, type SwapTxData, Synthesizer, TOKEN_AGENT_TOOL_NAMES, TRANSFER_TOPIC, TRENDING_DEFAULT_BY_HEX_CHAIN, type TokenAnalyticsResponse, type TokenAnalyticsTimeframeBuckets, TokenAnalyticsTool, type TokenAnalyticsToolConfig, type TokenApproval, type TokenApprovalSpender, type TokenApprovalToken, type TokenBalance, type TokenDisplay, type TokenHoldersResponse, TokenHoldersTool, type TokenHoldersToolConfig, TokenInfoTool, type TokenInfoToolConfig, type TokenMetadata, type TokenScoreMetrics, type TokenScoreResponse, type TokenScoreSupply, type TokenScoreTimeframeBuckets, TokenScoreTool, type TokenScoreToolConfig, type Tool, type ToolDefinition, type ToolKind, type ToolParameter, ToolRegistry, type ToolResult, type TopGainerTimeFrames, type TopGainerToken, type TopGainersTimeFrame, TopGainersTool, type TopGainersToolConfig, TopPoolsTool, type TopPoolsToolConfig, type TrackStatus, type TrackTransactionParams, type TrackTransactionResult, type TransactionByHashResponse, TransactionByHashTool, type TransactionByHashToolConfig, type TransactionLog, type TransactionReceipt, type TransactionReceiptLog, type TrendingToken, type TrendingTokenTimeframeBuckets, TrendingTokensTool, type TrendingTokensToolConfig, type UIPayload, UNISWAP_CHAIN_SLUG, type UnsignedTx, type UpstashEmbedStrategy, type UpstashFusionAlgorithm, type UpstashKBUpsertEntry, UpstashKnowledgeBase, type UpstashKnowledgeBaseConfig, type UserContext, type VectorKBConfig, WALLET_ACTION_AGENT_TOOL_NAMES, WALLET_AGENT_TOOL_NAMES, WalletActionAppTool, type WalletActionAppToolConfig, type WalletActionProps, type WalletActionType, type WalletApprovalsResponse, WalletApprovalsTool, type WalletApprovalsToolConfig, type WalletDefiPositionSummary, WalletDefiPositionsTool, type WalletDefiPositionsToolConfig, type WalletDefiPositionsV1Response, type WalletDefiProtocolPositionsResponse, WalletDefiProtocolPositionsTool, type WalletDefiProtocolPositionsToolConfig, type WalletDefiProtocolPositionsV1Response, type WalletDefiSummaryResponse, WalletDefiSummaryTool, type WalletDefiSummaryToolConfig, type WalletHistoryCategory, type WalletHistoryContractInteraction, type WalletHistoryErc20Transfer, type WalletHistoryItem, type WalletHistoryNativeTransfer, type WalletHistoryNftTransfer, type WalletHistoryResponse, WalletHistoryTool, type WalletHistoryToolConfig, WalletNFTsTool, type WalletNFTsToolConfig, type WalletNftTransferItem, type WalletNftTransfersResponse, WalletNftTransfersTool, type WalletNftTransfersToolConfig, type WalletPnlDaysWindow, type WalletPnlResponse, type WalletPnlSummaryResponse, WalletPnlSummaryTool, type WalletPnlSummaryToolConfig, type WalletPnlTokenItem, WalletPnlTool, type WalletPnlToolConfig, WalletTokenBalancesTool, type WalletTokenBalancesToolConfig, type WalletTokenTransferItem, type WalletTokenTransfersResponse, WalletTokenTransfersTool, type WalletTokenTransfersToolConfig, type WebsiteTrustExtraData, type WebsiteTrustInput, WebsiteTrustKeyringAgent, type WebsiteTrustKeyringAgentConfig, type WebsiteTrustResult, type X402Authorization, type X402Challenge, type X402Outcome, type X402PaymentRequiredProps, type X402RequestSpec, type X402Requirements, type X402SignRequest, type X402Signer, type X402TypedData, ZERO_ADDRESS, amazonDomainForLanguage, apiClient, buildChallenge, buildRangePresets, buildUniswapPoolUrl, clampTick, completeX402, configureSupportedChains, createAiAgent, createDefaultSubagents, createNfcAgent, createNftAgent, createPoolAgent, createTokenAgent, createWalletActionAgent, createWalletActionAppTools, createWalletAgent, createX402SignatureProvider, displayFromChallenge, encodeSignedHeader, ethCallAt, ethCallByChain, fetchTopMarketplaces, getAffiliateFee, getChainMeta, getDefaultRpcUrl, getGatewayAddress, getGatewayChains, getNativeTokenInfo, getPositionManagerAddress, getProviderByChain, ingestKnowledgeBase, isAbortError, nfcAmazonSearchUrl, normaliseCountry, normalizePriceRangeToPool, priceToTick, requestWithX402, resolveNfcShopLinks, resolveRpcUrl, roundTickToSpacing, rpcCall, setRpcOverrides, swapServiceFactory, tickToPrice, toPantographChain };
8082
+ export { AI_AGENT_TOOL_NAMES, AbortError, type AddLiquidityFormProps, type AddLiquiditySummary, type AffiliateFee, type AgentConfig, AgentCore, type AgentResponse, ApproveTokenTool, BaseNftAiTool, BaseSwapService, BaseTool, BaseWalletActionTool, type BuyTokenConfirmTxProps, type BuyTokenSide, BuyTokenTool, type ChainMeta, type ChainRef, type ChainSelector, ChatHistory, type ChatMessage, type ChatOptions, type ChatRole, type CheckApprovalParams, type CheckApprovalResult, type ConfirmAddLiquidityTxProps, type CortexResponse, DEFAULT_CHAIN, DEFAULT_PROVIDER, DEFAULT_RPC_BY_CHAIN, DebridgeAdapter, type DecodedCall, type DecodedEvent, type DecodedParam, type DefaultSubagentName, type DefiPosition, type DefiPositionDetails, type DefiPositionToken, type DefiProtocolSummary, EstimatePoolYieldTool, type EstimatePoolYieldToolConfig, type ExchangeProviderConfig, type ExecuteSwapParams, type ExecuteSwapResult, GeminiProvider, GeminiSearchAiTool, type GeminiSearchAiToolConfig, HEX_TO_PANTOGRAPH, type HolderChangePeriod, type HolderSupplyTier, type HttpMethod, type IngestKnowledgeBaseInput, type IngestKnowledgeBaseResult, type InputTokenInfo, type KBSearchResult, KnowledgeBase, type KnowledgeBaseEntry, type KnowledgeBaseProvider, type LLMProvider, type LLMProviderConfig, type LLMResponse, type LLMToolCall, ManageLiquidityRedirectTool, type MarketplaceLink, type MoralisApiResponse, MoralisService, type MoralisServiceConfig, NFC_AGENT_TOOL_NAMES, NFC_AMAZON_DEFAULT_DOMAIN, NFC_AMAZON_DOMAINS, type NFTCollectionItem, NFTContractInfoTool, type NFTContractMetadata, type NFTItem, type NFTLastSale, type NFTMetadata, NFTMetadataTool, NFT_AGENT_TOOL_NAMES, type NativeTokenInfo, NfcBuyTool, NfcInfoTool, type NftTransferLastSale, NoFormTool, type NoFormToolMessages, OpenAddLiquidityFormTool, type OpenAddLiquidityFormToolConfig, POOL_AGENT_TOOL_NAMES, PantographService, type PantographServiceConfig, type PaymentToken, PoolByAddressTool, type PoolByAddressToolConfig, PoolDetailTool, type PoolDetailToolConfig, type PoolDisplayInfo, PoolFallbackAiTool, type PoolFallbackAiToolConfig, type PoolOnchainInfo, PoolPriceRangesTool, type PoolPriceRangesToolConfig, PoolSearchTool, type PoolSearchToolConfig, PoolService, type PoolServiceConfig, type PresetInputs, PreviewAddLiquidityTool, type PreviewAddLiquidityToolConfig, type PriceBounds, type PriceRangePrefill, type ProviderName, type QuickRate, type RangePreset, type ReActPhase, type ReActStep, type ReActTrace, RelayAdapter, type ResolvedRange, Router, type RouterAssignment, type RouterDecision, SUPPORTED_CHAINS, SUPPORTED_CHAINS_LABEL, SWAP_PROVIDER_CONFIG, SendNativeTool, SendNftTool, SendTokenTool, type StorageProvider, Subagent, type SubagentCard, type SubagentOptions, type SubagentParams, type SubagentResult, type SubagentTask, type SubagentToggles, SubgraphAddPoolTool, type SubgraphAddPoolToolConfig, SubgraphCoinPoolPairsTool, type SubgraphCoinPoolPairsToolConfig, SubgraphPoolByAddressTool, type SubgraphPoolByAddressToolConfig, SubgraphPoolByPositionIdTool, type SubgraphPoolByPositionIdToolConfig, SubgraphPoolSearchTool, type SubgraphPoolSearchToolConfig, SubgraphPositionDetailTool, type SubgraphPositionDetailToolConfig, SubgraphTrendingPoolsTool, type SubgraphTrendingPoolsToolConfig, type SuggestedAction, Summarizer, type SupportedChainId, type SupportedChainName, type SwapQuoteParams, type SwapQuoteResult, type SwapServiceConfig, SwapServiceFactory, type SwapTokenConfirmTxProps, SwapTokenTool, type SwapTxData, Synthesizer, TOKEN_AGENT_TOOL_NAMES, TRANSFER_TOPIC, TRENDING_DEFAULT_BY_HEX_CHAIN, type TokenAnalyticsResponse, type TokenAnalyticsTimeframeBuckets, TokenAnalyticsTool, type TokenAnalyticsToolConfig, type TokenApproval, type TokenApprovalSpender, type TokenApprovalToken, type TokenBalance, type TokenDisplay, type TokenHoldersResponse, TokenHoldersTool, type TokenHoldersToolConfig, TokenInfoTool, type TokenInfoToolConfig, type TokenMetadata, type TokenScoreMetrics, type TokenScoreResponse, type TokenScoreSupply, type TokenScoreTimeframeBuckets, TokenScoreTool, type TokenScoreToolConfig, type Tool, type ToolDefinition, type ToolKind, type ToolParameter, ToolRegistry, type ToolResult, type TopGainerTimeFrames, type TopGainerToken, type TopGainersTimeFrame, TopGainersTool, type TopGainersToolConfig, TopPoolsTool, type TopPoolsToolConfig, type TrackStatus, type TrackTransactionParams, type TrackTransactionResult, type TransactionByHashResponse, TransactionByHashTool, type TransactionByHashToolConfig, type TransactionLog, type TransactionReceipt, type TransactionReceiptLog, type TrendingToken, type TrendingTokenTimeframeBuckets, TrendingTokensTool, type TrendingTokensToolConfig, type UIPayload, UNISWAP_CHAIN_SLUG, type UnsignedTx, type UpstashEmbedStrategy, type UpstashFusionAlgorithm, type UpstashKBUpsertEntry, UpstashKnowledgeBase, type UpstashKnowledgeBaseConfig, type UserContext, type VectorKBConfig, WALLET_ACTION_AGENT_TOOL_NAMES, WALLET_AGENT_TOOL_NAMES, type WalletActionProps, type WalletActionType, type WalletApprovalsResponse, WalletApprovalsTool, type WalletApprovalsToolConfig, type WalletDefiPositionSummary, WalletDefiPositionsTool, type WalletDefiPositionsToolConfig, type WalletDefiPositionsV1Response, type WalletDefiProtocolPositionsResponse, WalletDefiProtocolPositionsTool, type WalletDefiProtocolPositionsToolConfig, type WalletDefiProtocolPositionsV1Response, type WalletDefiSummaryResponse, WalletDefiSummaryTool, type WalletDefiSummaryToolConfig, type WalletDefiSummaryV1Response, type WalletHistoryCategory, type WalletHistoryContractInteraction, type WalletHistoryErc20Transfer, type WalletHistoryItem, type WalletHistoryNativeTransfer, type WalletHistoryNftTransfer, type WalletHistoryResponse, WalletHistoryTool, type WalletHistoryToolConfig, WalletNFTsTool, type WalletNFTsToolConfig, type WalletNftCardProps, type WalletNftListProps, type WalletNftTransferItem, type WalletNftTransfersResponse, WalletNftTransfersTool, type WalletNftTransfersToolConfig, type WalletPnlDaysWindow, type WalletPnlResponse, type WalletPnlSummaryResponse, WalletPnlSummaryTool, type WalletPnlSummaryToolConfig, type WalletPnlTokenItem, WalletPnlTool, type WalletPnlToolConfig, WalletTokenBalancesTool, type WalletTokenBalancesToolConfig, type WalletTokenTransferItem, type WalletTokenTransfersResponse, WalletTokenTransfersTool, type WalletTokenTransfersToolConfig, type WebsiteTrustExtraData, type WebsiteTrustInput, WebsiteTrustKeyringAgent, type WebsiteTrustKeyringAgentConfig, type WebsiteTrustResult, type X402Authorization, type X402Challenge, type X402Outcome, type X402PaymentRequiredProps, type X402RequestSpec, type X402Requirements, type X402SignRequest, type X402Signer, type X402TypedData, ZERO_ADDRESS, amazonDomainForLanguage, apiClient, buildChallenge, buildRangePresets, buildUniswapPoolUrl, clampTick, completeX402, configureSupportedChains, createAiAgent, createDefaultSubagents, createNfcAgent, createNftAgent, createPoolAgent, createTokenAgent, createWalletActionAgent, createWalletAgent, createX402SignatureProvider, displayFromChallenge, encodeSignedHeader, ethCallAt, ethCallByChain, fetchTopMarketplaces, getAffiliateFee, getChainMeta, getDefaultRpcUrl, getGatewayAddress, getGatewayChains, getNativeTokenInfo, getPositionManagerAddress, getProviderByChain, ingestKnowledgeBase, isAbortError, nfcAmazonSearchUrl, normaliseCountry, normalizePriceRangeToPool, priceToTick, registerMaybeNoForm, requestWithX402, resolveNfcShopLinks, resolveRpcUrl, roundTickToSpacing, rpcCall, setRpcOverrides, swapServiceFactory, tickToPrice, toPantographChain };