@qawolf/api-contracts
v0.167.0
Published
Versioned contracts for the QA Wolf public API
Keywords
Readme
@qawolf/api-contracts
Versioned contracts for the QA Wolf public API.
The package is the source of truth for public endpoints, and server implementations must derive their public input and output schemas from these contracts. Contract name values are exact tRPC route paths under the public namespace. Authorization and privileged request state stay in the owning server controller or policy.
import { publicContractsV1 } from "@qawolf/api-contracts/v1";
const contract = publicContractsV1.run.create;Every contract declares annotations with explicit readOnlyHint, destructiveHint, and openWorldHint booleans. These describe possible side effects for clients; adapters such as MCP pass them through. They do not control authorization. A kind: "read" contract can have readOnlyHint: false when reading also changes resource state, such as refreshing a billed runner's activity timer.
Every contract also requires annotationJustifications, with an explanation for each of those three hints. Keep each explanation specific to the tool, nonblank, and at most 200 characters so it fits the OpenAI submission form. Apex exposes these explanations in the QA Wolf extension _meta["qawolf/annotationJustifications"] on each MCP tool, including discovery before sign-in. This metadata does not replace the standard boolean annotations or change authorization. Submission authors can copy the explanations into the form; automatic import by OpenAI is not assumed.
Annotations include downstream effects in connected integrations. Creating an environment can create a remote Git branch, and stopping a run can update external run-status messages and commit statuses, so both declare openWorldHint: true. Inspection, journal reads and screenshots refresh the runner's inactivity timer on every runner and can extend its billed lifetime, so their contracts declare readOnlyHint: false.
Contracts are built by a factory that takes the id schemas as input. External consumers use publicContractsV1, which validates ids loosely (the server is the source of truth for id formats). The server instantiates makeContractsV1 with its own strict id schemas, so the contract shape can never drift between the two sides while validation strictness stays server-owned.
This package must not depend on internal packages or expose internal concepts: it is published publicly.
Run events webhook
The package also defines the body of each run events webhook request, so a receiver can check what it gets after verifying the request's signature:
import { publicRunEventsWebhookRequestSchema } from "@qawolf/api-contracts/v1";
const { events } = publicRunEventsWebhookRequestSchema.parse(body);Publishing
This package is published to the public npm registry so external repositories such as qawolf/cli can consume the public contracts.
