run402-mcp 4.47.0 → 4.49.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/package.json +3 -3
- package/sdk/dist/namespaces/deploy.js +64 -7
- package/sdk/dist/namespaces/deploy.js.map +1 -1
- package/sdk/dist/namespaces/gitvault.d.ts +18 -6
- package/sdk/dist/namespaces/gitvault.d.ts.map +1 -1
- package/sdk/dist/namespaces/gitvault.js +23 -6
- package/sdk/dist/namespaces/gitvault.js.map +1 -1
- package/sdk/dist/node/gitvault-address.d.ts +18 -5
- package/sdk/dist/node/gitvault-address.d.ts.map +1 -1
- package/sdk/dist/node/gitvault-address.js +57 -9
- package/sdk/dist/node/gitvault-address.js.map +1 -1
- package/sdk/dist/node/gitvault-keystore.d.ts +42 -0
- package/sdk/dist/node/gitvault-keystore.d.ts.map +1 -1
- package/sdk/dist/node/gitvault-keystore.js +130 -0
- package/sdk/dist/node/gitvault-keystore.js.map +1 -1
- package/sdk/dist/node/gitvault-publication.d.ts +130 -8
- package/sdk/dist/node/gitvault-publication.d.ts.map +1 -1
- package/sdk/dist/node/gitvault-publication.js +418 -39
- package/sdk/dist/node/gitvault-publication.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "run402-mcp",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.49.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.",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"test:sync": "node --test --import tsx sync.test.ts examples/tenant-x402-wallet-stats/example.test.mjs",
|
|
35
35
|
"test:run402-app-schema-drift": "node scripts/check-run402-app-schema-drift.mjs",
|
|
36
36
|
"test:docs": "node scripts/check-typed-config-docs.mjs && npm run check:docs --workspace=@run402/sdk -- --skip-build",
|
|
37
|
-
"test": "npm run build && node scripts/build-agent-skills-index.mjs --check && node scripts/build-gitvault-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-gitvault-surface.test.mjs examples/tenant-x402-wallet-stats/example.test.mjs 'core/src/**/*.test.ts' 'sdk/src/**/*.test.ts' 'src/**/*.test.ts' && node --test cli-core-target.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-gitvault-retired.test.mjs cli-projects-gitvault-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/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-provision-active.test.mjs cli-typed-config-modes.test.mjs cli-argv.test.mjs cli-gitvault-retired.test.mjs cli-conventions-gate.test.mjs cli-doctor.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-harness-context.test.mjs cli-ci.test.mjs cli-deploy-ci.test.mjs cli-operator-loopback.test.mjs cli-gitvault-remote-helper.test.mjs cli-deploy-gitvault-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/pay.test.mjs cli/lib/up.test.mjs cli/lib/update-check.test.mjs cli-bootstrap-next-actions.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-gitvault-retired.test.mjs cli-up-repo-compose.test.mjs cli-projects-gitvault-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 && 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-provision-active.test.mjs cli-typed-config-modes.test.mjs cli-argv.test.mjs cli-gitvault-retired.test.mjs cli-conventions-gate.test.mjs cli-doctor.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-harness-context.test.mjs cli-ci.test.mjs cli-deploy-ci.test.mjs cli-operator-loopback.test.mjs cli-gitvault-remote-helper.test.mjs cli-deploy-gitvault-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/up.test.mjs cli/lib/update-check.test.mjs cli-bootstrap-next-actions.test.mjs",
|
|
37
|
+
"test": "npm run build && node scripts/build-agent-skills-index.mjs --check && node scripts/build-gitvault-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-gitvault-surface.test.mjs examples/tenant-x402-wallet-stats/example.test.mjs 'core/src/**/*.test.ts' 'sdk/src/**/*.test.ts' 'src/**/*.test.ts' && node --test cli-core-target.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-gitvault-retired.test.mjs cli-projects-gitvault-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/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-provision-active.test.mjs cli-typed-config-modes.test.mjs cli-argv.test.mjs cli-gitvault-retired.test.mjs cli-conventions-gate.test.mjs cli-doctor.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-harness-context.test.mjs cli-ci.test.mjs cli-deploy-ci.test.mjs cli-operator-loopback.test.mjs cli-gitvault-remote-helper.test.mjs cli-deploy-gitvault-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/pay.test.mjs cli/lib/up.test.mjs cli/lib/update-check.test.mjs cli-bootstrap-next-actions.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-gitvault-retired.test.mjs cli-up-repo-compose.test.mjs cli-projects-gitvault-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 && 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-provision-active.test.mjs cli-typed-config-modes.test.mjs cli-argv.test.mjs cli-gitvault-retired.test.mjs cli-conventions-gate.test.mjs cli-doctor.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-harness-context.test.mjs cli-ci.test.mjs cli-deploy-ci.test.mjs cli-operator-loopback.test.mjs cli-gitvault-remote-helper.test.mjs cli-deploy-gitvault-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/up.test.mjs cli/lib/update-check.test.mjs cli-bootstrap-next-actions.test.mjs",
|
|
39
39
|
"test:help": "npm run build && node --test cli-help.test.mjs",
|
|
40
40
|
"test:integration": "node --test --import tsx core/src/siwx-integration.integ.ts",
|
|
41
41
|
"test:integration:full": "node --test --import tsx cli-integration.test.ts",
|
|
@@ -3873,10 +3873,21 @@ async function uploadInlineCas(client, projectId, bytes, contentType) {
|
|
|
3873
3873
|
* `/apply/v1/plans*` use SIWX, which the kernel's getAuth provides
|
|
3874
3874
|
* automatically — only the apikey-gated paths need this helper.
|
|
3875
3875
|
*
|
|
3876
|
-
*
|
|
3877
|
-
*
|
|
3878
|
-
*
|
|
3879
|
-
*
|
|
3876
|
+
* COLD-RESTART RECOVERY (gitvault-deploy-lane 6.5a, the #624 class one layer
|
|
3877
|
+
* in): when the local credential cache has no entry for the project — the
|
|
3878
|
+
* returning-agent case, where the wallet survives but the once-issued project
|
|
3879
|
+
* keys did not — this helper mints a SHORT-LIVED anon token via
|
|
3880
|
+
* `POST /projects/v1/:project_id/tokens` (the route the platform built as
|
|
3881
|
+
* exactly this recovery path; the gateway's own 401 envelope names it as the
|
|
3882
|
+
* `mint_token` next_action) and uses it as the apikey, memoized in-process
|
|
3883
|
+
* until shortly before it expires. A wallet-holding agent on a fresh machine
|
|
3884
|
+
* deploys with zero extra commands; nothing durable is written anywhere.
|
|
3885
|
+
*
|
|
3886
|
+
* The mint is attempted only on a cache miss and never retried within a
|
|
3887
|
+
* process on failure; a client that cannot mint (no signer, no authority)
|
|
3888
|
+
* falls through to the pre-existing behavior — the request goes out without
|
|
3889
|
+
* an apikey and the gateway rejects with 401, whose envelope names the
|
|
3890
|
+
* recovery.
|
|
3880
3891
|
*/
|
|
3881
3892
|
async function apikeyHeaders(client, projectId) {
|
|
3882
3893
|
// A CI session and a delegate both already authorize these routes via
|
|
@@ -3886,9 +3897,55 @@ async function apikeyHeaders(client, projectId) {
|
|
|
3886
3897
|
if (isCiClient(client) || isDelegateClient(client))
|
|
3887
3898
|
return {};
|
|
3888
3899
|
const project = await client.getProject(projectId);
|
|
3889
|
-
if (
|
|
3890
|
-
return {};
|
|
3891
|
-
|
|
3900
|
+
if (project?.anon_key)
|
|
3901
|
+
return { apikey: project.anon_key };
|
|
3902
|
+
const minted = await mintedAnonToken(client, projectId);
|
|
3903
|
+
return minted ? { apikey: minted } : {};
|
|
3904
|
+
}
|
|
3905
|
+
/**
|
|
3906
|
+
* Per-client, per-project memo of short-lived minted anon tokens (plus a
|
|
3907
|
+
* one-shot "minting failed, don't hammer" marker). Held only in process
|
|
3908
|
+
* memory — a short-lived token must never land in a durable cache.
|
|
3909
|
+
*/
|
|
3910
|
+
const mintedTokenMemo = new WeakMap();
|
|
3911
|
+
/** Refresh margin: stop using a minted token this long before it expires. */
|
|
3912
|
+
const MINTED_TOKEN_REFRESH_MARGIN_MS = 30_000;
|
|
3913
|
+
async function mintedAnonToken(client, projectId) {
|
|
3914
|
+
let perProject = mintedTokenMemo.get(client);
|
|
3915
|
+
if (!perProject) {
|
|
3916
|
+
perProject = new Map();
|
|
3917
|
+
mintedTokenMemo.set(client, perProject);
|
|
3918
|
+
}
|
|
3919
|
+
const memo = perProject.get(projectId);
|
|
3920
|
+
if (memo) {
|
|
3921
|
+
if ("failed" in memo)
|
|
3922
|
+
return null;
|
|
3923
|
+
if (Date.now() < memo.expiresAtMs - MINTED_TOKEN_REFRESH_MARGIN_MS)
|
|
3924
|
+
return memo.token;
|
|
3925
|
+
}
|
|
3926
|
+
try {
|
|
3927
|
+
const issued = await client.request(`/projects/v1/${encodeURIComponent(projectId)}/tokens`, {
|
|
3928
|
+
method: "POST",
|
|
3929
|
+
// Least authority: the apikey-gated deploy legs need exactly what the
|
|
3930
|
+
// anon key carries, never the service key's power.
|
|
3931
|
+
body: { kind: "anon" },
|
|
3932
|
+
context: "minting a short-lived anon token for deploy (local project keys not cached)",
|
|
3933
|
+
});
|
|
3934
|
+
if (!issued?.secret) {
|
|
3935
|
+
perProject.set(projectId, { failed: true });
|
|
3936
|
+
return null;
|
|
3937
|
+
}
|
|
3938
|
+
const ttlMs = (typeof issued.expires_in === "number" && issued.expires_in > 0 ? issued.expires_in : 300) * 1000;
|
|
3939
|
+
perProject.set(projectId, { token: issued.secret, expiresAtMs: Date.now() + ttlMs });
|
|
3940
|
+
return issued.secret;
|
|
3941
|
+
}
|
|
3942
|
+
catch {
|
|
3943
|
+
// No signer, no authority, or the route is unavailable: fall through to
|
|
3944
|
+
// the pre-existing no-apikey behavior. Marked so one deploy's many
|
|
3945
|
+
// apikey-gated legs don't each re-attempt a doomed mint.
|
|
3946
|
+
perProject.set(projectId, { failed: true });
|
|
3947
|
+
return null;
|
|
3948
|
+
}
|
|
3892
3949
|
}
|
|
3893
3950
|
function isCiClient(client) {
|
|
3894
3951
|
return isCiSessionCredentials(client.credentials);
|