{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://git.benstull.org/benstull/vscode-cowriting-plugin/schemas/coauthoring-sidecar.schema.json", "title": "Coauthoring sidecar artifact — cross-rung contract, schemaVersion 1", "description": "Machine-checkable half of the cross-rung contract (vscode-cowriting-plugin-content/specs/coauthoring-sidecar-contract.md — the prose contract is normative, INV-14). Unknown fields are deliberately allowed at every level: minor versions are additive and conforming writers preserve fields they do not recognize (INV-15/INV-16).", "type": "object", "required": ["schemaVersion", "document", "anchors", "threads", "attributions", "proposals"], "properties": { "schemaVersion": { "type": "integer", "minimum": 1 }, "document": { "type": "object", "required": ["path"], "properties": { "path": { "type": "string", "minLength": 1 } } }, "anchors": { "type": "object", "additionalProperties": { "$ref": "#/$defs/anchor" } }, "threads": { "type": "array", "items": { "$ref": "#/$defs/thread" } }, "attributions": { "type": "array", "items": { "$ref": "#/$defs/attribution" } }, "proposals": { "type": "array", "items": { "$ref": "#/$defs/proposal" } } }, "$defs": { "fingerprint": { "type": "object", "required": ["text", "before", "after", "lineHint"], "properties": { "text": { "type": "string" }, "before": { "type": "string" }, "after": { "type": "string" }, "lineHint": { "type": "integer", "minimum": 0 } } }, "anchor": { "type": "object", "required": ["fingerprint"], "properties": { "fingerprint": { "$ref": "#/$defs/fingerprint" } } }, "onBehalfOf": { "type": "object", "required": ["id"], "properties": { "id": { "type": "string" }, "email": { "type": "string" } } }, "agentPayload": { "type": "object", "required": ["sdk", "model", "sessionId"], "properties": { "sdk": { "type": "string" }, "model": { "type": "string" }, "sessionId": { "type": "string" }, "onBehalfOf": { "$ref": "#/$defs/onBehalfOf" } } }, "provenance": { "type": "object", "required": ["kind", "id"], "properties": { "kind": { "enum": ["human", "agent"] }, "id": { "type": "string" }, "email": { "type": "string" }, "agent": { "$ref": "#/$defs/agentPayload" } }, "if": { "properties": { "kind": { "const": "agent" } } }, "then": { "required": ["kind", "id", "agent"] } }, "message": { "type": "object", "required": ["id", "author", "body", "createdAt"], "properties": { "id": { "type": "string" }, "author": { "$ref": "#/$defs/provenance" }, "body": { "type": "string" }, "createdAt": { "type": "string" } } }, "thread": { "type": "object", "required": ["id", "anchorId", "status", "messages"], "properties": { "id": { "type": "string" }, "anchorId": { "type": "string" }, "status": { "enum": ["open", "resolved"] }, "messages": { "type": "array", "items": { "$ref": "#/$defs/message" } } } }, "attribution": { "type": "object", "required": ["id", "anchorId", "author", "createdAt", "updatedAt"], "properties": { "id": { "type": "string" }, "anchorId": { "type": "string" }, "author": { "$ref": "#/$defs/provenance" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "turnId": { "type": "string" } } }, "proposal": { "type": "object", "required": ["id", "anchorId", "replacement", "author", "createdAt"], "properties": { "id": { "type": "string" }, "anchorId": { "type": "string" }, "replacement": { "type": "string" }, "author": { "$ref": "#/$defs/provenance" }, "createdAt": { "type": "string" }, "turnId": { "type": "string" }, "instruction": { "type": "string" } } } } }