run402-mcp 4.148.4 → 4.148.6
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/dist/docs/llms-sdk.txt +1 -1
- package/package.json +1 -1
- package/sdk/dist/namespaces/deploy.d.ts.map +1 -1
- package/sdk/dist/namespaces/deploy.js +74 -20
- package/sdk/dist/namespaces/deploy.js.map +1 -1
- package/sdk/dist/namespaces/deploy.types.d.ts +9 -0
- package/sdk/dist/namespaces/deploy.types.d.ts.map +1 -1
- package/sdk/dist/node/actions-node.d.ts.map +1 -1
- package/sdk/dist/node/actions-node.js +59 -2
- package/sdk/dist/node/actions-node.js.map +1 -1
package/dist/docs/llms-sdk.txt
CHANGED
|
@@ -1073,7 +1073,7 @@ The full type is exported as `ReleaseSpec` from `@run402/sdk` and `@run402/sdk/n
|
|
|
1073
1073
|
- No-op specs fail locally. A spec with only `project` / `base`, or empty containers e.g. `site: {}`, `functions.patch.delete: []`, `secrets.require: []`, or `subdomains.set: []`, throws `Run402DeployError.code === "MANIFEST_EMPTY"` before any network call. Delete-only patches with non-empty `delete` arrays still count as deployable, and so does an explicit `site.replace: {}`: it takes the site's static files offline (the plan asks to confirm `ZERO_SITE_FILES_AFTER`, except for a release whose `ssr` function renders every path).
|
|
1074
1074
|
- Tier preflight is local but gateway remains authoritative. After normalization and before manifest CAS upload or `/apply/v1/plans`, `apply.plan/start/apply` check literal function `config.timeoutSeconds`, `config.memoryMb`, schedule-trigger cron minimum interval, and scheduled-trigger count when computable. Failures are `Run402DeployError.code === "BAD_FIELD"` with `details.field`, `details.value`, `details.tier`, `tier_max` or `min_interval_minutes`, and `details.limit_source` (`tier_status` or `local_static_fallback`). Current caps: prototype 10s / 128 MB / 1 scheduled trigger / 15 min, hobby 30s / 256 MB / 3 / 5 min, team 60s / 512 MB / 10 / 1 min; an SSR-class function (`class: "ssr"`) is checked against its own memory cap, 1,769 MB on team (prototype 128 MB, hobby 256 MB). The caps are those of the tier of the organization that owns the project (read from `GET /projects/v1/:project_id`), the tier the gateway judges the deploy by; `tier.status()` describes the wallet's own organization, so its `function_limits` / `limits.functions` (including current scheduled usage) count only when its tier is the project's.
|
|
1075
1075
|
- Plan warnings are structured. `PlanResponse.warnings` and `DeployResult.warnings` are `WarningEntry[]`; `apply()` emits `plan.warnings` and aborts before upload/commit when a warning requires confirmation unless broad `allowWarnings` is set or every blocking warning code is listed in `allowWarningCodes`. `MISSING_REQUIRED_SECRET` means set the affected keys with `r.secrets.set`, then retry. For `WILDCARD_ROUTE_EXCLUDES_MUTATION_METHODS`, add the mutation methods the function supports or omit methods for an API prefix; when the GET/HEAD final-wildcard function route is intentionally read-only, list the code in `allowWarningCodes` after inspecting all affected entries. `DESTRUCTIVE_SITE_BULK_REMOVAL` lists the counted removals in `affected`, and the SDK adds `details.removed_paths_summary` (heuristic: `pages`, `page_paths`, `content_hashed_build_assets`, `other`, `only_content_hashed_build_assets`, plus `by_top_level_dir` unless the gateway sends `counted_removed_by_dir`) so removals of pages are distinguishable from removed hashed bundles. The gateway already leaves out fingerprinted bundles the build replaces in the same directory (`details.replaced_fingerprinted`).
|
|
1076
|
-
- A migration's undo is on the result. When a commit runs a new migration, `DeployResult.restore_point` is `{ snapshot_id, restore_url }`, the pre-migration snapshot to restore (`run402 snapshots restore <project_id> <snapshot_id>`); when the commit went on without one, `DeployResult.snapshot_skipped_reason` says why: `explicit_skip_requested`, `capture_size_limit_exceeded` (with an `AUTO_SNAPSHOT_SKIPPED_OVERSIZED` warning in `warnings`), or `migrations_unchanged` (every migration was already applied, so no migration SQL ran).
|
|
1076
|
+
- A migration's undo is on the result. When a commit runs a new migration, `DeployResult.restore_point` is `{ snapshot_id, restore_url }`, the pre-migration snapshot to restore (`run402 snapshots restore <project_id> <snapshot_id>`); when the commit went on without one, `DeployResult.snapshot_skipped_reason` says why: `explicit_skip_requested`, `capture_size_limit_exceeded` (with an `AUTO_SNAPSHOT_SKIPPED_OVERSIZED` warning in `warnings`), or `migrations_unchanged` (every migration was already applied, so no migration SQL ran). The operation snapshot (`apply.status(operationId)`) repeats both once the snapshot phase has finished, so every path that ends in a ready operation carries them: a ready commit, a deferred or `running` one the SDK polls to ready, and `apply.resume(operationId)`. When the snapshot states the outcome, the SDK takes it over the one carried from the commit.
|
|
1077
1077
|
- Deploy summaries are derived SDK helpers. `summarizeDeployResult(result: DeployResult): DeploySummary` is exported from `@run402/sdk` and `@run402/sdk/node`. It makes no gateway calls and summarizes only current reliable `DeployResult.diff` / `DeployResult.warnings` data: site path counts, CAS new/reused bytes, functions, migrations, routes, secrets, subdomains, and warning counts. Missing buckets are omitted, not zero-filled. It intentionally has no timings, client-side duration estimates, server phase estimates, or function old/new code hash fields.
|
|
1078
1078
|
- Safe release-race retries are automatic. For omitted/current-base specs, `apply()` re-plans and retries `BASE_RELEASE_CONFLICT` only when the gateway marks the error `safe_to_retry: true`. Pinned `base.release_id` and `{ release: "empty" }` stay caller-owned. Transient platform conditions the gateway marks `safe_to_retry: true` (`OPERATION_INTERRUPTED` when a gateway rollout replaced the task running the commit, `IMAGE_ENCODE_TIMEOUT` / `TOO_MANY_ENCODES_QUEUED` under encoder load, `PROJECT_WRITES_PAUSED` while a snapshot or archive export holds the write pause) are retried the same way for any base, with a longer backoff (2s, 4s, … capped at 15s); nothing was activated, and content is content-addressed, so the re-apply uploads nothing twice. Content plans and operation polls lost to a 502/503/504 or a dropped connection are repeated in place. Static activation/spec failures inside `activation_pending` throw immediately with gateway metadata preserved instead of polling until timeout. Pass `maxRetries: 0` to opt out.
|
|
1079
1079
|
- Plan envelopes are normalized. New gateways return `kind: "plan_response"` with `is_noop`, `summary`, `warnings`, `expected_events`, and resource buckets at top level. The SDK preserves those fields and also folds them into `PlanResponse.diff` for compatibility, including `public_paths` (`mode_old`, `mode_new`, `added`, `removed`, `changed`: which browser URLs serve which asset) and `site_settings` (`effective` and `changed` for `noindex`, `embedding`, `sign_in_path`) when the gateway returns them; a change to either alone is not a noop. `summarizeDeployResult` counts `public_paths` and lists `site_settings_changed`. Dry-run plans return `plan_id: null` and `operation_id: null` and cannot be uploaded or committed.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "run402-mcp",
|
|
3
|
-
"version": "4.148.
|
|
3
|
+
"version": "4.148.6",
|
|
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.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/namespaces/deploy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAwB3C,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EAQtB,WAAW,EACX,oBAAoB,EAEpB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EAIvB,sBAAsB,EACtB,oBAAoB,EAUpB,iBAAiB,EAGjB,YAAY,EACZ,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,2BAA2B,EAC3B,uBAAuB,EACvB,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAGlB,YAAY,EAEb,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/namespaces/deploy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAwB3C,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EAQtB,WAAW,E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15 @@ const APPLY_RETRY_DEFAULT_MAX_RETRIES = 2;
|
|
|
40
40
|
const APPLY_RETRY_BASE_DELAY_MS = 250;
|
|
41
41
|
const APPLY_RETRY_MAX_DELAY_MS = 2_000;
|
|
42
42
|
const APPLY_RETRY_JITTER_MS = 100;
|
|
43
|
-
const CONTENT_COMMIT_MAX_ATTEMPTS = 3;
|
|
44
43
|
const DEPLOY_COMMIT_MAX_ATTEMPTS = 3;
|
|
45
44
|
const DEPLOY_COMMIT_RETRY_BASE_DELAY_MS = 1_000;
|
|
46
|
-
|
|
45
|
+
/** A content commit the gateway answered 202 is read back on this schedule. */
|
|
46
|
+
const CONTENT_COMMIT_POLL_INITIAL_MS = 1_000;
|
|
47
|
+
const CONTENT_COMMIT_POLL_MAX_MS = 10_000;
|
|
48
|
+
const CONTENT_COMMIT_POLL_TIMEOUT_MS = 60 * 60 * 1000;
|
|
49
|
+
/** The commit answers within 20 s (200 when done, else 202 with a poll) instead
|
|
50
|
+
* of holding the request for as long as a large promote takes (RFC 7240). */
|
|
51
|
+
const CONTENT_COMMIT_PREFER = "respond-async, wait=20";
|
|
47
52
|
const URL_REFRESH_AT_MS = 50 * 60 * 1000;
|
|
48
53
|
const SECRET_KEY_RE = /^[A-Z_][A-Z0-9_]{0,127}$/;
|
|
49
54
|
const APPLY_SAFE_RETRY_CODES = new Set([
|
|
@@ -1874,7 +1879,7 @@ async function uploadMissing(client, projectId, presence, byteReaders, emit) {
|
|
|
1874
1879
|
// Plan-level finalize — marks the plan committed in the deploy_plans
|
|
1875
1880
|
// table. Per-session promotion to CAS already happened in the loop
|
|
1876
1881
|
// above; this call is the plan-level idempotency anchor.
|
|
1877
|
-
await
|
|
1882
|
+
await commitContentPlan(client, planRes.plan_id, headers);
|
|
1878
1883
|
}
|
|
1879
1884
|
async function uploadCoreContent(client, projectId, byteReaders, emit) {
|
|
1880
1885
|
const entries = [...byteReaders.entries()].sort(([a], [b]) => a.localeCompare(b));
|
|
@@ -1904,27 +1909,67 @@ async function uploadCoreContent(client, projectId, byteReaders, emit) {
|
|
|
1904
1909
|
}
|
|
1905
1910
|
}
|
|
1906
1911
|
/**
|
|
1907
|
-
* Finalize a content plan
|
|
1908
|
-
*
|
|
1909
|
-
*
|
|
1910
|
-
*
|
|
1911
|
-
*
|
|
1912
|
+
* Finalize a content plan by following the gateway's answer. The gateway runs
|
|
1913
|
+
* one commit per plan, detached from the request, and with
|
|
1914
|
+
* `Prefer: respond-async, wait=20` answers its state within 20 s: 200
|
|
1915
|
+
* is done; 202 `committing` is followed by reading the plan (its `poll` next
|
|
1916
|
+
* action) until the commit is terminal; a read that says `pending` (the commit
|
|
1917
|
+
* never reached the gateway) is followed by the commit it names. A 502/503/504
|
|
1918
|
+
* or a dropped connection on the commit becomes a read of the plan, never a
|
|
1919
|
+
* second commit. `failed` and `expired` throw with the plan id.
|
|
1912
1920
|
*/
|
|
1913
|
-
async function
|
|
1914
|
-
|
|
1921
|
+
async function commitContentPlan(client, planId, headers) {
|
|
1922
|
+
const planPath = `/content/v1/plans/${encodeURIComponent(planId)}`;
|
|
1923
|
+
const postCommit = async () => {
|
|
1915
1924
|
try {
|
|
1916
|
-
await client.request(
|
|
1917
|
-
|
|
1925
|
+
return await client.request(`${planPath}/commit`, {
|
|
1926
|
+
method: "POST",
|
|
1927
|
+
headers: { ...headers, Prefer: CONTENT_COMMIT_PREFER },
|
|
1928
|
+
body: {},
|
|
1929
|
+
context: "committing content upload",
|
|
1930
|
+
});
|
|
1918
1931
|
}
|
|
1919
1932
|
catch (err) {
|
|
1920
|
-
if (
|
|
1921
|
-
return;
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1933
|
+
if (isTransientGatewayFailure(err))
|
|
1934
|
+
return null;
|
|
1935
|
+
throw err;
|
|
1936
|
+
}
|
|
1937
|
+
};
|
|
1938
|
+
const deadline = Date.now() + CONTENT_COMMIT_POLL_TIMEOUT_MS;
|
|
1939
|
+
let delay = CONTENT_COMMIT_POLL_INITIAL_MS;
|
|
1940
|
+
let state = await postCommit();
|
|
1941
|
+
for (;;) {
|
|
1942
|
+
const status = state?.status;
|
|
1943
|
+
if (state && status !== "committing" && status !== "pending") {
|
|
1944
|
+
if (status === "failed" || status === "expired")
|
|
1945
|
+
throw contentCommitStateError(planId, state);
|
|
1946
|
+
return;
|
|
1925
1947
|
}
|
|
1948
|
+
if (Date.now() >= deadline) {
|
|
1949
|
+
throw new Run402DeployError(`Content commit for plan ${planId} was still running after ${CONTENT_COMMIT_POLL_TIMEOUT_MS / 60_000} minutes; read GET ${planPath} for its state`, { code: "CONTENT_UPLOAD_FAILED", phase: "upload", retryable: true, planId, context: "committing content upload" });
|
|
1950
|
+
}
|
|
1951
|
+
if (status === "pending") {
|
|
1952
|
+
state = await postCommit();
|
|
1953
|
+
continue;
|
|
1954
|
+
}
|
|
1955
|
+
await sleep(delay);
|
|
1956
|
+
delay = Math.min(delay * 2, CONTENT_COMMIT_POLL_MAX_MS);
|
|
1957
|
+
state = await requestWithTransientRetry(() => client.request(planPath, { method: "GET", headers, context: "reading the content commit" }));
|
|
1926
1958
|
}
|
|
1927
1959
|
}
|
|
1960
|
+
function contentCommitStateError(planId, state) {
|
|
1961
|
+
const reason = state.status === "expired"
|
|
1962
|
+
? "the plan expired before it was committed"
|
|
1963
|
+
: `${state.error?.code ?? "failed"}: ${state.error?.message ?? "the commit failed"}`;
|
|
1964
|
+
return new Run402DeployError(`Content commit for plan ${planId} failed (${reason})`, {
|
|
1965
|
+
code: "CONTENT_UPLOAD_FAILED",
|
|
1966
|
+
phase: "upload",
|
|
1967
|
+
retryable: state.status === "failed" && state.error?.retryable === true,
|
|
1968
|
+
planId,
|
|
1969
|
+
body: state,
|
|
1970
|
+
context: "committing content upload",
|
|
1971
|
+
});
|
|
1972
|
+
}
|
|
1928
1973
|
/** Repeat a read or an idempotent request lost to a 502/503/504 or a dropped connection. */
|
|
1929
1974
|
async function requestWithTransientRetry(send) {
|
|
1930
1975
|
for (let attempt = 1;; attempt++) {
|
|
@@ -2099,7 +2144,8 @@ async function pollUntilReady(client, commit, diff, warnings, emit, projectId, s
|
|
|
2099
2144
|
const initialSnapshot = await client.request(`/apply/v1/operations/${encodeURIComponent(commit.operation_id)}`, { headers: opHeaders, context: "fetching deploy operation" });
|
|
2100
2145
|
// A deferred commit (schema_settling / activation_pending) already said
|
|
2101
2146
|
// what happened to its pre-migration snapshot and which warnings it raised;
|
|
2102
|
-
// the
|
|
2147
|
+
// they ride across the poll for a gateway whose operation snapshot does not
|
|
2148
|
+
// repeat them. A `running` commit says neither: the snapshot does.
|
|
2103
2149
|
return await pollSnapshotUntilReady(client, initialSnapshot, diff, mergeWarningsByCode(warnings, commit.warnings), emit, projectId, sliceKinds, commitSnapshotOutcome(commit));
|
|
2104
2150
|
}
|
|
2105
2151
|
/** Later warnings replace earlier ones with the same code (plan → commit → snapshot). */
|
|
@@ -2115,6 +2161,14 @@ function commitSnapshotOutcome(commit) {
|
|
|
2115
2161
|
...(commit.snapshot_skipped_reason ? { snapshot_skipped_reason: commit.snapshot_skipped_reason } : {}),
|
|
2116
2162
|
};
|
|
2117
2163
|
}
|
|
2164
|
+
/**
|
|
2165
|
+
* The operation snapshot's own snapshot outcome when it states one (the
|
|
2166
|
+
* gateway's record of the commit), else the one carried from the commit.
|
|
2167
|
+
*/
|
|
2168
|
+
function preferSnapshotOutcome(snapshot, carried) {
|
|
2169
|
+
const own = commitSnapshotOutcome(snapshot);
|
|
2170
|
+
return own.restore_point || own.snapshot_skipped_reason ? own : carried;
|
|
2171
|
+
}
|
|
2118
2172
|
async function pollSnapshotUntilReady(client, initial, diff, warnings, emit, projectId, sliceKinds = [], snapshotOutcome = {}) {
|
|
2119
2173
|
// Helper to spread slice_kinds onto every commit.phase / ready emit so
|
|
2120
2174
|
// agents grouping per-slice telemetry don't need to track the apply's
|
|
@@ -2207,7 +2261,7 @@ async function pollSnapshotUntilReady(client, initial, diff, warnings, emit, pro
|
|
|
2207
2261
|
urls: snapshot.urls,
|
|
2208
2262
|
diff,
|
|
2209
2263
|
warnings: mergeWarningsByCode(warnings, snapshot.warnings),
|
|
2210
|
-
...snapshotOutcome,
|
|
2264
|
+
...preferSnapshotOutcome(snapshot, snapshotOutcome),
|
|
2211
2265
|
...(snapshot.subdomain_bindings ? { subdomain_bindings: snapshot.subdomain_bindings } : {}),
|
|
2212
2266
|
...(snapshot.static_continuity ? { static_continuity: snapshot.static_continuity } : {}),
|
|
2213
2267
|
...(snapshot.edge ? { edge: snapshot.edge } : {}),
|
|
@@ -4418,7 +4472,7 @@ async function uploadInlineCas(client, projectId, bytes, contentType) {
|
|
|
4418
4472
|
await uploadOne(client.fetch, session, bytes);
|
|
4419
4473
|
// v1.48 unified-apply: per-session /storage/v1/uploads/:id/complete is
|
|
4420
4474
|
// gone (404). The plan-level commit below promotes the session to CAS.
|
|
4421
|
-
await
|
|
4475
|
+
await commitContentPlan(client, planRes.plan_id, headers);
|
|
4422
4476
|
}
|
|
4423
4477
|
return { sha256, size: bytes.byteLength, contentType };
|
|
4424
4478
|
}
|