run402 4.93.2 → 4.95.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 (316) hide show
  1. package/README.md +61 -59
  2. package/cli.mjs +40 -47
  3. package/core-dist/config.js +52 -18
  4. package/core-dist/control-plane-session.js +31 -6
  5. package/core-dist/keystore.js +7 -7
  6. package/core-dist/profiles.js +9 -7
  7. package/core-dist/{allowance-auth.js → wallet-auth.js} +15 -15
  8. package/{sdk/core-dist/allowance.js → core-dist/wallet.js} +20 -20
  9. package/{sdk/core-dist/write-auth-session.js → core-dist/write-approvals.js} +19 -19
  10. package/gitvault-surface.json +2 -2
  11. package/lib/admin.mjs +6 -6
  12. package/lib/agent.mjs +20 -18
  13. package/lib/ai.mjs +5 -5
  14. package/lib/approve.mjs +81 -0
  15. package/lib/apps.mjs +12 -12
  16. package/lib/archives.mjs +371 -8
  17. package/lib/argparse.mjs +5 -5
  18. package/lib/assets.mjs +14 -14
  19. package/lib/auth.mjs +34 -34
  20. package/lib/billing.mjs +6 -6
  21. package/lib/branches.mjs +7 -7
  22. package/lib/buzz-doctor.mjs +2 -2
  23. package/lib/buzz-notifications.mjs +5 -5
  24. package/lib/buzz.mjs +3 -3
  25. package/lib/buzz.test.mjs +1 -1
  26. package/lib/cache.mjs +1 -1
  27. package/lib/cdn.mjs +2 -2
  28. package/lib/ci.mjs +12 -12
  29. package/lib/claims.mjs +2 -2
  30. package/lib/cold-start.mjs +21 -21
  31. package/lib/command-manifest.mjs +55 -70
  32. package/lib/config.mjs +28 -28
  33. package/lib/contacts.mjs +16 -16
  34. package/lib/contracts.mjs +12 -12
  35. package/lib/credentials.mjs +33 -33
  36. package/lib/daemon-path.mjs +1 -1
  37. package/lib/delegates.mjs +14 -14
  38. package/lib/deliveries.mjs +6 -6
  39. package/lib/deploy-rehearse-discovery.test.mjs +7 -7
  40. package/lib/deploy-v2.mjs +241 -193
  41. package/lib/deploy.mjs +21 -53
  42. package/lib/dev.mjs +3 -3
  43. package/lib/doctor-source-scan.mjs +1 -1
  44. package/lib/doctor.mjs +63 -63
  45. package/lib/domains.mjs +27 -27
  46. package/lib/email.mjs +38 -38
  47. package/lib/errors.mjs +40 -24
  48. package/lib/escalations.mjs +5 -5
  49. package/lib/events.mjs +32 -25
  50. package/lib/feedback.mjs +12 -12
  51. package/lib/functions.mjs +34 -34
  52. package/lib/gitvault-daemon.mjs +1 -1
  53. package/lib/gitvault-scaffold.mjs +2 -2
  54. package/lib/gitvault.mjs +2 -2
  55. package/lib/grants.mjs +7 -7
  56. package/lib/image.mjs +10 -10
  57. package/lib/init.mjs +69 -69
  58. package/lib/jobs.mjs +15 -15
  59. package/lib/lightning-wallet.mjs +28 -28
  60. package/lib/live.mjs +1 -1
  61. package/lib/login.mjs +207 -0
  62. package/lib/logout.mjs +53 -0
  63. package/lib/logs.mjs +8 -8
  64. package/lib/messages.mjs +5 -5
  65. package/lib/next-actions.mjs +16 -16
  66. package/lib/org-context.mjs +13 -13
  67. package/lib/{org.mjs → orgs.mjs} +215 -167
  68. package/lib/pay.mjs +1 -1
  69. package/lib/projects.mjs +70 -84
  70. package/lib/redeem.mjs +7 -8
  71. package/lib/remote-helper-session.mjs +12 -12
  72. package/lib/repos.mjs +83 -83
  73. package/lib/rooms.mjs +105 -69
  74. package/lib/sdk-errors.mjs +10 -5
  75. package/lib/sdk.mjs +3 -3
  76. package/lib/secrets.mjs +13 -13
  77. package/lib/service.mjs +5 -5
  78. package/lib/session-proofs.mjs +21 -0
  79. package/lib/sign-in.mjs +296 -0
  80. package/lib/sites.mjs +22 -22
  81. package/lib/snapshots.mjs +10 -10
  82. package/lib/stats.mjs +2 -2
  83. package/lib/status.mjs +25 -25
  84. package/lib/subdomains.mjs +30 -30
  85. package/lib/subscriptions.mjs +10 -10
  86. package/lib/tier.mjs +29 -22
  87. package/lib/transfer.mjs +59 -86
  88. package/lib/up.mjs +14 -14
  89. package/lib/wallet-context.mjs +4 -4
  90. package/lib/wallet-context.test.mjs +3 -3
  91. package/lib/wallets.mjs +197 -32
  92. package/lib/webhook-secret.mjs +6 -6
  93. package/lib/webhooks.mjs +8 -8
  94. package/lib/whoami.mjs +102 -0
  95. package/package.json +1 -1
  96. package/sdk/core-dist/config.js +52 -18
  97. package/sdk/core-dist/control-plane-session.js +31 -6
  98. package/sdk/core-dist/keystore.js +7 -7
  99. package/sdk/core-dist/profiles.js +9 -7
  100. package/sdk/core-dist/{allowance-auth.js → wallet-auth.js} +15 -15
  101. package/{core-dist/allowance.js → sdk/core-dist/wallet.js} +20 -20
  102. package/{core-dist/write-auth-session.js → sdk/core-dist/write-approvals.js} +19 -19
  103. package/sdk/dist/actions.d.ts +4 -4
  104. package/sdk/dist/actions.d.ts.map +1 -1
  105. package/sdk/dist/app-up.d.ts +2 -2
  106. package/sdk/dist/app-up.d.ts.map +1 -1
  107. package/sdk/dist/config.d.ts +1 -2
  108. package/sdk/dist/config.d.ts.map +1 -1
  109. package/sdk/dist/config.js.map +1 -1
  110. package/sdk/dist/control-plane-credentials.d.ts +8 -8
  111. package/sdk/dist/control-plane-credentials.js +7 -7
  112. package/sdk/dist/credentials.d.ts +20 -20
  113. package/sdk/dist/credentials.d.ts.map +1 -1
  114. package/sdk/dist/credentials.js +1 -1
  115. package/sdk/dist/errors.d.ts +26 -28
  116. package/sdk/dist/errors.d.ts.map +1 -1
  117. package/sdk/dist/errors.js +35 -38
  118. package/sdk/dist/errors.js.map +1 -1
  119. package/sdk/dist/index.d.ts +29 -16
  120. package/sdk/dist/index.d.ts.map +1 -1
  121. package/sdk/dist/index.js +30 -17
  122. package/sdk/dist/index.js.map +1 -1
  123. package/sdk/dist/kernel.d.ts +1 -1
  124. package/sdk/dist/kernel.d.ts.map +1 -1
  125. package/sdk/dist/kernel.js +10 -9
  126. package/sdk/dist/kernel.js.map +1 -1
  127. package/sdk/dist/namespaces/admin.d.ts +52 -121
  128. package/sdk/dist/namespaces/admin.d.ts.map +1 -1
  129. package/sdk/dist/namespaces/admin.js +41 -45
  130. package/sdk/dist/namespaces/admin.js.map +1 -1
  131. package/sdk/dist/namespaces/agent.d.ts +2 -2
  132. package/sdk/dist/namespaces/agent.d.ts.map +1 -1
  133. package/sdk/dist/namespaces/agent.js +2 -2
  134. package/sdk/dist/namespaces/agent.js.map +1 -1
  135. package/sdk/dist/namespaces/ai.d.ts +2 -2
  136. package/sdk/dist/namespaces/ai.js +3 -3
  137. package/sdk/dist/namespaces/ai.js.map +1 -1
  138. package/sdk/dist/namespaces/assets.js +1 -1
  139. package/sdk/dist/namespaces/assets.js.map +1 -1
  140. package/sdk/dist/namespaces/billing.d.ts +6 -3
  141. package/sdk/dist/namespaces/billing.d.ts.map +1 -1
  142. package/sdk/dist/namespaces/billing.js.map +1 -1
  143. package/sdk/dist/namespaces/buzz-notifications.types.d.ts +1 -1
  144. package/sdk/dist/namespaces/buzz.d.ts +2 -2
  145. package/sdk/dist/namespaces/buzz.d.ts.map +1 -1
  146. package/sdk/dist/namespaces/buzz.js +2 -2
  147. package/sdk/dist/namespaces/buzz.js.map +1 -1
  148. package/sdk/dist/namespaces/buzz.types.d.ts +2 -2
  149. package/sdk/dist/namespaces/buzz.types.d.ts.map +1 -1
  150. package/sdk/dist/namespaces/ci.js +3 -3
  151. package/sdk/dist/namespaces/ci.js.map +1 -1
  152. package/sdk/dist/namespaces/credentials.types.d.ts +1 -1
  153. package/sdk/dist/namespaces/deploy.d.ts +1 -1
  154. package/sdk/dist/namespaces/deploy.d.ts.map +1 -1
  155. package/sdk/dist/namespaces/deploy.js +31 -32
  156. package/sdk/dist/namespaces/deploy.js.map +1 -1
  157. package/sdk/dist/namespaces/deploy.types.d.ts +6 -6
  158. package/sdk/dist/namespaces/deploy.types.d.ts.map +1 -1
  159. package/sdk/dist/namespaces/domains.d.ts +10 -2
  160. package/sdk/dist/namespaces/domains.d.ts.map +1 -1
  161. package/sdk/dist/namespaces/domains.js +10 -5
  162. package/sdk/dist/namespaces/domains.js.map +1 -1
  163. package/sdk/dist/namespaces/errors.js +1 -1
  164. package/sdk/dist/namespaces/escalations.d.ts +1 -1
  165. package/sdk/dist/namespaces/escalations.js +1 -1
  166. package/sdk/dist/namespaces/escalations.types.d.ts +2 -2
  167. package/sdk/dist/namespaces/escalations.types.d.ts.map +1 -1
  168. package/sdk/dist/namespaces/events.types.d.ts +1 -1
  169. package/sdk/dist/namespaces/functions.d.ts +1 -1
  170. package/sdk/dist/namespaces/functions.js +2 -2
  171. package/sdk/dist/namespaces/functions.js.map +1 -1
  172. package/sdk/dist/namespaces/gitvault.crypto.d.ts +1 -1
  173. package/sdk/dist/namespaces/gitvault.d.ts +26 -26
  174. package/sdk/dist/namespaces/gitvault.d.ts.map +1 -1
  175. package/sdk/dist/namespaces/gitvault.js +113 -113
  176. package/sdk/dist/namespaces/gitvault.js.map +1 -1
  177. package/sdk/dist/namespaces/me.d.ts +120 -0
  178. package/sdk/dist/namespaces/me.d.ts.map +1 -0
  179. package/sdk/dist/namespaces/me.js +34 -0
  180. package/sdk/dist/namespaces/me.js.map +1 -0
  181. package/sdk/dist/namespaces/org.d.ts +108 -6
  182. package/sdk/dist/namespaces/org.d.ts.map +1 -1
  183. package/sdk/dist/namespaces/org.js +63 -7
  184. package/sdk/dist/namespaces/org.js.map +1 -1
  185. package/sdk/dist/namespaces/org.types.d.ts +29 -9
  186. package/sdk/dist/namespaces/org.types.d.ts.map +1 -1
  187. package/sdk/dist/namespaces/pay.js +3 -3
  188. package/sdk/dist/namespaces/pay.js.map +1 -1
  189. package/sdk/dist/namespaces/projects.d.ts +9 -9
  190. package/sdk/dist/namespaces/projects.js +15 -15
  191. package/sdk/dist/namespaces/projects.js.map +1 -1
  192. package/sdk/dist/namespaces/projects.types.d.ts +28 -12
  193. package/sdk/dist/namespaces/projects.types.d.ts.map +1 -1
  194. package/sdk/dist/namespaces/rooms.d.ts +7 -7
  195. package/sdk/dist/namespaces/rooms.js +17 -17
  196. package/sdk/dist/namespaces/rooms.js.map +1 -1
  197. package/sdk/dist/namespaces/rooms.types.d.ts +9 -9
  198. package/sdk/dist/namespaces/rooms.types.d.ts.map +1 -1
  199. package/sdk/dist/namespaces/service.d.ts +1 -1
  200. package/sdk/dist/namespaces/service.js +1 -1
  201. package/sdk/dist/namespaces/{operator-session.d.ts → session.d.ts} +135 -51
  202. package/sdk/dist/namespaces/session.d.ts.map +1 -0
  203. package/sdk/dist/namespaces/{operator-session.js → session.js} +118 -30
  204. package/sdk/dist/namespaces/session.js.map +1 -0
  205. package/sdk/dist/namespaces/subdomains.d.ts +5 -5
  206. package/sdk/dist/namespaces/subdomains.d.ts.map +1 -1
  207. package/sdk/dist/namespaces/subdomains.js +6 -6
  208. package/sdk/dist/namespaces/subdomains.js.map +1 -1
  209. package/sdk/dist/namespaces/tier.d.ts +44 -21
  210. package/sdk/dist/namespaces/tier.d.ts.map +1 -1
  211. package/sdk/dist/namespaces/tier.js +7 -7
  212. package/sdk/dist/namespaces/tier.js.map +1 -1
  213. package/sdk/dist/namespaces/transfers.d.ts +119 -85
  214. package/sdk/dist/namespaces/transfers.d.ts.map +1 -1
  215. package/sdk/dist/namespaces/transfers.js +31 -38
  216. package/sdk/dist/namespaces/transfers.js.map +1 -1
  217. package/sdk/dist/namespaces/vouchers.d.ts +9 -10
  218. package/sdk/dist/namespaces/vouchers.d.ts.map +1 -1
  219. package/sdk/dist/namespaces/vouchers.js +4 -5
  220. package/sdk/dist/namespaces/vouchers.js.map +1 -1
  221. package/sdk/dist/namespaces/wallets.d.ts +72 -3
  222. package/sdk/dist/namespaces/wallets.d.ts.map +1 -1
  223. package/sdk/dist/namespaces/wallets.js +141 -3
  224. package/sdk/dist/namespaces/wallets.js.map +1 -1
  225. package/sdk/dist/namespaces/write-approval.d.ts +101 -0
  226. package/sdk/dist/namespaces/write-approval.d.ts.map +1 -0
  227. package/sdk/dist/namespaces/write-approval.js +62 -0
  228. package/sdk/dist/namespaces/write-approval.js.map +1 -0
  229. package/sdk/dist/node/actions-node.d.ts +3 -3
  230. package/sdk/dist/node/actions-node.d.ts.map +1 -1
  231. package/sdk/dist/node/actions-node.js +44 -44
  232. package/sdk/dist/node/actions-node.js.map +1 -1
  233. package/sdk/dist/node/assets-node.js +6 -6
  234. package/sdk/dist/node/assets-node.js.map +1 -1
  235. package/sdk/dist/node/{bearer-claim-key.d.ts → bearer-redeem-key.d.ts} +12 -12
  236. package/sdk/dist/node/bearer-redeem-key.d.ts.map +1 -0
  237. package/sdk/dist/node/{bearer-claim-key.js → bearer-redeem-key.js} +21 -21
  238. package/sdk/dist/node/bearer-redeem-key.js.map +1 -0
  239. package/sdk/dist/node/ci.d.ts +1 -1
  240. package/sdk/dist/node/ci.d.ts.map +1 -1
  241. package/sdk/dist/node/ci.js +6 -6
  242. package/sdk/dist/node/ci.js.map +1 -1
  243. package/sdk/dist/node/credentials.d.ts +18 -17
  244. package/sdk/dist/node/credentials.d.ts.map +1 -1
  245. package/sdk/dist/node/credentials.js +29 -28
  246. package/sdk/dist/node/credentials.js.map +1 -1
  247. package/sdk/dist/node/deploy-manifest.d.ts +3 -5
  248. package/sdk/dist/node/deploy-manifest.d.ts.map +1 -1
  249. package/sdk/dist/node/deploy-manifest.js +3 -12
  250. package/sdk/dist/node/deploy-manifest.js.map +1 -1
  251. package/sdk/dist/node/funding-recovery.d.ts +1 -1
  252. package/sdk/dist/node/funding-recovery.d.ts.map +1 -1
  253. package/sdk/dist/node/funding-recovery.js +1 -1
  254. package/sdk/dist/node/funding-recovery.js.map +1 -1
  255. package/sdk/dist/node/gitvault-apply.d.ts +1 -1
  256. package/sdk/dist/node/gitvault-apply.d.ts.map +1 -1
  257. package/sdk/dist/node/gitvault-apply.js +1 -1
  258. package/sdk/dist/node/gitvault-apply.js.map +1 -1
  259. package/sdk/dist/node/gitvault-handoff.d.ts +22 -22
  260. package/sdk/dist/node/gitvault-handoff.d.ts.map +1 -1
  261. package/sdk/dist/node/gitvault-handoff.js +45 -45
  262. package/sdk/dist/node/gitvault-handoff.js.map +1 -1
  263. package/sdk/dist/node/gitvault-prewarm.js +7 -7
  264. package/sdk/dist/node/gitvault-prewarm.js.map +1 -1
  265. package/sdk/dist/node/gitvault-restore.d.ts +1 -1
  266. package/sdk/dist/node/gitvault-restore.js +1 -1
  267. package/sdk/dist/node/index.d.ts +16 -16
  268. package/sdk/dist/node/index.d.ts.map +1 -1
  269. package/sdk/dist/node/index.js +15 -15
  270. package/sdk/dist/node/index.js.map +1 -1
  271. package/sdk/dist/node/manifest-export.js +2 -2
  272. package/sdk/dist/node/manifest-export.js.map +1 -1
  273. package/sdk/dist/node/org-adopt.d.ts +49 -0
  274. package/sdk/dist/node/org-adopt.d.ts.map +1 -0
  275. package/sdk/dist/node/org-adopt.js +77 -0
  276. package/sdk/dist/node/org-adopt.js.map +1 -0
  277. package/sdk/dist/node/paid-fetch.d.ts +7 -7
  278. package/sdk/dist/node/paid-fetch.d.ts.map +1 -1
  279. package/sdk/dist/node/paid-fetch.js +54 -54
  280. package/sdk/dist/node/paid-fetch.js.map +1 -1
  281. package/sdk/dist/node/preflight.d.ts +1 -1
  282. package/sdk/dist/node/preflight.d.ts.map +1 -1
  283. package/sdk/dist/node/preflight.js +1 -1
  284. package/sdk/dist/node/preflight.js.map +1 -1
  285. package/sdk/dist/node/sites-node.js +1 -1
  286. package/sdk/dist/node/sites-node.js.map +1 -1
  287. package/sdk/dist/node/source-scan.d.ts +1 -1
  288. package/sdk/dist/node/source-scan.js +2 -2
  289. package/sdk/dist/node/source-scan.js.map +1 -1
  290. package/sdk/dist/scoped.d.ts +11 -11
  291. package/sdk/dist/scoped.d.ts.map +1 -1
  292. package/sdk/dist/scoped.js +5 -5
  293. package/sdk/dist/scoped.js.map +1 -1
  294. package/core-dist/operator-session.js +0 -154
  295. package/lib/allowance.mjs +0 -355
  296. package/lib/cloud.mjs +0 -256
  297. package/lib/core.mjs +0 -123
  298. package/lib/operator-proofs.mjs +0 -22
  299. package/lib/operator.mjs +0 -771
  300. package/sdk/core-dist/operator-session.js +0 -154
  301. package/sdk/dist/namespaces/allowance.d.ts +0 -79
  302. package/sdk/dist/namespaces/allowance.d.ts.map +0 -1
  303. package/sdk/dist/namespaces/allowance.js +0 -149
  304. package/sdk/dist/namespaces/allowance.js.map +0 -1
  305. package/sdk/dist/namespaces/operator-session.d.ts.map +0 -1
  306. package/sdk/dist/namespaces/operator-session.js.map +0 -1
  307. package/sdk/dist/namespaces/operator.d.ts +0 -359
  308. package/sdk/dist/namespaces/operator.d.ts.map +0 -1
  309. package/sdk/dist/namespaces/operator.js +0 -272
  310. package/sdk/dist/namespaces/operator.js.map +0 -1
  311. package/sdk/dist/node/bearer-claim-key.d.ts.map +0 -1
  312. package/sdk/dist/node/bearer-claim-key.js.map +0 -1
  313. package/sdk/dist/node/operator-claim.d.ts +0 -49
  314. package/sdk/dist/node/operator-claim.d.ts.map +0 -1
  315. package/sdk/dist/node/operator-claim.js +0 -77
  316. package/sdk/dist/node/operator-claim.js.map +0 -1
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * `cold-start.mjs` — the minimal x402/Base-Sepolia cold-start chain
3
- * (kygit-handoff design D5): allowance → faucet → one x402 prototype
3
+ * (kygit-handoff design D5): wallet → faucet → one x402 prototype
4
4
  * payment. `repos create` (and so `kygit create`) folds this in when it is
5
5
  * refused `NO_ACTIVE_TIER`, so `kygit create` on a genuinely fresh machine
6
6
  * ends with a vault, no human signup, no cloud dashboard.
7
7
  *
8
- * This is the SAME shape `run402 init` already walks (allowance create →
8
+ * This is the SAME shape `run402 init` already walks (create the wallet →
9
9
  * balance check → faucet → tier), factored down to the x402/Base-Sepolia
10
10
  * default rail only (MPP/Tempo is `init`'s own separate concern — an agent
11
11
  * hitting NO_ACTIVE_TIER mid-`repos create` gets the default rail, not a
@@ -15,7 +15,7 @@
15
15
  * create` needs when it discovers there is no tier and nothing else has
16
16
  * set one up yet.
17
17
  *
18
- * add-room-invite design D9 splits the funded-wallet half (allowance →
18
+ * add-room-invite design D9 splits the funded-wallet half (wallet →
19
19
  * faucet-if-empty → brief settlement poll) out as {@link ensureFundedWallet}
20
20
  * — `rooms join <key>` needs exactly that half, with NO tier purchase and NO
21
21
  * project creation (the claim itself is the one x402 payment that funds the
@@ -23,42 +23,42 @@
23
23
  * `ensureFundedWallet` followed by the tier step — so every EXISTING caller
24
24
  * (`repos create`/`resume`/`join`) is unchanged.
25
25
  */
26
- import { readAllowance, saveAllowance } from "./config.mjs";
26
+ import { readWallet, saveWallet } from "./config.mjs";
27
27
  import { getSdk } from "./sdk.mjs";
28
28
 
29
29
  const USDC_ABI = [{ name: "balanceOf", type: "function", stateMutability: "view", inputs: [{ name: "account", type: "address" }], outputs: [{ name: "", type: "uint256" }] }];
30
30
  const USDC_SEPOLIA = "0x036CbD53842c5426634e7929541eC2318f3dCF7e";
31
31
 
32
32
  /**
33
- * Allowance → faucet-if-empty → brief settlement poll. NO tier purchase, no
33
+ * Wallet → faucet-if-empty → brief settlement poll. NO tier purchase, no
34
34
  * project creation — the caller decides what (if anything) to pay for next.
35
35
  *
36
36
  * @param {(line: string) => void} announce Called once per step, so the
37
37
  * caller can print each one it took (client-surface spec: "announcing
38
38
  * each step").
39
- * @returns {Promise<{allowance_created: boolean, faucet_requested: boolean, address: string}>}
39
+ * @returns {Promise<{wallet_created: boolean, faucet_requested: boolean, address: string}>}
40
40
  */
41
41
  export async function ensureFundedWallet(announce = () => {}) {
42
- const out = { allowance_created: false, faucet_requested: false, address: "" };
42
+ const out = { wallet_created: false, faucet_requested: false, address: "" };
43
43
 
44
- let allowance = readAllowance();
45
- if (!allowance) {
44
+ let localWallet = readWallet();
45
+ if (!localWallet) {
46
46
  const { generatePrivateKey, privateKeyToAccount } = await import("viem/accounts");
47
47
  const privateKey = generatePrivateKey();
48
48
  const account = privateKeyToAccount(privateKey);
49
- allowance = { address: account.address, privateKey, created: new Date().toISOString(), funded: false, rail: "x402" };
50
- saveAllowance(allowance);
51
- out.allowance_created = true;
52
- announce(`allowance created: ${allowance.address}`);
49
+ localWallet = { address: account.address, privateKey, created: new Date().toISOString(), funded: false, rail: "x402" };
50
+ saveWallet(localWallet);
51
+ out.wallet_created = true;
52
+ announce(`wallet created: ${localWallet.address}`);
53
53
  }
54
- out.address = allowance.address;
54
+ out.address = localWallet.address;
55
55
 
56
56
  const { createPublicClient, http } = await import("viem");
57
57
  const { baseSepolia } = await import("viem/chains");
58
58
  const client = createPublicClient({ chain: baseSepolia, transport: http() });
59
59
  let balance = 0;
60
60
  try {
61
- balance = Number(await client.readContract({ address: USDC_SEPOLIA, abi: USDC_ABI, functionName: "balanceOf", args: [allowance.address] }));
61
+ balance = Number(await client.readContract({ address: USDC_SEPOLIA, abi: USDC_ABI, functionName: "balanceOf", args: [localWallet.address] }));
62
62
  } catch {
63
63
  /* an RPC hiccup here is not fatal — the payment below will surface a real failure if the balance really is zero */
64
64
  }
@@ -67,19 +67,19 @@ export async function ensureFundedWallet(announce = () => {}) {
67
67
  // The faucet is throttled (0.25 USDC / 24h): a throttle refusal is
68
68
  // surfaced with its wait and NEVER retried silently (client-surface
69
69
  // spec) — this call is not wrapped in a swallowing catch.
70
- await getSdk().allowance.faucet(allowance.address);
70
+ await getSdk().wallets.faucet(localWallet.address);
71
71
  out.faucet_requested = true;
72
72
  announce("faucet requested — waiting briefly for on-chain confirmation");
73
73
  for (let i = 0; i < 30; i++) {
74
74
  await new Promise((r) => setTimeout(r, 1000));
75
75
  try {
76
- balance = Number(await client.readContract({ address: USDC_SEPOLIA, abi: USDC_ABI, functionName: "balanceOf", args: [allowance.address] }));
76
+ balance = Number(await client.readContract({ address: USDC_SEPOLIA, abi: USDC_ABI, functionName: "balanceOf", args: [localWallet.address] }));
77
77
  if (balance > 0) break;
78
78
  } catch {
79
79
  /* keep polling */
80
80
  }
81
81
  }
82
- saveAllowance({ ...allowance, funded: true, lastFaucet: new Date().toISOString() });
82
+ saveWallet({ ...localWallet, funded: true, lastFaucet: new Date().toISOString() });
83
83
  }
84
84
 
85
85
  return out;
@@ -91,13 +91,13 @@ export async function ensureFundedWallet(announce = () => {}) {
91
91
  * no edits.
92
92
  *
93
93
  * @param {(line: string) => void} announce Called once per step.
94
- * @returns {Promise<{allowance_created: boolean, faucet_requested: boolean, tier: object|null}>}
94
+ * @returns {Promise<{wallet_created: boolean, faucet_requested: boolean, tier: object|null}>}
95
95
  */
96
96
  export async function foldColdStartChain(announce = () => {}) {
97
97
  const funded = await ensureFundedWallet(announce);
98
98
 
99
- announce("subscribing to the prototype tier (one x402 testnet payment, perpetual)");
99
+ announce("setting the prototype tier (one x402 testnet payment; the free tier, no lease)");
100
100
  const tier = await getSdk().tier.set("prototype");
101
101
  announce(`prototype tier active${tier?.status === "already_active" ? " (already active)" : ""}`);
102
- return { allowance_created: funded.allowance_created, faucet_requested: funded.faucet_requested, tier };
102
+ return { wallet_created: funded.wallet_created, faucet_requested: funded.faucet_requested, tier };
103
103
  }
@@ -13,13 +13,13 @@
13
13
  * positionals canonical positional ATTRIBUTES (post-conventions).
14
14
  * A variadic list of the SAME kind counts as one.
15
15
  * projectScoped command operates on a project and accepts
16
- * `--project <id>` (precedence: --project > legacy
16
+ * `--project <project_id>` (precedence: --project > legacy
17
17
  * leading prj_ positional > active project)
18
18
  * orgScoped command acts ON an organization and resolves it
19
19
  * through the ONE shared chain (cli-org-context):
20
20
  * an optional leading <org_id> positional, else
21
21
  * --org, else RUN402_ORG, else the .run402.json
22
- * binding, else `org use`. The gate drives every
22
+ * binding, else `orgs use`. The gate drives every
23
23
  * such entry through --org AND RUN402_ORG with no
24
24
  * positional and fails on any "Missing <org_id>".
25
25
  * Any entry with an `org_id` positional MUST be
@@ -107,6 +107,8 @@ export const COMMAND_MANIFEST = [
107
107
  { path: ["wallets", "unbind"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
108
108
  { path: ["wallets", "import"], positionals: [p("name")], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["gate-import-wallet", "--key", "__FIXTURE_FILE__"] },
109
109
  { path: ["wallets", "rm"], positionals: [p("name")], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["no-such-wallet", "--yes"] },
110
+ { path: ["wallets", "fund"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [], skipBehavioral: "polls on-chain funding with sleeps" },
111
+ { path: ["wallets", "balance"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
110
112
  { path: ["wallets", "lightning"], positionals: [p("action", { required: false })], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["status"] },
111
113
 
112
114
  // ── credentials (gateway project credentials) ────────────────────────────
@@ -124,14 +126,6 @@ export const COMMAND_MANIFEST = [
124
126
  { path: ["credentials", "project-keys", "export"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["--reveal"] },
125
127
  { path: ["credentials", "project-keys", "remove"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: [] },
126
128
 
127
- // ── allowance ────────────────────────────────────────────────────────────
128
- { path: ["allowance", "status"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
129
- { path: ["allowance", "create"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [], skipBehavioral: "creates a real local wallet key outside the gate's scratch profile" },
130
- { path: ["allowance", "fund"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [], skipBehavioral: "polls on-chain funding with sleeps" },
131
- { path: ["allowance", "balance"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
132
- { path: ["allowance", "export"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
133
- { path: ["allowance", "checkout"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["--amount", "5000000"] },
134
- { path: ["allowance", "history"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
135
129
 
136
130
  // ── tier ─────────────────────────────────────────────────────────────────
137
131
  { path: ["tier", "status"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
@@ -157,7 +151,6 @@ export const COMMAND_MANIFEST = [
157
151
  { path: ["projects", "delete"], positionals: [], projectScoped: true, legacyPositionalProject: true, minimalArgs: [] },
158
152
  { path: ["projects", "promote-user"], positionals: [p("email")], projectScoped: true, legacyPositionalProject: true, minimalArgs: ["user@example.com"] },
159
153
  { path: ["projects", "demote-user"], positionals: [p("email")], projectScoped: true, legacyPositionalProject: true, minimalArgs: ["user@example.com"] },
160
- { path: ["projects", "export"], positionals: [], projectScoped: true, legacyPositionalProject: true, minimalArgs: [] },
161
154
 
162
155
  // ── snapshots ────────────────────────────────────────────────────────────
163
156
  { path: ["snapshots", "create"], positionals: [], projectScoped: true, legacyPositionalProject: true, minimalArgs: [] },
@@ -177,27 +170,30 @@ export const COMMAND_MANIFEST = [
177
170
  { path: ["admin", "archive"], positionals: [], projectScoped: true, legacyPositionalProject: true, minimalArgs: ["--reason", "gate"] },
178
171
  { path: ["admin", "reactivate"], positionals: [], projectScoped: true, legacyPositionalProject: true, minimalArgs: [] },
179
172
 
180
- // ── cloud / archives / core ──────────────────────────────────────────────
181
- { path: ["cloud", "archives", "create"], positionals: [], projectScoped: true, legacyPositionalProject: true, minimalArgs: [] },
182
- { path: ["cloud", "archives", "download"], positionals: [p("archive_id")], projectScoped: true, legacyPositionalProject: true, minimalArgs: ["arc_gate1", "--output", "__OUT_FILE__"] },
183
- { path: ["cloud", "archives", "status"], positionals: [p("archive_id")], projectScoped: true, legacyPositionalProject: true, minimalArgs: ["arc_gate1"] },
173
+ // ── archives ─────────────────────────────────────────────────────────────
174
+ { path: ["archives", "create"], positionals: [], projectScoped: true, legacyPositionalProject: true, minimalArgs: [] },
175
+ { path: ["archives", "download"], positionals: [p("archive_id")], projectScoped: true, legacyPositionalProject: true, minimalArgs: ["arc_gate1", "--output", "__OUT_FILE__"] },
176
+ { path: ["archives", "status"], positionals: [p("archive_id")], projectScoped: true, legacyPositionalProject: true, minimalArgs: ["arc_gate1"] },
184
177
  { path: ["archives", "inspect"], positionals: [p("archive_path")], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["__FIXTURE_FILE__"] },
185
178
  { path: ["archives", "verify"], positionals: [p("archive_path")], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["__FIXTURE_FILE__"] },
186
- { path: ["core", "projects", "import"], positionals: [p("archive_path")], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["__FIXTURE_FILE__", "--name", "gate-import"] },
179
+ { path: ["archives", "import"], positionals: [p("archive_path")], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["__FIXTURE_FILE__", "--name", "gate-import"] },
187
180
 
188
181
  // ── deploy (unified deploy v2) ───────────────────────────────────────────
189
- { path: ["deploy", "apply"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["--spec", "{}", "--check"], runStyle: "deployV2" },
182
+ // Bare `run402 deploy` IS the deploy (a verb); the family's subcommands
183
+ // follow. Dispatched flat through deploy.mjs so the gate exercises the
184
+ // same argv decision a person's shell does.
185
+ { path: ["deploy"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["--spec", "{}", "--check"], runStyle: "flat" },
190
186
  { path: ["deploy", "rehearse"], positionals: [p("plan_id", { required: false })], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["plan_gate1"], runStyle: "deployV2" },
191
187
  { path: ["deploy", "promote"], positionals: [p("release_id")], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["rel_gate1"], runStyle: "deployV2" },
192
188
  { path: ["deploy", "resume"], positionals: [p("operation_id")], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["op_gate1"], runStyle: "deployV2" },
189
+ { path: ["deploy", "status"], positionals: [p("operation_id")], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["op_gate1"], runStyle: "deployV2" },
193
190
  { path: ["deploy", "list"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: [], runStyle: "deployV2" },
194
191
  { path: ["deploy", "events"], positionals: [p("operation_id")], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["op_gate1"], runStyle: "deployV2" },
195
192
  { path: ["deploy", "verify"], positionals: [p("operation_id", { required: false })], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["op_gate1"], runStyle: "deployV2" },
196
- { path: ["deploy", "release", "get"], positionals: [p("release_id")], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["rel_gate1"], runStyle: "deployV2" },
197
- { path: ["deploy", "release", "active"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: [], runStyle: "deployV2" },
198
- { path: ["deploy", "release", "diff"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["--from", "empty", "--to", "active"], runStyle: "deployV2" },
199
- { path: ["deploy", "diagnose"], positionals: [p("url")], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["https://example.com/"], runStyle: "deployV2" },
200
- { path: ["deploy", "resolve"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["--url", "https://example.com/"], runStyle: "deployV2" },
193
+ { path: ["deploy", "releases", "get"], positionals: [p("release_id")], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["rel_gate1"], runStyle: "deployV2" },
194
+ { path: ["deploy", "releases", "active"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: [], runStyle: "deployV2" },
195
+ { path: ["deploy", "releases", "diff"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["--from", "empty", "--to", "active"], runStyle: "deployV2" },
196
+ { path: ["deploy", "resolve"], positionals: [p("url", { required: false })], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["https://example.com/"], runStyle: "deployV2" },
201
197
 
202
198
  // ── ci ───────────────────────────────────────────────────────────────────
203
199
  { path: ["ci", "link"], positionals: [p("provider")], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["github"] },
@@ -210,34 +206,32 @@ export const COMMAND_MANIFEST = [
210
206
  { path: ["transfer", "preview"], positionals: [p("transfer_id")], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["tr_gate1"] },
211
207
  { path: ["transfer", "list"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
212
208
  { path: ["transfer", "accept"], positionals: [p("transfer_id")], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["tr_gate1"] },
213
- { path: ["transfer", "claim"], positionals: [p("transfer_id")], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["tr_gate1"] },
214
209
  { path: ["transfer", "cancel"], positionals: [p("transfer_id")], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["tr_gate1"] },
215
210
 
216
- // ── org ──────────────────────────────────────────────────────────────────
217
- { path: ["org", "create"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
218
- { path: ["org", "list"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
219
- { path: ["org", "get"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG] },
220
- { path: ["org", "rename"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG, "--name", "Gate"] },
221
- { path: ["org", "payout-wallet"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG, "0x1111111111111111111111111111111111111111"] },
211
+ // ── orgs ──────────────────────────────────────────────────────────────────
212
+ { path: ["orgs", "create"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
213
+ { path: ["orgs", "list"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
214
+ { path: ["orgs", "get"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG] },
215
+ { path: ["orgs", "rename"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG, "--name", "Gate"] },
216
+ { path: ["orgs", "payout-wallet"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG, "0x1111111111111111111111111111111111111111"] },
222
217
  // `--org` (not a positional org_id
223
218
  // like rename/payout-wallet above) goes through resolveOrg's SHAPE
224
219
  // validation (a real UUID) — "org_gate1" fails that locally, so this needs
225
- // the same UUID-shaped fixture `org use` below already established.
226
- { path: ["org", "slug"], positionals: [p("slug")], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["acme", "--org", "11111111-2222-3333-4444-555555555555"] },
227
- { path: ["org", "whoami"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
228
- { path: ["org", "audit"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG] },
229
- { path: ["org", "use"], positionals: [p("org_id")], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["11111111-2222-3333-4444-555555555555"] },
230
- { path: ["org", "current"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
231
- { path: ["org", "clear"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
232
- { path: ["org", "bind"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["--org", "11111111-2222-3333-4444-555555555555"] },
233
- { path: ["org", "unbind"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
234
- { path: ["org", "member", "list"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG] },
235
- { path: ["org", "member", "add"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG, "0x1111111111111111111111111111111111111111"] },
236
- { path: ["org", "member", "role"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG, "--principal", "prn_gate1", "--role", "viewer"] },
237
- { path: ["org", "member", "rm"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG, "--principal", "prn_gate1"] },
238
- { path: ["org", "invite", "list"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG] },
239
- { path: ["org", "invite", "create"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG, "--email", "gate@example.com"] },
240
- { path: ["org", "invite", "rm"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG, "--principal", "prn_gate1"] },
220
+ // the same UUID-shaped fixture `orgs use` below already established.
221
+ { path: ["orgs", "slug"], positionals: [p("slug")], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["acme", "--org", "11111111-2222-3333-4444-555555555555"] },
222
+ { path: ["orgs", "audit"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG] },
223
+ { path: ["orgs", "use"], positionals: [p("org_id")], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["11111111-2222-3333-4444-555555555555"] },
224
+ { path: ["orgs", "current"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
225
+ { path: ["orgs", "clear"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
226
+ { path: ["orgs", "bind"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["--org", "11111111-2222-3333-4444-555555555555"] },
227
+ { path: ["orgs", "unbind"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
228
+ { path: ["orgs", "members", "list"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG] },
229
+ { path: ["orgs", "members", "add"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG, "0x1111111111111111111111111111111111111111"] },
230
+ { path: ["orgs", "members", "role"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG, "--principal", "prn_gate1", "--role", "viewer"] },
231
+ { path: ["orgs", "members", "rm"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG, "--principal", "prn_gate1"] },
232
+ { path: ["orgs", "invite", "list"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG] },
233
+ { path: ["orgs", "invite", "create"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG, "--email", "gate@example.com"] },
234
+ { path: ["orgs", "invite", "rm"], positionals: [p("org_id", { required: false })], projectScoped: false, orgScoped: true, legacyPositionalProject: false, minimalArgs: [GATE_ORG, "--principal", "prn_gate1"] },
241
235
 
242
236
  // ── grants ───────────────────────────────────────────────────────────────
243
237
  { path: ["grants", "create"], positionals: [p("wallet")], projectScoped: true, legacyPositionalProject: true, minimalArgs: ["0x1111111111111111111111111111111111111111", "--capability", "deploy"] },
@@ -249,8 +243,8 @@ export const COMMAND_MANIFEST = [
249
243
  { path: ["delegates", "revoke"], legacyPositionalProject: false, positionals: [p("delegate_id")], projectScoped: true, minimalArgs: ["dlg_gate1"] },
250
244
  { path: ["delegates", "rotate"], legacyPositionalProject: false, positionals: [p("delegate_id")], projectScoped: true, minimalArgs: ["dlg_gate1"] },
251
245
 
252
- // ── events / errors (flat, merged runners) ───────────────────────────────
253
- { path: ["events"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: [], runStyle: "merged" },
246
+ // ── events / live ────────────────────────────────────────────────────────
247
+ { path: ["events", "list"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: [], runStyle: "sub" },
254
248
  { path: ["live"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["--tables", "cells", "--once"], runStyle: "merged" },
255
249
  { path: ["deliveries", "list"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [], runStyle: "sub" },
256
250
  { path: ["deliveries", "get"], positionals: [p("notification_id")], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["n_1"], runStyle: "sub" },
@@ -266,9 +260,11 @@ export const COMMAND_MANIFEST = [
266
260
  // add-room-invite design D9: `rooms join` is one verb, two forms — no
267
261
  // positional registers a presence (the behaviorally-tested path, unchanged
268
262
  // by the optional positional below since minimalArgs stays empty); a
269
- // `kri1_…` positional claims a room seat first (a real x402 payment + an
263
+ // `kri1_…` positional redeems the key first (a real x402 payment + an
270
264
  // org-membership mutation), so that form is never behaviorally exercised
271
265
  // here — the same reasoning `repos join`'s own row states.
266
+ { path: ["rooms", "list"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: [], runStyle: "sub" },
267
+ { path: ["rooms", "get"], positionals: [p("room_key")], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["run402-dev"], runStyle: "sub" },
272
268
  { path: ["rooms", "join"], positionals: [p("key", { required: false })], projectScoped: true, legacyPositionalProject: false, minimalArgs: [], runStyle: "sub" },
273
269
  { path: ["rooms", "invite"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: [], runStyle: "sub", skipBehavioral: "mints a single-use bearer key from a live room, registering the inviter's presence and posting a real room message — never run against the gate's own checkout" },
274
270
  { path: ["rooms", "leave"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: [], runStyle: "sub" },
@@ -329,7 +325,8 @@ export const COMMAND_MANIFEST = [
329
325
  // Principal-scoped (one bundle covers every vault you can read), so no
330
326
  // --project — deliberately unlike its eleven vault-scoped siblings.
331
327
  { path: ["repos", "recovery-bundle"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["--out", "-"], runStyle: "sub", skipBehavioral: "exports the caller's live member recovery bundle (stamps recovery-posture export evidence server-side)" },
332
- { path: ["errors"], positionals: [p("fingerprint_id", { required: false })], projectScoped: true, legacyPositionalProject: false, minimalArgs: [], runStyle: "merged" },
328
+ { path: ["errors", "list"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: [], runStyle: "sub" },
329
+ { path: ["errors", "get"], positionals: [p("fingerprint_id")], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["fp_gate1"], runStyle: "sub" },
333
330
 
334
331
  // ── jobs ─────────────────────────────────────────────────────────────────
335
332
  { path: ["jobs", "submit"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["--file", "__FIXTURE_FILE__"] },
@@ -375,7 +372,7 @@ export const COMMAND_MANIFEST = [
375
372
  { path: ["sites", "deploy-dir"], positionals: [p("dir")], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["__SCRATCH_DIR__"] },
376
373
 
377
374
  // ── subdomains ───────────────────────────────────────────────────────────
378
- { path: ["subdomains", "claim"], positionals: [p("name")], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["gate-sub"] },
375
+ { path: ["subdomains", "add"], positionals: [p("name")], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["gate-sub"] },
379
376
  { path: ["subdomains", "list"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: [] },
380
377
  { path: ["subdomains", "delete"], positionals: [p("name")], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["gate-sub", "--confirm"] },
381
378
 
@@ -427,18 +424,16 @@ export const COMMAND_MANIFEST = [
427
424
  { path: ["email", "webhooks", "deliveries"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: [] },
428
425
  { path: ["email", "webhooks", "redrive"], positionals: [p("delivery_id")], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["dlv_gate1"] },
429
426
 
430
- // ── message / agent / operator ───────────────────────────────────────────
427
+ // ── message / agent / sign-in ────────────────────────────────────────────
431
428
  { path: ["feedback", "send"], positionals: [p("words", { variadic: true })], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["hello", "from", "the", "gate"] },
432
429
  { path: ["agent", "contact"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["--name", "gate-agent"] },
433
430
  { path: ["agent", "status"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
434
431
  { path: ["agent", "verify-email"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
435
432
  { path: ["agent", "passkey"], positionals: [p("action")], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["enroll"] },
436
- { path: ["operator", "login"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [], skipBehavioral: "opens a browser / loopback listener" },
437
- { path: ["operator", "logout"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
438
- { path: ["operator", "overview"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
439
- { path: ["operator", "whoami"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
440
- { path: ["operator", "claim-wallet-org"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
441
- { path: ["operator", "approve"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["--action", "org.project.create", "--org", "org_gate1", "--no-open"] },
433
+ { path: ["login"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [], runStyle: "flat", skipBehavioral: "opens a browser / loopback listener" },
434
+ { path: ["logout"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [], runStyle: "flat" },
435
+ { path: ["whoami"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [], runStyle: "flat", skipBehavioral: "requires live principal authentication" },
436
+ { path: ["approve"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["--action", "org.project.create", "--org", "org_gate1", "--no-open"], runStyle: "flat" },
442
437
 
443
438
  // ── auth ─────────────────────────────────────────────────────────────────
444
439
  { path: ["auth", "magic-link"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["--email", "gate@example.com", "--redirect", "https://example.com/cb"] },
@@ -488,8 +483,8 @@ export const COMMAND_MANIFEST = [
488
483
  // without rejecting it," which this satisfies.
489
484
  { path: ["doctor"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["--no-scan"], runStyle: "merged" },
490
485
  { path: ["webhook-secret", "rotate"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
491
- // `run402 logs [<function>] --request-id <id>`: the optional positional is
492
- // the function name (`run402 errors` samples print it that way); it is
486
+ // `run402 logs [<function>] --request-id <request_id>`: the optional positional is
487
+ // the function name (`run402 errors list` samples print it that way); it is
493
488
  // never a project id.
494
489
  { path: ["logs"], positionals: [p("function", { required: false })], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["--request-id", "req_gate123"], runStyle: "merged" },
495
490
  ];
@@ -497,7 +492,6 @@ export const COMMAND_MANIFEST = [
497
492
  // Families deliberately absent from the manifest, consumed by the gate's
498
493
  // completeness check against cli.mjs's dispatch switch.
499
494
  export const SKIPPED_FAMILIES = {
500
- "apply": "pure alias for `deploy apply` (covered by the deploy family)",
501
495
  "dev": "interactive wrapper that spawns `astro dev`",
502
496
  // RESERVED, not dispatched: every `run402 message …` fails with
503
497
  // COMMAND_REMOVED pointing at `feedback send` / `messages send` /
@@ -538,22 +532,13 @@ export const SKIPPED_FAMILIES = {
538
532
  export const RESERVED_SUBCOMMANDS = {
539
533
  "source-access:export": "moved to `repos recovery-bundle` — the artifact `repos recover --bundle` consumes belongs to the repos family",
540
534
  "source-access:status": "moved to `repos access` — your own wrapper custody rides its member_custody block; the org advisory is `doctor --only recovery_posture`",
541
- "rooms:who": "renamed to `rooms join` — an interrogative must not name a write",
542
- "rooms:send": "moved to `messages send` — the verb acts on a message",
543
- // The routes and SDK methods for room list/get exist (agent-room-lifecycle);
544
- // only these two SPELLINGS are held back, because they were freed from
545
- // meaning "list/get MESSAGES" and a reused spelling changes meaning without
546
- // ever failing. One major, then they may name the room.
547
- "rooms:list": "moved to `messages list` — the verb acts on a message",
548
- "rooms:get": "moved to `messages get` — the verb acts on a message",
549
- "rooms:ack": "moved to `messages ack` — the verb acts on a message",
550
535
  "escalations:contacts": "merged into `contacts` — the ladder and Telegram channels are one question",
551
536
  // Every `gitvault <verb>` spelling. Nine
552
537
  // answer COMMAND_MOVED naming their `repos` successor; `push` and
553
538
  // `reconcile` answer COMMAND_REMOVED (no equivalent successor for either —
554
539
  // `push`'s one-release alias window is over, `reconcile` was a workaround
555
540
  // with no permanent replacement, only a read at `repos access`).
556
- "gitvault:init": "moved to `repos create --project <id>`",
541
+ "gitvault:init": "moved to `repos create --project <project_id>`",
557
542
  "gitvault:status": "moved to `repos view`",
558
543
  "gitvault:snapshot": "moved to `repos snapshot`",
559
544
  "gitvault:policy": "moved to `repos policy`",
package/lib/config.mjs CHANGED
@@ -12,22 +12,22 @@ import {
12
12
  getLegacyProjectsPath,
13
13
  getProfileStatePath,
14
14
  getProjectCredentialsPath,
15
- getAllowancePath,
15
+ getWalletPath,
16
16
  configureApiBase,
17
17
  isCoreApiTarget,
18
18
  readApiTargetConfig,
19
19
  } from "../core-dist/config.js";
20
- import { readAllowance as coreReadAllowance, saveAllowance as coreSaveAllowance } from "../core-dist/allowance.js";
20
+ import { readWallet as coreReadWallet, saveWallet as coreSaveWallet } from "../core-dist/wallet.js";
21
21
  import { loadKeyStore, getProject, saveProject, updateProject, removeProject, saveKeyStore, getActiveProjectId, setActiveProjectId } from "../core-dist/keystore.js";
22
- import { getAllowanceAuthHeaders as coreGetAllowanceAuthHeaders } from "../core-dist/allowance-auth.js";
22
+ import { getWalletAuthHeaders as coreGetWalletAuthHeaders } from "../core-dist/wallet-auth.js";
23
23
  import { fail } from "./sdk-errors.mjs";
24
24
  import { initializeWalletAction, selectProjectAction } from "./next-actions.mjs";
25
25
 
26
26
  // Wallet-dependent paths are exposed as getters (preferred — they always
27
27
  // reflect the active profile, even if some future code path imports this module
28
- // before wallet resolution). Production code (init/doctor/allowance) uses these.
28
+ // before wallet resolution). Production code (init/doctor/wallet) uses these.
29
29
  export function configDir() { return getConfigDir(); }
30
- export function allowanceFile() { return getAllowancePath(); }
30
+ export function walletFile() { return getWalletPath(); }
31
31
  export function projectCredentialsFile() { return getProjectCredentialsPath(); }
32
32
  export function profileStateFile() { return getProfileStatePath(); }
33
33
  export function legacyProjectsFile() { return getLegacyProjectsPath(); }
@@ -45,7 +45,7 @@ export function activeProfile() { return getActiveProfile(); }
45
45
  // module, and tests set RUN402_CONFIG_DIR before importing. New code should
46
46
  // prefer the getters above.
47
47
  export const CONFIG_DIR = getConfigDir();
48
- export const ALLOWANCE_FILE = getAllowancePath();
48
+ export const WALLET_FILE = getWalletPath();
49
49
  export const PROJECTS_FILE = getProjectCredentialsPath();
50
50
  export const PROJECT_CREDENTIALS_FILE = getProjectCredentialsPath();
51
51
  export const PROFILE_STATE_FILE = getProfileStatePath();
@@ -54,40 +54,40 @@ export const PROFILE_STATE_FILE = getProfileStatePath();
54
54
  export const API = getApiBase();
55
55
 
56
56
  /**
57
- * Wraps core's `readAllowance()` and converts the malformed-shape throw
57
+ * Wraps core's `readWallet()` and converts the malformed-shape throw
58
58
  * into the canonical CLI failure envelope. Without this guard, every
59
- * CLI subcommand that touches the allowance leaks a Node stack trace and
60
- * source paths the moment a user has a malformed `allowance.json`.
59
+ * CLI subcommand that touches the wallet leaks a Node stack trace and
60
+ * source paths the moment a user has a malformed `wallet.json`.
61
61
  *
62
62
  * The unparseable-JSON case still returns `null` (matching the historical
63
- * "no_allowance" UX); only valid-JSON-but-wrong-shape becomes a structured
64
- * error with `code: BAD_ALLOWANCE_FILE`.
63
+ * "no_wallet" UX); only valid-JSON-but-wrong-shape becomes a structured
64
+ * error with `code: BAD_WALLET_FILE`.
65
65
  */
66
- export function readAllowance() {
66
+ export function readWallet() {
67
67
  try {
68
- return coreReadAllowance();
68
+ return coreReadWallet();
69
69
  } catch (err) {
70
70
  fail({
71
- code: "BAD_ALLOWANCE_FILE",
72
- message: err?.message ?? "allowance.json is malformed",
73
- hint: "Back up ~/.config/run402/allowance.json and run 'run402 init' to recreate it.",
74
- details: { path: allowanceFile() },
71
+ code: "BAD_WALLET_FILE",
72
+ message: err?.message ?? "wallet.json is malformed",
73
+ hint: "Back up ~/.config/run402/wallet.json and run 'run402 init' to recreate it.",
74
+ details: { path: walletFile() },
75
75
  next_actions: [initializeWalletAction()],
76
76
  });
77
77
  }
78
78
  }
79
79
 
80
- export function saveAllowance(data) {
81
- coreSaveAllowance(data);
80
+ export function saveWallet(data) {
81
+ coreSaveWallet(data);
82
82
  }
83
83
 
84
- export function allowanceAuthHeaders(path) {
85
- const headers = coreGetAllowanceAuthHeaders(path);
84
+ export function walletAuthHeaders(path) {
85
+ const headers = coreGetWalletAuthHeaders(path);
86
86
  if (!headers) {
87
87
  fail({
88
- code: "NO_ALLOWANCE",
89
- message: "No agent allowance found.",
90
- hint: "Run: run402 allowance create",
88
+ code: "NO_WALLET",
89
+ message: "No local wallet found.",
90
+ hint: "Run: run402 init",
91
91
  next_actions: [initializeWalletAction()],
92
92
  });
93
93
  }
@@ -101,11 +101,11 @@ export function findProject(id) {
101
101
  fail({
102
102
  code: "PROJECT_CREDENTIAL_NOT_FOUND",
103
103
  message: `No local project credentials cached for ${idStr}.`,
104
- hint: "Use a principal-auth command, or import project keys with `run402 credentials project-keys import --project <id> --service-key-stdin`.",
104
+ hint: "Use a principal-auth command, or import project keys with `run402 credentials project-keys import --project <project_id> --service-key-stdin`.",
105
105
  details: { project_id: idStr, source: "local_cache", cache_path: projectCredentialsFile(), wallet: activeProfile(), profile: activeProfile() },
106
106
  next_actions: [{
107
107
  type: "run_command",
108
- command: `run402 credentials project-keys status --project ${idStr || "<id>"}`,
108
+ command: `run402 credentials project-keys status --project ${idStr || "<project_id>"}`,
109
109
  why: "Inspect the local project-key cache without revealing secrets.",
110
110
  }],
111
111
  });
@@ -119,7 +119,7 @@ export function resolveProject(id) {
119
119
  fail({
120
120
  code: "PROJECT_REQUIRED",
121
121
  message: "no project specified and no active project set.",
122
- hint: "Pass --project <id>, set RUN402_PROJECT_ID, or run: run402 projects use <id>",
122
+ hint: "Pass --project <project_id>, set RUN402_PROJECT_ID, or run: run402 projects use <project_id>",
123
123
  next_actions: [selectProjectAction()],
124
124
  });
125
125
  }
@@ -132,7 +132,7 @@ export function resolveProjectId(id) {
132
132
  fail({
133
133
  code: "PROJECT_REQUIRED",
134
134
  message: "no project specified and no active project set.",
135
- hint: "Pass --project <id>, set RUN402_PROJECT_ID, or run: run402 projects use <id>",
135
+ hint: "Pass --project <project_id>, set RUN402_PROJECT_ID, or run: run402 projects use <project_id>",
136
136
  next_actions: [selectProjectAction()],
137
137
  });
138
138
  }