@bridgenode/llm 0.1.0 → 0.2.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/README.md +62 -1396
- package/dist/index.cjs +22 -22
- package/dist/index.d.cts +73 -73
- package/dist/index.d.ts +73 -73
- package/dist/index.js +22 -22
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -33,7 +33,7 @@ __export(index_exports, {
|
|
|
33
33
|
APIError: () => APIError,
|
|
34
34
|
AnthropicClient: () => AnthropicClient,
|
|
35
35
|
BASE_CHAIN_ID: () => BASE_CHAIN_ID,
|
|
36
|
-
BridgeNodeClient: () =>
|
|
36
|
+
BridgeNodeClient: () => BridgeNodeClient,
|
|
37
37
|
BridgeNodeError: () => BridgeNodeError,
|
|
38
38
|
ImageClient: () => ImageClient,
|
|
39
39
|
KNOWN_PROVIDERS: () => KNOWN_PROVIDERS,
|
|
@@ -585,7 +585,7 @@ var LLMClient = class _LLMClient {
|
|
|
585
585
|
preAuthCache = /* @__PURE__ */ new Map();
|
|
586
586
|
static PRE_AUTH_TTL_MS = 36e5;
|
|
587
587
|
/**
|
|
588
|
-
* Initialize the
|
|
588
|
+
* Initialize the BridgeNode LLM client.
|
|
589
589
|
*
|
|
590
590
|
* @param options - Client configuration options (optional if BASE_CHAIN_WALLET_KEY env var is set)
|
|
591
591
|
*/
|
|
@@ -932,7 +932,7 @@ var LLMClient = class _LLMClient {
|
|
|
932
932
|
details.resource?.url || `${this.apiUrl}/v1/chat/completions`,
|
|
933
933
|
this.apiUrl
|
|
934
934
|
),
|
|
935
|
-
resourceDescription: details.resource?.description || "
|
|
935
|
+
resourceDescription: details.resource?.description || "BridgeNode AI API call",
|
|
936
936
|
maxTimeoutSeconds: details.maxTimeoutSeconds || 300,
|
|
937
937
|
extra: details.extra,
|
|
938
938
|
extensions
|
|
@@ -1017,7 +1017,7 @@ var LLMClient = class _LLMClient {
|
|
|
1017
1017
|
details.resource?.url || `${this.apiUrl}/v1/chat/completions`,
|
|
1018
1018
|
this.apiUrl
|
|
1019
1019
|
),
|
|
1020
|
-
resourceDescription: details.resource?.description || "
|
|
1020
|
+
resourceDescription: details.resource?.description || "BridgeNode AI API call",
|
|
1021
1021
|
maxTimeoutSeconds: details.maxTimeoutSeconds || 300,
|
|
1022
1022
|
extra: details.extra,
|
|
1023
1023
|
extensions
|
|
@@ -1208,7 +1208,7 @@ var LLMClient = class _LLMClient {
|
|
|
1208
1208
|
details.resource?.url || url,
|
|
1209
1209
|
this.apiUrl
|
|
1210
1210
|
),
|
|
1211
|
-
resourceDescription: details.resource?.description || "
|
|
1211
|
+
resourceDescription: details.resource?.description || "BridgeNode AI API call",
|
|
1212
1212
|
maxTimeoutSeconds: details.maxTimeoutSeconds || 300,
|
|
1213
1213
|
extra: details.extra,
|
|
1214
1214
|
extensions
|
|
@@ -1355,7 +1355,7 @@ var LLMClient = class _LLMClient {
|
|
|
1355
1355
|
details.resource?.url || url,
|
|
1356
1356
|
this.apiUrl
|
|
1357
1357
|
),
|
|
1358
|
-
resourceDescription: details.resource?.description || "
|
|
1358
|
+
resourceDescription: details.resource?.description || "BridgeNode AI API call",
|
|
1359
1359
|
maxTimeoutSeconds: details.maxTimeoutSeconds || 300,
|
|
1360
1360
|
extra: details.extra,
|
|
1361
1361
|
extensions
|
|
@@ -1811,7 +1811,7 @@ var LLMClient = class _LLMClient {
|
|
|
1811
1811
|
// 0x DEX (swap quotes + gasless) — free passthrough
|
|
1812
1812
|
// ============================================================
|
|
1813
1813
|
/**
|
|
1814
|
-
* Query the 0x Swap / Gasless APIs (free — no x402 payment;
|
|
1814
|
+
* Query the 0x Swap / Gasless APIs (free — no x402 payment; BridgeNode
|
|
1815
1815
|
* takes an on-chain affiliate fee on executed swaps instead).
|
|
1816
1816
|
*
|
|
1817
1817
|
* @param path - "price", "quote", "gasless/price", "gasless/quote",
|
|
@@ -1925,7 +1925,7 @@ var ImageClient = class {
|
|
|
1925
1925
|
sessionTotalUsd = 0;
|
|
1926
1926
|
sessionCalls = 0;
|
|
1927
1927
|
/**
|
|
1928
|
-
* Initialize the
|
|
1928
|
+
* Initialize the BridgeNode Image client.
|
|
1929
1929
|
*
|
|
1930
1930
|
* @param options - Client configuration options
|
|
1931
1931
|
*/
|
|
@@ -2426,7 +2426,7 @@ var SpeechClient = class {
|
|
|
2426
2426
|
* @returns SpeechResponse with audio URL, format, and character count
|
|
2427
2427
|
*
|
|
2428
2428
|
* @example
|
|
2429
|
-
* const result = await client.generate('Welcome to
|
|
2429
|
+
* const result = await client.generate('Welcome to BridgeNode.', { voice: 'george' });
|
|
2430
2430
|
* console.log(result.data[0].url); // audio URL (mp3 by default)
|
|
2431
2431
|
*/
|
|
2432
2432
|
async generate(input, options) {
|
|
@@ -3415,7 +3415,7 @@ var PortraitClient = class {
|
|
|
3415
3415
|
details.network || "eip155:8453",
|
|
3416
3416
|
{
|
|
3417
3417
|
resourceUrl: details.resource?.url || url,
|
|
3418
|
-
resourceDescription: details.resource?.description || "
|
|
3418
|
+
resourceDescription: details.resource?.description || "BridgeNode Virtual Portrait",
|
|
3419
3419
|
maxTimeoutSeconds: details.maxTimeoutSeconds || 300,
|
|
3420
3420
|
extra: details.extra
|
|
3421
3421
|
}
|
|
@@ -4219,14 +4219,14 @@ var RpcClient = class {
|
|
|
4219
4219
|
}
|
|
4220
4220
|
};
|
|
4221
4221
|
|
|
4222
|
-
// src/
|
|
4222
|
+
// src/bridgenode.ts
|
|
4223
4223
|
var import_accounts14 = require("viem/accounts");
|
|
4224
4224
|
var DEFAULT_API_URL13 = "https://bridgenode.cc/api";
|
|
4225
4225
|
var DEFAULT_TIMEOUT13 = 6e4;
|
|
4226
4226
|
var DEFAULT_POLL_INTERVAL_MS = 5e3;
|
|
4227
4227
|
var DEFAULT_POLL_BUDGET_MS = 3e5;
|
|
4228
4228
|
var MAX_SIGNED_AUTH_SECONDS = 600;
|
|
4229
|
-
var
|
|
4229
|
+
var BridgeNodeClient = class {
|
|
4230
4230
|
account;
|
|
4231
4231
|
privateKey;
|
|
4232
4232
|
apiUrl;
|
|
@@ -4250,7 +4250,7 @@ var BlockrunClient = class {
|
|
|
4250
4250
|
this.timeout = options.timeout || DEFAULT_TIMEOUT13;
|
|
4251
4251
|
}
|
|
4252
4252
|
/**
|
|
4253
|
-
* GET a
|
|
4253
|
+
* GET a BridgeNode endpoint. `path` is everything after `/api` (a leading
|
|
4254
4254
|
* `/api` is tolerated and stripped). Query params are URL-encoded; arrays
|
|
4255
4255
|
* become repeated keys (`?a=1&a=2`); undefined/null are dropped.
|
|
4256
4256
|
*/
|
|
@@ -4259,7 +4259,7 @@ var BlockrunClient = class {
|
|
|
4259
4259
|
return this.requestWithPayment(url, "GET");
|
|
4260
4260
|
}
|
|
4261
4261
|
/**
|
|
4262
|
-
* POST a
|
|
4262
|
+
* POST a BridgeNode endpoint with a JSON body.
|
|
4263
4263
|
*/
|
|
4264
4264
|
async post(path5, body) {
|
|
4265
4265
|
const url = this.buildUrl(path5);
|
|
@@ -4716,12 +4716,12 @@ function formatWalletMigrationNotice(newAddress) {
|
|
|
4716
4716
|
if (addresses.length === 0) return null;
|
|
4717
4717
|
const found = addresses.map((addr) => ` ${addr}`).join("\n");
|
|
4718
4718
|
return `
|
|
4719
|
-
NOTICE:
|
|
4719
|
+
NOTICE: BridgeNode created a new wallet, but also found existing wallet(s)
|
|
4720
4720
|
belonging to other applications on this system:
|
|
4721
4721
|
|
|
4722
4722
|
${found}
|
|
4723
4723
|
|
|
4724
|
-
|
|
4724
|
+
BridgeNode now uses only its own wallet:
|
|
4725
4725
|
|
|
4726
4726
|
${newAddress}
|
|
4727
4727
|
|
|
@@ -4731,7 +4731,7 @@ do not control.
|
|
|
4731
4731
|
|
|
4732
4732
|
If an address above is yours and holds your USDC, adopt it deliberately:
|
|
4733
4733
|
|
|
4734
|
-
import { importWallet } from '@
|
|
4734
|
+
import { importWallet } from '@bridgenode/llm';
|
|
4735
4735
|
importWallet("<address-from-the-list-above>");
|
|
4736
4736
|
|
|
4737
4737
|
Your current wallet is backed up first. You can also set
|
|
@@ -4779,7 +4779,7 @@ function getPaymentLinks(address) {
|
|
|
4779
4779
|
function formatWalletCreatedMessage(address) {
|
|
4780
4780
|
const links = getPaymentLinks(address);
|
|
4781
4781
|
return `
|
|
4782
|
-
I'm your
|
|
4782
|
+
I'm your BridgeNode Agent! I can access GPT-4, Grok, image generation, and more.
|
|
4783
4783
|
|
|
4784
4784
|
Please send $1-5 USDC on Base to start:
|
|
4785
4785
|
|
|
@@ -4970,12 +4970,12 @@ async function formatSolanaWalletMigrationNotice(newAddress) {
|
|
|
4970
4970
|
if (addresses.length === 0) return null;
|
|
4971
4971
|
const found = addresses.map((addr) => ` ${addr}`).join("\n");
|
|
4972
4972
|
return `
|
|
4973
|
-
NOTICE:
|
|
4973
|
+
NOTICE: BridgeNode created a new Solana wallet, but also found existing
|
|
4974
4974
|
wallet(s) belonging to other applications on this system:
|
|
4975
4975
|
|
|
4976
4976
|
${found}
|
|
4977
4977
|
|
|
4978
|
-
|
|
4978
|
+
BridgeNode now uses only its own wallet:
|
|
4979
4979
|
|
|
4980
4980
|
${newAddress}
|
|
4981
4981
|
|
|
@@ -4985,7 +4985,7 @@ do not control.
|
|
|
4985
4985
|
|
|
4986
4986
|
If an address above is yours and holds your USDC, adopt it deliberately:
|
|
4987
4987
|
|
|
4988
|
-
import { importSolanaWallet } from '@
|
|
4988
|
+
import { importSolanaWallet } from '@bridgenode/llm';
|
|
4989
4989
|
await importSolanaWallet("<address-from-the-list-above>");
|
|
4990
4990
|
|
|
4991
4991
|
Your current wallet is backed up first. You can also set
|
|
@@ -5258,7 +5258,7 @@ var SolanaLLMClient = class {
|
|
|
5258
5258
|
// 0x DEX (swap quotes + gasless) — free passthrough
|
|
5259
5259
|
// ============================================================
|
|
5260
5260
|
/**
|
|
5261
|
-
* Query the 0x Swap / Gasless APIs (free — no x402 payment;
|
|
5261
|
+
* Query the 0x Swap / Gasless APIs (free — no x402 payment; BridgeNode
|
|
5262
5262
|
* takes an on-chain affiliate fee on executed swaps instead).
|
|
5263
5263
|
*
|
|
5264
5264
|
* @param path - "price", "quote", "gasless/price", "gasless/quote",
|