run402-mcp 4.28.0 → 4.29.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.d.ts +9 -1
- package/sdk/dist/namespaces/deploy.d.ts.map +1 -1
- package/sdk/dist/namespaces/deploy.js +38 -5
- package/sdk/dist/namespaces/deploy.js.map +1 -1
- package/sdk/dist/namespaces/deploy.types.d.ts +44 -0
- package/sdk/dist/namespaces/deploy.types.d.ts.map +1 -1
- package/sdk/dist/namespaces/gitvault.d.ts +1 -1
- package/sdk/dist/namespaces/gitvault.d.ts.map +1 -1
- package/sdk/dist/node/gitvault-apply.d.ts +104 -0
- package/sdk/dist/node/gitvault-apply.d.ts.map +1 -0
- package/sdk/dist/node/gitvault-apply.js +192 -0
- package/sdk/dist/node/gitvault-apply.js.map +1 -0
- package/sdk/dist/node/gitvault-creation-journal.d.ts +1 -1
- package/sdk/dist/node/gitvault-creation-journal.js +1 -1
- package/sdk/dist/node/gitvault-deploy.d.ts +58 -17
- package/sdk/dist/node/gitvault-deploy.d.ts.map +1 -1
- package/sdk/dist/node/gitvault-deploy.js +92 -17
- package/sdk/dist/node/gitvault-deploy.js.map +1 -1
- package/sdk/dist/node/gitvault-keystore.d.ts +1 -1
- package/sdk/dist/node/gitvault-keystore.js +1 -1
- package/sdk/dist/node/gitvault-publication.d.ts +1 -1
- package/sdk/dist/node/gitvault-publication.js +2 -2
- package/sdk/dist/node/gitvault-publication.js.map +1 -1
- package/sdk/dist/node/gitvault-snapshot.d.ts +58 -1
- package/sdk/dist/node/gitvault-snapshot.d.ts.map +1 -1
- package/sdk/dist/node/gitvault-snapshot.js +129 -39
- package/sdk/dist/node/gitvault-snapshot.js.map +1 -1
- package/sdk/dist/node/index.d.ts +6 -4
- package/sdk/dist/node/index.d.ts.map +1 -1
- package/sdk/dist/node/index.js +6 -2
- package/sdk/dist/node/index.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.29.0",
|
|
4
4
|
"packageManager": "npm@11.19.0",
|
|
5
5
|
"mcpName": "com.run402/mcp",
|
|
6
6
|
"description": "MCP server for Run402 — pay-per-call infrastructure for AI agents over x402 USDC micropayments. Generate an image for $0.03 with no signup, or provision Postgres databases with REST API, auth, storage and row-level security.",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"test:sync": "node --test --import tsx sync.test.ts examples/tenant-x402-wallet-stats/example.test.mjs",
|
|
34
34
|
"test:run402-app-schema-drift": "node scripts/check-run402-app-schema-drift.mjs",
|
|
35
35
|
"test:docs": "node scripts/check-typed-config-docs.mjs && npm run check:docs --workspace=@run402/sdk -- --skip-build",
|
|
36
|
-
"test": "npm run build && node scripts/build-agent-skills-index.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 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-gitvault-surface.test.mjs cli-identity-link.test.mjs cli-identity-link-matrix.test.mjs cli-redeem.test.mjs cli/lib/buzz.test.mjs && node --test cli-output-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-conventions-gate.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-ci.test.mjs cli-deploy-ci.test.mjs cli-operator-loopback.test.mjs cli-gitvault-remote-helper.test.mjs cli-deploy-gitvault-
|
|
37
|
-
"test:e2e": "npm run build && node --test cli-core-target.test.mjs && node --experimental-test-module-mocks --test cli-gitvault-surface.test.mjs cli-identity-link.test.mjs cli-identity-link-matrix.test.mjs cli-redeem.test.mjs && node --test cli-output-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-conventions-gate.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-ci.test.mjs cli-deploy-ci.test.mjs cli-operator-loopback.test.mjs cli-gitvault-remote-helper.test.mjs cli-deploy-gitvault-
|
|
36
|
+
"test": "npm run build && node scripts/build-agent-skills-index.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 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-gitvault-surface.test.mjs cli-identity-link.test.mjs cli-identity-link-matrix.test.mjs cli-redeem.test.mjs cli/lib/buzz.test.mjs && node --test cli-output-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-conventions-gate.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-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-bootstrap-next-actions.test.mjs && npm run test:docs",
|
|
37
|
+
"test:e2e": "npm run build && node --test cli-core-target.test.mjs && node --experimental-test-module-mocks --test cli-gitvault-surface.test.mjs cli-identity-link.test.mjs cli-identity-link-matrix.test.mjs cli-redeem.test.mjs && node --test cli-output-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-conventions-gate.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-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-bootstrap-next-actions.test.mjs",
|
|
38
38
|
"test:help": "npm run build && node --test cli-help.test.mjs",
|
|
39
39
|
"test:integration": "node --test --import tsx core/src/siwx-integration.integ.ts",
|
|
40
40
|
"test:integration:full": "node --test --import tsx cli-integration.test.ts",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* behavior; this file is the implementation.
|
|
20
20
|
*/
|
|
21
21
|
import type { Client } from "../kernel.js";
|
|
22
|
-
import type { ApplyOptions, ActiveReleaseInventory, DeployEvent, DeployEventsResponse, DeployListOptions, DeployListResponse, DeployOperation, DeployResult, DeployResolveOptions, DeployResolveResponse, EdgeCoherenceReport, EdgeCoherenceWaitOptions, EdgeCoherenceWaitResult, OperationSnapshot, PlanResponse, PromoteOptions, PromoteResult, ReleaseDiffOptions, ReleaseInventory, ReleaseInventoryByIdOptions, ReleaseInventoryOptions, ReleaseSpec, ReleaseToReleaseDiff, RehearsePlanOptions, RehearsePlanResult, StartOptions } from "./deploy.types.js";
|
|
22
|
+
import type { ApplyOptions, ActiveReleaseInventory, DeployEvent, DeployEventsResponse, DeployListOptions, DeployListResponse, DeployOperation, DeployResult, DeployResolveOptions, DeployResolveResponse, EdgeCoherenceReport, EdgeCoherenceWaitOptions, EdgeCoherenceWaitResult, GitvaultCommitDeclaration, GitvaultPlanDeclaration, OperationSnapshot, PlanResponse, PromoteOptions, PromoteResult, ReleaseDiffOptions, ReleaseInventory, ReleaseInventoryByIdOptions, ReleaseInventoryOptions, ReleaseSpec, ReleaseToReleaseDiff, RehearsePlanOptions, RehearsePlanResult, StartOptions } from "./deploy.types.js";
|
|
23
23
|
export declare class Deploy {
|
|
24
24
|
private readonly client;
|
|
25
25
|
constructor(client: Client);
|
|
@@ -47,6 +47,8 @@ export declare class Deploy {
|
|
|
47
47
|
planId: string;
|
|
48
48
|
planFingerprint?: string;
|
|
49
49
|
};
|
|
50
|
+
/** gitvault §6.5: bind this plan to a capture (see `runGitvaultDeploy`). */
|
|
51
|
+
gitvault?: GitvaultPlanDeclaration;
|
|
50
52
|
}): Promise<{
|
|
51
53
|
plan: PlanResponse;
|
|
52
54
|
byteReaders: Map<string, ByteReader>;
|
|
@@ -76,6 +78,12 @@ export declare class Deploy {
|
|
|
76
78
|
planId: string;
|
|
77
79
|
planFingerprint?: string;
|
|
78
80
|
};
|
|
81
|
+
/**
|
|
82
|
+
* gitvault §6.5: present the activation token minted for this operation,
|
|
83
|
+
* or the audited unvaulted override. A `required` project refuses a
|
|
84
|
+
* commit that carries neither.
|
|
85
|
+
*/
|
|
86
|
+
gitvault?: GitvaultCommitDeclaration;
|
|
79
87
|
}): Promise<DeployResult>;
|
|
80
88
|
rehearse(planId: string, opts?: RehearsePlanOptions): Promise<RehearsePlanResult>;
|
|
81
89
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/namespaces/deplo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OAAO,CAAC,oBAAoB,CAAC;IA+BnE;;;;OAIG;IACG,OAAO,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAW1E;AA+6DD;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;iEAG6D;IAC7D,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;CACvC"}
|
|
@@ -93,7 +93,12 @@ export class Deploy {
|
|
|
93
93
|
* {@link Run402DeployError} on any state-machine failure.
|
|
94
94
|
*/
|
|
95
95
|
async apply(spec, opts = {}) {
|
|
96
|
-
|
|
96
|
+
// A gitvault-bound apply never auto-retries: each attempt plans a NEW
|
|
97
|
+
// operation, and an activation token is minted for exactly one. Retrying
|
|
98
|
+
// would either present a token bound elsewhere (the platform refuses, as
|
|
99
|
+
// it should) or demand a fresh capture, which is the caller's deliberate
|
|
100
|
+
// re-run — not something the client does behind their back.
|
|
101
|
+
const maxRetries = opts.gitvault ? 0 : normalizeApplyMaxRetries(opts.maxRetries);
|
|
97
102
|
const maxAttempts = maxRetries + 1;
|
|
98
103
|
const emit = makeEmitter(opts.onEvent);
|
|
99
104
|
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
@@ -153,6 +158,7 @@ export class Deploy {
|
|
|
153
158
|
dryRun: opts.dryRun ?? opts.mode === "legacyDryRun",
|
|
154
159
|
reviewedPlan: opts.mode === "reviewedPlan",
|
|
155
160
|
requiredPlan: opts.requiredPlan,
|
|
161
|
+
...(opts.gitvault ? { gitvault: opts.gitvault } : {}),
|
|
156
162
|
});
|
|
157
163
|
}
|
|
158
164
|
/**
|
|
@@ -173,7 +179,7 @@ export class Deploy {
|
|
|
173
179
|
*/
|
|
174
180
|
async commit(planId, opts = {}) {
|
|
175
181
|
const emit = makeEmitter(opts.onEvent);
|
|
176
|
-
const commit = requireCloudCommitResponse(await commitInternal(this.client, planId, opts.idempotencyKey, opts.project, opts.requiredPlan), "committing deploy");
|
|
182
|
+
const commit = requireCloudCommitResponse(await commitInternal(this.client, planId, opts.idempotencyKey, opts.project, opts.requiredPlan, opts.gitvault), "committing deploy");
|
|
177
183
|
return await pollUntilReady(this.client, commit, {}, [], emit, opts.project);
|
|
178
184
|
}
|
|
179
185
|
async rehearse(planId, opts = {}) {
|
|
@@ -543,11 +549,17 @@ function deriveSliceKinds(spec) {
|
|
|
543
549
|
async function applyOnce(client, spec, opts, emit) {
|
|
544
550
|
const allowWarningCodes = normalizeAllowWarningCodes(opts.allowWarningCodes);
|
|
545
551
|
const target = opts.target === "core" ? "core" : "cloud";
|
|
552
|
+
if (opts.gitvault && target === "core") {
|
|
553
|
+
// Refuse rather than drop the hooks: silently committing without the
|
|
554
|
+
// activation block would activate a `required` project unvaulted.
|
|
555
|
+
throw new Run402DeployError("gitvault-bound deploys are not supported against a self-hosted Core gateway; the vault gate is a Cloud control-plane capability.", { code: "GITVAULT_UNSUPPORTED_TARGET", phase: "validate", retryable: false, context: "applying deploy" });
|
|
556
|
+
}
|
|
546
557
|
const sliceKinds = deriveSliceKinds(spec);
|
|
547
558
|
emit({ type: "plan.started" });
|
|
548
559
|
const { plan, byteReaders } = await planInternal(client, spec, opts.idempotencyKey, {
|
|
549
560
|
target,
|
|
550
561
|
requiredPlan: opts.requiredPlan,
|
|
562
|
+
...(opts.gitvault ? { gitvault: opts.gitvault.declaration } : {}),
|
|
551
563
|
});
|
|
552
564
|
emit({ type: "plan.diff", diff: plan.diff });
|
|
553
565
|
emitPlanWarnings(plan, emit);
|
|
@@ -588,8 +600,20 @@ async function applyOnce(client, spec, opts, emit) {
|
|
|
588
600
|
status: "started",
|
|
589
601
|
...(sliceKinds.length > 0 ? { slice_kinds: sliceKinds } : {}),
|
|
590
602
|
});
|
|
591
|
-
const { planId } = requirePersistedPlan(plan, "applying deploy");
|
|
592
|
-
|
|
603
|
+
const { planId, operationId } = requirePersistedPlan(plan, "applying deploy");
|
|
604
|
+
// gitvault §6.5 — the handshake. Content is uploaded, so the artifacts this
|
|
605
|
+
// release ships are fixed; `authorize` verifies snapshot correspondence,
|
|
606
|
+
// mints the activation token, and hands back the commit block. It throws
|
|
607
|
+
// rather than returning when the deploy must not proceed, and nothing has
|
|
608
|
+
// been committed at that point.
|
|
609
|
+
const gitvaultCommit = opts.gitvault
|
|
610
|
+
? await opts.gitvault.authorize({
|
|
611
|
+
plan_id: planId,
|
|
612
|
+
operation_id: operationId,
|
|
613
|
+
apply_plan_sha256: plan.gitvault?.apply_plan_sha256 ?? null,
|
|
614
|
+
})
|
|
615
|
+
: undefined;
|
|
616
|
+
const commit = requireCloudCommitResponse(await commitInternal(client, planId, opts.idempotencyKey, spec.project, opts.requiredPlan, gitvaultCommit), "applying deploy");
|
|
593
617
|
const result = await pollUntilReady(client, commit, plan.diff, plan.warnings, emit, spec.project, sliceKinds);
|
|
594
618
|
// v1.48 unified-apply: thread the plan response's `asset_entries[]` back
|
|
595
619
|
// into DeployResult.assets so callers reading `result.assets.byKey[key]`
|
|
@@ -1013,6 +1037,11 @@ async function planInternal(client, spec, idempotencyKey, opts = {}) {
|
|
|
1013
1037
|
inlineBody.mode = "reviewed_plan";
|
|
1014
1038
|
if (opts.requiredPlan)
|
|
1015
1039
|
inlineBody.required_plan = requiredPlanToWire(opts.requiredPlan);
|
|
1040
|
+
// gitvault §6.5: the capture declaration must ride the SAME plan the gateway
|
|
1041
|
+
// digests, so it is set before the inline/manifest_ref size decision below
|
|
1042
|
+
// and re-attached to the manifest_ref body too.
|
|
1043
|
+
if (opts.gitvault)
|
|
1044
|
+
inlineBody.gitvault = opts.gitvault;
|
|
1016
1045
|
const inlineBytes = new TextEncoder().encode(JSON.stringify(inlineBody)).byteLength;
|
|
1017
1046
|
let body;
|
|
1018
1047
|
if (inlineBytes <= PLAN_BODY_LIMIT_BYTES) {
|
|
@@ -1054,6 +1083,8 @@ async function planInternal(client, spec, idempotencyKey, opts = {}) {
|
|
|
1054
1083
|
body = { spec: { project_id: spec.project }, manifest_ref: contentRefToWire(ref) };
|
|
1055
1084
|
if (idempotencyKey)
|
|
1056
1085
|
body.idempotency_key = idempotencyKey;
|
|
1086
|
+
if (opts.gitvault)
|
|
1087
|
+
body.gitvault = opts.gitvault;
|
|
1057
1088
|
}
|
|
1058
1089
|
let plan;
|
|
1059
1090
|
try {
|
|
@@ -1431,13 +1462,15 @@ function expandCronNumberPart(part, min, max) {
|
|
|
1431
1462
|
}
|
|
1432
1463
|
return values;
|
|
1433
1464
|
}
|
|
1434
|
-
async function commitInternal(client, planId, idempotencyKey, project, requiredPlan) {
|
|
1465
|
+
async function commitInternal(client, planId, idempotencyKey, project, requiredPlan, gitvault) {
|
|
1435
1466
|
try {
|
|
1436
1467
|
const body = {};
|
|
1437
1468
|
if (idempotencyKey)
|
|
1438
1469
|
body.idempotency_key = idempotencyKey;
|
|
1439
1470
|
if (requiredPlan)
|
|
1440
1471
|
body.required_plan = requiredPlanToWire(requiredPlan);
|
|
1472
|
+
if (gitvault)
|
|
1473
|
+
body.gitvault = gitvault;
|
|
1441
1474
|
return await client.request(`/apply/v1/plans/${encodeURIComponent(planId)}/commit`, {
|
|
1442
1475
|
method: "POST",
|
|
1443
1476
|
body,
|