run402 4.93.2 → 4.95.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -59
- package/cli.mjs +40 -47
- package/core-dist/config.js +52 -18
- package/core-dist/control-plane-session.js +31 -6
- package/core-dist/keystore.js +7 -7
- package/core-dist/profiles.js +9 -7
- package/core-dist/{allowance-auth.js → wallet-auth.js} +15 -15
- package/{sdk/core-dist/allowance.js → core-dist/wallet.js} +20 -20
- package/{sdk/core-dist/write-auth-session.js → core-dist/write-approvals.js} +19 -19
- package/gitvault-surface.json +2 -2
- package/lib/admin.mjs +6 -6
- package/lib/agent.mjs +20 -18
- package/lib/ai.mjs +5 -5
- package/lib/approve.mjs +81 -0
- package/lib/apps.mjs +12 -12
- package/lib/archives.mjs +371 -8
- package/lib/argparse.mjs +5 -5
- package/lib/assets.mjs +14 -14
- package/lib/auth.mjs +34 -34
- package/lib/billing.mjs +6 -6
- package/lib/branches.mjs +7 -7
- package/lib/buzz-doctor.mjs +2 -2
- package/lib/buzz-notifications.mjs +5 -5
- package/lib/buzz.mjs +3 -3
- package/lib/buzz.test.mjs +1 -1
- package/lib/cache.mjs +1 -1
- package/lib/cdn.mjs +2 -2
- package/lib/ci.mjs +12 -12
- package/lib/claims.mjs +2 -2
- package/lib/cold-start.mjs +21 -21
- package/lib/command-manifest.mjs +55 -70
- package/lib/config.mjs +28 -28
- package/lib/contacts.mjs +16 -16
- package/lib/contracts.mjs +12 -12
- package/lib/credentials.mjs +33 -33
- package/lib/daemon-path.mjs +1 -1
- package/lib/delegates.mjs +14 -14
- package/lib/deliveries.mjs +6 -6
- package/lib/deploy-rehearse-discovery.test.mjs +7 -7
- package/lib/deploy-v2.mjs +241 -193
- package/lib/deploy.mjs +21 -53
- package/lib/dev.mjs +3 -3
- package/lib/doctor-source-scan.mjs +1 -1
- package/lib/doctor.mjs +63 -63
- package/lib/domains.mjs +27 -27
- package/lib/email.mjs +38 -38
- package/lib/errors.mjs +40 -24
- package/lib/escalations.mjs +5 -5
- package/lib/events.mjs +32 -25
- package/lib/feedback.mjs +12 -12
- package/lib/functions.mjs +34 -34
- package/lib/gitvault-daemon.mjs +1 -1
- package/lib/gitvault-scaffold.mjs +2 -2
- package/lib/gitvault.mjs +2 -2
- package/lib/grants.mjs +7 -7
- package/lib/image.mjs +10 -10
- package/lib/init.mjs +69 -69
- package/lib/jobs.mjs +15 -15
- package/lib/lightning-wallet.mjs +28 -28
- package/lib/live.mjs +1 -1
- package/lib/login.mjs +207 -0
- package/lib/logout.mjs +53 -0
- package/lib/logs.mjs +8 -8
- package/lib/messages.mjs +5 -5
- package/lib/next-actions.mjs +16 -16
- package/lib/org-context.mjs +13 -13
- package/lib/{org.mjs → orgs.mjs} +215 -167
- package/lib/pay.mjs +1 -1
- package/lib/projects.mjs +70 -84
- package/lib/redeem.mjs +7 -8
- package/lib/remote-helper-session.mjs +12 -12
- package/lib/repos.mjs +83 -83
- package/lib/rooms.mjs +105 -69
- package/lib/sdk-errors.mjs +10 -5
- package/lib/sdk.mjs +3 -3
- package/lib/secrets.mjs +13 -13
- package/lib/service.mjs +5 -5
- package/lib/session-proofs.mjs +21 -0
- package/lib/sign-in.mjs +296 -0
- package/lib/sites.mjs +22 -22
- package/lib/snapshots.mjs +10 -10
- package/lib/stats.mjs +2 -2
- package/lib/status.mjs +25 -25
- package/lib/subdomains.mjs +30 -30
- package/lib/subscriptions.mjs +10 -10
- package/lib/tier.mjs +29 -22
- package/lib/transfer.mjs +59 -86
- package/lib/up.mjs +14 -14
- package/lib/wallet-context.mjs +4 -4
- package/lib/wallet-context.test.mjs +3 -3
- package/lib/wallets.mjs +197 -32
- package/lib/webhook-secret.mjs +6 -6
- package/lib/webhooks.mjs +8 -8
- package/lib/whoami.mjs +102 -0
- package/package.json +1 -1
- package/sdk/core-dist/config.js +52 -18
- package/sdk/core-dist/control-plane-session.js +31 -6
- package/sdk/core-dist/keystore.js +7 -7
- package/sdk/core-dist/profiles.js +9 -7
- package/sdk/core-dist/{allowance-auth.js → wallet-auth.js} +15 -15
- package/{core-dist/allowance.js → sdk/core-dist/wallet.js} +20 -20
- package/{core-dist/write-auth-session.js → sdk/core-dist/write-approvals.js} +19 -19
- package/sdk/dist/actions.d.ts +4 -4
- package/sdk/dist/actions.d.ts.map +1 -1
- package/sdk/dist/app-up.d.ts +2 -2
- package/sdk/dist/app-up.d.ts.map +1 -1
- package/sdk/dist/config.d.ts +1 -2
- package/sdk/dist/config.d.ts.map +1 -1
- package/sdk/dist/config.js.map +1 -1
- package/sdk/dist/control-plane-credentials.d.ts +8 -8
- package/sdk/dist/control-plane-credentials.js +7 -7
- package/sdk/dist/credentials.d.ts +20 -20
- package/sdk/dist/credentials.d.ts.map +1 -1
- package/sdk/dist/credentials.js +1 -1
- package/sdk/dist/errors.d.ts +26 -28
- package/sdk/dist/errors.d.ts.map +1 -1
- package/sdk/dist/errors.js +35 -38
- package/sdk/dist/errors.js.map +1 -1
- package/sdk/dist/index.d.ts +29 -16
- package/sdk/dist/index.d.ts.map +1 -1
- package/sdk/dist/index.js +30 -17
- package/sdk/dist/index.js.map +1 -1
- package/sdk/dist/kernel.d.ts +1 -1
- package/sdk/dist/kernel.d.ts.map +1 -1
- package/sdk/dist/kernel.js +10 -9
- package/sdk/dist/kernel.js.map +1 -1
- package/sdk/dist/namespaces/admin.d.ts +52 -121
- package/sdk/dist/namespaces/admin.d.ts.map +1 -1
- package/sdk/dist/namespaces/admin.js +41 -45
- package/sdk/dist/namespaces/admin.js.map +1 -1
- package/sdk/dist/namespaces/agent.d.ts +2 -2
- package/sdk/dist/namespaces/agent.d.ts.map +1 -1
- package/sdk/dist/namespaces/agent.js +2 -2
- package/sdk/dist/namespaces/agent.js.map +1 -1
- package/sdk/dist/namespaces/ai.d.ts +2 -2
- package/sdk/dist/namespaces/ai.js +3 -3
- package/sdk/dist/namespaces/ai.js.map +1 -1
- package/sdk/dist/namespaces/assets.js +1 -1
- package/sdk/dist/namespaces/assets.js.map +1 -1
- package/sdk/dist/namespaces/billing.d.ts +6 -3
- package/sdk/dist/namespaces/billing.d.ts.map +1 -1
- package/sdk/dist/namespaces/billing.js.map +1 -1
- package/sdk/dist/namespaces/buzz-notifications.types.d.ts +1 -1
- package/sdk/dist/namespaces/buzz.d.ts +2 -2
- package/sdk/dist/namespaces/buzz.d.ts.map +1 -1
- package/sdk/dist/namespaces/buzz.js +2 -2
- package/sdk/dist/namespaces/buzz.js.map +1 -1
- package/sdk/dist/namespaces/buzz.types.d.ts +2 -2
- package/sdk/dist/namespaces/buzz.types.d.ts.map +1 -1
- package/sdk/dist/namespaces/ci.js +3 -3
- package/sdk/dist/namespaces/ci.js.map +1 -1
- package/sdk/dist/namespaces/credentials.types.d.ts +1 -1
- package/sdk/dist/namespaces/deploy.d.ts +1 -1
- package/sdk/dist/namespaces/deploy.d.ts.map +1 -1
- package/sdk/dist/namespaces/deploy.js +31 -32
- package/sdk/dist/namespaces/deploy.js.map +1 -1
- package/sdk/dist/namespaces/deploy.types.d.ts +6 -6
- package/sdk/dist/namespaces/deploy.types.d.ts.map +1 -1
- package/sdk/dist/namespaces/domains.d.ts +10 -2
- package/sdk/dist/namespaces/domains.d.ts.map +1 -1
- package/sdk/dist/namespaces/domains.js +10 -5
- package/sdk/dist/namespaces/domains.js.map +1 -1
- package/sdk/dist/namespaces/errors.js +1 -1
- package/sdk/dist/namespaces/escalations.d.ts +1 -1
- package/sdk/dist/namespaces/escalations.js +1 -1
- package/sdk/dist/namespaces/escalations.types.d.ts +2 -2
- package/sdk/dist/namespaces/escalations.types.d.ts.map +1 -1
- package/sdk/dist/namespaces/events.types.d.ts +1 -1
- package/sdk/dist/namespaces/functions.d.ts +1 -1
- package/sdk/dist/namespaces/functions.js +2 -2
- package/sdk/dist/namespaces/functions.js.map +1 -1
- package/sdk/dist/namespaces/gitvault.crypto.d.ts +1 -1
- package/sdk/dist/namespaces/gitvault.d.ts +26 -26
- package/sdk/dist/namespaces/gitvault.d.ts.map +1 -1
- package/sdk/dist/namespaces/gitvault.js +113 -113
- package/sdk/dist/namespaces/gitvault.js.map +1 -1
- package/sdk/dist/namespaces/me.d.ts +120 -0
- package/sdk/dist/namespaces/me.d.ts.map +1 -0
- package/sdk/dist/namespaces/me.js +34 -0
- package/sdk/dist/namespaces/me.js.map +1 -0
- package/sdk/dist/namespaces/org.d.ts +108 -6
- package/sdk/dist/namespaces/org.d.ts.map +1 -1
- package/sdk/dist/namespaces/org.js +63 -7
- package/sdk/dist/namespaces/org.js.map +1 -1
- package/sdk/dist/namespaces/org.types.d.ts +29 -9
- package/sdk/dist/namespaces/org.types.d.ts.map +1 -1
- package/sdk/dist/namespaces/pay.js +3 -3
- package/sdk/dist/namespaces/pay.js.map +1 -1
- package/sdk/dist/namespaces/projects.d.ts +9 -9
- package/sdk/dist/namespaces/projects.js +15 -15
- package/sdk/dist/namespaces/projects.js.map +1 -1
- package/sdk/dist/namespaces/projects.types.d.ts +28 -12
- package/sdk/dist/namespaces/projects.types.d.ts.map +1 -1
- package/sdk/dist/namespaces/rooms.d.ts +7 -7
- package/sdk/dist/namespaces/rooms.js +17 -17
- package/sdk/dist/namespaces/rooms.js.map +1 -1
- package/sdk/dist/namespaces/rooms.types.d.ts +9 -9
- package/sdk/dist/namespaces/rooms.types.d.ts.map +1 -1
- package/sdk/dist/namespaces/service.d.ts +1 -1
- package/sdk/dist/namespaces/service.js +1 -1
- package/sdk/dist/namespaces/{operator-session.d.ts → session.d.ts} +135 -51
- package/sdk/dist/namespaces/session.d.ts.map +1 -0
- package/sdk/dist/namespaces/{operator-session.js → session.js} +118 -30
- package/sdk/dist/namespaces/session.js.map +1 -0
- package/sdk/dist/namespaces/subdomains.d.ts +5 -5
- package/sdk/dist/namespaces/subdomains.d.ts.map +1 -1
- package/sdk/dist/namespaces/subdomains.js +6 -6
- package/sdk/dist/namespaces/subdomains.js.map +1 -1
- package/sdk/dist/namespaces/tier.d.ts +44 -21
- package/sdk/dist/namespaces/tier.d.ts.map +1 -1
- package/sdk/dist/namespaces/tier.js +7 -7
- package/sdk/dist/namespaces/tier.js.map +1 -1
- package/sdk/dist/namespaces/transfers.d.ts +119 -85
- package/sdk/dist/namespaces/transfers.d.ts.map +1 -1
- package/sdk/dist/namespaces/transfers.js +31 -38
- package/sdk/dist/namespaces/transfers.js.map +1 -1
- package/sdk/dist/namespaces/vouchers.d.ts +9 -10
- package/sdk/dist/namespaces/vouchers.d.ts.map +1 -1
- package/sdk/dist/namespaces/vouchers.js +4 -5
- package/sdk/dist/namespaces/vouchers.js.map +1 -1
- package/sdk/dist/namespaces/wallets.d.ts +72 -3
- package/sdk/dist/namespaces/wallets.d.ts.map +1 -1
- package/sdk/dist/namespaces/wallets.js +141 -3
- package/sdk/dist/namespaces/wallets.js.map +1 -1
- package/sdk/dist/namespaces/write-approval.d.ts +101 -0
- package/sdk/dist/namespaces/write-approval.d.ts.map +1 -0
- package/sdk/dist/namespaces/write-approval.js +62 -0
- package/sdk/dist/namespaces/write-approval.js.map +1 -0
- package/sdk/dist/node/actions-node.d.ts +3 -3
- package/sdk/dist/node/actions-node.d.ts.map +1 -1
- package/sdk/dist/node/actions-node.js +44 -44
- package/sdk/dist/node/actions-node.js.map +1 -1
- package/sdk/dist/node/assets-node.js +6 -6
- package/sdk/dist/node/assets-node.js.map +1 -1
- package/sdk/dist/node/{bearer-claim-key.d.ts → bearer-redeem-key.d.ts} +12 -12
- package/sdk/dist/node/bearer-redeem-key.d.ts.map +1 -0
- package/sdk/dist/node/{bearer-claim-key.js → bearer-redeem-key.js} +21 -21
- package/sdk/dist/node/bearer-redeem-key.js.map +1 -0
- package/sdk/dist/node/ci.d.ts +1 -1
- package/sdk/dist/node/ci.d.ts.map +1 -1
- package/sdk/dist/node/ci.js +6 -6
- package/sdk/dist/node/ci.js.map +1 -1
- package/sdk/dist/node/credentials.d.ts +18 -17
- package/sdk/dist/node/credentials.d.ts.map +1 -1
- package/sdk/dist/node/credentials.js +29 -28
- package/sdk/dist/node/credentials.js.map +1 -1
- package/sdk/dist/node/deploy-manifest.d.ts +3 -5
- package/sdk/dist/node/deploy-manifest.d.ts.map +1 -1
- package/sdk/dist/node/deploy-manifest.js +3 -12
- package/sdk/dist/node/deploy-manifest.js.map +1 -1
- package/sdk/dist/node/funding-recovery.d.ts +1 -1
- package/sdk/dist/node/funding-recovery.d.ts.map +1 -1
- package/sdk/dist/node/funding-recovery.js +1 -1
- package/sdk/dist/node/funding-recovery.js.map +1 -1
- package/sdk/dist/node/gitvault-apply.d.ts +1 -1
- package/sdk/dist/node/gitvault-apply.d.ts.map +1 -1
- package/sdk/dist/node/gitvault-apply.js +1 -1
- package/sdk/dist/node/gitvault-apply.js.map +1 -1
- package/sdk/dist/node/gitvault-handoff.d.ts +22 -22
- package/sdk/dist/node/gitvault-handoff.d.ts.map +1 -1
- package/sdk/dist/node/gitvault-handoff.js +45 -45
- package/sdk/dist/node/gitvault-handoff.js.map +1 -1
- package/sdk/dist/node/gitvault-prewarm.js +7 -7
- package/sdk/dist/node/gitvault-prewarm.js.map +1 -1
- package/sdk/dist/node/gitvault-restore.d.ts +1 -1
- package/sdk/dist/node/gitvault-restore.js +1 -1
- package/sdk/dist/node/index.d.ts +16 -16
- package/sdk/dist/node/index.d.ts.map +1 -1
- package/sdk/dist/node/index.js +15 -15
- package/sdk/dist/node/index.js.map +1 -1
- package/sdk/dist/node/manifest-export.js +2 -2
- package/sdk/dist/node/manifest-export.js.map +1 -1
- package/sdk/dist/node/org-adopt.d.ts +49 -0
- package/sdk/dist/node/org-adopt.d.ts.map +1 -0
- package/sdk/dist/node/org-adopt.js +77 -0
- package/sdk/dist/node/org-adopt.js.map +1 -0
- package/sdk/dist/node/paid-fetch.d.ts +7 -7
- package/sdk/dist/node/paid-fetch.d.ts.map +1 -1
- package/sdk/dist/node/paid-fetch.js +54 -54
- package/sdk/dist/node/paid-fetch.js.map +1 -1
- package/sdk/dist/node/preflight.d.ts +1 -1
- package/sdk/dist/node/preflight.d.ts.map +1 -1
- package/sdk/dist/node/preflight.js +1 -1
- package/sdk/dist/node/preflight.js.map +1 -1
- package/sdk/dist/node/sites-node.js +1 -1
- package/sdk/dist/node/sites-node.js.map +1 -1
- package/sdk/dist/node/source-scan.d.ts +1 -1
- package/sdk/dist/node/source-scan.js +2 -2
- package/sdk/dist/node/source-scan.js.map +1 -1
- package/sdk/dist/scoped.d.ts +11 -11
- package/sdk/dist/scoped.d.ts.map +1 -1
- package/sdk/dist/scoped.js +5 -5
- package/sdk/dist/scoped.js.map +1 -1
- package/core-dist/operator-session.js +0 -154
- package/lib/allowance.mjs +0 -355
- package/lib/cloud.mjs +0 -256
- package/lib/core.mjs +0 -123
- package/lib/operator-proofs.mjs +0 -22
- package/lib/operator.mjs +0 -771
- package/sdk/core-dist/operator-session.js +0 -154
- package/sdk/dist/namespaces/allowance.d.ts +0 -79
- package/sdk/dist/namespaces/allowance.d.ts.map +0 -1
- package/sdk/dist/namespaces/allowance.js +0 -149
- package/sdk/dist/namespaces/allowance.js.map +0 -1
- package/sdk/dist/namespaces/operator-session.d.ts.map +0 -1
- package/sdk/dist/namespaces/operator-session.js.map +0 -1
- package/sdk/dist/namespaces/operator.d.ts +0 -359
- package/sdk/dist/namespaces/operator.d.ts.map +0 -1
- package/sdk/dist/namespaces/operator.js +0 -272
- package/sdk/dist/namespaces/operator.js.map +0 -1
- package/sdk/dist/node/bearer-claim-key.d.ts.map +0 -1
- package/sdk/dist/node/bearer-claim-key.js.map +0 -1
- package/sdk/dist/node/operator-claim.d.ts +0 -49
- package/sdk/dist/node/operator-claim.d.ts.map +0 -1
- package/sdk/dist/node/operator-claim.js +0 -77
- package/sdk/dist/node/operator-claim.js.map +0 -1
package/lib/subdomains.mjs
CHANGED
|
@@ -9,16 +9,16 @@ Usage:
|
|
|
9
9
|
run402 subdomains <subcommand> [args...]
|
|
10
10
|
|
|
11
11
|
Subcommands:
|
|
12
|
-
|
|
13
|
-
delete <name> --confirm [--project <
|
|
14
|
-
list [--project <
|
|
12
|
+
add <name> [--project <project_id>] [--release <release_id> | --deployment <deployment_id>] Add a subdomain
|
|
13
|
+
delete <name> --confirm [--project <project_id>] Release a subdomain. Requires --confirm.
|
|
14
|
+
list [--project <project_id>] List subdomains for a project
|
|
15
15
|
|
|
16
16
|
Options default to the active project. With neither --release nor
|
|
17
|
-
--deployment,
|
|
17
|
+
--deployment, add binds the project's live release.
|
|
18
18
|
|
|
19
19
|
Examples:
|
|
20
|
-
run402 subdomains
|
|
21
|
-
run402 subdomains
|
|
20
|
+
run402 subdomains add myapp
|
|
21
|
+
run402 subdomains add myapp --release rel_abc123 --project prj_abc123
|
|
22
22
|
run402 subdomains delete myapp --confirm
|
|
23
23
|
run402 subdomains list
|
|
24
24
|
|
|
@@ -29,20 +29,20 @@ Notes:
|
|
|
29
29
|
`;
|
|
30
30
|
|
|
31
31
|
const SUB_HELP = {
|
|
32
|
-
|
|
32
|
+
add: `run402 subdomains add — Add a subdomain for a release
|
|
33
33
|
|
|
34
34
|
Usage:
|
|
35
|
-
run402 subdomains
|
|
35
|
+
run402 subdomains add <name> [--project <project_id>] [--release <release_id> | --deployment <deployment_id>]
|
|
36
36
|
|
|
37
37
|
Arguments:
|
|
38
38
|
<name> Subdomain name (3-63 chars, lowercase alphanumeric +
|
|
39
39
|
hyphens). Creates <name>.run402.com.
|
|
40
40
|
|
|
41
41
|
Options:
|
|
42
|
-
--project <
|
|
43
|
-
--release <
|
|
42
|
+
--project <project_id> Project ID (defaults to the active project)
|
|
43
|
+
--release <release_id> Release ID (rel_...) to point at. With neither flag,
|
|
44
44
|
the project's live release is bound.
|
|
45
|
-
--deployment <
|
|
45
|
+
--deployment <deployment_id> Legacy deployment ID (dpl_...); rel_.../op_... ids are
|
|
46
46
|
accepted too.
|
|
47
47
|
|
|
48
48
|
Notes:
|
|
@@ -51,33 +51,33 @@ Notes:
|
|
|
51
51
|
- A deploy manifest can declare the same thing: "subdomains": { "set": ["<name>"] }
|
|
52
52
|
|
|
53
53
|
Examples:
|
|
54
|
-
run402 subdomains
|
|
55
|
-
run402 subdomains
|
|
54
|
+
run402 subdomains add myapp
|
|
55
|
+
run402 subdomains add myapp --release rel_abc123 --project prj_abc123
|
|
56
56
|
`,
|
|
57
|
-
list: `run402 subdomains list — List
|
|
57
|
+
list: `run402 subdomains list — List a project's subdomains
|
|
58
58
|
|
|
59
59
|
Usage:
|
|
60
|
-
run402 subdomains list [--project <
|
|
60
|
+
run402 subdomains list [--project <project_id>]
|
|
61
61
|
|
|
62
62
|
Options:
|
|
63
|
-
--project <
|
|
63
|
+
--project <project_id> Project ID (defaults to the active project)
|
|
64
64
|
|
|
65
65
|
Examples:
|
|
66
66
|
run402 subdomains list
|
|
67
67
|
run402 subdomains list --project prj_abc123
|
|
68
68
|
`,
|
|
69
|
-
delete: `run402 subdomains delete — Release a
|
|
69
|
+
delete: `run402 subdomains delete — Release a subdomain
|
|
70
70
|
|
|
71
71
|
Usage:
|
|
72
|
-
run402 subdomains delete <name> --confirm [--project <
|
|
72
|
+
run402 subdomains delete <name> --confirm [--project <project_id>]
|
|
73
73
|
|
|
74
74
|
Arguments:
|
|
75
75
|
<name> Subdomain name to release
|
|
76
76
|
|
|
77
77
|
Options:
|
|
78
78
|
--confirm Required: releasing a subdomain is irreversible and
|
|
79
|
-
makes it available for any other project to
|
|
80
|
-
--project <
|
|
79
|
+
makes it available for any other project to add
|
|
80
|
+
--project <project_id> Project ID (defaults to the active project)
|
|
81
81
|
|
|
82
82
|
Examples:
|
|
83
83
|
run402 subdomains delete myapp --confirm
|
|
@@ -85,7 +85,7 @@ Examples:
|
|
|
85
85
|
`,
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
-
async function
|
|
88
|
+
async function add(args) {
|
|
89
89
|
const parsedArgs = normalizeArgv(args);
|
|
90
90
|
const valueFlags = ["--project", "--deployment", "--release"];
|
|
91
91
|
assertKnownFlags(parsedArgs, [...valueFlags, "--help", "-h"], valueFlags);
|
|
@@ -99,8 +99,8 @@ async function claim(args) {
|
|
|
99
99
|
if (positionals.length > 1) {
|
|
100
100
|
fail({
|
|
101
101
|
code: "BAD_USAGE",
|
|
102
|
-
message: `Unexpected argument for subdomains
|
|
103
|
-
hint: "Use `run402 subdomains
|
|
102
|
+
message: `Unexpected argument for subdomains add: ${positionals[1]}`,
|
|
103
|
+
hint: "Use `run402 subdomains add <name> [--release <rel_id>]`.",
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
if (positionals.length === 1) {
|
|
@@ -110,14 +110,14 @@ async function claim(args) {
|
|
|
110
110
|
fail({
|
|
111
111
|
code: "BAD_USAGE",
|
|
112
112
|
message: "Missing <name>.",
|
|
113
|
-
hint: "run402 subdomains
|
|
113
|
+
hint: "run402 subdomains add <name> [--project <project_id>] [--release <release_id> | --deployment <deployment_id>]",
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
if (opts.deployment && opts.release) {
|
|
117
117
|
fail({
|
|
118
118
|
code: "BAD_USAGE",
|
|
119
119
|
message: "Pass either --release or --deployment, not both.",
|
|
120
|
-
hint: "run402 subdomains
|
|
120
|
+
hint: "run402 subdomains add <name> [--release <release_id> | --deployment <deployment_id>]",
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
const projectId = resolveProjectId(opts.project);
|
|
@@ -129,7 +129,7 @@ async function claim(args) {
|
|
|
129
129
|
const deploymentId = opts.deployment || (opts.release ? undefined : p.last_deployment_id) || undefined;
|
|
130
130
|
const releaseId = opts.release || undefined;
|
|
131
131
|
try {
|
|
132
|
-
const data = await getSdk().subdomains.
|
|
132
|
+
const data = await getSdk().subdomains.add({ name, deploymentId, releaseId, projectId });
|
|
133
133
|
console.log(JSON.stringify(data, null, 2));
|
|
134
134
|
} catch (err) {
|
|
135
135
|
reportSdkError(err);
|
|
@@ -147,7 +147,7 @@ async function deleteSubdomain(allArgs) {
|
|
|
147
147
|
fail({
|
|
148
148
|
code: "BAD_USAGE",
|
|
149
149
|
message: "Missing <name>.",
|
|
150
|
-
hint: "run402 subdomains delete <name> --confirm [--project <
|
|
150
|
+
hint: "run402 subdomains delete <name> --confirm [--project <project_id>]",
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
153
|
if (positionals.length > 1) {
|
|
@@ -156,7 +156,7 @@ async function deleteSubdomain(allArgs) {
|
|
|
156
156
|
if (!argList.includes("--confirm")) {
|
|
157
157
|
fail({
|
|
158
158
|
code: "CONFIRMATION_REQUIRED",
|
|
159
|
-
message: `Destructive: releasing subdomain '${name}' makes it available for any other project to
|
|
159
|
+
message: `Destructive: releasing subdomain '${name}' makes it available for any other project to add. This is irreversible. Re-run with --confirm to proceed.`,
|
|
160
160
|
details: { name },
|
|
161
161
|
});
|
|
162
162
|
}
|
|
@@ -186,7 +186,7 @@ async function list(args) {
|
|
|
186
186
|
fail({
|
|
187
187
|
code: "BAD_USAGE",
|
|
188
188
|
message: `Unexpected argument for subdomains list: ${rest[0]}`,
|
|
189
|
-
hint: "Use `run402 subdomains list --project <
|
|
189
|
+
hint: "Use `run402 subdomains list --project <project_id>`.",
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
192
|
const projectId = resolveProjectId(project);
|
|
@@ -202,7 +202,7 @@ export async function run(sub, args) {
|
|
|
202
202
|
if (!sub || sub === '--help' || sub === '-h') { console.log(HELP); process.exit(0); }
|
|
203
203
|
if (Array.isArray(args) && (args.includes("--help") || args.includes("-h"))) { console.log(SUB_HELP[sub] || HELP); process.exit(0); }
|
|
204
204
|
switch (sub) {
|
|
205
|
-
case "
|
|
205
|
+
case "add": await add(args); break;
|
|
206
206
|
case "delete": await deleteSubdomain(args); break;
|
|
207
207
|
case "list": await list(args); break;
|
|
208
208
|
default:
|
package/lib/subscriptions.mjs
CHANGED
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
* successor, and the report must stop firing because the pipeline carries
|
|
15
15
|
* those events — never because the check was removed.
|
|
16
16
|
*
|
|
17
|
-
* HTTP paths unchanged (`/agent/v1/notifications/rules*`); the
|
|
17
|
+
* HTTP paths unchanged (`/agent/v1/notifications/rules*`); the SIWX auth
|
|
18
18
|
* headers are PATH-scoped and must keep naming the real route.
|
|
19
19
|
*/
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
20
|
+
import { walletAuthHeaders } from "./config.mjs";
|
|
21
|
+
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 {
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
const HELP = `run402 subscriptions — which events go where
|
|
36
36
|
|
|
37
37
|
Usage:
|
|
38
|
-
run402 subscriptions add --binding <binding_id> [--project <
|
|
38
|
+
run402 subscriptions add --binding <binding_id> [--project <project_id>] [--source app|platform] [--type a,b] [--class a,b]
|
|
39
39
|
run402 subscriptions list
|
|
40
40
|
run402 subscriptions rm <subscription_id>
|
|
41
41
|
|
|
@@ -68,7 +68,7 @@ function splitCsv(value) {
|
|
|
68
68
|
* alias for anyone who learned it from that help text. */
|
|
69
69
|
export const SUBSCRIPTIONS_ADD_VALUE_FLAGS = ["--binding", "--contact", "--project", "--source", "--type", "--class"];
|
|
70
70
|
export const SUBSCRIPTIONS_ADD_USAGE =
|
|
71
|
-
"run402 subscriptions add --binding <binding_id> [--project <
|
|
71
|
+
"run402 subscriptions add --binding <binding_id> [--project <project_id>] [--source app|platform] [--type a,b] [--class a,b]";
|
|
72
72
|
export { HELP as SUBSCRIPTIONS_HELP };
|
|
73
73
|
|
|
74
74
|
async function rulesAdd(args) {
|
|
@@ -96,16 +96,16 @@ async function rulesAdd(args) {
|
|
|
96
96
|
if (typeRaw !== null) input.eventTypes = splitCsv(typeRaw);
|
|
97
97
|
if (classRaw !== null) input.classes = splitCsv(classRaw);
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
walletAuthHeaders("/agent/v1/notifications/rules");
|
|
100
100
|
try {
|
|
101
|
-
console.log(JSON.stringify(await getSdk().admin.rules.create(input,
|
|
101
|
+
console.log(JSON.stringify(await getSdk().admin.rules.create(input, sessionProofs("/agent/v1/notifications/rules")), null, 2));
|
|
102
102
|
} catch (err) {
|
|
103
103
|
reportSdkError(err);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
async function rulesList() {
|
|
108
|
-
|
|
108
|
+
walletAuthHeaders("/agent/v1/notifications/rules");
|
|
109
109
|
try {
|
|
110
110
|
console.log(JSON.stringify(await getSdk().admin.rules.list(), null, 2));
|
|
111
111
|
} catch (err) {
|
|
@@ -122,9 +122,9 @@ async function rulesRm(args) {
|
|
|
122
122
|
command: "run402 notifications rules rm <rule_id>",
|
|
123
123
|
missing: "Missing <rule_id>.",
|
|
124
124
|
});
|
|
125
|
-
|
|
125
|
+
walletAuthHeaders("/agent/v1/notifications/rules");
|
|
126
126
|
try {
|
|
127
|
-
console.log(JSON.stringify(await getSdk().admin.rules.delete(ruleId,
|
|
127
|
+
console.log(JSON.stringify(await getSdk().admin.rules.delete(ruleId, sessionProofs("/agent/v1/notifications/rules")), null, 2));
|
|
128
128
|
} catch (err) {
|
|
129
129
|
reportSdkError(err);
|
|
130
130
|
}
|
package/lib/tier.mjs
CHANGED
|
@@ -3,30 +3,33 @@ import { reportSdkError, fail } from "./sdk-errors.mjs";
|
|
|
3
3
|
import { assertKnownFlags, normalizeArgv, positionalArgs, flagValue, failUnknownSubcommand } from "./argparse.mjs";
|
|
4
4
|
import { setTierAction } from "./next-actions.mjs";
|
|
5
5
|
|
|
6
|
-
const HELP = `run402 tier — Manage your Run402 tier
|
|
6
|
+
const HELP = `run402 tier — Manage your Run402 tier and its lease
|
|
7
7
|
|
|
8
8
|
Usage:
|
|
9
9
|
run402 tier <subcommand> [args...]
|
|
10
10
|
|
|
11
11
|
Subcommands:
|
|
12
12
|
status Show current tier, expiry, pool usage, and function caps when returned
|
|
13
|
-
set <tier>
|
|
13
|
+
set <tier> Start, renew, or upgrade the lease (the allowance first, else x402/MPP)
|
|
14
14
|
|
|
15
|
-
Tiers: prototype ($0.10
|
|
15
|
+
Tiers: prototype ($0.10 once, the free tier: no lease, never expires; covered by the testnet faucet), hobby ($5/30d), team ($20/30d)
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
challenge and no USDC in the wallet, and the receipt says paid_with: "
|
|
20
|
-
Only
|
|
17
|
+
The organization's allowance pays first. A promo code (run402 redeem <code>)
|
|
18
|
+
or a top-up adds to the allowance; 'tier set' settles from it with no payment
|
|
19
|
+
challenge and no USDC in the wallet, and the receipt says paid_with: "allowance".
|
|
20
|
+
Only an allowance that falls short goes to x402 / MPP, and that error names the
|
|
21
21
|
exact shortfall a voucher or top-up would cover.
|
|
22
22
|
|
|
23
|
-
Tier is per organization.
|
|
24
|
-
|
|
23
|
+
Tier is per organization. One tier covers every project on the account;
|
|
24
|
+
api_calls and storage_bytes are pooled across all of them. Hobby and team
|
|
25
|
+
are prepaid 30-day leases that end unless renewed; nothing charges again on
|
|
26
|
+
its own.
|
|
25
27
|
|
|
26
|
-
The server auto-detects the action
|
|
27
|
-
|
|
28
|
+
The server auto-detects the action from the current tier state and reports
|
|
29
|
+
it as action: start | renew | upgrade:
|
|
30
|
+
- No tier or expired → start
|
|
28
31
|
- Same tier, active → renew (extends from expiry)
|
|
29
|
-
- Higher tier → upgrade (prorated refund to allowance)
|
|
32
|
+
- Higher tier → upgrade (prorated refund to the allowance)
|
|
30
33
|
- Lower tier, active → rejected (wait for expiry)
|
|
31
34
|
|
|
32
35
|
Examples:
|
|
@@ -36,7 +39,7 @@ Examples:
|
|
|
36
39
|
`;
|
|
37
40
|
|
|
38
41
|
const SUB_HELP = {
|
|
39
|
-
status: `run402 tier status — Show current tier
|
|
42
|
+
status: `run402 tier status — Show current tier and lease state
|
|
40
43
|
|
|
41
44
|
Usage:
|
|
42
45
|
run402 tier status
|
|
@@ -49,12 +52,12 @@ Notes:
|
|
|
49
52
|
- Newer gateways include function authoring caps such as max timeout,
|
|
50
53
|
max memory, max scheduled functions, minimum cron interval, and current
|
|
51
54
|
scheduled-function usage
|
|
52
|
-
- Use 'run402 tier set <tier>' to
|
|
55
|
+
- Use 'run402 tier set <tier>' to start, renew, or upgrade the lease
|
|
53
56
|
|
|
54
57
|
Examples:
|
|
55
58
|
run402 tier status
|
|
56
59
|
`,
|
|
57
|
-
set: `run402 tier set —
|
|
60
|
+
set: `run402 tier set — Set your tier: start, renew, or upgrade the lease
|
|
58
61
|
|
|
59
62
|
Usage:
|
|
60
63
|
run402 tier set <tier> [--idempotency-key <key>]
|
|
@@ -63,23 +66,27 @@ Arguments:
|
|
|
63
66
|
<tier> One of: prototype, hobby, team
|
|
64
67
|
|
|
65
68
|
Options:
|
|
66
|
-
--idempotency-key <key> Retry-safe key: re-running the same
|
|
69
|
+
--idempotency-key <key> Retry-safe key: re-running the same start/renew
|
|
67
70
|
intent with this key does not double-charge. Use a
|
|
68
71
|
fresh key for a deliberate second renewal.
|
|
69
72
|
|
|
70
73
|
Tiers:
|
|
71
|
-
prototype $0.10,
|
|
74
|
+
prototype $0.10 once, the free tier: no lease, never expires
|
|
75
|
+
(covered by the testnet faucet)
|
|
72
76
|
hobby $5/30d
|
|
73
77
|
team $20/30d
|
|
74
78
|
|
|
75
79
|
Notes:
|
|
76
|
-
Tier is per organization, not per project. A successful
|
|
80
|
+
Tier is per organization, not per project. A successful start,
|
|
77
81
|
renew, or upgrade applies immediately to every project on the account.
|
|
82
|
+
Hobby and team are prepaid 30-day leases that end unless renewed;
|
|
83
|
+
nothing charges again on its own.
|
|
78
84
|
|
|
79
|
-
Server auto-detects action
|
|
80
|
-
|
|
85
|
+
Server auto-detects the action from the current tier state and reports
|
|
86
|
+
it as action: start | renew | upgrade:
|
|
87
|
+
- No tier or expired -> start
|
|
81
88
|
- Same tier, active -> renew (extends from expiry)
|
|
82
|
-
- Higher tier -> upgrade (prorated refund to allowance)
|
|
89
|
+
- Higher tier -> upgrade (prorated refund to the allowance)
|
|
83
90
|
- Lower tier, active -> rejected (wait for expiry)
|
|
84
91
|
Pays via x402 micropayments.
|
|
85
92
|
|
|
@@ -131,7 +138,7 @@ async function set(args = []) {
|
|
|
131
138
|
next_actions: [setTierAction()],
|
|
132
139
|
});
|
|
133
140
|
}
|
|
134
|
-
// Caller-supplied idempotency key makes a retried
|
|
141
|
+
// Caller-supplied idempotency key makes a retried start/renew safe from
|
|
135
142
|
// double-charge. Not auto-derived: the SDK cannot tell a retry from a new
|
|
136
143
|
// renewal intent (that boundary is the caller's).
|
|
137
144
|
const idempotencyKey = flagValue(parsedArgs, "--idempotency-key") ?? undefined;
|
package/lib/transfer.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { walletAuthHeaders, resolveProjectId } from "./config.mjs";
|
|
2
2
|
import { getSdk } from "./sdk.mjs";
|
|
3
3
|
import { reportSdkError, fail } from "./sdk-errors.mjs";
|
|
4
4
|
import {
|
|
@@ -14,21 +14,21 @@ import {
|
|
|
14
14
|
const HELP = `run402 transfer — Project transfer, one noun for wallet, email, and owned-org recipients
|
|
15
15
|
|
|
16
16
|
Usage:
|
|
17
|
-
run402 transfer init (--to <wallet|email> | --to-org <org_id>) [--project <
|
|
17
|
+
run402 transfer init (--to <wallet|email> | --to-org <org_id>) [--project <project_id>] [--billing-policy migrate] [--message <text>] [--kysigned <record_id>] [--retain-member developer]
|
|
18
18
|
run402 transfer preview <transfer_id>
|
|
19
19
|
run402 transfer list [--incoming | --outgoing] [--limit N] [--after <cursor>]
|
|
20
|
-
run402 transfer accept <transfer_id>
|
|
21
|
-
run402 transfer claim <transfer_id> [--into <org_id>] [--accept-retained-collaborator]
|
|
20
|
+
run402 transfer accept <transfer_id> [--org <org_id>] [--accept-retained-member]
|
|
22
21
|
run402 transfer cancel <transfer_id> [--reason <text>]
|
|
23
22
|
|
|
24
23
|
Subcommands:
|
|
25
|
-
init Initiate ownership change. --to <wallet> = two-party wallet transfer
|
|
26
|
-
|
|
24
|
+
init Initiate ownership change. --to <wallet> = two-party wallet transfer;
|
|
25
|
+
--to <email> = email-addressed transfer; both are completed by 'accept'.
|
|
27
26
|
--to-org <org_id> = same-actor move to an owned org (completes immediately).
|
|
28
27
|
preview Fetch the safe review document (pending transfer — kind-agnostic)
|
|
29
28
|
list List pending transfers (incoming default, or --outgoing) — pending rows unioned
|
|
30
|
-
accept Accept an incoming
|
|
31
|
-
|
|
29
|
+
accept Accept an incoming transfer, whatever its address (wallet: your wallet must be
|
|
30
|
+
the to_wallet; email: your verified email must match; --org <org_id> picks the
|
|
31
|
+
receiving org, omit = new org)
|
|
32
32
|
cancel Cancel a pending transfer of any kind
|
|
33
33
|
|
|
34
34
|
Notes:
|
|
@@ -44,24 +44,24 @@ const SUB_HELP = {
|
|
|
44
44
|
init: `run402 transfer init — Initiate a project transfer
|
|
45
45
|
|
|
46
46
|
Usage:
|
|
47
|
-
run402 transfer init (--to <wallet|email> | --to-org <org_id>) [--project <
|
|
47
|
+
run402 transfer init (--to <wallet|email> | --to-org <org_id>) [--project <project_id>] [--billing-policy migrate] [--message <text>] [--kysigned <record_id>] [--retain-member developer]
|
|
48
48
|
|
|
49
49
|
Options:
|
|
50
|
-
--project <
|
|
51
|
-
--to <wallet|email> Recipient (required). A wallet
|
|
52
|
-
|
|
50
|
+
--project <project_id> Project id (defaults to the active project)
|
|
51
|
+
--to <wallet|email> Recipient (required). A wallet is accepted by that wallet's signature;
|
|
52
|
+
an email is accepted by a principal whose verified email matches.
|
|
53
53
|
--to-org <org_id> Destination org you already own. Same-actor only in the first gateway
|
|
54
54
|
release; completes immediately and returns project keys.
|
|
55
55
|
--billing-policy <p> Billing policy (wallet rail). Phase 1A only allows 'migrate' (default).
|
|
56
56
|
--message <text> Optional note shown to the recipient in preview + emails.
|
|
57
57
|
--kysigned <record_id> Optional KySigned record id (wallet rail; Phase 1A: informational only).
|
|
58
|
-
--retain-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
--retain-member <role> Email recipients only: keep a 'developer' membership in the
|
|
59
|
+
recipient's org after the transfer. The recipient must accept it at
|
|
60
|
+
accept (--accept-retained-member); omit for full severance.
|
|
61
61
|
|
|
62
62
|
Notes:
|
|
63
63
|
- Caller's wallet/session must currently own or admin the project (gateway re-checks fresh DB).
|
|
64
|
-
- Owner-side mutations on the project are frozen until accept/
|
|
64
|
+
- Owner-side mutations on the project are frozen until accept/cancel/expiry.
|
|
65
65
|
Owned-org moves complete immediately and do not create a pending window.
|
|
66
66
|
- The project lease stays with your organization; it is NOT refunded.
|
|
67
67
|
`,
|
|
@@ -88,16 +88,23 @@ Options:
|
|
|
88
88
|
--limit N Page size (default 50).
|
|
89
89
|
--after <cursor> Opaque keyset cursor (next_cursor from a prior page).
|
|
90
90
|
`,
|
|
91
|
-
accept: `run402 transfer accept — Accept an incoming
|
|
91
|
+
accept: `run402 transfer accept — Accept an incoming transfer, whatever its address
|
|
92
92
|
|
|
93
93
|
Usage:
|
|
94
|
-
run402 transfer accept <transfer_id>
|
|
94
|
+
run402 transfer accept <transfer_id> [--org <org_id>] [--accept-retained-member]
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
The one completion. A wallet-addressed transfer is accepted by the to_wallet's
|
|
97
|
+
signature; an email-addressed transfer by a principal whose verified email
|
|
98
|
+
matches, into an org you own (--org) or, omitted, a brand-new org. Either way
|
|
99
|
+
the accept transaction atomically: flips ownership, revokes the previous
|
|
100
|
+
owner's CI bindings on the project, enqueues notifications to both parties,
|
|
101
|
+
stamps a 'secrets_rotation_advised' advisory on the project, and returns the
|
|
102
|
+
project keys (saved to your keystore).
|
|
103
|
+
|
|
104
|
+
Options:
|
|
105
|
+
--org <org_id> Email-addressed only: the org to receive the project (omit = new org).
|
|
106
|
+
--accept-retained-member Email-addressed only: accept the sender's retained-developer-membership
|
|
107
|
+
offer (see 'transfer preview' retain_member). Omit = full severance.
|
|
101
108
|
`,
|
|
102
109
|
cancel: `run402 transfer cancel — Cancel a pending transfer
|
|
103
110
|
|
|
@@ -108,19 +115,6 @@ Cancels a pending transfer of any kind. You must be authorized for the row's
|
|
|
108
115
|
kind (a wallet signing party, or an owner/admin of the offering org / the
|
|
109
116
|
addressed-email principal). Already-processed transfers return 409
|
|
110
117
|
TRANSFER_ALREADY_PROCESSED.
|
|
111
|
-
`,
|
|
112
|
-
claim: `run402 transfer claim — Claim an incoming EMAIL transfer
|
|
113
|
-
|
|
114
|
-
Usage:
|
|
115
|
-
run402 transfer claim <transfer_id> [--into <org_id>] [--accept-retained-collaborator]
|
|
116
|
-
|
|
117
|
-
Claims an email-addressed transfer into an org you own. Omit --into to claim into
|
|
118
|
-
a brand-new org. This is the email analog of 'accept'.
|
|
119
|
-
|
|
120
|
-
Options:
|
|
121
|
-
--into <org_id> Org to claim into (omit = brand-new org).
|
|
122
|
-
--accept-retained-collaborator Accept the sender's v1.91 retained-developer-membership offer
|
|
123
|
-
(see 'transfer preview' retain_collaborator). Omit = full severance.
|
|
124
118
|
`,
|
|
125
119
|
};
|
|
126
120
|
|
|
@@ -129,7 +123,7 @@ const RETAIN_ROLES = new Set(["developer"]);
|
|
|
129
123
|
|
|
130
124
|
async function init(args) {
|
|
131
125
|
const parsedArgs = normalizeArgv(args);
|
|
132
|
-
const valueFlags = ["--project", "--to", "--to-org", "--billing-policy", "--message", "--kysigned", "--retain-
|
|
126
|
+
const valueFlags = ["--project", "--to", "--to-org", "--billing-policy", "--message", "--kysigned", "--retain-member"];
|
|
133
127
|
assertKnownFlags(parsedArgs, [...valueFlags, "--help", "-h"], valueFlags);
|
|
134
128
|
const extra = positionalArgs(parsedArgs, valueFlags);
|
|
135
129
|
if (extra.length > 0) {
|
|
@@ -146,7 +140,7 @@ async function init(args) {
|
|
|
146
140
|
const projectFlag = flagValue(parsedArgs, "--project");
|
|
147
141
|
const projectId = await resolveProjectId(projectFlag);
|
|
148
142
|
if (!projectId) {
|
|
149
|
-
fail({ code: "NO_PROJECT", message: "No project id. Pass --project <
|
|
143
|
+
fail({ code: "NO_PROJECT", message: "No project id. Pass --project <project_id> or set an active project with 'run402 projects use <project_id>'." });
|
|
150
144
|
}
|
|
151
145
|
const billingPolicy = flagValue(parsedArgs, "--billing-policy");
|
|
152
146
|
if (billingPolicy !== null && !BILLING_POLICIES.has(billingPolicy)) {
|
|
@@ -158,27 +152,27 @@ async function init(args) {
|
|
|
158
152
|
}
|
|
159
153
|
const message = flagValue(parsedArgs, "--message");
|
|
160
154
|
const kysigned = flagValue(parsedArgs, "--kysigned");
|
|
161
|
-
const
|
|
155
|
+
const retainMember = flagValue(parsedArgs, "--retain-member");
|
|
162
156
|
|
|
163
157
|
// One noun, three recipient shapes. --to keeps wallet/email auto-detection;
|
|
164
158
|
// --to-org is explicit because org ids are not human-recipient addresses.
|
|
165
159
|
const recipientKind = toOrg ? "org" : (to.includes("@") ? "email" : "wallet");
|
|
166
160
|
|
|
167
|
-
// --retain-
|
|
168
|
-
//
|
|
169
|
-
if (
|
|
161
|
+
// --retain-member is an email-only opt-in: the sender keeps a developer
|
|
162
|
+
// membership in the recipient's org (the recipient must accept it at accept).
|
|
163
|
+
if (retainMember !== null) {
|
|
170
164
|
if (recipientKind !== "email") {
|
|
171
165
|
fail({
|
|
172
166
|
code: "BAD_FLAG",
|
|
173
|
-
message: "--retain-
|
|
174
|
-
details: { flag: "--retain-
|
|
167
|
+
message: "--retain-member applies only to email recipients.",
|
|
168
|
+
details: { flag: "--retain-member" },
|
|
175
169
|
});
|
|
176
170
|
}
|
|
177
|
-
if (!RETAIN_ROLES.has(
|
|
171
|
+
if (!RETAIN_ROLES.has(retainMember)) {
|
|
178
172
|
fail({
|
|
179
173
|
code: "BAD_FLAG",
|
|
180
|
-
message: `Unsupported --retain-
|
|
181
|
-
details: { flag: "--retain-
|
|
174
|
+
message: `Unsupported --retain-member role: ${retainMember}. Allowed: ${[...RETAIN_ROLES].join(", ")}.`,
|
|
175
|
+
details: { flag: "--retain-member", value: retainMember, allowed: [...RETAIN_ROLES] },
|
|
182
176
|
});
|
|
183
177
|
}
|
|
184
178
|
}
|
|
@@ -198,7 +192,7 @@ async function init(args) {
|
|
|
198
192
|
}
|
|
199
193
|
|
|
200
194
|
// All recipient shapes initiate on the unified transfer endpoint — sign that path.
|
|
201
|
-
|
|
195
|
+
walletAuthHeaders(`/projects/v1/${projectId}/transfers`);
|
|
202
196
|
|
|
203
197
|
try {
|
|
204
198
|
let res;
|
|
@@ -213,7 +207,7 @@ async function init(args) {
|
|
|
213
207
|
projectId,
|
|
214
208
|
toEmail: to,
|
|
215
209
|
message: message ?? undefined,
|
|
216
|
-
|
|
210
|
+
retainMember: retainMember ? { role: retainMember } : undefined,
|
|
217
211
|
});
|
|
218
212
|
} else {
|
|
219
213
|
res = await getSdk().admin.transfers.initiate({
|
|
@@ -239,7 +233,7 @@ async function preview(args) {
|
|
|
239
233
|
}
|
|
240
234
|
const transferId = positionals[0];
|
|
241
235
|
// Preview is kind-agnostic — one route serves wallet, email, and future org transfers.
|
|
242
|
-
|
|
236
|
+
walletAuthHeaders(`/agent/v1/transfers/${transferId}`);
|
|
243
237
|
|
|
244
238
|
try {
|
|
245
239
|
const data = await getSdk().admin.transfers.preview(transferId);
|
|
@@ -274,7 +268,7 @@ async function list(args) {
|
|
|
274
268
|
|
|
275
269
|
// Incoming/outgoing are kind-agnostic — each returns the union of pending
|
|
276
270
|
// wallet/email/future-org rows, tagged with recipient_kind.
|
|
277
|
-
|
|
271
|
+
walletAuthHeaders(`/agent/v1/transfers/${direction}`);
|
|
278
272
|
|
|
279
273
|
try {
|
|
280
274
|
const result =
|
|
@@ -300,16 +294,24 @@ async function list(args) {
|
|
|
300
294
|
|
|
301
295
|
async function accept(args) {
|
|
302
296
|
const parsedArgs = normalizeArgv(args);
|
|
303
|
-
|
|
304
|
-
|
|
297
|
+
const valueFlags = ["--org"];
|
|
298
|
+
assertKnownFlags(parsedArgs, [...valueFlags, "--accept-retained-member", "--help", "-h"], valueFlags);
|
|
299
|
+
const positionals = positionalArgs(parsedArgs, valueFlags);
|
|
305
300
|
if (positionals.length !== 1) {
|
|
306
|
-
fail({ code: "BAD_USAGE", message: "Usage: run402 transfer accept <transfer_id>" });
|
|
301
|
+
fail({ code: "BAD_USAGE", message: "Usage: run402 transfer accept <transfer_id> [--org <org_id>] [--accept-retained-member]" });
|
|
307
302
|
}
|
|
308
303
|
const transferId = positionals[0];
|
|
309
|
-
|
|
304
|
+
const orgId = flagValue(parsedArgs, "--org");
|
|
305
|
+
// Email-addressed rows only: accept the sender's retained-developer-membership
|
|
306
|
+
// offer (see the preview's `retain_member` block). Absent = full severance.
|
|
307
|
+
const acceptRetain = parsedArgs.includes("--accept-retained-member");
|
|
308
|
+
walletAuthHeaders(`/agent/v1/transfers/${transferId}/accept`);
|
|
310
309
|
|
|
311
310
|
try {
|
|
312
|
-
const data = await getSdk().admin.transfers.accept(transferId
|
|
311
|
+
const data = await getSdk().admin.transfers.accept(transferId, {
|
|
312
|
+
orgId: orgId ?? undefined,
|
|
313
|
+
acceptRetainedMember: acceptRetain || undefined,
|
|
314
|
+
});
|
|
313
315
|
console.log(JSON.stringify(data, null, 2));
|
|
314
316
|
} catch (err) {
|
|
315
317
|
reportSdkError(err);
|
|
@@ -327,7 +329,7 @@ async function cancel(args) {
|
|
|
327
329
|
const transferId = positionals[0];
|
|
328
330
|
const reason = flagValue(parsedArgs, "--reason");
|
|
329
331
|
// Cancel is kind-agnostic — one route serves wallet and email transfers.
|
|
330
|
-
|
|
332
|
+
walletAuthHeaders(`/agent/v1/transfers/${transferId}/cancel`);
|
|
331
333
|
|
|
332
334
|
try {
|
|
333
335
|
const data = await getSdk().admin.transfers.cancel(transferId, { reason: reason ?? undefined });
|
|
@@ -337,32 +339,6 @@ async function cancel(args) {
|
|
|
337
339
|
}
|
|
338
340
|
}
|
|
339
341
|
|
|
340
|
-
async function claim(args) {
|
|
341
|
-
const parsedArgs = normalizeArgv(args);
|
|
342
|
-
const valueFlags = ["--into"];
|
|
343
|
-
assertKnownFlags(parsedArgs, [...valueFlags, "--accept-retained-collaborator", "--help", "-h"], valueFlags);
|
|
344
|
-
const positionals = positionalArgs(parsedArgs, valueFlags);
|
|
345
|
-
if (positionals.length !== 1) {
|
|
346
|
-
fail({ code: "BAD_USAGE", message: "Usage: run402 transfer claim <transfer_id> [--into <org_id>] [--accept-retained-collaborator]" });
|
|
347
|
-
}
|
|
348
|
-
const transferId = positionals[0];
|
|
349
|
-
const into = flagValue(parsedArgs, "--into");
|
|
350
|
-
// v1.91: accept the sender's retained-developer-membership offer (see the
|
|
351
|
-
// preview's `retain_collaborator` block). Absent = full severance (default).
|
|
352
|
-
const acceptRetain = parsedArgs.includes("--accept-retained-collaborator");
|
|
353
|
-
allowanceAuthHeaders(`/agent/v1/transfers/${transferId}/claim`);
|
|
354
|
-
|
|
355
|
-
try {
|
|
356
|
-
const data = await getSdk().admin.transfers.claim(transferId, {
|
|
357
|
-
organizationId: into ?? undefined,
|
|
358
|
-
acceptRetainedCollaborator: acceptRetain || undefined,
|
|
359
|
-
});
|
|
360
|
-
console.log(JSON.stringify(data, null, 2));
|
|
361
|
-
} catch (err) {
|
|
362
|
-
reportSdkError(err);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
|
|
366
342
|
export async function run(sub, args) {
|
|
367
343
|
if (!sub || sub === "--help" || sub === "-h") {
|
|
368
344
|
console.log(HELP);
|
|
@@ -385,9 +361,6 @@ export async function run(sub, args) {
|
|
|
385
361
|
case "accept":
|
|
386
362
|
await accept(args);
|
|
387
363
|
return;
|
|
388
|
-
case "claim":
|
|
389
|
-
await claim(args);
|
|
390
|
-
return;
|
|
391
364
|
case "cancel":
|
|
392
365
|
await cancel(args);
|
|
393
366
|
return;
|