docs: record json rpc workflow transport

This commit is contained in:
lda
2026-06-03 07:17:01 +07:00 Verified
parent 19e4c61257
commit 5601409897
5 changed files with 32 additions and 8 deletions
+5 -2
View File
@@ -88,8 +88,11 @@ implementation state.
JSON-RPC-over-HTTP first transport, remote CLI targeting, WebSocket/MCP
transport siblings, source providers, auth, streaming/progress,
transactional storage, and live upstream MCP sources.
- First slice implemented: `wf_server` can construct a local/static durable
`WorkflowApi` without `WfMcpService`. Transport adapters remain future work.
- First slice implemented: `wf_server` can construct a local/static durable
`WorkflowApi` without `WfMcpService`. Transport adapters remain future work.
- Completed: the first JSON-RPC-over-HTTP transport can expose the local/static
`WorkflowServer` through fixed dotted methods. Remote CLI targeting remains
the next transport-facing slice.
5. **CLI/API alignment**
- Let the CLI target either local process-backed stores/runtime or the future
@@ -275,6 +275,15 @@ composition:
It should not implement source provider management yet.
Implementation status:
- `wf_transport_rpc_http.create_rpc_app(server)` exposes a fixed JSON-RPC
method set over an existing `wf_server.WorkflowServer`.
- `wf-rpc-server --store-root <path>` starts the local/static server over
`/rpc`.
- This slice still does not include remote `wf` CLI targeting, auth,
streaming/progress, or live upstream MCP source management.
Preferred implementation dependency:
```bash
+3 -1
View File
@@ -72,7 +72,9 @@ def create_rpc_app(server: WorkflowServer) -> jsonrpc.API:
except (ValueError, KeyError, LookupError, FileNotFoundError) as exc:
raise_workflow_rpc_error(exc)
@entrypoint.method(name="workflow.drafts.create_from_capability", errors=[WorkflowRpcError])
@entrypoint.method(
name="workflow.drafts.create_from_capability", errors=[WorkflowRpcError]
)
async def workflow_drafts_create_from_capability(
params: CreateDraftFromCapabilityParams = Params(...),
) -> dict[str, Any]:
+15 -5
View File
@@ -11,7 +11,9 @@ from wf_server import build_local_static_workflow_server
from wf_transport_rpc_http.app import create_rpc_app
async def _rpc(client: httpx.AsyncClient, method: str, params: dict[str, Any]) -> dict[str, Any]:
async def _rpc(
client: httpx.AsyncClient, method: str, params: dict[str, Any]
) -> dict[str, Any]:
response = await client.post(
"/rpc",
json={"jsonrpc": "2.0", "id": "test", "method": method, "params": params},
@@ -25,7 +27,9 @@ def test_rpc_health_and_capability_methods(tmp_path) -> None:
server = build_local_static_workflow_server(tmp_path / "store")
app = create_rpc_app(server)
transport = httpx.ASGITransport(app=app)
async with httpx.AsyncClient(transport=transport, base_url="http://test") as client:
async with httpx.AsyncClient(
transport=transport, base_url="http://test"
) as client:
health_response = await client.get("/healthz")
health = await _rpc(client, "workflow.health", {})
listed = await _rpc(
@@ -53,7 +57,9 @@ def test_rpc_unknown_method_returns_json_rpc_error(tmp_path) -> None:
server = build_local_static_workflow_server(tmp_path / "store")
app = create_rpc_app(server)
transport = httpx.ASGITransport(app=app)
async with httpx.AsyncClient(transport=transport, base_url="http://test") as client:
async with httpx.AsyncClient(
transport=transport, base_url="http://test"
) as client:
payload = await _rpc(client, "workflow.nope", {})
assert payload["error"]["code"] == -32601
@@ -67,7 +73,9 @@ def test_rpc_draft_artifact_deployment_lifecycle(tmp_path) -> None:
server = build_local_static_workflow_server(tmp_path / "store")
app = create_rpc_app(server)
transport = httpx.ASGITransport(app=app)
async with httpx.AsyncClient(transport=transport, base_url="http://test") as client:
async with httpx.AsyncClient(
transport=transport, base_url="http://test"
) as client:
draft_ws = await _rpc(
client,
"workflow.drafts.create_from_capability",
@@ -249,7 +257,9 @@ def test_rpc_runs_deployment_and_reads_bounded_trace(tmp_path) -> None:
app = create_rpc_app(server)
transport = httpx.ASGITransport(app=app)
async with httpx.AsyncClient(transport=transport, base_url="http://test") as client:
async with httpx.AsyncClient(
transport=transport, base_url="http://test"
) as client:
run = await _rpc(
client,
"workflow.runs.start",