UNPKG

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.

101 lines • 5.56 kB
/** * `errors` namespace — the release-error-rollup query surface (gateway * `release-error-rollup`). The platform's durable, grouped error memory: * every 5xx at the invoke choke points is fingerprinted (deploy-stable by * normalization) and collapsed into one hot row per distinct failure, each * baselined against the previous ACTIVE release. * * Verdict-first, gateway-authoritative: every page leads with a computed * promote-vs-revert verdict, and the SDK NEVER recomputes it. No client-side * fingerprinting, no re-baselining, no re-counting of `new_fingerprints` — the * gateway's numbers are the truth. `list`/`get` pass the envelope through * untouched; `watch` polls and reads `verdict.new_fingerprints`. * * The promote-gate golden path (run right after an apply/promote activates a * release): * * const w = await r.errors.watch(projectId, { newIn: releaseId }); * if (!w.clean) { * // w.verdict.new_fingerprints > 0 — new error identities under the new * // release. w.new_errors carries the grouped rows + fetch_logs drill-downs. * } * * `clean` is the gateway's counts (no new and no reopened group), never a * client recount. Exposed both unscoped (`r.errors.list(projectId, …)`) and * project-scoped (`r.project(id).errors.list(…)`), mirroring `r.events`. * * A group's status: `resolve` once a fix is live, `ignore` to stop counting * it as broken, `reopen` to undo either. The gateway decides and fences each * write and reopens a resolved group the next time its error is seen; the SDK * only calls. Setting a status takes the project's service key or a principal * with `project.deploy`. * * Auth: the addressed project's OWN key when it is cached locally; otherwise * the client's principal (SIWX wallet / session / grant key) with * `project.read`. A key for a different project gets 403, never a 404 that * would confirm existence. */ import type { Client } from "../kernel.js"; import type { ErrorsPage, ErrorFingerprintDetail, ErrorStatusChange, ListErrorsOptions, WatchErrorsOptions, WatchErrorsResult } from "./errors.types.js"; export declare class Errors { #private; private readonly client; constructor(client: Client); /** * Read a verdict-first page of a project's grouped error fingerprints * (`GET /projects/v1/:project_id/errors`). Filters map 1:1 to wire query * params except `newIn` → `new_in`; `newIn` (a release id or `"active"`) * drives the verdict's promote-gate `new_fingerprints`. Envelope is passed * through untouched. Authorized with the addressed project's OWN key. */ list(projectId: string, opts?: ListErrorsOptions): Promise<ErrorsPage>; /** * Read one fingerprint's full detail — the same row shape as {@link list} * with the complete sample ring, a per-sample `fetch_logs` next action, and * `also_seen_in_functions` when the hash surfaced under more than one * function (`GET /projects/v1/:project_id/errors/:fingerprint_id`). Throws an * {@link ApiError} 404 (`RESOURCE_NOT_FOUND`) for an unknown id under an * authorized project. */ get(projectId: string, fingerprintId: string): Promise<ErrorFingerprintDetail>; /** * Mark a group resolved once its fix is live * (`POST /projects/v1/:project_id/errors/:fingerprint_id/resolve`). The * gateway records the project's live release as `resolved_in_release_id` * and reopens the group the next time its error is seen. Resolving a group * that is already resolved answers `changed: 0`. */ resolve(projectId: string, fingerprintId: string): Promise<ErrorStatusChange>; /** * Mark a group ignored (`POST …/errors/:fingerprint_id/ignore`). An ignored * group keeps counting and stays listed, and its recurrence announces nothing. */ ignore(projectId: string, fingerprintId: string): Promise<ErrorStatusChange>; /** Open a resolved or ignored group again (`POST …/errors/:fingerprint_id/reopen`). */ reopen(projectId: string, fingerprintId: string): Promise<ErrorStatusChange>; /** * The promote-gate poll loop. Run it right after an apply/promote activates a * release to watch that release under real traffic. Polls {@link list} with * `{ newIn }` immediately, then every `intervalMs`, and does one final poll * when the `durationMs` window elapses. With `failFast` (the default), stops * the moment a poll reports a new group or a reopened one. * * The verdict is the gateway's — `clean` is `new_fingerprints === 0` and * `reopened_fingerprints === 0`, read straight off the last observed page; * nothing is recomputed here. `new_errors` and `reopened_errors` split that * page's `errors[]` by the compared release. * * Fault tolerance so an outage can't masquerade as a verdict: a 4xx (other * than 408/429) rethrows immediately — auth/validation won't heal; network * errors, 5xx, 408, and 429 are tolerated, but three CONSECUTIVE failed polls * rethrow the last error (a successful poll resets the counter). * * `signal` aborts cleanly: if at least one poll succeeded, returns the * result-so-far with `aborted: true`; if none did, throws a {@link LocalError}. * * @throws {LocalError} when `projectId` or `opts.newIn` is missing, or when * aborted before any poll succeeded. */ watch(projectId: string, opts: WatchErrorsOptions): Promise<WatchErrorsResult>; } //# sourceMappingURL=errors.d.ts.map