arc402-cli 0.7.5 → 0.9.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 (309) hide show
  1. package/INK6-UX-SPEC.md +446 -0
  2. package/MIGRATION-SPEC.md +108 -0
  3. package/dist/abis.js +14 -17
  4. package/dist/abis.js.map +1 -1
  5. package/dist/bundler.d.ts +1 -1
  6. package/dist/bundler.d.ts.map +1 -1
  7. package/dist/bundler.js +27 -61
  8. package/dist/bundler.js.map +1 -1
  9. package/dist/client.d.ts +1 -1
  10. package/dist/client.d.ts.map +1 -1
  11. package/dist/client.js +5 -9
  12. package/dist/client.js.map +1 -1
  13. package/dist/coinbase-smart-wallet.js +1 -4
  14. package/dist/coinbase-smart-wallet.js.map +1 -1
  15. package/dist/commands/accept.js +25 -28
  16. package/dist/commands/accept.js.map +1 -1
  17. package/dist/commands/agent-handshake.js +15 -18
  18. package/dist/commands/agent-handshake.js.map +1 -1
  19. package/dist/commands/agent.js +98 -104
  20. package/dist/commands/agent.js.map +1 -1
  21. package/dist/commands/agreements.js +62 -98
  22. package/dist/commands/agreements.js.map +1 -1
  23. package/dist/commands/arbitrator.js +45 -81
  24. package/dist/commands/arbitrator.js.map +1 -1
  25. package/dist/commands/arena-handshake.js +27 -30
  26. package/dist/commands/arena-handshake.js.map +1 -1
  27. package/dist/commands/arena.js +12 -18
  28. package/dist/commands/arena.js.map +1 -1
  29. package/dist/commands/backup.js +30 -36
  30. package/dist/commands/backup.js.map +1 -1
  31. package/dist/commands/cancel.js +15 -18
  32. package/dist/commands/cancel.js.map +1 -1
  33. package/dist/commands/channel.js +45 -81
  34. package/dist/commands/channel.js.map +1 -1
  35. package/dist/commands/coldstart.js +31 -34
  36. package/dist/commands/coldstart.js.map +1 -1
  37. package/dist/commands/config.js +23 -29
  38. package/dist/commands/config.js.map +1 -1
  39. package/dist/commands/contract-interaction.js +12 -15
  40. package/dist/commands/contract-interaction.js.map +1 -1
  41. package/dist/commands/daemon.d.ts.map +1 -1
  42. package/dist/commands/daemon.js +98 -135
  43. package/dist/commands/daemon.js.map +1 -1
  44. package/dist/commands/deliver.js +37 -76
  45. package/dist/commands/deliver.js.map +1 -1
  46. package/dist/commands/discover.js +24 -27
  47. package/dist/commands/discover.js.map +1 -1
  48. package/dist/commands/dispute.js +104 -110
  49. package/dist/commands/dispute.js.map +1 -1
  50. package/dist/commands/doctor.js +16 -55
  51. package/dist/commands/doctor.js.map +1 -1
  52. package/dist/commands/endpoint.js +56 -95
  53. package/dist/commands/endpoint.js.map +1 -1
  54. package/dist/commands/feed.js +11 -18
  55. package/dist/commands/feed.js.map +1 -1
  56. package/dist/commands/hire.js +37 -40
  57. package/dist/commands/hire.js.map +1 -1
  58. package/dist/commands/migrate.js +30 -33
  59. package/dist/commands/migrate.js.map +1 -1
  60. package/dist/commands/negotiate.d.ts.map +1 -1
  61. package/dist/commands/negotiate.js +34 -36
  62. package/dist/commands/negotiate.js.map +1 -1
  63. package/dist/commands/openshell.js +68 -104
  64. package/dist/commands/openshell.js.map +1 -1
  65. package/dist/commands/owner.js +17 -20
  66. package/dist/commands/owner.js.map +1 -1
  67. package/dist/commands/policy.js +41 -43
  68. package/dist/commands/policy.js.map +1 -1
  69. package/dist/commands/relay.d.ts.map +1 -1
  70. package/dist/commands/relay.js +18 -51
  71. package/dist/commands/relay.js.map +1 -1
  72. package/dist/commands/remediate.js +20 -23
  73. package/dist/commands/remediate.js.map +1 -1
  74. package/dist/commands/reputation.js +25 -27
  75. package/dist/commands/reputation.js.map +1 -1
  76. package/dist/commands/setup.js +65 -104
  77. package/dist/commands/setup.js.map +1 -1
  78. package/dist/commands/trust.js +17 -20
  79. package/dist/commands/trust.js.map +1 -1
  80. package/dist/commands/verify.js +18 -21
  81. package/dist/commands/verify.js.map +1 -1
  82. package/dist/commands/wallet.js +619 -625
  83. package/dist/commands/wallet.js.map +1 -1
  84. package/dist/commands/watch.js +33 -36
  85. package/dist/commands/watch.js.map +1 -1
  86. package/dist/commands/watchtower.js +37 -73
  87. package/dist/commands/watchtower.js.map +1 -1
  88. package/dist/commands/workroom.d.ts.map +1 -1
  89. package/dist/commands/workroom.js +138 -171
  90. package/dist/commands/workroom.js.map +1 -1
  91. package/dist/config.js +21 -65
  92. package/dist/config.js.map +1 -1
  93. package/dist/daemon/config.d.ts.map +1 -1
  94. package/dist/daemon/config.js +16 -53
  95. package/dist/daemon/config.js.map +1 -1
  96. package/dist/daemon/hire-listener.d.ts +3 -3
  97. package/dist/daemon/hire-listener.d.ts.map +1 -1
  98. package/dist/daemon/hire-listener.js +13 -47
  99. package/dist/daemon/hire-listener.js.map +1 -1
  100. package/dist/daemon/index.d.ts +1 -1
  101. package/dist/daemon/index.d.ts.map +1 -1
  102. package/dist/daemon/index.js +50 -88
  103. package/dist/daemon/index.js.map +1 -1
  104. package/dist/daemon/job-lifecycle.d.ts +1 -1
  105. package/dist/daemon/job-lifecycle.d.ts.map +1 -1
  106. package/dist/daemon/job-lifecycle.js +11 -51
  107. package/dist/daemon/job-lifecycle.js.map +1 -1
  108. package/dist/daemon/notify.d.ts +1 -1
  109. package/dist/daemon/notify.d.ts.map +1 -1
  110. package/dist/daemon/notify.js +19 -53
  111. package/dist/daemon/notify.js.map +1 -1
  112. package/dist/daemon/token-metering.js +8 -47
  113. package/dist/daemon/token-metering.js.map +1 -1
  114. package/dist/daemon/userops.d.ts +2 -2
  115. package/dist/daemon/userops.d.ts.map +1 -1
  116. package/dist/daemon/userops.js +23 -27
  117. package/dist/daemon/userops.js.map +1 -1
  118. package/dist/daemon/wallet-monitor.d.ts +1 -1
  119. package/dist/daemon/wallet-monitor.d.ts.map +1 -1
  120. package/dist/daemon/wallet-monitor.js +8 -12
  121. package/dist/daemon/wallet-monitor.js.map +1 -1
  122. package/dist/drain-v4.js +26 -64
  123. package/dist/drain-v4.js.map +1 -1
  124. package/dist/endpoint-config.js +20 -63
  125. package/dist/endpoint-config.js.map +1 -1
  126. package/dist/endpoint-notify.js +9 -48
  127. package/dist/endpoint-notify.js.map +1 -1
  128. package/dist/index.js +16 -50
  129. package/dist/index.js.map +1 -1
  130. package/dist/openshell-runtime.d.ts.map +1 -1
  131. package/dist/openshell-runtime.js +38 -82
  132. package/dist/openshell-runtime.js.map +1 -1
  133. package/dist/program.d.ts.map +1 -1
  134. package/dist/program.js +77 -83
  135. package/dist/program.js.map +1 -1
  136. package/dist/repl.js +25 -31
  137. package/dist/repl.js.map +1 -1
  138. package/dist/signing.js +3 -6
  139. package/dist/signing.js.map +1 -1
  140. package/dist/telegram-notify.js +3 -40
  141. package/dist/telegram-notify.js.map +1 -1
  142. package/dist/tui/App.d.ts +1 -9
  143. package/dist/tui/App.d.ts.map +1 -1
  144. package/dist/tui/App.js +87 -65
  145. package/dist/tui/App.js.map +1 -1
  146. package/dist/tui/Footer.js +4 -7
  147. package/dist/tui/Footer.js.map +1 -1
  148. package/dist/tui/Header.d.ts +1 -2
  149. package/dist/tui/Header.d.ts.map +1 -1
  150. package/dist/tui/Header.js +9 -14
  151. package/dist/tui/Header.js.map +1 -1
  152. package/dist/tui/InputLine.d.ts +1 -2
  153. package/dist/tui/InputLine.d.ts.map +1 -1
  154. package/dist/tui/InputLine.js +92 -46
  155. package/dist/tui/InputLine.js.map +1 -1
  156. package/dist/tui/Viewport.d.ts +5 -4
  157. package/dist/tui/Viewport.d.ts.map +1 -1
  158. package/dist/tui/Viewport.js +20 -13
  159. package/dist/tui/Viewport.js.map +1 -1
  160. package/dist/tui/WalletConnectPairing.d.ts +23 -0
  161. package/dist/tui/WalletConnectPairing.d.ts.map +1 -0
  162. package/dist/tui/WalletConnectPairing.js +75 -0
  163. package/dist/tui/WalletConnectPairing.js.map +1 -0
  164. package/dist/tui/components/Button.d.ts +7 -0
  165. package/dist/tui/components/Button.d.ts.map +1 -0
  166. package/dist/tui/components/Button.js +18 -0
  167. package/dist/tui/components/Button.js.map +1 -0
  168. package/dist/tui/components/CeremonyView.d.ts +13 -0
  169. package/dist/tui/components/CeremonyView.d.ts.map +1 -0
  170. package/dist/tui/components/CeremonyView.js +7 -0
  171. package/dist/tui/components/CeremonyView.js.map +1 -0
  172. package/dist/tui/components/CompletionDropdown.d.ts +7 -0
  173. package/dist/tui/components/CompletionDropdown.d.ts.map +1 -0
  174. package/dist/tui/components/CompletionDropdown.js +20 -0
  175. package/dist/tui/components/CompletionDropdown.js.map +1 -0
  176. package/dist/tui/components/ConfirmPrompt.d.ts +9 -0
  177. package/dist/tui/components/ConfirmPrompt.d.ts.map +1 -0
  178. package/dist/tui/components/ConfirmPrompt.js +7 -0
  179. package/dist/tui/components/ConfirmPrompt.js.map +1 -0
  180. package/dist/tui/components/InteractiveTable.d.ts +14 -0
  181. package/dist/tui/components/InteractiveTable.d.ts.map +1 -0
  182. package/dist/tui/components/InteractiveTable.js +58 -0
  183. package/dist/tui/components/InteractiveTable.js.map +1 -0
  184. package/dist/tui/components/StepSpinner.d.ts +11 -0
  185. package/dist/tui/components/StepSpinner.d.ts.map +1 -0
  186. package/dist/tui/components/StepSpinner.js +29 -0
  187. package/dist/tui/components/StepSpinner.js.map +1 -0
  188. package/dist/tui/components/Toast.d.ts +18 -0
  189. package/dist/tui/components/Toast.d.ts.map +1 -0
  190. package/dist/tui/components/Toast.js +25 -0
  191. package/dist/tui/components/Toast.js.map +1 -0
  192. package/dist/tui/index.d.ts.map +1 -1
  193. package/dist/tui/index.js +28 -21
  194. package/dist/tui/index.js.map +1 -1
  195. package/dist/tui/useChat.js +13 -19
  196. package/dist/tui/useChat.js.map +1 -1
  197. package/dist/tui/useCommand.d.ts +2 -7
  198. package/dist/tui/useCommand.d.ts.map +1 -1
  199. package/dist/tui/useCommand.js +77 -165
  200. package/dist/tui/useCommand.js.map +1 -1
  201. package/dist/tui/useNotifications.d.ts +9 -0
  202. package/dist/tui/useNotifications.d.ts.map +1 -0
  203. package/dist/tui/useNotifications.js +14 -0
  204. package/dist/tui/useNotifications.js.map +1 -0
  205. package/dist/tui/useScroll.js +9 -12
  206. package/dist/tui/useScroll.js.map +1 -1
  207. package/dist/ui/banner.d.ts +12 -0
  208. package/dist/ui/banner.d.ts.map +1 -1
  209. package/dist/ui/banner.js +35 -19
  210. package/dist/ui/banner.js.map +1 -1
  211. package/dist/ui/colors.js +13 -19
  212. package/dist/ui/colors.js.map +1 -1
  213. package/dist/ui/format.js +6 -14
  214. package/dist/ui/format.js.map +1 -1
  215. package/dist/ui/spinner.js +6 -12
  216. package/dist/ui/spinner.js.map +1 -1
  217. package/dist/ui/tree.js +3 -6
  218. package/dist/ui/tree.js.map +1 -1
  219. package/dist/utils/format.js +27 -41
  220. package/dist/utils/format.js.map +1 -1
  221. package/dist/utils/hash.js +4 -42
  222. package/dist/utils/hash.js.map +1 -1
  223. package/dist/utils/time.js +2 -6
  224. package/dist/utils/time.js.map +1 -1
  225. package/dist/wallet-router.d.ts +1 -1
  226. package/dist/wallet-router.d.ts.map +1 -1
  227. package/dist/wallet-router.js +12 -19
  228. package/dist/wallet-router.js.map +1 -1
  229. package/dist/walletconnect-session.d.ts +1 -1
  230. package/dist/walletconnect-session.d.ts.map +1 -1
  231. package/dist/walletconnect-session.js +6 -11
  232. package/dist/walletconnect-session.js.map +1 -1
  233. package/dist/walletconnect.d.ts +6 -1
  234. package/dist/walletconnect.d.ts.map +1 -1
  235. package/dist/walletconnect.js +32 -35
  236. package/dist/walletconnect.js.map +1 -1
  237. package/package.json +7 -6
  238. package/src/bundler.ts +1 -1
  239. package/src/client.ts +1 -1
  240. package/src/commands/accept.ts +7 -7
  241. package/src/commands/agent-handshake.ts +4 -4
  242. package/src/commands/agent.ts +9 -9
  243. package/src/commands/agreements.ts +8 -8
  244. package/src/commands/arbitrator.ts +5 -5
  245. package/src/commands/arena-handshake.ts +6 -6
  246. package/src/commands/arena.ts +2 -2
  247. package/src/commands/backup.ts +1 -1
  248. package/src/commands/cancel.ts +6 -6
  249. package/src/commands/channel.ts +6 -6
  250. package/src/commands/coldstart.ts +5 -5
  251. package/src/commands/config.ts +2 -2
  252. package/src/commands/contract-interaction.ts +2 -2
  253. package/src/commands/daemon.ts +14 -11
  254. package/src/commands/deliver.ts +9 -9
  255. package/src/commands/discover.ts +5 -5
  256. package/src/commands/dispute.ts +7 -7
  257. package/src/commands/doctor.ts +2 -2
  258. package/src/commands/endpoint.ts +6 -6
  259. package/src/commands/feed.ts +1 -1
  260. package/src/commands/hire.ts +10 -10
  261. package/src/commands/migrate.ts +7 -7
  262. package/src/commands/negotiate.ts +6 -5
  263. package/src/commands/openshell.ts +4 -4
  264. package/src/commands/owner.ts +5 -5
  265. package/src/commands/policy.ts +5 -5
  266. package/src/commands/relay.ts +5 -1
  267. package/src/commands/remediate.ts +5 -5
  268. package/src/commands/reputation.ts +6 -6
  269. package/src/commands/setup.ts +1 -1
  270. package/src/commands/trust.ts +6 -6
  271. package/src/commands/verify.ts +6 -6
  272. package/src/commands/wallet.ts +15 -15
  273. package/src/commands/watch.ts +3 -3
  274. package/src/commands/watchtower.ts +6 -6
  275. package/src/commands/workroom.ts +14 -10
  276. package/src/daemon/config.ts +2 -1
  277. package/src/daemon/hire-listener.ts +3 -3
  278. package/src/daemon/index.ts +10 -9
  279. package/src/daemon/job-lifecycle.ts +1 -1
  280. package/src/daemon/notify.ts +4 -4
  281. package/src/daemon/userops.ts +4 -4
  282. package/src/daemon/wallet-monitor.ts +2 -2
  283. package/src/endpoint-notify.ts +1 -1
  284. package/src/index.ts +8 -7
  285. package/src/openshell-runtime.ts +5 -1
  286. package/src/program.ts +36 -36
  287. package/src/repl.ts +3 -3
  288. package/src/tui/App.tsx +75 -52
  289. package/src/tui/Header.tsx +26 -12
  290. package/src/tui/InputLine.tsx +108 -33
  291. package/src/tui/Viewport.tsx +22 -18
  292. package/src/tui/WalletConnectPairing.tsx +131 -0
  293. package/src/tui/components/Button.tsx +38 -0
  294. package/src/tui/components/CeremonyView.tsx +39 -0
  295. package/src/tui/components/CompletionDropdown.tsx +59 -0
  296. package/src/tui/components/ConfirmPrompt.tsx +36 -0
  297. package/src/tui/components/InteractiveTable.tsx +112 -0
  298. package/src/tui/components/StepSpinner.tsx +84 -0
  299. package/src/tui/components/Toast.tsx +59 -0
  300. package/src/tui/index.tsx +27 -9
  301. package/src/tui/useChat.ts +1 -1
  302. package/src/tui/useCommand.ts +86 -183
  303. package/src/tui/useNotifications.ts +28 -0
  304. package/src/ui/banner.ts +29 -2
  305. package/src/ui/tree.ts +1 -1
  306. package/src/wallet-router.ts +2 -2
  307. package/src/walletconnect-session.ts +1 -1
  308. package/src/walletconnect.ts +20 -5
  309. package/tsconfig.json +16 -7
@@ -1,11 +1,11 @@
1
1
  import { Command } from "commander";
2
2
  import { ServiceAgreementClient } from "@arc402/sdk";
3
- import { loadConfig } from "../config";
4
- import { requireSigner } from "../client";
5
- import { printSenderInfo, executeContractWriteViaWallet } from "../wallet-router";
6
- import { SERVICE_AGREEMENT_ABI } from "../abis";
7
- import { c } from "../ui/colors";
8
- import { startSpinner } from "../ui/spinner";
3
+ import { loadConfig } from "../config.js";
4
+ import { requireSigner } from "../client.js";
5
+ import { printSenderInfo, executeContractWriteViaWallet } from "../wallet-router.js";
6
+ import { SERVICE_AGREEMENT_ABI } from "../abis.js";
7
+ import { c } from "../ui/colors.js";
8
+ import { startSpinner } from "../ui/spinner.js";
9
9
 
10
10
  export function registerCancelCommand(program: Command): void {
11
11
  program.command("cancel <id>").description("Cancel a proposed agreement; use --expired for post-deadline recovery paths").option("--expired", "Call expiredCancel()", false).action(async (id, opts) => {
@@ -1,15 +1,15 @@
1
1
  import { Command } from "commander";
2
- import { loadConfig } from "../config";
3
- import { requireSigner, getClient } from "../client";
2
+ import { loadConfig } from "../config.js";
3
+ import { requireSigner, getClient } from "../client.js";
4
4
  import { ChannelClient } from "@arc402/sdk";
5
5
  import type { ChannelState } from "@arc402/sdk";
6
6
  import * as fs from "fs";
7
7
  import * as path from "path";
8
8
  import * as os from "os";
9
- import { c } from '../ui/colors';
10
- import { startSpinner } from '../ui/spinner';
11
- import { renderTree } from '../ui/tree';
12
- import { formatAddress } from '../ui/format';
9
+ import { c } from '../ui/colors.js';
10
+ import { startSpinner } from '../ui/spinner.js';
11
+ import { renderTree } from '../ui/tree.js';
12
+ import { formatAddress } from '../ui/format.js';
13
13
 
14
14
  const CHANNEL_STATES_DIR = path.join(os.homedir(), ".arc402", "channel-states");
15
15
 
@@ -1,10 +1,10 @@
1
1
  import { Command } from "commander";
2
2
  import { ethers } from "ethers";
3
- import { loadConfig } from "../config";
4
- import { getClient, requireSigner } from "../client";
5
- import { c } from '../ui/colors';
6
- import { startSpinner } from '../ui/spinner';
7
- import { renderTree } from '../ui/tree';
3
+ import { loadConfig } from "../config.js";
4
+ import { getClient, requireSigner } from "../client.js";
5
+ import { c } from '../ui/colors.js';
6
+ import { startSpinner } from '../ui/spinner.js';
7
+ import { renderTree } from '../ui/tree.js';
8
8
 
9
9
  const VOUCHING_REGISTRY_ABI = [
10
10
  "function vouch(address newAgent, uint256 stakeAmount) external payable",
@@ -1,8 +1,8 @@
1
1
  import { Command } from "commander";
2
2
  import prompts from "prompts";
3
3
  import chalk from "chalk";
4
- import { Arc402Config, NETWORK_DEFAULTS, configExists, loadConfig, saveConfig, getSubdomainApi, getWcProjectId } from "../config";
5
- import { c } from '../ui/colors';
4
+ import { Arc402Config, NETWORK_DEFAULTS, configExists, loadConfig, saveConfig, getSubdomainApi, getWcProjectId } from "../config.js";
5
+ import { c } from '../ui/colors.js';
6
6
 
7
7
  export function registerConfigCommands(program: Command): void {
8
8
  const config = program.command("config").description("Manage ARC-402 CLI configuration");
@@ -1,7 +1,7 @@
1
1
  import { Command } from "commander";
2
2
  import { ethers } from "ethers";
3
- import { loadConfig } from "../config";
4
- import { requireSigner } from "../client";
3
+ import { loadConfig } from "../config.js";
4
+ import { requireSigner } from "../client.js";
5
5
  import { ContractInteractionClient, IntentPayload } from "@arc402/sdk";
6
6
 
7
7
  export function registerContractInteractionCommands(program: Command): void {
@@ -6,12 +6,12 @@ import * as os from "os";
6
6
  import { spawn, spawnSync } from "child_process";
7
7
  import { ethers } from "ethers";
8
8
  import prompts from "prompts";
9
- import { loadConfig } from "../config";
10
- import { requireSigner } from "../client";
11
- import { startSpinner } from "../ui/spinner";
12
- import { renderTree } from "../ui/tree";
13
- import { c } from "../ui/colors";
14
- import { SERVICE_AGREEMENT_ABI } from "../abis";
9
+ import { loadConfig } from "../config.js";
10
+ import { requireSigner } from "../client.js";
11
+ import { startSpinner } from "../ui/spinner.js";
12
+ import { renderTree } from "../ui/tree.js";
13
+ import { c } from "../ui/colors.js";
14
+ import { SERVICE_AGREEMENT_ABI } from "../abis.js";
15
15
  import {
16
16
  DAEMON_DIR,
17
17
  DAEMON_PID,
@@ -20,8 +20,8 @@ import {
20
20
  DAEMON_TOML,
21
21
  TEMPLATE_DAEMON_TOML,
22
22
  loadDaemonConfig,
23
- } from "../daemon/config";
24
- import { buildNotifier } from "../daemon/notify";
23
+ } from "../daemon/config.js";
24
+ import { buildNotifier } from "../daemon/notify.js";
25
25
  import {
26
26
  buildOpenShellSecretExports,
27
27
  buildOpenShellSshConfig,
@@ -31,7 +31,11 @@ import {
31
31
  readOpenShellConfig,
32
32
  runCmd,
33
33
  writeOpenShellConfig,
34
- } from "../openshell-runtime";
34
+ } from "../openshell-runtime.js";
35
+
36
+ import { fileURLToPath } from "node:url";
37
+ const __filename = fileURLToPath(import.meta.url);
38
+ const __dirname = path.dirname(__filename);
35
39
 
36
40
  // ─── Constants ────────────────────────────────────────────────────────────────
37
41
 
@@ -556,8 +560,7 @@ export function registerDaemonCommands(program: Command): void {
556
560
  process.exit(result.status ?? 0);
557
561
  } else {
558
562
  // Foreground mode without sandbox: import and run directly (blocking)
559
- // eslint-disable-next-line @typescript-eslint/no-var-requires
560
- const { runDaemon } = require("../daemon/index") as { runDaemon: (fg: boolean) => Promise<void> };
563
+ const { runDaemon } = await import("../daemon/index.js");
561
564
  await runDaemon(true);
562
565
  }
563
566
  return;
@@ -1,17 +1,17 @@
1
1
  import { Command } from "commander";
2
2
  import { ServiceAgreementClient, uploadEncryptedIPFS } from "@arc402/sdk";
3
3
  import { ethers } from "ethers";
4
- import { loadConfig } from "../config";
5
- import { getClient, requireSigner } from "../client";
6
- import { hashFile, hashString } from "../utils/hash";
7
- import { printSenderInfo, executeContractWriteViaWallet } from "../wallet-router";
8
- import { SERVICE_AGREEMENT_ABI } from "../abis";
4
+ import { loadConfig } from "../config.js";
5
+ import { getClient, requireSigner } from "../client.js";
6
+ import { hashFile, hashString } from "../utils/hash.js";
7
+ import { printSenderInfo, executeContractWriteViaWallet } from "../wallet-router.js";
8
+ import { SERVICE_AGREEMENT_ABI } from "../abis.js";
9
9
  import { readFile } from "fs/promises";
10
10
  import prompts from "prompts";
11
- import { resolveAgentEndpoint, notifyAgent, DEFAULT_REGISTRY_ADDRESS } from "../endpoint-notify";
12
- import { c } from '../ui/colors';
13
- import { startSpinner } from '../ui/spinner';
14
- import { renderTree } from '../ui/tree';
11
+ import { resolveAgentEndpoint, notifyAgent, DEFAULT_REGISTRY_ADDRESS } from "../endpoint-notify.js";
12
+ import { c } from '../ui/colors.js';
13
+ import { startSpinner } from '../ui/spinner.js';
14
+ import { renderTree } from '../ui/tree.js';
15
15
 
16
16
  export function registerDeliverCommand(program: Command): void {
17
17
  program
@@ -1,11 +1,11 @@
1
1
  import { Command } from "commander";
2
2
  import { ethers } from "ethers";
3
3
  import { AgentRegistryClient, CapabilityRegistryClient, ReputationOracleClient, SponsorshipAttestationClient } from "@arc402/sdk";
4
- import { loadConfig } from "../config";
5
- import { getClient } from "../client";
6
- import { getTrustTier, printTable, truncateAddress } from "../utils/format";
7
- import { c } from '../ui/colors';
8
- import { renderTree } from '../ui/tree';
4
+ import { loadConfig } from "../config.js";
5
+ import { getClient } from "../client.js";
6
+ import { getTrustTier, printTable, truncateAddress } from "../utils/format.js";
7
+ import { c } from '../ui/colors.js';
8
+ import { renderTree } from '../ui/tree.js';
9
9
 
10
10
  // Minimal ABI for the new getAgentsWithCapability function (Spec 18)
11
11
  const CAPABILITY_REGISTRY_EXTRA_ABI = [
@@ -2,13 +2,13 @@ import { Command } from "commander";
2
2
  import { ethers } from "ethers";
3
3
  import prompts from "prompts";
4
4
  import { ArbitrationVote, DirectDisputeReason, DisputeClass, DisputeMode, DisputeOutcome, EvidenceType, ServiceAgreementClient, DisputeArbitrationClient } from "@arc402/sdk";
5
- import { loadConfig } from "../config";
6
- import { getClient, requireSigner } from "../client";
7
- import { hashFile, hashString } from "../utils/hash";
8
- import { printSenderInfo, executeContractWriteViaWallet } from "../wallet-router";
9
- import { SERVICE_AGREEMENT_ABI } from "../abis";
10
- import { c } from '../ui/colors';
11
- import { startSpinner } from '../ui/spinner';
5
+ import { loadConfig } from "../config.js";
6
+ import { getClient, requireSigner } from "../client.js";
7
+ import { hashFile, hashString } from "../utils/hash.js";
8
+ import { printSenderInfo, executeContractWriteViaWallet } from "../wallet-router.js";
9
+ import { SERVICE_AGREEMENT_ABI } from "../abis.js";
10
+ import { c } from '../ui/colors.js';
11
+ import { startSpinner } from '../ui/spinner.js';
12
12
 
13
13
  export function registerDisputeCommand(program: Command): void {
14
14
  const dispute = program.command("dispute").description("Formal dispute workflow; remediation-first by default, with narrow hard-fail direct-dispute exceptions");
@@ -4,8 +4,8 @@ import * as fs from "fs";
4
4
  import * as path from "path";
5
5
  import * as os from "os";
6
6
  import { spawnSync } from "child_process";
7
- import { configExists, loadConfig } from "../config";
8
- import { c } from "../ui/colors";
7
+ import { configExists, loadConfig } from "../config.js";
8
+ import { c } from "../ui/colors.js";
9
9
 
10
10
  const ARC402_DIR = path.join(os.homedir(), ".arc402");
11
11
  const CONFIG_PATH = path.join(ARC402_DIR, "config.json");
@@ -8,16 +8,16 @@ import {
8
8
  loadEndpointConfig,
9
9
  normalizeAgentName,
10
10
  saveEndpointConfig,
11
- } from "../endpoint-config";
12
- import { configExists, getSubdomainApi, loadConfig, NETWORK_DEFAULTS } from "../config";
13
- import { DAEMON_PID } from "../daemon/config";
14
- import { detectDockerAccess, readOpenShellConfig, runCmd } from "../openshell-runtime";
15
- import { getClient } from "../client";
11
+ } from "../endpoint-config.js";
12
+ import { configExists, getSubdomainApi, loadConfig, NETWORK_DEFAULTS } from "../config.js";
13
+ import { DAEMON_PID } from "../daemon/config.js";
14
+ import { detectDockerAccess, readOpenShellConfig, runCmd } from "../openshell-runtime.js";
15
+ import { getClient } from "../client.js";
16
16
  import * as dns from "dns/promises";
17
17
  import * as fs from "fs";
18
18
  import * as net from "net";
19
19
  import chalk from "chalk";
20
- import { c } from '../ui/colors';
20
+ import { c } from '../ui/colors.js';
21
21
 
22
22
  interface DoctorCheck {
23
23
  layer: string;
@@ -1,6 +1,6 @@
1
1
  import { Command } from "commander";
2
2
  import chalk from "chalk";
3
- import { c } from '../ui/colors';
3
+ import { c } from '../ui/colors.js';
4
4
 
5
5
  const SUBGRAPH_URL = "https://api.studio.thegraph.com/query/1744310/arc-402/v0.2.0";
6
6
 
@@ -1,16 +1,16 @@
1
1
  import { Command } from "commander";
2
2
  import { ServiceAgreementClient, SessionManager } from "@arc402/sdk";
3
3
  import { ethers } from "ethers";
4
- import { getUsdcAddress, loadConfig } from "../config";
5
- import { requireSigner } from "../client";
6
- import { hashFile, hashString } from "../utils/hash";
7
- import { parseDuration } from "../utils/time";
8
- import { printSenderInfo, executeContractWriteViaWallet } from "../wallet-router";
9
- import { AGENT_REGISTRY_ABI, SERVICE_AGREEMENT_ABI } from "../abis";
10
- import { c } from '../ui/colors';
11
- import { startSpinner } from '../ui/spinner';
12
- import { renderTree, TreeItem } from '../ui/tree';
13
- import { formatAddress } from '../ui/format';
4
+ import { getUsdcAddress, loadConfig } from "../config.js";
5
+ import { requireSigner } from "../client.js";
6
+ import { hashFile, hashString } from "../utils/hash.js";
7
+ import { parseDuration } from "../utils/time.js";
8
+ import { printSenderInfo, executeContractWriteViaWallet } from "../wallet-router.js";
9
+ import { AGENT_REGISTRY_ABI, SERVICE_AGREEMENT_ABI } from "../abis.js";
10
+ import { c } from '../ui/colors.js';
11
+ import { startSpinner } from '../ui/spinner.js';
12
+ import { renderTree, TreeItem } from '../ui/tree.js';
13
+ import { formatAddress } from '../ui/format.js';
14
14
 
15
15
  const DEFAULT_REGISTRY_ADDRESS = "0xD5c2851B00090c92Ba7F4723FB548bb30C9B6865";
16
16
 
@@ -1,11 +1,11 @@
1
1
  import { Command } from "commander";
2
2
  import { ethers } from "ethers";
3
- import { loadConfig } from "../config";
4
- import { getClient, requireSigner } from "../client";
5
- import { c } from '../ui/colors';
6
- import { startSpinner } from '../ui/spinner';
7
- import { renderTree } from '../ui/tree';
8
- import { formatAddress } from '../ui/format';
3
+ import { loadConfig } from "../config.js";
4
+ import { getClient, requireSigner } from "../client.js";
5
+ import { c } from '../ui/colors.js';
6
+ import { startSpinner } from '../ui/spinner.js';
7
+ import { renderTree } from '../ui/tree.js';
8
+ import { formatAddress } from '../ui/format.js';
9
9
 
10
10
  const MIGRATION_REGISTRY_ABI = [
11
11
  "function registerMigration(address oldWallet, address newWallet) external",
@@ -91,7 +91,7 @@ export function registerMigrateCommands(program: Command): void {
91
91
  migratedFrom: wasSource ? migratedFrom : null,
92
92
  };
93
93
  if (opts.json) return console.log(JSON.stringify(payload, null, 2));
94
- const statusItems: import('../ui/tree').TreeItem[] = [
94
+ const statusItems: import('../ui/tree.js').TreeItem[] = [
95
95
  { label: 'Address', value: formatAddress(address) },
96
96
  { label: 'Active', value: formatAddress(activeWallet) },
97
97
  { label: 'Status', value: isCurrent ? 'current (no further migration)' : `migrated — resolves to ${formatAddress(activeWallet)}` },
@@ -1,4 +1,5 @@
1
1
  import { Command } from "commander";
2
+ import * as fs from "node:fs";
2
3
  import { ethers } from "ethers";
3
4
  import {
4
5
  createSignedProposal,
@@ -8,10 +9,10 @@ import {
8
9
  NegotiationGuard,
9
10
  SessionManager,
10
11
  } from "@arc402/sdk";
11
- import { loadConfig } from "../config";
12
- import { requireSigner, getClient } from "../client";
13
- import { hashFile, hashString } from "../utils/hash";
14
- import { c } from '../ui/colors';
12
+ import { loadConfig } from "../config.js";
13
+ import { requireSigner, getClient } from "../client.js";
14
+ import { hashFile, hashString } from "../utils/hash.js";
15
+ import { c } from '../ui/colors.js';
15
16
 
16
17
  const sessionManager = new SessionManager();
17
18
 
@@ -232,7 +233,7 @@ export function registerNegotiateCommands(program: Command): void {
232
233
  const guard = new NegotiationGuard({ agentRegistryAddress: config.agentRegistryAddress, runner: provider });
233
234
 
234
235
  const rawJson = opts.message.startsWith("@")
235
- ? require("fs").readFileSync(opts.message.slice(1), "utf8")
236
+ ? fs.readFileSync(opts.message.slice(1), "utf8")
236
237
  : opts.message;
237
238
 
238
239
  const result = await guard.verify(rawJson);
@@ -3,8 +3,8 @@ import * as fs from "fs";
3
3
  import * as path from "path";
4
4
  import * as os from "os";
5
5
  import * as YAML from "yaml";
6
- import { c } from '../ui/colors';
7
- import { startSpinner } from '../ui/spinner';
6
+ import { c } from '../ui/colors.js';
7
+ import { startSpinner } from '../ui/spinner.js';
8
8
  import {
9
9
  ARC402_DIR,
10
10
  DEFAULT_RUNTIME_REMOTE_ROOT,
@@ -16,8 +16,8 @@ import {
16
16
  resolveOpenShellSecrets,
17
17
  runCmd,
18
18
  writeOpenShellConfig,
19
- } from "../openshell-runtime";
20
- import { DAEMON_PID, DAEMON_LOG, DAEMON_TOML } from "../daemon/config";
19
+ } from "../openshell-runtime.js";
20
+ import { DAEMON_PID, DAEMON_LOG, DAEMON_TOML } from "../daemon/config.js";
21
21
 
22
22
  // ─── Constants ────────────────────────────────────────────────────────────────
23
23
 
@@ -1,10 +1,10 @@
1
1
  import { Command } from "commander";
2
2
  import { DisputeArbitrationClient } from "@arc402/sdk";
3
- import { loadConfig } from "../config";
4
- import { requireSigner } from "../client";
5
- import { c } from '../ui/colors';
6
- import { startSpinner } from '../ui/spinner';
7
- import { formatAddress } from '../ui/format';
3
+ import { loadConfig } from "../config.js";
4
+ import { requireSigner } from "../client.js";
5
+ import { c } from '../ui/colors.js';
6
+ import { startSpinner } from '../ui/spinner.js';
7
+ import { formatAddress } from '../ui/format.js';
8
8
 
9
9
  export function registerOwnerCommands(program: Command): void {
10
10
  const owner = program.command("owner").description("Protocol ownership management (DisputeArbitration two-step transfer)");
@@ -1,10 +1,10 @@
1
1
  import { Command } from "commander";
2
2
  import { ethers } from "ethers";
3
- import { loadConfig } from "../config";
4
- import { getClient, requireSigner } from "../client";
5
- import { c } from '../ui/colors';
6
- import { startSpinner } from '../ui/spinner';
7
- import { formatAddress } from '../ui/format';
3
+ import { loadConfig } from "../config.js";
4
+ import { getClient, requireSigner } from "../client.js";
5
+ import { c } from '../ui/colors.js';
6
+ import { startSpinner } from '../ui/spinner.js';
7
+ import { formatAddress } from '../ui/format.js';
8
8
 
9
9
  const POLICY_ENGINE_EXTENDED_ABI = [
10
10
  "function addToBlocklist(address wallet, address provider) external",
@@ -5,7 +5,11 @@ import * as os from "os";
5
5
  import * as http from "http";
6
6
  import * as https from "https";
7
7
  import { spawn } from "child_process";
8
- import { c } from '../ui/colors';
8
+ import { c } from '../ui/colors.js';
9
+
10
+ import { fileURLToPath } from "node:url";
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = path.dirname(__filename);
9
13
 
10
14
  const PID_FILE = path.join(os.homedir(), ".arc402", "relay.pid");
11
15
 
@@ -1,10 +1,10 @@
1
1
  import { Command } from "commander";
2
2
  import { ProviderResponseType, ServiceAgreementClient } from "@arc402/sdk";
3
- import { loadConfig } from "../config";
4
- import { getClient, requireSigner } from "../client";
5
- import { hashFile, hashString } from "../utils/hash";
6
- import { c } from '../ui/colors';
7
- import { startSpinner } from '../ui/spinner';
3
+ import { loadConfig } from "../config.js";
4
+ import { getClient, requireSigner } from "../client.js";
5
+ import { hashFile, hashString } from "../utils/hash.js";
6
+ import { c } from '../ui/colors.js';
7
+ import { startSpinner } from '../ui/spinner.js';
8
8
 
9
9
  export function registerRemediateCommands(program: Command): void {
10
10
  const remediate = program.command("remediate").description("Negotiated remediation before formal dispute");
@@ -1,12 +1,12 @@
1
1
  import { Command } from "commander";
2
2
  import { ReputationOracleClient, ReputationSignalType } from "@arc402/sdk";
3
3
  import { ethers } from "ethers";
4
- import { loadConfig } from "../config";
5
- import { getClient, requireSigner } from "../client";
6
- import { c } from '../ui/colors';
7
- import { startSpinner } from '../ui/spinner';
8
- import { renderTree } from '../ui/tree';
9
- import { formatAddress } from '../ui/format';
4
+ import { loadConfig } from "../config.js";
5
+ import { getClient, requireSigner } from "../client.js";
6
+ import { c } from '../ui/colors.js';
7
+ import { startSpinner } from '../ui/spinner.js';
8
+ import { renderTree } from '../ui/tree.js';
9
+ import { formatAddress } from '../ui/format.js';
10
10
 
11
11
  const reputation = new Command("reputation").description("Network-wide reputation signals");
12
12
 
@@ -3,7 +3,7 @@ import * as net from "net";
3
3
  import { execSync, spawn } from "child_process";
4
4
  import chalk from "chalk";
5
5
  import prompts from "prompts";
6
- import { configExists, loadConfig, getSubdomainApi } from "../config";
6
+ import { configExists, loadConfig, getSubdomainApi } from "../config.js";
7
7
 
8
8
  const DAEMON_PORT = 4402;
9
9
 
@@ -1,11 +1,11 @@
1
1
  import { Command } from "commander";
2
2
  import { ReputationOracleClient, SponsorshipAttestationClient, TrustClient } from "@arc402/sdk";
3
- import { loadConfig } from "../config";
4
- import { getClient } from "../client";
5
- import { getTrustTier, identityTierLabel } from "../utils/format";
6
- import { c } from '../ui/colors';
7
- import { renderTree } from '../ui/tree';
8
- import { formatAddress } from '../ui/format';
3
+ import { loadConfig } from "../config.js";
4
+ import { getClient } from "../client.js";
5
+ import { getTrustTier, identityTierLabel } from "../utils/format.js";
6
+ import { c } from '../ui/colors.js';
7
+ import { renderTree } from '../ui/tree.js';
8
+ import { formatAddress } from '../ui/format.js';
9
9
 
10
10
  export function registerTrustCommand(program: Command): void {
11
11
  program.command("trust <address>").description("Look up trust plus secondary sponsorship/reputation signals for an address").option("--json").action(async (address, opts) => {
@@ -1,12 +1,12 @@
1
1
  import { Command } from "commander";
2
2
  import { ServiceAgreementClient } from "@arc402/sdk";
3
3
  import { ethers } from "ethers";
4
- import { loadConfig } from "../config";
5
- import { getClient, requireSigner } from "../client";
6
- import { printSenderInfo, executeContractWriteViaWallet } from "../wallet-router";
7
- import { SERVICE_AGREEMENT_ABI } from "../abis";
8
- import { c } from '../ui/colors';
9
- import { startSpinner } from '../ui/spinner';
4
+ import { loadConfig } from "../config.js";
5
+ import { getClient, requireSigner } from "../client.js";
6
+ import { printSenderInfo, executeContractWriteViaWallet } from "../wallet-router.js";
7
+ import { SERVICE_AGREEMENT_ABI } from "../abis.js";
8
+ import { c } from '../ui/colors.js';
9
+ import { startSpinner } from '../ui/spinner.js';
10
10
 
11
11
  // Agreement status values from the contract
12
12
  const AGREEMENT_STATUS_NAMES: Record<number, string> = {
@@ -6,21 +6,21 @@ import fs from "fs";
6
6
  import path from "path";
7
7
  import os from "os";
8
8
  import { spawnSync } from "child_process";
9
- import { Arc402Config, getConfigPath, getUsdcAddress, loadConfig, NETWORK_DEFAULTS, saveConfig } from "../config";
10
- import { getClient, requireSigner } from "../client";
11
- import { getTrustTier } from "../utils/format";
12
- import { AGENT_REGISTRY_ABI, ARC402_WALLET_EXECUTE_ABI, ARC402_WALLET_GUARDIAN_ABI, ARC402_WALLET_MACHINE_KEY_ABI, ARC402_WALLET_OWNER_ABI, ARC402_WALLET_PASSKEY_ABI, ARC402_WALLET_PROTOCOL_ABI, ARC402_WALLET_REGISTRY_ABI, POLICY_ENGINE_GOVERNANCE_ABI, POLICY_ENGINE_LIMITS_ABI, TRUST_REGISTRY_ABI, WALLET_FACTORY_ABI } from "../abis";
13
- import { warnIfPublicRpc } from "../config";
14
- import { connectPhoneWallet, sendTransactionWithSession, requestPhoneWalletSignature } from "../walletconnect";
15
- import { BundlerClient, buildSponsoredUserOp, PaymasterClient, DEFAULT_ENTRY_POINT } from "../bundler";
16
- import { clearWCSession } from "../walletconnect-session";
17
- import { handleWalletError } from "../wallet-router";
18
- import { requestCoinbaseSmartWalletSignature } from "../coinbase-smart-wallet";
19
- import { sendTelegramMessage } from "../telegram-notify";
20
- import { renderTree } from "../ui/tree";
21
- import { startSpinner } from "../ui/spinner";
22
- import { c } from "../ui/colors";
23
- import { formatAddress } from "../ui/format";
9
+ import { Arc402Config, getConfigPath, getUsdcAddress, loadConfig, NETWORK_DEFAULTS, saveConfig } from "../config.js";
10
+ import { getClient, requireSigner } from "../client.js";
11
+ import { getTrustTier } from "../utils/format.js";
12
+ import { AGENT_REGISTRY_ABI, ARC402_WALLET_EXECUTE_ABI, ARC402_WALLET_GUARDIAN_ABI, ARC402_WALLET_MACHINE_KEY_ABI, ARC402_WALLET_OWNER_ABI, ARC402_WALLET_PASSKEY_ABI, ARC402_WALLET_PROTOCOL_ABI, ARC402_WALLET_REGISTRY_ABI, POLICY_ENGINE_GOVERNANCE_ABI, POLICY_ENGINE_LIMITS_ABI, TRUST_REGISTRY_ABI, WALLET_FACTORY_ABI } from "../abis.js";
13
+ import { warnIfPublicRpc } from "../config.js";
14
+ import { connectPhoneWallet, sendTransactionWithSession, requestPhoneWalletSignature } from "../walletconnect.js";
15
+ import { BundlerClient, buildSponsoredUserOp, PaymasterClient, DEFAULT_ENTRY_POINT } from "../bundler.js";
16
+ import { clearWCSession } from "../walletconnect-session.js";
17
+ import { handleWalletError } from "../wallet-router.js";
18
+ import { requestCoinbaseSmartWalletSignature } from "../coinbase-smart-wallet.js";
19
+ import { sendTelegramMessage } from "../telegram-notify.js";
20
+ import { renderTree } from "../ui/tree.js";
21
+ import { startSpinner } from "../ui/spinner.js";
22
+ import { c } from "../ui/colors.js";
23
+ import { formatAddress } from "../ui/format.js";
24
24
 
25
25
  const POLICY_ENGINE_DEFAULT = "0x44102e70c2A366632d98Fe40d892a2501fC7fFF2";
26
26
  const GUARDIAN_KEY_PATH = path.join(os.homedir(), ".arc402", "guardian.key");
@@ -1,8 +1,8 @@
1
1
  import { Command } from "commander";
2
2
  import { ethers } from "ethers";
3
- import { loadConfig } from "../config";
4
- import { getClient } from "../client";
5
- import { c } from "../ui/colors";
3
+ import { loadConfig } from "../config.js";
4
+ import { getClient } from "../client.js";
5
+ import { c } from "../ui/colors.js";
6
6
 
7
7
  // ─── Minimal ABIs for event watching ─────────────────────────────────────────
8
8
 
@@ -2,13 +2,13 @@ import { Command } from "commander";
2
2
  import * as fs from "fs";
3
3
  import * as path from "path";
4
4
  import * as os from "os";
5
- import { loadConfig } from "../config";
6
- import { requireSigner, getClient } from "../client";
5
+ import { loadConfig } from "../config.js";
6
+ import { requireSigner, getClient } from "../client.js";
7
7
  import { WatchtowerClient, ChannelClient } from "@arc402/sdk";
8
- import { c } from '../ui/colors';
9
- import { startSpinner } from '../ui/spinner';
10
- import { renderTree } from '../ui/tree';
11
- import { formatAddress } from '../ui/format';
8
+ import { c } from '../ui/colors.js';
9
+ import { startSpinner } from '../ui/spinner.js';
10
+ import { renderTree } from '../ui/tree.js';
11
+ import { formatAddress } from '../ui/format.js';
12
12
 
13
13
  const CHANNEL_STATES_DIR = path.join(os.homedir(), ".arc402", "channel-states");
14
14