execution-plane-client 0.1.19__tar.gz → 0.1.20__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.
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/PKG-INFO +17 -10
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/README.md +16 -9
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/_version.py +2 -2
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/catalog.py +5 -7
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/commands/base.py +5 -20
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/commands/control.py +17 -7
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/commands/credentials.py +16 -5
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/commands/results.py +6 -2
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/commands/work.py +18 -7
- execution_plane_client-0.1.20/models/runtime_context.py +22 -0
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/models/work_item.py +9 -1
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/protocol.py +22 -25
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/.gitignore +0 -0
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/LICENSE +0 -0
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/__init__.py +0 -0
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/commands/__init__.py +0 -0
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/commands/clusters.py +0 -0
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/commands/targets.py +0 -0
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/errors.py +0 -0
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/handlers.py +0 -0
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/models/__init__.py +0 -0
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/models/cluster.py +0 -0
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/models/execution_target.py +0 -0
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/models/shared.py +0 -0
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/py.typed +0 -0
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/pyproject.toml +0 -0
- {execution_plane_client-0.1.19 → execution_plane_client-0.1.20}/registry.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: execution-plane-client
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.20
|
|
4
4
|
Summary: Shared execution-plane command, response, and handler contracts
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
License-File: LICENSE
|
|
@@ -47,12 +47,19 @@ Every concrete command supports this method, including `ClusterDelete`,
|
|
|
47
47
|
`TargetDelete` and `TargetHealth`. Partial updates serialize only supplied fields, retaining explicit
|
|
48
48
|
nulls and placement discriminators without resetting omitted configuration.
|
|
49
49
|
|
|
50
|
-
By default, each call generates
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
By default, each call generates an independent message UUID and UTC timestamp.
|
|
51
|
+
Keep the returned message for retries, or pass `message_id` and `occurred_at` to
|
|
52
|
+
reconstruct a delivery. Message IDs correlate receipts, not resource identity
|
|
53
|
+
or deduplication. Source, destination and client scope are always supplied by
|
|
54
|
+
the caller; the helper does not authenticate them.
|
|
55
|
+
|
|
56
|
+
`WorkExecute` requires a caller-assigned `work_item_id`, which becomes the new
|
|
57
|
+
WorkItem's primary key. Submitting an existing ID returns HTTP 409. Use that same
|
|
58
|
+
ID for `WorkCancel`, `Completion`, and `CredentialResolveWorkload` requests.
|
|
59
|
+
|
|
60
|
+
Work execution accepts optional non-secret `runtime_context`, passed to the
|
|
61
|
+
plugin and included in work-item reads and completion notifications. See
|
|
62
|
+
[runtime context](../../docs/integration.md#runtime-context) for examples and filtering.
|
|
56
63
|
|
|
57
64
|
## Handling messages
|
|
58
65
|
|
|
@@ -66,10 +73,10 @@ result = await handler.handle(message, payload, context)
|
|
|
66
73
|
```
|
|
67
74
|
|
|
68
75
|
Handlers implement `handle(message, payload, context)`. The catalog selects the
|
|
69
|
-
payload model by command type and revision
|
|
70
|
-
|
|
76
|
+
payload model by command type and revision and validates its fields. Handlers
|
|
77
|
+
narrow the payload to their supported command
|
|
71
78
|
types without parsing the raw dictionary again. The original envelope remains
|
|
72
|
-
available for
|
|
79
|
+
available for routing and receipt correlation; partial-update payloads retain which
|
|
73
80
|
fields were supplied. Authentication, authorization and domain-state validation
|
|
74
81
|
(including validation after merging a patch) remain participant responsibilities.
|
|
75
82
|
|
|
@@ -37,12 +37,19 @@ Every concrete command supports this method, including `ClusterDelete`,
|
|
|
37
37
|
`TargetDelete` and `TargetHealth`. Partial updates serialize only supplied fields, retaining explicit
|
|
38
38
|
nulls and placement discriminators without resetting omitted configuration.
|
|
39
39
|
|
|
40
|
-
By default, each call generates
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
By default, each call generates an independent message UUID and UTC timestamp.
|
|
41
|
+
Keep the returned message for retries, or pass `message_id` and `occurred_at` to
|
|
42
|
+
reconstruct a delivery. Message IDs correlate receipts, not resource identity
|
|
43
|
+
or deduplication. Source, destination and client scope are always supplied by
|
|
44
|
+
the caller; the helper does not authenticate them.
|
|
45
|
+
|
|
46
|
+
`WorkExecute` requires a caller-assigned `work_item_id`, which becomes the new
|
|
47
|
+
WorkItem's primary key. Submitting an existing ID returns HTTP 409. Use that same
|
|
48
|
+
ID for `WorkCancel`, `Completion`, and `CredentialResolveWorkload` requests.
|
|
49
|
+
|
|
50
|
+
Work execution accepts optional non-secret `runtime_context`, passed to the
|
|
51
|
+
plugin and included in work-item reads and completion notifications. See
|
|
52
|
+
[runtime context](../../docs/integration.md#runtime-context) for examples and filtering.
|
|
46
53
|
|
|
47
54
|
## Handling messages
|
|
48
55
|
|
|
@@ -56,10 +63,10 @@ result = await handler.handle(message, payload, context)
|
|
|
56
63
|
```
|
|
57
64
|
|
|
58
65
|
Handlers implement `handle(message, payload, context)`. The catalog selects the
|
|
59
|
-
payload model by command type and revision
|
|
60
|
-
|
|
66
|
+
payload model by command type and revision and validates its fields. Handlers
|
|
67
|
+
narrow the payload to their supported command
|
|
61
68
|
types without parsing the raw dictionary again. The original envelope remains
|
|
62
|
-
available for
|
|
69
|
+
available for routing and receipt correlation; partial-update payloads retain which
|
|
63
70
|
fields were supplied. Authentication, authorization and domain-state validation
|
|
64
71
|
(including validation after merging a patch) remain participant responsibilities.
|
|
65
72
|
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.1.
|
|
22
|
-
__version_tuple__ = version_tuple = (0, 1,
|
|
21
|
+
__version__ = version = '0.1.20'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 1, 20)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -4,7 +4,7 @@ from dataclasses import dataclass
|
|
|
4
4
|
|
|
5
5
|
from execution_plane_client.commands.base import CommandPayload
|
|
6
6
|
from execution_plane_client.commands.clusters import ClusterDelete, ClusterRegister, ClusterUpdate
|
|
7
|
-
from execution_plane_client.commands.control import
|
|
7
|
+
from execution_plane_client.commands.control import Completion, WorkCancel
|
|
8
8
|
from execution_plane_client.commands.credentials import CredentialResolve, CredentialResolveWorkload
|
|
9
9
|
from execution_plane_client.commands.targets import TargetDelete, TargetHealth, TargetRegister, TargetUpdate
|
|
10
10
|
from execution_plane_client.commands.work import WorkExecute
|
|
@@ -25,7 +25,7 @@ class CommandCatalog:
|
|
|
25
25
|
"""Validate known commands independently of installed handlers."""
|
|
26
26
|
|
|
27
27
|
def __init__(self) -> None:
|
|
28
|
-
"""Install
|
|
28
|
+
"""Install supported work, resource and completion contracts."""
|
|
29
29
|
payloads = (
|
|
30
30
|
WorkExecute,
|
|
31
31
|
Completion,
|
|
@@ -38,7 +38,7 @@ class CommandCatalog:
|
|
|
38
38
|
TargetUpdate,
|
|
39
39
|
TargetDelete,
|
|
40
40
|
TargetHealth,
|
|
41
|
-
|
|
41
|
+
WorkCancel,
|
|
42
42
|
)
|
|
43
43
|
self._definitions = {
|
|
44
44
|
(schema.command_type, schema.command_revision): CommandDefinition(
|
|
@@ -55,8 +55,6 @@ class CommandCatalog:
|
|
|
55
55
|
raise UnsupportedCommand from None
|
|
56
56
|
|
|
57
57
|
def validate(self, message: MessageEnvelope) -> CommandPayload:
|
|
58
|
-
"""Validate the
|
|
58
|
+
"""Validate the typed command payload, returning the typed payload."""
|
|
59
59
|
definition = self.definition(message.command.command_type, message.command.command_revision)
|
|
60
|
-
|
|
61
|
-
definition.payload_schema.validate_parent(message.command.parent_command_id)
|
|
62
|
-
return payload
|
|
60
|
+
return definition.payload_schema.model_validate(message.command.payload)
|
|
@@ -4,7 +4,6 @@ from datetime import UTC, datetime
|
|
|
4
4
|
from typing import ClassVar
|
|
5
5
|
from uuid import UUID, uuid4
|
|
6
6
|
|
|
7
|
-
from execution_plane_client.errors import ProtocolConflict
|
|
8
7
|
from execution_plane_client.protocol import Command, CommandScope, MessageEnvelope, WireModel
|
|
9
8
|
|
|
10
9
|
|
|
@@ -13,13 +12,6 @@ class CommandPayload(WireModel):
|
|
|
13
12
|
|
|
14
13
|
command_type: ClassVar[str]
|
|
15
14
|
command_revision: ClassVar[int] = 1
|
|
16
|
-
requires_parent: ClassVar[bool] = False
|
|
17
|
-
|
|
18
|
-
@classmethod
|
|
19
|
-
def validate_parent(cls, parent_command_id: UUID | None) -> None:
|
|
20
|
-
"""Require correlation for commands that report another command's outcome."""
|
|
21
|
-
if cls.requires_parent and parent_command_id is None:
|
|
22
|
-
raise ProtocolConflict
|
|
23
15
|
|
|
24
16
|
def _message_payload(self) -> dict[str, object]:
|
|
25
17
|
return self.model_dump(mode="json")
|
|
@@ -30,32 +22,25 @@ class CommandPayload(WireModel):
|
|
|
30
22
|
source_id: str,
|
|
31
23
|
destination_id: str,
|
|
32
24
|
client_id: str,
|
|
33
|
-
command_id: UUID | None = None,
|
|
34
|
-
parent_command_id: UUID | None = None,
|
|
35
25
|
occurred_at: datetime | None = None,
|
|
36
26
|
message_id: UUID | None = None,
|
|
37
27
|
sequence: int = 0,
|
|
38
28
|
) -> MessageEnvelope:
|
|
39
|
-
"""Build a
|
|
29
|
+
"""Build a delivery message with an independent UUID and UTC timestamp.
|
|
40
30
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
Retain the returned message or supply message_id and occurred_at to
|
|
32
|
+
reconstruct a delivery. Resource identity belongs to the typed payload;
|
|
33
|
+
message_id only correlates the transport receipt, not deduplication.
|
|
44
34
|
"""
|
|
45
|
-
self.validate_parent(parent_command_id)
|
|
46
35
|
payload = self._message_payload()
|
|
47
36
|
type(self).model_validate(payload)
|
|
48
|
-
identity = uuid4() if command_id is None else command_id
|
|
49
37
|
return MessageEnvelope(
|
|
50
|
-
message_id=
|
|
51
|
-
command_id=identity,
|
|
38
|
+
message_id=uuid4() if message_id is None else message_id,
|
|
52
39
|
source_id=source_id,
|
|
53
40
|
destination_id=destination_id,
|
|
54
41
|
scope=CommandScope(client_id=client_id),
|
|
55
42
|
sequence=sequence,
|
|
56
43
|
command=Command(
|
|
57
|
-
command_id=identity,
|
|
58
|
-
parent_command_id=parent_command_id,
|
|
59
44
|
command_type=self.command_type,
|
|
60
45
|
command_revision=self.command_revision,
|
|
61
46
|
payload=payload,
|
|
@@ -7,16 +7,19 @@ from uuid import UUID
|
|
|
7
7
|
from pydantic import Field, field_validator
|
|
8
8
|
|
|
9
9
|
from execution_plane_client.commands.base import CommandPayload
|
|
10
|
+
from execution_plane_client.models.runtime_context import RuntimeContext
|
|
10
11
|
from execution_plane_client.models.work_item import WorkItemStatus
|
|
11
|
-
from execution_plane_client.protocol import
|
|
12
|
+
from execution_plane_client.protocol import validate_json
|
|
12
13
|
|
|
13
14
|
|
|
14
|
-
class
|
|
15
|
-
"""
|
|
15
|
+
class WorkCancel(CommandPayload):
|
|
16
|
+
"""Request cancellation of an existing work item."""
|
|
16
17
|
|
|
17
|
-
command_type: ClassVar[str] = "
|
|
18
|
+
command_type: ClassVar[str] = "work.cancel"
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
work_item_id: UUID = Field(
|
|
21
|
+
description="Primary key (WorkItem.id) of the existing EP work item to cancel within the authenticated client."
|
|
22
|
+
)
|
|
20
23
|
|
|
21
24
|
|
|
22
25
|
class CompletionStatus(StrEnum):
|
|
@@ -32,11 +35,18 @@ class Completion(CommandPayload):
|
|
|
32
35
|
"""Terminal or uncertain work outcome delivered to the initiating client."""
|
|
33
36
|
|
|
34
37
|
command_type: ClassVar[str] = "work.execute.completed"
|
|
35
|
-
|
|
38
|
+
command_revision: ClassVar[int] = 1
|
|
39
|
+
|
|
40
|
+
work_item_id: UUID = Field(
|
|
41
|
+
description=(
|
|
42
|
+
"Primary key (WorkItem.id) supplied when this work was created; identifies the item whose outcome "
|
|
43
|
+
"is reported. Syntara uses it to look up ActivityExecution.id."
|
|
44
|
+
)
|
|
45
|
+
)
|
|
46
|
+
runtime_context: RuntimeContext = Field(default_factory=dict, repr=False)
|
|
36
47
|
|
|
37
48
|
status: CompletionStatus
|
|
38
49
|
result: dict[str, object] = Field(default_factory=dict, repr=False)
|
|
39
|
-
resource: ResourceReference | None = None
|
|
40
50
|
error_code: str | None = None
|
|
41
51
|
|
|
42
52
|
@field_validator("result", mode="before")
|
|
@@ -23,15 +23,26 @@ class CredentialResolve(CommandPayload):
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
class CredentialResolveWorkload(CommandPayload):
|
|
26
|
-
"""Resolve one credential reference for the work item
|
|
26
|
+
"""Resolve one credential reference for the identified work item."""
|
|
27
27
|
|
|
28
28
|
command_type: ClassVar[str] = "credential.resolve.workload"
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
command_revision: ClassVar[int] = 1
|
|
30
|
+
work_item_id: UUID = Field(
|
|
31
|
+
description=(
|
|
32
|
+
"Primary key (WorkItem.id) of the EP work item requesting credentials. Syntara uses it to look up "
|
|
33
|
+
"ActivityExecution.id and verify the credential binding for that work."
|
|
34
|
+
)
|
|
35
|
+
)
|
|
36
|
+
attempt_id: Identifier = Field(
|
|
37
|
+
description="EP dispatch-attempt identifier, sent to the plugin as invocation_id; distinct from WorkItem.id."
|
|
38
|
+
)
|
|
31
39
|
credential_ref: UUID = Field(
|
|
32
40
|
repr=False,
|
|
33
41
|
description="Opaque AO credential reference bound to the requested recipe.",
|
|
34
42
|
)
|
|
35
43
|
credential_recipe_id: CredentialRecipeId = Field(description="Logical Plugin SDK recipe requested by the workload.")
|
|
36
|
-
|
|
37
|
-
|
|
44
|
+
step_revision_id: StepIdentity = Field(
|
|
45
|
+
description=(
|
|
46
|
+
"Handler identifier from this work item's invocation; identifies the implementation requesting credentials."
|
|
47
|
+
)
|
|
48
|
+
)
|
|
@@ -26,7 +26,9 @@ class CredentialResolveWorkloadCommandResult(WireModel):
|
|
|
26
26
|
"""Typed result returned for a workload credential-resolution command."""
|
|
27
27
|
|
|
28
28
|
command_type: Literal["credential.resolve.workload"] = "credential.resolve.workload"
|
|
29
|
-
command_revision: Literal[1] =
|
|
29
|
+
command_revision: Literal[1] = Field(
|
|
30
|
+
default=1, description="Payload contract version for credential.resolve.workload; matches the request revision."
|
|
31
|
+
)
|
|
30
32
|
credential: dict[
|
|
31
33
|
Annotated[StrictStr, Field(min_length=1, max_length=128)],
|
|
32
34
|
Annotated[StrictStr, Field(min_length=1, max_length=8192)],
|
|
@@ -69,6 +71,8 @@ class TransportReceipt(WireModel):
|
|
|
69
71
|
"""Receipt of a handled request, without a persisted command record."""
|
|
70
72
|
|
|
71
73
|
received: Literal[True] = True
|
|
72
|
-
message_id: UUID
|
|
74
|
+
message_id: UUID = Field(
|
|
75
|
+
description="The received delivery message's UUID, echoed so the sender can match this receipt."
|
|
76
|
+
)
|
|
73
77
|
resource: ResourceReference | None = None
|
|
74
78
|
result: CommandResult | None = None
|
|
@@ -6,6 +6,7 @@ from uuid import UUID
|
|
|
6
6
|
from pydantic import Field, StrictStr, field_validator
|
|
7
7
|
|
|
8
8
|
from execution_plane_client.commands.base import CommandPayload
|
|
9
|
+
from execution_plane_client.models.runtime_context import RuntimeContext
|
|
9
10
|
from execution_plane_client.protocol import PositiveInt, WireModel, validate_json
|
|
10
11
|
|
|
11
12
|
StepIdentity = Annotated[StrictStr, Field(min_length=1, max_length=256, pattern=r"^[A-Za-z0-9._:-]+$")]
|
|
@@ -36,17 +37,15 @@ class WorkloadInvocation(WireModel):
|
|
|
36
37
|
claim that arbitrary file paths have been mounted by EP.
|
|
37
38
|
"""
|
|
38
39
|
|
|
39
|
-
workflow_run_id: StepIdentity = Field(description="Caller-owned identity of the workflow run containing this step.")
|
|
40
40
|
step_revision_id: StepIdentity = Field(
|
|
41
|
-
description=
|
|
41
|
+
description=(
|
|
42
|
+
"Handler identifier advertised by the selected workload image. The plugin runtime uses it to select "
|
|
43
|
+
"the step implementation; it does not identify this work item or an execution."
|
|
44
|
+
)
|
|
42
45
|
)
|
|
43
46
|
inputs: dict[str, object] = Field(
|
|
44
47
|
description="Step inputs defined by the selected workload; never use this field for credential bindings."
|
|
45
48
|
)
|
|
46
|
-
runtime_context: dict[str, object] = Field(
|
|
47
|
-
default_factory=dict,
|
|
48
|
-
description="Non-secret execution context supplied to the workload; not for credential bindings.",
|
|
49
|
-
)
|
|
50
49
|
credential_bindings: list[WorkCredentialBinding] = Field(
|
|
51
50
|
default_factory=list,
|
|
52
51
|
max_length=16,
|
|
@@ -61,7 +60,7 @@ class WorkloadInvocation(WireModel):
|
|
|
61
60
|
),
|
|
62
61
|
]
|
|
63
62
|
|
|
64
|
-
@field_validator("inputs",
|
|
63
|
+
@field_validator("inputs", mode="before")
|
|
65
64
|
@classmethod
|
|
66
65
|
def check_json(cls, value: object) -> object:
|
|
67
66
|
"""Keep nested invocation data finite, portable, and bounded."""
|
|
@@ -82,6 +81,18 @@ class WorkExecute(CommandPayload):
|
|
|
82
81
|
"""Schedule one workload implementing the SDK container service."""
|
|
83
82
|
|
|
84
83
|
command_type: ClassVar[str] = "work.execute"
|
|
84
|
+
command_revision: ClassVar[int] = 1
|
|
85
|
+
|
|
86
|
+
work_item_id: UUID = Field(
|
|
87
|
+
description=(
|
|
88
|
+
"Caller-assigned UUID used as the primary key (WorkItem.id) of the new EP work item. "
|
|
89
|
+
"It must be unique across EP work items, including other clients' work. An existing UUID returns "
|
|
90
|
+
"HTTP 409 and never overwrites or reruns that item. On an uncertain submission retry, retain the UUID "
|
|
91
|
+
"and read the existing item after a conflict. Use it for reads, cancellation, completion, and credential "
|
|
92
|
+
"callbacks. Syntara supplies ActivityExecution.id, not the containing Execution.id."
|
|
93
|
+
)
|
|
94
|
+
)
|
|
95
|
+
runtime_context: RuntimeContext = Field(default_factory=dict, repr=False)
|
|
85
96
|
|
|
86
97
|
image: Annotated[
|
|
87
98
|
StrictStr,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""Non-secret caller context shared with the workload."""
|
|
2
|
+
|
|
3
|
+
from typing import Annotated
|
|
4
|
+
|
|
5
|
+
from pydantic import BeforeValidator, Field
|
|
6
|
+
|
|
7
|
+
from execution_plane_client.protocol import validate_json
|
|
8
|
+
|
|
9
|
+
RUNTIME_CONTEXT_DESCRIPTION = (
|
|
10
|
+
"Optional caller-defined JSON object, defaulting to {}. Stored once, unencrypted, on the work item and "
|
|
11
|
+
"passed to the plugin as context.runtime_context; also returned in work-item reads and completion notifications. "
|
|
12
|
+
"Do not include secrets. Syntara supplies project_id (Project.id), workflow_id (Workflow.id), and execution_id "
|
|
13
|
+
"(the containing Execution.id); EP does not require these keys. These values do not authorize access, select "
|
|
14
|
+
"placement, identify the work item, or control its lifecycle. List filters runtime_context[key]=value match "
|
|
15
|
+
"exact JSON strings at literal top-level keys; an empty value checks key existence and multiple keys use AND."
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
RuntimeContext = Annotated[
|
|
19
|
+
dict[str, object],
|
|
20
|
+
BeforeValidator(validate_json),
|
|
21
|
+
Field(description=RUNTIME_CONTEXT_DESCRIPTION),
|
|
22
|
+
]
|
|
@@ -7,6 +7,7 @@ from uuid import UUID
|
|
|
7
7
|
|
|
8
8
|
from pydantic import BaseModel, ConfigDict, Field, StringConstraints
|
|
9
9
|
|
|
10
|
+
from execution_plane_client.models.runtime_context import RuntimeContext
|
|
10
11
|
from execution_plane_client.models.shared import _SORT_PATTERN, EPListParams, ResourcesResponse
|
|
11
12
|
|
|
12
13
|
# Work item query metadata - single source of truth for EP and client
|
|
@@ -48,7 +49,14 @@ class WorkItemRead(BaseModel):
|
|
|
48
49
|
|
|
49
50
|
model_config = ConfigDict(from_attributes=True)
|
|
50
51
|
|
|
51
|
-
id: UUID = Field(
|
|
52
|
+
id: UUID = Field(
|
|
53
|
+
description=(
|
|
54
|
+
"Primary key of this EP work item, equal to work.execute.payload.work_item_id supplied at creation. "
|
|
55
|
+
"Use it to read or cancel this item and correlate completion or credential callbacks. "
|
|
56
|
+
"Syntara uses ActivityExecution.id; runtime_context.execution_id identifies its containing execution."
|
|
57
|
+
)
|
|
58
|
+
)
|
|
59
|
+
runtime_context: RuntimeContext = Field(default_factory=dict)
|
|
52
60
|
status: WorkItemStatus = Field(description="Work item lifecycle status")
|
|
53
61
|
result: dict[str, Any] | None = Field(default=None, description="Work execution result payload")
|
|
54
62
|
result_omitted: bool = Field(default=False, description="Whether result was omitted due to size")
|
|
@@ -4,10 +4,10 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import json
|
|
6
6
|
from datetime import UTC, datetime
|
|
7
|
-
from typing import Annotated, Literal
|
|
7
|
+
from typing import Annotated, Literal
|
|
8
8
|
from uuid import UUID # noqa: TC003 - Pydantic resolves these model fields at runtime.
|
|
9
9
|
|
|
10
|
-
from pydantic import BaseModel, Field, StrictInt, StrictStr, ValidationInfo, field_validator
|
|
10
|
+
from pydantic import BaseModel, Field, StrictInt, StrictStr, ValidationInfo, field_validator
|
|
11
11
|
|
|
12
12
|
MAX_PAYLOAD_BYTES = 512 * 1024
|
|
13
13
|
Identifier = Annotated[StrictStr, Field(min_length=1, max_length=255, pattern=r"^[A-Za-z0-9_.:@/-]+$")]
|
|
@@ -56,10 +56,16 @@ class CommandScope(WireModel):
|
|
|
56
56
|
class Command(WireModel):
|
|
57
57
|
"""One versioned operation; participants persist only its domain effects."""
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
command_type: Annotated[
|
|
60
|
+
StrictStr,
|
|
61
|
+
Field(
|
|
62
|
+
pattern=r"^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$",
|
|
63
|
+
description="Operation to perform; selects the payload contract.",
|
|
64
|
+
),
|
|
65
|
+
]
|
|
66
|
+
command_revision: PositiveInt = Field(
|
|
67
|
+
description="Version of this operation's payload contract, not a resource revision."
|
|
68
|
+
)
|
|
63
69
|
payload: dict[str, object] = Field(repr=False)
|
|
64
70
|
occurred_at: datetime
|
|
65
71
|
|
|
@@ -79,35 +85,23 @@ class Command(WireModel):
|
|
|
79
85
|
raise ValueError(message)
|
|
80
86
|
return value.astimezone(UTC)
|
|
81
87
|
|
|
82
|
-
@model_validator(mode="after")
|
|
83
|
-
def check_parent(self) -> Self:
|
|
84
|
-
"""Reject a command naming itself as its parent."""
|
|
85
|
-
if self.parent_command_id == self.command_id:
|
|
86
|
-
message = "A command cannot be its own parent"
|
|
87
|
-
raise ValueError(message)
|
|
88
|
-
return self
|
|
89
|
-
|
|
90
88
|
|
|
91
89
|
class MessageEnvelope(WireModel):
|
|
92
90
|
"""Participant identity around one logical command."""
|
|
93
91
|
|
|
94
|
-
message_id: UUID
|
|
92
|
+
message_id: UUID = Field(
|
|
93
|
+
description=(
|
|
94
|
+
"UUID assigned by the sender to this delivery message and echoed in its transport receipt. "
|
|
95
|
+
"It does not identify a work item or deduplicate submissions; resource IDs in the payload do that."
|
|
96
|
+
)
|
|
97
|
+
)
|
|
95
98
|
message_type: Literal["command.submit"] = "command.submit"
|
|
96
|
-
command_id: UUID
|
|
97
99
|
sequence: Sequence = 0
|
|
98
100
|
source_id: Identifier
|
|
99
101
|
destination_id: Identifier
|
|
100
102
|
scope: CommandScope
|
|
101
103
|
command: Command
|
|
102
104
|
|
|
103
|
-
@model_validator(mode="after")
|
|
104
|
-
def check_identity(self) -> Self:
|
|
105
|
-
"""Keep the envelope and nested command identity consistent."""
|
|
106
|
-
if self.command_id != self.command.command_id:
|
|
107
|
-
message = "Envelope command_id must match command.command_id"
|
|
108
|
-
raise ValueError(message)
|
|
109
|
-
return self
|
|
110
|
-
|
|
111
105
|
|
|
112
106
|
class ResourceReference(WireModel):
|
|
113
107
|
"""Safe reference from a command to a participant-owned resource."""
|
|
@@ -121,5 +115,8 @@ class ResourceReference(WireModel):
|
|
|
121
115
|
class CapabilitiesRead(WireModel):
|
|
122
116
|
"""Command revisions installed by this participant."""
|
|
123
117
|
|
|
124
|
-
protocol_revision: Literal[1] =
|
|
118
|
+
protocol_revision: Literal[1] = Field(
|
|
119
|
+
default=1,
|
|
120
|
+
description="Envelope contract version; remains 1 during development of the resource-addressed protocol.",
|
|
121
|
+
)
|
|
125
122
|
commands: dict[str, list[int]]
|
|
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
|