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.deployment.json b/packages/flow/tests/fixtures/schema_surface/openadapt_flow.deployment.json new file mode 100644 index 0000000000..a1878aeed8 --- /dev/null +++ b/packages/flow/tests/fixtures/schema_surface/openadapt_flow.deployment.json @@ -0,0 +1,10056 @@ +{ + "pydantic": "2.13.4", + "models": { + "ActuationConfig": { + "validation": { + "description": "The API/tool actuation tier (top of the capability ladder).\n\nWhen enabled, a step carrying an ``ir.ApiBinding`` has its write PERFORMED\nvia the API (deterministic, $0, no GUI) and confirmed by the effect\nverifier. Disabled (default) => every step actuates through the GUI ladder.", + "properties": { + "api": { + "default": false, + "title": "Api", + "type": "boolean" + }, + "base_url": { + "default": "", + "title": "Base Url", + "type": "string" + }, + "timeout_s": { + "default": 5.0, + "title": "Timeout S", + "type": "number" + } + }, + "title": "ActuationConfig", + "type": "object" + }, + "serialization": { + "description": "The API/tool actuation tier (top of the capability ladder).\n\nWhen enabled, a step carrying an ``ir.ApiBinding`` has its write PERFORMED\nvia the API (deterministic, $0, no GUI) and confirmed by the effect\nverifier. Disabled (default) => every step actuates through the GUI ladder.", + "properties": { + "api": { + "default": false, + "title": "Api", + "type": "boolean" + }, + "base_url": { + "default": "", + "title": "Base Url", + "type": "string" + }, + "timeout_s": { + "default": 5.0, + "title": "Timeout S", + "type": "number" + } + }, + "title": "ActuationConfig", + "type": "object" + } + }, + "ApproversSection": { + "validation": { + "additionalProperties": false, + "description": "Who may approve this deployment's saves (approval_mode/approver_roster).\n\n``root_public_key`` pins the root approver key (64 hex): a person's answer\ncounts only when its signer is on the signed roster this key vouches\nfor. ``key_dir``, when set, is the only key directory a run accepts.", + "properties": { + "root_public_key": { + "pattern": "^[0-9a-f]{64}$", + "title": "Root Public Key", + "type": "string" + }, + "key_dir": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Key Dir" + }, + "head": { + "anyOf": [ + { + "maxItems": 2, + "minItems": 2, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "string" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Head" + } + }, + "required": [ + "root_public_key" + ], + "title": "ApproversSection", + "type": "object" + }, + "serialization": { + "additionalProperties": false, + "description": "Who may approve this deployment's saves (approval_mode/approver_roster).\n\n``root_public_key`` pins the root approver key (64 hex): a person's answer\ncounts only when its signer is on the signed roster this key vouches\nfor. ``key_dir``, when set, is the only key directory a run accepts.", + "properties": { + "root_public_key": { + "pattern": "^[0-9a-f]{64}$", + "title": "Root Public Key", + "type": "string" + }, + "key_dir": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Key Dir" + }, + "head": { + "anyOf": [ + { + "maxItems": 2, + "minItems": 2, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "string" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Head" + } + }, + "required": [ + "root_public_key" + ], + "title": "ApproversSection", + "type": "object" + } + }, + "BackendConfig": { + "validation": { + "$defs": { + "RemoteFrameContract": { + "additionalProperties": false, + "description": "Reviewed exact-geometry exclusions for derived settle inputs only.", + "properties": { + "schema_version": { + "const": "openadapt.remote-frame-contract/v1", + "default": "openadapt.remote-frame-contract/v1", + "title": "Schema Version", + "type": "string" + }, + "frame_width": { + "exclusiveMinimum": 0, + "maximum": 32768, + "title": "Frame Width", + "type": "integer" + }, + "frame_height": { + "exclusiveMinimum": 0, + "maximum": 32768, + "title": "Frame Height", + "type": "integer" + }, + "volatile_regions": { + "items": { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + "maxItems": 32, + "minItems": 1, + "title": "Volatile Regions", + "type": "array" + }, + "protected_regions": { + "items": { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + "maxItems": 128, + "title": "Protected Regions", + "type": "array" + } + }, + "required": [ + "frame_width", + "frame_height", + "volatile_regions" + ], + "title": "RemoteFrameContract", + "type": "object" + } + }, + "description": "Where and how to drive the target application's GUI.\n\n``kind`` selects the concrete :class:`~openadapt_flow.backend.Backend` the\nCLI drives (built by :func:`openadapt_flow.backends.factory.build_backend`):\n\n- ``web`` (default) \u2014 the Playwright/Chromium browser backend. Reproduces\n the historical behavior exactly (``url`` / ``headed`` are browser fields);\n every other field here is ignored.\n- ``windows`` \u2014 the WAA (Windows Agent Arena) HTTP backend for native\n Windows desktops. Requires ``agent_url`` (the in-guest agent's base URL);\n ``agent_token`` authenticates a token-protected agent.\n- ``macos`` \u2014 a local native macOS application window. Requires\n ``macos_app``; ``macos_window_title`` should uniquely identify the target\n window when the application owns more than one.\n- ``linux`` \u2014 one exact local Linux application window through AT-SPI.\n Requires ``linux_app`` and ``linux_window_title``. Native accessibility\n actions are preferred; global pointer/keyboard fallback is opt-in.\n- ``rdp`` \u2014 a pixel-only network-RDP or local remote-display backend.\n ``rdp_host`` drives a network RDP session (FreeRDP/aardwolf);\n ``rdp_window`` instead drives a local remote-display client window.\n- ``citrix`` \u2014 the local Citrix Workspace/Viewer window preset over the\n remote-display backend. It defaults the owner selector for the host OS,\n accepts ``rdp_window`` / ``rdp_window_title`` overrides, and refuses an\n ``rdp_host`` rather than silently constructing the wrong RDP substrate.\n\nEvery non-``web`` field is optional and defaults to None, so an existing\n``web`` deployment (or an empty config) is byte-for-byte unchanged.", + "properties": { + "kind": { + "default": "web", + "title": "Kind", + "type": "string" + }, + "deployment_surface": { + "anyOf": [ + { + "enum": [ + "local", + "remote_in_session", + "remote_display", + "unknown" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Deployment Surface" + }, + "url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Url" + }, + "headed": { + "default": false, + "title": "Headed", + "type": "boolean" + }, + "browser_cdp_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Browser Cdp Endpoint" + }, + "browser_page_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Browser Page Url" + }, + "agent_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Agent Url" + }, + "agent_token": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Agent Token" + }, + "agent_tls_pin": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Agent Tls Pin" + }, + "macos_app": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Macos App" + }, + "macos_window_title": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Macos Window Title" + }, + "linux_app": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Linux App" + }, + "linux_window_title": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Linux Window Title" + }, + "linux_allow_physical_input": { + "default": false, + "title": "Linux Allow Physical Input", + "type": "boolean" + }, + "rdp_host": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Host" + }, + "rdp_username": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Username" + }, + "rdp_password": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Password" + }, + "rdp_domain": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Domain" + }, + "rdp_port": { + "default": 3389, + "title": "Rdp Port", + "type": "integer" + }, + "rdp_max_frame_age_s": { + "default": 10.0, + "exclusiveMinimum": 0, + "title": "Rdp Max Frame Age S", + "type": "number" + }, + "rdp_readiness_text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Readiness Text" + }, + "rdp_readiness_min_ratio": { + "default": 0.85, + "maximum": 1.0, + "minimum": 0.0, + "title": "Rdp Readiness Min Ratio", + "type": "number" + }, + "rdp_application_marker": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Application Marker" + }, + "rdp_application_version_marker": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Application Version Marker" + }, + "rdp_environment_marker": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Environment Marker" + }, + "rdp_session_marker": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Session Marker" + }, + "rdp_window": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Window" + }, + "rdp_window_title": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Window Title" + }, + "remote_frame_contract": { + "anyOf": [ + { + "$ref": "#/$defs/RemoteFrameContract" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "BackendConfig", + "type": "object" + }, + "serialization": { + "$defs": { + "RemoteFrameContract": { + "additionalProperties": false, + "description": "Reviewed exact-geometry exclusions for derived settle inputs only.", + "properties": { + "schema_version": { + "const": "openadapt.remote-frame-contract/v1", + "default": "openadapt.remote-frame-contract/v1", + "title": "Schema Version", + "type": "string" + }, + "frame_width": { + "exclusiveMinimum": 0, + "maximum": 32768, + "title": "Frame Width", + "type": "integer" + }, + "frame_height": { + "exclusiveMinimum": 0, + "maximum": 32768, + "title": "Frame Height", + "type": "integer" + }, + "volatile_regions": { + "items": { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + "maxItems": 32, + "minItems": 1, + "title": "Volatile Regions", + "type": "array" + }, + "protected_regions": { + "items": { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + "maxItems": 128, + "title": "Protected Regions", + "type": "array" + } + }, + "required": [ + "frame_width", + "frame_height", + "volatile_regions" + ], + "title": "RemoteFrameContract", + "type": "object" + } + }, + "description": "Where and how to drive the target application's GUI.\n\n``kind`` selects the concrete :class:`~openadapt_flow.backend.Backend` the\nCLI drives (built by :func:`openadapt_flow.backends.factory.build_backend`):\n\n- ``web`` (default) \u2014 the Playwright/Chromium browser backend. Reproduces\n the historical behavior exactly (``url`` / ``headed`` are browser fields);\n every other field here is ignored.\n- ``windows`` \u2014 the WAA (Windows Agent Arena) HTTP backend for native\n Windows desktops. Requires ``agent_url`` (the in-guest agent's base URL);\n ``agent_token`` authenticates a token-protected agent.\n- ``macos`` \u2014 a local native macOS application window. Requires\n ``macos_app``; ``macos_window_title`` should uniquely identify the target\n window when the application owns more than one.\n- ``linux`` \u2014 one exact local Linux application window through AT-SPI.\n Requires ``linux_app`` and ``linux_window_title``. Native accessibility\n actions are preferred; global pointer/keyboard fallback is opt-in.\n- ``rdp`` \u2014 a pixel-only network-RDP or local remote-display backend.\n ``rdp_host`` drives a network RDP session (FreeRDP/aardwolf);\n ``rdp_window`` instead drives a local remote-display client window.\n- ``citrix`` \u2014 the local Citrix Workspace/Viewer window preset over the\n remote-display backend. It defaults the owner selector for the host OS,\n accepts ``rdp_window`` / ``rdp_window_title`` overrides, and refuses an\n ``rdp_host`` rather than silently constructing the wrong RDP substrate.\n\nEvery non-``web`` field is optional and defaults to None, so an existing\n``web`` deployment (or an empty config) is byte-for-byte unchanged.", + "properties": { + "kind": { + "default": "web", + "title": "Kind", + "type": "string" + }, + "deployment_surface": { + "anyOf": [ + { + "enum": [ + "local", + "remote_in_session", + "remote_display", + "unknown" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Deployment Surface" + }, + "url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Url" + }, + "headed": { + "default": false, + "title": "Headed", + "type": "boolean" + }, + "browser_cdp_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Browser Cdp Endpoint" + }, + "browser_page_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Browser Page Url" + }, + "agent_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Agent Url" + }, + "agent_token": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Agent Token" + }, + "agent_tls_pin": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Agent Tls Pin" + }, + "macos_app": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Macos App" + }, + "macos_window_title": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Macos Window Title" + }, + "linux_app": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Linux App" + }, + "linux_window_title": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Linux Window Title" + }, + "linux_allow_physical_input": { + "default": false, + "title": "Linux Allow Physical Input", + "type": "boolean" + }, + "rdp_host": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Host" + }, + "rdp_username": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Username" + }, + "rdp_password": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Password" + }, + "rdp_domain": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Domain" + }, + "rdp_port": { + "default": 3389, + "title": "Rdp Port", + "type": "integer" + }, + "rdp_max_frame_age_s": { + "default": 10.0, + "exclusiveMinimum": 0, + "title": "Rdp Max Frame Age S", + "type": "number" + }, + "rdp_readiness_text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Readiness Text" + }, + "rdp_readiness_min_ratio": { + "default": 0.85, + "maximum": 1.0, + "minimum": 0.0, + "title": "Rdp Readiness Min Ratio", + "type": "number" + }, + "rdp_application_marker": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Application Marker" + }, + "rdp_application_version_marker": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Application Version Marker" + }, + "rdp_environment_marker": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Environment Marker" + }, + "rdp_session_marker": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Session Marker" + }, + "rdp_window": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Window" + }, + "rdp_window_title": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Window Title" + }, + "remote_frame_contract": { + "anyOf": [ + { + "$ref": "#/$defs/RemoteFrameContract" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "BackendConfig", + "type": "object" + } + }, + "DeploymentConfig": { + "validation": { + "$defs": { + "ActuationConfig": { + "description": "The API/tool actuation tier (top of the capability ladder).\n\nWhen enabled, a step carrying an ``ir.ApiBinding`` has its write PERFORMED\nvia the API (deterministic, $0, no GUI) and confirmed by the effect\nverifier. Disabled (default) => every step actuates through the GUI ladder.", + "properties": { + "api": { + "default": false, + "title": "Api", + "type": "boolean" + }, + "base_url": { + "default": "", + "title": "Base Url", + "type": "string" + }, + "timeout_s": { + "default": 5.0, + "title": "Timeout S", + "type": "number" + } + }, + "title": "ActuationConfig", + "type": "object" + }, + "AllowedTable": { + "additionalProperties": false, + "description": "One allow-listed table: the app writes it on its own.", + "properties": { + "table": { + "title": "Table", + "type": "string" + }, + "mode": { + "default": "append_only", + "enum": [ + "append_only", + "skip" + ], + "title": "Mode", + "type": "string" + }, + "reason": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Reason" + } + }, + "required": [ + "table" + ], + "title": "AllowedTable", + "type": "object" + }, + "ApproversSection": { + "additionalProperties": false, + "description": "Who may approve this deployment's saves (approval_mode/approver_roster).\n\n``root_public_key`` pins the root approver key (64 hex): a person's answer\ncounts only when its signer is on the signed roster this key vouches\nfor. ``key_dir``, when set, is the only key directory a run accepts.", + "properties": { + "root_public_key": { + "pattern": "^[0-9a-f]{64}$", + "title": "Root Public Key", + "type": "string" + }, + "key_dir": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Key Dir" + }, + "head": { + "anyOf": [ + { + "maxItems": 2, + "minItems": 2, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "string" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Head" + } + }, + "required": [ + "root_public_key" + ], + "title": "ApproversSection", + "type": "object" + }, + "AuthRef": { + "description": "A reference to an HTTP credential held OUTSIDE the config.\n\nExactly one auth style may be set:\n\n- ``bearer_env`` -- name of an env var holding a bearer token; resolves to\n ``Authorization: Bearer ``.\n- ``header`` + ``value_env`` -- an arbitrary auth header (e.g.\n ``X-API-Key``) whose VALUE comes from the named env var. Frappe-style\n ``Authorization: token :`` fits here too (put the whole\n value in the env var).\n- ``basic_env`` -- name of an env var holding ``user:password``; resolves\n to ``Authorization: Basic ``.\n\nNo field ever holds the secret itself -- only the env var NAME.", + "properties": { + "bearer_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Bearer Env" + }, + "header": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Header" + }, + "value_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Value Env" + }, + "basic_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Basic Env" + } + }, + "title": "AuthRef", + "type": "object" + }, + "BackendConfig": { + "description": "Where and how to drive the target application's GUI.\n\n``kind`` selects the concrete :class:`~openadapt_flow.backend.Backend` the\nCLI drives (built by :func:`openadapt_flow.backends.factory.build_backend`):\n\n- ``web`` (default) \u2014 the Playwright/Chromium browser backend. Reproduces\n the historical behavior exactly (``url`` / ``headed`` are browser fields);\n every other field here is ignored.\n- ``windows`` \u2014 the WAA (Windows Agent Arena) HTTP backend for native\n Windows desktops. Requires ``agent_url`` (the in-guest agent's base URL);\n ``agent_token`` authenticates a token-protected agent.\n- ``macos`` \u2014 a local native macOS application window. Requires\n ``macos_app``; ``macos_window_title`` should uniquely identify the target\n window when the application owns more than one.\n- ``linux`` \u2014 one exact local Linux application window through AT-SPI.\n Requires ``linux_app`` and ``linux_window_title``. Native accessibility\n actions are preferred; global pointer/keyboard fallback is opt-in.\n- ``rdp`` \u2014 a pixel-only network-RDP or local remote-display backend.\n ``rdp_host`` drives a network RDP session (FreeRDP/aardwolf);\n ``rdp_window`` instead drives a local remote-display client window.\n- ``citrix`` \u2014 the local Citrix Workspace/Viewer window preset over the\n remote-display backend. It defaults the owner selector for the host OS,\n accepts ``rdp_window`` / ``rdp_window_title`` overrides, and refuses an\n ``rdp_host`` rather than silently constructing the wrong RDP substrate.\n\nEvery non-``web`` field is optional and defaults to None, so an existing\n``web`` deployment (or an empty config) is byte-for-byte unchanged.", + "properties": { + "kind": { + "default": "web", + "title": "Kind", + "type": "string" + }, + "deployment_surface": { + "anyOf": [ + { + "enum": [ + "local", + "remote_in_session", + "remote_display", + "unknown" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Deployment Surface" + }, + "url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Url" + }, + "headed": { + "default": false, + "title": "Headed", + "type": "boolean" + }, + "browser_cdp_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Browser Cdp Endpoint" + }, + "browser_page_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Browser Page Url" + }, + "agent_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Agent Url" + }, + "agent_token": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Agent Token" + }, + "agent_tls_pin": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Agent Tls Pin" + }, + "macos_app": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Macos App" + }, + "macos_window_title": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Macos Window Title" + }, + "linux_app": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Linux App" + }, + "linux_window_title": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Linux Window Title" + }, + "linux_allow_physical_input": { + "default": false, + "title": "Linux Allow Physical Input", + "type": "boolean" + }, + "rdp_host": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Host" + }, + "rdp_username": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Username" + }, + "rdp_password": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Password" + }, + "rdp_domain": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Domain" + }, + "rdp_port": { + "default": 3389, + "title": "Rdp Port", + "type": "integer" + }, + "rdp_max_frame_age_s": { + "default": 10.0, + "exclusiveMinimum": 0, + "title": "Rdp Max Frame Age S", + "type": "number" + }, + "rdp_readiness_text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Readiness Text" + }, + "rdp_readiness_min_ratio": { + "default": 0.85, + "maximum": 1.0, + "minimum": 0.0, + "title": "Rdp Readiness Min Ratio", + "type": "number" + }, + "rdp_application_marker": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Application Marker" + }, + "rdp_application_version_marker": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Application Version Marker" + }, + "rdp_environment_marker": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Environment Marker" + }, + "rdp_session_marker": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Session Marker" + }, + "rdp_window": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Window" + }, + "rdp_window_title": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Window Title" + }, + "remote_frame_contract": { + "anyOf": [ + { + "$ref": "#/$defs/RemoteFrameContract" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "BackendConfig", + "type": "object" + }, + "ControlRef": { + "additionalProperties": false, + "description": "How to find one control in the read-back session.\n\nAccessibility path (UI Automation): ``automation_id``, or ``role`` with\n``name``. Pixel path (OCR): ``text`` is the control's own visible text or\nthe label next to it, and ``at`` says where the control (or the value to\nread) is relative to that text. ``region`` limits the OCR search to an\n``(x, y, width, height)`` area; a ``region`` alone names an area, such as\na results list.", + "properties": { + "automation_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Automation Id" + }, + "role": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Role" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Name" + }, + "text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Text" + }, + "at": { + "default": "self", + "enum": [ + "self", + "right", + "below" + ], + "title": "At", + "type": "string" + }, + "region": { + "anyOf": [ + { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Region" + }, + "shows": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Shows" + }, + "offset_px": { + "default": 24, + "maximum": 400, + "minimum": 0, + "title": "Offset Px", + "type": "integer" + }, + "min_ratio": { + "default": 0.85, + "maximum": 1.0, + "minimum": 0.5, + "title": "Min Ratio", + "type": "number" + } + }, + "title": "ControlRef", + "type": "object" + }, + "DeferredReportSpec": { + "additionalProperties": false, + "description": "Deployment config for ``effects.kind: deferred_report``.", + "properties": { + "report": { + "$ref": "#/$defs/ReportFormat" + }, + "key": { + "$ref": "#/$defs/ValueExpr" + }, + "deadline_hours": { + "exclusiveMinimum": 0, + "maximum": 2160, + "title": "Deadline Hours", + "type": "number" + }, + "ledger": { + "title": "Ledger", + "type": "string" + }, + "describe": { + "default": "the report", + "maxLength": 120, + "title": "Describe", + "type": "string" + } + }, + "required": [ + "report", + "key", + "deadline_hours", + "ledger" + ], + "title": "DeferredReportSpec", + "type": "object" + }, + "DesktopFieldReader": { + "additionalProperties": false, + "description": "How to read one field from the record view.", + "properties": { + "control": { + "$ref": "#/$defs/ControlRef" + }, + "date_format": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Date Format" + }, + "casefold": { + "default": false, + "title": "Casefold", + "type": "boolean" + } + }, + "required": [ + "control" + ], + "title": "DesktopFieldReader", + "type": "object" + }, + "DesktopIdentity": { + "additionalProperties": false, + "description": "The check that the record view shows the record that was searched for.", + "properties": { + "reader": { + "$ref": "#/$defs/ControlRef" + }, + "value": { + "$ref": "#/$defs/ValueExpr" + }, + "field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Field" + } + }, + "required": [ + "reader", + "value" + ], + "title": "DesktopIdentity", + "type": "object" + }, + "DesktopReadbackSpec": { + "additionalProperties": false, + "description": "Deployment config for ``effects.kind: desktop_readback``.", + "properties": { + "session": { + "additionalProperties": true, + "title": "Session", + "type": "object" + }, + "credentials": { + "anyOf": [ + { + "$ref": "#/$defs/SessionCredentials" + }, + { + "type": "null" + } + ], + "default": null + }, + "sign_in": { + "anyOf": [ + { + "$ref": "#/$defs/DesktopSignIn" + }, + { + "type": "null" + } + ], + "default": null + }, + "search": { + "$ref": "#/$defs/SearchStep" + }, + "open": { + "anyOf": [ + { + "$ref": "#/$defs/OpenStep" + }, + { + "type": "null" + } + ], + "default": null + }, + "ready": { + "$ref": "#/$defs/ControlRef" + }, + "not_found": { + "anyOf": [ + { + "$ref": "#/$defs/ControlRef" + }, + { + "type": "null" + } + ], + "default": null + }, + "identity": { + "$ref": "#/$defs/DesktopIdentity" + }, + "fields": { + "additionalProperties": { + "$ref": "#/$defs/DesktopFieldReader" + }, + "title": "Fields", + "type": "object" + }, + "truncation_markers": { + "items": { + "type": "string" + }, + "title": "Truncation Markers", + "type": "array" + }, + "min_ocr_confidence": { + "default": 0.8, + "maximum": 1.0, + "minimum": 0.0, + "title": "Min Ocr Confidence", + "type": "number" + }, + "navigation_timeout_s": { + "default": 15.0, + "exclusiveMinimum": 0, + "title": "Navigation Timeout S", + "type": "number" + }, + "settle_s": { + "default": 0.3, + "maximum": 10.0, + "minimum": 0.0, + "title": "Settle S", + "type": "number" + } + }, + "required": [ + "session", + "search", + "ready", + "identity", + "fields" + ], + "title": "DesktopReadbackSpec", + "type": "object" + }, + "DesktopRelaunch": { + "additionalProperties": false, + "description": "Start a new process of the application for the check.", + "properties": { + "command": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "minItems": 1, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Command" + }, + "handoff_grace_s": { + "default": 2.0, + "minimum": 0, + "title": "Handoff Grace S", + "type": "number" + } + }, + "title": "DesktopRelaunch", + "type": "object" + }, + "DesktopSignIn": { + "additionalProperties": false, + "description": "The application's own sign-in form in the read-back session.", + "properties": { + "username": { + "$ref": "#/$defs/ControlRef" + }, + "password": { + "$ref": "#/$defs/ControlRef" + }, + "submit": { + "$ref": "#/$defs/ControlRef" + }, + "signed_in": { + "$ref": "#/$defs/ControlRef" + } + }, + "required": [ + "username", + "password", + "submit", + "signed_in" + ], + "title": "DesktopSignIn", + "type": "object" + }, + "EffectsConfig": { + "description": "Which system of record to verify consequential writes against.\n\n``kind`` selects the concrete\n:class:`~openadapt_flow.runtime.effects.EffectVerifier`. ``none`` (default)\nwires no verifier \u2014 a bundle that declares NO effects then replays exactly\nas before, but a step that DOES declare effects HALTs (fail-safe: an\nunverifiable consequential write is never silently accepted).\n\nEffect-verifier kit conventions (``docs/EFFECT_KIT.md``):\n\n- **Secrets are references, never literals.** ``auth`` /\n ``access_token_env`` / ``sql_password_env`` name environment variables\n staged by the operator; a missing variable fails LOUD at construction.\n- **Run-parameter binding is explicit.** Every ``*_params`` /\n ``*_exprs`` mapping takes the same ``{param: name}`` / ``{literal: v}``\n :class:`~openadapt_flow.runtime.effects.ValueExpr` form bundles use (a\n bare string is a literal), and is resolved against the governed run\n parameters (``--params-file`` / ``--param``) when the verifier is\n BUILT \u2014 so one bundle + one deployment YAML ships with its verification\n bound to the record each run actually writes.", + "properties": { + "kind": { + "default": "none", + "title": "Kind", + "type": "string" + }, + "candidates": { + "items": { + "$ref": "#/$defs/EffectsConfig" + }, + "title": "Candidates", + "type": "array" + }, + "surfaces": { + "additionalProperties": { + "$ref": "#/$defs/EffectsConfig" + }, + "title": "Surfaces", + "type": "object" + }, + "records_drop_fields": { + "items": { + "type": "string" + }, + "title": "Records Drop Fields", + "type": "array" + }, + "readback_region": { + "anyOf": [ + { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Readback Region" + }, + "readback_min_ratio": { + "default": 0.9, + "title": "Readback Min Ratio", + "type": "number" + }, + "ui_readback": { + "anyOf": [ + { + "$ref": "#/$defs/UiReadbackSpec" + }, + { + "type": "null" + } + ], + "default": null + }, + "desktop_readback": { + "anyOf": [ + { + "$ref": "#/$defs/DesktopReadbackSpec" + }, + { + "type": "null" + } + ], + "default": null + }, + "deferred_report": { + "anyOf": [ + { + "$ref": "#/$defs/DeferredReportSpec" + }, + { + "type": "null" + } + ], + "default": null + }, + "fresh_session": { + "anyOf": [ + { + "$ref": "#/$defs/FreshSessionSpec" + }, + { + "type": "null" + } + ], + "default": null + }, + "base_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Base Url" + }, + "records_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Records Path" + }, + "records_key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": "records", + "title": "Records Key" + }, + "records_next_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Records Next Path" + }, + "records_next_absent_is_last": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Records Next Absent Is Last" + }, + "records_total_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Records Total Path" + }, + "records_complete": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Records Complete" + }, + "records_list_keys": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Records List Keys" + }, + "records_other_lists": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Records Other Lists" + }, + "records_snapshot_path": { + "anyOf": [ + { + "maxLength": 256, + "minLength": 1, + "pattern": "^[^.\\s]+(?:\\.[^.\\s]+)*$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Records Snapshot Path" + }, + "records_read_context": { + "anyOf": [ + { + "const": "revalidate", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Records Read Context" + }, + "records_consistency": { + "anyOf": [ + { + "const": "quiescent-two-pass", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Records Consistency" + }, + "auth": { + "anyOf": [ + { + "$ref": "#/$defs/AuthRef" + }, + { + "type": "null" + } + ], + "default": null + }, + "path_params": { + "additionalProperties": { + "$ref": "#/$defs/ValueExpr" + }, + "title": "Path Params", + "type": "object" + }, + "graphql_query": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Graphql Query" + }, + "graphql_variables": { + "additionalProperties": { + "$ref": "#/$defs/ValueExpr" + }, + "title": "Graphql Variables", + "type": "object" + }, + "graphql_records_path": { + "default": "data", + "title": "Graphql Records Path", + "type": "string" + }, + "graphql_freshness_field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Graphql Freshness Field" + }, + "graphql_freshness_window_s": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Graphql Freshness Window S" + }, + "mail_pattern": { + "default": "*.eml", + "title": "Mail Pattern", + "type": "string" + }, + "document_format": { + "default": "json", + "title": "Document Format", + "type": "string" + }, + "document_field_paths": { + "additionalProperties": { + "type": "string" + }, + "title": "Document Field Paths", + "type": "object" + }, + "document_text_pattern": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Document Text Pattern" + }, + "evidence_redact_fields": { + "items": { + "type": "string" + }, + "title": "Evidence Redact Fields", + "type": "array" + }, + "evidence_keep_fields": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Evidence Keep Fields" + }, + "resource_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Resource Type" + }, + "search_params": { + "additionalProperties": { + "type": "string" + }, + "title": "Search Params", + "type": "object" + }, + "field_paths": { + "anyOf": [ + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Field Paths" + }, + "access_token": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Access Token" + }, + "access_token_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Access Token Env" + }, + "smart_backend": { + "anyOf": [ + { + "$ref": "#/$defs/SmartBackendConfig" + }, + { + "type": "null" + } + ], + "default": null + }, + "verify_tls": { + "default": true, + "title": "Verify Tls", + "type": "boolean" + }, + "search_param_exprs": { + "additionalProperties": { + "$ref": "#/$defs/ValueExpr" + }, + "title": "Search Param Exprs", + "type": "object" + }, + "sql_query": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Sql Query" + }, + "sql_query_params": { + "additionalProperties": { + "$ref": "#/$defs/ValueExpr" + }, + "title": "Sql Query Params", + "type": "object" + }, + "sqlite_database": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Sqlite Database" + }, + "sql_driver": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Sql Driver" + }, + "sql_dialect": { + "anyOf": [ + { + "enum": [ + "sqlite", + "mysql", + "postgresql" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Sql Dialect" + }, + "sql_connect_args": { + "additionalProperties": true, + "title": "Sql Connect Args", + "type": "object" + }, + "sql_password_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Sql Password Env" + }, + "file_pattern": { + "default": "*", + "title": "File Pattern", + "type": "string" + }, + "file_min_size": { + "default": 1, + "title": "File Min Size", + "type": "integer" + }, + "file_mtime_window_s": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "File Mtime Window S" + }, + "file_content_probe": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "File Content Probe" + }, + "root": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Root" + }, + "glob": { + "default": "*", + "title": "Glob", + "type": "string" + }, + "options": { + "additionalProperties": true, + "title": "Options", + "type": "object" + }, + "option_params": { + "additionalProperties": { + "$ref": "#/$defs/ValueExpr" + }, + "title": "Option Params", + "type": "object" + }, + "secret_env": { + "additionalProperties": { + "type": "string" + }, + "title": "Secret Env", + "type": "object" + }, + "timeout_s": { + "default": 5.0, + "title": "Timeout S", + "type": "number" + }, + "poll_interval_s": { + "default": 0.2, + "title": "Poll Interval S", + "type": "number" + } + }, + "title": "EffectsConfig", + "type": "object" + }, + "FieldReader": { + "additionalProperties": false, + "description": "How to read one value from the record page.\n\n``selector`` is a CSS selector relative to the row (or to the page, for\nthe identity check). An empty selector reads the row element itself.\n``attribute`` reads that attribute instead of the rendered text, which is\nhow a page that shortens long text can still expose the full value (for\nexample a ``title`` attribute).", + "properties": { + "selector": { + "default": "", + "title": "Selector", + "type": "string" + }, + "attribute": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Attribute" + }, + "date_format": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Date Format" + }, + "casefold": { + "default": false, + "title": "Casefold", + "type": "boolean" + } + }, + "title": "FieldReader", + "type": "object" + }, + "FinalCheck": { + "additionalProperties": false, + "description": "Make the first read provisional and settle it with a later read.", + "properties": { + "ledger": { + "title": "Ledger", + "type": "string" + }, + "after_s": { + "default": 0.0, + "maximum": 7776000, + "minimum": 0.0, + "title": "After S", + "type": "number" + }, + "deadline_hours": { + "exclusiveMinimum": 0, + "maximum": 2160, + "title": "Deadline Hours", + "type": "number" + }, + "status_field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Status Field" + }, + "final_values": { + "items": { + "type": "string" + }, + "title": "Final Values", + "type": "array" + }, + "pending_values": { + "items": { + "type": "string" + }, + "title": "Pending Values", + "type": "array" + }, + "rejected_values": { + "items": { + "type": "string" + }, + "title": "Rejected Values", + "type": "array" + }, + "describe": { + "default": "the final read-back", + "maxLength": 120, + "title": "Describe", + "type": "string" + }, + "alert_hours": { + "anyOf": [ + { + "exclusiveMinimum": 0, + "maximum": 2160, + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Alert Hours" + } + }, + "required": [ + "ledger", + "deadline_hours" + ], + "title": "FinalCheck", + "type": "object" + }, + "FrameAttribution": { + "additionalProperties": false, + "description": "Where the judge learns who changed a record.\n\n``audit_read``: a second read-only read (``read``, the same shape as an\n``effects:`` verifier section) returns the app's audit log or change\nfeed. Entries present after the save and not before are the window's\nentries. ``record_field`` names the entry field that refers to a record\n(compared with :attr:`FrameSpec.identity_field`), ``actor_field`` the\nuser or session.\n\n``record_field`` attribution: each record carries its last modifier in\n``actor_field`` and, optionally, a version or ETag in ``version_field``.\nA changed record whose version did not move is unattributed.", + "properties": { + "kind": { + "enum": [ + "audit_read", + "record_field" + ], + "title": "Kind", + "type": "string" + }, + "actor_field": { + "minLength": 1, + "title": "Actor Field", + "type": "string" + }, + "self": { + "items": { + "$ref": "#/$defs/ValueExpr" + }, + "minItems": 1, + "title": "Self", + "type": "array" + }, + "record_field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Record Field" + }, + "read": { + "anyOf": [ + { + "additionalProperties": true, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Read" + }, + "record_key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Record Key" + }, + "record_keys": { + "additionalProperties": { + "type": "string" + }, + "title": "Record Keys", + "type": "object" + }, + "event_field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Event Field" + }, + "write_events": { + "items": { + "type": "string" + }, + "title": "Write Events", + "type": "array" + }, + "insert_events": { + "items": { + "type": "string" + }, + "title": "Insert Events", + "type": "array" + }, + "delete_events": { + "items": { + "type": "string" + }, + "title": "Delete Events", + "type": "array" + }, + "table_field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Table Field" + }, + "owners": { + "additionalProperties": { + "$ref": "#/$defs/Owner" + }, + "title": "Owners", + "type": "object" + }, + "version_field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Version Field" + }, + "server_set": { + "items": { + "type": "string" + }, + "title": "Server Set", + "type": "array" + } + }, + "required": [ + "kind", + "actor_field", + "self" + ], + "title": "FrameAttribution", + "type": "object" + }, + "FrameDatabase": { + "additionalProperties": false, + "description": "``frame.database``: diff the whole database, not only what is read.\n\nEvery table and column is snapshotted before and after the save\n(``db_snapshot.py``), and each table is judged as one more slice: a row\nadded, removed or changed is collateral unless a declared effect, a\ndeclared side record or an attributed concurrent writer explains it. A\nnew declared or side row that sets a column the effects don't name, and\nthat ``new_row_fields`` doesn't list, is collateral too.\n\n``allow_tables`` replaces a read-list with a reviewed allow-list: the\ntables the app writes on its own for any signed-in user (logs, sessions,\nid registries). They are append-only unless an entry says ``skip`` with a\nreason. Everything else is compared. The receipt counts tables compared,\nappend-only and skipped, and binds the list's digest.", + "properties": { + "dialect": { + "enum": [ + "sqlite", + "mysql", + "postgresql" + ], + "title": "Dialect", + "type": "string" + }, + "read": { + "additionalProperties": true, + "title": "Read", + "type": "object" + }, + "allow_tables": { + "items": { + "$ref": "#/$defs/AllowedTable" + }, + "title": "Allow Tables", + "type": "array" + }, + "views": { + "additionalProperties": { + "type": "string" + }, + "title": "Views", + "type": "object" + }, + "judged_by": { + "additionalProperties": { + "type": "string" + }, + "title": "Judged By", + "type": "object" + }, + "new_row_fields": { + "additionalProperties": { + "items": { + "type": "string" + }, + "type": "array" + }, + "title": "New Row Fields", + "type": "object" + }, + "ignore_columns": { + "additionalProperties": { + "items": { + "type": "string" + }, + "type": "array" + }, + "title": "Ignore Columns", + "type": "object" + }, + "max_rows": { + "default": 2000, + "minimum": 1, + "title": "Max Rows", + "type": "integer" + }, + "read_row_budget": { + "default": 1000000, + "minimum": 1, + "title": "Read Row Budget", + "type": "integer" + }, + "schemas": { + "items": { + "type": "string" + }, + "title": "Schemas", + "type": "array" + }, + "profile": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Profile" + }, + "profile_sha256": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Profile Sha256" + }, + "settle_s": { + "default": 1.0, + "minimum": 0, + "title": "Settle S", + "type": "number" + }, + "settle_attempts": { + "default": 1, + "maximum": 60, + "minimum": 1, + "title": "Settle Attempts", + "type": "integer" + }, + "recheck_after_s": { + "anyOf": [ + { + "exclusiveMinimum": 0, + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Recheck After S" + } + }, + "required": [ + "dialect", + "read" + ], + "title": "FrameDatabase", + "type": "object" + }, + "FreshSessionSpec": { + "additionalProperties": false, + "description": "``effects.fresh_session`` in ``deployment.yaml``.", + "properties": { + "surface": { + "enum": [ + "desktop", + "rdp" + ], + "title": "Surface", + "type": "string" + }, + "desktop": { + "anyOf": [ + { + "$ref": "#/$defs/DesktopRelaunch" + }, + { + "type": "null" + } + ], + "default": null + }, + "rdp": { + "anyOf": [ + { + "$ref": "#/$defs/RdpSession" + }, + { + "type": "null" + } + ], + "default": null + }, + "start": { + "items": { + "$ref": "#/$defs/ReadbackNav" + }, + "title": "Start", + "type": "array" + }, + "ready_text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Ready Text" + }, + "ready_timeout_s": { + "default": 30.0, + "exclusiveMinimum": 0, + "title": "Ready Timeout S", + "type": "number" + } + }, + "required": [ + "surface" + ], + "title": "FreshSessionSpec", + "type": "object" + }, + "GroundingModelConfig": { + "description": "Operator-selected (\"bring your own\") model-grounding endpoint.\n\nThe last rung of the resolution ladder is a Grounder that PROPOSES a click\npoint when the deterministic rungs abstain. This section lets a deployment\npoint that fallback rung at a model of its choice instead of the built-in\nAnthropic default: a self-hosted vLLM/Ollama, an OpenRouter/Azure/Bedrock\nproxy, or the Anthropic API directly.\n\nTwo hard invariants:\n\n* **Configuring a model NEVER enables egress by itself.** This section only\n names WHICH model would be used; whether ANYTHING leaves the box is still\n governed entirely by ``allow_model_grounding`` (default False => fully\n local). An enabled model with egress off stays dormant.\n* **The API key is a reference, never a literal.** ``api_key_env`` names the\n environment variable holding the key; the key itself is never stored in\n the config or in the repository.\n\nFail-safe: the constructed grounder only ever proposes a point; the identity\nband and risk gate still dispose before any click, and any endpoint error\nyields no proposal (the ladder halts).", + "properties": { + "enabled": { + "default": false, + "title": "Enabled", + "type": "boolean" + }, + "provider": { + "default": "anthropic", + "enum": [ + "anthropic", + "openai_compatible" + ], + "title": "Provider", + "type": "string" + }, + "base_url": { + "default": "", + "title": "Base Url", + "type": "string" + }, + "model": { + "default": "", + "title": "Model", + "type": "string" + }, + "api_key_env": { + "default": "", + "title": "Api Key Env", + "type": "string" + } + }, + "title": "GroundingModelConfig", + "type": "object" + }, + "HistoryEntryReader": { + "additionalProperties": false, + "description": "CSS selectors, relative to one history row, for its columns.", + "properties": { + "record": { + "minLength": 1, + "title": "Record", + "type": "string" + }, + "what": { + "minLength": 1, + "title": "What", + "type": "string" + }, + "user": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "User" + }, + "attribute": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Attribute" + } + }, + "required": [ + "record", + "what" + ], + "title": "HistoryEntryReader", + "type": "object" + }, + "HistoryView": { + "additionalProperties": false, + "description": "The application's history, audit or activity screen (optional).", + "properties": { + "url": { + "title": "Url", + "type": "string" + }, + "ready_selector": { + "title": "Ready Selector", + "type": "string" + }, + "row_selector": { + "title": "Row Selector", + "type": "string" + }, + "entry": { + "$ref": "#/$defs/HistoryEntryReader" + }, + "record": { + "anyOf": [ + { + "$ref": "#/$defs/ValueExpr" + }, + { + "type": "null" + } + ], + "default": null + }, + "explained": { + "items": { + "type": "string" + }, + "maxItems": 64, + "minItems": 1, + "title": "Explained", + "type": "array" + }, + "expect_entry": { + "default": true, + "title": "Expect Entry", + "type": "boolean" + }, + "acting_user_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Acting User Env" + }, + "ignored": { + "items": { + "type": "string" + }, + "maxItems": 64, + "title": "Ignored", + "type": "array" + }, + "unattributed_records": { + "items": { + "type": "string" + }, + "maxItems": 16, + "title": "Unattributed Records", + "type": "array" + }, + "submit_selector": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Submit Selector" + } + }, + "required": [ + "url", + "ready_selector", + "row_selector", + "entry", + "explained" + ], + "title": "HistoryView", + "type": "object" + }, + "HumanDecisionsConfig": { + "description": "Attended-decision delivery posture; local issuance is the default.", + "properties": { + "remote": { + "$ref": "#/$defs/RemoteHumanDecisionConfig" + } + }, + "title": "HumanDecisionsConfig", + "type": "object" + }, + "IdempotencySection": { + "description": "Idempotency key for a governed run. The value is an env reference.", + "properties": { + "key_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Key Env" + } + }, + "title": "IdempotencySection", + "type": "object" + }, + "IdentityCopyLookSection": { + "additionalProperties": false, + "description": "Select-and-copy look for a look-alike identifier on a pixel surface.\n\nTurn on only where selecting the recorded identifier cell and copying it\nchanges nothing (a read-only text cell) and the session's clipboard reaches\nthe machine Flow runs on (RDP/Citrix clipboard redirection). See\n:mod:`openadapt_flow.runtime.identity_looks`.", + "properties": { + "enabled": { + "default": false, + "title": "Enabled", + "type": "boolean" + }, + "gesture": { + "default": "drag", + "enum": [ + "drag", + "double_click" + ], + "title": "Gesture", + "type": "string" + }, + "copy_keys": { + "items": { + "type": "string" + }, + "minItems": 1, + "title": "Copy Keys", + "type": "array" + } + }, + "title": "IdentityCopyLookSection", + "type": "object" + }, + "IdentitySection": { + "description": "Live identity revalidation before actuation.\n\nRecord identifiers stay in customer-controlled env vars. This section\nnever stores a live identity value.", + "properties": { + "require_fresh_frame": { + "default": true, + "title": "Require Fresh Frame", + "type": "boolean" + }, + "record_id_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Record Id Env" + } + }, + "title": "IdentitySection", + "type": "object" + }, + "OpenStep": { + "additionalProperties": false, + "description": "Open the record from a results list: the one row showing the identity.", + "properties": { + "results": { + "$ref": "#/$defs/ControlRef" + }, + "double_click": { + "default": false, + "title": "Double Click", + "type": "boolean" + } + }, + "required": [ + "results" + ], + "title": "OpenStep", + "type": "object" + }, + "Owner": { + "additionalProperties": false, + "properties": { + "column": { + "title": "Column", + "type": "string" + }, + "by": { + "enum": [ + "username", + "user_id" + ], + "title": "By", + "type": "string" + }, + "default": { + "anyOf": [ + { + "$ref": "#/$defs/OwnerDefault" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "required": [ + "column", + "by" + ], + "title": "Owner", + "type": "object" + }, + "OwnerDefault": { + "additionalProperties": false, + "description": "The owner value of the app's global default rows, written beside a\nuser's own row (OpenEMR's ``user_settings`` row for ``setting_user = 0``,\nadded the first time anyone saves a label).", + "properties": { + "value": { + "minLength": 1, + "title": "Value", + "type": "string" + }, + "same": { + "items": { + "type": "string" + }, + "minItems": 1, + "title": "Same", + "type": "array" + } + }, + "required": [ + "value", + "same" + ], + "title": "OwnerDefault", + "type": "object" + }, + "PolicySection": { + "description": "The safety policy that certifies a bundle for this deployment.", + "properties": { + "policy": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Policy" + } + }, + "title": "PolicySection", + "type": "object" + }, + "ProbeCopySection": { + "additionalProperties": false, + "description": "Declares that this deployment drives a resettable test copy.\n\nOnly ``induce --probe-on`` reads it. Probing replays guessed\ninterpretations of a recording disagreement, some of which are wrong on\npurpose, so it runs only where the operator has said in writing that the\ntarget is a disposable copy. See docs/PROBE_INDUCTION.md.", + "properties": { + "declared": { + "default": false, + "title": "Declared", + "type": "boolean" + }, + "reset_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Reset Url" + }, + "reset_command": { + "items": { + "type": "string" + }, + "title": "Reset Command", + "type": "array" + }, + "reward_contract": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Reward Contract" + } + }, + "title": "ProbeCopySection", + "type": "object" + }, + "RdpSession": { + "additionalProperties": false, + "description": "A second RDP session, signed in as a separate account.", + "properties": { + "host": { + "minLength": 1, + "title": "Host", + "type": "string" + }, + "port": { + "default": 3389, + "maximum": 65535, + "minimum": 1, + "title": "Port", + "type": "integer" + }, + "domain": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Domain" + }, + "username_env": { + "minLength": 1, + "title": "Username Env", + "type": "string" + }, + "password_env": { + "minLength": 1, + "title": "Password Env", + "type": "string" + }, + "acting_username_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Acting Username Env" + }, + "width": { + "default": 1280, + "minimum": 320, + "title": "Width", + "type": "integer" + }, + "height": { + "default": 800, + "minimum": 240, + "title": "Height", + "type": "integer" + } + }, + "required": [ + "host", + "username_env", + "password_env" + ], + "title": "RdpSession", + "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" + }, + "RecordIdentity": { + "additionalProperties": false, + "description": "The check that the page shows the record the session asked for.", + "properties": { + "reader": { + "$ref": "#/$defs/FieldReader" + }, + "value": { + "anyOf": [ + { + "$ref": "#/$defs/ValueExpr" + }, + { + "type": "null" + } + ], + "default": null + }, + "field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Field" + } + }, + "required": [ + "reader" + ], + "title": "RecordIdentity", + "type": "object" + }, + "ReferenceCapture": { + "additionalProperties": false, + "description": "Read the saved record's identifier from the run's own session.\n\nSome applications only issue the identifier at the save: a claim number,\na submission reference, a confirmation number. Right after the save the\nverifier reads it once, here, and opens the record page by it in the\nseparate session. ``source`` is ``\"url\"`` (the page URL the run's session\nshows, from a backend that exposes ``url``) or ``\"screen\"`` (local OCR of\nthe run's current screenshot, optionally limited to ``region``).\n``pattern`` is a regular expression with exactly one capture group; it\nmust match exactly one distinct value, or the check is INDETERMINATE.", + "properties": { + "url_param": { + "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$", + "title": "Url Param", + "type": "string" + }, + "source": { + "default": "url", + "enum": [ + "url", + "screen" + ], + "title": "Source", + "type": "string" + }, + "pattern": { + "maxLength": 512, + "minLength": 1, + "title": "Pattern", + "type": "string" + }, + "region": { + "anyOf": [ + { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Region" + } + }, + "required": [ + "url_param", + "pattern" + ], + "title": "ReferenceCapture", + "type": "object" + }, + "RemoteFrameContract": { + "additionalProperties": false, + "description": "Reviewed exact-geometry exclusions for derived settle inputs only.", + "properties": { + "schema_version": { + "const": "openadapt.remote-frame-contract/v1", + "default": "openadapt.remote-frame-contract/v1", + "title": "Schema Version", + "type": "string" + }, + "frame_width": { + "exclusiveMinimum": 0, + "maximum": 32768, + "title": "Frame Width", + "type": "integer" + }, + "frame_height": { + "exclusiveMinimum": 0, + "maximum": 32768, + "title": "Frame Height", + "type": "integer" + }, + "volatile_regions": { + "items": { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + "maxItems": 32, + "minItems": 1, + "title": "Volatile Regions", + "type": "array" + }, + "protected_regions": { + "items": { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + "maxItems": 128, + "title": "Protected Regions", + "type": "array" + } + }, + "required": [ + "frame_width", + "frame_height", + "volatile_regions" + ], + "title": "RemoteFrameContract", + "type": "object" + }, + "RemoteHumanDecisionConfig": { + "description": "Explicit remote attended-decision issuance policy.\n\nThis section does not configure a network provider and does not grant\nexecution authority. It permits a customer-controlled runner to project\nthe current signed pause as a PHI-free AAL2 task for its configured control\nplane. The engine-owned pause capability and fresh live revalidation stay\nauthoritative when a decision returns.", + "properties": { + "enabled": { + "default": false, + "title": "Enabled", + "type": "boolean" + }, + "tenant_id": { + "anyOf": [ + { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{7,127}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tenant Id" + }, + "runner_id": { + "anyOf": [ + { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{7,127}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Runner Id" + }, + "context_tier": { + "default": "remote_closed_context", + "enum": [ + "remote_closed_context", + "remote_identifiers" + ], + "title": "Context Tier", + "type": "string" + }, + "peer_task_schemas": { + "items": { + "enum": [ + "openadapt.human-decision-task/v1", + "openadapt.human-decision-task/v2" + ], + "type": "string" + }, + "title": "Peer Task Schemas", + "type": "array" + } + }, + "title": "RemoteHumanDecisionConfig", + "type": "object" + }, + "RepairSection": { + "additionalProperties": false, + "description": "Automatic repair of stops that wrote nothing (docs/SELF_REPAIR.md).\n\nWhen ``agent`` is set, every ``run`` that halts before any effect hands\nthe stop to this repair agent, probes its fix up to the save, asks one\nperson (or applies a pre-approved standard change), and resumes. A stop\nafter a write is never repaired. ``auto: false`` or ``--no-auto-repair``\nturns it off. Omitted when serialized at its defaults.", + "properties": { + "agent": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Agent" + }, + "screen_access_by": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Screen Access By" + }, + "screen_share_mode": { + "default": "scrubbed_only", + "enum": [ + "scrubbed_only", + "allow_unscrubbed" + ], + "title": "Screen Share Mode", + "type": "string" + }, + "auto": { + "default": true, + "title": "Auto", + "type": "boolean" + }, + "store": { + "default": "repair-store", + "title": "Store", + "type": "string" + }, + "attempts": { + "default": 3, + "maximum": 10, + "minimum": 1, + "title": "Attempts", + "type": "integer" + }, + "fault_urls": { + "items": { + "type": "string" + }, + "title": "Fault Urls", + "type": "array" + }, + "approval_wait_s": { + "default": 900.0, + "minimum": 0.0, + "title": "Approval Wait S", + "type": "number" + }, + "model_provider": { + "anyOf": [ + { + "enum": [ + "anthropic", + "openai" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Model Provider" + }, + "model_key_file": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Model Key File" + }, + "requalify": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Requalify" + }, + "requalify_trials": { + "default": 1, + "maximum": 10, + "minimum": 1, + "title": "Requalify Trials", + "type": "integer" + }, + "session": { + "anyOf": [ + { + "$ref": "#/$defs/RepairSessionSpec" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "RepairSection", + "type": "object" + }, + "RepairSessionSpec": { + "additionalProperties": false, + "description": "How self-repair opens a fresh app session outside a browser.\n\nA probe, each fault probe and the resumed run each need the app freshly\nstarted; the halted session stays as it is. Each command is an argv run\non the machine Flow runs on, with no shell. It must keep running while the\napp is up and own (it, or a process of its group) the one window\n``backend:`` binds to; Flow checks that, and ends the group afterwards. A\nbackend whose window is not on this machine (Windows over its agent,\nFreeRDP) can't show that, so repair there is refused for now.", + "properties": { + "command": { + "items": { + "type": "string" + }, + "minItems": 1, + "title": "Command", + "type": "array" + }, + "fault_commands": { + "additionalProperties": { + "items": { + "type": "string" + }, + "type": "array" + }, + "title": "Fault Commands", + "type": "object" + }, + "close_command": { + "items": { + "type": "string" + }, + "title": "Close Command", + "type": "array" + }, + "ready_s": { + "default": 2.0, + "maximum": 120.0, + "minimum": 0.0, + "title": "Ready S", + "type": "number" + } + }, + "required": [ + "command" + ], + "title": "RepairSessionSpec", + "type": "object" + }, + "ReportFormat": { + "additionalProperties": false, + "description": "How to read one kind of report.", + "properties": { + "format": { + "enum": [ + "csv", + "x12-999", + "x12-277ca", + "text" + ], + "title": "Format", + "type": "string" + }, + "key_column": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Key Column" + }, + "status_column": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Status Column" + }, + "accept": { + "items": { + "type": "string" + }, + "title": "Accept", + "type": "array" + }, + "reject": { + "items": { + "type": "string" + }, + "title": "Reject", + "type": "array" + }, + "pattern": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Pattern" + } + }, + "required": [ + "format" + ], + "title": "ReportFormat", + "type": "object" + }, + "RollbackSection": { + "additionalProperties": false, + "description": "Compensating rollback after a stop (docs/ROLLBACK.md).\n\nOff unless ``enabled``. When on, the run reads the system of record before\nit starts; after a stop it runs the compensation a person approved for\neach change, latest first, and reads the store again. It is\n``ROLLED_BACK`` only when that read matches the first one.", + "properties": { + "enabled": { + "default": false, + "title": "Enabled", + "type": "boolean" + }, + "database": { + "anyOf": [ + { + "$ref": "#/$defs/FrameDatabase" + }, + { + "type": "null" + } + ], + "default": null + }, + "allow_delete": { + "default": false, + "title": "Allow Delete", + "type": "boolean" + }, + "profile": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Profile" + }, + "actor_names": { + "items": { + "type": "string" + }, + "title": "Actor Names", + "type": "array" + }, + "exclusive": { + "default": false, + "title": "Exclusive", + "type": "boolean" + }, + "attribution": { + "anyOf": [ + { + "$ref": "#/$defs/FrameAttribution" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "RollbackSection", + "type": "object" + }, + "RuntimeSection": { + "description": "Runtime posture: durability and model-egress opt-in.", + "properties": { + "profile": { + "anyOf": [ + { + "enum": [ + "demo", + "standard", + "regulated" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Profile" + }, + "approval_mode": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Approval Mode" + }, + "durable": { + "default": false, + "title": "Durable", + "type": "boolean" + }, + "require_settled": { + "default": false, + "title": "Require Settled", + "type": "boolean" + }, + "allow_model_grounding": { + "default": false, + "title": "Allow Model Grounding", + "type": "boolean" + }, + "local_grounding": { + "default": false, + "title": "Local Grounding", + "type": "boolean" + }, + "pixel_verify_enabled": { + "default": false, + "title": "Pixel Verify Enabled", + "type": "boolean" + }, + "known_ids_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Known Ids Path" + }, + "interruptions_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Interruptions Path" + }, + "known_ids_column": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Known Ids Column" + }, + "known_ids_confirmation_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Known Ids Confirmation Path" + }, + "known_ids_max_age_hours": { + "default": 24.0, + "exclusiveMinimum": 0, + "title": "Known Ids Max Age Hours", + "type": "number" + }, + "identity_copy_look": { + "$ref": "#/$defs/IdentityCopyLookSection" + }, + "layout_drift_check": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Layout Drift Check" + }, + "page_quiet_ms": { + "anyOf": [ + { + "maximum": 2000, + "minimum": 30, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Page Quiet Ms" + }, + "speed": { + "anyOf": [ + { + "enum": [ + "standard", + "fast" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Speed" + }, + "grounding_model": { + "$ref": "#/$defs/GroundingModelConfig" + }, + "phi_grounding_allowlist": { + "items": { + "type": "string" + }, + "title": "Phi Grounding Allowlist", + "type": "array" + }, + "phi_egress_attested": { + "default": false, + "title": "Phi Egress Attested", + "type": "boolean" + } + }, + "title": "RuntimeSection", + "type": "object" + }, + "SearchStep": { + "additionalProperties": false, + "description": "Find the record: type ``query`` into ``box`` and submit.", + "properties": { + "box": { + "$ref": "#/$defs/ControlRef" + }, + "query": { + "$ref": "#/$defs/ValueExpr" + }, + "submit": { + "anyOf": [ + { + "$ref": "#/$defs/ControlRef" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "required": [ + "box", + "query" + ], + "title": "SearchStep", + "type": "object" + }, + "SessionCredentials": { + "additionalProperties": false, + "description": "The read-back session's own credentials, as environment-variable names.\n\nFor a network RDP session they are the RDP logon. With ``sign_in`` they\nare typed into the application's sign-in form.", + "properties": { + "username_env": { + "title": "Username Env", + "type": "string" + }, + "password_env": { + "title": "Password Env", + "type": "string" + } + }, + "required": [ + "username_env", + "password_env" + ], + "title": "SessionCredentials", + "type": "object" + }, + "SignInSpec": { + "additionalProperties": false, + "description": "The read-back session's own sign-in. Credentials are env-var names.", + "properties": { + "url": { + "title": "Url", + "type": "string" + }, + "post_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Post Url" + }, + "username_selector": { + "title": "Username Selector", + "type": "string" + }, + "password_selector": { + "title": "Password Selector", + "type": "string" + }, + "submit_selector": { + "title": "Submit Selector", + "type": "string" + }, + "signed_in_selector": { + "title": "Signed In Selector", + "type": "string" + }, + "username_env": { + "title": "Username Env", + "type": "string" + }, + "password_env": { + "title": "Password Env", + "type": "string" + } + }, + "required": [ + "url", + "username_selector", + "password_selector", + "submit_selector", + "signed_in_selector", + "username_env", + "password_env" + ], + "title": "SignInSpec", + "type": "object" + }, + "SmartBackendConfig": { + "additionalProperties": false, + "description": "``effects.smart_backend`` in ``deployment.yaml`` or ``verify.yaml``.\n\nExactly one key source: ``private_key_file``, ``private_key_env`` or\n``jwks_file``. ``kid`` is required for a PEM key; for a JWKS it selects the\nkey and defaults to the only private key in the set.", + "properties": { + "client_id": { + "title": "Client Id", + "type": "string" + }, + "scope": { + "title": "Scope", + "type": "string" + }, + "token_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Token Url" + }, + "kid": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Kid" + }, + "alg": { + "anyOf": [ + { + "enum": [ + "RS384", + "ES384" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Alg" + }, + "private_key_file": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Private Key File" + }, + "private_key_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Private Key Env" + }, + "private_key_password_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Private Key Password Env" + }, + "jwks_file": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Jwks File" + }, + "jku": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Jku" + }, + "timeout_s": { + "default": 10.0, + "title": "Timeout S", + "type": "number" + }, + "verify_tls": { + "default": true, + "title": "Verify Tls", + "type": "boolean" + } + }, + "required": [ + "client_id", + "scope" + ], + "title": "SmartBackendConfig", + "type": "object" + }, + "UiReadbackSpec": { + "additionalProperties": false, + "description": "Deployment config for ``effects.kind: ui_readback``.", + "properties": { + "record_url": { + "title": "Record Url", + "type": "string" + }, + "url_params": { + "additionalProperties": { + "$ref": "#/$defs/ValueExpr" + }, + "title": "Url Params", + "type": "object" + }, + "sign_in": { + "$ref": "#/$defs/SignInSpec" + }, + "ready_selector": { + "title": "Ready Selector", + "type": "string" + }, + "not_found_selector": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Not Found Selector" + }, + "empty_selector": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Empty Selector" + }, + "row_selector": { + "title": "Row Selector", + "type": "string" + }, + "fields": { + "additionalProperties": { + "$ref": "#/$defs/FieldReader" + }, + "title": "Fields", + "type": "object" + }, + "identity": { + "$ref": "#/$defs/RecordIdentity" + }, + "reference": { + "anyOf": [ + { + "$ref": "#/$defs/ReferenceCapture" + }, + { + "type": "null" + } + ], + "default": null + }, + "read_post_paths": { + "items": { + "type": "string" + }, + "title": "Read Post Paths", + "type": "array" + }, + "truncation_markers": { + "items": { + "type": "string" + }, + "title": "Truncation Markers", + "type": "array" + }, + "navigation_timeout_s": { + "default": 15.0, + "title": "Navigation Timeout S", + "type": "number" + }, + "index_lag_s": { + "anyOf": [ + { + "maximum": 300.0, + "minimum": 0.0, + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Index Lag S" + }, + "browser": { + "default": "chromium", + "enum": [ + "chromium", + "firefox", + "webkit" + ], + "title": "Browser", + "type": "string" + }, + "headless": { + "default": true, + "title": "Headless", + "type": "boolean" + }, + "history": { + "anyOf": [ + { + "$ref": "#/$defs/HistoryView" + }, + { + "type": "null" + } + ], + "default": null + }, + "final": { + "anyOf": [ + { + "$ref": "#/$defs/FinalCheck" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "required": [ + "record_url", + "sign_in", + "ready_selector", + "row_selector", + "fields", + "identity" + ], + "title": "UiReadbackSpec", + "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" + }, + "WorklistAccount": { + "additionalProperties": false, + "description": "One signed-in session for a parallel worklist worker.\n\nHolds env var NAMES only, never a credential value.", + "properties": { + "name": { + "maxLength": 64, + "minLength": 1, + "title": "Name", + "type": "string" + }, + "params_env": { + "additionalProperties": { + "type": "string" + }, + "title": "Params Env", + "type": "object" + }, + "secrets_env": { + "additionalProperties": { + "type": "string" + }, + "title": "Secrets Env", + "type": "object" + }, + "browser_cdp_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Browser Cdp Endpoint" + }, + "rdp_username": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Username" + }, + "rdp_password_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Password Env" + } + }, + "required": [ + "name" + ], + "title": "WorklistAccount", + "type": "object" + }, + "WorklistSection": { + "additionalProperties": false, + "description": "Parallel worklist runs (``--workers N``, docs/THROUGHPUT.md).\n\nThe defaults run one item at a time, as before. ``--workers`` above\n``max_workers`` is refused, so the deployment states how many sessions\nthe app tolerates at once.", + "properties": { + "max_workers": { + "default": 1, + "maximum": 64, + "minimum": 1, + "title": "Max Workers", + "type": "integer" + }, + "items_independent": { + "default": false, + "title": "Items Independent", + "type": "boolean" + }, + "readback_window": { + "default": 0, + "maximum": 16, + "minimum": 0, + "title": "Readback Window", + "type": "integer" + }, + "on_halt": { + "default": "stop", + "enum": [ + "stop", + "skip_unwritten" + ], + "title": "On Halt", + "type": "string" + }, + "sign_in_bundle": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Sign In Bundle" + }, + "entry_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Entry Url" + }, + "entry_bundle": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Entry Bundle" + }, + "accounts": { + "items": { + "$ref": "#/$defs/WorklistAccount" + }, + "title": "Accounts", + "type": "array" + } + }, + "title": "WorklistSection", + "type": "object" + } + }, + "description": "The whole-deployment configuration (one ``deployment.yaml``).", + "properties": { + "name": { + "default": "deployment", + "title": "Name", + "type": "string" + }, + "bundle_digest": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Bundle Digest" + }, + "unresolved": { + "items": { + "type": "string" + }, + "title": "Unresolved", + "type": "array" + }, + "backend": { + "$ref": "#/$defs/BackendConfig" + }, + "actuation": { + "$ref": "#/$defs/ActuationConfig" + }, + "effects": { + "$ref": "#/$defs/EffectsConfig" + }, + "identity": { + "$ref": "#/$defs/IdentitySection" + }, + "idempotency": { + "$ref": "#/$defs/IdempotencySection" + }, + "runtime": { + "$ref": "#/$defs/RuntimeSection" + }, + "policy": { + "$ref": "#/$defs/PolicySection" + }, + "human_decisions": { + "$ref": "#/$defs/HumanDecisionsConfig" + }, + "surfaces": { + "additionalProperties": { + "$ref": "#/$defs/BackendConfig" + }, + "title": "Surfaces", + "type": "object" + }, + "worklist": { + "$ref": "#/$defs/WorklistSection" + }, + "test_copy": { + "anyOf": [ + { + "$ref": "#/$defs/ProbeCopySection" + }, + { + "type": "null" + } + ], + "default": null + }, + "rollback": { + "anyOf": [ + { + "$ref": "#/$defs/RollbackSection" + }, + { + "type": "null" + } + ], + "default": null + }, + "approvers": { + "anyOf": [ + { + "$ref": "#/$defs/ApproversSection" + }, + { + "type": "null" + } + ], + "default": null + }, + "repair": { + "$ref": "#/$defs/RepairSection" + } + }, + "title": "DeploymentConfig", + "type": "object" + }, + "serialization": { + "additionalProperties": true, + "type": "object" + } + }, + "EffectsConfig": { + "validation": { + "$defs": { + "AuthRef": { + "description": "A reference to an HTTP credential held OUTSIDE the config.\n\nExactly one auth style may be set:\n\n- ``bearer_env`` -- name of an env var holding a bearer token; resolves to\n ``Authorization: Bearer ``.\n- ``header`` + ``value_env`` -- an arbitrary auth header (e.g.\n ``X-API-Key``) whose VALUE comes from the named env var. Frappe-style\n ``Authorization: token :`` fits here too (put the whole\n value in the env var).\n- ``basic_env`` -- name of an env var holding ``user:password``; resolves\n to ``Authorization: Basic ``.\n\nNo field ever holds the secret itself -- only the env var NAME.", + "properties": { + "bearer_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Bearer Env" + }, + "header": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Header" + }, + "value_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Value Env" + }, + "basic_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Basic Env" + } + }, + "title": "AuthRef", + "type": "object" + }, + "ControlRef": { + "additionalProperties": false, + "description": "How to find one control in the read-back session.\n\nAccessibility path (UI Automation): ``automation_id``, or ``role`` with\n``name``. Pixel path (OCR): ``text`` is the control's own visible text or\nthe label next to it, and ``at`` says where the control (or the value to\nread) is relative to that text. ``region`` limits the OCR search to an\n``(x, y, width, height)`` area; a ``region`` alone names an area, such as\na results list.", + "properties": { + "automation_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Automation Id" + }, + "role": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Role" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Name" + }, + "text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Text" + }, + "at": { + "default": "self", + "enum": [ + "self", + "right", + "below" + ], + "title": "At", + "type": "string" + }, + "region": { + "anyOf": [ + { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Region" + }, + "shows": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Shows" + }, + "offset_px": { + "default": 24, + "maximum": 400, + "minimum": 0, + "title": "Offset Px", + "type": "integer" + }, + "min_ratio": { + "default": 0.85, + "maximum": 1.0, + "minimum": 0.5, + "title": "Min Ratio", + "type": "number" + } + }, + "title": "ControlRef", + "type": "object" + }, + "DeferredReportSpec": { + "additionalProperties": false, + "description": "Deployment config for ``effects.kind: deferred_report``.", + "properties": { + "report": { + "$ref": "#/$defs/ReportFormat" + }, + "key": { + "$ref": "#/$defs/ValueExpr" + }, + "deadline_hours": { + "exclusiveMinimum": 0, + "maximum": 2160, + "title": "Deadline Hours", + "type": "number" + }, + "ledger": { + "title": "Ledger", + "type": "string" + }, + "describe": { + "default": "the report", + "maxLength": 120, + "title": "Describe", + "type": "string" + } + }, + "required": [ + "report", + "key", + "deadline_hours", + "ledger" + ], + "title": "DeferredReportSpec", + "type": "object" + }, + "DesktopFieldReader": { + "additionalProperties": false, + "description": "How to read one field from the record view.", + "properties": { + "control": { + "$ref": "#/$defs/ControlRef" + }, + "date_format": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Date Format" + }, + "casefold": { + "default": false, + "title": "Casefold", + "type": "boolean" + } + }, + "required": [ + "control" + ], + "title": "DesktopFieldReader", + "type": "object" + }, + "DesktopIdentity": { + "additionalProperties": false, + "description": "The check that the record view shows the record that was searched for.", + "properties": { + "reader": { + "$ref": "#/$defs/ControlRef" + }, + "value": { + "$ref": "#/$defs/ValueExpr" + }, + "field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Field" + } + }, + "required": [ + "reader", + "value" + ], + "title": "DesktopIdentity", + "type": "object" + }, + "DesktopReadbackSpec": { + "additionalProperties": false, + "description": "Deployment config for ``effects.kind: desktop_readback``.", + "properties": { + "session": { + "additionalProperties": true, + "title": "Session", + "type": "object" + }, + "credentials": { + "anyOf": [ + { + "$ref": "#/$defs/SessionCredentials" + }, + { + "type": "null" + } + ], + "default": null + }, + "sign_in": { + "anyOf": [ + { + "$ref": "#/$defs/DesktopSignIn" + }, + { + "type": "null" + } + ], + "default": null + }, + "search": { + "$ref": "#/$defs/SearchStep" + }, + "open": { + "anyOf": [ + { + "$ref": "#/$defs/OpenStep" + }, + { + "type": "null" + } + ], + "default": null + }, + "ready": { + "$ref": "#/$defs/ControlRef" + }, + "not_found": { + "anyOf": [ + { + "$ref": "#/$defs/ControlRef" + }, + { + "type": "null" + } + ], + "default": null + }, + "identity": { + "$ref": "#/$defs/DesktopIdentity" + }, + "fields": { + "additionalProperties": { + "$ref": "#/$defs/DesktopFieldReader" + }, + "title": "Fields", + "type": "object" + }, + "truncation_markers": { + "items": { + "type": "string" + }, + "title": "Truncation Markers", + "type": "array" + }, + "min_ocr_confidence": { + "default": 0.8, + "maximum": 1.0, + "minimum": 0.0, + "title": "Min Ocr Confidence", + "type": "number" + }, + "navigation_timeout_s": { + "default": 15.0, + "exclusiveMinimum": 0, + "title": "Navigation Timeout S", + "type": "number" + }, + "settle_s": { + "default": 0.3, + "maximum": 10.0, + "minimum": 0.0, + "title": "Settle S", + "type": "number" + } + }, + "required": [ + "session", + "search", + "ready", + "identity", + "fields" + ], + "title": "DesktopReadbackSpec", + "type": "object" + }, + "DesktopRelaunch": { + "additionalProperties": false, + "description": "Start a new process of the application for the check.", + "properties": { + "command": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "minItems": 1, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Command" + }, + "handoff_grace_s": { + "default": 2.0, + "minimum": 0, + "title": "Handoff Grace S", + "type": "number" + } + }, + "title": "DesktopRelaunch", + "type": "object" + }, + "DesktopSignIn": { + "additionalProperties": false, + "description": "The application's own sign-in form in the read-back session.", + "properties": { + "username": { + "$ref": "#/$defs/ControlRef" + }, + "password": { + "$ref": "#/$defs/ControlRef" + }, + "submit": { + "$ref": "#/$defs/ControlRef" + }, + "signed_in": { + "$ref": "#/$defs/ControlRef" + } + }, + "required": [ + "username", + "password", + "submit", + "signed_in" + ], + "title": "DesktopSignIn", + "type": "object" + }, + "EffectsConfig": { + "description": "Which system of record to verify consequential writes against.\n\n``kind`` selects the concrete\n:class:`~openadapt_flow.runtime.effects.EffectVerifier`. ``none`` (default)\nwires no verifier \u2014 a bundle that declares NO effects then replays exactly\nas before, but a step that DOES declare effects HALTs (fail-safe: an\nunverifiable consequential write is never silently accepted).\n\nEffect-verifier kit conventions (``docs/EFFECT_KIT.md``):\n\n- **Secrets are references, never literals.** ``auth`` /\n ``access_token_env`` / ``sql_password_env`` name environment variables\n staged by the operator; a missing variable fails LOUD at construction.\n- **Run-parameter binding is explicit.** Every ``*_params`` /\n ``*_exprs`` mapping takes the same ``{param: name}`` / ``{literal: v}``\n :class:`~openadapt_flow.runtime.effects.ValueExpr` form bundles use (a\n bare string is a literal), and is resolved against the governed run\n parameters (``--params-file`` / ``--param``) when the verifier is\n BUILT \u2014 so one bundle + one deployment YAML ships with its verification\n bound to the record each run actually writes.", + "properties": { + "kind": { + "default": "none", + "title": "Kind", + "type": "string" + }, + "candidates": { + "items": { + "$ref": "#/$defs/EffectsConfig" + }, + "title": "Candidates", + "type": "array" + }, + "surfaces": { + "additionalProperties": { + "$ref": "#/$defs/EffectsConfig" + }, + "title": "Surfaces", + "type": "object" + }, + "records_drop_fields": { + "items": { + "type": "string" + }, + "title": "Records Drop Fields", + "type": "array" + }, + "readback_region": { + "anyOf": [ + { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Readback Region" + }, + "readback_min_ratio": { + "default": 0.9, + "title": "Readback Min Ratio", + "type": "number" + }, + "ui_readback": { + "anyOf": [ + { + "$ref": "#/$defs/UiReadbackSpec" + }, + { + "type": "null" + } + ], + "default": null + }, + "desktop_readback": { + "anyOf": [ + { + "$ref": "#/$defs/DesktopReadbackSpec" + }, + { + "type": "null" + } + ], + "default": null + }, + "deferred_report": { + "anyOf": [ + { + "$ref": "#/$defs/DeferredReportSpec" + }, + { + "type": "null" + } + ], + "default": null + }, + "fresh_session": { + "anyOf": [ + { + "$ref": "#/$defs/FreshSessionSpec" + }, + { + "type": "null" + } + ], + "default": null + }, + "base_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Base Url" + }, + "records_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Records Path" + }, + "records_key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": "records", + "title": "Records Key" + }, + "records_next_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Records Next Path" + }, + "records_next_absent_is_last": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Records Next Absent Is Last" + }, + "records_total_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Records Total Path" + }, + "records_complete": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Records Complete" + }, + "records_list_keys": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Records List Keys" + }, + "records_other_lists": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Records Other Lists" + }, + "records_snapshot_path": { + "anyOf": [ + { + "maxLength": 256, + "minLength": 1, + "pattern": "^[^.\\s]+(?:\\.[^.\\s]+)*$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Records Snapshot Path" + }, + "records_read_context": { + "anyOf": [ + { + "const": "revalidate", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Records Read Context" + }, + "records_consistency": { + "anyOf": [ + { + "const": "quiescent-two-pass", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Records Consistency" + }, + "auth": { + "anyOf": [ + { + "$ref": "#/$defs/AuthRef" + }, + { + "type": "null" + } + ], + "default": null + }, + "path_params": { + "additionalProperties": { + "$ref": "#/$defs/ValueExpr" + }, + "title": "Path Params", + "type": "object" + }, + "graphql_query": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Graphql Query" + }, + "graphql_variables": { + "additionalProperties": { + "$ref": "#/$defs/ValueExpr" + }, + "title": "Graphql Variables", + "type": "object" + }, + "graphql_records_path": { + "default": "data", + "title": "Graphql Records Path", + "type": "string" + }, + "graphql_freshness_field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Graphql Freshness Field" + }, + "graphql_freshness_window_s": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Graphql Freshness Window S" + }, + "mail_pattern": { + "default": "*.eml", + "title": "Mail Pattern", + "type": "string" + }, + "document_format": { + "default": "json", + "title": "Document Format", + "type": "string" + }, + "document_field_paths": { + "additionalProperties": { + "type": "string" + }, + "title": "Document Field Paths", + "type": "object" + }, + "document_text_pattern": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Document Text Pattern" + }, + "evidence_redact_fields": { + "items": { + "type": "string" + }, + "title": "Evidence Redact Fields", + "type": "array" + }, + "evidence_keep_fields": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Evidence Keep Fields" + }, + "resource_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Resource Type" + }, + "search_params": { + "additionalProperties": { + "type": "string" + }, + "title": "Search Params", + "type": "object" + }, + "field_paths": { + "anyOf": [ + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Field Paths" + }, + "access_token": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Access Token" + }, + "access_token_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Access Token Env" + }, + "smart_backend": { + "anyOf": [ + { + "$ref": "#/$defs/SmartBackendConfig" + }, + { + "type": "null" + } + ], + "default": null + }, + "verify_tls": { + "default": true, + "title": "Verify Tls", + "type": "boolean" + }, + "search_param_exprs": { + "additionalProperties": { + "$ref": "#/$defs/ValueExpr" + }, + "title": "Search Param Exprs", + "type": "object" + }, + "sql_query": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Sql Query" + }, + "sql_query_params": { + "additionalProperties": { + "$ref": "#/$defs/ValueExpr" + }, + "title": "Sql Query Params", + "type": "object" + }, + "sqlite_database": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Sqlite Database" + }, + "sql_driver": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Sql Driver" + }, + "sql_dialect": { + "anyOf": [ + { + "enum": [ + "sqlite", + "mysql", + "postgresql" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Sql Dialect" + }, + "sql_connect_args": { + "additionalProperties": true, + "title": "Sql Connect Args", + "type": "object" + }, + "sql_password_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Sql Password Env" + }, + "file_pattern": { + "default": "*", + "title": "File Pattern", + "type": "string" + }, + "file_min_size": { + "default": 1, + "title": "File Min Size", + "type": "integer" + }, + "file_mtime_window_s": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "File Mtime Window S" + }, + "file_content_probe": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "File Content Probe" + }, + "root": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Root" + }, + "glob": { + "default": "*", + "title": "Glob", + "type": "string" + }, + "options": { + "additionalProperties": true, + "title": "Options", + "type": "object" + }, + "option_params": { + "additionalProperties": { + "$ref": "#/$defs/ValueExpr" + }, + "title": "Option Params", + "type": "object" + }, + "secret_env": { + "additionalProperties": { + "type": "string" + }, + "title": "Secret Env", + "type": "object" + }, + "timeout_s": { + "default": 5.0, + "title": "Timeout S", + "type": "number" + }, + "poll_interval_s": { + "default": 0.2, + "title": "Poll Interval S", + "type": "number" + } + }, + "title": "EffectsConfig", + "type": "object" + }, + "FieldReader": { + "additionalProperties": false, + "description": "How to read one value from the record page.\n\n``selector`` is a CSS selector relative to the row (or to the page, for\nthe identity check). An empty selector reads the row element itself.\n``attribute`` reads that attribute instead of the rendered text, which is\nhow a page that shortens long text can still expose the full value (for\nexample a ``title`` attribute).", + "properties": { + "selector": { + "default": "", + "title": "Selector", + "type": "string" + }, + "attribute": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Attribute" + }, + "date_format": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Date Format" + }, + "casefold": { + "default": false, + "title": "Casefold", + "type": "boolean" + } + }, + "title": "FieldReader", + "type": "object" + }, + "FinalCheck": { + "additionalProperties": false, + "description": "Make the first read provisional and settle it with a later read.", + "properties": { + "ledger": { + "title": "Ledger", + "type": "string" + }, + "after_s": { + "default": 0.0, + "maximum": 7776000, + "minimum": 0.0, + "title": "After S", + "type": "number" + }, + "deadline_hours": { + "exclusiveMinimum": 0, + "maximum": 2160, + "title": "Deadline Hours", + "type": "number" + }, + "status_field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Status Field" + }, + "final_values": { + "items": { + "type": "string" + }, + "title": "Final Values", + "type": "array" + }, + "pending_values": { + "items": { + "type": "string" + }, + "title": "Pending Values", + "type": "array" + }, + "rejected_values": { + "items": { + "type": "string" + }, + "title": "Rejected Values", + "type": "array" + }, + "describe": { + "default": "the final read-back", + "maxLength": 120, + "title": "Describe", + "type": "string" + }, + "alert_hours": { + "anyOf": [ + { + "exclusiveMinimum": 0, + "maximum": 2160, + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Alert Hours" + } + }, + "required": [ + "ledger", + "deadline_hours" + ], + "title": "FinalCheck", + "type": "object" + }, + "FreshSessionSpec": { + "additionalProperties": false, + "description": "``effects.fresh_session`` in ``deployment.yaml``.", + "properties": { + "surface": { + "enum": [ + "desktop", + "rdp" + ], + "title": "Surface", + "type": "string" + }, + "desktop": { + "anyOf": [ + { + "$ref": "#/$defs/DesktopRelaunch" + }, + { + "type": "null" + } + ], + "default": null + }, + "rdp": { + "anyOf": [ + { + "$ref": "#/$defs/RdpSession" + }, + { + "type": "null" + } + ], + "default": null + }, + "start": { + "items": { + "$ref": "#/$defs/ReadbackNav" + }, + "title": "Start", + "type": "array" + }, + "ready_text": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Ready Text" + }, + "ready_timeout_s": { + "default": 30.0, + "exclusiveMinimum": 0, + "title": "Ready Timeout S", + "type": "number" + } + }, + "required": [ + "surface" + ], + "title": "FreshSessionSpec", + "type": "object" + }, + "HistoryEntryReader": { + "additionalProperties": false, + "description": "CSS selectors, relative to one history row, for its columns.", + "properties": { + "record": { + "minLength": 1, + "title": "Record", + "type": "string" + }, + "what": { + "minLength": 1, + "title": "What", + "type": "string" + }, + "user": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "User" + }, + "attribute": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Attribute" + } + }, + "required": [ + "record", + "what" + ], + "title": "HistoryEntryReader", + "type": "object" + }, + "HistoryView": { + "additionalProperties": false, + "description": "The application's history, audit or activity screen (optional).", + "properties": { + "url": { + "title": "Url", + "type": "string" + }, + "ready_selector": { + "title": "Ready Selector", + "type": "string" + }, + "row_selector": { + "title": "Row Selector", + "type": "string" + }, + "entry": { + "$ref": "#/$defs/HistoryEntryReader" + }, + "record": { + "anyOf": [ + { + "$ref": "#/$defs/ValueExpr" + }, + { + "type": "null" + } + ], + "default": null + }, + "explained": { + "items": { + "type": "string" + }, + "maxItems": 64, + "minItems": 1, + "title": "Explained", + "type": "array" + }, + "expect_entry": { + "default": true, + "title": "Expect Entry", + "type": "boolean" + }, + "acting_user_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Acting User Env" + }, + "ignored": { + "items": { + "type": "string" + }, + "maxItems": 64, + "title": "Ignored", + "type": "array" + }, + "unattributed_records": { + "items": { + "type": "string" + }, + "maxItems": 16, + "title": "Unattributed Records", + "type": "array" + }, + "submit_selector": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Submit Selector" + } + }, + "required": [ + "url", + "ready_selector", + "row_selector", + "entry", + "explained" + ], + "title": "HistoryView", + "type": "object" + }, + "OpenStep": { + "additionalProperties": false, + "description": "Open the record from a results list: the one row showing the identity.", + "properties": { + "results": { + "$ref": "#/$defs/ControlRef" + }, + "double_click": { + "default": false, + "title": "Double Click", + "type": "boolean" + } + }, + "required": [ + "results" + ], + "title": "OpenStep", + "type": "object" + }, + "RdpSession": { + "additionalProperties": false, + "description": "A second RDP session, signed in as a separate account.", + "properties": { + "host": { + "minLength": 1, + "title": "Host", + "type": "string" + }, + "port": { + "default": 3389, + "maximum": 65535, + "minimum": 1, + "title": "Port", + "type": "integer" + }, + "domain": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Domain" + }, + "username_env": { + "minLength": 1, + "title": "Username Env", + "type": "string" + }, + "password_env": { + "minLength": 1, + "title": "Password Env", + "type": "string" + }, + "acting_username_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Acting Username Env" + }, + "width": { + "default": 1280, + "minimum": 320, + "title": "Width", + "type": "integer" + }, + "height": { + "default": 800, + "minimum": 240, + "title": "Height", + "type": "integer" + } + }, + "required": [ + "host", + "username_env", + "password_env" + ], + "title": "RdpSession", + "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" + }, + "RecordIdentity": { + "additionalProperties": false, + "description": "The check that the page shows the record the session asked for.", + "properties": { + "reader": { + "$ref": "#/$defs/FieldReader" + }, + "value": { + "anyOf": [ + { + "$ref": "#/$defs/ValueExpr" + }, + { + "type": "null" + } + ], + "default": null + }, + "field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Field" + } + }, + "required": [ + "reader" + ], + "title": "RecordIdentity", + "type": "object" + }, + "ReferenceCapture": { + "additionalProperties": false, + "description": "Read the saved record's identifier from the run's own session.\n\nSome applications only issue the identifier at the save: a claim number,\na submission reference, a confirmation number. Right after the save the\nverifier reads it once, here, and opens the record page by it in the\nseparate session. ``source`` is ``\"url\"`` (the page URL the run's session\nshows, from a backend that exposes ``url``) or ``\"screen\"`` (local OCR of\nthe run's current screenshot, optionally limited to ``region``).\n``pattern`` is a regular expression with exactly one capture group; it\nmust match exactly one distinct value, or the check is INDETERMINATE.", + "properties": { + "url_param": { + "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$", + "title": "Url Param", + "type": "string" + }, + "source": { + "default": "url", + "enum": [ + "url", + "screen" + ], + "title": "Source", + "type": "string" + }, + "pattern": { + "maxLength": 512, + "minLength": 1, + "title": "Pattern", + "type": "string" + }, + "region": { + "anyOf": [ + { + "maxItems": 4, + "minItems": 4, + "prefixItems": [ + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + }, + { + "type": "integer" + } + ], + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Region" + } + }, + "required": [ + "url_param", + "pattern" + ], + "title": "ReferenceCapture", + "type": "object" + }, + "ReportFormat": { + "additionalProperties": false, + "description": "How to read one kind of report.", + "properties": { + "format": { + "enum": [ + "csv", + "x12-999", + "x12-277ca", + "text" + ], + "title": "Format", + "type": "string" + }, + "key_column": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Key Column" + }, + "status_column": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Status Column" + }, + "accept": { + "items": { + "type": "string" + }, + "title": "Accept", + "type": "array" + }, + "reject": { + "items": { + "type": "string" + }, + "title": "Reject", + "type": "array" + }, + "pattern": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Pattern" + } + }, + "required": [ + "format" + ], + "title": "ReportFormat", + "type": "object" + }, + "SearchStep": { + "additionalProperties": false, + "description": "Find the record: type ``query`` into ``box`` and submit.", + "properties": { + "box": { + "$ref": "#/$defs/ControlRef" + }, + "query": { + "$ref": "#/$defs/ValueExpr" + }, + "submit": { + "anyOf": [ + { + "$ref": "#/$defs/ControlRef" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "required": [ + "box", + "query" + ], + "title": "SearchStep", + "type": "object" + }, + "SessionCredentials": { + "additionalProperties": false, + "description": "The read-back session's own credentials, as environment-variable names.\n\nFor a network RDP session they are the RDP logon. With ``sign_in`` they\nare typed into the application's sign-in form.", + "properties": { + "username_env": { + "title": "Username Env", + "type": "string" + }, + "password_env": { + "title": "Password Env", + "type": "string" + } + }, + "required": [ + "username_env", + "password_env" + ], + "title": "SessionCredentials", + "type": "object" + }, + "SignInSpec": { + "additionalProperties": false, + "description": "The read-back session's own sign-in. Credentials are env-var names.", + "properties": { + "url": { + "title": "Url", + "type": "string" + }, + "post_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Post Url" + }, + "username_selector": { + "title": "Username Selector", + "type": "string" + }, + "password_selector": { + "title": "Password Selector", + "type": "string" + }, + "submit_selector": { + "title": "Submit Selector", + "type": "string" + }, + "signed_in_selector": { + "title": "Signed In Selector", + "type": "string" + }, + "username_env": { + "title": "Username Env", + "type": "string" + }, + "password_env": { + "title": "Password Env", + "type": "string" + } + }, + "required": [ + "url", + "username_selector", + "password_selector", + "submit_selector", + "signed_in_selector", + "username_env", + "password_env" + ], + "title": "SignInSpec", + "type": "object" + }, + "SmartBackendConfig": { + "additionalProperties": false, + "description": "``effects.smart_backend`` in ``deployment.yaml`` or ``verify.yaml``.\n\nExactly one key source: ``private_key_file``, ``private_key_env`` or\n``jwks_file``. ``kid`` is required for a PEM key; for a JWKS it selects the\nkey and defaults to the only private key in the set.", + "properties": { + "client_id": { + "title": "Client Id", + "type": "string" + }, + "scope": { + "title": "Scope", + "type": "string" + }, + "token_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Token Url" + }, + "kid": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Kid" + }, + "alg": { + "anyOf": [ + { + "enum": [ + "RS384", + "ES384" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Alg" + }, + "private_key_file": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Private Key File" + }, + "private_key_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Private Key Env" + }, + "private_key_password_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Private Key Password Env" + }, + "jwks_file": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Jwks File" + }, + "jku": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Jku" + }, + "timeout_s": { + "default": 10.0, + "title": "Timeout S", + "type": "number" + }, + "verify_tls": { + "default": true, + "title": "Verify Tls", + "type": "boolean" + } + }, + "required": [ + "client_id", + "scope" + ], + "title": "SmartBackendConfig", + "type": "object" + }, + "UiReadbackSpec": { + "additionalProperties": false, + "description": "Deployment config for ``effects.kind: ui_readback``.", + "properties": { + "record_url": { + "title": "Record Url", + "type": "string" + }, + "url_params": { + "additionalProperties": { + "$ref": "#/$defs/ValueExpr" + }, + "title": "Url Params", + "type": "object" + }, + "sign_in": { + "$ref": "#/$defs/SignInSpec" + }, + "ready_selector": { + "title": "Ready Selector", + "type": "string" + }, + "not_found_selector": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Not Found Selector" + }, + "empty_selector": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Empty Selector" + }, + "row_selector": { + "title": "Row Selector", + "type": "string" + }, + "fields": { + "additionalProperties": { + "$ref": "#/$defs/FieldReader" + }, + "title": "Fields", + "type": "object" + }, + "identity": { + "$ref": "#/$defs/RecordIdentity" + }, + "reference": { + "anyOf": [ + { + "$ref": "#/$defs/ReferenceCapture" + }, + { + "type": "null" + } + ], + "default": null + }, + "read_post_paths": { + "items": { + "type": "string" + }, + "title": "Read Post Paths", + "type": "array" + }, + "truncation_markers": { + "items": { + "type": "string" + }, + "title": "Truncation Markers", + "type": "array" + }, + "navigation_timeout_s": { + "default": 15.0, + "title": "Navigation Timeout S", + "type": "number" + }, + "index_lag_s": { + "anyOf": [ + { + "maximum": 300.0, + "minimum": 0.0, + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Index Lag S" + }, + "browser": { + "default": "chromium", + "enum": [ + "chromium", + "firefox", + "webkit" + ], + "title": "Browser", + "type": "string" + }, + "headless": { + "default": true, + "title": "Headless", + "type": "boolean" + }, + "history": { + "anyOf": [ + { + "$ref": "#/$defs/HistoryView" + }, + { + "type": "null" + } + ], + "default": null + }, + "final": { + "anyOf": [ + { + "$ref": "#/$defs/FinalCheck" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "required": [ + "record_url", + "sign_in", + "ready_selector", + "row_selector", + "fields", + "identity" + ], + "title": "UiReadbackSpec", + "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" + } + }, + "$ref": "#/$defs/EffectsConfig" + }, + "serialization": { + "additionalProperties": true, + "type": "object" + } + }, + "GroundingModelConfig": { + "validation": { + "description": "Operator-selected (\"bring your own\") model-grounding endpoint.\n\nThe last rung of the resolution ladder is a Grounder that PROPOSES a click\npoint when the deterministic rungs abstain. This section lets a deployment\npoint that fallback rung at a model of its choice instead of the built-in\nAnthropic default: a self-hosted vLLM/Ollama, an OpenRouter/Azure/Bedrock\nproxy, or the Anthropic API directly.\n\nTwo hard invariants:\n\n* **Configuring a model NEVER enables egress by itself.** This section only\n names WHICH model would be used; whether ANYTHING leaves the box is still\n governed entirely by ``allow_model_grounding`` (default False => fully\n local). An enabled model with egress off stays dormant.\n* **The API key is a reference, never a literal.** ``api_key_env`` names the\n environment variable holding the key; the key itself is never stored in\n the config or in the repository.\n\nFail-safe: the constructed grounder only ever proposes a point; the identity\nband and risk gate still dispose before any click, and any endpoint error\nyields no proposal (the ladder halts).", + "properties": { + "enabled": { + "default": false, + "title": "Enabled", + "type": "boolean" + }, + "provider": { + "default": "anthropic", + "enum": [ + "anthropic", + "openai_compatible" + ], + "title": "Provider", + "type": "string" + }, + "base_url": { + "default": "", + "title": "Base Url", + "type": "string" + }, + "model": { + "default": "", + "title": "Model", + "type": "string" + }, + "api_key_env": { + "default": "", + "title": "Api Key Env", + "type": "string" + } + }, + "title": "GroundingModelConfig", + "type": "object" + }, + "serialization": { + "description": "Operator-selected (\"bring your own\") model-grounding endpoint.\n\nThe last rung of the resolution ladder is a Grounder that PROPOSES a click\npoint when the deterministic rungs abstain. This section lets a deployment\npoint that fallback rung at a model of its choice instead of the built-in\nAnthropic default: a self-hosted vLLM/Ollama, an OpenRouter/Azure/Bedrock\nproxy, or the Anthropic API directly.\n\nTwo hard invariants:\n\n* **Configuring a model NEVER enables egress by itself.** This section only\n names WHICH model would be used; whether ANYTHING leaves the box is still\n governed entirely by ``allow_model_grounding`` (default False => fully\n local). An enabled model with egress off stays dormant.\n* **The API key is a reference, never a literal.** ``api_key_env`` names the\n environment variable holding the key; the key itself is never stored in\n the config or in the repository.\n\nFail-safe: the constructed grounder only ever proposes a point; the identity\nband and risk gate still dispose before any click, and any endpoint error\nyields no proposal (the ladder halts).", + "properties": { + "enabled": { + "default": false, + "title": "Enabled", + "type": "boolean" + }, + "provider": { + "default": "anthropic", + "enum": [ + "anthropic", + "openai_compatible" + ], + "title": "Provider", + "type": "string" + }, + "base_url": { + "default": "", + "title": "Base Url", + "type": "string" + }, + "model": { + "default": "", + "title": "Model", + "type": "string" + }, + "api_key_env": { + "default": "", + "title": "Api Key Env", + "type": "string" + } + }, + "title": "GroundingModelConfig", + "type": "object" + } + }, + "HumanDecisionsConfig": { + "validation": { + "$defs": { + "RemoteHumanDecisionConfig": { + "description": "Explicit remote attended-decision issuance policy.\n\nThis section does not configure a network provider and does not grant\nexecution authority. It permits a customer-controlled runner to project\nthe current signed pause as a PHI-free AAL2 task for its configured control\nplane. The engine-owned pause capability and fresh live revalidation stay\nauthoritative when a decision returns.", + "properties": { + "enabled": { + "default": false, + "title": "Enabled", + "type": "boolean" + }, + "tenant_id": { + "anyOf": [ + { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{7,127}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tenant Id" + }, + "runner_id": { + "anyOf": [ + { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{7,127}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Runner Id" + }, + "context_tier": { + "default": "remote_closed_context", + "enum": [ + "remote_closed_context", + "remote_identifiers" + ], + "title": "Context Tier", + "type": "string" + }, + "peer_task_schemas": { + "items": { + "enum": [ + "openadapt.human-decision-task/v1", + "openadapt.human-decision-task/v2" + ], + "type": "string" + }, + "title": "Peer Task Schemas", + "type": "array" + } + }, + "title": "RemoteHumanDecisionConfig", + "type": "object" + } + }, + "description": "Attended-decision delivery posture; local issuance is the default.", + "properties": { + "remote": { + "$ref": "#/$defs/RemoteHumanDecisionConfig" + } + }, + "title": "HumanDecisionsConfig", + "type": "object" + }, + "serialization": { + "$defs": { + "RemoteHumanDecisionConfig": { + "description": "Explicit remote attended-decision issuance policy.\n\nThis section does not configure a network provider and does not grant\nexecution authority. It permits a customer-controlled runner to project\nthe current signed pause as a PHI-free AAL2 task for its configured control\nplane. The engine-owned pause capability and fresh live revalidation stay\nauthoritative when a decision returns.", + "properties": { + "enabled": { + "default": false, + "title": "Enabled", + "type": "boolean" + }, + "tenant_id": { + "anyOf": [ + { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{7,127}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tenant Id" + }, + "runner_id": { + "anyOf": [ + { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{7,127}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Runner Id" + }, + "context_tier": { + "default": "remote_closed_context", + "enum": [ + "remote_closed_context", + "remote_identifiers" + ], + "title": "Context Tier", + "type": "string" + }, + "peer_task_schemas": { + "items": { + "enum": [ + "openadapt.human-decision-task/v1", + "openadapt.human-decision-task/v2" + ], + "type": "string" + }, + "title": "Peer Task Schemas", + "type": "array" + } + }, + "title": "RemoteHumanDecisionConfig", + "type": "object" + } + }, + "description": "Attended-decision delivery posture; local issuance is the default.", + "properties": { + "remote": { + "$ref": "#/$defs/RemoteHumanDecisionConfig" + } + }, + "title": "HumanDecisionsConfig", + "type": "object" + } + }, + "IdempotencySection": { + "validation": { + "description": "Idempotency key for a governed run. The value is an env reference.", + "properties": { + "key_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Key Env" + } + }, + "title": "IdempotencySection", + "type": "object" + }, + "serialization": { + "description": "Idempotency key for a governed run. The value is an env reference.", + "properties": { + "key_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Key Env" + } + }, + "title": "IdempotencySection", + "type": "object" + } + }, + "IdentityCopyLookSection": { + "validation": { + "additionalProperties": false, + "description": "Select-and-copy look for a look-alike identifier on a pixel surface.\n\nTurn on only where selecting the recorded identifier cell and copying it\nchanges nothing (a read-only text cell) and the session's clipboard reaches\nthe machine Flow runs on (RDP/Citrix clipboard redirection). See\n:mod:`openadapt_flow.runtime.identity_looks`.", + "properties": { + "enabled": { + "default": false, + "title": "Enabled", + "type": "boolean" + }, + "gesture": { + "default": "drag", + "enum": [ + "drag", + "double_click" + ], + "title": "Gesture", + "type": "string" + }, + "copy_keys": { + "items": { + "type": "string" + }, + "minItems": 1, + "title": "Copy Keys", + "type": "array" + } + }, + "title": "IdentityCopyLookSection", + "type": "object" + }, + "serialization": { + "additionalProperties": false, + "description": "Select-and-copy look for a look-alike identifier on a pixel surface.\n\nTurn on only where selecting the recorded identifier cell and copying it\nchanges nothing (a read-only text cell) and the session's clipboard reaches\nthe machine Flow runs on (RDP/Citrix clipboard redirection). See\n:mod:`openadapt_flow.runtime.identity_looks`.", + "properties": { + "enabled": { + "default": false, + "title": "Enabled", + "type": "boolean" + }, + "gesture": { + "default": "drag", + "enum": [ + "drag", + "double_click" + ], + "title": "Gesture", + "type": "string" + }, + "copy_keys": { + "items": { + "type": "string" + }, + "minItems": 1, + "title": "Copy Keys", + "type": "array" + } + }, + "title": "IdentityCopyLookSection", + "type": "object" + } + }, + "IdentitySection": { + "validation": { + "description": "Live identity revalidation before actuation.\n\nRecord identifiers stay in customer-controlled env vars. This section\nnever stores a live identity value.", + "properties": { + "require_fresh_frame": { + "default": true, + "title": "Require Fresh Frame", + "type": "boolean" + }, + "record_id_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Record Id Env" + } + }, + "title": "IdentitySection", + "type": "object" + }, + "serialization": { + "description": "Live identity revalidation before actuation.\n\nRecord identifiers stay in customer-controlled env vars. This section\nnever stores a live identity value.", + "properties": { + "require_fresh_frame": { + "default": true, + "title": "Require Fresh Frame", + "type": "boolean" + }, + "record_id_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Record Id Env" + } + }, + "title": "IdentitySection", + "type": "object" + } + }, + "PolicySection": { + "validation": { + "description": "The safety policy that certifies a bundle for this deployment.", + "properties": { + "policy": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Policy" + } + }, + "title": "PolicySection", + "type": "object" + }, + "serialization": { + "description": "The safety policy that certifies a bundle for this deployment.", + "properties": { + "policy": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Policy" + } + }, + "title": "PolicySection", + "type": "object" + } + }, + "ProbeCopySection": { + "validation": { + "additionalProperties": false, + "description": "Declares that this deployment drives a resettable test copy.\n\nOnly ``induce --probe-on`` reads it. Probing replays guessed\ninterpretations of a recording disagreement, some of which are wrong on\npurpose, so it runs only where the operator has said in writing that the\ntarget is a disposable copy. See docs/PROBE_INDUCTION.md.", + "properties": { + "declared": { + "default": false, + "title": "Declared", + "type": "boolean" + }, + "reset_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Reset Url" + }, + "reset_command": { + "items": { + "type": "string" + }, + "title": "Reset Command", + "type": "array" + }, + "reward_contract": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Reward Contract" + } + }, + "title": "ProbeCopySection", + "type": "object" + }, + "serialization": { + "additionalProperties": false, + "description": "Declares that this deployment drives a resettable test copy.\n\nOnly ``induce --probe-on`` reads it. Probing replays guessed\ninterpretations of a recording disagreement, some of which are wrong on\npurpose, so it runs only where the operator has said in writing that the\ntarget is a disposable copy. See docs/PROBE_INDUCTION.md.", + "properties": { + "declared": { + "default": false, + "title": "Declared", + "type": "boolean" + }, + "reset_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Reset Url" + }, + "reset_command": { + "items": { + "type": "string" + }, + "title": "Reset Command", + "type": "array" + }, + "reward_contract": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Reward Contract" + } + }, + "title": "ProbeCopySection", + "type": "object" + } + }, + "RemoteHumanDecisionConfig": { + "validation": { + "description": "Explicit remote attended-decision issuance policy.\n\nThis section does not configure a network provider and does not grant\nexecution authority. It permits a customer-controlled runner to project\nthe current signed pause as a PHI-free AAL2 task for its configured control\nplane. The engine-owned pause capability and fresh live revalidation stay\nauthoritative when a decision returns.", + "properties": { + "enabled": { + "default": false, + "title": "Enabled", + "type": "boolean" + }, + "tenant_id": { + "anyOf": [ + { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{7,127}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tenant Id" + }, + "runner_id": { + "anyOf": [ + { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{7,127}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Runner Id" + }, + "context_tier": { + "default": "remote_closed_context", + "enum": [ + "remote_closed_context", + "remote_identifiers" + ], + "title": "Context Tier", + "type": "string" + }, + "peer_task_schemas": { + "items": { + "enum": [ + "openadapt.human-decision-task/v1", + "openadapt.human-decision-task/v2" + ], + "type": "string" + }, + "title": "Peer Task Schemas", + "type": "array" + } + }, + "title": "RemoteHumanDecisionConfig", + "type": "object" + }, + "serialization": { + "description": "Explicit remote attended-decision issuance policy.\n\nThis section does not configure a network provider and does not grant\nexecution authority. It permits a customer-controlled runner to project\nthe current signed pause as a PHI-free AAL2 task for its configured control\nplane. The engine-owned pause capability and fresh live revalidation stay\nauthoritative when a decision returns.", + "properties": { + "enabled": { + "default": false, + "title": "Enabled", + "type": "boolean" + }, + "tenant_id": { + "anyOf": [ + { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{7,127}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tenant Id" + }, + "runner_id": { + "anyOf": [ + { + "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{7,127}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Runner Id" + }, + "context_tier": { + "default": "remote_closed_context", + "enum": [ + "remote_closed_context", + "remote_identifiers" + ], + "title": "Context Tier", + "type": "string" + }, + "peer_task_schemas": { + "items": { + "enum": [ + "openadapt.human-decision-task/v1", + "openadapt.human-decision-task/v2" + ], + "type": "string" + }, + "title": "Peer Task Schemas", + "type": "array" + } + }, + "title": "RemoteHumanDecisionConfig", + "type": "object" + } + }, + "RepairSection": { + "validation": { + "$defs": { + "RepairSessionSpec": { + "additionalProperties": false, + "description": "How self-repair opens a fresh app session outside a browser.\n\nA probe, each fault probe and the resumed run each need the app freshly\nstarted; the halted session stays as it is. Each command is an argv run\non the machine Flow runs on, with no shell. It must keep running while the\napp is up and own (it, or a process of its group) the one window\n``backend:`` binds to; Flow checks that, and ends the group afterwards. A\nbackend whose window is not on this machine (Windows over its agent,\nFreeRDP) can't show that, so repair there is refused for now.", + "properties": { + "command": { + "items": { + "type": "string" + }, + "minItems": 1, + "title": "Command", + "type": "array" + }, + "fault_commands": { + "additionalProperties": { + "items": { + "type": "string" + }, + "type": "array" + }, + "title": "Fault Commands", + "type": "object" + }, + "close_command": { + "items": { + "type": "string" + }, + "title": "Close Command", + "type": "array" + }, + "ready_s": { + "default": 2.0, + "maximum": 120.0, + "minimum": 0.0, + "title": "Ready S", + "type": "number" + } + }, + "required": [ + "command" + ], + "title": "RepairSessionSpec", + "type": "object" + } + }, + "additionalProperties": false, + "description": "Automatic repair of stops that wrote nothing (docs/SELF_REPAIR.md).\n\nWhen ``agent`` is set, every ``run`` that halts before any effect hands\nthe stop to this repair agent, probes its fix up to the save, asks one\nperson (or applies a pre-approved standard change), and resumes. A stop\nafter a write is never repaired. ``auto: false`` or ``--no-auto-repair``\nturns it off. Omitted when serialized at its defaults.", + "properties": { + "agent": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Agent" + }, + "screen_access_by": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Screen Access By" + }, + "screen_share_mode": { + "default": "scrubbed_only", + "enum": [ + "scrubbed_only", + "allow_unscrubbed" + ], + "title": "Screen Share Mode", + "type": "string" + }, + "auto": { + "default": true, + "title": "Auto", + "type": "boolean" + }, + "store": { + "default": "repair-store", + "title": "Store", + "type": "string" + }, + "attempts": { + "default": 3, + "maximum": 10, + "minimum": 1, + "title": "Attempts", + "type": "integer" + }, + "fault_urls": { + "items": { + "type": "string" + }, + "title": "Fault Urls", + "type": "array" + }, + "approval_wait_s": { + "default": 900.0, + "minimum": 0.0, + "title": "Approval Wait S", + "type": "number" + }, + "model_provider": { + "anyOf": [ + { + "enum": [ + "anthropic", + "openai" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Model Provider" + }, + "model_key_file": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Model Key File" + }, + "requalify": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Requalify" + }, + "requalify_trials": { + "default": 1, + "maximum": 10, + "minimum": 1, + "title": "Requalify Trials", + "type": "integer" + }, + "session": { + "anyOf": [ + { + "$ref": "#/$defs/RepairSessionSpec" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "RepairSection", + "type": "object" + }, + "serialization": { + "$defs": { + "RepairSessionSpec": { + "additionalProperties": false, + "description": "How self-repair opens a fresh app session outside a browser.\n\nA probe, each fault probe and the resumed run each need the app freshly\nstarted; the halted session stays as it is. Each command is an argv run\non the machine Flow runs on, with no shell. It must keep running while the\napp is up and own (it, or a process of its group) the one window\n``backend:`` binds to; Flow checks that, and ends the group afterwards. A\nbackend whose window is not on this machine (Windows over its agent,\nFreeRDP) can't show that, so repair there is refused for now.", + "properties": { + "command": { + "items": { + "type": "string" + }, + "minItems": 1, + "title": "Command", + "type": "array" + }, + "fault_commands": { + "additionalProperties": { + "items": { + "type": "string" + }, + "type": "array" + }, + "title": "Fault Commands", + "type": "object" + }, + "close_command": { + "items": { + "type": "string" + }, + "title": "Close Command", + "type": "array" + }, + "ready_s": { + "default": 2.0, + "maximum": 120.0, + "minimum": 0.0, + "title": "Ready S", + "type": "number" + } + }, + "required": [ + "command" + ], + "title": "RepairSessionSpec", + "type": "object" + } + }, + "additionalProperties": false, + "description": "Automatic repair of stops that wrote nothing (docs/SELF_REPAIR.md).\n\nWhen ``agent`` is set, every ``run`` that halts before any effect hands\nthe stop to this repair agent, probes its fix up to the save, asks one\nperson (or applies a pre-approved standard change), and resumes. A stop\nafter a write is never repaired. ``auto: false`` or ``--no-auto-repair``\nturns it off. Omitted when serialized at its defaults.", + "properties": { + "agent": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Agent" + }, + "screen_access_by": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Screen Access By" + }, + "screen_share_mode": { + "default": "scrubbed_only", + "enum": [ + "scrubbed_only", + "allow_unscrubbed" + ], + "title": "Screen Share Mode", + "type": "string" + }, + "auto": { + "default": true, + "title": "Auto", + "type": "boolean" + }, + "store": { + "default": "repair-store", + "title": "Store", + "type": "string" + }, + "attempts": { + "default": 3, + "maximum": 10, + "minimum": 1, + "title": "Attempts", + "type": "integer" + }, + "fault_urls": { + "items": { + "type": "string" + }, + "title": "Fault Urls", + "type": "array" + }, + "approval_wait_s": { + "default": 900.0, + "minimum": 0.0, + "title": "Approval Wait S", + "type": "number" + }, + "model_provider": { + "anyOf": [ + { + "enum": [ + "anthropic", + "openai" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Model Provider" + }, + "model_key_file": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Model Key File" + }, + "requalify": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Requalify" + }, + "requalify_trials": { + "default": 1, + "maximum": 10, + "minimum": 1, + "title": "Requalify Trials", + "type": "integer" + }, + "session": { + "anyOf": [ + { + "$ref": "#/$defs/RepairSessionSpec" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "RepairSection", + "type": "object" + } + }, + "RepairSessionSpec": { + "validation": { + "additionalProperties": false, + "description": "How self-repair opens a fresh app session outside a browser.\n\nA probe, each fault probe and the resumed run each need the app freshly\nstarted; the halted session stays as it is. Each command is an argv run\non the machine Flow runs on, with no shell. It must keep running while the\napp is up and own (it, or a process of its group) the one window\n``backend:`` binds to; Flow checks that, and ends the group afterwards. A\nbackend whose window is not on this machine (Windows over its agent,\nFreeRDP) can't show that, so repair there is refused for now.", + "properties": { + "command": { + "items": { + "type": "string" + }, + "minItems": 1, + "title": "Command", + "type": "array" + }, + "fault_commands": { + "additionalProperties": { + "items": { + "type": "string" + }, + "type": "array" + }, + "title": "Fault Commands", + "type": "object" + }, + "close_command": { + "items": { + "type": "string" + }, + "title": "Close Command", + "type": "array" + }, + "ready_s": { + "default": 2.0, + "maximum": 120.0, + "minimum": 0.0, + "title": "Ready S", + "type": "number" + } + }, + "required": [ + "command" + ], + "title": "RepairSessionSpec", + "type": "object" + }, + "serialization": { + "additionalProperties": false, + "description": "How self-repair opens a fresh app session outside a browser.\n\nA probe, each fault probe and the resumed run each need the app freshly\nstarted; the halted session stays as it is. Each command is an argv run\non the machine Flow runs on, with no shell. It must keep running while the\napp is up and own (it, or a process of its group) the one window\n``backend:`` binds to; Flow checks that, and ends the group afterwards. A\nbackend whose window is not on this machine (Windows over its agent,\nFreeRDP) can't show that, so repair there is refused for now.", + "properties": { + "command": { + "items": { + "type": "string" + }, + "minItems": 1, + "title": "Command", + "type": "array" + }, + "fault_commands": { + "additionalProperties": { + "items": { + "type": "string" + }, + "type": "array" + }, + "title": "Fault Commands", + "type": "object" + }, + "close_command": { + "items": { + "type": "string" + }, + "title": "Close Command", + "type": "array" + }, + "ready_s": { + "default": 2.0, + "maximum": 120.0, + "minimum": 0.0, + "title": "Ready S", + "type": "number" + } + }, + "required": [ + "command" + ], + "title": "RepairSessionSpec", + "type": "object" + } + }, + "RollbackSection": { + "validation": { + "$defs": { + "AllowedTable": { + "additionalProperties": false, + "description": "One allow-listed table: the app writes it on its own.", + "properties": { + "table": { + "title": "Table", + "type": "string" + }, + "mode": { + "default": "append_only", + "enum": [ + "append_only", + "skip" + ], + "title": "Mode", + "type": "string" + }, + "reason": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Reason" + } + }, + "required": [ + "table" + ], + "title": "AllowedTable", + "type": "object" + }, + "FrameAttribution": { + "additionalProperties": false, + "description": "Where the judge learns who changed a record.\n\n``audit_read``: a second read-only read (``read``, the same shape as an\n``effects:`` verifier section) returns the app's audit log or change\nfeed. Entries present after the save and not before are the window's\nentries. ``record_field`` names the entry field that refers to a record\n(compared with :attr:`FrameSpec.identity_field`), ``actor_field`` the\nuser or session.\n\n``record_field`` attribution: each record carries its last modifier in\n``actor_field`` and, optionally, a version or ETag in ``version_field``.\nA changed record whose version did not move is unattributed.", + "properties": { + "kind": { + "enum": [ + "audit_read", + "record_field" + ], + "title": "Kind", + "type": "string" + }, + "actor_field": { + "minLength": 1, + "title": "Actor Field", + "type": "string" + }, + "self": { + "items": { + "$ref": "#/$defs/ValueExpr" + }, + "minItems": 1, + "title": "Self", + "type": "array" + }, + "record_field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Record Field" + }, + "read": { + "anyOf": [ + { + "additionalProperties": true, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Read" + }, + "record_key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Record Key" + }, + "record_keys": { + "additionalProperties": { + "type": "string" + }, + "title": "Record Keys", + "type": "object" + }, + "event_field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Event Field" + }, + "write_events": { + "items": { + "type": "string" + }, + "title": "Write Events", + "type": "array" + }, + "insert_events": { + "items": { + "type": "string" + }, + "title": "Insert Events", + "type": "array" + }, + "delete_events": { + "items": { + "type": "string" + }, + "title": "Delete Events", + "type": "array" + }, + "table_field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Table Field" + }, + "owners": { + "additionalProperties": { + "$ref": "#/$defs/Owner" + }, + "title": "Owners", + "type": "object" + }, + "version_field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Version Field" + }, + "server_set": { + "items": { + "type": "string" + }, + "title": "Server Set", + "type": "array" + } + }, + "required": [ + "kind", + "actor_field", + "self" + ], + "title": "FrameAttribution", + "type": "object" + }, + "FrameDatabase": { + "additionalProperties": false, + "description": "``frame.database``: diff the whole database, not only what is read.\n\nEvery table and column is snapshotted before and after the save\n(``db_snapshot.py``), and each table is judged as one more slice: a row\nadded, removed or changed is collateral unless a declared effect, a\ndeclared side record or an attributed concurrent writer explains it. A\nnew declared or side row that sets a column the effects don't name, and\nthat ``new_row_fields`` doesn't list, is collateral too.\n\n``allow_tables`` replaces a read-list with a reviewed allow-list: the\ntables the app writes on its own for any signed-in user (logs, sessions,\nid registries). They are append-only unless an entry says ``skip`` with a\nreason. Everything else is compared. The receipt counts tables compared,\nappend-only and skipped, and binds the list's digest.", + "properties": { + "dialect": { + "enum": [ + "sqlite", + "mysql", + "postgresql" + ], + "title": "Dialect", + "type": "string" + }, + "read": { + "additionalProperties": true, + "title": "Read", + "type": "object" + }, + "allow_tables": { + "items": { + "$ref": "#/$defs/AllowedTable" + }, + "title": "Allow Tables", + "type": "array" + }, + "views": { + "additionalProperties": { + "type": "string" + }, + "title": "Views", + "type": "object" + }, + "judged_by": { + "additionalProperties": { + "type": "string" + }, + "title": "Judged By", + "type": "object" + }, + "new_row_fields": { + "additionalProperties": { + "items": { + "type": "string" + }, + "type": "array" + }, + "title": "New Row Fields", + "type": "object" + }, + "ignore_columns": { + "additionalProperties": { + "items": { + "type": "string" + }, + "type": "array" + }, + "title": "Ignore Columns", + "type": "object" + }, + "max_rows": { + "default": 2000, + "minimum": 1, + "title": "Max Rows", + "type": "integer" + }, + "read_row_budget": { + "default": 1000000, + "minimum": 1, + "title": "Read Row Budget", + "type": "integer" + }, + "schemas": { + "items": { + "type": "string" + }, + "title": "Schemas", + "type": "array" + }, + "profile": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Profile" + }, + "profile_sha256": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Profile Sha256" + }, + "settle_s": { + "default": 1.0, + "minimum": 0, + "title": "Settle S", + "type": "number" + }, + "settle_attempts": { + "default": 1, + "maximum": 60, + "minimum": 1, + "title": "Settle Attempts", + "type": "integer" + }, + "recheck_after_s": { + "anyOf": [ + { + "exclusiveMinimum": 0, + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Recheck After S" + } + }, + "required": [ + "dialect", + "read" + ], + "title": "FrameDatabase", + "type": "object" + }, + "Owner": { + "additionalProperties": false, + "properties": { + "column": { + "title": "Column", + "type": "string" + }, + "by": { + "enum": [ + "username", + "user_id" + ], + "title": "By", + "type": "string" + }, + "default": { + "anyOf": [ + { + "$ref": "#/$defs/OwnerDefault" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "required": [ + "column", + "by" + ], + "title": "Owner", + "type": "object" + }, + "OwnerDefault": { + "additionalProperties": false, + "description": "The owner value of the app's global default rows, written beside a\nuser's own row (OpenEMR's ``user_settings`` row for ``setting_user = 0``,\nadded the first time anyone saves a label).", + "properties": { + "value": { + "minLength": 1, + "title": "Value", + "type": "string" + }, + "same": { + "items": { + "type": "string" + }, + "minItems": 1, + "title": "Same", + "type": "array" + } + }, + "required": [ + "value", + "same" + ], + "title": "OwnerDefault", + "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" + } + }, + "additionalProperties": false, + "description": "Compensating rollback after a stop (docs/ROLLBACK.md).\n\nOff unless ``enabled``. When on, the run reads the system of record before\nit starts; after a stop it runs the compensation a person approved for\neach change, latest first, and reads the store again. It is\n``ROLLED_BACK`` only when that read matches the first one.", + "properties": { + "enabled": { + "default": false, + "title": "Enabled", + "type": "boolean" + }, + "database": { + "anyOf": [ + { + "$ref": "#/$defs/FrameDatabase" + }, + { + "type": "null" + } + ], + "default": null + }, + "allow_delete": { + "default": false, + "title": "Allow Delete", + "type": "boolean" + }, + "profile": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Profile" + }, + "actor_names": { + "items": { + "type": "string" + }, + "title": "Actor Names", + "type": "array" + }, + "exclusive": { + "default": false, + "title": "Exclusive", + "type": "boolean" + }, + "attribution": { + "anyOf": [ + { + "$ref": "#/$defs/FrameAttribution" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "RollbackSection", + "type": "object" + }, + "serialization": { + "$defs": { + "FrameAttribution": { + "additionalProperties": false, + "description": "Where the judge learns who changed a record.\n\n``audit_read``: a second read-only read (``read``, the same shape as an\n``effects:`` verifier section) returns the app's audit log or change\nfeed. Entries present after the save and not before are the window's\nentries. ``record_field`` names the entry field that refers to a record\n(compared with :attr:`FrameSpec.identity_field`), ``actor_field`` the\nuser or session.\n\n``record_field`` attribution: each record carries its last modifier in\n``actor_field`` and, optionally, a version or ETag in ``version_field``.\nA changed record whose version did not move is unattributed.", + "properties": { + "kind": { + "enum": [ + "audit_read", + "record_field" + ], + "title": "Kind", + "type": "string" + }, + "actor_field": { + "minLength": 1, + "title": "Actor Field", + "type": "string" + }, + "self": { + "items": { + "$ref": "#/$defs/ValueExpr" + }, + "minItems": 1, + "title": "Self", + "type": "array" + }, + "record_field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Record Field" + }, + "read": { + "anyOf": [ + { + "additionalProperties": true, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Read" + }, + "record_key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Record Key" + }, + "record_keys": { + "additionalProperties": { + "type": "string" + }, + "title": "Record Keys", + "type": "object" + }, + "event_field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Event Field" + }, + "write_events": { + "items": { + "type": "string" + }, + "title": "Write Events", + "type": "array" + }, + "insert_events": { + "items": { + "type": "string" + }, + "title": "Insert Events", + "type": "array" + }, + "delete_events": { + "items": { + "type": "string" + }, + "title": "Delete Events", + "type": "array" + }, + "table_field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Table Field" + }, + "owners": { + "additionalProperties": { + "$ref": "#/$defs/Owner" + }, + "title": "Owners", + "type": "object" + }, + "version_field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Version Field" + }, + "server_set": { + "items": { + "type": "string" + }, + "title": "Server Set", + "type": "array" + } + }, + "required": [ + "kind", + "actor_field", + "self" + ], + "title": "FrameAttribution", + "type": "object" + }, + "FrameDatabase": { + "additionalProperties": true, + "type": "object" + }, + "Owner": { + "additionalProperties": false, + "properties": { + "column": { + "title": "Column", + "type": "string" + }, + "by": { + "enum": [ + "username", + "user_id" + ], + "title": "By", + "type": "string" + }, + "default": { + "anyOf": [ + { + "$ref": "#/$defs/OwnerDefault" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "required": [ + "column", + "by" + ], + "title": "Owner", + "type": "object" + }, + "OwnerDefault": { + "additionalProperties": false, + "description": "The owner value of the app's global default rows, written beside a\nuser's own row (OpenEMR's ``user_settings`` row for ``setting_user = 0``,\nadded the first time anyone saves a label).", + "properties": { + "value": { + "minLength": 1, + "title": "Value", + "type": "string" + }, + "same": { + "items": { + "type": "string" + }, + "minItems": 1, + "title": "Same", + "type": "array" + } + }, + "required": [ + "value", + "same" + ], + "title": "OwnerDefault", + "type": "object" + }, + "ValueExpr": {} + }, + "additionalProperties": false, + "description": "Compensating rollback after a stop (docs/ROLLBACK.md).\n\nOff unless ``enabled``. When on, the run reads the system of record before\nit starts; after a stop it runs the compensation a person approved for\neach change, latest first, and reads the store again. It is\n``ROLLED_BACK`` only when that read matches the first one.", + "properties": { + "enabled": { + "default": false, + "title": "Enabled", + "type": "boolean" + }, + "database": { + "anyOf": [ + { + "$ref": "#/$defs/FrameDatabase" + }, + { + "type": "null" + } + ], + "default": null + }, + "allow_delete": { + "default": false, + "title": "Allow Delete", + "type": "boolean" + }, + "profile": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Profile" + }, + "actor_names": { + "items": { + "type": "string" + }, + "title": "Actor Names", + "type": "array" + }, + "exclusive": { + "default": false, + "title": "Exclusive", + "type": "boolean" + }, + "attribution": { + "anyOf": [ + { + "$ref": "#/$defs/FrameAttribution" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "RollbackSection", + "type": "object" + } + }, + "RuntimeSection": { + "validation": { + "$defs": { + "GroundingModelConfig": { + "description": "Operator-selected (\"bring your own\") model-grounding endpoint.\n\nThe last rung of the resolution ladder is a Grounder that PROPOSES a click\npoint when the deterministic rungs abstain. This section lets a deployment\npoint that fallback rung at a model of its choice instead of the built-in\nAnthropic default: a self-hosted vLLM/Ollama, an OpenRouter/Azure/Bedrock\nproxy, or the Anthropic API directly.\n\nTwo hard invariants:\n\n* **Configuring a model NEVER enables egress by itself.** This section only\n names WHICH model would be used; whether ANYTHING leaves the box is still\n governed entirely by ``allow_model_grounding`` (default False => fully\n local). An enabled model with egress off stays dormant.\n* **The API key is a reference, never a literal.** ``api_key_env`` names the\n environment variable holding the key; the key itself is never stored in\n the config or in the repository.\n\nFail-safe: the constructed grounder only ever proposes a point; the identity\nband and risk gate still dispose before any click, and any endpoint error\nyields no proposal (the ladder halts).", + "properties": { + "enabled": { + "default": false, + "title": "Enabled", + "type": "boolean" + }, + "provider": { + "default": "anthropic", + "enum": [ + "anthropic", + "openai_compatible" + ], + "title": "Provider", + "type": "string" + }, + "base_url": { + "default": "", + "title": "Base Url", + "type": "string" + }, + "model": { + "default": "", + "title": "Model", + "type": "string" + }, + "api_key_env": { + "default": "", + "title": "Api Key Env", + "type": "string" + } + }, + "title": "GroundingModelConfig", + "type": "object" + }, + "IdentityCopyLookSection": { + "additionalProperties": false, + "description": "Select-and-copy look for a look-alike identifier on a pixel surface.\n\nTurn on only where selecting the recorded identifier cell and copying it\nchanges nothing (a read-only text cell) and the session's clipboard reaches\nthe machine Flow runs on (RDP/Citrix clipboard redirection). See\n:mod:`openadapt_flow.runtime.identity_looks`.", + "properties": { + "enabled": { + "default": false, + "title": "Enabled", + "type": "boolean" + }, + "gesture": { + "default": "drag", + "enum": [ + "drag", + "double_click" + ], + "title": "Gesture", + "type": "string" + }, + "copy_keys": { + "items": { + "type": "string" + }, + "minItems": 1, + "title": "Copy Keys", + "type": "array" + } + }, + "title": "IdentityCopyLookSection", + "type": "object" + } + }, + "description": "Runtime posture: durability and model-egress opt-in.", + "properties": { + "profile": { + "anyOf": [ + { + "enum": [ + "demo", + "standard", + "regulated" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Profile" + }, + "approval_mode": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Approval Mode" + }, + "durable": { + "default": false, + "title": "Durable", + "type": "boolean" + }, + "require_settled": { + "default": false, + "title": "Require Settled", + "type": "boolean" + }, + "allow_model_grounding": { + "default": false, + "title": "Allow Model Grounding", + "type": "boolean" + }, + "local_grounding": { + "default": false, + "title": "Local Grounding", + "type": "boolean" + }, + "pixel_verify_enabled": { + "default": false, + "title": "Pixel Verify Enabled", + "type": "boolean" + }, + "known_ids_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Known Ids Path" + }, + "interruptions_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Interruptions Path" + }, + "known_ids_column": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Known Ids Column" + }, + "known_ids_confirmation_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Known Ids Confirmation Path" + }, + "known_ids_max_age_hours": { + "default": 24.0, + "exclusiveMinimum": 0, + "title": "Known Ids Max Age Hours", + "type": "number" + }, + "identity_copy_look": { + "$ref": "#/$defs/IdentityCopyLookSection" + }, + "layout_drift_check": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Layout Drift Check" + }, + "page_quiet_ms": { + "anyOf": [ + { + "maximum": 2000, + "minimum": 30, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Page Quiet Ms" + }, + "speed": { + "anyOf": [ + { + "enum": [ + "standard", + "fast" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Speed" + }, + "grounding_model": { + "$ref": "#/$defs/GroundingModelConfig" + }, + "phi_grounding_allowlist": { + "items": { + "type": "string" + }, + "title": "Phi Grounding Allowlist", + "type": "array" + }, + "phi_egress_attested": { + "default": false, + "title": "Phi Egress Attested", + "type": "boolean" + } + }, + "title": "RuntimeSection", + "type": "object" + }, + "serialization": { + "$defs": { + "GroundingModelConfig": { + "description": "Operator-selected (\"bring your own\") model-grounding endpoint.\n\nThe last rung of the resolution ladder is a Grounder that PROPOSES a click\npoint when the deterministic rungs abstain. This section lets a deployment\npoint that fallback rung at a model of its choice instead of the built-in\nAnthropic default: a self-hosted vLLM/Ollama, an OpenRouter/Azure/Bedrock\nproxy, or the Anthropic API directly.\n\nTwo hard invariants:\n\n* **Configuring a model NEVER enables egress by itself.** This section only\n names WHICH model would be used; whether ANYTHING leaves the box is still\n governed entirely by ``allow_model_grounding`` (default False => fully\n local). An enabled model with egress off stays dormant.\n* **The API key is a reference, never a literal.** ``api_key_env`` names the\n environment variable holding the key; the key itself is never stored in\n the config or in the repository.\n\nFail-safe: the constructed grounder only ever proposes a point; the identity\nband and risk gate still dispose before any click, and any endpoint error\nyields no proposal (the ladder halts).", + "properties": { + "enabled": { + "default": false, + "title": "Enabled", + "type": "boolean" + }, + "provider": { + "default": "anthropic", + "enum": [ + "anthropic", + "openai_compatible" + ], + "title": "Provider", + "type": "string" + }, + "base_url": { + "default": "", + "title": "Base Url", + "type": "string" + }, + "model": { + "default": "", + "title": "Model", + "type": "string" + }, + "api_key_env": { + "default": "", + "title": "Api Key Env", + "type": "string" + } + }, + "title": "GroundingModelConfig", + "type": "object" + }, + "IdentityCopyLookSection": { + "additionalProperties": false, + "description": "Select-and-copy look for a look-alike identifier on a pixel surface.\n\nTurn on only where selecting the recorded identifier cell and copying it\nchanges nothing (a read-only text cell) and the session's clipboard reaches\nthe machine Flow runs on (RDP/Citrix clipboard redirection). See\n:mod:`openadapt_flow.runtime.identity_looks`.", + "properties": { + "enabled": { + "default": false, + "title": "Enabled", + "type": "boolean" + }, + "gesture": { + "default": "drag", + "enum": [ + "drag", + "double_click" + ], + "title": "Gesture", + "type": "string" + }, + "copy_keys": { + "items": { + "type": "string" + }, + "minItems": 1, + "title": "Copy Keys", + "type": "array" + } + }, + "title": "IdentityCopyLookSection", + "type": "object" + } + }, + "description": "Runtime posture: durability and model-egress opt-in.", + "properties": { + "profile": { + "anyOf": [ + { + "enum": [ + "demo", + "standard", + "regulated" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Profile" + }, + "approval_mode": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Approval Mode" + }, + "durable": { + "default": false, + "title": "Durable", + "type": "boolean" + }, + "require_settled": { + "default": false, + "title": "Require Settled", + "type": "boolean" + }, + "allow_model_grounding": { + "default": false, + "title": "Allow Model Grounding", + "type": "boolean" + }, + "local_grounding": { + "default": false, + "title": "Local Grounding", + "type": "boolean" + }, + "pixel_verify_enabled": { + "default": false, + "title": "Pixel Verify Enabled", + "type": "boolean" + }, + "known_ids_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Known Ids Path" + }, + "interruptions_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Interruptions Path" + }, + "known_ids_column": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Known Ids Column" + }, + "known_ids_confirmation_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Known Ids Confirmation Path" + }, + "known_ids_max_age_hours": { + "default": 24.0, + "exclusiveMinimum": 0, + "title": "Known Ids Max Age Hours", + "type": "number" + }, + "identity_copy_look": { + "$ref": "#/$defs/IdentityCopyLookSection" + }, + "layout_drift_check": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Layout Drift Check" + }, + "page_quiet_ms": { + "anyOf": [ + { + "maximum": 2000, + "minimum": 30, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Page Quiet Ms" + }, + "speed": { + "anyOf": [ + { + "enum": [ + "standard", + "fast" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Speed" + }, + "grounding_model": { + "$ref": "#/$defs/GroundingModelConfig" + }, + "phi_grounding_allowlist": { + "items": { + "type": "string" + }, + "title": "Phi Grounding Allowlist", + "type": "array" + }, + "phi_egress_attested": { + "default": false, + "title": "Phi Egress Attested", + "type": "boolean" + } + }, + "title": "RuntimeSection", + "type": "object" + } + }, + "WorklistAccount": { + "validation": { + "additionalProperties": false, + "description": "One signed-in session for a parallel worklist worker.\n\nHolds env var NAMES only, never a credential value.", + "properties": { + "name": { + "maxLength": 64, + "minLength": 1, + "title": "Name", + "type": "string" + }, + "params_env": { + "additionalProperties": { + "type": "string" + }, + "title": "Params Env", + "type": "object" + }, + "secrets_env": { + "additionalProperties": { + "type": "string" + }, + "title": "Secrets Env", + "type": "object" + }, + "browser_cdp_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Browser Cdp Endpoint" + }, + "rdp_username": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Username" + }, + "rdp_password_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Password Env" + } + }, + "required": [ + "name" + ], + "title": "WorklistAccount", + "type": "object" + }, + "serialization": { + "additionalProperties": false, + "description": "One signed-in session for a parallel worklist worker.\n\nHolds env var NAMES only, never a credential value.", + "properties": { + "name": { + "maxLength": 64, + "minLength": 1, + "title": "Name", + "type": "string" + }, + "params_env": { + "additionalProperties": { + "type": "string" + }, + "title": "Params Env", + "type": "object" + }, + "secrets_env": { + "additionalProperties": { + "type": "string" + }, + "title": "Secrets Env", + "type": "object" + }, + "browser_cdp_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Browser Cdp Endpoint" + }, + "rdp_username": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Username" + }, + "rdp_password_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Password Env" + } + }, + "required": [ + "name" + ], + "title": "WorklistAccount", + "type": "object" + } + }, + "WorklistSection": { + "validation": { + "$defs": { + "WorklistAccount": { + "additionalProperties": false, + "description": "One signed-in session for a parallel worklist worker.\n\nHolds env var NAMES only, never a credential value.", + "properties": { + "name": { + "maxLength": 64, + "minLength": 1, + "title": "Name", + "type": "string" + }, + "params_env": { + "additionalProperties": { + "type": "string" + }, + "title": "Params Env", + "type": "object" + }, + "secrets_env": { + "additionalProperties": { + "type": "string" + }, + "title": "Secrets Env", + "type": "object" + }, + "browser_cdp_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Browser Cdp Endpoint" + }, + "rdp_username": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Username" + }, + "rdp_password_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Password Env" + } + }, + "required": [ + "name" + ], + "title": "WorklistAccount", + "type": "object" + } + }, + "additionalProperties": false, + "description": "Parallel worklist runs (``--workers N``, docs/THROUGHPUT.md).\n\nThe defaults run one item at a time, as before. ``--workers`` above\n``max_workers`` is refused, so the deployment states how many sessions\nthe app tolerates at once.", + "properties": { + "max_workers": { + "default": 1, + "maximum": 64, + "minimum": 1, + "title": "Max Workers", + "type": "integer" + }, + "items_independent": { + "default": false, + "title": "Items Independent", + "type": "boolean" + }, + "readback_window": { + "default": 0, + "maximum": 16, + "minimum": 0, + "title": "Readback Window", + "type": "integer" + }, + "on_halt": { + "default": "stop", + "enum": [ + "stop", + "skip_unwritten" + ], + "title": "On Halt", + "type": "string" + }, + "sign_in_bundle": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Sign In Bundle" + }, + "entry_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Entry Url" + }, + "entry_bundle": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Entry Bundle" + }, + "accounts": { + "items": { + "$ref": "#/$defs/WorklistAccount" + }, + "title": "Accounts", + "type": "array" + } + }, + "title": "WorklistSection", + "type": "object" + }, + "serialization": { + "$defs": { + "WorklistAccount": { + "additionalProperties": false, + "description": "One signed-in session for a parallel worklist worker.\n\nHolds env var NAMES only, never a credential value.", + "properties": { + "name": { + "maxLength": 64, + "minLength": 1, + "title": "Name", + "type": "string" + }, + "params_env": { + "additionalProperties": { + "type": "string" + }, + "title": "Params Env", + "type": "object" + }, + "secrets_env": { + "additionalProperties": { + "type": "string" + }, + "title": "Secrets Env", + "type": "object" + }, + "browser_cdp_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Browser Cdp Endpoint" + }, + "rdp_username": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Username" + }, + "rdp_password_env": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Rdp Password Env" + } + }, + "required": [ + "name" + ], + "title": "WorklistAccount", + "type": "object" + } + }, + "additionalProperties": false, + "description": "Parallel worklist runs (``--workers N``, docs/THROUGHPUT.md).\n\nThe defaults run one item at a time, as before. ``--workers`` above\n``max_workers`` is refused, so the deployment states how many sessions\nthe app tolerates at once.", + "properties": { + "max_workers": { + "default": 1, + "maximum": 64, + "minimum": 1, + "title": "Max Workers", + "type": "integer" + }, + "items_independent": { + "default": false, + "title": "Items Independent", + "type": "boolean" + }, + "readback_window": { + "default": 0, + "maximum": 16, + "minimum": 0, + "title": "Readback Window", + "type": "integer" + }, + "on_halt": { + "default": "stop", + "enum": [ + "stop", + "skip_unwritten" + ], + "title": "On Halt", + "type": "string" + }, + "sign_in_bundle": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Sign In Bundle" + }, + "entry_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Entry Url" + }, + "entry_bundle": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Entry Bundle" + }, + "accounts": { + "items": { + "$ref": "#/$defs/WorklistAccount" + }, + "title": "Accounts", + "type": "array" + } + }, + "title": "WorklistSection", + "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