Skip to main content

Crate ai6_diptel

Crate ai6_diptel 

Source
Expand description

§ai6-diptel

Version Rust version License: MPL-2.0 Docs CI

DipTels: the native and WebAssembly wire contract between a Station, Universal Exports and Outer Office, the operator app. One identity contract and one guatiao frame format carry Run lifecycle events, terminal bytes, terminal geometry and operator controls. See the crate API header.

§Features

  • Distinct validated Operation ID, Mission ID and provider ID types.
  • Schema-checked guatiao lifecycle, binary terminal, resize and operator control frames.
  • Native and wasm32-unknown-unknown support with no unsafe code.
  • No process-global state or custom wire codec.

FrameReceiver validates gateway frames against their channel schemas and yields decoded lifecycle events, terminal bytes, resize events, operator controls, gaps or channel closure. Schema announcements are consumed internally and return None.

§Installation

This crate is part of the AI6 workspace and is not published separately. From the repository root, add it as a path dependency:

cargo add ai6-diptel --path crates/ai6-diptel

There are no Cargo feature flags.

§Quick start

use ai6_diptel::{
    LifecycleEvent, MissionId, OperationId, RunId, RunState, lifecycle_frames,
};

let event = LifecycleEvent {
    operation_id: OperationId::new("operation-a")?,
    mission_id: MissionId::new("mission-17")?,
    run_id: RunId::new("provider-run-3")?,
    state: RunState::Working,
    reason: None,
    sequence: 4,
};
let (schema_frame, value_frame) = lifecycle_frames(&event)?;
assert!(!schema_frame.is_empty() && !value_frame.is_empty());

A Mission ID identifies one unit of work and may group several Runs. A provider ID identifies one resumable agent operation and stays the same when that operation resumes. An A2A Task ID is external protocol data.

§API overview

ItemPurpose
OperationId, MissionId, RunId, ControlIdValidated identities for project, work unit, provider operation and operator control.
RunSnapshot, LifecycleEvent, RunStateBoard state keyed by Operation, Mission and Run.
TerminalData, TerminalDirection, TerminalResizeBounded binary input/output and terminal geometry.
ControlAction, MissionControlAn operator control (cancel, retry, resume, interrupt) for the Station holding a Mission.
lifecycle_frames, terminal_frames, resize_frames, control_framesguatiao schema announcement and schema-checked value frames.
FrameReceiver, IncomingFrameSchema-checked gateway frame decoding.
MAX_ID_BYTES, MAX_TERMINAL_BYTES, MAX_CONTROL_MESSAGE_BYTESProtocol bounds applied by constructors.

§Development

From the repository root, run:

cargo fmt --all --check
cargo test -p ai6-diptel
cargo clippy -p ai6-diptel --all-targets --all-features -- -D warnings
RUSTDOCFLAGS="-D warnings" cargo doc -p ai6-diptel --no-deps
cargo check -p ai6-diptel --target wasm32-unknown-unknown

§Releasing

ai6-diptel is an internal workspace crate (publish = false). Update its version with the workspace package when an AI6 release requires it.

§License

MPL-2.0. See LICENSE.

Modules§

station
What a Station sends to Universal Exports, each body declared once.

Structs§

ControlId
A validated identifier for one operator control request.
FrameDecodeError
A malformed or unsupported incoming Universal Exports frame.
FrameReceiver
Decodes gateway frames while retaining Guatiao channel schemas.
FrameTooLarge
A terminal frame exceeded the protocol limit.
InvalidControl
A control field was empty, too long or held control characters.
InvalidGap
No sequence lies between a gap’s two ends.
InvalidIdentity
An invalid or over-limit protocol identity.
InvalidSize
A terminal resize dimension was zero.
LifecycleEvent
A lifecycle update for one agent Run.
MissionControl
One operator control, as Universal Exports hands it to the Station holding the Mission.
MissionId
A validated Mission identifier grouping one unit of work.
OperationId
A validated Operation identifier. An Operation is a project scope.
RunId
A provider-issued identifier for one resumable agent operation.
RunSnapshot
A run’s identity and current board state.
TerminalData
Terminal input or output associated with a Run.
TerminalGap
Events of a Run that a viewer cannot have: those after after and before before.
TerminalResize
A terminal resize request.

Enums§

ControlAction
What an operator asks of a Mission or of its live Run.
IncomingFrame
One validated lifecycle, terminal or control frame received from a gateway.
RunState
The lifecycle state shown for an agent Run: the state of the Mission it serves.
TerminalDirection
Direction of terminal bytes at the gateway boundary.

Constants§

MAX_CONTROL_MESSAGE_BYTES
The largest operator message a control carries, in UTF-8 bytes.
MAX_ID_BYTES
The largest accepted identity, in UTF-8 bytes.
MAX_REASON_BYTES
The longest lifecycle reason, in bytes.
MAX_TERMINAL_BYTES
The largest terminal data frame accepted by this protocol.

Functions§

control_frames
Creates a guatiao schema announcement and value frame for an operator control.
gap_frames
Creates a guatiao schema announcement and value frame for a gap.
lifecycle_frames
Creates a guatiao schema announcement and value frame for a lifecycle event.
resize_frames
Creates a guatiao schema announcement and value frame for a terminal resize.
terminal_frames
Creates a guatiao schema announcement and value frame for terminal bytes.
valid_reason
Whether reason is a lifecycle reason: 1 to MAX_REASON_BYTES of a-z, 0-9, -, _ and ..