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/pay.mjs
CHANGED
|
@@ -30,7 +30,7 @@ Examples:
|
|
|
30
30
|
run402 pay https://seller.example/translate --method POST \
|
|
31
31
|
--body '{"text":"hello"}' --max-usd 0.05 --idempotency-key translation:1
|
|
32
32
|
|
|
33
|
-
The command uses the same
|
|
33
|
+
The command uses the same wallet and bounded x402 buyer as the SDK.
|
|
34
34
|
An unpriced URL is passed through with payment: null.
|
|
35
35
|
On trusted Run402 PAYMENT_INTENT_PENDING, wait for Retry-After and repeat this
|
|
36
36
|
identical command with the same payer and --idempotency-key. Never change the key.
|
package/lib/projects.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from "fs";
|
|
2
|
-
import {
|
|
3
|
-
import { loadLiveOperatorSession } from "../core-dist/operator-session.js";
|
|
2
|
+
import { walletAuthHeaders, resolveProjectId, getActiveProjectId, isCoreApiTarget } from "./config.mjs";
|
|
4
3
|
import { loadLiveControlPlaneSession } from "../core-dist/control-plane-session.js";
|
|
5
|
-
import { withAutoApprove } from "./
|
|
4
|
+
import { withAutoApprove } from "./sign-in.mjs";
|
|
6
5
|
import { getSdk } from "./sdk.mjs";
|
|
7
6
|
import { reportSdkError, fail, parseFlagJson } from "./sdk-errors.mjs";
|
|
8
7
|
import { stampOrgFromProject } from "./org-context.mjs";
|
|
@@ -15,27 +14,26 @@ Usage:
|
|
|
15
14
|
|
|
16
15
|
Subcommands:
|
|
17
16
|
quote Show pricing tiers
|
|
18
|
-
provision [--tier <tier>] [--name <n>] [--org <
|
|
19
|
-
use <
|
|
20
|
-
list [--org <
|
|
21
|
-
rename <
|
|
17
|
+
provision [--tier <tier>] [--name <n>] [--org <org_id>] Provision a new Postgres project
|
|
18
|
+
use <project_id> Set the active project (used as default for other commands)
|
|
19
|
+
list [--org <org_id>] [--all] List your projects from the server (name, site_url, custom domains, org_id, active marker)
|
|
20
|
+
rename <project_id> --name <label> Rename a project (fix an auto-generated name)
|
|
22
21
|
tenant-payments [project_id] [--status <s>] List redacted tenant x402 payments for priced routes
|
|
23
|
-
get [
|
|
22
|
+
get [project_id] Authoritative server read: status, org, tier, active deploy, mailbox, usage vs limits (live; no keys)
|
|
24
23
|
current Show the active project pointer and validation status
|
|
25
|
-
sql "<query>" [--project <
|
|
26
|
-
rest <table> [--query "<params>"] [--project <
|
|
27
|
-
usage [
|
|
28
|
-
costs [
|
|
29
|
-
schema [
|
|
30
|
-
apply-expose [
|
|
31
|
-
apply-expose [
|
|
32
|
-
validate-expose [
|
|
33
|
-
validate-expose [
|
|
34
|
-
get-expose [
|
|
35
|
-
delete [
|
|
36
|
-
promote-user [
|
|
37
|
-
demote-user [
|
|
38
|
-
export [id] [archive options] Export a portable Run402 Core archive
|
|
24
|
+
sql "<query>" [--project <project_id>] [--file <path>] [--params '<json>'] Run a SQL query (supports parameterized queries)
|
|
25
|
+
rest <table> [--query "<params>"] [--project <project_id>] Query a table via the REST API (PostgREST)
|
|
26
|
+
usage [project_id] Show compute/storage usage for a project
|
|
27
|
+
costs [project_id] [--window <w>] Show admin-only per-project revenue/cost/margin
|
|
28
|
+
schema [project_id] Inspect the database schema
|
|
29
|
+
apply-expose [project_id] <manifest_json> Apply a declarative authorization manifest
|
|
30
|
+
apply-expose [project_id] --file <path> Apply a manifest from a JSON file
|
|
31
|
+
validate-expose [project_id] <manifest_json> Validate an authorization manifest without applying it
|
|
32
|
+
validate-expose [project_id] --file <path> Validate a manifest file without mutating the project
|
|
33
|
+
get-expose [project_id] Get the current authorization manifest
|
|
34
|
+
delete [project_id] --confirm Immediately and irreversibly delete a project (cascade purge) and remove from local state. Requires --confirm.
|
|
35
|
+
promote-user [project_id] <email> Promote a user to project_admin role
|
|
36
|
+
demote-user [project_id] <email> Demote a user from project_admin role
|
|
39
37
|
|
|
40
38
|
Examples:
|
|
41
39
|
run402 projects quote
|
|
@@ -60,7 +58,6 @@ Examples:
|
|
|
60
58
|
run402 projects apply-expose prj_abc123 --file manifest.json
|
|
61
59
|
run402 projects get-expose prj_abc123
|
|
62
60
|
run402 projects delete prj_abc123 --confirm
|
|
63
|
-
run402 projects export prj_abc123 --wait --output ./project.r402ar --json
|
|
64
61
|
|
|
65
62
|
Global options (any command):
|
|
66
63
|
--wallet <name> Use a named wallet (profile) for this command. Precedence:
|
|
@@ -68,23 +65,23 @@ Global options (any command):
|
|
|
68
65
|
'run402 wallets use' default > 'default'. See 'run402 wallets'.
|
|
69
66
|
|
|
70
67
|
Notes:
|
|
71
|
-
- <
|
|
72
|
-
- Most commands that take <
|
|
73
|
-
(set it with 'run402 projects use <
|
|
68
|
+
- <project_id> is the project_id shown in 'run402 projects list' (prefix: 'prj_')
|
|
69
|
+
- Most commands that take <project_id> default to the active project when omitted
|
|
70
|
+
(set it with 'run402 projects use <project_id>'). Project IDs start with 'prj_';
|
|
74
71
|
any first positional that doesn't is treated as the next argument instead.
|
|
75
72
|
- 'list', 'get', and 'use' are SERVER-authoritative project identity flows.
|
|
76
73
|
Local project keys live under 'run402 credentials project-keys ...'.
|
|
77
74
|
- 'list' is a SERVER read, not the local key cache: it shows every project the
|
|
78
75
|
active wallet can reach (membership-scoped), with name, site_url, custom
|
|
79
|
-
domains, and org_id. '--org <
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
76
|
+
domains, and org_id. '--org <org_id>' filters to one org; '--all' reads every
|
|
77
|
+
project you can reach across all your orgs (as your sign-in session after
|
|
78
|
+
'run402 login', else as the current wallet). The 'active' marker still
|
|
79
|
+
comes from local state.
|
|
83
80
|
- 'rename' fixes a project's display name. You must be an org admin (or hold a
|
|
84
81
|
project:write grant) on the owning org; it works even if the project was
|
|
85
82
|
never provisioned from this machine.
|
|
86
83
|
- 'rest' uses PostgREST query syntax (table name + optional query string)
|
|
87
|
-
- 'provision' requires a funded
|
|
84
|
+
- 'provision' requires a funded wallet on Run402 Cloud. Against a
|
|
88
85
|
configured Run402 Core target, it creates a local Core project without
|
|
89
86
|
payment.
|
|
90
87
|
- 'apply-expose' declares the full authorization surface (tables, views, RPCs)
|
|
@@ -109,17 +106,16 @@ const SUB_HELP = {
|
|
|
109
106
|
list: `run402 projects list — List your projects from the server
|
|
110
107
|
|
|
111
108
|
Usage:
|
|
112
|
-
run402 projects list [--org <
|
|
109
|
+
run402 projects list [--org <org_id>] [--all]
|
|
113
110
|
|
|
114
111
|
Options:
|
|
115
|
-
--org <
|
|
112
|
+
--org <org_id> Filter to projects owned by one org (organization).
|
|
116
113
|
Authorize-before-reveal: a non-member or guessed id is a
|
|
117
114
|
403; a non-UUID id is a 400.
|
|
118
|
-
--all Read
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
with --org.
|
|
115
|
+
--all Read every project you can reach across all your orgs
|
|
116
|
+
(GET /agent/v1/me/projects). After 'run402 login' it
|
|
117
|
+
reads as your sign-in session; without one, as the
|
|
118
|
+
current wallet. Mutually exclusive with --org.
|
|
123
119
|
|
|
124
120
|
Notes:
|
|
125
121
|
- This is a SERVER read (membership-scoped), not the local keystore. Each row
|
|
@@ -137,10 +133,10 @@ Examples:
|
|
|
137
133
|
rename: `run402 projects rename — Rename a project
|
|
138
134
|
|
|
139
135
|
Usage:
|
|
140
|
-
run402 projects rename <
|
|
136
|
+
run402 projects rename <project_id> --name <label>
|
|
141
137
|
|
|
142
138
|
Arguments:
|
|
143
|
-
<
|
|
139
|
+
<project_id> Project ID (prefix: 'prj_'). Required.
|
|
144
140
|
|
|
145
141
|
Options:
|
|
146
142
|
--name <label> New display name (1-200 chars, no control characters).
|
|
@@ -185,20 +181,20 @@ Notes:
|
|
|
185
181
|
provision: `run402 projects provision — Provision a new Postgres project
|
|
186
182
|
|
|
187
183
|
Usage:
|
|
188
|
-
run402 projects provision [--tier <tier>] [--name <name>] [--org <
|
|
184
|
+
run402 projects provision [--tier <tier>] [--name <name>] [--org <org_id>] [--idempotency-key <key>]
|
|
189
185
|
|
|
190
186
|
Options:
|
|
191
187
|
--tier <tier> Tier for the new project (default: prototype)
|
|
192
188
|
--name <name> Human-readable name for the project
|
|
193
|
-
--org <
|
|
189
|
+
--org <org_id> Provision into an EXISTING org (needs developer+ on it).
|
|
194
190
|
Omit for the cold-start path. Tier is org-governed.
|
|
195
191
|
--idempotency-key <key> Retry-safe key: re-running with the same key returns
|
|
196
192
|
the existing project instead of duplicating it. Auto-derived
|
|
197
193
|
from --name when omitted; an unnamed provision stays un-keyed.
|
|
198
194
|
|
|
199
195
|
Notes:
|
|
200
|
-
- Payment is automatic via x402 on Run402 Cloud; requires a funded
|
|
201
|
-
Against a configured Run402 Core target, no Cloud tier/
|
|
196
|
+
- Payment is automatic via x402 on Run402 Cloud; requires a funded wallet.
|
|
197
|
+
Against a configured Run402 Core target, no Cloud tier/wallet/payment is
|
|
202
198
|
required.
|
|
203
199
|
- The new project becomes the active project after provisioning
|
|
204
200
|
|
|
@@ -211,8 +207,8 @@ Examples:
|
|
|
211
207
|
sql: `run402 projects sql — Run a SQL query against a project's database
|
|
212
208
|
|
|
213
209
|
Usage:
|
|
214
|
-
run402 projects sql "<query>" [--project <
|
|
215
|
-
run402 projects sql --file <path> [--project <
|
|
210
|
+
run402 projects sql "<query>" [--project <project_id>] [options]
|
|
211
|
+
run402 projects sql --file <path> [--project <project_id>] [options]
|
|
216
212
|
|
|
217
213
|
Legacy (still supported):
|
|
218
214
|
run402 projects sql <prj_id> "<query>" [options]
|
|
@@ -221,7 +217,7 @@ Arguments:
|
|
|
221
217
|
<query> Inline SQL query (quote it to preserve spaces)
|
|
222
218
|
|
|
223
219
|
Options:
|
|
224
|
-
--project <
|
|
220
|
+
--project <project_id> Project ID (defaults to the active project; a leading
|
|
225
221
|
prj_... positional is also still accepted)
|
|
226
222
|
--file <path> Read SQL from a file instead of an inline query
|
|
227
223
|
--params '<json>' JSON array of parameters for a parameterized query
|
|
@@ -234,10 +230,10 @@ Examples:
|
|
|
234
230
|
costs: `run402 projects costs — Show admin-only per-project finance
|
|
235
231
|
|
|
236
232
|
Usage:
|
|
237
|
-
run402 projects costs [
|
|
233
|
+
run402 projects costs [project_id] [--window <24h|7d|30d|90d>]
|
|
238
234
|
|
|
239
235
|
Arguments:
|
|
240
|
-
[
|
|
236
|
+
[project_id] Project ID (defaults to the active project if omitted)
|
|
241
237
|
|
|
242
238
|
Options:
|
|
243
239
|
--window <w> Finance window (default: 30d). One of: 24h, 7d, 30d, 90d
|
|
@@ -246,7 +242,7 @@ Environment:
|
|
|
246
242
|
RUN402_ADMIN_COOKIE Optional admin OAuth cookie header, e.g. "run402_admin=..."
|
|
247
243
|
|
|
248
244
|
Notes:
|
|
249
|
-
- Platform-admin only. The configured
|
|
245
|
+
- Platform-admin only. The configured wallet must be an admin
|
|
250
246
|
wallet, or RUN402_ADMIN_COOKIE must contain an admin OAuth cookie.
|
|
251
247
|
- Project service keys are not enough for this endpoint.
|
|
252
248
|
- Output is the gateway's per-project finance JSON: revenue, direct cost,
|
|
@@ -260,12 +256,12 @@ Examples:
|
|
|
260
256
|
"validate-expose": `run402 projects validate-expose — Validate an authorization manifest without applying it
|
|
261
257
|
|
|
262
258
|
Usage:
|
|
263
|
-
run402 projects validate-expose [
|
|
264
|
-
run402 projects validate-expose [
|
|
265
|
-
cat manifest.json | run402 projects validate-expose [
|
|
259
|
+
run402 projects validate-expose [project_id] <manifest_json> [options]
|
|
260
|
+
run402 projects validate-expose [project_id] --file <path> [options]
|
|
261
|
+
cat manifest.json | run402 projects validate-expose [project_id] [options]
|
|
266
262
|
|
|
267
263
|
Arguments:
|
|
268
|
-
[
|
|
264
|
+
[project_id] Optional project ID. When omitted, the active project is
|
|
269
265
|
used if one is set; otherwise validation is projectless.
|
|
270
266
|
<manifest_json> Inline auth/expose manifest JSON.
|
|
271
267
|
|
|
@@ -330,7 +326,7 @@ async function provision(args) {
|
|
|
330
326
|
code: "BAD_USAGE",
|
|
331
327
|
message: "--org must not be empty.",
|
|
332
328
|
details: { field: "--org" },
|
|
333
|
-
hint: "Pass an org id (run402
|
|
329
|
+
hint: "Pass an org id (run402 orgs list), or omit --org for the cold-start path.",
|
|
334
330
|
});
|
|
335
331
|
}
|
|
336
332
|
// Validate --name when provided. Omitted --name lets the server pick a
|
|
@@ -361,10 +357,10 @@ async function provision(args) {
|
|
|
361
357
|
});
|
|
362
358
|
}
|
|
363
359
|
}
|
|
364
|
-
// Aggressive early exit when no
|
|
365
|
-
// there's also no
|
|
366
|
-
//
|
|
367
|
-
if (!isCoreApiTarget() && !loadLiveControlPlaneSession())
|
|
360
|
+
// Aggressive early exit when no local wallet is configured — but only when
|
|
361
|
+
// there's also no sign-in session, since a wallet-less person provisions
|
|
362
|
+
// into an org via a write approval instead of a wallet.
|
|
363
|
+
if (!isCoreApiTarget() && !loadLiveControlPlaneSession()) walletAuthHeaders("/projects/v1");
|
|
368
364
|
|
|
369
365
|
const activeBefore = getActiveProjectId();
|
|
370
366
|
try {
|
|
@@ -454,7 +450,7 @@ async function validateExpose(args = []) {
|
|
|
454
450
|
fail({
|
|
455
451
|
code: "BAD_USAGE",
|
|
456
452
|
message: `Unexpected extra argument: ${arg}`,
|
|
457
|
-
hint: "run402 projects validate-expose [
|
|
453
|
+
hint: "run402 projects validate-expose [project_id] <manifest_json>",
|
|
458
454
|
});
|
|
459
455
|
}
|
|
460
456
|
}
|
|
@@ -462,7 +458,7 @@ async function validateExpose(args = []) {
|
|
|
462
458
|
fail({
|
|
463
459
|
code: "BAD_USAGE",
|
|
464
460
|
message: "Provide either inline manifest JSON or --file <path>, not both.",
|
|
465
|
-
hint: "run402 projects validate-expose [
|
|
461
|
+
hint: "run402 projects validate-expose [project_id] --file manifest.json",
|
|
466
462
|
});
|
|
467
463
|
}
|
|
468
464
|
if (migrationFile && migrationSql !== null) {
|
|
@@ -495,7 +491,7 @@ async function validateExpose(args = []) {
|
|
|
495
491
|
}
|
|
496
492
|
const activeProjectId = getActiveProjectId();
|
|
497
493
|
const project = projectFlag || projectId || activeProjectId || undefined;
|
|
498
|
-
if (!project)
|
|
494
|
+
if (!project) walletAuthHeaders("/projects/v1/expose/validate");
|
|
499
495
|
const migration = migrationFile ? readFileSync(migrationFile, "utf-8") : migrationSql;
|
|
500
496
|
|
|
501
497
|
try {
|
|
@@ -525,25 +521,24 @@ async function list(args = []) {
|
|
|
525
521
|
fail({
|
|
526
522
|
code: "BAD_USAGE",
|
|
527
523
|
message: "--all and --org are mutually exclusive.",
|
|
528
|
-
hint: "--all reads
|
|
524
|
+
hint: "--all reads every project across all your orgs; --org filters the membership-scoped list to one org.",
|
|
529
525
|
});
|
|
530
526
|
}
|
|
531
527
|
|
|
532
|
-
// `--all` reads the
|
|
533
|
-
//
|
|
534
|
-
//
|
|
535
|
-
// wallet auth and the gateway returns just this wallet's slice.
|
|
528
|
+
// `--all` reads every project the caller can reach across all its orgs.
|
|
529
|
+
// Pass the cached sign-in session token when present; otherwise the SDK
|
|
530
|
+
// uses the credential provider and the gateway returns this wallet's slice.
|
|
536
531
|
const opts = {};
|
|
537
532
|
if (all) {
|
|
538
533
|
opts.all = true;
|
|
539
|
-
const session =
|
|
540
|
-
if (session) opts.token = session.
|
|
534
|
+
const session = loadLiveControlPlaneSession();
|
|
535
|
+
if (session) opts.token = session.control_plane_session_token;
|
|
541
536
|
} else if (org) {
|
|
542
537
|
opts.org = org;
|
|
543
538
|
}
|
|
544
539
|
|
|
545
540
|
// Active marker comes from local state; the inventory itself is the server
|
|
546
|
-
// read (NOT the keystore), so it surfaces every project the
|
|
541
|
+
// read (NOT the keystore), so it surfaces every project the principal can
|
|
547
542
|
// reach — including ones never provisioned from this machine.
|
|
548
543
|
const activeId = getActiveProjectId();
|
|
549
544
|
|
|
@@ -574,7 +569,7 @@ async function rename(projectId, args = []) {
|
|
|
574
569
|
fail({
|
|
575
570
|
code: "BAD_USAGE",
|
|
576
571
|
message: "Missing --name.",
|
|
577
|
-
hint: "run402 projects rename <
|
|
572
|
+
hint: "run402 projects rename <project_id> --name \"My Site\"",
|
|
578
573
|
});
|
|
579
574
|
}
|
|
580
575
|
try {
|
|
@@ -652,7 +647,7 @@ function commandMoved(name) {
|
|
|
652
647
|
fail({
|
|
653
648
|
code: "COMMAND_MOVED",
|
|
654
649
|
message: `run402 projects ${name} moved to the explicit local credential-cache surface.`,
|
|
655
|
-
hint: "Use `run402 credentials project-keys status/export --project <
|
|
650
|
+
hint: "Use `run402 credentials project-keys status/export --project <project_id>`.",
|
|
656
651
|
details: {
|
|
657
652
|
old_command: `projects ${name}`,
|
|
658
653
|
new_command: name === "keys" ? "credentials project-keys export --reveal" : "credentials project-keys status",
|
|
@@ -661,12 +656,12 @@ function commandMoved(name) {
|
|
|
661
656
|
next_actions: [
|
|
662
657
|
{
|
|
663
658
|
type: "run_command",
|
|
664
|
-
command: "run402 credentials project-keys status --project <
|
|
659
|
+
command: "run402 credentials project-keys status --project <project_id>",
|
|
665
660
|
why: "Inspect cached key presence without revealing secrets.",
|
|
666
661
|
},
|
|
667
662
|
{
|
|
668
663
|
type: "run_command",
|
|
669
|
-
command: "run402 credentials project-keys export --project <
|
|
664
|
+
command: "run402 credentials project-keys export --project <project_id> --reveal",
|
|
670
665
|
why: "Reveal cached project keys only when you explicitly need secret material.",
|
|
671
666
|
},
|
|
672
667
|
],
|
|
@@ -736,7 +731,7 @@ async function rest(projectId, restArgs = []) {
|
|
|
736
731
|
if (!table) {
|
|
737
732
|
fail({
|
|
738
733
|
code: "BAD_USAGE",
|
|
739
|
-
message: "Missing <table> argument. Usage: run402 projects rest <table> [--query \"<query>\"] [--project <
|
|
734
|
+
message: "Missing <table> argument. Usage: run402 projects rest <table> [--query \"<query>\"] [--project <project_id>]",
|
|
740
735
|
hint: "Run 'run402 projects schema' to list tables.",
|
|
741
736
|
});
|
|
742
737
|
}
|
|
@@ -889,10 +884,6 @@ const FLAGS_BY_SUB = {
|
|
|
889
884
|
values: ["--project", "--file", "--migration-file", "--migration-sql"],
|
|
890
885
|
},
|
|
891
886
|
delete: { known: ["--project", "--confirm"], values: ["--project"] },
|
|
892
|
-
export: {
|
|
893
|
-
known: ["--project", "--scope", "--auth", "--consistency", "--idempotency-key", "--output", "--poll-interval", "--timeout", "--wait", "--json", "--json-stream"],
|
|
894
|
-
values: ["--project", "--scope", "--auth", "--consistency", "--idempotency-key", "--output", "--poll-interval", "--timeout"],
|
|
895
|
-
},
|
|
896
887
|
};
|
|
897
888
|
|
|
898
889
|
function validateFlags(sub, args) {
|
|
@@ -940,11 +931,6 @@ export async function run(sub, args) {
|
|
|
940
931
|
case "validate-expose": await validateExpose(args); break;
|
|
941
932
|
case "get-expose": { const { projectId } = resolveProjectSelector(args, { rejectBareFirst: true }); await getExpose(projectId); break; }
|
|
942
933
|
case "delete": { const { projectId, rest } = resolveProjectSelector(args, { rejectBareFirst: true }); await deleteProject(projectId, rest); break; }
|
|
943
|
-
case "export": {
|
|
944
|
-
const { run } = await import("./cloud.mjs");
|
|
945
|
-
await run("archives", ["create", ...args]);
|
|
946
|
-
break;
|
|
947
|
-
}
|
|
948
934
|
case "promote-user": { const { projectId, rest } = resolveProjectSelector(args); await promoteUser(projectId, rest[0]); break; }
|
|
949
935
|
case "demote-user": { const { projectId, rest } = resolveProjectSelector(args); await demoteUser(projectId, rest[0]); break; }
|
|
950
936
|
default:
|
package/lib/redeem.mjs
CHANGED
|
@@ -2,14 +2,13 @@ import { getSdk } from "./sdk.mjs";
|
|
|
2
2
|
import { reportSdkError, fail } from "./sdk-errors.mjs";
|
|
3
3
|
import { assertKnownFlags, normalizeArgv, positionalArgs } from "./argparse.mjs";
|
|
4
4
|
|
|
5
|
-
const HELP = `run402 redeem — Redeem a promo code
|
|
5
|
+
const HELP = `run402 redeem — Redeem a promo code into your organization's allowance
|
|
6
6
|
|
|
7
7
|
Usage:
|
|
8
8
|
run402 redeem <code> [--json]
|
|
9
9
|
|
|
10
|
-
A promo code
|
|
11
|
-
|
|
12
|
-
on-chain payment.
|
|
10
|
+
A promo code adds to your organization's allowance, which spends like any
|
|
11
|
+
other allowance — a tier purchase settles from it with no on-chain payment.
|
|
13
12
|
|
|
14
13
|
Notes:
|
|
15
14
|
- Order does not matter. This works as your very first authenticated call
|
|
@@ -17,7 +16,7 @@ Notes:
|
|
|
17
16
|
- Codes are forgiving: case-insensitive and hyphens are optional, so
|
|
18
17
|
'R402-K8F3-Q2W9' and 'r402k8f3q2w9' are the same code.
|
|
19
18
|
- Retrying is safe. A repeat by the same organization returns the original
|
|
20
|
-
result with "already_redeemed": true and never
|
|
19
|
+
result with "already_redeemed": true and never adds the amount twice.
|
|
21
20
|
- Being in a grace state does not block you. Redeeming is how an owner funds
|
|
22
21
|
a renewal, so it is never gated.
|
|
23
22
|
- One gift per organization, per issuer: past the lifetime ceiling for a
|
|
@@ -64,10 +63,10 @@ export async function run(args = []) {
|
|
|
64
63
|
// in a field a human skims past.
|
|
65
64
|
console.error("");
|
|
66
65
|
console.error(
|
|
67
|
-
` Voucher ${usd(data.amount_usd_micros)}
|
|
68
|
-
`${data.already_redeemed ? " (already redeemed " + data.redeemed_at + " —
|
|
66
|
+
` Voucher ${usd(data.amount_usd_micros)} added` +
|
|
67
|
+
`${data.already_redeemed ? " (already redeemed " + data.redeemed_at + " — not added twice)" : ""}`,
|
|
69
68
|
);
|
|
70
|
-
console.error(`
|
|
69
|
+
console.error(` Allowance ${usd(data.balance_usd_micros)}`);
|
|
71
70
|
const next = Array.isArray(data.next_actions) ? data.next_actions.find((a) => a?.cli) : null;
|
|
72
71
|
if (next?.cli) console.error(`\n Next: ${next.cli}`);
|
|
73
72
|
console.error("");
|
|
@@ -146,7 +146,7 @@ const { getSdk } = await sdkModP;
|
|
|
146
146
|
const { resolveWalletCore, enforceWalletExistsCore, WalletSelectionError } = await walletModP;
|
|
147
147
|
const { gitvaultRemoteAddressForm, gitvaultSlugReleasedInfo, parseGitvaultRemoteUrl, gitvaultDegradedReadNote } = await isoModP;
|
|
148
148
|
const { GITVAULT_R402_REF_NAMESPACE, hardenedGit, resolveGitInvocationRepo, readPinnedGitvaultRepo, pinGitvaultRepo, readGitvaultRestoreMarker, readGitvaultAutoGcThreshold, predialGitvaultObjectStore } = await nodeModP;
|
|
149
|
-
const {
|
|
149
|
+
const { walletFile, projectCredentialsFile, profileStateFile } = await configModP;
|
|
150
150
|
|
|
151
151
|
/**
|
|
152
152
|
* Per-session SDK construction cache (gitvault-first-op-premium task 2.2).
|
|
@@ -167,10 +167,10 @@ const { allowanceFile, projectCredentialsFile, profileStateFile } = await config
|
|
|
167
167
|
* doc comment calls out as reasons a fresh instance mattered for tests that
|
|
168
168
|
* mutate them between calls in one process) and INVALIDATED on the mtime of
|
|
169
169
|
* the three files whose bytes actually determine signer/credential material
|
|
170
|
-
* (
|
|
170
|
+
* (wallet, project-credentials keystore, profile state) — a wallet
|
|
171
171
|
* rotation, `run402 init`, or any other on-disk change is picked up on the
|
|
172
172
|
* very next call, no daemon restart required. A file that does not exist
|
|
173
|
-
* yet (fresh wallet, no
|
|
173
|
+
* yet (fresh wallet, no local wallet) signs into the key as `null`, so its
|
|
174
174
|
* LATER appearance also busts the cache. The in-process fallback host calls
|
|
175
175
|
* this at most once per process anyway, so it degrades to exactly today's
|
|
176
176
|
* behavior there — this only changes anything for the daemon.
|
|
@@ -189,7 +189,7 @@ function sdkCacheKey() {
|
|
|
189
189
|
const wallet = process.env.RUN402_WALLET ?? "";
|
|
190
190
|
const configDir = process.env.RUN402_CONFIG_DIR ?? "";
|
|
191
191
|
const apiBase = process.env.RUN402_API_BASE ?? "";
|
|
192
|
-
const files = [mtimeOf(
|
|
192
|
+
const files = [mtimeOf(walletFile()), mtimeOf(projectCredentialsFile()), mtimeOf(profileStateFile())];
|
|
193
193
|
return `${wallet} ${configDir} ${apiBase} ${files.join(",")}`;
|
|
194
194
|
}
|
|
195
195
|
|
|
@@ -214,7 +214,7 @@ const note = (line) => process.stderr.write(`git-remote-run402: ${line}\n`);
|
|
|
214
214
|
* selection at all — a `.run402.json` binding, and even the global
|
|
215
215
|
* `wallets use` default, would silently never reach it; only the
|
|
216
216
|
* `RUN402_WALLET` env layer would work, so a bound checkout's `git push
|
|
217
|
-
* run402 main` would use the WRONG
|
|
217
|
+
* run402 main` would use the WRONG (usually empty) wallet.
|
|
218
218
|
*
|
|
219
219
|
* Shares `resolveWalletCore`/`enforceWalletExistsCore` with the CLI
|
|
220
220
|
* (`cli/lib/wallet-context.mjs`) — ONE implementation, minus the CLI's
|
|
@@ -253,19 +253,19 @@ function walletSourceLabel(resolved) {
|
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
/**
|
|
256
|
-
* The
|
|
256
|
+
* The wallet-missing/malformed family (`core/src/wallet.ts`'s own
|
|
257
257
|
* throws) all end with "Back up the file and run 'run402 init' to recreate
|
|
258
258
|
* it." — a remedy that assumes the resolved wallet is the one you meant.
|
|
259
259
|
* That is only true when NOTHING selected a wallet (the bare default); when
|
|
260
260
|
* an env var or a binding DID name one, the remedy is actively harmful —
|
|
261
|
-
* `run402 init` recreates the DEFAULT wallet's
|
|
262
|
-
* wallet than the one that was actually resolved and whose
|
|
261
|
+
* `run402 init` recreates the DEFAULT wallet's key file, a DIFFERENT
|
|
262
|
+
* wallet than the one that was actually resolved and whose key file is
|
|
263
263
|
* actually missing/broken. Replace
|
|
264
264
|
* it with the resolved wallet's name and how selection works, so the fix is
|
|
265
265
|
* "correct the selection" rather than "recreate the wrong wallet".
|
|
266
266
|
*/
|
|
267
|
-
function
|
|
268
|
-
if (!resolvedWallet || !/
|
|
267
|
+
function enrichWalletError(message) {
|
|
268
|
+
if (!resolvedWallet || !/wallet\.json/.test(message)) return message;
|
|
269
269
|
const source = walletSourceLabel(resolvedWallet);
|
|
270
270
|
const stripped = message.replace(/\s*Back up the file and run 'run402 init' to recreate it\.?/, "").trim();
|
|
271
271
|
if (!source) {
|
|
@@ -276,13 +276,13 @@ function enrichAllowanceError(message) {
|
|
|
276
276
|
return (
|
|
277
277
|
`${stripped} Resolved wallet '${resolvedWallet.name}' via ${source} ` +
|
|
278
278
|
"(order: RUN402_WALLET env > .run402.json binding > 'wallets use' default > default). " +
|
|
279
|
-
`Wrong wallet? Fix selection instead. Right wallet, just
|
|
279
|
+
`Wrong wallet? Fix selection instead. Right wallet, just not created yet? 'run402 wallets new ${resolvedWallet.name}'.`
|
|
280
280
|
);
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
function describeError(err) {
|
|
284
284
|
const code = err?.code ?? err?.body?.code ?? null;
|
|
285
|
-
const message =
|
|
285
|
+
const message = enrichWalletError(err?.message ?? err?.body?.message ?? String(err));
|
|
286
286
|
// SLUG_RELEASED is never auto-followed — but the successor slug (design D6)
|
|
287
287
|
// is exactly the fact a human/agent reading stderr needs to act on it.
|
|
288
288
|
const released = gitvaultSlugReleasedInfo(err);
|