@elizaos/python 2.0.0-alpha.10
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/LICENSE +26 -0
- package/README.md +239 -0
- package/elizaos/__init__.py +280 -0
- package/elizaos/action_docs.py +149 -0
- package/elizaos/advanced_capabilities/__init__.py +85 -0
- package/elizaos/advanced_capabilities/actions/__init__.py +54 -0
- package/elizaos/advanced_capabilities/actions/add_contact.py +139 -0
- package/elizaos/advanced_capabilities/actions/follow_room.py +151 -0
- package/elizaos/advanced_capabilities/actions/image_generation.py +148 -0
- package/elizaos/advanced_capabilities/actions/mute_room.py +164 -0
- package/elizaos/advanced_capabilities/actions/remove_contact.py +145 -0
- package/elizaos/advanced_capabilities/actions/roles.py +207 -0
- package/elizaos/advanced_capabilities/actions/schedule_follow_up.py +154 -0
- package/elizaos/advanced_capabilities/actions/search_contacts.py +145 -0
- package/elizaos/advanced_capabilities/actions/send_message.py +187 -0
- package/elizaos/advanced_capabilities/actions/settings.py +151 -0
- package/elizaos/advanced_capabilities/actions/unfollow_room.py +164 -0
- package/elizaos/advanced_capabilities/actions/unmute_room.py +164 -0
- package/elizaos/advanced_capabilities/actions/update_contact.py +164 -0
- package/elizaos/advanced_capabilities/actions/update_entity.py +161 -0
- package/elizaos/advanced_capabilities/evaluators/__init__.py +18 -0
- package/elizaos/advanced_capabilities/evaluators/reflection.py +134 -0
- package/elizaos/advanced_capabilities/evaluators/relationship_extraction.py +203 -0
- package/elizaos/advanced_capabilities/providers/__init__.py +36 -0
- package/elizaos/advanced_capabilities/providers/agent_settings.py +60 -0
- package/elizaos/advanced_capabilities/providers/contacts.py +77 -0
- package/elizaos/advanced_capabilities/providers/facts.py +82 -0
- package/elizaos/advanced_capabilities/providers/follow_ups.py +113 -0
- package/elizaos/advanced_capabilities/providers/knowledge.py +83 -0
- package/elizaos/advanced_capabilities/providers/relationships.py +112 -0
- package/elizaos/advanced_capabilities/providers/roles.py +97 -0
- package/elizaos/advanced_capabilities/providers/settings.py +51 -0
- package/elizaos/advanced_capabilities/services/__init__.py +18 -0
- package/elizaos/advanced_capabilities/services/follow_up.py +138 -0
- package/elizaos/advanced_capabilities/services/rolodex.py +244 -0
- package/elizaos/advanced_memory/__init__.py +3 -0
- package/elizaos/advanced_memory/evaluators.py +97 -0
- package/elizaos/advanced_memory/memory_service.py +556 -0
- package/elizaos/advanced_memory/plugin.py +30 -0
- package/elizaos/advanced_memory/prompts.py +12 -0
- package/elizaos/advanced_memory/providers.py +90 -0
- package/elizaos/advanced_memory/types.py +65 -0
- package/elizaos/advanced_planning/__init__.py +10 -0
- package/elizaos/advanced_planning/actions.py +145 -0
- package/elizaos/advanced_planning/message_classifier.py +127 -0
- package/elizaos/advanced_planning/planning_service.py +712 -0
- package/elizaos/advanced_planning/plugin.py +40 -0
- package/elizaos/advanced_planning/prompts.py +4 -0
- package/elizaos/basic_capabilities/__init__.py +66 -0
- package/elizaos/basic_capabilities/actions/__init__.py +24 -0
- package/elizaos/basic_capabilities/actions/choice.py +140 -0
- package/elizaos/basic_capabilities/actions/ignore.py +66 -0
- package/elizaos/basic_capabilities/actions/none.py +56 -0
- package/elizaos/basic_capabilities/actions/reply.py +120 -0
- package/elizaos/basic_capabilities/providers/__init__.py +54 -0
- package/elizaos/basic_capabilities/providers/action_state.py +113 -0
- package/elizaos/basic_capabilities/providers/actions.py +263 -0
- package/elizaos/basic_capabilities/providers/attachments.py +76 -0
- package/elizaos/basic_capabilities/providers/capabilities.py +62 -0
- package/elizaos/basic_capabilities/providers/character.py +113 -0
- package/elizaos/basic_capabilities/providers/choice.py +73 -0
- package/elizaos/basic_capabilities/providers/context_bench.py +44 -0
- package/elizaos/basic_capabilities/providers/current_time.py +58 -0
- package/elizaos/basic_capabilities/providers/entities.py +99 -0
- package/elizaos/basic_capabilities/providers/evaluators.py +54 -0
- package/elizaos/basic_capabilities/providers/providers_list.py +55 -0
- package/elizaos/basic_capabilities/providers/recent_messages.py +85 -0
- package/elizaos/basic_capabilities/providers/time.py +45 -0
- package/elizaos/basic_capabilities/providers/world.py +93 -0
- package/elizaos/basic_capabilities/services/__init__.py +18 -0
- package/elizaos/basic_capabilities/services/embedding.py +122 -0
- package/elizaos/basic_capabilities/services/task.py +178 -0
- package/elizaos/bootstrap/__init__.py +12 -0
- package/elizaos/bootstrap/actions/__init__.py +68 -0
- package/elizaos/bootstrap/actions/add_contact.py +149 -0
- package/elizaos/bootstrap/actions/choice.py +147 -0
- package/elizaos/bootstrap/actions/follow_room.py +151 -0
- package/elizaos/bootstrap/actions/ignore.py +80 -0
- package/elizaos/bootstrap/actions/image_generation.py +135 -0
- package/elizaos/bootstrap/actions/mute_room.py +151 -0
- package/elizaos/bootstrap/actions/none.py +71 -0
- package/elizaos/bootstrap/actions/remove_contact.py +159 -0
- package/elizaos/bootstrap/actions/reply.py +140 -0
- package/elizaos/bootstrap/actions/roles.py +193 -0
- package/elizaos/bootstrap/actions/schedule_follow_up.py +164 -0
- package/elizaos/bootstrap/actions/search_contacts.py +159 -0
- package/elizaos/bootstrap/actions/send_message.py +173 -0
- package/elizaos/bootstrap/actions/settings.py +165 -0
- package/elizaos/bootstrap/actions/unfollow_room.py +151 -0
- package/elizaos/bootstrap/actions/unmute_room.py +151 -0
- package/elizaos/bootstrap/actions/update_contact.py +178 -0
- package/elizaos/bootstrap/actions/update_entity.py +175 -0
- package/elizaos/bootstrap/autonomy/__init__.py +18 -0
- package/elizaos/bootstrap/autonomy/action.py +197 -0
- package/elizaos/bootstrap/autonomy/providers.py +165 -0
- package/elizaos/bootstrap/autonomy/routes.py +171 -0
- package/elizaos/bootstrap/autonomy/service.py +562 -0
- package/elizaos/bootstrap/autonomy/types.py +18 -0
- package/elizaos/bootstrap/evaluators/__init__.py +19 -0
- package/elizaos/bootstrap/evaluators/reflection.py +118 -0
- package/elizaos/bootstrap/evaluators/relationship_extraction.py +192 -0
- package/elizaos/bootstrap/plugin.py +140 -0
- package/elizaos/bootstrap/providers/__init__.py +80 -0
- package/elizaos/bootstrap/providers/action_state.py +71 -0
- package/elizaos/bootstrap/providers/actions.py +256 -0
- package/elizaos/bootstrap/providers/agent_settings.py +63 -0
- package/elizaos/bootstrap/providers/attachments.py +76 -0
- package/elizaos/bootstrap/providers/capabilities.py +66 -0
- package/elizaos/bootstrap/providers/character.py +128 -0
- package/elizaos/bootstrap/providers/choice.py +77 -0
- package/elizaos/bootstrap/providers/contacts.py +78 -0
- package/elizaos/bootstrap/providers/context_bench.py +49 -0
- package/elizaos/bootstrap/providers/current_time.py +56 -0
- package/elizaos/bootstrap/providers/entities.py +99 -0
- package/elizaos/bootstrap/providers/evaluators.py +58 -0
- package/elizaos/bootstrap/providers/facts.py +86 -0
- package/elizaos/bootstrap/providers/follow_ups.py +116 -0
- package/elizaos/bootstrap/providers/knowledge.py +73 -0
- package/elizaos/bootstrap/providers/providers_list.py +59 -0
- package/elizaos/bootstrap/providers/recent_messages.py +85 -0
- package/elizaos/bootstrap/providers/relationships.py +106 -0
- package/elizaos/bootstrap/providers/roles.py +95 -0
- package/elizaos/bootstrap/providers/settings.py +55 -0
- package/elizaos/bootstrap/providers/time.py +45 -0
- package/elizaos/bootstrap/providers/world.py +97 -0
- package/elizaos/bootstrap/services/__init__.py +26 -0
- package/elizaos/bootstrap/services/embedding.py +122 -0
- package/elizaos/bootstrap/services/follow_up.py +138 -0
- package/elizaos/bootstrap/services/rolodex.py +244 -0
- package/elizaos/bootstrap/services/task.py +585 -0
- package/elizaos/bootstrap/types.py +54 -0
- package/elizaos/bootstrap/utils/__init__.py +7 -0
- package/elizaos/bootstrap/utils/xml.py +69 -0
- package/elizaos/character.py +149 -0
- package/elizaos/logger.py +179 -0
- package/elizaos/media/__init__.py +45 -0
- package/elizaos/media/mime.py +315 -0
- package/elizaos/media/search.py +161 -0
- package/elizaos/media/tests/__init__.py +1 -0
- package/elizaos/media/tests/test_mime.py +117 -0
- package/elizaos/media/tests/test_search.py +156 -0
- package/elizaos/plugin.py +191 -0
- package/elizaos/prompts.py +1071 -0
- package/elizaos/py.typed +0 -0
- package/elizaos/runtime.py +2572 -0
- package/elizaos/services/__init__.py +49 -0
- package/elizaos/services/hook_service.py +511 -0
- package/elizaos/services/message_service.py +1248 -0
- package/elizaos/settings.py +182 -0
- package/elizaos/streaming_context.py +159 -0
- package/elizaos/trajectory_context.py +18 -0
- package/elizaos/types/__init__.py +512 -0
- package/elizaos/types/agent.py +31 -0
- package/elizaos/types/components.py +208 -0
- package/elizaos/types/database.py +64 -0
- package/elizaos/types/environment.py +46 -0
- package/elizaos/types/events.py +47 -0
- package/elizaos/types/memory.py +45 -0
- package/elizaos/types/model.py +393 -0
- package/elizaos/types/plugin.py +188 -0
- package/elizaos/types/primitives.py +100 -0
- package/elizaos/types/runtime.py +460 -0
- package/elizaos/types/service.py +113 -0
- package/elizaos/types/service_interfaces.py +244 -0
- package/elizaos/types/state.py +188 -0
- package/elizaos/types/task.py +29 -0
- package/elizaos/utils/__init__.py +108 -0
- package/elizaos/utils/spec_examples.py +48 -0
- package/elizaos/utils/streaming.py +426 -0
- package/elizaos_atropos_shared/__init__.py +1 -0
- package/elizaos_atropos_shared/canonical_eliza.py +282 -0
- package/package.json +19 -0
- package/pyproject.toml +143 -0
- package/requirements-dev.in +11 -0
- package/requirements-dev.lock +134 -0
- package/requirements.in +9 -0
- package/requirements.lock +64 -0
- package/tests/__init__.py +0 -0
- package/tests/test_action_parameters.py +154 -0
- package/tests/test_actions_provider_examples.py +39 -0
- package/tests/test_advanced_memory_behavior.py +96 -0
- package/tests/test_advanced_memory_flag.py +30 -0
- package/tests/test_advanced_planning_behavior.py +225 -0
- package/tests/test_advanced_planning_flag.py +26 -0
- package/tests/test_autonomy.py +445 -0
- package/tests/test_bootstrap_initialize.py +37 -0
- package/tests/test_character.py +163 -0
- package/tests/test_character_provider.py +231 -0
- package/tests/test_dynamic_prompt_exec.py +561 -0
- package/tests/test_logger_redaction.py +43 -0
- package/tests/test_plugin.py +117 -0
- package/tests/test_runtime.py +422 -0
- package/tests/test_salt_production_enforcement.py +22 -0
- package/tests/test_settings_crypto.py +118 -0
- package/tests/test_streaming.py +295 -0
- package/tests/test_types.py +221 -0
- package/tests/test_uuid_parity.py +46 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Awaitable, Callable
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
from enum import Enum
|
|
6
|
+
from typing import TYPE_CHECKING, Literal, TypeAlias
|
|
7
|
+
|
|
8
|
+
from elizaos.types.generated.eliza.v1 import components_pb2
|
|
9
|
+
from elizaos.types.primitives import Content
|
|
10
|
+
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
from elizaos.types.memory import Memory
|
|
13
|
+
from elizaos.types.runtime import IAgentRuntime
|
|
14
|
+
from elizaos.types.state import State
|
|
15
|
+
|
|
16
|
+
JsonPrimitive: TypeAlias = str | int | float | bool | None
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# ---------------------------------------------------------------------------
|
|
20
|
+
# Evaluator phase — when in the message pipeline the evaluator runs
|
|
21
|
+
# ---------------------------------------------------------------------------
|
|
22
|
+
|
|
23
|
+
EvaluatorPhase = Literal["pre", "post"]
|
|
24
|
+
"""When in the message pipeline an evaluator runs.
|
|
25
|
+
|
|
26
|
+
- ``"pre"`` — **Before** the incoming message is saved to memory and before
|
|
27
|
+
action processing. Pre-evaluators act as middleware: they can inspect,
|
|
28
|
+
rewrite, or **block** a message so it never reaches the agent.
|
|
29
|
+
|
|
30
|
+
- ``"post"`` — **After** the agent has responded and actions have executed.
|
|
31
|
+
This is the original (default) evaluator behaviour.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@dataclass
|
|
36
|
+
class PreEvaluatorResult:
|
|
37
|
+
"""Result returned by a ``phase="pre"`` evaluator's handler.
|
|
38
|
+
|
|
39
|
+
If *blocked* is ``True`` the message pipeline will skip memory storage,
|
|
40
|
+
response generation, and action execution for this message.
|
|
41
|
+
|
|
42
|
+
If *rewritten_text* is provided the message text is replaced before
|
|
43
|
+
further processing (useful for sanitisation / redaction).
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
blocked: bool = False
|
|
47
|
+
rewritten_text: str | None = None
|
|
48
|
+
reason: str | None = None
|
|
49
|
+
|
|
50
|
+
# Proto-backed data types
|
|
51
|
+
ActionExample = components_pb2.ActionExample
|
|
52
|
+
ActionParameterSchema = components_pb2.ActionParameterSchema
|
|
53
|
+
ActionParameter = components_pb2.ActionParameter
|
|
54
|
+
ActionParameters = components_pb2.ActionParameters
|
|
55
|
+
ActionResult = components_pb2.ActionResult
|
|
56
|
+
ActionContext = components_pb2.ActionContext
|
|
57
|
+
HandlerOptions = components_pb2.HandlerOptions
|
|
58
|
+
ProviderResult = components_pb2.ProviderResult
|
|
59
|
+
EvaluationExample = components_pb2.EvaluationExample
|
|
60
|
+
|
|
61
|
+
# Runtime handler signatures (not in proto)
|
|
62
|
+
HandlerCallback = Callable[[Content], Awaitable[list["Memory"]]]
|
|
63
|
+
StreamChunkCallback = Callable[[str, str | None], Awaitable[None]]
|
|
64
|
+
|
|
65
|
+
Handler = Callable[
|
|
66
|
+
[
|
|
67
|
+
"IAgentRuntime",
|
|
68
|
+
"Memory",
|
|
69
|
+
"State | None",
|
|
70
|
+
HandlerOptions | None,
|
|
71
|
+
HandlerCallback | None,
|
|
72
|
+
"list[Memory] | None",
|
|
73
|
+
],
|
|
74
|
+
Awaitable[ActionResult | None],
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
Validator = Callable[["IAgentRuntime", "Memory", "State | None"], Awaitable[bool]]
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class ActionDefinition: # runtime interface
|
|
81
|
+
"""Definition for an action that can be executed by the agent."""
|
|
82
|
+
|
|
83
|
+
name: str
|
|
84
|
+
description: str
|
|
85
|
+
handler: Handler
|
|
86
|
+
validate: Validator
|
|
87
|
+
similes: list[str] | None
|
|
88
|
+
examples: list[list[ActionExample]] | None
|
|
89
|
+
priority: int | None
|
|
90
|
+
tags: list[str] | None
|
|
91
|
+
parameters: list[ActionParameter] | None
|
|
92
|
+
|
|
93
|
+
def __init__(
|
|
94
|
+
self,
|
|
95
|
+
name: str,
|
|
96
|
+
description: str,
|
|
97
|
+
handler: Handler,
|
|
98
|
+
validate: Validator,
|
|
99
|
+
similes: list[str] | None = None,
|
|
100
|
+
examples: list[list[ActionExample]] | None = None,
|
|
101
|
+
priority: int | None = None,
|
|
102
|
+
tags: list[str] | None = None,
|
|
103
|
+
parameters: list[ActionParameter] | None = None,
|
|
104
|
+
) -> None:
|
|
105
|
+
self.name = name
|
|
106
|
+
self.description = description
|
|
107
|
+
self.handler = handler
|
|
108
|
+
self.validate = validate
|
|
109
|
+
self.similes = similes
|
|
110
|
+
self.examples = examples
|
|
111
|
+
self.priority = priority
|
|
112
|
+
self.tags = tags
|
|
113
|
+
self.parameters = parameters
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class EvaluatorDefinition: # runtime interface
|
|
117
|
+
"""Definition for an evaluator that processes agent messages.
|
|
118
|
+
|
|
119
|
+
Evaluators can run at two points in the pipeline controlled by *phase*:
|
|
120
|
+
|
|
121
|
+
- ``"pre"`` — before memory storage (middleware / security gate).
|
|
122
|
+
Pre-evaluators may return a :class:`PreEvaluatorResult` from their
|
|
123
|
+
handler to block or rewrite the incoming message.
|
|
124
|
+
- ``"post"`` — after actions (default, backwards-compatible).
|
|
125
|
+
"""
|
|
126
|
+
|
|
127
|
+
always_run: bool | None
|
|
128
|
+
description: str
|
|
129
|
+
similes: list[str] | None
|
|
130
|
+
examples: list[EvaluationExample]
|
|
131
|
+
handler: Handler
|
|
132
|
+
name: str
|
|
133
|
+
validate: Validator
|
|
134
|
+
phase: EvaluatorPhase
|
|
135
|
+
|
|
136
|
+
def __init__(
|
|
137
|
+
self,
|
|
138
|
+
name: str,
|
|
139
|
+
description: str,
|
|
140
|
+
handler: Handler,
|
|
141
|
+
validate: Validator,
|
|
142
|
+
examples: list[EvaluationExample] | None = None,
|
|
143
|
+
similes: list[str] | None = None,
|
|
144
|
+
always_run: bool | None = None,
|
|
145
|
+
phase: EvaluatorPhase = "post",
|
|
146
|
+
) -> None:
|
|
147
|
+
self.name = name
|
|
148
|
+
self.description = description
|
|
149
|
+
self.handler = handler
|
|
150
|
+
self.validate = validate
|
|
151
|
+
self.examples = examples or []
|
|
152
|
+
self.similes = similes
|
|
153
|
+
self.always_run = always_run
|
|
154
|
+
self.phase = phase
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
class ProviderDefinition: # runtime interface
|
|
158
|
+
"""Definition for a context provider that supplies information to the agent."""
|
|
159
|
+
|
|
160
|
+
name: str
|
|
161
|
+
description: str | None
|
|
162
|
+
dynamic: bool | None
|
|
163
|
+
position: int | None
|
|
164
|
+
private: bool | None
|
|
165
|
+
get: Callable[[IAgentRuntime, Memory, State], Awaitable[ProviderResult]]
|
|
166
|
+
|
|
167
|
+
def __init__(
|
|
168
|
+
self,
|
|
169
|
+
name: str,
|
|
170
|
+
get: Callable[[IAgentRuntime, Memory, State], Awaitable[ProviderResult]],
|
|
171
|
+
description: str | None = None,
|
|
172
|
+
dynamic: bool | None = None,
|
|
173
|
+
position: int | None = None,
|
|
174
|
+
private: bool | None = None,
|
|
175
|
+
) -> None:
|
|
176
|
+
self.name = name
|
|
177
|
+
self.get = get
|
|
178
|
+
self.description = description
|
|
179
|
+
self.dynamic = dynamic
|
|
180
|
+
self.position = position
|
|
181
|
+
self.private = private
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
Action = ActionDefinition
|
|
185
|
+
Evaluator = EvaluatorDefinition
|
|
186
|
+
Provider = ProviderDefinition
|
|
187
|
+
|
|
188
|
+
__all__ = [
|
|
189
|
+
"Action",
|
|
190
|
+
"Evaluator",
|
|
191
|
+
"EvaluatorPhase",
|
|
192
|
+
"PreEvaluatorResult",
|
|
193
|
+
"Provider",
|
|
194
|
+
"ActionExample",
|
|
195
|
+
"ActionParameterSchema",
|
|
196
|
+
"ActionParameter",
|
|
197
|
+
"ActionParameters",
|
|
198
|
+
"ActionResult",
|
|
199
|
+
"ActionContext",
|
|
200
|
+
"HandlerOptions",
|
|
201
|
+
"ProviderResult",
|
|
202
|
+
"EvaluationExample",
|
|
203
|
+
"Handler",
|
|
204
|
+
"Validator",
|
|
205
|
+
"HandlerCallback",
|
|
206
|
+
"StreamChunkCallback",
|
|
207
|
+
"JsonPrimitive",
|
|
208
|
+
]
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, Protocol, runtime_checkable
|
|
4
|
+
|
|
5
|
+
from elizaos.types.generated.eliza.v1 import database_pb2
|
|
6
|
+
|
|
7
|
+
# Proto-backed types
|
|
8
|
+
BaseLogBody = database_pb2.BaseLogBody
|
|
9
|
+
ActionLogBody = database_pb2.ActionLogBody
|
|
10
|
+
EvaluatorLogBody = database_pb2.EvaluatorLogBody
|
|
11
|
+
ModelLogBody = database_pb2.ModelLogBody
|
|
12
|
+
EmbeddingLogBody = database_pb2.EmbeddingLogBody
|
|
13
|
+
LogBody = database_pb2.LogBody
|
|
14
|
+
Log = database_pb2.Log
|
|
15
|
+
RunStatus = database_pb2.DbRunStatus # Alias for compatibility
|
|
16
|
+
AgentRunCounts = database_pb2.AgentRunCounts
|
|
17
|
+
AgentRunSummary = database_pb2.AgentRunSummary
|
|
18
|
+
AgentRunSummaryResult = database_pb2.AgentRunSummaryResult
|
|
19
|
+
EmbeddingSearchResult = database_pb2.EmbeddingSearchResult
|
|
20
|
+
MemoryRetrievalOptions = database_pb2.MemoryRetrievalOptions
|
|
21
|
+
MemorySearchOptions = database_pb2.MemorySearchOptions
|
|
22
|
+
MultiRoomMemoryOptions = database_pb2.MultiRoomMemoryOptions
|
|
23
|
+
|
|
24
|
+
# Types not in protobuf - provide aliases or simple types
|
|
25
|
+
MemoryOptions = MemoryRetrievalOptions # Alias for compatibility
|
|
26
|
+
SearchOptions = MemorySearchOptions # Alias for compatibility
|
|
27
|
+
DbConnection = Any # Runtime type
|
|
28
|
+
|
|
29
|
+
# Vector dimension constant (for compatibility with prior adapter interfaces)
|
|
30
|
+
VECTOR_DIMS = 1536
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@runtime_checkable
|
|
34
|
+
class IDatabaseAdapter(Protocol):
|
|
35
|
+
"""Runtime adapter interface (implementation-specific)."""
|
|
36
|
+
|
|
37
|
+
@property
|
|
38
|
+
def db(self) -> Any: ...
|
|
39
|
+
|
|
40
|
+
def __getattr__(self, name: str) -> Any: ...
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
__all__ = [
|
|
44
|
+
"BaseLogBody",
|
|
45
|
+
"ActionLogBody",
|
|
46
|
+
"EvaluatorLogBody",
|
|
47
|
+
"ModelLogBody",
|
|
48
|
+
"EmbeddingLogBody",
|
|
49
|
+
"LogBody",
|
|
50
|
+
"Log",
|
|
51
|
+
"RunStatus",
|
|
52
|
+
"AgentRunCounts",
|
|
53
|
+
"AgentRunSummary",
|
|
54
|
+
"AgentRunSummaryResult",
|
|
55
|
+
"EmbeddingSearchResult",
|
|
56
|
+
"MemoryRetrievalOptions",
|
|
57
|
+
"MemorySearchOptions",
|
|
58
|
+
"MultiRoomMemoryOptions",
|
|
59
|
+
"MemoryOptions",
|
|
60
|
+
"SearchOptions",
|
|
61
|
+
"DbConnection",
|
|
62
|
+
"VECTOR_DIMS",
|
|
63
|
+
"IDatabaseAdapter",
|
|
64
|
+
]
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from elizaos.types.generated.eliza.v1 import environment_pb2
|
|
4
|
+
|
|
5
|
+
Component = environment_pb2.Component
|
|
6
|
+
Entity = environment_pb2.Entity
|
|
7
|
+
WorldOwnership = environment_pb2.WorldOwnership
|
|
8
|
+
WorldMetadata = environment_pb2.WorldMetadata
|
|
9
|
+
World = environment_pb2.World
|
|
10
|
+
RoomMetadata = environment_pb2.RoomMetadata
|
|
11
|
+
Room = environment_pb2.Room
|
|
12
|
+
Participant = environment_pb2.Participant
|
|
13
|
+
Relationship = environment_pb2.Relationship
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class _ChannelValue(str):
|
|
17
|
+
"""String that also has a .value property for enum compatibility."""
|
|
18
|
+
|
|
19
|
+
@property
|
|
20
|
+
def value(self) -> str: # noqa: D401
|
|
21
|
+
return str(self)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ChannelType:
|
|
25
|
+
"""Channel type constants (mirrors the TypeScript ChannelType enum)."""
|
|
26
|
+
|
|
27
|
+
DM = _ChannelValue("DM")
|
|
28
|
+
GROUP = _ChannelValue("GROUP")
|
|
29
|
+
FEED = _ChannelValue("FEED")
|
|
30
|
+
WORLD = _ChannelValue("WORLD")
|
|
31
|
+
API = _ChannelValue("API")
|
|
32
|
+
SELF = _ChannelValue("SELF")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
__all__ = [
|
|
36
|
+
"ChannelType",
|
|
37
|
+
"Component",
|
|
38
|
+
"Entity",
|
|
39
|
+
"WorldOwnership",
|
|
40
|
+
"WorldMetadata",
|
|
41
|
+
"World",
|
|
42
|
+
"RoomMetadata",
|
|
43
|
+
"Room",
|
|
44
|
+
"Participant",
|
|
45
|
+
"Relationship",
|
|
46
|
+
]
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Awaitable, Callable
|
|
4
|
+
from typing import TYPE_CHECKING, TypeAlias
|
|
5
|
+
|
|
6
|
+
from elizaos.types.generated.eliza.v1 import events_pb2
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from elizaos.types.runtime import IAgentRuntime
|
|
10
|
+
|
|
11
|
+
EventType = events_pb2.EventType
|
|
12
|
+
PlatformPrefix = events_pb2.PlatformPrefix
|
|
13
|
+
EventPayload = events_pb2.EventPayload
|
|
14
|
+
WorldPayload = events_pb2.WorldPayload
|
|
15
|
+
EntityPayload = events_pb2.EntityPayload
|
|
16
|
+
MessagePayload = events_pb2.MessagePayload
|
|
17
|
+
ChannelClearedPayload = events_pb2.ChannelClearedPayload
|
|
18
|
+
InvokePayload = events_pb2.InvokePayload
|
|
19
|
+
RunEventPayload = events_pb2.RunEventPayload
|
|
20
|
+
ActionEventPayload = events_pb2.ActionEventPayload
|
|
21
|
+
EvaluatorEventPayload = events_pb2.EvaluatorEventPayload
|
|
22
|
+
ModelEventPayload = events_pb2.ModelEventPayload
|
|
23
|
+
EmbeddingGenerationPayload = events_pb2.EmbeddingGenerationPayload
|
|
24
|
+
ControlMessagePayload = events_pb2.ControlMessagePayload
|
|
25
|
+
|
|
26
|
+
EventPayloadMap: TypeAlias = dict[EventType, type]
|
|
27
|
+
|
|
28
|
+
EventHandler = Callable[[EventPayload, "IAgentRuntime"], Awaitable[None]]
|
|
29
|
+
|
|
30
|
+
__all__ = [
|
|
31
|
+
"EventType",
|
|
32
|
+
"PlatformPrefix",
|
|
33
|
+
"EventPayload",
|
|
34
|
+
"WorldPayload",
|
|
35
|
+
"EntityPayload",
|
|
36
|
+
"MessagePayload",
|
|
37
|
+
"ChannelClearedPayload",
|
|
38
|
+
"InvokePayload",
|
|
39
|
+
"RunEventPayload",
|
|
40
|
+
"ActionEventPayload",
|
|
41
|
+
"EvaluatorEventPayload",
|
|
42
|
+
"ModelEventPayload",
|
|
43
|
+
"EmbeddingGenerationPayload",
|
|
44
|
+
"ControlMessagePayload",
|
|
45
|
+
"EventPayloadMap",
|
|
46
|
+
"EventHandler",
|
|
47
|
+
]
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from elizaos.types.generated.eliza.v1 import memory_pb2
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class _MemoryTypeValue(str):
|
|
7
|
+
"""String that also has a .value property for enum compatibility."""
|
|
8
|
+
|
|
9
|
+
@property
|
|
10
|
+
def value(self) -> str: # noqa: D401
|
|
11
|
+
return str(self)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class MemoryType:
|
|
15
|
+
"""Memory type constants (mirrors the TypeScript MemoryType enum)."""
|
|
16
|
+
|
|
17
|
+
MESSAGE = _MemoryTypeValue("MESSAGE")
|
|
18
|
+
DOCUMENT = _MemoryTypeValue("DOCUMENT")
|
|
19
|
+
FRAGMENT = _MemoryTypeValue("FRAGMENT")
|
|
20
|
+
DESCRIPTION = _MemoryTypeValue("DESCRIPTION")
|
|
21
|
+
CUSTOM = _MemoryTypeValue("CUSTOM")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
BaseMetadata = memory_pb2.BaseMetadata
|
|
25
|
+
DocumentMetadata = memory_pb2.DocumentMetadata
|
|
26
|
+
FragmentMetadata = memory_pb2.FragmentMetadata
|
|
27
|
+
MessageMetadata = memory_pb2.MessageMetadata
|
|
28
|
+
DescriptionMetadata = memory_pb2.DescriptionMetadata
|
|
29
|
+
CustomMetadata = memory_pb2.CustomMetadata
|
|
30
|
+
MemoryMetadata = memory_pb2.MemoryMetadata
|
|
31
|
+
Memory = memory_pb2.Memory
|
|
32
|
+
MessageMemory = memory_pb2.MessageMemory
|
|
33
|
+
|
|
34
|
+
__all__ = [
|
|
35
|
+
"MemoryType",
|
|
36
|
+
"BaseMetadata",
|
|
37
|
+
"DocumentMetadata",
|
|
38
|
+
"FragmentMetadata",
|
|
39
|
+
"MessageMetadata",
|
|
40
|
+
"DescriptionMetadata",
|
|
41
|
+
"CustomMetadata",
|
|
42
|
+
"MemoryMetadata",
|
|
43
|
+
"Memory",
|
|
44
|
+
"MessageMemory",
|
|
45
|
+
]
|