feat: replace draft output bind with general bind

This commit is contained in:
lda
2026-06-28 00:38:42 +07:00 Verified
parent b96ba0f7d1
commit 955c43d808
25 changed files with 1246 additions and 138 deletions
+2
View File
@@ -6,6 +6,7 @@ from .errors import WorkflowRpcError
from .models import (
AddStepFromCapabilityParams,
AdminEmptyParams,
BindDraftParams,
BranchDraftParams,
CallCapabilityParams,
CompileDraftWorkspaceParams,
@@ -48,6 +49,7 @@ from .models import (
__all__ = [
"AddStepFromCapabilityParams",
"AdminEmptyParams",
"BindDraftParams",
"BranchDraftParams",
"CallCapabilityParams",
"CompileDraftWorkspaceParams",
+6 -6
View File
@@ -141,23 +141,23 @@ class RpcDraftClientMixin:
},
)
async def bind_output_to_state(
async def bind_draft(
self: RpcCaller,
*,
workspace_id: str,
revision: int,
step_id: str,
output_field: str,
state_path: str,
source_path: str,
target_path: str,
) -> dict[str, Any]:
return await self._call(
"workflow.draft_workspaces.bind_output_to_state",
"workflow.draft_workspaces.bind",
{
"workspace_id": workspace_id,
"revision": revision,
"step_id": step_id,
"output_field": output_field,
"state_path": state_path,
"source_path": source_path,
"target_path": target_path,
},
)
+7 -7
View File
@@ -9,7 +9,7 @@ from wf_server import WorkflowServer
from ..errors import WorkflowRpcError, raise_workflow_rpc_error
from ..models import (
AddStepFromCapabilityParams,
BindOutputToStateParams,
BindDraftParams,
BranchDraftParams,
CompileDraftWorkspaceParams,
CreateArtifactFromWorkspaceParams,
@@ -183,19 +183,19 @@ def register_methods(
raise_workflow_rpc_error(exc)
@entrypoint.method(
name="workflow.draft_workspaces.bind_output_to_state",
name="workflow.draft_workspaces.bind",
errors=[WorkflowRpcError],
)
async def workflow_draft_workspaces_bind_output_to_state(
params: BindOutputToStateParams = RpcParams(),
async def workflow_draft_workspaces_bind(
params: BindDraftParams = RpcParams(),
) -> dict[str, Any]:
try:
return await server.api.bind_output_to_state(
return await server.api.bind_draft(
workspace_id=params.workspace_id,
revision=params.revision,
step_id=params.step_id,
output_field=params.output_field,
state_path=params.state_path,
source_path=params.source_path,
target_path=params.target_path,
)
except (ValueError, KeyError, LookupError, FileNotFoundError) as exc:
raise_workflow_rpc_error(exc)
+3 -3
View File
@@ -141,12 +141,12 @@ class SetStepOutputMapParams(RpcParamsModel):
merge: bool = False
class BindOutputToStateParams(RpcParamsModel):
class BindDraftParams(RpcParamsModel):
workspace_id: str = Field(min_length=1)
revision: int = Field(ge=1)
step_id: str = Field(min_length=1)
output_field: str = Field(min_length=1)
state_path: str = Field(min_length=1)
source_path: str = Field(min_length=1)
target_path: str = Field(min_length=1)
class AddStepFromCapabilityParams(RpcParamsModel):