/** * JSON Schema declarations for the RemoteWorker WebSocket protocol contract. * * These schemas are the canonical wire-shape description for every protocol * message. They are re-exported from `@lostgradient/weft/worker-protocol` so the public * surface remains a single import path. The runtime parser guards in * `protocol.ts` mirror these schemas field-by-field; any drift here must be * reflected there as well. * * @module worker/protocol-schemas */ type JsonSchemaObject = { readonly [key: string]: unknown; }; /** * JSON Schema for every RemoteWorker protocol message, keyed by message type. * * @example * ```ts * import { REMOTE_WORKER_MESSAGE_SCHEMAS } from '@lostgradient/weft/worker-protocol'; * * const registerSchema = REMOTE_WORKER_MESSAGE_SCHEMAS.register; * ``` */ export declare const REMOTE_WORKER_MESSAGE_SCHEMAS: { readonly register: { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type", "protocolVersion", "workerId", "manifest"]; readonly properties: { readonly type: { readonly const: "register"; }; readonly protocolVersion: JsonSchemaObject; readonly workerId: { readonly type: "string"; readonly minLength: 1; }; readonly manifest: { readonly type: "object"; }; readonly concurrency: { readonly type: "number"; readonly minimum: 1; readonly maximum: 1000; }; readonly startedAt: { readonly type: "number"; }; }; }; readonly heartbeat: { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type", "workerId"]; readonly properties: { readonly type: { readonly const: "heartbeat"; }; readonly workerId: { readonly type: "string"; readonly minLength: 1; }; }; }; readonly taskResult: { readonly oneOf: readonly [{ readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type", "operationId", "status", "value", "attemptToken"]; readonly properties: { readonly type: { readonly const: "taskResult"; }; readonly operationId: { readonly type: "string"; readonly minLength: 1; }; readonly status: { readonly const: "completed"; }; readonly value: JsonSchemaObject; readonly attemptToken: { readonly type: "string"; readonly minLength: 1; }; readonly workflowRevision: { readonly type: "string"; readonly minLength: 1; }; }; }, { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type", "operationId", "status", "error", "attemptToken"]; readonly properties: { readonly type: { readonly const: "taskResult"; }; readonly operationId: { readonly type: "string"; readonly minLength: 1; }; readonly status: { readonly const: "failed"; }; readonly error: { readonly type: "string"; }; readonly attemptToken: { readonly type: "string"; readonly minLength: 1; }; readonly workflowRevision: { readonly type: "string"; readonly minLength: 1; }; }; }, { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type", "operationId", "status", "error", "attemptToken"]; readonly properties: { readonly type: { readonly const: "taskResult"; }; readonly operationId: { readonly type: "string"; readonly minLength: 1; }; readonly status: { readonly const: "cancelled"; }; readonly error: { readonly type: "string"; }; readonly cancelled: { readonly const: true; }; readonly attemptToken: { readonly type: "string"; readonly minLength: 1; }; readonly workflowRevision: { readonly type: "string"; readonly minLength: 1; }; }; }]; }; readonly task: { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type", "operationId", "activityName", "input", "attemptToken"]; readonly properties: { readonly type: { readonly const: "task"; }; readonly operationId: { readonly type: "string"; readonly minLength: 1; }; readonly activityName: { readonly type: "string"; readonly minLength: 1; }; readonly input: JsonSchemaObject; readonly attempt: { readonly type: "number"; readonly minimum: 1; }; readonly headers: JsonSchemaObject; readonly workflowExecutionToken: { readonly type: "string"; readonly minLength: 1; }; readonly workflowRevision: { readonly type: "string"; readonly minLength: 1; }; readonly attemptToken: { readonly type: "string"; readonly minLength: 1; }; }; }; readonly cancel: { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type", "operationId"]; readonly properties: { readonly type: { readonly const: "cancel"; }; readonly operationId: { readonly type: "string"; readonly minLength: 1; }; }; }; readonly shutdown: { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type"]; readonly properties: { readonly type: { readonly const: "shutdown"; }; }; }; readonly registerAck: { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type", "protocolVersion", "workerId", "queue", "concurrency", "acceptedManifestDigest", "serverCapabilities"]; readonly properties: { readonly type: { readonly const: "registerAck"; }; readonly protocolVersion: JsonSchemaObject; readonly workerId: { readonly type: "string"; readonly minLength: 1; }; readonly queue: { readonly type: "string"; readonly minLength: 1; }; readonly concurrency: { readonly type: "number"; readonly minimum: 1; readonly maximum: 1000; }; readonly acceptedManifestDigest: { readonly type: "string"; readonly minLength: 1; }; readonly serverCapabilities: { readonly type: "array"; readonly items: { readonly type: "string"; readonly minLength: 1; }; }; }; }; readonly registerError: { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type", "code", "message", "supportedProtocolVersions"]; readonly properties: { readonly type: { readonly const: "registerError"; }; readonly code: { readonly enum: readonly ["invalid_registration", "unsupported_protocol_version", "deployment_conflict", "registration_rejected"]; }; readonly message: { readonly type: "string"; }; readonly supportedProtocolVersions: { readonly type: "array"; readonly items: { readonly type: "number"; }; }; readonly requestedProtocolVersion: { readonly type: "number"; }; }; }; readonly protocolError: { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type", "code", "message"]; readonly properties: { readonly type: { readonly const: "protocolError"; }; readonly code: { readonly enum: readonly ["invalid_json", "invalid_message", "unknown_message_type", "registration_required"]; }; readonly message: { readonly type: "string"; }; }; }; }; /** * Complete RemoteWorker protocol JSON Schema document. * * @example * ```ts * import { REMOTE_WORKER_PROTOCOL_JSON_SCHEMA } from '@lostgradient/weft/worker-protocol'; * * const schemaId = REMOTE_WORKER_PROTOCOL_JSON_SCHEMA.$id; * ``` */ export declare const REMOTE_WORKER_PROTOCOL_JSON_SCHEMA: { readonly $schema: "https://json-schema.org/draft/2020-12/schema"; readonly $id: `https://weft.dev/schemas/remote-worker-protocol.v${string}.json`; readonly title: `Weft RemoteWorker Protocol v${string}`; readonly oneOf: { $ref: string; }[]; readonly $defs: { readonly jsonValue: { readonly oneOf: readonly [{ readonly type: "null"; }, { readonly type: "boolean"; }, { readonly type: "number"; }, { readonly type: "string"; }, { readonly type: "array"; readonly items: { readonly $ref: "#/$defs/jsonValue"; }; }, { readonly type: "object"; readonly additionalProperties: { readonly $ref: "#/$defs/jsonValue"; }; }]; }; readonly jsonObject: JsonSchemaObject; readonly messages: { readonly register: { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type", "protocolVersion", "workerId", "manifest"]; readonly properties: { readonly type: { readonly const: "register"; }; readonly protocolVersion: JsonSchemaObject; readonly workerId: { readonly type: "string"; readonly minLength: 1; }; readonly manifest: { readonly type: "object"; }; readonly concurrency: { readonly type: "number"; readonly minimum: 1; readonly maximum: 1000; }; readonly startedAt: { readonly type: "number"; }; }; }; readonly heartbeat: { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type", "workerId"]; readonly properties: { readonly type: { readonly const: "heartbeat"; }; readonly workerId: { readonly type: "string"; readonly minLength: 1; }; }; }; readonly taskResult: { readonly oneOf: readonly [{ readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type", "operationId", "status", "value", "attemptToken"]; readonly properties: { readonly type: { readonly const: "taskResult"; }; readonly operationId: { readonly type: "string"; readonly minLength: 1; }; readonly status: { readonly const: "completed"; }; readonly value: JsonSchemaObject; readonly attemptToken: { readonly type: "string"; readonly minLength: 1; }; readonly workflowRevision: { readonly type: "string"; readonly minLength: 1; }; }; }, { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type", "operationId", "status", "error", "attemptToken"]; readonly properties: { readonly type: { readonly const: "taskResult"; }; readonly operationId: { readonly type: "string"; readonly minLength: 1; }; readonly status: { readonly const: "failed"; }; readonly error: { readonly type: "string"; }; readonly attemptToken: { readonly type: "string"; readonly minLength: 1; }; readonly workflowRevision: { readonly type: "string"; readonly minLength: 1; }; }; }, { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type", "operationId", "status", "error", "attemptToken"]; readonly properties: { readonly type: { readonly const: "taskResult"; }; readonly operationId: { readonly type: "string"; readonly minLength: 1; }; readonly status: { readonly const: "cancelled"; }; readonly error: { readonly type: "string"; }; readonly cancelled: { readonly const: true; }; readonly attemptToken: { readonly type: "string"; readonly minLength: 1; }; readonly workflowRevision: { readonly type: "string"; readonly minLength: 1; }; }; }]; }; readonly task: { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type", "operationId", "activityName", "input", "attemptToken"]; readonly properties: { readonly type: { readonly const: "task"; }; readonly operationId: { readonly type: "string"; readonly minLength: 1; }; readonly activityName: { readonly type: "string"; readonly minLength: 1; }; readonly input: JsonSchemaObject; readonly attempt: { readonly type: "number"; readonly minimum: 1; }; readonly headers: JsonSchemaObject; readonly workflowExecutionToken: { readonly type: "string"; readonly minLength: 1; }; readonly workflowRevision: { readonly type: "string"; readonly minLength: 1; }; readonly attemptToken: { readonly type: "string"; readonly minLength: 1; }; }; }; readonly cancel: { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type", "operationId"]; readonly properties: { readonly type: { readonly const: "cancel"; }; readonly operationId: { readonly type: "string"; readonly minLength: 1; }; }; }; readonly shutdown: { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type"]; readonly properties: { readonly type: { readonly const: "shutdown"; }; }; }; readonly registerAck: { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type", "protocolVersion", "workerId", "queue", "concurrency", "acceptedManifestDigest", "serverCapabilities"]; readonly properties: { readonly type: { readonly const: "registerAck"; }; readonly protocolVersion: JsonSchemaObject; readonly workerId: { readonly type: "string"; readonly minLength: 1; }; readonly queue: { readonly type: "string"; readonly minLength: 1; }; readonly concurrency: { readonly type: "number"; readonly minimum: 1; readonly maximum: 1000; }; readonly acceptedManifestDigest: { readonly type: "string"; readonly minLength: 1; }; readonly serverCapabilities: { readonly type: "array"; readonly items: { readonly type: "string"; readonly minLength: 1; }; }; }; }; readonly registerError: { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type", "code", "message", "supportedProtocolVersions"]; readonly properties: { readonly type: { readonly const: "registerError"; }; readonly code: { readonly enum: readonly ["invalid_registration", "unsupported_protocol_version", "deployment_conflict", "registration_rejected"]; }; readonly message: { readonly type: "string"; }; readonly supportedProtocolVersions: { readonly type: "array"; readonly items: { readonly type: "number"; }; }; readonly requestedProtocolVersion: { readonly type: "number"; }; }; }; readonly protocolError: { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["type", "code", "message"]; readonly properties: { readonly type: { readonly const: "protocolError"; }; readonly code: { readonly enum: readonly ["invalid_json", "invalid_message", "unknown_message_type", "registration_required"]; }; readonly message: { readonly type: "string"; }; }; }; }; }; }; export {};