feat: authorize workflow contract authoring

This commit is contained in:
lda
2026-08-14 17:43:14 +07:00 Verified
parent bc23a722c3
commit bd226a2fa7
20 changed files with 1506 additions and 14 deletions
+15 -8
View File
@@ -255,9 +255,7 @@ def manifest_from_openrpc(document: Mapping[str, object]) -> ContractManifest:
params.append(
{
"name": _string(parameter.get("name"), f"{parameter_path}.name"),
"required": _boolean(
raw_required, f"{parameter_path}.required"
),
"required": _boolean(raw_required, f"{parameter_path}.required"),
"schema": _schema(
parameter.get("schema"), f"{parameter_path}.schema"
),
@@ -271,12 +269,21 @@ def manifest_from_openrpc(document: Mapping[str, object]) -> ContractManifest:
f"{result_path}.schema", "missing success result schema"
)
raw_result_schema = result["schema"]
if not isinstance(raw_result_schema, Mapping) or (
set(raw_result_schema) != {"$ref"}
or not (
isinstance(raw_result_schema.get("$ref"), str)
and raw_result_schema["$ref"].startswith("#/components/schemas/")
if not isinstance(raw_result_schema, Mapping):
raise ManifestError(
f"{result_path}.schema",
"success result must be a schema object",
)
named_result = (
set(raw_result_schema) == {"$ref"}
and isinstance(raw_result_schema.get("$ref"), str)
and raw_result_schema["$ref"].startswith("#/components/schemas/")
)
# This inspection RPC returns either its inventory or the standard
# revision-conflict workspace payload, so its OpenRPC result is a union.
if (
not named_result
and method_name != "workflow.draft_workspaces.inspect_authoring_contract"
):
raise ManifestError(
f"{result_path}.schema",