digitalkin 0.3.1__tar.gz → 0.3.1.dev1__tar.gz
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.
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/PKG-INFO +4 -4
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/pyproject.toml +15 -14
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/__version__.py +1 -1
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/core/job_manager/taskiq_broker.py +1 -1
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/core/task_manager/task_session.py +2 -12
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/grpc_servers/module_servicer.py +8 -12
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/models/grpc_servers/models.py +4 -4
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/models/module/module_context.py +0 -5
- digitalkin-0.3.1.dev1/src/digitalkin/models/module/module_types.py +109 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/modules/_base_module.py +28 -66
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/services_config.py +0 -11
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/services_models.py +1 -3
- digitalkin-0.3.1.dev1/src/digitalkin/services/user_profile/__init__.py +1 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/user_profile/grpc_user_profile.py +2 -2
- digitalkin-0.3.1.dev1/src/digitalkin/utils/__init__.py +1 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin.egg-info/PKG-INFO +4 -4
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin.egg-info/SOURCES.txt +0 -2
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin.egg-info/requires.txt +3 -3
- digitalkin-0.3.1/examples/modules/dynamic_setup_module.py +0 -362
- digitalkin-0.3.1/src/digitalkin/models/module/module_types.py +0 -393
- digitalkin-0.3.1/src/digitalkin/services/user_profile/__init__.py +0 -12
- digitalkin-0.3.1/src/digitalkin/utils/__init__.py +0 -29
- digitalkin-0.3.1/src/digitalkin/utils/dynamic_schema.py +0 -483
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/LICENSE +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/README.md +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/examples/base_server/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/examples/base_server/mock/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/examples/base_server/mock/mock_pb2.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/examples/base_server/mock/mock_pb2_grpc.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/examples/base_server/server_async_insecure.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/examples/base_server/server_async_secure.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/examples/base_server/server_sync_insecure.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/examples/base_server/server_sync_secure.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/examples/modules/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/examples/modules/cpu_intensive_module.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/examples/modules/minimal_llm_module.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/examples/modules/text_transform_module.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/examples/services/filesystem_module.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/examples/services/storage_module.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/setup.cfg +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/core/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/core/common/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/core/common/factories.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/core/job_manager/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/core/job_manager/base_job_manager.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/core/job_manager/single_job_manager.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/core/job_manager/taskiq_job_manager.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/core/task_manager/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/core/task_manager/base_task_manager.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/core/task_manager/local_task_manager.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/core/task_manager/remote_task_manager.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/core/task_manager/surrealdb_repository.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/core/task_manager/task_executor.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/grpc_servers/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/grpc_servers/_base_server.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/grpc_servers/module_server.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/grpc_servers/registry_server.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/grpc_servers/registry_servicer.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/grpc_servers/utils/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/grpc_servers/utils/exceptions.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/grpc_servers/utils/grpc_client_wrapper.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/grpc_servers/utils/grpc_error_handler.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/logger.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/mixins/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/mixins/base_mixin.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/mixins/callback_mixin.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/mixins/chat_history_mixin.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/mixins/cost_mixin.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/mixins/file_history_mixin.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/mixins/filesystem_mixin.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/mixins/logger_mixin.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/mixins/storage_mixin.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/models/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/models/core/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/models/core/job_manager_models.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/models/core/task_monitor.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/models/grpc_servers/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/models/grpc_servers/types.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/models/module/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/models/module/module.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/models/services/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/models/services/cost.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/models/services/storage.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/modules/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/modules/archetype_module.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/modules/tool_module.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/modules/trigger_handler.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/py.typed +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/agent/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/agent/agent_strategy.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/agent/default_agent.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/base_strategy.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/cost/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/cost/cost_strategy.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/cost/default_cost.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/cost/grpc_cost.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/filesystem/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/filesystem/default_filesystem.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/filesystem/filesystem_strategy.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/filesystem/grpc_filesystem.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/identity/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/identity/default_identity.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/identity/identity_strategy.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/registry/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/registry/default_registry.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/registry/registry_strategy.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/setup/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/setup/default_setup.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/setup/grpc_setup.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/setup/setup_strategy.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/snapshot/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/snapshot/default_snapshot.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/snapshot/snapshot_strategy.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/storage/__init__.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/storage/default_storage.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/storage/grpc_storage.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/storage/storage_strategy.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/user_profile/default_user_profile.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/user_profile/user_profile_strategy.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/utils/arg_parser.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/utils/development_mode_action.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/utils/llm_ready_schema.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/utils/package_discover.py +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin.egg-info/dependency_links.txt +0 -0
- {digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: digitalkin
|
|
3
|
-
Version: 0.3.1
|
|
3
|
+
Version: 0.3.1.dev1
|
|
4
4
|
Summary: SDK to build kin used in DigitalKin
|
|
5
5
|
Author-email: "DigitalKin.ai" <contact@digitalkin.ai>
|
|
6
6
|
License: Attribution-NonCommercial-ShareAlike 4.0 International
|
|
@@ -452,17 +452,17 @@ Classifier: License :: Other/Proprietary License
|
|
|
452
452
|
Requires-Python: >=3.10
|
|
453
453
|
Description-Content-Type: text/markdown
|
|
454
454
|
License-File: LICENSE
|
|
455
|
-
Requires-Dist: digitalkin-proto==0.2.0
|
|
455
|
+
Requires-Dist: digitalkin-proto==0.2.0.dev4
|
|
456
456
|
Requires-Dist: grpcio-health-checking>=1.76.0
|
|
457
457
|
Requires-Dist: grpcio-reflection>=1.76.0
|
|
458
458
|
Requires-Dist: grpcio-status>=1.76.0
|
|
459
|
-
Requires-Dist: pydantic>=2.12.
|
|
459
|
+
Requires-Dist: pydantic>=2.12.4
|
|
460
460
|
Requires-Dist: surrealdb>=1.0.6
|
|
461
461
|
Provides-Extra: taskiq
|
|
462
462
|
Requires-Dist: rstream>=0.40.0; extra == "taskiq"
|
|
463
463
|
Requires-Dist: taskiq-aio-pika>=0.5.0; extra == "taskiq"
|
|
464
464
|
Requires-Dist: taskiq-redis>=1.1.2; extra == "taskiq"
|
|
465
|
-
Requires-Dist: taskiq[reload]>=0.
|
|
465
|
+
Requires-Dist: taskiq[reload]>=0.11.20; extra == "taskiq"
|
|
466
466
|
Dynamic: license-file
|
|
467
467
|
|
|
468
468
|
# DigitalKin Python SDK
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
keywords = [ "digitalkin", "kin", "agent", "gprc", "sdk" ]
|
|
14
14
|
|
|
15
|
-
version = "0.3.1"
|
|
15
|
+
version = "0.3.1.dev1"
|
|
16
16
|
classifiers = [
|
|
17
17
|
"Development Status :: 3 - Alpha",
|
|
18
18
|
"Intended Audience :: Developers",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
]
|
|
29
29
|
|
|
30
30
|
dependencies = [
|
|
31
|
-
"digitalkin-proto==0.2.0",
|
|
31
|
+
"digitalkin-proto==0.2.0.dev4",
|
|
32
32
|
"grpcio-health-checking>=1.76.0",
|
|
33
33
|
"grpcio-reflection>=1.76.0",
|
|
34
34
|
"grpcio-status>=1.76.0",
|
|
35
|
-
"pydantic>=2.12.
|
|
35
|
+
"pydantic>=2.12.4",
|
|
36
36
|
"surrealdb>=1.0.6",
|
|
37
37
|
]
|
|
38
38
|
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"rstream>=0.40.0",
|
|
42
42
|
"taskiq-aio-pika>=0.5.0",
|
|
43
43
|
"taskiq-redis>=1.1.2",
|
|
44
|
-
"taskiq[reload]>=0.
|
|
44
|
+
"taskiq[reload]>=0.11.20",
|
|
45
45
|
]
|
|
46
46
|
|
|
47
47
|
[project.urls]
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
|
|
56
56
|
[dependency-groups]
|
|
57
57
|
dev = [
|
|
58
|
-
"typos>=1.
|
|
59
|
-
"ruff>=0.14.
|
|
60
|
-
"mypy>=1.
|
|
58
|
+
"typos>=1.39.2",
|
|
59
|
+
"ruff>=0.14.6",
|
|
60
|
+
"mypy>=1.18.2",
|
|
61
61
|
"pyright>=1.1.407",
|
|
62
62
|
"pre-commit>=4.5.0",
|
|
63
63
|
"bump-my-version>=1.2.4",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"cryptography>=46.0.3",
|
|
67
67
|
]
|
|
68
68
|
tests = [
|
|
69
|
-
"freezegun>=1.5.
|
|
69
|
+
"freezegun>=1.5.3",
|
|
70
70
|
"hdrhistogram>=0.10.3",
|
|
71
71
|
"grpcio-testing>=1.76.0",
|
|
72
72
|
"psutil>=7.1.3",
|
|
@@ -75,17 +75,17 @@
|
|
|
75
75
|
"pytest-cov>=7.0.0",
|
|
76
76
|
"pytest-html==4.1.1",
|
|
77
77
|
"pytest-json-report==1.5.0",
|
|
78
|
-
"pytest-timeout>=2.
|
|
78
|
+
"pytest-timeout>=2.3.1",
|
|
79
79
|
]
|
|
80
80
|
docs = [
|
|
81
81
|
"mike>=2.1.3",
|
|
82
|
-
"markdown-callouts>=0.4
|
|
82
|
+
"markdown-callouts>=0.4",
|
|
83
83
|
"markdown-exec>=1.12.1",
|
|
84
|
-
"mkdocs>=1.6
|
|
84
|
+
"mkdocs>=1.6",
|
|
85
85
|
"mkdocs-coverage>=2.0.0",
|
|
86
86
|
"mkdocs-llmstxt>=0.5.0",
|
|
87
|
-
"mkdocs-redirects>=1.2
|
|
88
|
-
"mkdocstrings>=
|
|
87
|
+
"mkdocs-redirects>=1.2",
|
|
88
|
+
"mkdocstrings>=0.29",
|
|
89
89
|
"griffe-inherited-docstrings>=1.1.2",
|
|
90
90
|
"mkdocs-autorefs>=1.4.3",
|
|
91
91
|
"mkdocs-awesome-pages-plugin>=2.10.1",
|
|
@@ -97,7 +97,8 @@
|
|
|
97
97
|
"mkdocs-material[imaging]>=9.7.0",
|
|
98
98
|
"mkdocs-minify-plugin>=0.8.0",
|
|
99
99
|
"mkdocs-section-index>=0.3.10",
|
|
100
|
-
"mkdocstrings
|
|
100
|
+
"mkdocstrings>=0.30.1",
|
|
101
|
+
"mkdocstrings-python>=1.19.0",
|
|
101
102
|
"mkdocs-open-in-new-tab>=1.0.8",
|
|
102
103
|
"tomli>=2.3.0",
|
|
103
104
|
]
|
|
@@ -208,7 +208,7 @@ async def run_start_module(
|
|
|
208
208
|
# Reconstruct Pydantic models from dicts for type safety
|
|
209
209
|
try:
|
|
210
210
|
input_model = module_class.create_input_model(input_data)
|
|
211
|
-
setup_model =
|
|
211
|
+
setup_model = module_class.create_setup_model(setup_data)
|
|
212
212
|
except Exception as e:
|
|
213
213
|
logger.error("Failed to reconstruct models for job %s: %s", job_id, e, exc_info=True)
|
|
214
214
|
raise
|
|
@@ -49,24 +49,14 @@ class TaskSession:
|
|
|
49
49
|
db: SurrealDBConnection,
|
|
50
50
|
module: BaseModule,
|
|
51
51
|
heartbeat_interval: datetime.timedelta = datetime.timedelta(seconds=2),
|
|
52
|
-
queue_maxsize: int = 1000,
|
|
53
52
|
) -> None:
|
|
54
|
-
"""Initialize Task Session.
|
|
55
|
-
|
|
56
|
-
Args:
|
|
57
|
-
task_id: Unique task identifier
|
|
58
|
-
mission_id: Mission identifier
|
|
59
|
-
db: SurrealDB connection
|
|
60
|
-
module: Module instance
|
|
61
|
-
heartbeat_interval: Interval between heartbeats
|
|
62
|
-
queue_maxsize: Maximum size for the queue (0 = unlimited)
|
|
63
|
-
"""
|
|
53
|
+
"""Initialize Task Session."""
|
|
64
54
|
self.db = db
|
|
65
55
|
self.module = module
|
|
66
56
|
|
|
67
57
|
self.status = TaskStatus.PENDING
|
|
68
58
|
# Bounded queue to prevent unbounded memory growth (max 1000 items)
|
|
69
|
-
self.queue: asyncio.Queue = asyncio.Queue(maxsize=
|
|
59
|
+
self.queue: asyncio.Queue = asyncio.Queue(maxsize=1000)
|
|
70
60
|
|
|
71
61
|
self.task_id = task_id
|
|
72
62
|
self.mission_id = mission_id
|
|
@@ -112,7 +112,7 @@ class ModuleServicer(module_service_pb2_grpc.ModuleServiceServicer, ArgParser):
|
|
|
112
112
|
# TODO: Secret should be used here as well
|
|
113
113
|
setup_version = request.setup_version
|
|
114
114
|
config_setup_data = self.module_class.create_config_setup_model(json_format.MessageToDict(request.content))
|
|
115
|
-
setup_version_data =
|
|
115
|
+
setup_version_data = self.module_class.create_setup_model(
|
|
116
116
|
json_format.MessageToDict(request.setup_version.content),
|
|
117
117
|
config_fields=True,
|
|
118
118
|
)
|
|
@@ -185,7 +185,7 @@ class ModuleServicer(module_service_pb2_grpc.ModuleServiceServicer, ArgParser):
|
|
|
185
185
|
msg = "No setup data returned."
|
|
186
186
|
raise ServicerError(msg)
|
|
187
187
|
|
|
188
|
-
setup_data =
|
|
188
|
+
setup_data = self.module_class.create_setup_model(setup_data_class.current_setup_version.content)
|
|
189
189
|
|
|
190
190
|
# create a task to run the module in background
|
|
191
191
|
job_id = await self.job_manager.create_module_instance_job(
|
|
@@ -350,9 +350,7 @@ class ModuleServicer(module_service_pb2_grpc.ModuleServiceServicer, ArgParser):
|
|
|
350
350
|
# Get input schema if available
|
|
351
351
|
try:
|
|
352
352
|
# Convert schema to proto format
|
|
353
|
-
input_schema_proto =
|
|
354
|
-
llm_format=request.llm_format,
|
|
355
|
-
)
|
|
353
|
+
input_schema_proto = self.module_class.get_input_format(llm_format=request.llm_format)
|
|
356
354
|
input_format_struct = json_format.Parse(
|
|
357
355
|
text=input_schema_proto,
|
|
358
356
|
message=struct_pb2.Struct(), # pylint: disable=no-member
|
|
@@ -388,9 +386,7 @@ class ModuleServicer(module_service_pb2_grpc.ModuleServiceServicer, ArgParser):
|
|
|
388
386
|
# Get output schema if available
|
|
389
387
|
try:
|
|
390
388
|
# Convert schema to proto format
|
|
391
|
-
output_schema_proto =
|
|
392
|
-
llm_format=request.llm_format,
|
|
393
|
-
)
|
|
389
|
+
output_schema_proto = self.module_class.get_output_format(llm_format=request.llm_format)
|
|
394
390
|
output_format_struct = json_format.Parse(
|
|
395
391
|
text=output_schema_proto,
|
|
396
392
|
message=struct_pb2.Struct(), # pylint: disable=no-member
|
|
@@ -426,7 +422,7 @@ class ModuleServicer(module_service_pb2_grpc.ModuleServiceServicer, ArgParser):
|
|
|
426
422
|
# Get setup schema if available
|
|
427
423
|
try:
|
|
428
424
|
# Convert schema to proto format
|
|
429
|
-
setup_schema_proto =
|
|
425
|
+
setup_schema_proto = self.module_class.get_setup_format(llm_format=request.llm_format)
|
|
430
426
|
setup_format_struct = json_format.Parse(
|
|
431
427
|
text=setup_schema_proto,
|
|
432
428
|
message=struct_pb2.Struct(), # pylint: disable=no-member
|
|
@@ -443,7 +439,7 @@ class ModuleServicer(module_service_pb2_grpc.ModuleServiceServicer, ArgParser):
|
|
|
443
439
|
setup_schema=setup_format_struct,
|
|
444
440
|
)
|
|
445
441
|
|
|
446
|
-
|
|
442
|
+
def GetModuleSecret( # noqa: N802
|
|
447
443
|
self,
|
|
448
444
|
request: information_pb2.GetModuleSecretRequest,
|
|
449
445
|
context: grpc.ServicerContext,
|
|
@@ -462,7 +458,7 @@ class ModuleServicer(module_service_pb2_grpc.ModuleServiceServicer, ArgParser):
|
|
|
462
458
|
# Get secret schema if available
|
|
463
459
|
try:
|
|
464
460
|
# Convert schema to proto format
|
|
465
|
-
secret_schema_proto =
|
|
461
|
+
secret_schema_proto = self.module_class.get_secret_format(llm_format=request.llm_format)
|
|
466
462
|
secret_format_struct = json_format.Parse(
|
|
467
463
|
text=secret_schema_proto,
|
|
468
464
|
message=struct_pb2.Struct(), # pylint: disable=no-member
|
|
@@ -498,7 +494,7 @@ class ModuleServicer(module_service_pb2_grpc.ModuleServiceServicer, ArgParser):
|
|
|
498
494
|
# Get setup schema if available
|
|
499
495
|
try:
|
|
500
496
|
# Convert schema to proto format
|
|
501
|
-
config_setup_schema_proto =
|
|
497
|
+
config_setup_schema_proto = self.module_class.get_config_setup_format(llm_format=request.llm_format)
|
|
502
498
|
config_setup_format_struct = json_format.Parse(
|
|
503
499
|
text=config_setup_schema_proto,
|
|
504
500
|
message=struct_pb2.Struct(), # pylint: disable=no-member
|
|
@@ -175,8 +175,8 @@ class ClientConfig(ChannelConfig):
|
|
|
175
175
|
credentials: ClientCredentials | None = Field(None, description="Client credentials for secure mode")
|
|
176
176
|
channel_options: list[tuple[str, Any]] = Field(
|
|
177
177
|
default_factory=lambda: [
|
|
178
|
-
("grpc.max_receive_message_length",
|
|
179
|
-
("grpc.max_send_message_length",
|
|
178
|
+
("grpc.max_receive_message_length", 50 * 1024 * 1024), # 50MB
|
|
179
|
+
("grpc.max_send_message_length", 50 * 1024 * 1024), # 50MB
|
|
180
180
|
],
|
|
181
181
|
description="Additional channel options",
|
|
182
182
|
)
|
|
@@ -223,8 +223,8 @@ class ServerConfig(ChannelConfig):
|
|
|
223
223
|
credentials: ServerCredentials | None = Field(None, description="Server credentials for secure mode")
|
|
224
224
|
server_options: list[tuple[str, Any]] = Field(
|
|
225
225
|
default_factory=lambda: [
|
|
226
|
-
("grpc.max_receive_message_length",
|
|
227
|
-
("grpc.max_send_message_length",
|
|
226
|
+
("grpc.max_receive_message_length", 50 * 1024 * 1024), # 50MB
|
|
227
|
+
("grpc.max_send_message_length", 50 * 1024 * 1024), # 50MB
|
|
228
228
|
],
|
|
229
229
|
description="Additional server options",
|
|
230
230
|
)
|
|
@@ -10,7 +10,6 @@ from digitalkin.services.identity.identity_strategy import IdentityStrategy
|
|
|
10
10
|
from digitalkin.services.registry.registry_strategy import RegistryStrategy
|
|
11
11
|
from digitalkin.services.snapshot.snapshot_strategy import SnapshotStrategy
|
|
12
12
|
from digitalkin.services.storage.storage_strategy import StorageStrategy
|
|
13
|
-
from digitalkin.services.user_profile.user_profile_strategy import UserProfileStrategy
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
class Session(SimpleNamespace):
|
|
@@ -90,7 +89,6 @@ class ModuleContext:
|
|
|
90
89
|
registry: RegistryStrategy
|
|
91
90
|
snapshot: SnapshotStrategy
|
|
92
91
|
storage: StorageStrategy
|
|
93
|
-
user_profile: UserProfileStrategy
|
|
94
92
|
|
|
95
93
|
session: Session
|
|
96
94
|
callbacks: SimpleNamespace
|
|
@@ -107,7 +105,6 @@ class ModuleContext:
|
|
|
107
105
|
registry: RegistryStrategy,
|
|
108
106
|
snapshot: SnapshotStrategy,
|
|
109
107
|
storage: StorageStrategy,
|
|
110
|
-
user_profile: UserProfileStrategy,
|
|
111
108
|
session: dict[str, Any],
|
|
112
109
|
metadata: dict[str, Any] = {},
|
|
113
110
|
helpers: dict[str, Any] = {},
|
|
@@ -123,7 +120,6 @@ class ModuleContext:
|
|
|
123
120
|
registry: RegistryStrategy.
|
|
124
121
|
snapshot: SnapshotStrategy.
|
|
125
122
|
storage: StorageStrategy.
|
|
126
|
-
user_profile: UserProfileStrategy.
|
|
127
123
|
metadata: dict defining differents Module metadata.
|
|
128
124
|
helpers: dict different user defined helpers.
|
|
129
125
|
session: dict referring the session IDs or informations.
|
|
@@ -137,7 +133,6 @@ class ModuleContext:
|
|
|
137
133
|
self.registry = registry
|
|
138
134
|
self.snapshot = snapshot
|
|
139
135
|
self.storage = storage
|
|
140
|
-
self.user_profile = user_profile
|
|
141
136
|
|
|
142
137
|
self.metadata = SimpleNamespace(**metadata)
|
|
143
138
|
self.session = Session(**session)
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"""Types for module models."""
|
|
2
|
+
|
|
3
|
+
from datetime import datetime, timezone
|
|
4
|
+
from typing import Any, ClassVar, Generic, TypeVar, cast
|
|
5
|
+
|
|
6
|
+
from pydantic import BaseModel, ConfigDict, Field, create_model
|
|
7
|
+
|
|
8
|
+
from digitalkin.logger import logger
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class DataTrigger(BaseModel):
|
|
12
|
+
"""Defines the root input/output model exposing the protocol.
|
|
13
|
+
|
|
14
|
+
The mandatory protocol is important to define the module beahvior following the user or agent input/output.
|
|
15
|
+
|
|
16
|
+
Example:
|
|
17
|
+
class MyInput(DataModel):
|
|
18
|
+
root: DataTrigger
|
|
19
|
+
user_define_data: Any
|
|
20
|
+
|
|
21
|
+
# Usage
|
|
22
|
+
my_input = MyInput(root=DataTrigger(protocol="message"))
|
|
23
|
+
print(my_input.root.protocol) # Output: message
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
protocol: ClassVar[str]
|
|
27
|
+
created_at: str = Field(
|
|
28
|
+
default_factory=lambda: datetime.now(tz=timezone.utc).isoformat(),
|
|
29
|
+
title="Created At",
|
|
30
|
+
description="Timestamp when the payload was created.",
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
DataTriggerT = TypeVar("DataTriggerT", bound=DataTrigger)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class DataModel(BaseModel, Generic[DataTriggerT]):
|
|
38
|
+
"""Base definition of input/output model showing mandatory root fields.
|
|
39
|
+
|
|
40
|
+
The Model define the Module Input/output, usually referring to multiple input/output type defined by an union.
|
|
41
|
+
|
|
42
|
+
Example:
|
|
43
|
+
class ModuleInput(DataModel):
|
|
44
|
+
root: FileInput | MessageInput
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
root: DataTriggerT
|
|
48
|
+
annotations: dict[str, str] = Field(
|
|
49
|
+
default={},
|
|
50
|
+
title="Annotations",
|
|
51
|
+
description="Additional metadata or annotations related to the output. ex {'role': 'user'}",
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
InputModelT = TypeVar("InputModelT", bound=DataModel)
|
|
56
|
+
OutputModelT = TypeVar("OutputModelT", bound=DataModel)
|
|
57
|
+
SecretModelT = TypeVar("SecretModelT", bound=BaseModel)
|
|
58
|
+
SetupModelT = TypeVar("SetupModelT", bound="SetupModel")
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class SetupModel(BaseModel):
|
|
62
|
+
"""Base definition of setup model showing mandatory root fields.
|
|
63
|
+
|
|
64
|
+
Optionally, the setup model can define a config option in json_schema_extra to be used to initialize the Kin.
|
|
65
|
+
|
|
66
|
+
Example:
|
|
67
|
+
class MySetup(SetupModel):
|
|
68
|
+
name: str = Field()
|
|
69
|
+
number: int = Field(..., json_schema_extra={"config": True})
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
@classmethod
|
|
73
|
+
def get_clean_model(cls, *, config_fields: bool, hidden_fields: bool) -> type[SetupModelT]: # type: ignore
|
|
74
|
+
"""Dynamically builds and returns a new BaseModel subclass.
|
|
75
|
+
|
|
76
|
+
containing only those fields where json_schema_extra["config"] == True.
|
|
77
|
+
|
|
78
|
+
Returns:
|
|
79
|
+
Type[BaseModel]: A new BaseModel subclass with the filtered fields.
|
|
80
|
+
|
|
81
|
+
Raises:
|
|
82
|
+
ValueError: If both config_fields and hidden_fields are set to True.
|
|
83
|
+
"""
|
|
84
|
+
clean_fields: dict[str, Any] = {}
|
|
85
|
+
for name, field_info in cls.model_fields.items():
|
|
86
|
+
extra = getattr(field_info, "json_schema_extra", {}) or {}
|
|
87
|
+
is_config = bool(extra.get("config", False))
|
|
88
|
+
is_hidden = bool(extra.get("hidden", False))
|
|
89
|
+
|
|
90
|
+
# Skip config unless explicitly included
|
|
91
|
+
if is_config and not config_fields:
|
|
92
|
+
logger.debug("Skipping '%s' (config-only)", name)
|
|
93
|
+
continue
|
|
94
|
+
|
|
95
|
+
# Skip hidden unless explicitly included
|
|
96
|
+
if is_hidden and not hidden_fields:
|
|
97
|
+
logger.debug("Skipping '%s' (hidden-only)", name)
|
|
98
|
+
continue
|
|
99
|
+
|
|
100
|
+
clean_fields[name] = (field_info.annotation, field_info)
|
|
101
|
+
|
|
102
|
+
# Dynamically create a model e.g. "SetupModel"
|
|
103
|
+
m = create_model(
|
|
104
|
+
f"{cls.__name__}",
|
|
105
|
+
__base__=BaseModel,
|
|
106
|
+
__config__=ConfigDict(arbitrary_types_allowed=True),
|
|
107
|
+
**clean_fields,
|
|
108
|
+
)
|
|
109
|
+
return cast("type[SetupModelT]", m) # type: ignore
|
|
@@ -107,18 +107,14 @@ class BaseModule( # noqa: PLR0904
|
|
|
107
107
|
return self._status
|
|
108
108
|
|
|
109
109
|
@classmethod
|
|
110
|
-
|
|
110
|
+
def get_secret_format(cls, *, llm_format: bool) -> str:
|
|
111
111
|
"""Get the JSON schema of the secret format model.
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
references and simplified structure.
|
|
113
|
+
Raises:
|
|
114
|
+
NotImplementedError: If the `secret_format` is not defined.
|
|
116
115
|
|
|
117
116
|
Returns:
|
|
118
|
-
The JSON schema of the secret format as a
|
|
119
|
-
|
|
120
|
-
Raises:
|
|
121
|
-
NotImplementedError: If the `secret_format` class attribute is not defined.
|
|
117
|
+
The JSON schema of the secret format as a string.
|
|
122
118
|
"""
|
|
123
119
|
if cls.secret_format is not None:
|
|
124
120
|
if llm_format:
|
|
@@ -128,18 +124,14 @@ class BaseModule( # noqa: PLR0904
|
|
|
128
124
|
raise NotImplementedError(msg)
|
|
129
125
|
|
|
130
126
|
@classmethod
|
|
131
|
-
|
|
127
|
+
def get_input_format(cls, *, llm_format: bool) -> str:
|
|
132
128
|
"""Get the JSON schema of the input format model.
|
|
133
129
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
references and simplified structure.
|
|
130
|
+
Raises:
|
|
131
|
+
NotImplementedError: If the `input_format` is not defined.
|
|
137
132
|
|
|
138
133
|
Returns:
|
|
139
|
-
The JSON schema of the input format as a
|
|
140
|
-
|
|
141
|
-
Raises:
|
|
142
|
-
NotImplementedError: If the `input_format` class attribute is not defined.
|
|
134
|
+
The JSON schema of the input format as a string.
|
|
143
135
|
"""
|
|
144
136
|
if cls.input_format is not None:
|
|
145
137
|
if llm_format:
|
|
@@ -149,18 +141,14 @@ class BaseModule( # noqa: PLR0904
|
|
|
149
141
|
raise NotImplementedError(msg)
|
|
150
142
|
|
|
151
143
|
@classmethod
|
|
152
|
-
|
|
144
|
+
def get_output_format(cls, *, llm_format: bool) -> str:
|
|
153
145
|
"""Get the JSON schema of the output format model.
|
|
154
146
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
references and simplified structure.
|
|
147
|
+
Raises:
|
|
148
|
+
NotImplementedError: If the `output_format` is not defined.
|
|
158
149
|
|
|
159
150
|
Returns:
|
|
160
|
-
The JSON schema of the output format as a
|
|
161
|
-
|
|
162
|
-
Raises:
|
|
163
|
-
NotImplementedError: If the `output_format` class attribute is not defined.
|
|
151
|
+
The JSON schema of the output format as a string.
|
|
164
152
|
"""
|
|
165
153
|
if cls.output_format is not None:
|
|
166
154
|
if llm_format:
|
|
@@ -170,29 +158,20 @@ class BaseModule( # noqa: PLR0904
|
|
|
170
158
|
raise NotImplementedError(msg)
|
|
171
159
|
|
|
172
160
|
@classmethod
|
|
173
|
-
|
|
161
|
+
def get_config_setup_format(cls, *, llm_format: bool) -> str:
|
|
174
162
|
"""Gets the JSON schema of the config setup format model.
|
|
175
163
|
|
|
176
|
-
The config setup format is used only to initialize the module with configuration
|
|
177
|
-
|
|
178
|
-
excludes hidden runtime fields.
|
|
179
|
-
|
|
180
|
-
Dynamic schema fields are always resolved when generating the schema, as this
|
|
181
|
-
method is typically called during module discovery or schema generation where
|
|
182
|
-
fresh values are needed.
|
|
164
|
+
The config setup format is used only to initialize the module with configuration data.
|
|
165
|
+
The setup format is used to initialize an run the module with setup data.
|
|
183
166
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
references and simplified structure.
|
|
167
|
+
Raises:
|
|
168
|
+
NotImplementedError: If the `setup_format` is not defined.
|
|
187
169
|
|
|
188
170
|
Returns:
|
|
189
|
-
The JSON schema of the config setup format as a
|
|
190
|
-
|
|
191
|
-
Raises:
|
|
192
|
-
NotImplementedError: If the `setup_format` class attribute is not defined.
|
|
171
|
+
The JSON schema of the config setup format as a string.
|
|
193
172
|
"""
|
|
194
173
|
if cls.setup_format is not None:
|
|
195
|
-
setup_format =
|
|
174
|
+
setup_format = cls.setup_format.get_clean_model(config_fields=True, hidden_fields=False)
|
|
196
175
|
if llm_format:
|
|
197
176
|
return json.dumps(llm_ready_schema(setup_format), indent=2)
|
|
198
177
|
return json.dumps(setup_format.model_json_schema(), indent=2)
|
|
@@ -200,28 +179,17 @@ class BaseModule( # noqa: PLR0904
|
|
|
200
179
|
raise NotImplementedError(msg)
|
|
201
180
|
|
|
202
181
|
@classmethod
|
|
203
|
-
|
|
182
|
+
def get_setup_format(cls, *, llm_format: bool) -> str:
|
|
204
183
|
"""Gets the JSON schema of the setup format model.
|
|
205
184
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
Dynamic schema fields are always resolved when generating the schema, as this
|
|
210
|
-
method is typically called during module discovery or schema generation where
|
|
211
|
-
fresh values are needed.
|
|
212
|
-
|
|
213
|
-
Args:
|
|
214
|
-
llm_format: If True, return LLM-optimized schema format with inlined
|
|
215
|
-
references and simplified structure.
|
|
185
|
+
Raises:
|
|
186
|
+
NotImplementedError: If the `setup_format` is not defined.
|
|
216
187
|
|
|
217
188
|
Returns:
|
|
218
|
-
The JSON schema of the setup format as a
|
|
219
|
-
|
|
220
|
-
Raises:
|
|
221
|
-
NotImplementedError: If the `setup_format` class attribute is not defined.
|
|
189
|
+
The JSON schema of the setup format as a string.
|
|
222
190
|
"""
|
|
223
191
|
if cls.setup_format is not None:
|
|
224
|
-
setup_format =
|
|
192
|
+
setup_format = cls.setup_format.get_clean_model(config_fields=False, hidden_fields=True)
|
|
225
193
|
if llm_format:
|
|
226
194
|
return json.dumps(llm_ready_schema(setup_format), indent=2)
|
|
227
195
|
return json.dumps(setup_format.model_json_schema(), indent=2)
|
|
@@ -253,22 +221,17 @@ class BaseModule( # noqa: PLR0904
|
|
|
253
221
|
return cls.input_format(**input_data)
|
|
254
222
|
|
|
255
223
|
@classmethod
|
|
256
|
-
|
|
224
|
+
def create_setup_model(cls, setup_data: dict[str, Any], *, config_fields: bool = False) -> SetupModelT:
|
|
257
225
|
"""Create the setup model from the setup data.
|
|
258
226
|
|
|
259
|
-
Creates a filtered setup model instance based on the provided data.
|
|
260
|
-
Uses `get_clean_model()` internally to get the appropriate model class
|
|
261
|
-
with field filtering applied.
|
|
262
|
-
|
|
263
227
|
Args:
|
|
264
228
|
setup_data: The setup data to create the model from.
|
|
265
229
|
config_fields: If True, include only fields with json_schema_extra["config"] == True.
|
|
266
230
|
|
|
267
231
|
Returns:
|
|
268
|
-
|
|
232
|
+
The setup model.
|
|
269
233
|
"""
|
|
270
|
-
|
|
271
|
-
return model_cls(**setup_data)
|
|
234
|
+
return cls.setup_format.get_clean_model(config_fields=config_fields, hidden_fields=True)(**setup_data)
|
|
272
235
|
|
|
273
236
|
@classmethod
|
|
274
237
|
def create_secret_model(cls, secret_data: dict[str, Any]) -> SecretModelT:
|
|
@@ -473,8 +436,7 @@ class BaseModule( # noqa: PLR0904
|
|
|
473
436
|
|
|
474
437
|
wrapper = config_setup_data.model_dump()
|
|
475
438
|
wrapper["content"] = content.model_dump()
|
|
476
|
-
|
|
477
|
-
await callback(setup_model)
|
|
439
|
+
await callback(self.create_setup_model(wrapper))
|
|
478
440
|
self._status = ModuleStatus.STOPPING
|
|
479
441
|
except Exception:
|
|
480
442
|
logger.error("Error during module lifecyle")
|
|
@@ -12,7 +12,6 @@ from digitalkin.services.registry import DefaultRegistry, RegistryStrategy
|
|
|
12
12
|
from digitalkin.services.services_models import ServicesMode, ServicesStrategy
|
|
13
13
|
from digitalkin.services.snapshot import DefaultSnapshot, SnapshotStrategy
|
|
14
14
|
from digitalkin.services.storage import DefaultStorage, GrpcStorage, StorageStrategy
|
|
15
|
-
from digitalkin.services.user_profile import DefaultUserProfile, GrpcUserProfile, UserProfileStrategy
|
|
16
15
|
|
|
17
16
|
|
|
18
17
|
class ServicesConfig(BaseModel):
|
|
@@ -54,10 +53,6 @@ class ServicesConfig(BaseModel):
|
|
|
54
53
|
default_factory=lambda: ServicesStrategy(local=DefaultIdentity, remote=DefaultIdentity)
|
|
55
54
|
)
|
|
56
55
|
_config_identity: dict[str, Any | None] = PrivateAttr(default_factory=dict)
|
|
57
|
-
_user_profile: ServicesStrategy[UserProfileStrategy] = PrivateAttr(
|
|
58
|
-
default_factory=lambda: ServicesStrategy(local=DefaultUserProfile, remote=GrpcUserProfile)
|
|
59
|
-
)
|
|
60
|
-
_config_user_profile: dict[str, Any | None] = PrivateAttr(default_factory=dict)
|
|
61
56
|
|
|
62
57
|
# List of valid strategy names for validation
|
|
63
58
|
_valid_strategy_names: ClassVar[set[str]] = {
|
|
@@ -68,7 +63,6 @@ class ServicesConfig(BaseModel):
|
|
|
68
63
|
"filesystem",
|
|
69
64
|
"agent",
|
|
70
65
|
"identity",
|
|
71
|
-
"user_profile",
|
|
72
66
|
}
|
|
73
67
|
|
|
74
68
|
def __init__(
|
|
@@ -175,11 +169,6 @@ class ServicesConfig(BaseModel):
|
|
|
175
169
|
"""Get the identity service strategy class based on the current mode."""
|
|
176
170
|
return self._identity[self.mode.value]
|
|
177
171
|
|
|
178
|
-
@property
|
|
179
|
-
def user_profile(self) -> type[UserProfileStrategy]:
|
|
180
|
-
"""Get the user_profile service strategy class based on the current mode."""
|
|
181
|
-
return self._user_profile[self.mode.value]
|
|
182
|
-
|
|
183
172
|
def update_mode(self, mode: ServicesMode) -> None:
|
|
184
173
|
"""Update the strategy mode.
|
|
185
174
|
|
|
@@ -13,7 +13,6 @@ from digitalkin.services.identity import IdentityStrategy
|
|
|
13
13
|
from digitalkin.services.registry import RegistryStrategy
|
|
14
14
|
from digitalkin.services.snapshot import SnapshotStrategy
|
|
15
15
|
from digitalkin.services.storage import StorageStrategy
|
|
16
|
-
from digitalkin.services.user_profile import UserProfileStrategy
|
|
17
16
|
|
|
18
17
|
# Define type variables
|
|
19
18
|
T = TypeVar(
|
|
@@ -24,8 +23,7 @@ T = TypeVar(
|
|
|
24
23
|
| IdentityStrategy
|
|
25
24
|
| RegistryStrategy
|
|
26
25
|
| SnapshotStrategy
|
|
27
|
-
| StorageStrategy
|
|
28
|
-
| UserProfileStrategy,
|
|
26
|
+
| StorageStrategy,
|
|
29
27
|
)
|
|
30
28
|
|
|
31
29
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""UserProfile service package."""
|
{digitalkin-0.3.1 → digitalkin-0.3.1.dev1}/src/digitalkin/services/user_profile/grpc_user_profile.py
RENAMED
|
@@ -49,8 +49,8 @@ class GrpcUserProfile(UserProfileStrategy, GrpcClientWrapper, GrpcErrorHandlerMi
|
|
|
49
49
|
ServerError: If gRPC operation fails
|
|
50
50
|
"""
|
|
51
51
|
with self.handle_grpc_errors("GetUserProfile", UserProfileServiceError):
|
|
52
|
-
# mission_id
|
|
53
|
-
request = user_profile_pb2.GetUserProfileRequest(
|
|
52
|
+
# mission_id typically contains user context
|
|
53
|
+
request = user_profile_pb2.GetUserProfileRequest(user_id=self.mission_id)
|
|
54
54
|
response = self.exec_grpc_query("GetUserProfile", request)
|
|
55
55
|
|
|
56
56
|
if not response.success:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""General utils folder."""
|