docs: record json rpc workflow transport
This commit is contained in:
@@ -90,6 +90,9 @@ implementation state.
|
|||||||
transactional storage, and live upstream MCP sources.
|
transactional storage, and live upstream MCP sources.
|
||||||
- First slice implemented: `wf_server` can construct a local/static durable
|
- First slice implemented: `wf_server` can construct a local/static durable
|
||||||
`WorkflowApi` without `WfMcpService`. Transport adapters remain future work.
|
`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**
|
5. **CLI/API alignment**
|
||||||
- Let the CLI target either local process-backed stores/runtime or the future
|
- 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.
|
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:
|
Preferred implementation dependency:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -72,7 +72,9 @@ def create_rpc_app(server: WorkflowServer) -> jsonrpc.API:
|
|||||||
except (ValueError, KeyError, LookupError, FileNotFoundError) as exc:
|
except (ValueError, KeyError, LookupError, FileNotFoundError) as exc:
|
||||||
raise_workflow_rpc_error(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(
|
async def workflow_drafts_create_from_capability(
|
||||||
params: CreateDraftFromCapabilityParams = Params(...),
|
params: CreateDraftFromCapabilityParams = Params(...),
|
||||||
) -> dict[str, Any]:
|
) -> dict[str, Any]:
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ from wf_server import build_local_static_workflow_server
|
|||||||
from wf_transport_rpc_http.app import create_rpc_app
|
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(
|
response = await client.post(
|
||||||
"/rpc",
|
"/rpc",
|
||||||
json={"jsonrpc": "2.0", "id": "test", "method": method, "params": params},
|
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")
|
server = build_local_static_workflow_server(tmp_path / "store")
|
||||||
app = create_rpc_app(server)
|
app = create_rpc_app(server)
|
||||||
transport = httpx.ASGITransport(app=app)
|
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_response = await client.get("/healthz")
|
||||||
health = await _rpc(client, "workflow.health", {})
|
health = await _rpc(client, "workflow.health", {})
|
||||||
listed = await _rpc(
|
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")
|
server = build_local_static_workflow_server(tmp_path / "store")
|
||||||
app = create_rpc_app(server)
|
app = create_rpc_app(server)
|
||||||
transport = httpx.ASGITransport(app=app)
|
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", {})
|
payload = await _rpc(client, "workflow.nope", {})
|
||||||
|
|
||||||
assert payload["error"]["code"] == -32601
|
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")
|
server = build_local_static_workflow_server(tmp_path / "store")
|
||||||
app = create_rpc_app(server)
|
app = create_rpc_app(server)
|
||||||
transport = httpx.ASGITransport(app=app)
|
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(
|
draft_ws = await _rpc(
|
||||||
client,
|
client,
|
||||||
"workflow.drafts.create_from_capability",
|
"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)
|
app = create_rpc_app(server)
|
||||||
transport = httpx.ASGITransport(app=app)
|
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(
|
run = await _rpc(
|
||||||
client,
|
client,
|
||||||
"workflow.runs.start",
|
"workflow.runs.start",
|
||||||
|
|||||||
Reference in New Issue
Block a user