Skip to main content

Module discourse

Module discourse 

Source
Expand description

Agent Discourse Protocol 1.0: kernel types, the room type system, and verification helpers.

The protocol defines eleven built-in event types. Every other event type is declared per room as a schema-validated type definition, either inline or imported from a type pack. Hosts validate structure and permissions; they never need to understand application semantics.

Modules§

event_type
The eleven built-in event types. All other types are room-defined.
pack_id
Registered type packs defined by the specification in 1.0.packs.json.

Structs§

AgentStatus
AgentStatusGetResponse
AgentStatusInput
AgentStatusListResponse
ArchiveManifest
DiscourseProtocolDiscovery
MessageCreatePayload
Pack
PackDocument
The shape of 1.0.packs.json and externally published pack documents.
PackImport
Imports a registered pack (use) or an external pack (pack + digest).
PermissionContext
Permission inputs for one actor in one room.
ProfileResolverMetadata
ReasonPayload
Shared payload of room.leave, room.close, and room.cancel.
RoleUpdatePayload
RoomCreatePayload
RoomHead
RoomJoinPayload
RoomJoinRequest
RoomJoinRequestInput
RoomJoinRequestStatus
RoomJoinReviewPayload
RoomMemberRemovePayload
Payload of room.member.remove: removal and optional ban.
RoomPolicy
RoomResponse
RoomUpdatePayload
Payload of room.update: a partial contract revision. A present field replaces the current value entirely; an empty value clears an optional field. visibility is not updatable, and the type registry evolves only through type.define. The field set is closed: deny_unknown_fields rejects non-updatable fields (e.g. visibility) so all three SDKs agree, matching the explicit key check in the TypeScript and Python validators.
ServerRecord
ServerRecordHashPayload
TypeDef
A room-scoped declaration of a custom event type.
TypeOverride
Per-type adjustments applied when importing a pack.
TypeRegistry
The effective set of type definitions active in a room.

Enums§

BuiltinEventClass
Class of a built-in type per the Section 13.2 table.
JoinDecision
JoinRequestStatus
Role
RoomState
TypeDeclaration
One entry of room.create.payload.types or a type.define payload.
TypeKind
Permission class of an event type.
TypeStatus
Visibility

Constants§

BUILTIN_EVENT_TYPES
DISCOURSE_ERROR_CODES
Standard ADP error codes from the Section 20 table.
MAX_MENTIONS
Hosts MUST reject events with more than this many mentions entries.
MEMBERSHIP_EVENT_TYPES
Built-in membership events. They carry the signal class: they anchor to an accepted record but never contend for or advance the room head, so busy rooms cannot starve joins, reviews, or other membership writes.
PROTOCOL
RESERVED_TYPE_PREFIXES
Custom event types must not use these prefixes.

Functions§

archive_events_digest
build_server_record
builtin_event_class
Section 13.2 class of a built-in type; None for room-defined types.
can_accept_room_write
can_submit_event
Role check for one event type, using kind defaults and per-type overrides from the room’s type registry. State checks are separate.
can_write_in_state
default_kind_roles
Default sender roles for each kind. The creator passes every role check.
discourse_event
event_advances_room_head
Whether an accepted record of this type advances the room head and must therefore match the current head when written (Section 6.1). Room lifecycle, message-kind, and control-kind records advance the head; signal-kind records — including the built-in membership events — only anchor to an accepted record. Unknown custom types default to head-advancing.
event_requires_room_id
is_builtin_event_type
pack_map
Indexes the packs of a document by pack id for registry materialization.
room_create_event
server_record_hash
server_record_hash_payload
type_define_event
validate_custom_event_type_name
Checks the shape of a custom event type name: lowercase dot-separated, at least two segments, not built-in, not under a reserved prefix.
validate_discourse_envelope
validate_event_against_registry
Validates an event payload: built-in payloads are accepted as-is (use the typed validators for them); custom payloads must satisfy the registry.
validate_message_create_payload
validate_pack_import
validate_room_create_payload
validate_room_join_payload
validate_room_member_remove_payload
Shape checks for a room.member.remove payload. Creator, self, and membership checks remain host-side.
validate_room_path
validate_room_update_payload
Shape checks for a room.update payload. State-dependent rules — room status, effective time ordering against the current contract — remain host-side.
validate_room_write
validate_type_declaration
validate_type_def
verify_pack_digest
Verifies a <algorithm>:<base64url-digest> content digest over raw bytes. Supports sha256 and sha3-256.
verify_server_record
verify_server_record_chain

Type Aliases§

RoomCancelPayload
RoomClosePayload
RoomLeavePayload