@toon-protocol/client-mcp 0.10.0 → 0.10.2

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-ZIJNTR5Y.js";
7
+ } from "./chunk-557ZV5RR.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-5Z74D23J.js";
20
+ } from "./chunk-BO5F3VT5.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
@@ -212,6 +212,10 @@ interface ChannelInfo {
212
212
  depositTotal?: string;
213
213
  /** Spendable balance = depositTotal − cumulativeAmount (clamped ≥ 0), decimal. */
214
214
  availableBalance?: string;
215
+ /** Where the channel sits in the withdraw journey. */
216
+ closeState?: 'open' | 'closing' | 'settleable' | 'settled';
217
+ /** Unix SECONDS the channel becomes settleable, when closing. */
218
+ settleableAt?: string;
215
219
  }
216
220
  /** `GET /channels` — list tracked channels with nonce watermarks. */
217
221
  interface ChannelsResponse {
@@ -248,6 +252,26 @@ interface ChannelDepositResponse {
248
252
  /** New on-chain deposit total after the deposit, base units, decimal. */
249
253
  depositTotal: string;
250
254
  }
255
+ /** `POST /channels/close` — begin the settlement grace period (withdraw, step 1). */
256
+ interface CloseChannelRequest {
257
+ channelId: string;
258
+ }
259
+ interface CloseChannelResponse {
260
+ channelId: string;
261
+ txHash?: string;
262
+ /** Unix SECONDS when close was initiated. */
263
+ closedAt: string;
264
+ /** Unix SECONDS the channel becomes settleable (closedAt + settlementTimeout). */
265
+ settleableAt: string;
266
+ }
267
+ /** `POST /channels/settle` — release collateral after the grace period (step 2). */
268
+ interface SettleChannelRequest {
269
+ channelId: string;
270
+ }
271
+ interface SettleChannelResponse {
272
+ channelId: string;
273
+ txHash?: string;
274
+ }
251
275
  /**
252
276
  * `POST /swap` — pay asset A to a swap peer, receive asset B + a signed
253
277
  * target-chain claim. The daemon builds the NIP-59 gift-wrapped kind:20032 swap
@@ -509,6 +533,8 @@ declare class ControlClient {
509
533
  channels(): Promise<ChannelsResponse>;
510
534
  balances(): Promise<BalancesResponse>;
511
535
  depositToChannel(body: ChannelDepositRequest): Promise<ChannelDepositResponse>;
536
+ closeChannel(body: CloseChannelRequest): Promise<CloseChannelResponse>;
537
+ settleChannel(body: SettleChannelRequest): Promise<SettleChannelResponse>;
512
538
  swap(body: SwapRequest): Promise<SwapResponse>;
513
539
  httpFetchPaid(body: HttpFetchPaidRequest): Promise<HttpFetchPaidResponse>;
514
540
  targets(): Promise<TargetsResponse>;
@@ -933,6 +959,18 @@ interface ToonClientLike {
933
959
  txHash?: string;
934
960
  depositTotal: string;
935
961
  }>;
962
+ closeChannel(channelId: string): Promise<{
963
+ channelId: string;
964
+ txHash?: string;
965
+ closedAt: string;
966
+ settleableAt: string;
967
+ }>;
968
+ settleChannel(channelId: string): Promise<{
969
+ channelId: string;
970
+ txHash?: string;
971
+ }>;
972
+ getChannelCloseState(channelId: string): 'open' | 'closing' | 'settleable' | 'settled';
973
+ getSettleableAt(channelId: string): bigint | undefined;
936
974
  sendSwapPacket(params: {
937
975
  destination: string;
938
976
  amount: bigint;
@@ -1154,6 +1192,16 @@ declare class ClientRunner {
1154
1192
  * the client signs its own on-chain tx.
1155
1193
  */
1156
1194
  depositToChannel(req: ChannelDepositRequest): Promise<ChannelDepositResponse>;
1195
+ /** Close a channel to begin the settlement grace period (withdraw, step 1). */
1196
+ closeChannel(req: CloseChannelRequest): Promise<CloseChannelResponse>;
1197
+ /**
1198
+ * Settle a closed channel to release collateral (withdraw, step 2). The client
1199
+ * enforces the `now >= settleableAt` guard and throws a retryable error if
1200
+ * called early; `mapError` maps that to HTTP 425.
1201
+ */
1202
+ settleChannel(req: SettleChannelRequest): Promise<SettleChannelResponse>;
1203
+ /** Run `fn` against the apex client that tracks `channelId`, else throw. */
1204
+ private withTrackingApex;
1157
1205
  /** Swap source→target asset against a swap peer via the selected apex. */
1158
1206
  swap(req: SwapRequest): Promise<SwapResponse>;
1159
1207
  /**
@@ -1346,4 +1394,4 @@ interface JourneyResult {
1346
1394
  */
1347
1395
  declare function runJourney(plan: JourneyPlan, client: ControlClient): Promise<JourneyResult>;
1348
1396
 
1349
- 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, 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 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 };
1397
+ 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 };
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  hasConfiguredIdentity,
9
9
  registerRoutes,
10
10
  scaffoldFirstRun
11
- } from "./chunk-ZIJNTR5Y.js";
11
+ } from "./chunk-557ZV5RR.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-KWQKOCE4.js";
21
+ } from "./chunk-3K5LWGQL.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-5Z74D23J.js";
39
+ } from "./chunk-BO5F3VT5.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-KWQKOCE4.js";
7
+ } from "./chunk-3K5LWGQL.js";
8
8
  import {
9
9
  ControlClient,
10
10
  defaultConfigPath,
@@ -12,7 +12,7 @@ import {
12
12
  readConfigFile,
13
13
  spawnDaemonDetached,
14
14
  waitForReady
15
- } from "./chunk-5Z74D23J.js";
15
+ } from "./chunk-BO5F3VT5.js";
16
16
  import "./chunk-32QD72IL.js";
17
17
  import "./chunk-DLYE6U2Z.js";
18
18
  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.0",
3
+ "version": "0.10.2",
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.7",
53
- "@toon-protocol/views": "0.10.0"
52
+ "@toon-protocol/client": "0.14.8",
53
+ "@toon-protocol/views": "0.10.2"
54
54
  },
55
55
  "engines": {
56
56
  "node": ">=20"