Expand description
Dual-consumer error output: an RFC 9457 Problem Details envelope, shared across the MIF (Modeled Information Format) workspace’s crates.
A command-line tool or MCP server now answers to two audiences: the human
who reads the terminal, and the LLM agent that parses the bytes and
decides whether to retry, escalate, or abandon. The human is served by an
error enum’s ordinary Display output (unchanged). The agent is served by
ProblemDetails — a serializable RFC 9457 Problem Details envelope
carrying the five standard members plus the three agent extensions
(retry_after, suggested_fix, code_actions) and an Applicability
marker on every suggested fix and code action.
This workspace deliberately has no shared top-level error type (see
this repo’s CLAUDE.md, “Why thiserror for Errors”) — mif-schema,
mif-ontology, mif-frontmatter, mif-embed, and mif-store each fail
in genuinely different ways and keep their own thiserror enum. This
crate does not change that: instead of one central Error enum with a
meta() match (the pattern this crate adapts from
attested-delivery/rust-template’s crates/problem.rs), each crate’s own
error enum implements ToProblem directly, using ProblemMeta to
keep its own per-variant type-URI/status/exit-code bookkeeping in one
place.
Structs§
- Code
Action - A structured edit an agent can apply directly, modeled on the LSP
CodeActioninterface. - Problem
Details - An RFC 9457 Problem Details envelope for machine consumers.
- Problem
Meta - Reusable per-variant problem-type metadata.
- Suggested
Fix - A recovery suggestion tagged with an
Applicabilitymarker.
Enums§
- Applicability
- How confidently an agent may apply a
SuggestedFixorCodeAction. - Output
Format - The rendering format for an error reported to a consumer.
Constants§
- ERROR_
TYPE_ BASE_ URI - Base URI under which this workspace’s problem-type identifiers are namespaced.
Traits§
- ToProblem
- Implemented by each crate’s own error enum to map it to a
ProblemDetailsenvelope.
Functions§
- classify_
io_ error - Classifies a
std::io::Errorfor RFC 9457 rendering.