arc402-cli 0.9.19 → 0.10.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 (359) hide show
  1. package/README.md +41 -2
  2. package/dist/abis.d.ts +1 -0
  3. package/dist/abis.d.ts.map +1 -1
  4. package/dist/abis.js +45 -14
  5. package/dist/abis.js.map +1 -1
  6. package/dist/bundler.d.ts +1 -1
  7. package/dist/bundler.d.ts.map +1 -1
  8. package/dist/bundler.js +61 -27
  9. package/dist/bundler.js.map +1 -1
  10. package/dist/client.d.ts +1 -1
  11. package/dist/client.d.ts.map +1 -1
  12. package/dist/client.js +9 -5
  13. package/dist/client.js.map +1 -1
  14. package/dist/coinbase-smart-wallet.js +4 -1
  15. package/dist/coinbase-smart-wallet.js.map +1 -1
  16. package/dist/commands/accept.js +28 -25
  17. package/dist/commands/accept.js.map +1 -1
  18. package/dist/commands/agent-handshake.js +18 -15
  19. package/dist/commands/agent-handshake.js.map +1 -1
  20. package/dist/commands/agent.js +104 -98
  21. package/dist/commands/agent.js.map +1 -1
  22. package/dist/commands/agreements.js +98 -62
  23. package/dist/commands/agreements.js.map +1 -1
  24. package/dist/commands/arbitrator.js +81 -45
  25. package/dist/commands/arbitrator.js.map +1 -1
  26. package/dist/commands/arena-handshake.d.ts.map +1 -1
  27. package/dist/commands/arena-handshake.js +35 -53
  28. package/dist/commands/arena-handshake.js.map +1 -1
  29. package/dist/commands/arena.js +18 -12
  30. package/dist/commands/arena.js.map +1 -1
  31. package/dist/commands/backup.js +36 -30
  32. package/dist/commands/backup.js.map +1 -1
  33. package/dist/commands/cancel.js +18 -15
  34. package/dist/commands/cancel.js.map +1 -1
  35. package/dist/commands/channel.js +81 -45
  36. package/dist/commands/channel.js.map +1 -1
  37. package/dist/commands/coldstart.js +34 -31
  38. package/dist/commands/coldstart.js.map +1 -1
  39. package/dist/commands/compute.d.ts +14 -0
  40. package/dist/commands/compute.d.ts.map +1 -0
  41. package/dist/commands/compute.js +466 -0
  42. package/dist/commands/compute.js.map +1 -0
  43. package/dist/commands/config.js +30 -24
  44. package/dist/commands/config.js.map +1 -1
  45. package/dist/commands/contract-interaction.js +15 -12
  46. package/dist/commands/contract-interaction.js.map +1 -1
  47. package/dist/commands/daemon.d.ts.map +1 -1
  48. package/dist/commands/daemon.js +135 -98
  49. package/dist/commands/daemon.js.map +1 -1
  50. package/dist/commands/deliver.js +76 -37
  51. package/dist/commands/deliver.js.map +1 -1
  52. package/dist/commands/discover.js +27 -24
  53. package/dist/commands/discover.js.map +1 -1
  54. package/dist/commands/dispute.js +110 -104
  55. package/dist/commands/dispute.js.map +1 -1
  56. package/dist/commands/doctor.js +55 -16
  57. package/dist/commands/doctor.js.map +1 -1
  58. package/dist/commands/endpoint.js +95 -56
  59. package/dist/commands/endpoint.js.map +1 -1
  60. package/dist/commands/feed.js +18 -11
  61. package/dist/commands/feed.js.map +1 -1
  62. package/dist/commands/hire.js +40 -37
  63. package/dist/commands/hire.js.map +1 -1
  64. package/dist/commands/migrate.js +33 -30
  65. package/dist/commands/migrate.js.map +1 -1
  66. package/dist/commands/negotiate.d.ts.map +1 -1
  67. package/dist/commands/negotiate.js +36 -34
  68. package/dist/commands/negotiate.js.map +1 -1
  69. package/dist/commands/openshell.js +104 -68
  70. package/dist/commands/openshell.js.map +1 -1
  71. package/dist/commands/owner.js +20 -17
  72. package/dist/commands/owner.js.map +1 -1
  73. package/dist/commands/policy.js +43 -41
  74. package/dist/commands/policy.js.map +1 -1
  75. package/dist/commands/relay.d.ts.map +1 -1
  76. package/dist/commands/relay.js +51 -18
  77. package/dist/commands/relay.js.map +1 -1
  78. package/dist/commands/remediate.js +23 -20
  79. package/dist/commands/remediate.js.map +1 -1
  80. package/dist/commands/reputation.js +27 -25
  81. package/dist/commands/reputation.js.map +1 -1
  82. package/dist/commands/setup.js +104 -65
  83. package/dist/commands/setup.js.map +1 -1
  84. package/dist/commands/trust.js +20 -17
  85. package/dist/commands/trust.js.map +1 -1
  86. package/dist/commands/verify.js +21 -18
  87. package/dist/commands/verify.js.map +1 -1
  88. package/dist/commands/wallet.d.ts.map +1 -1
  89. package/dist/commands/wallet.js +645 -679
  90. package/dist/commands/wallet.js.map +1 -1
  91. package/dist/commands/watch.js +36 -33
  92. package/dist/commands/watch.js.map +1 -1
  93. package/dist/commands/watchtower.js +73 -37
  94. package/dist/commands/watchtower.js.map +1 -1
  95. package/dist/commands/workroom.d.ts.map +1 -1
  96. package/dist/commands/workroom.js +282 -143
  97. package/dist/commands/workroom.js.map +1 -1
  98. package/dist/config.d.ts +3 -0
  99. package/dist/config.d.ts.map +1 -1
  100. package/dist/config.js +71 -22
  101. package/dist/config.js.map +1 -1
  102. package/dist/daemon/compute-metering.d.ts +61 -0
  103. package/dist/daemon/compute-metering.d.ts.map +1 -0
  104. package/dist/daemon/compute-metering.js +299 -0
  105. package/dist/daemon/compute-metering.js.map +1 -0
  106. package/dist/daemon/compute-session.d.ts +100 -0
  107. package/dist/daemon/compute-session.d.ts.map +1 -0
  108. package/dist/daemon/compute-session.js +231 -0
  109. package/dist/daemon/compute-session.js.map +1 -0
  110. package/dist/daemon/config.d.ts +19 -1
  111. package/dist/daemon/config.d.ts.map +1 -1
  112. package/dist/daemon/config.js +90 -16
  113. package/dist/daemon/config.js.map +1 -1
  114. package/dist/daemon/credentials.d.ts +24 -0
  115. package/dist/daemon/credentials.d.ts.map +1 -0
  116. package/dist/daemon/credentials.js +80 -0
  117. package/dist/daemon/credentials.js.map +1 -0
  118. package/dist/daemon/delivery-client.d.ts +35 -0
  119. package/dist/daemon/delivery-client.d.ts.map +1 -0
  120. package/dist/daemon/delivery-client.js +231 -0
  121. package/dist/daemon/delivery-client.js.map +1 -0
  122. package/dist/daemon/file-delivery.d.ts +98 -0
  123. package/dist/daemon/file-delivery.d.ts.map +1 -0
  124. package/dist/daemon/file-delivery.js +461 -0
  125. package/dist/daemon/file-delivery.js.map +1 -0
  126. package/dist/daemon/hire-listener.d.ts +3 -3
  127. package/dist/daemon/hire-listener.d.ts.map +1 -1
  128. package/dist/daemon/hire-listener.js +47 -13
  129. package/dist/daemon/hire-listener.js.map +1 -1
  130. package/dist/daemon/index.d.ts +2 -1
  131. package/dist/daemon/index.d.ts.map +1 -1
  132. package/dist/daemon/index.js +526 -53
  133. package/dist/daemon/index.js.map +1 -1
  134. package/dist/daemon/job-lifecycle.d.ts +1 -1
  135. package/dist/daemon/job-lifecycle.d.ts.map +1 -1
  136. package/dist/daemon/job-lifecycle.js +51 -11
  137. package/dist/daemon/job-lifecycle.js.map +1 -1
  138. package/dist/daemon/notify.d.ts +1 -1
  139. package/dist/daemon/notify.d.ts.map +1 -1
  140. package/dist/daemon/notify.js +53 -19
  141. package/dist/daemon/notify.js.map +1 -1
  142. package/dist/daemon/token-metering.js +47 -8
  143. package/dist/daemon/token-metering.js.map +1 -1
  144. package/dist/daemon/userops.d.ts +2 -2
  145. package/dist/daemon/userops.d.ts.map +1 -1
  146. package/dist/daemon/userops.js +27 -23
  147. package/dist/daemon/userops.js.map +1 -1
  148. package/dist/daemon/wallet-monitor.d.ts +1 -1
  149. package/dist/daemon/wallet-monitor.d.ts.map +1 -1
  150. package/dist/daemon/wallet-monitor.js +12 -8
  151. package/dist/daemon/wallet-monitor.js.map +1 -1
  152. package/dist/daemon/worker-executor.d.ts +71 -0
  153. package/dist/daemon/worker-executor.d.ts.map +1 -0
  154. package/dist/daemon/worker-executor.js +382 -0
  155. package/dist/daemon/worker-executor.js.map +1 -0
  156. package/dist/drain-v4.js +64 -26
  157. package/dist/drain-v4.js.map +1 -1
  158. package/dist/endpoint-config.js +63 -20
  159. package/dist/endpoint-config.js.map +1 -1
  160. package/dist/endpoint-notify.d.ts.map +1 -1
  161. package/dist/endpoint-notify.js +49 -15
  162. package/dist/endpoint-notify.js.map +1 -1
  163. package/dist/index.js +50 -18
  164. package/dist/index.js.map +1 -1
  165. package/dist/openshell-runtime.d.ts.map +1 -1
  166. package/dist/openshell-runtime.js +82 -38
  167. package/dist/openshell-runtime.js.map +1 -1
  168. package/dist/program.d.ts.map +1 -1
  169. package/dist/program.js +85 -78
  170. package/dist/program.js.map +1 -1
  171. package/dist/repl.js +31 -25
  172. package/dist/repl.js.map +1 -1
  173. package/dist/signing.js +6 -3
  174. package/dist/signing.js.map +1 -1
  175. package/dist/telegram-notify.js +40 -3
  176. package/dist/telegram-notify.js.map +1 -1
  177. package/dist/tui/App.d.ts.map +1 -1
  178. package/dist/tui/App.js +56 -89
  179. package/dist/tui/App.js.map +1 -1
  180. package/dist/tui/Footer.js +7 -4
  181. package/dist/tui/Footer.js.map +1 -1
  182. package/dist/tui/Header.d.ts +1 -1
  183. package/dist/tui/Header.d.ts.map +1 -1
  184. package/dist/tui/Header.js +14 -9
  185. package/dist/tui/Header.js.map +1 -1
  186. package/dist/tui/InputLine.d.ts +2 -1
  187. package/dist/tui/InputLine.d.ts.map +1 -1
  188. package/dist/tui/InputLine.js +47 -97
  189. package/dist/tui/InputLine.js.map +1 -1
  190. package/dist/tui/Viewport.d.ts +1 -2
  191. package/dist/tui/Viewport.d.ts.map +1 -1
  192. package/dist/tui/Viewport.js +26 -6
  193. package/dist/tui/Viewport.js.map +1 -1
  194. package/dist/tui/WalletConnectPairing.js +19 -16
  195. package/dist/tui/WalletConnectPairing.js.map +1 -1
  196. package/dist/tui/components/Button.js +9 -6
  197. package/dist/tui/components/Button.js.map +1 -1
  198. package/dist/tui/components/CeremonyView.js +8 -5
  199. package/dist/tui/components/CeremonyView.js.map +1 -1
  200. package/dist/tui/components/CompletionDropdown.js +9 -6
  201. package/dist/tui/components/CompletionDropdown.js.map +1 -1
  202. package/dist/tui/components/ConfirmPrompt.js +8 -5
  203. package/dist/tui/components/ConfirmPrompt.js.map +1 -1
  204. package/dist/tui/components/CustomTextInput.js +14 -11
  205. package/dist/tui/components/CustomTextInput.js.map +1 -1
  206. package/dist/tui/components/InteractiveTable.js +12 -9
  207. package/dist/tui/components/InteractiveTable.js.map +1 -1
  208. package/dist/tui/components/StepSpinner.js +13 -10
  209. package/dist/tui/components/StepSpinner.js.map +1 -1
  210. package/dist/tui/components/Toast.js +12 -8
  211. package/dist/tui/components/Toast.js.map +1 -1
  212. package/dist/tui/index.d.ts.map +1 -1
  213. package/dist/tui/index.js +21 -28
  214. package/dist/tui/index.js.map +1 -1
  215. package/dist/tui/useChat.js +19 -13
  216. package/dist/tui/useChat.js.map +1 -1
  217. package/dist/tui/useCommand.d.ts +2 -3
  218. package/dist/tui/useCommand.d.ts.map +1 -1
  219. package/dist/tui/useCommand.js +24 -100
  220. package/dist/tui/useCommand.js.map +1 -1
  221. package/dist/tui/useNotifications.js +8 -5
  222. package/dist/tui/useNotifications.js.map +1 -1
  223. package/dist/tui/useScroll.d.ts.map +1 -1
  224. package/dist/tui/useScroll.js +12 -15
  225. package/dist/tui/useScroll.js.map +1 -1
  226. package/dist/ui/banner.d.ts +0 -12
  227. package/dist/ui/banner.d.ts.map +1 -1
  228. package/dist/ui/banner.js +19 -35
  229. package/dist/ui/banner.js.map +1 -1
  230. package/dist/ui/colors.js +19 -13
  231. package/dist/ui/colors.js.map +1 -1
  232. package/dist/ui/format.js +14 -6
  233. package/dist/ui/format.js.map +1 -1
  234. package/dist/ui/qr-render.js +11 -4
  235. package/dist/ui/qr-render.js.map +1 -1
  236. package/dist/ui/rpc-fallback.js +11 -6
  237. package/dist/ui/rpc-fallback.js.map +1 -1
  238. package/dist/ui/spinner.js +12 -6
  239. package/dist/ui/spinner.js.map +1 -1
  240. package/dist/ui/tree.js +6 -3
  241. package/dist/ui/tree.js.map +1 -1
  242. package/dist/utils/format.js +41 -27
  243. package/dist/utils/format.js.map +1 -1
  244. package/dist/utils/hash.js +42 -4
  245. package/dist/utils/hash.js.map +1 -1
  246. package/dist/utils/time.js +6 -2
  247. package/dist/utils/time.js.map +1 -1
  248. package/dist/wallet-router.d.ts +1 -1
  249. package/dist/wallet-router.d.ts.map +1 -1
  250. package/dist/wallet-router.js +19 -12
  251. package/dist/wallet-router.js.map +1 -1
  252. package/dist/walletconnect-session.d.ts +1 -1
  253. package/dist/walletconnect-session.d.ts.map +1 -1
  254. package/dist/walletconnect-session.js +11 -6
  255. package/dist/walletconnect-session.js.map +1 -1
  256. package/dist/walletconnect.d.ts +5 -6
  257. package/dist/walletconnect.d.ts.map +1 -1
  258. package/dist/walletconnect.js +35 -32
  259. package/dist/walletconnect.js.map +1 -1
  260. package/package.json +11 -10
  261. package/INK6-UX-SPEC.md +0 -446
  262. package/MIGRATION-SPEC.md +0 -108
  263. package/TUI-SPEC.md +0 -214
  264. package/scripts/authorize-machine-key.ts +0 -43
  265. package/scripts/drain-wallet.ts +0 -149
  266. package/scripts/execute-spend-only.ts +0 -81
  267. package/scripts/register-agent-userop.ts +0 -186
  268. package/src/abis.ts +0 -187
  269. package/src/bundler.ts +0 -235
  270. package/src/client.ts +0 -36
  271. package/src/coinbase-smart-wallet.ts +0 -51
  272. package/src/commands/accept.ts +0 -64
  273. package/src/commands/agent-handshake.ts +0 -72
  274. package/src/commands/agent.ts +0 -691
  275. package/src/commands/agreements.ts +0 -350
  276. package/src/commands/arbitrator.ts +0 -180
  277. package/src/commands/arena-handshake.ts +0 -274
  278. package/src/commands/arena.ts +0 -122
  279. package/src/commands/backup.ts +0 -117
  280. package/src/commands/cancel.ts +0 -35
  281. package/src/commands/channel.ts +0 -218
  282. package/src/commands/coldstart.ts +0 -165
  283. package/src/commands/config.ts +0 -68
  284. package/src/commands/contract-interaction.ts +0 -166
  285. package/src/commands/daemon.ts +0 -1054
  286. package/src/commands/deliver.ts +0 -148
  287. package/src/commands/discover.ts +0 -350
  288. package/src/commands/dispute.ts +0 -375
  289. package/src/commands/doctor.ts +0 -172
  290. package/src/commands/endpoint.ts +0 -620
  291. package/src/commands/feed.ts +0 -229
  292. package/src/commands/hire.ts +0 -245
  293. package/src/commands/migrate.ts +0 -177
  294. package/src/commands/negotiate.ts +0 -272
  295. package/src/commands/openshell.ts +0 -1055
  296. package/src/commands/owner.ts +0 -35
  297. package/src/commands/policy.ts +0 -263
  298. package/src/commands/relay.ts +0 -277
  299. package/src/commands/remediate.ts +0 -24
  300. package/src/commands/reputation.ts +0 -79
  301. package/src/commands/setup.ts +0 -343
  302. package/src/commands/trust.ts +0 -27
  303. package/src/commands/verify.ts +0 -91
  304. package/src/commands/wallet.ts +0 -3548
  305. package/src/commands/watch.ts +0 -220
  306. package/src/commands/watchtower.ts +0 -248
  307. package/src/commands/workroom.ts +0 -963
  308. package/src/config.ts +0 -220
  309. package/src/daemon/config.ts +0 -344
  310. package/src/daemon/hire-listener.ts +0 -226
  311. package/src/daemon/index.ts +0 -1089
  312. package/src/daemon/job-lifecycle.ts +0 -215
  313. package/src/daemon/notify.ts +0 -297
  314. package/src/daemon/token-metering.ts +0 -183
  315. package/src/daemon/userops.ts +0 -119
  316. package/src/daemon/wallet-monitor.ts +0 -90
  317. package/src/drain-v4.ts +0 -159
  318. package/src/endpoint-config.ts +0 -83
  319. package/src/endpoint-notify.ts +0 -134
  320. package/src/index.ts +0 -74
  321. package/src/openshell-runtime.ts +0 -281
  322. package/src/program.ts +0 -88
  323. package/src/repl.ts +0 -178
  324. package/src/signing.ts +0 -28
  325. package/src/telegram-notify.ts +0 -88
  326. package/src/tui/App.tsx +0 -263
  327. package/src/tui/Footer.tsx +0 -18
  328. package/src/tui/Header.tsx +0 -45
  329. package/src/tui/InputLine.tsx +0 -243
  330. package/src/tui/Viewport.tsx +0 -51
  331. package/src/tui/WalletConnectPairing.tsx +0 -114
  332. package/src/tui/components/Button.tsx +0 -38
  333. package/src/tui/components/CeremonyView.tsx +0 -39
  334. package/src/tui/components/CompletionDropdown.tsx +0 -56
  335. package/src/tui/components/ConfirmPrompt.tsx +0 -36
  336. package/src/tui/components/CustomTextInput.tsx +0 -132
  337. package/src/tui/components/InteractiveTable.tsx +0 -106
  338. package/src/tui/components/StepSpinner.tsx +0 -84
  339. package/src/tui/components/Toast.tsx +0 -59
  340. package/src/tui/index.tsx +0 -90
  341. package/src/tui/useChat.ts +0 -103
  342. package/src/tui/useCommand.ts +0 -238
  343. package/src/tui/useNotifications.ts +0 -28
  344. package/src/tui/useScroll.ts +0 -69
  345. package/src/ui/banner.ts +0 -78
  346. package/src/ui/colors.ts +0 -30
  347. package/src/ui/format.ts +0 -78
  348. package/src/ui/qr-render.ts +0 -92
  349. package/src/ui/rpc-fallback.ts +0 -59
  350. package/src/ui/spinner.ts +0 -56
  351. package/src/ui/tree.ts +0 -16
  352. package/src/utils/format.ts +0 -48
  353. package/src/utils/hash.ts +0 -5
  354. package/src/utils/time.ts +0 -15
  355. package/src/wallet-router.ts +0 -178
  356. package/src/walletconnect-session.ts +0 -27
  357. package/src/walletconnect.ts +0 -309
  358. package/test/time.test.js +0 -11
  359. package/tsconfig.json +0 -33
package/INK6-UX-SPEC.md DELETED
@@ -1,446 +0,0 @@
1
- # Ink 6 UX Enhancement Spec
2
-
3
- ## Context
4
- CLI is now on Ink 6 + React 19 + ESM. The WalletConnect native component exists.
5
- This spec covers ALL remaining Ink 6 UX capabilities to build before the article demo.
6
-
7
- ## Current TUI Architecture
8
- ```
9
- src/tui/
10
- ├── App.tsx — Root component, layout, command dispatch
11
- ├── Header.tsx — ASCII banner + network/wallet/balance
12
- ├── Viewport.tsx — Scrollable output buffer
13
- ├── InputLine.tsx — Text input with history + tab completion
14
- ├── Footer.tsx — Footer wrapper
15
- ├── WalletConnectPairing.tsx — Native WC QR + status (new from Phase 3)
16
- ├── index.tsx — TUI launcher
17
- ├── useCommand.ts — Command dispatch (in-process + child process)
18
- ├── useChat.ts — Chat gateway integration
19
- └── useScroll.ts — Viewport scroll state
20
- ```
21
-
22
- ---
23
-
24
- ## Feature 1: Full-Screen Mode
25
-
26
- ### What
27
- Use Ink 6's `fullScreen` option on `render()` to use the alternate screen buffer.
28
-
29
- ### Why
30
- - Clean entry: terminal history preserved, TUI gets a blank canvas
31
- - Clean exit: original terminal content restored
32
- - Proper resize: Ink reflows on SIGWINCH in full-screen mode
33
- - No visual artifacts from previous commands bleeding into the TUI
34
-
35
- ### Implementation
36
- In `src/tui/index.tsx`, change the render call:
37
- ```tsx
38
- const { waitUntilExit } = render(<App ... />, {
39
- exitOnCtrlC: true,
40
- });
41
- ```
42
- Ink 6's `render()` supports a second options argument. Check if `fullScreen` is a boolean option or if it's handled via `<Box height="100%">` with the alternate buffer.
43
-
44
- If Ink 6 doesn't have a built-in fullScreen option, implement manually:
45
- ```tsx
46
- // Enter alternate buffer
47
- process.stdout.write('\x1b[?1049h');
48
- // ... render ...
49
- // On exit, restore
50
- process.stdout.write('\x1b[?1049l');
51
- ```
52
-
53
- ### Files to change
54
- - `src/tui/index.tsx` — add alternate screen buffer enter/exit
55
-
56
- ---
57
-
58
- ## Feature 2: Static Banner with `<Static>`
59
-
60
- ### What
61
- Wrap the ASCII art banner in Ink's `<Static>` component so it renders once and never re-renders.
62
-
63
- ### Why
64
- - The banner is ~12 lines of ASCII art that NEVER changes after launch
65
- - Currently re-renders on every state change (output buffer update, scroll, input change)
66
- - `<Static>` renders items once above the dynamic area — perfect for the banner
67
-
68
- ### Implementation
69
- In `App.tsx`, replace the `<Header>` component with a `<Static>` block:
70
- ```tsx
71
- import { Static } from "ink";
72
-
73
- // Banner lines computed once
74
- const [bannerItems] = useState(() => getBannerLines({ network, wallet, balance }));
75
-
76
- return (
77
- <Box flexDirection="column" height="100%">
78
- <Static items={bannerItems}>
79
- {(line, i) => <Text key={i}>{line}</Text>}
80
- </Static>
81
- <Text>{separator}</Text>
82
- <Viewport ... />
83
- <Text>{separator}</Text>
84
- <InputLine ... />
85
- </Box>
86
- );
87
- ```
88
-
89
- ### Files to change
90
- - `src/tui/App.tsx` — use `<Static>` for banner
91
- - `src/tui/Header.tsx` — may become unnecessary (inline into App)
92
-
93
- ---
94
-
95
- ## Feature 3: Spinner Components for Deploy Ceremony
96
-
97
- ### What
98
- Create reusable `<StepSpinner>` and `<StepComplete>` components for multi-step flows.
99
-
100
- ### Why
101
- The deploy + onboarding ceremony has 8+ sequential steps. Each should show:
102
- - `◈ Step 3/8 — Setting guardian...` (spinning) while in progress
103
- - `✓ Step 3/8 — Guardian set` (static) when done
104
- - `✗ Step 3/8 — Failed: reason` (static) on error
105
-
106
- ### Implementation
107
- Create `src/tui/components/StepSpinner.tsx`:
108
- ```tsx
109
- interface StepSpinnerProps {
110
- step: number;
111
- total: number;
112
- label: string;
113
- status: "pending" | "running" | "done" | "error";
114
- detail?: string; // e.g. tx hash, address
115
- error?: string;
116
- }
117
- ```
118
-
119
- Uses Ink's built-in spinner frames (or a simple `◈ ◇ ◆ ◈` cycle):
120
- ```
121
- ◈ Step 1/8 — Deploying wallet...
122
- ✓ Step 1/8 — Wallet deployed
123
- └ 0xA34B...a5dc
124
- ◈ Step 2/8 — Authorizing machine key...
125
- ```
126
-
127
- Create `src/tui/components/CeremonyView.tsx`:
128
- A container that manages the step list and renders each StepSpinner.
129
- ```tsx
130
- interface CeremonyStep {
131
- label: string;
132
- status: "pending" | "running" | "done" | "error";
133
- detail?: string;
134
- error?: string;
135
- }
136
-
137
- interface CeremonyViewProps {
138
- title: string;
139
- steps: CeremonyStep[];
140
- }
141
- ```
142
-
143
- ### Files to create
144
- - `src/tui/components/StepSpinner.tsx`
145
- - `src/tui/components/CeremonyView.tsx`
146
-
147
- ### Integration
148
- Wire into `useCommand.ts` — when `wallet deploy` runs, instead of spawning a child process, render `<CeremonyView>` in the viewport with steps updating via React state.
149
-
150
- ---
151
-
152
- ## Feature 4: Focus Management (`useFocus` / `useFocusManager`)
153
-
154
- ### What
155
- Tab-navigable interactive elements in the TUI.
156
-
157
- ### Why
158
- - Deploy wizard: Tab between "Confirm" / "Cancel" / "Change settings"
159
- - WalletConnect: Tab between QR display and wallet link list
160
- - Any confirmation prompt: focus on Yes/No buttons
161
-
162
- ### Implementation
163
- Create `src/tui/components/Button.tsx`:
164
- ```tsx
165
- interface ButtonProps {
166
- label: string;
167
- onPress: () => void;
168
- variant?: "primary" | "danger" | "dim";
169
- }
170
-
171
- function Button({ label, onPress, variant = "primary" }: ButtonProps) {
172
- const { isFocused } = useFocus();
173
- return (
174
- <Box>
175
- <Text
176
- color={isFocused ? "cyan" : "white"}
177
- bold={isFocused}
178
- >
179
- {isFocused ? "▸ " : " "}{label}
180
- </Text>
181
- </Box>
182
- );
183
- }
184
- ```
185
-
186
- Create `src/tui/components/ConfirmPrompt.tsx`:
187
- ```tsx
188
- interface ConfirmPromptProps {
189
- message: string;
190
- onConfirm: () => void;
191
- onCancel: () => void;
192
- }
193
- ```
194
- Renders two focusable buttons. Enter on focused button triggers action.
195
-
196
- ### Files to create
197
- - `src/tui/components/Button.tsx`
198
- - `src/tui/components/ConfirmPrompt.tsx`
199
-
200
- ---
201
-
202
- ## Feature 5: Enhanced Input (useInput)
203
-
204
- ### What
205
- Better keyboard handling in the TUI.
206
-
207
- ### Why
208
- - Ctrl+C: graceful shutdown (cleanup WC sessions, save state)
209
- - Ctrl+L: clear viewport (like terminal clear)
210
- - Page Up/Down: fast viewport scrolling
211
- - Escape: cancel current operation / close prompts
212
-
213
- ### Implementation
214
- In `App.tsx`, add a top-level `useInput` handler:
215
- ```tsx
216
- useInput((input, key) => {
217
- if (key.ctrl && input === 'l') {
218
- setOutputBuffer([]);
219
- return;
220
- }
221
- if (key.pageUp) {
222
- scrollUp(viewportHeight);
223
- return;
224
- }
225
- if (key.pageDown) {
226
- scrollDown(viewportHeight);
227
- return;
228
- }
229
- if (key.escape) {
230
- // Cancel current operation if any
231
- return;
232
- }
233
- });
234
- ```
235
-
236
- ### Files to change
237
- - `src/tui/App.tsx` — add useInput handler
238
- - `src/tui/useScroll.ts` — expose page-size scroll functions
239
-
240
- ---
241
-
242
- ## Feature 6: FlexWrap for Status Bar
243
-
244
- ### What
245
- Use `flexWrap="wrap"` on the header status info so it wraps on narrow terminals.
246
-
247
- ### Why
248
- `Network Base Mainnet Wallet 0xa9e0...83bE Balance 0.0042 ETH`
249
- On a narrow terminal this truncates. With flexWrap it becomes:
250
- ```
251
- Network Base Mainnet
252
- Wallet 0xa9e0...83bE
253
- Balance 0.0042 ETH
254
- ```
255
-
256
- ### Implementation
257
- In the banner/header, wrap status items in a `<Box flexWrap="wrap">`:
258
- ```tsx
259
- <Box flexWrap="wrap" columnGap={2}>
260
- <Box><Text dimColor>Network</Text><Text> {network}</Text></Box>
261
- <Box><Text dimColor>Wallet</Text><Text> {wallet}</Text></Box>
262
- <Box><Text dimColor>Balance</Text><Text> {balance}</Text></Box>
263
- </Box>
264
- ```
265
-
266
- ### Files to change
267
- - `src/ui/banner.ts` — return structured data instead of pre-formatted strings
268
- - `src/tui/Header.tsx` — use flexWrap Box layout
269
-
270
- ---
271
-
272
- ## Feature 7: Notification Toasts
273
-
274
- ### What
275
- Non-blocking notifications that appear briefly in the TUI when background events occur.
276
-
277
- ### Why
278
- When the daemon is running and receives a hire request, dispute, or payment — show it.
279
-
280
- ### Implementation
281
- Create `src/tui/components/Toast.tsx`:
282
- ```tsx
283
- interface ToastProps {
284
- message: string;
285
- variant: "info" | "success" | "warning" | "error";
286
- duration?: number; // ms, default 5000
287
- }
288
- ```
289
-
290
- Create `src/tui/useNotifications.ts`:
291
- ```tsx
292
- function useNotifications() {
293
- const [toasts, setToasts] = useState<Toast[]>([]);
294
- const push = (toast: Omit<Toast, "id">) => { ... };
295
- const dismiss = (id: string) => { ... };
296
- return { toasts, push, dismiss };
297
- }
298
- ```
299
-
300
- Toasts render in a fixed position above the input line, auto-dismiss after duration.
301
-
302
- ### Files to create
303
- - `src/tui/components/Toast.tsx`
304
- - `src/tui/useNotifications.ts`
305
-
306
- ### Integration
307
- The daemon WebSocket connection (if running) emits events → push toast.
308
-
309
- ---
310
-
311
- ## Feature 8: Tab-Completion Dropdown
312
-
313
- ### What
314
- Show a dropdown list of completion candidates when Tab is pressed.
315
-
316
- ### Why
317
- Current tab completion silently completes in the input. Users don't know what's available.
318
-
319
- ### Implementation
320
- Create `src/tui/components/CompletionDropdown.tsx`:
321
- ```tsx
322
- interface CompletionDropdownProps {
323
- candidates: string[];
324
- selectedIndex: number;
325
- visible: boolean;
326
- }
327
- ```
328
-
329
- Renders a floating box above the input line showing matching commands:
330
- ```
331
- wallet deploy
332
- wallet status
333
- wallet balance
334
- wallet freeze
335
- ◈ arc402 > wallet d_
336
- ```
337
-
338
- Arrow keys navigate, Tab/Enter selects, Escape dismisses.
339
-
340
- ### Files to create
341
- - `src/tui/components/CompletionDropdown.tsx`
342
-
343
- ### Files to change
344
- - `src/tui/InputLine.tsx` — manage dropdown state, render above input
345
-
346
- ---
347
-
348
- ## Feature 9: Interactive Tables
349
-
350
- ### What
351
- Scrollable, selectable table component for list views.
352
-
353
- ### Why
354
- `discover`, `agreements list`, `wallet list`, `list-machine-keys` all return tabular data.
355
- Currently rendered as plain text. Should be interactive: arrow keys to navigate rows, Enter to drill in.
356
-
357
- ### Implementation
358
- Create `src/tui/components/InteractiveTable.tsx`:
359
- ```tsx
360
- interface Column {
361
- header: string;
362
- key: string;
363
- width?: number;
364
- align?: "left" | "right";
365
- }
366
-
367
- interface InteractiveTableProps {
368
- columns: Column[];
369
- rows: Record<string, string>[];
370
- onSelect?: (row: Record<string, string>, index: number) => void;
371
- selectedIndex?: number;
372
- }
373
- ```
374
-
375
- Renders with box-drawing borders for the header row:
376
- ```
377
- Agent Service Trust Endpoint
378
- ─────────────────────────────────────────────────
379
- ▸ GigaBrain intelligence 850 gigabrain.arc402.xyz
380
- CodeReviewer code.review 720 reviewer.arc402.xyz
381
- DataOracle data.feed 690 oracle.arc402.xyz
382
- ```
383
-
384
- ### Files to create
385
- - `src/tui/components/InteractiveTable.tsx`
386
-
387
- ---
388
-
389
- ## Feature 10: Split Pane (Future — Post-Launch)
390
-
391
- ### What
392
- Side-by-side panes: command output left, daemon logs right.
393
-
394
- ### Why
395
- Power users running the daemon want to see live events while issuing commands.
396
-
397
- ### Implementation (design only — build post-launch)
398
- Create `src/tui/components/SplitPane.tsx`:
399
- ```tsx
400
- interface SplitPaneProps {
401
- left: React.ReactNode;
402
- right: React.ReactNode;
403
- ratio?: number; // 0.0-1.0, default 0.6
404
- }
405
- ```
406
-
407
- Uses Ink 6's `<Box width="60%">` + `<Box width="40%">` for the split.
408
-
409
- ### Files to create (post-launch)
410
- - `src/tui/components/SplitPane.tsx`
411
-
412
- ---
413
-
414
- ## Build Order
415
-
416
- 1. Full-screen mode (Feature 1) — foundational
417
- 2. Static banner (Feature 2) — performance
418
- 3. Enhanced input / keyboard (Feature 5) — UX basics
419
- 4. Spinner components (Feature 3) — deploy ceremony visual
420
- 5. Focus management + buttons (Feature 4) — interactive deploy wizard
421
- 6. FlexWrap status bar (Feature 6) — responsive layout
422
- 7. Tab-completion dropdown (Feature 8) — discoverability
423
- 8. Interactive tables (Feature 9) — list views
424
- 9. Notification toasts (Feature 7) — daemon integration
425
- 10. Split pane (Feature 10) — post-launch
426
-
427
- Features 1-8 are for the article demo. Feature 9 is nice-to-have. Feature 10 is post-launch.
428
-
429
- ---
430
-
431
- ## Testing Checklist
432
-
433
- After build:
434
- - [ ] `arc402` launches in full-screen mode, clean entry
435
- - [ ] Ctrl+C exits cleanly, original terminal restored
436
- - [ ] Ctrl+L clears viewport
437
- - [ ] Page Up/Down scrolls viewport
438
- - [ ] Tab shows completion dropdown
439
- - [ ] `wallet deploy` shows QR inside viewport
440
- - [ ] Deploy ceremony shows step spinners
441
- - [ ] Confirmation prompts are focusable (Tab between buttons)
442
- - [ ] `discover` renders interactive table
443
- - [ ] Narrow terminal: status bar wraps correctly
444
- - [ ] `exit` / `quit` restores terminal cleanly
445
- - [ ] `arc402 wallet status` (one-shot mode) still works outside TUI
446
- - [ ] `arc402 --help` still works
package/MIGRATION-SPEC.md DELETED
@@ -1,108 +0,0 @@
1
- # Ink 6 + ESM Migration Spec
2
-
3
- ## Goal
4
- Migrate ARC-402 CLI from Ink 3 (CommonJS) to Ink 6 (ESM + React 19).
5
- Also build a native WalletConnect Ink component so QR codes render inside the TUI viewport.
6
-
7
- ## Current State
8
- - ink@3.2.0, react@18.3.1, ink-text-input@4.0.3
9
- - tsconfig: module=commonjs, target=ES2020
10
- - ~33k lines of TypeScript across 53+ source files
11
- - All source uses `import/export` syntax, compiled to CJS by tsc
12
- - Some files use `require()` for package.json reads
13
- - TUI files: src/tui/ (App.tsx, Header.tsx, Viewport.tsx, InputLine.tsx, Footer.tsx, index.tsx, useChat.ts, useCommand.ts, useScroll.ts)
14
-
15
- ## Phase 1: ESM + Ink 6 Migration
16
-
17
- ### Step 1: Update package.json
18
- - Add `"type": "module"`
19
- - Update deps: `ink@^6.8.0`, `react@^19.0.0`, `@types/react@^19.0.0`, `ink-text-input@^6.0.0`
20
- - Add `react-devtools-core` as optional peer dep if needed
21
- - Run `npm install`
22
-
23
- ### Step 2: Update tsconfig.json
24
- - Change `"module": "NodeNext"` and add `"moduleResolution": "NodeNext"`
25
- - Change `"target": "ES2022"` and `"lib": ["ES2022"]`
26
- - Remove the `paths` entries for ink/ink-text-input (Ink 6 has proper types)
27
- - Add ethers path mapping if needed: `"ethers": ["./node_modules/ethers/lib.commonjs/index.d.ts"]`
28
-
29
- ### Step 3: Fix ALL relative imports
30
- Every `import ... from "./foo"` must become `import ... from "./foo.js"`.
31
- Every `import ... from "../foo"` must become `import ... from "../foo.js"`.
32
- TSX files: `import ... from "./App"` → `import ... from "./App.js"` (tsc compiles .tsx to .js)
33
-
34
- ### Step 4: Convert require() calls to import
35
- - `require("../../package.json")` → use `createRequire(import.meta.url)` from `"node:module"`
36
- - `require("ethers")` etc → already using `import`, should be fine
37
- - Dynamic requires → convert to dynamic `import()`
38
-
39
- ### Step 5: Fix Ink 6 API changes
40
- - Check if `useStdout`, `useInput`, `useApp` signatures changed
41
- - `ink-text-input@6` may have different import path or component API
42
- - `<Static>` component may have changed
43
- - Verify `render()` function signature
44
-
45
- ### Step 6: Build & fix errors iteratively
46
- - Run `npx tsc --noEmit` after each batch of changes
47
- - Fix type errors in batches by file category (TUI files first, then commands, then daemon)
48
-
49
- ## Phase 2: TUI Design Improvements
50
-
51
- ### Step 7: Remove vertical box borders
52
- The TUI should use horizontal separator lines only (no │ borders — they break on resize):
53
- ```
54
- ██████╗ ██████╗ ██████╗ ...
55
- agent-to-agent arcing · v0.7.5
56
- ◈ ──────────────────────────────────────
57
- Network Base Mainnet Wallet 0xa9e0..
58
- ─────────────────────────────────────────────
59
- scrollable output area
60
- ─────────────────────────────────────────────
61
- ◈ arc402 > _
62
- ```
63
-
64
- ### Step 8: ARC402_NO_TUI env guard
65
- In src/index.ts, the TTY TUI launch condition must check `!process.env.ARC402_NO_TUI`:
66
- ```ts
67
- } else if (process.stdout.isTTY && !hasSubcommand && process.argv.length <= 2 && !process.env.ARC402_NO_TUI) {
68
- ```
69
-
70
- ## Phase 3: Native WalletConnect Component
71
-
72
- ### Step 9: Create WalletConnect Ink component
73
- Create `src/tui/WalletConnectPairing.tsx`:
74
- - Renders QR code as ASCII text inside the viewport
75
- - Shows wallet deep links (MetaMask, Rainbow, Trust)
76
- - Shows "Waiting for approval..." status
77
- - Handles connection success/failure as React state transitions
78
-
79
- This requires refactoring `src/walletconnect.ts`:
80
- - Extract the pairing logic into an event-emitter or callback-based API
81
- - The current `connectPhoneWallet()` does console.log for QR — change it to accept
82
- an `onUri` callback and an `onStatus` callback instead
83
- - Keep the existing console.log behavior as the default (for one-shot CLI mode)
84
-
85
- ### Step 10: Wire WalletConnect component into useCommand
86
- Instead of spawning a child process for interactive commands, render the
87
- WalletConnect pairing component inside the viewport when `wallet deploy` runs.
88
-
89
- The multi-step deploy wizard becomes a state machine:
90
- 1. CONNECTING → show QR + links
91
- 2. CONNECTED → show account, deploy tx
92
- 3. DEPLOYING → show spinner
93
- 4. ONBOARDING → show each ceremony step
94
- 5. COMPLETE → show summary tree
95
-
96
- ## Rules
97
- - Do NOT change any business logic in command handlers
98
- - Do NOT change contract addresses, ABIs, or deployment logic
99
- - Keep all existing CLI one-shot behavior working (`arc402 wallet deploy` outside TUI)
100
- - Test with `npx tsc --noEmit` frequently
101
- - After build succeeds, test `node dist/index.js --help` to verify one-shot mode works
102
-
103
- ## Build & verify
104
- ```bash
105
- npm run build
106
- node dist/index.js --help # one-shot mode
107
- node dist/index.js # TUI mode (if TTY)
108
- ```