run402 4.165.0 → 4.167.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 (313) hide show
  1. package/lib/app-repo-tokens.mjs +1 -2
  2. package/lib/app-repos.mjs +2 -2
  3. package/lib/apps.mjs +1 -3
  4. package/lib/archives.mjs +0 -6
  5. package/lib/argparse.mjs +10 -53
  6. package/lib/assets.mjs +11 -42
  7. package/lib/auth.mjs +4 -48
  8. package/lib/billing.mjs +8 -8
  9. package/lib/branches.mjs +3 -5
  10. package/lib/buzz-notifications.mjs +2 -21
  11. package/lib/buzz.mjs +4 -5
  12. package/lib/cache.mjs +0 -20
  13. package/lib/cdn.mjs +0 -7
  14. package/lib/claims.mjs +2 -4
  15. package/lib/contacts.mjs +3 -9
  16. package/lib/contracts.mjs +0 -28
  17. package/lib/credentials.mjs +2 -5
  18. package/lib/deliveries.mjs +0 -1
  19. package/lib/deploy-v2.mjs +20 -102
  20. package/lib/domains.mjs +6 -73
  21. package/lib/email.mjs +73 -64
  22. package/lib/errors.mjs +6 -13
  23. package/lib/escalations.mjs +2 -4
  24. package/lib/events.mjs +1 -3
  25. package/lib/feedback.mjs +1 -34
  26. package/lib/functions.mjs +12 -26
  27. package/lib/grants.mjs +0 -7
  28. package/lib/identity.mjs +1 -7
  29. package/lib/image.mjs +1 -2
  30. package/lib/init.mjs +0 -3
  31. package/lib/jobs.mjs +2 -2
  32. package/lib/logs.mjs +2 -5
  33. package/lib/messages.mjs +3 -3
  34. package/lib/orgs.mjs +3 -3
  35. package/lib/projects.mjs +3 -50
  36. package/lib/remote-helper-session.mjs +1 -2
  37. package/lib/repos.mjs +7 -39
  38. package/lib/rooms.mjs +2 -3
  39. package/lib/snapshots.mjs +2 -7
  40. package/lib/stripe.mjs +9 -16
  41. package/lib/subscriptions.mjs +0 -3
  42. package/lib/transfer.mjs +16 -67
  43. package/lib/up.mjs +0 -16
  44. package/lib/webhooks.mjs +1 -13
  45. package/lib/whoami.mjs +0 -8
  46. package/package.json +1 -1
  47. package/sdk/dist/app-up.js +1 -0
  48. package/sdk/dist/app-up.js.map +1 -1
  49. package/sdk/dist/ci-credentials.d.ts.map +1 -1
  50. package/sdk/dist/ci-credentials.js +6 -0
  51. package/sdk/dist/ci-credentials.js.map +1 -1
  52. package/sdk/dist/control-plane-credentials.d.ts.map +1 -1
  53. package/sdk/dist/control-plane-credentials.js +2 -0
  54. package/sdk/dist/control-plane-credentials.js.map +1 -1
  55. package/sdk/dist/index.d.ts.map +1 -1
  56. package/sdk/dist/index.js +7 -0
  57. package/sdk/dist/index.js.map +1 -1
  58. package/sdk/dist/jcs.d.ts.map +1 -1
  59. package/sdk/dist/jcs.js +1 -0
  60. package/sdk/dist/jcs.js.map +1 -1
  61. package/sdk/dist/namespaces/admin.d.ts +1 -1
  62. package/sdk/dist/namespaces/admin.d.ts.map +1 -1
  63. package/sdk/dist/namespaces/admin.js +0 -5
  64. package/sdk/dist/namespaces/admin.js.map +1 -1
  65. package/sdk/dist/namespaces/agent.d.ts.map +1 -1
  66. package/sdk/dist/namespaces/agent.js +1 -0
  67. package/sdk/dist/namespaces/agent.js.map +1 -1
  68. package/sdk/dist/namespaces/ai.d.ts.map +1 -1
  69. package/sdk/dist/namespaces/ai.js +1 -0
  70. package/sdk/dist/namespaces/ai.js.map +1 -1
  71. package/sdk/dist/namespaces/app-repos.d.ts.map +1 -1
  72. package/sdk/dist/namespaces/app-repos.js +5 -4
  73. package/sdk/dist/namespaces/app-repos.js.map +1 -1
  74. package/sdk/dist/namespaces/archives.d.ts.map +1 -1
  75. package/sdk/dist/namespaces/archives.js +6 -3
  76. package/sdk/dist/namespaces/archives.js.map +1 -1
  77. package/sdk/dist/namespaces/assets-validation.d.ts +14 -19
  78. package/sdk/dist/namespaces/assets-validation.d.ts.map +1 -1
  79. package/sdk/dist/namespaces/assets-validation.js +27 -50
  80. package/sdk/dist/namespaces/assets-validation.js.map +1 -1
  81. package/sdk/dist/namespaces/assets.d.ts.map +1 -1
  82. package/sdk/dist/namespaces/assets.js +11 -28
  83. package/sdk/dist/namespaces/assets.js.map +1 -1
  84. package/sdk/dist/namespaces/assets.types.d.ts +0 -2
  85. package/sdk/dist/namespaces/assets.types.d.ts.map +1 -1
  86. package/sdk/dist/namespaces/assets.types.js +0 -2
  87. package/sdk/dist/namespaces/assets.types.js.map +1 -1
  88. package/sdk/dist/namespaces/auth.d.ts.map +1 -1
  89. package/sdk/dist/namespaces/auth.js +30 -51
  90. package/sdk/dist/namespaces/auth.js.map +1 -1
  91. package/sdk/dist/namespaces/billing.d.ts.map +1 -1
  92. package/sdk/dist/namespaces/billing.js +12 -41
  93. package/sdk/dist/namespaces/billing.js.map +1 -1
  94. package/sdk/dist/namespaces/branches.js +1 -0
  95. package/sdk/dist/namespaces/branches.js.map +1 -1
  96. package/sdk/dist/namespaces/buzz.d.ts.map +1 -1
  97. package/sdk/dist/namespaces/buzz.js +3 -6
  98. package/sdk/dist/namespaces/buzz.js.map +1 -1
  99. package/sdk/dist/namespaces/cache.d.ts.map +1 -1
  100. package/sdk/dist/namespaces/cache.js +0 -4
  101. package/sdk/dist/namespaces/cache.js.map +1 -1
  102. package/sdk/dist/namespaces/ci.d.ts.map +1 -1
  103. package/sdk/dist/namespaces/ci.js +24 -90
  104. package/sdk/dist/namespaces/ci.js.map +1 -1
  105. package/sdk/dist/namespaces/contracts.d.ts.map +1 -1
  106. package/sdk/dist/namespaces/contracts.js +10 -32
  107. package/sdk/dist/namespaces/contracts.js.map +1 -1
  108. package/sdk/dist/namespaces/credentials.d.ts.map +1 -1
  109. package/sdk/dist/namespaces/credentials.js +13 -8
  110. package/sdk/dist/namespaces/credentials.js.map +1 -1
  111. package/sdk/dist/namespaces/deploy.d.ts.map +1 -1
  112. package/sdk/dist/namespaces/deploy.js +156 -649
  113. package/sdk/dist/namespaces/deploy.js.map +1 -1
  114. package/sdk/dist/namespaces/domains.d.ts.map +1 -1
  115. package/sdk/dist/namespaces/domains.js +1 -0
  116. package/sdk/dist/namespaces/domains.js.map +1 -1
  117. package/sdk/dist/namespaces/email.d.ts +22 -2
  118. package/sdk/dist/namespaces/email.d.ts.map +1 -1
  119. package/sdk/dist/namespaces/email.js +23 -78
  120. package/sdk/dist/namespaces/email.js.map +1 -1
  121. package/sdk/dist/namespaces/errors.d.ts.map +1 -1
  122. package/sdk/dist/namespaces/errors.js +9 -0
  123. package/sdk/dist/namespaces/errors.js.map +1 -1
  124. package/sdk/dist/namespaces/escalations.d.ts.map +1 -1
  125. package/sdk/dist/namespaces/escalations.js +15 -0
  126. package/sdk/dist/namespaces/escalations.js.map +1 -1
  127. package/sdk/dist/namespaces/events.d.ts.map +1 -1
  128. package/sdk/dist/namespaces/events.js +2 -0
  129. package/sdk/dist/namespaces/events.js.map +1 -1
  130. package/sdk/dist/namespaces/functions.d.ts +2 -2
  131. package/sdk/dist/namespaces/functions.d.ts.map +1 -1
  132. package/sdk/dist/namespaces/functions.js +39 -154
  133. package/sdk/dist/namespaces/functions.js.map +1 -1
  134. package/sdk/dist/namespaces/grants.d.ts.map +1 -1
  135. package/sdk/dist/namespaces/grants.js +12 -0
  136. package/sdk/dist/namespaces/grants.js.map +1 -1
  137. package/sdk/dist/namespaces/identity-links.d.ts.map +1 -1
  138. package/sdk/dist/namespaces/identity-links.js +7 -3
  139. package/sdk/dist/namespaces/identity-links.js.map +1 -1
  140. package/sdk/dist/namespaces/identity-links.protocol.d.ts.map +1 -1
  141. package/sdk/dist/namespaces/identity-links.protocol.js +1 -0
  142. package/sdk/dist/namespaces/identity-links.protocol.js.map +1 -1
  143. package/sdk/dist/namespaces/live.js +2 -0
  144. package/sdk/dist/namespaces/live.js.map +1 -1
  145. package/sdk/dist/namespaces/org.d.ts.map +1 -1
  146. package/sdk/dist/namespaces/org.js +22 -9
  147. package/sdk/dist/namespaces/org.js.map +1 -1
  148. package/sdk/dist/namespaces/projects.d.ts.map +1 -1
  149. package/sdk/dist/namespaces/projects.js +3 -0
  150. package/sdk/dist/namespaces/projects.js.map +1 -1
  151. package/sdk/dist/namespaces/push.d.ts.map +1 -1
  152. package/sdk/dist/namespaces/push.js +6 -0
  153. package/sdk/dist/namespaces/push.js.map +1 -1
  154. package/sdk/dist/namespaces/repos.d.ts +7 -37
  155. package/sdk/dist/namespaces/repos.d.ts.map +1 -1
  156. package/sdk/dist/namespaces/repos.js +61 -63
  157. package/sdk/dist/namespaces/repos.js.map +1 -1
  158. package/sdk/dist/namespaces/rooms.d.ts.map +1 -1
  159. package/sdk/dist/namespaces/rooms.js +4 -0
  160. package/sdk/dist/namespaces/rooms.js.map +1 -1
  161. package/sdk/dist/namespaces/secrets.d.ts.map +1 -1
  162. package/sdk/dist/namespaces/secrets.js +1 -12
  163. package/sdk/dist/namespaces/secrets.js.map +1 -1
  164. package/sdk/dist/namespaces/snapshots.d.ts.map +1 -1
  165. package/sdk/dist/namespaces/snapshots.js +5 -0
  166. package/sdk/dist/namespaces/snapshots.js.map +1 -1
  167. package/sdk/dist/namespaces/subdomains.d.ts.map +1 -1
  168. package/sdk/dist/namespaces/subdomains.js +1 -0
  169. package/sdk/dist/namespaces/subdomains.js.map +1 -1
  170. package/sdk/dist/namespaces/transfers.d.ts.map +1 -1
  171. package/sdk/dist/namespaces/transfers.js +17 -28
  172. package/sdk/dist/namespaces/transfers.js.map +1 -1
  173. package/sdk/dist/namespaces/vault.crypto.d.ts.map +1 -1
  174. package/sdk/dist/namespaces/vault.crypto.js +1 -0
  175. package/sdk/dist/namespaces/vault.crypto.js.map +1 -1
  176. package/sdk/dist/namespaces/wallets.d.ts.map +1 -1
  177. package/sdk/dist/namespaces/wallets.js +6 -0
  178. package/sdk/dist/namespaces/wallets.js.map +1 -1
  179. package/sdk/dist/node/actions-node.d.ts.map +1 -1
  180. package/sdk/dist/node/actions-node.js +16 -0
  181. package/sdk/dist/node/actions-node.js.map +1 -1
  182. package/sdk/dist/node/archives-node.d.ts.map +1 -1
  183. package/sdk/dist/node/archives-node.js +17 -0
  184. package/sdk/dist/node/archives-node.js.map +1 -1
  185. package/sdk/dist/node/assets-node.d.ts.map +1 -1
  186. package/sdk/dist/node/assets-node.js +5 -3
  187. package/sdk/dist/node/assets-node.js.map +1 -1
  188. package/sdk/dist/node/bearer-redeem-key.d.ts.map +1 -1
  189. package/sdk/dist/node/bearer-redeem-key.js +1 -0
  190. package/sdk/dist/node/bearer-redeem-key.js.map +1 -1
  191. package/sdk/dist/node/buzz-doctor.d.ts.map +1 -1
  192. package/sdk/dist/node/buzz-doctor.js +3 -0
  193. package/sdk/dist/node/buzz-doctor.js.map +1 -1
  194. package/sdk/dist/node/ci.d.ts.map +1 -1
  195. package/sdk/dist/node/ci.js +1 -0
  196. package/sdk/dist/node/ci.js.map +1 -1
  197. package/sdk/dist/node/credentials.d.ts.map +1 -1
  198. package/sdk/dist/node/credentials.js +1 -0
  199. package/sdk/dist/node/credentials.js.map +1 -1
  200. package/sdk/dist/node/deploy-manifest.d.ts.map +1 -1
  201. package/sdk/dist/node/deploy-manifest.js +90 -222
  202. package/sdk/dist/node/deploy-manifest.js.map +1 -1
  203. package/sdk/dist/node/dev-session.d.ts.map +1 -1
  204. package/sdk/dist/node/dev-session.js +4 -0
  205. package/sdk/dist/node/dev-session.js.map +1 -1
  206. package/sdk/dist/node/doctor.d.ts.map +1 -1
  207. package/sdk/dist/node/doctor.js +1 -0
  208. package/sdk/dist/node/doctor.js.map +1 -1
  209. package/sdk/dist/node/files.d.ts.map +1 -1
  210. package/sdk/dist/node/files.js +5 -0
  211. package/sdk/dist/node/files.js.map +1 -1
  212. package/sdk/dist/node/index.d.ts.map +1 -1
  213. package/sdk/dist/node/index.js +1 -0
  214. package/sdk/dist/node/index.js.map +1 -1
  215. package/sdk/dist/node/init.d.ts.map +1 -1
  216. package/sdk/dist/node/init.js +2 -0
  217. package/sdk/dist/node/init.js.map +1 -1
  218. package/sdk/dist/node/lightning-wallet.d.ts.map +1 -1
  219. package/sdk/dist/node/lightning-wallet.js +1 -0
  220. package/sdk/dist/node/lightning-wallet.js.map +1 -1
  221. package/sdk/dist/node/manifest-export.d.ts.map +1 -1
  222. package/sdk/dist/node/manifest-export.js +1 -0
  223. package/sdk/dist/node/manifest-export.js.map +1 -1
  224. package/sdk/dist/node/mpp-pay-executor.d.ts.map +1 -1
  225. package/sdk/dist/node/mpp-pay-executor.js +1 -0
  226. package/sdk/dist/node/mpp-pay-executor.js.map +1 -1
  227. package/sdk/dist/node/org-adopt.d.ts.map +1 -1
  228. package/sdk/dist/node/org-adopt.js +4 -0
  229. package/sdk/dist/node/org-adopt.js.map +1 -1
  230. package/sdk/dist/node/org-context.d.ts.map +1 -1
  231. package/sdk/dist/node/org-context.js +5 -0
  232. package/sdk/dist/node/org-context.js.map +1 -1
  233. package/sdk/dist/node/paid-fetch.d.ts.map +1 -1
  234. package/sdk/dist/node/paid-fetch.js +2 -0
  235. package/sdk/dist/node/paid-fetch.js.map +1 -1
  236. package/sdk/dist/node/payment-attempts.d.ts.map +1 -1
  237. package/sdk/dist/node/payment-attempts.js +4 -0
  238. package/sdk/dist/node/payment-attempts.js.map +1 -1
  239. package/sdk/dist/node/signers/index.d.ts.map +1 -1
  240. package/sdk/dist/node/signers/index.js +2 -0
  241. package/sdk/dist/node/signers/index.js.map +1 -1
  242. package/sdk/dist/node/signers/kms.d.ts.map +1 -1
  243. package/sdk/dist/node/signers/kms.js +7 -0
  244. package/sdk/dist/node/signers/kms.js.map +1 -1
  245. package/sdk/dist/node/target-profile.d.ts.map +1 -1
  246. package/sdk/dist/node/target-profile.js +4 -0
  247. package/sdk/dist/node/target-profile.js.map +1 -1
  248. package/sdk/dist/node/vault-apply.d.ts.map +1 -1
  249. package/sdk/dist/node/vault-apply.js +6 -0
  250. package/sdk/dist/node/vault-apply.js.map +1 -1
  251. package/sdk/dist/node/vault-byo-config.d.ts.map +1 -1
  252. package/sdk/dist/node/vault-byo-config.js +1 -0
  253. package/sdk/dist/node/vault-byo-config.js.map +1 -1
  254. package/sdk/dist/node/vault-byo-probe.d.ts.map +1 -1
  255. package/sdk/dist/node/vault-byo-probe.js +1 -0
  256. package/sdk/dist/node/vault-byo-probe.js.map +1 -1
  257. package/sdk/dist/node/vault-creation-journal.d.ts.map +1 -1
  258. package/sdk/dist/node/vault-creation-journal.js +1 -0
  259. package/sdk/dist/node/vault-creation-journal.js.map +1 -1
  260. package/sdk/dist/node/vault-deploy.d.ts.map +1 -1
  261. package/sdk/dist/node/vault-deploy.js +7 -0
  262. package/sdk/dist/node/vault-deploy.js.map +1 -1
  263. package/sdk/dist/node/vault-handoff.d.ts.map +1 -1
  264. package/sdk/dist/node/vault-handoff.js +1 -0
  265. package/sdk/dist/node/vault-handoff.js.map +1 -1
  266. package/sdk/dist/node/vault-keystore.d.ts.map +1 -1
  267. package/sdk/dist/node/vault-keystore.js +2 -0
  268. package/sdk/dist/node/vault-keystore.js.map +1 -1
  269. package/sdk/dist/node/vault-member-bundle.d.ts.map +1 -1
  270. package/sdk/dist/node/vault-member-bundle.js +1 -0
  271. package/sdk/dist/node/vault-member-bundle.js.map +1 -1
  272. package/sdk/dist/node/vault-mirror-backend.d.ts.map +1 -1
  273. package/sdk/dist/node/vault-mirror-backend.js +1 -0
  274. package/sdk/dist/node/vault-mirror-backend.js.map +1 -1
  275. package/sdk/dist/node/vault-mirror-config.d.ts.map +1 -1
  276. package/sdk/dist/node/vault-mirror-config.js +1 -0
  277. package/sdk/dist/node/vault-mirror-config.js.map +1 -1
  278. package/sdk/dist/node/vault-mirror.d.ts.map +1 -1
  279. package/sdk/dist/node/vault-mirror.js +1 -0
  280. package/sdk/dist/node/vault-mirror.js.map +1 -1
  281. package/sdk/dist/node/vault-prune.d.ts.map +1 -1
  282. package/sdk/dist/node/vault-prune.js +1 -0
  283. package/sdk/dist/node/vault-prune.js.map +1 -1
  284. package/sdk/dist/node/vault-publication.d.ts +1 -2
  285. package/sdk/dist/node/vault-publication.d.ts.map +1 -1
  286. package/sdk/dist/node/vault-publication.js +2 -0
  287. package/sdk/dist/node/vault-publication.js.map +1 -1
  288. package/sdk/dist/node/vault-recover.d.ts.map +1 -1
  289. package/sdk/dist/node/vault-recover.js +1 -0
  290. package/sdk/dist/node/vault-recover.js.map +1 -1
  291. package/sdk/dist/node/vault-restore.d.ts.map +1 -1
  292. package/sdk/dist/node/vault-restore.js +3 -0
  293. package/sdk/dist/node/vault-restore.js.map +1 -1
  294. package/sdk/dist/node/vault-snapshot.d.ts.map +1 -1
  295. package/sdk/dist/node/vault-snapshot.js +6 -0
  296. package/sdk/dist/node/vault-snapshot.js.map +1 -1
  297. package/sdk/dist/node/vault-writer-state.d.ts.map +1 -1
  298. package/sdk/dist/node/vault-writer-state.js +1 -0
  299. package/sdk/dist/node/vault-writer-state.js.map +1 -1
  300. package/sdk/dist/node/wallets-send.d.ts.map +1 -1
  301. package/sdk/dist/node/wallets-send.js +4 -0
  302. package/sdk/dist/node/wallets-send.js.map +1 -1
  303. package/sdk/dist/node/wallets.d.ts.map +1 -1
  304. package/sdk/dist/node/wallets.js +17 -0
  305. package/sdk/dist/node/wallets.js.map +1 -1
  306. package/sdk/dist/project-id.d.ts.map +1 -1
  307. package/sdk/dist/project-id.js +1 -0
  308. package/sdk/dist/project-id.js.map +1 -1
  309. package/sdk/dist/validation.d.ts +0 -5
  310. package/sdk/dist/validation.d.ts.map +1 -1
  311. package/sdk/dist/validation.js +2 -40
  312. package/sdk/dist/validation.js.map +1 -1
  313. package/vault-surface.json +1 -1
package/lib/messages.mjs CHANGED
@@ -23,6 +23,7 @@ import {
23
23
  positionalArgs,
24
24
  requirePositionalCount,
25
25
  failUnknownSubcommand,
26
+ parseIntegerArg,
26
27
  } from "./argparse.mjs";
27
28
  import {
28
29
  resolveRoom,
@@ -184,7 +185,7 @@ async function list(args) {
184
185
  ...(unread ? { addressedTo: "me", unread: true } : {}),
185
186
  presenceId: presenceId ?? undefined,
186
187
  sessionKey,
187
- limit: limit != null ? parseIntegerFlag("--limit", limit, { min: 1, max: 200 }) : undefined,
188
+ limit: limit != null ? parseIntegerArg("--limit", limit) : undefined,
188
189
  }));
189
190
  // NOTE: an unread/addressed_to=me read needs a resolvable "me"; the retry
190
191
  // above registers a replacement when this session's presence has expired.
@@ -213,7 +214,6 @@ async function wait(args) {
213
214
  min: 0, max: 0, command: "run402 messages wait", missing: "",
214
215
  });
215
216
  const addressedTo = flagValue(a, "--addressed-to");
216
- if (addressedTo != null) assertAllowedValue(addressedTo, ["me"], "--addressed-to");
217
217
  const timeoutRaw = flagValue(a, "--timeout");
218
218
  // Default 120s, max 600s: a Claude Code shell call dies at 600s, so a wait
219
219
  // that outlives the tool call is a wait the agent never hears (design D7).
@@ -230,7 +230,7 @@ async function wait(args) {
230
230
  const result = await getSdk().rooms.waitForMessages(room.orgId, room.roomKey, {
231
231
  ...(cursor !== undefined ? { cursor } : {}),
232
232
  threadId: flagValue(a, "--thread") ?? undefined,
233
- addressedTo: addressedTo === "me" ? "me" : undefined,
233
+ addressedTo: addressedTo ?? undefined,
234
234
  presenceId: me.presence_id,
235
235
  timeoutMs: timeoutSeconds * 1000,
236
236
  });
package/lib/orgs.mjs CHANGED
@@ -7,9 +7,9 @@ import {
7
7
  assertKnownFlags,
8
8
  flagValue,
9
9
  positionalArgs,
10
- parseIntegerFlag,
11
10
  requirePositionalCount,
12
11
  failUnknownSubcommand,
12
+ parseIntegerArg,
13
13
  } from "./argparse.mjs";
14
14
 
15
15
  const ROLE_LIST = "owner | admin | developer | billing | viewer";
@@ -613,7 +613,7 @@ async function audit(args) {
613
613
  const limitFlag = flagValue(a, "--limit");
614
614
  const after = flagValue(a, "--after");
615
615
  const before = flagValue(a, "--before");
616
- const limit = limitFlag === null ? undefined : parseIntegerFlag("--limit", limitFlag, { min: 1, max: 1000 });
616
+ const limit = limitFlag === null ? undefined : parseIntegerArg("--limit", limitFlag);
617
617
  try {
618
618
  const result = await getSdk().org(org).audit({
619
619
  limit,
@@ -841,7 +841,7 @@ async function runInvite(args) {
841
841
  missing: "Missing <email> (use --email).",
842
842
  });
843
843
  const email = emailFlag ?? pos[0];
844
- const inviteTtlHours = ttlFlag === null ? undefined : parseIntegerFlag("--ttl-hours", ttlFlag, { min: 1, max: 8760 });
844
+ const inviteTtlHours = ttlFlag === null ? undefined : parseIntegerArg("--ttl-hours", ttlFlag);
845
845
  try {
846
846
  const res = await getSdk().org(org).invites.create({ email, role: role || "developer", inviteTtlHours });
847
847
  console.log(JSON.stringify(res, null, 2));
package/lib/projects.mjs CHANGED
@@ -311,7 +311,6 @@ Examples:
311
311
  `,
312
312
  };
313
313
 
314
- const FINANCE_WINDOWS = new Set(["24h", "7d", "30d", "90d"]);
315
314
 
316
315
  async function quote() {
317
316
  try {
@@ -354,34 +353,6 @@ async function provision(args) {
354
353
  hint: "Pass an org id (run402 orgs list), or omit --org for the cold-start path.",
355
354
  });
356
355
  }
357
- // Validate --name when provided. Omitted --name lets the server pick a
358
- // default. The same envelope should also be enforced server-side.
359
- if (opts.name !== undefined) {
360
- if (opts.name === "") {
361
- fail({
362
- code: "BAD_PROJECT_NAME",
363
- message: "--name must not be empty.",
364
- details: { field: "--name" },
365
- hint: "Provide a 1-128 character name, or omit --name to use the server-assigned default.",
366
- });
367
- }
368
- if (opts.name.length > 128) {
369
- fail({
370
- code: "BAD_PROJECT_NAME",
371
- message: `--name must be 1-128 characters, got ${opts.name.length}.`,
372
- details: { field: "--name", length: opts.name.length, max: 128 },
373
- });
374
- }
375
- // eslint-disable-next-line no-control-regex
376
- if (/[\x00-\x1f\x7f]/.test(opts.name)) {
377
- fail({
378
- code: "BAD_PROJECT_NAME",
379
- message: "--name contains control characters (newline, tab, etc).",
380
- details: { field: "--name" },
381
- hint: "Project names should be a single-line label.",
382
- });
383
- }
384
- }
385
356
  // Aggressive early exit when no local wallet is configured — but only when
386
357
  // there's also no sign-in session, since a wallet-less person provisions
387
358
  // into an org via a write approval instead of a wallet.
@@ -610,21 +581,13 @@ async function tenantPayments(projectId, args = []) {
610
581
  const after = flagValue(args, "--after") ?? undefined;
611
582
  const limitFlag = flagValue(args, "--limit");
612
583
  const limit = limitFlag === null ? undefined : Number(limitFlag);
613
- if (limitFlag !== null && (!Number.isInteger(limit) || limit <= 0 || limit > 200)) {
584
+ if (limitFlag !== null && !Number.isInteger(limit)) {
614
585
  fail({
615
586
  code: "BAD_FLAG",
616
- message: `--limit must be an integer from 1 to 200; got ${limitFlag}.`,
587
+ message: `--limit must be a whole number; got ${limitFlag}.`,
617
588
  details: { flag: "--limit", value: limitFlag },
618
589
  });
619
590
  }
620
- const allowed = new Set(["settling", "settled", "settle_failed", "ambiguous"]);
621
- if (status !== undefined && !allowed.has(status)) {
622
- fail({
623
- code: "BAD_FLAG",
624
- message: `--status must be one of settling, settled, settle_failed, ambiguous; got ${status}.`,
625
- details: { flag: "--status", value: status },
626
- });
627
- }
628
591
  try {
629
592
  const data = await getSdk().projects.listTenantPayments(projectId, { status, after, limit });
630
593
  console.log(JSON.stringify(data, null, 2));
@@ -734,9 +697,6 @@ async function sqlBatchCmd(projectId, batchFile, transaction, others) {
734
697
  if (others.query || others.file || others.paramsRaw) {
735
698
  fail({ code: "BAD_USAGE", message: "--batch takes its statements from the file; drop the inline query, --file, and --params." });
736
699
  }
737
- if (transaction !== null && transaction !== "all" && transaction !== "each") {
738
- fail({ code: "BAD_USAGE", message: "--transaction must be all or each." });
739
- }
740
700
  validateRegularFile(batchFile, "--batch");
741
701
  let parsed;
742
702
  try {
@@ -745,7 +705,7 @@ async function sqlBatchCmd(projectId, batchFile, transaction, others) {
745
705
  fail({ code: "BAD_USAGE", message: `--batch ${batchFile} is not valid JSON: ${err.message}` });
746
706
  }
747
707
  const statements = Array.isArray(parsed) ? parsed : parsed?.statements;
748
- if (!Array.isArray(statements) || statements.length === 0) {
708
+ if (!Array.isArray(statements)) {
749
709
  fail({
750
710
  code: "BAD_USAGE",
751
711
  message: "--batch expects a JSON array of { \"sql\": \"...\", \"params\": [...] } statements.",
@@ -822,13 +782,6 @@ function adminCookieFromEnv() {
822
782
 
823
783
  async function costs(projectId, args = []) {
824
784
  const window = flagValue(args, "--window") ?? "30d";
825
- if (!FINANCE_WINDOWS.has(window)) {
826
- fail({
827
- code: "BAD_FLAG",
828
- message: `--window must be one of 24h, 7d, 30d, 90d; got ${window}.`,
829
- details: { flag: "--window", value: window, allowed: [...FINANCE_WINDOWS] },
830
- });
831
- }
832
785
  const cookie = adminCookieFromEnv();
833
786
  try {
834
787
  const data = await getSdk().admin.getProjectFinance(projectId, {
@@ -912,8 +912,7 @@ async function main(argv, { onBackgroundWork } = {}) {
912
912
  * `compact()` (namespace, `sdk/src/namespaces/repos.ts`) already owns
913
913
  * the compaction headroom grant's open/close and single-flight refusal
914
914
  * (`VAULT_COMPACTION_IN_PROGRESS`) — this function only decides WHETHER
915
- * and HOW to run the cycle, never re-implements those. `--force-headroom`
916
- * is NEVER passed on this path (design D5) — an insufficient-headroom
915
+ * and HOW to run the cycle, never re-implements those. A storage-quota
917
916
  * refusal, a conflicting in-flight compaction, or any other failure all
918
917
  * degrade identically: one advisory line naming `run402 repos gc`, never
919
918
  * a thrown error, never a retry loop.
package/lib/repos.mjs CHANGED
@@ -44,6 +44,7 @@ import {
44
44
  resolveProjectSelector,
45
45
  failUnknownSubcommand,
46
46
  validateRegularFile,
47
+ parseIntegerArg,
47
48
  } from "./argparse.mjs";
48
49
 
49
50
  /**
@@ -102,7 +103,7 @@ Lifecycle:
102
103
 
103
104
  Maintenance:
104
105
  run402 repos fsck [--project <project_id>] [--repo <repo_id>] [--mirror] [--budget <n>] [--no-write] [--human]
105
- run402 repos gc [--project <project_id>] [--repo <repo_id>] [--force-headroom] [--submit --intent-core <path> --verifier-receipt <path> [--wait]]
106
+ run402 repos gc [--project <project_id>] [--repo <repo_id>] [--submit --intent-core <path> --verifier-receipt <path> [--wait]]
106
107
  run402 repos daemon <status|stop> The resident helper engine (vault-persistent-helper) — inspect or retire it; nothing requires either
107
108
  run402 repos access [--project <project_id>] [--repo <repo_id>] [--human]
108
109
  run402 repos access repair [--project <project_id>] [--repo <repo_id>] --recipient-state-version <n> --recipient-revocation-version <n>
@@ -486,13 +487,6 @@ Options:
486
487
  gc: r402s-verify's verifier_receipt over that same core.
487
488
  --wait gc: poll the submitted intent until the control-plane-
488
489
  signed completion appears, instead of returning immediately
489
- --force-headroom gc: compact even when the storage preflight says the org's
490
- pooled tier storage cannot hold the transient footprint.
491
- Compaction holds BOTH the new checkpoint and the
492
- not-yet-pruned history until a prune completes -- roughly
493
- 2x source_bytes -- so an org near its cap can otherwise be
494
- refused mid-upload. The platform's own quota enforcement
495
- stays authoritative either way.
496
490
  --reason <why> policy: why the policy is changing — recorded in the
497
491
  audit event. REQUIRED for \`grandfathered\`.
498
492
  -v, --verbose Print one stderr summary line of this call's request
@@ -734,19 +728,6 @@ async function formatRepoHuman(s, mirror) {
734
728
 
735
729
  // ─── name inference ──────────────────
736
730
 
737
- function validateProjectName(name) {
738
- if (name === "") {
739
- fail({ code: "BAD_PROJECT_NAME", message: "the repo name must not be empty.", details: { field: "name" } });
740
- }
741
- if (name.length > 128) {
742
- fail({ code: "BAD_PROJECT_NAME", message: `the repo name must be 1-128 characters, got ${name.length}.`, details: { field: "name", length: name.length, max: 128 } });
743
- }
744
- // eslint-disable-next-line no-control-regex
745
- if (/[\x00-\x1f\x7f]/.test(name)) {
746
- fail({ code: "BAD_PROJECT_NAME", message: "the repo name contains control characters (newline, tab, etc).", details: { field: "name" } });
747
- }
748
- }
749
-
750
731
  /**
751
732
  * Best-effort slugify for the address-form repo name (the address-form
752
733
  * grammar: lowercase [a-z0-9-], no leading/trailing/double hyphen, <=63 chars).
@@ -1065,7 +1046,6 @@ async function create(args) {
1065
1046
  }
1066
1047
 
1067
1048
  if (name == null) name = await inferRepoName(dir);
1068
- validateProjectName(name);
1069
1049
  return createProvision(name, dir, a);
1070
1050
  }
1071
1051
 
@@ -1753,7 +1733,7 @@ async function handoff(args) {
1753
1733
 
1754
1734
  const note = await readHandoffNoteInput(a);
1755
1735
  const ttlRaw = flagValue(a, "--ttl");
1756
- const ttlSeconds = ttlRaw != null ? parseIntegerFlag("--ttl", ttlRaw, { min: 60, max: 86400 }) : undefined;
1736
+ const ttlSeconds = ttlRaw != null ? parseIntegerArg("--ttl", ttlRaw) : undefined;
1757
1737
  const role = flagValue(a, "--role");
1758
1738
  const includeSensitive = flagValues(a, "--include-sensitive");
1759
1739
  const target = await vaultTarget(a);
@@ -1988,7 +1968,7 @@ async function invite(args) {
1988
1968
 
1989
1969
  const note = await readInviteNoteInput(a);
1990
1970
  const ttlRaw = flagValue(a, "--ttl");
1991
- const ttlSeconds = ttlRaw != null ? parseIntegerFlag("--ttl", ttlRaw, { min: 60, max: 86400 }) : undefined;
1971
+ const ttlSeconds = ttlRaw != null ? parseIntegerArg("--ttl", ttlRaw) : undefined;
1992
1972
  const role = flagValue(a, "--role");
1993
1973
  const includeSensitive = flagValues(a, "--include-sensitive");
1994
1974
  const roomKey = flagValue(a, "--room");
@@ -2249,14 +2229,6 @@ async function policy(args) {
2249
2229
  });
2250
2230
  }
2251
2231
  const reason = flagValue(a, "--reason");
2252
- if (requested === "grandfathered" && (reason == null || reason.trim() === "")) {
2253
- fail({
2254
- code: "BAD_USAGE",
2255
- message: "`grandfathered` needs --reason <why>.",
2256
- hint: "It weakens the activation guarantee for this project and is recorded in the audit event. Say why, e.g. --reason \"migrating CI to a vaulted client\".",
2257
- details: { policy: requested },
2258
- });
2259
- }
2260
2232
 
2261
2233
  const target = await vaultTarget(a);
2262
2234
  try {
@@ -2556,11 +2528,7 @@ const GC_VALUE_FLAGS = [...COMMON_VALUE_FLAGS, "--intent-core", "--verifier-rece
2556
2528
  function printHeadroomNote(headroom) {
2557
2529
  if (!headroom) return;
2558
2530
  const mib = (n) => `${(n / (1024 * 1024)).toFixed(1)} MiB`;
2559
- const verdict = headroom.overridden
2560
- ? "OVER the pooled cap — proceeding because --force-headroom was passed; the platform's own quota stays authoritative"
2561
- : headroom.ok
2562
- ? "fits"
2563
- : "does NOT fit";
2531
+ const verdict = headroom.ok ? "fits" : "does NOT fit";
2564
2532
  console.error(
2565
2533
  `storage headroom: ${mib(headroom.pool_used_bytes)} used of ${mib(headroom.pool_limit_bytes)} pooled; ` +
2566
2534
  `compaction transiently adds about ${mib(headroom.vault_source_bytes)} (it holds both the new checkpoint and the ` +
@@ -2570,7 +2538,7 @@ function printHeadroomNote(headroom) {
2570
2538
 
2571
2539
  async function gc(args) {
2572
2540
  const a = normalizeArgv(args);
2573
- assertKnownFlags(a, [...GC_VALUE_FLAGS, "--submit", "--wait", "--force-headroom", "-v", "--verbose", "--help", "-h"], GC_VALUE_FLAGS);
2541
+ assertKnownFlags(a, [...GC_VALUE_FLAGS, "--submit", "--wait", "-v", "--verbose", "--help", "-h"], GC_VALUE_FLAGS);
2574
2542
  requirePositionalCount(a, GC_VALUE_FLAGS, { min: 0, max: 0, command: "run402 repos gc", missing: "" });
2575
2543
  const sdk = getSdk();
2576
2544
  const submitting = a.includes("--submit");
@@ -2622,7 +2590,7 @@ async function gc(args) {
2622
2590
  return;
2623
2591
  }
2624
2592
 
2625
- const checkpoint = await sdk.repos.compact({ ...target, ...(a.includes("--force-headroom") ? { ignoreHeadroom: true } : {}) });
2593
+ const checkpoint = await sdk.repos.compact(target);
2626
2594
  const prune = await sdk.repos.prune(target);
2627
2595
  const nextActions = [];
2628
2596
  if (!prune.blocked_reason && prune.object_candidates.length > 0) {
package/lib/rooms.mjs CHANGED
@@ -17,13 +17,12 @@ import {
17
17
  normalizeArgv,
18
18
  hasHelp,
19
19
  assertKnownFlags,
20
- assertAllowedValue,
21
- parseIntegerFlag,
22
20
  flagValue,
23
21
  positionalArgs,
24
22
  requirePositionalCount,
25
23
  failUnknownSubcommand,
26
24
  validateRegularFile,
25
+ parseIntegerArg,
27
26
  } from "./argparse.mjs";
28
27
  import {
29
28
  resolveRoom,
@@ -335,7 +334,7 @@ async function invite(argv) {
335
334
  });
336
335
  const note = await readRoomInviteNote(a);
337
336
  const expiresRaw = flagValue(a, "--expires-in");
338
- const expiresInSeconds = expiresRaw != null ? parseIntegerFlag("--expires-in", expiresRaw, { min: 60, max: 86400 }) : undefined;
337
+ const expiresInSeconds = expiresRaw != null ? parseIntegerArg("--expires-in", expiresRaw) : undefined;
339
338
  const asJson = a.includes("--json");
340
339
 
341
340
  const sdk = getSdk();
package/lib/snapshots.mjs CHANGED
@@ -1,15 +1,14 @@
1
1
  import { getSdk } from "./sdk.mjs";
2
2
  import { fail, reportSdkError } from "./sdk-errors.mjs";
3
3
  import {
4
- assertAllowedValue,
5
4
  assertKnownFlags,
6
5
  flagValue,
7
6
  hasHelp,
8
7
  normalizeArgv,
9
- parseIntegerFlag,
10
8
  positionalArgs,
11
9
  resolveProjectSelector,
12
10
  failUnknownSubcommand,
11
+ parseIntegerArg,
13
12
  } from "./argparse.mjs";
14
13
 
15
14
  const HELP = `run402 snapshots — Project database restore points
@@ -41,8 +40,6 @@ result; restore-status reads a restore by id.
41
40
 
42
41
  const FLAG_VALUES = ["--project", "--kind", "--limit", "--after", "--confirm", "--label", "--metadata", "--release"];
43
42
  const FLAGS = new Set([...FLAG_VALUES, "--include-auth", "--json", "--help", "-h"]);
44
- const SNAPSHOT_KINDS = ["manual", "pre_migration", "pre_restore", "scheduled"];
45
- const RELEASE_MODES = ["keep", "snapshot"];
46
43
 
47
44
  export async function run(sub, args = []) {
48
45
  const all = [sub, ...args].filter(Boolean);
@@ -86,7 +83,6 @@ function parseMetadataFlag(args) {
86
83
  function releaseFlag(args) {
87
84
  const release = flagValue(args, "--release");
88
85
  if (release === null) return undefined;
89
- assertAllowedValue(release, RELEASE_MODES, "--release");
90
86
  return release;
91
87
  }
92
88
 
@@ -108,9 +104,8 @@ async function create(args) {
108
104
  async function list(args) {
109
105
  const { projectId } = resolveProjectSelector(args, { valueFlags: FLAG_VALUES });
110
106
  const kind = flagValue(args, "--kind") ?? undefined;
111
- if (kind !== undefined) assertAllowedValue(kind, SNAPSHOT_KINDS, "--kind");
112
107
  const limitFlag = flagValue(args, "--limit");
113
- const limit = limitFlag === null ? undefined : parseIntegerFlag("--limit", limitFlag, { min: 1, max: 100 });
108
+ const limit = limitFlag === null ? undefined : parseIntegerArg("--limit", limitFlag);
114
109
  try {
115
110
  const result = await getSdk().snapshots.list(projectId, {
116
111
  ...(kind ? { kind } : {}),
package/lib/stripe.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { resolveProjectId } from "./config.mjs";
2
2
  import { getSdk } from "./sdk.mjs";
3
3
  import { reportSdkError, fail } from "./sdk-errors.mjs";
4
- import { assertKnownFlags, flagValue, normalizeArgv, positionalArgs, parseIntegerFlag, failUnknownSubcommand } from "./argparse.mjs";
4
+ import { assertKnownFlags, flagValue, normalizeArgv, positionalArgs, failUnknownSubcommand, parseIntegerArg } from "./argparse.mjs";
5
5
 
6
6
  const HELP = `run402 stripe — Stripe payments for your app, on the organization's own Stripe account
7
7
 
@@ -161,9 +161,6 @@ async function accountConnect(args) {
161
161
  rejectExtraPositionals(positionalArgs(parsed, valueFlags), "stripe account connect");
162
162
  const projectId = resolveProjectId(flagValue(parsed, "--project"));
163
163
  const businessType = opt(parsed, "--business-type");
164
- if (businessType !== undefined && !["company", "individual", "non_profit"].includes(businessType)) {
165
- fail({ code: "BAD_USAGE", message: "--business-type must be one of company, individual, non_profit.", details: { flag: "--business-type" } });
166
- }
167
164
  const input = {
168
165
  country: opt(parsed, "--country"),
169
166
  businessType,
@@ -250,19 +247,18 @@ async function account(args) {
250
247
  function checkoutLineItem(parsed) {
251
248
  const price = opt(parsed, "--price");
252
249
  const priceData = parseJsonFlag(parsed, "--price-data");
253
- if ((price === undefined) === (priceData === undefined)) {
254
- fail({ code: "BAD_USAGE", message: "Pass exactly one of --price <price_id> or --price-data <json>.", hint: "run402 stripe checkout create --help" });
255
- }
256
- const quantity = parseIntegerFlag("--quantity", opt(parsed, "--quantity"), { min: 1, max: 999, def: 1 });
257
- return price !== undefined ? { price, quantity } : { price_data: priceData, quantity };
250
+ const quantity = parseIntegerArg("--quantity", opt(parsed, "--quantity"), { def: 1 });
251
+ // Both pass through as given: the gateway judges a line item with neither or both.
252
+ return {
253
+ ...(price !== undefined ? { price } : {}),
254
+ ...(priceData !== undefined ? { price_data: priceData } : {}),
255
+ quantity,
256
+ };
258
257
  }
259
258
 
260
259
  function checkoutOptions(parsed) {
261
260
  const customer = opt(parsed, "--customer");
262
261
  const customerEmail = opt(parsed, "--customer-email");
263
- if (customer !== undefined && customerEmail !== undefined) {
264
- fail({ code: "BAD_USAGE", message: "Pass --customer or --customer-email, not both.", details: { flag: "--customer-email" } });
265
- }
266
262
  const trialDays = opt(parsed, "--trial-days");
267
263
  return {
268
264
  customer,
@@ -271,7 +267,7 @@ function checkoutOptions(parsed) {
271
267
  metadata: parseJsonFlag(parsed, "--metadata"),
272
268
  locale: opt(parsed, "--locale"),
273
269
  idempotencyKey: opt(parsed, "--idempotency-key"),
274
- subscription: trialDays === undefined ? undefined : { trial_period_days: parseIntegerFlag("--trial-days", trialDays, { min: 1, max: 730 }) },
270
+ subscription: trialDays === undefined ? undefined : { trial_period_days: parseIntegerArg("--trial-days", trialDays) },
275
271
  };
276
272
  }
277
273
 
@@ -285,9 +281,6 @@ async function checkoutCreate(args) {
285
281
  rejectExtraPositionals(positionalArgs(parsed, valueFlags), "stripe checkout create");
286
282
  const projectId = resolveProjectId(flagValue(parsed, "--project"));
287
283
  const mode = opt(parsed, "--mode");
288
- if (mode !== "subscription" && mode !== "payment") {
289
- fail({ code: "BAD_USAGE", message: "--mode must be subscription or payment.", details: { flag: "--mode" } });
290
- }
291
284
  const successUrl = opt(parsed, "--success-url");
292
285
  const cancelUrl = opt(parsed, "--cancel-url");
293
286
  if (!successUrl || !cancelUrl) {
@@ -22,7 +22,6 @@ import { sessionProofs } from "./session-proofs.mjs";
22
22
  import { getSdk } from "./sdk.mjs";
23
23
  import { reportSdkError, fail } from "./sdk-errors.mjs";
24
24
  import {
25
- assertAllowedValue,
26
25
  assertKnownFlags,
27
26
  flagValue,
28
27
  normalizeArgv,
@@ -111,12 +110,10 @@ async function rulesAdd(args) {
111
110
  }
112
111
  const projectId = flagValue(a, "--project");
113
112
  const source = flagValue(a, "--source");
114
- if (source !== null) assertAllowedValue(source, ["app", "platform"], "--source");
115
113
  const typeRaw = flagValue(a, "--type");
116
114
  const classRaw = flagValue(a, "--class");
117
115
 
118
116
  const minSeverity = flagValue(a, "--min-severity");
119
- if (minSeverity !== null) assertAllowedValue(minSeverity, SEVERITY_LEVELS, "--min-severity");
120
117
  const groupByRaw = flagValue(a, "--group-by");
121
118
  const windowRaw = flagValue(a, "--window");
122
119
 
package/lib/transfer.mjs CHANGED
@@ -6,9 +6,9 @@ import {
6
6
  flagValue,
7
7
  hasHelp,
8
8
  normalizeArgv,
9
- parseIntegerFlag,
10
9
  positionalArgs,
11
10
  failUnknownSubcommand,
11
+ parseIntegerArg,
12
12
  } from "./argparse.mjs";
13
13
 
14
14
  const HELP = `run402 transfer — Project transfer, one noun for wallet, email, and owned-org recipients
@@ -143,8 +143,6 @@ TRANSFER_ALREADY_PROCESSED.
143
143
  `,
144
144
  };
145
145
 
146
- const BILLING_POLICIES = new Set(["migrate"]);
147
- const RETAIN_ROLES = new Set(["developer"]);
148
146
 
149
147
  async function init(args) {
150
148
  const parsedArgs = normalizeArgv(args);
@@ -168,13 +166,6 @@ async function init(args) {
168
166
  fail({ code: "NO_PROJECT", message: "No project id. Pass --project <project_id> or set an active project with 'run402 projects use <project_id>'." });
169
167
  }
170
168
  const billingPolicy = flagValue(parsedArgs, "--billing-policy");
171
- if (billingPolicy !== null && !BILLING_POLICIES.has(billingPolicy)) {
172
- fail({
173
- code: "BAD_FLAG",
174
- message: `Unsupported --billing-policy: ${billingPolicy}. Phase 1A allows only 'migrate'.`,
175
- details: { flag: "--billing-policy", value: billingPolicy, allowed: [...BILLING_POLICIES] },
176
- });
177
- }
178
169
  const message = flagValue(parsedArgs, "--message");
179
170
  const kysigned = flagValue(parsedArgs, "--kysigned");
180
171
  const retainMember = flagValue(parsedArgs, "--retain-member");
@@ -183,66 +174,24 @@ async function init(args) {
183
174
  // --to-org is explicit because org ids are not human-recipient addresses.
184
175
  const recipientKind = toOrg ? "org" : (to.includes("@") ? "email" : "wallet");
185
176
 
186
- // --retain-member is an email-only opt-in: the sender keeps a developer
187
- // membership in the recipient's org (the recipient must accept it at accept).
188
- if (retainMember !== null) {
189
- if (recipientKind !== "email") {
190
- fail({
191
- code: "BAD_FLAG",
192
- message: "--retain-member applies only to email recipients.",
193
- details: { flag: "--retain-member" },
194
- });
195
- }
196
- if (!RETAIN_ROLES.has(retainMember)) {
197
- fail({
198
- code: "BAD_FLAG",
199
- message: `Unsupported --retain-member role: ${retainMember}. Allowed: ${[...RETAIN_ROLES].join(", ")}.`,
200
- details: { flag: "--retain-member", value: retainMember, allowed: [...RETAIN_ROLES] },
201
- });
202
- }
203
- }
204
- if (kysigned !== null && recipientKind !== "wallet") {
205
- fail({
206
- code: "BAD_FLAG",
207
- message: "--kysigned applies only to wallet recipients; email and owned-org transfers do not use the KySigned rail.",
208
- details: { flag: "--kysigned" },
209
- });
210
- }
211
- if (billingPolicy !== null && recipientKind !== "wallet") {
212
- fail({
213
- code: "BAD_FLAG",
214
- message: "--billing-policy applies only to wallet recipients; email and owned-org transfers always migrate ownership.",
215
- details: { flag: "--billing-policy" },
216
- });
217
- }
218
-
177
+ // --retain-member (an email recipient's opt-in), --kysigned and
178
+ // --billing-policy (wallet recipients) ride every shape as given; the
179
+ // gateway judges which recipient each applies to.
219
180
  // All recipient shapes initiate on the unified transfer endpoint — sign that path.
220
181
  walletAuthHeaders(`/projects/v1/${projectId}/transfers`);
221
182
 
222
183
  try {
223
- let res;
224
- if (recipientKind === "org") {
225
- res = await getSdk().admin.transfers.initiate({
226
- projectId,
227
- toOrgId: toOrg,
228
- message: message ?? undefined,
229
- });
230
- } else if (recipientKind === "email") {
231
- res = await getSdk().admin.transfers.initiate({
232
- projectId,
233
- toEmail: to,
234
- message: message ?? undefined,
235
- retainMember: retainMember ? { role: retainMember } : undefined,
236
- });
237
- } else {
238
- res = await getSdk().admin.transfers.initiate({
239
- projectId,
240
- toWallet: to,
241
- billingPolicy: billingPolicy ?? undefined,
242
- message: message ?? undefined,
243
- kysignedRecordId: kysigned ?? undefined,
244
- });
245
- }
184
+ const recipient = recipientKind === "org"
185
+ ? { toOrgId: toOrg }
186
+ : recipientKind === "email" ? { toEmail: to } : { toWallet: to };
187
+ const res = await getSdk().admin.transfers.initiate({
188
+ projectId,
189
+ ...recipient,
190
+ message: message ?? undefined,
191
+ retainMember: retainMember ? { role: retainMember } : undefined,
192
+ billingPolicy: billingPolicy ?? undefined,
193
+ kysignedRecordId: kysigned ?? undefined,
194
+ });
246
195
  console.log(JSON.stringify(res, null, 2));
247
196
  } catch (err) {
248
197
  reportSdkError(err);
@@ -289,7 +238,7 @@ async function list(args) {
289
238
  const limit =
290
239
  limitFlag === null
291
240
  ? undefined
292
- : parseIntegerFlag("--limit", limitFlag, { min: 1, max: 1000 });
241
+ : parseIntegerArg("--limit", limitFlag);
293
242
 
294
243
  // Incoming/outgoing are kind-agnostic — each returns the union of pending
295
244
  // wallet/email/future-org rows, tagged with recipient_kind.
package/lib/up.mjs CHANGED
@@ -162,8 +162,6 @@ Options:
162
162
  --quiet Suppress action progress events on stderr.
163
163
  `;
164
164
 
165
- const TIERS = new Set(["prototype", "hobby", "team"]);
166
- const BUILD_MODES = new Set(["local", "remote", "sandbox"]);
167
165
 
168
166
  export async function run(args = []) {
169
167
  const parsed = normalizeArgv(args);
@@ -244,22 +242,8 @@ export async function run(args = []) {
244
242
  }
245
243
 
246
244
  const tier = flagValue(parsed, "--tier") ?? undefined;
247
- if (tier && !TIERS.has(tier)) {
248
- fail({
249
- code: "BAD_FLAG",
250
- message: "--tier must be one of: prototype, hobby, team",
251
- details: { flag: "--tier", value: tier, allowed: [...TIERS] },
252
- });
253
- }
254
245
 
255
246
  const buildMode = flagValue(parsed, "--build-mode") ?? undefined;
256
- if (buildMode && !BUILD_MODES.has(buildMode)) {
257
- fail({
258
- code: "BAD_FLAG",
259
- message: "--build-mode must be one of: local, remote, sandbox",
260
- details: { flag: "--build-mode", value: buildMode, allowed: [...BUILD_MODES] },
261
- });
262
- }
263
247
 
264
248
  const maxSpendRaw = flagValue(parsed, "--max-spend-usd");
265
249
  const maxSpendUsd = maxSpendRaw === null ? undefined : Number(maxSpendRaw);
package/lib/webhooks.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { resolveProjectId } from "./config.mjs";
2
2
  import { getSdk } from "./sdk.mjs";
3
3
  import { reportSdkError, fail } from "./sdk-errors.mjs";
4
- import { assertKnownFlags, flagValue, normalizeArgv, positionalArgs, validateWebhookUrl, failUnknownSubcommand } from "./argparse.mjs";
4
+ import { assertKnownFlags, flagValue, normalizeArgv, positionalArgs, failUnknownSubcommand } from "./argparse.mjs";
5
5
 
6
6
  const HELP = `run402 email webhooks — Manage mailbox webhooks
7
7
 
@@ -149,14 +149,6 @@ async function update(args) {
149
149
  hint: "run402 email webhooks update <webhook_id> [--url <url>] [--events <e1,e2>]",
150
150
  });
151
151
  }
152
- if (!url && !eventsRaw) {
153
- fail({ code: "BAD_USAGE", message: "Provide at least --url or --events" });
154
- }
155
- // scheme-only local validation. Server-side SSRF defenses are out
156
- // of scope for the CLI (private-IP / DNS rebinding / IMDS belongs on the
157
- // gateway). `validateWebhookUrl` is a no-op when `url` is null/undefined,
158
- // so partial updates that change only `--events` still work.
159
- validateWebhookUrl(url, "--url");
160
152
 
161
153
  try {
162
154
  const data = await getSdk().email.webhooks.update(projectId, webhookId, {
@@ -186,10 +178,6 @@ async function register(args) {
186
178
  hint: "run402 email webhooks register --url <url> --events <e1,e2>",
187
179
  });
188
180
  }
189
- // validate scheme locally before any network call. Catches
190
- // javascript:/file:/http:/data: schemes that the gateway would reject
191
- // anyway, but with a friendlier round-trip-free error.
192
- validateWebhookUrl(url, "--url");
193
181
  if (!eventsRaw) {
194
182
  fail({
195
183
  code: "BAD_USAGE",
package/lib/whoami.mjs CHANGED
@@ -60,14 +60,6 @@ export async function run(args = []) {
60
60
  fail({ code: "BAD_USAGE", message: `Unexpected argument for whoami: ${extra[0]}`, hint: "Use `run402 whoami` or `run402 whoami --set-name <name>`." });
61
61
  }
62
62
  const setName = flagValue(args, "--set-name");
63
- if (setName !== null && setName.trim() === "") {
64
- fail({
65
- code: "BAD_USAGE",
66
- message: "--set-name must not be empty.",
67
- details: { field: "--set-name" },
68
- hint: "Pass a 1-64 character display name.",
69
- });
70
- }
71
63
  const sdk = getSdk();
72
64
  if (setName !== null) {
73
65
  try {