keyring-agent-core 0.2.46 → 0.2.48
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 +45 -0
- package/dist/index.js +88 -81
- package/dist/index.native.js +183 -176
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2090,6 +2090,16 @@ interface WebsiteTrustKeyringAgentConfig {
|
|
|
2090
2090
|
llm?: LLMProviderConfig;
|
|
2091
2091
|
/** Bring your own LLM provider (e.g. a shared instance). Overrides `llm`. */
|
|
2092
2092
|
provider?: LLMProvider;
|
|
2093
|
+
/**
|
|
2094
|
+
* License key gating use of the Keyring-hosted Gemini proxy, exactly as in
|
|
2095
|
+
* {@link AgentCore.secretKey}. Validated lazily on the first
|
|
2096
|
+
* {@link WebsiteTrustKeyringAgent.chat} call, never in the constructor.
|
|
2097
|
+
*
|
|
2098
|
+
* Optional ONLY in bring-your-own-key mode — when {@link LLMProviderConfig.apiKey}
|
|
2099
|
+
* is set, calls go straight to Google, consume none of our proxy, and the gate is
|
|
2100
|
+
* waived. Without an `llm.apiKey`, this is required.
|
|
2101
|
+
*/
|
|
2102
|
+
secretKey?: string;
|
|
2093
2103
|
/**
|
|
2094
2104
|
* The ecosystem the input URLs belong to. Every URL handed to this agent is a
|
|
2095
2105
|
* site that integrates WalletConnect — i.e. a blockchain / Web3 dApp — so the
|
|
@@ -2201,7 +2211,29 @@ declare class WebsiteTrustKeyringAgent {
|
|
|
2201
2211
|
private readonly debug;
|
|
2202
2212
|
/** Ecosystem prior scoping every search-grounded call (see {@link DEFAULT_ECOSYSTEM_CONTEXT}). */
|
|
2203
2213
|
private readonly ecosystem;
|
|
2214
|
+
/** Caller-supplied license key; validated lazily on first chat() via assertLicense(). */
|
|
2215
|
+
private readonly secretKey;
|
|
2216
|
+
/**
|
|
2217
|
+
* True when the caller supplied their own Gemini API key (`llm.apiKey`), so
|
|
2218
|
+
* every LLM call goes straight to Google and the licence gate does not apply.
|
|
2219
|
+
*/
|
|
2220
|
+
private readonly ownGeminiKey;
|
|
2221
|
+
/** True once the license has passed, so we only hash-check once. */
|
|
2222
|
+
private licenseChecked;
|
|
2204
2223
|
constructor(config?: WebsiteTrustKeyringAgentConfig);
|
|
2224
|
+
/**
|
|
2225
|
+
* Validate the license key against the hash baked into this bundle at build
|
|
2226
|
+
* time (`__AGENT_LICENSE_HASH__`, set by tsup from `SECRET_KEY_HASH`). The
|
|
2227
|
+
* app passes the raw key; we hash it here and compare hash-to-hash, so
|
|
2228
|
+
* neither the bundle nor the repo ever holds the key itself. When no hash was
|
|
2229
|
+
* baked in (local dev build with no `SECRET_KEY_HASH`) the gate is a no-op.
|
|
2230
|
+
* Cached after the first pass so we only hash once.
|
|
2231
|
+
*
|
|
2232
|
+
* The gate exists to protect the Keyring-hosted Gemini proxy. A caller that
|
|
2233
|
+
* brings their own Gemini API key (`llm.apiKey`) talks to Google directly and
|
|
2234
|
+
* consumes nothing of ours, so no secretKey is required in that mode.
|
|
2235
|
+
*/
|
|
2236
|
+
private assertLicense;
|
|
2205
2237
|
chat(input: WebsiteTrustInput): Promise<WebsiteTrustResult>;
|
|
2206
2238
|
/**
|
|
2207
2239
|
* Derive the phishing verdict + raw (English) evidence reasons from the
|
|
@@ -6755,6 +6787,19 @@ declare abstract class BaseWalletActionTool extends BaseTool {
|
|
|
6755
6787
|
protected cleanAmountString(s: string): string;
|
|
6756
6788
|
/** Format a number as a plain decimal string, expanding any e-notation. */
|
|
6757
6789
|
protected toPlainDecimal(n: number): string;
|
|
6790
|
+
/**
|
|
6791
|
+
* The USD value of a spendable balance as a plain decimal STRING, from the
|
|
6792
|
+
* token amount and its unit price — the RAW `amount × usdPrice`, with NO
|
|
6793
|
+
* rounding or truncation. The FE owns all display formatting (rounding to
|
|
6794
|
+
* cents, "$", thousands separators); the core just hands over the full-
|
|
6795
|
+
* precision number so nothing is thrown away before the app decides.
|
|
6796
|
+
*
|
|
6797
|
+
* Returns `undefined` — meaning "no dollar figure to show" — whenever either
|
|
6798
|
+
* input is missing or unusable (no price, unparseable amount, non-positive
|
|
6799
|
+
* value), so the form falls back to showing just the token amount. Never
|
|
6800
|
+
* throws; a best-effort adornment, not a gate.
|
|
6801
|
+
*/
|
|
6802
|
+
protected formatSpendableUsd(spendable: string | undefined, usdPrice: number | undefined): string | undefined;
|
|
6758
6803
|
/**
|
|
6759
6804
|
* Override `execute` so the `ui` payload we return from `run()` is lifted
|
|
6760
6805
|
* onto the ToolResult envelope (BaseTool only copies `data`).
|