@run402/sdk 4.94.0 → 4.96.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 +44 -44
- package/core-dist/keystore.d.ts +1 -1
- package/core-dist/keystore.js +1 -1
- package/dist/actions.d.ts +3 -3
- package/dist/actions.d.ts.map +1 -1
- package/dist/app-up.d.ts +2 -2
- package/dist/app-up.d.ts.map +1 -1
- package/dist/config.d.ts +1 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/credentials.d.ts +1 -1
- package/dist/errors.d.ts +6 -6
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/namespaces/admin.d.ts +1 -1
- package/dist/namespaces/admin.d.ts.map +1 -1
- package/dist/namespaces/ai.d.ts +1 -1
- package/dist/namespaces/ai.js +2 -2
- package/dist/namespaces/ai.js.map +1 -1
- package/dist/namespaces/assets.js +1 -1
- package/dist/namespaces/assets.js.map +1 -1
- package/dist/namespaces/ci.js +3 -3
- package/dist/namespaces/ci.js.map +1 -1
- package/dist/namespaces/deploy.d.ts +5 -5
- package/dist/namespaces/deploy.d.ts.map +1 -1
- package/dist/namespaces/deploy.js +45 -46
- package/dist/namespaces/deploy.js.map +1 -1
- package/dist/namespaces/deploy.types.d.ts +19 -19
- package/dist/namespaces/deploy.types.d.ts.map +1 -1
- package/dist/namespaces/domains.d.ts +10 -2
- package/dist/namespaces/domains.d.ts.map +1 -1
- package/dist/namespaces/domains.js +10 -5
- package/dist/namespaces/domains.js.map +1 -1
- package/dist/namespaces/errors.js +1 -1
- package/dist/namespaces/functions.js +1 -1
- package/dist/namespaces/functions.js.map +1 -1
- package/dist/namespaces/org.d.ts +2 -2
- package/dist/namespaces/org.js +2 -2
- package/dist/namespaces/org.types.d.ts +3 -3
- package/dist/namespaces/pay.js +1 -1
- package/dist/namespaces/{gitvault.d.ts → repos.d.ts} +438 -451
- package/dist/namespaces/repos.d.ts.map +1 -0
- package/dist/namespaces/{gitvault.js → repos.js} +454 -462
- package/dist/namespaces/repos.js.map +1 -0
- package/dist/namespaces/rooms.js +2 -2
- package/dist/namespaces/rooms.js.map +1 -1
- package/dist/namespaces/session.d.ts +2 -2
- package/dist/namespaces/session.d.ts.map +1 -1
- package/dist/namespaces/session.js +2 -2
- package/dist/namespaces/session.js.map +1 -1
- package/dist/namespaces/tier.d.ts +4 -4
- package/dist/namespaces/tier.d.ts.map +1 -1
- package/dist/namespaces/transfers.d.ts +46 -15
- package/dist/namespaces/transfers.d.ts.map +1 -1
- package/dist/namespaces/transfers.js.map +1 -1
- package/dist/namespaces/{gitvault.crypto.d.ts → vault.crypto.d.ts} +141 -141
- package/dist/namespaces/vault.crypto.d.ts.map +1 -0
- package/dist/namespaces/{gitvault.crypto.js → vault.crypto.js} +173 -173
- package/dist/namespaces/vault.crypto.js.map +1 -0
- package/dist/namespaces/{gitvault.types.d.ts → vault.types.d.ts} +136 -136
- package/dist/namespaces/vault.types.d.ts.map +1 -0
- package/dist/namespaces/{gitvault.types.js → vault.types.js} +4 -4
- package/dist/namespaces/vault.types.js.map +1 -0
- package/dist/node/actions-node.js +8 -8
- package/dist/node/actions-node.js.map +1 -1
- package/dist/node/assets-node.js +6 -6
- package/dist/node/assets-node.js.map +1 -1
- package/dist/node/bearer-redeem-key.d.ts +1 -1
- package/dist/node/bearer-redeem-key.js +5 -5
- package/dist/node/bearer-redeem-key.js.map +1 -1
- package/dist/node/ci.js +1 -1
- package/dist/node/ci.js.map +1 -1
- package/dist/node/credentials.d.ts +1 -1
- package/dist/node/credentials.js +1 -1
- package/dist/node/deploy-manifest.d.ts +3 -5
- package/dist/node/deploy-manifest.d.ts.map +1 -1
- package/dist/node/deploy-manifest.js +3 -12
- package/dist/node/deploy-manifest.js.map +1 -1
- package/dist/node/http-dispatcher.js +5 -5
- package/dist/node/http-dispatcher.js.map +1 -1
- package/dist/node/index.d.ts +29 -29
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +39 -39
- package/dist/node/index.js.map +1 -1
- package/dist/node/manifest-export.js +2 -2
- package/dist/node/manifest-export.js.map +1 -1
- package/dist/node/org-adopt.js +1 -1
- package/dist/node/org-adopt.js.map +1 -1
- package/dist/node/sites-node.js +1 -1
- package/dist/node/sites-node.js.map +1 -1
- package/dist/node/{gitvault-address.d.ts → vault-address.d.ts} +42 -42
- package/dist/node/vault-address.d.ts.map +1 -0
- package/dist/node/{gitvault-address.js → vault-address.js} +43 -43
- package/dist/node/vault-address.js.map +1 -0
- package/dist/node/{gitvault-apply.d.ts → vault-apply.d.ts} +27 -27
- package/dist/node/vault-apply.d.ts.map +1 -0
- package/dist/node/{gitvault-apply.js → vault-apply.js} +38 -38
- package/dist/node/vault-apply.js.map +1 -0
- package/dist/node/vault-byo-config.d.ts +29 -0
- package/dist/node/vault-byo-config.d.ts.map +1 -0
- package/dist/node/{gitvault-byo-config.js → vault-byo-config.js} +18 -18
- package/dist/node/vault-byo-config.js.map +1 -0
- package/dist/node/vault-byo-probe.d.ts +20 -0
- package/dist/node/vault-byo-probe.d.ts.map +1 -0
- package/dist/node/vault-byo-probe.js +57 -0
- package/dist/node/vault-byo-probe.js.map +1 -0
- package/dist/node/{gitvault-creation-journal.d.ts → vault-creation-journal.d.ts} +69 -69
- package/dist/node/vault-creation-journal.d.ts.map +1 -0
- package/dist/node/{gitvault-creation-journal.js → vault-creation-journal.js} +54 -54
- package/dist/node/vault-creation-journal.js.map +1 -0
- package/dist/node/{gitvault-degraded-read.d.ts → vault-degraded-read.d.ts} +34 -34
- package/dist/node/vault-degraded-read.d.ts.map +1 -0
- package/dist/node/{gitvault-degraded-read.js → vault-degraded-read.js} +24 -24
- package/dist/node/vault-degraded-read.js.map +1 -0
- package/dist/node/{gitvault-deploy.d.ts → vault-deploy.d.ts} +67 -67
- package/dist/node/vault-deploy.d.ts.map +1 -0
- package/dist/node/{gitvault-deploy.js → vault-deploy.js} +27 -27
- package/dist/node/vault-deploy.js.map +1 -0
- package/dist/node/{gitvault-edge-fetch.d.ts → vault-edge-fetch.d.ts} +9 -9
- package/dist/node/vault-edge-fetch.d.ts.map +1 -0
- package/dist/node/{gitvault-edge-fetch.js → vault-edge-fetch.js} +11 -11
- package/dist/node/vault-edge-fetch.js.map +1 -0
- package/dist/node/{gitvault-handoff.d.ts → vault-handoff.d.ts} +9 -9
- package/dist/node/vault-handoff.d.ts.map +1 -0
- package/dist/node/{gitvault-handoff.js → vault-handoff.js} +24 -24
- package/dist/node/vault-handoff.js.map +1 -0
- package/dist/node/{gitvault-keystore.d.ts → vault-keystore.d.ts} +87 -77
- package/dist/node/vault-keystore.d.ts.map +1 -0
- package/dist/node/{gitvault-keystore.js → vault-keystore.js} +105 -68
- package/dist/node/vault-keystore.js.map +1 -0
- package/dist/node/{gitvault-member-bundle.d.ts → vault-member-bundle.d.ts} +17 -17
- package/dist/node/vault-member-bundle.d.ts.map +1 -0
- package/dist/node/{gitvault-member-bundle.js → vault-member-bundle.js} +11 -11
- package/dist/node/vault-member-bundle.js.map +1 -0
- package/dist/node/{gitvault-mirror-backend.d.ts → vault-mirror-backend.d.ts} +26 -26
- package/dist/node/vault-mirror-backend.d.ts.map +1 -0
- package/dist/node/{gitvault-mirror-backend.js → vault-mirror-backend.js} +25 -25
- package/dist/node/vault-mirror-backend.js.map +1 -0
- package/dist/node/{gitvault-mirror-config.d.ts → vault-mirror-config.d.ts} +23 -23
- package/dist/node/vault-mirror-config.d.ts.map +1 -0
- package/dist/node/{gitvault-mirror-config.js → vault-mirror-config.js} +16 -16
- package/dist/node/vault-mirror-config.js.map +1 -0
- package/dist/node/{gitvault-mirror.d.ts → vault-mirror.d.ts} +36 -36
- package/dist/node/vault-mirror.d.ts.map +1 -0
- package/dist/node/{gitvault-mirror.js → vault-mirror.js} +75 -75
- package/dist/node/vault-mirror.js.map +1 -0
- package/dist/node/{gitvault-native-crypto.d.ts → vault-native-crypto.d.ts} +10 -10
- package/dist/node/vault-native-crypto.d.ts.map +1 -0
- package/dist/node/{gitvault-native-crypto.js → vault-native-crypto.js} +16 -16
- package/dist/node/vault-native-crypto.js.map +1 -0
- package/dist/node/{gitvault-open-or-create.d.ts → vault-open-or-create.d.ts} +16 -16
- package/dist/node/vault-open-or-create.d.ts.map +1 -0
- package/dist/node/{gitvault-open-or-create.js → vault-open-or-create.js} +10 -10
- package/dist/node/vault-open-or-create.js.map +1 -0
- package/dist/node/{gitvault-prewarm.d.ts → vault-prewarm.d.ts} +13 -13
- package/dist/node/vault-prewarm.d.ts.map +1 -0
- package/dist/node/{gitvault-prewarm.js → vault-prewarm.js} +25 -25
- package/dist/node/vault-prewarm.js.map +1 -0
- package/dist/node/{gitvault-profile-scan.d.ts → vault-profile-scan.d.ts} +3 -3
- package/dist/node/vault-profile-scan.d.ts.map +1 -0
- package/dist/node/{gitvault-profile-scan.js → vault-profile-scan.js} +12 -12
- package/dist/node/vault-profile-scan.js.map +1 -0
- package/dist/node/{gitvault-prune.d.ts → vault-prune.d.ts} +61 -61
- package/dist/node/vault-prune.d.ts.map +1 -0
- package/dist/node/{gitvault-prune.js → vault-prune.js} +34 -34
- package/dist/node/vault-prune.js.map +1 -0
- package/dist/node/{gitvault-publication.d.ts → vault-publication.d.ts} +399 -399
- package/dist/node/vault-publication.d.ts.map +1 -0
- package/dist/node/{gitvault-publication.js → vault-publication.js} +584 -584
- package/dist/node/vault-publication.js.map +1 -0
- package/dist/node/{gitvault-push-to-create.d.ts → vault-push-to-create.d.ts} +16 -16
- package/dist/node/vault-push-to-create.d.ts.map +1 -0
- package/dist/node/{gitvault-push-to-create.js → vault-push-to-create.js} +9 -9
- package/dist/node/vault-push-to-create.js.map +1 -0
- package/dist/node/{gitvault-recover.d.ts → vault-recover.d.ts} +50 -50
- package/dist/node/vault-recover.d.ts.map +1 -0
- package/dist/node/{gitvault-recover.js → vault-recover.js} +84 -84
- package/dist/node/vault-recover.js.map +1 -0
- package/dist/node/{gitvault-restore.d.ts → vault-restore.d.ts} +8 -8
- package/dist/node/vault-restore.d.ts.map +1 -0
- package/dist/node/{gitvault-restore.js → vault-restore.js} +11 -11
- package/dist/node/vault-restore.js.map +1 -0
- package/dist/node/{gitvault-snapshot.d.ts → vault-snapshot.d.ts} +48 -48
- package/dist/node/vault-snapshot.d.ts.map +1 -0
- package/dist/node/{gitvault-snapshot.js → vault-snapshot.js} +61 -61
- package/dist/node/vault-snapshot.js.map +1 -0
- package/dist/node/{gitvault-writer-state.d.ts → vault-writer-state.d.ts} +8 -8
- package/dist/node/vault-writer-state.d.ts.map +1 -0
- package/dist/node/{gitvault-writer-state.js → vault-writer-state.js} +15 -15
- package/dist/node/vault-writer-state.js.map +1 -0
- package/dist/node/workflow-output.js +4 -4
- package/dist/node/workflow-output.js.map +1 -1
- package/dist/scoped.d.ts +8 -8
- package/dist/scoped.d.ts.map +1 -1
- package/dist/scoped.js +3 -3
- package/dist/scoped.js.map +1 -1
- package/package.json +1 -1
- package/dist/namespaces/gitvault.crypto.d.ts.map +0 -1
- package/dist/namespaces/gitvault.crypto.js.map +0 -1
- package/dist/namespaces/gitvault.d.ts.map +0 -1
- package/dist/namespaces/gitvault.js.map +0 -1
- package/dist/namespaces/gitvault.types.d.ts.map +0 -1
- package/dist/namespaces/gitvault.types.js.map +0 -1
- package/dist/node/gitvault-address.d.ts.map +0 -1
- package/dist/node/gitvault-address.js.map +0 -1
- package/dist/node/gitvault-apply.d.ts.map +0 -1
- package/dist/node/gitvault-apply.js.map +0 -1
- package/dist/node/gitvault-byo-config.d.ts +0 -29
- package/dist/node/gitvault-byo-config.d.ts.map +0 -1
- package/dist/node/gitvault-byo-config.js.map +0 -1
- package/dist/node/gitvault-byo-probe.d.ts +0 -20
- package/dist/node/gitvault-byo-probe.d.ts.map +0 -1
- package/dist/node/gitvault-byo-probe.js +0 -57
- package/dist/node/gitvault-byo-probe.js.map +0 -1
- package/dist/node/gitvault-creation-journal.d.ts.map +0 -1
- package/dist/node/gitvault-creation-journal.js.map +0 -1
- package/dist/node/gitvault-degraded-read.d.ts.map +0 -1
- package/dist/node/gitvault-degraded-read.js.map +0 -1
- package/dist/node/gitvault-deploy.d.ts.map +0 -1
- package/dist/node/gitvault-deploy.js.map +0 -1
- package/dist/node/gitvault-edge-fetch.d.ts.map +0 -1
- package/dist/node/gitvault-edge-fetch.js.map +0 -1
- package/dist/node/gitvault-handoff.d.ts.map +0 -1
- package/dist/node/gitvault-handoff.js.map +0 -1
- package/dist/node/gitvault-keystore.d.ts.map +0 -1
- package/dist/node/gitvault-keystore.js.map +0 -1
- package/dist/node/gitvault-member-bundle.d.ts.map +0 -1
- package/dist/node/gitvault-member-bundle.js.map +0 -1
- package/dist/node/gitvault-mirror-backend.d.ts.map +0 -1
- package/dist/node/gitvault-mirror-backend.js.map +0 -1
- package/dist/node/gitvault-mirror-config.d.ts.map +0 -1
- package/dist/node/gitvault-mirror-config.js.map +0 -1
- package/dist/node/gitvault-mirror.d.ts.map +0 -1
- package/dist/node/gitvault-mirror.js.map +0 -1
- package/dist/node/gitvault-native-crypto.d.ts.map +0 -1
- package/dist/node/gitvault-native-crypto.js.map +0 -1
- package/dist/node/gitvault-open-or-create.d.ts.map +0 -1
- package/dist/node/gitvault-open-or-create.js.map +0 -1
- package/dist/node/gitvault-prewarm.d.ts.map +0 -1
- package/dist/node/gitvault-prewarm.js.map +0 -1
- package/dist/node/gitvault-profile-scan.d.ts.map +0 -1
- package/dist/node/gitvault-profile-scan.js.map +0 -1
- package/dist/node/gitvault-prune.d.ts.map +0 -1
- package/dist/node/gitvault-prune.js.map +0 -1
- package/dist/node/gitvault-publication.d.ts.map +0 -1
- package/dist/node/gitvault-publication.js.map +0 -1
- package/dist/node/gitvault-push-to-create.d.ts.map +0 -1
- package/dist/node/gitvault-push-to-create.js.map +0 -1
- package/dist/node/gitvault-recover.d.ts.map +0 -1
- package/dist/node/gitvault-recover.js.map +0 -1
- package/dist/node/gitvault-restore.d.ts.map +0 -1
- package/dist/node/gitvault-restore.js.map +0 -1
- package/dist/node/gitvault-snapshot.d.ts.map +0 -1
- package/dist/node/gitvault-snapshot.js.map +0 -1
- package/dist/node/gitvault-writer-state.d.ts.map +0 -1
- package/dist/node/gitvault-writer-state.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* vault-byo-primary-bucket — degraded read mode (design D4, task 3.4,
|
|
3
3
|
* MIRROR HALF ONLY). Turns a gateway chain/payload read that fails with a
|
|
4
4
|
* NETWORK-CLASS error into a transparent fallback served from the vault's
|
|
5
5
|
* client-side mirror, so `git fetch`/`clone` keep working while run402 is
|
|
6
6
|
* down.
|
|
7
7
|
*
|
|
8
8
|
* This is deliberately NOT a second implementation of anything: the fallback
|
|
9
|
-
* reuses `r402s-recover` (`
|
|
9
|
+
* reuses `r402s-recover` (`vault-recover.ts`'s `recoverVaultMirror`)
|
|
10
10
|
* verbatim — the SAME chain-verification, absence adjudication, and
|
|
11
11
|
* decrypt/materialize machinery `run402 repos recover` already ships. The
|
|
12
12
|
* module doc there says it plainly: "recovery is the keyed offline subset
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
*
|
|
19
19
|
* Local trust: this module never touches the LIVE vault's own keystore pins
|
|
20
20
|
* (`head_pin` / `verified_prefix` / `materialized_pin`, written by
|
|
21
|
-
* `
|
|
22
|
-
* a degraded read runs an entirely separate engine (`
|
|
21
|
+
* `Vault.verifyToNewest`/`materialize` against the live transport) —
|
|
22
|
+
* a degraded read runs an entirely separate engine (`recoverVaultMirror`,
|
|
23
23
|
* which only ever calls `keystore.readIdentity`/`readRecoveryReceipt`, never
|
|
24
|
-
* `keystore.updateRepo`) against a `
|
|
24
|
+
* `keystore.updateRepo`) against a `VaultMirrorBackend`. So "local trust
|
|
25
25
|
* pins advance only as far as the copy chain-verifies" holds by
|
|
26
26
|
* construction: there is no code path here that could advance a live pin
|
|
27
27
|
* past what the mirror copy itself proved.
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
* doc's own D194 citation ("admission is irreducibly live-server").
|
|
32
32
|
*/
|
|
33
33
|
import { isRun402Error } from "../errors.js";
|
|
34
|
-
import { readByoConfig } from "./
|
|
35
|
-
import { formatMirrorDestination, readMirrorConfig } from "./
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
34
|
+
import { readByoConfig } from "./vault-byo-config.js";
|
|
35
|
+
import { formatMirrorDestination, readMirrorConfig } from "./vault-mirror-config.js";
|
|
36
|
+
import { openVaultMirrorBackend } from "./vault-mirror-backend.js";
|
|
37
|
+
import { recoverVaultMirror } from "./vault-recover.js";
|
|
38
38
|
/**
|
|
39
39
|
* Trigger discipline (design D4): a chain/payload read falls back ONLY on a
|
|
40
40
|
* genuinely network-class failure — the underlying `fetch` threw before a
|
|
@@ -43,24 +43,24 @@ import { recoverGitvaultMirror } from "./gitvault-recover.js";
|
|
|
43
43
|
* mirror, so it is excluded even when it happens to arrive with no `.status`
|
|
44
44
|
* (see below).
|
|
45
45
|
*
|
|
46
|
-
* Two wrinkles in how a
|
|
46
|
+
* Two wrinkles in how a vault read actually fails, both handled here:
|
|
47
47
|
*
|
|
48
|
-
* 1. Most
|
|
49
|
-
* `
|
|
48
|
+
* 1. Most vault byte reads (`getGenerationBytes`/`getObjectBytes` in
|
|
49
|
+
* `vault-publication.ts`, and this file's own mirror backend) call the
|
|
50
50
|
* injected `fetch` DIRECTLY rather than the kernel's typed
|
|
51
51
|
* `client.request()` — a raw connection/DNS failure therefore propagates
|
|
52
52
|
* UNBRANDED (a plain `TypeError`, never a `Run402Error`). That is, in
|
|
53
53
|
* practice, the primary shape a real "run402 is unreachable" outage
|
|
54
54
|
* takes, so an unbranded throw is treated as network-class.
|
|
55
55
|
* 2. When those SAME call sites DO get a response but it is not `ok`, they
|
|
56
|
-
* throw via `
|
|
56
|
+
* throw via `vault-publication.ts`'s own local `fail()` helper — a
|
|
57
57
|
* `LocalError` whose real HTTP status rides in `details.status`, never on
|
|
58
58
|
* `e.status` itself (`LocalError` always passes `status: null` to the
|
|
59
59
|
* `Run402Error` constructor). This function reads BOTH places so a 5xx
|
|
60
60
|
* reaching through either path is classified alike, and a 4xx through
|
|
61
61
|
* either path is excluded alike.
|
|
62
62
|
*/
|
|
63
|
-
export function
|
|
63
|
+
export function isNetworkClassVaultReadError(e) {
|
|
64
64
|
if (!isRun402Error(e))
|
|
65
65
|
return true;
|
|
66
66
|
if (e.kind === "network_error")
|
|
@@ -71,10 +71,10 @@ export function isNetworkClassGitvaultReadError(e) {
|
|
|
71
71
|
// response, no status: network-class.
|
|
72
72
|
if (e.kind === "payment_attempt_error" && e.code === "X402_INITIAL_REQUEST_FAILED" && e.toJSON().category === "network")
|
|
73
73
|
return true;
|
|
74
|
-
const status =
|
|
74
|
+
const status = vaultReadErrorStatus(e);
|
|
75
75
|
return typeof status === "number" && status >= 500;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function vaultReadErrorStatus(e) {
|
|
78
78
|
if (typeof e.status === "number")
|
|
79
79
|
return e.status;
|
|
80
80
|
const details = e.details;
|
|
@@ -89,7 +89,7 @@ function gitvaultReadErrorStatus(e) {
|
|
|
89
89
|
* The small seam design D4 calls out: which client-side destination a
|
|
90
90
|
* degraded read should serve from, for one vault.
|
|
91
91
|
*
|
|
92
|
-
* Precedence (
|
|
92
|
+
* Precedence (vault-byo-primary-bucket task 3.4): the opt-in customer
|
|
93
93
|
* MIRROR wins when BOTH a mirror and a BYO write config are configured
|
|
94
94
|
* locally on THIS machine. A BYO vault's own primary destination is
|
|
95
95
|
* ALWAYS a complete `r402s-recover` source on its own (task 3.3's whole
|
|
@@ -105,13 +105,13 @@ function gitvaultReadErrorStatus(e) {
|
|
|
105
105
|
export function resolveDegradedReadSource(keystore, repoId) {
|
|
106
106
|
const config = readMirrorConfig(keystore, repoId);
|
|
107
107
|
if (config) {
|
|
108
|
-
const backend =
|
|
108
|
+
const backend = openVaultMirrorBackend(config.destination, repoId, config.credential);
|
|
109
109
|
return { kind: "mirror", backend, destination: formatMirrorDestination(config.destination), credential_kind: config.credential?.kind ?? null };
|
|
110
110
|
}
|
|
111
111
|
const byo = readByoConfig(keystore, repoId);
|
|
112
112
|
if (!byo)
|
|
113
113
|
return null;
|
|
114
|
-
const backend =
|
|
114
|
+
const backend = openVaultMirrorBackend(byo.destination, repoId, byo.credential);
|
|
115
115
|
return { kind: "byo", backend, destination: formatMirrorDestination(byo.destination), credential_kind: byo.credential?.kind ?? null };
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
@@ -128,12 +128,12 @@ export function resolveDegradedReadSource(keystore, repoId) {
|
|
|
128
128
|
* `code`/`status`/`kind` survive for the caller exactly as they would
|
|
129
129
|
* without this wrapper. Only the caller's own stderr hint may change.
|
|
130
130
|
* With a fallback source, this degrades via the SHIPPED `r402s-recover`
|
|
131
|
-
* engine (`
|
|
131
|
+
* engine (`recoverVaultMirror`) against it, returning
|
|
132
132
|
* `{ degraded: true, result }` — a genuine recovery failure (an incomplete
|
|
133
133
|
* or unreadable mirror) propagates from THAT call as its own honest error,
|
|
134
134
|
* never silently swallowed back into the original gateway failure.
|
|
135
135
|
*/
|
|
136
|
-
export async function
|
|
136
|
+
export async function tryVaultDegradedRead(options) {
|
|
137
137
|
let lastErr;
|
|
138
138
|
const RETRY_ATTEMPTS = 2; // the live attempt, plus one bounded retry
|
|
139
139
|
for (let attempt = 0; attempt < RETRY_ATTEMPTS; attempt++) {
|
|
@@ -141,7 +141,7 @@ export async function tryGitvaultDegradedRead(options) {
|
|
|
141
141
|
return { degraded: false, live: await options.attemptLive() };
|
|
142
142
|
}
|
|
143
143
|
catch (e) {
|
|
144
|
-
if (!
|
|
144
|
+
if (!isNetworkClassVaultReadError(e))
|
|
145
145
|
throw e;
|
|
146
146
|
lastErr = e;
|
|
147
147
|
}
|
|
@@ -153,7 +153,7 @@ export async function tryGitvaultDegradedRead(options) {
|
|
|
153
153
|
: resolveDegradedReadSource(options.keystore, options.repo_id);
|
|
154
154
|
if (!source)
|
|
155
155
|
throw lastErr;
|
|
156
|
-
const recovered = await
|
|
156
|
+
const recovered = await recoverVaultMirror({ backend: source.backend, out_dir: options.out_dir, keystore: options.keystore });
|
|
157
157
|
return {
|
|
158
158
|
degraded: true,
|
|
159
159
|
result: {
|
|
@@ -167,4 +167,4 @@ export async function tryGitvaultDegradedRead(options) {
|
|
|
167
167
|
},
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
|
-
//# sourceMappingURL=
|
|
170
|
+
//# sourceMappingURL=vault-degraded-read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vault-degraded-read.js","sourceRoot":"","sources":["../../src/node/vault-degraded-read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAA2B,MAAM,2BAA2B,CAAC;AAC5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,4BAA4B,CAAC,CAAU;IACrD,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACnC,IAAI,CAAC,CAAC,IAAI,KAAK,eAAe;QAAE,OAAO,IAAI,CAAC;IAC5C,wEAAwE;IACxE,wEAAwE;IACxE,qEAAqE;IACrE,sCAAsC;IACtC,IAAI,CAAC,CAAC,IAAI,KAAK,uBAAuB,IAAK,CAAuB,CAAC,IAAI,KAAK,6BAA6B,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ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,kBAAkB,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC9H,OAAO;QACL,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE;YACN,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,eAAe,EAAE,MAAM,CAAC,eAAe,EAAE;YACvG,IAAI,EAAE,SAAS,CAAC,IAAI;YACpB,WAAW,EAAE,SAAS,CAAC,WAAW;YAClC,UAAU,EAAE,SAAS,CAAC,oBAAoB;YAC1C,aAAa,EAAE,SAAS,CAAC,aAAa;YACtC,sBAAsB,EAAE,SAAS,CAAC,sBAAsB;SACzD;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* by change `
|
|
2
|
+
* vault — push-gated deploy (protocol rev 41 §6.5; task 5.6, lane supplied
|
|
3
|
+
* by change `vault-deploy-lane`).
|
|
4
4
|
*
|
|
5
5
|
* Every deploy has a commit, and the artifacts it ships CORRESPOND to it:
|
|
6
|
-
* 1. snapshot (§6.6) → the `
|
|
6
|
+
* 1. snapshot (§6.6) → the `vault_commit`, printed ALWAYS, never sent,
|
|
7
7
|
* plus a digest over the captured file set;
|
|
8
8
|
* 2. a fresh `capture_id` before BOTH lanes;
|
|
9
9
|
* 3. the deploy lane collects artifacts from the work tree and produces the
|
|
@@ -42,65 +42,65 @@
|
|
|
42
42
|
* journaled snapshot and presenting the capture receipt to the
|
|
43
43
|
* override-completion route — equality on EVERY field or no clear.
|
|
44
44
|
*/
|
|
45
|
-
import type {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import { type
|
|
49
|
-
export declare const
|
|
50
|
-
export type
|
|
45
|
+
import type { VaultActivationToken, VaultCaptureReceipt, VaultHeadTarget } from "../namespaces/vault.types.js";
|
|
46
|
+
import { VaultKeystore } from "./vault-keystore.js";
|
|
47
|
+
import { Vault } from "./vault-publication.js";
|
|
48
|
+
import { type VaultCapturedSetDrift, type VaultSnapshot, type VaultSnapshotOptions } from "./vault-snapshot.js";
|
|
49
|
+
export declare const VAULT_DEPLOY_OUTCOMES: readonly ["DEPLOYED_AND_VAULTED", "DEPLOY_BLOCKED_PUSH_FAILED", "DEPLOY_FAILED_VAULTED", "DEPLOY_FAILED_UNVAULTED", "DEPLOYED_UNVAULTED_OVERRIDE"];
|
|
50
|
+
export type VaultDeployOutcome = (typeof VAULT_DEPLOY_OUTCOMES)[number];
|
|
51
51
|
/** A serializable error summary (never plaintext, never presigned URLs). */
|
|
52
|
-
export interface
|
|
52
|
+
export interface VaultDeployError {
|
|
53
53
|
code: string;
|
|
54
54
|
message: string;
|
|
55
55
|
retryable: boolean;
|
|
56
56
|
details?: unknown;
|
|
57
57
|
}
|
|
58
|
-
export interface
|
|
58
|
+
export interface VaultDeployNextAction {
|
|
59
59
|
action: string;
|
|
60
60
|
/** Present when the action needs a capability the caller may lack. */
|
|
61
61
|
requires?: string;
|
|
62
62
|
}
|
|
63
|
-
interface
|
|
64
|
-
outcome:
|
|
65
|
-
/** The snapshot commit — ALWAYS present; the `
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
snapshot:
|
|
63
|
+
interface VaultDeployResultBase {
|
|
64
|
+
outcome: VaultDeployOutcome;
|
|
65
|
+
/** The snapshot commit — ALWAYS present; the `vault_commit` line is derived from it. */
|
|
66
|
+
vault_commit: string;
|
|
67
|
+
vault_commit_line: string;
|
|
68
|
+
snapshot: VaultSnapshot;
|
|
69
69
|
capture_id: string;
|
|
70
70
|
snapshot_oid_hmac: string;
|
|
71
71
|
/** The canonical plan digest — null when the build failed before a plan existed. */
|
|
72
72
|
apply_plan_sha256: string | null;
|
|
73
73
|
operation_id: string | null;
|
|
74
|
-
next_actions:
|
|
74
|
+
next_actions: VaultDeployNextAction[];
|
|
75
75
|
}
|
|
76
|
-
export type
|
|
76
|
+
export type VaultDeployResult = (VaultDeployResultBase & {
|
|
77
77
|
outcome: "DEPLOYED_AND_VAULTED";
|
|
78
78
|
generation: string;
|
|
79
79
|
head_sha256: string;
|
|
80
|
-
capture_receipt:
|
|
81
|
-
activation_token:
|
|
80
|
+
capture_receipt: VaultCaptureReceipt;
|
|
81
|
+
activation_token: VaultActivationToken;
|
|
82
82
|
commit: unknown;
|
|
83
|
-
}) | (
|
|
83
|
+
}) | (VaultDeployResultBase & {
|
|
84
84
|
outcome: "DEPLOY_BLOCKED_PUSH_FAILED";
|
|
85
|
-
push_error:
|
|
85
|
+
push_error: VaultDeployError;
|
|
86
86
|
previous_release_keeps_serving: true;
|
|
87
|
-
}) | (
|
|
87
|
+
}) | (VaultDeployResultBase & {
|
|
88
88
|
outcome: "DEPLOY_FAILED_VAULTED";
|
|
89
89
|
generation: string;
|
|
90
90
|
head_sha256: string;
|
|
91
|
-
capture_receipt:
|
|
92
|
-
deploy_error:
|
|
93
|
-
}) | (
|
|
91
|
+
capture_receipt: VaultCaptureReceipt | null;
|
|
92
|
+
deploy_error: VaultDeployError;
|
|
93
|
+
}) | (VaultDeployResultBase & {
|
|
94
94
|
outcome: "DEPLOY_FAILED_UNVAULTED";
|
|
95
|
-
push_error:
|
|
96
|
-
deploy_error:
|
|
97
|
-
}) | (
|
|
95
|
+
push_error: VaultDeployError;
|
|
96
|
+
deploy_error: VaultDeployError;
|
|
97
|
+
}) | (VaultDeployResultBase & {
|
|
98
98
|
outcome: "DEPLOYED_UNVAULTED_OVERRIDE";
|
|
99
|
-
push_error:
|
|
100
|
-
override_journal:
|
|
99
|
+
push_error: VaultDeployError;
|
|
100
|
+
override_journal: VaultOverrideJournal;
|
|
101
101
|
commit: unknown;
|
|
102
102
|
});
|
|
103
|
-
export interface
|
|
103
|
+
export interface VaultDeployLanePlanInput {
|
|
104
104
|
/**
|
|
105
105
|
* The work tree the snapshot was captured from — collect artifacts from
|
|
106
106
|
* HERE. It is the mutable tree on purpose (a materialization of the snapshot
|
|
@@ -112,29 +112,29 @@ export interface GitvaultDeployLanePlanInput {
|
|
|
112
112
|
capture_id: string;
|
|
113
113
|
snapshot_oid_hmac: string;
|
|
114
114
|
}
|
|
115
|
-
export interface
|
|
115
|
+
export interface VaultDeployLanePlan {
|
|
116
116
|
plan_id: string;
|
|
117
117
|
/** The apply operation the token is minted for (the gateway creates it at plan time under the vault gate). */
|
|
118
118
|
operation_id: string;
|
|
119
119
|
/** The canonical `apply_plan_canonical/v1` digest (opaque 32-byte commitment, hex). */
|
|
120
120
|
apply_plan_sha256: string;
|
|
121
121
|
}
|
|
122
|
-
export interface
|
|
122
|
+
export interface VaultDeployLaneCommitInput {
|
|
123
123
|
plan_id: string;
|
|
124
124
|
operation_id: string;
|
|
125
125
|
/** Present on the vaulted path. */
|
|
126
|
-
activation_token?:
|
|
126
|
+
activation_token?: VaultActivationToken;
|
|
127
127
|
/** Present on the override path — requires `gitvault.override_unvaulted` server-side. */
|
|
128
128
|
allow_unvaulted?: {
|
|
129
129
|
reason: string;
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
132
|
/** The apply-v1 plan → commit pair, abstracted so the deploy logic is testable without a gateway. */
|
|
133
|
-
export interface
|
|
134
|
-
plan(input:
|
|
135
|
-
commit(input:
|
|
133
|
+
export interface VaultDeployLane {
|
|
134
|
+
plan(input: VaultDeployLanePlanInput): Promise<VaultDeployLanePlan>;
|
|
135
|
+
commit(input: VaultDeployLaneCommitInput): Promise<unknown>;
|
|
136
136
|
}
|
|
137
|
-
export interface
|
|
137
|
+
export interface VaultOverrideJournal {
|
|
138
138
|
version: 1;
|
|
139
139
|
repo_id: string;
|
|
140
140
|
operation_id: string;
|
|
@@ -143,36 +143,36 @@ export interface GitvaultOverrideJournal {
|
|
|
143
143
|
snapshot: {
|
|
144
144
|
ref: string;
|
|
145
145
|
oid: string;
|
|
146
|
-
head_target:
|
|
146
|
+
head_target: VaultHeadTarget;
|
|
147
147
|
};
|
|
148
148
|
snapshot_oid_hmac: string;
|
|
149
149
|
/** `pending` → committed unvaulted, not yet pushed; `published` → pushed, completion not yet accepted; `completed` → advisory cleared server-side. */
|
|
150
150
|
publication_state: "pending" | "published" | "completed";
|
|
151
151
|
generation: string | null;
|
|
152
152
|
head_sha256: string | null;
|
|
153
|
-
capture_receipt:
|
|
153
|
+
capture_receipt: VaultCaptureReceipt | null;
|
|
154
154
|
reason: string;
|
|
155
155
|
created_at: string;
|
|
156
156
|
updated_at: string;
|
|
157
157
|
}
|
|
158
|
-
export declare function overrideJournalDir(keystore:
|
|
159
|
-
export declare function overrideJournalPath(keystore:
|
|
160
|
-
export declare function writeOverrideJournal(keystore:
|
|
161
|
-
export declare function readOverrideJournal(keystore:
|
|
158
|
+
export declare function overrideJournalDir(keystore: VaultKeystore): string;
|
|
159
|
+
export declare function overrideJournalPath(keystore: VaultKeystore, operationId: string): string;
|
|
160
|
+
export declare function writeOverrideJournal(keystore: VaultKeystore, journal: VaultOverrideJournal): void;
|
|
161
|
+
export declare function readOverrideJournal(keystore: VaultKeystore, operationId: string): VaultOverrideJournal | null;
|
|
162
162
|
/** Every override journal not yet `completed` — the doctor-visible advisory list. */
|
|
163
|
-
export declare function listPendingOverrideJournals(keystore:
|
|
164
|
-
export interface
|
|
163
|
+
export declare function listPendingOverrideJournals(keystore: VaultKeystore, repoId?: string): VaultOverrideJournal[];
|
|
164
|
+
export interface VaultCaptureReceiptMatch {
|
|
165
165
|
equal: boolean;
|
|
166
166
|
mismatched_fields: string[];
|
|
167
167
|
}
|
|
168
168
|
/** Compare a capture receipt against an operation's journaled binding on EVERY field: repo, capture_id, plan digest, snapshot commitment, head hash. */
|
|
169
|
-
export declare function matchCaptureReceipt(receipt:
|
|
169
|
+
export declare function matchCaptureReceipt(receipt: VaultCaptureReceipt, expected: {
|
|
170
170
|
repo_id: string;
|
|
171
171
|
capture_id: string;
|
|
172
172
|
apply_plan_sha256: string | null;
|
|
173
173
|
snapshot_oid_hmac: string;
|
|
174
174
|
head_sha256: string;
|
|
175
|
-
}):
|
|
175
|
+
}): VaultCaptureReceiptMatch;
|
|
176
176
|
/**
|
|
177
177
|
* `authorization_epoch` is compared BYTEWISE against the epoch the client last
|
|
178
178
|
* saw installed (a DR gate mints a fresh one). Any difference — one nibble is
|
|
@@ -180,7 +180,7 @@ export declare function matchCaptureReceipt(receipt: GitvaultCaptureReceipt, exp
|
|
|
180
180
|
*/
|
|
181
181
|
export declare function checkAuthorizationEpoch(tokenEpoch: string, installedEpoch: string): void;
|
|
182
182
|
/** Verify a minted activation token binds exactly this deploy (before it is ever presented to a commit). */
|
|
183
|
-
export declare function checkActivationTokenBinding(token:
|
|
183
|
+
export declare function checkActivationTokenBinding(token: VaultActivationToken, expected: {
|
|
184
184
|
repo_id: string;
|
|
185
185
|
operation_id: string;
|
|
186
186
|
generation: string;
|
|
@@ -189,12 +189,12 @@ export declare function checkActivationTokenBinding(token: GitvaultActivationTok
|
|
|
189
189
|
apply_plan_sha256: string;
|
|
190
190
|
snapshot_oid_hmac: string;
|
|
191
191
|
}): string[];
|
|
192
|
-
export interface
|
|
193
|
-
vault:
|
|
194
|
-
lane:
|
|
192
|
+
export interface VaultDeployOptions {
|
|
193
|
+
vault: Vault;
|
|
194
|
+
lane: VaultDeployLane;
|
|
195
195
|
/** The work tree to snapshot. */
|
|
196
196
|
repo_dir: string;
|
|
197
|
-
snapshot?: Omit<
|
|
197
|
+
snapshot?: Omit<VaultSnapshotOptions, "dir">;
|
|
198
198
|
/** The unvaulted override — requires `gitvault.override_unvaulted` server-side; refused otherwise. */
|
|
199
199
|
allow_unvaulted?: {
|
|
200
200
|
reason: string;
|
|
@@ -202,7 +202,7 @@ export interface GitvaultDeployOptions {
|
|
|
202
202
|
/** Test/replay hook: pin the capture id. */
|
|
203
203
|
capture_id?: string;
|
|
204
204
|
now?: () => Date;
|
|
205
|
-
/** Called with the `
|
|
205
|
+
/** Called with the `vault_commit` line as soon as the snapshot exists — the CLI prints it. */
|
|
206
206
|
onCommitLine?: (line: string) => void;
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
@@ -211,7 +211,7 @@ export interface GitvaultDeployOptions {
|
|
|
211
211
|
* `revocation_outstanding` / `exposure_outstanding` — any subset, never
|
|
212
212
|
* mutually exclusive); this decodes them into the exact `repos access`
|
|
213
213
|
* command that remedies each one. Shared with the namespace-level `push()`
|
|
214
|
-
* enrichment (`
|
|
214
|
+
* enrichment (`repos.ts#enrichEpochRotationRequired`) — same three
|
|
215
215
|
* causes, same three commands, one place either could drift from.
|
|
216
216
|
*/
|
|
217
217
|
export declare function epochRotationRequiredNextActions(e: unknown): {
|
|
@@ -228,8 +228,8 @@ export declare function epochRotationRequiredNextActions(e: unknown): {
|
|
|
228
228
|
*/
|
|
229
229
|
export declare const SNAPSHOT_MOVED_DURING_DEPLOY = "SNAPSHOT_MOVED_DURING_DEPLOY";
|
|
230
230
|
/** What `SNAPSHOT_MOVED_DURING_DEPLOY` carries in `details`. */
|
|
231
|
-
export interface
|
|
232
|
-
|
|
231
|
+
export interface VaultSnapshotMovedDetails extends VaultCapturedSetDrift {
|
|
232
|
+
vault_commit: string;
|
|
233
233
|
capture_id: string;
|
|
234
234
|
captured_digest: string;
|
|
235
235
|
observed_digest: string;
|
|
@@ -243,13 +243,13 @@ export interface GitvaultSnapshotMovedDetails extends GitvaultCapturedSetDrift {
|
|
|
243
243
|
* capture; nothing is committed), and for `OVERRIDE_NOT_AUTHORIZED`; every
|
|
244
244
|
* other path resolves to one of the five outcomes.
|
|
245
245
|
*/
|
|
246
|
-
export declare function
|
|
247
|
-
export interface
|
|
248
|
-
completed:
|
|
246
|
+
export declare function runVaultDeploy(options: VaultDeployOptions): Promise<VaultDeployResult>;
|
|
247
|
+
export interface VaultOverrideDrainReport {
|
|
248
|
+
completed: VaultOverrideJournal[];
|
|
249
249
|
/** Still pending, with the reason the drain could not complete them this time. */
|
|
250
250
|
remaining: Array<{
|
|
251
|
-
journal:
|
|
252
|
-
error:
|
|
251
|
+
journal: VaultOverrideJournal;
|
|
252
|
+
error: VaultDeployError;
|
|
253
253
|
}>;
|
|
254
254
|
}
|
|
255
255
|
/**
|
|
@@ -258,8 +258,8 @@ export interface GitvaultOverrideDrainReport {
|
|
|
258
258
|
* field + the read-back head hash, present it for completion. Partial matches
|
|
259
259
|
* never clear; the advisory persists until equality.
|
|
260
260
|
*/
|
|
261
|
-
export declare function drainOverrideJournals(vault:
|
|
261
|
+
export declare function drainOverrideJournals(vault: Vault, options?: {
|
|
262
262
|
now?: () => Date;
|
|
263
|
-
}): Promise<
|
|
263
|
+
}): Promise<VaultOverrideDrainReport>;
|
|
264
264
|
export {};
|
|
265
|
-
//# sourceMappingURL=
|
|
265
|
+
//# sourceMappingURL=vault-deploy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vault-deploy.d.ts","sourceRoot":"","sources":["../../src/node/vault-deploy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAMH,OAAO,KAAK,EAAE,oBAAoB,EAAuB,mBAAmB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpI,OAAO,EAAE,aAAa,EAAyC,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EAAE,KAAK,EAAiE,MAAM,wBAAwB,CAAC;AAC9G,OAAO,EAAwJ,KAAK,qBAAqB,EAAE,KAAK,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAItQ,eAAO,MAAM,qBAAqB,oJAMxB,CAAC;AACX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE,4EAA4E;AAC5E,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IA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;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAiDD;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA+H5F;AAID,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,oBAAoB,EAAE,CAAC;IAClC,kFAAkF;IAClF,SAAS,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,oBAAoB,CAAC;QAAC,KAAK,EAAE,gBAAgB,CAAA;KAAE,CAAC,CAAC;CAC9E;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,IAAI,CAAA;CAAO,GAAG,OAAO,CAAC,wBAAwB,CAAC,CA8B/H"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* by change `
|
|
2
|
+
* vault — push-gated deploy (protocol rev 41 §6.5; task 5.6, lane supplied
|
|
3
|
+
* by change `vault-deploy-lane`).
|
|
4
4
|
*
|
|
5
5
|
* Every deploy has a commit, and the artifacts it ships CORRESPOND to it:
|
|
6
|
-
* 1. snapshot (§6.6) → the `
|
|
6
|
+
* 1. snapshot (§6.6) → the `vault_commit`, printed ALWAYS, never sent,
|
|
7
7
|
* plus a digest over the captured file set;
|
|
8
8
|
* 2. a fresh `capture_id` before BOTH lanes;
|
|
9
9
|
* 3. the deploy lane collects artifacts from the work tree and produces the
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
import { existsSync, readdirSync, rmSync } from "node:fs";
|
|
46
46
|
import { join } from "node:path";
|
|
47
47
|
import { LocalError, isRun402Error } from "../errors.js";
|
|
48
|
-
import {
|
|
49
|
-
import { readFileNoFollow, writeFileAtomic0600 } from "./
|
|
50
|
-
import { captureBinding, deployRefTransaction } from "./
|
|
51
|
-
import {
|
|
48
|
+
import { formatVaultTimestamp, hexToBytes, newHex32 } from "../namespaces/vault.crypto.js";
|
|
49
|
+
import { readFileNoFollow, writeFileAtomic0600 } from "./vault-keystore.js";
|
|
50
|
+
import { captureBinding, deployRefTransaction } from "./vault-publication.js";
|
|
51
|
+
import { VAULT_DEPLOY_REF, capturedSetDigest, capturedSetUnchanged, captureSnapshot, deriveCapturedSet, diffCapturedSets, vaultCommitLine, snapshotCommitment } from "./vault-snapshot.js";
|
|
52
52
|
// ─── Outcomes ────────────────────────────────────────────────────────────────
|
|
53
|
-
export const
|
|
53
|
+
export const VAULT_DEPLOY_OUTCOMES = [
|
|
54
54
|
"DEPLOYED_AND_VAULTED",
|
|
55
55
|
"DEPLOY_BLOCKED_PUSH_FAILED",
|
|
56
56
|
"DEPLOY_FAILED_VAULTED",
|
|
@@ -62,7 +62,7 @@ export function overrideJournalDir(keystore) {
|
|
|
62
62
|
}
|
|
63
63
|
export function overrideJournalPath(keystore, operationId) {
|
|
64
64
|
if (!/^[A-Za-z0-9_.-]{1,128}$/.test(operationId))
|
|
65
|
-
throw new LocalError("operation_id is not a safe file name", "resolving override journal path", { code: "
|
|
65
|
+
throw new LocalError("operation_id is not a safe file name", "resolving override journal path", { code: "VAULT_BAD_ID" });
|
|
66
66
|
return join(overrideJournalDir(keystore), `${operationId}.json`);
|
|
67
67
|
}
|
|
68
68
|
export function writeOverrideJournal(keystore, journal) {
|
|
@@ -148,7 +148,7 @@ function code(e) {
|
|
|
148
148
|
* `revocation_outstanding` / `exposure_outstanding` — any subset, never
|
|
149
149
|
* mutually exclusive); this decodes them into the exact `repos access`
|
|
150
150
|
* command that remedies each one. Shared with the namespace-level `push()`
|
|
151
|
-
* enrichment (`
|
|
151
|
+
* enrichment (`repos.ts#enrichEpochRotationRequired`) — same three
|
|
152
152
|
* causes, same three commands, one place either could drift from.
|
|
153
153
|
*/
|
|
154
154
|
export function epochRotationRequiredNextActions(e) {
|
|
@@ -196,7 +196,7 @@ async function assertCapturedSetUnchanged(snapshot, context) {
|
|
|
196
196
|
return;
|
|
197
197
|
const details = {
|
|
198
198
|
...drift,
|
|
199
|
-
|
|
199
|
+
vault_commit: snapshot.oid,
|
|
200
200
|
capture_id: context.capture_id,
|
|
201
201
|
captured_digest: snapshot.captured_digest,
|
|
202
202
|
observed_digest: capturedSetDigest(now),
|
|
@@ -218,20 +218,20 @@ async function assertCapturedSetUnchanged(snapshot, context) {
|
|
|
218
218
|
* capture; nothing is committed), and for `OVERRIDE_NOT_AUTHORIZED`; every
|
|
219
219
|
* other path resolves to one of the five outcomes.
|
|
220
220
|
*/
|
|
221
|
-
export async function
|
|
221
|
+
export async function runVaultDeploy(options) {
|
|
222
222
|
const { vault, lane } = options;
|
|
223
223
|
const now = options.now ?? (() => new Date());
|
|
224
224
|
const repo = vault.repoFile();
|
|
225
225
|
const kRepo = hexToBytes(repo.k_repo_hex);
|
|
226
226
|
// 1. snapshot — refusals propagate; nothing has been sent anywhere.
|
|
227
227
|
const snapshot = await captureSnapshot({ dir: options.repo_dir, ...(options.snapshot ?? {}) });
|
|
228
|
-
const commitLine =
|
|
228
|
+
const commitLine = vaultCommitLine(snapshot);
|
|
229
229
|
options.onCommitLine?.(commitLine);
|
|
230
230
|
// 2. fresh capture id before both lanes; the keyed snapshot commitment (the platform never sees the oid).
|
|
231
231
|
const captureId = options.capture_id ?? newHex32();
|
|
232
232
|
const snapshotOidHmac = snapshotCommitment(kRepo, vault.repoId, repo.epoch, snapshot.oid);
|
|
233
233
|
const base = (fields) => ({
|
|
234
|
-
outcome: "DEPLOY_FAILED_UNVAULTED",
|
|
234
|
+
outcome: "DEPLOY_FAILED_UNVAULTED", vault_commit: snapshot.oid, vault_commit_line: commitLine, snapshot, capture_id: captureId, snapshot_oid_hmac: snapshotOidHmac,
|
|
235
235
|
apply_plan_sha256: null, operation_id: null, next_actions: [], ...fields,
|
|
236
236
|
});
|
|
237
237
|
// 3. the deploy lane collects artifacts from the work tree; step 5 below
|
|
@@ -274,7 +274,7 @@ export async function runGitvaultDeploy(options) {
|
|
|
274
274
|
if (!pub) {
|
|
275
275
|
const push_error = summarize(pushError);
|
|
276
276
|
if (!planned) {
|
|
277
|
-
return { ...common, outcome: "DEPLOY_FAILED_UNVAULTED", push_error, deploy_error: summarize(planError), next_actions: [{ action: "fix the build, then redeploy" }, { action: "retry the push (run402 repos
|
|
277
|
+
return { ...common, outcome: "DEPLOY_FAILED_UNVAULTED", push_error, deploy_error: summarize(planError), next_actions: [{ action: "fix the build, then redeploy" }, { action: "retry the push (run402 repos capture)" }] };
|
|
278
278
|
}
|
|
279
279
|
if (options.allow_unvaulted) {
|
|
280
280
|
// Correspondence is checked BEFORE the journal is written: an override
|
|
@@ -284,9 +284,9 @@ export async function runGitvaultDeploy(options) {
|
|
|
284
284
|
// journal BEFORE the commit so a crash leaves the advisory + the exact snapshot to resume
|
|
285
285
|
const journal = {
|
|
286
286
|
version: 1, repo_id: vault.repoId, operation_id: planned.operation_id, capture_id: captureId, apply_plan_sha256: planned.apply_plan_sha256,
|
|
287
|
-
snapshot: { ref:
|
|
287
|
+
snapshot: { ref: VAULT_DEPLOY_REF, oid: snapshot.oid, head_target: snapshot.head }, snapshot_oid_hmac: snapshotOidHmac,
|
|
288
288
|
publication_state: "pending", generation: null, head_sha256: null, capture_receipt: null, reason: options.allow_unvaulted.reason,
|
|
289
|
-
created_at:
|
|
289
|
+
created_at: formatVaultTimestamp(now()), updated_at: formatVaultTimestamp(now()),
|
|
290
290
|
};
|
|
291
291
|
writeOverrideJournal(vault.keystore, journal);
|
|
292
292
|
let commit;
|
|
@@ -298,7 +298,7 @@ export async function runGitvaultDeploy(options) {
|
|
|
298
298
|
rmSync(overrideJournalPath(vault.keystore, planned.operation_id), { force: true }); // nothing activated; no advisory to drain
|
|
299
299
|
throw e;
|
|
300
300
|
}
|
|
301
|
-
return { ...common, outcome: "DEPLOY_FAILED_UNVAULTED", push_error, deploy_error: summarize(e), next_actions: [{ action: "retry the push (run402 repos
|
|
301
|
+
return { ...common, outcome: "DEPLOY_FAILED_UNVAULTED", push_error, deploy_error: summarize(e), next_actions: [{ action: "retry the push (run402 repos capture) — the override journal is kept and will drain" }, { action: "retry the deploy" }] };
|
|
302
302
|
}
|
|
303
303
|
return { ...common, outcome: "DEPLOYED_UNVAULTED_OVERRIDE", push_error, override_journal: journal, commit, next_actions: [{ action: "run any run402 CLI command later: the override journal drains by pushing this exact snapshot and presenting its capture receipt for completion" }] };
|
|
304
304
|
}
|
|
@@ -312,7 +312,7 @@ export async function runGitvaultDeploy(options) {
|
|
|
312
312
|
// (never attempted automatically here: the two D194 counters a
|
|
313
313
|
// rotation must be fenced against have no client-visible read for
|
|
314
314
|
// ANY of the three causes below, so a blind retry inside the deploy
|
|
315
|
-
// lane would only ever fail — see
|
|
315
|
+
// lane would only ever fail — see Vault.rotateEpoch's doc
|
|
316
316
|
// comment for the confirmed gateway gap).
|
|
317
317
|
...(code(pushError) === "EPOCH_ROTATION_REQUIRED" ? epochRotationRequiredNextActions(pushError) : []),
|
|
318
318
|
],
|
|
@@ -323,7 +323,7 @@ export async function runGitvaultDeploy(options) {
|
|
|
323
323
|
return { ...common, outcome: "DEPLOY_FAILED_VAULTED", ...vaulted, deploy_error: summarize(planError), next_actions: [{ action: "fix the build, then redeploy (the attempted tree is in the vault at generation " + pub.generation + ")" }] };
|
|
324
324
|
}
|
|
325
325
|
if (!pub.capture_receipt) {
|
|
326
|
-
return { ...common, outcome: "DEPLOY_FAILED_VAULTED", ...vaulted, deploy_error: { code: "
|
|
326
|
+
return { ...common, outcome: "DEPLOY_FAILED_VAULTED", ...vaulted, deploy_error: { code: "VAULT_CAPTURE_RECEIPT_MISSING", message: "admission returned no capture receipt for a head carrying a capture binding; no activation token can be exchanged", retryable: true }, next_actions: [{ action: "retry the deploy" }] };
|
|
327
327
|
}
|
|
328
328
|
// Correspondence, before the token is even minted: an unspent token is
|
|
329
329
|
// harmless, but refusing after the mint would leave one bound to a deploy
|
|
@@ -334,7 +334,7 @@ export async function runGitvaultDeploy(options) {
|
|
|
334
334
|
token = await vault.transport.exchangeActivationToken({ repo_id: vault.repoId, operation_id: planned.operation_id, capture_receipt: pub.capture_receipt });
|
|
335
335
|
const problems = checkActivationTokenBinding(token, { repo_id: vault.repoId, operation_id: planned.operation_id, generation: pub.generation, head_sha256: pub.head_sha256, capture_id: captureId, apply_plan_sha256: planned.apply_plan_sha256, snapshot_oid_hmac: snapshotOidHmac });
|
|
336
336
|
if (problems.length > 0)
|
|
337
|
-
throw new LocalError(`the minted activation token does not bind this deploy (${problems.join(", ")}); refusing to present it`, "checking activation token", { code: "
|
|
337
|
+
throw new LocalError(`the minted activation token does not bind this deploy (${problems.join(", ")}); refusing to present it`, "checking activation token", { code: "VAULT_TOKEN_BINDING_MISMATCH", details: { problems } });
|
|
338
338
|
// the mint validates the receipt's epoch against the installed one, so a minted token's epoch
|
|
339
339
|
// must equal the receipt's — a difference means the epoch moved under us.
|
|
340
340
|
checkAuthorizationEpoch(token.authorization_epoch, pub.capture_receipt.authorization_epoch);
|
|
@@ -371,18 +371,18 @@ export async function drainOverrideJournals(vault, options = {}) {
|
|
|
371
371
|
protocol_refs: "allow",
|
|
372
372
|
capture_binding: captureBinding(j.capture_id, j.apply_plan_sha256, j.snapshot_oid_hmac),
|
|
373
373
|
});
|
|
374
|
-
j = { ...j, publication_state: "published", generation: pub.generation, head_sha256: pub.head_sha256, capture_receipt: pub.capture_receipt, updated_at:
|
|
374
|
+
j = { ...j, publication_state: "published", generation: pub.generation, head_sha256: pub.head_sha256, capture_receipt: pub.capture_receipt, updated_at: formatVaultTimestamp(now()) };
|
|
375
375
|
writeOverrideJournal(vault.keystore, j);
|
|
376
376
|
}
|
|
377
377
|
if (!j.capture_receipt || !j.head_sha256)
|
|
378
|
-
throw new LocalError("the journaled publication has no capture receipt to present", "draining override journal", { code: "
|
|
378
|
+
throw new LocalError("the journaled publication has no capture receipt to present", "draining override journal", { code: "VAULT_CAPTURE_RECEIPT_MISSING" });
|
|
379
379
|
const match = matchCaptureReceipt(j.capture_receipt, { repo_id: j.repo_id, capture_id: j.capture_id, apply_plan_sha256: j.apply_plan_sha256, snapshot_oid_hmac: j.snapshot_oid_hmac, head_sha256: j.head_sha256 });
|
|
380
380
|
if (!match.equal)
|
|
381
|
-
throw new LocalError(`the capture receipt does not match the journaled operation on ${match.mismatched_fields.join(", ")}; the advisory persists`, "draining override journal", { code: "
|
|
381
|
+
throw new LocalError(`the capture receipt does not match the journaled operation on ${match.mismatched_fields.join(", ")}; the advisory persists`, "draining override journal", { code: "VAULT_OVERRIDE_COMPLETION_MISMATCH", details: match });
|
|
382
382
|
const res = await vault.transport.submitOverrideCompletion({ repo_id: j.repo_id, operation_id: j.operation_id, capture_receipt: j.capture_receipt });
|
|
383
383
|
if (!res.cleared)
|
|
384
|
-
throw new LocalError("the platform did not clear the override advisory", "draining override journal", { code: "
|
|
385
|
-
j = { ...j, publication_state: "completed", updated_at:
|
|
384
|
+
throw new LocalError("the platform did not clear the override advisory", "draining override journal", { code: "VAULT_OVERRIDE_COMPLETION_REFUSED" });
|
|
385
|
+
j = { ...j, publication_state: "completed", updated_at: formatVaultTimestamp(now()) };
|
|
386
386
|
writeOverrideJournal(vault.keystore, j);
|
|
387
387
|
report.completed.push(j);
|
|
388
388
|
}
|
|
@@ -392,4 +392,4 @@ export async function drainOverrideJournals(vault, options = {}) {
|
|
|
392
392
|
}
|
|
393
393
|
return report;
|
|
394
394
|
}
|
|
395
|
-
//# sourceMappingURL=
|
|
395
|
+
//# sourceMappingURL=vault-deploy.js.map
|