run402 4.95.0 → 4.97.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 +5 -5
- package/cli.mjs +2 -28
- package/core-dist/keystore.js +1 -1
- package/git-remote-run402.mjs +6 -6
- package/lib/buzz.mjs +1 -1
- package/lib/cold-start.mjs +2 -2
- package/lib/command-manifest.mjs +6 -47
- package/lib/credentials.mjs +5 -5
- package/lib/daemon-path.mjs +3 -3
- package/lib/deploy-v2.mjs +44 -44
- package/lib/doctor.mjs +45 -54
- package/lib/errors.mjs +1 -1
- package/lib/events.mjs +1 -1
- package/lib/grants.mjs +148 -46
- package/lib/init.mjs +29 -29
- package/lib/logs.mjs +1 -1
- package/lib/next-actions.mjs +1 -1
- package/lib/org-context.mjs +9 -9
- package/lib/orgs.mjs +19 -19
- package/lib/path-lookup.mjs +7 -10
- package/lib/path-lookup.test.mjs +19 -21
- package/lib/projects.mjs +1 -1
- package/lib/remote-helper-session.mjs +93 -93
- package/lib/repos.mjs +174 -175
- package/lib/rooms-context.mjs +7 -7
- package/lib/sites.mjs +5 -5
- package/lib/up.mjs +14 -14
- package/lib/{gitvault-capabilities.mjs → vault-capabilities.mjs} +10 -14
- package/lib/{gitvault-daemon-run.mjs → vault-daemon-run.mjs} +2 -2
- package/lib/{gitvault-daemon.mjs → vault-daemon.mjs} +23 -23
- package/lib/{gitvault-scaffold.mjs → vault-scaffold.mjs} +12 -12
- package/lib/{gitvault-target.mjs → vault-target.mjs} +22 -17
- package/package.json +2 -2
- package/sdk/core-dist/keystore.js +1 -1
- package/sdk/dist/errors.d.ts +5 -5
- package/sdk/dist/errors.d.ts.map +1 -1
- package/sdk/dist/errors.js +2 -2
- package/sdk/dist/errors.js.map +1 -1
- package/sdk/dist/grant-key-credentials.d.ts +38 -0
- package/sdk/dist/grant-key-credentials.d.ts.map +1 -0
- package/sdk/dist/grant-key-credentials.js +42 -0
- package/sdk/dist/grant-key-credentials.js.map +1 -0
- package/sdk/dist/index.d.ts +16 -23
- package/sdk/dist/index.d.ts.map +1 -1
- package/sdk/dist/index.js +14 -21
- package/sdk/dist/index.js.map +1 -1
- package/sdk/dist/namespaces/billing.d.ts +1 -1
- package/sdk/dist/namespaces/billing.js +1 -1
- package/sdk/dist/namespaces/buzz.js +1 -1
- package/sdk/dist/namespaces/buzz.js.map +1 -1
- package/sdk/dist/namespaces/credentials.d.ts +4 -4
- package/sdk/dist/namespaces/credentials.js +4 -4
- package/sdk/dist/namespaces/deploy.d.ts +5 -5
- package/sdk/dist/namespaces/deploy.d.ts.map +1 -1
- package/sdk/dist/namespaces/deploy.js +25 -25
- package/sdk/dist/namespaces/deploy.js.map +1 -1
- package/sdk/dist/namespaces/deploy.types.d.ts +17 -17
- package/sdk/dist/namespaces/deploy.types.d.ts.map +1 -1
- package/sdk/dist/namespaces/domains.d.ts +1 -1
- package/sdk/dist/namespaces/domains.js +1 -1
- package/sdk/dist/namespaces/errors.d.ts +1 -1
- package/sdk/dist/namespaces/errors.js +2 -2
- package/sdk/dist/namespaces/escalations.d.ts +2 -2
- package/sdk/dist/namespaces/escalations.js +2 -2
- package/sdk/dist/namespaces/escalations.types.d.ts +3 -3
- package/sdk/dist/namespaces/escalations.types.d.ts.map +1 -1
- package/sdk/dist/namespaces/events.d.ts +1 -1
- package/sdk/dist/namespaces/events.js +1 -1
- package/sdk/dist/namespaces/functions.js +1 -1
- package/sdk/dist/namespaces/functions.js.map +1 -1
- package/sdk/dist/namespaces/grants.d.ts +43 -9
- package/sdk/dist/namespaces/grants.d.ts.map +1 -1
- package/sdk/dist/namespaces/grants.js +99 -10
- package/sdk/dist/namespaces/grants.js.map +1 -1
- package/sdk/dist/namespaces/grants.types.d.ts +120 -15
- package/sdk/dist/namespaces/grants.types.d.ts.map +1 -1
- package/sdk/dist/namespaces/grants.types.js +12 -3
- package/sdk/dist/namespaces/grants.types.js.map +1 -1
- package/sdk/dist/namespaces/identity-links.types.d.ts +2 -2
- package/sdk/dist/namespaces/identity-links.types.d.ts.map +1 -1
- package/sdk/dist/namespaces/org.d.ts +3 -3
- package/sdk/dist/namespaces/org.js +3 -3
- package/sdk/dist/namespaces/org.types.d.ts +3 -3
- package/sdk/dist/namespaces/pay.js +1 -1
- package/sdk/dist/namespaces/projects.d.ts +1 -1
- package/sdk/dist/namespaces/projects.js +1 -1
- package/sdk/dist/namespaces/{gitvault.d.ts → repos.d.ts} +436 -449
- package/sdk/dist/namespaces/repos.d.ts.map +1 -0
- package/sdk/dist/namespaces/{gitvault.js → repos.js} +452 -460
- package/sdk/dist/namespaces/repos.js.map +1 -0
- package/sdk/dist/namespaces/rooms.d.ts +3 -3
- package/sdk/dist/namespaces/rooms.js +5 -5
- package/sdk/dist/namespaces/rooms.js.map +1 -1
- package/sdk/dist/namespaces/session.d.ts +2 -2
- package/sdk/dist/namespaces/session.d.ts.map +1 -1
- package/sdk/dist/namespaces/session.js +2 -2
- package/sdk/dist/namespaces/session.js.map +1 -1
- package/sdk/dist/namespaces/tier.d.ts +3 -3
- package/sdk/dist/namespaces/tier.d.ts.map +1 -1
- package/sdk/dist/namespaces/{gitvault.crypto.d.ts → vault.crypto.d.ts} +141 -141
- package/sdk/dist/namespaces/vault.crypto.d.ts.map +1 -0
- package/sdk/dist/namespaces/{gitvault.crypto.js → vault.crypto.js} +173 -173
- package/sdk/dist/namespaces/vault.crypto.js.map +1 -0
- package/sdk/dist/namespaces/{gitvault.types.d.ts → vault.types.d.ts} +136 -136
- package/sdk/dist/namespaces/vault.types.d.ts.map +1 -0
- package/sdk/dist/namespaces/{gitvault.types.js → vault.types.js} +4 -4
- package/sdk/dist/namespaces/vault.types.js.map +1 -0
- package/sdk/dist/node/bearer-redeem-key.d.ts +1 -1
- package/sdk/dist/node/bearer-redeem-key.js +5 -5
- package/sdk/dist/node/bearer-redeem-key.js.map +1 -1
- package/sdk/dist/node/credentials.d.ts +9 -9
- package/sdk/dist/node/credentials.d.ts.map +1 -1
- package/sdk/dist/node/credentials.js +12 -12
- package/sdk/dist/node/credentials.js.map +1 -1
- package/sdk/dist/node/http-dispatcher.js +5 -5
- package/sdk/dist/node/http-dispatcher.js.map +1 -1
- package/sdk/dist/node/index.d.ts +34 -34
- package/sdk/dist/node/index.d.ts.map +1 -1
- package/sdk/dist/node/index.js +41 -41
- package/sdk/dist/node/index.js.map +1 -1
- package/sdk/dist/node/{gitvault-address.d.ts → vault-address.d.ts} +42 -42
- package/sdk/dist/node/vault-address.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-address.js → vault-address.js} +43 -43
- package/sdk/dist/node/vault-address.js.map +1 -0
- package/sdk/dist/node/{gitvault-apply.d.ts → vault-apply.d.ts} +27 -27
- package/sdk/dist/node/vault-apply.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-apply.js → vault-apply.js} +38 -38
- package/sdk/dist/node/vault-apply.js.map +1 -0
- package/sdk/dist/node/vault-byo-config.d.ts +29 -0
- package/sdk/dist/node/vault-byo-config.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-byo-config.js → vault-byo-config.js} +18 -18
- package/sdk/dist/node/vault-byo-config.js.map +1 -0
- package/sdk/dist/node/vault-byo-probe.d.ts +20 -0
- package/sdk/dist/node/vault-byo-probe.d.ts.map +1 -0
- package/sdk/dist/node/vault-byo-probe.js +57 -0
- package/sdk/dist/node/vault-byo-probe.js.map +1 -0
- package/sdk/dist/node/{gitvault-creation-journal.d.ts → vault-creation-journal.d.ts} +69 -69
- package/sdk/dist/node/vault-creation-journal.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-creation-journal.js → vault-creation-journal.js} +54 -54
- package/sdk/dist/node/vault-creation-journal.js.map +1 -0
- package/sdk/dist/node/{gitvault-degraded-read.d.ts → vault-degraded-read.d.ts} +34 -34
- package/sdk/dist/node/vault-degraded-read.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-degraded-read.js → vault-degraded-read.js} +24 -24
- package/sdk/dist/node/vault-degraded-read.js.map +1 -0
- package/sdk/dist/node/{gitvault-deploy.d.ts → vault-deploy.d.ts} +67 -67
- package/sdk/dist/node/vault-deploy.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-deploy.js → vault-deploy.js} +27 -27
- package/sdk/dist/node/vault-deploy.js.map +1 -0
- package/sdk/dist/node/{gitvault-edge-fetch.d.ts → vault-edge-fetch.d.ts} +9 -9
- package/sdk/dist/node/vault-edge-fetch.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-edge-fetch.js → vault-edge-fetch.js} +11 -11
- package/sdk/dist/node/vault-edge-fetch.js.map +1 -0
- package/sdk/dist/node/{gitvault-handoff.d.ts → vault-handoff.d.ts} +9 -9
- package/sdk/dist/node/vault-handoff.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-handoff.js → vault-handoff.js} +24 -24
- package/sdk/dist/node/vault-handoff.js.map +1 -0
- package/sdk/dist/node/{gitvault-keystore.d.ts → vault-keystore.d.ts} +87 -77
- package/sdk/dist/node/vault-keystore.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-keystore.js → vault-keystore.js} +105 -68
- package/sdk/dist/node/vault-keystore.js.map +1 -0
- package/sdk/dist/node/{gitvault-member-bundle.d.ts → vault-member-bundle.d.ts} +17 -17
- package/sdk/dist/node/vault-member-bundle.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-member-bundle.js → vault-member-bundle.js} +11 -11
- package/sdk/dist/node/vault-member-bundle.js.map +1 -0
- package/sdk/dist/node/{gitvault-mirror-backend.d.ts → vault-mirror-backend.d.ts} +26 -26
- package/sdk/dist/node/vault-mirror-backend.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-mirror-backend.js → vault-mirror-backend.js} +25 -25
- package/sdk/dist/node/vault-mirror-backend.js.map +1 -0
- package/sdk/dist/node/{gitvault-mirror-config.d.ts → vault-mirror-config.d.ts} +23 -23
- package/sdk/dist/node/vault-mirror-config.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-mirror-config.js → vault-mirror-config.js} +16 -16
- package/sdk/dist/node/vault-mirror-config.js.map +1 -0
- package/sdk/dist/node/{gitvault-mirror.d.ts → vault-mirror.d.ts} +36 -36
- package/sdk/dist/node/vault-mirror.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-mirror.js → vault-mirror.js} +75 -75
- package/sdk/dist/node/vault-mirror.js.map +1 -0
- package/sdk/dist/node/{gitvault-native-crypto.d.ts → vault-native-crypto.d.ts} +10 -10
- package/sdk/dist/node/vault-native-crypto.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-native-crypto.js → vault-native-crypto.js} +16 -16
- package/sdk/dist/node/vault-native-crypto.js.map +1 -0
- package/sdk/dist/node/{gitvault-open-or-create.d.ts → vault-open-or-create.d.ts} +16 -16
- package/sdk/dist/node/vault-open-or-create.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-open-or-create.js → vault-open-or-create.js} +10 -10
- package/sdk/dist/node/vault-open-or-create.js.map +1 -0
- package/sdk/dist/node/{gitvault-prewarm.d.ts → vault-prewarm.d.ts} +13 -13
- package/sdk/dist/node/vault-prewarm.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-prewarm.js → vault-prewarm.js} +25 -25
- package/sdk/dist/node/vault-prewarm.js.map +1 -0
- package/sdk/dist/node/{gitvault-profile-scan.d.ts → vault-profile-scan.d.ts} +3 -3
- package/sdk/dist/node/vault-profile-scan.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-profile-scan.js → vault-profile-scan.js} +12 -12
- package/sdk/dist/node/vault-profile-scan.js.map +1 -0
- package/sdk/dist/node/{gitvault-prune.d.ts → vault-prune.d.ts} +61 -61
- package/sdk/dist/node/vault-prune.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-prune.js → vault-prune.js} +34 -34
- package/sdk/dist/node/vault-prune.js.map +1 -0
- package/sdk/dist/node/{gitvault-publication.d.ts → vault-publication.d.ts} +399 -399
- package/sdk/dist/node/vault-publication.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-publication.js → vault-publication.js} +584 -584
- package/sdk/dist/node/vault-publication.js.map +1 -0
- package/sdk/dist/node/{gitvault-push-to-create.d.ts → vault-push-to-create.d.ts} +16 -16
- package/sdk/dist/node/vault-push-to-create.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-push-to-create.js → vault-push-to-create.js} +9 -9
- package/sdk/dist/node/vault-push-to-create.js.map +1 -0
- package/sdk/dist/node/{gitvault-recover.d.ts → vault-recover.d.ts} +50 -50
- package/sdk/dist/node/vault-recover.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-recover.js → vault-recover.js} +84 -84
- package/sdk/dist/node/vault-recover.js.map +1 -0
- package/sdk/dist/node/{gitvault-restore.d.ts → vault-restore.d.ts} +8 -8
- package/sdk/dist/node/vault-restore.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-restore.js → vault-restore.js} +11 -11
- package/sdk/dist/node/vault-restore.js.map +1 -0
- package/sdk/dist/node/{gitvault-snapshot.d.ts → vault-snapshot.d.ts} +48 -48
- package/sdk/dist/node/vault-snapshot.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-snapshot.js → vault-snapshot.js} +61 -61
- package/sdk/dist/node/vault-snapshot.js.map +1 -0
- package/sdk/dist/node/{gitvault-writer-state.d.ts → vault-writer-state.d.ts} +8 -8
- package/sdk/dist/node/vault-writer-state.d.ts.map +1 -0
- package/sdk/dist/node/{gitvault-writer-state.js → vault-writer-state.js} +15 -15
- package/sdk/dist/node/vault-writer-state.js.map +1 -0
- package/sdk/dist/node/workflow-output.js +4 -4
- package/sdk/dist/node/workflow-output.js.map +1 -1
- package/sdk/dist/project-auth-classification.d.ts +8 -8
- package/sdk/dist/project-auth-classification.d.ts.map +1 -1
- package/sdk/dist/project-auth-classification.js +7 -7
- package/sdk/dist/project-auth-classification.js.map +1 -1
- package/sdk/dist/scoped.d.ts +6 -14
- package/sdk/dist/scoped.d.ts.map +1 -1
- package/sdk/dist/scoped.js +10 -21
- package/sdk/dist/scoped.js.map +1 -1
- package/vault-surface.json +40 -0
- package/gitvault-surface.json +0 -89
- package/lib/delegates.mjs +0 -189
- package/lib/gitvault.mjs +0 -163
- package/lib/source-access.mjs +0 -70
- package/sdk/dist/delegate-credentials.d.ts +0 -37
- package/sdk/dist/delegate-credentials.d.ts.map +0 -1
- package/sdk/dist/delegate-credentials.js +0 -41
- package/sdk/dist/delegate-credentials.js.map +0 -1
- package/sdk/dist/namespaces/delegates.d.ts +0 -50
- package/sdk/dist/namespaces/delegates.d.ts.map +0 -1
- package/sdk/dist/namespaces/delegates.js +0 -99
- package/sdk/dist/namespaces/delegates.js.map +0 -1
- package/sdk/dist/namespaces/delegates.types.d.ts +0 -88
- package/sdk/dist/namespaces/delegates.types.d.ts.map +0 -1
- package/sdk/dist/namespaces/delegates.types.js +0 -10
- package/sdk/dist/namespaces/delegates.types.js.map +0 -1
- package/sdk/dist/namespaces/gitvault.crypto.d.ts.map +0 -1
- package/sdk/dist/namespaces/gitvault.crypto.js.map +0 -1
- package/sdk/dist/namespaces/gitvault.d.ts.map +0 -1
- package/sdk/dist/namespaces/gitvault.js.map +0 -1
- package/sdk/dist/namespaces/gitvault.types.d.ts.map +0 -1
- package/sdk/dist/namespaces/gitvault.types.js.map +0 -1
- package/sdk/dist/node/gitvault-address.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-address.js.map +0 -1
- package/sdk/dist/node/gitvault-apply.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-apply.js.map +0 -1
- package/sdk/dist/node/gitvault-byo-config.d.ts +0 -29
- package/sdk/dist/node/gitvault-byo-config.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-byo-config.js.map +0 -1
- package/sdk/dist/node/gitvault-byo-probe.d.ts +0 -20
- package/sdk/dist/node/gitvault-byo-probe.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-byo-probe.js +0 -57
- package/sdk/dist/node/gitvault-byo-probe.js.map +0 -1
- package/sdk/dist/node/gitvault-creation-journal.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-creation-journal.js.map +0 -1
- package/sdk/dist/node/gitvault-degraded-read.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-degraded-read.js.map +0 -1
- package/sdk/dist/node/gitvault-deploy.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-deploy.js.map +0 -1
- package/sdk/dist/node/gitvault-edge-fetch.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-edge-fetch.js.map +0 -1
- package/sdk/dist/node/gitvault-handoff.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-handoff.js.map +0 -1
- package/sdk/dist/node/gitvault-keystore.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-keystore.js.map +0 -1
- package/sdk/dist/node/gitvault-member-bundle.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-member-bundle.js.map +0 -1
- package/sdk/dist/node/gitvault-mirror-backend.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-mirror-backend.js.map +0 -1
- package/sdk/dist/node/gitvault-mirror-config.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-mirror-config.js.map +0 -1
- package/sdk/dist/node/gitvault-mirror.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-mirror.js.map +0 -1
- package/sdk/dist/node/gitvault-native-crypto.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-native-crypto.js.map +0 -1
- package/sdk/dist/node/gitvault-open-or-create.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-open-or-create.js.map +0 -1
- package/sdk/dist/node/gitvault-prewarm.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-prewarm.js.map +0 -1
- package/sdk/dist/node/gitvault-profile-scan.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-profile-scan.js.map +0 -1
- package/sdk/dist/node/gitvault-prune.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-prune.js.map +0 -1
- package/sdk/dist/node/gitvault-publication.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-publication.js.map +0 -1
- package/sdk/dist/node/gitvault-push-to-create.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-push-to-create.js.map +0 -1
- package/sdk/dist/node/gitvault-recover.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-recover.js.map +0 -1
- package/sdk/dist/node/gitvault-restore.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-restore.js.map +0 -1
- package/sdk/dist/node/gitvault-snapshot.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-snapshot.js.map +0 -1
- package/sdk/dist/node/gitvault-writer-state.d.ts.map +0 -1
- package/sdk/dist/node/gitvault-writer-state.js.map +0 -1
package/lib/rooms-context.mjs
CHANGED
|
@@ -39,16 +39,16 @@ export const PRESENCE_ENV = "RUN402_PRESENCE_ID";
|
|
|
39
39
|
/**
|
|
40
40
|
* `r402.room` from `cwd`'s LOCAL git config (kygit-handoff design D10) —
|
|
41
41
|
* best-effort, `null` on any absence or failure. Checks a real vault
|
|
42
|
-
* checkout's pin first (`
|
|
42
|
+
* checkout's pin first (`readPinnedVaultRepo`, gated on `r402.repoId`
|
|
43
43
|
* being present), then falls back to the bare room/org pin `rooms join
|
|
44
44
|
* <key>` writes in a directory with NO vault at all (add-room-invite design
|
|
45
|
-
* D10) — `
|
|
45
|
+
* D10) — `readPinnedVaultRepo` would otherwise see that pin as absent,
|
|
46
46
|
* since it never sets `r402.repoId`.
|
|
47
47
|
*/
|
|
48
|
-
async function
|
|
48
|
+
async function readVaultPinnedRoom(cwd) {
|
|
49
49
|
try {
|
|
50
|
-
const {
|
|
51
|
-
const pinned = await
|
|
50
|
+
const { readPinnedVaultRepo, readPinnedRoomBinding } = await import("#sdk/node");
|
|
51
|
+
const pinned = await readPinnedVaultRepo(cwd);
|
|
52
52
|
const room = typeof pinned?.room === "string" ? pinned.room.trim() : "";
|
|
53
53
|
if (room.length > 0) return room;
|
|
54
54
|
const bare = await readPinnedRoomBinding(cwd);
|
|
@@ -102,11 +102,11 @@ export async function resolveRoom({ org, room, project } = {}) {
|
|
|
102
102
|
// (`--room` alone works whenever the org resolves, and fails with
|
|
103
103
|
// ORG_REQUIRED — naming every way to supply one — when it does not.)
|
|
104
104
|
// kygit-handoff design D10: `r402.room` in this checkout's LOCAL git
|
|
105
|
-
// config — written by `resume` and every other
|
|
105
|
+
// config — written by `resume` and every other vault pin site — is
|
|
106
106
|
// the LAST room-key source before falling to the project default,
|
|
107
107
|
// below the binding file's own `room` key.
|
|
108
108
|
const bindingRoom = findBindingKey(process.cwd(), "room");
|
|
109
|
-
const roomKey = room ?? bindingRoom?.value ?? (await
|
|
109
|
+
const roomKey = room ?? bindingRoom?.value ?? (await readVaultPinnedRoom(process.cwd()));
|
|
110
110
|
if (roomKey) {
|
|
111
111
|
const resolved = await resolveOrg({ org, project }, { cmd: "rooms" });
|
|
112
112
|
return {
|
package/lib/sites.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mkdtempSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
|
|
2
2
|
import { tmpdir } from "os";
|
|
3
3
|
import { dirname, join, resolve } from "path";
|
|
4
|
-
import { fileSetFromDir,
|
|
4
|
+
import { fileSetFromDir, grantKeyFromEnv } from "#sdk/node";
|
|
5
5
|
import { walletAuthHeaders, resolveProjectId, updateProject } from "./config.mjs";
|
|
6
6
|
import { resolveFilePathsInManifest } from "./manifest.mjs";
|
|
7
7
|
import { getSdk } from "./sdk.mjs";
|
|
@@ -220,9 +220,9 @@ async function deploy(args) {
|
|
|
220
220
|
if (opts.manifest) resolveFilePathsInManifest(manifest, dirname(resolve(opts.manifest)));
|
|
221
221
|
|
|
222
222
|
// Preserve the aggressive early exit when no local wallet is configured.
|
|
223
|
-
// A
|
|
223
|
+
// A grant key holds `deploy` and /apply/v1/plans accepts it; refusing locally
|
|
224
224
|
// would tell a wallet-less holder to run `run402 init` (see 4.11.2).
|
|
225
|
-
if (!
|
|
225
|
+
if (!grantKeyFromEnv()) walletAuthHeaders("/apply/v1/plans");
|
|
226
226
|
|
|
227
227
|
const stage = stageFilesToTempDir(manifest.files || []);
|
|
228
228
|
try {
|
|
@@ -289,9 +289,9 @@ async function deployDir(args) {
|
|
|
289
289
|
if (opts.target !== undefined) failUnsupportedTarget();
|
|
290
290
|
|
|
291
291
|
// Preserve the aggressive early exit when no local wallet is configured.
|
|
292
|
-
// A
|
|
292
|
+
// A grant key holds `deploy` and /apply/v1/plans accepts it; refusing locally
|
|
293
293
|
// would tell a wallet-less holder to run `run402 init` (see 4.11.2).
|
|
294
|
-
if (!
|
|
294
|
+
if (!grantKeyFromEnv()) walletAuthHeaders("/apply/v1/plans");
|
|
295
295
|
|
|
296
296
|
let fileSet;
|
|
297
297
|
try {
|
package/lib/up.mjs
CHANGED
|
@@ -84,12 +84,12 @@ Options:
|
|
|
84
84
|
Repo composition (D4): against a local directory (not a git URL source), up
|
|
85
85
|
composes git init (only when the app root is not already a repository) +
|
|
86
86
|
provision + a run402 remote scaffold (origin is never claimed) + a first
|
|
87
|
-
|
|
87
|
+
vault push — one command, the fly-launch shape. The app root is the
|
|
88
88
|
manifest's directory; an app root that lies INSIDE another repository is
|
|
89
89
|
left untouched (result.repo.status "skipped", reason
|
|
90
90
|
"inside_other_repository", toplevel named) and result.repo.next_actions
|
|
91
91
|
carries create_nested_repo — re-run with --nested to give the app its own
|
|
92
|
-
encrypted remote (result.repo.
|
|
92
|
+
encrypted remote (result.repo.vault.nested true, enclosing_toplevel,
|
|
93
93
|
excluded_in_enclosing). The scaffold and first push are best-effort: a git
|
|
94
94
|
or vault hiccup never turns an otherwise-successful deploy into a failure,
|
|
95
95
|
and is reported under result.repo (default apply) or result (--repo-only)
|
|
@@ -395,7 +395,7 @@ export async function run(args = []) {
|
|
|
395
395
|
createdRepository = await gitInitIfNeeded(workDir);
|
|
396
396
|
result.result.repo = await composeRepoPushStep({ sdk, workDir, projectId, createdRepository, nested });
|
|
397
397
|
} catch (err) {
|
|
398
|
-
result.result.repo = { status: "failed", first_push: null, first_push_error: { code: err?.code ?? "
|
|
398
|
+
result.result.repo = { status: "failed", first_push: null, first_push_error: { code: err?.code ?? "VAULT_SETUP_FAILED", message: err?.message ?? String(err) }, ...repoNextActionsOf(err) };
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
401
|
}
|
|
@@ -658,13 +658,13 @@ function looksLikeGitRemoteUrl(source) {
|
|
|
658
658
|
*
|
|
659
659
|
* `-b main`, not whatever `init.defaultBranch` (or the pre-2.28 hardcoded
|
|
660
660
|
* `master`) happens to be — the docs teach `git push origin main`, and the
|
|
661
|
-
*
|
|
661
|
+
* vault remote helper's own dangling-HEAD hazard note (a first push of
|
|
662
662
|
* any OTHER branch leaves HEAD naming a ref that does not exist yet) is
|
|
663
663
|
* exactly what a mismatched default branch here would walk `up` straight
|
|
664
664
|
* into. `-b` needs git 2.28+ (2020); an older git falls back to the same
|
|
665
665
|
* result by a different route — `symbolic-ref` on a still-empty repository
|
|
666
666
|
* has no existing ref to disturb, so it is exactly as safe as `-b main`
|
|
667
|
-
* would have been. Mirrors `
|
|
667
|
+
* would have been. Mirrors `Repos.scaffoldRemote`'s identical fallback.
|
|
668
668
|
*/
|
|
669
669
|
async function gitInitIfNeeded(dir) {
|
|
670
670
|
const { hardenedGit } = await import("#sdk/node");
|
|
@@ -685,20 +685,20 @@ async function gitInitIfNeeded(dir) {
|
|
|
685
685
|
/**
|
|
686
686
|
* Remote scaffold + first push, against an already-known project. Best-effort
|
|
687
687
|
* in every branch — the same non-fatal discipline `projects provision`'s own
|
|
688
|
-
* fold-in follows (`
|
|
688
|
+
* fold-in follows (`vault-scaffold.mjs`): a git or vault hiccup here must
|
|
689
689
|
* never turn an otherwise-successful `up` into a failure.
|
|
690
690
|
*/
|
|
691
691
|
async function composeRepoPushStep({ sdk, workDir, projectId, createdRepository, nested = false }) {
|
|
692
692
|
const { resolveOwningOrgId } = await import("./org-context.mjs");
|
|
693
|
-
const {
|
|
693
|
+
const { scaffoldVaultRemote } = await import("./vault-scaffold.mjs");
|
|
694
694
|
const orgId = await resolveOwningOrgId(projectId);
|
|
695
695
|
// `--nested`: an app root INSIDE another repository (a monorepo workspace)
|
|
696
696
|
// becomes its own repository with the encrypted remote — the enclosing
|
|
697
697
|
// checkout only gains one local `.git/info/exclude` line. Without it the
|
|
698
698
|
// scaffold is skipped there and the result's `next_actions` name
|
|
699
699
|
// `run402 up --nested` (the caller's own spelling of the way out).
|
|
700
|
-
const scaffold = await
|
|
701
|
-
if (createdRepository && scaffold.
|
|
700
|
+
const scaffold = await scaffoldVaultRemote({ repoDir: workDir, projectId, orgId: orgId ?? undefined, createRepoIfMissing: false, nested, nestedCommand: "run402 up --nested" });
|
|
701
|
+
if (createdRepository && scaffold.vault) scaffold.vault.created_repository = true;
|
|
702
702
|
const out = { ...scaffold, first_push: null, first_push_error: null };
|
|
703
703
|
if (scaffold.status !== "scaffolded") {
|
|
704
704
|
// Nothing was scaffolded (the app root is inside another repository, or
|
|
@@ -707,7 +707,7 @@ async function composeRepoPushStep({ sdk, workDir, projectId, createdRepository,
|
|
|
707
707
|
return out;
|
|
708
708
|
}
|
|
709
709
|
if (!orgId) {
|
|
710
|
-
out.first_push_error = { code: "
|
|
710
|
+
out.first_push_error = { code: "VAULT_ORG_UNRESOLVED", message: `could not resolve the owning org for ${projectId} — the first push was skipped` };
|
|
711
711
|
return out;
|
|
712
712
|
}
|
|
713
713
|
// Read BEFORE the push decision: an unborn HEAD is what decides the lane.
|
|
@@ -717,7 +717,7 @@ async function composeRepoPushStep({ sdk, workDir, projectId, createdRepository,
|
|
|
717
717
|
// a repository the agent `git init`ed itself and never committed to (an
|
|
718
718
|
// UNBORN HEAD): there is no clean tree to keep, only untracked files, and
|
|
719
719
|
// the strict lane would refuse SNAPSHOT_DIRTY_TREE on every first push.
|
|
720
|
-
const freshRepository = createdRepository || scaffold.
|
|
720
|
+
const freshRepository = createdRepository || scaffold.vault?.created_repository === true || out.local_git.unborn === true;
|
|
721
721
|
try {
|
|
722
722
|
let vaultCreated = null;
|
|
723
723
|
// A fresh repository has, by definition, nothing committed yet — every
|
|
@@ -726,7 +726,7 @@ async function composeRepoPushStep({ sdk, workDir, projectId, createdRepository,
|
|
|
726
726
|
// first commit the dirty-tree lane produces (disclosed under
|
|
727
727
|
// first_push.snapshot); a repository WITH commits keeps the clean-tree
|
|
728
728
|
// rule and its refusal is reported, never overridden.
|
|
729
|
-
const pushed = await sdk.
|
|
729
|
+
const pushed = await sdk.repos.capture({
|
|
730
730
|
project_id: projectId,
|
|
731
731
|
org_id: orgId,
|
|
732
732
|
repo_dir: workDir,
|
|
@@ -736,14 +736,14 @@ async function composeRepoPushStep({ sdk, workDir, projectId, createdRepository,
|
|
|
736
736
|
out.first_push = {
|
|
737
737
|
generation: pushed.generation,
|
|
738
738
|
form: pushed.form,
|
|
739
|
-
|
|
739
|
+
vault_commit: pushed.vault_commit,
|
|
740
740
|
vault_created: vaultCreated,
|
|
741
741
|
snapshot: pushed.snapshot ? { id: pushed.snapshot.oid, kind: pushed.snapshot.kind, backup_status: "succeeded" } : null,
|
|
742
742
|
note: "Vault backup does not create a local branch commit or stage files. Local HEAD and dirty state are independent.",
|
|
743
743
|
...(freshRepository ? { captured_dirty: true, modified_captured: pushed.snapshot?.modified_captured ?? null, untracked_captured: pushed.snapshot?.untracked_captured ?? null } : {}),
|
|
744
744
|
};
|
|
745
745
|
} catch (err) {
|
|
746
|
-
out.first_push_error = { code: err?.body?.code ?? err?.code ?? "
|
|
746
|
+
out.first_push_error = { code: err?.body?.code ?? err?.code ?? "VAULT_PUSH_FAILED", message: err?.message ?? String(err) };
|
|
747
747
|
Object.assign(out, repoNextActionsOf(err));
|
|
748
748
|
}
|
|
749
749
|
return out;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* marketing surface (openspec/changes/
|
|
2
|
+
* vault-capabilities.mjs — the capability ledger for the KyGit
|
|
3
|
+
* marketing surface (openspec/changes/kygit-page-truth-gate, design D1).
|
|
4
4
|
*
|
|
5
5
|
* THIS FILE IS MARKETING-CLAIM GROUND TRUTH. run402-private's page-truth
|
|
6
|
-
* gate (`scripts/check-
|
|
6
|
+
* gate (`scripts/check-kygit-page-truth.mjs`) resolves the PUBLISHED
|
|
7
7
|
* `run402` package, reads these flags out of the generated
|
|
8
|
-
* `cli/
|
|
8
|
+
* `cli/vault-surface.json`, and fails the KyGit product page's build
|
|
9
9
|
* when a claim marker contradicts what is asserted here. It lives NEXT TO
|
|
10
10
|
* `command-manifest.mjs` so the change that flips a capability (ships a
|
|
11
11
|
* feature, retires a spelling) is the SAME change that flips the fact this
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
* behavior and this file in the same change, never one without the other.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
export const
|
|
16
|
+
export const VAULT_CAPABILITIES = {
|
|
17
17
|
// `repos access repair` / `repos access revoke-key` /
|
|
18
18
|
// `repos access declare-exposure` (rev 42, D193-D203) drive a real epoch
|
|
19
19
|
// rotation against the gateway — revocation is a live, shipped feature.
|
|
20
20
|
revocation_live: true,
|
|
21
|
-
// `
|
|
21
|
+
// `Repos#reconcileEnvelopeRecipients` (vault-human-envelopes task
|
|
22
22
|
// 4.1's ADD-path workaround) runs automatically after every successful
|
|
23
23
|
// `push()`/`deploy()` and wraps the vault's current epoch key to every org
|
|
24
24
|
// member who has published an encryption key but has no `key_envelope` on
|
|
@@ -34,7 +34,7 @@ export const GITVAULT_CAPABILITIES = {
|
|
|
34
34
|
// fail-closed before allocation; chain-copy dual-write; attested finalize
|
|
35
35
|
// with `storage_verification: "client_attested"`; degraded reads from the
|
|
36
36
|
// destination; fsck absence check) — shipped end to end in the same
|
|
37
|
-
// change that flips this flag (
|
|
37
|
+
// change that flips this flag (vault-byo-primary-bucket, Phase 3).
|
|
38
38
|
byo_live: true,
|
|
39
39
|
// `repos recover` materializes a git repository from a mirror source,
|
|
40
40
|
// offline, with no server call.
|
|
@@ -42,15 +42,15 @@ export const GITVAULT_CAPABILITIES = {
|
|
|
42
42
|
// `repos create` allocates the vault IMMEDIATELY — the moment the repo
|
|
43
43
|
// starts existing — not lazily deferred to first push.
|
|
44
44
|
allocation: "create_immediate",
|
|
45
|
-
// `repos
|
|
45
|
+
// `repos capture` refuses to capture a dirty working tree
|
|
46
46
|
// (`SNAPSHOT_DIRTY_TREE`) by default; `--allow-dirty` opts in explicitly.
|
|
47
|
-
|
|
47
|
+
capture_dirty_default: "refuse",
|
|
48
48
|
// kygit-handoff (design D10): `repos handoff` / `repos resume` mint and
|
|
49
49
|
// claim a real single-use bearer key against a live gateway route —
|
|
50
50
|
// shipped, not aspirational.
|
|
51
51
|
handoff_live: true,
|
|
52
52
|
// `repos handoff` captures dirty work by DEFAULT (the opposite default
|
|
53
|
-
// from `
|
|
53
|
+
// from `capture_dirty_default` above) — two verbs, two defaults, one
|
|
54
54
|
// capture path (design D1).
|
|
55
55
|
handoff_dirty_default: "capture",
|
|
56
56
|
// kygit-invite (design D10): `repos invite` / `repos join` mint and claim
|
|
@@ -59,8 +59,4 @@ export const GITVAULT_CAPABILITIES = {
|
|
|
59
59
|
// while the inviter keeps working.
|
|
60
60
|
invite_live: true,
|
|
61
61
|
join_live: true,
|
|
62
|
-
// Both remote door spellings resolve identically (design D8):
|
|
63
|
-
// `run402::` (canonical, plumbing) and `kygit::` (rendered by
|
|
64
|
-
// `@kychee/kygit` once it sets `RUN402_REMOTE_SCHEME=kygit`).
|
|
65
|
-
remote_schemes: ["run402", "kygit"],
|
|
66
62
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Daemon process entry (
|
|
2
|
+
* Daemon process entry (vault-persistent-helper) — spawned detached by
|
|
3
3
|
* the thin client's fallback path; never invoked by users directly. Enables
|
|
4
4
|
* the compile cache (the daemon compiles the heavy graph exactly once, so
|
|
5
5
|
* this mostly benefits the NEXT daemon after an upgrade), then runs the
|
|
@@ -14,7 +14,7 @@ try {
|
|
|
14
14
|
/* silent by contract */
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
const { runDaemon } = await import("./
|
|
17
|
+
const { runDaemon } = await import("./vault-daemon.mjs");
|
|
18
18
|
try {
|
|
19
19
|
await runDaemon();
|
|
20
20
|
} catch {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The resident helper engine (
|
|
2
|
+
* The resident helper engine (vault-persistent-helper D2–D6).
|
|
3
3
|
*
|
|
4
4
|
* Holds the WARM things — the loaded session module (whose top-level await
|
|
5
5
|
* pulls the whole SDK graph), the owned dispatcher's live h2 connection,
|
|
@@ -53,16 +53,16 @@ export async function runDaemon() {
|
|
|
53
53
|
// Load the heavy module ONCE — this is the entire point of residency.
|
|
54
54
|
// Its top-level await pulls the SDK graph; the prewarm dials the API
|
|
55
55
|
// origin so the first forwarded session rides a warm h2 connection.
|
|
56
|
-
const {
|
|
57
|
-
|
|
56
|
+
const { prewarmVaultConnection, kickVaultConnection, predialVaultObjectStore } = await import("../sdk/dist/node/vault-prewarm.js");
|
|
57
|
+
prewarmVaultConnection();
|
|
58
58
|
const { runHelperSession } = await import("./remote-helper-session.mjs");
|
|
59
|
-
//
|
|
59
|
+
// vault-object-host-predial task 2.2 — narrow, session-scoped imports
|
|
60
60
|
// (not the whole `#sdk/node` barrel) for the OFFLINE repo resolution the
|
|
61
61
|
// session-accept predial needs: a local git subprocess (`rev-parse
|
|
62
62
|
// --absolute-git-dir`) plus a local git-config read, never a network
|
|
63
63
|
// call (design D6).
|
|
64
|
-
const { resolveGitInvocationRepo } = await import("../sdk/dist/node/
|
|
65
|
-
const {
|
|
64
|
+
const { resolveGitInvocationRepo } = await import("../sdk/dist/node/vault-snapshot.js");
|
|
65
|
+
const { readPinnedVaultRepo } = await import("../sdk/dist/node/vault-address.js");
|
|
66
66
|
|
|
67
67
|
const socketPath = daemonSocketPath();
|
|
68
68
|
if (process.platform !== "win32") {
|
|
@@ -107,7 +107,7 @@ export async function runDaemon() {
|
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
|
-
*
|
|
110
|
+
* vault-checkpoint-cadence design D2: `session.backgroundWork` — set
|
|
111
111
|
* by `onBackgroundWork` below when a push's auto-gc cycle was handed
|
|
112
112
|
* off — is a promise this daemon keeps itself alive for BEFORE
|
|
113
113
|
* restoring env/cwd/`busy`, even though the CLIENT already got its
|
|
@@ -176,22 +176,22 @@ export async function runDaemon() {
|
|
|
176
176
|
socket.end();
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
179
|
-
//
|
|
179
|
+
// vault-first-op-premium (design point: pre-connect on session
|
|
180
180
|
// accept). Git's own helper handshake (capabilities/list stdin
|
|
181
181
|
// exchange) buys ~100-200ms of free overlap before the SESSION's
|
|
182
182
|
// first real transport op — kick the owned dispatcher's connection
|
|
183
183
|
// right now, before env/cwd swap even, so a dead/never-dialed
|
|
184
184
|
// socket redials NOW instead of on the verb's critical path. The
|
|
185
|
-
// NARROW half only (`
|
|
186
|
-
// `
|
|
185
|
+
// NARROW half only (`kickVaultConnection`), never the full
|
|
186
|
+
// `prewarmVaultConnection` — that also (re)warms the signer +
|
|
187
187
|
// paid-fetch buyer stack, which this daemon already warmed ONCE at
|
|
188
188
|
// boot; re-running it per session was measured to cost an EXTRA
|
|
189
|
-
// ~150-300ms/session (two live Base RPC probes a
|
|
189
|
+
// ~150-300ms/session (two live Base RPC probes a vault session
|
|
190
190
|
// never needs) for zero benefit. Fire-and-forget by contract
|
|
191
191
|
// (never throws, never awaited, never delays a session).
|
|
192
192
|
const acceptedAt = Date.now();
|
|
193
|
-
|
|
194
|
-
//
|
|
193
|
+
kickVaultConnection();
|
|
194
|
+
// vault-object-host-predial task 2.2 — the addressed repo's
|
|
195
195
|
// persisted object-store origin(s), predialed on the SAME
|
|
196
196
|
// pre-connect timing as the API-origin kick above: resolved from
|
|
197
197
|
// THIS session's OWN `msg.cwd`/`msg.env` (not `process.cwd()`/
|
|
@@ -199,7 +199,7 @@ export async function runDaemon() {
|
|
|
199
199
|
// until the swap below runs) via the same offline, no-network
|
|
200
200
|
// mechanism the session module itself uses once it takes over —
|
|
201
201
|
// `resolveGitInvocationRepo` (a local `git rev-parse
|
|
202
|
-
// --absolute-git-dir`) then `
|
|
202
|
+
// --absolute-git-dir`) then `readPinnedVaultRepo` (a local
|
|
203
203
|
// `git config --local` read). Any resolution failure (no
|
|
204
204
|
// `GIT_DIR`, not a repository, no pin yet) predials nothing —
|
|
205
205
|
// never a network read to learn where to predial (design D6),
|
|
@@ -207,8 +207,8 @@ export async function runDaemon() {
|
|
|
207
207
|
void (async () => {
|
|
208
208
|
try {
|
|
209
209
|
const { repo_dir } = await resolveGitInvocationRepo(msg.env ?? {}, msg.cwd);
|
|
210
|
-
const pinned = await
|
|
211
|
-
if (pinned)
|
|
210
|
+
const pinned = await readPinnedVaultRepo(repo_dir);
|
|
211
|
+
if (pinned) predialVaultObjectStore(pinned.repo_id);
|
|
212
212
|
} catch {
|
|
213
213
|
/* best-effort: must never surface from session accept */
|
|
214
214
|
}
|
|
@@ -258,18 +258,18 @@ export async function runDaemon() {
|
|
|
258
258
|
};
|
|
259
259
|
session = { stdin, restoreEnv, restoreCwd, restoreWrites, backgroundWork: null };
|
|
260
260
|
send({ t: "ready" });
|
|
261
|
-
//
|
|
261
|
+
// vault-first-op-premium task 1.1: phase stamps for attribution
|
|
262
262
|
// (session accept -> env ready -> first transport call, the last
|
|
263
|
-
// covered by the existing
|
|
263
|
+
// covered by the existing RUN402_VAULT_TRACE per-op lines).
|
|
264
264
|
// Emitted AFTER write-redirection so they ride the socket to the
|
|
265
265
|
// client and land in the SAME trace stream the bench harness
|
|
266
266
|
// already captures — gated on the session's own env, exactly like
|
|
267
|
-
// every other
|
|
268
|
-
if (process.env.
|
|
269
|
-
process.stderr.write(`
|
|
270
|
-
process.stderr.write(`
|
|
267
|
+
// every other vault-trace line.
|
|
268
|
+
if (process.env.RUN402_VAULT_TRACE === "1") {
|
|
269
|
+
process.stderr.write(`vault-trace: daemon session-accept ${sessionsServed} at ${acceptedAt}\n`);
|
|
270
|
+
process.stderr.write(`vault-trace: daemon env-ready ${sessionsServed} +${envReadyAt - acceptedAt}ms\n`);
|
|
271
271
|
}
|
|
272
|
-
//
|
|
272
|
+
// vault-checkpoint-cadence design D2: a push's auto-gc cycle
|
|
273
273
|
// (if triggered) hands its ALREADY-STARTED promise here instead
|
|
274
274
|
// of being awaited inline — `runHelperSession` itself still
|
|
275
275
|
// resolves at push speed, so `exit`/`socket.end()` below reach
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* `run402 init`'s 5b block pioneered this pattern; this module is the same
|
|
5
5
|
* additive-only, non-fatal-in-every-branch scaffold factored out so
|
|
6
6
|
* `run402 up` and `run402 repos create` report through the IDENTICAL
|
|
7
|
-
* `
|
|
7
|
+
* `vault` / `vault_skipped` / `vault_error` summary keys `init`
|
|
8
8
|
* already uses (plus `status` / `reason` / `toplevel`), instead of
|
|
9
9
|
* near-copies drifting apart. `projects provision` never scaffolds: it is
|
|
10
10
|
* the provisioning primitive and has no local side effects. `init.mjs` itself is left untouched — its own scaffold block is
|
|
@@ -32,12 +32,12 @@ import { resolveOwningOrgId } from "./org-context.mjs";
|
|
|
32
32
|
* @param {string} options.projectId The project the remote should point at.
|
|
33
33
|
* @param {string} [options.orgId] Explicit owning org. Resolved via `resolveOwningOrgId` when omitted.
|
|
34
34
|
* @param {boolean} [options.createRepoIfMissing] Opt into `git init`-ing `repoDir` when it is not a repository yet.
|
|
35
|
-
* @param {boolean} [options.nested] Scaffold `repoDir` as its OWN repository even when it lies inside another one (`
|
|
35
|
+
* @param {boolean} [options.nested] Scaffold `repoDir` as its OWN repository even when it lies inside another one (`Repos.scaffoldRemote`'s `nested`).
|
|
36
36
|
* @param {string} [options.nestedCommand] The caller's own `--nested` spelling for the `create_nested_repo` next_action (default: the SDK's `run402 repos create --nested --project <project_id>`).
|
|
37
|
-
* @returns {Promise<{status: "scaffolded"|"skipped"|"error", reason?: string, toplevel?: string|null, next_actions?: object[],
|
|
37
|
+
* @returns {Promise<{status: "scaffolded"|"skipped"|"error", reason?: string, toplevel?: string|null, next_actions?: object[], vault: object|null, vault_skipped?: string, vault_error?: {code: string, message: string}}>}
|
|
38
38
|
*/
|
|
39
|
-
export async function
|
|
40
|
-
const out = {
|
|
39
|
+
export async function scaffoldVaultRemote({ repoDir = process.cwd(), projectId, orgId, createRepoIfMissing = false, nested = false, nestedCommand } = {}) {
|
|
40
|
+
const out = { vault: null, status: "skipped" };
|
|
41
41
|
try {
|
|
42
42
|
const { hardenedGit } = await import("#sdk/node");
|
|
43
43
|
let insideRepo = true;
|
|
@@ -48,16 +48,16 @@ export async function scaffoldGitvaultRemote({ repoDir = process.cwd(), projectI
|
|
|
48
48
|
}
|
|
49
49
|
if (!insideRepo && !createRepoIfMissing) {
|
|
50
50
|
out.reason = "not_a_repository";
|
|
51
|
-
out.
|
|
51
|
+
out.vault_skipped = "not a git repository — re-run with --git-remote to create one and add the remote";
|
|
52
52
|
return out;
|
|
53
53
|
}
|
|
54
54
|
const resolvedOrgId = orgId ?? (await resolveOwningOrgId(projectId));
|
|
55
55
|
if (!resolvedOrgId) {
|
|
56
56
|
out.reason = "org_unresolved";
|
|
57
|
-
out.
|
|
57
|
+
out.vault_skipped = `could not resolve the owning org for ${projectId} — the run402 remote was not added`;
|
|
58
58
|
return out;
|
|
59
59
|
}
|
|
60
|
-
const remote = await getSdk().
|
|
60
|
+
const remote = await getSdk().repos.scaffoldRemote({ repo_dir: repoDir, org_id: resolvedOrgId, project_id: projectId, ...(nested ? { nested: true } : {}) });
|
|
61
61
|
if (remote.status === "skipped") {
|
|
62
62
|
// The app root lies INSIDE some other repository (first-deploy-agent-dx
|
|
63
63
|
// D3): that repository is never touched. Say which one, why, and the
|
|
@@ -66,7 +66,7 @@ export async function scaffoldGitvaultRemote({ repoDir = process.cwd(), projectI
|
|
|
66
66
|
// --nested`), so the command printed is the one the agent just ran.
|
|
67
67
|
out.reason = "inside_other_repository";
|
|
68
68
|
out.toplevel = remote.toplevel ?? null;
|
|
69
|
-
out.
|
|
69
|
+
out.vault_skipped = remote.reason;
|
|
70
70
|
out.next_actions = (remote.next_actions ?? []).map((action) =>
|
|
71
71
|
action.type === "create_nested_repo" && nestedCommand ? { ...action, command: nestedCommand } : action,
|
|
72
72
|
);
|
|
@@ -76,11 +76,11 @@ export async function scaffoldGitvaultRemote({ repoDir = process.cwd(), projectI
|
|
|
76
76
|
// git only — no vault exists for the project yet (allocation happens
|
|
77
77
|
// lazily on first push, or explicitly via `run402 repos create --project <project_id>`).
|
|
78
78
|
out.status = "scaffolded";
|
|
79
|
-
out.
|
|
79
|
+
out.vault = { ...remote, allocated: false };
|
|
80
80
|
} catch (err) {
|
|
81
|
-
out.
|
|
81
|
+
out.vault = null;
|
|
82
82
|
out.status = "error";
|
|
83
|
-
out.
|
|
83
|
+
out.vault_error = { code: err?.body?.code ?? err?.code ?? "VAULT_SCAFFOLD_FAILED", message: err?.message ?? String(err) };
|
|
84
84
|
}
|
|
85
85
|
return out;
|
|
86
86
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared "which vault does this repo mean" resolution for `run402
|
|
3
|
-
* and `run402 doctor`'s
|
|
2
|
+
* Shared "which vault does this repo mean" resolution for `run402 repos`
|
|
3
|
+
* and `run402 doctor`'s vault check. When a verb runs standing inside a
|
|
4
4
|
* repository that already names its own vault via a pinned repo id or a
|
|
5
5
|
* run402/origin remote, targeting prefers that repo over the active-project
|
|
6
6
|
* pointer — git muscle memory says a command run inside a repo acts on THAT
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
* and 5 apply.
|
|
26
26
|
*
|
|
27
27
|
* ARCHITECTURAL NOTE: this is CLI-edge policy (which flag/env/file wins),
|
|
28
|
-
* not
|
|
28
|
+
* not vault protocol behavior — the same class of concern
|
|
29
29
|
* `wallet-context.mjs` owns for wallet selection. The protocol reads it
|
|
30
|
-
* composes (`
|
|
30
|
+
* composes (`readPinnedVaultRepo`, `resolveAddress`) already live once in
|
|
31
31
|
* the SDK; this module adds no protocol logic of its own.
|
|
32
32
|
*/
|
|
33
33
|
import { getActiveProjectId } from "./config.mjs";
|
|
@@ -35,12 +35,12 @@ import { getActiveProjectId } from "./config.mjs";
|
|
|
35
35
|
/**
|
|
36
36
|
* Tiers 4/5 (RUN402_PROJECT_ID env, then the active project) — deliberately
|
|
37
37
|
* NON-throwing, unlike `config.mjs#resolveProjectId`. `run402 doctor`'s
|
|
38
|
-
*
|
|
38
|
+
* vault check needs to report "skipped" gracefully when nothing resolves
|
|
39
39
|
* anywhere (its pre-existing, tested behavior); a `fail()`-triggered
|
|
40
40
|
* `process.exit()` here would abort doctor's ENTIRE report, not just this
|
|
41
41
|
* one check. Callers that DO want the historical PROJECT_REQUIRED failure
|
|
42
|
-
* (
|
|
43
|
-
* themselves when this returns `null` — see `vaultTarget` in
|
|
42
|
+
* (vault.mjs's own verbs) get it by falling back to `resolveProjectId`
|
|
43
|
+
* themselves when this returns `null` — see `vaultTarget` in vault.mjs.
|
|
44
44
|
*/
|
|
45
45
|
function envOrActiveProjectId() {
|
|
46
46
|
return (process.env.RUN402_PROJECT_ID || "").trim() || getActiveProjectId() || null;
|
|
@@ -63,14 +63,14 @@ async function isInsideGitRepo(repoDir) {
|
|
|
63
63
|
* repository at all, or (slug-form only) the remote fails to resolve over
|
|
64
64
|
* the network — a miss here is always ordinary, never thrown.
|
|
65
65
|
*/
|
|
66
|
-
export async function
|
|
66
|
+
export async function repoOwnVaultTarget(repoDir) {
|
|
67
67
|
if (!(await isInsideGitRepo(repoDir))) return null;
|
|
68
68
|
|
|
69
|
-
const { hardenedGit,
|
|
70
|
-
const pinned = await
|
|
69
|
+
const { hardenedGit, readPinnedVaultRepo } = await import("#sdk/node");
|
|
70
|
+
const pinned = await readPinnedVaultRepo(repoDir);
|
|
71
71
|
if (pinned) return { repo_id: pinned.repo_id, project_id: null, source: "pin" };
|
|
72
72
|
|
|
73
|
-
const {
|
|
73
|
+
const { parseVaultRemoteUrl, vaultRemoteAddressForm } = await import("#sdk");
|
|
74
74
|
for (const name of ["run402", "origin"]) {
|
|
75
75
|
let url;
|
|
76
76
|
try {
|
|
@@ -79,16 +79,21 @@ export async function repoOwnGitvaultTarget(repoDir) {
|
|
|
79
79
|
continue; // no such remote — try the other conventional name
|
|
80
80
|
}
|
|
81
81
|
if (!url) continue;
|
|
82
|
-
|
|
82
|
+
let address;
|
|
83
|
+
try {
|
|
84
|
+
address = parseVaultRemoteUrl(url);
|
|
85
|
+
} catch {
|
|
86
|
+
continue; // another scheme's remote — not a vault address
|
|
87
|
+
}
|
|
83
88
|
if (!address) continue; // exists, but isn't a run402 address — try the other name
|
|
84
|
-
if (
|
|
89
|
+
if (vaultRemoteAddressForm(address) === "id") {
|
|
85
90
|
// id-form already carries both halves in the address string — no
|
|
86
91
|
// network read needed at all.
|
|
87
92
|
return { repo_id: null, project_id: address.project_id, source: "remote", remote_name: name };
|
|
88
93
|
}
|
|
89
94
|
try {
|
|
90
95
|
const { getSdk } = await import("./sdk.mjs");
|
|
91
|
-
const resolved = await getSdk().
|
|
96
|
+
const resolved = await getSdk().repos.resolveAddress(address);
|
|
92
97
|
return { repo_id: resolved.repo_id, project_id: resolved.project_id, source: "remote", remote_name: name };
|
|
93
98
|
} catch {
|
|
94
99
|
// Offline, SLUG_RELEASED, not-found, ... — nothing to target from this
|
|
@@ -100,7 +105,7 @@ export async function repoOwnGitvaultTarget(repoDir) {
|
|
|
100
105
|
}
|
|
101
106
|
|
|
102
107
|
/**
|
|
103
|
-
* Resolve `{ repo_id?, project_id? }` for a
|
|
108
|
+
* Resolve `{ repo_id?, project_id? }` for a vault verb that addresses a
|
|
104
109
|
* vault the same way `--repo`/`--project` already do — pin beats remote
|
|
105
110
|
* beats env beats active project, an explicit flag beats all of them.
|
|
106
111
|
* `explicitProjectId`/`explicitRepoId` are the already-parsed flag values
|
|
@@ -114,14 +119,14 @@ export async function repoOwnGitvaultTarget(repoDir) {
|
|
|
114
119
|
* only `--project` is checked against it — matching the task's own wording
|
|
115
120
|
* ("a mismatch between an explicit flag and the repo's remote").
|
|
116
121
|
*/
|
|
117
|
-
export async function
|
|
122
|
+
export async function resolveVaultTarget({
|
|
118
123
|
repoDir = process.cwd(),
|
|
119
124
|
explicitProjectId,
|
|
120
125
|
explicitRepoId,
|
|
121
126
|
warn = (line) => console.error(line),
|
|
122
127
|
} = {}) {
|
|
123
128
|
const needsOwn = explicitRepoId == null || explicitProjectId == null;
|
|
124
|
-
const own = needsOwn ? await
|
|
129
|
+
const own = needsOwn ? await repoOwnVaultTarget(repoDir) : null;
|
|
125
130
|
|
|
126
131
|
if (explicitRepoId != null && own?.source === "pin" && own.repo_id !== explicitRepoId) {
|
|
127
132
|
warn(`warning: --repo ${explicitRepoId} does not match this repo's pinned vault ${own.repo_id} — using --repo ${explicitRepoId}.`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "run402",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.97.0",
|
|
4
4
|
"description": "CLI for Run402 — full-stack backend infrastructure for AI agents: Postgres, auth, storage, serverless functions and atomic deploys. Paid with x402/MPP. Includes $0.03 image generation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"fixtures/",
|
|
22
22
|
"core-dist/",
|
|
23
23
|
"sdk/",
|
|
24
|
-
"
|
|
24
|
+
"vault-surface.json"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@hpke/chacha20poly1305": "^1.8.0",
|
|
@@ -190,7 +190,7 @@ export function removeProject(projectId, path) {
|
|
|
190
190
|
* bucket, not "unknown") and PERMANENTLY shadows every later wallet-scoped
|
|
191
191
|
* activation for every caller that reads through this module: `resolveProjectId`
|
|
192
192
|
* / `resolveProject` (cli/lib/config.mjs), `projects current`, and every
|
|
193
|
-
*
|
|
193
|
+
* vault-verb target resolution. The failure it causes: `repos create`
|
|
194
194
|
* calls `projects.provision`, whose `creds.setActiveProject` correctly
|
|
195
195
|
* persists the new project under the real wallet's scoped bucket AND the
|
|
196
196
|
* flat fallback, yet every CLI read of "the active project" resolves the
|
package/sdk/dist/errors.d.ts
CHANGED
|
@@ -120,7 +120,7 @@ export declare class ProjectNotFound extends Run402Error {
|
|
|
120
120
|
* `NOT_AUTHORIZED`, `STEP_UP_REQUIRED`) — since 402 is reserved for
|
|
121
121
|
* genuine payment challenges, this now also covers non-payment 403 denials
|
|
122
122
|
* such as quota (`QUOTA_EXCEEDED`), lifecycle (`PROJECT_FROZEN` /
|
|
123
|
-
* `PROJECT_DORMANT`), and
|
|
123
|
+
* `PROJECT_DORMANT`), and grant-key spend-cap denials. Check `body.code` (or
|
|
124
124
|
* use `formatCanonicalErrorContext`-style parsing) to distinguish these
|
|
125
125
|
* from a true auth failure.
|
|
126
126
|
*/
|
|
@@ -340,19 +340,19 @@ export declare class TransferFreezeError extends Run402Error {
|
|
|
340
340
|
* name was not claimed). `push_repo`, `verify_refs`, `submit_gc`,
|
|
341
341
|
* `use_moved_command`, and `access_repair_pending` are repo-surface-
|
|
342
342
|
* consolidation's own additions — see `cli/lib/repos.mjs` for where each is
|
|
343
|
-
* emitted. `configure_mirror` (
|
|
343
|
+
* emitted. `configure_mirror` (vault-mirror-default) rides `repos create`'s
|
|
344
344
|
* result beside the recovery receipt — the customer-owned mirror taught at
|
|
345
|
-
* vault birth. `sync_writers` / `request_writer_sync` (
|
|
345
|
+
* vault birth. `sync_writers` / `request_writer_sync` (vault-multi-writer
|
|
346
346
|
* rev 47, D10) are the writer dimension's own pair — `sync_writers` rides
|
|
347
347
|
* `POST /orgs/v1/:org_id/members`'s own gateway response (the caller's next
|
|
348
348
|
* `orgs members add`/`repos access sync` admits a just-added member as a
|
|
349
349
|
* writer on every vault it can reach); `request_writer_sync` is CLIENT-
|
|
350
|
-
* constructed (`
|
|
350
|
+
* constructed (`Vault#assertCallerIsWriter`, task 5.8) when a local
|
|
351
351
|
* push pre-check refuses because this session's own key is not (or is no
|
|
352
352
|
* longer) an admitted writer.
|
|
353
353
|
* Tolerates unknown future gateway types via the `(string & {})` fallback.
|
|
354
354
|
*/
|
|
355
|
-
export type NextActionType = "retry" | "poll" | "reconcile_payment" | "authenticate" | "submit_payment" | "renew_tier" | "check_usage" | "resume_deploy" | "edit_request" | "edit_migration" | "create_project" | "initialize_wallet" | "deploy" | "approve_write" | "hand_to_member" | "register_contact" | "contact_staff" | "contact_support" | "
|
|
355
|
+
export type NextActionType = "retry" | "poll" | "reconcile_payment" | "authenticate" | "submit_payment" | "renew_tier" | "check_usage" | "resume_deploy" | "edit_request" | "edit_migration" | "create_project" | "initialize_wallet" | "deploy" | "approve_write" | "hand_to_member" | "register_contact" | "contact_staff" | "contact_support" | "vault_policy_required" | "set_org_slug" | "set_repo_name" | "push_repo" | "create_nested_repo" | "verify_refs" | "submit_gc" | "use_moved_command" | "access_repair_pending" | "configure_mirror" | "resume_handoff" | "revoke_handoff" | "remove_member" | "sync_writers" | "request_writer_sync" | "join_invite" | "revoke_invite" | "wait_room" | "send_room_message" | "create_manifest" | "create_file" | "check_manifest" | "run_in_directory" | "commit_changes" | "add_subdomain";
|
|
356
356
|
/**
|
|
357
357
|
* A single advisory "what to do next" entry. Mirrors the gateway's
|
|
358
358
|
* `next_actions[]` shape (`{ type, method?, path?, auth?, why? }`) extended with
|