diff --git a/schemas/BrowserAutomationReceipt.json b/schemas/BrowserAutomationReceipt.json new file mode 100644 index 0000000..c30373c --- /dev/null +++ b/schemas/BrowserAutomationReceipt.json @@ -0,0 +1,57 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://schemas.srcos.ai/v2/BrowserAutomationReceipt.json", + "title": "BrowserAutomationReceipt", + "description": "Receipt for a user-visible, revocable browser automation session with explicit owner, transport, permission scope, policy decision, and evidence references.", + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "type", + "specVersion", + "sessionRef", + "ownerRef", + "transport", + "permissionScope", + "origin", + "userVisible", + "revocable", + "policyDecisionRef", + "evidenceRefs", + "capturedAt" + ], + "properties": { + "id": { "type": "string", "pattern": "^urn:srcos:receipt:browser-automation:" }, + "type": { "const": "BrowserAutomationReceipt" }, + "specVersion": { "type": "string" }, + "sessionRef": { "type": "string", "pattern": "^urn:srcos:session:" }, + "ownerRef": { "type": "string" }, + "transport": { "type": "string", "enum": ["native_pipe", "cdp", "webdriver", "extension", "accessibility"] }, + "permissionScope": { + "type": "array", + "minItems": 1, + "items": { + "type": "string", + "enum": ["read_dom", "click", "type", "download", "upload", "inspect_network", "inspect_cookies", "use_credentials", "screenshot", "navigate", "read_clipboard", "write_clipboard"] + } + }, + "origin": { "type": "string", "enum": ["local", "remote", "workspace"] }, + "controlledScope": { + "type": ["object", "null"], + "additionalProperties": false, + "properties": { + "windowRef": { "type": ["string", "null"] }, + "tabRef": { "type": ["string", "null"] }, + "urlOrigin": { "type": ["string", "null"] }, + "workspaceRef": { "type": ["string", "null"] } + } + }, + "userVisible": { "type": "boolean", "const": true }, + "revocable": { "type": "boolean", "const": true }, + "revokedAt": { "type": ["string", "null"], "format": "date-time" }, + "terminalState": { "type": ["string", "null"], "enum": ["active", "revoked", "completed", "failed", "denied", null] }, + "policyDecisionRef": { "type": "string", "pattern": "^urn:srcos:decision:" }, + "evidenceRefs": { "type": "array", "items": { "type": "string" } }, + "capturedAt": { "type": "string", "format": "date-time" } + } +} diff --git a/schemas/CapabilityLedger.json b/schemas/CapabilityLedger.json new file mode 100644 index 0000000..1f02060 --- /dev/null +++ b/schemas/CapabilityLedger.json @@ -0,0 +1,52 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://schemas.srcos.ai/v2/CapabilityLedger.json", + "title": "CapabilityLedger", + "description": "Effective capability-state record after reconciling config, UI, runtime, server, plugin, policy, schema, and transport claims.", + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "type", + "specVersion", + "capabilityRef", + "declaredBy", + "negotiatedBy", + "effectiveState", + "policyDecisionRef", + "evidenceRefs", + "capturedAt" + ], + "properties": { + "id": { "type": "string", "pattern": "^urn:srcos:capability-ledger:" }, + "type": { "const": "CapabilityLedger" }, + "specVersion": { "type": "string" }, + "capabilityRef": { "type": "string", "pattern": "^urn:srcos:capability:" }, + "declaredBy": { + "type": "array", + "minItems": 1, + "items": { + "type": "string", + "enum": ["config", "ui", "runtime", "server", "plugin", "policy", "schema", "transport", "user", "agent", "workspace"] + } + }, + "negotiatedBy": { + "type": "array", + "minItems": 1, + "items": { + "type": "string", + "enum": ["config", "ui", "runtime", "server", "plugin", "policy", "schema", "transport", "user", "agent", "workspace"] + } + }, + "effectiveState": { + "type": "string", + "enum": ["declared", "requested", "negotiating", "available", "enabled", "degraded", "blocked_by_policy", "unsupported_by_runtime", "unsupported_by_server", "missing_plugin", "missing_schema", "failed"] + }, + "stateReason": { "type": ["string", "null"] }, + "ownerRefs": { "type": "array", "items": { "type": "string" } }, + "conflictRefs": { "type": "array", "items": { "type": "string" } }, + "policyDecisionRef": { "type": "string", "pattern": "^urn:srcos:decision:" }, + "evidenceRefs": { "type": "array", "items": { "type": "string" } }, + "capturedAt": { "type": "string", "format": "date-time" } + } +} diff --git a/schemas/GitWorkspaceState.json b/schemas/GitWorkspaceState.json new file mode 100644 index 0000000..cbc2d82 --- /dev/null +++ b/schemas/GitWorkspaceState.json @@ -0,0 +1,228 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://schemas.srcos.ai/v2/GitWorkspaceState.json", + "title": "GitWorkspaceState", + "description": "Typed terminal/workspace Git-state classification emitted before passive Git discovery or user-requested Git operations, with severity discipline, redacted path evidence, session linkage, and capability-ledger linkage.", + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "type", + "specVersion", + "sessionRef", + "capabilityLedgerRef", + "workspaceRef", + "state", + "severity", + "operation", + "actionability", + "pathEvidence", + "gitFacts", + "policyDecisionRef", + "evidenceRefs", + "capturedAt" + ], + "properties": { + "id": { + "type": "string", + "pattern": "^urn:srcos:git-workspace-state:" + }, + "type": { + "const": "GitWorkspaceState" + }, + "specVersion": { + "type": "string" + }, + "sessionRef": { + "type": "string", + "pattern": "^urn:srcos:session:" + }, + "capabilityLedgerRef": { + "type": "string", + "pattern": "^urn:srcos:capability-ledger:" + }, + "agentMachineReceiptRef": { + "type": [ + "string", + "null" + ], + "pattern": "^urn:srcos:agent-machine-receipt:" + }, + "workspaceRef": { + "type": "string", + "pattern": "^urn:srcos:workspace:" + }, + "state": { + "type": "string", + "enum": [ + "not_a_repo", + "repo_root", + "inside_worktree", + "inside_git_dir", + "bare_repo", + "worktree_no_remote", + "detached_head", + "corrupt_repo", + "permission_denied", + "operation_superseded" + ] + }, + "severity": { + "type": "string", + "enum": [ + "debug", + "info", + "warning", + "error" + ] + }, + "operation": { + "type": "string", + "enum": [ + "passive_discovery", + "watcher_refresh", + "user_requested_command", + "agent_requested_command", + "ci_validation" + ] + }, + "actionability": { + "type": "string", + "enum": [ + "none", + "remediation_hint", + "blocked", + "quarantined" + ] + }, + "pathEvidence": { + "type": "object", + "additionalProperties": false, + "required": [ + "pathDigest", + "redaction", + "rawPathStored" + ], + "properties": { + "pathDigest": { + "type": "string", + "pattern": "^sha256:[a-fA-F0-9]{64}$" + }, + "redactedPathHint": { + "type": [ + "string", + "null" + ] + }, + "redaction": { + "type": "string", + "enum": [ + "none", + "user_home_redacted", + "workspace_alias", + "digest_only" + ] + }, + "rawPathStored": { + "type": "boolean", + "const": false + } + } + }, + "gitFacts": { + "type": "object", + "additionalProperties": false, + "required": [ + "branch", + "headSha", + "remoteState", + "worktreeRootDigest", + "gitDirDigest" + ], + "properties": { + "branch": { + "type": [ + "string", + "null" + ] + }, + "headSha": { + "type": [ + "string", + "null" + ], + "pattern": "^[a-fA-F0-9]{7,40}$" + }, + "remoteState": { + "type": "string", + "enum": [ + "available", + "missing", + "not_applicable", + "error", + "unknown" + ] + }, + "worktreeRootDigest": { + "type": [ + "string", + "null" + ], + "pattern": "^sha256:[a-fA-F0-9]{64}$" + }, + "gitDirDigest": { + "type": [ + "string", + "null" + ], + "pattern": "^sha256:[a-fA-F0-9]{64}$" + }, + "failureReason": { + "type": [ + "string", + "null" + ] + }, + "commandClass": { + "type": [ + "string", + "null" + ], + "enum": [ + "config", + "rev_parse", + "symbolic_ref", + "for_each_ref", + "status", + "remote", + "watcher", + null + ] + } + } + }, + "expectedNegativeState": { + "type": "boolean" + }, + "causalRefs": { + "type": "array", + "items": { + "type": "string" + } + }, + "policyDecisionRef": { + "type": "string", + "pattern": "^urn:srcos:decision:" + }, + "evidenceRefs": { + "type": "array", + "items": { + "type": "string" + } + }, + "capturedAt": { + "type": "string", + "format": "date-time" + } + } +} diff --git a/schemas/OrphanEventReceipt.json b/schemas/OrphanEventReceipt.json new file mode 100644 index 0000000..e903612 --- /dev/null +++ b/schemas/OrphanEventReceipt.json @@ -0,0 +1,54 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://schemas.srcos.ai/v2/OrphanEventReceipt.json", + "title": "OrphanEventReceipt", + "description": "Receipt for lifecycle events that could not initially attach to a known session DAG node and were recovered or quarantined with evidence.", + "type": "object", + "additionalProperties": false, + "required": ["id", "type", "specVersion", "eventRef", "eventClass", "observedAt", "sessionResolution", "ttl", "policyDecisionRef", "evidenceRefs", "capturedAt"], + "properties": { + "id": { "type": "string", "pattern": "^urn:srcos:receipt:orphan-event:" }, + "type": { "const": "OrphanEventReceipt" }, + "specVersion": { "type": "string" }, + "eventRef": { "type": "string", "pattern": "^urn:srcos:event:" }, + "eventClass": { "type": "string", "enum": ["agent_lifecycle", "runtime_lifecycle", "browser_automation", "terminal_workspace", "plugin", "transport", "unknown"] }, + "observedAt": { "type": "string", "format": "date-time" }, + "rawEventDigest": { "type": "string", "pattern": "^sha256:[a-fA-F0-9]{64}$" }, + "sessionResolution": { + "type": "object", + "additionalProperties": false, + "required": ["state", "candidateSessionRefs", "recoveredSessionRef", "recoveredDagNodeRef", "reconciledAt", "quarantinedAt"], + "properties": { + "state": { "type": "string", "enum": ["queued", "recovered", "quarantined", "discarded_duplicate"] }, + "candidateSessionRefs": { "type": "array", "items": { "type": "string", "pattern": "^urn:srcos:session:" } }, + "recoveredSessionRef": { "type": ["string", "null"], "pattern": "^urn:srcos:session:" }, + "recoveredDagNodeRef": { "type": ["string", "null"], "pattern": "^urn:srcos:session-dag-node:" }, + "reconciledAt": { "type": ["string", "null"], "format": "date-time" }, + "quarantinedAt": { "type": ["string", "null"], "format": "date-time" } + } + }, + "ttl": { + "type": "object", + "additionalProperties": false, + "required": ["expiresAt", "expired"], + "properties": { + "expiresAt": { "type": "string", "format": "date-time" }, + "expired": { "type": "boolean" } + } + }, + "correlationKeys": { + "type": "object", + "additionalProperties": false, + "properties": { + "conversationId": { "type": ["string", "null"] }, + "parentId": { "type": ["string", "null"] }, + "workspaceRef": { "type": ["string", "null"], "pattern": "^urn:srcos:workspace:" }, + "taskRef": { "type": ["string", "null"] } + } + }, + "causalRefs": { "type": "array", "items": { "type": "string" } }, + "policyDecisionRef": { "type": "string", "pattern": "^urn:srcos:decision:" }, + "evidenceRefs": { "type": "array", "items": { "type": "string" } }, + "capturedAt": { "type": "string", "format": "date-time" } + } +}