run402-mcp 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 +17 -16
- package/core/dist/keystore.d.ts +1 -1
- package/core/dist/keystore.js +1 -1
- package/dist/index.js +12 -10
- package/dist/index.js.map +1 -1
- package/dist/result-store.d.ts +2 -2
- package/dist/result-store.d.ts.map +1 -1
- package/dist/result-store.js +1 -1
- package/dist/tools/grants.d.ts +22 -3
- package/dist/tools/grants.d.ts.map +1 -1
- package/dist/tools/grants.js +51 -4
- package/dist/tools/grants.js.map +1 -1
- package/dist/tools/{gitvault.d.ts → repos.d.ts} +7 -7
- package/dist/tools/repos.d.ts.map +1 -0
- package/dist/tools/{gitvault.js → repos.js} +26 -26
- package/dist/tools/repos.js.map +1 -0
- package/dist/tools/tier-status.js +1 -1
- package/dist/tools/tier-status.js.map +1 -1
- package/package.json +5 -6
- package/sdk/README.md +27 -27
- package/sdk/core-dist/keystore.d.ts +1 -1
- 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/dist/tools/gitvault.d.ts.map +0 -1
- package/dist/tools/gitvault.js.map +0 -1
- 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/dist/tools/grants.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* MCP tools for per-project capability grants
|
|
3
|
-
*
|
|
4
|
-
* shims over `r.grants.*`.
|
|
2
|
+
* MCP tools for per-project capability grants and their grant keys: issue,
|
|
3
|
+
* list, and revoke a grant for an agent or CI principal on a single project,
|
|
4
|
+
* and revoke one grant key. Thin shims over `r.grants.*`. Every call requires
|
|
5
|
+
* owner of the project's org.
|
|
6
|
+
*
|
|
7
|
+
* Minting and rotating a grant key are deliberately CLI/SDK-only: each returns
|
|
8
|
+
* a token exactly once, and MCP renders tool output into an agent transcript,
|
|
9
|
+
* where a once-printed secret must never be persisted.
|
|
5
10
|
*/
|
|
6
11
|
import { z } from "zod";
|
|
7
12
|
import { getSdk } from "../sdk.js";
|
|
@@ -38,7 +43,7 @@ export async function handleCreateProjectGrant(args) {
|
|
|
38
43
|
// ─── revoke_project_grant ───────────────────────────────────────────────────
|
|
39
44
|
export const revokeProjectGrantSchema = {
|
|
40
45
|
project_id: z.string().describe("Project id the grant belongs to."),
|
|
41
|
-
grant_id: z.string().describe("The grant id to revoke
|
|
46
|
+
grant_id: z.string().describe("The grant id to revoke (from `list_project_grants`). Revokes every grant key minted against it too."),
|
|
42
47
|
};
|
|
43
48
|
export async function handleRevokeProjectGrant(args) {
|
|
44
49
|
try {
|
|
@@ -49,4 +54,46 @@ export async function handleRevokeProjectGrant(args) {
|
|
|
49
54
|
return mapSdkError(err, "revoking project grant");
|
|
50
55
|
}
|
|
51
56
|
}
|
|
57
|
+
// ─── list_project_grants ────────────────────────────────────────────────────
|
|
58
|
+
export const listProjectGrantsSchema = {
|
|
59
|
+
project_id: z.string().describe("Project id whose grants to list."),
|
|
60
|
+
};
|
|
61
|
+
export async function handleListProjectGrants(args) {
|
|
62
|
+
try {
|
|
63
|
+
const res = await getSdk().grants.list(args.project_id);
|
|
64
|
+
if (res.grants.length === 0) {
|
|
65
|
+
return { content: [{ type: "text", text: `No grants on \`${args.project_id}\`.` }] };
|
|
66
|
+
}
|
|
67
|
+
const lines = [`## Grants on \`${args.project_id}\``, ""];
|
|
68
|
+
for (const g of res.grants) {
|
|
69
|
+
const state = g.revoked_at ? `revoked ${g.revoked_at}` : g.expires_at ? `expires ${g.expires_at}` : "no expiry";
|
|
70
|
+
lines.push(`- \`${g.grant_id}\` — \`${g.capability}\` for ${g.wallet ? `\`${g.wallet}\`` : `principal \`${g.principal_id}\``} (${state})`);
|
|
71
|
+
for (const k of g.keys) {
|
|
72
|
+
const keyState = k.revoked_at ? `revoked ${k.revoked_at}` : k.expires_at ? `expires ${k.expires_at}` : "no expiry";
|
|
73
|
+
lines.push(` - key \`${k.key_id}\` — ${k.kind} (${keyState})`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
lines.push("", "Grant keys never carry a token here; mint or rotate one with the CLI (`run402 grants create --key`, `run402 grants rotate-key`).");
|
|
77
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
return mapSdkError(err, "listing project grants");
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// ─── revoke_project_grant_key ───────────────────────────────────────────────
|
|
84
|
+
export const revokeProjectGrantKeySchema = {
|
|
85
|
+
project_id: z.string().describe("Project id the grant key belongs to."),
|
|
86
|
+
key_id: z.string().describe("The grant key id to revoke (from `list_project_grants`)."),
|
|
87
|
+
};
|
|
88
|
+
export async function handleRevokeProjectGrantKey(args) {
|
|
89
|
+
try {
|
|
90
|
+
const res = await getSdk().grants.revokeKey(args.project_id, args.key_id);
|
|
91
|
+
return {
|
|
92
|
+
content: [{ type: "text", text: `Revoked grant key \`${res.key_id}\` on \`${args.project_id}\`. The grant and its other keys stay.` }],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
return mapSdkError(err, "revoking grant key");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
52
99
|
//# sourceMappingURL=grants.js.map
|
package/dist/tools/grants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grants.js","sourceRoot":"","sources":["../../src/tools/grants.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"grants.js","sourceRoot":"","sources":["../../src/tools/grants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAI3C,+EAA+E;AAE/E,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;IACjE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uDAAuD,CAAC;IACpF,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0DAA0D,CAAC;IAC3F,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kEAAkE,CAAC;IACrH,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0DAA0D,CAAC;CACvG,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,IAM9C;IACC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE;YACxD,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,SAAS,EAAE,IAAI,CAAC,UAAU;SAC3B,CAAC,CAAC;QACH,OAAO;YACL,OAAO,EAAE;gBACP;o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CAAC,CAAC;YAClE,CAAC;QACH,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,kIAAkI,CAAC,CAAC;QACnJ,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;IACjE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,WAAW,CAAC,GAAG,EAAE,wBAAwB,CAAC,CAAC;IACpD,CAAC;AACH,CAAC;AAED,+EAA+E;AAE/E,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;IACvE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0DAA0D,CAAC;CACxF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,IAGjD;IACC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1E,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,GAAG,CAAC,MAAM,WAAW,IAAI,CAAC,UAAU,wCAAwC,EAAE,CAAC;SACvI,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,WAAW,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC;IAChD,CAAC;AACH,CAAC"}
|
|
@@ -34,23 +34,23 @@ type ToolResult = {
|
|
|
34
34
|
isError?: boolean;
|
|
35
35
|
};
|
|
36
36
|
/** What this machine and the control plane each believe about the vault. */
|
|
37
|
-
export declare const
|
|
37
|
+
export declare const getVaultStatusSchema: {
|
|
38
38
|
project_id: z.ZodOptional<z.ZodString>;
|
|
39
39
|
repo_id: z.ZodOptional<z.ZodString>;
|
|
40
40
|
};
|
|
41
|
-
export declare function
|
|
41
|
+
export declare function handleGetVaultStatus(args: {
|
|
42
42
|
project_id?: string;
|
|
43
43
|
repo_id?: string;
|
|
44
44
|
}): Promise<ToolResult>;
|
|
45
45
|
/** One page of the heads listing, above a fixed verification anchor. */
|
|
46
|
-
export declare const
|
|
46
|
+
export declare const listVaultHeadsSchema: {
|
|
47
47
|
repo_id: z.ZodOptional<z.ZodString>;
|
|
48
48
|
project_id: z.ZodOptional<z.ZodString>;
|
|
49
49
|
after_generation: z.ZodString;
|
|
50
50
|
limit: z.ZodNumber;
|
|
51
51
|
cursor: z.ZodOptional<z.ZodString>;
|
|
52
52
|
};
|
|
53
|
-
export declare function
|
|
53
|
+
export declare function handleListVaultHeads(args: {
|
|
54
54
|
repo_id?: string;
|
|
55
55
|
project_id?: string;
|
|
56
56
|
after_generation: string;
|
|
@@ -58,13 +58,13 @@ export declare function handleListGitvaultHeads(args: {
|
|
|
58
58
|
cursor?: string;
|
|
59
59
|
}): Promise<ToolResult>;
|
|
60
60
|
/** Verify the chain from the authenticated pin upward, then advance the pin. */
|
|
61
|
-
export declare const
|
|
61
|
+
export declare const verifyVaultSchema: {
|
|
62
62
|
project_id: z.ZodOptional<z.ZodString>;
|
|
63
63
|
repo_id: z.ZodOptional<z.ZodString>;
|
|
64
64
|
};
|
|
65
|
-
export declare function
|
|
65
|
+
export declare function handleVerifyVault(args: {
|
|
66
66
|
project_id?: string;
|
|
67
67
|
repo_id?: string;
|
|
68
68
|
}): Promise<ToolResult>;
|
|
69
69
|
export {};
|
|
70
|
-
//# sourceMappingURL=
|
|
70
|
+
//# sourceMappingURL=repos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repos.d.ts","sourceRoot":"","sources":["../../src/tools/repos.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,KAAK,UAAU,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AA8CxF,4EAA4E;AAC5E,eAAO,MAAM,oBAAoB;;;CAMhC,CAAC;AAEF,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAuG/G;AAID,wEAAwE;AACxE,eAAO,MAAM,oBAAoB;;;;;;CAoBhC,CAAC;AAEF,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC,UAAU,CAAC,CA+CtB;AAID,gFAAgF;AAChF,eAAO,MAAM,iBAAiB;;;CAG7B,CAAC;AAcF,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAgD5G"}
|
|
@@ -33,7 +33,7 @@ import { storeResult } from "../result-store.js";
|
|
|
33
33
|
/**
|
|
34
34
|
* The scoped confidentiality sentence — the ONLY permitted form (protocol D57 /
|
|
35
35
|
* D168). The unqualified variants of this claim are on the banned-copy list
|
|
36
|
-
* because they drop the scope; `
|
|
36
|
+
* because they drop the scope; `vault-copy.test.ts` holds that list verbatim
|
|
37
37
|
* and fails the build if one appears here.
|
|
38
38
|
*/
|
|
39
39
|
const SCOPED_CONFIDENTIALITY = "source payload and repository-history content are ciphertext-only; the substrate retains only enumerated plaintext metadata and holds zero vault keys";
|
|
@@ -59,35 +59,35 @@ function isToolResult(value) {
|
|
|
59
59
|
function targetOptions(target) {
|
|
60
60
|
return target.repo_id !== null ? { repo_id: target.repo_id } : { project_id: target.project_id };
|
|
61
61
|
}
|
|
62
|
-
// ───
|
|
62
|
+
// ─── repos_view ─────────────────────────────────────────────────────
|
|
63
63
|
/** What this machine and the control plane each believe about the vault. */
|
|
64
|
-
export const
|
|
64
|
+
export const getVaultStatusSchema = {
|
|
65
65
|
project_id: z
|
|
66
66
|
.string()
|
|
67
67
|
.optional()
|
|
68
68
|
.describe("The project whose vault to report. Defaults to the active project. The cold-restart entry point: it resolves repo_id with no local state."),
|
|
69
69
|
repo_id: z.string().optional().describe("Address the vault directly when you already know its id. Wins over project_id."),
|
|
70
70
|
};
|
|
71
|
-
export async function
|
|
71
|
+
export async function handleGetVaultStatus(args) {
|
|
72
72
|
const target = await resolveVaultTarget(args);
|
|
73
73
|
if (isToolResult(target))
|
|
74
74
|
return target;
|
|
75
75
|
try {
|
|
76
|
-
const status = await getSdk().
|
|
76
|
+
const status = await getSdk().repos.status(targetOptions(target));
|
|
77
77
|
const v = status.vault;
|
|
78
78
|
const lines = [];
|
|
79
79
|
lines.push(status.repo_id
|
|
80
|
-
? `
|
|
80
|
+
? `vault ${status.repo_id}${status.project_id ? ` — project ${status.project_id}` : ""}`
|
|
81
81
|
: `No vault is allocated${status.project_id ? ` for project ${status.project_id}` : ""}.`);
|
|
82
82
|
if (v) {
|
|
83
|
-
lines.push("", "Vault", ` policy ${v.
|
|
83
|
+
lines.push("", "Vault", ` policy ${v.vault_policy ?? "(unset)"} (version ${v.vault_policy_version})`, ` allocation generation ${v.allocation_generation}`, ` newest generation ${v.newest_generation ?? "(none admitted)"}`, ` admitted generations ${v.admitted_generations}`, ` genesis admitted at ${v.genesis_admitted_at ?? "(not yet)"}`, ` source bytes ${v.storage.source_bytes}`, ` repair fence ${v.repair_fence_state} (version ${v.repair_version})`);
|
|
84
84
|
if (v.maintenance.lease) {
|
|
85
|
-
lines.push(` maintenance lease ${v.maintenance.lease.maintenance_lease_id} (expires ${v.maintenance.lease.expires_at ?? "unknown"})`, " a compact/prune cycle holds the reservation; run402
|
|
85
|
+
lines.push(` maintenance lease ${v.maintenance.lease.maintenance_lease_id} (expires ${v.maintenance.lease.expires_at ?? "unknown"})`, " a compact/prune cycle holds the reservation; run402 repos gc owns it.");
|
|
86
86
|
}
|
|
87
87
|
if (v.maintenance.open_cycle) {
|
|
88
88
|
lines.push(` open cycle ${v.maintenance.open_cycle.maintenance_cycle_id} (${v.maintenance.open_cycle.state})`);
|
|
89
89
|
}
|
|
90
|
-
//
|
|
90
|
+
// vault-multi-writer (rev 47): the chain-verified writer roster,
|
|
91
91
|
// read-only — this tool never mints or reconciles admissions itself;
|
|
92
92
|
// `run402 repos access sync` is the CLI-only mutating counterpart.
|
|
93
93
|
if (v.writer_set) {
|
|
@@ -137,12 +137,12 @@ export async function handleGetGitvaultStatus(args) {
|
|
|
137
137
|
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
138
138
|
}
|
|
139
139
|
catch (err) {
|
|
140
|
-
return mapSdkError(err, "reading the
|
|
140
|
+
return mapSdkError(err, "reading the vault status");
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
-
// ───
|
|
143
|
+
// ─── repos_list_heads ─────────────────────────────────────────────────────
|
|
144
144
|
/** One page of the heads listing, above a fixed verification anchor. */
|
|
145
|
-
export const
|
|
145
|
+
export const listVaultHeadsSchema = {
|
|
146
146
|
repo_id: z.string().optional().describe("The vault to list. Wins over project_id."),
|
|
147
147
|
project_id: z.string().optional().describe("Resolves repo_id from the project. Defaults to the active project."),
|
|
148
148
|
after_generation: z
|
|
@@ -159,14 +159,14 @@ export const listGitvaultHeadsSchema = {
|
|
|
159
159
|
.optional()
|
|
160
160
|
.describe("Omit on the first request. Afterwards pass the prior page's next_cursor UNCHANGED — it is opaque: store and echo it, never parse or construct one. A malformed or stale cursor is INVALID_CURSOR; recover by restarting from after_generation with no cursor."),
|
|
161
161
|
};
|
|
162
|
-
export async function
|
|
162
|
+
export async function handleListVaultHeads(args) {
|
|
163
163
|
const target = await resolveVaultTarget(args);
|
|
164
164
|
if (isToolResult(target))
|
|
165
165
|
return target;
|
|
166
166
|
try {
|
|
167
167
|
const sdk = getSdk();
|
|
168
|
-
const repoId = target.repo_id ?? (await sdk.
|
|
169
|
-
const page = await sdk.
|
|
168
|
+
const repoId = target.repo_id ?? (await sdk.repos.forProject(target.project_id)).repo_id;
|
|
169
|
+
const page = await sdk.repos.heads(repoId, {
|
|
170
170
|
after_generation: args.after_generation,
|
|
171
171
|
limit: String(args.limit),
|
|
172
172
|
...(args.cursor !== undefined ? { cursor: args.cursor } : {}),
|
|
@@ -174,9 +174,9 @@ export async function handleListGitvaultHeads(args) {
|
|
|
174
174
|
// The full page is persisted; only the window is rendered. A vault with a
|
|
175
175
|
// thousand admitted generations must not spend an agent's context on rows
|
|
176
176
|
// it did not ask to read.
|
|
177
|
-
const view = storeResult("
|
|
177
|
+
const view = storeResult("vault_heads", page.heads);
|
|
178
178
|
const lines = [
|
|
179
|
-
`
|
|
179
|
+
`vault ${page.repo_id} — heads above anchor ${page.after_generation}.`,
|
|
180
180
|
`Showing ${view.shown} of ${view.total} in this page${page.total !== null ? `; ${page.total} heads above the anchor in total` : ""}.`,
|
|
181
181
|
];
|
|
182
182
|
if (view.ref && view.shown < view.total) {
|
|
@@ -194,16 +194,16 @@ export async function handleListGitvaultHeads(args) {
|
|
|
194
194
|
else {
|
|
195
195
|
lines.push("has_more is false — this is the last page of the sequence.");
|
|
196
196
|
}
|
|
197
|
-
lines.push("", "Listing a head is not verifying it. Run
|
|
197
|
+
lines.push("", "Listing a head is not verifying it. Run repos_fsck to check the chain links and advance the local authenticated pin.");
|
|
198
198
|
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
199
199
|
}
|
|
200
200
|
catch (err) {
|
|
201
|
-
return mapSdkError(err, "listing
|
|
201
|
+
return mapSdkError(err, "listing vault heads");
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
// ───
|
|
204
|
+
// ─── repos_fsck ─────────────────────────────────────────────────────────
|
|
205
205
|
/** Verify the chain from the authenticated pin upward, then advance the pin. */
|
|
206
|
-
export const
|
|
206
|
+
export const verifyVaultSchema = {
|
|
207
207
|
project_id: z.string().optional().describe("The project whose vault to verify. Defaults to the active project."),
|
|
208
208
|
repo_id: z.string().optional().describe("Address the vault directly. Wins over project_id."),
|
|
209
209
|
};
|
|
@@ -212,14 +212,14 @@ const VERIFY_FAILURE_GUIDANCE = {
|
|
|
212
212
|
GENERATION_REGRESSION: "The vault offered a generation at or below your authenticated pin — a rollback. Verification fails closed and the pin is NOT moved backwards; nothing local was rewritten. Treat this as a serious integrity signal about the remote, not a local problem to clear.",
|
|
213
213
|
CHAIN_BROKEN: "A link is missing or does not match: a listed head absent from storage, a gap in the sequence, or a head whose previous-hash does not chain. Verification stops at the last good generation and the pin stays there.",
|
|
214
214
|
UPGRADE_REQUIRED: "The chain contains a transition this client cannot validate. It is read-only past that point and the transition is never skipped — upgrade the client (npx run402@latest) and verify again.",
|
|
215
|
-
VERIFICATION_BUDGET_EXCEEDED: "The per-call head budget ran out. The verified prefix is persisted, so this is a pause, not a failure: call
|
|
215
|
+
VERIFICATION_BUDGET_EXCEEDED: "The per-call head budget ran out. The verified prefix is persisted, so this is a pause, not a failure: call repos_fsck again and it resumes from where it stopped.",
|
|
216
216
|
};
|
|
217
|
-
export async function
|
|
217
|
+
export async function handleVerifyVault(args) {
|
|
218
218
|
const target = await resolveVaultTarget(args);
|
|
219
219
|
if (isToolResult(target))
|
|
220
220
|
return target;
|
|
221
221
|
try {
|
|
222
|
-
const state = await getSdk().
|
|
222
|
+
const state = await getSdk().repos.verify(targetOptions(target));
|
|
223
223
|
const lines = [
|
|
224
224
|
`Verified to generation ${state.generation} (head ${state.head_sha256}).`,
|
|
225
225
|
"",
|
|
@@ -250,7 +250,7 @@ export async function handleVerifyGitvault(args) {
|
|
|
250
250
|
}
|
|
251
251
|
catch (err) {
|
|
252
252
|
const code = typeof err?.code === "string" ? (err.code) : null;
|
|
253
|
-
const mapped = mapSdkError(err, "verifying the
|
|
253
|
+
const mapped = mapSdkError(err, "verifying the vault chain");
|
|
254
254
|
const guidance = code ? VERIFY_FAILURE_GUIDANCE[code] : undefined;
|
|
255
255
|
if (!guidance)
|
|
256
256
|
return mapped;
|
|
@@ -260,4 +260,4 @@ export async function handleVerifyGitvault(args) {
|
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
|
-
//# sourceMappingURL=
|
|
263
|
+
//# sourceMappingURL=repos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repos.js","sourceRoot":"","sources":["../../src/tools/repos.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAIjD;;;;;GAKG;AACH,MAAM,sBAAsB,GAC1B,uJAAuJ,CAAC;AAE1J,kHAAkH;AAClH,MAAM,6BAA6B,GACjC,4FAA4F,CAAC;AAU/F;;;GAGG;AACH,KAAK,UAAU,kBAAkB,CAAC,IAAqB;IACrD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC;IACpC,IAAI,MAAM;QAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,CA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I,EAAE,QAAQ,EAAE,CAAC;SACxE,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -36,7 +36,7 @@ export async function handleTierStatus(_args) {
|
|
|
36
36
|
`| projects in pool | ${body.pool_usage.projects} |`,
|
|
37
37
|
`| pooled api calls | ${body.pool_usage.total_api_calls.toLocaleString()} / ${body.pool_usage.api_calls_limit.toLocaleString()} |`,
|
|
38
38
|
`| pooled storage | ${body.pool_usage.total_storage ?? formatBytesDecimal(body.pool_usage.total_storage_bytes)} / ${body.pool_usage.storage_limit ?? formatBytesDecimal(body.pool_usage.storage_bytes_limit)} |`,
|
|
39
|
-
`| pooled vault | ${body.pool_usage.
|
|
39
|
+
`| pooled vault | ${body.pool_usage.vault_source ?? formatBytesDecimal(body.pool_usage.vault_source_bytes ?? 0)} / ${body.pool_usage.source_limit ?? formatBytesDecimal(body.pool_usage.source_bytes_limit ?? 0)} |`,
|
|
40
40
|
];
|
|
41
41
|
const functionLimits = functionLimitsFromTierStatus(body);
|
|
42
42
|
if (functionLimits) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tier-status.js","sourceRoot":"","sources":["../../src/tools/tier-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEnC,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,KAA4B;IAE5B,MAAM,IAAI,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;IACnD,IAAI,OAAO,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC;IAEvC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,MAA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SAAS,WAAW,CAAC,KAAc,EAAE,MAAM,GAAG,EAAE;IAC9C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,cAAc,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC;AAC7F,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "run402-mcp",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.97.0",
|
|
4
4
|
"packageManager": "npm@11.19.0",
|
|
5
5
|
"mcpName": "com.run402/mcp",
|
|
6
6
|
"description": "MCP server 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.",
|
|
@@ -21,8 +21,7 @@
|
|
|
21
21
|
"workspaces": [
|
|
22
22
|
"cli",
|
|
23
23
|
"sdk",
|
|
24
|
-
"astro"
|
|
25
|
-
"kygit"
|
|
24
|
+
"astro"
|
|
26
25
|
],
|
|
27
26
|
"scripts": {
|
|
28
27
|
"build:core": "rm -rf core/dist && tsc -p core/tsconfig.json",
|
|
@@ -30,13 +29,13 @@
|
|
|
30
29
|
"build": "rm -rf dist cli/core-dist cli/sdk/dist cli/sdk/core-dist && npm run build:core && npm run build:sdk && tsc && mkdir -p cli/core-dist cli/sdk/dist cli/sdk/core-dist && cp core/dist/*.js cli/core-dist/ && cp -R sdk/dist/. cli/sdk/dist/ && cp sdk/core-dist/*.js cli/sdk/core-dist/",
|
|
31
30
|
"start": "node dist/index.js",
|
|
32
31
|
"test:skill": "node scripts/build-agent-skills-index.mjs --check && node --test --import tsx SKILL.test.ts buzz/setup.test.mjs buzz/helper.test.mjs buzz/package.test.mjs scripts/build-agent-skills-index.test.mjs",
|
|
33
|
-
"test:
|
|
32
|
+
"test:vault-surface": "node scripts/build-vault-surface.mjs --check && node --test scripts/build-vault-surface.test.mjs",
|
|
34
33
|
"test:buzz-installer": "node buzz/install-smoke.mjs",
|
|
35
34
|
"test:sync": "node --test --import tsx sync.test.ts examples/tenant-x402-wallet-stats/example.test.mjs examples/static-config-js/example.test.mjs",
|
|
36
35
|
"test:run402-app-schema-drift": "node scripts/check-run402-app-schema-drift.mjs",
|
|
37
36
|
"test:docs": "node scripts/check-typed-config-docs.mjs && npm run check:docs --workspace=@run402/sdk -- --skip-build && npm run test:docs:quality",
|
|
38
|
-
"test": "npm run build && node scripts/build-agent-skills-index.mjs --check && node scripts/build-
|
|
39
|
-
"test:e2e": "npm run build && node --test cli-core-target.test.mjs && node --experimental-test-module-mocks --test cli-repos-surface.test.mjs cli-
|
|
37
|
+
"test": "npm run build && node scripts/build-agent-skills-index.mjs --check && node scripts/build-vault-surface.mjs --check && node --experimental-test-module-mocks --test --import tsx SKILL.test.ts sync.test.ts buzz/setup.test.mjs buzz/helper.test.mjs buzz/package.test.mjs scripts/build-agent-skills-index.test.mjs scripts/build-agent-flat-docs.test.mjs scripts/build-vault-surface.test.mjs examples/tenant-x402-wallet-stats/example.test.mjs examples/static-config-js/example.test.mjs 'core/src/**/*.test.ts' 'sdk/src/**/*.test.ts' 'src/**/*.test.ts' && node --test cli-core-target.test.mjs mcp-vendored-sdk-imports.test.mjs && node --experimental-test-module-mocks --test cli-up-argv.test.mjs cli-up-repo-compose.test.mjs cli-repos-surface.test.mjs cli-repos-naming.test.mjs cli-projects-vault-scaffold.test.mjs cli-identity-link.test.mjs cli-identity-link-matrix.test.mjs cli-redeem.test.mjs cli-rooms-context-session-key.test.mjs cli-messages-wait.test.mjs cli-rooms-invite-key-leak.test.mjs cli-rooms-join-arrival.test.mjs cli/lib/buzz.test.mjs && node --test cli-help-listing.test.mjs cli-module-references.test.mjs cli-output-contract.test.mjs cli-json-noop-contract.test.mjs cli-e2e.test.mjs cli-help.test.mjs cli-subscriptions-help.test.mjs cli-provision-active.test.mjs cli-typed-config-modes.test.mjs cli-argv.test.mjs cli-repos-naming.test.mjs cli-conventions-gate.test.mjs cli-doctor.test.mjs cli-rest-diagnostics.test.mjs cli-credentials.test.mjs paid-stack-deps.test.mjs profile-guidance.test.mjs settlement-disclosure.test.mjs cli-suggestions-gate.test.mjs cli-env.test.mjs cli-wallets.test.mjs cli-org.test.mjs cli-org-context.test.mjs cli-image-org.test.mjs cli-harness-context.test.mjs cli-ci.test.mjs cli-deploy-ci.test.mjs cli-login-loopback.test.mjs cli-vault-remote-helper.test.mjs cli-vault-daemon.test.mjs cli-deploy-vault-lane.test.mjs cli/lib/buzz-doctor-contract.test.mjs cli/lib/buzz-doctor.test.mjs cli/lib/diagnostic-telemetry.test.mjs cli/lib/doctor-source-scan.test.mjs cli/lib/errors.test.mjs cli/lib/path-lookup.test.mjs cli/lib/pay.test.mjs cli/lib/up.test.mjs cli/lib/deploy-rehearse-discovery.test.mjs cli/lib/update-check.test.mjs cli-bootstrap-next-actions.test.mjs cli-sdk-errors-room-invite-hint.test.mjs && npm run test:docs",
|
|
38
|
+
"test:e2e": "npm run build && node --test cli-core-target.test.mjs && node --experimental-test-module-mocks --test cli-repos-surface.test.mjs cli-repos-naming.test.mjs cli-up-repo-compose.test.mjs cli-projects-vault-scaffold.test.mjs cli-identity-link.test.mjs cli-identity-link-matrix.test.mjs cli-redeem.test.mjs cli-rooms-context-session-key.test.mjs cli-messages-wait.test.mjs cli-rooms-invite-key-leak.test.mjs cli-rooms-join-arrival.test.mjs && node --test cli-help-listing.test.mjs cli-module-references.test.mjs cli-output-contract.test.mjs cli-json-noop-contract.test.mjs cli-e2e.test.mjs cli-help.test.mjs cli-subscriptions-help.test.mjs cli-provision-active.test.mjs cli-typed-config-modes.test.mjs cli-argv.test.mjs cli-repos-naming.test.mjs cli-conventions-gate.test.mjs cli-doctor.test.mjs cli-rest-diagnostics.test.mjs cli-credentials.test.mjs paid-stack-deps.test.mjs profile-guidance.test.mjs settlement-disclosure.test.mjs cli-suggestions-gate.test.mjs cli-env.test.mjs cli-wallets.test.mjs cli-org.test.mjs cli-org-context.test.mjs cli-image-org.test.mjs cli-harness-context.test.mjs cli-ci.test.mjs cli-deploy-ci.test.mjs cli-login-loopback.test.mjs cli-vault-remote-helper.test.mjs cli-vault-daemon.test.mjs cli-deploy-vault-lane.test.mjs cli/lib/buzz-doctor-contract.test.mjs cli/lib/buzz-doctor.test.mjs cli/lib/diagnostic-telemetry.test.mjs cli/lib/doctor-source-scan.test.mjs cli/lib/errors.test.mjs cli/lib/path-lookup.test.mjs cli/lib/up.test.mjs cli/lib/update-check.test.mjs cli-bootstrap-next-actions.test.mjs cli-sdk-errors-room-invite-hint.test.mjs",
|
|
40
39
|
"test:help": "npm run build && node --test cli-help.test.mjs",
|
|
41
40
|
"test:integration": "node --test --import tsx core/src/siwx-integration.integ.ts",
|
|
42
41
|
"test:integration:full": "node --test --import tsx cli-integration.test.ts",
|
package/sdk/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Typed TypeScript client for the [Run402](https://run402.com) API. The typed, opinionated workflow layer shared by `run402-mcp` and the `run402` CLI. Most operations are project-scoped: bind with `await r.project(id)`, then compose `.apply()`, `.assets.put()` and other operations. Apply coordinates staged activation and resumable work; it does not promise to roll back committed SQL migrations. Application functions use the separate `@run402/functions` runtime package.
|
|
4
4
|
|
|
5
|
-
Run402 callers are first-class principals, whether they are people or agents. The SDK preserves the acting principal and authenticator separately from authority: organization roles, grants,
|
|
5
|
+
Run402 callers are first-class principals, whether they are people or agents. The SDK preserves the acting principal and authenticator separately from authority: organization roles, grants, grant keys, freshness, and spend policy determine which operations are allowed. An agent should act as itself, never through a borrowed human credential.
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install @run402/sdk
|
|
@@ -266,7 +266,7 @@ resolveRun402TargetProfile({
|
|
|
266
266
|
|
|
267
267
|
Most operations are project-scoped. Bind once and skip the id arg on every call:
|
|
268
268
|
|
|
269
|
-
`r.projects.list()` and `r.projects.get(id)` are server-authoritative project reads. `r.projects.use(id)` validates the project with the current principal and stores only an active project id in profile state; it does not require local project-key cache membership. `r.project(id)` binds the id without local lookup. Each namespace then follows its declared auth mode: control-plane operations such as custom domains default to principal/
|
|
269
|
+
`r.projects.list()` and `r.projects.get(id)` are server-authoritative project reads. `r.projects.use(id)` validates the project with the current principal and stores only an active project id in profile state; it does not require local project-key cache membership. `r.project(id)` binds the id without local lookup. Each namespace then follows its declared auth mode: control-plane operations such as custom domains default to principal/grant-key auth with explicit `project_id`, while true data-plane/key operations use local project credentials and fail with `PROJECT_CREDENTIAL_NOT_FOUND` when the selected profile lacks cached keys.
|
|
270
270
|
|
|
271
271
|
```ts
|
|
272
272
|
const p = await r.useProject(projectId); // persists active project + returns scoped handle
|
|
@@ -343,10 +343,10 @@ The `CredentialsProvider` interface has two required methods (`getAuth`, `getPro
|
|
|
343
343
|
| `wallets` | The local wallet: `status`, `create`, `export`, `faucet`; plus `getLabel(address)` |
|
|
344
344
|
| `wallet(address)` | `getLabel()`, `setLabel(label)` — the signed server-side wallet label (gateway `/wallets/v1/:address/label`) surfaced in the console; pushed on `wallets use` unless `RUN402_WALLET_LABEL_SYNC=0`. Use the `r.wallet(address)` handle; `r.wallets.getLabel(address)` remains a bare read |
|
|
345
345
|
| `orgs` | **Org-owned control plane** (first-class orgs). `create`, `list`, `whoami` (the gateway-resolved control-plane identity) on the collection; the scoped `r.org(id)` sub-client (org analog of `r.project(id)`) adds `get`, `rename`, `setPayoutWallet`, `members.*` (`list`/`add`/`setRole`/`revoke`), `invites.*` (`list`/`create`/`revoke`), `audit`. Org create/read/rename summaries include `tier`, `lease_started_at`, and `lease_expires_at`. |
|
|
346
|
-
| `grants` | `create
|
|
346
|
+
| `grants` | `create` (optional first grant key via `key`), `list` (keys nested), `revoke`, `createKey`, `revokeKey`, `rotateKey` — per-project capability grants (e.g. `"deploy"`, `"functions:write"`) for agent/CI principals and the grant keys minted against them; a key's `token` is returned once. Owner-gated, also reachable project-scoped as `r.project(id).grants` |
|
|
347
347
|
| `events` | `list`, `listForOrg` — the cursored project events feed ("what happened since I last looked"): deploy activations, suspensions, transfers, lifecycle cliffs, each with platform-suggested `next_actions`, plus app-emitted business facts (`source: "app"`) alongside the platform's own (`source: "platform"`) — filter with `{ source?, eventType? }`. Opaque store-and-echo cursor; `reset: true` + `earliest_cursor` instead of errors on expiry. Also reachable project-scoped as `r.project(id).events` |
|
|
348
348
|
| `rooms` | `registerPresence`, `listPresences`, `getPresence`, `sendMessage`, `listMessages`, `waitForMessages` (kygit-invite — the agent's ear: blocks until a matching message lands past the cursor or a timeout elapses, using the gateway's held read `wait=<1..25>` when it is observed to hold and degrading to bounded polling the instant a page comes back with no `waited_ms`; silence is an answer, never a throw — returns the last observed page with `settled: false`), `getMessage`, `ackMessage`, `createClaim`, `listClaims`, `releaseClaim`, plus `scoped(orgId, roomKey)` (sync) and `forProject(projectId)` (async — resolves the project's org; the default room's key IS the project id) returning a room-bound `ScopedRoom` (which also carries `waitForMessages`). Org-scoped agent coordination rooms: per-session presence (~1h silence decays LIVENESS only — an opaque `sessionKey` on every call RESUMES the same presence no matter how long it was silent, reported via `resumed: true`; `requestedName` honored-or-suffixed on a fresh registration, reported via `requested_name` + `renamed` + a plain-language `why` when a collision was task-qualified; `program`/`model` labels ride every registration when the harness or an explicit override names them), room-visible ≤32 KiB markdown messages (`to`/`cc` route attention, not access control; `idempotencyKey` replay returns the ORIGINAL + `deduplicated: true`) with opaque `mcr_…` cursors (`reset: true` + `earliest_cursor` on expiry, never an error), and ADVISORY claims — `createClaim` always succeeds with a complete `conflicts[]`; nothing is ever blocked by a claim |
|
|
349
|
-
| `
|
|
349
|
+
| `repos` | The host-blind encrypted Git remote (`r402s/v0`). **Isomorphic reads:** `get`, `forProject` (cold-restart lookup — resolves `repo_id` with no local state), `forRepo` (slug-form resolution), `resolveAddress` (form dispatch), `heads`, `allHeads`, `setPolicy`, `completeOverride`, `acquireMaintenanceLease`, `listByOrg` (the bulk vaults-by-org read — `repos list`'s primary route), `access` (READ-ONLY recipients/coverage/local-TOFU-pin report; never wraps a key). **Node-only writes** (keystore + git working tree, reached through dynamic imports so a browser build never pulls `node:fs`): `init`, `openOrCreate` (lazy allocation on first open — the primitive `push` and `git-remote-run402`'s push path compose on `VAULT_UNRESOLVED`), `resolveOrCreateAddress` (named-address resolve/push-to-create/id-pin), `push`, `handoff` (kygit-handoff — captures the working tree into a stash-shaped checkpoint and mints a single-use bearer `kgh1_…` key), `resume` (claims a Handoff Key, clones fresh, restores the checkpoint), `listHandoffs`, `revokeHandoff`, `invite` (kygit-invite — the second claim kind: captures the checkpoint, registers the inviter's presence, mints a single-use bearer `kgi1_…` key, posts one room fact), `join` (claims an Invite Key, folds the caller's own cold-start chain first, clones fresh, restores the checkpoint, pins the invite's room, registers this session's presence, posts one arrival fact), `listInvites`, `revokeInvite`, `status`, `compact`, `prune` (plans; submits with both verifier receipts), `verify` (accepts `{persist:false}` to walk without writing), `fsck` (verify + materialize + explicit pin_before/pin_after/local_state_changed; `{write:false}` is the audit mode), `deploy`, `restore`, `scaffoldRemote` (claims `origin` additively, falls back to `run402`), `open`, `drainOverrides`. Also exports the pure `vaultLossWarningTrip`/`vaultLossWarningTripped`/`vaultLossWarningMessage` and `vaultRemoteAddressForm`/`vaultRemoteUrl`/`vaultRemoteUrlForRepo`/`vaultSlugReleasedInfo` helpers — `vaultRemoteUrl`/`vaultRemoteUrlForRepo` render `run402::`, the one remote scheme; `parseVaultRemoteUrl` accepts `run402::` only and refuses any other `<scheme>::` address by name. All protocol behaviour lives here once; `run402 repos …` (the SDK's own name, `r.repos`), `git-remote-run402`, and the MCP tools are adapters. Run402 cannot decrypt your vault or repository history. Deployment artifacts remain a disclosed plaintext custody boundary. |
|
|
350
350
|
| `errors` | `list`, `get`, `watch` — the release-error-rollup query surface. **Verdict-first**: each page leads with a gateway-computed promote-vs-revert verdict (`new_fingerprints` / `recurring_fingerprints` / `invocations_in_window`, baselined against the previous ACTIVE release), then grouped, deploy-stable error fingerprints with `fetch_logs` drill-downs. `watch({ newIn })` is the promote-gate poll loop — run it right after apply/promote; `clean === (verdict.new_fingerprints === 0)`, the gateway's count (no client-side identity math). Opaque keyset cursor. Also reachable project-scoped as `r.project(id).errors` |
|
|
351
351
|
|
|
352
352
|
CLI-style aliases are available for agent ergonomics: `r.image` aliases `r.ai`,
|
|
@@ -777,23 +777,23 @@ await r.branches.delete(projectId, branch.branch_project_id);
|
|
|
777
777
|
|
|
778
778
|
Scoped handles expose the same surface as `p.snapshots.*` and `p.branches.*`.
|
|
779
779
|
|
|
780
|
-
###
|
|
780
|
+
### repos (`r.repos`) — the encrypted Git remote behind `run402 repos`, and its isomorphic/Node split
|
|
781
781
|
|
|
782
|
-
`r.
|
|
782
|
+
`r.repos` is the host-blind encrypted Git remote (`r402s/v0`): KyGit is the brand, a vault is the resource, and a repo is what you have, so the SDK namespace matches the CLI noun. Every piece of protocol behaviour — crypto core, keystore, creation journal, snapshot + capture, publication state machines, ref transactions, verification budget, repair — lives here once; `run402 repos …`, `git-remote-run402`, and the MCP tools (`repos_view`/`repos_list_heads`/`repos_fsck`) are adapters over this namespace with identical semantics.
|
|
783
783
|
|
|
784
784
|
**Three claims, three different strengths.** These are the entire approved claims vocabulary:
|
|
785
785
|
|
|
786
|
-
- **Run402 cannot decrypt your
|
|
786
|
+
- **Run402 cannot decrypt your vault or repository history. Deployment artifacts remain a disclosed plaintext custody boundary.** Cryptographic, against Run402 itself: source payload and repository-history content are ciphertext-only; the substrate retains only enumerated plaintext metadata and holds zero vault keys. The deploy lane is separate and disclosed — the platform custodially holds the plaintext artifacts of every deploy.
|
|
787
787
|
- **Activation requires vault admission by default; an explicit, audited override can bypass it.** An operational platform invariant, not a cryptographic one.
|
|
788
788
|
- **Retention is an operational promise of the platform, not a cryptographic guarantee against it** (the host controls timestamps and bytes).
|
|
789
789
|
|
|
790
|
-
**The split.** Vault reads need only the HTTP client and run anywhere — a browser, a worker, an isolate. The verbs that touch a git working tree or the on-disk keystore are **Node-only** and are reached through dynamic imports, so `import { run402 } from "@run402/sdk"` in a browser never pulls `node:fs` into the graph. Calling a Node-only verb outside Node throws a `LocalError` with code `
|
|
790
|
+
**The split.** Vault reads need only the HTTP client and run anywhere — a browser, a worker, an isolate. The verbs that touch a git working tree or the on-disk keystore are **Node-only** and are reached through dynamic imports, so `import { run402 } from "@run402/sdk"` in a browser never pulls `node:fs` into the graph. Calling a Node-only verb outside Node throws a `LocalError` with code `VAULT_NODE_ONLY` rather than a module-resolution crash.
|
|
791
791
|
|
|
792
792
|
```ts
|
|
793
793
|
// Isomorphic — @run402/sdk or @run402/sdk/node.
|
|
794
|
-
const vault = await r.
|
|
795
|
-
const page = await r.
|
|
796
|
-
await r.
|
|
794
|
+
const vault = await r.repos.forProject(projectId); // cold restart: resolves repo_id with no local state
|
|
795
|
+
const page = await r.repos.heads(vault.repo_id, { after_generation: "0000000000000001", limit: "100" });
|
|
796
|
+
await r.repos.setPolicy(vault.repo_id, { vault_policy: "required" });
|
|
797
797
|
```
|
|
798
798
|
|
|
799
799
|
```ts
|
|
@@ -801,46 +801,46 @@ await r.gitvault.setPolicy(vault.repo_id, { gitvault_policy: "required" });
|
|
|
801
801
|
import { run402 } from "@run402/sdk/node";
|
|
802
802
|
const r = run402();
|
|
803
803
|
|
|
804
|
-
const pushed = await r.
|
|
805
|
-
const state = await r.
|
|
806
|
-
const plan = await r.
|
|
804
|
+
const pushed = await r.repos.capture({ project_id: projectId, snapshot: { message: "wip: refactor the parser" } });
|
|
805
|
+
const state = await r.repos.verify({ project_id: projectId });
|
|
806
|
+
const plan = await r.repos.prune({ project_id: projectId }); // plans; plan.submitted is false until you submit
|
|
807
807
|
```
|
|
808
808
|
|
|
809
809
|
`heads` paging (D186): `after_generation` is the REQUIRED verification anchor — a semantic input, never a paging knob — and stays CONSTANT across a page sequence; `limit` is required; `cursor` is omitted on the first request and thereafter is the prior page's `next_cursor` echoed unchanged. `allHeads` walks that sequence for you.
|
|
810
810
|
|
|
811
811
|
**Nothing here is memoised.** Two responses are secret-bearing — the maintenance lease's `holder_token` (returned exactly once) and anything derived from the keystore — so they are never cached, never persisted into an agent-surface result store, and never logged.
|
|
812
812
|
|
|
813
|
-
`
|
|
813
|
+
`vaultRemoteUrl(orgId, projectId)` / `parseVaultRemoteUrl(url)` are exported helpers for the `run402::<org_id>/<project_id>` remote form that `git-remote-run402` serves; `r.repos.scaffoldRemote(...)` is what `run402 init` calls to add it — claiming `origin` when the repository has none yet, falling back to `run402` when `origin` is already taken by something else, and never modifying an existing remote either way. A `repo_dir` that lies inside another repository is reported `skipped` with a `create_nested_repo` next action; `scaffoldRemote({ …, nested: true })` (and `init({ …, nested: true })`) makes it its own nested repository instead (`git init -b main`, the remote added there) and appends exactly one line to the enclosing repository's local `.git/info/exclude`, reporting `nested`, `enclosing_toplevel`, and `excluded_in_enclosing`.
|
|
814
814
|
|
|
815
|
-
**Lazy allocation on first open.** `r.
|
|
815
|
+
**Lazy allocation on first open.** `r.repos.openOrCreate({ project_id, org_id, repo_dir? })` resolves `repo_id` from `project_id` exactly like `open()`; when that resolution fails AND `org_id` was supplied, it runs the six-stage creation journal to allocate the vault before opening it. Without `org_id` it is byte-identical to `open()`. `capture({ org_id, onVaultCreated })` composes this internally, so `git push` and `repos capture` allocate inline against an unregistered project — `onVaultCreated` fires with the one-shot recovery receipt the instant allocation lands, before capture/publish continue.
|
|
816
816
|
|
|
817
|
-
**Named addressing, id-pinning, and push-to-create.** `run402::<org-slug>/<name>` works alongside the id-form `run402::<org_id>/<project_id>` in the same slot — `
|
|
817
|
+
**Named addressing, id-pinning, and push-to-create.** `run402::<org-slug>/<name>` works alongside the id-form `run402::<org_id>/<project_id>` in the same slot — `vaultRemoteAddressForm(address)` discriminates them (a real org id is always a UUID and a real project id always `prj_`-prefixed, so an id-form address satisfies both at once). `r.repos.resolveOrCreateAddress({ address, repo_dir?, allow_create? })` resolves a parsed address, pinning the resolved `repo_id` into that checkout's LOCAL git config (`git config r402.repoId`) the first time a SLUG-form address resolves; every later open on that checkout follows the pin, skipping the resolution round-trip and surviving a later rename of either half. `allow_create: true` push-to-creates on a slug-form miss — the project and vault are allocated atomically, and `push({ address })` uses this instead of `openOrCreate` when `address` is passed. `REPO_CREATION_CONFLICT` (a race lost to a concurrent pusher) resolves to the winner's repo automatically; `SLUG_RELEASED` (`vaultSlugReleasedInfo(err)`) is NEVER auto-followed.
|
|
818
818
|
|
|
819
|
-
**Handoff / resume — pass a working tree to another agent (kygit-handoff).** `r.
|
|
819
|
+
**Handoff / resume — pass a working tree to another agent (kygit-handoff).** `r.repos.handoff({ project_id, note, role?, ttlSeconds?, includeSensitive? })` captures the working tree into a synthetic stash-shaped checkpoint (same 3-parent shape real `git stash push -u` produces — an outer tracked-worktree-state commit, an index-tree parent, a parentless untracked-tree parent), pushes it as a retention root, and mints a single-use bearer `kgh1_<base64url(handoff_id[16] ‖ master_secret[32])>` key — returned in `handoff_key`, which is the ONLY copy; nothing else in the response, and nothing this library logs, ever carries it. `r.repos.resume({ key, to? })` claims the key (a same-principal replay dedups safely rather than erroring), clones a fresh checkout, and reapplies the checkpoint with `git stash apply --index`. Sensitive untracked paths (`.env`, `*.pem`, `id_rsa*`, SSH/AWS/GPG directories, 22 globs total — exported as `VAULT_HANDOFF_SENSITIVE_DENYLIST`) are excluded from capture unless named in `includeSensitive`. `r.repos.listHandoffs`/`revokeHandoff` manage outstanding keys.
|
|
820
820
|
|
|
821
821
|
```ts
|
|
822
|
-
const minted = await r.
|
|
822
|
+
const minted = await r.repos.handoff({
|
|
823
823
|
project_id: projectId,
|
|
824
824
|
note: { schema: "kygit.handoff-note.v1", created_at: new Date().toISOString(), from: { agent: "claude" }, summary: "refactored the parser" },
|
|
825
825
|
});
|
|
826
826
|
console.log(minted.handoff_key); // kgh1_… — print it ALONE, this is the only copy
|
|
827
827
|
|
|
828
828
|
// on another machine, with no shared keystore or wallet:
|
|
829
|
-
const resumed = await r.
|
|
829
|
+
const resumed = await r.repos.resume({ key: "kgh1_…" });
|
|
830
830
|
console.log(resumed.restored.dir); // the fresh checkout, dirty state reapplied
|
|
831
831
|
```
|
|
832
832
|
|
|
833
|
-
**Invite / join — a second agent into the SAME work, dirty tree included (kygit-invite).** The second claim kind beside handoff/resume, sharing the same crypto/keystore/restore machinery, kind-parameterized: a Handoff passes the work on and the sender stops; an Invite grows the team while the sender keeps working. `r.
|
|
833
|
+
**Invite / join — a second agent into the SAME work, dirty tree included (kygit-invite).** The second claim kind beside handoff/resume, sharing the same crypto/keystore/restore machinery, kind-parameterized: a Handoff passes the work on and the sender stops; an Invite grows the team while the sender keeps working. `r.repos.invite({ project_id, note, roomKey?, role?, ttlSeconds?, includeSensitive?, program?, model?, sessionKey? })` captures the checkpoint exactly like `handoff` — the inviter's own worktree, index, branch, refs, and access are all untouched — registers the inviter's OWN presence in the invite's room (the project's default room, or `roomKey` for a named org room) BEFORE minting, mints a single-use bearer `kgi1_<base64url(invite_id[16] ‖ master_secret[32])>` key (returned in `invite_key`, the ONLY copy), and posts ONE room message naming the checkpoint and invite id (never the key) — a presence or fact-post failure is reported in `inviter_presence`/`room_message` and never voids the mint. `r.repos.join({ key, to?, program?, model?, sessionKey? })` claims it (a same-principal replay dedups safely), clones a fresh checkout, reapplies the checkpoint with `git stash apply --index`, pins the invite's OWN room locally (`r402.room`), registers this session's presence, posts ONE arrival message, and returns the inviter (name, labels, liveness), `live_presences`, the catch-up `cursor`, and the last few `recent_messages` — the joiner's first message needs no lookup. `r.repos.listInvites`/`revokeInvite` manage outstanding keys. A `kgh1_…` key handed to `join()`, or a `kgi1_…` key handed to `resume()`, is refused BY NAME (`INVITE_KEY_WRONG_KIND`/`HANDOFF_KEY_WRONG_KIND`) before any network call.
|
|
834
834
|
|
|
835
835
|
```ts
|
|
836
|
-
const minted = await r.
|
|
836
|
+
const minted = await r.repos.invite({
|
|
837
837
|
project_id: projectId,
|
|
838
838
|
note: { schema: "kygit.invite-note.v1", created_at: new Date().toISOString(), from: { agent: "claude" }, summary: "bringing in a second agent to pair on the parser" },
|
|
839
839
|
});
|
|
840
840
|
console.log(minted.invite_key); // kgi1_… — print it ALONE, this is the only copy
|
|
841
841
|
|
|
842
842
|
// on another machine, with no shared keystore or wallet:
|
|
843
|
-
const joined = await r.
|
|
843
|
+
const joined = await r.repos.join({ key: "kgi1_…" });
|
|
844
844
|
console.log(joined.restored.dir); // the fresh checkout, dirty state reapplied
|
|
845
845
|
console.log(joined.inviter?.name); // who invited you, and whether they're still live
|
|
846
846
|
|
|
@@ -849,13 +849,13 @@ const heard = await r.rooms.waitForMessages(joined.membership.organization_id, j
|
|
|
849
849
|
console.log(heard.settled, heard.messages, heard.live_presences);
|
|
850
850
|
```
|
|
851
851
|
|
|
852
|
-
**
|
|
852
|
+
**One remote scheme.** `vaultRemoteUrl`/`vaultRemoteUrlForRepo` render `run402::<org>/<name>`; `parseVaultRemoteUrl` accepts `run402::` only and throws `REMOTE_SCHEME_UNSUPPORTED`, naming the scheme, for any other `<scheme>::` address.
|
|
853
853
|
|
|
854
|
-
**Allocating a vault does not change deploy policy.** `
|
|
854
|
+
**Allocating a vault does not change deploy policy.** `vault_policy` stays whatever it already was — `null` for a project whose vault was just allocated. The apply engine (`applyWithVault`) attaches a typed `next_actions` entry (`vault_policy_required`) and a `warnings[]` entry on every deploy of a vaulted, ungated project, but never blocks or prompts; only `setPolicy(repoId, { vault_policy: "required" })` (or `"grandfathered"`) changes the gate.
|
|
855
855
|
|
|
856
|
-
**The progressive terminal-loss warning.** `status()` stays quiet at genesis and adds a `terminal_loss_risk` entry to `warnings[]` once the vault crosses any of ≥10 admitted generations, ≥10 MB `storage.source_bytes`, or ≥14 days since `genesis_admitted_at` — an OR-composite, computed by the pure, exported `
|
|
856
|
+
**The progressive terminal-loss warning.** `status()` stays quiet at genesis and adds a `terminal_loss_risk` entry to `warnings[]` once the vault crosses any of ≥10 admitted generations, ≥10 MB `storage.source_bytes`, or ≥14 days since `genesis_admitted_at` — an OR-composite, computed by the pure, exported `vaultLossWarningTrip(record)` / `vaultLossWarningTripped(trip)` / `vaultLossWarningMessage(trip)` helpers (thresholds in `VAULT_LOSS_WARNING_THRESHOLDS`, tunable in this one place). There is deliberately no companion "resolved" check: V0 cannot detect a second principal able to open the vault, so nothing in the SDK ever clears a tripped warning.
|
|
857
857
|
|
|
858
|
-
**Terminal loss (protocol §0).** In V0-A, **whole-machine or whole-keystore loss is terminal for vault history until human envelopes ship** — `status()` carries the statement verbatim in `terminal_loss_statement` / `terminal_loss_detail`. The vault protects source history from host-side loss while a principal keystore survives. Back up the keystore directory `run402 repos view` reports as `keystore.root` and prints under the terminal-loss statement — `~/.config/run402/
|
|
858
|
+
**Terminal loss (protocol §0).** In V0-A, **whole-machine or whole-keystore loss is terminal for vault history until human envelopes ship** — `status()` carries the statement verbatim in `terminal_loss_statement` / `terminal_loss_detail`. The vault protects source history from host-side loss while a principal keystore survives. Back up the keystore directory `run402 repos view` reports as `keystore.root` and prints under the terminal-loss statement — `~/.config/run402/vault` for the default wallet, `~/.config/run402/profiles/<wallet>/vault` for a named one. The recovery receipt `init` prints once is an integrity anchor, not a decryption key: it proves the vault you are served is the one you created, and it decrypts nothing.
|
|
859
859
|
|
|
860
860
|
### GitHub Actions OIDC — CI credentials drive deploy
|
|
861
861
|
|
|
@@ -6,7 +6,7 @@ export interface StoredProject {
|
|
|
6
6
|
last_deployment_id?: string;
|
|
7
7
|
/**
|
|
8
8
|
* The owning organization, cached so a returning machine can build addresses
|
|
9
|
-
* that need it — the `run402::<org_id>/<project_id>`
|
|
9
|
+
* that need it — the `run402::<org_id>/<project_id>` vault remote is the
|
|
10
10
|
* first — WITHOUT a control-plane round trip.
|
|
11
11
|
*
|
|
12
12
|
* NOT a secret and NOT an authorization input: it is a routing identifier the
|