keyring-agent-core 0.2.8 → 0.2.9
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 +49 -0
- package/dist/index.js +48 -48
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1006,6 +1006,13 @@ interface UserContext {
|
|
|
1006
1006
|
walletAddress?: string | null;
|
|
1007
1007
|
/** Current chain the wallet is on (e.g. "ethereum", "arbitrum", "base"). */
|
|
1008
1008
|
chain?: string | null;
|
|
1009
|
+
/**
|
|
1010
|
+
* The raw user query for this turn (verbatim phrasing). Tools that need to
|
|
1011
|
+
* disambiguate LLM-extracted args against what the user actually typed read it
|
|
1012
|
+
* — e.g. BuyToken checks which token an amount sits next to to decide whether
|
|
1013
|
+
* it's the buy-side or pay-side amount. Optional; absent on programmatic calls.
|
|
1014
|
+
*/
|
|
1015
|
+
query?: string;
|
|
1009
1016
|
}
|
|
1010
1017
|
/**
|
|
1011
1018
|
* Platform-agnostic storage interface.
|
|
@@ -1271,6 +1278,14 @@ interface ChatOptions {
|
|
|
1271
1278
|
maxRetries?: number;
|
|
1272
1279
|
/** Delay between retries in ms */
|
|
1273
1280
|
retryDelayMs?: number;
|
|
1281
|
+
/**
|
|
1282
|
+
* Force the model to call one of the supplied `tools` instead of answering in
|
|
1283
|
+
* text (Gemini `functionCallingConfig.mode = "ANY"`). Used by action subagents
|
|
1284
|
+
* that MUST open a form, so the first turn calls a tool directly instead of
|
|
1285
|
+
* burning a round-trip on a text answer that then has to be re-prompted.
|
|
1286
|
+
* Ignored when no tools are passed.
|
|
1287
|
+
*/
|
|
1288
|
+
forceToolUse?: boolean;
|
|
1274
1289
|
}
|
|
1275
1290
|
interface LLMProvider {
|
|
1276
1291
|
/** Send messages to the LLM and get a response */
|
|
@@ -1608,6 +1623,14 @@ declare class AgentCore {
|
|
|
1608
1623
|
* this turn (e.g. a token-picker after the user said "send token" without
|
|
1609
1624
|
* naming one). Preserves emission order; drops malformed entries.
|
|
1610
1625
|
*/
|
|
1626
|
+
/**
|
|
1627
|
+
* Uppercase only the FIRST character of a button click-prompt so it reads as
|
|
1628
|
+
* a proper sentence when echoed as the user's sent message. Language-agnostic:
|
|
1629
|
+
* locale-aware casing on the leading character only, a harmless no-op for
|
|
1630
|
+
* scripts without letter case (e.g. Japanese/Chinese). Uses code-point
|
|
1631
|
+
* iteration so a leading surrogate-pair/emoji isn't split.
|
|
1632
|
+
*/
|
|
1633
|
+
private capitalizeFirst;
|
|
1611
1634
|
private collectActionButtons;
|
|
1612
1635
|
private collectUiActions;
|
|
1613
1636
|
/**
|
|
@@ -5881,6 +5904,32 @@ declare class BuyTokenTool extends BaseTool {
|
|
|
5881
5904
|
private buildResult;
|
|
5882
5905
|
private normaliseAddress;
|
|
5883
5906
|
private normaliseAmount;
|
|
5907
|
+
/**
|
|
5908
|
+
* Deterministically fix which SIDE an amount belongs to. The LLM occasionally
|
|
5909
|
+
* assigns the spend amount to the wrong field — e.g. "buy WETH with 0.0000011
|
|
5910
|
+
* WBTC" arriving as buy_amount="0.0000011" when 0.0000011 is the WBTC (pay)
|
|
5911
|
+
* amount. When EXACTLY one amount is present and BOTH token symbols are named,
|
|
5912
|
+
* we read the RAW user query and assign the amount to whichever symbol it
|
|
5913
|
+
* physically sits next to. Language-agnostic: proximity/position only, never
|
|
5914
|
+
* prepositions ("with"/"bằng"/"で"). Only corrects when the number AND both
|
|
5915
|
+
* symbols are found verbatim in the query (high confidence); otherwise it
|
|
5916
|
+
* leaves the LLM's assignment untouched, so a correct call is never worsened.
|
|
5917
|
+
*/
|
|
5918
|
+
private correctAmountSide;
|
|
5919
|
+
/**
|
|
5920
|
+
* Decide which named token an amount sits next to in the raw query by text
|
|
5921
|
+
* proximity. Returns 'buy' / 'pay' for the closer symbol, or `null` when the
|
|
5922
|
+
* number or either symbol can't be located as a standalone token (caller then
|
|
5923
|
+
* declines to override). Symbols match on token boundaries so "ETH" is not
|
|
5924
|
+
* found inside "WETH".
|
|
5925
|
+
*/
|
|
5926
|
+
private nearestSymbolSide;
|
|
5927
|
+
/**
|
|
5928
|
+
* indexOf for a symbol token that must stand alone (not be a substring of a
|
|
5929
|
+
* larger alphanumeric word) — so "eth" matches in "with eth" but not in "weth".
|
|
5930
|
+
* Returns the symbol's index, or -1 when not present as a standalone token.
|
|
5931
|
+
*/
|
|
5932
|
+
private indexOfToken;
|
|
5884
5933
|
private requireChain;
|
|
5885
5934
|
/**
|
|
5886
5935
|
* Resolve a token reference (symbol "USDC" or address "0x…") on a chain.
|