// Copyright AGNTCY Contributors (https://github.com/agntcy) // SPDX-License-Identifier: Apache-2.0 syntax = "proto3"; package agntcy.dir.events.v1; import "google/protobuf/timestamp.proto"; // EventService provides real-time event streaming for all system operations. // Events are delivered from subscription time forward with no history or replay. // This service enables external applications to react to system changes in real-time. service EventService { // Listen establishes a streaming connection to receive events. // Events are only delivered while the stream is active. // On disconnect, missed events are not recoverable. rpc Listen(ListenRequest) returns (stream ListenResponse); } // ListenRequest specifies filters for event subscription. message ListenRequest { // Event types to subscribe to. // If empty, subscribes to all event types. repeated EventType event_types = 1; // Optional label filters (e.g., "/skills/AI", "/domains/research"). // Only events for records matching these labels are delivered. // Uses substring matching. repeated string label_filters = 2; // Optional CID filters. // Only events for specific CIDs are delivered. repeated string cid_filters = 3; } // ListenResponse is the response message for the Listen RPC. // Wraps the Event message to allow for future extensions without breaking the Event structure. message ListenResponse { // The event that occurred. Event event = 1; // Future fields can be added here without breaking existing clients: // - Stream metadata // - Sequence numbers // - Acknowledgment tokens // - etc. } // Event represents a system event that occurred. message Event { // Unique event identifier (generated by the system). string id = 1; // Type of event that occurred. EventType type = 2; // When the event occurred. google.protobuf.Timestamp timestamp = 3; // Resource identifier (CID for records, sync_id for syncs, etc.). string resource_id = 4; // Optional labels associated with the record (for record events). repeated string labels = 5; // Optional metadata for additional context. // Used for flexible event-specific data that doesn't fit standard fields. map metadata = 7; } // EventType represents all valid event types in the system. // Each value represents a specific operation that can occur. // // Supported Events: // - Store: RECORD_PUSHED, RECORD_PULLED, RECORD_DELETED // - Routing: RECORD_PUBLISHED, RECORD_UNPUBLISHED // - Sync: SYNC_CREATED, SYNC_COMPLETED, SYNC_FAILED // - Sign: RECORD_SIGNED enum EventType { // Unknown/unspecified event type. EVENT_TYPE_UNSPECIFIED = 0; // Store service events - record storage operations // A record was pushed to local storage. EVENT_TYPE_RECORD_PUSHED = 1; // A record was pulled from storage. EVENT_TYPE_RECORD_PULLED = 2; // A record was deleted from storage. EVENT_TYPE_RECORD_DELETED = 3; // Routing service events - network operations // A record was published/announced to the network. EVENT_TYPE_RECORD_PUBLISHED = 4; // A record was unpublished from the network. EVENT_TYPE_RECORD_UNPUBLISHED = 5; // Sync service events - synchronization operations // A sync operation was created/initiated. EVENT_TYPE_SYNC_CREATED = 6; // A sync operation completed successfully. EVENT_TYPE_SYNC_COMPLETED = 7; // A sync operation failed. EVENT_TYPE_SYNC_FAILED = 8; // Sign service events - cryptographic operations // A record was signed. EVENT_TYPE_RECORD_SIGNED = 9; // A public key was uploaded. EVENT_TYPE_PUBLIC_KEY_UPLOADED = 10; // Future event types can be added here without breaking existing clients. // Examples: // EVENT_TYPE_RECORD_SEARCHED = 12; // EVENT_TYPE_REMOTE_RECORD_ANNOUNCED = 13; // EVENT_TYPE_PEER_CONNECTED = 14; // EVENT_TYPE_PEER_DISCONNECTED = 15; }