workspace draft from a capability
This commit is contained in:
@@ -115,6 +115,7 @@ def test_server_exposes_upstream_admin_and_workflow_tools() -> None:
|
||||
assert "wf.workflow.set_step_input_map" in names
|
||||
assert "wf.workflow.set_step_output_map" in names
|
||||
assert "wf.workflow.create_minimal_draft_workspace" in names
|
||||
assert "wf.workflow.create_draft_workspace_from_capability" in names
|
||||
assert "wf.workflow.create_artifact_from_workspace" in names
|
||||
assert "wf.workflow.create_wrapper_from_workspace" in names
|
||||
assert "wf.workflow.run_deployment" in names
|
||||
@@ -142,6 +143,18 @@ def test_server_exposes_upstream_admin_and_workflow_tools() -> None:
|
||||
== "Public input JSON Schema for the workflow or wrapper being "
|
||||
"drafted."
|
||||
)
|
||||
from_capability_input = tools_by_name[
|
||||
"wf.workflow.create_draft_workspace_from_capability"
|
||||
].inputSchema
|
||||
from_capability_request = from_capability_input["properties"]["request"]
|
||||
assert "capability_name" in from_capability_request["properties"]
|
||||
assert "input_schema" in from_capability_request["properties"]
|
||||
assert "output_map" in from_capability_request["properties"]
|
||||
from_capability_output = tools_by_name[
|
||||
"wf.workflow.create_draft_workspace_from_capability"
|
||||
].outputSchema
|
||||
assert from_capability_output is not None
|
||||
assert "wrapper_hints" in from_capability_output["properties"]
|
||||
wrapper_workspace_input = tools_by_name[
|
||||
"wf.workflow.create_wrapper_from_workspace"
|
||||
].inputSchema
|
||||
|
||||
@@ -680,6 +680,38 @@ def test_workflow_surface_creates_minimal_draft_workspace_with_error_route() ->
|
||||
assert workspace.draft["steps"]["tool_error"]["in"] == {"state.echoed": "message"}
|
||||
|
||||
|
||||
def test_workflow_surface_creates_draft_workspace_from_capability_hints() -> None:
|
||||
artifact_store = FileWorkflowArtifactStore(
|
||||
local_temp_root() / "surface_workspace_from_capability"
|
||||
)
|
||||
service = WfMcpService(
|
||||
store=FileStore(local_temp_root() / "surface_workspace_from_capability_mcp"),
|
||||
artifact_store=artifact_store,
|
||||
)
|
||||
service.register_connection(
|
||||
ConnectionConfig(id="demo.personal", server="demo", account="personal")
|
||||
)
|
||||
service.register_specs("demo.personal", echo_tool)
|
||||
handlers = WorkflowSurfaceHandlers(service)
|
||||
|
||||
result = asyncio.run(
|
||||
handlers.create_draft_workspace_from_capability(
|
||||
workspace_id="echo_from_capability",
|
||||
capability_name="demo.personal.echo_tool",
|
||||
name="echo_from_capability",
|
||||
)
|
||||
)
|
||||
assert service.draft_workspace_store is not None
|
||||
workspace = service.draft_workspace_store.get_workspace("echo_from_capability")
|
||||
|
||||
assert result["workspace_id"] == "echo_from_capability"
|
||||
assert result["wrapper_hints"]["input_map"] == {"input.text": "text"}
|
||||
assert result["wrapper_hints"]["output_map"] == {"echoed": "state.echoed"}
|
||||
assert workspace.draft["steps"]["call"]["use"] == "demo.personal.echo_tool"
|
||||
assert workspace.draft["steps"]["call"]["in"] == {"input.text": "text"}
|
||||
assert workspace.draft["steps"]["call"]["out"] == {"echoed": "state.echoed"}
|
||||
|
||||
|
||||
def test_workflow_surface_creates_artifact_from_workspace() -> None:
|
||||
artifact_store = FileWorkflowArtifactStore(
|
||||
local_temp_root() / "surface_workspace_artifact"
|
||||
|
||||
Reference in New Issue
Block a user