digitalkin 0.3.2.dev30__py3-none-any.whl → 0.3.2.dev31__py3-none-any.whl

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/__version__.py CHANGED
@@ -5,4 +5,4 @@ from importlib.metadata import PackageNotFoundError, version
5
5
  try:
6
6
  __version__ = version("digitalkin")
7
7
  except PackageNotFoundError:
8
- __version__ = "0.3.2.dev30"
8
+ __version__ = "0.3.2.dev31"
@@ -13,7 +13,6 @@ from digitalkin.logger import logger
13
13
  from digitalkin.models.grpc_servers.models import (
14
14
  ClientConfig,
15
15
  ModuleServerConfig,
16
- SecurityMode,
17
16
  )
18
17
  from digitalkin.modules._base_module import BaseModule
19
18
  from digitalkin.services.registry import GrpcRegistry
@@ -45,8 +44,8 @@ class ModuleServer(BaseServer):
45
44
 
46
45
  Args:
47
46
  module_class: The module instance to be served.
48
- server_config: Server configuration including registry address if auto-registration is desired.
49
- client_config: Client configuration used by services.
47
+ server_config: Server configuration.
48
+ client_config: Client configuration used by services and registry connection.
50
49
  """
51
50
  super().__init__(server_config)
52
51
  self.module_class = module_class
@@ -55,9 +54,6 @@ class ModuleServer(BaseServer):
55
54
  self.module_servicer: ModuleServicer | None = None
56
55
  self.registry: RegistryStrategy | None = None
57
56
 
58
- self._registry_client_config: ClientConfig | None = None
59
- if self.server_config.registry_address:
60
- self._registry_client_config = self._build_registry_client_config()
61
57
  self._prepare_registry_config()
62
58
 
63
59
  def _register_servicers(self) -> None:
@@ -85,36 +81,17 @@ class ModuleServer(BaseServer):
85
81
  This ensures ServicesConfig created by JobManager will have registry config,
86
82
  allowing spawned module instances to inherit the registry configuration.
87
83
  """
88
- if not self._registry_client_config:
84
+ if not self.client_config:
89
85
  return
90
86
 
91
- self.module_class.services_config_params["registry"] = {"client_config": self._registry_client_config}
92
-
93
- def _build_registry_client_config(self) -> ClientConfig:
94
- """Build ClientConfig for registry from server_config.registry_address.
95
-
96
- Returns:
97
- ClientConfig configured for registry connection.
98
- """
99
- host, port = self.server_config.registry_address.rsplit(":", 1)
100
- return ClientConfig(
101
- host=host,
102
- port=int(port),
103
- mode=self.server_config.mode,
104
- security=self.client_config.security if self.client_config else SecurityMode.INSECURE,
105
- credentials=self.client_config.credentials if self.client_config else None,
106
- )
87
+ self.module_class.services_config_params["registry"] = {"client_config": self.client_config}
107
88
 
108
89
  def _init_registry(self) -> None:
109
- """Initialize server-level registry client for registration.
110
-
111
- Note: services_config_params["registry"] is already set in _prepare_registry_config()
112
- which runs in __init__(). This method only creates the server-level client instance.
113
- """
114
- if not self._registry_client_config:
90
+ """Initialize server-level registry client for registration."""
91
+ if not self.client_config:
115
92
  return
116
93
 
117
- self.registry = GrpcRegistry("", "", "", self._registry_client_config)
94
+ self.registry = GrpcRegistry("", "", "", self.client_config)
118
95
 
119
96
  def start(self) -> None:
120
97
  """Start the module server and register with the registry if configured."""
@@ -170,20 +147,21 @@ class ModuleServer(BaseServer):
170
147
  )
171
148
  return
172
149
 
150
+ advertise_address = self.server_config.advertise_host or self.server_config.host
151
+
173
152
  logger.info(
174
153
  "Attempting to register module with registry",
175
154
  extra={
176
155
  "module_id": module_id,
177
- "address": self.server_config.host,
156
+ "address": advertise_address,
178
157
  "port": self.server_config.port,
179
158
  "version": version,
180
- "registry_address": self.server_config.registry_address,
181
159
  },
182
160
  )
183
161
 
184
162
  result = self.registry.register(
185
163
  module_id=module_id,
186
- address=self.server_config.host,
164
+ address=advertise_address,
187
165
  port=self.server_config.port,
188
166
  version=version,
189
167
  )
@@ -193,16 +171,12 @@ class ModuleServer(BaseServer):
193
171
  "Module registered successfully",
194
172
  extra={
195
173
  "module_id": result.module_id,
196
- "address": self.server_config.host,
174
+ "address": advertise_address,
197
175
  "port": self.server_config.port,
198
- "registry_address": self.server_config.registry_address,
199
176
  },
200
177
  )
201
178
  else:
202
179
  logger.warning(
203
180
  "Module registration returned None (module may not exist in registry)",
204
- extra={
205
- "module_id": module_id,
206
- "registry_address": self.server_config.registry_address,
207
- },
181
+ extra={"module_id": module_id, "address": advertise_address},
208
182
  )
@@ -344,10 +344,12 @@ class ModuleServerConfig(ServerConfig):
344
344
  """Configuration for Module gRPC server.
345
345
 
346
346
  Attributes:
347
- registry_address: Address of the registry server
347
+ advertise_host: Public hostname/IP sent to registry for discovery. Falls back to host if not set.
348
348
  """
349
349
 
350
- registry_address: str = Field(..., description="Address of the registry server")
350
+ advertise_host: str | None = Field(
351
+ None, description="Public hostname/IP sent to registry for discovery. Falls back to host if not set."
352
+ )
351
353
 
352
354
 
353
355
  class RegistryServerConfig(ServerConfig):
@@ -43,7 +43,7 @@ class _ToolReferenceInputSchema:
43
43
  def __init__(
44
44
  self,
45
45
  setup_ids: list[str],
46
- module_ids: list[str],
46
+ module_ids: list[str] | None,
47
47
  tag_ids: list[str],
48
48
  categories: list[str],
49
49
  max_tools: int = 0,
@@ -77,16 +77,17 @@ class _ToolReferenceInputSchema:
77
77
  json_schema["ui:widget"] = "toolSelect"
78
78
  json_schema["ui:options"] = {
79
79
  "setupIds": self.setup_ids,
80
- "moduleIds": self.module_ids,
81
80
  "tagIds": self.tag_ids,
82
81
  "categories": self.categories,
82
+ "moduleIds": self.module_ids or [],
83
+ "showModules": self.module_ids is not None,
83
84
  }
84
85
  return json_schema
85
86
 
86
87
 
87
88
  def tool_reference_input(
88
89
  setup_ids: list[str] = [],
89
- module_ids: list[str] = [],
90
+ module_ids: list[str] | None = [],
90
91
  tag_ids: list[str] = [],
91
92
  categories: list[str] = [],
92
93
  max_tools: int = 0,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: digitalkin
3
- Version: 0.3.2.dev30
3
+ Version: 0.3.2.dev31
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
@@ -7,7 +7,7 @@ base_server/mock/__init__.py,sha256=YZFT-F1l_TpvJYuIPX-7kTeE1CfOjhx9YmNRXVoi-jQ,
7
7
  base_server/mock/mock_pb2.py,sha256=sETakcS3PAAm4E-hTCV1jIVaQTPEAIoVVHupB8Z_k7Y,1843
8
8
  base_server/mock/mock_pb2_grpc.py,sha256=BbOT70H6q3laKgkHfOx1QdfmCS_HxCY4wCOX84YAdG4,3180
9
9
  digitalkin/__init__.py,sha256=7LLBAba0th-3SGqcpqFO-lopWdUkVLKzLZiMtB-mW3M,162
10
- digitalkin/__version__.py,sha256=ae9RK0HSLfcT6PpMoP-U9CLQQeJH7Ej6t5Jw6ZGL7t8,196
10
+ digitalkin/__version__.py,sha256=kDT339Iyebmk1kRj9jnBqCMyuRyXV0IOMP0tTsMAKAE,196
11
11
  digitalkin/logger.py,sha256=8ze_tjt2G6mDTuQcsf7-UTXWP3UHZ7LZVSs_iqF4rX4,4685
12
12
  digitalkin/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  digitalkin/core/__init__.py,sha256=FJRcJ-B1Viyn-38L8XpOpZ8KOnf1I7PCDOAmKXLQhqc,71
@@ -27,7 +27,7 @@ digitalkin/core/task_manager/task_executor.py,sha256=8xh5_1zuRAaGZIH_gWyNsA4T7YY
27
27
  digitalkin/core/task_manager/task_session.py,sha256=5jw21bT_SPXUzWE7tk6YG62EXqlRJcrSakFXDFDRy28,12730
28
28
  digitalkin/grpc_servers/__init__.py,sha256=ZIRMJ1Lcas8yQ106GCup6hn2UBOsx1sNk8ap0lpEDnY,72
29
29
  digitalkin/grpc_servers/_base_server.py,sha256=ZVeCDwI7w7fFbPTXPkeJb_SOuLfd2T7za3T4oCu2UWY,18680
30
- digitalkin/grpc_servers/module_server.py,sha256=Ec3izzV2YpdN8rGs_cX-iVulQ00FkLR5dBflHlQ8a6Y,7849
30
+ digitalkin/grpc_servers/module_server.py,sha256=1zjOzLUyQS-y-GWdTJHH1v-JPxq6-ydd8eOYFqxOvaQ,6578
31
31
  digitalkin/grpc_servers/module_servicer.py,sha256=yhS5zOxxOTh3aXNVZBbgomRtFa5k6Q7jm-PZh54Gus8,21717
32
32
  digitalkin/grpc_servers/utils/__init__.py,sha256=ZnAIb_F8z4NhtPypqkdmzgRSzolKnJTk3oZx5GfWH5Y,38
33
33
  digitalkin/grpc_servers/utils/exceptions.py,sha256=LtaDtlqXCeT6iqApogs4pbtezotOVeg4fhnFzGBvFsY,692
@@ -48,7 +48,7 @@ digitalkin/models/core/__init__.py,sha256=jOMDmPX0uSfGA9zUi0u_kOvYJ46VdIssoIhVYv
48
48
  digitalkin/models/core/job_manager_models.py,sha256=wvf2dzRzAu0-zzzAXQe6XTC36cNA10sXRLt2p_TFqjk,1003
49
49
  digitalkin/models/core/task_monitor.py,sha256=CW-jydSgXMV464W0pqfar0HpgqlSxqdujmC-f8p9EQc,2639
50
50
  digitalkin/models/grpc_servers/__init__.py,sha256=0tA71nPSXgRrh9DoLvx-TSwZXdYIRUEItoadpTL1cTo,42
51
- digitalkin/models/grpc_servers/models.py,sha256=gRX94eL71a5mLIie-lCOwE7a0As_AuGduxPPzTHbAe4,13797
51
+ digitalkin/models/grpc_servers/models.py,sha256=kuoH2QTZwbUa8HsB5e7hm9X2S5tCqKArFKhYxGmaozE,13917
52
52
  digitalkin/models/grpc_servers/types.py,sha256=rQ78s4nAet2jy-NIDj_PUWriT0kuGHr_w6ELjmjgBao,539
53
53
  digitalkin/models/module/__init__.py,sha256=YDOsaX-4fYaZR6Cs3ksTr6pa0LSzo7lvSzWftLZJuwU,913
54
54
  digitalkin/models/module/base_types.py,sha256=oIylVNqo0idTFj4dRgCt7P19daNZ-AlvgCPpL9TJvto,1850
@@ -57,7 +57,7 @@ digitalkin/models/module/module_context.py,sha256=kwaAobsA82Du6L0XH9Is9u6Qj1rEjh
57
57
  digitalkin/models/module/module_types.py,sha256=C9azCNBk76xMa-Mww8_6AiwQR8MLAsEyUOvBYxytovI,739
58
58
  digitalkin/models/module/setup_types.py,sha256=Jh6zkSoKTdRTU2YsSoLGrVquLcYHvSeFUX9jpEiZyLU,19268
59
59
  digitalkin/models/module/tool_cache.py,sha256=xCOH2tr7MN0-b3B_8If3mZvoingJsJB4M032ajfdmIA,6623
60
- digitalkin/models/module/tool_reference.py,sha256=l1g9p26adO93wSsvtXd4AEtwxceI82lJg96QMAsPjTI,5456
60
+ digitalkin/models/module/tool_reference.py,sha256=ukcq5TdCbJ28ef41vAcNzTqYSH68Kz7h9hPYKwWutvE,5532
61
61
  digitalkin/models/module/utility.py,sha256=gnbYfWpXGbomUI0fWf7T-Qm_VvT-LXDv1OuA9zObwVg,5589
62
62
  digitalkin/models/services/__init__.py,sha256=jhfVw6egq0OcHmos_fypH9XFehbHTBw09wluVFVFEyw,226
63
63
  digitalkin/models/services/cost.py,sha256=9PXvd5RrIk9vCrRjcUGQ9ZyAokEbwLg4s0RfnE-aLP4,1616
@@ -123,7 +123,7 @@ digitalkin/utils/dynamic_schema.py,sha256=y5csxjuqVHjWDpnTUzxbcUuI_wou9-ibRVHQlB
123
123
  digitalkin/utils/llm_ready_schema.py,sha256=JjMug_lrQllqFoanaC091VgOqwAd-_YzcpqFlS7p778,2375
124
124
  digitalkin/utils/package_discover.py,sha256=sa6Zp5Kape1Zr4iYiNrnZxiHDnqM06ODk6yfWHom53w,13465
125
125
  digitalkin/utils/schema_splitter.py,sha256=lMaReyLD4kGAZSQ9MSxpNZ4D4luWANVArFqNWV_bsko,14040
126
- digitalkin-0.3.2.dev30.dist-info/licenses/LICENSE,sha256=Ies4HFv2r2hzDRakJYxk3Y60uDFLiG-orIgeTpstnIo,20327
126
+ digitalkin-0.3.2.dev31.dist-info/licenses/LICENSE,sha256=Ies4HFv2r2hzDRakJYxk3Y60uDFLiG-orIgeTpstnIo,20327
127
127
  modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
128
128
  modules/archetype_with_tools_module.py,sha256=kJkVhAFWG0aDDqzupOXOnV3l8j3z5bEdWos_6Z9rUP8,7303
129
129
  modules/cpu_intensive_module.py,sha256=GZlirQDZdYuXrI46sv1q4RNAHZjL4EptHVQTvgK9zz8,8363
@@ -138,7 +138,7 @@ monitoring/digitalkin_observability/prometheus.py,sha256=gDmM9ySaVwPAe7Yg84pLxmE
138
138
  monitoring/tests/test_metrics.py,sha256=ugnYfAwqBPO6zA8z4afKTlyBWECTivacYSN-URQCn2E,5856
139
139
  services/filesystem_module.py,sha256=U4dgqtuDadaXz8PJ1d_uQ_1EPncBqudAQCLUICF9yL4,7421
140
140
  services/storage_module.py,sha256=Wz2MzLvqs2D_bnBBgtnujYcAKK2V2KFMk8K21RoepSE,6972
141
- digitalkin-0.3.2.dev30.dist-info/METADATA,sha256=p61ucL27xrbUi7r5PXTNAiQqdV5p_3a1PogbLEvK0mk,29725
142
- digitalkin-0.3.2.dev30.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
143
- digitalkin-0.3.2.dev30.dist-info/top_level.txt,sha256=AYVIesKrO0jnedQ-Muog9JBehG81WeTCNeOFoJgwsgE,51
144
- digitalkin-0.3.2.dev30.dist-info/RECORD,,
141
+ digitalkin-0.3.2.dev31.dist-info/METADATA,sha256=4pklHW30QXZCWTIYNLogl660JTW4KkN7CUbK52NfFE0,29725
142
+ digitalkin-0.3.2.dev31.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
143
+ digitalkin-0.3.2.dev31.dist-info/top_level.txt,sha256=AYVIesKrO0jnedQ-Muog9JBehG81WeTCNeOFoJgwsgE,51
144
+ digitalkin-0.3.2.dev31.dist-info/RECORD,,