Skip to main content

Crate hatchery_observation_protocol

Crate hatchery_observation_protocol 

Source
Expand description

Dependency-light, versioned observations for provider-session monitoring.

Observations carry bounded, allowlisted workflow facts. They never carry prompts, transcript text, raw tool input/output, credentials, or provider configuration. Consumers must still treat the evidence source as part of the fact: terminal hints cannot authoritatively claim semantic workflow completion.

Structs§

ObservationCapabilitiesV1
ObservationTodoItemV1
ObservationV1

Enums§

BlockAuthorityV1
WHO or WHAT blocked an action – see ObservationKindV1::ActionBlocked. A strictly wider vocabulary than HostDecisionAuthorityV1: the harness itself only ever produces HarnessGate/HarnessPolicy/HarnessDeadline/ Operator (see that type’s own variants, which this one mirrors one-for-one for the harness’s own four), but a block can also come from the PROVIDER side of the wire – a classifier, a permission rule, a sandbox, a plain refusal, a hook, or the user declining inside the provider’s own UI – none of which HostDecisionAuthorityV1 has any vocabulary for at all. Unknown is the evidence-gated fallback: see ObservationV1::validate’s pty-hint rule, the only evidence class this crate lets claim it.
HostDecisionAuthorityV1
WHO decided a host request the agent sent to the ACP host – see ObservationKindV1::HostRequestObserved. Mirrors gate4agent’s own HostDecisionAuthority one-for-one; this crate is dependency-light and keeps its own copy rather than depending on gate4agent, the same convention every other *V1 wire type here follows.
HostRequestDecisionV1
A typed answer to “what happened to this host request” – see ObservationKindV1::HostRequestObserved. Mirrors gate4agent’s own HostRequestDecision one-for-one; see HostDecisionAuthorityV1’s doc comment for why this crate keeps its own copy.
HostRequestOutcomeV1
Whether a Granted host request’s underlying operation actually ran without an I/O or execution problem – see [ObservationKindV1:: HostRequestObserved]. Mirrors gate4agent’s own HostRequestOutcome one-for-one; see HostDecisionAuthorityV1’s doc comment for why this crate keeps its own copy rather than importing it.
ObservationEvidenceV1
ObservationInteractionOutcomeV1
ObservationKindV1
ObservationSourceFamilyV1
ObservationTodoStateV1
ObservationValidationError

Constants§

OBSERVATION_ACTION_BLOCKED_HELP_MAX_BYTES
Max bytes for ObservationKindV1::ActionBlocked::help – the guidance tail a CLI attaches after naming the block (e.g. “add a Bash permission rule”). Larger than reason because guidance text runs longer than a one-line refusal.
OBSERVATION_ACTION_BLOCKED_REASON_MAX_BYTES
Max bytes for ObservationKindV1::ActionBlocked::reason – the authority’s own refusal sentence (e.g. “blocked by dangerous-command gate: rule=…, argument=…”, or a provider’s “Reason: Blocked by classifier.”). Verbatim and bounded, never summarised – see truncate_observation_text for the producer-side cut this bound backs.
OBSERVATION_COLLECTION_MAX
OBSERVATION_DETAIL_MAX_BYTES
OBSERVATION_EVENT_MAX_BYTES
OBSERVATION_LABEL_MAX_BYTES
OBSERVATION_PATH_MAX_BYTES
OBSERVATION_TODO_ITEMS_MAX
OBSERVATION_TODO_TEXT_MAX_BYTES

Functions§

truncate_observation_text
Cuts value to at most max_bytes, backing off to the nearest UTF-8 character boundary at or before that limit – never inside a multi-byte sequence. Returns (text, true) when a cut was made, (text, false) when value already fit. This is the one honest way to bound ActionBlocked::reason/help without rewriting them: the byte limit is enforced here, at the producer, BEFORE ObservationV1::validate ever sees the text – that validator rejects an oversize value outright (see validate_required_text), it does not truncate. A caller that cuts text with this function is responsible for setting the sibling ObservationV1::truncated from the returned bool; this function only makes the cut safe, it does not know how to report having made it.