Home / Learn / 18 Tools

Release v0.4.0Edition 0.2

18.10 Recap and reference

Page 11 of 11

18.10.1 For agents

Every command but una lsp prints one JSON document with --json, its schema key first. The run of the day-to-day program, with its trace:

json
{"schema":"una.run/1","tier":1,"status":"ok","output":["LAMP-01  19.90 now 13.93","DESK-02  129.00 now 110.00","CHAIR-09  not in the catalog"],"failure":null,"diagnostics":[],"trace":[{"seq":1,"instance":"with:listed#1","capability":"Catalog","op":"product","args":{"sku":"\"LAMP-01\""},"outcome":{"kind":"ok","value":"Some(Product(sku: \"LAMP-01\", price: 1990, cost: 1200))"}},{"seq":2,"instance":"host:Console","capability":"Console","op":"print","args":{"line":"\"LAMP-01  19.90 now 13.93\""},"outcome":{"kind":"ok","value":"unit"}},{"seq":3,"instance":"with:listed#2","capability":"Catalog","op":"product","args":{"sku":"\"DESK-02\""},"outcome":{"kind":"ok","value":"Some(Product(sku: \"DESK-02\", price: 12900, cost: 11000))"}},{"seq":4,"instance":"host:Console","capability":"Console","op":"print","args":{"line":"\"DESK-02  129.00 now 110.00\""},"outcome":{"kind":"ok","value":"unit"}},{"seq":5,"instance":"with:listed#3","capability":"Catalog","op":"product","args":{"sku":"\"CHAIR-09\""},"outcome":{"kind":"ok","value":"None"}},{"seq":6,"instance":"host:Console","capability":"Console","op":"print","args":{"line":"\"CHAIR-09  not in the catalog\""},"outcome":{"kind":"ok","value":"unit"}}]}

Each event names the handler instance that answered, such as with:listed#1, so an agent can check what a run asked of each service. The loop for an agent: una --json check ., apply what una fix . applies, read the remaining repairs by rank and escape_cost, then una --json test .. una fix never widens authority, never edits una.toml, and never applies an escape. Exit codes: 0 success, 1 an error, an unproven obligation or a failed example, 2 a usage error, 3 an internal error.

18.10.2 Recap

  • una check . is the loop. --tier 0 skips the proofs for a quick answer; run the full check before a change is done.
  • una fix --dry-run . shows the exact repairs, and una fix . applies them and formats. It never widens authority, applies an escape, or edits una.toml.
  • A diagnostic has a code, places, ranked repairs, and for a proof, an obligation and a counterexample. una explain explains any code.
  • --json turns the output of every command but una lsp into one document with a schema key, and exit codes say the same as the text.
  • una obligations, una contract and una trace show what was proven, what a function promises, and which code carries a rule.
  • una report shows what the package may do and trusts; compare it between releases.
  • una run, una test and una build check first, and run nothing that does not check.

18.10.3 Reference

Next:19 Editions