run402-mcp
Version:
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.
48 lines • 1.92 kB
TypeScript
/**
* RFC 8785 (JCS) canonical JSON utility — kept as a UX / diagnostic helper.
*
* **As of v1.34, the gateway is authoritative for the deploy manifest
* digest.** `POST /apply/v1/plans` returns the gateway-computed digest in
* the response, and operation idempotency keys on it (combined with
* `project_id`, `base_release_id`, and an optional client idempotency key).
* A drift between this implementation and the gateway's canonicalize
* therefore SHALL NOT silently break idempotency — retries still find the
* existing plan because the lookup uses the gateway-computed value.
*
* This module remains exported so callers can still produce a stable local
* digest for caching or debugging output. New code should treat the local
* digest as advisory.
*
* Spec for our value domain:
* - object keys sorted ASCII-ascending
* - arrays comma-separated, no whitespace
* - strings/numbers via JSON.stringify (matches RFC 8785 for ASCII paths,
* hex sha256, integer sizes, ASCII content_types)
*/
export interface ManifestEntry {
path: string;
sha256: string;
size: number;
content_type: string;
}
export interface Manifest {
files: ManifestEntry[];
}
export declare function canonicalizeJson(value: unknown): string;
/**
* Build the canonical manifest object the gateway hashes: `{ files: [...] }`
* with entries sorted by path and only the four expected keys per entry.
* `content_type` defaults to `"application/octet-stream"` when absent.
*/
export declare function buildCanonicalManifest(entries: Array<{
path: string;
sha256: string;
size: number;
content_type?: string;
}>): Manifest;
/**
* Compute the hex SHA-256 of the canonical JSON encoding of a manifest.
* Matches the gateway's `computeManifestDigest`.
*/
export declare function computeManifestDigest(manifest: Manifest): Promise<string>;
//# sourceMappingURL=canonicalize.d.ts.map