import { z } from "zod"; //#region src/hub/contract/schema.d.ts /** * The hub's public REST contract (docs/hub-api.md). These schemas are * consumed on both sides of the wire: the hub validates request/response * bodies against them, and `ccqa/hub-client` re-exports them so any HTTP * client — the ccqa CLI, an intranet web app, the hub's own bundled UI — * gets the same types. */ /** * A run's outcome. "running" is non-terminal/mutable — an opened run * (`POST /runs/open`) sits in this state while it's patched incrementally. * "passed"/"failed" are terminal/immutable: a pushed run (`POST /runs`) * starts there directly, and an opened run ends there once done. */ declare const RunStatusSchema: z.ZodEnum<{ passed: "passed"; failed: "failed"; running: "running"; }>; type RunStatus = z.infer; /** * A pushed run. All fields are derived server-side from the report the client * pushed (`POST /runs`) — the run is immutable once created. */ declare const RunSchema: z.ZodObject<{ id: z.ZodString; project: z.ZodString; profile: z.ZodNullable; branch: z.ZodNullable; status: z.ZodEnum<{ passed: "passed"; failed: "failed"; running: "running"; }>; kind: z.ZodDefault>; drift: z.ZodDefault>>; gradedDrift: z.ZodOptional>; specs: z.ZodObject<{ total: z.ZodNumber; passed: z.ZodNumber; failed: z.ZodNumber; }, z.core.$strip>; gitHead: z.ZodNullable; promptVersion: z.ZodString; costUsd: z.ZodOptional>; ciRunId: z.ZodNullable; runUrl: z.ZodOptional>; reportCreatedAt: z.ZodString; createdAt: z.ZodString; deployedSha: z.ZodOptional>; deployedShaSource: z.ZodOptional>>; deployedShaAmbiguous: z.ZodOptional; }, z.core.$strip>; type Run = z.infer; /** * One failing spec's triage: the AI's prediction (read-only, sourced from * the run's report) paired with the human-recorded actual cause (write-only * from the client's perspective — the API is how it gets in). */ declare const TriageCaseSchema: z.ZodObject<{ feature: z.ZodString; spec: z.ZodString; target: z.ZodOptional; predicted: z.ZodObject<{ label: z.ZodEnum<{ TEST_DRIFT: "TEST_DRIFT"; SPEC_CHANGE: "SPEC_CHANGE"; PRODUCT_BUG: "PRODUCT_BUG"; ENVIRONMENT: "ENVIRONMENT"; UNKNOWN: "UNKNOWN"; }>; confidence: z.ZodNumber; subDiagnosis: z.ZodOptional; headline: z.ZodString; }, z.core.$strip>; actual: z.ZodNullable; note: z.ZodOptional; recordedAt: z.ZodString; invalidForKind: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; type TriageCase = z.infer; declare const RunTriageSchema: z.ZodObject<{ runId: z.ZodString; promptVersion: z.ZodString; cases: z.ZodArray; predicted: z.ZodObject<{ label: z.ZodEnum<{ TEST_DRIFT: "TEST_DRIFT"; SPEC_CHANGE: "SPEC_CHANGE"; PRODUCT_BUG: "PRODUCT_BUG"; ENVIRONMENT: "ENVIRONMENT"; UNKNOWN: "UNKNOWN"; }>; confidence: z.ZodNumber; subDiagnosis: z.ZodOptional; headline: z.ZodString; }, z.core.$strip>; actual: z.ZodNullable; note: z.ZodOptional; recordedAt: z.ZodString; invalidForKind: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>>; recorded: z.ZodNumber; recordedInvalidForKind: z.ZodNumber; total: z.ZodNumber; }, z.core.$strip>; type RunTriage = z.infer; declare const PutActualCauseRequestSchema: z.ZodObject<{ cause: z.ZodEnum<{ TEST_DRIFT: "TEST_DRIFT"; SPEC_CHANGE: "SPEC_CHANGE"; PRODUCT_BUG: "PRODUCT_BUG"; ENVIRONMENT: "ENVIRONMENT"; NO_DRIFT: "NO_DRIFT"; }>; note: z.ZodOptional; }, z.core.$strip>; type PutActualCauseRequest = z.infer; /** Response of `PUT /runs/:id/triage/actual-causes`. */ declare const ImportActualCausesResponseSchema: z.ZodObject<{ imported: z.ZodNumber; rejected: z.ZodArray>; }, z.core.$strip>; type ImportActualCausesResponse = z.infer; /** * One spec's "last time it passed" record in the last-green ledger. The hub * updates the ledger whenever a `kind: "run"` run reaches a terminal state: * every spec that passed gets its entry advanced to that run's `gitHead` * (newest `at` wins, so out-of-order finalizes can't move a baseline * backwards). `ccqa run --on-fail-explain` reads it to diff each * failing spec against the commit where that spec was last green. */ declare const LastGreenEntrySchema: z.ZodObject<{ gitHead: z.ZodString; runId: z.ZodString; at: z.ZodString; }, z.core.$strip>; type LastGreenEntry = z.infer; /** One deploy, as the consumer's deploy job reported it (ADR-0010). */ declare const DeployEntrySchema: z.ZodObject<{ index: z.ZodNumber; sha: z.ZodString; previousSha: z.ZodNullable; at: z.ZodString; ref: z.ZodOptional; runUrl: z.ZodOptional; changedPaths: z.ZodNullable>; hasSelection: z.ZodDefault; gapBefore: z.ZodDefault; }, z.core.$strip>; type DeployEntry = z.infer; /** Body of `POST /projects/:project/locks?profile=`. */ declare const AcquireLocksRequestSchema: z.ZodObject<{ specs: z.ZodArray; kind: z.ZodEnum<{ run: "run"; audit: "audit"; }>; holder: z.ZodString; ttlSeconds: z.ZodNumber; }, z.core.$strip>; type AcquireLocksRequest = z.infer; /** * Which specs the caller may work on. `denied` is not an error: another job got * there first, and skipping those is the whole point. */ declare const AcquireLocksResponseSchema: z.ZodObject<{ granted: z.ZodArray; denied: z.ZodArray; }, z.core.$strip>; type AcquireLocksResponse = z.infer; /** Answer of PUT (the attestation as stamped) and GET (the whole document). */ declare const AttestationResponseSchema: z.ZodObject<{ project: z.ZodString; profile: z.ZodString; spec: z.ZodString; attestation: z.ZodObject<{ by: z.ZodString; at: z.ZodString; note: z.ZodOptional; deployedSha: z.ZodNullable; }, z.core.$strip>; }, z.core.$strip>; type AttestationResponse = z.infer; declare const AttestationsResponseSchema: z.ZodObject<{ project: z.ZodString; profile: z.ZodString; specs: z.ZodRecord; deployedSha: z.ZodNullable; }, z.core.$strip>>; }, z.core.$strip>; type AttestationsResponse = z.infer; declare const AuditDismissalResponseSchema: z.ZodObject<{ project: z.ZodString; spec: z.ZodString; dismissal: z.ZodObject<{ by: z.ZodString; at: z.ZodString; note: z.ZodString; auditRunId: z.ZodString; label: z.ZodEnum<{ TEST_DRIFT: "TEST_DRIFT"; SPEC_CHANGE: "SPEC_CHANGE"; UNKNOWN: "UNKNOWN"; }>; headline: z.ZodString; }, z.core.$strip>; }, z.core.$strip>; type AuditDismissalResponse = z.infer; declare const AuditDismissalsResponseSchema: z.ZodObject<{ project: z.ZodString; specs: z.ZodRecord; headline: z.ZodString; }, z.core.$strip>>; }, z.core.$strip>; type AuditDismissalsResponse = z.infer; /** Body of `GET /projects/:project/audit-needed?profile=`: one answer per spec. */ declare const AuditNeedReportSchema: z.ZodObject<{ project: z.ZodString; profile: z.ZodString; specs: z.ZodRecord; reason: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$strip>; type AuditNeedReport = z.infer; /** Body of `GET /projects/:project/rerun?profile=`: one verdict per spec in the perspectives document. */ declare const RerunReportSchema: z.ZodObject<{ project: z.ZodString; profile: z.ZodString; deployHead: z.ZodNullable>; specs: z.ZodRecord; audit: z.ZodEnum<{ due: "due"; clean: "clean"; drifted: "drifted"; undecided: "undecided"; }>; execution: z.ZodEnum<{ passed: "passed"; failed: "failed"; stale: "stale"; neverRun: "neverRun"; }>; driftLabel: z.ZodOptional>; auditAssumedReached: z.ZodOptional>; auditDismissed: z.ZodOptional; headline: z.ZodString; }, z.core.$strip>>; auditDismissalApplied: z.ZodOptional; executionAssumedReached: z.ZodOptional>; specChangedSince: z.ZodOptional; manual: z.ZodOptional; deployedSha: z.ZodNullable; }, z.core.$strip>>; manualLapsed: z.ZodOptional; deployedSha: z.ZodNullable; because: z.ZodEnum<{ deployReached: "deployReached"; cannotPlace: "cannotPlace"; specEdited: "specEdited"; newerRed: "newerRed"; }>; }, z.core.$strip>>; manualLapsedByDeploy: z.ZodOptional>>; manualLapsedReason: z.ZodOptional>; heldBy: z.ZodNullable; holder: z.ZodString; expiresAt: z.ZodString; }, z.core.$strip>>; lastRun: z.ZodNullable>; deployedShaAmbiguous: z.ZodOptional; }, z.core.$strip>>; lastGreen: z.ZodNullable>; deployedShaAmbiguous: z.ZodOptional; }, z.core.$strip>>; lastRed: z.ZodNullable>; deployedShaAmbiguous: z.ZodOptional; label: z.ZodOptional>; headline: z.ZodOptional; }, z.core.$strip>>; touchedBy: z.ZodOptional>; touchedByDeploy: z.ZodOptional>>; }, z.core.$strip>>; }, z.core.$strip>; type RerunReport = z.infer; /** Body of `POST /projects/:project/deploys?profile=` — what the deploy job shipped. */ declare const RecordDeployRequestSchema: z.ZodObject<{ sha: z.ZodString; previousSha: z.ZodOptional>; changedPaths: z.ZodOptional>>; selection: z.ZodOptional; reason: z.ZodString; touchedBy: z.ZodOptional>; }, z.core.$strip>>>; ref: z.ZodOptional; runUrl: z.ZodOptional; }, z.core.$strip>; type RecordDeployRequest = z.infer; /** Body of `GET /projects/:project/deploys?profile=` — newest last, as stored. */ declare const DeployLogResponseSchema: z.ZodObject<{ entries: z.ZodArray; at: z.ZodString; ref: z.ZodOptional; runUrl: z.ZodOptional; changedPaths: z.ZodNullable>; hasSelection: z.ZodDefault; gapBefore: z.ZodDefault; }, z.core.$strip>>; nextIndex: z.ZodNumber; }, z.core.$strip>; type DeployLogResponse = z.infer; /** * Body of `GET /projects/:project/drift`. No `?profile=` — see `SpecDriftEntrySchema`. */ declare const DriftLedgerResponseSchema: z.ZodObject<{ project: z.ZodString; specs: z.ZodRecord>; surface: z.ZodOptional>; subDiagnosis: z.ZodOptional>; specChangeKind: z.ZodOptional>; confidence: z.ZodOptional; headline: z.ZodOptional; gitHead: z.ZodString; runId: z.ZodString; at: z.ZodString; graded: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; type DriftLedgerResponse = z.infer; /** * What one batch of ccqa invocations spent on Claude, as the job that ran them * reported it (see `SpendStore`). `label` is the consumer's name for the batch * — its job name — and the only thing that says where the money went. */ declare const SpendEntrySchema: z.ZodObject<{ id: z.ZodString; at: z.ZodString; costUsd: z.ZodNumber; label: z.ZodString; ciRunId: z.ZodOptional; runUrl: z.ZodOptional; }, z.core.$strip>; type SpendEntry = z.infer; /** Body of `POST /projects/:project/spend` — one batch's total. `at` defaults to now. */ declare const RecordSpendRequestSchema: z.ZodObject<{ costUsd: z.ZodNumber; label: z.ZodString; at: z.ZodOptional; ciRunId: z.ZodOptional; runUrl: z.ZodOptional; }, z.core.$strip>; type RecordSpendRequest = z.infer; /** * Body of `GET /projects/:project/spend?since=&until=`, newest first. `since` * and `until` echo the window that was asked for (null for an open end), so a * reader of `totalUsd` can tell what it totals. */ declare const SpendLogResponseSchema: z.ZodObject<{ project: z.ZodString; since: z.ZodNullable; until: z.ZodNullable; totalUsd: z.ZodNumber; entries: z.ZodArray; runUrl: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; type SpendLogResponse = z.infer; declare const CoverageEdgesDocSchema: z.ZodObject<{ specs: z.ZodRecord; measuredAt: z.ZodNumber; runId: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; type CoverageEdgesDoc = z.infer; /** * Body of `PUT /projects/:project/coverage-edges` — the specs one run * measured. Merged into the stored document, never replacing other specs' * entries; an empty file set is not a measurement and is rejected per entry. */ declare const CoverageEdgesUpsertSchema: z.ZodObject<{ specs: z.ZodRecord; runId: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; type CoverageEdgesUpsert = z.infer; //#endregion //#region src/coverage/resolve-stream.d.ts /** * What one run's slice of the stream resolves to. The shape is the read-out * API of `CoverageResolver` written down: what the coverage page needs to * draw, and nothing the stream cannot support. */ declare const ResolvedCoverageSchema: z.ZodObject<{ runId: z.ZodString; hubRunId: z.ZodOptional; asOf: z.ZodNumber; lastSeq: z.ZodNumber; universe: z.ZodOptional; files: z.ZodArray; }, z.core.$strip>>; specs: z.ZodArray; actorEvents: z.ZodRecord; }, z.core.$strip>>; boot: z.ZodArray; health: z.ZodObject<{ heardFromApplication: z.ZodBoolean; pushesDuringRun: z.ZodNumber; attributedSpecs: z.ZodNumber; rejectedPushes: z.ZodNumber; uninstrumentedFiles: z.ZodNumber; uninstrumentedProcesses: z.ZodNumber; droppedPushes: z.ZodNumber; unmappedActorEvents: z.ZodNumber; outsideWindowEvents: z.ZodRecord; specsMeasured: z.ZodNumber; }, z.core.$strip>; }, z.core.$strip>; type ResolvedCoverage = z.infer; //#endregion //#region src/prompts/prompt-names.d.ts /** * The fixed set of prompt assets the hub stores per project/profile, and which * each is fetched at run time by the CLI. Kept as a tiny, dependency-free * module so both the hub side (store/handlers) and the client/CLI can share * the names without a circular import. * * Two kinds share one namespace: * - "guidance": Markdown — every `.user.md` file, plus the record/live/ * playwright/runn `.agent.md` notes (despite the "agent" name, these are * plain prose, not the learned JSON below). * - "custom-prompt": JSON Claude writes — only `triage.agent` and * `audit.agent`, calibration distilled from graded cases and injected at * run time. * * `triage.*` belongs to `ccqa run`'s failure classification and `audit.*` to * `ccqa audit`. They are two prompts because they answer two questions in one * shared vocabulary: the audit decides whether a spec still describes the * code (from the source alone), and the run decides why it failed, using the * execution evidence — the two commands run independently, neither gating the * other (ADR-0016). * * Hub names are extensionless (`record.agent`), local files keep their real * extensions; `PROMPT_LOCAL_PATHS` is the single mapping every caller (push, * pull, learn, UI) goes through so the two never drift. */ declare const PROMPT_NAMES: readonly ["record.user", "record.agent", "live.user", "live.agent", "playwright.user", "playwright.agent", "runn.user", "runn.agent", "triage.user", "triage.agent", "audit.user", "audit.agent"]; type PromptName = (typeof PROMPT_NAMES)[number]; //#endregion //#region src/report/schema.d.ts declare const ReportSpecResultSchema: z.ZodObject<{ feature: z.ZodString; spec: z.ZodString; title: z.ZodNullable; target: z.ZodOptional; mode: z.ZodOptional>; status: z.ZodEnum<{ passed: "passed"; failed: "failed"; skipped: "skipped"; }>; skipReason: z.ZodOptional; testCounts: z.ZodNullable>; durationMs: z.ZodNullable; assertions: z.ZodNullable; durationMs: z.ZodNullable; }, z.core.$strip>>>; analysis: z.ZodNullable; confidence: z.ZodNumber; subDiagnosis: z.ZodOptional>; headline: z.ZodDefault; recommendation: z.ZodDefault; evidence: z.ZodArray; detail: z.ZodString; }, z.core.$strip>>; reasoning: z.ZodString; surface: z.ZodOptional>; specChangeKind: z.ZodOptional>; }, z.core.$strip>>; analysisSkipped: z.ZodNullable; rerun: z.ZodOptional; }, z.core.$strip>>; customPromptVersion: z.ZodOptional; analysisBase: z.ZodOptional>>; failureLogExcerpt: z.ZodNullable; diffExcerpt: z.ZodNullable; specYaml: z.ZodNullable; evidence: z.ZodNullable>; url: z.ZodNullable; title: z.ZodNullable; capturedAt: z.ZodNullable; description: z.ZodNullable; status: z.ZodDefault>; failureSummary: z.ZodDefault>; }, z.core.$strip>>>; evidenceUnavailable: z.ZodOptional; artifacts: z.ZodOptional; sizeBytes: z.ZodNumber; }, z.core.$strip>>>; coverage: z.ZodOptional; frontendFiles: z.ZodNumber; backendFiles: z.ZodNumber; backendReported: z.ZodBoolean; frontendReported: z.ZodBoolean; frontendStopped: z.ZodBoolean; actorWindows: z.ZodDefault>>; excludedDependencies: z.ZodNumber; gaps: z.ZodObject<{ unattributed: z.ZodNumber; unmappedScripts: z.ZodNumber; unmappedRanges: z.ZodNumber; outsideProject: z.ZodNumber; unresolvedSources: z.ZodNumber; uninstrumentedFiles: z.ZodNumber; uninstrumentedProcesses: z.ZodNumber; droppedPushes: z.ZodNumber; unmappedActorEvents: z.ZodDefault; outsideWindowEvents: z.ZodDefault; }, z.core.$strip>; }, z.core.$strip>>; coverageUnavailable: z.ZodOptional; liveRun: z.ZodNullable; reasoning: z.ZodString; beforePng: z.ZodNullable; afterPng: z.ZodNullable; durationMs: z.ZodNumber; cost: z.ZodObject<{ totalCostUsd: z.ZodNullable; durationApiMs: z.ZodNullable; numTurns: z.ZodNullable; inputTokens: z.ZodNullable; cacheCreationInputTokens: z.ZodNullable; cacheReadInputTokens: z.ZodNullable; outputTokens: z.ZodNullable; models: z.ZodArray; }, z.core.$strip>; commands: z.ZodOptional>; }, z.core.$strip>>; cost: z.ZodObject<{ totalCostUsd: z.ZodNullable; durationApiMs: z.ZodNullable; numTurns: z.ZodNullable; inputTokens: z.ZodNullable; cacheCreationInputTokens: z.ZodNullable; cacheReadInputTokens: z.ZodNullable; outputTokens: z.ZodNullable; models: z.ZodArray; }, z.core.$strip>; }, z.core.$strip>>; }, z.core.$strip>; type ReportSpecResult = z.infer; declare const RunReportDataSchema: z.ZodObject<{ schemaVersion: z.ZodLiteral<1>; kind: z.ZodDefault>; createdAt: z.ZodString; runId: z.ZodNullable; runUrl: z.ZodOptional>; git: z.ZodObject<{ head: z.ZodNullable; base: z.ZodNullable; baseSha: z.ZodOptional>; baseSource: z.ZodOptional>>; }, z.core.$strip>; model: z.ZodNullable; language: z.ZodDefault>; promptVersion: z.ZodString; customPromptVersion: z.ZodDefault>; triageUserPromptHash: z.ZodOptional; deployedSha: z.ZodOptional; cost: z.ZodDefault; durationApiMs: z.ZodNullable; numTurns: z.ZodNullable; inputTokens: z.ZodNullable; cacheCreationInputTokens: z.ZodNullable; cacheReadInputTokens: z.ZodNullable; outputTokens: z.ZodNullable; models: z.ZodArray; }, z.core.$strip>>>; coverageUniverse: z.ZodOptional; files: z.ZodArray; }, z.core.$strip>>; results: z.ZodArray; target: z.ZodOptional; mode: z.ZodOptional>; status: z.ZodEnum<{ passed: "passed"; failed: "failed"; skipped: "skipped"; }>; skipReason: z.ZodOptional; testCounts: z.ZodNullable>; durationMs: z.ZodNullable; assertions: z.ZodNullable; durationMs: z.ZodNullable; }, z.core.$strip>>>; analysis: z.ZodNullable; confidence: z.ZodNumber; subDiagnosis: z.ZodOptional>; headline: z.ZodDefault; recommendation: z.ZodDefault; evidence: z.ZodArray; detail: z.ZodString; }, z.core.$strip>>; reasoning: z.ZodString; surface: z.ZodOptional>; specChangeKind: z.ZodOptional>; }, z.core.$strip>>; analysisSkipped: z.ZodNullable; rerun: z.ZodOptional; }, z.core.$strip>>; customPromptVersion: z.ZodOptional; analysisBase: z.ZodOptional>>; failureLogExcerpt: z.ZodNullable; diffExcerpt: z.ZodNullable; specYaml: z.ZodNullable; evidence: z.ZodNullable>; url: z.ZodNullable; title: z.ZodNullable; capturedAt: z.ZodNullable; description: z.ZodNullable; status: z.ZodDefault>; failureSummary: z.ZodDefault>; }, z.core.$strip>>>; evidenceUnavailable: z.ZodOptional; artifacts: z.ZodOptional; sizeBytes: z.ZodNumber; }, z.core.$strip>>>; coverage: z.ZodOptional; frontendFiles: z.ZodNumber; backendFiles: z.ZodNumber; backendReported: z.ZodBoolean; frontendReported: z.ZodBoolean; frontendStopped: z.ZodBoolean; actorWindows: z.ZodDefault>>; excludedDependencies: z.ZodNumber; gaps: z.ZodObject<{ unattributed: z.ZodNumber; unmappedScripts: z.ZodNumber; unmappedRanges: z.ZodNumber; outsideProject: z.ZodNumber; unresolvedSources: z.ZodNumber; uninstrumentedFiles: z.ZodNumber; uninstrumentedProcesses: z.ZodNumber; droppedPushes: z.ZodNumber; unmappedActorEvents: z.ZodDefault; outsideWindowEvents: z.ZodDefault; }, z.core.$strip>; }, z.core.$strip>>; coverageUnavailable: z.ZodOptional; liveRun: z.ZodNullable; reasoning: z.ZodString; beforePng: z.ZodNullable; afterPng: z.ZodNullable; durationMs: z.ZodNumber; cost: z.ZodObject<{ totalCostUsd: z.ZodNullable; durationApiMs: z.ZodNullable; numTurns: z.ZodNullable; inputTokens: z.ZodNullable; cacheCreationInputTokens: z.ZodNullable; cacheReadInputTokens: z.ZodNullable; outputTokens: z.ZodNullable; models: z.ZodArray; }, z.core.$strip>; commands: z.ZodOptional>; }, z.core.$strip>>; cost: z.ZodObject<{ totalCostUsd: z.ZodNullable; durationApiMs: z.ZodNullable; numTurns: z.ZodNullable; inputTokens: z.ZodNullable; cacheCreationInputTokens: z.ZodNullable; cacheReadInputTokens: z.ZodNullable; outputTokens: z.ZodNullable; models: z.ZodArray; }, z.core.$strip>; }, z.core.$strip>>; }, z.core.$strip>>; }, z.core.$strip>; type RunReportData = z.infer; declare const LabelsExportSchema: z.ZodObject<{ schemaVersion: z.ZodLiteral<1>; runId: z.ZodNullable; promptVersion: z.ZodString; exportedAt: z.ZodString; labels: z.ZodArray; label: z.ZodEnum<{ TEST_DRIFT: "TEST_DRIFT"; SPEC_CHANGE: "SPEC_CHANGE"; PRODUCT_BUG: "PRODUCT_BUG"; ENVIRONMENT: "ENVIRONMENT"; NO_DRIFT: "NO_DRIFT"; }>; note: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; type LabelsExport = z.infer; //#endregion //#region src/run/incremental-report.d.ts /** * The report envelope fields that don't change spec-to-spec — everything in * `RunReportData` except `results`. Captured once when the writer is created * so each incremental flush produces the same envelope the final batch write * used to. */ type ReportEnvelope = Omit; //#endregion //#region src/hub-client/index.d.ts /** * Body of a `PATCH /runs/:id` incremental push: the newly-finished spec rows, * their evidence PNGs (posix relPath → base64), the report envelope metadata * (filled once the real git diff is known), and — on the last patch — `done` * with the terminal status. */ interface PatchRunRequest { rows: ReportSpecResult[]; /** reportDir-relative posix path → base64 PNG bytes. */ evidence?: Record; done?: boolean; finalStatus?: "passed" | "failed"; reportMeta?: Partial; } /** * TypeScript client for the ccqa hub's public REST API (docs/hub-api.md). * Uses the global `fetch` only — no `node:*` imports — so this same module * works unmodified as a browser bundle (an intranet dashboard) or in a * Node script (the `ccqa hub push/pull` CLI, which is itself just one more * consumer of this client). */ interface HubClientOptions { baseUrl: string; token: string; /** * Extra headers sent on every request, ahead of any per-call headers and * the `Authorization` header (e.g. an infra gateway/ALB bypass header in * CI — never overrides `Authorization`). */ headers?: Record; /** Override for testing; defaults to the global `fetch`. */ fetchImpl?: typeof fetch; } declare class HubApiError extends Error { readonly status: number; readonly code: string; constructor(status: number, code: string, message: string); } interface HubVariable { name: string; sensitive: boolean; updatedAt: string; value?: string; } interface HubPromptMeta { name: string; kind: "guidance" | "custom-prompt"; updatedAt: string; meta: Record; } /** * What `GET /api/v1/coverage` answers: one run's resolved view of the * project's coverage event stream, plus every run the stream retains (newest * first, bounded server-side). `resolved` is null when the stream holds no * measured run. */ interface HubCoverageAnswer { resolved: ResolvedCoverage | null; runIds: string[]; } interface HubClient { /** * Push a report directory (as a tar.gz) for an already-finished `ccqa run`. * * `deployedSha` asserts the commit the environment was running *when the run * started*. Without it the hub falls back to its deploy-log head, which by * push time is the head after the run — a deploy that landed mid-run would * then read as that run's baseline. */ pushRun(archive: Uint8Array, meta: { project: string; branch?: string; profile?: string; kind?: Run["kind"]; deployedSha?: string; }): Promise; /** * Open a `running` run to push results into incrementally. Returns the new * run's id. Non-retryable (a dropped response after the server committed * would leave a second open run); callers degrade to local-only on failure. * `gitHead` stamps the run's commit at open time, so even a run that dies * before its final reconcile patch is attributable to a commit. * * `deployedSha` does the same for the environment's commit. The hub would * otherwise read its own deploy-log head here, and the open happens after * the deterministic phase, not before the first spec. */ openRun(meta: { project: string; branch?: string; profile?: string; kind?: Run["kind"]; gitHead?: string; deployedSha?: string; /** CI run id (GITHUB_RUN_ID) and its run URL, stamped at open time so an * interrupted incremental run still links back to its CI run. */ ciRunId?: string; runUrl?: string; }): Promise; /** Add finished spec rows (+ evidence) to a running run; `done` closes it. */ patchRun(id: string, body: PatchRunRequest): Promise; listRuns(q?: { project?: string; branch?: string; status?: RunStatus; kind?: Run["kind"]; limit?: number; }): Promise; getRun(id: string): Promise; getReport(id: string): Promise; downloadArtifacts(id: string): Promise; /** * The project's coverage event stream, resolved for one run — `runId` * omitted means the most recently measured run. Spec selection reads its * reach edges through this (ADR-0024). */ getCoverage(project: string, q?: { runId?: string; }): Promise; /** * Merge one run's measured reach into the project's coverage-edge ledger * (ADR-0026). The hub stamps `measuredAt` with its own clock. */ putCoverageEdges(project: string, upsert: CoverageEdgesUpsert): Promise; /** The coverage-edge ledger, or `null` when nothing is stored (or the hub predates it). */ getCoverageEdges(project: string): Promise; /** * Source maps for what a commit deployed, addressed by the asset path the * browser requests. Coverage falls back to these when the build keeps its * maps out of the CDN, which is the usual choice — a map hands out source. */ putSourceMap(project: string, commit: string, assetPath: string, map: Uint8Array): Promise; getSourceMap(project: string, commit: string, assetPath: string): Promise; listSourceMaps(project: string, commit: string): Promise; /** Ends a push, letting the hub drop the commits it no longer keeps. */ sweepSourceMaps(project: string): Promise; getTriage(id: string): Promise; putActualCause(id: string, c: { feature: string; spec: string; }, v: PutActualCauseRequest): Promise; deleteActualCause(id: string, c: { feature: string; spec: string; }): Promise; importActualCauses(id: string, labels: LabelsExport): Promise; /** Every project the hub knows (from runs and stored secrets). */ listProjects(): Promise; /** * The last-green ledger for one project/profile: "feature/spec" → the run * head where that spec last passed. `branch` entries overlay * `fallbackBranch` (typically the default branch) entries server-side. */ getLastGreen(project: string, q: { profile?: string; branch: string; fallbackBranch?: string; }): Promise>; /** * Per spec of one project/profile: is its last result still trustworthy? * Answers `ccqa run --only-hub-rerun-needed`. 404 when the project has no * perspectives document — there is then no spec registered to compare * against a deploy, which the caller must report rather than read as * "nothing to run". */ getRerun(project: string, q: { profile: string; }): Promise; /** * Per spec of one project/profile: has a deploy landed on the code it covers * since the audit last read it? Answers `ccqa audit * --only-hub-audit-needed`. 404 on a project with no perspectives document, * for the same reason `getRerun` does. */ getAuditNeed(project: string, q: { profile: string; }): Promise; /** * Take the specs that are free, so a second job does not start on one this * run is already working. `denied` is part of the answer, not an error. */ acquireLocks(project: string, q: { profile: string; }, body: AcquireLocksRequest): Promise; /** Drop everything `runId` holds. Safe to call when it holds nothing. */ releaseLocks(project: string, q: { profile: string; }, holder: string): Promise; /** Every attestation for the profile, standing and lapsed alike. */ getAttestations(project: string, q: { profile: string; }): Promise; /** Record that a person checked `spec` by hand. The hub stamps the time and deploy head. */ putAttestation(project: string, q: { profile: string; }, body: { spec: string; by: string; note?: string; }): Promise; /** Revoke a spec's attestation. Revoking one that does not exist succeeds. */ deleteAttestation(project: string, q: { profile: string; }, spec: string): Promise; /** Every dismissed audit finding for the project, current and superseded alike. No profile — findings are about the repository. */ getAuditDismissals(project: string): Promise; /** * Record that a person judged `spec`'s current audit finding wrong. The hub * reads which finding that is from the ledger and pins the dismissal to it; * a spec with no open finding is rejected. */ putAuditDismissal(project: string, body: { spec: string; by: string; note: string; }): Promise; /** Withdraw a dismissal, putting the audit's finding back in force. */ deleteAuditDismissal(project: string, spec: string): Promise; /** * Every spec's last `ccqa audit --report-to-hub` result, keyed by "feature/spec". No * profile — drift asks whether a spec still describes the code, not * whether an environment is stale. */ getDriftLedger(project: string): Promise; /** Tell the hub what a deploy shipped (`ccqa hub deploy record`). */ recordDeploy(project: string, profile: string, body: RecordDeployRequest): Promise; /** The profile's retained deploy log, oldest first; `limit` keeps the newest N. */ getDeployLog(project: string, q: { profile: string; limit?: number; }): Promise; /** * Report what one batch of ccqa invocations cost (`ccqa hub cost push`). * Read instead of a sum over runs, never alongside one (ADR-0017). */ recordSpend(project: string, body: RecordSpendRequest): Promise; /** The project's spend over `[since, until)`, newest first, with the window's total. */ getSpend(project: string, q?: { since?: string; until?: string; }): Promise; putSession(project: string, profile: string, name: string, storageState: unknown): Promise; getSession(project: string, profile: string, name: string): Promise; listSessions(project: string, profile: string): Promise<{ name: string; updatedAt: string; }[]>; deleteSession(project: string, profile: string, name: string): Promise; putVariable(project: string, profile: string, name: string, v: { value: string; sensitive: boolean; }): Promise; listVariables(project: string, profile: string, opts?: { includeValues?: boolean; }): Promise; deleteVariable(project: string, profile: string, name: string): Promise; putPrompt(project: string, name: PromptName, body: string): Promise; getPrompt(project: string, name: PromptName): Promise; listPrompts(project: string): Promise; deletePrompt(project: string, name: PromptName): Promise; /** The project's perspectives document (coverage inventory), stored hub-only. */ putPerspectives(project: string, doc: unknown): Promise; getPerspectives(project: string): Promise; /** Set (or clear, with an empty string) the human note on one spec's entry. */ patchPerspectivesNote(project: string, c: { feature: string; spec: string; note: string; }): Promise; deletePerspectives(project: string): Promise; } /** * One round trip against a hub, with the client's shared policy: bearer auth, * per-attempt timeout, retries for idempotent methods, `HubApiError` on the * final non-ok answer. Exported for the one caller outside the client * (`CoverageInbox`), whose POSTs are appends a duplicate cannot corrupt — * unlike the client's own POSTs — so it may opt into `retry: "post-once"`, * one extra attempt after a 5xx or network error. */ declare function hubRequest(opts: HubClientOptions, path: string, init?: RequestInit, retry?: "post-once"): Promise; declare function createHubClient(opts: HubClientOptions): HubClient; //#endregion export { HubApiError, HubClient, HubClientOptions, HubCoverageAnswer, HubPromptMeta, HubVariable, PatchRunRequest, createHubClient, hubRequest };