CLI
Check, explain and test policies, verify receipts, and answer pending approvals from a terminal.
The same commands ship in both packages. Python installs viewport-hitl on your PATH. In a Node project, run it
with npx @viewportai/hitl <command> (or viewport-hitl from an npm script). Paths default to policies/.
viewport-hitl <command>
check [paths] [--tools tools.json] [--channels slack,terminal] schema plus lint
explain [paths] --tool NAME [--args JSON] [--context k=v]... [--actor ID] [--tenant T] [--usage rule=N]... [--schema input-schema.json]
test [paths] run tests: blocks and *.test.yaml
receipts verify <file.jsonl|store.sqlite|postgres://...> [--chain TENANT] [--anchor sha256:...]
pending --store <path|dsn> [paths]
approve <approval_id> --store <path|dsn> [--by ID] [--reason TEXT] [paths...]
deny <approval_id> --store <path|dsn> [--by ID] [--message TEXT] [paths...]
init --tools tools.json [--out policies/starter.yaml] [--force]Every command exits 0 on success and 1 on a failure it reports (a lint error, a failing test, a broken chain).
check
Schema plus lint: fail-open timeouts, allow rules a deny fully covers, ask rules with no reachable approver,
default: allow. --tools adds coverage (tools no rule mentions) and flags deny/ask rules on argument paths no
tool has; --channels lists the channels you configure in code.
viewport-hitl check
npx @viewportai/hitl check policies/ --tools tools.json2 rules, 1 approvers, digest sha256:403db9a4...: 0 errors, 0 warningsexplain
The decision trace for one action, without a store (--usage rule=N supplies limit usage):
viewport-hitl explain --tool issue_refund --args '{"order_id": "A-1002", "amount": 900}'ASK by large-refunds: Refunds over $50 need a human
* refunds (allow): match
* large-refunds (ask): match
needs: support x1 (large-refunds)Values the gate would mask never appear in the trace: the policy's secrets: paths, the default secret rules and,
with --schema input-schema.json, the tool schema's declared secrets. A rule that cannot decide on such a value reads
args.card: gt could not be decided on a string (value masked). test follows the same rule.
test
Runs tests: blocks and *.test.yaml files:
pass issue_refund -> allow (#1)
pass issue_refund -> ask (#2)
2 passed, 0 failedreceipts verify
Recomputes every digest of a JSONL file, a SQLite store or a Postgres store and checks the chain. --anchor
requires a digest you pinned earlier to be in it. --chain <tenant> verifies one tenant's chain in a store
(without it, the default tenant-less chain). See Receipts and
Tenants.
pending, approve, deny
Answer approvals from a terminal against a durable store. The reviewer defaults to terminal:<user>@<host> (answers count for approvers on the terminal channel); the policy
is loaded so membership and edits are checked as for any channel.
--by accepts any identity: the CLI writes reviews straight into the store. Store access is therefore full approval
authority. Whoever can run the CLI against the store (or write to it directly) can approve anything as anyone, so
protect the store and its credentials like a credential that can approve every action.
viewport-hitl pending --store .viewport/hitl.sqlite
viewport-hitl approve apr_01JDQ7... --store .viewport/hitl.sqlite --reason "checked the order"
npx @viewportai/hitl deny apr_01JDQ7... --store postgres://localhost/app --message "Amount looks wrong"init
Writes a starter policy from a tool list (a JSON array of names or tool definitions): tools that read run alone, everything else asks a human, every tool named.
viewport-hitl init --tools tools.json --out policies/starter.yamlErrors and codes
Every hitl.* code, where it appears (an outcome value, a rejected review, an HTTP response or an exception), and which ones are worth retrying.
Viewport Context
Progressive skill loading, per-skill tool binding, token budgets and cache-friendly prompt assembly, for any agent stack, in Python and TypeScript.