arc402-cli 0.7.5 → 0.8.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 (264) hide show
  1. package/MIGRATION-SPEC.md +108 -0
  2. package/dist/abis.js +14 -17
  3. package/dist/abis.js.map +1 -1
  4. package/dist/bundler.d.ts +1 -1
  5. package/dist/bundler.d.ts.map +1 -1
  6. package/dist/bundler.js +27 -61
  7. package/dist/bundler.js.map +1 -1
  8. package/dist/client.d.ts +1 -1
  9. package/dist/client.d.ts.map +1 -1
  10. package/dist/client.js +5 -9
  11. package/dist/client.js.map +1 -1
  12. package/dist/coinbase-smart-wallet.js +1 -4
  13. package/dist/coinbase-smart-wallet.js.map +1 -1
  14. package/dist/commands/accept.js +25 -28
  15. package/dist/commands/accept.js.map +1 -1
  16. package/dist/commands/agent-handshake.js +15 -18
  17. package/dist/commands/agent-handshake.js.map +1 -1
  18. package/dist/commands/agent.js +98 -104
  19. package/dist/commands/agent.js.map +1 -1
  20. package/dist/commands/agreements.js +62 -98
  21. package/dist/commands/agreements.js.map +1 -1
  22. package/dist/commands/arbitrator.js +45 -81
  23. package/dist/commands/arbitrator.js.map +1 -1
  24. package/dist/commands/arena-handshake.js +27 -30
  25. package/dist/commands/arena-handshake.js.map +1 -1
  26. package/dist/commands/arena.js +12 -18
  27. package/dist/commands/arena.js.map +1 -1
  28. package/dist/commands/backup.js +30 -36
  29. package/dist/commands/backup.js.map +1 -1
  30. package/dist/commands/cancel.js +15 -18
  31. package/dist/commands/cancel.js.map +1 -1
  32. package/dist/commands/channel.js +45 -81
  33. package/dist/commands/channel.js.map +1 -1
  34. package/dist/commands/coldstart.js +31 -34
  35. package/dist/commands/coldstart.js.map +1 -1
  36. package/dist/commands/config.js +23 -29
  37. package/dist/commands/config.js.map +1 -1
  38. package/dist/commands/contract-interaction.js +12 -15
  39. package/dist/commands/contract-interaction.js.map +1 -1
  40. package/dist/commands/daemon.d.ts.map +1 -1
  41. package/dist/commands/daemon.js +98 -135
  42. package/dist/commands/daemon.js.map +1 -1
  43. package/dist/commands/deliver.js +37 -76
  44. package/dist/commands/deliver.js.map +1 -1
  45. package/dist/commands/discover.js +24 -27
  46. package/dist/commands/discover.js.map +1 -1
  47. package/dist/commands/dispute.js +104 -110
  48. package/dist/commands/dispute.js.map +1 -1
  49. package/dist/commands/doctor.js +16 -55
  50. package/dist/commands/doctor.js.map +1 -1
  51. package/dist/commands/endpoint.js +56 -95
  52. package/dist/commands/endpoint.js.map +1 -1
  53. package/dist/commands/feed.js +11 -18
  54. package/dist/commands/feed.js.map +1 -1
  55. package/dist/commands/hire.js +37 -40
  56. package/dist/commands/hire.js.map +1 -1
  57. package/dist/commands/migrate.js +30 -33
  58. package/dist/commands/migrate.js.map +1 -1
  59. package/dist/commands/negotiate.d.ts.map +1 -1
  60. package/dist/commands/negotiate.js +34 -36
  61. package/dist/commands/negotiate.js.map +1 -1
  62. package/dist/commands/openshell.js +68 -104
  63. package/dist/commands/openshell.js.map +1 -1
  64. package/dist/commands/owner.js +17 -20
  65. package/dist/commands/owner.js.map +1 -1
  66. package/dist/commands/policy.js +41 -43
  67. package/dist/commands/policy.js.map +1 -1
  68. package/dist/commands/relay.d.ts.map +1 -1
  69. package/dist/commands/relay.js +18 -51
  70. package/dist/commands/relay.js.map +1 -1
  71. package/dist/commands/remediate.js +20 -23
  72. package/dist/commands/remediate.js.map +1 -1
  73. package/dist/commands/reputation.js +25 -27
  74. package/dist/commands/reputation.js.map +1 -1
  75. package/dist/commands/setup.js +65 -104
  76. package/dist/commands/setup.js.map +1 -1
  77. package/dist/commands/trust.js +17 -20
  78. package/dist/commands/trust.js.map +1 -1
  79. package/dist/commands/verify.js +18 -21
  80. package/dist/commands/verify.js.map +1 -1
  81. package/dist/commands/wallet.js +619 -625
  82. package/dist/commands/wallet.js.map +1 -1
  83. package/dist/commands/watch.js +33 -36
  84. package/dist/commands/watch.js.map +1 -1
  85. package/dist/commands/watchtower.js +37 -73
  86. package/dist/commands/watchtower.js.map +1 -1
  87. package/dist/commands/workroom.d.ts.map +1 -1
  88. package/dist/commands/workroom.js +138 -171
  89. package/dist/commands/workroom.js.map +1 -1
  90. package/dist/config.js +21 -65
  91. package/dist/config.js.map +1 -1
  92. package/dist/daemon/config.d.ts.map +1 -1
  93. package/dist/daemon/config.js +16 -53
  94. package/dist/daemon/config.js.map +1 -1
  95. package/dist/daemon/hire-listener.d.ts +3 -3
  96. package/dist/daemon/hire-listener.d.ts.map +1 -1
  97. package/dist/daemon/hire-listener.js +13 -47
  98. package/dist/daemon/hire-listener.js.map +1 -1
  99. package/dist/daemon/index.d.ts +1 -1
  100. package/dist/daemon/index.d.ts.map +1 -1
  101. package/dist/daemon/index.js +50 -88
  102. package/dist/daemon/index.js.map +1 -1
  103. package/dist/daemon/job-lifecycle.d.ts +1 -1
  104. package/dist/daemon/job-lifecycle.d.ts.map +1 -1
  105. package/dist/daemon/job-lifecycle.js +11 -51
  106. package/dist/daemon/job-lifecycle.js.map +1 -1
  107. package/dist/daemon/notify.d.ts +1 -1
  108. package/dist/daemon/notify.d.ts.map +1 -1
  109. package/dist/daemon/notify.js +19 -53
  110. package/dist/daemon/notify.js.map +1 -1
  111. package/dist/daemon/token-metering.js +8 -47
  112. package/dist/daemon/token-metering.js.map +1 -1
  113. package/dist/daemon/userops.d.ts +2 -2
  114. package/dist/daemon/userops.d.ts.map +1 -1
  115. package/dist/daemon/userops.js +23 -27
  116. package/dist/daemon/userops.js.map +1 -1
  117. package/dist/daemon/wallet-monitor.d.ts +1 -1
  118. package/dist/daemon/wallet-monitor.d.ts.map +1 -1
  119. package/dist/daemon/wallet-monitor.js +8 -12
  120. package/dist/daemon/wallet-monitor.js.map +1 -1
  121. package/dist/drain-v4.js +26 -64
  122. package/dist/drain-v4.js.map +1 -1
  123. package/dist/endpoint-config.js +20 -63
  124. package/dist/endpoint-config.js.map +1 -1
  125. package/dist/endpoint-notify.js +9 -48
  126. package/dist/endpoint-notify.js.map +1 -1
  127. package/dist/index.js +16 -50
  128. package/dist/index.js.map +1 -1
  129. package/dist/openshell-runtime.d.ts.map +1 -1
  130. package/dist/openshell-runtime.js +38 -82
  131. package/dist/openshell-runtime.js.map +1 -1
  132. package/dist/program.d.ts.map +1 -1
  133. package/dist/program.js +77 -83
  134. package/dist/program.js.map +1 -1
  135. package/dist/repl.js +25 -31
  136. package/dist/repl.js.map +1 -1
  137. package/dist/signing.js +3 -6
  138. package/dist/signing.js.map +1 -1
  139. package/dist/telegram-notify.js +3 -40
  140. package/dist/telegram-notify.js.map +1 -1
  141. package/dist/tui/App.d.ts +1 -9
  142. package/dist/tui/App.d.ts.map +1 -1
  143. package/dist/tui/App.js +47 -65
  144. package/dist/tui/App.js.map +1 -1
  145. package/dist/tui/Footer.js +4 -7
  146. package/dist/tui/Footer.js.map +1 -1
  147. package/dist/tui/Header.d.ts +1 -2
  148. package/dist/tui/Header.d.ts.map +1 -1
  149. package/dist/tui/Header.js +8 -14
  150. package/dist/tui/Header.js.map +1 -1
  151. package/dist/tui/InputLine.js +17 -23
  152. package/dist/tui/InputLine.js.map +1 -1
  153. package/dist/tui/Viewport.d.ts +5 -4
  154. package/dist/tui/Viewport.d.ts.map +1 -1
  155. package/dist/tui/Viewport.js +20 -13
  156. package/dist/tui/Viewport.js.map +1 -1
  157. package/dist/tui/WalletConnectPairing.d.ts +23 -0
  158. package/dist/tui/WalletConnectPairing.d.ts.map +1 -0
  159. package/dist/tui/WalletConnectPairing.js +75 -0
  160. package/dist/tui/WalletConnectPairing.js.map +1 -0
  161. package/dist/tui/index.d.ts.map +1 -1
  162. package/dist/tui/index.js +14 -21
  163. package/dist/tui/index.js.map +1 -1
  164. package/dist/tui/useChat.js +13 -19
  165. package/dist/tui/useChat.js.map +1 -1
  166. package/dist/tui/useCommand.d.ts +2 -7
  167. package/dist/tui/useCommand.d.ts.map +1 -1
  168. package/dist/tui/useCommand.js +77 -165
  169. package/dist/tui/useCommand.js.map +1 -1
  170. package/dist/tui/useScroll.js +9 -12
  171. package/dist/tui/useScroll.js.map +1 -1
  172. package/dist/ui/banner.js +12 -19
  173. package/dist/ui/banner.js.map +1 -1
  174. package/dist/ui/colors.js +13 -19
  175. package/dist/ui/colors.js.map +1 -1
  176. package/dist/ui/format.js +6 -14
  177. package/dist/ui/format.js.map +1 -1
  178. package/dist/ui/spinner.js +6 -12
  179. package/dist/ui/spinner.js.map +1 -1
  180. package/dist/ui/tree.js +3 -6
  181. package/dist/ui/tree.js.map +1 -1
  182. package/dist/utils/format.js +27 -41
  183. package/dist/utils/format.js.map +1 -1
  184. package/dist/utils/hash.js +4 -42
  185. package/dist/utils/hash.js.map +1 -1
  186. package/dist/utils/time.js +2 -6
  187. package/dist/utils/time.js.map +1 -1
  188. package/dist/wallet-router.d.ts +1 -1
  189. package/dist/wallet-router.d.ts.map +1 -1
  190. package/dist/wallet-router.js +12 -19
  191. package/dist/wallet-router.js.map +1 -1
  192. package/dist/walletconnect-session.d.ts +1 -1
  193. package/dist/walletconnect-session.d.ts.map +1 -1
  194. package/dist/walletconnect-session.js +6 -11
  195. package/dist/walletconnect-session.js.map +1 -1
  196. package/dist/walletconnect.d.ts +6 -1
  197. package/dist/walletconnect.d.ts.map +1 -1
  198. package/dist/walletconnect.js +32 -35
  199. package/dist/walletconnect.js.map +1 -1
  200. package/package.json +7 -6
  201. package/src/bundler.ts +1 -1
  202. package/src/client.ts +1 -1
  203. package/src/commands/accept.ts +7 -7
  204. package/src/commands/agent-handshake.ts +4 -4
  205. package/src/commands/agent.ts +9 -9
  206. package/src/commands/agreements.ts +8 -8
  207. package/src/commands/arbitrator.ts +5 -5
  208. package/src/commands/arena-handshake.ts +6 -6
  209. package/src/commands/arena.ts +2 -2
  210. package/src/commands/backup.ts +1 -1
  211. package/src/commands/cancel.ts +6 -6
  212. package/src/commands/channel.ts +6 -6
  213. package/src/commands/coldstart.ts +5 -5
  214. package/src/commands/config.ts +2 -2
  215. package/src/commands/contract-interaction.ts +2 -2
  216. package/src/commands/daemon.ts +14 -11
  217. package/src/commands/deliver.ts +9 -9
  218. package/src/commands/discover.ts +5 -5
  219. package/src/commands/dispute.ts +7 -7
  220. package/src/commands/doctor.ts +2 -2
  221. package/src/commands/endpoint.ts +6 -6
  222. package/src/commands/feed.ts +1 -1
  223. package/src/commands/hire.ts +10 -10
  224. package/src/commands/migrate.ts +7 -7
  225. package/src/commands/negotiate.ts +6 -5
  226. package/src/commands/openshell.ts +4 -4
  227. package/src/commands/owner.ts +5 -5
  228. package/src/commands/policy.ts +5 -5
  229. package/src/commands/relay.ts +5 -1
  230. package/src/commands/remediate.ts +5 -5
  231. package/src/commands/reputation.ts +6 -6
  232. package/src/commands/setup.ts +1 -1
  233. package/src/commands/trust.ts +6 -6
  234. package/src/commands/verify.ts +6 -6
  235. package/src/commands/wallet.ts +15 -15
  236. package/src/commands/watch.ts +3 -3
  237. package/src/commands/watchtower.ts +6 -6
  238. package/src/commands/workroom.ts +14 -10
  239. package/src/daemon/config.ts +2 -1
  240. package/src/daemon/hire-listener.ts +3 -3
  241. package/src/daemon/index.ts +10 -9
  242. package/src/daemon/job-lifecycle.ts +1 -1
  243. package/src/daemon/notify.ts +4 -4
  244. package/src/daemon/userops.ts +4 -4
  245. package/src/daemon/wallet-monitor.ts +2 -2
  246. package/src/endpoint-notify.ts +1 -1
  247. package/src/index.ts +8 -7
  248. package/src/openshell-runtime.ts +5 -1
  249. package/src/program.ts +36 -36
  250. package/src/repl.ts +3 -3
  251. package/src/tui/App.tsx +26 -47
  252. package/src/tui/Header.tsx +3 -10
  253. package/src/tui/InputLine.tsx +1 -1
  254. package/src/tui/Viewport.tsx +22 -18
  255. package/src/tui/WalletConnectPairing.tsx +131 -0
  256. package/src/tui/index.tsx +7 -8
  257. package/src/tui/useChat.ts +1 -1
  258. package/src/tui/useCommand.ts +86 -183
  259. package/src/ui/banner.ts +2 -2
  260. package/src/ui/tree.ts +1 -1
  261. package/src/wallet-router.ts +2 -2
  262. package/src/walletconnect-session.ts +1 -1
  263. package/src/walletconnect.ts +20 -5
  264. package/tsconfig.json +16 -7
@@ -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
 
@@ -1,4 +1,5 @@
1
1
  import { Command } from "commander";
2
+ import * as crypto from "node:crypto";
2
3
  import * as fs from "fs";
3
4
  import * as path from "path";
4
5
  import * as os from "os";
@@ -7,12 +8,16 @@ import { spawnSync, execSync } from "child_process";
7
8
  import {
8
9
  ARC402_DIR,
9
10
  runCmd,
10
- } from "../openshell-runtime";
11
- import { DAEMON_LOG, DAEMON_TOML } from "../daemon/config";
12
- import { c } from "../ui/colors";
13
- import { startSpinner } from "../ui/spinner";
14
- import { renderTree } from "../ui/tree";
15
- import { formatAddress } from "../ui/format";
11
+ } from "../openshell-runtime.js";
12
+ import { DAEMON_LOG, DAEMON_TOML, loadDaemonConfig } from "../daemon/config.js";
13
+ import { c } from "../ui/colors.js";
14
+ import { startSpinner } from "../ui/spinner.js";
15
+ import { renderTree } from "../ui/tree.js";
16
+ import { formatAddress } from "../ui/format.js";
17
+
18
+ import { fileURLToPath } from "node:url";
19
+ const __filename = fileURLToPath(import.meta.url);
20
+ const __dirname = path.dirname(__filename);
16
21
 
17
22
  // ─── Daemon lifecycle notify ──────────────────────────────────────────────────
18
23
 
@@ -27,7 +32,6 @@ function notifyDaemonWorkroomStatus(
27
32
  let daemonPort = port;
28
33
  if (fs.existsSync(DAEMON_TOML)) {
29
34
  try {
30
- const { loadDaemonConfig } = require("../daemon/config") as typeof import("../daemon/config");
31
35
  const cfg = loadDaemonConfig();
32
36
  daemonPort = cfg.relay?.listen_port ?? port;
33
37
  } catch { /* use default */ }
@@ -101,7 +105,7 @@ function buildImage(): boolean {
101
105
  function getPolicyHash(): string {
102
106
  if (!fs.existsSync(POLICY_FILE)) return "(no policy file)";
103
107
  const content = fs.readFileSync(POLICY_FILE, "utf-8");
104
- const crypto = require("crypto");
108
+ // crypto imported at top level
105
109
  return "0x" + crypto.createHash("sha256").update(content).digest("hex").slice(0, 16);
106
110
  }
107
111
 
@@ -131,7 +135,7 @@ export function registerWorkroomCommands(program: Command): void {
131
135
  if (!fs.existsSync(POLICY_FILE)) {
132
136
  console.log(c.dim("No policy file found. Generating default..."));
133
137
  // Import and call the existing policy generator
134
- const { registerOpenShellCommands } = require("./openshell");
138
+ const { registerOpenShellCommands } = await import("./openshell.js");
135
139
  console.log(c.dim(`Policy file will be generated at: ${POLICY_FILE}`));
136
140
  console.log(c.dim("Run 'arc402 workroom policy preset core-launch' after init to apply defaults."));
137
141
  } else {
@@ -797,7 +801,7 @@ No learnings yet. Complete your first hired task to start accumulating expertise
797
801
  .command("token-usage [agreementId]")
798
802
  .description("Show token usage for a specific agreement or across all jobs.")
799
803
  .action(async (agreementId) => {
800
- const { readUsageReport, formatUsageReport } = require("../daemon/token-metering");
804
+ const { readUsageReport, formatUsageReport } = await import("../daemon/token-metering.js");
801
805
 
802
806
  if (agreementId) {
803
807
  const usage = readUsageReport(agreementId);
@@ -6,6 +6,7 @@
6
6
  import * as fs from "fs";
7
7
  import * as path from "path";
8
8
  import * as os from "os";
9
+ import { ethers } from "ethers";
9
10
  import { parse as parseToml } from "smol-toml";
10
11
 
11
12
  export const DAEMON_DIR = path.join(os.homedir(), ".arc402");
@@ -249,7 +250,7 @@ export function loadMachineKey(config: DaemonConfig): { privateKey: string; addr
249
250
  throw new Error(`Machine key not found. Set environment variable: ${envVarName}`);
250
251
  }
251
252
 
252
- const { ethers } = require("ethers") as typeof import("ethers");
253
+ // ethers imported at top level
253
254
  let address: string;
254
255
  try {
255
256
  const w = new ethers.Wallet(privateKey);