open-standards/wai/wai-quantum-cli/schemas/local-tools.v1.json
Transaction Science 2778ddd525 wai-quantum: the planner under a contract, its reasoning sealed, a provider's answer shadowed
Re-landed from PR #668 (branch wai/quantum-planner-contract, merged with main
495651ddd at 37350335b) as one commit on main, under the land-it model. Five
review rounds; round 5's findings (two high: workers that died as PID 1) were
fixed on the branch, and its CI reds were traced and fixed before landing.

A job may carry a contract (deadline, energy ceiling, cost, accuracy); the
planner chooses a route that meets it or refuses with every route's reason,
and its reasoning is sealed in the receipt. Under #676's reading child the
contract job is planned in the child from the per-method timings the parent
sends, bounded as a job naming its chosen method plus its reasoning, kept
across a restart. Both verifiers (Rust and receipt_verify.py) check the
planner statement beside wasmQ's; the receipts corpus is regenerated with
both kinds (268 crafted receipts, 14 plants caught). The views page carries
its engine raw-deflated and stays under its 1 MiB limit (669,484 bytes).

Passed before the push (Framework, linux; M3, macOS): every repository
check, receipts conformance, breaking, corpora, catalogue, the qpu clients,
energy (wai-rs, wai-quantum full, serve), the CLI tests and clippy, writer,
smoke, cross-simulator corpus, job receipts, wasmQ tests and vectors, the
engine with and without receipts under -D warnings, the docs pages, and the
service suite with clippy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-09 17:42:46 -05:00

593 lines
17 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.transaction.science/Transaction-Science/open-standards/raw/branch/main/wai/wai-quantum-cli/schemas/local-tools.v1.json",
"title": "wai.quantum.local-tools/1",
"description": "The answers of the local MCP server's own tools (wai-quantum mcp), those the command line writes beside the engine's: a receipt's check, the workbench archive's submissions, a program's history, the person's taste, and the person's own providers. Each is a $def; every tool's outputSchema in tools/list is its answer's schema standing alone. The engine's answers are in wai-quantum's schemas.",
"$defs": {
"verify": {
"description": "Whether a job's receipt seals its request and its result, and the key that signed it; for an estimate, also every estimate's receipt and the request re-run here; for an answer of the variational and algorithm library, also its digest chain and the answer re-run here; for a wasmQ job, also its body and its form (extensions/quantum-wasmq.md §6.5).",
"anyOf": [
{
"type": "object",
"description": "Whether a job's receipt seals its request and its result and every rule of its form holds, and the key that signed it.",
"required": [
"valid",
"key"
],
"properties": {
"valid": {
"type": "boolean"
},
"reasons": {
"type": "array",
"items": {
"type": "string"
},
"description": "Each rule the receipt breaks (the provider protocol's section 8.4, wasmq_form among them for a wasmQ job): none when it is valid."
},
"form": {
"type": [
"string",
"null"
],
"description": "The receipt's form: rfc8785, or first."
},
"provider": {
"type": "object",
"description": "For a provider's result, what it says of itself."
},
"key": {
"type": [
"string",
"null"
],
"description": "The signing key, 32 bytes in hex."
},
"signer": {
"type": [
"string",
"null"
],
"description": "That key as a did:key."
},
"planner": {
"type": "object",
"description": "For a job under a contract, what its reasoning says: the route chosen, the class wanted and given, whether the choice depends on the host, what was kept, and the shadow."
},
"recheck": {
"type": "object",
"description": "With recheck: whether the routes priced again and the shadow run again are what the job sealed.",
"properties": {
"holds": {
"type": "boolean"
},
"engine": {
"type": "object"
},
"priced": {
"type": "object"
},
"shadow": {
"type": "object"
}
}
},
"wasmq": {
"type": "object",
"description": "For a wasmQ job (quantum-wasmq section 6.5), beside the verdict: how the run ended, each rule of the profile's form it breaks, and where the host's unsealed words differ from what is sealed, which change no verdict.",
"required": [
"outcome",
"problems",
"notes"
],
"additionalProperties": false,
"properties": {
"outcome": {
"type": [
"string",
"null"
],
"description": "The sealed result's status: ok, or fault."
},
"problems": {
"type": "array",
"items": {
"type": "string"
},
"description": "Each rule of quantum-wasmq section 6.5 the job breaks, in words (the reason wasmq_form): the first 64, then how many more. Empty when it breaks none."
},
"notes": {
"type": "array",
"items": {
"type": "string"
},
"description": "Where the body's unsealed status or method differs from what is sealed or is missing, and members nothing seals: told beside the verdict, and no part of it."
},
"bundle": {
"type": "boolean",
"description": "`wai-quantum verify --json --bundle` only: whether the envelope given is the one the receipt binds."
},
"reproduced": {
"type": [
"boolean",
"null"
],
"description": "`wai-quantum verify --json --bundle` only: whether running the envelope again here gives the same result, byte for byte; null when it is not the envelope the receipt binds."
}
}
}
}
},
{
"$ref": "https://git.transaction.science/Transaction-Science/open-standards/raw/branch/main/wai/wai-quantum/schemas/set.v1.json#/$defs/verify"
},
{
"$ref": "https://git.transaction.science/Transaction-Science/open-standards/raw/branch/main/wai/wai-quantum/schemas/estimate.v1.json#/$defs/verify"
},
{
"$ref": "https://git.transaction.science/Transaction-Science/open-standards/raw/branch/main/wai/wai-quantum/schemas/algorithms.v1.json#/$defs/verify"
}
]
},
"discover_submit": {
"type": "object",
"description": "What the archive did with a generator, and its best entry after.",
"required": [
"outcome",
"best"
],
"properties": {
"outcome": {
"type": "object"
},
"best": {
"type": [
"object",
"null"
]
}
}
},
"history_commit": {
"type": "object",
"description": "The version an agent's edit was recorded as, and in whose name.",
"required": [
"version",
"parent",
"by",
"history"
],
"properties": {
"version": {
"type": "string"
},
"parent": {
"type": "string"
},
"by": {
"type": [
"object",
"null"
],
"properties": {
"kind": {
"enum": [
"person",
"assistant",
"agent",
"engine",
"origin"
]
},
"name": {
"type": [
"string",
"null"
]
}
}
},
"history": {
"type": "string",
"description": "The history file's path."
}
}
},
"history_changes": {
"type": "object",
"required": [
"changes",
"rules"
],
"properties": {
"changes": {
"type": "array",
"items": {
"type": "object"
}
},
"breaches": {},
"rules": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"history_blame": {
"type": "object",
"required": [
"version",
"lines",
"authorship"
],
"properties": {
"version": {
"type": "string"
},
"lines": {
"type": "array",
"items": {
"type": "object"
}
},
"authorship": {
"type": "object"
}
}
},
"history_log": {
"type": "object",
"required": [
"versions",
"check"
],
"properties": {
"versions": {
"type": "array",
"items": {
"type": "object"
}
},
"check": {
"type": "object"
}
}
},
"taste_rank": {
"type": "object",
"description": "Programs ranked by the person's own taste profile: each with its score, its parts' scores and its typicality; where the parts or the cost put another first; and whether the ranking narrows what comes first.",
"required": [
"choices",
"ranked"
],
"properties": {
"choices": {
"type": "integer",
"description": "The choices the profile has learned from."
},
"dial": {
"type": "number",
"description": "The novelty dial, -1 to 1."
},
"ranked": {
"type": "array",
"items": {
"type": "object",
"required": [
"name",
"score",
"final"
],
"properties": {
"name": {
"type": "string"
},
"score": {
"type": "number"
},
"final": {
"type": "number"
},
"novelty": {
"type": [
"number",
"null"
]
},
"typicality": {
"type": [
"number",
"null"
]
},
"cost": {
"type": [
"number",
"null"
]
},
"parts": {
"type": "object",
"additionalProperties": {
"type": "number"
}
}
}
}
},
"disagree": {
"type": "array",
"items": {
"type": "object",
"properties": {
"part": {
"type": "string"
},
"first": {
"type": "string"
}
}
}
},
"narrowing": {
"type": [
"object",
"null"
]
}
}
},
"taste_next": {
"type": "object",
"description": "The pair the person's taste profile is least sure of that the engine proves equal, or why there is none.",
"required": [
"a"
],
"properties": {
"a": {
"type": [
"string",
"null"
]
},
"b": {
"type": "string"
},
"how": {
"type": "string",
"description": "How the engine proved them equal."
},
"p_a": {
"type": "number",
"description": "The profile's probability that the person prefers a."
},
"why": {
"type": "string"
}
}
},
"providers_list": {
"type": "object",
"description": "The person's providers, and where each one's credential is; with free, what is free.",
"required": [
"registry",
"providers"
],
"properties": {
"registry": {
"type": "string",
"description": "The registry file's path."
},
"providers": {
"type": "array",
"items": {
"type": "object"
}
},
"free": {
"type": "object"
}
}
},
"provider_job": {
"type": "object",
"description": "A job on a provider, in the form of a job (job.v1.json), its id the record's handle: running, ended with its error, or done with its result and receipt, which verify_quantum_result checks.",
"required": [
"id",
"status",
"method",
"request"
],
"properties": {
"id": {
"type": "string"
},
"status": {
"enum": [
"running",
"done",
"failed",
"cancelled"
]
},
"method": {
"const": "provider"
},
"why": {
"type": "string"
},
"request": {
"type": "object"
},
"result": {
"type": "object"
},
"error": {
"type": "string"
},
"submitted_ms": {
"type": "integer"
},
"finished_ms": {
"type": "integer"
}
}
},
"provider_jobs": {
"type": "object",
"description": "Every job recorded on this machine, as it last stood: no provider is asked.",
"required": [
"ledger",
"jobs",
"unread"
],
"properties": {
"ledger": {
"type": "string",
"description": "The directory the records are in."
},
"jobs": {
"type": "array",
"items": {
"type": "object",
"required": [
"id",
"provider",
"status",
"shots",
"submitted_ms"
],
"properties": {
"id": {
"type": "string"
},
"provider": {
"type": "string"
},
"status": {
"enum": [
"running",
"done",
"failed",
"cancelled"
]
},
"shots": {
"type": "integer"
},
"submitted_ms": {
"type": "integer"
},
"finished_ms": {
"type": "integer"
},
"error": {
"type": "string"
}
}
}
},
"unread": {
"type": "array",
"items": {
"type": "string"
},
"description": "Why any file among the records could not be read."
}
}
},
"provider_estimate": {
"type": "object",
"description": "The dry run of a job on a provider: nothing submitted, nothing spent.",
"required": [
"dry_run",
"provider",
"plan",
"estimate",
"free",
"confirm"
],
"properties": {
"dry_run": {
"const": true
},
"provider": {
"type": "object"
},
"calibration": {
"type": [
"string",
"null"
]
},
"billing": {
"type": "object"
},
"plan": {
"type": "object"
},
"estimate": {
"type": "object"
},
"free": {
"type": "boolean"
},
"confirm": {
"type": "string",
"description": "What the person reads before confirming a run that is not free."
},
"planner": {
"$ref": "https://git.transaction.science/Transaction-Science/open-standards/raw/branch/main/wai/wai-quantum/schemas/job-result.v1.json#/$defs/planner"
}
}
},
"routed": {
"type": "object",
"description": "Every route a job could take under its contract, each with its price or why it was rejected, and the route chosen: nothing submitted, nothing spent.",
"required": [
"dry_run",
"planner"
],
"properties": {
"dry_run": {
"const": true
},
"planner": {
"$ref": "https://git.transaction.science/Transaction-Science/open-standards/raw/branch/main/wai/wai-quantum/schemas/job-result.v1.json#/$defs/planner"
},
"plan": {
"$ref": "https://git.transaction.science/Transaction-Science/open-standards/raw/branch/main/wai/wai-quantum/schemas/plan.v1.json"
},
"provider_plan": {
"$ref": "#/$defs/provider_estimate"
},
"confirm": {
"type": "object",
"description": "Where the route chosen is a provider's and not free: what a person confirms it by. token is a digest of the route, its estimate's money and the program and shots it would send; a run is sent only when given that token made again at send time.",
"required": [
"token",
"route",
"money",
"says"
],
"properties": {
"token": {
"type": "string"
},
"route": {
"type": "string"
},
"money": {
"type": "object"
},
"says": {
"type": "string"
}
}
}
}
}
}
}