model-compose 0.0.9__tar.gz → 0.0.11__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.
- {model_compose-0.0.9/src/model_compose.egg-info → model_compose-0.0.11}/PKG-INFO +1 -1
- {model_compose-0.0.9 → model_compose-0.0.11}/pyproject.toml +1 -1
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/component/engine/http_client.py +11 -8
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/listener/engine/http_callback.py +18 -2
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/action/impl/http_client.py +9 -2
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/listener/impl/http_callback.py +10 -0
- {model_compose-0.0.9 → model_compose-0.0.11/src/model_compose.egg-info}/PKG-INFO +1 -1
- {model_compose-0.0.9 → model_compose-0.0.11}/LICENSE +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/README.md +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/setup.cfg +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/cli/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/cli/compose.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/component/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/component/component.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/component/engine/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/component/engine/base.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/component/engine/context.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/component/engine/http_server.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/compose/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/compose/compose.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/compose/manager.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/controller/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/controller/controller.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/controller/engine/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/controller/engine/base.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/controller/engine/http_server.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/controller/engine/mcp_server.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/gateway/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/gateway/engine/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/gateway/engine/base.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/gateway/engine/http_tunnel.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/gateway/gateway.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/listener/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/listener/engine/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/listener/engine/base.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/listener/listener.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/runtime/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/runtime/env.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/services/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/services/async_service.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/utils/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/utils/expiring.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/utils/http_client.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/utils/http_headers.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/utils/resources.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/utils/template.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/utils/time.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/utils/workqueue.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/workflow/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/workflow/context.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/workflow/job.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/workflow/workflow.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/loader.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/action/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/action/action.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/action/impl/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/action/impl/common.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/action/impl/http_server.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/action/impl/mcp_client.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/action/impl/mcp_server.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/component/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/component/component.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/component/impl/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/component/impl/common.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/component/impl/http_client.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/component/impl/http_server.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/component/impl/mcp_client.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/component/impl/mcp_server.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/component/impl/types.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/compose.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/controller/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/controller/controller.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/controller/impl/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/controller/impl/common.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/controller/impl/http_server.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/controller/impl/mcp_server.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/controller/impl/types.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/gateway/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/gateway/gateway.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/gateway/impl/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/gateway/impl/common.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/gateway/impl/http_tunnel.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/gateway/impl/types.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/listener/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/listener/impl/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/listener/impl/common.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/listener/impl/types.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/listener/listener.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/runtime/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/runtime/impl/__init__.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/runtime/impl/common.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/runtime/impl/docker.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/runtime/impl/types.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/runtime/runtime.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/workflow.py +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/model_compose.egg-info/SOURCES.txt +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/model_compose.egg-info/dependency_links.txt +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/model_compose.egg-info/entry_points.txt +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/model_compose.egg-info/requires.txt +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/src/model_compose.egg-info/top_level.txt +0 -0
- {model_compose-0.0.9 → model_compose-0.0.11}/tests/test_cli.py +0 -0
{model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/component/engine/http_client.py
RENAMED
|
@@ -31,20 +31,23 @@ class HttpClientPollingCompletion:
|
|
|
31
31
|
while datetime.now(timezone.utc) < deadline:
|
|
32
32
|
response = await self.client.request(url, method, params, body, headers)
|
|
33
33
|
|
|
34
|
-
context.register_source("
|
|
34
|
+
context.register_source("result", response)
|
|
35
35
|
status = context.render_template(self.config.status) if self.config.status else response["status"]
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
if not status:
|
|
38
|
+
raise RuntimeError(f"Polling failed: no status found in response.")
|
|
39
|
+
|
|
40
|
+
for success_when in self.config.success_when if self.config.success_when else [ "completed" ]:
|
|
41
|
+
if status == context.render_template(success_when):
|
|
42
|
+
return response
|
|
40
43
|
|
|
41
|
-
fail_when
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
for fail_when in self.config.fail_when if self.config.fail_when else [ "failed" ]:
|
|
45
|
+
if status == context.render_template(fail_when):
|
|
46
|
+
raise RuntimeError(f"Polling failed: status '{status}' matched a failure condition.")
|
|
44
47
|
|
|
45
48
|
await asyncio.sleep(interval.total_seconds())
|
|
46
49
|
|
|
47
|
-
raise TimeoutError(f"Polling timed out after {timeout}")
|
|
50
|
+
raise TimeoutError(f"Polling timed out after {timeout}.")
|
|
48
51
|
|
|
49
52
|
def _resolve_request_url(self, context: ComponentContext) -> str:
|
|
50
53
|
if self.base_url and self.config.path:
|
{model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/listener/engine/http_callback.py
RENAMED
|
@@ -68,20 +68,36 @@ class HttpCallbackListener(BaseListener):
|
|
|
68
68
|
def _make_callback_handler(self, callback: HttpCallbackConfig) -> Callable:
|
|
69
69
|
async def handler(request: Request) -> Response:
|
|
70
70
|
body, query = await self._parse_request_content(request), request.query_params
|
|
71
|
-
context = HttpCallbackContext(body, query, callback.bulk, callback.item)
|
|
71
|
+
context: HttpCallbackContext = HttpCallbackContext(body, query, callback.bulk, callback.item)
|
|
72
|
+
succeeded: bool = self._is_callback_succeeded(callback, context)
|
|
72
73
|
|
|
73
74
|
for item in context.items():
|
|
74
75
|
callback_id = item.render_template(callback.identify_by)
|
|
75
76
|
future: asyncio.Future = self._get_pending_future(callback_id)
|
|
76
77
|
|
|
77
78
|
if future:
|
|
78
|
-
|
|
79
|
+
if succeeded:
|
|
80
|
+
future.set_result(item.render_template(callback.result) if callback.result else item.body)
|
|
81
|
+
else:
|
|
82
|
+
future.set_exception(RuntimeError(f"Task failed for '{callback_id}'"))
|
|
79
83
|
self._remove_pending_future(callback_id)
|
|
80
84
|
|
|
81
85
|
return Response()
|
|
82
86
|
|
|
83
87
|
return handler
|
|
84
88
|
|
|
89
|
+
def _is_callback_succeeded(self, callback: HttpCallbackConfig, context: HttpCallbackContext) -> bool:
|
|
90
|
+
status = context.render_template(callback.status) if callback.status else None
|
|
91
|
+
|
|
92
|
+
if status:
|
|
93
|
+
if callback.success_when and status == context.render_template(callback.success_when):
|
|
94
|
+
return True
|
|
95
|
+
|
|
96
|
+
if callback.fail_when and status == context.render_template(callback.fail_when):
|
|
97
|
+
return False
|
|
98
|
+
|
|
99
|
+
return True
|
|
100
|
+
|
|
85
101
|
async def _parse_request_content(self, request: Request) -> Any:
|
|
86
102
|
content_type, _ = parse_options_header(request.headers.get("Content-Type", ""))
|
|
87
103
|
|
{model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/action/impl/http_client.py
RENAMED
|
@@ -15,8 +15,8 @@ class PollingCompletionConfig(CommonCompletionConfig):
|
|
|
15
15
|
body: Optional[Dict[str, Any]] = Field(default_factory=dict)
|
|
16
16
|
params: Optional[Dict[str, str]] = Field(default_factory=dict)
|
|
17
17
|
status: Optional[str] = None
|
|
18
|
-
success_when: Optional[str] = None
|
|
19
|
-
fail_when: Optional[str] = None
|
|
18
|
+
success_when: Optional[List[str]] = None
|
|
19
|
+
fail_when: Optional[List[str]] = None
|
|
20
20
|
interval: Optional[str] = None
|
|
21
21
|
timeout: Optional[str] = None
|
|
22
22
|
|
|
@@ -26,6 +26,13 @@ class PollingCompletionConfig(CommonCompletionConfig):
|
|
|
26
26
|
raise ValueError("Either 'endpoint' or 'path' must be set, but not both.")
|
|
27
27
|
return values
|
|
28
28
|
|
|
29
|
+
@model_validator(mode="before")
|
|
30
|
+
def normalize_status_fields(cls, values: Dict[str, Any]):
|
|
31
|
+
for key in ("success_when", "fail_when"):
|
|
32
|
+
if isinstance(values.get(key), str):
|
|
33
|
+
values[key] = [ values[key] ]
|
|
34
|
+
return values
|
|
35
|
+
|
|
29
36
|
class CallbackCompletionConfig(CommonCompletionConfig):
|
|
30
37
|
type: Literal["callback"]
|
|
31
38
|
wait_for: str
|
{model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/listener/impl/http_callback.py
RENAMED
|
@@ -9,8 +9,18 @@ class HttpCallbackConfig(BaseModel):
|
|
|
9
9
|
bulk: bool = False
|
|
10
10
|
item: Optional[str] = None
|
|
11
11
|
identify_by: str
|
|
12
|
+
status: Optional[str] = None
|
|
13
|
+
success_when: Optional[List[str]] = None
|
|
14
|
+
fail_when: Optional[List[str]] = None
|
|
12
15
|
result: Optional[Any] = None
|
|
13
16
|
|
|
17
|
+
@model_validator(mode="before")
|
|
18
|
+
def normalize_status_fields(cls, values: Dict[str, Any]):
|
|
19
|
+
for key in [ "success_when", "fail_when" ]:
|
|
20
|
+
if isinstance(values.get(key), str):
|
|
21
|
+
values[key] = [ values[key] ]
|
|
22
|
+
return values
|
|
23
|
+
|
|
14
24
|
class HttpCallbackListenerConfig(CommonListenerConfig):
|
|
15
25
|
type: Literal[ListenerType.HTTP_CALLBACK]
|
|
16
26
|
host: Optional[str] = "0.0.0.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/component/engine/http_server.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/controller/engine/http_server.py
RENAMED
|
File without changes
|
{model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/core/controller/engine/mcp_server.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/action/impl/http_server.py
RENAMED
|
File without changes
|
{model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/action/impl/mcp_client.py
RENAMED
|
File without changes
|
{model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/action/impl/mcp_server.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/component/impl/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/component/impl/http_client.py
RENAMED
|
File without changes
|
{model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/component/impl/http_server.py
RENAMED
|
File without changes
|
{model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/component/impl/mcp_client.py
RENAMED
|
File without changes
|
{model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/component/impl/mcp_server.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/controller/impl/__init__.py
RENAMED
|
File without changes
|
{model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/controller/impl/common.py
RENAMED
|
File without changes
|
{model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/controller/impl/http_server.py
RENAMED
|
File without changes
|
{model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/controller/impl/mcp_server.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/gateway/impl/http_tunnel.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{model_compose-0.0.9 → model_compose-0.0.11}/src/mindor/dsl/schema/listener/impl/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{model_compose-0.0.9 → model_compose-0.0.11}/src/model_compose.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|