{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://raw.githubusercontent.com/mirivlad/verstak-sdk/main/schemas/sync.json", "title": "Verstak core sync operation log", "description": "Wire contracts for the core-owned operation log. Plugins may configure and display sync, but do not create operations.", "type": "object", "properties": { "Operation": { "$ref": "#/$defs/Operation" }, "PushRequest": { "$ref": "#/$defs/PushRequest" }, "PullResponse": { "$ref": "#/$defs/PullResponse" }, "Snapshot": { "$ref": "#/$defs/Snapshot" }, "PairingRequest": { "$ref": "#/$defs/PairingRequest" } }, "$defs": { "Operation": { "type": "object", "required": ["op_id", "device_id", "entity_type", "entity_id", "op_type", "payload_json", "created_at"], "properties": { "op_id": { "type": "string", "minLength": 1 }, "server_sequence": { "type": "integer", "minimum": 1 }, "device_id": { "type": "string" }, "entity_type": { "enum": ["file", "folder", "workspace"] }, "entity_id": { "type": "string", "minLength": 1 }, "op_type": { "enum": ["create", "update", "delete", "move", "rename", "trash", "restore"] }, "payload_json": { "type": "string" }, "created_at": { "type": "string", "format": "date-time" }, "client_sequence": { "type": "integer", "minimum": 0 }, "last_seen_server_seq": { "type": "integer", "minimum": 0 } }, "additionalProperties": false }, "FilePayload": { "type": "object", "required": ["path"], "properties": { "path": { "$ref": "#/$defs/VaultPath" }, "content": { "type": "string" }, "dataBase64": { "type": "string", "contentEncoding": "base64" }, "contentHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" }, "fromPath": { "$ref": "#/$defs/VaultPath" }, "toPath": { "$ref": "#/$defs/VaultPath" } }, "additionalProperties": false }, "WorkspacePayload": { "type": "object", "required": ["workspaceId", "path", "name"], "properties": { "workspaceId": { "type": "string", "format": "uuid" }, "path": { "$ref": "#/$defs/WorkspacePath" }, "previousPath": { "$ref": "#/$defs/WorkspacePath" }, "name": { "type": "string", "minLength": 1 }, "metadata": { "type": "object", "additionalProperties": true } }, "additionalProperties": false }, "PushRequest": { "type": "object", "required": ["device_id", "ops"], "properties": { "device_id": { "type": "string", "minLength": 1 }, "idempotency_key": { "type": "string" }, "ops": { "type": "array", "items": { "$ref": "#/$defs/PushOperation" } } }, "additionalProperties": false }, "PullResponse": { "type": "object", "required": ["server_sequence", "ops"], "properties": { "server_sequence": { "type": "integer", "minimum": 0 }, "ops": { "type": "array", "items": { "$ref": "#/$defs/Operation" } } }, "additionalProperties": false }, "PushOperation": { "type": "object", "required": ["op_id", "entity_type", "entity_id", "op_type", "payload_json", "created_at"], "properties": { "op_id": { "type": "string", "minLength": 1 }, "entity_type": { "enum": ["file", "folder", "workspace"] }, "entity_id": { "type": "string", "minLength": 1 }, "op_type": { "enum": ["create", "update", "delete", "move", "rename", "trash", "restore"] }, "payload_json": { "type": "string" }, "created_at": { "type": "string", "format": "date-time" }, "client_sequence": { "type": "integer", "minimum": 0 }, "last_seen_server_seq": { "type": "integer", "minimum": 0 } }, "additionalProperties": false }, "SnapshotEntry": { "type": "object", "required": ["path", "type", "size", "modifiedAt"], "properties": { "path": { "$ref": "#/$defs/VaultPath" }, "type": { "enum": ["file", "folder"] }, "size": { "type": "integer", "minimum": 0 }, "modifiedAt": { "type": "string", "format": "date-time" }, "hash": { "type": "string", "pattern": "^[a-f0-9]{64}$" } }, "additionalProperties": false }, "Snapshot": { "type": "object", "required": ["version", "entries"], "properties": { "version": { "type": "integer", "minimum": 1 }, "entries": { "type": "object", "additionalProperties": { "$ref": "#/$defs/SnapshotEntry" } }, "unresolved": { "type": "object", "additionalProperties": { "type": "string" } } }, "additionalProperties": true }, "PairingRequest": { "type": "object", "required": ["login", "password", "device_name", "vault_id"], "properties": { "login": { "type": "string", "minLength": 1 }, "password": { "type": "string", "minLength": 1 }, "device_name": { "type": "string", "minLength": 1 }, "client_version": { "type": "string" }, "vault_id": { "type": "string", "minLength": 1 } }, "additionalProperties": false }, "VaultPath": { "type": "string", "minLength": 1, "not": { "pattern": "(^|/)\\.verstak(/|$)" } }, "WorkspacePath": { "type": "string", "minLength": 1, "pattern": "^[^/]+$" } } }