From bc578b574e5851cfdc7398837bd681b868f547f5 Mon Sep 17 00:00:00 2001 From: abrichr Date: Sat, 21 Nov 2026 02:06:53 -0500 Subject: [PATCH 1/2] test: pin the JSON schema of every model in ir and the qualification modules --- .../openadapt_flow.approval_mode.model.json | 1287 + .../schema_surface/openadapt_flow.ir.json | 62763 ++++++++++++++++ ...enadapt_flow.production_qualification.json | 2361 + .../openadapt_flow.qualification.json | 4465 ++ ...penadapt_flow.qualification_admission.json | 1937 + ...adapt_flow.qualification_admission_v2.json | 6713 ++ ...adapt_flow.qualification_admission_v4.json | 163 + ...flow.qualification_campaign_authority.json | 1527 + ...pt_flow.qualification_campaign_permit.json | 3021 + ...enadapt_flow.qualification_dev_signer.json | 199 + ...nadapt_flow.qualification_environment.json | 105 + .../openadapt_flow.qualification_faults.json | 285 + ...nadapt_flow.qualification_oracle_gate.json | 369 + ...openadapt_flow.qualification_proposal.json | 221 + .../openadapt_flow.records.schema.json | 2955 + ...openadapt_flow.runtime.effects.effect.json | 2188 + packages/flow/tests/test_schema_surface.py | 140 + 17 files changed, 90699 insertions(+) create mode 100644 packages/flow/tests/fixtures/schema_surface/openadapt_flow.approval_mode.model.json create mode 100644 packages/flow/tests/fixtures/schema_surface/openadapt_flow.ir.json create mode 100644 packages/flow/tests/fixtures/schema_surface/openadapt_flow.production_qualification.json create mode 100644 packages/flow/tests/fixtures/schema_surface/openadapt_flow.qualification.json create mode 100644 packages/flow/tests/fixtures/schema_surface/openadapt_flow.qualification_admission.json create mode 100644 packages/flow/tests/fixtures/schema_surface/openadapt_flow.qualification_admission_v2.json create mode 100644 packages/flow/tests/fixtures/schema_surface/openadapt_flow.qualification_admission_v4.json create mode 100644 packages/flow/tests/fixtures/schema_surface/openadapt_flow.qualification_campaign_authority.json create mode 100644 packages/flow/tests/fixtures/schema_surface/openadapt_flow.qualification_campaign_permit.json create mode 100644 packages/flow/tests/fixtures/schema_surface/openadapt_flow.qualification_dev_signer.json create mode 100644 packages/flow/tests/fixtures/schema_surface/openadapt_flow.qualification_environment.json create mode 100644 packages/flow/tests/fixtures/schema_surface/openadapt_flow.qualification_faults.json create mode 100644 packages/flow/tests/fixtures/schema_surface/openadapt_flow.qualification_oracle_gate.json create mode 100644 packages/flow/tests/fixtures/schema_surface/openadapt_flow.qualification_proposal.json create mode 100644 packages/flow/tests/fixtures/schema_surface/openadapt_flow.records.schema.json create mode 100644 packages/flow/tests/fixtures/schema_surface/openadapt_flow.runtime.effects.effect.json create mode 100644 packages/flow/tests/test_schema_surface.py diff --git a/packages/flow/tests/fixtures/schema_surface/openadapt_flow.approval_mode.model.json b/packages/flow/tests/fixtures/schema_surface/openadapt_flow.approval_mode.model.json new file mode 100644 index 0000000000..41f898af66 --- /dev/null +++ b/packages/flow/tests/fixtures/schema_surface/openadapt_flow.approval_mode.model.json @@ -0,0 +1,1287 @@ +{ + "pydantic": "2.13.4", + "models": { + "ApprovalModeItemEvidence": { + "validation": { + "$defs": { + "ApprovalMode": { + "description": "Whether a person approves an item before it is saved.", + "enum": [ + "each_item", + "problems_only", + "not_gated" + ], + "title": "ApprovalMode", + "type": "string" + }, + "ApproverAuth": { + "enum": [ + "cloud_user", + "unauthenticated", + "policy", + "local_cli", + "signed_webhook", + "mcp_session" + ], + "title": "ApproverAuth", + "type": "string" + }, + "ApproverIdentityV1": { + "additionalProperties": false, + "description": "Mirror of ``openadapt_types.ApproverIdentityV1``.", + "properties": { + "schema_version": { + "const": "openadapt.approver-identity/v1", + "default": "openadapt.approver-identity/v1", + "title": "Schema Version", + "type": "string" + }, + "kind": { + "$ref": "#/$defs/ApproverKind" + }, + "auth": { + "$ref": "#/$defs/ApproverAuth" + }, + "id": { + "anyOf": [ + { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@/-]{0,255}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Id" + }, + "auth_method": { + "default": "none", + "enum": [ + "cloud_aal2", + "cloud_aal1", + "none" + ], + "title": "Auth Method", + "type": "string" + }, + "policy_ref": { + "anyOf": [ + { + "pattern": "^sha256:[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Policy Ref" + }, + "on_behalf_of": { + "anyOf": [ + { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@/-]{0,255}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "On Behalf Of" + } + }, + "required": [ + "kind", + "auth" + ], + "title": "ApproverIdentityV1", + "type": "object" + }, + "ApproverKind": { + "enum": [ + "person", + "rule", + "agent", + "system" + ], + "title": "ApproverKind", + "type": "string" + }, + "CheckOutcome": { + "additionalProperties": false, + "description": "The result of one named check, with a closed-vocabulary detail code.", + "properties": { + "code": { + "enum": [ + "channel", + "inputs_strict", + "inputs_supplied", + "not_a_retry", + "record_key_not_recent", + "deployment_config", + "switch_lease", + "not_resumed", + "switch_on", + "signed_in_user", + "right_record", + "same_screens", + "record_check_ready", + "verified", + "whole_run_clean", + "each_item", + "gate_error", + "switch_log", + "dry_run" + ], + "title": "Code", + "type": "string" + }, + "passed": { + "title": "Passed", + "type": "boolean" + }, + "detail": { + "default": "ok", + "pattern": "^[a-z][a-z0-9_]{0,63}$", + "title": "Detail", + "type": "string" + }, + "step_id": { + "anyOf": [ + { + "maxLength": 256, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Step Id" + } + }, + "required": [ + "code", + "passed" + ], + "title": "CheckOutcome", + "type": "object" + }, + "ItemApprovalRef": { + "additionalProperties": false, + "description": "One person's answer to one item-approval request, as PHI-free codes.\n\nThe approver is a Cloud user id (never a name), or ``unauthenticated``\nwhen the person approved in Desktop while signed out. Digests bind the\nexact request the person saw and the exact answer file.", + "properties": { + "step_id": { + "maxLength": 256, + "minLength": 1, + "title": "Step Id", + "type": "string" + }, + "request_sha256": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Request Sha256", + "type": "string" + }, + "answer_sha256": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Answer Sha256", + "type": "string" + }, + "decision": { + "enum": [ + "approved", + "declined" + ], + "title": "Decision", + "type": "string" + }, + "decline_reason": { + "anyOf": [ + { + "enum": [ + "wrong_values", + "wrong_record", + "screen_problem" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Decline Reason" + }, + "decided_by": { + "default": "human", + "enum": [ + "human", + "automation" + ], + "title": "Decided By", + "type": "string" + }, + "route": { + "default": "desktop_run_it", + "enum": [ + "desktop_run_it", + "decision_portal", + "local_cli", + "webhook", + "mcp" + ], + "title": "Route", + "type": "string" + }, + "approver_kind": { + "enum": [ + "cloud_user", + "unauthenticated" + ], + "title": "Approver Kind", + "type": "string" + }, + "approver_id": { + "anyOf": [ + { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Approver Id" + }, + "auth_method": { + "enum": [ + "cloud_aal2", + "cloud_aal1", + "none" + ], + "title": "Auth Method", + "type": "string" + }, + "approver": { + "anyOf": [ + { + "$ref": "#/$defs/ApproverIdentityV1" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "required": [ + "step_id", + "request_sha256", + "answer_sha256", + "decision", + "approver_kind", + "auth_method" + ], + "title": "ItemApprovalRef", + "type": "object" + }, + "ItemDecisionKind": { + "description": "What happened to one item under its approval mode.", + "enum": [ + "no_person", + "approval_required", + "stop_before_saving", + "problem", + "not_gated", + "approved", + "declined" + ], + "title": "ItemDecisionKind", + "type": "string" + }, + "OffReason": { + "description": "Why the switch turned off (design section 7.6). Closed set.", + "enum": [ + "uncertain_result", + "wrong_item_found", + "too_many_problems", + "screen_changed", + "record_check_lost", + "spot_checks_overdue", + "version_changed", + "environment_changed", + "admission_lost", + "setup_lapsed", + "turned_off" + ], + "title": "OffReason", + "type": "string" + } + }, + "additionalProperties": false, + "description": "The per-item approval block stored in the run report (design 10).\n\nPHI-free: codes, counts, digests and step ids only. The model enforces the\nsafety rule at the evidence boundary: an item can be recorded as saved\nwithout a person only in ``problems_only`` mode, only after at least one\nsave passed every pre-check, and only when both post-checks passed.", + "properties": { + "schema_version": { + "const": "openadapt.approval-mode-item/v1", + "default": "openadapt.approval-mode-item/v1", + "title": "Schema Version", + "type": "string" + }, + "mode": { + "$ref": "#/$defs/ApprovalMode" + }, + "channel": { + "anyOf": [ + { + "pattern": "^[a-z][a-z0-9_]{0,63}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Channel" + }, + "switch_id": { + "anyOf": [ + { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Switch Id" + }, + "switch_record_sha256": { + "anyOf": [ + { + "pattern": "^sha256:[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Switch Record Sha256" + }, + "item_checks": { + "items": { + "$ref": "#/$defs/CheckOutcome" + }, + "title": "Item Checks", + "type": "array" + }, + "pre_checks": { + "items": { + "$ref": "#/$defs/CheckOutcome" + }, + "title": "Pre Checks", + "type": "array" + }, + "post_checks": { + "items": { + "$ref": "#/$defs/CheckOutcome" + }, + "title": "Post Checks", + "type": "array" + }, + "saves_without_person": { + "default": 0, + "minimum": 0, + "title": "Saves Without Person", + "type": "integer" + }, + "gated_step_id": { + "anyOf": [ + { + "maxLength": 256, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Gated Step Id" + }, + "decision": { + "$ref": "#/$defs/ItemDecisionKind" + }, + "decision_reason": { + "anyOf": [ + { + "pattern": "^[a-z][a-z0-9_]{0,63}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Decision Reason" + }, + "needs_person": { + "title": "Needs Person", + "type": "boolean" + }, + "counts_toward_problems": { + "default": false, + "title": "Counts Toward Problems", + "type": "boolean" + }, + "switch_off_reason": { + "anyOf": [ + { + "$ref": "#/$defs/OffReason" + }, + { + "type": "null" + } + ], + "default": null + }, + "switch_log_recorded": { + "default": false, + "title": "Switch Log Recorded", + "type": "boolean" + }, + "approvals": { + "items": { + "$ref": "#/$defs/ItemApprovalRef" + }, + "title": "Approvals", + "type": "array" + } + }, + "required": [ + "mode", + "decision", + "needs_person" + ], + "title": "ApprovalModeItemEvidence", + "type": "object" + }, + "serialization": { + "$defs": { + "ApprovalMode": { + "description": "Whether a person approves an item before it is saved.", + "enum": [ + "each_item", + "problems_only", + "not_gated" + ], + "title": "ApprovalMode", + "type": "string" + }, + "CheckOutcome": { + "additionalProperties": false, + "description": "The result of one named check, with a closed-vocabulary detail code.", + "properties": { + "code": { + "enum": [ + "channel", + "inputs_strict", + "inputs_supplied", + "not_a_retry", + "record_key_not_recent", + "deployment_config", + "switch_lease", + "not_resumed", + "switch_on", + "signed_in_user", + "right_record", + "same_screens", + "record_check_ready", + "verified", + "whole_run_clean", + "each_item", + "gate_error", + "switch_log", + "dry_run" + ], + "title": "Code", + "type": "string" + }, + "passed": { + "title": "Passed", + "type": "boolean" + }, + "detail": { + "default": "ok", + "pattern": "^[a-z][a-z0-9_]{0,63}$", + "title": "Detail", + "type": "string" + }, + "step_id": { + "anyOf": [ + { + "maxLength": 256, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Step Id" + } + }, + "required": [ + "code", + "passed" + ], + "title": "CheckOutcome", + "type": "object" + }, + "ItemApprovalRef": { + "additionalProperties": true, + "type": "object" + }, + "ItemDecisionKind": { + "description": "What happened to one item under its approval mode.", + "enum": [ + "no_person", + "approval_required", + "stop_before_saving", + "problem", + "not_gated", + "approved", + "declined" + ], + "title": "ItemDecisionKind", + "type": "string" + }, + "OffReason": { + "description": "Why the switch turned off (design section 7.6). Closed set.", + "enum": [ + "uncertain_result", + "wrong_item_found", + "too_many_problems", + "screen_changed", + "record_check_lost", + "spot_checks_overdue", + "version_changed", + "environment_changed", + "admission_lost", + "setup_lapsed", + "turned_off" + ], + "title": "OffReason", + "type": "string" + } + }, + "additionalProperties": false, + "description": "The per-item approval block stored in the run report (design 10).\n\nPHI-free: codes, counts, digests and step ids only. The model enforces the\nsafety rule at the evidence boundary: an item can be recorded as saved\nwithout a person only in ``problems_only`` mode, only after at least one\nsave passed every pre-check, and only when both post-checks passed.", + "properties": { + "schema_version": { + "const": "openadapt.approval-mode-item/v1", + "default": "openadapt.approval-mode-item/v1", + "title": "Schema Version", + "type": "string" + }, + "mode": { + "$ref": "#/$defs/ApprovalMode" + }, + "channel": { + "anyOf": [ + { + "pattern": "^[a-z][a-z0-9_]{0,63}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Channel" + }, + "switch_id": { + "anyOf": [ + { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Switch Id" + }, + "switch_record_sha256": { + "anyOf": [ + { + "pattern": "^sha256:[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Switch Record Sha256" + }, + "item_checks": { + "items": { + "$ref": "#/$defs/CheckOutcome" + }, + "title": "Item Checks", + "type": "array" + }, + "pre_checks": { + "items": { + "$ref": "#/$defs/CheckOutcome" + }, + "title": "Pre Checks", + "type": "array" + }, + "post_checks": { + "items": { + "$ref": "#/$defs/CheckOutcome" + }, + "title": "Post Checks", + "type": "array" + }, + "saves_without_person": { + "default": 0, + "minimum": 0, + "title": "Saves Without Person", + "type": "integer" + }, + "gated_step_id": { + "anyOf": [ + { + "maxLength": 256, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Gated Step Id" + }, + "decision": { + "$ref": "#/$defs/ItemDecisionKind" + }, + "decision_reason": { + "anyOf": [ + { + "pattern": "^[a-z][a-z0-9_]{0,63}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Decision Reason" + }, + "needs_person": { + "title": "Needs Person", + "type": "boolean" + }, + "counts_toward_problems": { + "default": false, + "title": "Counts Toward Problems", + "type": "boolean" + }, + "switch_off_reason": { + "anyOf": [ + { + "$ref": "#/$defs/OffReason" + }, + { + "type": "null" + } + ], + "default": null + }, + "switch_log_recorded": { + "default": false, + "title": "Switch Log Recorded", + "type": "boolean" + }, + "approvals": { + "items": { + "$ref": "#/$defs/ItemApprovalRef" + }, + "title": "Approvals", + "type": "array" + } + }, + "required": [ + "mode", + "decision", + "needs_person" + ], + "title": "ApprovalModeItemEvidence", + "type": "object" + } + }, + "CheckOutcome": { + "validation": { + "additionalProperties": false, + "description": "The result of one named check, with a closed-vocabulary detail code.", + "properties": { + "code": { + "enum": [ + "channel", + "inputs_strict", + "inputs_supplied", + "not_a_retry", + "record_key_not_recent", + "deployment_config", + "switch_lease", + "not_resumed", + "switch_on", + "signed_in_user", + "right_record", + "same_screens", + "record_check_ready", + "verified", + "whole_run_clean", + "each_item", + "gate_error", + "switch_log", + "dry_run" + ], + "title": "Code", + "type": "string" + }, + "passed": { + "title": "Passed", + "type": "boolean" + }, + "detail": { + "default": "ok", + "pattern": "^[a-z][a-z0-9_]{0,63}$", + "title": "Detail", + "type": "string" + }, + "step_id": { + "anyOf": [ + { + "maxLength": 256, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Step Id" + } + }, + "required": [ + "code", + "passed" + ], + "title": "CheckOutcome", + "type": "object" + }, + "serialization": { + "additionalProperties": false, + "description": "The result of one named check, with a closed-vocabulary detail code.", + "properties": { + "code": { + "enum": [ + "channel", + "inputs_strict", + "inputs_supplied", + "not_a_retry", + "record_key_not_recent", + "deployment_config", + "switch_lease", + "not_resumed", + "switch_on", + "signed_in_user", + "right_record", + "same_screens", + "record_check_ready", + "verified", + "whole_run_clean", + "each_item", + "gate_error", + "switch_log", + "dry_run" + ], + "title": "Code", + "type": "string" + }, + "passed": { + "title": "Passed", + "type": "boolean" + }, + "detail": { + "default": "ok", + "pattern": "^[a-z][a-z0-9_]{0,63}$", + "title": "Detail", + "type": "string" + }, + "step_id": { + "anyOf": [ + { + "maxLength": 256, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Step Id" + } + }, + "required": [ + "code", + "passed" + ], + "title": "CheckOutcome", + "type": "object" + } + }, + "ItemApprovalRef": { + "validation": { + "$defs": { + "ApproverAuth": { + "enum": [ + "cloud_user", + "unauthenticated", + "policy", + "local_cli", + "signed_webhook", + "mcp_session" + ], + "title": "ApproverAuth", + "type": "string" + }, + "ApproverIdentityV1": { + "additionalProperties": false, + "description": "Mirror of ``openadapt_types.ApproverIdentityV1``.", + "properties": { + "schema_version": { + "const": "openadapt.approver-identity/v1", + "default": "openadapt.approver-identity/v1", + "title": "Schema Version", + "type": "string" + }, + "kind": { + "$ref": "#/$defs/ApproverKind" + }, + "auth": { + "$ref": "#/$defs/ApproverAuth" + }, + "id": { + "anyOf": [ + { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@/-]{0,255}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Id" + }, + "auth_method": { + "default": "none", + "enum": [ + "cloud_aal2", + "cloud_aal1", + "none" + ], + "title": "Auth Method", + "type": "string" + }, + "policy_ref": { + "anyOf": [ + { + "pattern": "^sha256:[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Policy Ref" + }, + "on_behalf_of": { + "anyOf": [ + { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@/-]{0,255}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "On Behalf Of" + } + }, + "required": [ + "kind", + "auth" + ], + "title": "ApproverIdentityV1", + "type": "object" + }, + "ApproverKind": { + "enum": [ + "person", + "rule", + "agent", + "system" + ], + "title": "ApproverKind", + "type": "string" + } + }, + "additionalProperties": false, + "description": "One person's answer to one item-approval request, as PHI-free codes.\n\nThe approver is a Cloud user id (never a name), or ``unauthenticated``\nwhen the person approved in Desktop while signed out. Digests bind the\nexact request the person saw and the exact answer file.", + "properties": { + "step_id": { + "maxLength": 256, + "minLength": 1, + "title": "Step Id", + "type": "string" + }, + "request_sha256": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Request Sha256", + "type": "string" + }, + "answer_sha256": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Answer Sha256", + "type": "string" + }, + "decision": { + "enum": [ + "approved", + "declined" + ], + "title": "Decision", + "type": "string" + }, + "decline_reason": { + "anyOf": [ + { + "enum": [ + "wrong_values", + "wrong_record", + "screen_problem" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Decline Reason" + }, + "decided_by": { + "default": "human", + "enum": [ + "human", + "automation" + ], + "title": "Decided By", + "type": "string" + }, + "route": { + "default": "desktop_run_it", + "enum": [ + "desktop_run_it", + "decision_portal", + "local_cli", + "webhook", + "mcp" + ], + "title": "Route", + "type": "string" + }, + "approver_kind": { + "enum": [ + "cloud_user", + "unauthenticated" + ], + "title": "Approver Kind", + "type": "string" + }, + "approver_id": { + "anyOf": [ + { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Approver Id" + }, + "auth_method": { + "enum": [ + "cloud_aal2", + "cloud_aal1", + "none" + ], + "title": "Auth Method", + "type": "string" + }, + "approver": { + "anyOf": [ + { + "$ref": "#/$defs/ApproverIdentityV1" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "required": [ + "step_id", + "request_sha256", + "answer_sha256", + "decision", + "approver_kind", + "auth_method" + ], + "title": "ItemApprovalRef", + "type": "object" + }, + "serialization": { + "additionalProperties": true, + "type": "object" + } + }, + "ItemContext": { + "validation": { + "additionalProperties": false, + "description": "What the caller knows about one item before it runs (design 7.2).\n\nDesktop fills this from its own list parsing, work-item history and lease.\nEvery field defaults to the value that fails its check, so an omitted\nfield sends the item to per-item approval rather than past a person.", + "properties": { + "channel": { + "anyOf": [ + { + "pattern": "^[a-z][a-z0-9_]{0,63}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Channel" + }, + "header_maps_every_input": { + "default": false, + "title": "Header Maps Every Input", + "type": "boolean" + }, + "rows_well_formed": { + "default": false, + "title": "Rows Well Formed", + "type": "boolean" + }, + "values_pass_types": { + "default": false, + "title": "Values Pass Types", + "type": "boolean" + }, + "is_retry": { + "default": true, + "title": "Is Retry", + "type": "boolean" + }, + "allow_repeat": { + "default": true, + "title": "Allow Repeat", + "type": "boolean" + }, + "record_key_seen_recently": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Record Key Seen Recently" + }, + "caller_supplied_configuration": { + "default": true, + "title": "Caller Supplied Configuration", + "type": "boolean" + }, + "holds_switch_lease": { + "default": false, + "title": "Holds Switch Lease", + "type": "boolean" + } + }, + "title": "ItemContext", + "type": "object" + }, + "serialization": { + "additionalProperties": false, + "description": "What the caller knows about one item before it runs (design 7.2).\n\nDesktop fills this from its own list parsing, work-item history and lease.\nEvery field defaults to the value that fails its check, so an omitted\nfield sends the item to per-item approval rather than past a person.", + "properties": { + "channel": { + "anyOf": [ + { + "pattern": "^[a-z][a-z0-9_]{0,63}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Channel" + }, + "header_maps_every_input": { + "default": false, + "title": "Header Maps Every Input", + "type": "boolean" + }, + "rows_well_formed": { + "default": false, + "title": "Rows Well Formed", + "type": "boolean" + }, + "values_pass_types": { + "default": false, + "title": "Values Pass Types", + "type": "boolean" + }, + "is_retry": { + "default": true, + "title": "Is Retry", + "type": "boolean" + }, + "allow_repeat": { + "default": true, + "title": "Allow Repeat", + "type": "boolean" + }, + "record_key_seen_recently": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Record Key Seen Recently" + }, + "caller_supplied_configuration": { + "default": true, + "title": "Caller Supplied Configuration", + "type": "boolean" + }, + "holds_switch_lease": { + "default": false, + "title": "Holds Switch Lease", + "type": "boolean" + } + }, + "title": "ItemContext", + "type": "object" + } + }, + "SwitchThresholds": { + "validation": { + "additionalProperties": false, + "description": "Conservative public defaults (design 7.6). Deployments may only tighten.\n\nTuned values are private configuration and stay out of this repository;\nthe validator refuses any value looser than these defaults.", + "properties": { + "status_max_age_s": { + "default": 900, + "exclusiveMinimum": 0, + "maximum": 900, + "title": "Status Max Age S", + "type": "integer" + }, + "problems_in_a_row": { + "default": 3, + "maximum": 3, + "minimum": 1, + "title": "Problems In A Row", + "type": "integer" + }, + "problems_in_window": { + "default": 5, + "maximum": 5, + "minimum": 1, + "title": "Problems In Window", + "type": "integer" + }, + "problems_window": { + "default": 20, + "maximum": 1000, + "minimum": 20, + "title": "Problems Window", + "type": "integer" + } + }, + "title": "SwitchThresholds", + "type": "object" + }, + "serialization": { + "additionalProperties": false, + "description": "Conservative public defaults (design 7.6). Deployments may only tighten.\n\nTuned values are private configuration and stay out of this repository;\nthe validator refuses any value looser than these defaults.", + "properties": { + "status_max_age_s": { + "default": 900, + "exclusiveMinimum": 0, + "maximum": 900, + "title": "Status Max Age S", + "type": "integer" + }, + "problems_in_a_row": { + "default": 3, + "maximum": 3, + "minimum": 1, + "title": "Problems In A Row", + "type": "integer" + }, + "problems_in_window": { + "default": 5, + "maximum": 5, + "minimum": 1, + "title": "Problems In Window", + "type": "integer" + }, + "problems_window": { + "default": 20, + "maximum": 1000, + "minimum": 20, + "title": "Problems Window", + "type": "integer" + } + }, + "title": "SwitchThresholds", + "type": "object" + } + } + } +} diff --git a/packages/flow/tests/fixtures/schema_surface/openadapt_flow.ir.json b/packages/flow/tests/fixtures/schema_surface/openadapt_flow.ir.json new file mode 100644 index 0000000000..8080bbc3ec --- /dev/null +++ b/packages/flow/tests/fixtures/schema_surface/openadapt_flow.ir.json @@ -0,0 +1,62763 @@ +{ + "pydantic": "2.13.4", + "models": { + "ActionDeliveryReceipt": { + "validation": { + "additionalProperties": false, + "description": "Proof that an action was delivered, never that its outcome happened.\n\nNative UIA Invoke/Focus/Toggle/Select and physical input can confirm only\nthat the operating-system action API accepted the request. Business success\nremains the independent postcondition + system-of-record effect verifier's\nresponsibility. ``outcome_verified`` is therefore fixed False here.", + "properties": { + "status": { + "const": "delivered", + "default": "delivered", + "title": "Status", + "type": "string" + }, + "receipt_id": { + "maxLength": 128, + "minLength": 1, + "pattern": "^[A-Za-z0-9._:-]+$", + "title": "Receipt Id", + "type": "string" + }, + "operation": { + "maxLength": 64, + "minLength": 1, + "pattern": "^[a-z][a-z0-9_]*$", + "title": "Operation", + "type": "string" + }, + "native": { + "title": "Native", + "type": "boolean" + }, + "target_fingerprint": { + "anyOf": [ + { + "pattern": "^[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Target Fingerprint" + }, + "destination_fingerprint": { + "anyOf": [ + { + "pattern": "^[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "DRAG only: fingerprint of the independently resolved destination. The source remains target_fingerprint.", + "title": "Destination Fingerprint" + }, + "selection_value_sha256": { + "anyOf": [ + { + "pattern": "^[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "SELECT_OPTION only: SHA-256 of the exact native option value, or the remote type-ahead text dispatched, without retaining it.", + "title": "Selection Value Sha256" + }, + "selection_commit_key": { + "anyOf": [ + { + "enum": [ + "Enter", + "Tab" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "SELECT_OPTION only: exact key dispatched after the value.", + "title": "Selection Commit Key" + }, + "delivered_at": { + "maxLength": 64, + "minLength": 20, + "title": "Delivered At", + "type": "string" + }, + "outcome_verified": { + "const": false, + "default": false, + "title": "Outcome Verified", + "type": "boolean" + } + }, + "required": [ + "receipt_id", + "operation", + "native", + "delivered_at" + ], + "title": "ActionDeliveryReceipt", + "type": "object" + }, + "serialization": { + "additionalProperties": true, + "type": "object" + } + }, + "ActionDeliveryUncertainty": { + "validation": { + "description": "Evidence that an action may have landed but cannot be retried safely.\n\nThis record never proves delivery or business success. It makes the\nuncertainty explicit and records whether the runtime subsequently proved\nthe complete postcondition + independent-effect contract.", + "properties": { + "status": { + "const": "delivery_uncertain", + "default": "delivery_uncertain", + "title": "Status", + "type": "string" + }, + "operation": { + "maxLength": 64, + "minLength": 1, + "pattern": "^[a-z][a-z0-9_]*$", + "title": "Operation", + "type": "string" + }, + "native": { + "title": "Native", + "type": "boolean" + }, + "target_fingerprint": { + "anyOf": [ + { + "pattern": "^[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Target Fingerprint" + }, + "observed_at": { + "maxLength": 64, + "minLength": 20, + "title": "Observed At", + "type": "string" + }, + "cause_type": { + "maxLength": 128, + "minLength": 1, + "pattern": "^[A-Za-z_][A-Za-z0-9_.]*$", + "title": "Cause Type", + "type": "string" + }, + "retried": { + "const": false, + "default": false, + "title": "Retried", + "type": "boolean" + }, + "verification_attempted": { + "default": false, + "title": "Verification Attempted", + "type": "boolean" + }, + "postconditions_confirmed": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Postconditions Confirmed" + }, + "effects_confirmed": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Effects Confirmed" + }, + "resolved_by_contract": { + "default": false, + "title": "Resolved By Contract", + "type": "boolean" + } + }, + "required": [ + "operation", + "native", + "observed_at", + "cause_type" + ], + "title": "ActionDeliveryUncertainty", + "type": "object" + }, + "serialization": { + "description": "Evidence that an action may have landed but cannot be retried safely.\n\nThis record never proves delivery or business success. It makes the\nuncertainty explicit and records whether the runtime subsequently proved\nthe complete postcondition + independent-effect contract.", + "properties": { + "status": { + "const": "delivery_uncertain", + "default": "delivery_uncertain", + "title": "Status", + "type": "string" + }, + "operation": { + "maxLength": 64, + "minLength": 1, + "pattern": "^[a-z][a-z0-9_]*$", + "title": "Operation", + "type": "string" + }, + "native": { + "title": "Native", + "type": "boolean" + }, + "target_fingerprint": { + "anyOf": [ + { + "pattern": "^[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Target Fingerprint" + }, + "observed_at": { + "maxLength": 64, + "minLength": 20, + "title": "Observed At", + "type": "string" + }, + "cause_type": { + "maxLength": 128, + "minLength": 1, + "pattern": "^[A-Za-z_][A-Za-z0-9_.]*$", + "title": "Cause Type", + "type": "string" + }, + "retried": { + "const": false, + "default": false, + "title": "Retried", + "type": "boolean" + }, + "verification_attempted": { + "default": false, + "title": "Verification Attempted", + "type": "boolean" + }, + "postconditions_confirmed": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Postconditions Confirmed" + }, + "effects_confirmed": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Effects Confirmed" + }, + "resolved_by_contract": { + "default": false, + "title": "Resolved By Contract", + "type": "boolean" + } + }, + "required": [ + "operation", + "native", + "observed_at", + "cause_type" + ], + "title": "ActionDeliveryUncertainty", + "type": "object" + } + }, + "Anchor": { + "validation": { + "$defs": { + "ConcatTemplate": { + "description": "Precomputed SPLIT-match key (consecutive recorded tokens the live OCR\nmay glue into one), since hashes cannot be concatenated at replay.", + "properties": { + "i": { + "title": "I", + "type": "integer" + }, + "size": { + "title": "Size", + "type": "integer" + }, + "c": { + "title": "C", + "type": "string" + }, + "r": { + "title": "R", + "type": "string" + }, + "digit": { + "title": "Digit", + "type": "boolean" + }, + "name": { + "title": "Name", + "type": "boolean" + }, + "n": { + "title": "N", + "type": "integer" + } + }, + "required": [ + "i", + "size", + "c", + "r", + "digit", + "name", + "n" + ], + "title": "ConcatTemplate", + "type": "object" + }, + "FormIdentity": { + "additionalProperties": false, + "description": "Record identity of a save on a create-new form: the form it submits is\nthe demonstrated form, holding exactly what this run typed.\n\nA form that creates a record shows no existing record next to its save\nbutton: the record is the one the run is entering. So the save's identity\nis the form itself, all of it. The recorder observes, right before the\ndemonstrated click on a labelled submit button, that the button submits\nthe one HTML form owning every field typed into since the last save (not\nin a table row or a single field's own widget), and fingerprints that\nform. Before the click at run time, the replayer requires:\n\n- the button is still that form's submit button, and the form owns\n exactly ``filled_fields`` fields this run typed into, each holding\n exactly what the run typed;\n- the form submits to the same origin and path (``action_sha256``) with\n the same ``method``, and would send the same set of control names and\n types (``controls_sha256``), hidden ones included;\n- every control the run did not type into (a hidden record or parent id,\n a select left on its default, a checked box) holds the demonstrated\n value: salted digests in ``value_digests``, under ``value_salt`` (the\n identity-template scheme). Hidden tokens are not compared (``exempt``):\n ones named like a token, and ones that changed while the demonstration\n was typed.\n\nAnything else halts before the click. A submit event from any other form\nor control during the click is cancelled and halts the run.\n\nCounts, tokens, names and digests only; no field text or value.", + "properties": { + "filled_fields": { + "maximum": 10000, + "minimum": 1, + "title": "Filled Fields", + "type": "integer" + }, + "submit_role": { + "const": "form_submit", + "title": "Submit Role", + "type": "string" + }, + "action_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Action Sha256", + "type": "string" + }, + "method": { + "enum": [ + "get", + "post", + "dialog" + ], + "title": "Method", + "type": "string" + }, + "controls_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Controls Sha256", + "type": "string" + }, + "value_salt": { + "default": "", + "maxLength": 128, + "title": "Value Salt", + "type": "string" + }, + "value_digests": { + "additionalProperties": { + "type": "string" + }, + "title": "Value Digests", + "type": "object" + }, + "exempt": { + "default": [], + "items": { + "type": "string" + }, + "title": "Exempt", + "type": "array" + } + }, + "required": [ + "filled_fields", + "submit_role", + "action_sha256", + "method", + "controls_sha256" + ], + "title": "FormIdentity", + "type": "object" + }, + "IdentityTemplate": { + "description": "PHI-free stand-in for ``Anchor.context_text`` / ``structured_identity``.\n\nA salted-hash, shape-preserving template of the recorded identity band. It\nlets the runtime re-run the SAME wrong-patient identity check\n(:mod:`openadapt_flow.runtime.identity_template`) with no readable name /\nDOB / MRN in the artifact. NOT a cryptographic control (a salted hash of a\nlow-entropy identifier is brute-forceable by a holder of the bundle + salt);\nit removes *plaintext* PHI. The at-rest control is bundle encryption\n(docs/phi_at_rest.md, deferred). Set ``OPENADAPT_FLOW_IDENTITY_SALT`` at\ncompile+replay to keep the salt out of the bundle and make the hashes\none-way to anyone without the external secret.", + "properties": { + "schema_version": { + "default": 1, + "title": "Schema Version", + "type": "integer" + }, + "salt": { + "default": "", + "description": "per-bundle salt (hex); empty => env salt", + "title": "Salt", + "type": "string" + }, + "band_len": { + "default": 0, + "title": "Band Len", + "type": "integer" + }, + "tokens": { + "items": { + "$ref": "#/$defs/TokenTemplate" + }, + "title": "Tokens", + "type": "array" + }, + "concats": { + "items": { + "$ref": "#/$defs/ConcatTemplate" + }, + "title": "Concats", + "type": "array" + }, + "punctuation_policy": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Punctuation Policy" + }, + "punctuation_indices": { + "items": { + "type": "integer" + }, + "title": "Punctuation Indices", + "type": "array" + }, + "punctuation_body_keys": { + "additionalProperties": { + "type": "string" + }, + "title": "Punctuation Body Keys", + "type": "object" + }, + "standalone_punctuation_indices": { + "items": { + "type": "integer" + }, + "title": "Standalone Punctuation Indices", + "type": "array" + }, + "ocr_noise": { + "anyOf": [ + { + "$ref": "#/$defs/IdentityTemplate" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Writer-owned salted noise hashes, schema0. Classification-only: can supply glyph uncertainty but never identity authority. Unavailable on parameterized calls." + }, + "structured": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "salted hash of the structured identity string", + "title": "Structured" + }, + "structured_params": { + "description": "Workflow parameters embedded in the structured identity. Their demonstrated values are replaced by fixed sentinels before hashing; replay substitutes the run's value before exact compare.", + "items": { + "type": "string" + }, + "title": "Structured Params", + "type": "array" + }, + "signal_hashes": { + "additionalProperties": { + "type": "string" + }, + "description": "Salted hashes of strict exact/explicitly-normalized identity evidence, including operator-selected extracted fields. Keys are produced by identity_signals.", + "title": "Signal Hashes", + "type": "object" + }, + "context_params": { + "description": "Workflow parameters replaced by fixed sentinels before the captured-context signal hashes were computed.", + "items": { + "type": "string" + }, + "title": "Context Params", + "type": "array" + }, + "param_token_indices": { + "additionalProperties": { + "items": { + "type": "integer" + }, + "type": "array" + }, + "title": "Param Token Indices", + "type": "object" + }, + "rests_on_confusable_identifier": { + "default": false, + "title": "Rests On Confusable Identifier", + "type": "boolean" + }, + "record_key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Salted hash of the stable record id the target's row carried at teach time (app-owned DOM data-* ids, the row link's path). When set, replay acts only on the shown row with the same id.", + "title": "Record Key" + }, + "structured_row": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Whether the structured identity came from a record row at teach time. False lets a replay surface that cannot count look-alike rows still act on the target (a form field, a button); None (unknown) is treated as a row.", + "title": "Structured Row" + }, + "teach_ambiguous": { + "default": false, + "description": "Teach time saw another shown row with the same identity and no record id between them. Replay halts before a consequential write: a twin that later scrolls out of view would otherwise pass the text check.", + "title": "Teach Ambiguous", + "type": "boolean" + } + }, + "title": "IdentityTemplate", + "type": "object" + }, + "Landmark": { + "description": "A stable nearby text element, used by the geometry resolution rung.\n\n``relation`` describes where the LANDMARK sits relative to the target:\na landmark that is ``left_of`` the target implies the target is\n``distance_px`` to the landmark's right. ``dx_px``/``dy_px``, when set,\nare the exact pixel offsets from the landmark's center to the target\nclick point (target = landmark_center + (dx_px, dy_px)); the geometry\nrung prefers them over the coarser relation/distance estimate.", + "properties": { + "relation": { + "enum": [ + "left_of", + "right_of", + "above", + "below" + ], + "title": "Relation", + "type": "string" + }, + "ocr_text": { + "title": "Ocr Text", + "type": "string" + }, + "distance_px": { + "title": "Distance Px", + "type": "integer" + }, + "match_mode": { + "default": "fuzzy", + "description": "OCR comparison mode for this retained relation. Compiler-mined generic context remains fuzzy; a qualified opaque-field label uses exact normalized text so a near label cannot authorize input.", + "enum": [ + "fuzzy", + "exact" + ], + "title": "Match Mode", + "type": "string" + }, + "dx_px": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Exact x offset landmark center -> target click point", + "title": "Dx Px" + }, + "dy_px": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Exact y offset landmark center -> target click point", + "title": "Dy Px" + } + }, + "required": [ + "relation", + "ocr_text", + "distance_px" + ], + "title": "Landmark", + "type": "object" + }, + "StructuralLocator": { + "description": "A stable structural (DOM / accessibility) locator for a step's target.\n\nCaptured at record time from the recording backend's structured layer\n(:meth:`openadapt_flow.backend.StructuralActionBackend.structural_locator_at`)\nand consumed at replay by the structural ACTION rung -- the TOP of the\nresolution ladder (:mod:`openadapt_flow.runtime.resolver`). The runtime\nre-finds the SAME element by its stable identity -- a DOM id / CSS selector\n/ ARIA role+name, or a Windows UIA ``AutomationId`` / ``ControlType``+\n``Name`` -- and acts on the element's center DETERMINISTICALLY, with no\npixel matching. This is the thesis shift from \"vision-only\" to\n\"deterministic compiled automation with visual FALLBACK\": the desktop\nbenchmark measured UIA execution 21/21 vs compiled visual replay 6/21 under\nrender drift.\n\nThe visual anchor (template / ocr_text / landmarks) is ALWAYS kept too: the\nladder falls through to it UNCHANGED when this locator is absent (pixel-only\nsubstrate -- RDP/Citrix/canvas) or when the element cannot be located at\nreplay (see docs/LIMITS.md). Structural resolution is ADDITIVE -- it never\nremoves the visual floor.\n\nFields are backend-neutral; a browser backend fills ``selector`` / ``role``\n/ ``name`` from the DOM, a native backend fills ``automation_id`` / ``role``\n/ ``name`` from its accessibility tree (Windows UIA AutomationId or the\nLinux AT-SPI accessible ID). Each backend uses whichever fields it\nrecorded; unset fields are ignored.", + "properties": { + "selector": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Stable CSS/DOM selector, e.g. '#open-p1' (browser)", + "title": "Selector" + }, + "frame_path": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "maxItems": 8, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Outermost-to-innermost CSS selectors for iframe/frame elements containing a browser target. Each selector must resolve uniquely in its parent frame; absent means the top-level document.", + "title": "Frame Path" + }, + "role": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "ARIA / UIA control role, e.g. 'button', 'link'", + "title": "Role" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Accessible name / label / text of the target element", + "title": "Name" + }, + "automation_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Stable native accessibility ID: Windows UIA AutomationId or Linux AT-SPI accessible ID", + "title": "Automation Id" + }, + "window_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Exact top-level accessibility window name captured with the target. Native backends use it to scope candidate enumeration and refuse duplicate controls in a different application window.", + "title": "Window Name" + } + }, + "title": "StructuralLocator", + "type": "object" + }, + "TokenTemplate": { + "description": "Salted-hash + shape descriptor for one recorded identity-band token.\n\nCarries NO plaintext (the PHI audit's REM-2): ``c``/``r`` are salted hashes\nof the token's OCR-canonical and squashed-raw forms; the rest are\nnon-identifying shape flags and a length. Enough to reproduce the\nwrong-patient guard's per-token budgets at replay\n(:mod:`openadapt_flow.runtime.identity_template`) without persisting the\nidentifier itself.", + "properties": { + "c": { + "description": "salted hash of ocr_canonical(squashed token)", + "title": "C", + "type": "string" + }, + "r": { + "description": "salted hash of squashed raw token", + "title": "R", + "type": "string" + }, + "n": { + "description": "squashed length", + "title": "N", + "type": "integer" + }, + "alpha": { + "default": false, + "title": "Alpha", + "type": "boolean" + }, + "name": { + "default": false, + "title": "Name", + "type": "boolean" + }, + "digit": { + "default": false, + "title": "Digit", + "type": "boolean" + }, + "idsh": { + "default": false, + "title": "Idsh", + "type": "boolean" + }, + "glyph": { + "default": false, + "title": "Glyph", + "type": "boolean" + }, + "gen": { + "default": false, + "title": "Gen", + "type": "boolean" + }, + "bearing": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "identity-bearing (identity.identity_bearing); None in bundles compiled before the flag, which count every token", + "title": "Bearing" + }, + "label": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Writer-owned generic UI-label role from the same raw/comparison token pair as bearing; unknown in older templates", + "title": "Label" + } + }, + "required": [ + "c", + "r", + "n" + ], + "title": "TokenTemplate", + "type": "object" + } + }, + "description": "Redundant evidence for locating a step's target on screen.\n\nResolution ladder consumes fields in order of preference (strongest, most\ndrift-tolerant first): ``structural`` (DOM / UIA element, when the backend\nsupports it) -> template (local, then global) -> ocr_text -> landmarks ->\ngrounder. ``structural`` is the deterministic top rung; the remaining\n(visual) rungs are the FALLBACK floor for pixel-only substrates.", + "properties": { + "template": { + "description": "Bundle-relative path to the PNG crop", + "title": "Template", + "type": "string" + }, + "structural": { + "anyOf": [ + { + "$ref": "#/$defs/StructuralLocator" + }, + { + "type": "null" + } + ], + "default": null, + "description": "STRUCTURAL locator (DOM selector / role+name, or UIA AutomationId / role+name) of the clicked target, captured at record time when the recording backend exposes it (openadapt_flow.backend.StructuralActionBackend). Drives the structural ACTION rung -- the TOP of the resolution ladder -- which re-finds the SAME element deterministically (no pixel match) and is far more drift-tolerant than the visual rungs (21/21 vs 6/21 on the desktop benchmark). None on pixel-only substrates or bundles compiled before this capability; the ladder then resolves via the visual rungs below." + }, + "region": { + "description": "Crop location in the recorded frame", + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "title": "Region", + "type": "array" + }, + "click_point": { + "description": "Click point in the recorded frame", + "maxItems": 2, + "minItems": 2, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "title": "Click Point", + "type": "array" + }, + "ocr_text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Text label at/near the target, if any", + "title": "Ocr Text" + }, + "context_text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Identity evidence: OCR text on the target's row (full-width band at the crop's height) EXCLUDING the target's own crop and timestamp-bearing lines. Verified before every click (see runtime.identity); None when the band had no usable text at compile time.", + "title": "Context Text" + }, + "structured_identity": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "STRUCTURED identity text (DOM / accessibility tree) of the clicked target's row, captured at record time when the recording backend exposes it (openadapt_flow.backend.IdentityBackend.structured_text_at). The REAL characters (a genuine digit 0 vs a letter O), so replay verifies identity by exact/normalized string compare with NO OCR ambiguity -- the structured-text tier of the identity ladder (see runtime.identity). None on pixel-only substrates or bundles recorded before this capability; the ladder then falls back to the OCR context_text tier.", + "title": "Structured Identity" + }, + "record_key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Stable record id of the target's row at record time (plaintext, compile-time only). The PHI-free pass hashes it into ``identity_template.record_key`` and clears this field.", + "title": "Record Key" + }, + "structured_row": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Whether ``structured_identity`` came from a record row (compile-time only; moved to ``identity_template.structured_row``).", + "title": "Structured Row" + }, + "structured_ambiguous": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Whether teach time saw another row read the same with no record id between them (compile-time only; moved to ``identity_template.teach_ambiguous``).", + "title": "Structured Ambiguous" + }, + "identity_template": { + "anyOf": [ + { + "$ref": "#/$defs/IdentityTemplate" + }, + { + "type": "null" + } + ], + "default": null, + "description": "PHI-FREE identity template (salted-hash + shape) of the recorded context band and structured identity. When present, the runtime verifies target identity from THIS (no plaintext name/DOB/MRN in the artifact \u2014 the PHI audit's REM-2) and ``context_text`` / ``structured_identity`` are None. Bundles compiled before this capability carry the plaintext fields instead and still replay unchanged (backward compatible). See openadapt_flow.runtime.identity_template." + }, + "identifier_crop": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Bundle-relative PNG crop of the target row's DISCRIMINATIVE IDENTIFIER cell (the MRN / name+DOB region), emitted by the COMPILER (templates/identifiers/.png -- under templates/ so it is sealed with the other image crops in an encrypted bundle) for identity-armed steps that captured no structured text (Citrix / RDP / remote-display pixel recordings), or for any step whose identifier region was explicitly marked at record time (--identifier). Feeds the pixel-compare and optional VLM tiers of the identity ladder (see runtime.identity): the rendered PIXELS retain the O/0 and l/1 distinction OCR collapses, so a crop-vs-crop compare catches the glyph-collapse wrong-patient where the DOM/a11y tree is unavailable. None on structured (browser/UIA) recordings unless marked (the structured tier owns identity there; no identity pixels at rest) and on bundles compiled before this capability -- Step.identifier_crop_missing_reason records WHY; the ladder then falls through to the OCR band tier.", + "title": "Identifier Crop" + }, + "identifier_region": { + "anyOf": [ + { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Location of `identifier_crop` in the recorded frame (x, y, w, h). Replay re-crops the SAME box at the resolved point (translated by the recorded region's offset from the recorded click point, exactly as the OCR band's exclude region is) so the pixel/VLM tiers compare like-for-like. Set iff `identifier_crop` is set.", + "title": "Identifier Region" + }, + "dialog_region": { + "anyOf": [ + { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Box of the active dialog (the topmost modal) that held the target in the recorded frame, when it sat in one. The context band was cut to it, so text of the page behind the dialog is not identity evidence. Replay cuts the live band to the live dialog's box, and fails the identity check closed when no dialog holds the resolved point. None outside a dialog and on bundles compiled before this capability.", + "title": "Dialog Region" + }, + "dialog_row": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "True reads the target's own row inside dialog_region. False permits the whole dialog when teach time positively found a standalone control with no usable row text; replay must confirm no record row again. None conservatively uses the target's row.", + "title": "Dialog Row" + }, + "form_identity": { + "anyOf": [ + { + "$ref": "#/$defs/FormIdentity" + }, + { + "type": "null" + } + ], + "default": null, + "description": "A labelled save on a create-new form: before the click, its form must hold exactly the fields this run typed, with the values typed. See FormIdentity. None everywhere else." + }, + "landmarks": { + "items": { + "$ref": "#/$defs/Landmark" + }, + "title": "Landmarks", + "type": "array" + }, + "search_pad": { + "default": 80, + "description": "Pixels of padding around `region` for the local search", + "title": "Search Pad", + "type": "integer" + } + }, + "required": [ + "template", + "region", + "click_point" + ], + "title": "Anchor", + "type": "object" + }, + "serialization": { + "additionalProperties": true, + "type": "object" + } + }, + "ApiAdmission": { + "validation": { + "additionalProperties": false, + "description": "A person's acceptance of a compiler-proposed API step.\n\nBound to the exact binding by :attr:`spec_digest`; a changed binding needs\na new admission. Only a person can admit (an agent, model or service name\nadmits nothing).", + "properties": { + "admitted_by": { + "minLength": 1, + "title": "Admitted By", + "type": "string" + }, + "admitted_at": { + "minLength": 1, + "title": "Admitted At", + "type": "string" + }, + "spec_digest": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Spec Digest", + "type": "string" + }, + "role": { + "const": "person", + "default": "person", + "title": "Role", + "type": "string" + } + }, + "required": [ + "admitted_by", + "admitted_at", + "spec_digest" + ], + "title": "ApiAdmission", + "type": "object" + }, + "serialization": { + "additionalProperties": false, + "description": "A person's acceptance of a compiler-proposed API step.\n\nBound to the exact binding by :attr:`spec_digest`; a changed binding needs\na new admission. Only a person can admit (an agent, model or service name\nadmits nothing).", + "properties": { + "admitted_by": { + "minLength": 1, + "title": "Admitted By", + "type": "string" + }, + "admitted_at": { + "minLength": 1, + "title": "Admitted At", + "type": "string" + }, + "spec_digest": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Spec Digest", + "type": "string" + }, + "role": { + "const": "person", + "default": "person", + "title": "Role", + "type": "string" + } + }, + "required": [ + "admitted_by", + "admitted_at", + "spec_digest" + ], + "title": "ApiAdmission", + "type": "object" + } + }, + "ApiBinding": { + "validation": { + "$defs": { + "ApiAdmission": { + "additionalProperties": false, + "description": "A person's acceptance of a compiler-proposed API step.\n\nBound to the exact binding by :attr:`spec_digest`; a changed binding needs\na new admission. Only a person can admit (an agent, model or service name\nadmits nothing).", + "properties": { + "admitted_by": { + "minLength": 1, + "title": "Admitted By", + "type": "string" + }, + "admitted_at": { + "minLength": 1, + "title": "Admitted At", + "type": "string" + }, + "spec_digest": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Spec Digest", + "type": "string" + }, + "role": { + "const": "person", + "default": "person", + "title": "Role", + "type": "string" + } + }, + "required": [ + "admitted_by", + "admitted_at", + "spec_digest" + ], + "title": "ApiAdmission", + "type": "object" + }, + "ApiIdentityBinding": { + "additionalProperties": false, + "description": "Exact API request/effect binding for one qualified identity signal.\n\n``param`` must be referenced by the outgoing request template and by\n``effect_field`` through ``ValueExpr(param=...)``. Runtime validates both\nsides before any request is sent, so an API optimization cannot bypass the\nqualified identity contract that guards the equivalent GUI action.", + "properties": { + "key": { + "enum": [ + "subject_name", + "record_id", + "secondary_identifier", + "application", + "session", + "workflow_state" + ], + "title": "Key", + "type": "string" + }, + "param": { + "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,127}$", + "title": "Param", + "type": "string" + }, + "effect_field": { + "pattern": "^[A-Za-z_][A-Za-z0-9_.-]{0,127}$", + "title": "Effect Field", + "type": "string" + }, + "request_pointers": { + "description": "Explicit target-bearing JSON pointers in the request template. Supported roots are /url/, /body/..., and /query/...; the terminal pointer segment must name the bound effect field, and headers are never accepted as target identity.", + "items": { + "type": "string" + }, + "maxItems": 8, + "minItems": 1, + "title": "Request Pointers", + "type": "array" + } + }, + "required": [ + "key", + "param", + "effect_field", + "request_pointers" + ], + "title": "ApiIdentityBinding", + "type": "object" + }, + "Effect": { + "description": "A typed system-of-record effect (RFC ``Effect``, concrete runtime form).\n\nAn ``Effect`` is a *contract*: what must be true of the system of record\nfor a step to have actually succeeded. It is deliberately substrate-neutral\n-- the SAME ``Effect`` is checked by the REST verifier, the FHIR verifier,\nor the filesystem verifier (see :class:`EffectVerifier`). The verifier maps\n:attr:`match` / :attr:`field` onto its substrate's query language.\n\nBinds to the RFC (``docs/design/WORKFLOW_PROGRAM_IR.md`` section 2.2): the\nRFC's ``Effect(kind=\"record_written\", probe=\"encounter exists for\npatient\")`` is realized here with a machine-checkable :attr:`match`\nselector and an :attr:`expected_count`; the RFC's\n``Effect(kind=\"field_equals\", field=\"note\", value=params.note)`` maps to\n:attr:`field` / :attr:`value`.", + "properties": { + "kind": { + "$ref": "#/$defs/EffectKind" + }, + "match": { + "additionalProperties": { + "$ref": "#/$defs/ValueExpr" + }, + "title": "Match", + "type": "object" + }, + "field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Field" + }, + "value": { + "anyOf": [ + { + "$ref": "#/$defs/ValueExpr" + }, + { + "type": "null" + } + ], + "default": null + }, + "expected_count": { + "default": 1, + "title": "Expected Count", + "type": "integer" + }, + "new_records": { + "items": { + "additionalProperties": { + "$ref": "#/$defs/ValueExpr" + }, + "type": "object" + }, + "title": "New Records", + "type": "array" + }, + "identity_field": { + "default": "id", + "title": "Identity Field", + "type": "string" + }, + "idempotency_key": { + "anyOf": [ + { + "$ref": "#/$defs/ValueExpr" + }, + { + "type": "null" + } + ], + "default": null + }, + "key_field": { + "default": "key", + "title": "Key Field", + "type": "string" + }, + "composite_key": { + "additionalProperties": { + "$ref": "#/$defs/ValueExpr" + }, + "title": "Composite Key", + "type": "object" + }, + "count_new_only": { + "default": false, + "title": "Count New Only", + "type": "boolean" + }, + "forbid_collateral_loss": { + "default": true, + "title": "Forbid Collateral Loss", + "type": "boolean" + }, + "forbid_collateral_change": { + "default": false, + "title": "Forbid Collateral Change", + "type": "boolean" + }, + "risk": { + "default": "reversible", + "title": "Risk", + "type": "string" + }, + "probe": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Probe" + }, + "timeout_s": { + "default": 5.0, + "title": "Timeout S", + "type": "number" + }, + "needs_operator_confirmation": { + "default": false, + "title": "Needs Operator Confirmation", + "type": "boolean" + }, + "readback": { + "anyOf": [ + { + "$ref": "#/$defs/ReadbackSpec" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "required": [ + "kind" + ], + "title": "Effect", + "type": "object" + }, + "EffectKind": { + "description": "System-of-record effect kinds (RFC section 2.2).\n\nThese are the NEW kinds the RFC adds beyond the vision-checkable\npostcondition kinds (``text_present`` / ``region_stable`` / ...): their\nprobe is a read against the system of record, not the frame.", + "enum": [ + "record_written", + "field_equals", + "exact_new_set" + ], + "title": "EffectKind", + "type": "string" + }, + "ReadbackAdmission": { + "additionalProperties": false, + "description": "A person's acceptance of a read-back taught by demonstration.\n\nThe demonstration that taught the check cannot approve it. Until a person\nadmits it, the check can't confirm a save (the verifier rules\n``INDETERMINATE``). The admission is bound to the exact check by\n:attr:`spec_digest`; a changed check needs a new admission.", + "properties": { + "admitted_by": { + "minLength": 1, + "title": "Admitted By", + "type": "string" + }, + "admitted_at": { + "minLength": 1, + "title": "Admitted At", + "type": "string" + }, + "spec_digest": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Spec Digest", + "type": "string" + }, + "role": { + "const": "person", + "default": "person", + "title": "Role", + "type": "string" + } + }, + "required": [ + "admitted_by", + "admitted_at", + "spec_digest" + ], + "title": "ReadbackAdmission", + "type": "object" + }, + "ReadbackField": { + "additionalProperties": false, + "description": "One field a person marked on the saved record's screen.\n\nThe verifier reads :attr:`region` and requires :attr:`value` there.", + "properties": { + "name": { + "title": "Name", + "type": "string" + }, + "region": { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "title": "Region", + "type": "array" + }, + "value": { + "$ref": "#/$defs/ValueExpr" + }, + "locator": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Locator" + }, + "source": { + "default": "ocr", + "enum": [ + "ocr", + "structure" + ], + "title": "Source", + "type": "string" + }, + "value_kind": { + "default": "text", + "enum": [ + "text", + "code", + "date", + "currency", + "number" + ], + "title": "Value Kind", + "type": "string" + }, + "date_order": { + "anyOf": [ + { + "enum": [ + "mdy", + "dmy" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Date Order" + } + }, + "required": [ + "name", + "region", + "value" + ], + "title": "ReadbackField", + "type": "object" + }, + "ReadbackGuard": { + "additionalProperties": false, + "description": "What a read-back's replayed navigation must never do.\n\nThe navigation runs in the acting session, on any surface (a browser, a\ndesktop app, an RDP or Citrix window), where no network guard can stop a\nstray write. Before each click the verifier reads the text under the\npointer and refuses a control whose label is a commit word or one of the\nsave's own control labels; it refuses save and delete key chords. A\nrefusal makes the check INDETERMINATE (HALT), never a guessed CONFIRM.", + "properties": { + "commit_labels": { + "items": { + "type": "string" + }, + "title": "Commit Labels", + "type": "array" + } + }, + "title": "ReadbackGuard", + "type": "object" + }, + "ReadbackNav": { + "description": "One deterministic navigation action to RE-OPEN the written record by a\npath DIFFERENT from the write flow, before an on-screen read-back.\n\nAuto-derived from the demonstration (the steps the person took to view the\nsaved record again \u2014 e.g. clear the form, search the patient, open the\nencounter). Deliberately tiny and model-free: a re-navigation is replayed\nby coordinate/keyboard exactly as recorded; anything a backend cannot\nperform makes the read-back INDETERMINATE (HALT), never a guessed CONFIRM.", + "properties": { + "action": { + "title": "Action", + "type": "string" + }, + "point": { + "anyOf": [ + { + "maxItems": 2, + "minItems": 2, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Point" + }, + "text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Text" + }, + "key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Key" + }, + "param": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Param" + }, + "reference": { + "default": false, + "title": "Reference", + "type": "boolean" + } + }, + "required": [ + "action" + ], + "title": "ReadbackNav", + "type": "object" + }, + "ReadbackReference": { + "additionalProperties": false, + "description": "A reference number the application shows right after the save.\n\nLearned from the demonstration: text that appeared on the screen the save\nleft, was not typed, and looks like an identifier (a claim, order or\nencounter number). Read at run time from :attr:`region` with\n:attr:`pattern` (one capture group), it is evidence that the application\nissued a record (check level ``same_screen``) and, when a navigation\nstep types it (:attr:`ReadbackNav.reference`), the way to find the record\nagain. The captured value itself is never stored in a report.", + "properties": { + "region": { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "title": "Region", + "type": "array" + }, + "pattern": { + "maxLength": 512, + "minLength": 1, + "title": "Pattern", + "type": "string" + } + }, + "required": [ + "region", + "pattern" + ], + "title": "ReadbackReference", + "type": "object" + }, + "ReadbackReset": { + "additionalProperties": false, + "description": "The step of a demonstrated check that throws away client-side state.\n\nWithout one, the check could read a form buffer or a client-side page the\nsave left behind, and a save that never reached the record would pass.", + "properties": { + "kind": { + "enum": [ + "reload", + "new_search", + "reopen_window", + "fresh_session" + ], + "title": "Kind", + "type": "string" + }, + "at": { + "minimum": 0, + "title": "At", + "type": "integer" + }, + "evidence": { + "default": "detected", + "enum": [ + "detected", + "declared" + ], + "title": "Evidence", + "type": "string" + } + }, + "required": [ + "kind", + "at" + ], + "title": "ReadbackReset", + "type": "object" + }, + "ReadbackSpec": { + "description": "The on-screen read-back oracle mined from the demonstration.\n\nCarries WHERE to re-read the saved value (:attr:`region`) and, for the\nstronger DIFFERENT-PATH variant, the re-navigation that re-opens the record\n(:attr:`renavigation`) so the read is forced through a real fetch rather\nthan the form the write left on screen. Consumed by\n:class:`~openadapt_flow.runtime.effects.onscreen.OnScreenReadbackVerifier`;\nevery non-onscreen substrate ignores it.\n\nSAFETY \u2014 the ``different_path`` flag is the gate. A ``different_path=True``\nread-back re-opens the record by an independent path (defeating the\n\"the form still shows what I typed but nothing persisted\" phantom-save\nclass) and is safe enough to be the DEFAULT out-of-the-box oracle. A\n``different_path=False`` (SAME-SURFACE) read-back re-reads the very region\nthe write drove; it CANNOT see a phantom/optimistic save (the measured\nfalse-CONFIRM rate is > 0), so it is wired but NON-default \u2014 a\nhalt-inducing consistency signal an operator opts into with eyes open, not\na pass. See ``docs/LIMITS.md`` and ``benchmark/effect_readback/``.", + "properties": { + "region": { + "anyOf": [ + { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Region" + }, + "different_path": { + "default": false, + "title": "Different Path", + "type": "boolean" + }, + "renavigation": { + "items": { + "$ref": "#/$defs/ReadbackNav" + }, + "title": "Renavigation", + "type": "array" + }, + "fields": { + "items": { + "$ref": "#/$defs/ReadbackField" + }, + "title": "Fields", + "type": "array" + }, + "demonstrated": { + "default": false, + "title": "Demonstrated", + "type": "boolean" + }, + "demonstrated_by": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Demonstrated By" + }, + "reset": { + "anyOf": [ + { + "$ref": "#/$defs/ReadbackReset" + }, + { + "type": "null" + } + ], + "default": null + }, + "admission": { + "anyOf": [ + { + "$ref": "#/$defs/ReadbackAdmission" + }, + { + "type": "null" + } + ], + "default": null + }, + "guard": { + "anyOf": [ + { + "$ref": "#/$defs/ReadbackGuard" + }, + { + "type": "null" + } + ], + "default": null + }, + "reference": { + "anyOf": [ + { + "$ref": "#/$defs/ReadbackReference" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "ReadbackSpec", + "type": "object" + }, + "ValueExpr": { + "additionalProperties": false, + "description": "A single effect-contract value: either a static ``literal`` or a\nreference to a run ``param`` (P0-3 fix).\n\nBefore this type an :class:`Effect` carried plain static strings, so a\nPARAMETERIZED workflow verified its effects against the values baked in at\nDEMONSTRATION time (write patient \"Susan\" via the GUI, then verify the\nrecorded demo patient \"Phil\"). ``ValueExpr`` lets a compiled effect declare\n``{\"param\": \"patient_id\"}`` and have the runtime resolve it against the\nRUN's params before verification, so the record actually written is the\nrecord checked.\n\nExactly one of :attr:`literal` / :attr:`param` is meaningful. Old bundles\n(and hand-authored effects) that pass a bare string are coerced to\n``ValueExpr(literal=...)`` by :class:`Effect`'s validators, and this type's\n``__eq__`` / ``__str__`` compare/render as that bare string so every\nexisting reader (learning gate signatures, codegen review comments) and the\nsubstrate matchers behave BYTE-FOR-BYTE identically for a literal.", + "properties": { + "literal": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Literal" + }, + "param": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Param" + }, + "map": { + "anyOf": [ + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Map" + }, + "stored": { + "anyOf": [ + { + "enum": [ + "upper", + "lower", + "capitalize_words" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Stored" + }, + "kind": { + "anyOf": [ + { + "enum": [ + "phone", + "date", + "email" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Kind" + }, + "date_order": { + "anyOf": [ + { + "enum": [ + "mdy", + "dmy" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Date Order" + }, + "null": { + "anyOf": [ + { + "const": true, + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Null" + }, + "absent_is_null": { + "anyOf": [ + { + "const": true, + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Absent Is Null" + }, + "number": { + "anyOf": [ + { + "const": true, + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Number" + } + }, + "title": "ValueExpr", + "type": "object" + }, + "WebFormField": { + "additionalProperties": false, + "description": "One field of a recorded form save, and where its value comes from.\n\n``param``: a run parameter typed into the form. ``select_label``: a select\nwhose option is chosen by the label in ``param`` (the value is looked up in\nthe live form each run). ``session``: a value the server issued to this\nsession, such as a CSRF token, read from the live form each run.\n``form_default``: the form's own default, which must still equal ``value``\nin the live form or the API step does not run. ``submitter``: the\n``name=value`` the browser adds for the submit button the person clicked;\nthe live form must still have exactly one enabled submit button that\nsends exactly ``value``. ``empty_file``: a file input sent with no file\n(a multipart save); the live form must still have that file input, and\nthe API step never attaches a file.", + "properties": { + "name": { + "minLength": 1, + "title": "Name", + "type": "string" + }, + "source": { + "enum": [ + "param", + "select_label", + "session", + "form_default", + "submitter", + "empty_file" + ], + "title": "Source", + "type": "string" + }, + "param": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Param" + }, + "value": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Value" + } + }, + "required": [ + "name", + "source" + ], + "title": "WebFormField", + "type": "object" + }, + "WebFormPrecheck": { + "additionalProperties": false, + "description": "A read-only request the page made before the save, and its pass rule.\n\nCarries over a check the GUI program made on screen before saving (for\nexample a duplicate search that must say \"No matches were found.\"). The\nresponse must contain every ``require_text`` or the API step does not\nsend the save.", + "properties": { + "path": { + "minLength": 1, + "title": "Path", + "type": "string" + }, + "query": { + "items": { + "maxItems": 2, + "minItems": 2, + "prefixItems": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "type": "array" + }, + "title": "Query", + "type": "array" + }, + "require_text": { + "items": { + "type": "string" + }, + "minItems": 1, + "title": "Require Text", + "type": "array" + }, + "from_step": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "From Step" + } + }, + "required": [ + "path", + "require_text" + ], + "title": "WebFormPrecheck", + "type": "object" + }, + "WebFormSpec": { + "additionalProperties": false, + "description": "How to repeat a recorded browser form save as one HTTP request.\n\nCompiled from the network traffic captured during ``record\n--capture-network``. The request goes through the replaying browser's\nown session (its cookies), so no credential is stored or needed. Before\nsending, the runtime reads ``form_path`` again and refuses (falls back to\nthe GUI steps) if the form's fields, defaults, options or client-side\nrules differ from the recording.", + "properties": { + "form_path": { + "minLength": 1, + "title": "Form Path", + "type": "string" + }, + "fields": { + "items": { + "$ref": "#/$defs/WebFormField" + }, + "minItems": 1, + "title": "Fields", + "type": "array" + }, + "controls": { + "items": { + "type": "string" + }, + "title": "Controls", + "type": "array" + }, + "encoding": { + "default": "urlencoded", + "enum": [ + "urlencoded", + "multipart", + "json" + ], + "title": "Encoding", + "type": "string" + }, + "json_body": { + "anyOf": [ + {}, + { + "type": "null" + } + ], + "default": null, + "title": "Json Body" + }, + "session_headers": { + "items": { + "type": "string" + }, + "title": "Session Headers", + "type": "array" + }, + "graphql": { + "default": false, + "title": "Graphql", + "type": "boolean" + }, + "api_origin": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Api Origin" + }, + "form_action": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Form Action" + }, + "client_rules": { + "anyOf": [ + { + "additionalProperties": true, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Client Rules" + }, + "client_scripts": { + "items": { + "type": "string" + }, + "title": "Client Scripts", + "type": "array" + }, + "submitter": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Submitter" + }, + "submitter_requests": { + "items": { + "type": "string" + }, + "title": "Submitter Requests", + "type": "array" + }, + "confirm": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Confirm" + }, + "prechecks": { + "items": { + "$ref": "#/$defs/WebFormPrecheck" + }, + "title": "Prechecks", + "type": "array" + }, + "success_pattern": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Success Pattern" + }, + "replaces_steps": { + "items": { + "type": "string" + }, + "minItems": 1, + "title": "Replaces Steps", + "type": "array" + }, + "other_writes_seen": { + "items": { + "type": "string" + }, + "title": "Other Writes Seen", + "type": "array" + }, + "writes": { + "items": { + "$ref": "#/$defs/WebFormWrite" + }, + "title": "Writes", + "type": "array" + }, + "screen_only_checks": { + "items": { + "type": "string" + }, + "title": "Screen Only Checks", + "type": "array" + }, + "folded_checks_digest": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Folded Checks Digest", + "type": "string" + } + }, + "required": [ + "form_path", + "fields", + "replaces_steps", + "folded_checks_digest" + ], + "title": "WebFormSpec", + "type": "object" + }, + "WebFormWrite": { + "additionalProperties": false, + "description": "A request, other than the save, that wrote while the replaced steps ran.\n\nThe API step's span is a declared, ordered sequence: these writes in the\norder they were recorded, then the save. Each is one of two roles:\n\n- ``ambient``: the page sent it on its own. It came from a script of\n another document than the form, one that was loaded before the form\n opened (for example an app's tab shell that posts\n ``execute_background_services.php`` on a timer), and the form page's\n source doesn't name it. No replaced step caused it, so the API step\n neither sends nor waits for it; the live page goes on as it does under\n the GUI steps. Listed for the person who admits the step.\n- ``step``: a replaced step caused it. The API step sends it, rebuilt\n from ``fields`` the same way as the save, in its recorded place before\n the save. Its read-back is the record check declared on ``from_step``,\n which the binding's record check includes; admission refuses a step\n write whose step has none. A write that fails, or whose response is\n outside ``expected_status``, stops the run with nothing after it sent,\n nothing retried and nothing redone through the GUI, and the run\n reconciles by reading the records back.", + "properties": { + "role": { + "enum": [ + "ambient", + "step" + ], + "title": "Role", + "type": "string" + }, + "method": { + "minLength": 1, + "title": "Method", + "type": "string" + }, + "path": { + "minLength": 1, + "title": "Path", + "type": "string" + }, + "sent_by": { + "default": "", + "title": "Sent By", + "type": "string" + }, + "from_step": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "From Step" + }, + "fields": { + "items": { + "$ref": "#/$defs/WebFormField" + }, + "title": "Fields", + "type": "array" + }, + "expected_status": { + "items": { + "type": "integer" + }, + "title": "Expected Status", + "type": "array" + }, + "evidence": { + "default": "", + "title": "Evidence", + "type": "string" + } + }, + "required": [ + "role", + "method", + "path" + ], + "title": "WebFormWrite", + "type": "object" + } + }, + "description": "A declarative API/tool call that performs a step's write WITHOUT the GUI.\n\nThe TOP of the capability ladder (RFC ``docs/design/WORKFLOW_PROGRAM_IR.md``\nsection 4, the ``api`` implementation of a ``TransitionContract``): where the\ntarget app exposes a real API, driving its GUI to make the same write is the\nwrong tool. When a step carries an ``ApiBinding`` AND the run configures an\n:class:`~openadapt_flow.runtime.actuators.ApiActuator`, the runtime performs\nthe write by CALLING the API deterministically (``$0``, zero model calls),\nconfirms it with the same\n:class:`~openadapt_flow.runtime.effects.EffectVerifier` that gates a GUI\nwrite, and SKIPS the GUI resolution/act for that step. This is the\n``api`` leaf of the same contract the structural rung realizes as ``dom_uia``\nand the visual ladder realizes as ``vision_rdp`` -- one semantic effect,\nbackend-specific implementation.\n\nADDITIVE and back-compatible: the field is optional and defaults absent, so a\nbundle carrying no binding replays EXACTLY as today (GUI actuation). A binding\nalso defaults to GUI fallback when the API tier is unavailable before\ndelivery. A workflow can instead set ``on_unavailable=\"halt\"`` to declare an\nAPI-only action. That mode refuses before GUI resolution or input rather than\ninventing a second, unqualified actuation path.\n\nFields are REST/JSON-first but shaped so a FHIR / MCP / tool binding fits the\nsame model (``kind`` selects the substrate; a FHIR resource POST, an MCP tool\ninvocation, and a plain REST write all reduce to method + endpoint + body +\nthe expected effect). Placeholders ``{param}`` in the URL / query / body are\nsubstituted from the run's typed params (``Workflow.params`` overlaid by the\ncaller's values) at actuation time.", + "properties": { + "kind": { + "default": "rest", + "description": "Substrate: 'rest'/'fhir' HTTP, an 'mcp'/'tool' call, or 'web_form': a browser form save repeated through the live session", + "enum": [ + "rest", + "fhir", + "mcp", + "tool", + "web_form" + ], + "title": "Kind", + "type": "string" + }, + "on_unavailable": { + "default": "gui", + "description": "Pre-delivery API-unavailability policy. 'gui' preserves the back-compatible GUI fallback; 'halt' declares this step API-only and refuses without GUI input when no actuator is configured or the actuator proves that no request was sent.", + "enum": [ + "gui", + "halt" + ], + "title": "On Unavailable", + "type": "string" + }, + "method": { + "default": "POST", + "description": "HTTP verb (REST/FHIR) or logical operation name (mcp/tool)", + "title": "Method", + "type": "string" + }, + "url_template": { + "description": "Endpoint template; absolute (http...) or relative to the actuator's base_url. `{param}` placeholders are substituted from the run's typed params.", + "title": "Url Template", + "type": "string" + }, + "body_template": { + "additionalProperties": true, + "description": "JSON request body template; string leaves may carry `{param}` placeholders substituted from the run's params.", + "title": "Body Template", + "type": "object" + }, + "query": { + "additionalProperties": { + "type": "string" + }, + "description": "Query-string params; values may carry `{param}` too", + "title": "Query", + "type": "object" + }, + "headers": { + "additionalProperties": { + "type": "string" + }, + "description": "Extra request headers; values may carry `{param}`", + "title": "Headers", + "type": "object" + }, + "expected_status": { + "description": "Explicit acceptable HTTP status codes; empty means any 2xx is success (anything else is treated as an attempted write of unknown effect and HALTs -- never GUI-retried).", + "items": { + "type": "integer" + }, + "title": "Expected Status", + "type": "array" + }, + "timeout_s": { + "default": 5.0, + "description": "Per-request timeout in seconds", + "title": "Timeout S", + "type": "number" + }, + "effects": { + "description": "The system-of-record effect(s) this call is expected to produce. Used to CONFIRM the API write via the run's EffectVerifier when the step itself declares no `effects` (an API write must be confirmable, exactly as a GUI write with declared effects is).", + "items": { + "$ref": "#/$defs/Effect" + }, + "title": "Effects", + "type": "array" + }, + "identity": { + "description": "Exact run-parameter bindings that prove qualified record identity for API actuation. Each binding must occur in both the request template and an effect selector before the request may be sent.", + "items": { + "$ref": "#/$defs/ApiIdentityBinding" + }, + "title": "Identity", + "type": "array" + }, + "web_form": { + "anyOf": [ + { + "$ref": "#/$defs/WebFormSpec" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The recorded form save, for kind='web_form' only" + }, + "admission": { + "anyOf": [ + { + "$ref": "#/$defs/ApiAdmission" + }, + { + "type": "null" + } + ], + "default": null, + "description": "A person's acceptance of a compiler-proposed binding. A web_form binding never runs without one." + } + }, + "required": [ + "url_template" + ], + "title": "ApiBinding", + "type": "object" + }, + "serialization": { + "$defs": { + "ApiAdmission": { + "additionalProperties": false, + "description": "A person's acceptance of a compiler-proposed API step.\n\nBound to the exact binding by :attr:`spec_digest`; a changed binding needs\na new admission. Only a person can admit (an agent, model or service name\nadmits nothing).", + "properties": { + "admitted_by": { + "minLength": 1, + "title": "Admitted By", + "type": "string" + }, + "admitted_at": { + "minLength": 1, + "title": "Admitted At", + "type": "string" + }, + "spec_digest": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Spec Digest", + "type": "string" + }, + "role": { + "const": "person", + "default": "person", + "title": "Role", + "type": "string" + } + }, + "required": [ + "admitted_by", + "admitted_at", + "spec_digest" + ], + "title": "ApiAdmission", + "type": "object" + }, + "ApiIdentityBinding": { + "additionalProperties": false, + "description": "Exact API request/effect binding for one qualified identity signal.\n\n``param`` must be referenced by the outgoing request template and by\n``effect_field`` through ``ValueExpr(param=...)``. Runtime validates both\nsides before any request is sent, so an API optimization cannot bypass the\nqualified identity contract that guards the equivalent GUI action.", + "properties": { + "key": { + "enum": [ + "subject_name", + "record_id", + "secondary_identifier", + "application", + "session", + "workflow_state" + ], + "title": "Key", + "type": "string" + }, + "param": { + "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,127}$", + "title": "Param", + "type": "string" + }, + "effect_field": { + "pattern": "^[A-Za-z_][A-Za-z0-9_.-]{0,127}$", + "title": "Effect Field", + "type": "string" + }, + "request_pointers": { + "description": "Explicit target-bearing JSON pointers in the request template. Supported roots are /url/, /body/..., and /query/...; the terminal pointer segment must name the bound effect field, and headers are never accepted as target identity.", + "items": { + "type": "string" + }, + "maxItems": 8, + "minItems": 1, + "title": "Request Pointers", + "type": "array" + } + }, + "required": [ + "key", + "param", + "effect_field", + "request_pointers" + ], + "title": "ApiIdentityBinding", + "type": "object" + }, + "Effect": { + "additionalProperties": true, + "type": "object" + }, + "WebFormSpec": {} + }, + "description": "A declarative API/tool call that performs a step's write WITHOUT the GUI.\n\nThe TOP of the capability ladder (RFC ``docs/design/WORKFLOW_PROGRAM_IR.md``\nsection 4, the ``api`` implementation of a ``TransitionContract``): where the\ntarget app exposes a real API, driving its GUI to make the same write is the\nwrong tool. When a step carries an ``ApiBinding`` AND the run configures an\n:class:`~openadapt_flow.runtime.actuators.ApiActuator`, the runtime performs\nthe write by CALLING the API deterministically (``$0``, zero model calls),\nconfirms it with the same\n:class:`~openadapt_flow.runtime.effects.EffectVerifier` that gates a GUI\nwrite, and SKIPS the GUI resolution/act for that step. This is the\n``api`` leaf of the same contract the structural rung realizes as ``dom_uia``\nand the visual ladder realizes as ``vision_rdp`` -- one semantic effect,\nbackend-specific implementation.\n\nADDITIVE and back-compatible: the field is optional and defaults absent, so a\nbundle carrying no binding replays EXACTLY as today (GUI actuation). A binding\nalso defaults to GUI fallback when the API tier is unavailable before\ndelivery. A workflow can instead set ``on_unavailable=\"halt\"`` to declare an\nAPI-only action. That mode refuses before GUI resolution or input rather than\ninventing a second, unqualified actuation path.\n\nFields are REST/JSON-first but shaped so a FHIR / MCP / tool binding fits the\nsame model (``kind`` selects the substrate; a FHIR resource POST, an MCP tool\ninvocation, and a plain REST write all reduce to method + endpoint + body +\nthe expected effect). Placeholders ``{param}`` in the URL / query / body are\nsubstituted from the run's typed params (``Workflow.params`` overlaid by the\ncaller's values) at actuation time.", + "properties": { + "kind": { + "default": "rest", + "description": "Substrate: 'rest'/'fhir' HTTP, an 'mcp'/'tool' call, or 'web_form': a browser form save repeated through the live session", + "enum": [ + "rest", + "fhir", + "mcp", + "tool", + "web_form" + ], + "title": "Kind", + "type": "string" + }, + "on_unavailable": { + "default": "gui", + "description": "Pre-delivery API-unavailability policy. 'gui' preserves the back-compatible GUI fallback; 'halt' declares this step API-only and refuses without GUI input when no actuator is configured or the actuator proves that no request was sent.", + "enum": [ + "gui", + "halt" + ], + "title": "On Unavailable", + "type": "string" + }, + "method": { + "default": "POST", + "description": "HTTP verb (REST/FHIR) or logical operation name (mcp/tool)", + "title": "Method", + "type": "string" + }, + "url_template": { + "description": "Endpoint template; absolute (http...) or relative to the actuator's base_url. `{param}` placeholders are substituted from the run's typed params.", + "title": "Url Template", + "type": "string" + }, + "body_template": { + "additionalProperties": true, + "description": "JSON request body template; string leaves may carry `{param}` placeholders substituted from the run's params.", + "title": "Body Template", + "type": "object" + }, + "query": { + "additionalProperties": { + "type": "string" + }, + "description": "Query-string params; values may carry `{param}` too", + "title": "Query", + "type": "object" + }, + "headers": { + "additionalProperties": { + "type": "string" + }, + "description": "Extra request headers; values may carry `{param}`", + "title": "Headers", + "type": "object" + }, + "expected_status": { + "description": "Explicit acceptable HTTP status codes; empty means any 2xx is success (anything else is treated as an attempted write of unknown effect and HALTs -- never GUI-retried).", + "items": { + "type": "integer" + }, + "title": "Expected Status", + "type": "array" + }, + "timeout_s": { + "default": 5.0, + "description": "Per-request timeout in seconds", + "title": "Timeout S", + "type": "number" + }, + "effects": { + "description": "The system-of-record effect(s) this call is expected to produce. Used to CONFIRM the API write via the run's EffectVerifier when the step itself declares no `effects` (an API write must be confirmable, exactly as a GUI write with declared effects is).", + "items": { + "$ref": "#/$defs/Effect" + }, + "title": "Effects", + "type": "array" + }, + "identity": { + "description": "Exact run-parameter bindings that prove qualified record identity for API actuation. Each binding must occur in both the request template and an effect selector before the request may be sent.", + "items": { + "$ref": "#/$defs/ApiIdentityBinding" + }, + "title": "Identity", + "type": "array" + }, + "web_form": { + "anyOf": [ + { + "$ref": "#/$defs/WebFormSpec" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The recorded form save, for kind='web_form' only" + }, + "admission": { + "anyOf": [ + { + "$ref": "#/$defs/ApiAdmission" + }, + { + "type": "null" + } + ], + "default": null, + "description": "A person's acceptance of a compiler-proposed binding. A web_form binding never runs without one." + } + }, + "required": [ + "url_template" + ], + "title": "ApiBinding", + "type": "object" + } + }, + "ApiIdentityBinding": { + "validation": { + "additionalProperties": false, + "description": "Exact API request/effect binding for one qualified identity signal.\n\n``param`` must be referenced by the outgoing request template and by\n``effect_field`` through ``ValueExpr(param=...)``. Runtime validates both\nsides before any request is sent, so an API optimization cannot bypass the\nqualified identity contract that guards the equivalent GUI action.", + "properties": { + "key": { + "enum": [ + "subject_name", + "record_id", + "secondary_identifier", + "application", + "session", + "workflow_state" + ], + "title": "Key", + "type": "string" + }, + "param": { + "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,127}$", + "title": "Param", + "type": "string" + }, + "effect_field": { + "pattern": "^[A-Za-z_][A-Za-z0-9_.-]{0,127}$", + "title": "Effect Field", + "type": "string" + }, + "request_pointers": { + "description": "Explicit target-bearing JSON pointers in the request template. Supported roots are /url/, /body/..., and /query/...; the terminal pointer segment must name the bound effect field, and headers are never accepted as target identity.", + "items": { + "type": "string" + }, + "maxItems": 8, + "minItems": 1, + "title": "Request Pointers", + "type": "array" + } + }, + "required": [ + "key", + "param", + "effect_field", + "request_pointers" + ], + "title": "ApiIdentityBinding", + "type": "object" + }, + "serialization": { + "additionalProperties": false, + "description": "Exact API request/effect binding for one qualified identity signal.\n\n``param`` must be referenced by the outgoing request template and by\n``effect_field`` through ``ValueExpr(param=...)``. Runtime validates both\nsides before any request is sent, so an API optimization cannot bypass the\nqualified identity contract that guards the equivalent GUI action.", + "properties": { + "key": { + "enum": [ + "subject_name", + "record_id", + "secondary_identifier", + "application", + "session", + "workflow_state" + ], + "title": "Key", + "type": "string" + }, + "param": { + "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,127}$", + "title": "Param", + "type": "string" + }, + "effect_field": { + "pattern": "^[A-Za-z_][A-Za-z0-9_.-]{0,127}$", + "title": "Effect Field", + "type": "string" + }, + "request_pointers": { + "description": "Explicit target-bearing JSON pointers in the request template. Supported roots are /url/, /body/..., and /query/...; the terminal pointer segment must name the bound effect field, and headers are never accepted as target identity.", + "items": { + "type": "string" + }, + "maxItems": 8, + "minItems": 1, + "title": "Request Pointers", + "type": "array" + } + }, + "required": [ + "key", + "param", + "effect_field", + "request_pointers" + ], + "title": "ApiIdentityBinding", + "type": "object" + } + }, + "AttendedProgramTransitionEvidence": { + "validation": { + "$defs": { + "ProgramExecutionScopeFrame": { + "additionalProperties": false, + "description": "PHI-free control scope for one action in a program run.", + "properties": { + "graph_id": { + "maxLength": 128, + "minLength": 1, + "title": "Graph Id", + "type": "string" + }, + "loop_state_id": { + "anyOf": [ + { + "maxLength": 128, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Loop State Id" + }, + "relation": { + "anyOf": [ + { + "maxLength": 128, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Relation" + }, + "row_index": { + "anyOf": [ + { + "minimum": 0, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Row Index" + } + }, + "required": [ + "graph_id" + ], + "title": "ProgramExecutionScopeFrame", + "type": "object" + } + }, + "additionalProperties": false, + "description": "A signed attended transition consumed without evaluating its guard again.", + "properties": { + "decision_index": { + "minimum": 0, + "title": "Decision Index", + "type": "integer" + }, + "graph_id": { + "maxLength": 128, + "minLength": 1, + "title": "Graph Id", + "type": "string" + }, + "state_id": { + "maxLength": 128, + "minLength": 1, + "title": "State Id", + "type": "string" + }, + "program_scope": { + "items": { + "$ref": "#/$defs/ProgramExecutionScopeFrame" + }, + "minItems": 1, + "title": "Program Scope", + "type": "array" + }, + "target_state_id": { + "anyOf": [ + { + "maxLength": 128, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Target State Id" + }, + "action": { + "enum": [ + "continue", + "skip" + ], + "title": "Action", + "type": "string" + }, + "receipt_pause_id": { + "pattern": "^[0-9a-f]{32}$", + "title": "Receipt Pause Id", + "type": "string" + }, + "receipt_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Receipt Sha256", + "type": "string" + }, + "receipt_inventory_ref": { + "maxLength": 512, + "minLength": 1, + "title": "Receipt Inventory Ref", + "type": "string" + }, + "control_frames_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Control Frames Sha256", + "type": "string" + }, + "control_frames_inventory_ref": { + "maxLength": 512, + "minLength": 1, + "title": "Control Frames Inventory Ref", + "type": "string" + }, + "governed_runtime_inputs_digest": { + "anyOf": [ + { + "pattern": "^[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Governed Runtime Inputs Digest" + } + }, + "required": [ + "decision_index", + "graph_id", + "state_id", + "program_scope", + "action", + "receipt_pause_id", + "receipt_sha256", + "receipt_inventory_ref", + "control_frames_sha256", + "control_frames_inventory_ref" + ], + "title": "AttendedProgramTransitionEvidence", + "type": "object" + }, + "serialization": { + "$defs": { + "ProgramExecutionScopeFrame": { + "additionalProperties": false, + "description": "PHI-free control scope for one action in a program run.", + "properties": { + "graph_id": { + "maxLength": 128, + "minLength": 1, + "title": "Graph Id", + "type": "string" + }, + "loop_state_id": { + "anyOf": [ + { + "maxLength": 128, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Loop State Id" + }, + "relation": { + "anyOf": [ + { + "maxLength": 128, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Relation" + }, + "row_index": { + "anyOf": [ + { + "minimum": 0, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Row Index" + } + }, + "required": [ + "graph_id" + ], + "title": "ProgramExecutionScopeFrame", + "type": "object" + } + }, + "additionalProperties": false, + "description": "A signed attended transition consumed without evaluating its guard again.", + "properties": { + "decision_index": { + "minimum": 0, + "title": "Decision Index", + "type": "integer" + }, + "graph_id": { + "maxLength": 128, + "minLength": 1, + "title": "Graph Id", + "type": "string" + }, + "state_id": { + "maxLength": 128, + "minLength": 1, + "title": "State Id", + "type": "string" + }, + "program_scope": { + "items": { + "$ref": "#/$defs/ProgramExecutionScopeFrame" + }, + "minItems": 1, + "title": "Program Scope", + "type": "array" + }, + "target_state_id": { + "anyOf": [ + { + "maxLength": 128, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Target State Id" + }, + "action": { + "enum": [ + "continue", + "skip" + ], + "title": "Action", + "type": "string" + }, + "receipt_pause_id": { + "pattern": "^[0-9a-f]{32}$", + "title": "Receipt Pause Id", + "type": "string" + }, + "receipt_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Receipt Sha256", + "type": "string" + }, + "receipt_inventory_ref": { + "maxLength": 512, + "minLength": 1, + "title": "Receipt Inventory Ref", + "type": "string" + }, + "control_frames_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Control Frames Sha256", + "type": "string" + }, + "control_frames_inventory_ref": { + "maxLength": 512, + "minLength": 1, + "title": "Control Frames Inventory Ref", + "type": "string" + }, + "governed_runtime_inputs_digest": { + "anyOf": [ + { + "pattern": "^[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Governed Runtime Inputs Digest" + } + }, + "required": [ + "decision_index", + "graph_id", + "state_id", + "program_scope", + "action", + "receipt_pause_id", + "receipt_sha256", + "receipt_inventory_ref", + "control_frames_sha256", + "control_frames_inventory_ref" + ], + "title": "AttendedProgramTransitionEvidence", + "type": "object" + } + }, + "BackendHints": { + "validation": { + "additionalProperties": false, + "description": "Trusted local execution target captured with a remote-display demo.\n\nThese hints bind a window-scoped recording to the same local client window\nat replay time. They live only inside ``workflow.json``: plaintext in an\nexplicitly unencrypted local bundle, or encrypted with the rest of a sealed\nbundle. They never enter the plaintext manifest or PHI-free hosted report\nrail because a window title can contain a patient or account name.\n\nThe schema is deliberately closed to the two pixel-window substrates that\nuse ``BackendConfig.rdp_*``. Network endpoints, credentials, arbitrary\nbackend configuration, and provider-specific recipes are not recording\nmetadata and must still come from the deployment config.", + "properties": { + "backend": { + "enum": [ + "rdp", + "citrix" + ], + "title": "Backend", + "type": "string" + }, + "rdp_window": { + "anyOf": [ + { + "maxLength": 512, + "minLength": 1, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Window" + }, + "rdp_window_title": { + "anyOf": [ + { + "maxLength": 512, + "minLength": 1, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Window Title" + }, + "rdp_readiness_text": { + "anyOf": [ + { + "maxLength": 512, + "minLength": 1, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Readiness Text" + } + }, + "required": [ + "backend" + ], + "title": "BackendHints", + "type": "object" + }, + "serialization": { + "additionalProperties": false, + "description": "Trusted local execution target captured with a remote-display demo.\n\nThese hints bind a window-scoped recording to the same local client window\nat replay time. They live only inside ``workflow.json``: plaintext in an\nexplicitly unencrypted local bundle, or encrypted with the rest of a sealed\nbundle. They never enter the plaintext manifest or PHI-free hosted report\nrail because a window title can contain a patient or account name.\n\nThe schema is deliberately closed to the two pixel-window substrates that\nuse ``BackendConfig.rdp_*``. Network endpoints, credentials, arbitrary\nbackend configuration, and provider-specific recipes are not recording\nmetadata and must still come from the deployment config.", + "properties": { + "backend": { + "enum": [ + "rdp", + "citrix" + ], + "title": "Backend", + "type": "string" + }, + "rdp_window": { + "anyOf": [ + { + "maxLength": 512, + "minLength": 1, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Window" + }, + "rdp_window_title": { + "anyOf": [ + { + "maxLength": 512, + "minLength": 1, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Window Title" + }, + "rdp_readiness_text": { + "anyOf": [ + { + "maxLength": 512, + "minLength": 1, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Readiness Text" + } + }, + "required": [ + "backend" + ], + "title": "BackendHints", + "type": "object" + } + }, + "BundleManifest": { + "validation": { + "$defs": { + "BundleProvenance": { + "description": "Who produced a bundle and, if certified, under what policy (schema v2).\n\n``compiler_version`` records the ``openadapt_flow`` version that compiled /\nlast saved the bundle, so an operator inventory can tell which compiler an\nartifact came from. The certification block is populated only for a bundle\nthat passed a policy certification (see :meth:`Workflow.stamp_certification`\n/ ``openadapt_flow.policy.evaluate_policy``): ``policy_name`` is the policy\nit was certified against, ``certification_status`` is a short label\n(``\"certified\"`` / ``\"failed\"`` / ``\"expired\"``), and ``expires_at`` is an\noptional ISO expiry after which a consumer should re-certify. An\nuncertified bundle leaves the block at its defaults.", + "properties": { + "compiler_version": { + "default": "", + "description": "openadapt_flow version that produced the bundle", + "title": "Compiler Version", + "type": "string" + }, + "source_recording_sha256": { + "anyOf": [ + { + "pattern": "^[a-f0-9]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Exact approved sanitized recording archive used for compilation", + "title": "Source Recording Sha256" + }, + "sanitized_from_digest": { + "anyOf": [ + { + "pattern": "^[a-f0-9]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Verified source bundle content digest for a sanitized derivative", + "title": "Sanitized From Digest" + }, + "compiler_config_sha256": { + "anyOf": [ + { + "pattern": "^[a-f0-9]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Canonical digest of the compiler options used for this bundle", + "title": "Compiler Config Sha256" + }, + "created_at": { + "description": "When this manifest/provenance was first sealed (ISO 8601)", + "title": "Created At", + "type": "string" + }, + "policy_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Certified bundle: the policy it was certified against", + "title": "Policy Name" + }, + "certified": { + "default": false, + "description": "Whether the bundle passed policy certification", + "title": "Certified", + "type": "boolean" + }, + "certification_status": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Short label: 'certified' | 'failed' | 'expired' | None", + "title": "Certification Status" + }, + "certified_at": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "ISO timestamp of the certification, if any", + "title": "Certified At" + }, + "expires_at": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional ISO expiry; a consumer should re-certify after it", + "title": "Expires At" + }, + "certification_invalidated_at": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "ISO timestamp when a previously persisted certification stopped matching this bundle contract", + "title": "Certification Invalidated At" + }, + "certification_invalidation_reason": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "PHI-free reason the persisted certification was invalidated; the bundle must be certified again before production use", + "title": "Certification Invalidation Reason" + }, + "governed_authorization_template": { + "anyOf": [ + { + "$ref": "#/$defs/GovernedAuthorizationTemplate" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Value-free, hash-bound production authorization template for this exact certified bundle" + } + }, + "title": "BundleProvenance", + "type": "object" + }, + "GovernedAuthorizationParameter": { + "additionalProperties": false, + "description": "One value-free parameter declaration in a governed template.", + "properties": { + "name": { + "maxLength": 128, + "minLength": 1, + "title": "Name", + "type": "string" + }, + "type": { + "$ref": "#/$defs/ParamKind" + }, + "required": { + "title": "Required", + "type": "boolean" + }, + "secret": { + "title": "Secret", + "type": "boolean" + }, + "has_default": { + "title": "Has Default", + "type": "boolean" + }, + "choices_count": { + "minimum": 0, + "title": "Choices Count", + "type": "integer" + }, + "choices_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Choices Sha256", + "type": "string" + } + }, + "required": [ + "name", + "type", + "required", + "secret", + "has_default", + "choices_count", + "choices_sha256" + ], + "title": "GovernedAuthorizationParameter", + "type": "object" + }, + "GovernedAuthorizationTemplate": { + "additionalProperties": false, + "description": "Immutable production authorization shape for one certified bundle.\n\nThis is not a bearer capability. It deliberately excludes runtime input\nvalues, approval identity, credentials, and effect or identity recipes.\nThe template lives in manifest provenance so it can commit to the final\ncontent digest without creating a content-digest cycle.", + "properties": { + "schema_version": { + "const": "openadapt.governed-authorization-template/v1", + "default": "openadapt.governed-authorization-template/v1", + "title": "Schema Version", + "type": "string" + }, + "bundle_content_digest": { + "pattern": "^[a-f0-9]{64}$", + "title": "Bundle Content Digest", + "type": "string" + }, + "workflow_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Workflow Contract Sha256", + "type": "string" + }, + "qualification_project_id": { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$", + "title": "Qualification Project Id", + "type": "string" + }, + "qualification_project_revision": { + "minimum": 1, + "title": "Qualification Project Revision", + "type": "integer" + }, + "qualification_project_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Qualification Project Contract Sha256", + "type": "string" + }, + "qualification_environment_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Qualification Environment Contract Sha256", + "type": "string" + }, + "qualification_report_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Qualification Report Sha256", + "type": "string" + }, + "qualification_case_evidence_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Qualification Case Evidence Contract Sha256", + "type": "string" + }, + "policy_name": { + "maxLength": 128, + "minLength": 1, + "title": "Policy Name", + "type": "string" + }, + "policy_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Policy Contract Sha256", + "type": "string" + }, + "execution_profile": { + "enum": [ + "standard", + "regulated" + ], + "title": "Execution Profile", + "type": "string" + }, + "minimum_effect_tier": { + "maximum": 4, + "minimum": 1, + "title": "Minimum Effect Tier", + "type": "integer" + }, + "qualified_effect_requirements": { + "default": [], + "items": { + "$ref": "#/$defs/QualifiedEffectRequirement" + }, + "title": "Qualified Effect Requirements", + "type": "array" + }, + "required_identity_step_ids": { + "items": { + "type": "string" + }, + "title": "Required Identity Step Ids", + "type": "array" + }, + "identity_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Identity Contract Sha256", + "type": "string" + }, + "parameters": { + "default": [], + "items": { + "$ref": "#/$defs/GovernedAuthorizationParameter" + }, + "title": "Parameters", + "type": "array" + }, + "parameter_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Parameter Contract Sha256", + "type": "string" + }, + "template_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Template Sha256", + "type": "string" + } + }, + "required": [ + "bundle_content_digest", + "workflow_contract_sha256", + "qualification_project_id", + "qualification_project_revision", + "qualification_project_contract_sha256", + "qualification_environment_contract_sha256", + "qualification_report_sha256", + "qualification_case_evidence_contract_sha256", + "policy_name", + "policy_contract_sha256", + "execution_profile", + "minimum_effect_tier", + "identity_contract_sha256", + "parameter_contract_sha256", + "template_sha256" + ], + "title": "GovernedAuthorizationTemplate", + "type": "object" + }, + "ParamKind": { + "description": "Typed-parameter kinds (RFC \u00a72.2 ``ParamSpec.type``).\n\n``entity_ref`` names an ENTITY to be re-resolved by the identity ladder at\nrun time (the \"which patient\" fix, docs/LIMITS.md), not a literal to blindly\nsubstitute; the other kinds are literal values. Phase 1 stores the type for\ntyping/validation/emit -- kind-specific run-time resolution (entity_ref\nre-resolution) is Phase 2+.", + "enum": [ + "string", + "date", + "enum", + "number", + "boolean", + "entity_ref" + ], + "title": "ParamKind", + "type": "string" + }, + "QualifiedEffectRequirement": { + "additionalProperties": false, + "description": "One exact qualified effect-strength requirement admitted for a run.", + "properties": { + "step_id": { + "title": "Step Id", + "type": "string" + }, + "actuation_path": { + "enum": [ + "gui", + "api" + ], + "title": "Actuation Path", + "type": "string" + }, + "effect_index": { + "minimum": 0, + "title": "Effect Index", + "type": "integer" + }, + "effect_contract_hash": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Effect Contract Hash", + "type": "string" + }, + "minimum_tier": { + "maximum": 4, + "minimum": 1, + "title": "Minimum Tier", + "type": "integer" + } + }, + "required": [ + "step_id", + "actuation_path", + "effect_index", + "effect_contract_hash", + "minimum_tier" + ], + "title": "QualifiedEffectRequirement", + "type": "object" + } + }, + "description": "Integrity + provenance manifest for a compiled bundle (schema v2).\n\nSealed on :meth:`Workflow.save` and re-verified on :meth:`Workflow.load`\n(``openadapt_flow.bundle_validation``): ``file_hashes`` is a SHA-256 per\ntemplate/image asset (bundle-relative path -> hex digest), ``content_digest``\nis a whole-bundle SHA-256 over the manifest-free ``workflow.json`` content\nAND those asset hashes (so it changes if any semantic byte changes), and\n``provenance`` carries the compiler version + certification block. ``encrypted``\nmirrors ``Workflow.encrypted``: True when the bundle is sealed at rest with\nAES-256-GCM -- both ``workflow.json`` and every ``templates/*.png`` crop.\nThe ``file_hashes`` are always digests over the PLAINTEXT asset (sealed\nBEFORE encryption), so integrity re-verifies against the decrypted crops.\nA v1 bundle carries no manifest. Verified loading requires a persisted\nintegrity seal rather than computing a replacement for unsealed content.", + "properties": { + "schema_version": { + "default": 2, + "title": "Schema Version", + "type": "integer" + }, + "content_digest": { + "default": "", + "description": "whole-bundle SHA-256 (content + asset hashes)", + "title": "Content Digest", + "type": "string" + }, + "file_hashes": { + "additionalProperties": { + "type": "string" + }, + "description": "bundle-relative asset path -> SHA-256 hex digest", + "title": "File Hashes", + "type": "object" + }, + "provenance": { + "$ref": "#/$defs/BundleProvenance" + }, + "encrypted": { + "default": false, + "description": "mirrors Workflow.encrypted (workflow.json sealed at rest)", + "title": "Encrypted", + "type": "boolean" + } + }, + "title": "BundleManifest", + "type": "object" + }, + "serialization": { + "additionalProperties": true, + "type": "object" + } + }, + "BundleProvenance": { + "validation": { + "$defs": { + "GovernedAuthorizationParameter": { + "additionalProperties": false, + "description": "One value-free parameter declaration in a governed template.", + "properties": { + "name": { + "maxLength": 128, + "minLength": 1, + "title": "Name", + "type": "string" + }, + "type": { + "$ref": "#/$defs/ParamKind" + }, + "required": { + "title": "Required", + "type": "boolean" + }, + "secret": { + "title": "Secret", + "type": "boolean" + }, + "has_default": { + "title": "Has Default", + "type": "boolean" + }, + "choices_count": { + "minimum": 0, + "title": "Choices Count", + "type": "integer" + }, + "choices_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Choices Sha256", + "type": "string" + } + }, + "required": [ + "name", + "type", + "required", + "secret", + "has_default", + "choices_count", + "choices_sha256" + ], + "title": "GovernedAuthorizationParameter", + "type": "object" + }, + "GovernedAuthorizationTemplate": { + "additionalProperties": false, + "description": "Immutable production authorization shape for one certified bundle.\n\nThis is not a bearer capability. It deliberately excludes runtime input\nvalues, approval identity, credentials, and effect or identity recipes.\nThe template lives in manifest provenance so it can commit to the final\ncontent digest without creating a content-digest cycle.", + "properties": { + "schema_version": { + "const": "openadapt.governed-authorization-template/v1", + "default": "openadapt.governed-authorization-template/v1", + "title": "Schema Version", + "type": "string" + }, + "bundle_content_digest": { + "pattern": "^[a-f0-9]{64}$", + "title": "Bundle Content Digest", + "type": "string" + }, + "workflow_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Workflow Contract Sha256", + "type": "string" + }, + "qualification_project_id": { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$", + "title": "Qualification Project Id", + "type": "string" + }, + "qualification_project_revision": { + "minimum": 1, + "title": "Qualification Project Revision", + "type": "integer" + }, + "qualification_project_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Qualification Project Contract Sha256", + "type": "string" + }, + "qualification_environment_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Qualification Environment Contract Sha256", + "type": "string" + }, + "qualification_report_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Qualification Report Sha256", + "type": "string" + }, + "qualification_case_evidence_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Qualification Case Evidence Contract Sha256", + "type": "string" + }, + "policy_name": { + "maxLength": 128, + "minLength": 1, + "title": "Policy Name", + "type": "string" + }, + "policy_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Policy Contract Sha256", + "type": "string" + }, + "execution_profile": { + "enum": [ + "standard", + "regulated" + ], + "title": "Execution Profile", + "type": "string" + }, + "minimum_effect_tier": { + "maximum": 4, + "minimum": 1, + "title": "Minimum Effect Tier", + "type": "integer" + }, + "qualified_effect_requirements": { + "default": [], + "items": { + "$ref": "#/$defs/QualifiedEffectRequirement" + }, + "title": "Qualified Effect Requirements", + "type": "array" + }, + "required_identity_step_ids": { + "items": { + "type": "string" + }, + "title": "Required Identity Step Ids", + "type": "array" + }, + "identity_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Identity Contract Sha256", + "type": "string" + }, + "parameters": { + "default": [], + "items": { + "$ref": "#/$defs/GovernedAuthorizationParameter" + }, + "title": "Parameters", + "type": "array" + }, + "parameter_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Parameter Contract Sha256", + "type": "string" + }, + "template_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Template Sha256", + "type": "string" + } + }, + "required": [ + "bundle_content_digest", + "workflow_contract_sha256", + "qualification_project_id", + "qualification_project_revision", + "qualification_project_contract_sha256", + "qualification_environment_contract_sha256", + "qualification_report_sha256", + "qualification_case_evidence_contract_sha256", + "policy_name", + "policy_contract_sha256", + "execution_profile", + "minimum_effect_tier", + "identity_contract_sha256", + "parameter_contract_sha256", + "template_sha256" + ], + "title": "GovernedAuthorizationTemplate", + "type": "object" + }, + "ParamKind": { + "description": "Typed-parameter kinds (RFC \u00a72.2 ``ParamSpec.type``).\n\n``entity_ref`` names an ENTITY to be re-resolved by the identity ladder at\nrun time (the \"which patient\" fix, docs/LIMITS.md), not a literal to blindly\nsubstitute; the other kinds are literal values. Phase 1 stores the type for\ntyping/validation/emit -- kind-specific run-time resolution (entity_ref\nre-resolution) is Phase 2+.", + "enum": [ + "string", + "date", + "enum", + "number", + "boolean", + "entity_ref" + ], + "title": "ParamKind", + "type": "string" + }, + "QualifiedEffectRequirement": { + "additionalProperties": false, + "description": "One exact qualified effect-strength requirement admitted for a run.", + "properties": { + "step_id": { + "title": "Step Id", + "type": "string" + }, + "actuation_path": { + "enum": [ + "gui", + "api" + ], + "title": "Actuation Path", + "type": "string" + }, + "effect_index": { + "minimum": 0, + "title": "Effect Index", + "type": "integer" + }, + "effect_contract_hash": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Effect Contract Hash", + "type": "string" + }, + "minimum_tier": { + "maximum": 4, + "minimum": 1, + "title": "Minimum Tier", + "type": "integer" + } + }, + "required": [ + "step_id", + "actuation_path", + "effect_index", + "effect_contract_hash", + "minimum_tier" + ], + "title": "QualifiedEffectRequirement", + "type": "object" + } + }, + "description": "Who produced a bundle and, if certified, under what policy (schema v2).\n\n``compiler_version`` records the ``openadapt_flow`` version that compiled /\nlast saved the bundle, so an operator inventory can tell which compiler an\nartifact came from. The certification block is populated only for a bundle\nthat passed a policy certification (see :meth:`Workflow.stamp_certification`\n/ ``openadapt_flow.policy.evaluate_policy``): ``policy_name`` is the policy\nit was certified against, ``certification_status`` is a short label\n(``\"certified\"`` / ``\"failed\"`` / ``\"expired\"``), and ``expires_at`` is an\noptional ISO expiry after which a consumer should re-certify. An\nuncertified bundle leaves the block at its defaults.", + "properties": { + "compiler_version": { + "default": "", + "description": "openadapt_flow version that produced the bundle", + "title": "Compiler Version", + "type": "string" + }, + "source_recording_sha256": { + "anyOf": [ + { + "pattern": "^[a-f0-9]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Exact approved sanitized recording archive used for compilation", + "title": "Source Recording Sha256" + }, + "sanitized_from_digest": { + "anyOf": [ + { + "pattern": "^[a-f0-9]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Verified source bundle content digest for a sanitized derivative", + "title": "Sanitized From Digest" + }, + "compiler_config_sha256": { + "anyOf": [ + { + "pattern": "^[a-f0-9]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Canonical digest of the compiler options used for this bundle", + "title": "Compiler Config Sha256" + }, + "created_at": { + "description": "When this manifest/provenance was first sealed (ISO 8601)", + "title": "Created At", + "type": "string" + }, + "policy_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Certified bundle: the policy it was certified against", + "title": "Policy Name" + }, + "certified": { + "default": false, + "description": "Whether the bundle passed policy certification", + "title": "Certified", + "type": "boolean" + }, + "certification_status": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Short label: 'certified' | 'failed' | 'expired' | None", + "title": "Certification Status" + }, + "certified_at": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "ISO timestamp of the certification, if any", + "title": "Certified At" + }, + "expires_at": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional ISO expiry; a consumer should re-certify after it", + "title": "Expires At" + }, + "certification_invalidated_at": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "ISO timestamp when a previously persisted certification stopped matching this bundle contract", + "title": "Certification Invalidated At" + }, + "certification_invalidation_reason": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "PHI-free reason the persisted certification was invalidated; the bundle must be certified again before production use", + "title": "Certification Invalidation Reason" + }, + "governed_authorization_template": { + "anyOf": [ + { + "$ref": "#/$defs/GovernedAuthorizationTemplate" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Value-free, hash-bound production authorization template for this exact certified bundle" + } + }, + "title": "BundleProvenance", + "type": "object" + }, + "serialization": { + "$defs": { + "GovernedAuthorizationParameter": { + "additionalProperties": false, + "description": "One value-free parameter declaration in a governed template.", + "properties": { + "name": { + "maxLength": 128, + "minLength": 1, + "title": "Name", + "type": "string" + }, + "type": { + "$ref": "#/$defs/ParamKind" + }, + "required": { + "title": "Required", + "type": "boolean" + }, + "secret": { + "title": "Secret", + "type": "boolean" + }, + "has_default": { + "title": "Has Default", + "type": "boolean" + }, + "choices_count": { + "minimum": 0, + "title": "Choices Count", + "type": "integer" + }, + "choices_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Choices Sha256", + "type": "string" + } + }, + "required": [ + "name", + "type", + "required", + "secret", + "has_default", + "choices_count", + "choices_sha256" + ], + "title": "GovernedAuthorizationParameter", + "type": "object" + }, + "GovernedAuthorizationTemplate": { + "additionalProperties": false, + "description": "Immutable production authorization shape for one certified bundle.\n\nThis is not a bearer capability. It deliberately excludes runtime input\nvalues, approval identity, credentials, and effect or identity recipes.\nThe template lives in manifest provenance so it can commit to the final\ncontent digest without creating a content-digest cycle.", + "properties": { + "schema_version": { + "const": "openadapt.governed-authorization-template/v1", + "default": "openadapt.governed-authorization-template/v1", + "title": "Schema Version", + "type": "string" + }, + "bundle_content_digest": { + "pattern": "^[a-f0-9]{64}$", + "title": "Bundle Content Digest", + "type": "string" + }, + "workflow_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Workflow Contract Sha256", + "type": "string" + }, + "qualification_project_id": { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$", + "title": "Qualification Project Id", + "type": "string" + }, + "qualification_project_revision": { + "minimum": 1, + "title": "Qualification Project Revision", + "type": "integer" + }, + "qualification_project_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Qualification Project Contract Sha256", + "type": "string" + }, + "qualification_environment_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Qualification Environment Contract Sha256", + "type": "string" + }, + "qualification_report_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Qualification Report Sha256", + "type": "string" + }, + "qualification_case_evidence_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Qualification Case Evidence Contract Sha256", + "type": "string" + }, + "policy_name": { + "maxLength": 128, + "minLength": 1, + "title": "Policy Name", + "type": "string" + }, + "policy_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Policy Contract Sha256", + "type": "string" + }, + "execution_profile": { + "enum": [ + "standard", + "regulated" + ], + "title": "Execution Profile", + "type": "string" + }, + "minimum_effect_tier": { + "maximum": 4, + "minimum": 1, + "title": "Minimum Effect Tier", + "type": "integer" + }, + "qualified_effect_requirements": { + "default": [], + "items": { + "$ref": "#/$defs/QualifiedEffectRequirement" + }, + "title": "Qualified Effect Requirements", + "type": "array" + }, + "required_identity_step_ids": { + "items": { + "type": "string" + }, + "title": "Required Identity Step Ids", + "type": "array" + }, + "identity_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Identity Contract Sha256", + "type": "string" + }, + "parameters": { + "default": [], + "items": { + "$ref": "#/$defs/GovernedAuthorizationParameter" + }, + "title": "Parameters", + "type": "array" + }, + "parameter_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Parameter Contract Sha256", + "type": "string" + }, + "template_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Template Sha256", + "type": "string" + } + }, + "required": [ + "bundle_content_digest", + "workflow_contract_sha256", + "qualification_project_id", + "qualification_project_revision", + "qualification_project_contract_sha256", + "qualification_environment_contract_sha256", + "qualification_report_sha256", + "qualification_case_evidence_contract_sha256", + "policy_name", + "policy_contract_sha256", + "execution_profile", + "minimum_effect_tier", + "identity_contract_sha256", + "parameter_contract_sha256", + "template_sha256" + ], + "title": "GovernedAuthorizationTemplate", + "type": "object" + }, + "ParamKind": { + "description": "Typed-parameter kinds (RFC \u00a72.2 ``ParamSpec.type``).\n\n``entity_ref`` names an ENTITY to be re-resolved by the identity ladder at\nrun time (the \"which patient\" fix, docs/LIMITS.md), not a literal to blindly\nsubstitute; the other kinds are literal values. Phase 1 stores the type for\ntyping/validation/emit -- kind-specific run-time resolution (entity_ref\nre-resolution) is Phase 2+.", + "enum": [ + "string", + "date", + "enum", + "number", + "boolean", + "entity_ref" + ], + "title": "ParamKind", + "type": "string" + }, + "QualifiedEffectRequirement": { + "additionalProperties": false, + "description": "One exact qualified effect-strength requirement admitted for a run.", + "properties": { + "step_id": { + "title": "Step Id", + "type": "string" + }, + "actuation_path": { + "enum": [ + "gui", + "api" + ], + "title": "Actuation Path", + "type": "string" + }, + "effect_index": { + "minimum": 0, + "title": "Effect Index", + "type": "integer" + }, + "effect_contract_hash": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Effect Contract Hash", + "type": "string" + }, + "minimum_tier": { + "maximum": 4, + "minimum": 1, + "title": "Minimum Tier", + "type": "integer" + } + }, + "required": [ + "step_id", + "actuation_path", + "effect_index", + "effect_contract_hash", + "minimum_tier" + ], + "title": "QualifiedEffectRequirement", + "type": "object" + } + }, + "description": "Who produced a bundle and, if certified, under what policy (schema v2).\n\n``compiler_version`` records the ``openadapt_flow`` version that compiled /\nlast saved the bundle, so an operator inventory can tell which compiler an\nartifact came from. The certification block is populated only for a bundle\nthat passed a policy certification (see :meth:`Workflow.stamp_certification`\n/ ``openadapt_flow.policy.evaluate_policy``): ``policy_name`` is the policy\nit was certified against, ``certification_status`` is a short label\n(``\"certified\"`` / ``\"failed\"`` / ``\"expired\"``), and ``expires_at`` is an\noptional ISO expiry after which a consumer should re-certify. An\nuncertified bundle leaves the block at its defaults.", + "properties": { + "compiler_version": { + "default": "", + "description": "openadapt_flow version that produced the bundle", + "title": "Compiler Version", + "type": "string" + }, + "source_recording_sha256": { + "anyOf": [ + { + "pattern": "^[a-f0-9]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Exact approved sanitized recording archive used for compilation", + "title": "Source Recording Sha256" + }, + "sanitized_from_digest": { + "anyOf": [ + { + "pattern": "^[a-f0-9]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Verified source bundle content digest for a sanitized derivative", + "title": "Sanitized From Digest" + }, + "compiler_config_sha256": { + "anyOf": [ + { + "pattern": "^[a-f0-9]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Canonical digest of the compiler options used for this bundle", + "title": "Compiler Config Sha256" + }, + "created_at": { + "description": "When this manifest/provenance was first sealed (ISO 8601)", + "title": "Created At", + "type": "string" + }, + "policy_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Certified bundle: the policy it was certified against", + "title": "Policy Name" + }, + "certified": { + "default": false, + "description": "Whether the bundle passed policy certification", + "title": "Certified", + "type": "boolean" + }, + "certification_status": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Short label: 'certified' | 'failed' | 'expired' | None", + "title": "Certification Status" + }, + "certified_at": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "ISO timestamp of the certification, if any", + "title": "Certified At" + }, + "expires_at": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional ISO expiry; a consumer should re-certify after it", + "title": "Expires At" + }, + "certification_invalidated_at": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "ISO timestamp when a previously persisted certification stopped matching this bundle contract", + "title": "Certification Invalidated At" + }, + "certification_invalidation_reason": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "PHI-free reason the persisted certification was invalidated; the bundle must be certified again before production use", + "title": "Certification Invalidation Reason" + }, + "governed_authorization_template": { + "anyOf": [ + { + "$ref": "#/$defs/GovernedAuthorizationTemplate" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Value-free, hash-bound production authorization template for this exact certified bundle" + } + }, + "title": "BundleProvenance", + "type": "object" + } + }, + "BusinessDecisionEvidence": { + "validation": { + "$defs": { + "ProgramExecutionScopeFrame": { + "additionalProperties": false, + "description": "PHI-free control scope for one action in a program run.", + "properties": { + "graph_id": { + "maxLength": 128, + "minLength": 1, + "title": "Graph Id", + "type": "string" + }, + "loop_state_id": { + "anyOf": [ + { + "maxLength": 128, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Loop State Id" + }, + "relation": { + "anyOf": [ + { + "maxLength": 128, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Relation" + }, + "row_index": { + "anyOf": [ + { + "minimum": 0, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Row Index" + } + }, + "required": [ + "graph_id" + ], + "title": "ProgramExecutionScopeFrame", + "type": "object" + } + }, + "additionalProperties": false, + "description": "Authenticated control evidence for one finite human answer.\n\nThis evidence can select a compiled branch. It cannot satisfy an action's\nentity identity, postcondition, or business-effect contract.", + "properties": { + "schema_version": { + "const": "openadapt.business-decision-evidence/v1", + "default": "openadapt.business-decision-evidence/v1", + "title": "Schema Version", + "type": "string" + }, + "decision_index": { + "minimum": 0, + "title": "Decision Index", + "type": "integer" + }, + "graph_id": { + "maxLength": 128, + "minLength": 1, + "title": "Graph Id", + "type": "string" + }, + "state_id": { + "maxLength": 128, + "minLength": 1, + "title": "State Id", + "type": "string" + }, + "program_scope": { + "items": { + "$ref": "#/$defs/ProgramExecutionScopeFrame" + }, + "minItems": 1, + "title": "Program Scope", + "type": "array" + }, + "decision_contract_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Decision Contract Sha256", + "type": "string" + }, + "request_digest": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Request Digest", + "type": "string" + }, + "request_inventory_ref": { + "maxLength": 512, + "minLength": 1, + "title": "Request Inventory Ref", + "type": "string" + }, + "request_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Request Sha256", + "type": "string" + }, + "receipt_digest": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Receipt Digest", + "type": "string" + }, + "receipt_inventory_ref": { + "maxLength": 512, + "minLength": 1, + "title": "Receipt Inventory Ref", + "type": "string" + }, + "receipt_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Receipt Sha256", + "type": "string" + }, + "option_id": { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$", + "title": "Option Id", + "type": "string" + }, + "output_param": { + "pattern": "^[A-Za-z_][A-Za-z0-9_.:-]{0,127}$", + "title": "Output Param", + "type": "string" + }, + "output_value": { + "maxLength": 512, + "minLength": 1, + "title": "Output Value", + "type": "string" + }, + "target_state_id": { + "maxLength": 128, + "minLength": 1, + "title": "Target State Id", + "type": "string" + }, + "operator_ref": { + "maxLength": 256, + "minLength": 1, + "title": "Operator Ref", + "type": "string" + }, + "authorized_role": { + "maxLength": 128, + "minLength": 1, + "title": "Authorized Role", + "type": "string" + }, + "authentication_context_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Authentication Context Sha256", + "type": "string" + }, + "evidence_artifact_sha256s": { + "additionalProperties": { + "type": "string" + }, + "title": "Evidence Artifact Sha256S", + "type": "object" + }, + "idempotency_key_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Idempotency Key Sha256", + "type": "string" + }, + "decided_at": { + "title": "Decided At", + "type": "string" + }, + "governed_runtime_inputs_digest": { + "anyOf": [ + { + "pattern": "^[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Governed Runtime Inputs Digest" + } + }, + "required": [ + "decision_index", + "graph_id", + "state_id", + "program_scope", + "decision_contract_sha256", + "request_digest", + "request_inventory_ref", + "request_sha256", + "receipt_digest", + "receipt_inventory_ref", + "receipt_sha256", + "option_id", + "output_param", + "output_value", + "target_state_id", + "operator_ref", + "authorized_role", + "authentication_context_sha256", + "idempotency_key_sha256", + "decided_at" + ], + "title": "BusinessDecisionEvidence", + "type": "object" + }, + "serialization": { + "$defs": { + "ProgramExecutionScopeFrame": { + "additionalProperties": false, + "description": "PHI-free control scope for one action in a program run.", + "properties": { + "graph_id": { + "maxLength": 128, + "minLength": 1, + "title": "Graph Id", + "type": "string" + }, + "loop_state_id": { + "anyOf": [ + { + "maxLength": 128, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Loop State Id" + }, + "relation": { + "anyOf": [ + { + "maxLength": 128, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Relation" + }, + "row_index": { + "anyOf": [ + { + "minimum": 0, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Row Index" + } + }, + "required": [ + "graph_id" + ], + "title": "ProgramExecutionScopeFrame", + "type": "object" + } + }, + "additionalProperties": false, + "description": "Authenticated control evidence for one finite human answer.\n\nThis evidence can select a compiled branch. It cannot satisfy an action's\nentity identity, postcondition, or business-effect contract.", + "properties": { + "schema_version": { + "const": "openadapt.business-decision-evidence/v1", + "default": "openadapt.business-decision-evidence/v1", + "title": "Schema Version", + "type": "string" + }, + "decision_index": { + "minimum": 0, + "title": "Decision Index", + "type": "integer" + }, + "graph_id": { + "maxLength": 128, + "minLength": 1, + "title": "Graph Id", + "type": "string" + }, + "state_id": { + "maxLength": 128, + "minLength": 1, + "title": "State Id", + "type": "string" + }, + "program_scope": { + "items": { + "$ref": "#/$defs/ProgramExecutionScopeFrame" + }, + "minItems": 1, + "title": "Program Scope", + "type": "array" + }, + "decision_contract_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Decision Contract Sha256", + "type": "string" + }, + "request_digest": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Request Digest", + "type": "string" + }, + "request_inventory_ref": { + "maxLength": 512, + "minLength": 1, + "title": "Request Inventory Ref", + "type": "string" + }, + "request_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Request Sha256", + "type": "string" + }, + "receipt_digest": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Receipt Digest", + "type": "string" + }, + "receipt_inventory_ref": { + "maxLength": 512, + "minLength": 1, + "title": "Receipt Inventory Ref", + "type": "string" + }, + "receipt_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Receipt Sha256", + "type": "string" + }, + "option_id": { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$", + "title": "Option Id", + "type": "string" + }, + "output_param": { + "pattern": "^[A-Za-z_][A-Za-z0-9_.:-]{0,127}$", + "title": "Output Param", + "type": "string" + }, + "output_value": { + "maxLength": 512, + "minLength": 1, + "title": "Output Value", + "type": "string" + }, + "target_state_id": { + "maxLength": 128, + "minLength": 1, + "title": "Target State Id", + "type": "string" + }, + "operator_ref": { + "maxLength": 256, + "minLength": 1, + "title": "Operator Ref", + "type": "string" + }, + "authorized_role": { + "maxLength": 128, + "minLength": 1, + "title": "Authorized Role", + "type": "string" + }, + "authentication_context_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Authentication Context Sha256", + "type": "string" + }, + "evidence_artifact_sha256s": { + "additionalProperties": { + "type": "string" + }, + "title": "Evidence Artifact Sha256S", + "type": "object" + }, + "idempotency_key_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Idempotency Key Sha256", + "type": "string" + }, + "decided_at": { + "title": "Decided At", + "type": "string" + }, + "governed_runtime_inputs_digest": { + "anyOf": [ + { + "pattern": "^[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Governed Runtime Inputs Digest" + } + }, + "required": [ + "decision_index", + "graph_id", + "state_id", + "program_scope", + "decision_contract_sha256", + "request_digest", + "request_inventory_ref", + "request_sha256", + "receipt_digest", + "receipt_inventory_ref", + "receipt_sha256", + "option_id", + "output_param", + "output_value", + "target_state_id", + "operator_ref", + "authorized_role", + "authentication_context_sha256", + "idempotency_key_sha256", + "decided_at" + ], + "title": "BusinessDecisionEvidence", + "type": "object" + } + }, + "BusinessDecisionEvidenceRequirement": { + "validation": { + "additionalProperties": false, + "description": "One reviewed evidence item required before a business answer is valid.\n\nThe answer carries only a digest of the retained local artifact. It does\nnot carry screenshots, record values, or free text across a trust boundary.", + "properties": { + "id": { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$", + "title": "Id", + "type": "string" + }, + "label": { + "maxLength": 240, + "minLength": 1, + "title": "Label", + "type": "string" + } + }, + "required": [ + "id", + "label" + ], + "title": "BusinessDecisionEvidenceRequirement", + "type": "object" + }, + "serialization": { + "additionalProperties": false, + "description": "One reviewed evidence item required before a business answer is valid.\n\nThe answer carries only a digest of the retained local artifact. It does\nnot carry screenshots, record values, or free text across a trust boundary.", + "properties": { + "id": { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$", + "title": "Id", + "type": "string" + }, + "label": { + "maxLength": 240, + "minLength": 1, + "title": "Label", + "type": "string" + } + }, + "required": [ + "id", + "label" + ], + "title": "BusinessDecisionEvidenceRequirement", + "type": "object" + } + }, + "BusinessDecisionOption": { + "validation": { + "additionalProperties": false, + "description": "One finite answer and its exact compiled successor.", + "properties": { + "id": { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$", + "title": "Id", + "type": "string" + }, + "label": { + "maxLength": 240, + "minLength": 1, + "title": "Label", + "type": "string" + }, + "value": { + "maxLength": 512, + "minLength": 1, + "title": "Value", + "type": "string" + }, + "target": { + "maxLength": 128, + "minLength": 1, + "title": "Target", + "type": "string" + }, + "required_evidence": { + "default": [], + "items": { + "type": "string" + }, + "title": "Required Evidence", + "type": "array" + } + }, + "required": [ + "id", + "label", + "value", + "target" + ], + "title": "BusinessDecisionOption", + "type": "object" + }, + "serialization": { + "additionalProperties": false, + "description": "One finite answer and its exact compiled successor.", + "properties": { + "id": { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$", + "title": "Id", + "type": "string" + }, + "label": { + "maxLength": 240, + "minLength": 1, + "title": "Label", + "type": "string" + }, + "value": { + "maxLength": 512, + "minLength": 1, + "title": "Value", + "type": "string" + }, + "target": { + "maxLength": 128, + "minLength": 1, + "title": "Target", + "type": "string" + }, + "required_evidence": { + "default": [], + "items": { + "type": "string" + }, + "title": "Required Evidence", + "type": "array" + } + }, + "required": [ + "id", + "label", + "value", + "target" + ], + "title": "BusinessDecisionOption", + "type": "object" + } + }, + "BusinessDecisionSpec": { + "validation": { + "$defs": { + "Anchor": { + "description": "Redundant evidence for locating a step's target on screen.\n\nResolution ladder consumes fields in order of preference (strongest, most\ndrift-tolerant first): ``structural`` (DOM / UIA element, when the backend\nsupports it) -> template (local, then global) -> ocr_text -> landmarks ->\ngrounder. ``structural`` is the deterministic top rung; the remaining\n(visual) rungs are the FALLBACK floor for pixel-only substrates.", + "properties": { + "template": { + "description": "Bundle-relative path to the PNG crop", + "title": "Template", + "type": "string" + }, + "structural": { + "anyOf": [ + { + "$ref": "#/$defs/StructuralLocator" + }, + { + "type": "null" + } + ], + "default": null, + "description": "STRUCTURAL locator (DOM selector / role+name, or UIA AutomationId / role+name) of the clicked target, captured at record time when the recording backend exposes it (openadapt_flow.backend.StructuralActionBackend). Drives the structural ACTION rung -- the TOP of the resolution ladder -- which re-finds the SAME element deterministically (no pixel match) and is far more drift-tolerant than the visual rungs (21/21 vs 6/21 on the desktop benchmark). None on pixel-only substrates or bundles compiled before this capability; the ladder then resolves via the visual rungs below." + }, + "region": { + "description": "Crop location in the recorded frame", + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "title": "Region", + "type": "array" + }, + "click_point": { + "description": "Click point in the recorded frame", + "maxItems": 2, + "minItems": 2, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "title": "Click Point", + "type": "array" + }, + "ocr_text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Text label at/near the target, if any", + "title": "Ocr Text" + }, + "context_text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Identity evidence: OCR text on the target's row (full-width band at the crop's height) EXCLUDING the target's own crop and timestamp-bearing lines. Verified before every click (see runtime.identity); None when the band had no usable text at compile time.", + "title": "Context Text" + }, + "structured_identity": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "STRUCTURED identity text (DOM / accessibility tree) of the clicked target's row, captured at record time when the recording backend exposes it (openadapt_flow.backend.IdentityBackend.structured_text_at). The REAL characters (a genuine digit 0 vs a letter O), so replay verifies identity by exact/normalized string compare with NO OCR ambiguity -- the structured-text tier of the identity ladder (see runtime.identity). None on pixel-only substrates or bundles recorded before this capability; the ladder then falls back to the OCR context_text tier.", + "title": "Structured Identity" + }, + "record_key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Stable record id of the target's row at record time (plaintext, compile-time only). The PHI-free pass hashes it into ``identity_template.record_key`` and clears this field.", + "title": "Record Key" + }, + "structured_row": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Whether ``structured_identity`` came from a record row (compile-time only; moved to ``identity_template.structured_row``).", + "title": "Structured Row" + }, + "structured_ambiguous": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Whether teach time saw another row read the same with no record id between them (compile-time only; moved to ``identity_template.teach_ambiguous``).", + "title": "Structured Ambiguous" + }, + "identity_template": { + "anyOf": [ + { + "$ref": "#/$defs/IdentityTemplate" + }, + { + "type": "null" + } + ], + "default": null, + "description": "PHI-FREE identity template (salted-hash + shape) of the recorded context band and structured identity. When present, the runtime verifies target identity from THIS (no plaintext name/DOB/MRN in the artifact \u2014 the PHI audit's REM-2) and ``context_text`` / ``structured_identity`` are None. Bundles compiled before this capability carry the plaintext fields instead and still replay unchanged (backward compatible). See openadapt_flow.runtime.identity_template." + }, + "identifier_crop": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Bundle-relative PNG crop of the target row's DISCRIMINATIVE IDENTIFIER cell (the MRN / name+DOB region), emitted by the COMPILER (templates/identifiers/.png -- under templates/ so it is sealed with the other image crops in an encrypted bundle) for identity-armed steps that captured no structured text (Citrix / RDP / remote-display pixel recordings), or for any step whose identifier region was explicitly marked at record time (--identifier). Feeds the pixel-compare and optional VLM tiers of the identity ladder (see runtime.identity): the rendered PIXELS retain the O/0 and l/1 distinction OCR collapses, so a crop-vs-crop compare catches the glyph-collapse wrong-patient where the DOM/a11y tree is unavailable. None on structured (browser/UIA) recordings unless marked (the structured tier owns identity there; no identity pixels at rest) and on bundles compiled before this capability -- Step.identifier_crop_missing_reason records WHY; the ladder then falls through to the OCR band tier.", + "title": "Identifier Crop" + }, + "identifier_region": { + "anyOf": [ + { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Location of `identifier_crop` in the recorded frame (x, y, w, h). Replay re-crops the SAME box at the resolved point (translated by the recorded region's offset from the recorded click point, exactly as the OCR band's exclude region is) so the pixel/VLM tiers compare like-for-like. Set iff `identifier_crop` is set.", + "title": "Identifier Region" + }, + "dialog_region": { + "anyOf": [ + { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Box of the active dialog (the topmost modal) that held the target in the recorded frame, when it sat in one. The context band was cut to it, so text of the page behind the dialog is not identity evidence. Replay cuts the live band to the live dialog's box, and fails the identity check closed when no dialog holds the resolved point. None outside a dialog and on bundles compiled before this capability.", + "title": "Dialog Region" + }, + "dialog_row": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "True reads the target's own row inside dialog_region. False permits the whole dialog when teach time positively found a standalone control with no usable row text; replay must confirm no record row again. None conservatively uses the target's row.", + "title": "Dialog Row" + }, + "form_identity": { + "anyOf": [ + { + "$ref": "#/$defs/FormIdentity" + }, + { + "type": "null" + } + ], + "default": null, + "description": "A labelled save on a create-new form: before the click, its form must hold exactly the fields this run typed, with the values typed. See FormIdentity. None everywhere else." + }, + "landmarks": { + "items": { + "$ref": "#/$defs/Landmark" + }, + "title": "Landmarks", + "type": "array" + }, + "search_pad": { + "default": 80, + "description": "Pixels of padding around `region` for the local search", + "title": "Search Pad", + "type": "integer" + } + }, + "required": [ + "template", + "region", + "click_point" + ], + "title": "Anchor", + "type": "object" + }, + "BusinessDecisionEvidenceRequirement": { + "additionalProperties": false, + "description": "One reviewed evidence item required before a business answer is valid.\n\nThe answer carries only a digest of the retained local artifact. It does\nnot carry screenshots, record values, or free text across a trust boundary.", + "properties": { + "id": { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$", + "title": "Id", + "type": "string" + }, + "label": { + "maxLength": 240, + "minLength": 1, + "title": "Label", + "type": "string" + } + }, + "required": [ + "id", + "label" + ], + "title": "BusinessDecisionEvidenceRequirement", + "type": "object" + }, + "BusinessDecisionOption": { + "additionalProperties": false, + "description": "One finite answer and its exact compiled successor.", + "properties": { + "id": { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$", + "title": "Id", + "type": "string" + }, + "label": { + "maxLength": 240, + "minLength": 1, + "title": "Label", + "type": "string" + }, + "value": { + "maxLength": 512, + "minLength": 1, + "title": "Value", + "type": "string" + }, + "target": { + "maxLength": 128, + "minLength": 1, + "title": "Target", + "type": "string" + }, + "required_evidence": { + "default": [], + "items": { + "type": "string" + }, + "title": "Required Evidence", + "type": "array" + } + }, + "required": [ + "id", + "label", + "value", + "target" + ], + "title": "BusinessDecisionOption", + "type": "object" + }, + "ConcatTemplate": { + "description": "Precomputed SPLIT-match key (consecutive recorded tokens the live OCR\nmay glue into one), since hashes cannot be concatenated at replay.", + "properties": { + "i": { + "title": "I", + "type": "integer" + }, + "size": { + "title": "Size", + "type": "integer" + }, + "c": { + "title": "C", + "type": "string" + }, + "r": { + "title": "R", + "type": "string" + }, + "digit": { + "title": "Digit", + "type": "boolean" + }, + "name": { + "title": "Name", + "type": "boolean" + }, + "n": { + "title": "N", + "type": "integer" + } + }, + "required": [ + "i", + "size", + "c", + "r", + "digit", + "name", + "n" + ], + "title": "ConcatTemplate", + "type": "object" + }, + "FormIdentity": { + "additionalProperties": false, + "description": "Record identity of a save on a create-new form: the form it submits is\nthe demonstrated form, holding exactly what this run typed.\n\nA form that creates a record shows no existing record next to its save\nbutton: the record is the one the run is entering. So the save's identity\nis the form itself, all of it. The recorder observes, right before the\ndemonstrated click on a labelled submit button, that the button submits\nthe one HTML form owning every field typed into since the last save (not\nin a table row or a single field's own widget), and fingerprints that\nform. Before the click at run time, the replayer requires:\n\n- the button is still that form's submit button, and the form owns\n exactly ``filled_fields`` fields this run typed into, each holding\n exactly what the run typed;\n- the form submits to the same origin and path (``action_sha256``) with\n the same ``method``, and would send the same set of control names and\n types (``controls_sha256``), hidden ones included;\n- every control the run did not type into (a hidden record or parent id,\n a select left on its default, a checked box) holds the demonstrated\n value: salted digests in ``value_digests``, under ``value_salt`` (the\n identity-template scheme). Hidden tokens are not compared (``exempt``):\n ones named like a token, and ones that changed while the demonstration\n was typed.\n\nAnything else halts before the click. A submit event from any other form\nor control during the click is cancelled and halts the run.\n\nCounts, tokens, names and digests only; no field text or value.", + "properties": { + "filled_fields": { + "maximum": 10000, + "minimum": 1, + "title": "Filled Fields", + "type": "integer" + }, + "submit_role": { + "const": "form_submit", + "title": "Submit Role", + "type": "string" + }, + "action_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Action Sha256", + "type": "string" + }, + "method": { + "enum": [ + "get", + "post", + "dialog" + ], + "title": "Method", + "type": "string" + }, + "controls_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Controls Sha256", + "type": "string" + }, + "value_salt": { + "default": "", + "maxLength": 128, + "title": "Value Salt", + "type": "string" + }, + "value_digests": { + "additionalProperties": { + "type": "string" + }, + "title": "Value Digests", + "type": "object" + }, + "exempt": { + "default": [], + "items": { + "type": "string" + }, + "title": "Exempt", + "type": "array" + } + }, + "required": [ + "filled_fields", + "submit_role", + "action_sha256", + "method", + "controls_sha256" + ], + "title": "FormIdentity", + "type": "object" + }, + "IdentityTemplate": { + "description": "PHI-free stand-in for ``Anchor.context_text`` / ``structured_identity``.\n\nA salted-hash, shape-preserving template of the recorded identity band. It\nlets the runtime re-run the SAME wrong-patient identity check\n(:mod:`openadapt_flow.runtime.identity_template`) with no readable name /\nDOB / MRN in the artifact. NOT a cryptographic control (a salted hash of a\nlow-entropy identifier is brute-forceable by a holder of the bundle + salt);\nit removes *plaintext* PHI. The at-rest control is bundle encryption\n(docs/phi_at_rest.md, deferred). Set ``OPENADAPT_FLOW_IDENTITY_SALT`` at\ncompile+replay to keep the salt out of the bundle and make the hashes\none-way to anyone without the external secret.", + "properties": { + "schema_version": { + "default": 1, + "title": "Schema Version", + "type": "integer" + }, + "salt": { + "default": "", + "description": "per-bundle salt (hex); empty => env salt", + "title": "Salt", + "type": "string" + }, + "band_len": { + "default": 0, + "title": "Band Len", + "type": "integer" + }, + "tokens": { + "items": { + "$ref": "#/$defs/TokenTemplate" + }, + "title": "Tokens", + "type": "array" + }, + "concats": { + "items": { + "$ref": "#/$defs/ConcatTemplate" + }, + "title": "Concats", + "type": "array" + }, + "punctuation_policy": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Punctuation Policy" + }, + "punctuation_indices": { + "items": { + "type": "integer" + }, + "title": "Punctuation Indices", + "type": "array" + }, + "punctuation_body_keys": { + "additionalProperties": { + "type": "string" + }, + "title": "Punctuation Body Keys", + "type": "object" + }, + "standalone_punctuation_indices": { + "items": { + "type": "integer" + }, + "title": "Standalone Punctuation Indices", + "type": "array" + }, + "ocr_noise": { + "anyOf": [ + { + "$ref": "#/$defs/IdentityTemplate" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Writer-owned salted noise hashes, schema0. Classification-only: can supply glyph uncertainty but never identity authority. Unavailable on parameterized calls." + }, + "structured": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "salted hash of the structured identity string", + "title": "Structured" + }, + "structured_params": { + "description": "Workflow parameters embedded in the structured identity. Their demonstrated values are replaced by fixed sentinels before hashing; replay substitutes the run's value before exact compare.", + "items": { + "type": "string" + }, + "title": "Structured Params", + "type": "array" + }, + "signal_hashes": { + "additionalProperties": { + "type": "string" + }, + "description": "Salted hashes of strict exact/explicitly-normalized identity evidence, including operator-selected extracted fields. Keys are produced by identity_signals.", + "title": "Signal Hashes", + "type": "object" + }, + "context_params": { + "description": "Workflow parameters replaced by fixed sentinels before the captured-context signal hashes were computed.", + "items": { + "type": "string" + }, + "title": "Context Params", + "type": "array" + }, + "param_token_indices": { + "additionalProperties": { + "items": { + "type": "integer" + }, + "type": "array" + }, + "title": "Param Token Indices", + "type": "object" + }, + "rests_on_confusable_identifier": { + "default": false, + "title": "Rests On Confusable Identifier", + "type": "boolean" + }, + "record_key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Salted hash of the stable record id the target's row carried at teach time (app-owned DOM data-* ids, the row link's path). When set, replay acts only on the shown row with the same id.", + "title": "Record Key" + }, + "structured_row": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Whether the structured identity came from a record row at teach time. False lets a replay surface that cannot count look-alike rows still act on the target (a form field, a button); None (unknown) is treated as a row.", + "title": "Structured Row" + }, + "teach_ambiguous": { + "default": false, + "description": "Teach time saw another shown row with the same identity and no record id between them. Replay halts before a consequential write: a twin that later scrolls out of view would otherwise pass the text check.", + "title": "Teach Ambiguous", + "type": "boolean" + } + }, + "title": "IdentityTemplate", + "type": "object" + }, + "Landmark": { + "description": "A stable nearby text element, used by the geometry resolution rung.\n\n``relation`` describes where the LANDMARK sits relative to the target:\na landmark that is ``left_of`` the target implies the target is\n``distance_px`` to the landmark's right. ``dx_px``/``dy_px``, when set,\nare the exact pixel offsets from the landmark's center to the target\nclick point (target = landmark_center + (dx_px, dy_px)); the geometry\nrung prefers them over the coarser relation/distance estimate.", + "properties": { + "relation": { + "enum": [ + "left_of", + "right_of", + "above", + "below" + ], + "title": "Relation", + "type": "string" + }, + "ocr_text": { + "title": "Ocr Text", + "type": "string" + }, + "distance_px": { + "title": "Distance Px", + "type": "integer" + }, + "match_mode": { + "default": "fuzzy", + "description": "OCR comparison mode for this retained relation. Compiler-mined generic context remains fuzzy; a qualified opaque-field label uses exact normalized text so a near label cannot authorize input.", + "enum": [ + "fuzzy", + "exact" + ], + "title": "Match Mode", + "type": "string" + }, + "dx_px": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Exact x offset landmark center -> target click point", + "title": "Dx Px" + }, + "dy_px": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Exact y offset landmark center -> target click point", + "title": "Dy Px" + } + }, + "required": [ + "relation", + "ocr_text", + "distance_px" + ], + "title": "Landmark", + "type": "object" + }, + "Predicate": { + "description": "A deterministic condition over observed state (RFC \u00a72.2 ``Predicate``).\n\nUsed two ways in Phase 1: as a ``Step.wait_until`` readiness predicate (the\nreplayer polls it, BOUNDED by ``timeout_s``, and HALTS on timeout -- never\nproceeds-anyway) and as the condition inside a ``Guard``. Model-free by\nconstruction (see ``runtime.replayer._predicate_holds``); an unknown kind\nfails safe (does not hold).", + "properties": { + "kind": { + "$ref": "#/$defs/PredicateKind" + }, + "anchor": { + "anyOf": [ + { + "$ref": "#/$defs/Anchor" + }, + { + "type": "null" + } + ], + "default": null + }, + "text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Text" + }, + "param": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Param" + }, + "value": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Value" + }, + "intent": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Human-readable label (also the resolution-ladder intent for an ANCHOR_RESOLVES predicate).", + "title": "Intent" + }, + "operands": { + "description": "Sub-predicates for AND / OR / NOT.", + "items": { + "$ref": "#/$defs/Predicate" + }, + "title": "Operands", + "type": "array" + }, + "timeout_s": { + "default": 5.0, + "description": "wait_until bound: how long the replayer polls this predicate before HALTing (fail-safe; never proceed-anyway).", + "title": "Timeout S", + "type": "number" + }, + "exact": { + "default": false, + "title": "Exact", + "type": "boolean" + } + }, + "required": [ + "kind" + ], + "title": "Predicate", + "type": "object" + }, + "PredicateKind": { + "description": "Deterministic, model-free predicate kinds (RFC \u00a72.2 ``Predicate``).\n\nA predicate is evaluated over the CURRENT observed frame / run parameters\nwith ZERO model calls -- it is the thing a linear IR cannot express. Phase 1\nships the concrete kinds needed to (a) subsume today's SCROLL closed loop\n(``anchor_resolves``), (b) turn the optional-modal case into a guarded\nbranch (``text_present``), and (c) branch on a parameter (``param_equals``),\nplus boolean composition. ``worklist_nonempty`` (loops) is Phase 2.", + "enum": [ + "anchor_resolves", + "text_present", + "text_absent", + "param_equals", + "and", + "or", + "not" + ], + "title": "PredicateKind", + "type": "string" + }, + "StructuralLocator": { + "description": "A stable structural (DOM / accessibility) locator for a step's target.\n\nCaptured at record time from the recording backend's structured layer\n(:meth:`openadapt_flow.backend.StructuralActionBackend.structural_locator_at`)\nand consumed at replay by the structural ACTION rung -- the TOP of the\nresolution ladder (:mod:`openadapt_flow.runtime.resolver`). The runtime\nre-finds the SAME element by its stable identity -- a DOM id / CSS selector\n/ ARIA role+name, or a Windows UIA ``AutomationId`` / ``ControlType``+\n``Name`` -- and acts on the element's center DETERMINISTICALLY, with no\npixel matching. This is the thesis shift from \"vision-only\" to\n\"deterministic compiled automation with visual FALLBACK\": the desktop\nbenchmark measured UIA execution 21/21 vs compiled visual replay 6/21 under\nrender drift.\n\nThe visual anchor (template / ocr_text / landmarks) is ALWAYS kept too: the\nladder falls through to it UNCHANGED when this locator is absent (pixel-only\nsubstrate -- RDP/Citrix/canvas) or when the element cannot be located at\nreplay (see docs/LIMITS.md). Structural resolution is ADDITIVE -- it never\nremoves the visual floor.\n\nFields are backend-neutral; a browser backend fills ``selector`` / ``role``\n/ ``name`` from the DOM, a native backend fills ``automation_id`` / ``role``\n/ ``name`` from its accessibility tree (Windows UIA AutomationId or the\nLinux AT-SPI accessible ID). Each backend uses whichever fields it\nrecorded; unset fields are ignored.", + "properties": { + "selector": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Stable CSS/DOM selector, e.g. '#open-p1' (browser)", + "title": "Selector" + }, + "frame_path": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "maxItems": 8, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Outermost-to-innermost CSS selectors for iframe/frame elements containing a browser target. Each selector must resolve uniquely in its parent frame; absent means the top-level document.", + "title": "Frame Path" + }, + "role": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "ARIA / UIA control role, e.g. 'button', 'link'", + "title": "Role" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Accessible name / label / text of the target element", + "title": "Name" + }, + "automation_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Stable native accessibility ID: Windows UIA AutomationId or Linux AT-SPI accessible ID", + "title": "Automation Id" + }, + "window_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Exact top-level accessibility window name captured with the target. Native backends use it to scope candidate enumeration and refuse duplicate controls in a different application window.", + "title": "Window Name" + } + }, + "title": "StructuralLocator", + "type": "object" + }, + "TokenTemplate": { + "description": "Salted-hash + shape descriptor for one recorded identity-band token.\n\nCarries NO plaintext (the PHI audit's REM-2): ``c``/``r`` are salted hashes\nof the token's OCR-canonical and squashed-raw forms; the rest are\nnon-identifying shape flags and a length. Enough to reproduce the\nwrong-patient guard's per-token budgets at replay\n(:mod:`openadapt_flow.runtime.identity_template`) without persisting the\nidentifier itself.", + "properties": { + "c": { + "description": "salted hash of ocr_canonical(squashed token)", + "title": "C", + "type": "string" + }, + "r": { + "description": "salted hash of squashed raw token", + "title": "R", + "type": "string" + }, + "n": { + "description": "squashed length", + "title": "N", + "type": "integer" + }, + "alpha": { + "default": false, + "title": "Alpha", + "type": "boolean" + }, + "name": { + "default": false, + "title": "Name", + "type": "boolean" + }, + "digit": { + "default": false, + "title": "Digit", + "type": "boolean" + }, + "idsh": { + "default": false, + "title": "Idsh", + "type": "boolean" + }, + "glyph": { + "default": false, + "title": "Glyph", + "type": "boolean" + }, + "gen": { + "default": false, + "title": "Gen", + "type": "boolean" + }, + "bearing": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "identity-bearing (identity.identity_bearing); None in bundles compiled before the flag, which count every token", + "title": "Bearing" + }, + "label": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Writer-owned generic UI-label role from the same raw/comparison token pair as bearing; unknown in older templates", + "title": "Label" + } + }, + "required": [ + "c", + "r", + "n" + ], + "title": "TokenTemplate", + "type": "object" + } + }, + "additionalProperties": false, + "description": "A finite, reviewed human decision inside a workflow program.\n\nThis is not an identity or effect verifier. It only selects a declared\nbranch and binds a declared output. The successor action still runs the\nnormal fresh-frame, identity, policy, postcondition, and effect gates.", + "properties": { + "schema_version": { + "const": "openadapt.business-decision/v1", + "default": "openadapt.business-decision/v1", + "title": "Schema Version", + "type": "string" + }, + "question": { + "maxLength": 500, + "minLength": 1, + "title": "Question", + "type": "string" + }, + "authorized_roles": { + "items": { + "type": "string" + }, + "minItems": 1, + "title": "Authorized Roles", + "type": "array" + }, + "output_param": { + "pattern": "^[A-Za-z_][A-Za-z0-9_.:-]{0,127}$", + "title": "Output Param", + "type": "string" + }, + "options": { + "items": { + "$ref": "#/$defs/BusinessDecisionOption" + }, + "minItems": 2, + "title": "Options", + "type": "array" + }, + "evidence_requirements": { + "default": [], + "items": { + "$ref": "#/$defs/BusinessDecisionEvidenceRequirement" + }, + "title": "Evidence Requirements", + "type": "array" + }, + "expires_after_s": { + "default": 3600, + "maximum": 604800, + "minimum": 30, + "title": "Expires After S", + "type": "integer" + }, + "revalidation": { + "items": { + "$ref": "#/$defs/Predicate" + }, + "minItems": 1, + "title": "Revalidation", + "type": "array" + } + }, + "required": [ + "question", + "authorized_roles", + "output_param", + "options", + "revalidation" + ], + "title": "BusinessDecisionSpec", + "type": "object" + }, + "serialization": { + "$defs": { + "BusinessDecisionEvidenceRequirement": { + "additionalProperties": false, + "description": "One reviewed evidence item required before a business answer is valid.\n\nThe answer carries only a digest of the retained local artifact. It does\nnot carry screenshots, record values, or free text across a trust boundary.", + "properties": { + "id": { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$", + "title": "Id", + "type": "string" + }, + "label": { + "maxLength": 240, + "minLength": 1, + "title": "Label", + "type": "string" + } + }, + "required": [ + "id", + "label" + ], + "title": "BusinessDecisionEvidenceRequirement", + "type": "object" + }, + "BusinessDecisionOption": { + "additionalProperties": false, + "description": "One finite answer and its exact compiled successor.", + "properties": { + "id": { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$", + "title": "Id", + "type": "string" + }, + "label": { + "maxLength": 240, + "minLength": 1, + "title": "Label", + "type": "string" + }, + "value": { + "maxLength": 512, + "minLength": 1, + "title": "Value", + "type": "string" + }, + "target": { + "maxLength": 128, + "minLength": 1, + "title": "Target", + "type": "string" + }, + "required_evidence": { + "default": [], + "items": { + "type": "string" + }, + "title": "Required Evidence", + "type": "array" + } + }, + "required": [ + "id", + "label", + "value", + "target" + ], + "title": "BusinessDecisionOption", + "type": "object" + }, + "Predicate": { + "additionalProperties": true, + "type": "object" + } + }, + "additionalProperties": false, + "description": "A finite, reviewed human decision inside a workflow program.\n\nThis is not an identity or effect verifier. It only selects a declared\nbranch and binds a declared output. The successor action still runs the\nnormal fresh-frame, identity, policy, postcondition, and effect gates.", + "properties": { + "schema_version": { + "const": "openadapt.business-decision/v1", + "default": "openadapt.business-decision/v1", + "title": "Schema Version", + "type": "string" + }, + "question": { + "maxLength": 500, + "minLength": 1, + "title": "Question", + "type": "string" + }, + "authorized_roles": { + "items": { + "type": "string" + }, + "minItems": 1, + "title": "Authorized Roles", + "type": "array" + }, + "output_param": { + "pattern": "^[A-Za-z_][A-Za-z0-9_.:-]{0,127}$", + "title": "Output Param", + "type": "string" + }, + "options": { + "items": { + "$ref": "#/$defs/BusinessDecisionOption" + }, + "minItems": 2, + "title": "Options", + "type": "array" + }, + "evidence_requirements": { + "default": [], + "items": { + "$ref": "#/$defs/BusinessDecisionEvidenceRequirement" + }, + "title": "Evidence Requirements", + "type": "array" + }, + "expires_after_s": { + "default": 3600, + "maximum": 604800, + "minimum": 30, + "title": "Expires After S", + "type": "integer" + }, + "revalidation": { + "items": { + "$ref": "#/$defs/Predicate" + }, + "minItems": 1, + "title": "Revalidation", + "type": "array" + } + }, + "required": [ + "question", + "authorized_roles", + "output_param", + "options", + "revalidation" + ], + "title": "BusinessDecisionSpec", + "type": "object" + } + }, + "ChangeLedgerEffect": { + "validation": { + "description": "One declared effect of a step in the change ledger (PHI-free).\n\nNames the effect by its kind and its run-bound contract hash. Never carries\nthe effect's ``probe`` text (a compiler-written probe can quote record\nvalues), a selector value or a read-back value.", + "properties": { + "kind": { + "title": "Kind", + "type": "string" + }, + "description": { + "title": "Description", + "type": "string" + }, + "contract_hash": { + "default": "", + "title": "Contract Hash", + "type": "string" + }, + "status": { + "default": "unknown", + "enum": [ + "confirmed", + "refuted", + "unknown" + ], + "title": "Status", + "type": "string" + }, + "observed_effect": { + "default": "unknown", + "enum": [ + "present", + "absent", + "conflicting", + "unknown" + ], + "title": "Observed Effect", + "type": "string" + } + }, + "required": [ + "kind", + "description" + ], + "title": "ChangeLedgerEffect", + "type": "object" + }, + "serialization": { + "description": "One declared effect of a step in the change ledger (PHI-free).\n\nNames the effect by its kind and its run-bound contract hash. Never carries\nthe effect's ``probe`` text (a compiler-written probe can quote record\nvalues), a selector value or a read-back value.", + "properties": { + "kind": { + "title": "Kind", + "type": "string" + }, + "description": { + "title": "Description", + "type": "string" + }, + "contract_hash": { + "default": "", + "title": "Contract Hash", + "type": "string" + }, + "status": { + "default": "unknown", + "enum": [ + "confirmed", + "refuted", + "unknown" + ], + "title": "Status", + "type": "string" + }, + "observed_effect": { + "default": "unknown", + "enum": [ + "present", + "absent", + "conflicting", + "unknown" + ], + "title": "Observed Effect", + "type": "string" + } + }, + "required": [ + "kind", + "description" + ], + "title": "ChangeLedgerEffect", + "type": "object" + } + }, + "ChangeLedgerEntry": { + "validation": { + "$defs": { + "ChangeLedgerEffect": { + "description": "One declared effect of a step in the change ledger (PHI-free).\n\nNames the effect by its kind and its run-bound contract hash. Never carries\nthe effect's ``probe`` text (a compiler-written probe can quote record\nvalues), a selector value or a read-back value.", + "properties": { + "kind": { + "title": "Kind", + "type": "string" + }, + "description": { + "title": "Description", + "type": "string" + }, + "contract_hash": { + "default": "", + "title": "Contract Hash", + "type": "string" + }, + "status": { + "default": "unknown", + "enum": [ + "confirmed", + "refuted", + "unknown" + ], + "title": "Status", + "type": "string" + }, + "observed_effect": { + "default": "unknown", + "enum": [ + "present", + "absent", + "conflicting", + "unknown" + ], + "title": "Observed Effect", + "type": "string" + } + }, + "required": [ + "kind", + "description" + ], + "title": "ChangeLedgerEffect", + "type": "object" + } + }, + "description": "One step that could have changed the app, in run order (PHI-free).\n\nA step is in the ledger when it is consequential or declares an effect,\nand the run did not prove it stopped before delivering the action. The\nledger answers the question a person has after a stop: what may need\nundoing? See ``openadapt_flow.after_stop`` and ``docs/AFTER_A_STOP.md``.", + "properties": { + "position": { + "minimum": 1, + "title": "Position", + "type": "integer" + }, + "step_id": { + "title": "Step Id", + "type": "string" + }, + "intent": { + "title": "Intent", + "type": "string" + }, + "attempt_state": { + "default": "delivery_uncertain", + "enum": [ + "not_actuated", + "delivered", + "actuated_api", + "delivery_uncertain" + ], + "title": "Attempt State", + "type": "string" + }, + "status": { + "default": "unknown", + "enum": [ + "confirmed", + "refuted", + "unknown" + ], + "title": "Status", + "type": "string" + }, + "effects": { + "items": { + "$ref": "#/$defs/ChangeLedgerEffect" + }, + "title": "Effects", + "type": "array" + }, + "may_need_undo": { + "default": true, + "title": "May Need Undo", + "type": "boolean" + }, + "undo_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Undo Id" + } + }, + "required": [ + "position", + "step_id", + "intent" + ], + "title": "ChangeLedgerEntry", + "type": "object" + }, + "serialization": { + "$defs": { + "ChangeLedgerEffect": { + "description": "One declared effect of a step in the change ledger (PHI-free).\n\nNames the effect by its kind and its run-bound contract hash. Never carries\nthe effect's ``probe`` text (a compiler-written probe can quote record\nvalues), a selector value or a read-back value.", + "properties": { + "kind": { + "title": "Kind", + "type": "string" + }, + "description": { + "title": "Description", + "type": "string" + }, + "contract_hash": { + "default": "", + "title": "Contract Hash", + "type": "string" + }, + "status": { + "default": "unknown", + "enum": [ + "confirmed", + "refuted", + "unknown" + ], + "title": "Status", + "type": "string" + }, + "observed_effect": { + "default": "unknown", + "enum": [ + "present", + "absent", + "conflicting", + "unknown" + ], + "title": "Observed Effect", + "type": "string" + } + }, + "required": [ + "kind", + "description" + ], + "title": "ChangeLedgerEffect", + "type": "object" + } + }, + "description": "One step that could have changed the app, in run order (PHI-free).\n\nA step is in the ledger when it is consequential or declares an effect,\nand the run did not prove it stopped before delivering the action. The\nledger answers the question a person has after a stop: what may need\nundoing? See ``openadapt_flow.after_stop`` and ``docs/AFTER_A_STOP.md``.", + "properties": { + "position": { + "minimum": 1, + "title": "Position", + "type": "integer" + }, + "step_id": { + "title": "Step Id", + "type": "string" + }, + "intent": { + "title": "Intent", + "type": "string" + }, + "attempt_state": { + "default": "delivery_uncertain", + "enum": [ + "not_actuated", + "delivered", + "actuated_api", + "delivery_uncertain" + ], + "title": "Attempt State", + "type": "string" + }, + "status": { + "default": "unknown", + "enum": [ + "confirmed", + "refuted", + "unknown" + ], + "title": "Status", + "type": "string" + }, + "effects": { + "items": { + "$ref": "#/$defs/ChangeLedgerEffect" + }, + "title": "Effects", + "type": "array" + }, + "may_need_undo": { + "default": true, + "title": "May Need Undo", + "type": "boolean" + }, + "undo_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Undo Id" + } + }, + "required": [ + "position", + "step_id", + "intent" + ], + "title": "ChangeLedgerEntry", + "type": "object" + } + }, + "CheckToClickRecheck": { + "validation": { + "additionalProperties": false, + "description": "The screen changed between a pixel step's check and its click.\n\nRecords which checked regions changed on the fresh frame taken just\nbefore the click, and what the runtime did: re-observed the target and\nits identity on that frame, refused the click, or (``settled``) clicked\nbecause the fresh frame matched an earlier confirmed one, as a blinking\ncaret does. ``settled_on`` then counts how many confirmations back that\nframe was (1 = the one before the latest). No pixels.", + "properties": { + "changed": { + "items": { + "enum": [ + "target", + "identity", + "hover", + "frame_size" + ], + "type": "string" + }, + "title": "Changed", + "type": "array" + }, + "outcome": { + "enum": [ + "reobserved", + "aborted", + "settled" + ], + "title": "Outcome", + "type": "string" + }, + "settled_on": { + "anyOf": [ + { + "minimum": 1, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Settled On" + } + }, + "required": [ + "changed", + "outcome" + ], + "title": "CheckToClickRecheck", + "type": "object" + }, + "serialization": { + "additionalProperties": false, + "description": "The screen changed between a pixel step's check and its click.\n\nRecords which checked regions changed on the fresh frame taken just\nbefore the click, and what the runtime did: re-observed the target and\nits identity on that frame, refused the click, or (``settled``) clicked\nbecause the fresh frame matched an earlier confirmed one, as a blinking\ncaret does. ``settled_on`` then counts how many confirmations back that\nframe was (1 = the one before the latest). No pixels.", + "properties": { + "changed": { + "items": { + "enum": [ + "target", + "identity", + "hover", + "frame_size" + ], + "type": "string" + }, + "title": "Changed", + "type": "array" + }, + "outcome": { + "enum": [ + "reobserved", + "aborted", + "settled" + ], + "title": "Outcome", + "type": "string" + }, + "settled_on": { + "anyOf": [ + { + "minimum": 1, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Settled On" + } + }, + "required": [ + "changed", + "outcome" + ], + "title": "CheckToClickRecheck", + "type": "object" + } + }, + "ChoiceOptionShape": { + "validation": { + "additionalProperties": false, + "description": "What the demonstrated option looked like among its siblings.\n\nReplay finds the option list by shape, never by position: elements with\n``role`` (``option`` or ``treeitem``), or, for a list without ARIA, the\n``tag`` and every class in ``classes`` (the classes the chosen option\nshared with the other options in its list; none for a list of bare\nitems). Only elements that appeared after the control opened count.", + "properties": { + "role": { + "anyOf": [ + { + "enum": [ + "option", + "treeitem" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Role" + }, + "tag": { + "maxLength": 32, + "minLength": 1, + "pattern": "^[a-z][a-z0-9-]*$", + "title": "Tag", + "type": "string" + }, + "classes": { + "default": [], + "items": { + "type": "string" + }, + "maxItems": 8, + "title": "Classes", + "type": "array" + } + }, + "required": [ + "tag" + ], + "title": "ChoiceOptionShape", + "type": "object" + }, + "serialization": { + "additionalProperties": false, + "description": "What the demonstrated option looked like among its siblings.\n\nReplay finds the option list by shape, never by position: elements with\n``role`` (``option`` or ``treeitem``), or, for a list without ARIA, the\n``tag`` and every class in ``classes`` (the classes the chosen option\nshared with the other options in its list; none for a list of bare\nitems). Only elements that appeared after the control opened count.", + "properties": { + "role": { + "anyOf": [ + { + "enum": [ + "option", + "treeitem" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Role" + }, + "tag": { + "maxLength": 32, + "minLength": 1, + "pattern": "^[a-z][a-z0-9-]*$", + "title": "Tag", + "type": "string" + }, + "classes": { + "default": [], + "items": { + "type": "string" + }, + "maxItems": 8, + "title": "Classes", + "type": "array" + } + }, + "required": [ + "tag" + ], + "title": "ChoiceOptionShape", + "type": "object" + } + }, + "ConcatTemplate": { + "validation": { + "description": "Precomputed SPLIT-match key (consecutive recorded tokens the live OCR\nmay glue into one), since hashes cannot be concatenated at replay.", + "properties": { + "i": { + "title": "I", + "type": "integer" + }, + "size": { + "title": "Size", + "type": "integer" + }, + "c": { + "title": "C", + "type": "string" + }, + "r": { + "title": "R", + "type": "string" + }, + "digit": { + "title": "Digit", + "type": "boolean" + }, + "name": { + "title": "Name", + "type": "boolean" + }, + "n": { + "title": "N", + "type": "integer" + } + }, + "required": [ + "i", + "size", + "c", + "r", + "digit", + "name", + "n" + ], + "title": "ConcatTemplate", + "type": "object" + }, + "serialization": { + "description": "Precomputed SPLIT-match key (consecutive recorded tokens the live OCR\nmay glue into one), since hashes cannot be concatenated at replay.", + "properties": { + "i": { + "title": "I", + "type": "integer" + }, + "size": { + "title": "Size", + "type": "integer" + }, + "c": { + "title": "C", + "type": "string" + }, + "r": { + "title": "R", + "type": "string" + }, + "digit": { + "title": "Digit", + "type": "boolean" + }, + "name": { + "title": "Name", + "type": "boolean" + }, + "n": { + "title": "N", + "type": "integer" + } + }, + "required": [ + "i", + "size", + "c", + "r", + "digit", + "name", + "n" + ], + "title": "ConcatTemplate", + "type": "object" + } + }, + "DialogResponse": { + "validation": { + "additionalProperties": false, + "description": "How a step answers the JavaScript dialog its action raises.\n\nA browser ``alert``/``confirm``/``prompt``/``beforeunload`` dialog is not a\nsurface: it is a screen state of the page that raised it, and it blocks\nthat page until it is answered. On the browser backend the step's action\narms a one-shot answer before delivering input; its recorded kind and\nmessage identify the dialog. Legacy contracts without a kind retain their\nmessage-only behavior. A dialog that does not show exactly ``message`` is\ndismissed, never accepted, and the step halts. On a screen-driven backend\n(desktop, RDP, Citrix) a dialog is just pixels and is recorded as the\nclicks that answer it, so this field is browser-only\n(docs/MULTI_SURFACE.md, \"Dialogs\").\n\nThe identity is either the exact ``message`` or ``message_pattern``, a\nfull-match regex. The compiler writes the pattern whenever the recorded\nmessage carried a demonstrated parameter value or digits (a record\nnumber, a date), so the bundle never seals that value.", + "properties": { + "response": { + "enum": [ + "accept", + "dismiss" + ], + "title": "Response", + "type": "string" + }, + "kind": { + "anyOf": [ + { + "enum": [ + "alert", + "confirm", + "prompt", + "beforeunload" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Kind" + }, + "message": { + "anyOf": [ + { + "maxLength": 2000, + "minLength": 1, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Message" + }, + "message_pattern": { + "anyOf": [ + { + "maxLength": 4000, + "minLength": 1, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Message Pattern" + } + }, + "required": [ + "response" + ], + "title": "DialogResponse", + "type": "object" + }, + "serialization": { + "additionalProperties": true, + "type": "object" + } + }, + "EffectFieldCheck": { + "validation": { + "additionalProperties": false, + "description": "One field the effect verifier compared on the saved record.\n\n``expected`` is what the run typed; ``observed`` is what the record held\n(None when it wasn't found). Kept on the local report only, for the\nreviewer's field-level diff and for decision triage; never sent to a\nhosted lane.", + "properties": { + "field": { + "title": "Field", + "type": "string" + }, + "expected": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Expected" + }, + "observed": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Observed" + }, + "matched": { + "title": "Matched", + "type": "boolean" + }, + "verification_tier": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Verification Tier" + } + }, + "required": [ + "field", + "matched" + ], + "title": "EffectFieldCheck", + "type": "object" + }, + "serialization": { + "additionalProperties": false, + "description": "One field the effect verifier compared on the saved record.\n\n``expected`` is what the run typed; ``observed`` is what the record held\n(None when it wasn't found). Kept on the local report only, for the\nreviewer's field-level diff and for decision triage; never sent to a\nhosted lane.", + "properties": { + "field": { + "title": "Field", + "type": "string" + }, + "expected": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Expected" + }, + "observed": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Observed" + }, + "matched": { + "title": "Matched", + "type": "boolean" + }, + "verification_tier": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Verification Tier" + } + }, + "required": [ + "field", + "matched" + ], + "title": "EffectFieldCheck", + "type": "object" + } + }, + "EffectJournalEntry": { + "validation": { + "description": "One consequential step's transaction-effect record (PHI-free).\n\nThe effect journal is the per-step ledger the reconciliation model reads.\nFor each consequential step it states the INTENDED effect (by stable\ncontract hash), the ATTEMPT state (delivered / uncertain / actuated / not\nactuated), the OBSERVED effect the independent verifier read from the\nsystem of record, how FRESH that verification was, and any COLLATERAL delta\n(reconciling compensations applied). It carries no record values,\nparameters, or free text -- only typed evidence already present on the\n:class:`StepResult`, so it can be persisted in the run's evidence output\nwithout leaking PHI.", + "properties": { + "step_id": { + "title": "Step Id", + "type": "string" + }, + "intent": { + "title": "Intent", + "type": "string" + }, + "consequential": { + "default": true, + "title": "Consequential", + "type": "boolean" + }, + "intended_effect_contract_hashes": { + "items": { + "type": "string" + }, + "title": "Intended Effect Contract Hashes", + "type": "array" + }, + "attempt_state": { + "default": "not_actuated", + "enum": [ + "not_actuated", + "delivered", + "actuated_api", + "delivery_uncertain" + ], + "title": "Attempt State", + "type": "string" + }, + "observed_effect": { + "default": "unknown", + "enum": [ + "present", + "absent", + "conflicting", + "unknown" + ], + "title": "Observed Effect", + "type": "string" + }, + "effect_verified": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Effect Verified" + }, + "approved_unverified": { + "default": false, + "title": "Approved Unverified", + "type": "boolean" + }, + "verification_performed": { + "default": false, + "title": "Verification Performed", + "type": "boolean" + }, + "observed_at": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Observed At" + }, + "collateral_reconciliation_actions": { + "default": 0, + "minimum": 0, + "title": "Collateral Reconciliation Actions", + "type": "integer" + } + }, + "required": [ + "step_id", + "intent" + ], + "title": "EffectJournalEntry", + "type": "object" + }, + "serialization": { + "description": "One consequential step's transaction-effect record (PHI-free).\n\nThe effect journal is the per-step ledger the reconciliation model reads.\nFor each consequential step it states the INTENDED effect (by stable\ncontract hash), the ATTEMPT state (delivered / uncertain / actuated / not\nactuated), the OBSERVED effect the independent verifier read from the\nsystem of record, how FRESH that verification was, and any COLLATERAL delta\n(reconciling compensations applied). It carries no record values,\nparameters, or free text -- only typed evidence already present on the\n:class:`StepResult`, so it can be persisted in the run's evidence output\nwithout leaking PHI.", + "properties": { + "step_id": { + "title": "Step Id", + "type": "string" + }, + "intent": { + "title": "Intent", + "type": "string" + }, + "consequential": { + "default": true, + "title": "Consequential", + "type": "boolean" + }, + "intended_effect_contract_hashes": { + "items": { + "type": "string" + }, + "title": "Intended Effect Contract Hashes", + "type": "array" + }, + "attempt_state": { + "default": "not_actuated", + "enum": [ + "not_actuated", + "delivered", + "actuated_api", + "delivery_uncertain" + ], + "title": "Attempt State", + "type": "string" + }, + "observed_effect": { + "default": "unknown", + "enum": [ + "present", + "absent", + "conflicting", + "unknown" + ], + "title": "Observed Effect", + "type": "string" + }, + "effect_verified": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Effect Verified" + }, + "approved_unverified": { + "default": false, + "title": "Approved Unverified", + "type": "boolean" + }, + "verification_performed": { + "default": false, + "title": "Verification Performed", + "type": "boolean" + }, + "observed_at": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Observed At" + }, + "collateral_reconciliation_actions": { + "default": 0, + "minimum": 0, + "title": "Collateral Reconciliation Actions", + "type": "integer" + } + }, + "required": [ + "step_id", + "intent" + ], + "title": "EffectJournalEntry", + "type": "object" + } + }, + "EffectVerificationEvidence": { + "validation": { + "description": "Structured evidence behind one effect-verification decision.", + "properties": { + "effect_contract_hash": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Effect Contract Hash", + "type": "string" + }, + "substrate": { + "minLength": 1, + "title": "Substrate", + "type": "string" + }, + "verifier_identity": { + "anyOf": [ + { + "pattern": "^sha256:[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Verifier Identity" + }, + "verification_tier": { + "anyOf": [ + { + "maximum": 4, + "minimum": 1, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Verification Tier" + }, + "initial_verdict": { + "enum": [ + "confirmed", + "refuted", + "indeterminate" + ], + "title": "Initial Verdict", + "type": "string" + }, + "final_verdict": { + "enum": [ + "confirmed", + "refuted", + "indeterminate" + ], + "title": "Final Verdict", + "type": "string" + }, + "reconciliation_completed": { + "default": false, + "title": "Reconciliation Completed", + "type": "boolean" + }, + "reconciliation_actions": { + "default": 0, + "minimum": 0, + "title": "Reconciliation Actions", + "type": "integer" + }, + "observed_effect": { + "default": "unknown", + "enum": [ + "present", + "absent", + "conflicting", + "unknown" + ], + "title": "Observed Effect", + "type": "string" + }, + "endpoint_scope": { + "default": "unknown", + "enum": [ + "loopback", + "external", + "unknown" + ], + "title": "Endpoint Scope", + "type": "string" + }, + "deferred_check": { + "anyOf": [ + { + "pattern": "^deferred:[0-9a-f]{32}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Deferred Check" + }, + "read_evidence": { + "anyOf": [ + { + "additionalProperties": true, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Read Evidence" + } + }, + "required": [ + "effect_contract_hash", + "substrate", + "initial_verdict", + "final_verdict" + ], + "title": "EffectVerificationEvidence", + "type": "object" + }, + "serialization": { + "additionalProperties": true, + "type": "object" + } + }, + "ExecutionOutcomeEnvelope": { + "validation": { + "$defs": { + "ActionKind": { + "enum": [ + "click", + "double_click", + "right_click", + "drag", + "type", + "select_option", + "key", + "hotkey", + "wait", + "scroll", + "read", + "switch_surface" + ], + "title": "ActionKind", + "type": "string" + }, + "OutcomeContractCounts": { + "description": "PHI-free counts of the contracts required and passed by one run.", + "properties": { + "authorization": { + "default": 0, + "minimum": 0, + "title": "Authorization", + "type": "integer" + }, + "identity": { + "default": 0, + "minimum": 0, + "title": "Identity", + "type": "integer" + }, + "postcondition": { + "default": 0, + "minimum": 0, + "title": "Postcondition", + "type": "integer" + }, + "effect": { + "default": 0, + "minimum": 0, + "title": "Effect", + "type": "integer" + } + }, + "title": "OutcomeContractCounts", + "type": "object" + }, + "PostconditionContractEvidence": { + "additionalProperties": false, + "description": "PHI-free proof for one postcondition contract on one result.\n\n``result_index`` binds the proof to the exact retained result occurrence,\nincluding repeated executions of the same program step. The two digests\nbind it to the executable workflow and exact step contract without placing\nthe step id, predicate text, typed value, or other record-bearing content in\nthe control-plane envelope.\n\nAn explicit predicate and intrinsic TYPE/SELECT_OPTION readback are\nintentionally different contract kinds. A successful input readback can\ntherefore never be counted as proof for a CLICK predicate.", + "properties": { + "result_index": { + "minimum": 0, + "title": "Result Index", + "type": "integer" + }, + "workflow_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Workflow Contract Sha256", + "type": "string" + }, + "step_index": { + "minimum": 0, + "title": "Step Index", + "type": "integer" + }, + "step_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Step Contract Sha256", + "type": "string" + }, + "action_kind": { + "$ref": "#/$defs/ActionKind" + }, + "actuation_path": { + "const": "gui", + "default": "gui", + "title": "Actuation Path", + "type": "string" + }, + "contract_kind": { + "enum": [ + "explicit_predicate", + "intrinsic_input_readback" + ], + "title": "Contract Kind", + "type": "string" + }, + "contract_index": { + "minimum": 0, + "title": "Contract Index", + "type": "integer" + }, + "contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Contract Sha256", + "type": "string" + }, + "verdict": { + "enum": [ + "passed", + "refuted", + "unverifiable" + ], + "title": "Verdict", + "type": "string" + } + }, + "required": [ + "result_index", + "workflow_contract_sha256", + "step_index", + "step_contract_sha256", + "action_kind", + "contract_kind", + "contract_index", + "contract_sha256", + "verdict" + ], + "title": "PostconditionContractEvidence", + "type": "object" + } + }, + "description": "Versioned, PHI-free execution result shared with control planes.\n\nThe coarse ``success``/``halt``/``failed`` lifecycle remains available for\nold consumers. This envelope states what the evidence actually proves.", + "properties": { + "version": { + "const": "openadapt.execution-outcome/v1", + "default": "openadapt.execution-outcome/v1", + "title": "Version", + "type": "string" + }, + "outcome": { + "enum": [ + "VERIFIED", + "COMPLETED_UNVERIFIED", + "HALTED", + "FAILED", + "ROLLED_BACK" + ], + "title": "Outcome", + "type": "string" + }, + "profile": { + "anyOf": [ + { + "enum": [ + "demo", + "standard", + "regulated" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Profile" + }, + "production_eligible": { + "default": false, + "title": "Production Eligible", + "type": "boolean" + }, + "qualification_evidence_only": { + "default": false, + "title": "Qualification Evidence Only", + "type": "boolean" + }, + "execution_completed": { + "default": false, + "title": "Execution Completed", + "type": "boolean" + }, + "required_contracts": { + "$ref": "#/$defs/OutcomeContractCounts" + }, + "passed_contracts": { + "$ref": "#/$defs/OutcomeContractCounts" + }, + "workflow_contract_sha256": { + "anyOf": [ + { + "pattern": "^[a-f0-9]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Exact executable workflow contract that owns the retained postcondition evidence.", + "title": "Workflow Contract Sha256" + }, + "postcondition_evidence": { + "description": "One typed, result-bound record for every required explicit or intrinsic GUI postcondition contract.", + "items": { + "$ref": "#/$defs/PostconditionContractEvidence" + }, + "title": "Postcondition Evidence", + "type": "array" + }, + "evidence_classes": { + "items": { + "enum": [ + "authorization", + "identity", + "postcondition", + "effect_tier_1", + "effect_tier_2", + "effect_tier_3", + "effect_tier_4", + "model", + "compensation" + ], + "type": "string" + }, + "title": "Evidence Classes", + "type": "array" + }, + "model_calls": { + "default": 0, + "minimum": 0, + "title": "Model Calls", + "type": "integer" + }, + "external_network_calls": { + "default": "unknown", + "enum": [ + "none", + "observed", + "unknown" + ], + "title": "External Network Calls", + "type": "string" + }, + "compensation_actions": { + "default": 0, + "minimum": 0, + "title": "Compensation Actions", + "type": "integer" + } + }, + "required": [ + "outcome" + ], + "title": "ExecutionOutcomeEnvelope", + "type": "object" + }, + "serialization": { + "additionalProperties": true, + "type": "object" + } + }, + "FormIdentity": { + "validation": { + "additionalProperties": false, + "description": "Record identity of a save on a create-new form: the form it submits is\nthe demonstrated form, holding exactly what this run typed.\n\nA form that creates a record shows no existing record next to its save\nbutton: the record is the one the run is entering. So the save's identity\nis the form itself, all of it. The recorder observes, right before the\ndemonstrated click on a labelled submit button, that the button submits\nthe one HTML form owning every field typed into since the last save (not\nin a table row or a single field's own widget), and fingerprints that\nform. Before the click at run time, the replayer requires:\n\n- the button is still that form's submit button, and the form owns\n exactly ``filled_fields`` fields this run typed into, each holding\n exactly what the run typed;\n- the form submits to the same origin and path (``action_sha256``) with\n the same ``method``, and would send the same set of control names and\n types (``controls_sha256``), hidden ones included;\n- every control the run did not type into (a hidden record or parent id,\n a select left on its default, a checked box) holds the demonstrated\n value: salted digests in ``value_digests``, under ``value_salt`` (the\n identity-template scheme). Hidden tokens are not compared (``exempt``):\n ones named like a token, and ones that changed while the demonstration\n was typed.\n\nAnything else halts before the click. A submit event from any other form\nor control during the click is cancelled and halts the run.\n\nCounts, tokens, names and digests only; no field text or value.", + "properties": { + "filled_fields": { + "maximum": 10000, + "minimum": 1, + "title": "Filled Fields", + "type": "integer" + }, + "submit_role": { + "const": "form_submit", + "title": "Submit Role", + "type": "string" + }, + "action_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Action Sha256", + "type": "string" + }, + "method": { + "enum": [ + "get", + "post", + "dialog" + ], + "title": "Method", + "type": "string" + }, + "controls_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Controls Sha256", + "type": "string" + }, + "value_salt": { + "default": "", + "maxLength": 128, + "title": "Value Salt", + "type": "string" + }, + "value_digests": { + "additionalProperties": { + "type": "string" + }, + "title": "Value Digests", + "type": "object" + }, + "exempt": { + "default": [], + "items": { + "type": "string" + }, + "title": "Exempt", + "type": "array" + } + }, + "required": [ + "filled_fields", + "submit_role", + "action_sha256", + "method", + "controls_sha256" + ], + "title": "FormIdentity", + "type": "object" + }, + "serialization": { + "additionalProperties": false, + "description": "Record identity of a save on a create-new form: the form it submits is\nthe demonstrated form, holding exactly what this run typed.\n\nA form that creates a record shows no existing record next to its save\nbutton: the record is the one the run is entering. So the save's identity\nis the form itself, all of it. The recorder observes, right before the\ndemonstrated click on a labelled submit button, that the button submits\nthe one HTML form owning every field typed into since the last save (not\nin a table row or a single field's own widget), and fingerprints that\nform. Before the click at run time, the replayer requires:\n\n- the button is still that form's submit button, and the form owns\n exactly ``filled_fields`` fields this run typed into, each holding\n exactly what the run typed;\n- the form submits to the same origin and path (``action_sha256``) with\n the same ``method``, and would send the same set of control names and\n types (``controls_sha256``), hidden ones included;\n- every control the run did not type into (a hidden record or parent id,\n a select left on its default, a checked box) holds the demonstrated\n value: salted digests in ``value_digests``, under ``value_salt`` (the\n identity-template scheme). Hidden tokens are not compared (``exempt``):\n ones named like a token, and ones that changed while the demonstration\n was typed.\n\nAnything else halts before the click. A submit event from any other form\nor control during the click is cancelled and halts the run.\n\nCounts, tokens, names and digests only; no field text or value.", + "properties": { + "filled_fields": { + "maximum": 10000, + "minimum": 1, + "title": "Filled Fields", + "type": "integer" + }, + "submit_role": { + "const": "form_submit", + "title": "Submit Role", + "type": "string" + }, + "action_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Action Sha256", + "type": "string" + }, + "method": { + "enum": [ + "get", + "post", + "dialog" + ], + "title": "Method", + "type": "string" + }, + "controls_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Controls Sha256", + "type": "string" + }, + "value_salt": { + "default": "", + "maxLength": 128, + "title": "Value Salt", + "type": "string" + }, + "value_digests": { + "additionalProperties": { + "type": "string" + }, + "title": "Value Digests", + "type": "object" + }, + "exempt": { + "default": [], + "items": { + "type": "string" + }, + "title": "Exempt", + "type": "array" + } + }, + "required": [ + "filled_fields", + "submit_role", + "action_sha256", + "method", + "controls_sha256" + ], + "title": "FormIdentity", + "type": "object" + } + }, + "GovernedAuthorizationParameter": { + "validation": { + "$defs": { + "ParamKind": { + "description": "Typed-parameter kinds (RFC \u00a72.2 ``ParamSpec.type``).\n\n``entity_ref`` names an ENTITY to be re-resolved by the identity ladder at\nrun time (the \"which patient\" fix, docs/LIMITS.md), not a literal to blindly\nsubstitute; the other kinds are literal values. Phase 1 stores the type for\ntyping/validation/emit -- kind-specific run-time resolution (entity_ref\nre-resolution) is Phase 2+.", + "enum": [ + "string", + "date", + "enum", + "number", + "boolean", + "entity_ref" + ], + "title": "ParamKind", + "type": "string" + } + }, + "additionalProperties": false, + "description": "One value-free parameter declaration in a governed template.", + "properties": { + "name": { + "maxLength": 128, + "minLength": 1, + "title": "Name", + "type": "string" + }, + "type": { + "$ref": "#/$defs/ParamKind" + }, + "required": { + "title": "Required", + "type": "boolean" + }, + "secret": { + "title": "Secret", + "type": "boolean" + }, + "has_default": { + "title": "Has Default", + "type": "boolean" + }, + "choices_count": { + "minimum": 0, + "title": "Choices Count", + "type": "integer" + }, + "choices_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Choices Sha256", + "type": "string" + } + }, + "required": [ + "name", + "type", + "required", + "secret", + "has_default", + "choices_count", + "choices_sha256" + ], + "title": "GovernedAuthorizationParameter", + "type": "object" + }, + "serialization": { + "$defs": { + "ParamKind": { + "description": "Typed-parameter kinds (RFC \u00a72.2 ``ParamSpec.type``).\n\n``entity_ref`` names an ENTITY to be re-resolved by the identity ladder at\nrun time (the \"which patient\" fix, docs/LIMITS.md), not a literal to blindly\nsubstitute; the other kinds are literal values. Phase 1 stores the type for\ntyping/validation/emit -- kind-specific run-time resolution (entity_ref\nre-resolution) is Phase 2+.", + "enum": [ + "string", + "date", + "enum", + "number", + "boolean", + "entity_ref" + ], + "title": "ParamKind", + "type": "string" + } + }, + "additionalProperties": false, + "description": "One value-free parameter declaration in a governed template.", + "properties": { + "name": { + "maxLength": 128, + "minLength": 1, + "title": "Name", + "type": "string" + }, + "type": { + "$ref": "#/$defs/ParamKind" + }, + "required": { + "title": "Required", + "type": "boolean" + }, + "secret": { + "title": "Secret", + "type": "boolean" + }, + "has_default": { + "title": "Has Default", + "type": "boolean" + }, + "choices_count": { + "minimum": 0, + "title": "Choices Count", + "type": "integer" + }, + "choices_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Choices Sha256", + "type": "string" + } + }, + "required": [ + "name", + "type", + "required", + "secret", + "has_default", + "choices_count", + "choices_sha256" + ], + "title": "GovernedAuthorizationParameter", + "type": "object" + } + }, + "GovernedAuthorizationTemplate": { + "validation": { + "$defs": { + "GovernedAuthorizationParameter": { + "additionalProperties": false, + "description": "One value-free parameter declaration in a governed template.", + "properties": { + "name": { + "maxLength": 128, + "minLength": 1, + "title": "Name", + "type": "string" + }, + "type": { + "$ref": "#/$defs/ParamKind" + }, + "required": { + "title": "Required", + "type": "boolean" + }, + "secret": { + "title": "Secret", + "type": "boolean" + }, + "has_default": { + "title": "Has Default", + "type": "boolean" + }, + "choices_count": { + "minimum": 0, + "title": "Choices Count", + "type": "integer" + }, + "choices_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Choices Sha256", + "type": "string" + } + }, + "required": [ + "name", + "type", + "required", + "secret", + "has_default", + "choices_count", + "choices_sha256" + ], + "title": "GovernedAuthorizationParameter", + "type": "object" + }, + "ParamKind": { + "description": "Typed-parameter kinds (RFC \u00a72.2 ``ParamSpec.type``).\n\n``entity_ref`` names an ENTITY to be re-resolved by the identity ladder at\nrun time (the \"which patient\" fix, docs/LIMITS.md), not a literal to blindly\nsubstitute; the other kinds are literal values. Phase 1 stores the type for\ntyping/validation/emit -- kind-specific run-time resolution (entity_ref\nre-resolution) is Phase 2+.", + "enum": [ + "string", + "date", + "enum", + "number", + "boolean", + "entity_ref" + ], + "title": "ParamKind", + "type": "string" + }, + "QualifiedEffectRequirement": { + "additionalProperties": false, + "description": "One exact qualified effect-strength requirement admitted for a run.", + "properties": { + "step_id": { + "title": "Step Id", + "type": "string" + }, + "actuation_path": { + "enum": [ + "gui", + "api" + ], + "title": "Actuation Path", + "type": "string" + }, + "effect_index": { + "minimum": 0, + "title": "Effect Index", + "type": "integer" + }, + "effect_contract_hash": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Effect Contract Hash", + "type": "string" + }, + "minimum_tier": { + "maximum": 4, + "minimum": 1, + "title": "Minimum Tier", + "type": "integer" + } + }, + "required": [ + "step_id", + "actuation_path", + "effect_index", + "effect_contract_hash", + "minimum_tier" + ], + "title": "QualifiedEffectRequirement", + "type": "object" + } + }, + "additionalProperties": false, + "description": "Immutable production authorization shape for one certified bundle.\n\nThis is not a bearer capability. It deliberately excludes runtime input\nvalues, approval identity, credentials, and effect or identity recipes.\nThe template lives in manifest provenance so it can commit to the final\ncontent digest without creating a content-digest cycle.", + "properties": { + "schema_version": { + "const": "openadapt.governed-authorization-template/v1", + "default": "openadapt.governed-authorization-template/v1", + "title": "Schema Version", + "type": "string" + }, + "bundle_content_digest": { + "pattern": "^[a-f0-9]{64}$", + "title": "Bundle Content Digest", + "type": "string" + }, + "workflow_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Workflow Contract Sha256", + "type": "string" + }, + "qualification_project_id": { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$", + "title": "Qualification Project Id", + "type": "string" + }, + "qualification_project_revision": { + "minimum": 1, + "title": "Qualification Project Revision", + "type": "integer" + }, + "qualification_project_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Qualification Project Contract Sha256", + "type": "string" + }, + "qualification_environment_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Qualification Environment Contract Sha256", + "type": "string" + }, + "qualification_report_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Qualification Report Sha256", + "type": "string" + }, + "qualification_case_evidence_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Qualification Case Evidence Contract Sha256", + "type": "string" + }, + "policy_name": { + "maxLength": 128, + "minLength": 1, + "title": "Policy Name", + "type": "string" + }, + "policy_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Policy Contract Sha256", + "type": "string" + }, + "execution_profile": { + "enum": [ + "standard", + "regulated" + ], + "title": "Execution Profile", + "type": "string" + }, + "minimum_effect_tier": { + "maximum": 4, + "minimum": 1, + "title": "Minimum Effect Tier", + "type": "integer" + }, + "qualified_effect_requirements": { + "default": [], + "items": { + "$ref": "#/$defs/QualifiedEffectRequirement" + }, + "title": "Qualified Effect Requirements", + "type": "array" + }, + "required_identity_step_ids": { + "items": { + "type": "string" + }, + "title": "Required Identity Step Ids", + "type": "array" + }, + "identity_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Identity Contract Sha256", + "type": "string" + }, + "parameters": { + "default": [], + "items": { + "$ref": "#/$defs/GovernedAuthorizationParameter" + }, + "title": "Parameters", + "type": "array" + }, + "parameter_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Parameter Contract Sha256", + "type": "string" + }, + "template_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Template Sha256", + "type": "string" + } + }, + "required": [ + "bundle_content_digest", + "workflow_contract_sha256", + "qualification_project_id", + "qualification_project_revision", + "qualification_project_contract_sha256", + "qualification_environment_contract_sha256", + "qualification_report_sha256", + "qualification_case_evidence_contract_sha256", + "policy_name", + "policy_contract_sha256", + "execution_profile", + "minimum_effect_tier", + "identity_contract_sha256", + "parameter_contract_sha256", + "template_sha256" + ], + "title": "GovernedAuthorizationTemplate", + "type": "object" + }, + "serialization": { + "$defs": { + "GovernedAuthorizationParameter": { + "additionalProperties": false, + "description": "One value-free parameter declaration in a governed template.", + "properties": { + "name": { + "maxLength": 128, + "minLength": 1, + "title": "Name", + "type": "string" + }, + "type": { + "$ref": "#/$defs/ParamKind" + }, + "required": { + "title": "Required", + "type": "boolean" + }, + "secret": { + "title": "Secret", + "type": "boolean" + }, + "has_default": { + "title": "Has Default", + "type": "boolean" + }, + "choices_count": { + "minimum": 0, + "title": "Choices Count", + "type": "integer" + }, + "choices_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Choices Sha256", + "type": "string" + } + }, + "required": [ + "name", + "type", + "required", + "secret", + "has_default", + "choices_count", + "choices_sha256" + ], + "title": "GovernedAuthorizationParameter", + "type": "object" + }, + "ParamKind": { + "description": "Typed-parameter kinds (RFC \u00a72.2 ``ParamSpec.type``).\n\n``entity_ref`` names an ENTITY to be re-resolved by the identity ladder at\nrun time (the \"which patient\" fix, docs/LIMITS.md), not a literal to blindly\nsubstitute; the other kinds are literal values. Phase 1 stores the type for\ntyping/validation/emit -- kind-specific run-time resolution (entity_ref\nre-resolution) is Phase 2+.", + "enum": [ + "string", + "date", + "enum", + "number", + "boolean", + "entity_ref" + ], + "title": "ParamKind", + "type": "string" + }, + "QualifiedEffectRequirement": { + "additionalProperties": false, + "description": "One exact qualified effect-strength requirement admitted for a run.", + "properties": { + "step_id": { + "title": "Step Id", + "type": "string" + }, + "actuation_path": { + "enum": [ + "gui", + "api" + ], + "title": "Actuation Path", + "type": "string" + }, + "effect_index": { + "minimum": 0, + "title": "Effect Index", + "type": "integer" + }, + "effect_contract_hash": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Effect Contract Hash", + "type": "string" + }, + "minimum_tier": { + "maximum": 4, + "minimum": 1, + "title": "Minimum Tier", + "type": "integer" + } + }, + "required": [ + "step_id", + "actuation_path", + "effect_index", + "effect_contract_hash", + "minimum_tier" + ], + "title": "QualifiedEffectRequirement", + "type": "object" + } + }, + "additionalProperties": false, + "description": "Immutable production authorization shape for one certified bundle.\n\nThis is not a bearer capability. It deliberately excludes runtime input\nvalues, approval identity, credentials, and effect or identity recipes.\nThe template lives in manifest provenance so it can commit to the final\ncontent digest without creating a content-digest cycle.", + "properties": { + "schema_version": { + "const": "openadapt.governed-authorization-template/v1", + "default": "openadapt.governed-authorization-template/v1", + "title": "Schema Version", + "type": "string" + }, + "bundle_content_digest": { + "pattern": "^[a-f0-9]{64}$", + "title": "Bundle Content Digest", + "type": "string" + }, + "workflow_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Workflow Contract Sha256", + "type": "string" + }, + "qualification_project_id": { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$", + "title": "Qualification Project Id", + "type": "string" + }, + "qualification_project_revision": { + "minimum": 1, + "title": "Qualification Project Revision", + "type": "integer" + }, + "qualification_project_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Qualification Project Contract Sha256", + "type": "string" + }, + "qualification_environment_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Qualification Environment Contract Sha256", + "type": "string" + }, + "qualification_report_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Qualification Report Sha256", + "type": "string" + }, + "qualification_case_evidence_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Qualification Case Evidence Contract Sha256", + "type": "string" + }, + "policy_name": { + "maxLength": 128, + "minLength": 1, + "title": "Policy Name", + "type": "string" + }, + "policy_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Policy Contract Sha256", + "type": "string" + }, + "execution_profile": { + "enum": [ + "standard", + "regulated" + ], + "title": "Execution Profile", + "type": "string" + }, + "minimum_effect_tier": { + "maximum": 4, + "minimum": 1, + "title": "Minimum Effect Tier", + "type": "integer" + }, + "qualified_effect_requirements": { + "default": [], + "items": { + "$ref": "#/$defs/QualifiedEffectRequirement" + }, + "title": "Qualified Effect Requirements", + "type": "array" + }, + "required_identity_step_ids": { + "items": { + "type": "string" + }, + "title": "Required Identity Step Ids", + "type": "array" + }, + "identity_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Identity Contract Sha256", + "type": "string" + }, + "parameters": { + "default": [], + "items": { + "$ref": "#/$defs/GovernedAuthorizationParameter" + }, + "title": "Parameters", + "type": "array" + }, + "parameter_contract_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Parameter Contract Sha256", + "type": "string" + }, + "template_sha256": { + "pattern": "^[a-f0-9]{64}$", + "title": "Template Sha256", + "type": "string" + } + }, + "required": [ + "bundle_content_digest", + "workflow_contract_sha256", + "qualification_project_id", + "qualification_project_revision", + "qualification_project_contract_sha256", + "qualification_environment_contract_sha256", + "qualification_report_sha256", + "qualification_case_evidence_contract_sha256", + "policy_name", + "policy_contract_sha256", + "execution_profile", + "minimum_effect_tier", + "identity_contract_sha256", + "parameter_contract_sha256", + "template_sha256" + ], + "title": "GovernedAuthorizationTemplate", + "type": "object" + } + }, + "Guard": { + "validation": { + "$defs": { + "Anchor": { + "description": "Redundant evidence for locating a step's target on screen.\n\nResolution ladder consumes fields in order of preference (strongest, most\ndrift-tolerant first): ``structural`` (DOM / UIA element, when the backend\nsupports it) -> template (local, then global) -> ocr_text -> landmarks ->\ngrounder. ``structural`` is the deterministic top rung; the remaining\n(visual) rungs are the FALLBACK floor for pixel-only substrates.", + "properties": { + "template": { + "description": "Bundle-relative path to the PNG crop", + "title": "Template", + "type": "string" + }, + "structural": { + "anyOf": [ + { + "$ref": "#/$defs/StructuralLocator" + }, + { + "type": "null" + } + ], + "default": null, + "description": "STRUCTURAL locator (DOM selector / role+name, or UIA AutomationId / role+name) of the clicked target, captured at record time when the recording backend exposes it (openadapt_flow.backend.StructuralActionBackend). Drives the structural ACTION rung -- the TOP of the resolution ladder -- which re-finds the SAME element deterministically (no pixel match) and is far more drift-tolerant than the visual rungs (21/21 vs 6/21 on the desktop benchmark). None on pixel-only substrates or bundles compiled before this capability; the ladder then resolves via the visual rungs below." + }, + "region": { + "description": "Crop location in the recorded frame", + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "title": "Region", + "type": "array" + }, + "click_point": { + "description": "Click point in the recorded frame", + "maxItems": 2, + "minItems": 2, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "title": "Click Point", + "type": "array" + }, + "ocr_text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Text label at/near the target, if any", + "title": "Ocr Text" + }, + "context_text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Identity evidence: OCR text on the target's row (full-width band at the crop's height) EXCLUDING the target's own crop and timestamp-bearing lines. Verified before every click (see runtime.identity); None when the band had no usable text at compile time.", + "title": "Context Text" + }, + "structured_identity": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "STRUCTURED identity text (DOM / accessibility tree) of the clicked target's row, captured at record time when the recording backend exposes it (openadapt_flow.backend.IdentityBackend.structured_text_at). The REAL characters (a genuine digit 0 vs a letter O), so replay verifies identity by exact/normalized string compare with NO OCR ambiguity -- the structured-text tier of the identity ladder (see runtime.identity). None on pixel-only substrates or bundles recorded before this capability; the ladder then falls back to the OCR context_text tier.", + "title": "Structured Identity" + }, + "record_key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Stable record id of the target's row at record time (plaintext, compile-time only). The PHI-free pass hashes it into ``identity_template.record_key`` and clears this field.", + "title": "Record Key" + }, + "structured_row": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Whether ``structured_identity`` came from a record row (compile-time only; moved to ``identity_template.structured_row``).", + "title": "Structured Row" + }, + "structured_ambiguous": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Whether teach time saw another row read the same with no record id between them (compile-time only; moved to ``identity_template.teach_ambiguous``).", + "title": "Structured Ambiguous" + }, + "identity_template": { + "anyOf": [ + { + "$ref": "#/$defs/IdentityTemplate" + }, + { + "type": "null" + } + ], + "default": null, + "description": "PHI-FREE identity template (salted-hash + shape) of the recorded context band and structured identity. When present, the runtime verifies target identity from THIS (no plaintext name/DOB/MRN in the artifact \u2014 the PHI audit's REM-2) and ``context_text`` / ``structured_identity`` are None. Bundles compiled before this capability carry the plaintext fields instead and still replay unchanged (backward compatible). See openadapt_flow.runtime.identity_template." + }, + "identifier_crop": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Bundle-relative PNG crop of the target row's DISCRIMINATIVE IDENTIFIER cell (the MRN / name+DOB region), emitted by the COMPILER (templates/identifiers/.png -- under templates/ so it is sealed with the other image crops in an encrypted bundle) for identity-armed steps that captured no structured text (Citrix / RDP / remote-display pixel recordings), or for any step whose identifier region was explicitly marked at record time (--identifier). Feeds the pixel-compare and optional VLM tiers of the identity ladder (see runtime.identity): the rendered PIXELS retain the O/0 and l/1 distinction OCR collapses, so a crop-vs-crop compare catches the glyph-collapse wrong-patient where the DOM/a11y tree is unavailable. None on structured (browser/UIA) recordings unless marked (the structured tier owns identity there; no identity pixels at rest) and on bundles compiled before this capability -- Step.identifier_crop_missing_reason records WHY; the ladder then falls through to the OCR band tier.", + "title": "Identifier Crop" + }, + "identifier_region": { + "anyOf": [ + { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Location of `identifier_crop` in the recorded frame (x, y, w, h). Replay re-crops the SAME box at the resolved point (translated by the recorded region's offset from the recorded click point, exactly as the OCR band's exclude region is) so the pixel/VLM tiers compare like-for-like. Set iff `identifier_crop` is set.", + "title": "Identifier Region" + }, + "dialog_region": { + "anyOf": [ + { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Box of the active dialog (the topmost modal) that held the target in the recorded frame, when it sat in one. The context band was cut to it, so text of the page behind the dialog is not identity evidence. Replay cuts the live band to the live dialog's box, and fails the identity check closed when no dialog holds the resolved point. None outside a dialog and on bundles compiled before this capability.", + "title": "Dialog Region" + }, + "dialog_row": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "True reads the target's own row inside dialog_region. False permits the whole dialog when teach time positively found a standalone control with no usable row text; replay must confirm no record row again. None conservatively uses the target's row.", + "title": "Dialog Row" + }, + "form_identity": { + "anyOf": [ + { + "$ref": "#/$defs/FormIdentity" + }, + { + "type": "null" + } + ], + "default": null, + "description": "A labelled save on a create-new form: before the click, its form must hold exactly the fields this run typed, with the values typed. See FormIdentity. None everywhere else." + }, + "landmarks": { + "items": { + "$ref": "#/$defs/Landmark" + }, + "title": "Landmarks", + "type": "array" + }, + "search_pad": { + "default": 80, + "description": "Pixels of padding around `region` for the local search", + "title": "Search Pad", + "type": "integer" + } + }, + "required": [ + "template", + "region", + "click_point" + ], + "title": "Anchor", + "type": "object" + }, + "ConcatTemplate": { + "description": "Precomputed SPLIT-match key (consecutive recorded tokens the live OCR\nmay glue into one), since hashes cannot be concatenated at replay.", + "properties": { + "i": { + "title": "I", + "type": "integer" + }, + "size": { + "title": "Size", + "type": "integer" + }, + "c": { + "title": "C", + "type": "string" + }, + "r": { + "title": "R", + "type": "string" + }, + "digit": { + "title": "Digit", + "type": "boolean" + }, + "name": { + "title": "Name", + "type": "boolean" + }, + "n": { + "title": "N", + "type": "integer" + } + }, + "required": [ + "i", + "size", + "c", + "r", + "digit", + "name", + "n" + ], + "title": "ConcatTemplate", + "type": "object" + }, + "FormIdentity": { + "additionalProperties": false, + "description": "Record identity of a save on a create-new form: the form it submits is\nthe demonstrated form, holding exactly what this run typed.\n\nA form that creates a record shows no existing record next to its save\nbutton: the record is the one the run is entering. So the save's identity\nis the form itself, all of it. The recorder observes, right before the\ndemonstrated click on a labelled submit button, that the button submits\nthe one HTML form owning every field typed into since the last save (not\nin a table row or a single field's own widget), and fingerprints that\nform. Before the click at run time, the replayer requires:\n\n- the button is still that form's submit button, and the form owns\n exactly ``filled_fields`` fields this run typed into, each holding\n exactly what the run typed;\n- the form submits to the same origin and path (``action_sha256``) with\n the same ``method``, and would send the same set of control names and\n types (``controls_sha256``), hidden ones included;\n- every control the run did not type into (a hidden record or parent id,\n a select left on its default, a checked box) holds the demonstrated\n value: salted digests in ``value_digests``, under ``value_salt`` (the\n identity-template scheme). Hidden tokens are not compared (``exempt``):\n ones named like a token, and ones that changed while the demonstration\n was typed.\n\nAnything else halts before the click. A submit event from any other form\nor control during the click is cancelled and halts the run.\n\nCounts, tokens, names and digests only; no field text or value.", + "properties": { + "filled_fields": { + "maximum": 10000, + "minimum": 1, + "title": "Filled Fields", + "type": "integer" + }, + "submit_role": { + "const": "form_submit", + "title": "Submit Role", + "type": "string" + }, + "action_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Action Sha256", + "type": "string" + }, + "method": { + "enum": [ + "get", + "post", + "dialog" + ], + "title": "Method", + "type": "string" + }, + "controls_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Controls Sha256", + "type": "string" + }, + "value_salt": { + "default": "", + "maxLength": 128, + "title": "Value Salt", + "type": "string" + }, + "value_digests": { + "additionalProperties": { + "type": "string" + }, + "title": "Value Digests", + "type": "object" + }, + "exempt": { + "default": [], + "items": { + "type": "string" + }, + "title": "Exempt", + "type": "array" + } + }, + "required": [ + "filled_fields", + "submit_role", + "action_sha256", + "method", + "controls_sha256" + ], + "title": "FormIdentity", + "type": "object" + }, + "IdentityTemplate": { + "description": "PHI-free stand-in for ``Anchor.context_text`` / ``structured_identity``.\n\nA salted-hash, shape-preserving template of the recorded identity band. It\nlets the runtime re-run the SAME wrong-patient identity check\n(:mod:`openadapt_flow.runtime.identity_template`) with no readable name /\nDOB / MRN in the artifact. NOT a cryptographic control (a salted hash of a\nlow-entropy identifier is brute-forceable by a holder of the bundle + salt);\nit removes *plaintext* PHI. The at-rest control is bundle encryption\n(docs/phi_at_rest.md, deferred). Set ``OPENADAPT_FLOW_IDENTITY_SALT`` at\ncompile+replay to keep the salt out of the bundle and make the hashes\none-way to anyone without the external secret.", + "properties": { + "schema_version": { + "default": 1, + "title": "Schema Version", + "type": "integer" + }, + "salt": { + "default": "", + "description": "per-bundle salt (hex); empty => env salt", + "title": "Salt", + "type": "string" + }, + "band_len": { + "default": 0, + "title": "Band Len", + "type": "integer" + }, + "tokens": { + "items": { + "$ref": "#/$defs/TokenTemplate" + }, + "title": "Tokens", + "type": "array" + }, + "concats": { + "items": { + "$ref": "#/$defs/ConcatTemplate" + }, + "title": "Concats", + "type": "array" + }, + "punctuation_policy": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Punctuation Policy" + }, + "punctuation_indices": { + "items": { + "type": "integer" + }, + "title": "Punctuation Indices", + "type": "array" + }, + "punctuation_body_keys": { + "additionalProperties": { + "type": "string" + }, + "title": "Punctuation Body Keys", + "type": "object" + }, + "standalone_punctuation_indices": { + "items": { + "type": "integer" + }, + "title": "Standalone Punctuation Indices", + "type": "array" + }, + "ocr_noise": { + "anyOf": [ + { + "$ref": "#/$defs/IdentityTemplate" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Writer-owned salted noise hashes, schema0. Classification-only: can supply glyph uncertainty but never identity authority. Unavailable on parameterized calls." + }, + "structured": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "salted hash of the structured identity string", + "title": "Structured" + }, + "structured_params": { + "description": "Workflow parameters embedded in the structured identity. Their demonstrated values are replaced by fixed sentinels before hashing; replay substitutes the run's value before exact compare.", + "items": { + "type": "string" + }, + "title": "Structured Params", + "type": "array" + }, + "signal_hashes": { + "additionalProperties": { + "type": "string" + }, + "description": "Salted hashes of strict exact/explicitly-normalized identity evidence, including operator-selected extracted fields. Keys are produced by identity_signals.", + "title": "Signal Hashes", + "type": "object" + }, + "context_params": { + "description": "Workflow parameters replaced by fixed sentinels before the captured-context signal hashes were computed.", + "items": { + "type": "string" + }, + "title": "Context Params", + "type": "array" + }, + "param_token_indices": { + "additionalProperties": { + "items": { + "type": "integer" + }, + "type": "array" + }, + "title": "Param Token Indices", + "type": "object" + }, + "rests_on_confusable_identifier": { + "default": false, + "title": "Rests On Confusable Identifier", + "type": "boolean" + }, + "record_key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Salted hash of the stable record id the target's row carried at teach time (app-owned DOM data-* ids, the row link's path). When set, replay acts only on the shown row with the same id.", + "title": "Record Key" + }, + "structured_row": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Whether the structured identity came from a record row at teach time. False lets a replay surface that cannot count look-alike rows still act on the target (a form field, a button); None (unknown) is treated as a row.", + "title": "Structured Row" + }, + "teach_ambiguous": { + "default": false, + "description": "Teach time saw another shown row with the same identity and no record id between them. Replay halts before a consequential write: a twin that later scrolls out of view would otherwise pass the text check.", + "title": "Teach Ambiguous", + "type": "boolean" + } + }, + "title": "IdentityTemplate", + "type": "object" + }, + "Landmark": { + "description": "A stable nearby text element, used by the geometry resolution rung.\n\n``relation`` describes where the LANDMARK sits relative to the target:\na landmark that is ``left_of`` the target implies the target is\n``distance_px`` to the landmark's right. ``dx_px``/``dy_px``, when set,\nare the exact pixel offsets from the landmark's center to the target\nclick point (target = landmark_center + (dx_px, dy_px)); the geometry\nrung prefers them over the coarser relation/distance estimate.", + "properties": { + "relation": { + "enum": [ + "left_of", + "right_of", + "above", + "below" + ], + "title": "Relation", + "type": "string" + }, + "ocr_text": { + "title": "Ocr Text", + "type": "string" + }, + "distance_px": { + "title": "Distance Px", + "type": "integer" + }, + "match_mode": { + "default": "fuzzy", + "description": "OCR comparison mode for this retained relation. Compiler-mined generic context remains fuzzy; a qualified opaque-field label uses exact normalized text so a near label cannot authorize input.", + "enum": [ + "fuzzy", + "exact" + ], + "title": "Match Mode", + "type": "string" + }, + "dx_px": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Exact x offset landmark center -> target click point", + "title": "Dx Px" + }, + "dy_px": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Exact y offset landmark center -> target click point", + "title": "Dy Px" + } + }, + "required": [ + "relation", + "ocr_text", + "distance_px" + ], + "title": "Landmark", + "type": "object" + }, + "Predicate": { + "description": "A deterministic condition over observed state (RFC \u00a72.2 ``Predicate``).\n\nUsed two ways in Phase 1: as a ``Step.wait_until`` readiness predicate (the\nreplayer polls it, BOUNDED by ``timeout_s``, and HALTS on timeout -- never\nproceeds-anyway) and as the condition inside a ``Guard``. Model-free by\nconstruction (see ``runtime.replayer._predicate_holds``); an unknown kind\nfails safe (does not hold).", + "properties": { + "kind": { + "$ref": "#/$defs/PredicateKind" + }, + "anchor": { + "anyOf": [ + { + "$ref": "#/$defs/Anchor" + }, + { + "type": "null" + } + ], + "default": null + }, + "text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Text" + }, + "param": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Param" + }, + "value": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Value" + }, + "intent": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Human-readable label (also the resolution-ladder intent for an ANCHOR_RESOLVES predicate).", + "title": "Intent" + }, + "operands": { + "description": "Sub-predicates for AND / OR / NOT.", + "items": { + "$ref": "#/$defs/Predicate" + }, + "title": "Operands", + "type": "array" + }, + "timeout_s": { + "default": 5.0, + "description": "wait_until bound: how long the replayer polls this predicate before HALTing (fail-safe; never proceed-anyway).", + "title": "Timeout S", + "type": "number" + }, + "exact": { + "default": false, + "title": "Exact", + "type": "boolean" + } + }, + "required": [ + "kind" + ], + "title": "Predicate", + "type": "object" + }, + "PredicateKind": { + "description": "Deterministic, model-free predicate kinds (RFC \u00a72.2 ``Predicate``).\n\nA predicate is evaluated over the CURRENT observed frame / run parameters\nwith ZERO model calls -- it is the thing a linear IR cannot express. Phase 1\nships the concrete kinds needed to (a) subsume today's SCROLL closed loop\n(``anchor_resolves``), (b) turn the optional-modal case into a guarded\nbranch (``text_present``), and (c) branch on a parameter (``param_equals``),\nplus boolean composition. ``worklist_nonempty`` (loops) is Phase 2.", + "enum": [ + "anchor_resolves", + "text_present", + "text_absent", + "param_equals", + "and", + "or", + "not" + ], + "title": "PredicateKind", + "type": "string" + }, + "StructuralLocator": { + "description": "A stable structural (DOM / accessibility) locator for a step's target.\n\nCaptured at record time from the recording backend's structured layer\n(:meth:`openadapt_flow.backend.StructuralActionBackend.structural_locator_at`)\nand consumed at replay by the structural ACTION rung -- the TOP of the\nresolution ladder (:mod:`openadapt_flow.runtime.resolver`). The runtime\nre-finds the SAME element by its stable identity -- a DOM id / CSS selector\n/ ARIA role+name, or a Windows UIA ``AutomationId`` / ``ControlType``+\n``Name`` -- and acts on the element's center DETERMINISTICALLY, with no\npixel matching. This is the thesis shift from \"vision-only\" to\n\"deterministic compiled automation with visual FALLBACK\": the desktop\nbenchmark measured UIA execution 21/21 vs compiled visual replay 6/21 under\nrender drift.\n\nThe visual anchor (template / ocr_text / landmarks) is ALWAYS kept too: the\nladder falls through to it UNCHANGED when this locator is absent (pixel-only\nsubstrate -- RDP/Citrix/canvas) or when the element cannot be located at\nreplay (see docs/LIMITS.md). Structural resolution is ADDITIVE -- it never\nremoves the visual floor.\n\nFields are backend-neutral; a browser backend fills ``selector`` / ``role``\n/ ``name`` from the DOM, a native backend fills ``automation_id`` / ``role``\n/ ``name`` from its accessibility tree (Windows UIA AutomationId or the\nLinux AT-SPI accessible ID). Each backend uses whichever fields it\nrecorded; unset fields are ignored.", + "properties": { + "selector": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Stable CSS/DOM selector, e.g. '#open-p1' (browser)", + "title": "Selector" + }, + "frame_path": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "maxItems": 8, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Outermost-to-innermost CSS selectors for iframe/frame elements containing a browser target. Each selector must resolve uniquely in its parent frame; absent means the top-level document.", + "title": "Frame Path" + }, + "role": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "ARIA / UIA control role, e.g. 'button', 'link'", + "title": "Role" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Accessible name / label / text of the target element", + "title": "Name" + }, + "automation_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Stable native accessibility ID: Windows UIA AutomationId or Linux AT-SPI accessible ID", + "title": "Automation Id" + }, + "window_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Exact top-level accessibility window name captured with the target. Native backends use it to scope candidate enumeration and refuse duplicate controls in a different application window.", + "title": "Window Name" + } + }, + "title": "StructuralLocator", + "type": "object" + }, + "TokenTemplate": { + "description": "Salted-hash + shape descriptor for one recorded identity-band token.\n\nCarries NO plaintext (the PHI audit's REM-2): ``c``/``r`` are salted hashes\nof the token's OCR-canonical and squashed-raw forms; the rest are\nnon-identifying shape flags and a length. Enough to reproduce the\nwrong-patient guard's per-token budgets at replay\n(:mod:`openadapt_flow.runtime.identity_template`) without persisting the\nidentifier itself.", + "properties": { + "c": { + "description": "salted hash of ocr_canonical(squashed token)", + "title": "C", + "type": "string" + }, + "r": { + "description": "salted hash of squashed raw token", + "title": "R", + "type": "string" + }, + "n": { + "description": "squashed length", + "title": "N", + "type": "integer" + }, + "alpha": { + "default": false, + "title": "Alpha", + "type": "boolean" + }, + "name": { + "default": false, + "title": "Name", + "type": "boolean" + }, + "digit": { + "default": false, + "title": "Digit", + "type": "boolean" + }, + "idsh": { + "default": false, + "title": "Idsh", + "type": "boolean" + }, + "glyph": { + "default": false, + "title": "Glyph", + "type": "boolean" + }, + "gen": { + "default": false, + "title": "Gen", + "type": "boolean" + }, + "bearing": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "identity-bearing (identity.identity_bearing); None in bundles compiled before the flag, which count every token", + "title": "Bearing" + }, + "label": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Writer-owned generic UI-label role from the same raw/comparison token pair as bearing; unknown in older templates", + "title": "Label" + } + }, + "required": [ + "c", + "r", + "n" + ], + "title": "TokenTemplate", + "type": "object" + } + }, + "description": "A deterministic precondition on a step (RFC \u00a72.2, Phase 1 scope).\n\n``predicate`` is evaluated over the step's entry frame. When it does NOT\nhold, ``on_unmet`` decides: ``\"halt\"`` (the DEFAULT -- the safe direction\nfor an unmet precondition, per the RFC's refuse-rather-than-guess posture)\nstops the run naming the step; ``\"skip\"`` makes the step a no-op success\n(the expected-but-optional case, e.g. dismissing a survey modal only when it\nappeared -- a guarded branch WITHOUT the Phase-2 state machine). Full\nmulti-way branching is Phase 2.", + "properties": { + "predicate": { + "$ref": "#/$defs/Predicate" + }, + "on_unmet": { + "default": "halt", + "enum": [ + "halt", + "skip" + ], + "title": "On Unmet", + "type": "string" + } + }, + "required": [ + "predicate" + ], + "title": "Guard", + "type": "object" + }, + "serialization": { + "$defs": { + "Predicate": { + "additionalProperties": true, + "type": "object" + } + }, + "description": "A deterministic precondition on a step (RFC \u00a72.2, Phase 1 scope).\n\n``predicate`` is evaluated over the step's entry frame. When it does NOT\nhold, ``on_unmet`` decides: ``\"halt\"`` (the DEFAULT -- the safe direction\nfor an unmet precondition, per the RFC's refuse-rather-than-guess posture)\nstops the run naming the step; ``\"skip\"`` makes the step a no-op success\n(the expected-but-optional case, e.g. dismissing a survey modal only when it\nappeared -- a guarded branch WITHOUT the Phase-2 state machine). Full\nmulti-way branching is Phase 2.", + "properties": { + "predicate": { + "$ref": "#/$defs/Predicate" + }, + "on_unmet": { + "default": "halt", + "enum": [ + "halt", + "skip" + ], + "title": "On Unmet", + "type": "string" + } + }, + "required": [ + "predicate" + ], + "title": "Guard", + "type": "object" + } + }, + "GuardSource": { + "validation": { + "description": "Why a guard is in the program, when spoken narration suggested it.\n\nWritten by induction (``compiler.narration_rules``) for a guard that\nstarted as a narrated proposal and was then certified. The sentence is\nscrubbed narration. It explains the guard to a reviewer; the runtime never\nreads it.", + "properties": { + "sentence": { + "description": "The scrubbed sentence that suggested it", + "title": "Sentence", + "type": "string" + }, + "rule": { + "default": "", + "description": "The guard in plain words", + "title": "Rule", + "type": "string" + }, + "certified_by": { + "enum": [ + "recordings_agree", + "probe", + "person" + ], + "title": "Certified By", + "type": "string" + }, + "accepted_by": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Who accepted it, when a person certified it", + "title": "Accepted By" + }, + "recording": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Index of the recording the sentence came from", + "title": "Recording" + }, + "source": { + "default": "narration", + "enum": [ + "narration", + "narration+model" + ], + "title": "Source", + "type": "string" + } + }, + "required": [ + "sentence", + "certified_by" + ], + "title": "GuardSource", + "type": "object" + }, + "serialization": { + "description": "Why a guard is in the program, when spoken narration suggested it.\n\nWritten by induction (``compiler.narration_rules``) for a guard that\nstarted as a narrated proposal and was then certified. The sentence is\nscrubbed narration. It explains the guard to a reviewer; the runtime never\nreads it.", + "properties": { + "sentence": { + "description": "The scrubbed sentence that suggested it", + "title": "Sentence", + "type": "string" + }, + "rule": { + "default": "", + "description": "The guard in plain words", + "title": "Rule", + "type": "string" + }, + "certified_by": { + "enum": [ + "recordings_agree", + "probe", + "person" + ], + "title": "Certified By", + "type": "string" + }, + "accepted_by": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Who accepted it, when a person certified it", + "title": "Accepted By" + }, + "recording": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Index of the recording the sentence came from", + "title": "Recording" + }, + "source": { + "default": "narration", + "enum": [ + "narration", + "narration+model" + ], + "title": "Source", + "type": "string" + } + }, + "required": [ + "sentence", + "certified_by" + ], + "title": "GuardSource", + "type": "object" + } + }, + "HaltCleanup": { + "validation": { + "$defs": { + "ActionKind": { + "enum": [ + "click", + "double_click", + "right_click", + "drag", + "type", + "select_option", + "key", + "hotkey", + "wait", + "scroll", + "read", + "switch_surface" + ], + "title": "ActionKind", + "type": "string" + }, + "Anchor": { + "description": "Redundant evidence for locating a step's target on screen.\n\nResolution ladder consumes fields in order of preference (strongest, most\ndrift-tolerant first): ``structural`` (DOM / UIA element, when the backend\nsupports it) -> template (local, then global) -> ocr_text -> landmarks ->\ngrounder. ``structural`` is the deterministic top rung; the remaining\n(visual) rungs are the FALLBACK floor for pixel-only substrates.", + "properties": { + "template": { + "description": "Bundle-relative path to the PNG crop", + "title": "Template", + "type": "string" + }, + "structural": { + "anyOf": [ + { + "$ref": "#/$defs/StructuralLocator" + }, + { + "type": "null" + } + ], + "default": null, + "description": "STRUCTURAL locator (DOM selector / role+name, or UIA AutomationId / role+name) of the clicked target, captured at record time when the recording backend exposes it (openadapt_flow.backend.StructuralActionBackend). Drives the structural ACTION rung -- the TOP of the resolution ladder -- which re-finds the SAME element deterministically (no pixel match) and is far more drift-tolerant than the visual rungs (21/21 vs 6/21 on the desktop benchmark). None on pixel-only substrates or bundles compiled before this capability; the ladder then resolves via the visual rungs below." + }, + "region": { + "description": "Crop location in the recorded frame", + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "title": "Region", + "type": "array" + }, + "click_point": { + "description": "Click point in the recorded frame", + "maxItems": 2, + "minItems": 2, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "title": "Click Point", + "type": "array" + }, + "ocr_text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Text label at/near the target, if any", + "title": "Ocr Text" + }, + "context_text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Identity evidence: OCR text on the target's row (full-width band at the crop's height) EXCLUDING the target's own crop and timestamp-bearing lines. Verified before every click (see runtime.identity); None when the band had no usable text at compile time.", + "title": "Context Text" + }, + "structured_identity": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "STRUCTURED identity text (DOM / accessibility tree) of the clicked target's row, captured at record time when the recording backend exposes it (openadapt_flow.backend.IdentityBackend.structured_text_at). The REAL characters (a genuine digit 0 vs a letter O), so replay verifies identity by exact/normalized string compare with NO OCR ambiguity -- the structured-text tier of the identity ladder (see runtime.identity). None on pixel-only substrates or bundles recorded before this capability; the ladder then falls back to the OCR context_text tier.", + "title": "Structured Identity" + }, + "record_key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Stable record id of the target's row at record time (plaintext, compile-time only). The PHI-free pass hashes it into ``identity_template.record_key`` and clears this field.", + "title": "Record Key" + }, + "structured_row": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Whether ``structured_identity`` came from a record row (compile-time only; moved to ``identity_template.structured_row``).", + "title": "Structured Row" + }, + "structured_ambiguous": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Whether teach time saw another row read the same with no record id between them (compile-time only; moved to ``identity_template.teach_ambiguous``).", + "title": "Structured Ambiguous" + }, + "identity_template": { + "anyOf": [ + { + "$ref": "#/$defs/IdentityTemplate" + }, + { + "type": "null" + } + ], + "default": null, + "description": "PHI-FREE identity template (salted-hash + shape) of the recorded context band and structured identity. When present, the runtime verifies target identity from THIS (no plaintext name/DOB/MRN in the artifact \u2014 the PHI audit's REM-2) and ``context_text`` / ``structured_identity`` are None. Bundles compiled before this capability carry the plaintext fields instead and still replay unchanged (backward compatible). See openadapt_flow.runtime.identity_template." + }, + "identifier_crop": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Bundle-relative PNG crop of the target row's DISCRIMINATIVE IDENTIFIER cell (the MRN / name+DOB region), emitted by the COMPILER (templates/identifiers/.png -- under templates/ so it is sealed with the other image crops in an encrypted bundle) for identity-armed steps that captured no structured text (Citrix / RDP / remote-display pixel recordings), or for any step whose identifier region was explicitly marked at record time (--identifier). Feeds the pixel-compare and optional VLM tiers of the identity ladder (see runtime.identity): the rendered PIXELS retain the O/0 and l/1 distinction OCR collapses, so a crop-vs-crop compare catches the glyph-collapse wrong-patient where the DOM/a11y tree is unavailable. None on structured (browser/UIA) recordings unless marked (the structured tier owns identity there; no identity pixels at rest) and on bundles compiled before this capability -- Step.identifier_crop_missing_reason records WHY; the ladder then falls through to the OCR band tier.", + "title": "Identifier Crop" + }, + "identifier_region": { + "anyOf": [ + { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Location of `identifier_crop` in the recorded frame (x, y, w, h). Replay re-crops the SAME box at the resolved point (translated by the recorded region's offset from the recorded click point, exactly as the OCR band's exclude region is) so the pixel/VLM tiers compare like-for-like. Set iff `identifier_crop` is set.", + "title": "Identifier Region" + }, + "dialog_region": { + "anyOf": [ + { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Box of the active dialog (the topmost modal) that held the target in the recorded frame, when it sat in one. The context band was cut to it, so text of the page behind the dialog is not identity evidence. Replay cuts the live band to the live dialog's box, and fails the identity check closed when no dialog holds the resolved point. None outside a dialog and on bundles compiled before this capability.", + "title": "Dialog Region" + }, + "dialog_row": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "True reads the target's own row inside dialog_region. False permits the whole dialog when teach time positively found a standalone control with no usable row text; replay must confirm no record row again. None conservatively uses the target's row.", + "title": "Dialog Row" + }, + "form_identity": { + "anyOf": [ + { + "$ref": "#/$defs/FormIdentity" + }, + { + "type": "null" + } + ], + "default": null, + "description": "A labelled save on a create-new form: before the click, its form must hold exactly the fields this run typed, with the values typed. See FormIdentity. None everywhere else." + }, + "landmarks": { + "items": { + "$ref": "#/$defs/Landmark" + }, + "title": "Landmarks", + "type": "array" + }, + "search_pad": { + "default": 80, + "description": "Pixels of padding around `region` for the local search", + "title": "Search Pad", + "type": "integer" + } + }, + "required": [ + "template", + "region", + "click_point" + ], + "title": "Anchor", + "type": "object" + }, + "ApiAdmission": { + "additionalProperties": false, + "description": "A person's acceptance of a compiler-proposed API step.\n\nBound to the exact binding by :attr:`spec_digest`; a changed binding needs\na new admission. Only a person can admit (an agent, model or service name\nadmits nothing).", + "properties": { + "admitted_by": { + "minLength": 1, + "title": "Admitted By", + "type": "string" + }, + "admitted_at": { + "minLength": 1, + "title": "Admitted At", + "type": "string" + }, + "spec_digest": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Spec Digest", + "type": "string" + }, + "role": { + "const": "person", + "default": "person", + "title": "Role", + "type": "string" + } + }, + "required": [ + "admitted_by", + "admitted_at", + "spec_digest" + ], + "title": "ApiAdmission", + "type": "object" + }, + "ApiBinding": { + "description": "A declarative API/tool call that performs a step's write WITHOUT the GUI.\n\nThe TOP of the capability ladder (RFC ``docs/design/WORKFLOW_PROGRAM_IR.md``\nsection 4, the ``api`` implementation of a ``TransitionContract``): where the\ntarget app exposes a real API, driving its GUI to make the same write is the\nwrong tool. When a step carries an ``ApiBinding`` AND the run configures an\n:class:`~openadapt_flow.runtime.actuators.ApiActuator`, the runtime performs\nthe write by CALLING the API deterministically (``$0``, zero model calls),\nconfirms it with the same\n:class:`~openadapt_flow.runtime.effects.EffectVerifier` that gates a GUI\nwrite, and SKIPS the GUI resolution/act for that step. This is the\n``api`` leaf of the same contract the structural rung realizes as ``dom_uia``\nand the visual ladder realizes as ``vision_rdp`` -- one semantic effect,\nbackend-specific implementation.\n\nADDITIVE and back-compatible: the field is optional and defaults absent, so a\nbundle carrying no binding replays EXACTLY as today (GUI actuation). A binding\nalso defaults to GUI fallback when the API tier is unavailable before\ndelivery. A workflow can instead set ``on_unavailable=\"halt\"`` to declare an\nAPI-only action. That mode refuses before GUI resolution or input rather than\ninventing a second, unqualified actuation path.\n\nFields are REST/JSON-first but shaped so a FHIR / MCP / tool binding fits the\nsame model (``kind`` selects the substrate; a FHIR resource POST, an MCP tool\ninvocation, and a plain REST write all reduce to method + endpoint + body +\nthe expected effect). Placeholders ``{param}`` in the URL / query / body are\nsubstituted from the run's typed params (``Workflow.params`` overlaid by the\ncaller's values) at actuation time.", + "properties": { + "kind": { + "default": "rest", + "description": "Substrate: 'rest'/'fhir' HTTP, an 'mcp'/'tool' call, or 'web_form': a browser form save repeated through the live session", + "enum": [ + "rest", + "fhir", + "mcp", + "tool", + "web_form" + ], + "title": "Kind", + "type": "string" + }, + "on_unavailable": { + "default": "gui", + "description": "Pre-delivery API-unavailability policy. 'gui' preserves the back-compatible GUI fallback; 'halt' declares this step API-only and refuses without GUI input when no actuator is configured or the actuator proves that no request was sent.", + "enum": [ + "gui", + "halt" + ], + "title": "On Unavailable", + "type": "string" + }, + "method": { + "default": "POST", + "description": "HTTP verb (REST/FHIR) or logical operation name (mcp/tool)", + "title": "Method", + "type": "string" + }, + "url_template": { + "description": "Endpoint template; absolute (http...) or relative to the actuator's base_url. `{param}` placeholders are substituted from the run's typed params.", + "title": "Url Template", + "type": "string" + }, + "body_template": { + "additionalProperties": true, + "description": "JSON request body template; string leaves may carry `{param}` placeholders substituted from the run's params.", + "title": "Body Template", + "type": "object" + }, + "query": { + "additionalProperties": { + "type": "string" + }, + "description": "Query-string params; values may carry `{param}` too", + "title": "Query", + "type": "object" + }, + "headers": { + "additionalProperties": { + "type": "string" + }, + "description": "Extra request headers; values may carry `{param}`", + "title": "Headers", + "type": "object" + }, + "expected_status": { + "description": "Explicit acceptable HTTP status codes; empty means any 2xx is success (anything else is treated as an attempted write of unknown effect and HALTs -- never GUI-retried).", + "items": { + "type": "integer" + }, + "title": "Expected Status", + "type": "array" + }, + "timeout_s": { + "default": 5.0, + "description": "Per-request timeout in seconds", + "title": "Timeout S", + "type": "number" + }, + "effects": { + "description": "The system-of-record effect(s) this call is expected to produce. Used to CONFIRM the API write via the run's EffectVerifier when the step itself declares no `effects` (an API write must be confirmable, exactly as a GUI write with declared effects is).", + "items": { + "$ref": "#/$defs/Effect" + }, + "title": "Effects", + "type": "array" + }, + "identity": { + "description": "Exact run-parameter bindings that prove qualified record identity for API actuation. Each binding must occur in both the request template and an effect selector before the request may be sent.", + "items": { + "$ref": "#/$defs/ApiIdentityBinding" + }, + "title": "Identity", + "type": "array" + }, + "web_form": { + "anyOf": [ + { + "$ref": "#/$defs/WebFormSpec" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The recorded form save, for kind='web_form' only" + }, + "admission": { + "anyOf": [ + { + "$ref": "#/$defs/ApiAdmission" + }, + { + "type": "null" + } + ], + "default": null, + "description": "A person's acceptance of a compiler-proposed binding. A web_form binding never runs without one." + } + }, + "required": [ + "url_template" + ], + "title": "ApiBinding", + "type": "object" + }, + "ApiIdentityBinding": { + "additionalProperties": false, + "description": "Exact API request/effect binding for one qualified identity signal.\n\n``param`` must be referenced by the outgoing request template and by\n``effect_field`` through ``ValueExpr(param=...)``. Runtime validates both\nsides before any request is sent, so an API optimization cannot bypass the\nqualified identity contract that guards the equivalent GUI action.", + "properties": { + "key": { + "enum": [ + "subject_name", + "record_id", + "secondary_identifier", + "application", + "session", + "workflow_state" + ], + "title": "Key", + "type": "string" + }, + "param": { + "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,127}$", + "title": "Param", + "type": "string" + }, + "effect_field": { + "pattern": "^[A-Za-z_][A-Za-z0-9_.-]{0,127}$", + "title": "Effect Field", + "type": "string" + }, + "request_pointers": { + "description": "Explicit target-bearing JSON pointers in the request template. Supported roots are /url/, /body/..., and /query/...; the terminal pointer segment must name the bound effect field, and headers are never accepted as target identity.", + "items": { + "type": "string" + }, + "maxItems": 8, + "minItems": 1, + "title": "Request Pointers", + "type": "array" + } + }, + "required": [ + "key", + "param", + "effect_field", + "request_pointers" + ], + "title": "ApiIdentityBinding", + "type": "object" + }, + "ChoiceOptionShape": { + "additionalProperties": false, + "description": "What the demonstrated option looked like among its siblings.\n\nReplay finds the option list by shape, never by position: elements with\n``role`` (``option`` or ``treeitem``), or, for a list without ARIA, the\n``tag`` and every class in ``classes`` (the classes the chosen option\nshared with the other options in its list; none for a list of bare\nitems). Only elements that appeared after the control opened count.", + "properties": { + "role": { + "anyOf": [ + { + "enum": [ + "option", + "treeitem" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Role" + }, + "tag": { + "maxLength": 32, + "minLength": 1, + "pattern": "^[a-z][a-z0-9-]*$", + "title": "Tag", + "type": "string" + }, + "classes": { + "default": [], + "items": { + "type": "string" + }, + "maxItems": 8, + "title": "Classes", + "type": "array" + } + }, + "required": [ + "tag" + ], + "title": "ChoiceOptionShape", + "type": "object" + }, + "ConcatTemplate": { + "description": "Precomputed SPLIT-match key (consecutive recorded tokens the live OCR\nmay glue into one), since hashes cannot be concatenated at replay.", + "properties": { + "i": { + "title": "I", + "type": "integer" + }, + "size": { + "title": "Size", + "type": "integer" + }, + "c": { + "title": "C", + "type": "string" + }, + "r": { + "title": "R", + "type": "string" + }, + "digit": { + "title": "Digit", + "type": "boolean" + }, + "name": { + "title": "Name", + "type": "boolean" + }, + "n": { + "title": "N", + "type": "integer" + } + }, + "required": [ + "i", + "size", + "c", + "r", + "digit", + "name", + "n" + ], + "title": "ConcatTemplate", + "type": "object" + }, + "DialogResponse": { + "additionalProperties": false, + "description": "How a step answers the JavaScript dialog its action raises.\n\nA browser ``alert``/``confirm``/``prompt``/``beforeunload`` dialog is not a\nsurface: it is a screen state of the page that raised it, and it blocks\nthat page until it is answered. On the browser backend the step's action\narms a one-shot answer before delivering input; its recorded kind and\nmessage identify the dialog. Legacy contracts without a kind retain their\nmessage-only behavior. A dialog that does not show exactly ``message`` is\ndismissed, never accepted, and the step halts. On a screen-driven backend\n(desktop, RDP, Citrix) a dialog is just pixels and is recorded as the\nclicks that answer it, so this field is browser-only\n(docs/MULTI_SURFACE.md, \"Dialogs\").\n\nThe identity is either the exact ``message`` or ``message_pattern``, a\nfull-match regex. The compiler writes the pattern whenever the recorded\nmessage carried a demonstrated parameter value or digits (a record\nnumber, a date), so the bundle never seals that value.", + "properties": { + "response": { + "enum": [ + "accept", + "dismiss" + ], + "title": "Response", + "type": "string" + }, + "kind": { + "anyOf": [ + { + "enum": [ + "alert", + "confirm", + "prompt", + "beforeunload" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Kind" + }, + "message": { + "anyOf": [ + { + "maxLength": 2000, + "minLength": 1, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Message" + }, + "message_pattern": { + "anyOf": [ + { + "maxLength": 4000, + "minLength": 1, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Message Pattern" + } + }, + "required": [ + "response" + ], + "title": "DialogResponse", + "type": "object" + }, + "Effect": { + "description": "A typed system-of-record effect (RFC ``Effect``, concrete runtime form).\n\nAn ``Effect`` is a *contract*: what must be true of the system of record\nfor a step to have actually succeeded. It is deliberately substrate-neutral\n-- the SAME ``Effect`` is checked by the REST verifier, the FHIR verifier,\nor the filesystem verifier (see :class:`EffectVerifier`). The verifier maps\n:attr:`match` / :attr:`field` onto its substrate's query language.\n\nBinds to the RFC (``docs/design/WORKFLOW_PROGRAM_IR.md`` section 2.2): the\nRFC's ``Effect(kind=\"record_written\", probe=\"encounter exists for\npatient\")`` is realized here with a machine-checkable :attr:`match`\nselector and an :attr:`expected_count`; the RFC's\n``Effect(kind=\"field_equals\", field=\"note\", value=params.note)`` maps to\n:attr:`field` / :attr:`value`.", + "properties": { + "kind": { + "$ref": "#/$defs/EffectKind" + }, + "match": { + "additionalProperties": { + "$ref": "#/$defs/ValueExpr" + }, + "title": "Match", + "type": "object" + }, + "field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Field" + }, + "value": { + "anyOf": [ + { + "$ref": "#/$defs/ValueExpr" + }, + { + "type": "null" + } + ], + "default": null + }, + "expected_count": { + "default": 1, + "title": "Expected Count", + "type": "integer" + }, + "new_records": { + "items": { + "additionalProperties": { + "$ref": "#/$defs/ValueExpr" + }, + "type": "object" + }, + "title": "New Records", + "type": "array" + }, + "identity_field": { + "default": "id", + "title": "Identity Field", + "type": "string" + }, + "idempotency_key": { + "anyOf": [ + { + "$ref": "#/$defs/ValueExpr" + }, + { + "type": "null" + } + ], + "default": null + }, + "key_field": { + "default": "key", + "title": "Key Field", + "type": "string" + }, + "composite_key": { + "additionalProperties": { + "$ref": "#/$defs/ValueExpr" + }, + "title": "Composite Key", + "type": "object" + }, + "count_new_only": { + "default": false, + "title": "Count New Only", + "type": "boolean" + }, + "forbid_collateral_loss": { + "default": true, + "title": "Forbid Collateral Loss", + "type": "boolean" + }, + "forbid_collateral_change": { + "default": false, + "title": "Forbid Collateral Change", + "type": "boolean" + }, + "risk": { + "default": "reversible", + "title": "Risk", + "type": "string" + }, + "probe": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Probe" + }, + "timeout_s": { + "default": 5.0, + "title": "Timeout S", + "type": "number" + }, + "needs_operator_confirmation": { + "default": false, + "title": "Needs Operator Confirmation", + "type": "boolean" + }, + "readback": { + "anyOf": [ + { + "$ref": "#/$defs/ReadbackSpec" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "required": [ + "kind" + ], + "title": "Effect", + "type": "object" + }, + "EffectKind": { + "description": "System-of-record effect kinds (RFC section 2.2).\n\nThese are the NEW kinds the RFC adds beyond the vision-checkable\npostcondition kinds (``text_present`` / ``region_stable`` / ...): their\nprobe is a read against the system of record, not the frame.", + "enum": [ + "record_written", + "field_equals", + "exact_new_set" + ], + "title": "EffectKind", + "type": "string" + }, + "FieldSpec": { + "additionalProperties": false, + "description": "One field of a record: its name, kind and how strictly it is read.", + "properties": { + "name": { + "description": "Lower snake case, unique in the schema.", + "title": "Name", + "type": "string" + }, + "kind": { + "default": "text", + "enum": [ + "text", + "code", + "date", + "currency", + "integer", + "decimal", + "boolean", + "enum" + ], + "title": "Kind", + "type": "string" + }, + "description": { + "default": "", + "title": "Description", + "type": "string" + }, + "required": { + "default": true, + "title": "Required", + "type": "boolean" + }, + "choices": { + "default": [], + "description": "Allowed values; required when kind is enum.", + "items": { + "type": "string" + }, + "title": "Choices", + "type": "array" + }, + "date_order": { + "anyOf": [ + { + "enum": [ + "dmy", + "mdy" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "How to read 03/04/2026; unset means ambiguous.", + "title": "Date Order" + }, + "pattern": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Regular expression the normalized value matches.", + "title": "Pattern" + }, + "min_confidence": { + "anyOf": [ + { + "maximum": 1.0, + "minimum": 0.0, + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Below this the value goes to the review queue; unset means no confidence gate.", + "title": "Min Confidence" + }, + "proof": { + "anyOf": [ + { + "$ref": "#/$defs/ReadProof" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Overrides the schema's proof for this field." + } + }, + "required": [ + "name" + ], + "title": "FieldSpec", + "type": "object" + }, + "FormIdentity": { + "additionalProperties": false, + "description": "Record identity of a save on a create-new form: the form it submits is\nthe demonstrated form, holding exactly what this run typed.\n\nA form that creates a record shows no existing record next to its save\nbutton: the record is the one the run is entering. So the save's identity\nis the form itself, all of it. The recorder observes, right before the\ndemonstrated click on a labelled submit button, that the button submits\nthe one HTML form owning every field typed into since the last save (not\nin a table row or a single field's own widget), and fingerprints that\nform. Before the click at run time, the replayer requires:\n\n- the button is still that form's submit button, and the form owns\n exactly ``filled_fields`` fields this run typed into, each holding\n exactly what the run typed;\n- the form submits to the same origin and path (``action_sha256``) with\n the same ``method``, and would send the same set of control names and\n types (``controls_sha256``), hidden ones included;\n- every control the run did not type into (a hidden record or parent id,\n a select left on its default, a checked box) holds the demonstrated\n value: salted digests in ``value_digests``, under ``value_salt`` (the\n identity-template scheme). Hidden tokens are not compared (``exempt``):\n ones named like a token, and ones that changed while the demonstration\n was typed.\n\nAnything else halts before the click. A submit event from any other form\nor control during the click is cancelled and halts the run.\n\nCounts, tokens, names and digests only; no field text or value.", + "properties": { + "filled_fields": { + "maximum": 10000, + "minimum": 1, + "title": "Filled Fields", + "type": "integer" + }, + "submit_role": { + "const": "form_submit", + "title": "Submit Role", + "type": "string" + }, + "action_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Action Sha256", + "type": "string" + }, + "method": { + "enum": [ + "get", + "post", + "dialog" + ], + "title": "Method", + "type": "string" + }, + "controls_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Controls Sha256", + "type": "string" + }, + "value_salt": { + "default": "", + "maxLength": 128, + "title": "Value Salt", + "type": "string" + }, + "value_digests": { + "additionalProperties": { + "type": "string" + }, + "title": "Value Digests", + "type": "object" + }, + "exempt": { + "default": [], + "items": { + "type": "string" + }, + "title": "Exempt", + "type": "array" + } + }, + "required": [ + "filled_fields", + "submit_role", + "action_sha256", + "method", + "controls_sha256" + ], + "title": "FormIdentity", + "type": "object" + }, + "GradeGate": { + "additionalProperties": false, + "description": "The minimum read grade a write step accepts for the values it writes.", + "properties": { + "min_grade": { + "enum": [ + "unchecked", + "same_screen", + "reopened", + "system_of_record" + ], + "title": "Min Grade", + "type": "string" + }, + "fields": { + "default": [], + "description": "Fields the step writes; empty means every field.", + "items": { + "type": "string" + }, + "title": "Fields", + "type": "array" + } + }, + "required": [ + "min_grade" + ], + "title": "GradeGate", + "type": "object" + }, + "Guard": { + "description": "A deterministic precondition on a step (RFC \u00a72.2, Phase 1 scope).\n\n``predicate`` is evaluated over the step's entry frame. When it does NOT\nhold, ``on_unmet`` decides: ``\"halt\"`` (the DEFAULT -- the safe direction\nfor an unmet precondition, per the RFC's refuse-rather-than-guess posture)\nstops the run naming the step; ``\"skip\"`` makes the step a no-op success\n(the expected-but-optional case, e.g. dismissing a survey modal only when it\nappeared -- a guarded branch WITHOUT the Phase-2 state machine). Full\nmulti-way branching is Phase 2.", + "properties": { + "predicate": { + "$ref": "#/$defs/Predicate" + }, + "on_unmet": { + "default": "halt", + "enum": [ + "halt", + "skip" + ], + "title": "On Unmet", + "type": "string" + } + }, + "required": [ + "predicate" + ], + "title": "Guard", + "type": "object" + }, + "HaltCleanupQualification": { + "additionalProperties": false, + "description": "The test-copy evidence that a halt cleanup reaches the start screen.", + "properties": { + "test_copy": { + "minLength": 1, + "title": "Test Copy", + "type": "string" + }, + "halt_points": { + "minimum": 1, + "title": "Halt Points", + "type": "integer" + }, + "passed": { + "minimum": 0, + "title": "Passed", + "type": "integer" + }, + "qualified_at": { + "title": "Qualified At", + "type": "string" + }, + "cleanup_sha256": { + "pattern": "^[0-9a-f]{64}$", + "title": "Cleanup Sha256", + "type": "string" + } + }, + "required": [ + "test_copy", + "halt_points", + "passed", + "qualified_at", + "cleanup_sha256" + ], + "title": "HaltCleanupQualification", + "type": "object" + }, + "HoverEvidence": { + "additionalProperties": false, + "description": "What the recording saw when the pointer rested on a click target.\n\nSee :mod:`openadapt_flow.runtime.hover_evidence`. Captured for click steps\nwhose target carries no record identity (an icon-only control) on a\npixel surface. Replay moves the pointer onto the resolved target, waits\n``dwell_ms`` and compares its response with this one before clicking.", + "properties": { + "response": { + "description": "Whether anything near the target changed under the pointer", + "title": "Response", + "type": "boolean" + }, + "region": { + "anyOf": [ + { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The changed box, as an offset from the recorded click point (dx, dy, w, h). Set iff ``response``.", + "title": "Region" + }, + "crop": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Bundle-relative PNG of the response pixels (templates/hover/), sealed with the other image crops. Set iff ``response``.", + "title": "Crop" + }, + "dwell_ms": { + "default": 800, + "maximum": 5000, + "minimum": 0, + "title": "Dwell Ms", + "type": "integer" + } + }, + "required": [ + "response" + ], + "title": "HoverEvidence", + "type": "object" + }, + "IdentityTemplate": { + "description": "PHI-free stand-in for ``Anchor.context_text`` / ``structured_identity``.\n\nA salted-hash, shape-preserving template of the recorded identity band. It\nlets the runtime re-run the SAME wrong-patient identity check\n(:mod:`openadapt_flow.runtime.identity_template`) with no readable name /\nDOB / MRN in the artifact. NOT a cryptographic control (a salted hash of a\nlow-entropy identifier is brute-forceable by a holder of the bundle + salt);\nit removes *plaintext* PHI. The at-rest control is bundle encryption\n(docs/phi_at_rest.md, deferred). Set ``OPENADAPT_FLOW_IDENTITY_SALT`` at\ncompile+replay to keep the salt out of the bundle and make the hashes\none-way to anyone without the external secret.", + "properties": { + "schema_version": { + "default": 1, + "title": "Schema Version", + "type": "integer" + }, + "salt": { + "default": "", + "description": "per-bundle salt (hex); empty => env salt", + "title": "Salt", + "type": "string" + }, + "band_len": { + "default": 0, + "title": "Band Len", + "type": "integer" + }, + "tokens": { + "items": { + "$ref": "#/$defs/TokenTemplate" + }, + "title": "Tokens", + "type": "array" + }, + "concats": { + "items": { + "$ref": "#/$defs/ConcatTemplate" + }, + "title": "Concats", + "type": "array" + }, + "punctuation_policy": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Punctuation Policy" + }, + "punctuation_indices": { + "items": { + "type": "integer" + }, + "title": "Punctuation Indices", + "type": "array" + }, + "punctuation_body_keys": { + "additionalProperties": { + "type": "string" + }, + "title": "Punctuation Body Keys", + "type": "object" + }, + "standalone_punctuation_indices": { + "items": { + "type": "integer" + }, + "title": "Standalone Punctuation Indices", + "type": "array" + }, + "ocr_noise": { + "anyOf": [ + { + "$ref": "#/$defs/IdentityTemplate" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Writer-owned salted noise hashes, schema0. Classification-only: can supply glyph uncertainty but never identity authority. Unavailable on parameterized calls." + }, + "structured": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "salted hash of the structured identity string", + "title": "Structured" + }, + "structured_params": { + "description": "Workflow parameters embedded in the structured identity. Their demonstrated values are replaced by fixed sentinels before hashing; replay substitutes the run's value before exact compare.", + "items": { + "type": "string" + }, + "title": "Structured Params", + "type": "array" + }, + "signal_hashes": { + "additionalProperties": { + "type": "string" + }, + "description": "Salted hashes of strict exact/explicitly-normalized identity evidence, including operator-selected extracted fields. Keys are produced by identity_signals.", + "title": "Signal Hashes", + "type": "object" + }, + "context_params": { + "description": "Workflow parameters replaced by fixed sentinels before the captured-context signal hashes were computed.", + "items": { + "type": "string" + }, + "title": "Context Params", + "type": "array" + }, + "param_token_indices": { + "additionalProperties": { + "items": { + "type": "integer" + }, + "type": "array" + }, + "title": "Param Token Indices", + "type": "object" + }, + "rests_on_confusable_identifier": { + "default": false, + "title": "Rests On Confusable Identifier", + "type": "boolean" + }, + "record_key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Salted hash of the stable record id the target's row carried at teach time (app-owned DOM data-* ids, the row link's path). When set, replay acts only on the shown row with the same id.", + "title": "Record Key" + }, + "structured_row": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Whether the structured identity came from a record row at teach time. False lets a replay surface that cannot count look-alike rows still act on the target (a form field, a button); None (unknown) is treated as a row.", + "title": "Structured Row" + }, + "teach_ambiguous": { + "default": false, + "description": "Teach time saw another shown row with the same identity and no record id between them. Replay halts before a consequential write: a twin that later scrolls out of view would otherwise pass the text check.", + "title": "Teach Ambiguous", + "type": "boolean" + } + }, + "title": "IdentityTemplate", + "type": "object" + }, + "Landmark": { + "description": "A stable nearby text element, used by the geometry resolution rung.\n\n``relation`` describes where the LANDMARK sits relative to the target:\na landmark that is ``left_of`` the target implies the target is\n``distance_px`` to the landmark's right. ``dx_px``/``dy_px``, when set,\nare the exact pixel offsets from the landmark's center to the target\nclick point (target = landmark_center + (dx_px, dy_px)); the geometry\nrung prefers them over the coarser relation/distance estimate.", + "properties": { + "relation": { + "enum": [ + "left_of", + "right_of", + "above", + "below" + ], + "title": "Relation", + "type": "string" + }, + "ocr_text": { + "title": "Ocr Text", + "type": "string" + }, + "distance_px": { + "title": "Distance Px", + "type": "integer" + }, + "match_mode": { + "default": "fuzzy", + "description": "OCR comparison mode for this retained relation. Compiler-mined generic context remains fuzzy; a qualified opaque-field label uses exact normalized text so a near label cannot authorize input.", + "enum": [ + "fuzzy", + "exact" + ], + "title": "Match Mode", + "type": "string" + }, + "dx_px": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Exact x offset landmark center -> target click point", + "title": "Dx Px" + }, + "dy_px": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Exact y offset landmark center -> target click point", + "title": "Dy Px" + } + }, + "required": [ + "relation", + "ocr_text", + "distance_px" + ], + "title": "Landmark", + "type": "object" + }, + "NativeSelectContract": { + "additionalProperties": false, + "description": "Exact semantic selection, distinct from remote text-and-key input.", + "properties": { + "kind": { + "const": "html_single_select", + "default": "html_single_select", + "title": "Kind", + "type": "string" + }, + "value": { + "maxLength": 512, + "title": "Value", + "type": "string" + }, + "label": { + "maxLength": 512, + "minLength": 1, + "title": "Label", + "type": "string" + }, + "options": { + "items": { + "$ref": "#/$defs/NativeSelectOption" + }, + "maxItems": 2048, + "minItems": 1, + "title": "Options", + "type": "array" + } + }, + "required": [ + "value", + "label", + "options" + ], + "title": "NativeSelectContract", + "type": "object" + }, + "NativeSelectOption": { + "additionalProperties": false, + "description": "One option in a bounded, observed native HTML select census.", + "properties": { + "value": { + "maxLength": 512, + "title": "Value", + "type": "string" + }, + "label": { + "maxLength": 512, + "title": "Label", + "type": "string" + }, + "disabled": { + "title": "Disabled", + "type": "boolean" + } + }, + "required": [ + "value", + "label", + "disabled" + ], + "title": "NativeSelectOption", + "type": "object" + }, + "OptionChoice": { + "additionalProperties": false, + "description": "Choose one option of a dropdown by what it says, then read it back.\n\nOne model for every dropdown family (docs/CHOICES.md):\n\n- ``native_select``: an HTML ````. The option is set through the\n DOM and the control's selected option is read back.\n- ``listed_option``: anything that opens a list of options when the\n control is clicked (ARIA listboxes, ``
`` lists, searchable selects,\n type-aheads whose options load from the server). Replay clicks the\n control, types the wanted label when the demonstration typed a search\n (``query=\"label\"``), waits until the option list stops changing, and\n clicks the one option whose label (or ``value`` attribute) equals the\n wanted value. The control must then show that label (``readback``).\n\nThe wanted value is the step's parameter when it has one, else ``label``.\nNo option, more than one, or a disabled one halts the step before the\noption is clicked; a control that does not show the choice afterwards\nhalts it too. Position never decides which option is chosen.", + "properties": { + "kind": { + "enum": [ + "native_select", + "listed_option" + ], + "title": "Kind", + "type": "string" + }, + "label": { + "maxLength": 512, + "minLength": 1, + "title": "Label", + "type": "string" + }, + "value": { + "anyOf": [ + { + "maxLength": 512, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Value" + }, + "query": { + "default": "none", + "enum": [ + "none", + "label", + "words" + ], + "title": "Query", + "type": "string" + }, + "query_words": { + "anyOf": [ + { + "maxItems": 2, + "minItems": 2, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Query Words" + }, + "option": { + "anyOf": [ + { + "$ref": "#/$defs/ChoiceOptionShape" + }, + { + "type": "null" + } + ], + "default": null + }, + "readback": { + "enum": [ + "select", + "control_text", + "control_value" + ], + "title": "Readback", + "type": "string" + }, + "commit_field": { + "anyOf": [ + { + "maxLength": 512, + "minLength": 1, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Commit Field" + }, + "shows": { + "anyOf": [ + { + "maxLength": 512, + "minLength": 1, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Shows" + }, + "settle_s": { + "default": 8.0, + "exclusiveMinimum": 0, + "maximum": 30, + "title": "Settle S", + "type": "number" + } + }, + "required": [ + "kind", + "label", + "readback" + ], + "title": "OptionChoice", + "type": "object" + }, + "serialization": { + "$defs": { + "ChoiceOptionShape": { + "additionalProperties": false, + "description": "What the demonstrated option looked like among its siblings.\n\nReplay finds the option list by shape, never by position: elements with\n``role`` (``option`` or ``treeitem``), or, for a list without ARIA, the\n``tag`` and every class in ``classes`` (the classes the chosen option\nshared with the other options in its list; none for a list of bare\nitems). Only elements that appeared after the control opened count.", + "properties": { + "role": { + "anyOf": [ + { + "enum": [ + "option", + "treeitem" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Role" + }, + "tag": { + "maxLength": 32, + "minLength": 1, + "pattern": "^[a-z][a-z0-9-]*$", + "title": "Tag", + "type": "string" + }, + "classes": { + "default": [], + "items": { + "type": "string" + }, + "maxItems": 8, + "title": "Classes", + "type": "array" + } + }, + "required": [ + "tag" + ], + "title": "ChoiceOptionShape", + "type": "object" + } + }, + "additionalProperties": false, + "description": "Choose one option of a dropdown by what it says, then read it back.\n\nOne model for every dropdown family (docs/CHOICES.md):\n\n- ``native_select``: an HTML ````. The option is set through the\n DOM and the control's selected option is read back.\n- ``listed_option``: anything that opens a list of options when the\n control is clicked (ARIA listboxes, ``
`` lists, searchable selects,\n type-aheads whose options load from the server). Replay clicks the\n control, types the wanted label when the demonstration typed a search\n (``query=\"label\"``), waits until the option list stops changing, and\n clicks the one option whose label (or ``value`` attribute) equals the\n wanted value. The control must then show that label (``readback``).\n\nThe wanted value is the step's parameter when it has one, else ``label``.\nNo option, more than one, or a disabled one halts the step before the\noption is clicked; a control that does not show the choice afterwards\nhalts it too. Position never decides which option is chosen.", + "properties": { + "kind": { + "enum": [ + "native_select", + "listed_option" + ], + "title": "Kind", + "type": "string" + }, + "label": { + "maxLength": 512, + "minLength": 1, + "title": "Label", + "type": "string" + }, + "value": { + "anyOf": [ + { + "maxLength": 512, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Value" + }, + "query": { + "default": "none", + "enum": [ + "none", + "label", + "words" + ], + "title": "Query", + "type": "string" + }, + "query_words": { + "anyOf": [ + { + "maxItems": 2, + "minItems": 2, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Query Words" + }, + "option": { + "anyOf": [ + { + "$ref": "#/$defs/ChoiceOptionShape" + }, + { + "type": "null" + } + ], + "default": null + }, + "readback": { + "enum": [ + "select", + "control_text", + "control_value" + ], + "title": "Readback", + "type": "string" + }, + "commit_field": { + "anyOf": [ + { + "maxLength": 512, + "minLength": 1, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Commit Field" + }, + "shows": { + "anyOf": [ + { + "maxLength": 512, + "minLength": 1, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Shows" + }, + "settle_s": { + "default": 8.0, + "exclusiveMinimum": 0, + "maximum": 30, + "title": "Settle S", + "type": "number" + } + }, + "required": [ + "kind", + "label", + "readback" + ], + "title": "OptionChoice", + "type": "object" + }, + "Postcondition": { + "properties": { + "kind": { + "$ref": "#/$defs/PostconditionKind" + }, + "text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Text" + }, + "region": { + "anyOf": [ + { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Region" + }, + "phash": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Phash" + }, + "phash_tolerance": { + "default": 8, + "title": "Phash Tolerance", + "type": "integer" + }, + "timeout_s": { + "default": 5.0, + "title": "Timeout S", + "type": "number" + }, + "template": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Bundle-relative PNG crop of the expected REGION_STABLE content; lets the check tolerate small layout shifts (content found near, not exactly at, the recorded region)", + "title": "Template" + }, + "field_selector": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Field Selector" + }, + "param": { + "anyOf": [ + { + "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,127}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Param" + }, + "candidate_rows": { + "anyOf": [ + { + "maxLength": 256, + "minLength": 1, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Candidate Rows" + }, + "candidate_frame_path": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "maxItems": 8, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Candidate Frame Path" + }, + "focus_by": { + "anyOf": [ + { + "enum": [ + "testid", + "id", + "role_name" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Focus By" + }, + "focus_value": { + "anyOf": [ + { + "maxLength": 256, + "minLength": 1, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Focus Value" + }, + "focus_role": { + "anyOf": [ + { + "maxLength": 64, + "minLength": 1, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Focus Role" + }, + "focus_name": { + "anyOf": [ + { + "maxLength": 256, + "minLength": 1, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Focus Name" + }, + "focus_active_option": { + "default": false, + "title": "Focus Active Option", + "type": "boolean" + }, + "focus_frame_path": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "maxItems": 8, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Focus Frame Path" + }, + "candidate_params": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "maxItems": 8, + "minItems": 1, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Candidate Params" + }, + "candidate_source": { + "anyOf": [ + { + "enum": [ + "record", + "screen" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Candidate Source" + }, + "candidate_record_fields": { + "anyOf": [ + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Candidate Record Fields" + }, + "candidate_channel": { + "anyOf": [ + { + "enum": [ + "fhir", + "rest" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Candidate Channel" + }, + "exact": { + "default": false, + "title": "Exact", + "type": "boolean" + }, + "text_clock": { + "anyOf": [ + { + "maxLength": 256, + "minLength": 1, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Text Clock" + } + }, + "required": [ + "kind" + ], + "title": "Postcondition", + "type": "object" + }, + "PostconditionKind": { + "enum": [ + "text_present", + "text_absent", + "region_stable", + "url_changed", + "title_changed", + "new_tab_opened", + "local_edit", + "field_value", + "no_duplicate_candidate", + "focus_on" + ], + "title": "PostconditionKind", + "type": "string" + }, + "Predicate": { + "description": "A deterministic condition over observed state (RFC \u00a72.2 ``Predicate``).\n\nUsed two ways in Phase 1: as a ``Step.wait_until`` readiness predicate (the\nreplayer polls it, BOUNDED by ``timeout_s``, and HALTS on timeout -- never\nproceeds-anyway) and as the condition inside a ``Guard``. Model-free by\nconstruction (see ``runtime.replayer._predicate_holds``); an unknown kind\nfails safe (does not hold).", + "properties": { + "kind": { + "$ref": "#/$defs/PredicateKind" + }, + "anchor": { + "anyOf": [ + { + "$ref": "#/$defs/Anchor" + }, + { + "type": "null" + } + ], + "default": null + }, + "text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Text" + }, + "param": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Param" + }, + "value": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Value" + }, + "intent": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Human-readable label (also the resolution-ladder intent for an ANCHOR_RESOLVES predicate).", + "title": "Intent" + }, + "operands": { + "description": "Sub-predicates for AND / OR / NOT.", + "items": { + "$ref": "#/$defs/Predicate" + }, + "title": "Operands", + "type": "array" + }, + "timeout_s": { + "default": 5.0, + "description": "wait_until bound: how long the replayer polls this predicate before HALTing (fail-safe; never proceed-anyway).", + "title": "Timeout S", + "type": "number" + }, + "exact": { + "default": false, + "title": "Exact", + "type": "boolean" + } + }, + "required": [ + "kind" + ], + "title": "Predicate", + "type": "object" + }, + "PredicateKind": { + "description": "Deterministic, model-free predicate kinds (RFC \u00a72.2 ``Predicate``).\n\nA predicate is evaluated over the CURRENT observed frame / run parameters\nwith ZERO model calls -- it is the thing a linear IR cannot express. Phase 1\nships the concrete kinds needed to (a) subsume today's SCROLL closed loop\n(``anchor_resolves``), (b) turn the optional-modal case into a guarded\nbranch (``text_present``), and (c) branch on a parameter (``param_equals``),\nplus boolean composition. ``worklist_nonempty`` (loops) is Phase 2.", + "enum": [ + "anchor_resolves", + "text_present", + "text_absent", + "param_equals", + "and", + "or", + "not" + ], + "title": "PredicateKind", + "type": "string" + }, + "ReadProof": { + "additionalProperties": false, + "description": "Which proof to collect for a read. Everything is off by default.", + "properties": { + "double_read": { + "default": false, + "description": "Read through two channels and compare.", + "title": "Double Read", + "type": "boolean" + }, + "committed_readback": { + "default": false, + "description": "Close, reopen by identity fields and read again.", + "title": "Committed Readback", + "type": "boolean" + }, + "seal": { + "default": false, + "description": "Cover the value with a signed Seal.", + "title": "Seal", + "type": "boolean" + } + }, + "title": "ReadProof", + "type": "object" + }, + "ReadStepSpec": { + "additionalProperties": false, + "description": "What a READ step reads and how much proof it collects.\n\n``region`` is the field's value box on the recorded frame. When the step\nhas an ``anchor`` (usually the field's label), the runtime re-resolves it\non the live frame and moves ``region`` by the same offset, so the read\nfollows the field when the layout shifts. Without an anchor, ``region`` is\nused as recorded.\n\nProof is opt-in (:class:`~openadapt_flow.records.schema.ReadProof`): by\ndefault one channel is read (the clipboard when the runtime has one,\notherwise OCR), the value is ``unchecked`` and carries no Seal. OCR and\nthe clipboard are deterministic channels; a READ step makes no model\ncalls.", + "properties": { + "schema_name": { + "description": "The RecordSchema this field belongs to.", + "title": "Schema Name", + "type": "string" + }, + "field": { + "$ref": "#/$defs/FieldSpec" + }, + "region": { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "title": "Region", + "type": "array" + }, + "proof": { + "$ref": "#/$defs/ReadProof" + }, + "copy_keys": { + "description": "Keys pressed to copy the focused field for a clipboard read.", + "items": { + "type": "string" + }, + "maxItems": 4, + "title": "Copy Keys", + "type": "array" + }, + "on_review": { + "default": "halt", + "description": "What to do when the read needs review (channels disagree, an invalid value, a missing second channel). ``halt`` stops the run and asks a person; ``continue`` records the field for the review queue and goes on.", + "enum": [ + "halt", + "continue" + ], + "title": "On Review", + "type": "string" + } + }, + "required": [ + "schema_name", + "field", + "region" + ], + "title": "ReadStepSpec", + "type": "object" + }, + "ReadbackAdmission": { + "additionalProperties": false, + "description": "A person's acceptance of a read-back taught by demonstration.\n\nThe demonstration that taught the check cannot approve it. Until a person\nadmits it, the check can't confirm a save (the verifier rules\n``INDETERMINATE``). The admission is bound to the exact check by\n:attr:`spec_digest`; a changed check needs a new admission.", + "properties": { + "admitted_by": { + "minLength": 1, + "title": "Admitted By", + "type": "string" + }, + "admitted_at": { + "minLength": 1, + "title": "Admitted At", + "type": "string" + }, + "spec_digest": { + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Spec Digest", + "type": "string" + }, + "role": { + "const": "person", + "default": "person", + "title": "Role", + "type": "string" + } + }, + "required": [ + "admitted_by", + "admitted_at", + "spec_digest" + ], + "title": "ReadbackAdmission", + "type": "object" + }, + "ReadbackField": { + "additionalProperties": false, + "description": "One field a person marked on the saved record's screen.\n\nThe verifier reads :attr:`region` and requires :attr:`value` there.", + "properties": { + "name": { + "title": "Name", + "type": "string" + }, + "region": { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "title": "Region", + "type": "array" + }, + "value": { + "$ref": "#/$defs/ValueExpr" + }, + "locator": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Locator" + }, + "source": { + "default": "ocr", + "enum": [ + "ocr", + "structure" + ], + "title": "Source", + "type": "string" + }, + "value_kind": { + "default": "text", + "enum": [ + "text", + "code", + "date", + "currency", + "number" + ], + "title": "Value Kind", + "type": "string" + }, + "date_order": { + "anyOf": [ + { + "enum": [ + "mdy", + "dmy" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Date Order" + } + }, + "required": [ + "name", + "region", + "value" + ], + "title": "ReadbackField", + "type": "object" + }, + "ReadbackGuard": { + "additionalProperties": false, + "description": "What a read-back's replayed navigation must never do.\n\nThe navigation runs in the acting session, on any surface (a browser, a\ndesktop app, an RDP or Citrix window), where no network guard can stop a\nstray write. Before each click the verifier reads the text under the\npointer and refuses a control whose label is a commit word or one of the\nsave's own control labels; it refuses save and delete key chords. A\nrefusal makes the check INDETERMINATE (HALT), never a guessed CONFIRM.", + "properties": { + "commit_labels": { + "items": { + "type": "string" + }, + "title": "Commit Labels", + "type": "array" + } + }, + "title": "ReadbackGuard", + "type": "object" + }, + "ReadbackNav": { + "description": "One deterministic navigation action to RE-OPEN the written record by a\npath DIFFERENT from the write flow, before an on-screen read-back.\n\nAuto-derived from the demonstration (the steps the person took to view the\nsaved record again \u2014 e.g. clear the form, search the patient, open the\nencounter). Deliberately tiny and model-free: a re-navigation is replayed\nby coordinate/keyboard exactly as recorded; anything a backend cannot\nperform makes the read-back INDETERMINATE (HALT), never a guessed CONFIRM.", + "properties": { + "action": { + "title": "Action", + "type": "string" + }, + "point": { + "anyOf": [ + { + "maxItems": 2, + "minItems": 2, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Point" + }, + "text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Text" + }, + "key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Key" + }, + "param": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Param" + }, + "reference": { + "default": false, + "title": "Reference", + "type": "boolean" + } + }, + "required": [ + "action" + ], + "title": "ReadbackNav", + "type": "object" + }, + "ReadbackReference": { + "additionalProperties": false, + "description": "A reference number the application shows right after the save.\n\nLearned from the demonstration: text that appeared on the screen the save\nleft, was not typed, and looks like an identifier (a claim, order or\nencounter number). Read at run time from :attr:`region` with\n:attr:`pattern` (one capture group), it is evidence that the application\nissued a record (check level ``same_screen``) and, when a navigation\nstep types it (:attr:`ReadbackNav.reference`), the way to find the record\nagain. The captured value itself is never stored in a report.", + "properties": { + "region": { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "title": "Region", + "type": "array" + }, + "pattern": { + "maxLength": 512, + "minLength": 1, + "title": "Pattern", + "type": "string" + } + }, + "required": [ + "region", + "pattern" + ], + "title": "ReadbackReference", + "type": "object" + }, + "ReadbackReset": { + "additionalProperties": false, + "description": "The step of a demonstrated check that throws away client-side state.\n\nWithout one, the check could read a form buffer or a client-side page the\nsave left behind, and a save that never reached the record would pass.", + "properties": { + "kind": { + "enum": [ + "reload", + "new_search", + "reopen_window", + "fresh_session" + ], + "title": "Kind", + "type": "string" + }, + "at": { + "minimum": 0, + "title": "At", + "type": "integer" + }, + "evidence": { + "default": "detected", + "enum": [ + "detected", + "declared" + ], + "title": "Evidence", + "type": "string" + } + }, + "required": [ + "kind", + "at" + ], + "title": "ReadbackReset", + "type": "object" + }, + "ReadbackSpec": { + "description": "The on-screen read-back oracle mined from the demonstration.\n\nCarries WHERE to re-read the saved value (:attr:`region`) and, for the\nstronger DIFFERENT-PATH variant, the re-navigation that re-opens the record\n(:attr:`renavigation`) so the read is forced through a real fetch rather\nthan the form the write left on screen. Consumed by\n:class:`~openadapt_flow.runtime.effects.onscreen.OnScreenReadbackVerifier`;\nevery non-onscreen substrate ignores it.\n\nSAFETY \u2014 the ``different_path`` flag is the gate. A ``different_path=True``\nread-back re-opens the record by an independent path (defeating the\n\"the form still shows what I typed but nothing persisted\" phantom-save\nclass) and is safe enough to be the DEFAULT out-of-the-box oracle. A\n``different_path=False`` (SAME-SURFACE) read-back re-reads the very region\nthe write drove; it CANNOT see a phantom/optimistic save (the measured\nfalse-CONFIRM rate is > 0), so it is wired but NON-default \u2014 a\nhalt-inducing consistency signal an operator opts into with eyes open, not\na pass. See ``docs/LIMITS.md`` and ``benchmark/effect_readback/``.", + "properties": { + "region": { + "anyOf": [ + { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Region" + }, + "different_path": { + "default": false, + "title": "Different Path", + "type": "boolean" + }, + "renavigation": { + "items": { + "$ref": "#/$defs/ReadbackNav" + }, + "title": "Renavigation", + "type": "array" + }, + "fields": { + "items": { + "$ref": "#/$defs/ReadbackField" + }, + "title": "Fields", + "type": "array" + }, + "demonstrated": { + "default": false, + "title": "Demonstrated", + "type": "boolean" + }, + "demonstrated_by": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Demonstrated By" + }, + "reset": { + "anyOf": [ + { + "$ref": "#/$defs/ReadbackReset" + }, + { + "type": "null" + } + ], + "default": null + }, + "admission": { + "anyOf": [ + { + "$ref": "#/$defs/ReadbackAdmission" + }, + { + "type": "null" + } + ], + "default": null + }, + "guard": { + "anyOf": [ + { + "$ref": "#/$defs/ReadbackGuard" + }, + { + "type": "null" + } + ], + "default": null + }, + "reference": { + "anyOf": [ + { + "$ref": "#/$defs/ReadbackReference" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "ReadbackSpec", + "type": "object" + }, + "State": { + "description": "A node in the workflow-program graph (RFC \u00a72.2).\n\nIts ``kind`` selects the payload: ``action`` carries a hardened Phase-1\n:class:`Step`; ``branch`` picks an edge purely by guard;\n``business_decision`` binds one authorized finite human choice; ``loop``\niterates a worklist; ``subflow_call`` invokes a reusable subgraph;\n``terminal`` ends the (sub)graph. ``transitions`` are the outgoing edges\n(empty on a terminal, a single unconditional edge on a degenerate linear\nnode). ``on_exception`` routes a FAILED action to a local handler instead\nof aborting the whole run.", + "properties": { + "id": { + "title": "Id", + "type": "string" + }, + "kind": { + "$ref": "#/$defs/StateKind" + }, + "step": { + "anyOf": [ + { + "$ref": "#/$defs/Step" + }, + { + "type": "null" + } + ], + "default": null + }, + "decision": { + "anyOf": [ + { + "$ref": "#/$defs/BusinessDecisionSpec" + }, + { + "type": "null" + } + ], + "default": null + }, + "loop": { + "anyOf": [ + { + "$ref": "#/$defs/LoopSpec" + }, + { + "type": "null" + } + ], + "default": null + }, + "subflow": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Subflow" + }, + "transitions": { + "items": { + "$ref": "#/$defs/Transition" + }, + "title": "Transitions", + "type": "array" + }, + "on_exception": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "On Exception" + }, + "outcome": { + "anyOf": [ + { + "enum": [ + "success", + "halt", + "escalate" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Outcome" + }, + "reason": { + "default": "", + "title": "Reason", + "type": "string" + } + }, + "required": [ + "id", + "kind" + ], + "title": "State", + "type": "object" + }, + "StateKind": { + "description": "The kinds of node in a workflow-program graph (RFC \u00a72.2).", + "enum": [ + "action", + "branch", + "business_decision", + "loop", + "subflow_call", + "terminal" + ], + "title": "StateKind", + "type": "string" + }, + "Step": { + "properties": { + "id": { + "title": "Id", + "type": "string" + }, + "intent": { + "description": "Human-readable purpose of the step", + "title": "Intent", + "type": "string" + }, + "action": { + "$ref": "#/$defs/ActionKind" + }, + "anchor": { + "anyOf": [ + { + "$ref": "#/$defs/Anchor" + }, + { + "type": "null" + } + ], + "default": null + }, + "text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Text" + }, + "param": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Param" + }, + "secret": { + "default": false, + "description": "TYPE steps only: the parameter is a SECRET (e.g. a password). Its literal value is NEVER stored in the recording, the events log, or this bundle; at replay it is injected from the environment variable OPENADAPT_FLOW_SECRET_ (the param name upper-cased). ``text`` is always None for a secret step, and ``param`` names the required secret. A missing secret at replay is a clear, fail-fast error (see runtime.Replayer).", + "title": "Secret", + "type": "boolean" + }, + "field_label": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "TYPE/SELECT_OPTION steps only: the receiving field's best available label, captured PASSIVELY at record time (DOM