feat: add remote draft lifecycle client

This commit is contained in:
lda
2026-07-21 20:50:22 +07:00 Verified
parent 4c36597f51
commit 0d13f79cbf
3 changed files with 222 additions and 1 deletions
+31
View File
@@ -70,6 +70,18 @@ class WorkflowDraftSurface(Protocol):
error_message_source: Any | None = None,
) -> dict[str, Any]: ...
async def create_empty_draft_workspace(
self,
*,
workspace_id: str,
name: str,
title: str | None = None,
input_schema: dict[str, Any] | None = None,
state_schema: dict[str, Any] | None = None,
output_schema: dict[str, Any] | None = None,
outcomes: Sequence[str] = ("ok",),
) -> dict[str, Any]: ...
async def patch_draft_workspace(
self,
*,
@@ -86,6 +98,25 @@ class WorkflowDraftSurface(Protocol):
name: str,
) -> dict[str, Any]: ...
async def set_draft_start(
self,
*,
workspace_id: str,
revision: int,
step_id: str,
) -> dict[str, Any]: ...
async def set_draft_contract(
self,
*,
workspace_id: str,
revision: int,
input_schema: dict[str, Any] | None = None,
state_schema: dict[str, Any] | None = None,
output_schema: dict[str, Any] | None = None,
outcomes: Sequence[str] | None = None,
) -> dict[str, Any]: ...
async def set_draft_route(
self,
*,
@@ -60,6 +60,30 @@ class RpcDraftClientMixin:
},
)
async def create_empty_draft_workspace(
self: RpcCaller,
*,
workspace_id: str,
name: str,
title: str | None = None,
input_schema: dict[str, Any] | None = None,
state_schema: dict[str, Any] | None = None,
output_schema: dict[str, Any] | None = None,
outcomes: Sequence[str] = ("ok",),
) -> dict[str, Any]:
return await self._call(
"workflow.draft_workspaces.create_empty",
{
"workspace_id": workspace_id,
"name": name,
"title": title,
"input_schema": input_schema,
"state_schema": state_schema,
"output_schema": output_schema,
"outcomes": list(outcomes),
},
)
async def patch_draft_workspace(
self: RpcCaller,
*,
@@ -84,6 +108,40 @@ class RpcDraftClientMixin:
{"workspace_id": workspace_id, "revision": revision, "name": name},
)
async def set_draft_start(
self: RpcCaller,
*,
workspace_id: str,
revision: int,
step_id: str,
) -> dict[str, Any]:
return await self._call(
"workflow.draft_workspaces.set_start",
{"workspace_id": workspace_id, "revision": revision, "step_id": step_id},
)
async def set_draft_contract(
self: RpcCaller,
*,
workspace_id: str,
revision: int,
input_schema: dict[str, Any] | None = None,
state_schema: dict[str, Any] | None = None,
output_schema: dict[str, Any] | None = None,
outcomes: Sequence[str] | None = None,
) -> dict[str, Any]:
return await self._call(
"workflow.draft_workspaces.set_contract",
{
"workspace_id": workspace_id,
"revision": revision,
"input_schema": input_schema,
"state_schema": state_schema,
"output_schema": output_schema,
"outcomes": None if outcomes is None else list(outcomes),
},
)
async def set_draft_route(
self: RpcCaller,
*,