@elizaos/schemas 2.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,199 @@
1
+ # elizaOS Protocol Buffer Schemas
2
+
3
+ This directory contains the **single source of truth** for all elizaOS types. These Protocol Buffer schemas are compiled to generate type definitions for TypeScript, Python, and Rust.
4
+
5
+ ## Architecture
6
+
7
+ ```
8
+ schemas/
9
+ ├── buf.yaml # Buf module configuration
10
+ ├── buf.gen.yaml # Code generation configuration
11
+ ├── eliza/v1/ # Proto definitions (versioned)
12
+ │ ├── primitives.proto # UUID, Content, Media, Metadata
13
+ │ ├── memory.proto # Memory, MemoryMetadata
14
+ │ ├── state.proto # State, ActionPlan, WorkingMemory
15
+ │ ├── environment.proto # Entity, Room, World, Relationship
16
+ │ ├── components.proto # Action, Provider, Evaluator
17
+ │ ├── agent.proto # Character, Agent
18
+ │ ├── service.proto # Service types
19
+ │ ├── model.proto # Model types, generation params
20
+ │ ├── events.proto # Event types and payloads
21
+ │ ├── plugin.proto # Plugin, Route definitions
22
+ │ ├── task.proto # Task types
23
+ │ ├── database.proto # Database, logging types
24
+ │ ├── messaging.proto # WebSocket, streaming types
25
+ │ └── ipc.proto # Cross-language IPC messages
26
+ └── README.md
27
+
28
+ Generated output:
29
+ ├── packages/typescript/src/types/generated/ # TypeScript
30
+ ├── packages/python/elizaos/types/generated/ # Python
31
+ └── packages/rust/src/types/generated/ # Rust
32
+ ```
33
+
34
+ ## Quick Start
35
+
36
+ ### Prerequisites
37
+
38
+ Install Buf CLI:
39
+
40
+ ```bash
41
+ # macOS
42
+ brew install bufbuild/buf/buf
43
+
44
+ # Linux
45
+ curl -sSL "https://github.com/bufbuild/buf/releases/latest/download/buf-$(uname -s)-$(uname -m)" -o /usr/local/bin/buf
46
+ chmod +x /usr/local/bin/buf
47
+
48
+ # npm (cross-platform)
49
+ npm install -g @bufbuild/buf
50
+ ```
51
+
52
+ ### Generate Types
53
+
54
+ ```bash
55
+ # From the schemas directory
56
+ cd schemas
57
+
58
+ # Lint proto files
59
+ buf lint
60
+
61
+ # Generate code for all languages
62
+ buf generate
63
+
64
+ # Or use the npm script from project root
65
+ npm run generate:types
66
+ ```
67
+
68
+ ### Development Workflow
69
+
70
+ 1. **Edit proto files** in `eliza/v1/`
71
+ 2. **Run `buf lint`** to check for errors
72
+ 3. **Run `buf generate`** to regenerate types
73
+ 4. **Commit both** proto changes and generated code
74
+
75
+ ## Schema Design Principles
76
+
77
+ ### 1. Versioning
78
+
79
+ All schemas are under `eliza/v1/`. When breaking changes are needed, create `eliza/v2/` and maintain both during migration.
80
+
81
+ ### 2. JSON Compatibility
82
+
83
+ Proto3 has first-class JSON mapping. All messages can be serialized to JSON for debugging:
84
+
85
+ - `snake_case` in proto → `camelCase` in JSON (automatic)
86
+ - Use `google.protobuf.Struct` for dynamic/unknown fields
87
+
88
+ ### 3. Optional Fields
89
+
90
+ Use `optional` keyword for fields that may not be present:
91
+
92
+ ```protobuf
93
+ message Memory {
94
+ optional string id = 1; // Optional on creation
95
+ string entity_id = 2; // Always required
96
+ }
97
+ ```
98
+
99
+ ### 4. Enums
100
+
101
+ Always include `UNSPECIFIED = 0` as the first enum value:
102
+
103
+ ```protobuf
104
+ enum MemoryType {
105
+ MEMORY_TYPE_UNSPECIFIED = 0;
106
+ MEMORY_TYPE_DOCUMENT = 1;
107
+ MEMORY_TYPE_MESSAGE = 2;
108
+ }
109
+ ```
110
+
111
+ ### 5. Dynamic Properties
112
+
113
+ Use `google.protobuf.Struct` for JSON-like dynamic data:
114
+
115
+ ```protobuf
116
+ import "google/protobuf/struct.proto";
117
+
118
+ message Content {
119
+ string text = 1;
120
+ google.protobuf.Struct data = 2; // Dynamic properties
121
+ }
122
+ ```
123
+
124
+ ## Language-Specific Notes
125
+
126
+ ### TypeScript
127
+
128
+ - Generated with `@bufbuild/protobuf`
129
+ - Import from `@elizaos/core/types/generated`
130
+ - Full TypeScript types with proper inference
131
+
132
+ ### Python
133
+
134
+ - Generated with `betterproto` for clean, Pythonic code
135
+ - Dataclass-style types with type hints
136
+ - Import from `elizaos.types.generated`
137
+
138
+ ### Rust
139
+
140
+ - Generated with `prost` (WASM-compatible)
141
+ - Includes `serde` support for JSON serialization
142
+ - Import from `elizaos::types::generated`
143
+
144
+ ## Adding New Types
145
+
146
+ 1. Create or edit a `.proto` file in `eliza/v1/`
147
+ 2. Follow naming conventions:
148
+ - Messages: `PascalCase`
149
+ - Fields: `snake_case`
150
+ - Enums: `SCREAMING_SNAKE_CASE`
151
+ - Enum values: `ENUM_NAME_VALUE_NAME`
152
+ 3. Run `buf lint` to validate
153
+ 4. Run `buf generate` to create code
154
+ 5. Update imports in consuming code
155
+
156
+ ## Migration from Manual Types
157
+
158
+ The generated types replace the manual type definitions in:
159
+
160
+ - `packages/typescript/src/types/*.ts`
161
+ - `packages/python/elizaos/types/*.py`
162
+ - `packages/rust/src/types/*.rs`
163
+
164
+ ### Compatibility Layer
165
+
166
+ During migration, a compatibility layer re-exports generated types with the original names. This allows gradual migration:
167
+
168
+ ```typescript
169
+ // packages/typescript/src/types/index.ts
170
+ export * from "./generated";
171
+ export { Memory as MemoryType } from "./generated/eliza/v1/memory_pb";
172
+ ```
173
+
174
+ ## Buf Commands Reference
175
+
176
+ ```bash
177
+ # Lint proto files
178
+ buf lint
179
+
180
+ # Check for breaking changes
181
+ buf breaking --against '.git#branch=main'
182
+
183
+ # Generate code
184
+ buf generate
185
+
186
+ # Update dependencies
187
+ buf dep update
188
+
189
+ # Format proto files
190
+ buf format -w
191
+ ```
192
+
193
+ ## Resources
194
+
195
+ - [Buf Documentation](https://buf.build/docs)
196
+ - [Protocol Buffers Language Guide](https://protobuf.dev/programming-guides/proto3/)
197
+ - [bufbuild/protobuf-es](https://github.com/bufbuild/protobuf-es) (TypeScript)
198
+ - [danielgtaylor/python-betterproto](https://github.com/danielgtaylor/python-betterproto) (Python)
199
+ - [tokio-rs/prost](https://github.com/tokio-rs/prost) (Rust)
package/buf.gen.yaml ADDED
@@ -0,0 +1,28 @@
1
+ # buf.gen.yaml - Code generation configuration for multiple languages
2
+ version: v2
3
+
4
+ managed:
5
+ enabled: true
6
+ override:
7
+ - file_option: go_package_prefix
8
+ value: github.com/elizaos/eliza/gen/go
9
+
10
+ plugins:
11
+ # TypeScript generation using @bufbuild/protobuf
12
+ - remote: buf.build/bufbuild/es:v2.2.2
13
+ out: ../typescript/src/types/generated
14
+ opt:
15
+ - target=ts
16
+ - import_extension=.js
17
+
18
+ # Python generation using standard protobuf
19
+ - remote: buf.build/protocolbuffers/python
20
+ out: ../python/elizaos/types/generated
21
+
22
+ # Python type stubs
23
+ - remote: buf.build/protocolbuffers/pyi
24
+ out: ../python/elizaos/types/generated
25
+
26
+ # Rust generation using prost (WASM-compatible)
27
+ - remote: buf.build/community/neoeinstein-prost:v0.4.0
28
+ out: ../rust/src/types/generated
package/buf.yaml ADDED
@@ -0,0 +1,16 @@
1
+ # buf.yaml - Buf configuration for elizaOS proto schemas
2
+ version: v2
3
+ modules:
4
+ - path: .
5
+ name: buf.build/elizaos/eliza
6
+ lint:
7
+ use:
8
+ - STANDARD
9
+ except:
10
+ - FIELD_NOT_REQUIRED
11
+ - PACKAGE_NO_IMPORT_CYCLE
12
+ breaking:
13
+ use:
14
+ - FILE
15
+ deps:
16
+ - buf.build/googleapis/googleapis
@@ -0,0 +1,119 @@
1
+ // agent.proto - Agent and Character types for elizaOS
2
+ syntax = "proto3";
3
+
4
+ package eliza.v1;
5
+
6
+ import "eliza/v1/primitives.proto";
7
+ import "google/protobuf/struct.proto";
8
+
9
+ // Agent status enumeration
10
+ enum AgentStatus {
11
+ AGENT_STATUS_UNSPECIFIED = 0;
12
+ AGENT_STATUS_ACTIVE = 1;
13
+ AGENT_STATUS_INACTIVE = 2;
14
+ }
15
+
16
+ // Example message for demonstration
17
+ message MessageExample {
18
+ string name = 1;
19
+ Content content = 2;
20
+ }
21
+
22
+ // Knowledge item - can be a path or directory reference
23
+ message KnowledgeItem {
24
+ oneof item {
25
+ string path = 1;
26
+ KnowledgeDirectory directory = 2;
27
+ }
28
+ }
29
+
30
+ // Knowledge directory with optional shared flag
31
+ message KnowledgeDirectory {
32
+ string path = 1;
33
+ optional bool shared = 2;
34
+ }
35
+
36
+ // Character settings (well-known keys with expected types)
37
+ message CharacterSettings {
38
+ // Model type to use for shouldRespond evaluation
39
+ optional string should_respond_model = 1; // "small" | "large"
40
+ // Whether to use multi-step workflow
41
+ optional bool use_multi_step = 2;
42
+ // Maximum iterations for multi-step
43
+ optional int32 max_multistep_iterations = 3;
44
+ // Whether LLM is off by default in rooms
45
+ optional bool bootstrap_defllmoff = 4;
46
+ // Whether to keep responses when superseded
47
+ optional bool bootstrap_keep_resp = 5;
48
+ // Provider execution timeout in ms
49
+ optional int32 providers_total_timeout_ms = 6;
50
+ // Maximum working memory entries
51
+ optional int32 max_working_memory_entries = 7;
52
+ // Channel types that always trigger response
53
+ optional string always_respond_channels = 8;
54
+ // Sources that always trigger response
55
+ optional string always_respond_sources = 9;
56
+ // Model temperature
57
+ optional double default_temperature = 10;
58
+ // Maximum tokens for text generation
59
+ optional int32 default_max_tokens = 11;
60
+ // Frequency penalty
61
+ optional double default_frequency_penalty = 12;
62
+ // Presence penalty
63
+ optional double default_presence_penalty = 13;
64
+ // Disable basic capabilities
65
+ optional bool disable_basic_capabilities = 14;
66
+ // Enable extended capabilities
67
+ optional bool enable_extended_capabilities = 15;
68
+ // Additional dynamic settings
69
+ google.protobuf.Struct extra = 16;
70
+ }
71
+
72
+ // Writing style guides
73
+ message StyleGuides {
74
+ repeated string all = 1;
75
+ repeated string chat = 2;
76
+ repeated string post = 3;
77
+ }
78
+
79
+ // Character configuration defining personality, knowledge, and capabilities
80
+ message Character {
81
+ optional string id = 1;
82
+ string name = 2;
83
+ optional string username = 3;
84
+ optional string system = 4;
85
+ // Templates as map of name to template string
86
+ map<string, string> templates = 5;
87
+ // Bio can be a single string or multiple lines
88
+ repeated string bio = 6;
89
+ // Example messages grouped in arrays
90
+ repeated MessageExampleGroup message_examples = 7;
91
+ repeated string post_examples = 8;
92
+ repeated string topics = 9;
93
+ repeated string adjectives = 10;
94
+ repeated KnowledgeItem knowledge = 11;
95
+ repeated string plugins = 12;
96
+ optional CharacterSettings settings = 13;
97
+ // Secrets as key-value pairs
98
+ map<string, string> secrets = 14;
99
+ optional StyleGuides style = 15;
100
+ // Enable built-in advanced planning capabilities
101
+ optional bool advanced_planning = 16;
102
+ // Enable built-in advanced memory capabilities
103
+ optional bool advanced_memory = 17;
104
+ }
105
+
106
+ // Group of message examples (for nested array structure)
107
+ message MessageExampleGroup {
108
+ repeated MessageExample examples = 1;
109
+ }
110
+
111
+ // Represents an operational agent
112
+ message Agent {
113
+ // Inherits all Character fields
114
+ Character character = 1;
115
+ optional bool enabled = 2;
116
+ AgentStatus status = 3;
117
+ int64 created_at = 4;
118
+ int64 updated_at = 5;
119
+ }
@@ -0,0 +1,111 @@
1
+ // components.proto - Action, Provider, Evaluator types for elizaOS
2
+ syntax = "proto3";
3
+
4
+ package eliza.v1;
5
+
6
+ import "eliza/v1/primitives.proto";
7
+ import "google/protobuf/struct.proto";
8
+
9
+ // JSON Schema for action parameter validation
10
+ message ActionParameterSchema {
11
+ string type = 1;
12
+ optional string description = 2;
13
+ // Default value
14
+ google.protobuf.Value default_value = 3;
15
+ // Allowed enum values
16
+ repeated string enum_values = 4;
17
+ // Nested properties for object types
18
+ map<string, ActionParameterSchema> properties = 5;
19
+ // Item schema for array types
20
+ optional ActionParameterSchema items = 6;
21
+ // Numeric constraints
22
+ optional double minimum = 7;
23
+ optional double maximum = 8;
24
+ // String pattern (regex)
25
+ optional string pattern = 9;
26
+ }
27
+
28
+ // Defines a single parameter for an action
29
+ message ActionParameter {
30
+ string name = 1;
31
+ string description = 2;
32
+ optional bool required = 3;
33
+ ActionParameterSchema schema = 4;
34
+ }
35
+
36
+ // Example content with associated user for demonstration
37
+ message ActionExample {
38
+ string name = 1;
39
+ Content content = 2;
40
+ }
41
+
42
+ // Validated parameters passed to an action handler
43
+ // Represented as a Struct for flexibility with nested values
44
+ message ActionParameters {
45
+ google.protobuf.Struct values = 1;
46
+ }
47
+
48
+ // Result returned by an action after execution
49
+ message ActionResult {
50
+ bool success = 1;
51
+ optional string text = 2;
52
+ google.protobuf.Struct values = 3;
53
+ google.protobuf.Struct data = 4;
54
+ optional string error = 5;
55
+ }
56
+
57
+ // Context provided to actions during execution
58
+ message ActionContext {
59
+ repeated ActionResult previous_results = 1;
60
+ }
61
+
62
+ // Options passed to action handlers during execution
63
+ message HandlerOptions {
64
+ optional ActionContext action_context = 1;
65
+ // Forward reference to ActionPlan (defined in state.proto)
66
+ optional string action_plan_json = 2; // Serialized ActionPlan
67
+ optional ActionParameters parameters = 3;
68
+ }
69
+
70
+ // Action manifest (metadata only, for cross-language interop)
71
+ message ActionManifest {
72
+ string name = 1;
73
+ string description = 2;
74
+ repeated string similes = 3;
75
+ repeated ActionExample examples = 4;
76
+ optional int32 priority = 5;
77
+ repeated string tags = 6;
78
+ repeated ActionParameter parameters = 7;
79
+ }
80
+
81
+ // Result returned by a provider
82
+ message ProviderResult {
83
+ optional string text = 1;
84
+ google.protobuf.Struct values = 2;
85
+ google.protobuf.Struct data = 3;
86
+ }
87
+
88
+ // Provider manifest (metadata only, for cross-language interop)
89
+ message ProviderManifest {
90
+ string name = 1;
91
+ optional string description = 2;
92
+ optional bool dynamic = 3;
93
+ optional int32 position = 4;
94
+ optional bool private = 5;
95
+ }
96
+
97
+ // Example for evaluating agent behavior
98
+ message EvaluationExample {
99
+ string prompt = 1;
100
+ repeated ActionExample messages = 2;
101
+ string outcome = 3;
102
+ }
103
+
104
+ // Evaluator manifest (metadata only, for cross-language interop)
105
+ message EvaluatorManifest {
106
+ string name = 1;
107
+ string description = 2;
108
+ optional bool always_run = 3;
109
+ repeated string similes = 4;
110
+ repeated EvaluationExample examples = 5;
111
+ }
@@ -0,0 +1,199 @@
1
+ // database.proto - Database and logging types for elizaOS
2
+ syntax = "proto3";
3
+
4
+ package eliza.v1;
5
+
6
+ import "eliza/v1/memory.proto";
7
+ import "google/protobuf/struct.proto";
8
+ import "google/protobuf/timestamp.proto";
9
+
10
+ // Run status enumeration
11
+ enum DbRunStatus {
12
+ DB_RUN_STATUS_UNSPECIFIED = 0;
13
+ DB_RUN_STATUS_STARTED = 1;
14
+ DB_RUN_STATUS_COMPLETED = 2;
15
+ DB_RUN_STATUS_TIMEOUT = 3;
16
+ DB_RUN_STATUS_ERROR = 4;
17
+ }
18
+
19
+ // Base log body type
20
+ message BaseLogBody {
21
+ optional string run_id = 1;
22
+ optional string parent_run_id = 2;
23
+ optional string status = 3;
24
+ optional string message_id = 4;
25
+ optional string room_id = 5;
26
+ optional string entity_id = 6;
27
+ google.protobuf.Struct metadata = 7;
28
+ }
29
+
30
+ // Action log content structure
31
+ message ActionLogContent {
32
+ repeated string actions = 1;
33
+ optional string text = 2;
34
+ optional string thought = 3;
35
+ }
36
+
37
+ // Action result for logging
38
+ message ActionLogResult {
39
+ optional bool success = 1;
40
+ google.protobuf.Struct data = 2;
41
+ optional string text = 3;
42
+ optional string error = 4;
43
+ }
44
+
45
+ // Prompt tracking for action logs
46
+ message ActionLogPrompt {
47
+ string model_type = 1;
48
+ string prompt = 2;
49
+ int64 timestamp = 3;
50
+ }
51
+
52
+ // Action log body
53
+ message ActionLogBody {
54
+ BaseLogBody base = 1;
55
+ optional string action = 2;
56
+ optional string action_id = 3;
57
+ optional string message = 4;
58
+ google.protobuf.Struct state = 5;
59
+ repeated google.protobuf.Struct responses = 6;
60
+ optional ActionLogContent content = 7;
61
+ optional ActionLogResult result = 8;
62
+ repeated ActionLogPrompt prompts = 9;
63
+ optional int32 prompt_count = 11;
64
+ optional string plan_step = 12;
65
+ optional string plan_thought = 13;
66
+ }
67
+
68
+ // Evaluator log body
69
+ message EvaluatorLogBody {
70
+ BaseLogBody base = 1;
71
+ optional string evaluator = 2;
72
+ optional string message = 3;
73
+ google.protobuf.Struct state = 4;
74
+ }
75
+
76
+ // Model action context
77
+ message ModelActionContext {
78
+ string action_name = 1;
79
+ string action_id = 2;
80
+ }
81
+
82
+ // Model log body
83
+ message ModelLogBody {
84
+ BaseLogBody base = 1;
85
+ optional string model_type = 2;
86
+ optional string model_key = 3;
87
+ google.protobuf.Struct params = 4;
88
+ optional string prompt = 5;
89
+ optional string system_prompt = 6;
90
+ optional int64 timestamp = 7;
91
+ optional int64 execution_time = 8;
92
+ optional string provider = 9;
93
+ optional ModelActionContext action_context = 10;
94
+ google.protobuf.Value response = 11;
95
+ }
96
+
97
+ // Embedding log body
98
+ message EmbeddingLogBody {
99
+ BaseLogBody base = 1;
100
+ optional string memory_id = 2;
101
+ optional int64 duration = 3;
102
+ }
103
+
104
+ // Union of all log body types
105
+ message LogBody {
106
+ oneof body {
107
+ BaseLogBody base = 1;
108
+ ActionLogBody action = 2;
109
+ EvaluatorLogBody evaluator = 3;
110
+ ModelLogBody model = 4;
111
+ EmbeddingLogBody embedding = 5;
112
+ }
113
+ }
114
+
115
+ // Log entry
116
+ message Log {
117
+ optional string id = 1;
118
+ string entity_id = 2;
119
+ optional string room_id = 3;
120
+ LogBody body = 4;
121
+ string type = 5;
122
+ google.protobuf.Timestamp created_at = 6;
123
+ }
124
+
125
+ // Agent run counts
126
+ message AgentRunCounts {
127
+ int32 actions = 1;
128
+ int32 model_calls = 2;
129
+ int32 errors = 3;
130
+ int32 evaluators = 4;
131
+ }
132
+
133
+ // Agent run summary
134
+ message AgentRunSummary {
135
+ string run_id = 1;
136
+ DbRunStatus status = 2;
137
+ optional int64 started_at = 3;
138
+ optional int64 ended_at = 4;
139
+ optional int64 duration_ms = 5;
140
+ optional string message_id = 6;
141
+ optional string room_id = 7;
142
+ optional string entity_id = 8;
143
+ google.protobuf.Struct metadata = 9;
144
+ optional AgentRunCounts counts = 10;
145
+ }
146
+
147
+ // Agent run summary result
148
+ message AgentRunSummaryResult {
149
+ repeated AgentRunSummary runs = 1;
150
+ int32 total = 2;
151
+ bool has_more = 3;
152
+ }
153
+
154
+ // Embedding search result
155
+ message EmbeddingSearchResult {
156
+ repeated float embedding = 1;
157
+ int32 levenshtein_score = 2;
158
+ }
159
+
160
+ // Memory retrieval options
161
+ message MemoryRetrievalOptions {
162
+ string room_id = 1;
163
+ optional int32 count = 2;
164
+ optional bool unique = 3;
165
+ optional int64 start = 4;
166
+ optional int64 end = 5;
167
+ optional string agent_id = 6;
168
+ }
169
+
170
+ // Memory search options
171
+ message MemorySearchOptions {
172
+ repeated float embedding = 1;
173
+ optional float match_threshold = 2;
174
+ optional int32 count = 3;
175
+ string room_id = 4;
176
+ optional string agent_id = 5;
177
+ optional bool unique = 6;
178
+ optional MemoryMetadata metadata = 7;
179
+ }
180
+
181
+ // Multi-room memory options
182
+ message MultiRoomMemoryOptions {
183
+ repeated string room_ids = 1;
184
+ optional int32 limit = 2;
185
+ optional string agent_id = 3;
186
+ }
187
+
188
+ // Vector dimensions constants
189
+ // Note: Proto doesn't have const, so this is just for documentation
190
+ // SMALL: 384, MEDIUM: 512, LARGE: 768, XL: 1024, XXL: 1536, XXXL: 3072
191
+ enum VectorDimension {
192
+ VECTOR_DIMENSION_UNSPECIFIED = 0;
193
+ VECTOR_DIMENSION_SMALL = 384;
194
+ VECTOR_DIMENSION_MEDIUM = 512;
195
+ VECTOR_DIMENSION_LARGE = 768;
196
+ VECTOR_DIMENSION_XL = 1024;
197
+ VECTOR_DIMENSION_XXL = 1536;
198
+ VECTOR_DIMENSION_XXXL = 3072;
199
+ }