|
A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
|
Namespaces | |
| namespace | serializable_internal |
Classes | |
| struct | ActionMessage |
| The wire description of an action invocation. More... | |
| struct | Chunk |
| A unit of data: bytes plus optional descriptive metadata. More... | |
| struct | ChunkMetadata |
| Descriptive metadata attached to a a11::data::Chunk. More... | |
| class | ChunkObject |
| An in-process value a chunk may carry instead of its encoded bytes. More... | |
| class | MsgpackReader |
| Sequentially decode the fields of one A11 MessagePack wire record. More... | |
| class | MsgpackWriter |
| Incrementally encode the fields of one A11 wire record. More... | |
| struct | NodeFragment |
| One piece of a node's stream: an inline chunk or a node reference. More... | |
| struct | NodeRef |
| A reference to a (slice of a) logical node, in lieu of inline data. More... | |
| struct | Port |
Binds an action's port name to the concrete node id serving it. More... | |
| class | SerializationRegistry |
| class | TypedChunkObject |
| The local fast path: a value in a chunk, encoded only if needed. More... | |
| struct | TypeTag |
Empty tag carrying a type T so customization points are found by argument-dependent lookup even when T does not appear elsewhere in the call (e.g. More... | |
| struct | WireMessage |
| The top-level frame exchanged between two A11 endpoints. More... | |
Concepts | |
| concept | JsonSerializable |
Whether T provides an ADL JSON representation. | |
| concept | MsgpackSerializable |
Whether T can be serialized to MessagePack, either directly via A11ToMsgpackBytes / A11FromMsgpackBytes or derived from its JSON form. | |
| concept | Serializable |
Whether T supports at least one representation. | |
| concept | HasSerialTypeTag |
Whether T publishes a serialisation tag. | |
Typedefs | |
| using | Bytes = std::string |
Raw byte payload; an alias of std::string. | |
| using | ByteMap = absl::flat_hash_map< std::string, Bytes > |
| String-keyed map of byte values (headers, attributes, etc.). | |
Functions | |
| absl::StatusOr< Json > | WireMessageToJsonValue (const WireMessage &message) |
| absl::StatusOr< std::string > | WireMessageToJson (const WireMessage &message) |
| absl::StatusOr< WireMessage > | WireMessageFromJsonValue (const Json &value) |
| absl::StatusOr< WireMessage > | WireMessageFromJson (std::string_view encoded) |
| absl::StatusOr< WireMessage > | WireMessageFromJsonValue (const nlohmann::json &value) |
| nlohmann::json | Binary (std::string_view bytes) |
| Wrap arbitrary bytes as a MessagePack binary JSON value. | |
| absl::StatusOr< std::string > | GetBinary (const nlohmann::json &value, std::string_view field_name) |
Read a binary JSON value, naming field_name in any validation error. | |
| absl::StatusOr< std::string > | PackStatus (const absl::Status &status) |
| Encode a structured Abseil status for action and transport status fields. | |
| absl::StatusOr< absl::Status > | UnpackStatus (std::string_view bytes) |
| Decode a structured status without losing A11 status details. | |
| std::string_view | A11SerialTag (TypeTag< ChunkMetadata >) |
| std::string_view | A11SerialTag (TypeTag< Chunk >) |
| std::string_view | A11SerialTag (TypeTag< NodeRef >) |
| std::string_view | A11SerialTag (TypeTag< NodeFragment >) |
| std::string_view | A11SerialTag (TypeTag< Port >) |
| std::string_view | A11SerialTag (TypeTag< ActionMessage >) |
| std::string_view | A11SerialTag (TypeTag< WireMessage >) |
| template<typename T > requires serializable_internal::HasSerialTag<T> | |
| std::string | SerialTypeTag () |
| template<typename T > requires JsonSerializable<T> | |
| absl::Status | RegisterJsonSerializable (SerializationRegistry ®istry) |
Registers a JSON codec (media type application/json) for T. | |
| template<typename T > requires MsgpackSerializable<T> | |
| absl::Status | RegisterMsgpackSerializable (SerializationRegistry ®istry) |
Registers a MessagePack codec (media type application/x-msgpack) for T, using direct bytes when available or deriving from JSON. | |
| template<typename T > requires Serializable<T> | |
| absl::Status | RegisterSerializable (SerializationRegistry ®istry, bool json=true, bool msgpack=true) |
Registers every representation T supports into registry. | |
| SerializationRegistry & | GlobalSerializationRegistry () |
| Returns the process-wide registry (defaults pre-installed). | |
| template<typename T > | |
| std::optional< T > | TryTakeObject (const Chunk &chunk, std::string_view tag) |
Takes the value out of chunk, if it is carrying one of type T. | |
| template<typename T > | |
| Chunk | MakeChunkObject (T value, std::string tag, std::string mimetype, std::shared_ptr< const SerializationRegistry > registry) |
Builds a chunk carrying value, with no bytes produced. | |
| absl::Status | ValidateName (std::string_view name) |
| Validates an A11 identifier (node/port/action name). | |
| absl::StatusOr< Chunk > | MakeStatusChunk (const absl::Status &status, bool closing=false) |
Encodes status as a chunk of mimetype kStatusMimetype. | |
| bool | IsStatusChunk (const Chunk &chunk) |
Whether chunk carries a packed status. | |
| bool | IsCloseStatusChunk (const Chunk &chunk) |
Whether chunk is a status chunk marking write-half closure. | |
| absl::StatusOr< absl::Status > | StatusFromStatusChunk (const Chunk &chunk) |
| Decodes a status previously encoded by MakeStatusChunk. | |
| bool | IsHalfCloseMessage (const WireMessage &message) |
Whether message is a transport half-close signal. | |
| WireMessage | MakeHalfCloseMessage (ByteMap trailers={}) |
Builds a half-close WireMessage carrying optional trailers. | |
| size_t | EmptyWireMessageSize () |
| The encoded size of an empty WireMessage. | |
Variables | |
| constexpr std::string_view | kChunkMetadataTag = "a11.ChunkMetadata" |
| constexpr std::string_view | kChunkTag = "a11.Chunk" |
| constexpr std::string_view | kNodeRefTag = "a11.NodeRef" |
| constexpr std::string_view | kNodeFragmentTag = "a11.NodeFragment" |
| constexpr std::string_view | kPortTag = "a11.Port" |
| constexpr std::string_view | kActionMessageTag = "a11.ActionMessage" |
| constexpr std::string_view | kWireMessageTag = "a11.WireMessage" |
| constexpr std::string_view | kStatusTag = "a11.Status" |
| constexpr std::string_view | kTimeTag = "a11.Time" |
| constexpr std::string_view | kDurationTag = "a11.Duration" |
| constexpr std::string_view | kInteractionTag = "a11.sdk.Interaction" |
| constexpr std::string_view | kPeerTag = "a11.sdk.Peer" |
| constexpr std::string_view | kActionConfigTag = "a11.sdk.ActionConfig" |
| constexpr std::string_view | kUsageMetadataTag = "a11.sdk.UsageMetadata" |
| constexpr std::string_view | kInteractWithClaudeConfigTag |
| constexpr std::string_view | kInteractWithClaudeCodeConfigTag |
| constexpr std::string_view | kInteractWithGeminiConfigTag |
| constexpr std::string_view | kInteractWithGptConfigTag |
| constexpr std::string_view | kInteractWithCodexConfigTag |
| constexpr std::string_view | kInteractWithOllamaConfigTag |
| constexpr std::string_view | kInteractWithVllmConfigTag |
| constexpr std::string_view | kInteractWithGemmaConfigTag |
| constexpr std::string_view | kAudioBufferTag = "a11.sdk.AudioBuffer" |
| constexpr std::string_view | kAudioInputOptionsTag |
| constexpr std::string_view | kSpeechRecognizerOptionsTag |
| constexpr std::string_view | kAudioDeviceInfoTag |
| constexpr std::string_view | kAudioControlEventTag |
| constexpr std::string_view | kAudioCaptureEventTag |
| constexpr std::string_view | kTranscriptionEventTag |
| constexpr std::string_view | kJsonMimetype = "application/json" |
| Media type of the built-in JSON codec. | |
| constexpr std::string_view | kMsgpackMimetype = "application/x-msgpack" |
| Media type of the built-in MessagePack codec. | |
| constexpr std::string_view | kTextMimetype = "text/plain" |
| Media type of UTF-8 text carried as itself. | |
| constexpr std::string_view | kBytesMimetype = "application/octet-stream" |
| Media type of opaque bytes carried as themselves. | |
| constexpr std::string_view | kStatusMimetype = "application/x-a11-status" |
| Mimetype marking a chunk whose payload is a packed status. | |
| constexpr std::string_view | kCloseAttribute = "a11-close" |
| Metadata attribute marking a status chunk as a closure marker. | |
| using a11::data::ByteMap = typedef absl::flat_hash_map<std::string, Bytes> |
String-keyed map of byte values (headers, attributes, etc.).
| using a11::data::Bytes = typedef std::string |
Raw byte payload; an alias of std::string.
|
inline |
|
inline |
|
inline |
|
inline |
| nlohmann::json a11::data::Binary | ( | std::string_view | bytes | ) |
Wrap arbitrary bytes as a MessagePack binary JSON value.
| size_t a11::data::EmptyWireMessageSize | ( | ) |
The encoded size of an empty WireMessage.
Computed from the same encoder rather than hard-coded, so it stays correct if the wire format changes.
| absl::StatusOr< std::string > a11::data::GetBinary | ( | const nlohmann::json & | value, |
| std::string_view | field_name | ||
| ) |
Read a binary JSON value, naming field_name in any validation error.
| SerializationRegistry & a11::data::GlobalSerializationRegistry | ( | ) |
Returns the process-wide registry (defaults pre-installed).
| bool a11::data::IsCloseStatusChunk | ( | const Chunk & | chunk | ) |
Whether chunk is a status chunk marking write-half closure.
| bool a11::data::IsHalfCloseMessage | ( | const WireMessage & | message | ) |
Whether message is a transport half-close signal.
| bool a11::data::IsStatusChunk | ( | const Chunk & | chunk | ) |
Whether chunk carries a packed status.
| Chunk a11::data::MakeChunkObject | ( | T | value, |
| std::string | tag, | ||
| std::string | mimetype, | ||
| std::shared_ptr< const SerializationRegistry > | registry | ||
| ) |
Builds a chunk carrying value, with no bytes produced.
| value | The value, which must not change afterwards. |
| tag | Its serialisation tag, from SerialTypeTag<T>(). |
| mimetype | The media type it would encode as; the chunk reports this as its mimetype, so a consumer selecting on media type sees the same thing it would have seen had the bytes been there. |
| registry | Used only if somebody asks for the bytes after all. |
| WireMessage a11::data::MakeHalfCloseMessage | ( | ByteMap | trailers | ) |
Builds a half-close WireMessage carrying optional trailers.
| absl::StatusOr< Chunk > a11::data::MakeStatusChunk | ( | const absl::Status & | status, |
| bool | closing = false |
||
| ) |
Encodes status as a chunk of mimetype kStatusMimetype.
| status | The status to pack. |
| closing | Whether to mark the chunk as a closure marker (kCloseAttribute), meaning the producer closed the node's write half. |
| absl::StatusOr< std::string > a11::data::PackStatus | ( | const absl::Status & | status | ) |
Encode a structured Abseil status for action and transport status fields.
| absl::Status a11::data::RegisterJsonSerializable | ( | SerializationRegistry & | registry | ) |
Registers a JSON codec (media type application/json) for T.
| absl::Status a11::data::RegisterMsgpackSerializable | ( | SerializationRegistry & | registry | ) |
Registers a MessagePack codec (media type application/x-msgpack) for T, using direct bytes when available or deriving from JSON.
| absl::Status a11::data::RegisterSerializable | ( | SerializationRegistry & | registry, |
| bool | json = true, |
||
| bool | msgpack = true |
||
| ) |
Registers every representation T supports into registry.
JSON is registered first (so it is the default when no mimetype is given) when available, followed by MessagePack. Passing json / msgpack as false skips that representation even when the type supports it.
| std::string a11::data::SerialTypeTag | ( | ) |
| absl::StatusOr< absl::Status > a11::data::StatusFromStatusChunk | ( | const Chunk & | chunk | ) |
Decodes a status previously encoded by MakeStatusChunk.
| std::optional< T > a11::data::TryTakeObject | ( | const Chunk & | chunk, |
| std::string_view | tag | ||
| ) |
Takes the value out of chunk, if it is carrying one of type T.
Returns nullopt when the chunk holds bytes instead, or holds a value of some other type. The value is copied to each reader, allowing multiple consumers to read the in-process object directly without repeated serialization.
| absl::StatusOr< absl::Status > a11::data::UnpackStatus | ( | std::string_view | bytes | ) |
Decode a structured status without losing A11 status details.
| absl::Status a11::data::ValidateName | ( | std::string_view | name | ) |
Validates an A11 identifier (node/port/action name).
| name | Candidate name. |
name matches A11's identifier grammar, else an error. | absl::StatusOr< WireMessage > a11::data::WireMessageFromJson | ( | std::string_view | encoded | ) |
| absl::StatusOr< WireMessage > a11::data::WireMessageFromJsonValue | ( | const Json & | value | ) |
| absl::StatusOr< WireMessage > a11::data::WireMessageFromJsonValue | ( | const nlohmann::json & | value | ) |
| absl::StatusOr< std::string > a11::data::WireMessageToJson | ( | const WireMessage & | message | ) |
| absl::StatusOr< nlohmann::json > a11::data::WireMessageToJsonValue | ( | const WireMessage & | message | ) |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
Media type of opaque bytes carried as themselves.
The default for a std::string, and for every language's byte-array type. Neither this nor kTextMimetype takes a ;type= parameter: the media type is the whole description, and the payload is the value with no framing – which is the point, since the JSON representation of bytes is base64 inside a quoted string, a third larger than the bytes themselves.
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
Metadata attribute marking a status chunk as a closure marker.
A plain status chunk carries a value (an action's outcome) or a failure to apply to a node. One carrying this attribute instead reports that the producer has drained the node and closed its write half with that status; it holds no application value and is never stored.
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
Media type of the built-in JSON codec.
|
inlineconstexpr |
Media type of the built-in MessagePack codec.
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
Mimetype marking a chunk whose payload is a packed status.
|
inlineconstexpr |
|
inlineconstexpr |
Media type of UTF-8 text carried as itself.
The default for strings in the languages that distinguish text from bytes. C++ does not – a std::string is a sequence of bytes – so here it is available on request and kBytesMimetype is the default; see RegisterDefaults.
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |