caveat-lang
v1.6.0Caveat authoring bridge: validate, check, test, step saves, explain, search and trace decisions.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
caveat_validate
Load inline source with the installed runtime and list its declarations. Start here to find load errors; use caveat_check for authoring diagnostics and caveat_test to verify expected behavior. No events are dispatched. report (caveat-validate/0.1) contains program, loads, events, reading_streams, decision_series and displayed bindings, or a load error. exitCode: 0 loaded; 2 load failure. Returns the same JSON in structuredContent and text: {schema:"caveat-authoring/0.1",operation,sourceSha256,runtime,exitCode,report}. Read exitCode even when isError is false. Bridge failures instead set isErro…
| Parameter | Type | Description |
|---|---|---|
source * | string | Complete inline Caveat program text, available as the virtual file inline.cav. No file path or URL lookup. At most 1 MiB of UTF-8 source; each call uses a fresh runtime. |
caveat_check
Load a single-file program and report authoring diagnostics, such as repeated rules or a missing reopening path. Use after editing source; choose caveat_validate for a declaration summary and caveat_test for behavior assertions. A clean check does not prove behavior; bundles are unsupported. report (caveat-check/0.1) contains loads, strict, diagnostics and suppressed diagnostics, with code, location, message and suggestion, or a load error. exitCode: 0 completed without a strict failure; 1 strict with unsuppressed diagnostics; 2 load failure or bundle. Returns the same JSON in structuredConten…
| Parameter | Type | Description |
|---|---|---|
source * | string | Complete inline Caveat program text, available as the virtual file inline.cav. No file path or URL lookup. At most 1 MiB of UTF-8 source; each call uses a fresh runtime. |
strict | boolean | Optional, defaults to false. When true, any unsuppressed diagnostic makes exitCode 1 instead of 0; suppressed diagnostics do not count. Does not change program behavior. Load failures and unsupported… |
caveat_test
Run scenario assertions and runtime invariant checks against inline source, with a fresh session per scenario. Use to verify expected event outcomes and snapshot values; caveat_validate only checks loading, caveat_check reports diagnostics, and caveat_explain inspects history without assertions. report (caveat-scenario-report/0.1) includes files, per-scenario results/failures, check diagnostics and passed/failed totals. exitCode: 0 all passed; 1 scenario failure; 2 invalid scenario document (report has valid:false and error) or blocking authoring diagnostics. Every source reference must be inl…
| Parameter | Type | Description |
|---|---|---|
scenarios * | object | Scenario document object, not JSON text. Example: {"schema":"caveat-scenarios/0.1","source":"inline.cav","scenarios":[{"id":"initial","title":"Initial sequence","steps":[{"expect":{"/sequence":0}}]}]}… |
source * | string | Complete inline Caveat program text, available as the virtual file inline.cav. No file path or URL lookup. At most 1 MiB of UTF-8 source; each call uses a fresh runtime. |
caveat_explain
Replay optional events and explain the resulting decisions, evidence and displayed values. Use to answer why a decision was made; choose caveat_dependents to trace one evidence or caveat name forward, and caveat_test for assertions. report (caveat-explain/0.1) includes sequence, event outcomes, decisions with grounds and revision history, evidence with caveats, displayed values and available archive history. exitCode: 0 replay completed (may include rejected events); 1 fatal event with last good state; 2 source load failure (report has loads:false and error). Returns the same JSON in structure…
| Parameter | Type | Description |
|---|---|---|
source * | string | Complete inline Caveat program text, available as the virtual file inline.cav. No file path or URL lookup. At most 1 MiB of UTF-8 source; each call uses a fresh runtime. |
events | array | Events replayed in array order from a fresh session. Omitted or [] inspects the initial state; previous calls supply no history. Rejections are recorded and replay continues; a fatal event stops repla… |
caveat_dependents
Replay optional events and find what rests on one named evidence item, reading stream or caveat. Use for impact inspection; caveat_explain instead explains all decisions and their reasons. Subjects are causes only: evidence, a reading stream or a caveat. Claims and decisions are never subjects, because a claim causes nothing and the grounds of a decision are evidence, not claims; both appear in the report as what the subject reaches. To trace from a claim, query the evidence that supports or opposes it (report.claims lists those relations). report (caveat-dependents/0.1) includes subject, kind…
| Parameter | Type | Description |
|---|---|---|
source * | string | Complete inline Caveat program text, available as the virtual file inline.cav. No file path or URL lookup. At most 1 MiB of UTF-8 source; each call uses a fresh runtime. |
subject * | string | Exact case-sensitive evidence name, reading stream name, caveat name, or evidence occurrence ID after replay. Evidence records supplied observations; a reading stream is a named history of samples; a… |
events | array | Events replayed in array order from a fresh session. Omitted or [] inspects the initial state; previous calls supply no history. Rejections are recorded and replay continues; a fatal event stops repla… |
caveat_dispatch
Keep one running ledger across calls: send events to the program, starting fresh or from the save an earlier caveat_dispatch call returned, and get the new save back. Use when a task records decisions as it goes; pass report.save unchanged as save in the next call, with the same source, and send only the new events. The server keeps nothing between calls. caveat_explain instead replays a whole history from the start each time. report (caveat-dispatch-step/0.1) is the caveat-explain/0.1 report of the state after these events (its events list only this call's events), plus restored and save. exi…
| Parameter | Type | Description |
|---|---|---|
source * | string | Complete inline Caveat program text, available as the virtual file inline.cav. No file path or URL lookup. At most 1 MiB of UTF-8 source; each call uses a fresh runtime. |
events | array | Events to send in array order after the save is restored, or from a fresh session. Omitted or [] reports the current state and returns an equivalent save. Rejections are recorded and the step continue… |
moduleBindings | string | Optional, only with save, and only after a call refused that save because it needs this. A save that a release up to 1.4.1 wrote, of a bundle whose modules use hold or release, can need its reading na… |
save | string | Optional. The report.save text from the previous caveat_dispatch call, passed back unchanged. Omit to start a fresh session. A save restores only with the exact source it came from; it is not repaired… |
caveat_find
Search past decision records of one program for decisions already made: has this been decided before, on what grounds, and does it still stand? Each record is the events of one past run, replayed in a fresh session. A decision revision is found when every word of query occurs, ignoring case, in its decision or revision name, the record name, the names, sources and claims of the evidence it rests on, its caveats, or its retention reasons. Use caveat_explain to see one record in full, and caveat_dependents to trace one evidence forward. report (caveat-find/0.1) includes words, searched (per reco…
| Parameter | Type | Description |
|---|---|---|
query * | string | Words to find, separated by spaces, such as "refund email". Every word must match; case is ignored; a word matches part of a name, so refund matches refund_warranted. |
records * | array | Past records of the program, each {"name":"ticket-a","events":[...]}: a unique non-empty name the report uses, and the events of that run in order, as for caveat_explain. At most 64 records and 1 MiB… |
source * | string | Complete inline Caveat program text, available as the virtual file inline.cav. No file path or URL lookup. At most 1 MiB of UTF-8 source; each call uses a fresh runtime. |