Expand description
Agent-First Data (AFDATA) output formatting and protocol templates.
Public APIs, grouped by concern (see each item’s own docs for details; the full symbol list is the crate root’s own rustdoc index, not repeated here — it drifts out of sync with a hand-maintained count otherwise):
- Protocol v1 builders:
json_result,json_error,json_progress,json_log(each returns a builder; call.build()) - Protocol reader:
decode_protocol_eventparses and strict-validates one protocol line into a typedDecodedEvent - Redaction:
redacted_value/Redactor::value(JSON values),redact_url_secrets/Redactor::url(URL strings) —Redactorcarries customsecret_names/policy - Output formatters:
output_json,output_yaml,output_plainand their_with_optionsvariants - Parse utilities:
parse_size,normalize_utc_offset,is_valid_rfc3339_date,is_valid_rfc3339_time - CLI helpers:
cli_parse_output,cli_parse_log_filters(returnsLogFilters),cli_output,cli_output_with_options,build_cli_error,build_cli_version,cli_render_version,cli_handle_version_or_continue - (feature
cli-help): configurable clap help rendering via [cli_render_help_with_options] and [cli_handle_help_or_continue] - (feature
cli-help-markdown): [cli_render_help_markdown] — recursive Markdown help - (feature
skill-admin): [skill::run_skill_admin] — install/uninstall/status a spore’s embedded Agent Skill across Codex, Claude Code, opencode, and Hermes; returns a typed [skill::SkillReport] - (feature
tracing): [afdata_tracing::try_init] initializes an AFDATA stdout logging layer with configurable format and redaction; also [afdata_tracing::LogFormat]
The shared cross-language contract (which of these exist, under what name, in each of
Rust/Python/TypeScript/Go) is tracked in spec/api-surface.json and cross-checked by
scripts/validate_api_surface.py.
Structs§
- CliEmitter
- Stateful emitter for finite structured CLI executions.
- Decoded
Error - Decoded
kind:"error"event. - Decoded
Log - Decoded
kind:"log"event. - Decoded
Progress - Decoded
kind:"progress"event. - Decoded
Result - Decoded
kind:"result"event. - Error
Builder - Builder for error events.
- Event
- A typed, strict-valid AFDATA protocol v1 event.
- LogBuilder
- Builder for log events.
- LogFilters
- Parsed and normalized log filters (trimmed, lowercased, deduplicated).
- Output
Options - Output options combining redaction and rendering style.
- Progress
Builder - Builder for progress events.
- Redactor
- Configurable redaction builder for secrets and legacy field names.
- Result
Builder - Builder for result events.
- Version
Config - Configuration for pre-parser
--versionhandling.
Enums§
- Build
Error - Error type for builder failures.
- CliEmitter
Error - Error returned by
CliEmitter. - CliProtocol
Mode - Protocol envelope behavior for early CLI exits such as
--version. - Decoded
Event - A decoded, strict-valid AFDATA protocol v1 event, typed by kind.
- Event
Decode Error - Error returned by
decode_protocol_event. - LogLevel
- Log level enumeration (serialized as lowercase).
- Output
Format - Output format for CLI and pipe/MCP modes.
- Output
Style - Rendering style for YAML and plain output.
- Redaction
Policy - Redaction policy. Convert with
.into()toRedactororOutputOptions.
Functions§
- build_
cli_ error - Build a CLI error event with optional hint.
- build_
cli_ version - Build a standard CLI version event.
- cli_
handle_ version_ or_ continue - Render version output from raw argv if
--versionor-Vis present. - cli_
output - Dispatch output formatting by
OutputFormat. - cli_
output_ with_ options - Dispatch output formatting by
OutputFormatwith configurable output options. - cli_
parse_ log_ filters - Normalize
--logflag entries: trim, lowercase, deduplicate, remove empty. - cli_
parse_ output - Parse
--outputflag value intoOutputFormat. - cli_
render_ version - Render a CLI version response.
- decode_
protocol_ event - Parse one protocol v1 line, strict-validate it, and return a typed decoded event.
- is_
valid_ rfc3339_ date - Return true when
sis an RFC 3339full-date(YYYY-MM-DD). - is_
valid_ rfc3339_ time - Return true when
sis an RFC 3339partial-time(HH:MM:SS[.fraction]). - json_
error - Fluent builder: start building an error event.
- json_
log - Fluent builder: start building a log event.
- json_
progress - Fluent builder: start building a progress event.
- json_
result - Fluent builder: start building a result event.
- normalize_
utc_ offset - Normalize a fixed UTC offset string to AFDATA canonical form.
- output_
json - output_
json_ with_ options - Format as single-line JSON with configurable output options.
- output_
plain - Format as single-line logfmt. Keys stripped, values formatted, secrets redacted.
- output_
plain_ with_ options - Format as single-line logfmt with configurable output options.
- output_
yaml - Format as multi-line YAML. Keys stripped, values formatted, secrets redacted.
- output_
yaml_ with_ options - Format as multi-line YAML with configurable output options.
- parse_
size - redact_
url_ secrets - Redact secret components of a single URL string, using default options.
- redacted_
value - Return a JSON value copy with default
_secretredaction applied. - validate_
protocol_ event - Validate one protocol v1 event envelope.
- validate_
protocol_ stream - Validate a finite structured CLI event stream:
(log | progress)* -> exactly one (result | error) -> end.