@elizaos/python 2.0.0-alpha.10 → 2.0.0-alpha.26
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/elizaos/__init__.py +0 -1
- package/elizaos/advanced_capabilities/__init__.py +6 -41
- package/elizaos/advanced_capabilities/actions/__init__.py +1 -21
- package/elizaos/advanced_capabilities/actions/add_contact.py +21 -11
- package/elizaos/advanced_capabilities/actions/follow_room.py +28 -28
- package/elizaos/advanced_capabilities/actions/image_generation.py +13 -26
- package/elizaos/advanced_capabilities/actions/mute_room.py +13 -26
- package/elizaos/advanced_capabilities/actions/remove_contact.py +16 -2
- package/elizaos/advanced_capabilities/actions/roles.py +13 -27
- package/elizaos/advanced_capabilities/actions/schedule_follow_up.py +70 -15
- package/elizaos/advanced_capabilities/actions/search_contacts.py +17 -3
- package/elizaos/advanced_capabilities/actions/send_message.py +183 -50
- package/elizaos/advanced_capabilities/actions/settings.py +16 -2
- package/elizaos/advanced_capabilities/actions/unfollow_room.py +13 -26
- package/elizaos/advanced_capabilities/actions/unmute_room.py +13 -26
- package/elizaos/advanced_capabilities/actions/update_contact.py +16 -2
- package/elizaos/advanced_capabilities/actions/update_entity.py +16 -2
- package/elizaos/advanced_capabilities/evaluators/__init__.py +2 -9
- package/elizaos/advanced_capabilities/evaluators/reflection.py +3 -132
- package/elizaos/advanced_capabilities/evaluators/relationship_extraction.py +5 -201
- package/elizaos/advanced_capabilities/providers/__init__.py +1 -12
- package/elizaos/advanced_capabilities/providers/knowledge.py +24 -3
- package/elizaos/advanced_capabilities/services/__init__.py +2 -9
- package/elizaos/advanced_memory/actions/reset_session.py +11 -0
- package/elizaos/advanced_memory/evaluators/reflection.py +134 -0
- package/elizaos/advanced_memory/evaluators/relationship_extraction.py +203 -0
- package/elizaos/advanced_memory/memory_service.py +15 -17
- package/elizaos/advanced_memory/test_advanced_memory.py +357 -0
- package/elizaos/advanced_planning/actions/schedule_follow_up.py +222 -0
- package/elizaos/advanced_planning/planning_service.py +26 -14
- package/elizaos/basic_capabilities/__init__.py +0 -2
- package/elizaos/basic_capabilities/providers/__init__.py +0 -3
- package/elizaos/basic_capabilities/providers/actions.py +118 -29
- package/elizaos/basic_capabilities/providers/agent_settings.py +64 -0
- package/elizaos/basic_capabilities/providers/character.py +19 -21
- package/elizaos/basic_capabilities/providers/contacts.py +79 -0
- package/elizaos/basic_capabilities/providers/current_time.py +7 -4
- package/elizaos/basic_capabilities/providers/facts.py +87 -0
- package/elizaos/basic_capabilities/providers/follow_ups.py +117 -0
- package/elizaos/basic_capabilities/providers/knowledge.py +97 -0
- package/elizaos/basic_capabilities/providers/relationships.py +107 -0
- package/elizaos/basic_capabilities/providers/roles.py +96 -0
- package/elizaos/basic_capabilities/providers/settings.py +56 -0
- package/elizaos/basic_capabilities/providers/time.py +7 -4
- package/elizaos/bootstrap/__init__.py +21 -2
- package/elizaos/bootstrap/actions/schedule_follow_up.py +65 -7
- package/elizaos/bootstrap/actions/send_message.py +162 -15
- package/elizaos/bootstrap/autonomy/__init__.py +5 -1
- package/elizaos/bootstrap/autonomy/action.py +161 -0
- package/elizaos/bootstrap/autonomy/evaluators.py +217 -0
- package/elizaos/bootstrap/autonomy/service.py +238 -28
- package/elizaos/bootstrap/plugin.py +7 -0
- package/elizaos/bootstrap/providers/actions.py +118 -27
- package/elizaos/bootstrap/providers/agent_settings.py +1 -0
- package/elizaos/bootstrap/providers/attachments.py +1 -0
- package/elizaos/bootstrap/providers/capabilities.py +1 -0
- package/elizaos/bootstrap/providers/character.py +1 -0
- package/elizaos/bootstrap/providers/choice.py +1 -0
- package/elizaos/bootstrap/providers/contacts.py +1 -0
- package/elizaos/bootstrap/providers/current_time.py +8 -2
- package/elizaos/bootstrap/providers/entities.py +1 -0
- package/elizaos/bootstrap/providers/evaluators.py +1 -0
- package/elizaos/bootstrap/providers/facts.py +1 -0
- package/elizaos/bootstrap/providers/follow_ups.py +1 -0
- package/elizaos/bootstrap/providers/knowledge.py +27 -3
- package/elizaos/bootstrap/providers/providers_list.py +1 -0
- package/elizaos/bootstrap/providers/relationships.py +1 -0
- package/elizaos/bootstrap/providers/roles.py +1 -0
- package/elizaos/bootstrap/providers/settings.py +1 -0
- package/elizaos/bootstrap/providers/time.py +8 -4
- package/elizaos/bootstrap/providers/world.py +1 -0
- package/elizaos/bootstrap/services/embedding.py +156 -1
- package/elizaos/deterministic.py +193 -0
- package/elizaos/generated/__init__.py +1 -0
- package/elizaos/generated/action_docs.py +3181 -0
- package/elizaos/generated/spec_helpers.py +175 -0
- package/elizaos/media/mime.py +2 -2
- package/elizaos/media/search.py +23 -23
- package/elizaos/runtime.py +215 -57
- package/elizaos/services/message_service.py +175 -29
- package/elizaos/types/components.py +2 -2
- package/elizaos/types/generated/__init__.py +12 -0
- package/elizaos/types/generated/eliza/v1/agent_pb2.py +63 -0
- package/elizaos/types/generated/eliza/v1/agent_pb2.pyi +159 -0
- package/elizaos/types/generated/eliza/v1/components_pb2.py +65 -0
- package/elizaos/types/generated/eliza/v1/components_pb2.pyi +160 -0
- package/elizaos/types/generated/eliza/v1/database_pb2.py +78 -0
- package/elizaos/types/generated/eliza/v1/database_pb2.pyi +305 -0
- package/elizaos/types/generated/eliza/v1/environment_pb2.py +58 -0
- package/elizaos/types/generated/eliza/v1/environment_pb2.pyi +135 -0
- package/elizaos/types/generated/eliza/v1/events_pb2.py +82 -0
- package/elizaos/types/generated/eliza/v1/events_pb2.pyi +322 -0
- package/elizaos/types/generated/eliza/v1/ipc_pb2.py +113 -0
- package/elizaos/types/generated/eliza/v1/ipc_pb2.pyi +367 -0
- package/elizaos/types/generated/eliza/v1/knowledge_pb2.py +41 -0
- package/elizaos/types/generated/eliza/v1/knowledge_pb2.pyi +26 -0
- package/elizaos/types/generated/eliza/v1/memory_pb2.py +55 -0
- package/elizaos/types/generated/eliza/v1/memory_pb2.pyi +111 -0
- package/elizaos/types/generated/eliza/v1/message_service_pb2.py +48 -0
- package/elizaos/types/generated/eliza/v1/message_service_pb2.pyi +69 -0
- package/elizaos/types/generated/eliza/v1/messaging_pb2.py +51 -0
- package/elizaos/types/generated/eliza/v1/messaging_pb2.pyi +97 -0
- package/elizaos/types/generated/eliza/v1/model_pb2.py +84 -0
- package/elizaos/types/generated/eliza/v1/model_pb2.pyi +280 -0
- package/elizaos/types/generated/eliza/v1/payment_pb2.py +44 -0
- package/elizaos/types/generated/eliza/v1/payment_pb2.pyi +70 -0
- package/elizaos/types/generated/eliza/v1/plugin_pb2.py +68 -0
- package/elizaos/types/generated/eliza/v1/plugin_pb2.pyi +145 -0
- package/elizaos/types/generated/eliza/v1/primitives_pb2.py +48 -0
- package/elizaos/types/generated/eliza/v1/primitives_pb2.pyi +92 -0
- package/elizaos/types/generated/eliza/v1/prompts_pb2.py +52 -0
- package/elizaos/types/generated/eliza/v1/prompts_pb2.pyi +74 -0
- package/elizaos/types/generated/eliza/v1/service_interfaces_pb2.py +211 -0
- package/elizaos/types/generated/eliza/v1/service_interfaces_pb2.pyi +1296 -0
- package/elizaos/types/generated/eliza/v1/service_pb2.py +42 -0
- package/elizaos/types/generated/eliza/v1/service_pb2.pyi +69 -0
- package/elizaos/types/generated/eliza/v1/settings_pb2.py +58 -0
- package/elizaos/types/generated/eliza/v1/settings_pb2.pyi +85 -0
- package/elizaos/types/generated/eliza/v1/state_pb2.py +60 -0
- package/elizaos/types/generated/eliza/v1/state_pb2.pyi +114 -0
- package/elizaos/types/generated/eliza/v1/task_pb2.py +42 -0
- package/elizaos/types/generated/eliza/v1/task_pb2.pyi +58 -0
- package/elizaos/types/generated/eliza/v1/tee_pb2.py +52 -0
- package/elizaos/types/generated/eliza/v1/tee_pb2.pyi +90 -0
- package/elizaos/types/generated/eliza/v1/testing_pb2.py +39 -0
- package/elizaos/types/generated/eliza/v1/testing_pb2.pyi +23 -0
- package/elizaos/types/model.py +30 -0
- package/elizaos/types/runtime.py +6 -2
- package/elizaos/utils/validation.py +76 -0
- package/package.json +3 -2
- package/tests/test_action_parameters.py +2 -3
- package/tests/test_actions_provider_examples.py +58 -1
- package/tests/test_advanced_memory_behavior.py +0 -2
- package/tests/test_advanced_memory_flag.py +0 -2
- package/tests/test_advanced_planning_behavior.py +11 -5
- package/tests/test_async_embedding.py +124 -0
- package/tests/test_autonomy.py +24 -3
- package/tests/test_runtime.py +8 -17
- package/tests/test_schedule_follow_up_action.py +260 -0
- package/tests/test_send_message_action_targets.py +114 -0
- package/tests/test_settings_crypto.py +0 -2
- package/tests/test_validation.py +141 -0
- package/tests/verify_memory_architecture.py +192 -0
- package/uv.lock +1565 -0
- package/elizaos/basic_capabilities/providers/capabilities.py +0 -62
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Helper functions to lookup action/provider/evaluator specs by name.
|
|
3
|
+
These allow language-specific implementations to import their text content
|
|
4
|
+
(description, similes, examples) from the centralized specs.
|
|
5
|
+
|
|
6
|
+
DO NOT EDIT the spec data - update packages/prompts/specs/** and regenerate.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from .action_docs import (
|
|
10
|
+
ActionDoc,
|
|
11
|
+
EvaluatorDoc,
|
|
12
|
+
ProviderDoc,
|
|
13
|
+
all_action_docs,
|
|
14
|
+
all_evaluator_docs,
|
|
15
|
+
all_provider_docs,
|
|
16
|
+
core_action_docs,
|
|
17
|
+
core_evaluator_docs,
|
|
18
|
+
core_provider_docs,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _get_items(doc: object, key: str) -> list[dict[str, object]]:
|
|
23
|
+
if not isinstance(doc, dict):
|
|
24
|
+
return []
|
|
25
|
+
raw = doc.get(key)
|
|
26
|
+
if not isinstance(raw, list):
|
|
27
|
+
return []
|
|
28
|
+
return [item for item in raw if isinstance(item, dict)]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# Build lookup dicts for O(1) access
|
|
32
|
+
_core_action_map: dict[str, ActionDoc] = {}
|
|
33
|
+
for action in _get_items(core_action_docs, "actions"):
|
|
34
|
+
name = action.get("name")
|
|
35
|
+
if isinstance(name, str):
|
|
36
|
+
_core_action_map[name] = action # type: ignore[assignment]
|
|
37
|
+
|
|
38
|
+
_all_action_map: dict[str, ActionDoc] = {}
|
|
39
|
+
for action in _get_items(all_action_docs, "actions"):
|
|
40
|
+
name = action.get("name")
|
|
41
|
+
if isinstance(name, str):
|
|
42
|
+
_all_action_map[name] = action # type: ignore[assignment]
|
|
43
|
+
|
|
44
|
+
_core_provider_map: dict[str, ProviderDoc] = {}
|
|
45
|
+
for provider in _get_items(core_provider_docs, "providers"):
|
|
46
|
+
name = provider.get("name")
|
|
47
|
+
if isinstance(name, str):
|
|
48
|
+
_core_provider_map[name] = provider # type: ignore[assignment]
|
|
49
|
+
|
|
50
|
+
_all_provider_map: dict[str, ProviderDoc] = {}
|
|
51
|
+
for provider in _get_items(all_provider_docs, "providers"):
|
|
52
|
+
name = provider.get("name")
|
|
53
|
+
if isinstance(name, str):
|
|
54
|
+
_all_provider_map[name] = provider # type: ignore[assignment]
|
|
55
|
+
|
|
56
|
+
_core_evaluator_map: dict[str, EvaluatorDoc] = {}
|
|
57
|
+
for evaluator in _get_items(core_evaluator_docs, "evaluators"):
|
|
58
|
+
name = evaluator.get("name")
|
|
59
|
+
if isinstance(name, str):
|
|
60
|
+
_core_evaluator_map[name] = evaluator # type: ignore[assignment]
|
|
61
|
+
|
|
62
|
+
_all_evaluator_map: dict[str, EvaluatorDoc] = {}
|
|
63
|
+
for evaluator in _get_items(all_evaluator_docs, "evaluators"):
|
|
64
|
+
name = evaluator.get("name")
|
|
65
|
+
if isinstance(name, str):
|
|
66
|
+
_all_evaluator_map[name] = evaluator # type: ignore[assignment]
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def get_action_spec(name: str) -> ActionDoc | None:
|
|
70
|
+
"""
|
|
71
|
+
Get an action spec by name from the core specs.
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
name: The action name (e.g., "REPLY", "IGNORE")
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
The action spec or None if not found
|
|
78
|
+
"""
|
|
79
|
+
return _core_action_map.get(name) or _all_action_map.get(name)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def require_action_spec(name: str) -> ActionDoc:
|
|
83
|
+
"""
|
|
84
|
+
Get an action spec by name, raising if not found.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
name: The action name
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
The action spec
|
|
91
|
+
|
|
92
|
+
Raises:
|
|
93
|
+
ValueError: If the action is not found
|
|
94
|
+
"""
|
|
95
|
+
spec = get_action_spec(name)
|
|
96
|
+
if spec is None:
|
|
97
|
+
raise ValueError(f"Action spec not found: {name}")
|
|
98
|
+
return spec
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def get_provider_spec(name: str) -> ProviderDoc | None:
|
|
102
|
+
"""
|
|
103
|
+
Get a provider spec by name from the core specs.
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
name: The provider name (e.g., "CHARACTER", "TIME")
|
|
107
|
+
|
|
108
|
+
Returns:
|
|
109
|
+
The provider spec or None if not found
|
|
110
|
+
"""
|
|
111
|
+
return _core_provider_map.get(name) or _all_provider_map.get(name)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def require_provider_spec(name: str) -> ProviderDoc:
|
|
115
|
+
"""
|
|
116
|
+
Get a provider spec by name, raising if not found.
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
name: The provider name
|
|
120
|
+
|
|
121
|
+
Returns:
|
|
122
|
+
The provider spec
|
|
123
|
+
|
|
124
|
+
Raises:
|
|
125
|
+
ValueError: If the provider is not found
|
|
126
|
+
"""
|
|
127
|
+
spec = get_provider_spec(name)
|
|
128
|
+
if spec is None:
|
|
129
|
+
raise ValueError(f"Provider spec not found: {name}")
|
|
130
|
+
return spec
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def get_evaluator_spec(name: str) -> EvaluatorDoc | None:
|
|
134
|
+
"""
|
|
135
|
+
Get an evaluator spec by name from the core specs.
|
|
136
|
+
|
|
137
|
+
Args:
|
|
138
|
+
name: The evaluator name (e.g., "REFLECTION")
|
|
139
|
+
|
|
140
|
+
Returns:
|
|
141
|
+
The evaluator spec or None if not found
|
|
142
|
+
"""
|
|
143
|
+
return _core_evaluator_map.get(name) or _all_evaluator_map.get(name)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def require_evaluator_spec(name: str) -> EvaluatorDoc:
|
|
147
|
+
"""
|
|
148
|
+
Get an evaluator spec by name, raising if not found.
|
|
149
|
+
|
|
150
|
+
Args:
|
|
151
|
+
name: The evaluator name
|
|
152
|
+
|
|
153
|
+
Returns:
|
|
154
|
+
The evaluator spec
|
|
155
|
+
|
|
156
|
+
Raises:
|
|
157
|
+
ValueError: If the evaluator is not found
|
|
158
|
+
"""
|
|
159
|
+
spec = get_evaluator_spec(name)
|
|
160
|
+
if spec is None:
|
|
161
|
+
raise ValueError(f"Evaluator spec not found: {name}")
|
|
162
|
+
return spec
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
__all__ = [
|
|
166
|
+
"ActionDoc",
|
|
167
|
+
"ProviderDoc",
|
|
168
|
+
"EvaluatorDoc",
|
|
169
|
+
"get_action_spec",
|
|
170
|
+
"require_action_spec",
|
|
171
|
+
"get_provider_spec",
|
|
172
|
+
"require_provider_spec",
|
|
173
|
+
"get_evaluator_spec",
|
|
174
|
+
"require_evaluator_spec",
|
|
175
|
+
]
|
package/elizaos/media/mime.py
CHANGED
|
@@ -12,14 +12,14 @@ from urllib.parse import urlparse
|
|
|
12
12
|
|
|
13
13
|
# Try to import python-magic for MIME sniffing, fallback to filetype
|
|
14
14
|
try:
|
|
15
|
-
import magic
|
|
15
|
+
import magic # type: ignore[import-not-found]
|
|
16
16
|
|
|
17
17
|
HAS_MAGIC = True
|
|
18
18
|
except ImportError:
|
|
19
19
|
HAS_MAGIC = False
|
|
20
20
|
|
|
21
21
|
try:
|
|
22
|
-
import filetype
|
|
22
|
+
import filetype # type: ignore[import-not-found]
|
|
23
23
|
|
|
24
24
|
HAS_FILETYPE = True
|
|
25
25
|
except ImportError:
|
package/elizaos/media/search.py
CHANGED
|
@@ -109,36 +109,36 @@ def merge_hybrid_results(
|
|
|
109
109
|
by_id: dict[str, dict] = {}
|
|
110
110
|
|
|
111
111
|
# Add vector search results
|
|
112
|
-
for
|
|
113
|
-
by_id[
|
|
114
|
-
"id":
|
|
115
|
-
"path":
|
|
116
|
-
"start_line":
|
|
117
|
-
"end_line":
|
|
118
|
-
"source":
|
|
119
|
-
"snippet":
|
|
120
|
-
"vector_score":
|
|
112
|
+
for vector_result in vector:
|
|
113
|
+
by_id[vector_result.id] = {
|
|
114
|
+
"id": vector_result.id,
|
|
115
|
+
"path": vector_result.path,
|
|
116
|
+
"start_line": vector_result.start_line,
|
|
117
|
+
"end_line": vector_result.end_line,
|
|
118
|
+
"source": vector_result.source,
|
|
119
|
+
"snippet": vector_result.snippet,
|
|
120
|
+
"vector_score": vector_result.vector_score,
|
|
121
121
|
"text_score": 0.0,
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
# Merge keyword search results
|
|
125
|
-
for
|
|
126
|
-
if
|
|
127
|
-
existing = by_id[
|
|
128
|
-
existing["text_score"] =
|
|
125
|
+
for keyword_result in keyword:
|
|
126
|
+
if keyword_result.id in by_id:
|
|
127
|
+
existing = by_id[keyword_result.id]
|
|
128
|
+
existing["text_score"] = keyword_result.text_score
|
|
129
129
|
# Prefer keyword snippet if available (may have highlights)
|
|
130
|
-
if
|
|
131
|
-
existing["snippet"] =
|
|
130
|
+
if keyword_result.snippet:
|
|
131
|
+
existing["snippet"] = keyword_result.snippet
|
|
132
132
|
else:
|
|
133
|
-
by_id[
|
|
134
|
-
"id":
|
|
135
|
-
"path":
|
|
136
|
-
"start_line":
|
|
137
|
-
"end_line":
|
|
138
|
-
"source":
|
|
139
|
-
"snippet":
|
|
133
|
+
by_id[keyword_result.id] = {
|
|
134
|
+
"id": keyword_result.id,
|
|
135
|
+
"path": keyword_result.path,
|
|
136
|
+
"start_line": keyword_result.start_line,
|
|
137
|
+
"end_line": keyword_result.end_line,
|
|
138
|
+
"source": keyword_result.source,
|
|
139
|
+
"snippet": keyword_result.snippet,
|
|
140
140
|
"vector_score": 0.0,
|
|
141
|
-
"text_score":
|
|
141
|
+
"text_score": keyword_result.text_score,
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
# Calculate weighted scores and create results
|