execution-plane-client 0.1.16__tar.gz → 0.1.18__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.
Files changed (29) hide show
  1. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/PKG-INFO +2 -4
  2. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/README.md +1 -3
  3. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/_version.py +2 -2
  4. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/catalog.py +2 -1
  5. execution_plane_client-0.1.18/commands/credentials.py +37 -0
  6. execution_plane_client-0.1.18/commands/results.py +74 -0
  7. execution_plane_client-0.1.18/commands/work.py +109 -0
  8. execution_plane_client-0.1.16/commands/credentials.py +0 -15
  9. execution_plane_client-0.1.16/commands/results.py +0 -43
  10. execution_plane_client-0.1.16/commands/work.py +0 -43
  11. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/.gitignore +0 -0
  12. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/LICENSE +0 -0
  13. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/__init__.py +0 -0
  14. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/commands/__init__.py +0 -0
  15. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/commands/base.py +0 -0
  16. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/commands/clusters.py +0 -0
  17. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/commands/control.py +0 -0
  18. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/commands/targets.py +0 -0
  19. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/errors.py +0 -0
  20. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/handlers.py +0 -0
  21. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/models/__init__.py +0 -0
  22. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/models/cluster.py +0 -0
  23. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/models/execution_target.py +0 -0
  24. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/models/shared.py +0 -0
  25. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/models/work_item.py +0 -0
  26. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/protocol.py +0 -0
  27. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/py.typed +0 -0
  28. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/pyproject.toml +0 -0
  29. {execution_plane_client-0.1.16 → execution_plane_client-0.1.18}/registry.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: execution-plane-client
3
- Version: 0.1.16
3
+ Version: 0.1.18
4
4
  Summary: Shared execution-plane command, response, and handler contracts
5
5
  License-Expression: Apache-2.0
6
6
  License-File: LICENSE
@@ -30,11 +30,9 @@ from uuid import uuid4
30
30
  from execution_plane_client.commands.clusters import ClusterRegister
31
31
 
32
32
  message = ClusterRegister(
33
- resource_key=uuid4(),
34
- desired_revision=1,
33
+ resource_id=uuid4(),
35
34
  name="workers",
36
35
  endpoint="https://cluster.example",
37
- namespace="execution-plane",
38
36
  credential_ref=uuid4(),
39
37
  ).to_message(
40
38
  source_id="syntara-orchestration",
@@ -20,11 +20,9 @@ from uuid import uuid4
20
20
  from execution_plane_client.commands.clusters import ClusterRegister
21
21
 
22
22
  message = ClusterRegister(
23
- resource_key=uuid4(),
24
- desired_revision=1,
23
+ resource_id=uuid4(),
25
24
  name="workers",
26
25
  endpoint="https://cluster.example",
27
- namespace="execution-plane",
28
26
  credential_ref=uuid4(),
29
27
  ).to_message(
30
28
  source_id="syntara-orchestration",
@@ -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.16'
22
- __version_tuple__ = version_tuple = (0, 1, 16)
21
+ __version__ = version = '0.1.18'
22
+ __version_tuple__ = version_tuple = (0, 1, 18)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -5,7 +5,7 @@ from dataclasses import dataclass
5
5
  from execution_plane_client.commands.base import CommandPayload
6
6
  from execution_plane_client.commands.clusters import ClusterDelete, ClusterRegister, ClusterUpdate
7
7
  from execution_plane_client.commands.control import CancelCommand, Completion
8
- from execution_plane_client.commands.credentials import CredentialResolve
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
11
11
  from execution_plane_client.errors import UnsupportedCommand
@@ -30,6 +30,7 @@ class CommandCatalog:
30
30
  WorkExecute,
31
31
  Completion,
32
32
  CredentialResolve,
33
+ CredentialResolveWorkload,
33
34
  ClusterRegister,
34
35
  ClusterUpdate,
35
36
  ClusterDelete,
@@ -0,0 +1,37 @@
1
+ """Credential-reference resolution commands."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import ClassVar
6
+ from uuid import UUID # noqa: TC003 - Pydantic evaluates fields.
7
+
8
+ from pydantic import Field
9
+
10
+ from execution_plane_client.commands.base import CommandPayload
11
+ from execution_plane_client.commands.work import CredentialRecipeId, StepIdentity # noqa: TC001
12
+ from execution_plane_client.protocol import Identifier # noqa: TC001
13
+
14
+
15
+ class CredentialResolve(CommandPayload):
16
+ """Resolve an opaque credential reference into a short-lived value."""
17
+
18
+ command_type: ClassVar[str] = "credential.resolve"
19
+ credential_ref: UUID = Field(
20
+ repr=False,
21
+ description="Opaque AO credential reference.",
22
+ )
23
+
24
+
25
+ class CredentialResolveWorkload(CommandPayload):
26
+ """Resolve one credential reference for the work item named by its parent command."""
27
+
28
+ command_type: ClassVar[str] = "credential.resolve.workload"
29
+ requires_parent: ClassVar[bool] = True
30
+ attempt_id: Identifier = Field(description="Execution attempt that owns the workload invocation.")
31
+ credential_ref: UUID = Field(
32
+ repr=False,
33
+ description="Opaque AO credential reference bound to the requested recipe.",
34
+ )
35
+ credential_recipe_id: CredentialRecipeId = Field(description="Logical Plugin SDK recipe requested by the workload.")
36
+ workflow_run_id: StepIdentity = Field(description="Caller-owned workflow run containing the active step.")
37
+ step_revision_id: StepIdentity = Field(description="Workload revision that requested the credential.")
@@ -0,0 +1,74 @@
1
+ """Typed command results and transport receipts."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ from typing import Annotated, Literal
7
+ from uuid import UUID # noqa: TC003 - Pydantic resolves this model field at runtime.
8
+
9
+ from pydantic import Field, StrictBool, StrictStr, field_validator
10
+
11
+ from execution_plane_client.protocol import ResourceReference, WireModel
12
+
13
+ MAX_WORKLOAD_CREDENTIAL_FIELDS = 32
14
+ MAX_WORKLOAD_CREDENTIAL_BYTES = 32 * 1024
15
+
16
+
17
+ class CredentialResolveCommandResult(WireModel):
18
+ """Typed result returned for a credential-resolution command."""
19
+
20
+ command_type: Literal["credential.resolve"] = "credential.resolve"
21
+ command_revision: Literal[1] = 1
22
+ credential: Annotated[StrictStr, Field(min_length=1, max_length=65536, repr=False)]
23
+
24
+
25
+ class CredentialResolveWorkloadCommandResult(WireModel):
26
+ """Typed result returned for a workload credential-resolution command."""
27
+
28
+ command_type: Literal["credential.resolve.workload"] = "credential.resolve.workload"
29
+ command_revision: Literal[1] = 1
30
+ credential: dict[
31
+ Annotated[StrictStr, Field(min_length=1, max_length=128)],
32
+ Annotated[StrictStr, Field(min_length=1, max_length=8192)],
33
+ ] = Field(repr=False)
34
+
35
+ @field_validator("credential")
36
+ @classmethod
37
+ def check_document(cls, value: dict[str, str]) -> dict[str, str]:
38
+ """Bound credential field count and encoded response size."""
39
+ if not value:
40
+ message = "Credential document must not be empty"
41
+ raise ValueError(message)
42
+ if len(value) > MAX_WORKLOAD_CREDENTIAL_FIELDS:
43
+ message = "Credential document must contain at most 32 fields"
44
+ raise ValueError(message)
45
+ encoded = json.dumps(value, ensure_ascii=False, separators=(",", ":")).encode("utf-8")
46
+ if len(encoded) > MAX_WORKLOAD_CREDENTIAL_BYTES:
47
+ message = "Credential document exceeds 32 KiB"
48
+ raise ValueError(message)
49
+ return value
50
+
51
+
52
+ class TargetHealthCommandResult(WireModel):
53
+ """Typed result returned for an execution-target health command."""
54
+
55
+ command_type: Literal["execution_target.health"] = "execution_target.health"
56
+ command_revision: Literal[1] = 1
57
+ healthy: StrictBool
58
+ message: StrictStr | None = None
59
+ skipped: StrictBool = False
60
+
61
+
62
+ CommandResult = Annotated[
63
+ CredentialResolveCommandResult | CredentialResolveWorkloadCommandResult | TargetHealthCommandResult,
64
+ Field(discriminator="command_type"),
65
+ ]
66
+
67
+
68
+ class TransportReceipt(WireModel):
69
+ """Receipt of a handled request, without a persisted command record."""
70
+
71
+ received: Literal[True] = True
72
+ message_id: UUID
73
+ resource: ResourceReference | None = None
74
+ result: CommandResult | None = None
@@ -0,0 +1,109 @@
1
+ """Scheduling commands for the SDK-owned container gRPC contract."""
2
+
3
+ from typing import Annotated, ClassVar, Literal
4
+ from uuid import UUID
5
+
6
+ from pydantic import Field, StrictStr, field_validator
7
+
8
+ from execution_plane_client.commands.base import CommandPayload
9
+ from execution_plane_client.protocol import PositiveInt, WireModel, validate_json
10
+
11
+ StepIdentity = Annotated[StrictStr, Field(min_length=1, max_length=256, pattern=r"^[A-Za-z0-9._:-]+$")]
12
+ CREDENTIAL_RECIPE_ID_PATTERN = r"^[a-z][a-z0-9-]{0,62}(?:\.[a-z][a-z0-9-]{0,62})+$"
13
+ CredentialRecipeId = Annotated[
14
+ StrictStr,
15
+ Field(min_length=1, max_length=256, pattern=CREDENTIAL_RECIPE_ID_PATTERN),
16
+ ]
17
+
18
+
19
+ class WorkCredentialBinding(WireModel):
20
+ """One Plugin SDK recipe-to-AO credential mapping for a work item."""
21
+
22
+ credential_recipe_id: CredentialRecipeId = Field(
23
+ description="Qualified Plugin SDK CredentialRecipe identifier that the workload may request at runtime."
24
+ )
25
+ credential_ref: UUID = Field(
26
+ repr=False,
27
+ description="Opaque AO credential reference; EP resolves it only after the workload requests this recipe.",
28
+ )
29
+
30
+
31
+ class WorkloadInvocation(WireModel):
32
+ """Public invocation data; EP supplies the attempt ID and credential resolver.
33
+
34
+ Script environment variables remain ordinary step inputs. Credential-file
35
+ delivery is not implemented yet, so callers cannot supply secret values or
36
+ claim that arbitrary file paths have been mounted by EP.
37
+ """
38
+
39
+ workflow_run_id: StepIdentity = Field(description="Caller-owned identity of the workflow run containing this step.")
40
+ step_revision_id: StepIdentity = Field(
41
+ description="Workload-advertised revision of the step implementation to execute."
42
+ )
43
+ inputs: dict[str, object] = Field(
44
+ description="Step inputs defined by the selected workload; never use this field for credential bindings."
45
+ )
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
+ credential_bindings: list[WorkCredentialBinding] = Field(
51
+ default_factory=list,
52
+ max_length=16,
53
+ repr=False,
54
+ description="Host-side recipe-to-reference bindings; never plugin inputs or runtime context.",
55
+ )
56
+ timeout_seconds: Annotated[
57
+ PositiveInt,
58
+ Field(
59
+ le=86_400,
60
+ description="Maximum workload execution time in seconds, including SDK streaming but excluding cleanup.",
61
+ ),
62
+ ]
63
+
64
+ @field_validator("inputs", "runtime_context", mode="before")
65
+ @classmethod
66
+ def check_json(cls, value: object) -> object:
67
+ """Keep nested invocation data finite, portable, and bounded."""
68
+ return validate_json(value)
69
+
70
+ @field_validator("credential_bindings")
71
+ @classmethod
72
+ def check_unique_recipe_ids(cls, value: list[WorkCredentialBinding]) -> list[WorkCredentialBinding]:
73
+ """Reject duplicate recipe IDs before host-side credential resolution."""
74
+ recipe_ids = [binding.credential_recipe_id for binding in value]
75
+ if len(set(recipe_ids)) != len(recipe_ids):
76
+ message = "Credential bindings must have unique credential recipe IDs"
77
+ raise ValueError(message)
78
+ return value
79
+
80
+
81
+ class WorkExecute(CommandPayload):
82
+ """Schedule one workload implementing the SDK container service."""
83
+
84
+ command_type: ClassVar[str] = "work.execute"
85
+
86
+ image: Annotated[
87
+ StrictStr,
88
+ Field(
89
+ min_length=1,
90
+ max_length=2048,
91
+ description="OCI image reference for the isolated cold-start workload container.",
92
+ ),
93
+ ]
94
+ selectors: dict[StrictStr, StrictStr] = Field(
95
+ default_factory=dict,
96
+ description="Exact label requirements used to select an execution target; all keys and values must match.",
97
+ )
98
+ invocation: WorkloadInvocation = Field(
99
+ repr=False,
100
+ description="Validated workload invocation, including host-side credential bindings.",
101
+ )
102
+ output_config: dict[str, str] | None = Field(
103
+ default=None,
104
+ description="Optional result-field allowlist mapping output names to workload result keys.",
105
+ )
106
+ workload_type: Literal["container"] = Field(
107
+ default="container",
108
+ description="Workload execution family; container is the only supported value.",
109
+ )
@@ -1,15 +0,0 @@
1
- """Credential-reference resolution commands."""
2
-
3
- from __future__ import annotations
4
-
5
- from typing import ClassVar
6
- from uuid import UUID # noqa: TC003 - Pydantic evaluates fields.
7
-
8
- from execution_plane_client.commands.base import CommandPayload
9
-
10
-
11
- class CredentialResolve(CommandPayload):
12
- """Resolve an opaque credential reference into a short-lived value."""
13
-
14
- command_type: ClassVar[str] = "credential.resolve"
15
- credential_ref: UUID
@@ -1,43 +0,0 @@
1
- """Typed command results and transport receipts."""
2
-
3
- from __future__ import annotations
4
-
5
- from typing import Annotated, Literal
6
- from uuid import UUID # noqa: TC003 - Pydantic resolves this model field at runtime.
7
-
8
- from pydantic import Field, StrictBool, StrictStr
9
-
10
- from execution_plane_client.protocol import ResourceReference, WireModel
11
-
12
-
13
- class CredentialResolveCommandResult(WireModel):
14
- """Typed result returned for a credential-resolution command."""
15
-
16
- command_type: Literal["credential.resolve"] = "credential.resolve"
17
- command_revision: Literal[1] = 1
18
- credential: Annotated[StrictStr, Field(min_length=1, max_length=65536, repr=False)]
19
-
20
-
21
- class TargetHealthCommandResult(WireModel):
22
- """Typed result returned for an execution-target health command."""
23
-
24
- command_type: Literal["execution_target.health"] = "execution_target.health"
25
- command_revision: Literal[1] = 1
26
- healthy: StrictBool
27
- message: StrictStr | None = None
28
- skipped: StrictBool = False
29
-
30
-
31
- CommandResult = Annotated[
32
- CredentialResolveCommandResult | TargetHealthCommandResult,
33
- Field(discriminator="command_type"),
34
- ]
35
-
36
-
37
- class TransportReceipt(WireModel):
38
- """Receipt of a handled request, without a persisted command record."""
39
-
40
- received: Literal[True] = True
41
- message_id: UUID
42
- resource: ResourceReference | None = None
43
- result: CommandResult | None = None
@@ -1,43 +0,0 @@
1
- """Scheduling commands for the SDK-owned container gRPC contract."""
2
-
3
- from typing import Annotated, ClassVar, Literal
4
-
5
- from pydantic import Field, StrictStr, field_validator
6
-
7
- from execution_plane_client.commands.base import CommandPayload
8
- from execution_plane_client.protocol import PositiveInt, WireModel, validate_json
9
-
10
- StepIdentity = Annotated[StrictStr, Field(min_length=1, max_length=256, pattern=r"^[A-Za-z0-9._:-]+$")]
11
-
12
-
13
- class WorkloadInvocation(WireModel):
14
- """Public invocation data; EP supplies the attempt ID and credential mounts.
15
-
16
- Script environment variables remain ordinary step inputs. Credential-file
17
- delivery is not implemented yet, so callers cannot supply secret values or
18
- claim that arbitrary file paths have been mounted by EP.
19
- """
20
-
21
- workflow_run_id: StepIdentity
22
- step_revision_id: StepIdentity
23
- inputs: dict[str, object]
24
- runtime_context: dict[str, object] = Field(default_factory=dict)
25
- timeout_seconds: Annotated[PositiveInt, Field(le=86_400)]
26
-
27
- @field_validator("inputs", "runtime_context", mode="before")
28
- @classmethod
29
- def check_json(cls, value: object) -> object:
30
- """Keep nested invocation data finite, portable, and bounded."""
31
- return validate_json(value)
32
-
33
-
34
- class WorkExecute(CommandPayload):
35
- """Schedule one workload implementing the SDK container service."""
36
-
37
- command_type: ClassVar[str] = "work.execute"
38
-
39
- image: Annotated[StrictStr, Field(min_length=1, max_length=2048)]
40
- selectors: dict[StrictStr, StrictStr] = Field(default_factory=dict)
41
- invocation: WorkloadInvocation = Field(repr=False)
42
- output_config: dict[str, str] | None = None
43
- workload_type: Literal["container"] = "container"