keyring-agent-core 0.2.39 → 0.2.41

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
@@ -1438,6 +1438,15 @@ interface ChatOptions {
1438
1438
  maxRetries?: number;
1439
1439
  /** Delay between retries in ms */
1440
1440
  retryDelayMs?: number;
1441
+ /**
1442
+ * Per-call cap on generated tokens, overriding the provider default
1443
+ * (`LLMProviderConfig.maxTokens`). Short structured turns — router/rewrite JSON,
1444
+ * language detection, yes/no guards, suggestion arrays — only need a few hundred
1445
+ * tokens; capping them lets the model stop sooner (fewer tokens to generate =
1446
+ * faster turn) instead of running up to the global 4096 budget. Leave unset to
1447
+ * use the provider default.
1448
+ */
1449
+ maxOutputTokens?: number;
1441
1450
  /**
1442
1451
  * Force the model to call one of the supplied `tools` instead of answering in
1443
1452
  * text (Gemini `functionCallingConfig.mode = "ANY"`). Used by action subagents
@@ -1574,6 +1583,8 @@ declare class Subagent {
1574
1583
  constructor(params: SubagentParams);
1575
1584
  /** Card shown to the router for selection. */
1576
1585
  getCard(): SubagentCard;
1586
+ /** True when this subagent is allowed to invoke the named tool. */
1587
+ ownsTool(toolName: string): boolean;
1577
1588
  /** Only the tools this subagent owns, resolved from the shared registry. */
1578
1589
  private getTools;
1579
1590
  run(task: SubagentTask, conversationHistory: ChatMessage[], userContext?: UserContext): Promise<SubagentResult>;
@@ -1775,6 +1786,33 @@ declare class AgentCore {
1775
1786
  invokeTool(name: string, args: Record<string, unknown>, options?: {
1776
1787
  userMessage?: string;
1777
1788
  }): Promise<AgentResponse>;
1789
+ /**
1790
+ * Fast path: execute ONE known tool with structured args, then run the SAME
1791
+ * synthesise → finalise flow as {@link chat} — but skip the rewrite / KB /
1792
+ * router / subagent-ReAct stages entirely.
1793
+ *
1794
+ * Use this when the FE already knows EXACTLY which tool to call and has the
1795
+ * args (e.g. a token-info screen that always calls `get-token-info`). Versus
1796
+ * `chat()` it saves ~3-4 LLM calls (no rewrite, no router, no per-tool ReAct
1797
+ * 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.
1800
+ *
1801
+ * Differs from {@link invokeTool}: invokeTool returns the tool's own `summary`
1802
+ * (+ UI) with NO LLM pass — right for action/UI tools (forms, redirects).
1803
+ * runTool LLM-synthesises the tool data into prose — right for DATA tools like
1804
+ * `get-token-info` whose result has no `summary` field.
1805
+ *
1806
+ * `options.userMessage` is the natural-language question recorded in history
1807
+ * and fed to the synthesiser (it drives the answer wording + language). Pass
1808
+ * the user's actual question when you have it.
1809
+ */
1810
+ runTool(name: string, args: Record<string, unknown>, options?: {
1811
+ userMessage?: string;
1812
+ generateSuggestions?: boolean;
1813
+ language?: string;
1814
+ signal?: AbortSignal;
1815
+ }): Promise<AgentResponse>;
1778
1816
  /**
1779
1817
  * Register the host's inline x402 signer and turn on transparent x402. When
1780
1818
  * set, ANY ApiClient call (every service/tool uses it) that returns 402 makes
@@ -1937,6 +1975,13 @@ declare class AgentCore {
1937
1975
  * Synthesizer can consume. The `finalAnswer` here is a compact
1938
1976
  * concatenation of each subagent's own answer, labelled by name.
1939
1977
  */
1978
+ /**
1979
+ * Synthesiser-input history: the working window with the trailing user message
1980
+ * dropped (the query is passed separately) and tool messages stripped (the
1981
+ * synthesiser declares no tools). Shared by the chat graph's synthesize node
1982
+ * and {@link runTool}.
1983
+ */
1984
+ private synthesiserHistory;
1940
1985
  private mergeTrace;
1941
1986
  private finaliseAnswer;
1942
1987
  private generateSuggestions;
@@ -3723,6 +3768,12 @@ declare class TokenInfoTool extends BaseTool {
3723
3768
  private llm;
3724
3769
  constructor(config?: TokenInfoToolConfig);
3725
3770
  protected run(args: Record<string, unknown>, userContext?: UserContext): Promise<{
3771
+ _instructions: string;
3772
+ keyword: string;
3773
+ token: null;
3774
+ userHoldsToken: boolean;
3775
+ research: string | null;
3776
+ } | {
3726
3777
  research: string | null;
3727
3778
  searchResults?: TokenMetadata[] | undefined;
3728
3779
  _instructions: string;
@@ -3733,6 +3784,14 @@ declare class TokenInfoTool extends BaseTool {
3733
3784
  } | {
3734
3785
  error: string;
3735
3786
  }>;
3787
+ /**
3788
+ * Fallback for when the connected/requested chain isn't supported: skip the
3789
+ * chain-bound data sources (Pantograph search, Moralis metadata, wallet
3790
+ * holdings) and answer purely from Gemini's Google-Search-grounded research,
3791
+ * which is chain-agnostic. Returns the same `research` shape the synthesizer
3792
+ * already knows how to fold into a reply.
3793
+ */
3794
+ private researchTokenChainAgnostic;
3736
3795
  private searchToken;
3737
3796
  private askGeminiWithSearch;
3738
3797
  private findTokenInWallet;