@toon-protocol/client-mcp 0.10.9 → 0.11.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/dist/daemon.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  ClientRunner,
5
5
  registerRoutes,
6
6
  scaffoldFirstRun
7
- } from "./chunk-CS4B3GET.js";
7
+ } from "./chunk-KVK6OZVD.js";
8
8
  import {
9
9
  ControlClient,
10
10
  ToonClient,
@@ -17,7 +17,7 @@ import {
17
17
  resolveConfig,
18
18
  spawnDaemonDetached,
19
19
  waitForReady
20
- } from "./chunk-UHITXU5V.js";
20
+ } from "./chunk-CMGJ3NFT.js";
21
21
  import "./chunk-32QD72IL.js";
22
22
  import "./chunk-DLYE6U2Z.js";
23
23
  import "./chunk-LR7W2ISE.js";
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { NostrEvent, EventTemplate } from 'nostr-tools/pure';
2
2
  import { SwapPair } from '@toon-protocol/core';
3
- import { ToonClientConfig } from '@toon-protocol/client';
3
+ import { ToonClientConfig, FaucetChain } from '@toon-protocol/client';
4
4
  import { FastifyInstance } from 'fastify';
5
5
  import { ViewSpec } from '@toon-protocol/views';
6
6
 
@@ -453,16 +453,42 @@ interface FundWalletRequest {
453
453
  /** Address to fund (default: this client's own address for `chain`). */
454
454
  address?: string;
455
455
  }
456
- /** `POST /fund-wallet` result. */
456
+ /**
457
+ * `POST /fund-wallet` result — a snapshot of an ASYNC faucet drip job.
458
+ *
459
+ * The drip is non-blocking: `POST /fund-wallet` launches the faucet call in the
460
+ * daemon background and returns immediately with `status: 'pending'`. This avoids
461
+ * the MCP host's ~60s tool-call timeout surfacing a still-working Mina drip
462
+ * (which legitimately settles in ~75s, native MINA + USDC) as a misleading
463
+ * relay/apex timeout (#199-class). Poll `GET /fund-wallet/status` (or just
464
+ * re-read balances) to observe the terminal `'success'` / `'error'` state.
465
+ */
457
466
  interface FundWalletResponse {
458
- /** The chain that was funded. */
467
+ /** The chain being funded. */
459
468
  chain: SettlementChain;
460
- /** The address that was funded. */
469
+ /** The address being funded. */
461
470
  address: string;
462
471
  /** The faucet base URL the drip was requested from. */
463
472
  faucetUrl: string;
464
- /** Raw parsed JSON body from the faucet (shape is faucet-defined). */
465
- response: unknown;
473
+ /**
474
+ * Lifecycle of the background drip. `'timeout'` is distinct from `'error'`:
475
+ * the faucet client gave up but the on-chain drip MAY still have settled
476
+ * (observed on a loaded EVM faucet) — treat it as "uncertain, re-check
477
+ * balances", not a definitive failure, to avoid a misleading double-fund.
478
+ */
479
+ status: 'pending' | 'success' | 'error' | 'timeout';
480
+ /** Unix ms the drip was submitted. */
481
+ startedAt: number;
482
+ /** Unix ms the drip settled or failed (absent while `'pending'`). */
483
+ finishedAt?: number;
484
+ /** Raw parsed JSON body from the faucet on success (shape is faucet-defined). */
485
+ response?: unknown;
486
+ /** Error message on failure. */
487
+ error?: string;
488
+ }
489
+ /** `GET /fund-wallet/status` result — snapshots of tracked drip jobs. */
490
+ interface FundStatusResponse {
491
+ jobs: FundWalletResponse[];
466
492
  }
467
493
  /** Uniform error envelope returned with non-2xx responses. */
468
494
  interface ErrorResponse {
@@ -543,6 +569,7 @@ declare class ControlClient {
543
569
  addApex(body: AddApexRequest): Promise<AddApexResponse>;
544
570
  removeApex(body: RemoveApexRequest): Promise<TargetsResponse>;
545
571
  fundWallet(body?: FundWalletRequest): Promise<FundWalletResponse>;
572
+ fundStatus(chain?: SettlementChain): Promise<FundStatusResponse>;
546
573
  /**
547
574
  * Whether an HTTP method is safe to transparently retry. Idempotent reads
548
575
  * (GET) and deletes can be replayed verbatim; a mutating POST cannot — the
@@ -1028,11 +1055,29 @@ declare class ClientRunner {
1028
1055
  private readonly createRelay;
1029
1056
  private readonly log;
1030
1057
  private readonly targetsPath?;
1058
+ /**
1059
+ * Identity-level chain-read client. Reading your OWN on-chain wallet balance is
1060
+ * a pure (wallet keys + chain RPC) operation that has nothing to do with the
1061
+ * ILP/payment peer, so it lives at the daemon level rather than inside an apex.
1062
+ * Built once from the daemon's own `toonClientConfig` (the same keys + chain
1063
+ * RPC config every apex shares) and REUSED as the default apex's client, so a
1064
+ * funded apex's `start()` (which derives Solana/Mina keys) also benefits this
1065
+ * reader. `getBalances` uses it directly, so balances work even with zero
1066
+ * apexes registered (follow-up to #199/#200).
1067
+ */
1068
+ private readonly identityClient;
1031
1069
  private readonly startedAt;
1032
1070
  /** Apex write targets, keyed by btpUrl. */
1033
1071
  private readonly apexes;
1034
1072
  /** Relay read targets, keyed by relayUrl. */
1035
1073
  private readonly relays;
1074
+ /**
1075
+ * Async faucet drip jobs, keyed by chain. A drip is launched in the background
1076
+ * (the Mina faucet legitimately takes ~75s — longer than the MCP host's ~60s
1077
+ * tool-call budget) and its terminal state is observed via {@link getFundStatus}
1078
+ * / re-reading balances rather than by blocking the caller.
1079
+ */
1080
+ private readonly fundJobs;
1036
1081
  /** Runner-level merged read buffer across all relays (de-duped by event.id). */
1037
1082
  private merged;
1038
1083
  private readonly mergedSeen;
@@ -1145,7 +1190,13 @@ declare class ClientRunner {
1145
1190
  * (the typical "fund me before I open a channel" flow). The daemon holds the
1146
1191
  * faucet URL + the keys, so the MCP caller never needs either.
1147
1192
  */
1148
- fundWallet(req?: FundWalletRequest): Promise<FundWalletResponse>;
1193
+ fundWallet(req?: FundWalletRequest): FundWalletResponse;
1194
+ /**
1195
+ * Snapshots of tracked faucet drip jobs — all of them, or just the one for
1196
+ * `chain`. Lets a caller poll for the terminal state of an async drip without
1197
+ * re-dripping.
1198
+ */
1199
+ getFundStatus(chain?: FaucetChain): FundStatusResponse;
1149
1200
  /** Full registry of relay + apex targets with per-target status. */
1150
1201
  getTargets(): TargetsResponse;
1151
1202
  /** Pay-to-write a single event through the selected (or default) apex. */
@@ -1190,8 +1241,20 @@ declare class ClientRunner {
1190
1241
  getChannels(): ChannelsResponse;
1191
1242
  /**
1192
1243
  * On-chain wallet balances. The wallet is identity-level (same keys across
1193
- * apexes), so read from the first available apex's client; per-chain reads are
1194
- * best-effort inside the client (a failing chain is simply omitted).
1244
+ * apexes), so this reads from the daemon's {@link identityClient} NOT an apex
1245
+ * and therefore works even with zero apexes / no payment peer configured
1246
+ * (reading your own balance is a pure wallet-keys + chain-RPC operation).
1247
+ * Per-chain reads are best-effort inside the client (a failing chain is simply
1248
+ * omitted).
1249
+ *
1250
+ * Each underlying read hits per-chain RPC providers that can stall
1251
+ * indefinitely on devnet (a provider being `detail: "configured"` in
1252
+ * toon_status means it is WIRED, not that its RPC is live). A stall here used
1253
+ * to block the whole control request until the client aborted, surfacing as a
1254
+ * misleading "relay/apex unreachable" timeout (#199). Bound each attempt well
1255
+ * under the control-plane timeout and retry once so a single transient
1256
+ * provider stall FAST-FAILS with an honest "balances handler / provider
1257
+ * stalled" error instead of hanging.
1195
1258
  */
1196
1259
  getBalances(): Promise<BalancesResponse>;
1197
1260
  /**
@@ -1402,4 +1465,4 @@ interface JourneyResult {
1402
1465
  */
1403
1466
  declare function runJourney(plan: JourneyPlan, client: ControlClient): Promise<JourneyResult>;
1404
1467
 
1405
- export { type AddApexRequest, type AddApexResponse, type AddRelayRequest, type ApexNegotiationConfig, type ApexTargetStatus, type BalanceInfo, type BalancesResponse, type ChainStatus, type ChannelDepositRequest, type ChannelDepositResponse, type ChannelInfo, type ChannelsResponse, ClientRunner, type ClientRunnerDeps, type CloseChannelRequest, type CloseChannelResponse, ControlApiError, ControlClient, type ControlClientOptions, DEFAULT_KEYSTORE_PASSWORD, type DaemonConfigFile, DaemonUnreachableError, type DrainResult, type ErrorResponse, type EventsQuery, type EventsResponse, type FundWalletRequest, type FundWalletResponse, type HttpFetchPaidRequest, type HttpFetchPaidResponse, type JourneyPlan, type JourneyResult, type JourneyState, type JourneyStep, type JourneyStepResult, type MinimalWebSocket, type NostrFilter, NotReadyError, type OpenChannelRequest, PublishRejectedError, type PublishRequest, type PublishResponse, type PublishUnsignedRequest, type QueryRequest, type QueryResponse, RelaySubscription, type RelaySubscriptionOptions, type RelayTargetStatus, type RemoveApexRequest, type RemoveRelayRequest, type ResolvedDaemonConfig, type SettleChannelRequest, type SettleChannelResponse, type SettlementChain, type StatusResponse, type SubscribeRequest, type SubscribeResponse, type SwapClaim, type SwapRequest, type SwapResponse, TOOL_DEFINITIONS, type TargetsResponse, type ToolDefinition, type ToolResult, type ToonClientLike, type UploadMediaRequest, type UploadMediaResponse, type WebSocketFactory, acquireLock, configDir, defaultConfigPath, defaultKeystorePath, dispatchTool, hasConfiguredIdentity, isDaemonRunning, isProcessAlive, readConfigFile, readPid, registerRoutes, releaseLock, resolveConfig, resolveMnemonic, runJourney, scaffoldFirstRun, spawnDaemonDetached, waitForReady };
1468
+ export { type AddApexRequest, type AddApexResponse, type AddRelayRequest, type ApexNegotiationConfig, type ApexTargetStatus, type BalanceInfo, type BalancesResponse, type ChainStatus, type ChannelDepositRequest, type ChannelDepositResponse, type ChannelInfo, type ChannelsResponse, ClientRunner, type ClientRunnerDeps, type CloseChannelRequest, type CloseChannelResponse, ControlApiError, ControlClient, type ControlClientOptions, DEFAULT_KEYSTORE_PASSWORD, type DaemonConfigFile, DaemonUnreachableError, type DrainResult, type ErrorResponse, type EventsQuery, type EventsResponse, type FundStatusResponse, type FundWalletRequest, type FundWalletResponse, type HttpFetchPaidRequest, type HttpFetchPaidResponse, type JourneyPlan, type JourneyResult, type JourneyState, type JourneyStep, type JourneyStepResult, type MinimalWebSocket, type NostrFilter, NotReadyError, type OpenChannelRequest, PublishRejectedError, type PublishRequest, type PublishResponse, type PublishUnsignedRequest, type QueryRequest, type QueryResponse, RelaySubscription, type RelaySubscriptionOptions, type RelayTargetStatus, type RemoveApexRequest, type RemoveRelayRequest, type ResolvedDaemonConfig, type SettleChannelRequest, type SettleChannelResponse, type SettlementChain, type StatusResponse, type SubscribeRequest, type SubscribeResponse, type SwapClaim, type SwapRequest, type SwapResponse, TOOL_DEFINITIONS, type TargetsResponse, type ToolDefinition, type ToolResult, type ToonClientLike, type UploadMediaRequest, type UploadMediaResponse, type WebSocketFactory, acquireLock, configDir, defaultConfigPath, defaultKeystorePath, dispatchTool, hasConfiguredIdentity, isDaemonRunning, isProcessAlive, readConfigFile, readPid, registerRoutes, releaseLock, resolveConfig, resolveMnemonic, runJourney, scaffoldFirstRun, spawnDaemonDetached, waitForReady };
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  hasConfiguredIdentity,
9
9
  registerRoutes,
10
10
  scaffoldFirstRun
11
- } from "./chunk-CS4B3GET.js";
11
+ } from "./chunk-KVK6OZVD.js";
12
12
  import {
13
13
  PUBLISH_TOOL,
14
14
  TOOL_DEFINITIONS,
@@ -18,7 +18,7 @@ import {
18
18
  buildFollowListFilter,
19
19
  buildProfileFilter,
20
20
  dispatchTool
21
- } from "./chunk-X4GKWZQP.js";
21
+ } from "./chunk-JPQ4VCCF.js";
22
22
  import {
23
23
  ControlApiError,
24
24
  ControlClient,
@@ -36,7 +36,7 @@ import {
36
36
  resolveMnemonic,
37
37
  spawnDaemonDetached,
38
38
  waitForReady
39
- } from "./chunk-UHITXU5V.js";
39
+ } from "./chunk-CMGJ3NFT.js";
40
40
  import "./chunk-32QD72IL.js";
41
41
  import "./chunk-DLYE6U2Z.js";
42
42
  import "./chunk-LR7W2ISE.js";
package/dist/mcp.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  APP_RESOURCE_URI,
5
5
  TOOL_DEFINITIONS,
6
6
  dispatchTool
7
- } from "./chunk-X4GKWZQP.js";
7
+ } from "./chunk-JPQ4VCCF.js";
8
8
  import {
9
9
  ARWEAVE_GATEWAYS,
10
10
  ControlClient,
@@ -13,7 +13,7 @@ import {
13
13
  readConfigFile,
14
14
  spawnDaemonDetached,
15
15
  waitForReady
16
- } from "./chunk-UHITXU5V.js";
16
+ } from "./chunk-CMGJ3NFT.js";
17
17
  import "./chunk-32QD72IL.js";
18
18
  import "./chunk-DLYE6U2Z.js";
19
19
  import "./chunk-LR7W2ISE.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toon-protocol/client-mcp",
3
- "version": "0.10.9",
3
+ "version": "0.11.0",
4
4
  "description": "Always-on local daemon + MCP server letting a Claude agent (Desktop or Code) act as a TOON Protocol client: pay-to-write publishing, free reads, channel/balance management, and swaps.",
5
5
  "license": "MIT",
6
6
  "author": "Jonathan Green",
@@ -49,8 +49,8 @@
49
49
  "typescript": "^5.3.0",
50
50
  "vitest": "^1.0.0",
51
51
  "@toon-protocol/arweave": "0.1.1",
52
- "@toon-protocol/client": "0.14.9",
53
- "@toon-protocol/views": "0.10.9"
52
+ "@toon-protocol/client": "0.14.10",
53
+ "@toon-protocol/views": "0.11.0"
54
54
  },
55
55
  "engines": {
56
56
  "node": ">=20"