run402-mcp 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 (495) hide show
  1. package/README.md +73 -73
  2. package/core/dist/config.d.ts +16 -2
  3. package/core/dist/config.d.ts.map +1 -1
  4. package/core/dist/config.js +52 -18
  5. package/core/dist/config.js.map +1 -1
  6. package/core/dist/control-plane-session.d.ts +29 -14
  7. package/core/dist/control-plane-session.d.ts.map +1 -1
  8. package/core/dist/control-plane-session.js +31 -6
  9. package/core/dist/control-plane-session.js.map +1 -1
  10. package/core/dist/keystore.js +7 -7
  11. package/core/dist/keystore.js.map +1 -1
  12. package/core/dist/profiles.d.ts +3 -3
  13. package/core/dist/profiles.d.ts.map +1 -1
  14. package/core/dist/profiles.js +9 -7
  15. package/core/dist/profiles.js.map +1 -1
  16. package/core/dist/{allowance-auth.d.ts → wallet-auth.d.ts} +6 -6
  17. package/core/dist/wallet-auth.d.ts.map +1 -0
  18. package/{sdk/core-dist/allowance-auth.js → core/dist/wallet-auth.js} +15 -15
  19. package/core/dist/wallet-auth.js.map +1 -0
  20. package/core/dist/wallet.d.ts +22 -0
  21. package/core/dist/wallet.d.ts.map +1 -0
  22. package/core/dist/{allowance.js → wallet.js} +20 -20
  23. package/core/dist/wallet.js.map +1 -0
  24. package/core/dist/{write-auth-session.d.ts → write-approvals.d.ts} +28 -26
  25. package/core/dist/write-approvals.d.ts.map +1 -0
  26. package/{sdk/core-dist/write-auth-session.js → core/dist/write-approvals.js} +19 -19
  27. package/core/dist/write-approvals.js.map +1 -0
  28. package/dist/active-project.js +2 -2
  29. package/dist/active-project.js.map +1 -1
  30. package/dist/config.d.ts +1 -1
  31. package/dist/config.d.ts.map +1 -1
  32. package/dist/config.js +1 -1
  33. package/dist/config.js.map +1 -1
  34. package/dist/errors.d.ts.map +1 -1
  35. package/dist/errors.js +14 -9
  36. package/dist/errors.js.map +1 -1
  37. package/dist/format-bytes.d.ts +2 -0
  38. package/dist/format-bytes.d.ts.map +1 -0
  39. package/dist/format-bytes.js +24 -0
  40. package/dist/format-bytes.js.map +1 -0
  41. package/dist/index.js +68 -65
  42. package/dist/index.js.map +1 -1
  43. package/dist/sdk.js +2 -2
  44. package/dist/sdk.js.map +1 -1
  45. package/dist/tool-profiles.d.ts +6 -6
  46. package/dist/tool-profiles.d.ts.map +1 -1
  47. package/dist/tool-profiles.js +11 -11
  48. package/dist/tool-profiles.js.map +1 -1
  49. package/dist/tools/admin-reactivate-project.js +1 -1
  50. package/dist/tools/admin-reactivate-project.js.map +1 -1
  51. package/dist/tools/admin-set-lease-perpetual.js +1 -1
  52. package/dist/tools/admin-set-lease-perpetual.js.map +1 -1
  53. package/dist/tools/check-balance.js +4 -4
  54. package/dist/tools/check-balance.js.map +1 -1
  55. package/dist/tools/ci.js +1 -1
  56. package/dist/tools/ci.js.map +1 -1
  57. package/dist/tools/create-email-organization.js +1 -1
  58. package/dist/tools/create-email-organization.js.map +1 -1
  59. package/dist/tools/create-notification-rule.js +3 -3
  60. package/dist/tools/create-notification-rule.js.map +1 -1
  61. package/dist/tools/delete-notification-rule.js +2 -2
  62. package/dist/tools/delete-notification-rule.js.map +1 -1
  63. package/dist/tools/deploy-events.js +2 -2
  64. package/dist/tools/deploy-events.js.map +1 -1
  65. package/dist/tools/deploy-list.js +2 -2
  66. package/dist/tools/deploy-list.js.map +1 -1
  67. package/dist/tools/deploy-rehearse.js +4 -4
  68. package/dist/tools/deploy-rehearse.js.map +1 -1
  69. package/dist/tools/{deploy-release.d.ts → deploy-releases.d.ts} +9 -9
  70. package/dist/tools/deploy-releases.d.ts.map +1 -0
  71. package/dist/tools/{deploy-release.js → deploy-releases.js} +9 -9
  72. package/dist/tools/deploy-releases.js.map +1 -0
  73. package/dist/tools/{deploy-diagnose-url.d.ts → deploy-resolve.d.ts} +4 -4
  74. package/dist/tools/deploy-resolve.d.ts.map +1 -0
  75. package/dist/tools/{deploy-diagnose-url.js → deploy-resolve.js} +6 -6
  76. package/dist/tools/deploy-resolve.js.map +1 -0
  77. package/dist/tools/deploy-resume.js +2 -2
  78. package/dist/tools/deploy-resume.js.map +1 -1
  79. package/dist/tools/deploy-site-dir.js +2 -2
  80. package/dist/tools/deploy-site-dir.js.map +1 -1
  81. package/dist/tools/deploy-site.js +2 -2
  82. package/dist/tools/deploy-site.js.map +1 -1
  83. package/dist/tools/deploy-verify-edge.js +2 -2
  84. package/dist/tools/deploy-verify-edge.js.map +1 -1
  85. package/dist/tools/deploy.js +3 -3
  86. package/dist/tools/deploy.js.map +1 -1
  87. package/dist/tools/domains.d.ts +2 -2
  88. package/dist/tools/domains.d.ts.map +1 -1
  89. package/dist/tools/domains.js +6 -5
  90. package/dist/tools/domains.js.map +1 -1
  91. package/dist/tools/fork-app.js +2 -2
  92. package/dist/tools/fork-app.js.map +1 -1
  93. package/dist/tools/generate-image.js +5 -5
  94. package/dist/tools/generate-image.js.map +1 -1
  95. package/dist/tools/get-agent-contact-status.js +2 -2
  96. package/dist/tools/get-agent-contact-status.js.map +1 -1
  97. package/dist/tools/get-buzz-route.js +1 -1
  98. package/dist/tools/get-buzz-route.js.map +1 -1
  99. package/dist/tools/get-notification-preferences.js +2 -2
  100. package/dist/tools/get-notification-preferences.js.map +1 -1
  101. package/dist/tools/get-quote.js +3 -3
  102. package/dist/tools/get-quote.js.map +1 -1
  103. package/dist/tools/get-room.d.ts +20 -0
  104. package/dist/tools/get-room.d.ts.map +1 -0
  105. package/dist/tools/get-room.js +25 -0
  106. package/dist/tools/get-room.js.map +1 -0
  107. package/dist/tools/get-usage.d.ts.map +1 -1
  108. package/dist/tools/get-usage.js +4 -3
  109. package/dist/tools/get-usage.js.map +1 -1
  110. package/dist/tools/init.js +36 -36
  111. package/dist/tools/init.js.map +1 -1
  112. package/dist/tools/leave-room.d.ts +22 -0
  113. package/dist/tools/leave-room.d.ts.map +1 -0
  114. package/dist/tools/leave-room.js +40 -0
  115. package/dist/tools/leave-room.js.map +1 -0
  116. package/dist/tools/lightning-topup.js +1 -1
  117. package/dist/tools/lightning-topup.js.map +1 -1
  118. package/dist/tools/lightning-wallet.d.ts +2 -2
  119. package/dist/tools/lightning-wallet.js +9 -9
  120. package/dist/tools/lightning-wallet.js.map +1 -1
  121. package/dist/tools/link-wallet-to-organization.d.ts.map +1 -1
  122. package/dist/tools/link-wallet-to-organization.js +4 -3
  123. package/dist/tools/link-wallet-to-organization.js.map +1 -1
  124. package/dist/tools/list-notification-channels.js +2 -2
  125. package/dist/tools/list-notification-channels.js.map +1 -1
  126. package/dist/tools/list-notification-rules.js +2 -2
  127. package/dist/tools/list-notification-rules.js.map +1 -1
  128. package/dist/tools/list-notifications.js +2 -2
  129. package/dist/tools/list-notifications.js.map +1 -1
  130. package/dist/tools/list-projects.js +1 -1
  131. package/dist/tools/list-projects.js.map +1 -1
  132. package/dist/tools/list-rooms.d.ts +18 -0
  133. package/dist/tools/list-rooms.d.ts.map +1 -0
  134. package/dist/tools/list-rooms.js +28 -0
  135. package/dist/tools/list-rooms.js.map +1 -0
  136. package/dist/tools/list-subdomains.js +1 -1
  137. package/dist/tools/list-subdomains.js.map +1 -1
  138. package/dist/tools/orgs.d.ts +4 -4
  139. package/dist/tools/orgs.d.ts.map +1 -1
  140. package/dist/tools/orgs.js +28 -7
  141. package/dist/tools/orgs.js.map +1 -1
  142. package/dist/tools/project-archives.js +1 -1
  143. package/dist/tools/project-archives.js.map +1 -1
  144. package/dist/tools/provision-signer.js +1 -1
  145. package/dist/tools/provision-signer.js.map +1 -1
  146. package/dist/tools/provision.js +3 -3
  147. package/dist/tools/provision.js.map +1 -1
  148. package/dist/tools/redeem-voucher.js +5 -5
  149. package/dist/tools/redeem-voucher.js.map +1 -1
  150. package/dist/tools/request-faucet.js +9 -9
  151. package/dist/tools/request-faucet.js.map +1 -1
  152. package/dist/tools/rotate-webhook-secret.js +2 -2
  153. package/dist/tools/rotate-webhook-secret.js.map +1 -1
  154. package/dist/tools/send-feedback.js +3 -3
  155. package/dist/tools/send-feedback.js.map +1 -1
  156. package/dist/tools/set-agent-contact.js +2 -2
  157. package/dist/tools/set-agent-contact.js.map +1 -1
  158. package/dist/tools/set-notification-preferences.js +3 -3
  159. package/dist/tools/set-notification-preferences.js.map +1 -1
  160. package/dist/tools/start-contact-passkey-enrollment.d.ts +9 -0
  161. package/dist/tools/start-contact-passkey-enrollment.d.ts.map +1 -0
  162. package/dist/tools/start-contact-passkey-enrollment.js +18 -0
  163. package/dist/tools/start-contact-passkey-enrollment.js.map +1 -0
  164. package/dist/tools/status.d.ts.map +1 -1
  165. package/dist/tools/status.js +17 -16
  166. package/dist/tools/status.js.map +1 -1
  167. package/dist/tools/subdomain.d.ts +2 -2
  168. package/dist/tools/subdomain.d.ts.map +1 -1
  169. package/dist/tools/subdomain.js +4 -4
  170. package/dist/tools/subdomain.js.map +1 -1
  171. package/dist/tools/test-notification.js +2 -2
  172. package/dist/tools/test-notification.js.map +1 -1
  173. package/dist/tools/{set-tier.d.ts → tier-set.d.ts} +3 -3
  174. package/dist/tools/{set-tier.d.ts.map → tier-set.d.ts.map} +1 -1
  175. package/dist/tools/{set-tier.js → tier-set.js} +14 -8
  176. package/dist/tools/tier-set.js.map +1 -0
  177. package/dist/tools/tier-status.d.ts.map +1 -1
  178. package/dist/tools/tier-status.js +6 -4
  179. package/dist/tools/tier-status.js.map +1 -1
  180. package/dist/tools/transfers.d.ts +9 -15
  181. package/dist/tools/transfers.d.ts.map +1 -1
  182. package/dist/tools/transfers.js +44 -58
  183. package/dist/tools/transfers.js.map +1 -1
  184. package/dist/tools/{app-up.d.ts → up.d.ts} +3 -3
  185. package/dist/tools/up.d.ts.map +1 -0
  186. package/dist/tools/{app-up.js → up.js} +6 -6
  187. package/dist/tools/up.js.map +1 -0
  188. package/dist/tools/verify-agent-contact-email.js +2 -2
  189. package/dist/tools/verify-agent-contact-email.js.map +1 -1
  190. package/dist/tools/wallet-create.d.ts +9 -0
  191. package/dist/tools/wallet-create.d.ts.map +1 -0
  192. package/dist/tools/{allowance-create.js → wallet-create.js} +8 -8
  193. package/dist/tools/wallet-create.js.map +1 -0
  194. package/dist/tools/wallet-export.d.ts +9 -0
  195. package/dist/tools/wallet-export.d.ts.map +1 -0
  196. package/dist/tools/{allowance-export.js → wallet-export.js} +6 -6
  197. package/dist/tools/wallet-export.js.map +1 -0
  198. package/dist/tools/wallet-status.d.ts +9 -0
  199. package/dist/tools/wallet-status.d.ts.map +1 -0
  200. package/dist/tools/wallet-status.js +33 -0
  201. package/dist/tools/wallet-status.js.map +1 -0
  202. package/dist/wallet-auth.d.ts +21 -0
  203. package/dist/wallet-auth.d.ts.map +1 -0
  204. package/dist/wallet-auth.js +32 -0
  205. package/dist/wallet-auth.js.map +1 -0
  206. package/dist/wallet.d.ts +3 -0
  207. package/dist/wallet.d.ts.map +1 -0
  208. package/dist/wallet.js +2 -0
  209. package/dist/wallet.js.map +1 -0
  210. package/package.json +3 -3
  211. package/schemas/release-spec.v1.json +2 -6
  212. package/sdk/README.md +40 -38
  213. package/sdk/core-dist/config.d.ts +16 -2
  214. package/sdk/core-dist/config.js +52 -18
  215. package/sdk/core-dist/control-plane-session.d.ts +29 -14
  216. package/sdk/core-dist/control-plane-session.js +31 -6
  217. package/sdk/core-dist/keystore.js +7 -7
  218. package/sdk/core-dist/profiles.d.ts +3 -3
  219. package/sdk/core-dist/profiles.js +9 -7
  220. package/sdk/core-dist/{allowance-auth.d.ts → wallet-auth.d.ts} +6 -6
  221. package/{core/dist/allowance-auth.js → sdk/core-dist/wallet-auth.js} +15 -15
  222. package/sdk/core-dist/wallet.d.ts +22 -0
  223. package/sdk/core-dist/{allowance.js → wallet.js} +20 -20
  224. package/sdk/core-dist/{write-auth-session.d.ts → write-approvals.d.ts} +28 -26
  225. package/{core/dist/write-auth-session.js → sdk/core-dist/write-approvals.js} +19 -19
  226. package/sdk/dist/actions.d.ts +4 -4
  227. package/sdk/dist/actions.d.ts.map +1 -1
  228. package/sdk/dist/app-up.d.ts +2 -2
  229. package/sdk/dist/app-up.d.ts.map +1 -1
  230. package/sdk/dist/config.d.ts +1 -2
  231. package/sdk/dist/config.d.ts.map +1 -1
  232. package/sdk/dist/config.js.map +1 -1
  233. package/sdk/dist/control-plane-credentials.d.ts +8 -8
  234. package/sdk/dist/control-plane-credentials.js +7 -7
  235. package/sdk/dist/credentials.d.ts +20 -20
  236. package/sdk/dist/credentials.d.ts.map +1 -1
  237. package/sdk/dist/credentials.js +1 -1
  238. package/sdk/dist/errors.d.ts +26 -28
  239. package/sdk/dist/errors.d.ts.map +1 -1
  240. package/sdk/dist/errors.js +35 -38
  241. package/sdk/dist/errors.js.map +1 -1
  242. package/sdk/dist/index.d.ts +29 -16
  243. package/sdk/dist/index.d.ts.map +1 -1
  244. package/sdk/dist/index.js +30 -17
  245. package/sdk/dist/index.js.map +1 -1
  246. package/sdk/dist/kernel.d.ts +1 -1
  247. package/sdk/dist/kernel.d.ts.map +1 -1
  248. package/sdk/dist/kernel.js +10 -9
  249. package/sdk/dist/kernel.js.map +1 -1
  250. package/sdk/dist/namespaces/admin.d.ts +52 -121
  251. package/sdk/dist/namespaces/admin.d.ts.map +1 -1
  252. package/sdk/dist/namespaces/admin.js +41 -45
  253. package/sdk/dist/namespaces/admin.js.map +1 -1
  254. package/sdk/dist/namespaces/agent.d.ts +2 -2
  255. package/sdk/dist/namespaces/agent.d.ts.map +1 -1
  256. package/sdk/dist/namespaces/agent.js +2 -2
  257. package/sdk/dist/namespaces/agent.js.map +1 -1
  258. package/sdk/dist/namespaces/ai.d.ts +2 -2
  259. package/sdk/dist/namespaces/ai.js +3 -3
  260. package/sdk/dist/namespaces/ai.js.map +1 -1
  261. package/sdk/dist/namespaces/assets.js +1 -1
  262. package/sdk/dist/namespaces/assets.js.map +1 -1
  263. package/sdk/dist/namespaces/billing.d.ts +6 -3
  264. package/sdk/dist/namespaces/billing.d.ts.map +1 -1
  265. package/sdk/dist/namespaces/billing.js.map +1 -1
  266. package/sdk/dist/namespaces/buzz-notifications.types.d.ts +1 -1
  267. package/sdk/dist/namespaces/buzz.d.ts +2 -2
  268. package/sdk/dist/namespaces/buzz.d.ts.map +1 -1
  269. package/sdk/dist/namespaces/buzz.js +2 -2
  270. package/sdk/dist/namespaces/buzz.js.map +1 -1
  271. package/sdk/dist/namespaces/buzz.types.d.ts +2 -2
  272. package/sdk/dist/namespaces/buzz.types.d.ts.map +1 -1
  273. package/sdk/dist/namespaces/ci.js +3 -3
  274. package/sdk/dist/namespaces/ci.js.map +1 -1
  275. package/sdk/dist/namespaces/credentials.types.d.ts +1 -1
  276. package/sdk/dist/namespaces/deploy.d.ts +1 -1
  277. package/sdk/dist/namespaces/deploy.d.ts.map +1 -1
  278. package/sdk/dist/namespaces/deploy.js +31 -32
  279. package/sdk/dist/namespaces/deploy.js.map +1 -1
  280. package/sdk/dist/namespaces/deploy.types.d.ts +6 -6
  281. package/sdk/dist/namespaces/deploy.types.d.ts.map +1 -1
  282. package/sdk/dist/namespaces/domains.d.ts +10 -2
  283. package/sdk/dist/namespaces/domains.d.ts.map +1 -1
  284. package/sdk/dist/namespaces/domains.js +10 -5
  285. package/sdk/dist/namespaces/domains.js.map +1 -1
  286. package/sdk/dist/namespaces/errors.js +1 -1
  287. package/sdk/dist/namespaces/escalations.d.ts +1 -1
  288. package/sdk/dist/namespaces/escalations.js +1 -1
  289. package/sdk/dist/namespaces/escalations.types.d.ts +2 -2
  290. package/sdk/dist/namespaces/escalations.types.d.ts.map +1 -1
  291. package/sdk/dist/namespaces/events.types.d.ts +1 -1
  292. package/sdk/dist/namespaces/functions.d.ts +1 -1
  293. package/sdk/dist/namespaces/functions.js +2 -2
  294. package/sdk/dist/namespaces/functions.js.map +1 -1
  295. package/sdk/dist/namespaces/gitvault.crypto.d.ts +1 -1
  296. package/sdk/dist/namespaces/gitvault.d.ts +26 -26
  297. package/sdk/dist/namespaces/gitvault.d.ts.map +1 -1
  298. package/sdk/dist/namespaces/gitvault.js +113 -113
  299. package/sdk/dist/namespaces/gitvault.js.map +1 -1
  300. package/sdk/dist/namespaces/me.d.ts +120 -0
  301. package/sdk/dist/namespaces/me.d.ts.map +1 -0
  302. package/sdk/dist/namespaces/me.js +34 -0
  303. package/sdk/dist/namespaces/me.js.map +1 -0
  304. package/sdk/dist/namespaces/org.d.ts +108 -6
  305. package/sdk/dist/namespaces/org.d.ts.map +1 -1
  306. package/sdk/dist/namespaces/org.js +63 -7
  307. package/sdk/dist/namespaces/org.js.map +1 -1
  308. package/sdk/dist/namespaces/org.types.d.ts +29 -9
  309. package/sdk/dist/namespaces/org.types.d.ts.map +1 -1
  310. package/sdk/dist/namespaces/pay.js +3 -3
  311. package/sdk/dist/namespaces/pay.js.map +1 -1
  312. package/sdk/dist/namespaces/projects.d.ts +9 -9
  313. package/sdk/dist/namespaces/projects.js +15 -15
  314. package/sdk/dist/namespaces/projects.js.map +1 -1
  315. package/sdk/dist/namespaces/projects.types.d.ts +28 -12
  316. package/sdk/dist/namespaces/projects.types.d.ts.map +1 -1
  317. package/sdk/dist/namespaces/rooms.d.ts +7 -7
  318. package/sdk/dist/namespaces/rooms.js +17 -17
  319. package/sdk/dist/namespaces/rooms.js.map +1 -1
  320. package/sdk/dist/namespaces/rooms.types.d.ts +9 -9
  321. package/sdk/dist/namespaces/rooms.types.d.ts.map +1 -1
  322. package/sdk/dist/namespaces/service.d.ts +1 -1
  323. package/sdk/dist/namespaces/service.js +1 -1
  324. package/sdk/dist/namespaces/{operator-session.d.ts → session.d.ts} +135 -51
  325. package/sdk/dist/namespaces/session.d.ts.map +1 -0
  326. package/sdk/dist/namespaces/{operator-session.js → session.js} +118 -30
  327. package/sdk/dist/namespaces/session.js.map +1 -0
  328. package/sdk/dist/namespaces/subdomains.d.ts +5 -5
  329. package/sdk/dist/namespaces/subdomains.d.ts.map +1 -1
  330. package/sdk/dist/namespaces/subdomains.js +6 -6
  331. package/sdk/dist/namespaces/subdomains.js.map +1 -1
  332. package/sdk/dist/namespaces/tier.d.ts +44 -21
  333. package/sdk/dist/namespaces/tier.d.ts.map +1 -1
  334. package/sdk/dist/namespaces/tier.js +7 -7
  335. package/sdk/dist/namespaces/tier.js.map +1 -1
  336. package/sdk/dist/namespaces/transfers.d.ts +119 -85
  337. package/sdk/dist/namespaces/transfers.d.ts.map +1 -1
  338. package/sdk/dist/namespaces/transfers.js +31 -38
  339. package/sdk/dist/namespaces/transfers.js.map +1 -1
  340. package/sdk/dist/namespaces/vouchers.d.ts +9 -10
  341. package/sdk/dist/namespaces/vouchers.d.ts.map +1 -1
  342. package/sdk/dist/namespaces/vouchers.js +4 -5
  343. package/sdk/dist/namespaces/vouchers.js.map +1 -1
  344. package/sdk/dist/namespaces/wallets.d.ts +72 -3
  345. package/sdk/dist/namespaces/wallets.d.ts.map +1 -1
  346. package/sdk/dist/namespaces/wallets.js +141 -3
  347. package/sdk/dist/namespaces/wallets.js.map +1 -1
  348. package/sdk/dist/namespaces/write-approval.d.ts +101 -0
  349. package/sdk/dist/namespaces/write-approval.d.ts.map +1 -0
  350. package/sdk/dist/namespaces/write-approval.js +62 -0
  351. package/sdk/dist/namespaces/write-approval.js.map +1 -0
  352. package/sdk/dist/node/actions-node.d.ts +3 -3
  353. package/sdk/dist/node/actions-node.d.ts.map +1 -1
  354. package/sdk/dist/node/actions-node.js +44 -44
  355. package/sdk/dist/node/actions-node.js.map +1 -1
  356. package/sdk/dist/node/assets-node.js +6 -6
  357. package/sdk/dist/node/assets-node.js.map +1 -1
  358. package/sdk/dist/node/{bearer-claim-key.d.ts → bearer-redeem-key.d.ts} +12 -12
  359. package/sdk/dist/node/bearer-redeem-key.d.ts.map +1 -0
  360. package/sdk/dist/node/{bearer-claim-key.js → bearer-redeem-key.js} +21 -21
  361. package/sdk/dist/node/bearer-redeem-key.js.map +1 -0
  362. package/sdk/dist/node/ci.d.ts +1 -1
  363. package/sdk/dist/node/ci.d.ts.map +1 -1
  364. package/sdk/dist/node/ci.js +6 -6
  365. package/sdk/dist/node/ci.js.map +1 -1
  366. package/sdk/dist/node/credentials.d.ts +18 -17
  367. package/sdk/dist/node/credentials.d.ts.map +1 -1
  368. package/sdk/dist/node/credentials.js +29 -28
  369. package/sdk/dist/node/credentials.js.map +1 -1
  370. package/sdk/dist/node/deploy-manifest.d.ts +3 -5
  371. package/sdk/dist/node/deploy-manifest.d.ts.map +1 -1
  372. package/sdk/dist/node/deploy-manifest.js +3 -12
  373. package/sdk/dist/node/deploy-manifest.js.map +1 -1
  374. package/sdk/dist/node/funding-recovery.d.ts +1 -1
  375. package/sdk/dist/node/funding-recovery.d.ts.map +1 -1
  376. package/sdk/dist/node/funding-recovery.js +1 -1
  377. package/sdk/dist/node/funding-recovery.js.map +1 -1
  378. package/sdk/dist/node/gitvault-apply.d.ts +1 -1
  379. package/sdk/dist/node/gitvault-apply.d.ts.map +1 -1
  380. package/sdk/dist/node/gitvault-apply.js +1 -1
  381. package/sdk/dist/node/gitvault-apply.js.map +1 -1
  382. package/sdk/dist/node/gitvault-handoff.d.ts +22 -22
  383. package/sdk/dist/node/gitvault-handoff.d.ts.map +1 -1
  384. package/sdk/dist/node/gitvault-handoff.js +45 -45
  385. package/sdk/dist/node/gitvault-handoff.js.map +1 -1
  386. package/sdk/dist/node/gitvault-prewarm.js +7 -7
  387. package/sdk/dist/node/gitvault-prewarm.js.map +1 -1
  388. package/sdk/dist/node/gitvault-restore.d.ts +1 -1
  389. package/sdk/dist/node/gitvault-restore.js +1 -1
  390. package/sdk/dist/node/index.d.ts +16 -16
  391. package/sdk/dist/node/index.d.ts.map +1 -1
  392. package/sdk/dist/node/index.js +15 -15
  393. package/sdk/dist/node/index.js.map +1 -1
  394. package/sdk/dist/node/manifest-export.js +2 -2
  395. package/sdk/dist/node/manifest-export.js.map +1 -1
  396. package/sdk/dist/node/org-adopt.d.ts +49 -0
  397. package/sdk/dist/node/org-adopt.d.ts.map +1 -0
  398. package/sdk/dist/node/org-adopt.js +77 -0
  399. package/sdk/dist/node/org-adopt.js.map +1 -0
  400. package/sdk/dist/node/paid-fetch.d.ts +7 -7
  401. package/sdk/dist/node/paid-fetch.d.ts.map +1 -1
  402. package/sdk/dist/node/paid-fetch.js +54 -54
  403. package/sdk/dist/node/paid-fetch.js.map +1 -1
  404. package/sdk/dist/node/preflight.d.ts +1 -1
  405. package/sdk/dist/node/preflight.d.ts.map +1 -1
  406. package/sdk/dist/node/preflight.js +1 -1
  407. package/sdk/dist/node/preflight.js.map +1 -1
  408. package/sdk/dist/node/sites-node.js +1 -1
  409. package/sdk/dist/node/sites-node.js.map +1 -1
  410. package/sdk/dist/node/source-scan.d.ts +1 -1
  411. package/sdk/dist/node/source-scan.js +2 -2
  412. package/sdk/dist/node/source-scan.js.map +1 -1
  413. package/sdk/dist/scoped.d.ts +11 -11
  414. package/sdk/dist/scoped.d.ts.map +1 -1
  415. package/sdk/dist/scoped.js +5 -5
  416. package/sdk/dist/scoped.js.map +1 -1
  417. package/core/dist/allowance-auth.d.ts.map +0 -1
  418. package/core/dist/allowance-auth.js.map +0 -1
  419. package/core/dist/allowance.d.ts +0 -22
  420. package/core/dist/allowance.d.ts.map +0 -1
  421. package/core/dist/allowance.js.map +0 -1
  422. package/core/dist/operator-session.d.ts +0 -80
  423. package/core/dist/operator-session.d.ts.map +0 -1
  424. package/core/dist/operator-session.js +0 -154
  425. package/core/dist/operator-session.js.map +0 -1
  426. package/core/dist/write-auth-session.d.ts.map +0 -1
  427. package/core/dist/write-auth-session.js.map +0 -1
  428. package/dist/allowance-auth.d.ts +0 -21
  429. package/dist/allowance-auth.d.ts.map +0 -1
  430. package/dist/allowance-auth.js +0 -32
  431. package/dist/allowance-auth.js.map +0 -1
  432. package/dist/allowance.d.ts +0 -3
  433. package/dist/allowance.d.ts.map +0 -1
  434. package/dist/allowance.js +0 -2
  435. package/dist/allowance.js.map +0 -1
  436. package/dist/tools/add-custom-domain.d.ts +0 -18
  437. package/dist/tools/add-custom-domain.d.ts.map +0 -1
  438. package/dist/tools/add-custom-domain.js +0 -19
  439. package/dist/tools/add-custom-domain.js.map +0 -1
  440. package/dist/tools/allowance-create.d.ts +0 -9
  441. package/dist/tools/allowance-create.d.ts.map +0 -1
  442. package/dist/tools/allowance-create.js.map +0 -1
  443. package/dist/tools/allowance-export.d.ts +0 -9
  444. package/dist/tools/allowance-export.d.ts.map +0 -1
  445. package/dist/tools/allowance-export.js.map +0 -1
  446. package/dist/tools/allowance-status.d.ts +0 -9
  447. package/dist/tools/allowance-status.d.ts.map +0 -1
  448. package/dist/tools/allowance-status.js +0 -33
  449. package/dist/tools/allowance-status.js.map +0 -1
  450. package/dist/tools/app-up.d.ts.map +0 -1
  451. package/dist/tools/app-up.js.map +0 -1
  452. package/dist/tools/check-domain-status.d.ts +0 -16
  453. package/dist/tools/check-domain-status.d.ts.map +0 -1
  454. package/dist/tools/check-domain-status.js +0 -12
  455. package/dist/tools/check-domain-status.js.map +0 -1
  456. package/dist/tools/deploy-diagnose-url.d.ts.map +0 -1
  457. package/dist/tools/deploy-diagnose-url.js.map +0 -1
  458. package/dist/tools/deploy-release.d.ts.map +0 -1
  459. package/dist/tools/deploy-release.js.map +0 -1
  460. package/dist/tools/get-operator-status.d.ts +0 -9
  461. package/dist/tools/get-operator-status.d.ts.map +0 -1
  462. package/dist/tools/get-operator-status.js +0 -17
  463. package/dist/tools/get-operator-status.js.map +0 -1
  464. package/dist/tools/list-custom-domains.d.ts +0 -14
  465. package/dist/tools/list-custom-domains.d.ts.map +0 -1
  466. package/dist/tools/list-custom-domains.js +0 -11
  467. package/dist/tools/list-custom-domains.js.map +0 -1
  468. package/dist/tools/remove-custom-domain.d.ts +0 -16
  469. package/dist/tools/remove-custom-domain.d.ts.map +0 -1
  470. package/dist/tools/remove-custom-domain.js +0 -15
  471. package/dist/tools/remove-custom-domain.js.map +0 -1
  472. package/dist/tools/set-tier.js.map +0 -1
  473. package/dist/tools/start-operator-passkey-enrollment.d.ts +0 -9
  474. package/dist/tools/start-operator-passkey-enrollment.d.ts.map +0 -1
  475. package/dist/tools/start-operator-passkey-enrollment.js +0 -18
  476. package/dist/tools/start-operator-passkey-enrollment.js.map +0 -1
  477. package/sdk/core-dist/allowance.d.ts +0 -22
  478. package/sdk/core-dist/operator-session.d.ts +0 -80
  479. package/sdk/core-dist/operator-session.js +0 -154
  480. package/sdk/dist/namespaces/allowance.d.ts +0 -79
  481. package/sdk/dist/namespaces/allowance.d.ts.map +0 -1
  482. package/sdk/dist/namespaces/allowance.js +0 -149
  483. package/sdk/dist/namespaces/allowance.js.map +0 -1
  484. package/sdk/dist/namespaces/operator-session.d.ts.map +0 -1
  485. package/sdk/dist/namespaces/operator-session.js.map +0 -1
  486. package/sdk/dist/namespaces/operator.d.ts +0 -359
  487. package/sdk/dist/namespaces/operator.d.ts.map +0 -1
  488. package/sdk/dist/namespaces/operator.js +0 -272
  489. package/sdk/dist/namespaces/operator.js.map +0 -1
  490. package/sdk/dist/node/bearer-claim-key.d.ts.map +0 -1
  491. package/sdk/dist/node/bearer-claim-key.js.map +0 -1
  492. package/sdk/dist/node/operator-claim.d.ts +0 -49
  493. package/sdk/dist/node/operator-claim.d.ts.map +0 -1
  494. package/sdk/dist/node/operator-claim.js +0 -77
  495. package/sdk/dist/node/operator-claim.js.map +0 -1
@@ -1,33 +1,40 @@
1
1
  /**
2
- * A cached **control-plane session** — the human principal's bearer, minted by
3
- * the loopback-PKCE flow (`run402 operator login --loopback`). Distinct from the
4
- * device-flow {@link OperatorSession} (read-only): this one carries `provenance`
5
- * (`loopback_pkce`) and `amr`. It authorizes most control-plane operations, but
6
- * since gateway v1.85/v1.87 it is NOT sufficient on its own for the high-stakes
7
- * writes `provision` / `deploy` / secrets — those additionally require a
8
- * passkey-fresh **operator approval** (`X-Run402-Write-Auth`, minted by
9
- * `run402 operator approve`; see {@link WriteAuthApproval}). Cached at the BASE
10
- * config dir (email/principal-scoped, shared across local named wallets), mode
11
- * 0600 — the token is as sensitive as the allowance key.
2
+ * The cached **sign-in session** — a person's one Run402 session, bound to
3
+ * their principal and graded by how it was minted: `loopback` (`run402 login`,
4
+ * the loopback-PKCE browser ceremony; full, step-up-able) or `device`
5
+ * (`run402 login --device`, RFC 8628; read-only — the gateway refuses every
6
+ * mutation with `SESSION_READ_ONLY`). The wire token class is
7
+ * `control_plane_session`. The session authorizes most control-plane writes,
8
+ * but provisioning, deploying, and writing secrets additionally need a
9
+ * passkey-signed **write approval** (`X-Run402-Write-Approval`, minted by
10
+ * `run402 approve`; see `write-approvals.ts`). Cached at the BASE config dir
11
+ * (principal-scoped, shared across local named wallets), mode 0600 — the token
12
+ * is as sensitive as the wallet key.
12
13
  *
13
14
  * Stored shape vs the gateway payload: the gateway returns a relative
14
15
  * `expires_in` (seconds); we persist the absolute `expires_at` (epoch ms) so a
15
16
  * cached session can be expiry-checked without knowing when it was written.
16
17
  */
18
+ /** How a sign-in session was minted, as the gateway reports it. */
19
+ export type SessionGrade = "browser" | "loopback" | "device";
17
20
  export interface ControlPlaneSessionCache {
18
21
  control_plane_session_token: string;
19
22
  token_type: string;
20
- provenance: string;
23
+ grade: SessionGrade;
21
24
  principal_id: string;
22
25
  amr: string[];
23
26
  /** Epoch ms when the session expires (issued_at + expires_in). */
24
27
  expires_at: number;
25
28
  }
26
- /** The token payload returned by `POST /agent/v1/control-plane/cli/token`. */
29
+ /**
30
+ * The token payload returned by `POST /agent/v1/control-plane/cli/token`
31
+ * (grade `loopback`) and `POST /agent/v1/control-plane/cli/device/token`
32
+ * (grade `device`).
33
+ */
27
34
  export interface ControlPlaneSessionTokenResponse {
28
35
  control_plane_session_token: string;
29
36
  token_type?: string;
30
- provenance?: string;
37
+ grade?: string;
31
38
  principal_id?: string;
32
39
  amr?: string[];
33
40
  expires_in?: number;
@@ -45,7 +52,7 @@ export declare function getControlPlaneSessionPath(): string;
45
52
  export declare function readControlPlaneSession(path?: string): ControlPlaneSessionCache | null;
46
53
  /** Persist a control-plane session atomically (temp-file + rename), mode 0600. */
47
54
  export declare function saveControlPlaneSession(data: ControlPlaneSessionCache, path?: string): void;
48
- /** Delete the cached control-plane session — local half of `operator logout`. Idempotent. */
55
+ /** Delete the cached sign-in session — local half of `run402 logout`. Idempotent. */
49
56
  export declare function clearControlPlaneSession(path?: string): void;
50
57
  /** Whether a cached session is past its usable life (with a small skew buffer). */
51
58
  export declare function isControlPlaneSessionExpired(session: ControlPlaneSessionCache, nowMs?: number, skewMs?: number): boolean;
@@ -53,4 +60,12 @@ export declare function isControlPlaneSessionExpired(session: ControlPlaneSessio
53
60
  export declare function loadLiveControlPlaneSession(path?: string, nowMs?: number): ControlPlaneSessionCache | null;
54
61
  /** Map a gateway token payload (relative `expires_in`) into the cached shape (absolute `expires_at`). */
55
62
  export declare function controlPlaneSessionFromTokenResponse(resp: ControlPlaneSessionTokenResponse, nowMs?: number): ControlPlaneSessionCache;
63
+ /**
64
+ * Delete the session caches of the retired email-scoped session
65
+ * (`{base}/operator-session.json`) and the retired approval cache file
66
+ * (`{base}/write-auth-session.json`). Neither is read any more; `run402 login`
67
+ * and `run402 logout` call this so a stale token does not linger on disk.
68
+ * Best-effort and idempotent.
69
+ */
70
+ export declare function clearRetiredSessionCaches(): void;
56
71
  //# sourceMappingURL=control-plane-session.d.ts.map
@@ -10,6 +10,14 @@ export function getControlPlaneSessionPath() {
10
10
  return (process.env.RUN402_CONTROL_PLANE_SESSION_PATH ||
11
11
  join(getConfigBaseDir(), "control-plane-session.json"));
12
12
  }
13
+ /**
14
+ * Read a wire grade. An unknown or absent value is treated as `device` (the
15
+ * read-only grade) so a cache the client cannot classify never claims more
16
+ * authority than the gateway will grant.
17
+ */
18
+ function toGrade(raw) {
19
+ return raw === "browser" || raw === "loopback" || raw === "device" ? raw : "device";
20
+ }
13
21
  /** Tighten 0600 if group/other-readable, warning once. Best-effort, POSIX-only. */
14
22
  function selfHealPermissions(p) {
15
23
  if (process.platform === "win32")
@@ -50,20 +58,20 @@ export function readControlPlaneSession(path) {
50
58
  return null;
51
59
  }
52
60
  if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
53
- throw new Error("control-plane-session.json must contain a JSON object. Delete it and run 'run402 operator login --loopback' to recreate it.");
61
+ throw new Error("control-plane-session.json must contain a JSON object. Delete it and run 'run402 login' to recreate it.");
54
62
  }
55
63
  const data = parsed;
56
64
  if (typeof data.control_plane_session_token !== "string" ||
57
65
  data.control_plane_session_token.length === 0) {
58
- throw new Error("control-plane-session.json missing valid 'control_plane_session_token'. Run 'run402 operator login --loopback' to refresh it.");
66
+ throw new Error("control-plane-session.json missing valid 'control_plane_session_token'. Run 'run402 login' to refresh it.");
59
67
  }
60
68
  if (typeof data.expires_at !== "number" || !Number.isFinite(data.expires_at)) {
61
- throw new Error("control-plane-session.json missing valid 'expires_at'. Run 'run402 operator login --loopback' to refresh it.");
69
+ throw new Error("control-plane-session.json missing valid 'expires_at'. Run 'run402 login' to refresh it.");
62
70
  }
63
71
  return {
64
72
  control_plane_session_token: data.control_plane_session_token,
65
73
  token_type: typeof data.token_type === "string" ? data.token_type : "Bearer",
66
- provenance: typeof data.provenance === "string" ? data.provenance : "loopback_pkce",
74
+ grade: toGrade(data.grade),
67
75
  principal_id: typeof data.principal_id === "string" ? data.principal_id : "",
68
76
  amr: Array.isArray(data.amr) ? data.amr.filter((a) => typeof a === "string") : [],
69
77
  expires_at: data.expires_at,
@@ -79,7 +87,7 @@ export function saveControlPlaneSession(data, path) {
79
87
  renameSync(tmp, p);
80
88
  chmodSync(p, 0o600);
81
89
  }
82
- /** Delete the cached control-plane session — local half of `operator logout`. Idempotent. */
90
+ /** Delete the cached sign-in session — local half of `run402 logout`. Idempotent. */
83
91
  export function clearControlPlaneSession(path) {
84
92
  const p = path ?? getControlPlaneSessionPath();
85
93
  try {
@@ -105,10 +113,27 @@ export function controlPlaneSessionFromTokenResponse(resp, nowMs = Date.now()) {
105
113
  return {
106
114
  control_plane_session_token: resp.control_plane_session_token,
107
115
  token_type: resp.token_type ?? "Bearer",
108
- provenance: resp.provenance ?? "loopback_pkce",
116
+ grade: toGrade(resp.grade),
109
117
  principal_id: resp.principal_id ?? "",
110
118
  amr: Array.isArray(resp.amr) ? resp.amr.filter((a) => typeof a === "string") : [],
111
119
  expires_at: nowMs + (typeof resp.expires_in === "number" ? resp.expires_in : 0) * 1000,
112
120
  };
113
121
  }
122
+ /**
123
+ * Delete the session caches of the retired email-scoped session
124
+ * (`{base}/operator-session.json`) and the retired approval cache file
125
+ * (`{base}/write-auth-session.json`). Neither is read any more; `run402 login`
126
+ * and `run402 logout` call this so a stale token does not linger on disk.
127
+ * Best-effort and idempotent.
128
+ */
129
+ export function clearRetiredSessionCaches() {
130
+ for (const name of ["operator-session.json", "write-auth-session.json"]) {
131
+ try {
132
+ rmSync(join(getConfigBaseDir(), name), { force: true });
133
+ }
134
+ catch {
135
+ // Best-effort: a failed unlink never blocks login or logout.
136
+ }
137
+ }
138
+ }
114
139
  //# sourceMappingURL=control-plane-session.js.map
@@ -3,7 +3,7 @@ import { dirname, join } from "node:path";
3
3
  import { randomBytes } from "node:crypto";
4
4
  import { getLegacyProjectsPath, getProjectCredentialsPath } from "./config.js";
5
5
  import { clearActiveProjectId as clearProfileActiveProjectId, getActiveProjectId as getProfileActiveProjectId, recordMigration, setActiveProjectId as setProfileActiveProjectId, } from "./profile-state.js";
6
- import { readAllowance } from "./allowance.js";
6
+ import { readWallet } from "./wallet.js";
7
7
  function withFileLock(path, fn, { retries = 200, delayMs = 20 } = {}) {
8
8
  const lockDir = path + ".lock";
9
9
  mkdirSync(dirname(path), { recursive: true });
@@ -99,7 +99,7 @@ function migrateLegacyProjectsJson(targetPath) {
99
99
  // Scoped the same way every other write in this module now is (see
100
100
  // `currentPrincipal`'s doc comment) — an unscoped write here is exactly
101
101
  // what poisons the "unknown"-principal bucket for good on a machine that
102
- // migrates before its wallet allowance exists yet.
102
+ // migrates before its wallet exists yet.
103
103
  setProfileActiveProjectId(legacy.active_project_id, undefined, { principal: currentPrincipal() });
104
104
  }
105
105
  recordMigration("projects_json_import", {
@@ -174,7 +174,7 @@ export function removeProject(projectId, path) {
174
174
  }
175
175
  /**
176
176
  * The active-project scope's `principal`, derived from the CURRENT wallet's
177
- * allowance — matching exactly what `NodeCredentialsProvider.setActiveProject`
177
+ * wallet — matching exactly what `NodeCredentialsProvider.setActiveProject`
178
178
  * (sdk/src/node/credentials.ts) writes after `projects.provision` /
179
179
  * `projects.use`. Without this, every reader here used the profile-state
180
180
  * module's own default (empty) scope, which resolves to a FIXED
@@ -185,7 +185,7 @@ export function removeProject(projectId, path) {
185
185
  * `profile-state.ts#getActiveProjectId` happens to agree), but once the
186
186
  * "unknown" bucket is EVER populated by any principal-less write — the
187
187
  * one-time legacy `projects.json` migration below, or any provision/`use`
188
- * call made before this machine had a wallet allowance — it never gets
188
+ * call made before this machine had a wallet — it never gets
189
189
  * updated again (real wallet operations write to the principal-keyed
190
190
  * bucket, not "unknown") and PERMANENTLY shadows every later wallet-scoped
191
191
  * activation for every caller that reads through this module: `resolveProjectId`
@@ -197,13 +197,13 @@ export function removeProject(projectId, path) {
197
197
  * stale "unknown"-bucket entry first and never falls through to the
198
198
  * freshly-updated flat value.
199
199
  *
200
- * Best-effort: an unreadable/malformed allowance degrades to `null` (the
200
+ * Best-effort: an unreadable/malformed wallet degrades to `null` (the
201
201
  * "unknown" bucket callers tolerate), never a
202
- * throw — this is a read-scoping concern, not an allowance-validity one.
202
+ * throw — this is a read-scoping concern, not a wallet-validity one.
203
203
  */
204
204
  function currentPrincipal() {
205
205
  try {
206
- return readAllowance()?.address ?? null;
206
+ return readWallet()?.address ?? null;
207
207
  }
208
208
  catch {
209
209
  return null;
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * A "wallet" is a whole config directory. The reserved `default` wallet lives
5
5
  * at the base config dir (zero migration for existing installs); every named
6
- * wallet lives under `{base}/profiles/<name>/` with its own `allowance.json`,
6
+ * wallet lives under `{base}/profiles/<name>/` with its own `wallet.json`,
7
7
  * `projects.json`, and this module's non-secret `meta.json`.
8
8
  *
9
9
  * Two levels of active state, mirroring the wallet → project model:
@@ -40,10 +40,10 @@ export declare function profileDir(name: string): string;
40
40
  export declare function ensureProfileDir(name: string): string;
41
41
  export declare function readMeta(name: string): ProfileMeta | null;
42
42
  export declare function writeMeta(name: string, meta: ProfileMeta): void;
43
- /** True when a wallet's `allowance.json` exists on disk. */
43
+ /** True when a wallet's `wallet.json` exists on disk. */
44
44
  export declare function profileExists(name: string): boolean;
45
45
  /**
46
- * All wallet names on disk: `default` (only if a root allowance.json exists)
46
+ * All wallet names on disk: `default` (only if a root wallet.json exists)
47
47
  * plus every valid directory under `profiles/`.
48
48
  */
49
49
  export declare function listProfileNames(): string[];
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * A "wallet" is a whole config directory. The reserved `default` wallet lives
5
5
  * at the base config dir (zero migration for existing installs); every named
6
- * wallet lives under `{base}/profiles/<name>/` with its own `allowance.json`,
6
+ * wallet lives under `{base}/profiles/<name>/` with its own `wallet.json`,
7
7
  * `projects.json`, and this module's non-secret `meta.json`.
8
8
  *
9
9
  * Two levels of active state, mirroring the wallet → project model:
@@ -17,7 +17,7 @@
17
17
  import { readFileSync, writeFileSync, mkdirSync, renameSync, chmodSync, existsSync, readdirSync, rmSync, } from "node:fs";
18
18
  import { dirname, join } from "node:path";
19
19
  import { randomBytes } from "node:crypto";
20
- import { getConfigBaseDir, getProfilesDir, DEFAULT_PROFILE, isValidProfileName, } from "./config.js";
20
+ import { getConfigBaseDir, getProfilesDir, DEFAULT_PROFILE, isValidProfileName, moveWalletFiles, WALLET_FILE_NAME, } from "./config.js";
21
21
  import { describeRejectedValue } from "./redact.js";
22
22
  function atomicWrite(p, content, mode) {
23
23
  const dir = dirname(p);
@@ -114,17 +114,19 @@ export function writeMeta(name, meta) {
114
114
  atomicWrite(metaPath(name), JSON.stringify(meta, null, 2), 0o600);
115
115
  }
116
116
  // --- enumeration + lifecycle ---
117
- /** True when a wallet's `allowance.json` exists on disk. */
117
+ /** True when a wallet's `wallet.json` exists on disk. */
118
118
  export function profileExists(name) {
119
- return existsSync(join(profileDir(name), "allowance.json"));
119
+ moveWalletFiles();
120
+ return existsSync(join(profileDir(name), WALLET_FILE_NAME));
120
121
  }
121
122
  /**
122
- * All wallet names on disk: `default` (only if a root allowance.json exists)
123
+ * All wallet names on disk: `default` (only if a root wallet.json exists)
123
124
  * plus every valid directory under `profiles/`.
124
125
  */
125
126
  export function listProfileNames() {
127
+ moveWalletFiles();
126
128
  const names = [];
127
- if (existsSync(join(getConfigBaseDir(), "allowance.json"))) {
129
+ if (existsSync(join(getConfigBaseDir(), WALLET_FILE_NAME))) {
128
130
  names.push(DEFAULT_PROFILE);
129
131
  }
130
132
  try {
@@ -184,7 +186,7 @@ export function renameProfile(oldName, newName) {
184
186
  /* best-effort */
185
187
  }
186
188
  const base = getConfigBaseDir();
187
- for (const f of ["allowance.json", "projects.json", "meta.json"]) {
189
+ for (const f of [WALLET_FILE_NAME, "projects.json", "meta.json"]) {
188
190
  const src = join(base, f);
189
191
  if (existsSync(src))
190
192
  renameSync(src, join(dest, f));
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Allowance auth helper — generates SIWX (Sign-In With X / EIP-4361) headers for Run402 API.
2
+ * SIWX auth helper — generates SIWX (Sign-In With X / EIP-4361) headers for Run402 API.
3
3
  * Uses @noble/curves (lighter than viem) for signing.
4
4
  */
5
- import type { AllowanceData } from "./allowance.js";
5
+ import type { WalletData } from "./wallet.js";
6
6
  export interface SIWxAuthHeaders {
7
7
  "SIGN-IN-WITH-X": string;
8
8
  }
@@ -22,7 +22,7 @@ interface SIWEMessageOpts {
22
22
  resources?: string[];
23
23
  }
24
24
  export interface SIWxAuthOptions extends SIWEMessageOpts {
25
- allowance: Pick<AllowanceData, "address" | "privateKey">;
25
+ wallet: Pick<WalletData, "address" | "privateKey">;
26
26
  type?: "eip191";
27
27
  }
28
28
  /**
@@ -33,10 +33,10 @@ export declare function formatSIWEMessage(opts: SIWEMessageOpts, address: string
33
33
  export declare function buildSIWxAuthHeaders(opts: SIWxAuthOptions): SIWxAuthHeaders;
34
34
  /**
35
35
  * Get SIWX auth headers for the Run402 API.
36
- * Returns null if no allowance is configured.
36
+ * Returns null if no local wallet is configured.
37
37
  *
38
38
  * @param path - API path (e.g. "/projects/v1") used to build the SIWE uri field.
39
39
  */
40
- export declare function getAllowanceAuthHeaders(path: string, allowancePath?: string): SIWxAuthHeaders | null;
40
+ export declare function getWalletAuthHeaders(path: string, walletPath?: string): SIWxAuthHeaders | null;
41
41
  export {};
42
- //# sourceMappingURL=allowance-auth.d.ts.map
42
+ //# sourceMappingURL=wallet-auth.d.ts.map
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Allowance auth helper — generates SIWX (Sign-In With X / EIP-4361) headers for Run402 API.
2
+ * SIWX auth helper — generates SIWX (Sign-In With X / EIP-4361) headers for Run402 API.
3
3
  * Uses @noble/curves (lighter than viem) for signing.
4
4
  */
5
5
  import { randomBytes } from "node:crypto";
6
6
  import { secp256k1 } from "@noble/curves/secp256k1.js";
7
7
  import { keccak_256 } from "@noble/hashes/sha3.js";
8
8
  import { bytesToHex } from "@noble/hashes/utils.js";
9
- import { readAllowance } from "./allowance.js";
9
+ import { readWallet } from "./wallet.js";
10
10
  import { getApiBase } from "./config.js";
11
11
  /**
12
12
  * EIP-55 mixed-case checksum encoding.
@@ -21,7 +21,7 @@ export function toChecksumAddress(address) {
21
21
  return checksummed;
22
22
  }
23
23
  /**
24
- * EIP-191 personal_sign: sign a message with the allowance's private key.
24
+ * EIP-191 personal_sign: sign a message with the wallet's private key.
25
25
  */
26
26
  function personalSign(privateKeyHex, address, message) {
27
27
  const msgBytes = new TextEncoder().encode(message);
@@ -86,11 +86,11 @@ export function formatSIWEMessage(opts, address) {
86
86
  return lines.join("\n");
87
87
  }
88
88
  export function buildSIWxAuthHeaders(opts) {
89
- const message = formatSIWEMessage(opts, opts.allowance.address);
90
- const signature = personalSign(opts.allowance.privateKey, opts.allowance.address, message);
89
+ const message = formatSIWEMessage(opts, opts.wallet.address);
90
+ const signature = personalSign(opts.wallet.privateKey, opts.wallet.address, message);
91
91
  const payload = {
92
92
  domain: opts.domain,
93
- address: toChecksumAddress(opts.allowance.address),
93
+ address: toChecksumAddress(opts.wallet.address),
94
94
  statement: opts.statement,
95
95
  uri: opts.uri,
96
96
  version: opts.version ?? "1",
@@ -110,18 +110,18 @@ export function buildSIWxAuthHeaders(opts) {
110
110
  }
111
111
  /**
112
112
  * Get SIWX auth headers for the Run402 API.
113
- * Returns null if no allowance is configured.
113
+ * Returns null if no local wallet is configured.
114
114
  *
115
115
  * @param path - API path (e.g. "/projects/v1") used to build the SIWE uri field.
116
116
  */
117
- export function getAllowanceAuthHeaders(path, allowancePath) {
118
- // readAllowance throws on a malformed-shape allowance file. The
119
- // CLI's higher-level readAllowance wrapper surfaces this as a structured
120
- // BAD_ALLOWANCE_FILE envelope; here we preserve the public contract that
117
+ export function getWalletAuthHeaders(path, walletPath) {
118
+ // readWallet throws on a malformed-shape wallet file. The
119
+ // CLI's higher-level readWallet wrapper surfaces this as a structured
120
+ // BAD_WALLET_FILE envelope; here we preserve the public contract that
121
121
  // this helper returns SIWxAuthHeaders | null. Re-throw so callers above
122
122
  // the CLI's wrapper (e.g. SDK paid-fetch) can decide whether to swallow it.
123
- const allowance = readAllowance(allowancePath);
124
- if (!allowance || !allowance.address || !allowance.privateKey)
123
+ const localWallet = readWallet(walletPath);
124
+ if (!localWallet || !localWallet.address || !localWallet.privateKey)
125
125
  return null;
126
126
  const apiBase = getApiBase();
127
127
  const url = new URL(apiBase);
@@ -132,7 +132,7 @@ export function getAllowanceAuthHeaders(path, allowancePath) {
132
132
  const issuedAt = now.toISOString();
133
133
  const expirationTime = new Date(now.getTime() + 5 * 60 * 1000).toISOString();
134
134
  return buildSIWxAuthHeaders({
135
- allowance,
135
+ wallet: localWallet,
136
136
  domain,
137
137
  uri,
138
138
  statement: "Sign in to Run402",
@@ -151,4 +151,4 @@ function messageChainId(chainId) {
151
151
  function payloadChainId(chainId) {
152
152
  return typeof chainId === "number" ? `eip155:${chainId}` : chainId;
153
153
  }
154
- //# sourceMappingURL=allowance-auth.js.map
154
+ //# sourceMappingURL=wallet-auth.js.map
@@ -0,0 +1,22 @@
1
+ export interface WalletData {
2
+ address: string;
3
+ privateKey: string;
4
+ created?: string;
5
+ funded?: boolean;
6
+ lastFaucet?: string;
7
+ rail?: "x402" | "mpp" | "lightning";
8
+ /** The Lightning wallet (`run402 init lightning`): a budgeted wallet on Run402's Hub. `nwc` is the pairing secret. */
9
+ lightning?: WalletLightning;
10
+ }
11
+ export interface WalletLightning {
12
+ wallet_id: string;
13
+ nwc: string;
14
+ lightning_address: string | null;
15
+ budget_sats: number;
16
+ starter_sats: number;
17
+ custody: "run402_hub";
18
+ minted_at: string;
19
+ }
20
+ export declare function readWallet(path?: string): WalletData | null;
21
+ export declare function saveWallet(data: WalletData, path?: string): void;
22
+ //# sourceMappingURL=wallet.d.ts.map
@@ -1,36 +1,36 @@
1
1
  import { readFileSync, writeFileSync, mkdirSync, existsSync, chmodSync, renameSync, statSync } from "node:fs";
2
2
  import { dirname, join } from "node:path";
3
3
  import { randomBytes } from "node:crypto";
4
- import { getAllowancePath } from "./config.js";
4
+ import { getWalletPath } from "./config.js";
5
5
  // 0x-prefixed 40-hex EVM address.
6
6
  const ADDRESS_RE = /^0x[a-fA-F0-9]{40}$/;
7
7
  // 0x-prefixed 64-hex secp256k1 private key (32 bytes).
8
8
  const PRIVATE_KEY_RE = /^0x[a-fA-F0-9]{64}$/;
9
9
  /**
10
- * Load the agent allowance from disk.
10
+ * Load the agent wallet from disk.
11
11
  *
12
- * Returns `null` for the two "no allowance configured" cases:
12
+ * Returns `null` for the two "no local wallet configured" cases:
13
13
  * - the file does not exist
14
14
  * - the file exists but is not parseable JSON (preserve existing UX —
15
- * consumers print "no_allowance" and tell the user to run init)
15
+ * consumers print "no_wallet" and tell the user to run init)
16
16
  *
17
17
  * Throws a structured `Error` when the file parses as JSON but the
18
18
  * shape is wrong (missing/wrong-type/wrong-length fields). Without this guard
19
19
  * downstream callers crash with raw stack traces:
20
- * - `cli/lib/status.mjs` reaches for `allowance.address.toLowerCase()`
20
+ * - `cli/lib/status.mjs` reaches for `wallet.address.toLowerCase()`
21
21
  * and crashes with `TypeError: Cannot read properties of undefined`.
22
- * - `core/src/allowance-auth.ts` passes a malformed `privateKey` to
22
+ * - `core/src/wallet-auth.ts` passes a malformed `privateKey` to
23
23
  * `@noble/curves` which throws "expected 32 bytes, got N".
24
24
  *
25
- * The CLI's `cli/lib/config.mjs:readAllowance()` wrapper and the MCP
25
+ * The CLI's `cli/lib/config.mjs:readWallet()` wrapper and the MCP
26
26
  * `src/tools/{status,init}.ts` callers translate the throw into their own
27
- * structured envelopes (`code: BAD_ALLOWANCE_FILE`).
27
+ * structured envelopes (`code: BAD_WALLET_FILE`).
28
28
  */
29
29
  /**
30
- * If an allowance file is readable by group or other (any of the low 0o077
30
+ * If a wallet file is readable by group or other (any of the low 0o077
31
31
  * bits set), tighten it to 0600 and warn once on stderr. This self-heals the
32
32
  * historical case where a legacy world-readable `wallet.json` (mode 0644) was
33
- * migrated to `allowance.json` via a mode-preserving rename, leaving the
33
+ * migrated to `wallet.json` via a mode-preserving rename, leaving the
34
34
  * private key exposed on a shared machine. Best-effort: POSIX-only and silent
35
35
  * on platforms without meaningful Unix modes (e.g. Windows).
36
36
  */
@@ -48,8 +48,8 @@ function selfHealPermissions(p) {
48
48
  // Best-effort; never block a read on a chmod/stat failure.
49
49
  }
50
50
  }
51
- export function readAllowance(path) {
52
- const p = path ?? getAllowancePath();
51
+ export function readWallet(path) {
52
+ const p = path ?? getWalletPath();
53
53
  if (!existsSync(p))
54
54
  return null;
55
55
  selfHealPermissions(p);
@@ -66,31 +66,31 @@ export function readAllowance(path) {
66
66
  }
67
67
  catch {
68
68
  // Preserve historical UX — completely unparseable input reads as "no
69
- // allowance configured" rather than as an error. Consumers already handle
69
+ // wallet configured" rather than as an error. Consumers already handle
70
70
  // null with a friendly "run 'run402 init'" message.
71
71
  return null;
72
72
  }
73
73
  if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
74
- throw new Error(`allowance.json must contain a JSON object (got ${Array.isArray(parsed) ? "array" : parsed === null ? "null" : typeof parsed}). Back up the file and run 'run402 init' to recreate it.`);
74
+ throw new Error(`wallet.json must contain a JSON object (got ${Array.isArray(parsed) ? "array" : parsed === null ? "null" : typeof parsed}). Back up the file and run 'run402 init' to recreate it.`);
75
75
  }
76
76
  const data = parsed;
77
77
  if (typeof data.address !== "string" || !ADDRESS_RE.test(data.address)) {
78
- throw new Error("allowance.json missing valid 'address' (expected 0x-prefixed 40-hex string). " +
78
+ throw new Error("wallet.json missing valid 'address' (expected 0x-prefixed 40-hex string). " +
79
79
  "Back up the file and run 'run402 init' to recreate it.");
80
80
  }
81
81
  if (typeof data.privateKey !== "string" || !PRIVATE_KEY_RE.test(data.privateKey)) {
82
- throw new Error("allowance.json missing valid 'privateKey' (expected 0x-prefixed 64-hex string). " +
82
+ throw new Error("wallet.json missing valid 'privateKey' (expected 0x-prefixed 64-hex string). " +
83
83
  "Back up the file and run 'run402 init' to recreate it.");
84
84
  }
85
85
  return data;
86
86
  }
87
- export function saveAllowance(data, path) {
88
- const p = path ?? getAllowancePath();
87
+ export function saveWallet(data, path) {
88
+ const p = path ?? getWalletPath();
89
89
  const dir = dirname(p);
90
90
  mkdirSync(dir, { recursive: true });
91
- const tmp = join(dir, `.allowance.${randomBytes(4).toString("hex")}.tmp`);
91
+ const tmp = join(dir, `.wallet.${randomBytes(4).toString("hex")}.tmp`);
92
92
  writeFileSync(tmp, JSON.stringify(data, null, 2), { mode: 0o600 });
93
93
  renameSync(tmp, p);
94
94
  chmodSync(p, 0o600);
95
95
  }
96
- //# sourceMappingURL=allowance.js.map
96
+ //# sourceMappingURL=wallet.js.map
@@ -1,19 +1,20 @@
1
1
  /**
2
- * Cache of **operator-approval** tokens — the passkey-fresh write-auth tokens a
3
- * wallet-less human mints to provision/deploy (gateway v1.85/v1.87). Distinct
4
- * from the control-plane session ({@link ControlPlaneSessionCache}) it pairs
5
- * with: the gateway scopes each token to one `(action, target)`, so this is a
2
+ * Cache of **write approvals** — the passkey-signed, target-scoped tokens a
3
+ * wallet-less person mints with `run402 approve` to provision, deploy, or write
4
+ * secrets from the command line. Distinct from the sign-in session
5
+ * ({@link ControlPlaneSessionCache}) it pairs with, and never a step-up. The
6
+ * gateway scopes each token to one `(action, target)`, so this is a
6
7
  * **multi-entry** cache keyed by `(api_origin, control_plane_session_hash,
7
8
  * action, target)`. An `org.project.create` approval for org Y and a
8
9
  * `project.deploy` approval for project X coexist.
9
10
  *
10
11
  * Stored at the BASE config dir (principal-scoped), mode 0600 — as sensitive as
11
- * the allowance key. The token dies with its control-plane session; the
12
+ * the wallet key. The token dies with its sign-in session; the
12
13
  * `control_plane_session_hash` binding lets the client drop a stale approval
13
- * locally rather than replay it into a `WRITE_AUTH_BINDING_MISMATCH`.
14
+ * locally rather than replay it into a `WRITE_APPROVAL_BINDING_MISMATCH`.
14
15
  */
15
- export interface WriteAuthApproval {
16
- write_auth_token: string;
16
+ export interface WriteApproval {
17
+ write_approval_token: string;
17
18
  token_type: string;
18
19
  header: string;
19
20
  /** Gateway capability: `org.project.create` | `project.deploy` | `project.secret.write`. */
@@ -30,13 +31,14 @@ export interface WriteAuthApproval {
30
31
  amr?: string[];
31
32
  minted_at: number;
32
33
  }
33
- /** The token payload from `POST /agent/v1/control-plane/write-auth/cli/token`. */
34
- export interface WriteAuthTokenResponse {
35
- write_auth_token: string;
34
+ /** The token payload from `POST /agent/v1/control-plane/write-approval/cli/token`. */
35
+ export interface WriteApprovalTokenResponse {
36
+ write_approval_token: string;
36
37
  token_type?: string;
37
38
  header?: string;
38
- /** The write-auth session; its expiry is the token's expiry. */
39
+ /** The write-approval session; its idle expiry is the token's expiry. */
39
40
  session?: {
41
+ idle_expires_at?: string | number;
40
42
  expires_at?: string | number;
41
43
  absolute_expires_at?: string | number;
42
44
  amr?: string[];
@@ -45,15 +47,15 @@ export interface WriteAuthTokenResponse {
45
47
  [k: string]: unknown;
46
48
  }
47
49
  /** A capability target — exactly one of these is set per approval. */
48
- export interface WriteAuthTargetKey {
50
+ export interface WriteApprovalTargetKey {
49
51
  org_id?: string;
50
52
  project_id?: string;
51
53
  }
52
54
  /**
53
- * Path to the approval cache: `{base}/write-auth-session.json`.
54
- * `RUN402_WRITE_AUTH_SESSION_PATH` overrides for testing.
55
+ * Path to the approval cache: `{base}/write-approvals.json`.
56
+ * `RUN402_WRITE_APPROVALS_PATH` overrides for testing.
55
57
  */
56
- export declare function getWriteAuthSessionPath(): string;
58
+ export declare function getWriteApprovalsPath(): string;
57
59
  /** Stable short hash binding an approval to a control-plane session token. */
58
60
  export declare function hashControlPlaneSession(token: string): string;
59
61
  /**
@@ -61,17 +63,17 @@ export declare function hashControlPlaneSession(token: string): string;
61
63
  * unreadable, unparseable). Throws when the file parses as JSON but the shape
62
64
  * is wrong, so a corrupted cache surfaces a clear fix-it.
63
65
  */
64
- export declare function readApprovals(path?: string): WriteAuthApproval[];
66
+ export declare function readApprovals(path?: string): WriteApproval[];
65
67
  /**
66
68
  * Persist an approval. Replaces any existing entry with the same
67
69
  * `(api_origin, control_plane_session_hash, action, target)` key and leaves
68
70
  * every other entry intact (multi-entry, non-thrashing). Atomic, mode 0600.
69
71
  */
70
- export declare function saveApproval(approval: WriteAuthApproval, path?: string): void;
71
- /** Delete the whole approval cache — local half of `operator logout`. Idempotent. */
72
+ export declare function saveApproval(approval: WriteApproval, path?: string): void;
73
+ /** Delete the whole approval cache — local half of `run402 logout`. Idempotent. */
72
74
  export declare function clearApprovals(path?: string): void;
73
75
  /** Whether an approval is past its usable life (with a small skew buffer). */
74
- export declare function isApprovalExpired(approval: WriteAuthApproval, nowMs?: number, skewMs?: number): boolean;
76
+ export declare function isApprovalExpired(approval: WriteApproval, nowMs?: number, skewMs?: number): boolean;
75
77
  /**
76
78
  * Return the cached approval matching ALL of `(apiOrigin, cpSessionHash,
77
79
  * capability, target)` and still live, or `null` if none matches or it is
@@ -82,18 +84,18 @@ export declare function loadLiveApproval(q: {
82
84
  apiOrigin: string;
83
85
  cpSessionHash: string;
84
86
  capability: string;
85
- target: WriteAuthTargetKey;
86
- }, path?: string, nowMs?: number): WriteAuthApproval | null;
87
+ target: WriteApprovalTargetKey;
88
+ }, path?: string, nowMs?: number): WriteApproval | null;
87
89
  /**
88
90
  * Build a cache entry from the gateway token response + the binding context
89
91
  * (the cp-session it was minted under, the API origin, and the `(action,
90
92
  * target)` it covers). Expiry is taken from the returned `session`.
91
93
  */
92
- export declare function approvalFromTokenResponse(resp: WriteAuthTokenResponse, binding: {
94
+ export declare function approvalFromTokenResponse(resp: WriteApprovalTokenResponse, binding: {
93
95
  action: string;
94
- target: WriteAuthTargetKey;
96
+ target: WriteApprovalTargetKey;
95
97
  apiOrigin: string;
96
98
  controlPlaneSessionHash: string;
97
99
  controlPlanePrincipalId: string;
98
- }, nowMs?: number): WriteAuthApproval;
99
- //# sourceMappingURL=write-auth-session.d.ts.map
100
+ }, nowMs?: number): WriteApproval;
101
+ //# sourceMappingURL=write-approvals.d.ts.map