ton-mesh-harness 0.13.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.
Files changed (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +444 -0
  3. package/dist/cli.js +38739 -0
  4. package/dist/daemon/installer-utils.d.ts +103 -0
  5. package/dist/daemon/installer.d.ts +30 -0
  6. package/dist/daemon/linger.d.ts +10 -0
  7. package/dist/daemon/platform.d.ts +47 -0
  8. package/dist/daemon/ports.d.ts +14 -0
  9. package/dist/daemon/rldp-http-proxy-installer.d.ts +10 -0
  10. package/dist/daemon/service.d.ts +36 -0
  11. package/dist/daemon/tonutils-installer.d.ts +10 -0
  12. package/dist/daemon/tonutils-process.d.ts +90 -0
  13. package/dist/deeplink.d.ts +25 -0
  14. package/dist/dns.d.ts +39 -0
  15. package/dist/mcp.js +38097 -0
  16. package/dist/network.d.ts +5 -0
  17. package/dist/sdk/abort.d.ts +25 -0
  18. package/dist/sdk/agentic-config.d.ts +199 -0
  19. package/dist/sdk/agentic-sign.d.ts +48 -0
  20. package/dist/sdk/check.d.ts +24 -0
  21. package/dist/sdk/deploy.d.ts +96 -0
  22. package/dist/sdk/dns-helpers.d.ts +158 -0
  23. package/dist/sdk/dns-onchain.d.ts +39 -0
  24. package/dist/sdk/dns.d.ts +125 -0
  25. package/dist/sdk/endpoints.d.ts +58 -0
  26. package/dist/sdk/json-schemas.d.ts +38 -0
  27. package/dist/sdk/log.d.ts +43 -0
  28. package/dist/sdk/provenance.d.ts +87 -0
  29. package/dist/sdk/resolve-tx.d.ts +70 -0
  30. package/dist/sdk/schemas.d.ts +885 -0
  31. package/dist/sdk/site-record.d.ts +25 -0
  32. package/dist/sdk/status.d.ts +23 -0
  33. package/dist/sdk/walletkit-network.d.ts +30 -0
  34. package/dist/sdk.d.ts +46 -0
  35. package/dist/sdk.js +37789 -0
  36. package/dist/utils/http.d.ts +25 -0
  37. package/dist/utils/tunnel-config.d.ts +20 -0
  38. package/dist/version.d.ts +13 -0
  39. package/dist/wallet/FSStorage.d.ts +12 -0
  40. package/dist/wallet/SendProvider.d.ts +17 -0
  41. package/dist/wallet/Storage.d.ts +5 -0
  42. package/dist/wallet/TonConnectProvider.d.ts +48 -0
  43. package/dist/wallet/constants.d.ts +12 -0
  44. package/dist/wallet/ui.d.ts +13 -0
  45. package/package.json +105 -0
  46. package/skills/mesh-deploy.md +283 -0
  47. package/templates/.well-known/mcp.json +44 -0
  48. package/templates/github-workflow-agentic.yml +94 -0
  49. package/templates/github-workflow.yml +76 -0
@@ -0,0 +1,885 @@
1
+ /**
2
+ * Single zod source of truth for ton-mesh-harness-mcp inputs / outputs / events.
3
+ *
4
+ * Generated JSON Schemas drive both:
5
+ * - the MCP server tools/list response (`@modelcontextprotocol/sdk`)
6
+ * - the SDK's TypeScript types (`z.infer<typeof DeployOptionsSchema>`)
7
+ *
8
+ * Spec: docs/v0.8/mcp-core-requirements.md §F2 / §F3 / §F5 / §NF6
9
+ * Verdict context: docs/archive/v0.8/at-mcp-probe.md (P-1 probe, dual-path WalletSpec)
10
+ *
11
+ * NO `console.*` ANYWHERE IN THIS FILE OR src/sdk/* — lint-enforced (planned [S4]).
12
+ */
13
+ import { z } from 'zod';
14
+ export declare const WalletSpecSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
15
+ kind: z.ZodLiteral<"tonconnect">;
16
+ /** Substring match against TonConnect manifest names. Default: "Tonkeeper". */
17
+ connector: z.ZodDefault<z.ZodString>;
18
+ }, "strict", z.ZodTypeAny, {
19
+ kind: "tonconnect";
20
+ connector: string;
21
+ }, {
22
+ kind: "tonconnect";
23
+ connector?: string | undefined;
24
+ }>, z.ZodObject<{
25
+ kind: z.ZodLiteral<"agentic">;
26
+ /**
27
+ * Override path to the agentic-wallet config file.
28
+ * Default: `$TON_CONFIG_PATH` if set, else `~/.config/ton/config.json`.
29
+ * The kit reads this file directly with its own loader (the original
30
+ * P-1 memo's "via @ton/walletkit's loader" claim was wrong — the kit
31
+ * defines the schema; @ton/walletkit's `Signer` is then used to sign).
32
+ */
33
+ config_path: z.ZodOptional<z.ZodString>;
34
+ /**
35
+ * Selects from agentic wallet list when multiple are configured.
36
+ * Default: the active wallet, which is the convention `@ton/mcp`
37
+ * writes via `set_active_wallet`. Verify exact field at week-5
38
+ * implementation start by inspecting an actual config.json.
39
+ */
40
+ wallet_label: z.ZodOptional<z.ZodString>;
41
+ }, "strict", z.ZodTypeAny, {
42
+ kind: "agentic";
43
+ config_path?: string | undefined;
44
+ wallet_label?: string | undefined;
45
+ }, {
46
+ kind: "agentic";
47
+ config_path?: string | undefined;
48
+ wallet_label?: string | undefined;
49
+ }>]>;
50
+ export type WalletSpec = z.infer<typeof WalletSpecSchema>;
51
+ /**
52
+ * Backwards-compat helper: legacy callers (CLI today) pass a bare string
53
+ * meaning "TonConnect connector substring". Lift it into a `WalletSpec`.
54
+ *
55
+ * Used at the SDK boundary in [S2] / runDeploy() so the MCP JSON schema
56
+ * stays clean (no `string | WalletSpec` union exposed via the contract).
57
+ */
58
+ export declare function parseWalletInput(input: string | WalletSpec | undefined): WalletSpec;
59
+ export declare const DeployOptionsSchema: z.ZodObject<{
60
+ /** Absolute or relative path to the build directory. */
61
+ source_dir: z.ZodString;
62
+ /** Optional `.ton` domain to write storage / site DNS records for. */
63
+ domain: z.ZodDefault<z.ZodNullable<z.ZodString>>;
64
+ /** Bag description; defaults to source_dir basename if null. */
65
+ description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
66
+ /**
67
+ * Wallet selection (Path 1 = TonConnect human-signed / Path 2 = agentic autonomous).
68
+ * MCP callers MUST pass the structured object; legacy CLI callers pass a
69
+ * bare string and are lifted via `parseWalletInput()` in the SDK boundary.
70
+ */
71
+ wallet: z.ZodDefault<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
72
+ kind: z.ZodLiteral<"tonconnect">;
73
+ /** Substring match against TonConnect manifest names. Default: "Tonkeeper". */
74
+ connector: z.ZodDefault<z.ZodString>;
75
+ }, "strict", z.ZodTypeAny, {
76
+ kind: "tonconnect";
77
+ connector: string;
78
+ }, {
79
+ kind: "tonconnect";
80
+ connector?: string | undefined;
81
+ }>, z.ZodObject<{
82
+ kind: z.ZodLiteral<"agentic">;
83
+ /**
84
+ * Override path to the agentic-wallet config file.
85
+ * Default: `$TON_CONFIG_PATH` if set, else `~/.config/ton/config.json`.
86
+ * The kit reads this file directly with its own loader (the original
87
+ * P-1 memo's "via @ton/walletkit's loader" claim was wrong — the kit
88
+ * defines the schema; @ton/walletkit's `Signer` is then used to sign).
89
+ */
90
+ config_path: z.ZodOptional<z.ZodString>;
91
+ /**
92
+ * Selects from agentic wallet list when multiple are configured.
93
+ * Default: the active wallet, which is the convention `@ton/mcp`
94
+ * writes via `set_active_wallet`. Verify exact field at week-5
95
+ * implementation start by inspecting an actual config.json.
96
+ */
97
+ wallet_label: z.ZodOptional<z.ZodString>;
98
+ }, "strict", z.ZodTypeAny, {
99
+ kind: "agentic";
100
+ config_path?: string | undefined;
101
+ wallet_label?: string | undefined;
102
+ }, {
103
+ kind: "agentic";
104
+ config_path?: string | undefined;
105
+ wallet_label?: string | undefined;
106
+ }>]>>;
107
+ /**
108
+ * Use TON testnet instead of mainnet. Supported on the tonutils backend
109
+ * since v0.9: the daemon is started with the testnet `--network-config`
110
+ * and the DNS write uses testnet endpoints. Requires testnet TON in the
111
+ * signing wallet and a testnet `.ton` domain. Bag propagation depends on
112
+ * testnet ADNL/storage liveness (self-host via the deployer's own daemon).
113
+ */
114
+ testnet: z.ZodDefault<z.ZodBoolean>;
115
+ /** Path to ADNL Tunnel client config (nodes-pool.json). */
116
+ tunnel_config: z.ZodDefault<z.ZodNullable<z.ZodString>>;
117
+ /**
118
+ * Cloud-seeder announce knobs (#69). For running the kit AS a
119
+ * publicly-reachable seeder on a VM: `announce_ip` is the public IPv4 to
120
+ * advertise to the DHT (tonutils config `ExternalIP`); `announce_port` pins
121
+ * the UDP `ListenAddr` port so a firewall rule can be pre-opened. Both
122
+ * override the `MESH_ANNOUNCE_IP` / `MESH_ANNOUNCE_PORT` env vars.
123
+ * IPv4 only — the daemon binds 0.0.0.0 (IPv4); an IPv6 announce would
124
+ * advertise an address it can't serve.
125
+ */
126
+ announce_ip: z.ZodDefault<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
127
+ announce_port: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
128
+ /**
129
+ * If true, the daemon survives the call; the MCP server tracks the spawned
130
+ * daemon and kills it on its own shutdown. If false, the daemon is killed
131
+ * before the call returns (one-shot semantics).
132
+ */
133
+ keep_alive: z.ZodDefault<z.ZodBoolean>;
134
+ /**
135
+ * Daemon ownership (#37):
136
+ * - `embedded` (default): daemon killed before the call returns.
137
+ * - `detached`: daemon survives; the CALLER owns its lifecycle (the
138
+ * legacy `keep_alive: true` behaviour — a bare `keep_alive: true`
139
+ * with the default mode is normalized to `detached`). Rejected by
140
+ * the MCP server (it can't own a long-lived daemon).
141
+ * - `service`: hand the daemon to the OS service manager (launchd /
142
+ * systemd --user) seeding a persistent db under
143
+ * ~/.ton-mesh/seeds/<bag_id>/. The CLI/MCP return cleanly; manage
144
+ * via `ton-mesh-harness service list|stop`. Not on Windows yet.
145
+ */
146
+ daemon_mode: z.ZodDefault<z.ZodEnum<["embedded", "detached", "service"]>>;
147
+ /**
148
+ * Emit a provenance manifest into `<source_dir>/.well-known/ton-deploy.json`
149
+ * before bag creation (so the bag includes it). On the agentic path it is
150
+ * signed with the operator/standard key; on TonConnect it is unsigned
151
+ * (the wallet can't sign arbitrary bytes). Only emitted when `domain` is
152
+ * set. Best-effort: any failure is logged and skipped, never fatal.
153
+ * Pass false to opt out (CLI `--no-provenance`).
154
+ */
155
+ provenance: z.ZodDefault<z.ZodBoolean>;
156
+ }, "strict", z.ZodTypeAny, {
157
+ source_dir: string;
158
+ domain: string | null;
159
+ description: string | null;
160
+ wallet: {
161
+ kind: "tonconnect";
162
+ connector: string;
163
+ } | {
164
+ kind: "agentic";
165
+ config_path?: string | undefined;
166
+ wallet_label?: string | undefined;
167
+ };
168
+ testnet: boolean;
169
+ tunnel_config: string | null;
170
+ announce_ip: string | null;
171
+ announce_port: number | null;
172
+ keep_alive: boolean;
173
+ daemon_mode: "embedded" | "detached" | "service";
174
+ provenance: boolean;
175
+ }, {
176
+ source_dir: string;
177
+ domain?: string | null | undefined;
178
+ description?: string | null | undefined;
179
+ wallet?: {
180
+ kind: "tonconnect";
181
+ connector?: string | undefined;
182
+ } | {
183
+ kind: "agentic";
184
+ config_path?: string | undefined;
185
+ wallet_label?: string | undefined;
186
+ } | undefined;
187
+ testnet?: boolean | undefined;
188
+ tunnel_config?: string | null | undefined;
189
+ announce_ip?: string | null | undefined;
190
+ announce_port?: number | null | undefined;
191
+ keep_alive?: boolean | undefined;
192
+ daemon_mode?: "embedded" | "detached" | "service" | undefined;
193
+ provenance?: boolean | undefined;
194
+ }>;
195
+ export type DeployOptions = z.infer<typeof DeployOptionsSchema>;
196
+ export declare const NextActionSchema: z.ZodObject<{
197
+ description: z.ZodString;
198
+ }, "strict", z.ZodTypeAny, {
199
+ description: string;
200
+ }, {
201
+ description: string;
202
+ }>;
203
+ export declare const DeployResultSchema: z.ZodObject<{
204
+ bag_id: z.ZodString;
205
+ bag_size_bytes: z.ZodNumber;
206
+ /**
207
+ * Real on-chain tx hash of the `change_dns_record` write. Null when
208
+ * `domain` was null on input (no DNS write), AND — best-effort — when
209
+ * Toncenter's tx index lagged the TONAPI DNS poll past the grace window
210
+ * (#117): a null hash on an otherwise-successful deploy still means the
211
+ * write landed (verify via TONAPI `resolve` storage==bag_id). The
212
+ * submitted-tx pointer is surfaced in `next_actions` in that case.
213
+ */
214
+ dns_tx_hash: z.ZodNullable<z.ZodString>;
215
+ /**
216
+ * The tonutils-storage daemon's local HTTP API base (e.g.
217
+ * `http://127.0.0.1:7100`). Renamed from `dashboard_url` in [S3] review
218
+ * — the daemon does not serve a dashboard HTML page; it exposes a JSON
219
+ * API. The kit's actual dashboard is a separate static file the CLI
220
+ * may open in a browser. `null` when `seed_status: "stopped"` (embedded
221
+ * mode kills the daemon before `done`), since the URL would point at a
222
+ * dead endpoint — mirrors `daemon_pid`. (#134)
223
+ */
224
+ daemon_api_url: z.ZodNullable<z.ZodString>;
225
+ /** Non-null only for `daemon_mode: "detached"` (the caller owns the pid). */
226
+ daemon_pid: z.ZodNullable<z.ZodNumber>;
227
+ seed_status: z.ZodEnum<["seeding", "stopped"]>;
228
+ /**
229
+ * OS service label when `daemon_mode: "service"` handed the daemon to
230
+ * launchd / systemd (e.g. `ton-mesh.<bag_id>`); null otherwise.
231
+ * Manage via `ton-mesh-harness service list | stop`.
232
+ */
233
+ daemon_service: z.ZodDefault<z.ZodNullable<z.ZodString>>;
234
+ next_actions: z.ZodDefault<z.ZodArray<z.ZodObject<{
235
+ description: z.ZodString;
236
+ }, "strict", z.ZodTypeAny, {
237
+ description: string;
238
+ }, {
239
+ description: string;
240
+ }>, "many">>;
241
+ }, "strict", z.ZodTypeAny, {
242
+ bag_id: string;
243
+ bag_size_bytes: number;
244
+ dns_tx_hash: string | null;
245
+ daemon_api_url: string | null;
246
+ daemon_pid: number | null;
247
+ seed_status: "seeding" | "stopped";
248
+ daemon_service: string | null;
249
+ next_actions: {
250
+ description: string;
251
+ }[];
252
+ }, {
253
+ bag_id: string;
254
+ bag_size_bytes: number;
255
+ dns_tx_hash: string | null;
256
+ daemon_api_url: string | null;
257
+ daemon_pid: number | null;
258
+ seed_status: "seeding" | "stopped";
259
+ daemon_service?: string | null | undefined;
260
+ next_actions?: {
261
+ description: string;
262
+ }[] | undefined;
263
+ }>;
264
+ export type DeployResult = z.infer<typeof DeployResultSchema>;
265
+ export declare const CheckEnvOptionsSchema: z.ZodObject<{
266
+ source_dir: z.ZodDefault<z.ZodNullable<z.ZodString>>;
267
+ }, "strict", z.ZodTypeAny, {
268
+ source_dir: string | null;
269
+ }, {
270
+ source_dir?: string | null | undefined;
271
+ }>;
272
+ export type CheckEnvOptions = z.infer<typeof CheckEnvOptionsSchema>;
273
+ export declare const CheckEnvResultSchema: z.ZodEffects<z.ZodObject<{
274
+ ready: z.ZodBoolean;
275
+ node_version: z.ZodString;
276
+ disk_free_mb: z.ZodNumber;
277
+ udp_port_17555_free: z.ZodBoolean;
278
+ /**
279
+ * `"tonconnect"` if the kit's TonConnect connector code is reachable
280
+ * (no session check). `"agentic"` if `~/.config/ton/config.json`
281
+ * (or `$TON_CONFIG_PATH`) exists AND has at least one wallet entry the
282
+ * SDK's loader can read. Possible values: `[]`, `["tonconnect"]`,
283
+ * `["agentic"]`, `["tonconnect","agentic"]`. Each value appears at most once.
284
+ */
285
+ wallet_signers_available: z.ZodEffects<z.ZodArray<z.ZodEnum<["tonconnect", "agentic"]>, "many">, ("tonconnect" | "agentic")[], ("tonconnect" | "agentic")[]>;
286
+ daemon_backend_installed: z.ZodObject<{
287
+ tonutils: z.ZodBoolean;
288
+ ton_core: z.ZodBoolean;
289
+ }, "strict", z.ZodTypeAny, {
290
+ tonutils: boolean;
291
+ ton_core: boolean;
292
+ }, {
293
+ tonutils: boolean;
294
+ ton_core: boolean;
295
+ }>;
296
+ network_reachable: z.ZodBoolean;
297
+ /** Null when `source_dir` was null on input. */
298
+ source_dir_valid: z.ZodNullable<z.ZodBoolean>;
299
+ blocking: z.ZodArray<z.ZodObject<{
300
+ code: z.ZodString;
301
+ message: z.ZodString;
302
+ fix_hint: z.ZodString;
303
+ }, "strict", z.ZodTypeAny, {
304
+ code: string;
305
+ message: string;
306
+ fix_hint: string;
307
+ }, {
308
+ code: string;
309
+ message: string;
310
+ fix_hint: string;
311
+ }>, "many">;
312
+ warnings: z.ZodArray<z.ZodObject<{
313
+ code: z.ZodString;
314
+ message: z.ZodString;
315
+ }, "strict", z.ZodTypeAny, {
316
+ code: string;
317
+ message: string;
318
+ }, {
319
+ code: string;
320
+ message: string;
321
+ }>, "many">;
322
+ }, "strict", z.ZodTypeAny, {
323
+ ready: boolean;
324
+ node_version: string;
325
+ disk_free_mb: number;
326
+ udp_port_17555_free: boolean;
327
+ wallet_signers_available: ("tonconnect" | "agentic")[];
328
+ daemon_backend_installed: {
329
+ tonutils: boolean;
330
+ ton_core: boolean;
331
+ };
332
+ network_reachable: boolean;
333
+ source_dir_valid: boolean | null;
334
+ blocking: {
335
+ code: string;
336
+ message: string;
337
+ fix_hint: string;
338
+ }[];
339
+ warnings: {
340
+ code: string;
341
+ message: string;
342
+ }[];
343
+ }, {
344
+ ready: boolean;
345
+ node_version: string;
346
+ disk_free_mb: number;
347
+ udp_port_17555_free: boolean;
348
+ wallet_signers_available: ("tonconnect" | "agentic")[];
349
+ daemon_backend_installed: {
350
+ tonutils: boolean;
351
+ ton_core: boolean;
352
+ };
353
+ network_reachable: boolean;
354
+ source_dir_valid: boolean | null;
355
+ blocking: {
356
+ code: string;
357
+ message: string;
358
+ fix_hint: string;
359
+ }[];
360
+ warnings: {
361
+ code: string;
362
+ message: string;
363
+ }[];
364
+ }>, {
365
+ ready: boolean;
366
+ node_version: string;
367
+ disk_free_mb: number;
368
+ udp_port_17555_free: boolean;
369
+ wallet_signers_available: ("tonconnect" | "agentic")[];
370
+ daemon_backend_installed: {
371
+ tonutils: boolean;
372
+ ton_core: boolean;
373
+ };
374
+ network_reachable: boolean;
375
+ source_dir_valid: boolean | null;
376
+ blocking: {
377
+ code: string;
378
+ message: string;
379
+ fix_hint: string;
380
+ }[];
381
+ warnings: {
382
+ code: string;
383
+ message: string;
384
+ }[];
385
+ }, {
386
+ ready: boolean;
387
+ node_version: string;
388
+ disk_free_mb: number;
389
+ udp_port_17555_free: boolean;
390
+ wallet_signers_available: ("tonconnect" | "agentic")[];
391
+ daemon_backend_installed: {
392
+ tonutils: boolean;
393
+ ton_core: boolean;
394
+ };
395
+ network_reachable: boolean;
396
+ source_dir_valid: boolean | null;
397
+ blocking: {
398
+ code: string;
399
+ message: string;
400
+ fix_hint: string;
401
+ }[];
402
+ warnings: {
403
+ code: string;
404
+ message: string;
405
+ }[];
406
+ }>;
407
+ export type CheckEnvResult = z.infer<typeof CheckEnvResultSchema>;
408
+ export declare const StatusOptionsSchema: z.ZodObject<{
409
+ bag_id: z.ZodString;
410
+ /** Optional `.ton` domain to also check (resolves NFT + reads storage record). */
411
+ domain: z.ZodDefault<z.ZodNullable<z.ZodString>>;
412
+ testnet: z.ZodDefault<z.ZodBoolean>;
413
+ }, "strict", z.ZodTypeAny, {
414
+ domain: string | null;
415
+ testnet: boolean;
416
+ bag_id: string;
417
+ }, {
418
+ bag_id: string;
419
+ domain?: string | null | undefined;
420
+ testnet?: boolean | undefined;
421
+ }>;
422
+ export type StatusOptions = z.infer<typeof StatusOptionsSchema>;
423
+ export declare const StatusResultSchema: z.ZodObject<{
424
+ bag_id: z.ZodString;
425
+ /** TONAPI reports the bag is visible / not "not_found". */
426
+ bag_accessible: z.ZodBoolean;
427
+ /** Bag size in bytes if TONAPI returned it; null when accessible=false. */
428
+ bag_size_bytes: z.ZodNullable<z.ZodNumber>;
429
+ /** File count if TONAPI returned it; null when accessible=false. */
430
+ bag_file_count: z.ZodNullable<z.ZodNumber>;
431
+ /**
432
+ * When `bag_accessible: false`, why. `not_found` = TONAPI returned
433
+ * status=not_found (genuine "not propagated"). `network_error` =
434
+ * TONAPI was unreachable or returned 5xx for both attempts. Lets
435
+ * callers distinguish "the bag isn't on the network yet" from
436
+ * "TONAPI itself is down / endpoint drifted." `null` when accessible.
437
+ */
438
+ bag_unavailable_reason: z.ZodNullable<z.ZodEnum<["not_found", "network_error"]>>;
439
+ /** Present iff `domain` was passed. */
440
+ domain: z.ZodNullable<z.ZodObject<{
441
+ name: z.ZodString;
442
+ nft_address: z.ZodNullable<z.ZodString>;
443
+ /** Bag id currently pointed to by the `storage` DNS record (lowercase hex). */
444
+ resolved_bag_id: z.ZodNullable<z.ZodString>;
445
+ /** `resolved_bag_id === bag_id` (lowercased compare). */
446
+ matches: z.ZodBoolean;
447
+ }, "strict", z.ZodTypeAny, {
448
+ name: string;
449
+ nft_address: string | null;
450
+ resolved_bag_id: string | null;
451
+ matches: boolean;
452
+ }, {
453
+ name: string;
454
+ nft_address: string | null;
455
+ resolved_bag_id: string | null;
456
+ matches: boolean;
457
+ }>>;
458
+ }, "strict", z.ZodTypeAny, {
459
+ domain: {
460
+ name: string;
461
+ nft_address: string | null;
462
+ resolved_bag_id: string | null;
463
+ matches: boolean;
464
+ } | null;
465
+ bag_id: string;
466
+ bag_size_bytes: number | null;
467
+ bag_accessible: boolean;
468
+ bag_file_count: number | null;
469
+ bag_unavailable_reason: "not_found" | "network_error" | null;
470
+ }, {
471
+ domain: {
472
+ name: string;
473
+ nft_address: string | null;
474
+ resolved_bag_id: string | null;
475
+ matches: boolean;
476
+ } | null;
477
+ bag_id: string;
478
+ bag_size_bytes: number | null;
479
+ bag_accessible: boolean;
480
+ bag_file_count: number | null;
481
+ bag_unavailable_reason: "not_found" | "network_error" | null;
482
+ }>;
483
+ export type StatusResult = z.infer<typeof StatusResultSchema>;
484
+ export declare const SiteRecordOptionsSchema: z.ZodObject<{
485
+ /** `.ton` domain whose NFT will receive the site record. */
486
+ domain: z.ZodString;
487
+ /**
488
+ * 64-hex ADNL identity (256-bit) of the rldp-http-proxy. Accepts an
489
+ * optional `0x` prefix; canonicalized to lowercase, no prefix.
490
+ */
491
+ site_adnl: z.ZodEffects<z.ZodString, string, string>;
492
+ testnet: z.ZodDefault<z.ZodBoolean>;
493
+ }, "strict", z.ZodTypeAny, {
494
+ domain: string;
495
+ testnet: boolean;
496
+ site_adnl: string;
497
+ }, {
498
+ domain: string;
499
+ site_adnl: string;
500
+ testnet?: boolean | undefined;
501
+ }>;
502
+ export type SiteRecordOptions = z.infer<typeof SiteRecordOptionsSchema>;
503
+ export declare const SiteRecordResultSchema: z.ZodObject<{
504
+ /** Normalized `<name>.ton`. */
505
+ domain: z.ZodString;
506
+ /** The domain NFT item address the transaction targets. */
507
+ nft_address: z.ZodString;
508
+ /** Always `site` — this tool never touches the storage record. */
509
+ record: z.ZodLiteral<"site">;
510
+ /** Canonical (lowercase, no prefix) ADNL hex written into the record. */
511
+ site_adnl: z.ZodString;
512
+ /** Gas attached to the message, in nanoTON (string — bigint isn't JSON-safe). */
513
+ amount_nano: z.ZodString;
514
+ /** The `change_dns_record` message body, BOC-serialized + base64url. */
515
+ body_boc_base64url: z.ZodString;
516
+ /** Tonkeeper transfer deeplink that signs the site record in one tap. */
517
+ tonkeeper_deeplink: z.ZodString;
518
+ }, "strict", z.ZodTypeAny, {
519
+ domain: string;
520
+ nft_address: string;
521
+ site_adnl: string;
522
+ record: "site";
523
+ amount_nano: string;
524
+ body_boc_base64url: string;
525
+ tonkeeper_deeplink: string;
526
+ }, {
527
+ domain: string;
528
+ nft_address: string;
529
+ site_adnl: string;
530
+ record: "site";
531
+ amount_nano: string;
532
+ body_boc_base64url: string;
533
+ tonkeeper_deeplink: string;
534
+ }>;
535
+ export type SiteRecordResult = z.infer<typeof SiteRecordResultSchema>;
536
+ declare const PhaseSchema: z.ZodEnum<["env_check", "bag_creating", "daemon_starting", "bag_uploaded", "awaiting_signature", "dns_signing", "dns_confirmed", "verifying", "done"]>;
537
+ export type DeployPhase = z.infer<typeof PhaseSchema>;
538
+ /**
539
+ * Discriminated union on `phase`. Specialised data shapes for
540
+ * `awaiting_signature` (signing mode handoff) and `done` (DeployResult);
541
+ * all intermediate phases carry a free-form `data` record (file-level
542
+ * granularity, daemon ports, etc.).
543
+ *
544
+ * Using a discriminated union (rather than `z.union`) is load-bearing:
545
+ * a `z.union` with a free-form fallback variant would silently accept
546
+ * malformed `awaiting_signature` events.
547
+ */
548
+ export declare const DeployEventSchema: z.ZodDiscriminatedUnion<"phase", [z.ZodObject<{
549
+ data: z.ZodDiscriminatedUnion<"signing_mode", [z.ZodObject<{
550
+ signing_mode: z.ZodLiteral<"tonconnect">;
551
+ signing_url: z.ZodString;
552
+ expires_at_iso: z.ZodString;
553
+ }, "strict", z.ZodTypeAny, {
554
+ signing_mode: "tonconnect";
555
+ signing_url: string;
556
+ expires_at_iso: string;
557
+ }, {
558
+ signing_mode: "tonconnect";
559
+ signing_url: string;
560
+ expires_at_iso: string;
561
+ }>, z.ZodObject<{
562
+ signing_mode: z.ZodLiteral<"agentic">;
563
+ signing_url: z.ZodNull;
564
+ /**
565
+ * Wallet label that will sign autonomously, for the agent's logs.
566
+ * Optional — if the active wallet has no explicit label, this is null.
567
+ */
568
+ wallet_label: z.ZodDefault<z.ZodNullable<z.ZodString>>;
569
+ }, "strict", z.ZodTypeAny, {
570
+ wallet_label: string | null;
571
+ signing_mode: "agentic";
572
+ signing_url: null;
573
+ }, {
574
+ signing_mode: "agentic";
575
+ signing_url: null;
576
+ wallet_label?: string | null | undefined;
577
+ }>]>;
578
+ message: z.ZodString;
579
+ percent: z.ZodOptional<z.ZodNumber>;
580
+ phase: z.ZodLiteral<"awaiting_signature">;
581
+ }, "strict", z.ZodTypeAny, {
582
+ message: string;
583
+ phase: "awaiting_signature";
584
+ data: {
585
+ signing_mode: "tonconnect";
586
+ signing_url: string;
587
+ expires_at_iso: string;
588
+ } | {
589
+ wallet_label: string | null;
590
+ signing_mode: "agentic";
591
+ signing_url: null;
592
+ };
593
+ percent?: number | undefined;
594
+ }, {
595
+ message: string;
596
+ phase: "awaiting_signature";
597
+ data: {
598
+ signing_mode: "tonconnect";
599
+ signing_url: string;
600
+ expires_at_iso: string;
601
+ } | {
602
+ signing_mode: "agentic";
603
+ signing_url: null;
604
+ wallet_label?: string | null | undefined;
605
+ };
606
+ percent?: number | undefined;
607
+ }>, z.ZodObject<{
608
+ data: z.ZodObject<{
609
+ bag_id: z.ZodString;
610
+ bag_size_bytes: z.ZodNumber;
611
+ /**
612
+ * Real on-chain tx hash of the `change_dns_record` write. Null when
613
+ * `domain` was null on input (no DNS write), AND — best-effort — when
614
+ * Toncenter's tx index lagged the TONAPI DNS poll past the grace window
615
+ * (#117): a null hash on an otherwise-successful deploy still means the
616
+ * write landed (verify via TONAPI `resolve` storage==bag_id). The
617
+ * submitted-tx pointer is surfaced in `next_actions` in that case.
618
+ */
619
+ dns_tx_hash: z.ZodNullable<z.ZodString>;
620
+ /**
621
+ * The tonutils-storage daemon's local HTTP API base (e.g.
622
+ * `http://127.0.0.1:7100`). Renamed from `dashboard_url` in [S3] review
623
+ * — the daemon does not serve a dashboard HTML page; it exposes a JSON
624
+ * API. The kit's actual dashboard is a separate static file the CLI
625
+ * may open in a browser. `null` when `seed_status: "stopped"` (embedded
626
+ * mode kills the daemon before `done`), since the URL would point at a
627
+ * dead endpoint — mirrors `daemon_pid`. (#134)
628
+ */
629
+ daemon_api_url: z.ZodNullable<z.ZodString>;
630
+ /** Non-null only for `daemon_mode: "detached"` (the caller owns the pid). */
631
+ daemon_pid: z.ZodNullable<z.ZodNumber>;
632
+ seed_status: z.ZodEnum<["seeding", "stopped"]>;
633
+ /**
634
+ * OS service label when `daemon_mode: "service"` handed the daemon to
635
+ * launchd / systemd (e.g. `ton-mesh.<bag_id>`); null otherwise.
636
+ * Manage via `ton-mesh-harness service list | stop`.
637
+ */
638
+ daemon_service: z.ZodDefault<z.ZodNullable<z.ZodString>>;
639
+ next_actions: z.ZodDefault<z.ZodArray<z.ZodObject<{
640
+ description: z.ZodString;
641
+ }, "strict", z.ZodTypeAny, {
642
+ description: string;
643
+ }, {
644
+ description: string;
645
+ }>, "many">>;
646
+ }, "strict", z.ZodTypeAny, {
647
+ bag_id: string;
648
+ bag_size_bytes: number;
649
+ dns_tx_hash: string | null;
650
+ daemon_api_url: string | null;
651
+ daemon_pid: number | null;
652
+ seed_status: "seeding" | "stopped";
653
+ daemon_service: string | null;
654
+ next_actions: {
655
+ description: string;
656
+ }[];
657
+ }, {
658
+ bag_id: string;
659
+ bag_size_bytes: number;
660
+ dns_tx_hash: string | null;
661
+ daemon_api_url: string | null;
662
+ daemon_pid: number | null;
663
+ seed_status: "seeding" | "stopped";
664
+ daemon_service?: string | null | undefined;
665
+ next_actions?: {
666
+ description: string;
667
+ }[] | undefined;
668
+ }>;
669
+ message: z.ZodString;
670
+ percent: z.ZodOptional<z.ZodNumber>;
671
+ phase: z.ZodLiteral<"done">;
672
+ }, "strict", z.ZodTypeAny, {
673
+ message: string;
674
+ phase: "done";
675
+ data: {
676
+ bag_id: string;
677
+ bag_size_bytes: number;
678
+ dns_tx_hash: string | null;
679
+ daemon_api_url: string | null;
680
+ daemon_pid: number | null;
681
+ seed_status: "seeding" | "stopped";
682
+ daemon_service: string | null;
683
+ next_actions: {
684
+ description: string;
685
+ }[];
686
+ };
687
+ percent?: number | undefined;
688
+ }, {
689
+ message: string;
690
+ phase: "done";
691
+ data: {
692
+ bag_id: string;
693
+ bag_size_bytes: number;
694
+ dns_tx_hash: string | null;
695
+ daemon_api_url: string | null;
696
+ daemon_pid: number | null;
697
+ seed_status: "seeding" | "stopped";
698
+ daemon_service?: string | null | undefined;
699
+ next_actions?: {
700
+ description: string;
701
+ }[] | undefined;
702
+ };
703
+ percent?: number | undefined;
704
+ }>, z.ZodObject<{
705
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
706
+ message: z.ZodString;
707
+ percent: z.ZodOptional<z.ZodNumber>;
708
+ phase: z.ZodLiteral<"env_check">;
709
+ }, "strict", z.ZodTypeAny, {
710
+ message: string;
711
+ phase: "env_check";
712
+ data?: Record<string, unknown> | undefined;
713
+ percent?: number | undefined;
714
+ }, {
715
+ message: string;
716
+ phase: "env_check";
717
+ data?: Record<string, unknown> | undefined;
718
+ percent?: number | undefined;
719
+ }>, z.ZodObject<{
720
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
721
+ message: z.ZodString;
722
+ percent: z.ZodOptional<z.ZodNumber>;
723
+ phase: z.ZodLiteral<"bag_creating">;
724
+ }, "strict", z.ZodTypeAny, {
725
+ message: string;
726
+ phase: "bag_creating";
727
+ data?: Record<string, unknown> | undefined;
728
+ percent?: number | undefined;
729
+ }, {
730
+ message: string;
731
+ phase: "bag_creating";
732
+ data?: Record<string, unknown> | undefined;
733
+ percent?: number | undefined;
734
+ }>, z.ZodObject<{
735
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
736
+ message: z.ZodString;
737
+ percent: z.ZodOptional<z.ZodNumber>;
738
+ phase: z.ZodLiteral<"daemon_starting">;
739
+ }, "strict", z.ZodTypeAny, {
740
+ message: string;
741
+ phase: "daemon_starting";
742
+ data?: Record<string, unknown> | undefined;
743
+ percent?: number | undefined;
744
+ }, {
745
+ message: string;
746
+ phase: "daemon_starting";
747
+ data?: Record<string, unknown> | undefined;
748
+ percent?: number | undefined;
749
+ }>, z.ZodObject<{
750
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
751
+ message: z.ZodString;
752
+ percent: z.ZodOptional<z.ZodNumber>;
753
+ phase: z.ZodLiteral<"bag_uploaded">;
754
+ }, "strict", z.ZodTypeAny, {
755
+ message: string;
756
+ phase: "bag_uploaded";
757
+ data?: Record<string, unknown> | undefined;
758
+ percent?: number | undefined;
759
+ }, {
760
+ message: string;
761
+ phase: "bag_uploaded";
762
+ data?: Record<string, unknown> | undefined;
763
+ percent?: number | undefined;
764
+ }>, z.ZodObject<{
765
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
766
+ message: z.ZodString;
767
+ percent: z.ZodOptional<z.ZodNumber>;
768
+ phase: z.ZodLiteral<"dns_signing">;
769
+ }, "strict", z.ZodTypeAny, {
770
+ message: string;
771
+ phase: "dns_signing";
772
+ data?: Record<string, unknown> | undefined;
773
+ percent?: number | undefined;
774
+ }, {
775
+ message: string;
776
+ phase: "dns_signing";
777
+ data?: Record<string, unknown> | undefined;
778
+ percent?: number | undefined;
779
+ }>, z.ZodObject<{
780
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
781
+ message: z.ZodString;
782
+ percent: z.ZodOptional<z.ZodNumber>;
783
+ phase: z.ZodLiteral<"dns_confirmed">;
784
+ }, "strict", z.ZodTypeAny, {
785
+ message: string;
786
+ phase: "dns_confirmed";
787
+ data?: Record<string, unknown> | undefined;
788
+ percent?: number | undefined;
789
+ }, {
790
+ message: string;
791
+ phase: "dns_confirmed";
792
+ data?: Record<string, unknown> | undefined;
793
+ percent?: number | undefined;
794
+ }>, z.ZodObject<{
795
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
796
+ message: z.ZodString;
797
+ percent: z.ZodOptional<z.ZodNumber>;
798
+ phase: z.ZodLiteral<"verifying">;
799
+ }, "strict", z.ZodTypeAny, {
800
+ message: string;
801
+ phase: "verifying";
802
+ data?: Record<string, unknown> | undefined;
803
+ percent?: number | undefined;
804
+ }, {
805
+ message: string;
806
+ phase: "verifying";
807
+ data?: Record<string, unknown> | undefined;
808
+ percent?: number | undefined;
809
+ }>]>;
810
+ export type DeployEvent = z.infer<typeof DeployEventSchema>;
811
+ /**
812
+ * All stable error codes per F5. Adding new codes is non-breaking; renaming
813
+ * or removing is breaking and requires a kit minor bump + tool description note.
814
+ */
815
+ export declare const ERR_CODES: readonly ["ERR_INVALID_INPUT", "ERR_NO_DOMAIN", "ERR_NO_WALLET", "ERR_PORT_BUSY", "ERR_DAEMON_SPAWN", "ERR_DAEMON_API_TIMEOUT", "ERR_BAG_UPLOAD", "ERR_DNS_SIGN_REJECTED", "ERR_DNS_TX_TIMEOUT", "ERR_VERIFY_FAILED", "ERR_CANCELLED", "ERR_BUSY", "ERR_INTERNAL"];
816
+ export declare const ErrCodeSchema: z.ZodEnum<["ERR_INVALID_INPUT", "ERR_NO_DOMAIN", "ERR_NO_WALLET", "ERR_PORT_BUSY", "ERR_DAEMON_SPAWN", "ERR_DAEMON_API_TIMEOUT", "ERR_BAG_UPLOAD", "ERR_DNS_SIGN_REJECTED", "ERR_DNS_TX_TIMEOUT", "ERR_VERIFY_FAILED", "ERR_CANCELLED", "ERR_BUSY", "ERR_INTERNAL"]>;
817
+ export type ErrCode = z.infer<typeof ErrCodeSchema>;
818
+ /**
819
+ * Code-aware discriminated union. ERR_CANCELLED carries strict F4 data;
820
+ * other codes carry a free-form data record (or none).
821
+ */
822
+ export declare const ErrorPayloadSchema: z.ZodDiscriminatedUnion<"code", [z.ZodObject<{
823
+ code: z.ZodLiteral<"ERR_CANCELLED">;
824
+ message: z.ZodString;
825
+ severity: z.ZodEnum<["fatal", "recoverable"]>;
826
+ fix_hint: z.ZodOptional<z.ZodString>;
827
+ data: z.ZodObject<{
828
+ phase_at_cancel: z.ZodEnum<["env_check", "bag_creating", "daemon_starting", "bag_uploaded", "awaiting_signature", "dns_signing", "dns_confirmed", "verifying", "done"]>;
829
+ may_have_published: z.ZodBoolean;
830
+ bag_id: z.ZodNullable<z.ZodString>;
831
+ tx_hash: z.ZodNullable<z.ZodString>;
832
+ }, "strict", z.ZodTypeAny, {
833
+ bag_id: string | null;
834
+ phase_at_cancel: "env_check" | "bag_creating" | "daemon_starting" | "bag_uploaded" | "awaiting_signature" | "dns_signing" | "dns_confirmed" | "verifying" | "done";
835
+ may_have_published: boolean;
836
+ tx_hash: string | null;
837
+ }, {
838
+ bag_id: string | null;
839
+ phase_at_cancel: "env_check" | "bag_creating" | "daemon_starting" | "bag_uploaded" | "awaiting_signature" | "dns_signing" | "dns_confirmed" | "verifying" | "done";
840
+ may_have_published: boolean;
841
+ tx_hash: string | null;
842
+ }>;
843
+ }, "strict", z.ZodTypeAny, {
844
+ code: "ERR_CANCELLED";
845
+ message: string;
846
+ data: {
847
+ bag_id: string | null;
848
+ phase_at_cancel: "env_check" | "bag_creating" | "daemon_starting" | "bag_uploaded" | "awaiting_signature" | "dns_signing" | "dns_confirmed" | "verifying" | "done";
849
+ may_have_published: boolean;
850
+ tx_hash: string | null;
851
+ };
852
+ severity: "fatal" | "recoverable";
853
+ fix_hint?: string | undefined;
854
+ }, {
855
+ code: "ERR_CANCELLED";
856
+ message: string;
857
+ data: {
858
+ bag_id: string | null;
859
+ phase_at_cancel: "env_check" | "bag_creating" | "daemon_starting" | "bag_uploaded" | "awaiting_signature" | "dns_signing" | "dns_confirmed" | "verifying" | "done";
860
+ may_have_published: boolean;
861
+ tx_hash: string | null;
862
+ };
863
+ severity: "fatal" | "recoverable";
864
+ fix_hint?: string | undefined;
865
+ }>, z.ZodObject<{
866
+ code: z.ZodEnum<["ERR_INVALID_INPUT" | "ERR_NO_DOMAIN" | "ERR_NO_WALLET" | "ERR_PORT_BUSY" | "ERR_DAEMON_SPAWN" | "ERR_DAEMON_API_TIMEOUT" | "ERR_BAG_UPLOAD" | "ERR_DNS_SIGN_REJECTED" | "ERR_DNS_TX_TIMEOUT" | "ERR_VERIFY_FAILED" | "ERR_BUSY" | "ERR_INTERNAL", ...("ERR_INVALID_INPUT" | "ERR_NO_DOMAIN" | "ERR_NO_WALLET" | "ERR_PORT_BUSY" | "ERR_DAEMON_SPAWN" | "ERR_DAEMON_API_TIMEOUT" | "ERR_BAG_UPLOAD" | "ERR_DNS_SIGN_REJECTED" | "ERR_DNS_TX_TIMEOUT" | "ERR_VERIFY_FAILED" | "ERR_BUSY" | "ERR_INTERNAL")[]]>;
867
+ message: z.ZodString;
868
+ severity: z.ZodEnum<["fatal", "recoverable"]>;
869
+ fix_hint: z.ZodOptional<z.ZodString>;
870
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
871
+ }, "strict", z.ZodTypeAny, {
872
+ code: "ERR_INVALID_INPUT" | "ERR_NO_DOMAIN" | "ERR_NO_WALLET" | "ERR_PORT_BUSY" | "ERR_DAEMON_SPAWN" | "ERR_DAEMON_API_TIMEOUT" | "ERR_BAG_UPLOAD" | "ERR_DNS_SIGN_REJECTED" | "ERR_DNS_TX_TIMEOUT" | "ERR_VERIFY_FAILED" | "ERR_BUSY" | "ERR_INTERNAL";
873
+ message: string;
874
+ severity: "fatal" | "recoverable";
875
+ fix_hint?: string | undefined;
876
+ data?: Record<string, unknown> | undefined;
877
+ }, {
878
+ code: "ERR_INVALID_INPUT" | "ERR_NO_DOMAIN" | "ERR_NO_WALLET" | "ERR_PORT_BUSY" | "ERR_DAEMON_SPAWN" | "ERR_DAEMON_API_TIMEOUT" | "ERR_BAG_UPLOAD" | "ERR_DNS_SIGN_REJECTED" | "ERR_DNS_TX_TIMEOUT" | "ERR_VERIFY_FAILED" | "ERR_BUSY" | "ERR_INTERNAL";
879
+ message: string;
880
+ severity: "fatal" | "recoverable";
881
+ fix_hint?: string | undefined;
882
+ data?: Record<string, unknown> | undefined;
883
+ }>]>;
884
+ export type ErrorPayload = z.infer<typeof ErrorPayloadSchema>;
885
+ export {};