Expand description
Typed JSON wire DTOs for agent-facing stdout/stderr contracts.
§Policy (Rules Rust — JSON / NDJSON)
- Format: classic single-root JSON (object or array), RFC 8259. Not NDJSON.
- Encoding: UTF-8, no BOM on emit; BOM stripped on import parse.
- Shape: one complete document per CLI invocation on the data stream (stdout success or stderr error envelope), terminated by a single LF.
- Pretty-print: forbidden on the agent wire — compact
serde_json::to_stringonly (machine interop; matches error envelope historical compact form). - Types: known payloads use
Serialize/Deserializestructs here;Valueis reserved for genuinely dynamic trees (meta command-tree) and the flexible success-envelope field map at the emission boundary. - Must-Ignore: import deserializers ignore unknown fields (default serde).
- I-JSON: integers are
u16/u32/u64/i32within safe practical ranges (ports, exit codes, ms timeouts, byte counts); noNaN/Infinityfloats. - Schemas: hand-versioned under
docs/schemas/*.schema.json(not generated at runtime). Agents validate offline; product does not embed a schema engine. - Config on disk: TOML, not JSON5. JSON is only for CLI machine contracts
and optional
vps export --json/ import of that envelope.
Structs§
- Error
Envelope - Stderr failure envelope when JSON errors mode is active.
- Exec
Batch Json - Multi-host exec batch envelope.
- Exec
Host Json - One entry in multi-host
exec --all --json. - Exec
Target - Identity of the host a single-host execution actually ran against.
- Execution
Json exec/sudo-exec/su-execJSON stdout.- Export
Host Json - One host entry inside
vps export --json(redacted or with secrets). - Health
Batch Json health-check --all --jsonbatch envelope.- Health
Check Json health-check --jsonstdout (single host).- Health
Host Json - One entry in
health-check --all --json. - Import
Defaults - Default field values applied when import JSON omits them.
- Import
Envelope - Top-level import document:
vps-exportenvelope or bare{ "hosts": … }. - Import
Host Entry - One host object under
hostsfor JSON import. - Masked
VpsJson - Masked VPS record for
vps list|show --json(secrets never raw). - ScpBatch
Json - Multi-host SCP batch envelope.
- ScpHost
Json - One entry in multi-host
scp --all --json. - ScpTransfer
Json scp upload|download --jsonsuccess stdout.- Sftp
Batch Json - Multi-host SFTP batch (reuses scp-host shape).
- Sftp
FsOp Json sftp mkdir|rmdir|rm|rename|stat --json(stat uses size/mode fields).- Sftp
List Entry Json - One entry in
sftp ls --json. - Sftp
List Json sftp ls --jsonsuccess stdout.- Sftp
Transfer Json sftp upload|download --jsonsuccess stdout (G-SFTP-09).- Success
Envelope - Agent-first success envelope:
{ "ok": true, "event": …, …fields }. - Target
Echo - The resolved target, echoed under both the canonical and the legacy names.
- Tunnel
Closed Json tunnel --jsonshutdown event.- Tunnel
Listening Json tunnel --jsonpost-bind event.- VpsExport
Json vps export --jsonenvelope.
Enums§
- Target
Source - Where the executing host came from, reported by
ExecutionJson::host_source. - Tunnel
Close Reason - Reason a tunnel stopped serving, reported by
TunnelClosedJson.
Constants§
- UTF8_
BOM - UTF-8 BOM character; stripped before parsing external JSON.
Functions§
- print_
json_ line - Compact JSON + LF on stdout (agent success / data path).
- print_
json_ line_ stderr - Compact JSON + LF on stderr; BrokenPipe is ignored (downstream closed).
- resolved_
target - Returns the host resolved by this process, if any.
- set_
resolved_ target - Records the host this process resolved, so failures can name it.
- strip_
utf8_ bom - Strips a leading UTF-8 BOM if present (Rules: remove BOM before parse).
- write_
json_ line - Serializes
valueas compact JSON + trailing LF on the given writer.