@ai-matrx/desktop-protocol 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/schema/primitives.ts","../src/schema/errors.ts","../src/schema/frame.ts","../src/error.ts","../src/frame.ts","../src/schema/envelope.ts","../src/schema/sysinfo.ts","../src/schema/fs.ts","../src/schema/exec.ts","../src/schema/session.ts","../src/schema/relay.ts","../src/schema/models.ts","../src/schema/apps.ts","../src/schema/service.ts","../src/schema/tools.ts","../src/schema/registry.ts","../src/versioning.ts","../src/contract.ts","../src/close-policy.ts","../src/tools/catalog.ts","../src/tools/status.ts"],"sourcesContent":["/**\n * `@ai-matrx/desktop-protocol` — the one wire contract between Matrx 2 (the desktop core) and every\n * client (phone, web app, extension, server). SPEC P11: this zod source is THE source; the JSON\n * Schema in generated/ and the Pydantic models in aidream/_generated/desktop_protocol.py are\n * generated from it and CI fails on any drift (`pnpm generate --check`).\n *\n * Entries: `.` (schemas, OPS, EVENTS, error codes) · `./frame` (binary frame codec, zod-free)\n * · `./client` (reconnecting request/stream/credit/reattach client) · `./react` (hooks).\n */\nexport * from \"./schema/primitives\";\nexport * from \"./schema/errors\";\nexport * from \"./schema/frame\";\nexport * from \"./schema/envelope\";\nexport * from \"./schema/sysinfo\";\nexport * from \"./schema/fs\";\nexport * from \"./schema/exec\";\nexport * from \"./schema/session\";\nexport * from \"./schema/relay\";\nexport * from \"./schema/models\";\nexport * from \"./schema/apps\";\nexport * from \"./schema/service\";\nexport * from \"./schema/tools\";\nexport * from \"./schema/registry\";\nexport * from \"./versioning\";\nexport * from \"./contract\";\nexport * from \"./close-policy\";\nexport * from \"./tools/catalog\";\nexport * from \"./tools/status\";\nexport {\n FRAME_HEADER_BYTES,\n FRAME_STRUCT_FORMAT,\n FRAME_VERSION,\n FrameChannel,\n FrameFlag,\n decodeFrame,\n encodeFrame,\n stampCid,\n readCid,\n hasFlag,\n assertFrameHeader,\n BROADCAST_CID,\n connectionEndFrame,\n isConnectionEnd,\n} from \"./frame\";\nexport type { DecodedFrame, FrameChannelValue } from \"./frame\";\nexport { DesktopProtocolError, isDesktopProtocolError } from \"./error\";\nexport type { ErrorCodeName, ErrorData, ErrorReasonName } from \"./types\";\n","/** @ai-matrx/desktop-protocol — version and primitive schemas. Schema source: lint-enforced rules in scripts/check-schema-source.mjs. */\nimport { z } from \"zod\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Version\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const PROTOCOL_MAJOR = 1 as const;\n/**\n * Minor history (same major = compatible; see src/versioning.ts for the rule and FIELDS_SINCE):\n * 1.0 — the first contract.\n * 1.1 — fs.patch per-edit results; /call reports the negotiated version;\n * device status since_ms is null for a device that never connected.\n * 1.2 — the `models` capability (local transcription) and its error reasons (REASONS_SINCE);\n * the `apps` capability (desktop apps, their profiles and usage).\n */\nexport const PROTOCOL_MINOR = 2 as const;\n/** This package's version as the wire spells it (\"major.minor\"): hello, welcome, relay status. */\nexport const PROTOCOL_VERSION = `${PROTOCOL_MAJOR}.${PROTOCOL_MINOR}` as const;\n/** \"major.minor\". Same major = compatible (minor adds optional fields/ops only). */\nexport const ProtocolVersion = z\n .string()\n .regex(/^[1-9][0-9]{0,2}\\.[0-9]{1,3}$/);\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Primitives\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Client-generated request id, unique per session. */\nexport const RequestId = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[A-Za-z0-9_-]+$/);\n\n/** Long-lived resource handle minted by the core: \"<kind>_<base62>\" (pty_…, watch_…). */\nexport const ResourceId = z\n .string()\n .regex(/^(pty|watch)_[A-Za-z0-9]{16,40}$/);\n\n/**\n * = app_instances.id. A plain pattern, NOT z.uuid(): z.uuid() emits `format: uuid` + `pattern`,\n * which datamodel-codegen renders as `Annotated[UUID, Field(pattern=...)]` — a model Pydantic can\n * never validate (\"Unable to apply constraint 'pattern' … of type 'uuid'\"). generate.ts now\n * refuses format+pattern on one node so this class cannot come back.\n */\nexport const DeviceId = z\n .string()\n .regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/);\n\n/**\n * Absolute, normalized path: forward slashes on every OS, NFC. POSIX \"/...\" or Windows \"C:/...\".\n * Normalization happens once, in the fs owner (SPEC §9); the wire never carries backslashes.\n */\nexport const AbsPath = z\n .string()\n .min(1)\n .max(4096)\n .regex(/^(\\/|[A-Za-z]:\\/)[^\\\\\\u0000]*$/);\n\n/** Internal building blocks — deliberately unnamed in $defs (inlined wherever used). */\nexport const u32 = z.int().min(0).max(4_294_967_295);\nexport const nonNegInt = z.int().min(0);\n/** Unix epoch milliseconds. */\nexport const epochMs = z.int().min(0);\n\n// Inferred (output) types — same name as the schema, so `FsEntry` is both the validator and its type.\nexport type ProtocolVersion = z.output<typeof ProtocolVersion>;\nexport type RequestId = z.output<typeof RequestId>;\nexport type ResourceId = z.output<typeof ResourceId>;\nexport type DeviceId = z.output<typeof DeviceId>;\nexport type AbsPath = z.output<typeof AbsPath>;\n","/** @ai-matrx/desktop-protocol — error model (SPEC §5). Schema source: lint-enforced rules in scripts/check-schema-source.mjs. */\nimport { z } from \"zod\";\nimport type { ErrorCodeName, ErrorData, ErrorReasonName } from \"../types\";\nimport { AbsPath, ProtocolVersion, nonNegInt } from \"./primitives\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Errors (SPEC §5, plus the five additions marked NEW)\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const ErrorCode = z\n .enum([\n \"AUTH_REQUIRED\",\n \"AUTH_INVALID\",\n \"AUTH_EXPIRED\",\n \"AUTH_FORBIDDEN\", // signed in, but not this device's owner\n \"AUTH_DEVICE_REVOKED\", // kill switch\n \"PERMISSION_DENIED_OS\",\n \"NOT_FOUND\",\n \"CONFLICT\",\n \"INVALID_PARAMS\",\n \"RESOURCE_BUSY\",\n \"RESOURCE_GONE\",\n \"CANCELLED\",\n \"TIMEOUT\",\n \"PLATFORM_UNSUPPORTED\",\n \"RATE_LIMITED\",\n \"INTERNAL\",\n \"PROTOCOL_VERSION_UNSUPPORTED\", // NEW: hello refused, carries data.upgrade\n \"PROTOCOL_ERROR\", // NEW: malformed envelope/frame, credit overrun, unknown sid\n \"UNKNOWN_OPERATION\", // NEW: cap.op not served by this core version\n \"DEVICE_OFFLINE\", // NEW: relay has no live device socket (retryable)\n \"PAYLOAD_TOO_LARGE\", // NEW: message or frame above limits.max_*_bytes\n ]);\n\n/** Machine reason under a code, so clients branch without parsing messages. */\nexport const ErrorReason = z\n .enum([\n \"not_a_directory\",\n \"is_a_directory\",\n \"directory_not_empty\",\n \"already_exists\",\n \"stale_write\", // fs.write if_match_mtime_ms mismatch → CONFLICT\n \"binary_content\", // utf8 read of non-UTF-8 bytes → INVALID_PARAMS\n \"not_utf8_boundary\",\n \"patch_no_match\",\n \"patch_ambiguous\",\n \"resource_exited\",\n \"resource_expired\",\n \"control_taken\", // another client of the same user took control\n \"window_exhausted\",\n // 1.2 (REASONS_SINCE): the `models` capability and its supervised Python service\n \"runtime_not_installed\", // NOT_FOUND: install the inference runtime first (models.install)\n \"model_not_installed\", // NOT_FOUND: that model's weights are not on the device\n \"unsupported_media\", // INVALID_PARAMS: the file is not audio or video the decoder reads\n \"download_failed\", // install could not fetch a package or model file\n \"service_starting\", // RESOURCE_BUSY (retryable): the service is starting or restarting\n \"service_restarted\", // RESOURCE_GONE: the service died while this request ran\n \"service_failed\", // INTERNAL: the service could not be started (see models.status)\n ]);\n\n/**\n * One edit fs.patch could not apply — the daemon's `edits_failed[]` entry, verbatim: the edit's\n * index and the daemon's own reason text (\"old_text not found\", or \"old_text matches N locations —\n * add context or set replace_all=True\").\n */\nexport const FsPatchEditFailure = z.strictObject({ edit_index: nonNegInt, reason: z.string().max(300) });\n\nexport const ProtocolErrorBody = z\n .strictObject({\n code: ErrorCode,\n message: z.string().max(300), // short, human, never a stack trace or a token\n retryable: z.boolean(),\n data: z\n .strictObject({\n reason: ErrorReason.optional(),\n cap: z.string().max(32).optional(),\n op: z.string().max(64).optional(),\n path: AbsPath.optional(),\n settings_url: z.string().max(512).optional(), // PERMISSION_DENIED_OS deep link\n retry_after_ms: nonNegInt.optional(),\n limit_bytes: nonNegInt.optional(),\n /** fs.patch when every edit failed (CONFLICT, patch_no_match / patch_ambiguous): the daemon's 422 `failures`. */\n edits_failed: z.array(FsPatchEditFailure).max(256).optional(),\n upgrade: z\n .strictObject({\n min_version: ProtocolVersion,\n max_version: ProtocolVersion,\n download_url: z.url().optional(),\n })\n .optional(),\n })\n .optional(),\n });\n\n\n// Compile-time proof the zod-free twins in ../types.ts equal these schemas.\ntype Same<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;\ntype AssertTrue<T extends true> = T;\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype ErrorTwinCheck = [\n AssertTrue<Same<z.infer<typeof ErrorCode>, ErrorCodeName>>,\n AssertTrue<Same<z.infer<typeof ErrorReason>, ErrorReasonName>>,\n AssertTrue<Same<NonNullable<z.input<typeof ProtocolErrorBody>[\"data\"]>, ErrorData>>,\n];\n\n// Inferred (output) types — same name as the schema, so `FsEntry` is both the validator and its type.\nexport type ErrorCode = z.output<typeof ErrorCode>;\nexport type ErrorReason = z.output<typeof ErrorReason>;\nexport type ProtocolErrorBody = z.output<typeof ProtocolErrorBody>;\nexport type FsPatchEditFailure = z.output<typeof FsPatchEditFailure>;\n","/** @ai-matrx/desktop-protocol — binary frame header and flow-control constants. Schema source: lint-enforced rules in scripts/check-schema-source.mjs. */\nimport { z } from \"zod\";\nimport { FRAME_VERSION } from \"../frame\";\nimport type { FrameHeader as FrameHeaderShape } from \"../frame\";\nimport { u32 } from \"./primitives\";\n\n/** Zod twin of the codec's FrameHeader (layout documented in src/frame.ts) — for $defs and Pydantic. */\nexport const FrameHeader = z\n .strictObject({\n version: z.literal(FRAME_VERSION),\n flags: z.int().min(0).max(3),\n channel: z.union([z.literal(0), z.literal(1), z.literal(2), z.literal(3), z.literal(255)]),\n cid: u32,\n sid: u32,\n seq: u32,\n });\nexport type FrameHeader = z.infer<typeof FrameHeader>;\n\n/** Relay ↔ device hop: the header of a frame carrying one JSON envelope. cid 0 = broadcast (device → relay). */\nexport const RelayHopEnvelopeHeader = z\n .strictObject({\n version: z.literal(FRAME_VERSION),\n flags: z.literal(0),\n channel: z.literal(255),\n cid: u32,\n sid: z.literal(0),\n seq: z.literal(0),\n });\nexport type RelayHopEnvelopeHeader = z.infer<typeof RelayHopEnvelopeHeader>;\n\n/** Relay ↔ device hop: the header of a connection-end frame (FIN, empty payload; see connectionEndFrame). */\nexport const RelayHopConnectionEnd = z\n .strictObject({\n version: z.literal(FRAME_VERSION),\n flags: z.literal(1),\n channel: z.literal(255),\n cid: z.int().min(1).max(4_294_967_295),\n sid: z.literal(0),\n seq: z.literal(0),\n });\nexport type RelayHopConnectionEnd = z.infer<typeof RelayHopConnectionEnd>;\n\n// Compile-time proof the zod twin and the zod-free codec type are the same shape.\ntype Same<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;\ntype AssertTrue<T extends true> = T;\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype FrameHeaderTwinCheck = AssertTrue<Same<z.infer<typeof FrameHeader>, FrameHeaderShape>>;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Flow control (credits)\n//\n// The RECEIVER of a byte stream grants the SENDER a window in payload bytes. The sender may have at\n// most `window` un-credited payload bytes in flight per sid; it pauses its source (node-pty\n// pause(), file read loop) at zero and resumes on credit. Initial window = request's\n// `window_bytes` or limits.default_window_bytes. The receiver sends credit{n} after it has\n// CONSUMED n bytes (xterm write callback fired, file chunk persisted). Overrun → PROTOCOL_ERROR\n// and the stream is ended. Credits are end-to-end (client↔core), so the relay holds at most\n// sum(windows) per device and never buffers without bound. Unary JSON ops are not credited.\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const DEFAULT_WINDOW_BYTES = 262_144 as const; // 256 KiB\nexport const DEFAULT_MAX_FRAME_PAYLOAD_BYTES = 65_536 as const; // 64 KiB\nexport const DEFAULT_MAX_MESSAGE_BYTES = 8_388_608 as const; // 8 MiB JSON message cap\n\n","/**\n * The one error type every package entry throws. It carries the wire ErrorCode (SPEC §5), so a\n * caller branches on `code`/`retryable`/`data.reason` and never parses a message. Zod-free on\n * purpose: `./frame` (the relay hot path) throws it without pulling the schema graph.\n */\nimport type { ErrorCodeName, ErrorData } from \"./types\";\n\nexport class DesktopProtocolError extends Error {\n readonly code: ErrorCodeName;\n readonly retryable: boolean;\n readonly data: ErrorData | undefined;\n\n constructor(code: ErrorCodeName, message: string, options: { retryable?: boolean; data?: ErrorData; cause?: unknown } = {}) {\n super(message, options.cause === undefined ? undefined : { cause: options.cause });\n this.name = \"DesktopProtocolError\";\n this.code = code;\n this.retryable = options.retryable ?? false;\n this.data = options.data;\n }\n\n /** The wire body (ProtocolErrorBody) — what a core or relay sends for this error. */\n toBody(): { code: ErrorCodeName; message: string; retryable: boolean; data?: ErrorData } {\n return this.data === undefined\n ? { code: this.code, message: this.message, retryable: this.retryable }\n : { code: this.code, message: this.message, retryable: this.retryable, data: this.data };\n }\n}\n\nexport function isDesktopProtocolError(value: unknown): value is DesktopProtocolError {\n return value instanceof DesktopProtocolError || (value instanceof Error && value.name === \"DesktopProtocolError\" && \"code\" in value);\n}\n","/**\n * `@ai-matrx/desktop-protocol/frame` — the 16-byte binary frame codec. ZOD-FREE by design: the\n * relay Worker's hot path imports only this entry and must stay tiny.\n *\n * off size field notes\n * 0 u8 version = 1\n * 1 u8 flags bit0 FIN (last frame of this stream), bit1 REPLAY (from ring buffer),\n * bits2-7 reserved = 0\n * 2 u8 channel see FrameChannel\n * 3 u8 reserved = 0\n * 4 u32 cid relay connection id. 0 on every client↔relay hop; the relay stamps it on\n * the relay→device hop and strips it on the way back (rewrites 4 bytes in\n * place — the relay never parses payloads).\n * 8 u32 sid stream id, announced by the core in stream{meta:{kind:\"open\",sid}}\n * 12 u32 seq per-stream frame sequence, starts at 1, strictly +1\n *\n * Big-endian. Payload length = message length − 16 (one frame = one WS binary message).\n * Python struct format: \">BBBBIII\". The zod twin (FrameHeader in the root entry, and so the JSON\n * Schema and Pydantic model) is checked against this file by src/frame.test.ts.\n */\nimport { DesktopProtocolError } from \"./error\";\n\nexport const FRAME_HEADER_BYTES = 16 as const;\nexport const FRAME_VERSION = 1 as const;\nexport const FRAME_STRUCT_FORMAT = \">BBBBIII\" as const;\nexport const FrameFlag = { FIN: 0b01, REPLAY: 0b10 } as const;\nexport const FrameChannel = {\n /** core→client: pty output, fs.read_stream bytes */\n DATA: 0,\n /** core→client: stderr of a non-pty process (reserved for exec.spawn in v1.1) */\n STDERR: 1,\n /** client→core: keystrokes / stdin to sid */\n STDIN: 2,\n /** core→client: serialized terminal screen (attach when since_seq is outside the ring) */\n SNAPSHOT: 3,\n /** relay↔device hop only: a JSON envelope carried inside a binary frame so the relay can route\n * by cid without parsing JSON. Never seen by clients. */\n ENVELOPE: 255,\n} as const;\n\nexport type FrameChannelValue = (typeof FrameChannel)[keyof typeof FrameChannel];\n\nexport interface FrameHeader {\n version: typeof FRAME_VERSION;\n /** 0..3 — FrameFlag bits. */\n flags: number;\n channel: FrameChannelValue;\n cid: number;\n sid: number;\n seq: number;\n}\n\nexport interface DecodedFrame {\n header: FrameHeader;\n /** A VIEW into the input buffer (no copy). Copy it if you keep it past the input's lifetime. */\n payload: Uint8Array;\n}\n\nconst U32_MAX = 4_294_967_295;\nconst CHANNELS: ReadonlySet<number> = new Set(Object.values(FrameChannel));\n\nfunction frameError(message: string): DesktopProtocolError {\n return new DesktopProtocolError(\"PROTOCOL_ERROR\", message);\n}\n\nfunction checkU32(name: string, value: number): void {\n if (!Number.isInteger(value) || value < 0 || value > U32_MAX) throw frameError(`frame ${name} is not a u32: ${value}`);\n}\n\n/** Validate a header without zod. Throws DesktopProtocolError(PROTOCOL_ERROR). */\nexport function assertFrameHeader(h: FrameHeader): void {\n if (h.version !== FRAME_VERSION) throw frameError(`unsupported frame version ${String(h.version)}`);\n if (!Number.isInteger(h.flags) || h.flags < 0 || h.flags > 3) throw frameError(`reserved frame flag bits set: ${h.flags}`);\n if (!CHANNELS.has(h.channel)) throw frameError(`unknown frame channel ${String(h.channel)}`);\n checkU32(\"cid\", h.cid);\n checkU32(\"sid\", h.sid);\n checkU32(\"seq\", h.seq);\n}\n\nexport function encodeFrame(h: FrameHeader, payload: Uint8Array): Uint8Array {\n assertFrameHeader(h);\n const out = new Uint8Array(FRAME_HEADER_BYTES + payload.byteLength);\n const v = new DataView(out.buffer);\n v.setUint8(0, h.version);\n v.setUint8(1, h.flags);\n v.setUint8(2, h.channel);\n v.setUint8(3, 0);\n v.setUint32(4, h.cid);\n v.setUint32(8, h.sid);\n v.setUint32(12, h.seq);\n out.set(payload, FRAME_HEADER_BYTES);\n return out;\n}\n\nexport function decodeFrame(buf: ArrayBuffer | Uint8Array): DecodedFrame {\n const bytes = buf instanceof Uint8Array ? buf : new Uint8Array(buf);\n if (bytes.byteLength < FRAME_HEADER_BYTES) throw frameError(`short frame: ${bytes.byteLength} bytes`);\n const v = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n if (v.getUint8(3) !== 0) throw frameError(\"reserved frame byte 3 is not 0\");\n const header = {\n version: v.getUint8(0),\n flags: v.getUint8(1),\n channel: v.getUint8(2),\n cid: v.getUint32(4),\n sid: v.getUint32(8),\n seq: v.getUint32(12),\n } as FrameHeader;\n assertFrameHeader(header);\n return { header, payload: bytes.subarray(FRAME_HEADER_BYTES) };\n}\n\n/** Read only the 4-byte cid (relay routing) without decoding the rest. */\nexport function readCid(frame: Uint8Array): number {\n if (frame.byteLength < FRAME_HEADER_BYTES) throw frameError(`short frame: ${frame.byteLength} bytes`);\n return new DataView(frame.buffer, frame.byteOffset, frame.byteLength).getUint32(4);\n}\n\n/** Relay hot path: rewrite only the cid IN PLACE, never touch the payload. Returns the same array. */\nexport function stampCid(frame: Uint8Array, cid: number): Uint8Array {\n if (frame.byteLength < FRAME_HEADER_BYTES) throw frameError(`short frame: ${frame.byteLength} bytes`);\n checkU32(\"cid\", cid);\n new DataView(frame.buffer, frame.byteOffset, frame.byteLength).setUint32(4, cid);\n return frame;\n}\n\nexport function hasFlag(header: FrameHeader, flag: (typeof FrameFlag)[keyof typeof FrameFlag]): boolean {\n return (header.flags & flag) !== 0;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Relay ↔ device hop (never seen by clients). Every JSON envelope rides an ENVELOPE frame with\n// flags 0, sid 0, seq 0 and the client's cid; byte frames carry that cid too.\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** cid 0 on an ENVELOPE frame from the device: the relay delivers it to every client. */\nexport const BROADCAST_CID = 0 as const;\n\n/**\n * Connection end: an ENVELOPE frame with FIN, sid 0, seq 0 and NO payload, for connection `cid`.\n * Relay → device: client `cid` is gone — cancel its streams, detach its sessions (idempotent; it\n * may arrive more than once). Device → relay: close client `cid`.\n */\nexport function connectionEndFrame(cid: number): Uint8Array {\n if (cid === BROADCAST_CID) throw frameError(\"a connection end needs a client cid, not the broadcast cid 0\");\n return encodeFrame({ version: FRAME_VERSION, flags: FrameFlag.FIN, channel: FrameChannel.ENVELOPE, cid, sid: 0, seq: 0 }, new Uint8Array(0));\n}\n\n/** True for a decoded connection-end frame (see connectionEndFrame). */\nexport function isConnectionEnd(frame: DecodedFrame): boolean {\n const h = frame.header;\n return h.channel === FrameChannel.ENVELOPE && hasFlag(h, FrameFlag.FIN) && frame.payload.byteLength === 0 && h.cid !== BROADCAST_CID;\n}\n","/** @ai-matrx/desktop-protocol — the JSON envelope (SPEC §4). Schema source: lint-enforced rules in scripts/check-schema-source.mjs. */\nimport { z } from \"zod\";\nimport { ProtocolErrorBody } from \"./errors\";\nimport { DeviceId, ProtocolVersion, RequestId, ResourceId, epochMs, u32 } from \"./primitives\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Client types and hello\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const ClientType = z\n .enum([\"screen\", \"web\", \"extension\", \"server\", \"test\"]);\n\nexport const Limits = z\n .strictObject({\n max_message_bytes: z.int().min(65_536),\n max_frame_payload_bytes: z.int().min(4096),\n default_window_bytes: z.int().min(4096),\n max_streams_per_client: z.int().min(1),\n max_resources_per_user: z.int().min(1),\n });\n\nexport const OpDescriptor = z\n .strictObject({ cap: z.string().max(32), op: z.string().max(64), since: ProtocolVersion });\n\nexport const Welcome = z\n .strictObject({\n protocol_version: ProtocolVersion, // negotiated = min(client, core) within the same major\n session_id: z.string().min(8).max(64),\n client_id: z.string().min(8).max(64), // this connection's identity in the Session Manager\n device_id: DeviceId,\n device_name: z.string().max(128),\n app_version: z.string().max(32),\n platform: z.enum([\"darwin\", \"win32\", \"linux\"]),\n ops: z.array(OpDescriptor),\n limits: Limits,\n server_time_ms: epochMs,\n });\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Envelope (SPEC §4). Text WS messages carry exactly one of these as JSON.\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const HelloMsg = z\n .strictObject({\n type: z.literal(\"hello\"),\n id: RequestId, // answered by response{id, result: Welcome} or error{id}\n protocolVersion: ProtocolVersion,\n clientType: ClientType,\n clientVersion: z.string().min(1).max(32),\n });\n\nexport const RequestMsg = z\n .strictObject({\n id: RequestId,\n type: z.literal(\"request\"),\n cap: z.string().min(1).max(32),\n op: z.string().min(1).max(64),\n params: z.unknown(), // validated by the Router against OPS[cap.op].params — once, there\n });\n\nexport const ResponseMsg = z\n .strictObject({ id: RequestId, type: z.literal(\"response\"), result: z.unknown() });\n\nexport const ErrorMsg = z\n .strictObject({ id: RequestId, type: z.literal(\"error\"), error: ProtocolErrorBody });\n\nexport const StreamMeta = z\n .discriminatedUnion(\"kind\", [\n /** Binds request id → numeric sid; binary frames for this stream follow. */\n z.strictObject({\n kind: z.literal(\"open\"),\n sid: u32,\n window_bytes: z.int().min(4096),\n resource_id: ResourceId.optional(),\n }),\n /** Frames after this (channel SNAPSHOT) are a serialized screen; live DATA resumes after. */\n z.strictObject({ kind: z.literal(\"snapshot\"), cols: z.int().min(1), rows: z.int().min(1) }),\n /** Frames [from_seq, to_seq] are gone from the ring; a snapshot follows. */\n z.strictObject({ kind: z.literal(\"gap\"), from_seq: u32, to_seq: u32 }),\n ]);\n\nexport const StreamMsg = z\n .strictObject({ id: RequestId, type: z.literal(\"stream\"), seq: u32, meta: StreamMeta });\n\nexport const EndReason = z\n .enum([\"completed\", \"cancelled\", \"detached\", \"resource_exited\", \"error\"]);\n\nexport const EndMsg = z\n .strictObject({ id: RequestId, type: z.literal(\"end\"), seq: u32, reason: EndReason.optional() });\n\nexport const CancelMsg = z\n .strictObject({ id: RequestId, type: z.literal(\"cancel\") });\n\n/** Grant n more payload bytes for the stream opened by request `id` (either direction). */\nexport const CreditMsg = z\n .strictObject({ id: RequestId, type: z.literal(\"credit\"), n: z.int().min(1).max(2_147_483_647) });\n\nexport const EventMsg = z\n .strictObject({\n type: z.literal(\"event\"),\n cap: z.string().min(1).max(32),\n name: z.string().min(1).max(64),\n payload: z.unknown(), // validated against EVENTS[cap.name]\n resourceId: ResourceId.optional(),\n });\n\n/** Client↔relay only; the relay consumes these and never forwards them to the core. */\nexport const RelayMsg = z\n .discriminatedUnion(\"op\", [\n /** Fresh access token before the current one expires (relay closes 4008 at exp + 60 s). */\n z.strictObject({ type: z.literal(\"relay\"), op: z.literal(\"reauth\"), token: z.string().min(16).max(8192) }),\n ]);\n\n/**\n * Heartbeat. Sent as these EXACT bytes; the relay answers via the Durable Object\n * setWebSocketAutoResponse pair, so a heartbeat never wakes a hibernated object.\n * Interval 25 s (device and clients); 2 missed pongs = reconnect.\n */\nexport const PING_TEXT = '{\"type\":\"ping\"}' as const;\nexport const PONG_TEXT = '{\"type\":\"pong\"}' as const;\n\n/**\n * Every WebSocket (device, phone, browser, localhost) offers this subprotocol; the access token\n * rides beside it as `${BEARER_PREFIX}<token>`, never in the URL. The server echoes only SUBPROTOCOL.\n */\nexport const SUBPROTOCOL = \"matrx.v1\" as const;\nexport const BEARER_PREFIX = \"bearer.\" as const;\n\nexport const ClientToCoreMsg = z\n .discriminatedUnion(\"type\", [HelloMsg, RequestMsg, CancelMsg, CreditMsg]);\n\nexport const CoreToClientMsg = z\n .discriminatedUnion(\"type\", [ResponseMsg, ErrorMsg, StreamMsg, EndMsg, CreditMsg, EventMsg]);\n\n// ─────────────────────────────────────────────────────────────────────────────\n// WebSocket close codes (relay and localhost transport alike)\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const CloseCode = {\n NORMAL: 1000,\n GOING_AWAY: 1001, // app quit; relay: the device was silent for 75 s — reconnect\n /** Never sent by anyone: what a socket reports when it drops without a close frame. A relay\n * deploy (every Durable Object restarts) arrives as this — reconnect immediately. */\n ABNORMAL: 1006,\n /** Relay → clients: the device (re)connected, so the core session they spoke to is gone —\n * reconnect, hello, and reattach with since_seq. */\n DEVICE_RECONNECTED: 1012,\n TRY_AGAIN_LATER: 1013, // relay: signing keys or the device registry unreachable — retry\n AUTH_INVALID: 4001,\n AUTH_FORBIDDEN: 4003,\n DEVICE_NOT_FOUND: 4004,\n AUTH_EXPIRED: 4008, // no reauth before exp + 60 s\n REPLACED: 4009, // a newer device socket for the same device took over\n DEVICE_REVOKED: 4010, // kill switch — do NOT reconnect\n PROTOCOL_ERROR: 4400,\n UPGRADE_REQUIRED: 4426,\n} as const;\n\n/** Every close code above, as a schema (so Python sees the same table). */\nexport const CloseCodeValue = z.literal([1000, 1001, 1006, 1012, 1013, 4001, 4003, 4004, 4008, 4009, 4010, 4400, 4426]);\nexport type CloseCodeValue = z.output<typeof CloseCodeValue>;\n\n// Compile-time proof the schema lists exactly the CloseCode table.\ntype SameCodes<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;\ntype AssertCodes<T extends true> = T;\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype CloseCodeTableCheck = AssertCodes<SameCodes<CloseCodeValue, (typeof CloseCode)[keyof typeof CloseCode]>>;\n\n// Inferred (output) types — same name as the schema, so `FsEntry` is both the validator and its type.\nexport type ClientType = z.output<typeof ClientType>;\nexport type Limits = z.output<typeof Limits>;\nexport type OpDescriptor = z.output<typeof OpDescriptor>;\nexport type Welcome = z.output<typeof Welcome>;\nexport type HelloMsg = z.output<typeof HelloMsg>;\nexport type RequestMsg = z.output<typeof RequestMsg>;\nexport type ResponseMsg = z.output<typeof ResponseMsg>;\nexport type ErrorMsg = z.output<typeof ErrorMsg>;\nexport type StreamMeta = z.output<typeof StreamMeta>;\nexport type StreamMsg = z.output<typeof StreamMsg>;\nexport type EndReason = z.output<typeof EndReason>;\nexport type EndMsg = z.output<typeof EndMsg>;\nexport type CancelMsg = z.output<typeof CancelMsg>;\nexport type CreditMsg = z.output<typeof CreditMsg>;\nexport type EventMsg = z.output<typeof EventMsg>;\nexport type RelayMsg = z.output<typeof RelayMsg>;\nexport type ClientToCoreMsg = z.output<typeof ClientToCoreMsg>;\nexport type CoreToClientMsg = z.output<typeof CoreToClientMsg>;\n","/** @ai-matrx/desktop-protocol — cap sysinfo. Schema source: lint-enforced rules in scripts/check-schema-source.mjs. */\nimport { z } from \"zod\";\nimport { AbsPath, DeviceId, ProtocolVersion, nonNegInt } from \"./primitives\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n// sysinfo\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const OsPermissionName = z\n .enum([\n \"full_disk_access\",\n \"accessibility\",\n \"screen_recording\",\n \"microphone\",\n \"camera\",\n \"automation\",\n \"contacts\",\n \"calendars\",\n \"photos\",\n \"location\",\n \"local_network\",\n \"bluetooth\",\n \"notifications\",\n ]);\n\nexport const SysinfoGetParams = z.strictObject({});\nexport const SysinfoGetResult = z\n .strictObject({\n device_id: DeviceId,\n device_name: z.string().max(128),\n hostname: z.string().max(255),\n platform: z.enum([\"darwin\", \"win32\", \"linux\"]),\n os_version: z.string().max(64),\n arch: z.enum([\"arm64\", \"x64\"]),\n app_version: z.string().max(32),\n protocol_version: ProtocolVersion,\n user: z.strictObject({ username: z.string().max(128), shell: z.string().max(512) }),\n paths: z.strictObject({\n home: AbsPath,\n desktop: AbsPath,\n documents: AbsPath,\n downloads: AbsPath,\n app_data: AbsPath,\n temp: AbsPath,\n }),\n cpu: z.strictObject({ model: z.string().max(128), cores: z.int().min(1) }),\n memory: z.strictObject({ total_bytes: nonNegInt, free_bytes: nonNegInt }),\n uptime_seconds: nonNegInt,\n on_battery: z.boolean().nullable(),\n sleep_prevented: z.boolean(), // true while any remote session holds the power blocker\n permissions: z.array(\n z.strictObject({\n name: OsPermissionName,\n state: z.enum([\"granted\", \"denied\", \"not_determined\", \"not_applicable\"]),\n settings_url: z.string().max(512).nullable(),\n }),\n ),\n });\n\n// Inferred (output) types — same name as the schema, so `FsEntry` is both the validator and its type.\nexport type OsPermissionName = z.output<typeof OsPermissionName>;\nexport type SysinfoGetParams = z.output<typeof SysinfoGetParams>;\nexport type SysinfoGetResult = z.output<typeof SysinfoGetResult>;\n","/** @ai-matrx/desktop-protocol — cap fs. Schema source: lint-enforced rules in scripts/check-schema-source.mjs. */\nimport { z } from \"zod\";\nimport { FsPatchEditFailure } from \"./errors\";\nimport { AbsPath, ResourceId, epochMs, nonNegInt } from \"./primitives\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n// fs — mirrors matrx_agent daemon /fs/* field names (SPEC §6.1)\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const FsKind = z.enum([\"file\", \"dir\", \"symlink\"]);\n\n/**\n * = daemon get_stat_dict(), field for field (SPEC 6.1): what /fs/stat and every /fs/list entry\n * answer in the cloud sandbox. Never follows symlinks; `target` is the fully resolved target.\n */\nexport const FsEntry = z\n .strictObject({\n name: z.string().max(1024),\n path: AbsPath,\n kind: FsKind,\n size: nonNegInt,\n mtime: z.number().min(0), // seconds, float\n mode: z.int().min(0).max(0o7777),\n target: AbsPath.nullable(),\n });\n\nexport const FsListParams = z\n .strictObject({\n path: AbsPath,\n recursive: z.boolean().default(false),\n depth: z.int().min(1).max(32).default(1),\n pattern: z.string().max(256).optional(), // glob on name\n limit: z.int().min(1).max(5000).default(1000),\n page_token: z.string().max(256).optional(),\n // Desktop additions; their defaults ARE the daemon's behaviour: dotfiles listed, siblings in\n // binary (byte) order of name, depth-first.\n show_hidden: z.boolean().default(true),\n sort: z.enum([\"name\", \"mtime\", \"size\", \"kind\"]).default(\"name\"),\n });\nexport const FsListResult = z\n .strictObject({\n entries: z.array(FsEntry),\n truncated: z.boolean(),\n next_page_token: z.string().max(256).nullable(),\n scanned: nonNegInt,\n });\n\nexport const FsStatParams = z.strictObject({ path: AbsPath });\nexport const FsStatResult = FsEntry;\n\nexport const FsEncoding = z.enum([\"utf8\", \"base64\"]);\n\n/** Bounded read. offset = byte offset; limit = chars (utf8) or bytes (base64), as the daemon. */\nexport const FsReadParams = z\n .strictObject({\n path: AbsPath,\n encoding: FsEncoding.default(\"utf8\"),\n offset: nonNegInt.default(0),\n limit: z.int().min(1).max(4_194_304).default(262_144),\n });\nexport const FsReadResult = z\n .strictObject({\n content: z.string(),\n encoding: FsEncoding,\n size: nonNegInt,\n offset: nonNegInt,\n next_offset: nonNegInt,\n truncated: z.boolean(),\n mime: z.string().max(128).nullable(),\n mtime_ms: epochMs, // pass back as if_match_mtime_ms to guard a later write\n });\n\n/** Whole-file or ranged download as binary frames (channel DATA, credited). */\nexport const FsReadStreamParams = z\n .strictObject({\n path: AbsPath,\n offset: nonNegInt.default(0),\n length: nonNegInt.optional(), // absent = to EOF\n window_bytes: z.int().min(4096).max(16_777_216).optional(),\n });\n/** Unary result arrives first (size/mime), then stream{open} + DATA frames + end. */\nexport const FsReadStreamResult = z\n .strictObject({ size: nonNegInt, mime: z.string().max(128).nullable(), mtime_ms: epochMs });\n\nexport const FsWriteParams = z\n .strictObject({\n path: AbsPath,\n content: z.string().max(5_592_406), // ≤ 4 MiB of bytes after base64 decode\n encoding: FsEncoding.default(\"utf8\"),\n mode: z.int().min(0).max(0o7777).optional(),\n create_parents: z.boolean().default(false),\n /** Optimistic concurrency: CONFLICT/stale_write if the file changed since this mtime. */\n if_match_mtime_ms: epochMs.optional(),\n /** Refuse to replace an existing file (CONFLICT/already_exists). */\n exclusive: z.boolean().default(false),\n });\n/** Writes are atomic: temp file in the same directory + rename (daemon parity). */\nexport const FsWriteResult = z\n .strictObject({ path: AbsPath, size: nonNegInt, mtime_ms: epochMs, created: z.boolean() });\n\nexport const FsMkdirParams = z\n .strictObject({ path: AbsPath, parents: z.boolean().default(false) });\nexport const FsMkdirResult = z\n .strictObject({ path: AbsPath, created: z.boolean() });\n\n/** = daemon RenameRequest (/fs/rename). */\nexport const FsMoveParams = z\n .strictObject({ from_path: AbsPath, to_path: AbsPath, overwrite: z.boolean().default(false) });\nexport const FsMoveResult = z\n .strictObject({ from_path: AbsPath, to_path: AbsPath });\n\n/**\n * Delete. Default goes to the OS Trash (Finder/Explorer semantics: undoable from the phone's\n * \"Undo\" toast via fs.move back). to_trash:false is a permanent delete — the daemon's behaviour,\n * used by agents through _sandbox_proxy.\n */\nexport const FsDeleteParams = z\n .strictObject({\n path: AbsPath,\n recursive: z.boolean().default(false),\n to_trash: z.boolean().default(true),\n });\nexport const FsDeleteResult = z\n .strictObject({ deleted: z.literal(true), trashed_to: AbsPath.nullable() });\n\n/** Opens a watch resource; changes arrive as event fs.changed with resourceId. */\nexport const FsWatchParams = z\n .strictObject({\n path: AbsPath,\n recursive: z.boolean().default(false),\n ignore: z.array(z.string().max(256)).max(64).default([]),\n debounce_ms: z.int().min(0).max(5000).default(50),\n });\nexport const FsWatchResult = z\n .strictObject({ resource_id: ResourceId, path: AbsPath });\n\n// — Required by lane F (SPEC §6.1 parity sequence and every existing _sandbox_proxy call) —\n\n/** = daemon EditChunk / PatchRequest (/fs/patch). */\nexport const FsPatchParams = z\n .strictObject({\n path: AbsPath,\n edits: z\n .array(\n z.strictObject({\n old_text: z.string(),\n new_text: z.string(),\n replace_all: z.boolean().default(false),\n }),\n )\n .min(1)\n .max(256),\n create_if_missing: z.boolean().default(false),\n });\n/** One edit fs.patch applied — the daemon's `edits_applied[]` entry, verbatim. */\nexport const FsPatchEditApplied = z.strictObject({\n edit_index: nonNegInt,\n mode: z.enum([\"create\", \"replace\", \"replace_all\"]),\n /** Present for replace_all only, as the daemon sends it. */\n matches_replaced: nonNegInt.optional(),\n});\n\n/**\n * = the daemon's /fs/patch answer per edit: edits apply in order, each sees the previous result; an\n * edit whose old_text is missing, or matches more than once without replace_all, is skipped and\n * listed in edits_failed with the daemon's reason; the file is written when at least one applied.\n * (Every edit failing is a CONFLICT whose data.edits_failed lists them — the daemon's 422.)\n */\nexport const FsPatchResult = z.strictObject({\n path: AbsPath,\n applied: nonNegInt,\n size: nonNegInt,\n mtime_ms: epochMs,\n /** Since 1.1 (FIELDS_SINCE): a 1.0 app sends only `applied`. Always sent to a ≥1.1 peer. */\n edits_applied: z.array(FsPatchEditApplied).max(256).optional(),\n /** Since 1.1 (FIELDS_SINCE). */\n edits_failed: z.array(FsPatchEditFailure).max(256).optional(),\n});\n\n/** = daemon SearchPathRequest (/search/paths). */\nexport const FsSearchPathsParams = z\n .strictObject({\n pattern: z.string().min(1).max(512),\n cwd: AbsPath,\n hidden: z.boolean().default(false),\n max_results: z.int().min(1).max(5000).default(100),\n });\n/**\n * = the daemon's /search/paths answer (fd 8.3.1 in the sandbox image): paths RELATIVE to `cwd`, each\n * prefixed \"./\", sorted, cut to max_results. No truncation flag (the daemon has none).\n */\nexport const FsSearchPathsResult = z\n .strictObject({ paths: z.array(z.string().min(3).max(4096).regex(/^\\.\\/[^\\\\\\u0000]+$/)) });\n\n/** = daemon SearchContentRequest (/search/content). */\nexport const FsSearchContentParams = z\n .strictObject({\n query: z.string().min(1).max(1024),\n cwd: AbsPath,\n regex: z.boolean().default(true),\n case_sensitive: z.boolean().default(false),\n include: z.array(z.string().max(256)).max(64).optional(),\n exclude: z.array(z.string().max(256)).max(64).optional(),\n max_results: z.int().min(1).max(5000).default(100),\n });\n/**\n * = the daemon's /search/content answer (ripgrep 13 --json run in `cwd`): `path` RELATIVE to `cwd`\n * with no \"./\"; `lines` is the matching line with its newline; submatches are ripgrep's, byte\n * offsets within the line. max_results is per FILE (rg -m), as the daemon passes it. No truncation\n * flag (the daemon has none).\n */\nexport const FsSearchContentResult = z\n .strictObject({\n results: z.array(\n z.strictObject({\n path: z.string().min(1).max(4096).regex(/^[^/\\\\\\u0000][^\\\\\\u0000]*$/),\n lines: z.string(),\n line_number: z.int().min(1),\n submatches: z.array(\n z.strictObject({ match: z.strictObject({ text: z.string() }), start: nonNegInt, end: nonNegInt }),\n ),\n }),\n ),\n });\n\nexport const FsChange = z\n .strictObject({\n type: z.enum([\"created\", \"modified\", \"deleted\", \"moved\"]),\n path: AbsPath,\n to_path: AbsPath.optional(),\n kind: z.enum([\"file\", \"dir\", \"symlink\", \"unknown\"]),\n });\nexport const FsChangedEvent = z\n .strictObject({ changes: z.array(FsChange).min(1).max(1000), overflow: z.boolean() }); // overflow:true = events dropped; client re-lists\n\n// Inferred (output) types — same name as the schema, so `FsEntry` is both the validator and its type.\nexport type FsKind = z.output<typeof FsKind>;\nexport type FsEntry = z.output<typeof FsEntry>;\nexport type FsListParams = z.output<typeof FsListParams>;\nexport type FsListResult = z.output<typeof FsListResult>;\nexport type FsStatParams = z.output<typeof FsStatParams>;\nexport type FsStatResult = z.output<typeof FsStatResult>;\nexport type FsEncoding = z.output<typeof FsEncoding>;\nexport type FsReadParams = z.output<typeof FsReadParams>;\nexport type FsReadResult = z.output<typeof FsReadResult>;\nexport type FsReadStreamParams = z.output<typeof FsReadStreamParams>;\nexport type FsReadStreamResult = z.output<typeof FsReadStreamResult>;\nexport type FsWriteParams = z.output<typeof FsWriteParams>;\nexport type FsWriteResult = z.output<typeof FsWriteResult>;\nexport type FsMkdirParams = z.output<typeof FsMkdirParams>;\nexport type FsMkdirResult = z.output<typeof FsMkdirResult>;\nexport type FsMoveParams = z.output<typeof FsMoveParams>;\nexport type FsMoveResult = z.output<typeof FsMoveResult>;\nexport type FsDeleteParams = z.output<typeof FsDeleteParams>;\nexport type FsDeleteResult = z.output<typeof FsDeleteResult>;\nexport type FsWatchParams = z.output<typeof FsWatchParams>;\nexport type FsWatchResult = z.output<typeof FsWatchResult>;\nexport type FsPatchParams = z.output<typeof FsPatchParams>;\nexport type FsPatchResult = z.output<typeof FsPatchResult>;\nexport type FsPatchEditApplied = z.output<typeof FsPatchEditApplied>;\nexport type FsSearchPathsParams = z.output<typeof FsSearchPathsParams>;\nexport type FsSearchPathsResult = z.output<typeof FsSearchPathsResult>;\nexport type FsSearchContentParams = z.output<typeof FsSearchContentParams>;\nexport type FsSearchContentResult = z.output<typeof FsSearchContentResult>;\nexport type FsChange = z.output<typeof FsChange>;\nexport type FsChangedEvent = z.output<typeof FsChangedEvent>;\n","/** @ai-matrx/desktop-protocol — cap exec. Schema source: lint-enforced rules in scripts/check-schema-source.mjs. */\nimport { z } from \"zod\";\nimport { AbsPath, ResourceId, epochMs, nonNegInt, u32 } from \"./primitives\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n// exec — PTY sessions (resources) + one-shot run\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const Signal = z\n .enum([\"SIGINT\", \"SIGTERM\", \"SIGKILL\", \"SIGHUP\", \"SIGQUIT\", \"SIGTSTP\", \"SIGCONT\", \"SIGUSR1\", \"SIGUSR2\"]); // Windows: SIGINT→Ctrl-C event, SIGTERM/SIGKILL/SIGHUP→terminate, others PLATFORM_UNSUPPORTED\n\nconst cols = z.int().min(2).max(1000);\nconst rows = z.int().min(1).max(500);\n\n/**\n * Start a PTY. Response result = PtyInfo; the same request id then carries the output stream:\n * stream{meta:{kind:\"open\",sid,resource_id}} → DATA frames (credited) → end{reason}.\n * Input goes as STDIN frames on that sid (cheap per keystroke) or via exec.pty.write.\n */\nexport const ExecPtyStartParams = z\n .strictObject({\n cols,\n rows,\n cwd: AbsPath.optional(), // default: home\n shell: z.string().max(512).optional(), // default: user's login shell (PowerShell on Windows)\n args: z.array(z.string().max(4096)).max(64).optional(),\n env: z.record(z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(128), z.string().max(32_768)).optional(),\n name: z.string().max(64).optional(), // tab label\n window_bytes: z.int().min(4096).max(16_777_216).optional(),\n });\n\nexport const PtyInfo = z\n .strictObject({\n resource_id: ResourceId,\n pid: z.int().min(1),\n shell: z.string().max(512),\n cwd: AbsPath, // live, from OSC 7 / process cwd\n title: z.string().max(256),\n name: z.string().max(64).nullable(),\n cols,\n rows,\n state: z.enum([\"running\", \"exited\"]),\n exit_code: z.int().nullable(),\n exit_signal: Signal.nullable(),\n last_seq: u32,\n created_at_ms: epochMs,\n controller_client_id: z.string().max(64).nullable(), // null = orphaned (in grace period)\n attached_clients: nonNegInt,\n orphan_expires_at_ms: epochMs.nullable(),\n });\n\nexport const ExecPtyStartResult = PtyInfo;\n\nexport const ExecPtyWriteParams = z\n .strictObject({ resource_id: ResourceId, data: z.string().min(1).max(65_536) });\nexport const ExecPtyWriteResult = z.strictObject({ written: nonNegInt });\n\nexport const ExecPtyResizeParams = z\n .strictObject({ resource_id: ResourceId, cols, rows });\nexport const ExecPtyResizeResult = z.strictObject({ cols, rows });\n\n/** Delivered to the PTY's foreground process group (daemon parity: tcgetpgrp + killpg). */\nexport const ExecPtySignalParams = z\n .strictObject({ resource_id: ResourceId, signal: Signal });\nexport const ExecPtySignalResult = z.strictObject({ delivered: z.boolean() });\n\n/** SIGHUP the session, SIGKILL after grace_ms, reap, free the resource. Idempotent. */\nexport const ExecPtyKillParams = z\n .strictObject({ resource_id: ResourceId, grace_ms: z.int().min(0).max(30_000).default(2000) });\nexport const ExecPtyKillResult = z\n .strictObject({ exit_code: z.int().nullable(), exit_signal: Signal.nullable() });\n\nexport const ExecListParams = z.strictObject({});\nexport const ExecListResult = z.strictObject({ sessions: z.array(PtyInfo) });\n\n/**\n * One-shot command (agents, via _sandbox_proxy → /exec). Timeout ENFORCED (exit 124, daemon\n * convention). cwd is sticky per cwd_key: a later run with the same key and no cwd starts where\n * the last one ended (SPEC §6.1: \"cd sub && pwd\" then \"pwd\").\n */\nexport const ExecRunParams = z\n .strictObject({\n command: z.string().min(1).max(131_072),\n cwd: AbsPath.optional(),\n cwd_key: z.string().max(128).optional(),\n env: z.record(z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(128), z.string().max(32_768)).optional(),\n stdin: z.string().max(1_048_576).optional(),\n timeout: z.int().min(1).max(3600).default(60), // seconds, daemon parity\n max_output_bytes: z.int().min(1024).max(8_388_608).default(1_048_576),\n });\nexport const ExecRunResult = z\n .strictObject({\n exit_code: z.int(),\n stdout: z.string(),\n stderr: z.string(),\n cwd: AbsPath,\n duration_ms: nonNegInt,\n timed_out: z.boolean(),\n output_truncated: z.boolean(),\n });\n\nexport const ExecExitedEvent = z\n .strictObject({ exit_code: z.int().nullable(), exit_signal: Signal.nullable() });\nexport const ExecTitleEvent = z.strictObject({ title: z.string().max(256) });\nexport const ExecCwdEvent = z.strictObject({ cwd: AbsPath });\n\n// Inferred (output) types — same name as the schema, so `FsEntry` is both the validator and its type.\nexport type Signal = z.output<typeof Signal>;\nexport type ExecPtyStartParams = z.output<typeof ExecPtyStartParams>;\nexport type PtyInfo = z.output<typeof PtyInfo>;\nexport type ExecPtyStartResult = z.output<typeof ExecPtyStartResult>;\nexport type ExecPtyWriteParams = z.output<typeof ExecPtyWriteParams>;\nexport type ExecPtyWriteResult = z.output<typeof ExecPtyWriteResult>;\nexport type ExecPtyResizeParams = z.output<typeof ExecPtyResizeParams>;\nexport type ExecPtyResizeResult = z.output<typeof ExecPtyResizeResult>;\nexport type ExecPtySignalParams = z.output<typeof ExecPtySignalParams>;\nexport type ExecPtySignalResult = z.output<typeof ExecPtySignalResult>;\nexport type ExecPtyKillParams = z.output<typeof ExecPtyKillParams>;\nexport type ExecPtyKillResult = z.output<typeof ExecPtyKillResult>;\nexport type ExecListParams = z.output<typeof ExecListParams>;\nexport type ExecListResult = z.output<typeof ExecListResult>;\nexport type ExecRunParams = z.output<typeof ExecRunParams>;\nexport type ExecRunResult = z.output<typeof ExecRunResult>;\nexport type ExecExitedEvent = z.output<typeof ExecExitedEvent>;\nexport type ExecTitleEvent = z.output<typeof ExecTitleEvent>;\nexport type ExecCwdEvent = z.output<typeof ExecCwdEvent>;\n","/** @ai-matrx/desktop-protocol — cap session. Schema source: lint-enforced rules in scripts/check-schema-source.mjs. */\nimport { z } from \"zod\";\nimport { PtyInfo } from \"./exec\";\nimport { AbsPath, ResourceId, epochMs, u32 } from \"./primitives\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n// session — generic resource ownership (SPEC §3.3). One attach/detach for EVERY resource kind.\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Reattach after a drop. mode \"control\" by the same user takes control (previous controller is\n * demoted to read_only and gets session.control_changed). since_seq = last seq the client\n * rendered: frames (since_seq, last_seq] are replayed from the ring with the REPLAY flag; if they\n * have left the ring, stream{gap} + stream{snapshot} + SNAPSHOT frames come first.\n * Response = PtyInfo|FsWatchResult-shaped ResourceInfo; then the stream continues on a new sid.\n */\nexport const SessionAttachParams = z\n .strictObject({\n resource_id: ResourceId,\n mode: z.enum([\"control\", \"read_only\"]).default(\"control\"),\n since_seq: u32.optional(),\n window_bytes: z.int().min(4096).max(16_777_216).optional(),\n });\n\nexport const ResourceInfo = z\n .discriminatedUnion(\"kind\", [\n z.strictObject({ kind: z.literal(\"pty\"), pty: PtyInfo }),\n z.strictObject({\n kind: z.literal(\"watch\"),\n resource_id: ResourceId,\n path: AbsPath,\n orphan_expires_at_ms: epochMs.nullable(),\n }),\n ]);\nexport const SessionAttachResult = ResourceInfo;\n\n/** Leave the resource running (orphan grace starts if no other client controls it). */\nexport const SessionDetachParams = z.strictObject({ resource_id: ResourceId });\nexport const SessionDetachResult = z\n .strictObject({ orphan_expires_at_ms: epochMs.nullable() });\n\n/** Free a resource through its owner's cancel path (watch → unwatch; pty → exec.pty.kill). */\nexport const SessionReleaseParams = z.strictObject({ resource_id: ResourceId });\nexport const SessionReleaseResult = z.strictObject({ released: z.literal(true) });\n\nexport const SessionListParams = z.strictObject({});\nexport const SessionListResult = z.strictObject({ resources: z.array(ResourceInfo) });\n\nexport const SessionControlChangedEvent = z\n .strictObject({ controller_client_id: z.string().max(64).nullable(), your_mode: z.enum([\"control\", \"read_only\"]) });\n\n// Inferred (output) types — same name as the schema, so `FsEntry` is both the validator and its type.\nexport type SessionAttachParams = z.output<typeof SessionAttachParams>;\nexport type ResourceInfo = z.output<typeof ResourceInfo>;\nexport type SessionAttachResult = z.output<typeof SessionAttachResult>;\nexport type SessionDetachParams = z.output<typeof SessionDetachParams>;\nexport type SessionDetachResult = z.output<typeof SessionDetachResult>;\nexport type SessionReleaseParams = z.output<typeof SessionReleaseParams>;\nexport type SessionReleaseResult = z.output<typeof SessionReleaseResult>;\nexport type SessionListParams = z.output<typeof SessionListParams>;\nexport type SessionListResult = z.output<typeof SessionListResult>;\nexport type SessionControlChangedEvent = z.output<typeof SessionControlChangedEvent>;\n","/** @ai-matrx/desktop-protocol — cap relay. Schema source: lint-enforced rules in scripts/check-schema-source.mjs. */\nimport { z } from \"zod\";\nimport { ProtocolErrorBody } from \"./errors\";\nimport { ProtocolVersion, epochMs } from \"./primitives\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n// relay — events the relay itself emits to clients (cap \"relay\")\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const RelayDeviceStatusEvent = z\n .strictObject({\n online: z.boolean(),\n /**\n * When the device last went online/offline; null = it has never connected (since 1.1 —\n * NULL_SINCE: a 1.0 reader is sent 0, its old meaning).\n */\n since_ms: epochMs.nullable(),\n app_version: z.string().max(32).nullable(),\n protocol_version: ProtocolVersion.nullable(),\n });\nexport const RelayAuthExpiringEvent = z\n .strictObject({ expires_at_ms: epochMs });\n\n/** HTTP POST https://relay.matrxserver.com/v1/devices/{device_id}/call — unary ops only (lane F). */\nexport const RelayCallRequest = z\n .strictObject({\n cap: z.string().min(1).max(32),\n op: z.string().min(1).max(64),\n params: z.unknown(),\n timeout_ms: z.int().min(100).max(3_700_000).default(70_000),\n });\n/**\n * The caller of /call announces the newest protocol it reads in this request header; the relay\n * includes fields newer than 1.0 only when the announced version knows them (src/versioning.ts).\n */\nexport const RELAY_CALL_VERSION_HEADER = \"x-matrx-protocol-version\" as const;\n\nexport const RelayCallResponse = z\n .discriminatedUnion(\"ok\", [\n z.strictObject({\n ok: z.literal(true),\n result: z.unknown(),\n /** Since 1.1: the version the device negotiated for this call (its welcome). */\n protocol_version: ProtocolVersion.optional(),\n }),\n z.strictObject({\n ok: z.literal(false),\n error: ProtocolErrorBody,\n /** Since 1.1, as above (absent when the device never answered hello). */\n protocol_version: ProtocolVersion.optional(),\n }),\n ]);\n\n/**\n * How the relay runs one /call on the device: a fresh cid (its own connection) carrying exactly\n * RelayCallHello then RelayCallEnvelope, answered on that cid by response/error with id \"call\"\n * (an error on id \"hello\" also ends it), then a connection-end frame. A stream answer is refused.\n */\nexport const RELAY_CALL_HELLO_ID = \"hello\" as const;\nexport const RELAY_CALL_REQUEST_ID = \"call\" as const;\n\nexport const RelayCallHello = z\n .strictObject({\n type: z.literal(\"hello\"),\n id: z.literal(RELAY_CALL_HELLO_ID),\n protocolVersion: ProtocolVersion,\n clientType: z.literal(\"server\"),\n clientVersion: z.string().min(1).max(32),\n });\nexport const RelayCallEnvelope = z\n .strictObject({\n id: z.literal(RELAY_CALL_REQUEST_ID),\n type: z.literal(\"request\"),\n cap: z.string().min(1).max(32),\n op: z.string().min(1).max(64),\n params: z.unknown(),\n });\n\n/** HTTP GET /v1/devices/{device_id}/status (owner JWT). */\nexport const RelayStatusResponse = RelayDeviceStatusEvent;\n\n// Inferred (output) types — same name as the schema, so `FsEntry` is both the validator and its type.\nexport type RelayDeviceStatusEvent = z.output<typeof RelayDeviceStatusEvent>;\nexport type RelayAuthExpiringEvent = z.output<typeof RelayAuthExpiringEvent>;\nexport type RelayCallRequest = z.output<typeof RelayCallRequest>;\nexport type RelayCallResponse = z.output<typeof RelayCallResponse>;\nexport type RelayStatusResponse = z.output<typeof RelayStatusResponse>;\nexport type RelayCallHello = z.output<typeof RelayCallHello>;\nexport type RelayCallEnvelope = z.output<typeof RelayCallEnvelope>;\n","/**\n * @ai-matrx/desktop-protocol — the `models` capability (SPEC §6): local AI models on the device,\n * served by Matrx 2's `ml` Python service (SPEC §3.10). Schema source: lint-enforced rules in\n * scripts/check-schema-source.mjs.\n *\n * Two contracts share these shapes, both generated from this file (SPEC P11):\n * - the Router ops `models.*` (every transport: relay, localhost, extension, the app's screen);\n * - the internal service ops `ml.*` between the desktop core and the Python service\n * (src/schema/service.ts, `SERVICES` in registry.ts). A forwarded op uses the SAME named\n * schema on both hops, so the two can never disagree.\n */\nimport { z } from \"zod\";\nimport { AbsPath, RequestId, nonNegInt } from \"./primitives\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Transcription (local Whisper)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Whisper sizes the device can run (CTranslate2 weights). Larger = slower, more accurate. */\nexport const TranscriptionModelId = z.enum([\"tiny\", \"base\", \"small\", \"large-v3-turbo\"]);\n\n/** The heavy runtime (inference packages) is installed on first use, never shipped in the app. */\nexport const MlRuntimeState = z.enum([\"not_installed\", \"installing\", \"installed\", \"failed\"]);\n\n/** `packages`: the locked inference wheels; `model`: one model's weights; `verifying`: hashes and a load test. */\nexport const MlInstallPhase = z.enum([\"packages\", \"model\", \"verifying\"]);\n\nexport const MlInstallProgress = z.strictObject({\n phase: MlInstallPhase,\n /** What is being fetched now: a package or a model file name. */\n item: z.string().max(200),\n bytes_done: nonNegInt,\n /** Null while the total is not known yet. */\n bytes_total: nonNegInt.nullable(),\n});\n\nexport const TranscriptionModelInfo = z.strictObject({\n id: TranscriptionModelId,\n /** Download size of the weights. */\n size_bytes: nonNegInt,\n multilingual: z.boolean(),\n installed: z.boolean(),\n});\n\nexport const TranscriptSegment = z.strictObject({\n start_s: z.number().min(0),\n end_s: z.number().min(0),\n text: z.string().max(4000),\n});\n\n/** What the `ml` service itself reports (the core adds the supervisor's view in ModelsStatusResult). */\nexport const MlStatusParams = z.strictObject({});\nexport const MlStatusResult = z.strictObject({\n runtime: MlRuntimeState,\n /** Non-null while runtime or model files are being installed. */\n install: MlInstallProgress.nullable(),\n /** The last install failure, one human line; null when the last install succeeded or none ran. */\n error: z.string().max(300).nullable(),\n /** Where inference runs once the runtime is installed: `cuda` only when a usable GPU is present. */\n accelerator: z.enum([\"cpu\", \"cuda\"]),\n models: z.array(TranscriptionModelInfo).max(16),\n default_model: TranscriptionModelId,\n});\n\n/** Install the runtime (if missing) and one model's weights (default: the default model). */\nexport const ModelsInstallParams = z.strictObject({ model: TranscriptionModelId.optional() });\nexport const ModelsInstallResult = z.strictObject({ model: TranscriptionModelId, elapsed_ms: nonNegInt });\n\n/**\n * Transcribe an audio or video file on the device. Any format the bundled decoder reads (wav, mp3,\n * m4a, webm/opus, mp4…). `language` is ISO 639-1; omitted = detect. `translate` = into English.\n */\nexport const ModelsTranscribeParams = z.strictObject({\n path: AbsPath,\n model: TranscriptionModelId.optional(),\n language: z\n .string()\n .regex(/^[a-z]{2,3}$/)\n .optional(),\n task: z.enum([\"transcribe\", \"translate\"]).default(\"transcribe\"),\n});\nexport const ModelsTranscribeResult = z.strictObject({\n text: z.string().max(400_000),\n language: z.string().max(8),\n language_probability: z.number().min(0).max(1),\n duration_s: z.number().min(0),\n model: TranscriptionModelId,\n segments: z.array(TranscriptSegment).max(20_000),\n elapsed_ms: nonNegInt,\n});\n\n/** A progress report while `ml.install` / `ml.transcribe` runs. */\nexport const MlProgress = z.strictObject({\n kind: z.enum([\"install\", \"transcribe\"]),\n /** 0–1 when known (transcribe: audio covered so far; install: bytes so far). */\n fraction: z.number().min(0).max(1).nullable(),\n install: MlInstallProgress.nullable(),\n /** The segment just transcribed (transcribe only): text appears as it is recognised. */\n segment: TranscriptSegment.nullable(),\n});\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Router ops (`models.*`)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** The supervisor's view of the `ml` service process. */\nexport const MlServiceState = z.enum([\"starting\", \"ready\", \"restarting\", \"failed\", \"stopped\"]);\n\nexport const MlServiceStatus = z.strictObject({\n state: MlServiceState,\n pid: nonNegInt.nullable(),\n /** Restarts since the app started (crashes, missed health checks). */\n restarts: nonNegInt,\n /** The bundled interpreter's version once the service has answered, e.g. \"3.13.15\". */\n python: z.string().max(32).nullable(),\n /** Why the service is restarting or failed, one human line. */\n error: z.string().max(300).nullable(),\n});\n\nexport const ModelsStatusParams = z.strictObject({});\nexport const ModelsStatusResult = z.strictObject({\n service: MlServiceStatus,\n /** Null until the service has answered (starting, restarting, failed). */\n transcription: MlStatusResult.nullable(),\n});\n\n/** Sent to the client that started a `models.install` or `models.transcribe`, for that request. */\nexport const ModelsProgressEvent = z.strictObject({ request_id: RequestId, progress: MlProgress });\n\nexport type TranscriptionModelId = z.output<typeof TranscriptionModelId>;\nexport type MlStatusResult = z.output<typeof MlStatusResult>;\nexport type MlProgress = z.output<typeof MlProgress>;\nexport type ModelsStatusResult = z.output<typeof ModelsStatusResult>;\nexport type ModelsTranscribeParams = z.output<typeof ModelsTranscribeParams>;\nexport type ModelsTranscribeResult = z.output<typeof ModelsTranscribeResult>;\nexport type ModelsInstallParams = z.output<typeof ModelsInstallParams>;\nexport type ModelsInstallResult = z.output<typeof ModelsInstallResult>;\nexport type ModelsProgressEvent = z.output<typeof ModelsProgressEvent>;\nexport type TranscriptSegment = z.output<typeof TranscriptSegment>;\n","/**\n * @ai-matrx/desktop-protocol — cap apps (SPEC §6): the desktop apps a person uses (Claude, Codex,\n * Cursor, VS Code, Antigravity, and any app a later adapter adds), their profiles and usage.\n * Schema source: lint-enforced rules in scripts/check-schema-source.mjs.\n *\n * A profile is one data folder of one app on one device, so several accounts of the same app run\n * side by side. Profiles are the person's own rows in `users.desktop_app_profile` (the one\n * database); folders found on disk that no row names yet are listed with `id: null` so they can be\n * added. Nothing here is ever a credential: signing in happens inside the app.\n */\nimport { z } from \"zod\";\nimport { AbsPath, DeviceId, epochMs } from \"./primitives\";\n\n/** An adapter key: lowercase, open-ended (a new app needs only a new adapter). */\nexport const AppKey = z\n .string()\n .regex(/^[a-z][a-z0-9_-]{0,39}$/);\n\n/** A users.desktop_app_profile id. Plain pattern (see DeviceId for why not z.uuid()). */\nexport const AppProfileId = z\n .string()\n .regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/);\n\n/**\n * Where a profile's folder lives, RELATIVE to the app adapter's data root on that device: one or\n * more plain names joined by \"/\" (none starting with a dot, so never \".\" or \"..\"), never absolute.\n * Null on a profile means the app's own default profile. No lookaround: Pydantic's regex engine\n * has none.\n */\nexport const AppProfileLocator = z\n .string()\n .min(1)\n .max(512)\n .regex(/^[A-Za-z0-9 _()+@,-][A-Za-z0-9 ._()+@,-]{0,127}(\\/[A-Za-z0-9 _()+@,-][A-Za-z0-9 ._()+@,-]{0,127}){0,7}$/);\n\n/** supported: proven here; partial: works with a stated gap; unsupported: not on this OS. */\nexport const AppSupport = z.enum([\"supported\", \"partial\", \"unsupported\"]);\n\nexport const AppFeatureStatus = z.strictObject({\n status: AppSupport,\n /** One line, set whenever status is not \"supported\". */\n reason: z.string().max(140).nullable(),\n});\n\nexport const AppInfo = z.strictObject({\n app_key: AppKey,\n name: z.string().max(64),\n installed: z.boolean(),\n /** The app's own version string, or null when it is not installed or does not say. */\n version: z.string().max(64).nullable(),\n /** The install found (an .app bundle, an .exe, a binary), or null. */\n location: AbsPath.nullable(),\n /** Open the app at all on this OS. */\n open: AppFeatureStatus,\n /** Separate profiles (one account each) on this OS. */\n profiles: AppFeatureStatus,\n /** Plan usage read from the app's own files on this OS. */\n usage: AppFeatureStatus,\n});\n\n/** One plan-usage figure, as the app itself last recorded it. */\nexport const AppUsageReading = z.strictObject({\n window: z.enum([\"five_hour\", \"weekly\", \"extra\"]),\n /** 0–100 for five_hour and weekly; extra-usage spend as a percent of its cap (may pass 100). */\n percent: z.number().min(0).max(10_000),\n /** When the app recorded it. */\n sampled_at_ms: epochMs,\n /** True when the window has rolled over since the sample, so the figure has reset. */\n reset_since: z.boolean(),\n});\n\nexport const AppProfile = z.strictObject({\n /** The row's id; null for a folder found on disk that no row names yet. */\n id: AppProfileId.nullable(),\n app_key: AppKey,\n display_name: z.string().min(1).max(120),\n /** The account the person means to be signed in here; null when not stated (never guessed). */\n account_identity: z.string().min(3).max(320).nullable(),\n profile_locator: AppProfileLocator.nullable(),\n /** The device the row is tied to; null when the row names none. */\n device_id: DeviceId.nullable(),\n /** The folder this profile resolves to on this device; null for a row tied to another device. */\n folder: AbsPath.nullable(),\n /** The folder exists on this device. */\n on_disk: z.boolean(),\n /** An instance with this profile is running; null when it could not be determined. */\n running: z.boolean().nullable(),\n /** Usage the app recorded for this profile; null when the app exposes none here. */\n usage: z.array(AppUsageReading).nullable(),\n last_opened_ms: epochMs.nullable(),\n});\n\nexport const AppsListParams = z.strictObject({});\nexport const AppsListResult = z.strictObject({ apps: z.array(AppInfo) });\n\nexport const AppsProfilesListParams = z.strictObject({\n /** Only this app's profiles; every app's when absent. */\n app_key: AppKey.optional(),\n});\nexport const AppsProfilesListResult = z.strictObject({\n profiles: z.array(AppProfile),\n /**\n * Whether the saved rows could be read: false while signed out or offline, when only folders\n * found on disk are listed.\n */\n registry: z.enum([\"ok\", \"signed_out\", \"unavailable\"]),\n});\n\n/** Create (no id) or update (id) the person's own profile row. */\nexport const AppsProfilesSaveParams = z.strictObject({\n id: AppProfileId.optional(),\n app_key: AppKey,\n display_name: z.string().min(1).max(120),\n account_identity: z.string().min(3).max(320).nullable(),\n /** On create: the folder to use (one found on disk), or null for the app's default profile. Ignored on update. */\n profile_locator: AppProfileLocator.nullable(),\n /** On create with profile_locator null: make a new folder named after display_name instead. */\n new_folder: z.boolean().default(false),\n});\nexport const AppsProfilesSaveResult = AppProfile;\n\n/** Remove the row (soft delete). The folder on disk is never touched. */\nexport const AppsProfilesRemoveParams = z.strictObject({ id: AppProfileId });\nexport const AppsProfilesRemoveResult = z.strictObject({ removed: z.boolean() });\n\n/** Open the app with a profile (its default profile when profile_id is absent). */\nexport const AppsOpenParams = z.strictObject({\n app_key: AppKey,\n profile_id: AppProfileId.optional(),\n});\nexport const AppsOpenResult = z.strictObject({\n /** True when an instance with this profile was already running; it is brought forward. */\n already_running: z.boolean(),\n folder: AbsPath.nullable(),\n});\n\n// Inferred (output) types — same name as the schema, so `AppInfo` is both the validator and its type.\nexport type AppKey = z.output<typeof AppKey>;\nexport type AppProfileId = z.output<typeof AppProfileId>;\nexport type AppProfileLocator = z.output<typeof AppProfileLocator>;\nexport type AppSupport = z.output<typeof AppSupport>;\nexport type AppFeatureStatus = z.output<typeof AppFeatureStatus>;\nexport type AppInfo = z.output<typeof AppInfo>;\nexport type AppUsageReading = z.output<typeof AppUsageReading>;\nexport type AppProfile = z.output<typeof AppProfile>;\nexport type AppsListParams = z.output<typeof AppsListParams>;\nexport type AppsListResult = z.output<typeof AppsListResult>;\nexport type AppsProfilesListParams = z.output<typeof AppsProfilesListParams>;\nexport type AppsProfilesListResult = z.output<typeof AppsProfilesListResult>;\nexport type AppsProfilesSaveParams = z.output<typeof AppsProfilesSaveParams>;\nexport type AppsProfilesSaveResult = z.output<typeof AppsProfilesSaveResult>;\nexport type AppsProfilesRemoveParams = z.output<typeof AppsProfilesRemoveParams>;\nexport type AppsProfilesRemoveResult = z.output<typeof AppsProfilesRemoveResult>;\nexport type AppsOpenParams = z.output<typeof AppsOpenParams>;\nexport type AppsOpenResult = z.output<typeof AppsOpenResult>;\n","/**\n * @ai-matrx/desktop-protocol — the internal envelope between Matrx 2's core and its supervised\n * Python services (SPEC §3.10). Schema source: lint-enforced rules in scripts/check-schema-source.mjs.\n *\n * Never seen by a client: clients speak the Router protocol (envelope.ts); a capability owner in\n * the core forwards a Router op to its service op (SERVICES in registry.ts). One local socket per\n * service (a Unix socket on macOS/Linux, a named pipe on Windows). Each message is one frame:\n * a 4-byte big-endian length, then that many bytes of UTF-8 JSON (at most SERVICE_MAX_FRAME_BYTES).\n *\n * The first message on a connection is `hello` (the per-launch token the core handed the service\n * in its environment, plus the contract hash it was built against). A wrong token or a different\n * contract is answered with `error` id 0 and the connection is closed: the two sides of the\n * connection were generated from different contracts and must never talk (SPEC P11).\n */\nimport { z } from \"zod\";\nimport { ProtocolErrorBody } from \"./errors\";\nimport { nonNegInt, u32 } from \"./primitives\";\n\n/** The largest frame either side accepts (16 MiB). */\nexport const SERVICE_MAX_FRAME_BYTES = 16_777_216 as const;\n\n/** Supervised Python services. `tools` joins when it is built. */\nexport const ServiceName = z.enum([\"ml\"]);\n\n/** SHA-256 (hex) of generated/desktop-protocol.schema.json: CONTRACT_SHA256 on both sides. */\nexport const ContractHash = z.string().regex(/^[0-9a-f]{64}$/);\n\n/** The per-launch secret: 32 random bytes, base64url (43 characters). Passed by environment, never argv. */\nexport const ServiceToken = z.string().regex(/^[A-Za-z0-9_-]{43}$/);\n\n/** Request ids on a service connection: 1 and up; 0 answers a refused hello. (u32, inlined.) */\nconst ServiceRequestId = u32;\n\nexport const ServiceHello = z.strictObject({ type: z.literal(\"hello\"), token: ServiceToken, contract: ContractHash });\n\nexport const ServiceWelcome = z.strictObject({\n type: z.literal(\"welcome\"),\n service: ServiceName,\n contract: ContractHash,\n pid: nonNegInt,\n /** The interpreter's version, e.g. \"3.13.15\". */\n python: z.string().max(32),\n /** Every op this service serves; must equal SERVICES[service] exactly. */\n ops: z.array(z.string().min(1).max(64)).max(64),\n});\n\nexport const ServiceRequest = z.strictObject({\n type: z.literal(\"request\"),\n id: ServiceRequestId,\n op: z.string().min(1).max(64),\n params: z.unknown(), // validated by the service against SERVICES[service][op].params\n});\n\nexport const ServiceResponse = z.strictObject({\n type: z.literal(\"response\"),\n id: ServiceRequestId,\n result: z.unknown(), // validated by the core against SERVICES[service][op].result\n});\n\nexport const ServiceErrorMsg = z.strictObject({ type: z.literal(\"error\"), id: ServiceRequestId, error: ProtocolErrorBody });\n\n/** A running request's progress (validated against the service's progress schema). */\nexport const ServiceProgressMsg = z.strictObject({ type: z.literal(\"progress\"), id: ServiceRequestId, progress: z.unknown() });\n\nexport const ServiceCancel = z.strictObject({ type: z.literal(\"cancel\"), id: ServiceRequestId });\n\n/** Health check: the service answers `pong` at once from its event loop, even while it works. */\nexport const ServicePing = z.strictObject({ type: z.literal(\"ping\"), id: ServiceRequestId });\nexport const ServicePong = z.strictObject({\n type: z.literal(\"pong\"),\n id: ServiceRequestId,\n /** Requests running now. */\n busy: nonNegInt,\n});\n\n/** Finish quickly: cancel running work, answer nothing more, exit 0. */\nexport const ServiceShutdown = z.strictObject({ type: z.literal(\"shutdown\") });\n\nexport const CoreToServiceMsg = z.discriminatedUnion(\"type\", [ServiceHello, ServiceRequest, ServiceCancel, ServicePing, ServiceShutdown]);\nexport const ServiceToCoreMsg = z.discriminatedUnion(\"type\", [ServiceWelcome, ServiceResponse, ServiceErrorMsg, ServiceProgressMsg, ServicePong]);\n\nexport type ServiceName = z.output<typeof ServiceName>;\nexport type CoreToServiceMsg = z.output<typeof CoreToServiceMsg>;\nexport type ServiceToCoreMsg = z.output<typeof ServiceToCoreMsg>;\nexport type ServiceWelcome = z.output<typeof ServiceWelcome>;\n","/**\n * @ai-matrx/desktop-protocol — local tool proof records (SPEC §10). Schema source: lint-enforced\n * rules in scripts/check-schema-source.mjs.\n *\n * A tool is \"working\" only when three levels pass: programmatic (its owner, called directly on the\n * real OS), protocol (through the transports, including the relay), chat (a real platform agent in a\n * real chat calls it and gets the right result). Every harness that proves a level — the desktop's\n * vitest suites, aidream's live pytest — writes `ToolResultsFile`s; the status table is generated\n * from them (src/tools/status.ts) and is never written by hand. This file is the one contract\n * between those harnesses: the Pydantic twin in aidream/_generated/desktop_protocol.py is generated\n * from it, so the Python writers and the TS reader cannot drift.\n */\nimport { z } from \"zod\";\n\nexport const ToolLevel = z.enum([\"programmatic\", \"protocol\", \"chat\"]);\nexport const ToolOutcome = z.enum([\"pass\", \"fail\", \"skip\"]);\nexport const ToolPlatform = z.enum([\"darwin\", \"win32\", \"linux\"]);\n/**\n * How the call reached the owner. `in_process` is level 1; `localhost` and `relay` are level 2;\n * `agent` is level 3 (a model chose the call). `relay` means the platform's real path: a matrx-ai\n * tool → aidream local-proxy → the relay → the device.\n */\nexport const ToolTransport = z.enum([\"in_process\", \"localhost\", \"relay\", \"agent\"]);\n\n/** Tool names are the platform registry's (`tool.definition.name`): `fs_read`, `shell_execute`… */\nexport const ToolName = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-z][a-z0-9_]*$/);\n\nexport const ToolLevelResult = z.strictObject({\n tool: ToolName,\n level: ToolLevel,\n platform: ToolPlatform,\n transport: ToolTransport,\n outcome: ToolOutcome,\n /** True when the caller sat on a different network from the device (a phone on cellular, CI). */\n remote_network: z.boolean(),\n /** One line: what was asserted, or why it failed. Never a token, a file's contents or a path under a real home. */\n detail: z.string().max(500),\n /** The harness that produced it, e.g. `matrx-desktop test/tools/programmatic.test.ts`. */\n suite: z.string().min(1).max(200),\n /** The test case inside the suite. */\n test: z.string().min(1).max(300),\n run_at_ms: z.int().min(0),\n});\n\nexport const ToolResultsFile = z.strictObject({\n schema: z.literal(\"matrx.tool-results.v1\"),\n /** The producing repo's commit (short or full SHA). */\n commit: z.string().min(4).max(64),\n results: z.array(ToolLevelResult).max(10_000),\n});\n\nexport type ToolLevel = z.output<typeof ToolLevel>;\nexport type ToolOutcome = z.output<typeof ToolOutcome>;\nexport type ToolPlatform = z.output<typeof ToolPlatform>;\nexport type ToolTransport = z.output<typeof ToolTransport>;\nexport type ToolLevelResult = z.output<typeof ToolLevelResult>;\nexport type ToolResultsFile = z.output<typeof ToolResultsFile>;\n","/** @ai-matrx/desktop-protocol — the op and event registries (Router, client and Python are generated from these). */\nimport { z } from \"zod\";\nimport {\n AbsPath,\n DeviceId,\n ProtocolVersion,\n RequestId,\n ResourceId,\n} from \"./primitives\";\nimport {\n ErrorCode,\n ErrorReason,\n FsPatchEditFailure,\n ProtocolErrorBody,\n} from \"./errors\";\nimport {\n FrameHeader,\n RelayHopEnvelopeHeader,\n RelayHopConnectionEnd,\n} from \"./frame\";\nimport {\n CancelMsg,\n ClientToCoreMsg,\n ClientType,\n CoreToClientMsg,\n CreditMsg,\n EndMsg,\n EndReason,\n ErrorMsg,\n EventMsg,\n HelloMsg,\n Limits,\n OpDescriptor,\n RelayMsg,\n RequestMsg,\n ResponseMsg,\n StreamMeta,\n StreamMsg,\n Welcome,\n CloseCodeValue,\n} from \"./envelope\";\nimport {\n OsPermissionName,\n SysinfoGetParams,\n SysinfoGetResult,\n} from \"./sysinfo\";\nimport {\n FsChange,\n FsChangedEvent,\n FsDeleteParams,\n FsDeleteResult,\n FsEncoding,\n FsEntry,\n FsKind,\n FsListParams,\n FsListResult,\n FsMkdirParams,\n FsMkdirResult,\n FsMoveParams,\n FsMoveResult,\n FsPatchEditApplied,\n FsPatchParams,\n FsPatchResult,\n FsReadParams,\n FsReadResult,\n FsReadStreamParams,\n FsReadStreamResult,\n FsSearchContentParams,\n FsSearchContentResult,\n FsSearchPathsParams,\n FsSearchPathsResult,\n FsStatParams,\n FsStatResult,\n FsWatchParams,\n FsWatchResult,\n FsWriteParams,\n FsWriteResult,\n} from \"./fs\";\nimport {\n ExecCwdEvent,\n ExecExitedEvent,\n ExecListParams,\n ExecListResult,\n ExecPtyKillParams,\n ExecPtyKillResult,\n ExecPtyResizeParams,\n ExecPtyResizeResult,\n ExecPtySignalParams,\n ExecPtySignalResult,\n ExecPtyStartParams,\n ExecPtyStartResult,\n ExecPtyWriteParams,\n ExecPtyWriteResult,\n ExecRunParams,\n ExecRunResult,\n ExecTitleEvent,\n PtyInfo,\n Signal,\n} from \"./exec\";\nimport {\n ResourceInfo,\n SessionAttachParams,\n SessionAttachResult,\n SessionControlChangedEvent,\n SessionDetachParams,\n SessionDetachResult,\n SessionListParams,\n SessionListResult,\n SessionReleaseParams,\n SessionReleaseResult,\n} from \"./session\";\nimport {\n MlInstallPhase,\n MlInstallProgress,\n MlProgress,\n MlRuntimeState,\n MlServiceState,\n MlServiceStatus,\n MlStatusParams,\n MlStatusResult,\n ModelsInstallParams,\n ModelsInstallResult,\n ModelsProgressEvent,\n ModelsStatusParams,\n ModelsStatusResult,\n ModelsTranscribeParams,\n ModelsTranscribeResult,\n TranscriptionModelId,\n TranscriptionModelInfo,\n TranscriptSegment,\n} from \"./models\";\nimport {\n ContractHash,\n CoreToServiceMsg,\n ServiceCancel,\n ServiceErrorMsg,\n ServiceHello,\n ServiceName,\n ServicePing,\n ServicePong,\n ServiceProgressMsg,\n ServiceRequest,\n ServiceResponse,\n ServiceShutdown,\n ServiceToCoreMsg,\n ServiceToken,\n ServiceWelcome,\n} from \"./service\";\nimport {\n RelayAuthExpiringEvent,\n RelayCallRequest,\n RelayCallResponse,\n RelayDeviceStatusEvent,\n RelayCallHello,\n RelayCallEnvelope,\n} from \"./relay\";\nimport { ToolLevel, ToolLevelResult, ToolName, ToolOutcome, ToolPlatform, ToolResultsFile, ToolTransport } from \"./tools\";\n\nimport {\n AppFeatureStatus,\n AppInfo,\n AppKey,\n AppProfile,\n AppProfileId,\n AppProfileLocator,\n AppSupport,\n AppUsageReading,\n AppsListParams,\n AppsListResult,\n AppsOpenParams,\n AppsOpenResult,\n AppsProfilesListParams,\n AppsProfilesListResult,\n AppsProfilesRemoveParams,\n AppsProfilesRemoveResult,\n AppsProfilesSaveParams,\n AppsProfilesSaveResult,\n} from \"./apps\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Registries — the Router, the client and the Python side are all generated from these.\n// kind: unary = response only; stream = response, then stream/end on the same id;\n// resource = like stream and the result carries a resource_id the Session Manager owns.\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type OpSpec = {\n readonly params: z.ZodType;\n readonly result: z.ZodType;\n readonly kind: \"unary\" | \"stream\" | \"resource\";\n readonly since: \"1.0\" | \"1.2\";\n readonly errors: readonly z.infer<typeof ErrorCode>[];\n};\n\nconst FS_ERR = [\"NOT_FOUND\", \"PERMISSION_DENIED_OS\", \"INVALID_PARAMS\", \"RESOURCE_BUSY\", \"INTERNAL\"] as const;\n\nexport const OPS = {\n \"sysinfo.get\": { params: SysinfoGetParams, result: SysinfoGetResult, kind: \"unary\", since: \"1.0\", errors: [\"INTERNAL\"] },\n\n \"fs.list\": { params: FsListParams, result: FsListResult, kind: \"unary\", since: \"1.0\", errors: FS_ERR },\n \"fs.stat\": { params: FsStatParams, result: FsStatResult, kind: \"unary\", since: \"1.0\", errors: FS_ERR },\n \"fs.read\": { params: FsReadParams, result: FsReadResult, kind: \"unary\", since: \"1.0\", errors: [...FS_ERR, \"PAYLOAD_TOO_LARGE\"] },\n \"fs.read_stream\": { params: FsReadStreamParams, result: FsReadStreamResult, kind: \"stream\", since: \"1.0\", errors: [...FS_ERR, \"CANCELLED\"] },\n \"fs.write\": { params: FsWriteParams, result: FsWriteResult, kind: \"unary\", since: \"1.0\", errors: [...FS_ERR, \"CONFLICT\", \"PAYLOAD_TOO_LARGE\"] },\n \"fs.mkdir\": { params: FsMkdirParams, result: FsMkdirResult, kind: \"unary\", since: \"1.0\", errors: [...FS_ERR, \"CONFLICT\"] },\n \"fs.move\": { params: FsMoveParams, result: FsMoveResult, kind: \"unary\", since: \"1.0\", errors: [...FS_ERR, \"CONFLICT\"] },\n \"fs.delete\": { params: FsDeleteParams, result: FsDeleteResult, kind: \"unary\", since: \"1.0\", errors: FS_ERR },\n \"fs.watch\": { params: FsWatchParams, result: FsWatchResult, kind: \"resource\", since: \"1.0\", errors: [...FS_ERR, \"RATE_LIMITED\"] },\n \"fs.patch\": { params: FsPatchParams, result: FsPatchResult, kind: \"unary\", since: \"1.0\", errors: [...FS_ERR, \"CONFLICT\"] },\n \"fs.search_paths\": { params: FsSearchPathsParams, result: FsSearchPathsResult, kind: \"unary\", since: \"1.0\", errors: [...FS_ERR, \"TIMEOUT\"] },\n \"fs.search_content\": { params: FsSearchContentParams, result: FsSearchContentResult, kind: \"unary\", since: \"1.0\", errors: [...FS_ERR, \"TIMEOUT\"] },\n\n \"exec.pty.start\": { params: ExecPtyStartParams, result: ExecPtyStartResult, kind: \"resource\", since: \"1.0\", errors: [\"INVALID_PARAMS\", \"NOT_FOUND\", \"RATE_LIMITED\", \"PLATFORM_UNSUPPORTED\", \"INTERNAL\"] },\n \"exec.pty.write\": { params: ExecPtyWriteParams, result: ExecPtyWriteResult, kind: \"unary\", since: \"1.0\", errors: [\"RESOURCE_GONE\", \"AUTH_FORBIDDEN\", \"INVALID_PARAMS\"] },\n \"exec.pty.resize\": { params: ExecPtyResizeParams, result: ExecPtyResizeResult, kind: \"unary\", since: \"1.0\", errors: [\"RESOURCE_GONE\", \"AUTH_FORBIDDEN\"] },\n \"exec.pty.signal\": { params: ExecPtySignalParams, result: ExecPtySignalResult, kind: \"unary\", since: \"1.0\", errors: [\"RESOURCE_GONE\", \"AUTH_FORBIDDEN\", \"PLATFORM_UNSUPPORTED\"] },\n \"exec.pty.kill\": { params: ExecPtyKillParams, result: ExecPtyKillResult, kind: \"unary\", since: \"1.0\", errors: [\"RESOURCE_GONE\", \"AUTH_FORBIDDEN\"] },\n \"exec.list\": { params: ExecListParams, result: ExecListResult, kind: \"unary\", since: \"1.0\", errors: [\"INTERNAL\"] },\n \"exec.run\": { params: ExecRunParams, result: ExecRunResult, kind: \"unary\", since: \"1.0\", errors: [\"INVALID_PARAMS\", \"NOT_FOUND\", \"TIMEOUT\", \"CANCELLED\", \"INTERNAL\"] },\n\n \"session.attach\": { params: SessionAttachParams, result: SessionAttachResult, kind: \"stream\", since: \"1.0\", errors: [\"RESOURCE_GONE\", \"AUTH_FORBIDDEN\", \"RESOURCE_BUSY\"] },\n \"session.detach\": { params: SessionDetachParams, result: SessionDetachResult, kind: \"unary\", since: \"1.0\", errors: [\"RESOURCE_GONE\"] },\n \"session.release\": { params: SessionReleaseParams, result: SessionReleaseResult, kind: \"unary\", since: \"1.0\", errors: [\"RESOURCE_GONE\", \"AUTH_FORBIDDEN\"] },\n \"session.list\": { params: SessionListParams, result: SessionListResult, kind: \"unary\", since: \"1.0\", errors: [\"INTERNAL\"] },\n\n // Local models (SPEC §6), served by the `ml` Python service through SERVICES below.\n \"models.status\": { params: ModelsStatusParams, result: ModelsStatusResult, kind: \"unary\", since: \"1.2\", errors: [\"INTERNAL\"] },\n \"models.install\": { params: ModelsInstallParams, result: ModelsInstallResult, kind: \"unary\", since: \"1.2\", errors: [\"RESOURCE_BUSY\", \"RESOURCE_GONE\", \"TIMEOUT\", \"CANCELLED\", \"INTERNAL\"] },\n \"models.transcribe\": { params: ModelsTranscribeParams, result: ModelsTranscribeResult, kind: \"unary\", since: \"1.2\", errors: [\"NOT_FOUND\", \"INVALID_PARAMS\", \"PERMISSION_DENIED_OS\", \"RESOURCE_BUSY\", \"RESOURCE_GONE\", \"CANCELLED\", \"PAYLOAD_TOO_LARGE\", \"INTERNAL\"] },\n\n // Desktop apps and their profiles (SPEC §6 apps); profiles are rows in users.desktop_app_profile.\n \"apps.list\": { params: AppsListParams, result: AppsListResult, kind: \"unary\", since: \"1.2\", errors: [\"INTERNAL\"] },\n \"apps.profiles.list\": { params: AppsProfilesListParams, result: AppsProfilesListResult, kind: \"unary\", since: \"1.2\", errors: [\"NOT_FOUND\", \"INVALID_PARAMS\", \"INTERNAL\"] },\n \"apps.profiles.save\": { params: AppsProfilesSaveParams, result: AppsProfilesSaveResult, kind: \"unary\", since: \"1.2\", errors: [\"AUTH_REQUIRED\", \"AUTH_FORBIDDEN\", \"NOT_FOUND\", \"INVALID_PARAMS\", \"CONFLICT\", \"PLATFORM_UNSUPPORTED\", \"DEVICE_OFFLINE\", \"INTERNAL\"] },\n \"apps.profiles.remove\": { params: AppsProfilesRemoveParams, result: AppsProfilesRemoveResult, kind: \"unary\", since: \"1.2\", errors: [\"AUTH_REQUIRED\", \"AUTH_FORBIDDEN\", \"NOT_FOUND\", \"DEVICE_OFFLINE\", \"INTERNAL\"] },\n \"apps.open\": { params: AppsOpenParams, result: AppsOpenResult, kind: \"unary\", since: \"1.2\", errors: [\"NOT_FOUND\", \"PLATFORM_UNSUPPORTED\", \"AUTH_REQUIRED\", \"DEVICE_OFFLINE\", \"INTERNAL\"] },\n} as const satisfies Record<string, OpSpec>;\n\nexport type OpName = keyof typeof OPS;\nexport type OpParams<N extends OpName> = z.input<(typeof OPS)[N][\"params\"]>;\nexport type OpResult<N extends OpName> = z.output<(typeof OPS)[N][\"result\"]>;\n\nexport const EVENTS = {\n \"fs.changed\": FsChangedEvent,\n \"exec.exited\": ExecExitedEvent,\n \"exec.title\": ExecTitleEvent,\n \"exec.cwd\": ExecCwdEvent,\n \"session.control_changed\": SessionControlChangedEvent,\n \"models.progress\": ModelsProgressEvent,\n \"relay.device_status\": RelayDeviceStatusEvent,\n \"relay.auth_expiring\": RelayAuthExpiringEvent,\n} as const satisfies Record<string, z.ZodType>;\n\nexport type EventName = keyof typeof EVENTS;\n\n/**\n * Supervised Python services (SPEC §3.10) and the ops each serves over its local socket\n * (src/schema/service.ts). The Python side's handler protocol, op table and models are generated\n * from this table (scripts/gen_pydantic.py); the core's service client is typed by it. A Router\n * op that a capability owner forwards uses the same params/result schemas as its service op.\n */\nexport type ServiceOpSpec = { readonly params: z.ZodType; readonly result: z.ZodType };\nexport type ServiceSpec = { readonly progress: z.ZodType; readonly ops: Readonly<Record<string, ServiceOpSpec>> };\n\nexport const SERVICES = {\n ml: {\n progress: MlProgress,\n ops: {\n \"ml.status\": { params: MlStatusParams, result: MlStatusResult },\n \"ml.install\": { params: ModelsInstallParams, result: ModelsInstallResult },\n \"ml.transcribe\": { params: ModelsTranscribeParams, result: ModelsTranscribeResult },\n },\n },\n} as const satisfies Record<z.infer<typeof ServiceName>, ServiceSpec>;\n\nexport type ServiceId = keyof typeof SERVICES;\nexport type ServiceOpName<S extends ServiceId> = keyof (typeof SERVICES)[S][\"ops\"] & string;\n\n/**\n * Every schema that lands in the generated JSON Schema `$defs` under a stable name (and so becomes a\n * named Pydantic model). Order is the emission order. A test asserts every exported schema of\n * src/schema/* is either listed here or is a documented alias of a listed one.\n * Registered into a PRIVATE zod registry by scripts/generate.ts — never `.meta()`/`.describe()`,\n * which write zod's process-global registry as an import side effect.\n */\nexport const NAMED_SCHEMAS = {\n ProtocolVersion,\n RequestId,\n ResourceId,\n DeviceId,\n AbsPath,\n ErrorCode,\n ErrorReason,\n FsPatchEditFailure,\n ProtocolErrorBody,\n FrameHeader,\n ClientType,\n Limits,\n OpDescriptor,\n Welcome,\n HelloMsg,\n RequestMsg,\n ResponseMsg,\n ErrorMsg,\n StreamMeta,\n StreamMsg,\n EndReason,\n EndMsg,\n CancelMsg,\n CreditMsg,\n EventMsg,\n RelayMsg,\n ClientToCoreMsg,\n CoreToClientMsg,\n OsPermissionName,\n SysinfoGetParams,\n SysinfoGetResult,\n FsKind,\n FsEntry,\n FsListParams,\n FsListResult,\n FsStatParams,\n FsEncoding,\n FsReadParams,\n FsReadResult,\n FsReadStreamParams,\n FsReadStreamResult,\n FsWriteParams,\n FsWriteResult,\n FsMkdirParams,\n FsMkdirResult,\n FsMoveParams,\n FsMoveResult,\n FsDeleteParams,\n FsDeleteResult,\n FsWatchParams,\n FsWatchResult,\n FsPatchEditApplied,\n FsPatchParams,\n FsPatchResult,\n FsSearchPathsParams,\n FsSearchPathsResult,\n FsSearchContentParams,\n FsSearchContentResult,\n FsChange,\n FsChangedEvent,\n Signal,\n ExecPtyStartParams,\n PtyInfo,\n ExecPtyWriteParams,\n ExecPtyWriteResult,\n ExecPtyResizeParams,\n ExecPtyResizeResult,\n ExecPtySignalParams,\n ExecPtySignalResult,\n ExecPtyKillParams,\n ExecPtyKillResult,\n ExecListParams,\n ExecListResult,\n ExecRunParams,\n ExecRunResult,\n ExecExitedEvent,\n ExecTitleEvent,\n ExecCwdEvent,\n SessionAttachParams,\n ResourceInfo,\n SessionDetachParams,\n SessionDetachResult,\n SessionReleaseParams,\n SessionReleaseResult,\n SessionListParams,\n SessionListResult,\n SessionControlChangedEvent,\n TranscriptionModelId,\n MlRuntimeState,\n MlInstallPhase,\n MlInstallProgress,\n TranscriptionModelInfo,\n TranscriptSegment,\n MlStatusParams,\n MlStatusResult,\n ModelsInstallParams,\n ModelsInstallResult,\n ModelsTranscribeParams,\n ModelsTranscribeResult,\n MlProgress,\n MlServiceState,\n MlServiceStatus,\n ModelsStatusParams,\n ModelsStatusResult,\n ModelsProgressEvent,\n ServiceName,\n ContractHash,\n ServiceToken,\n ServiceHello,\n ServiceWelcome,\n ServiceRequest,\n ServiceResponse,\n ServiceErrorMsg,\n ServiceProgressMsg,\n ServiceCancel,\n ServicePing,\n ServicePong,\n ServiceShutdown,\n CoreToServiceMsg,\n ServiceToCoreMsg,\n RelayDeviceStatusEvent,\n RelayAuthExpiringEvent,\n RelayCallRequest,\n RelayCallResponse,\n RelayCallHello,\n RelayCallEnvelope,\n RelayHopEnvelopeHeader,\n RelayHopConnectionEnd,\n CloseCodeValue,\n ToolLevel,\n ToolOutcome,\n ToolPlatform,\n ToolTransport,\n ToolName,\n ToolLevelResult,\n ToolResultsFile,\n AppKey,\n AppProfileId,\n AppProfileLocator,\n AppSupport,\n AppFeatureStatus,\n AppInfo,\n AppUsageReading,\n AppProfile,\n AppsListParams,\n AppsListResult,\n AppsProfilesListParams,\n AppsProfilesListResult,\n AppsProfilesSaveParams,\n AppsProfilesRemoveParams,\n AppsProfilesRemoveResult,\n AppsOpenParams,\n AppsOpenResult,\n} as const satisfies Record<string, z.ZodType>;\n\nexport type NamedSchemaId = keyof typeof NAMED_SCHEMAS;\n","/**\n * Version skew is the normal state: a phone, the server and a desktop app in the field run\n * different package versions, and a minor protocol bump must never make any of them fail.\n *\n * THE RULE (enforced by src/versioning.test.ts against generated/baseline-1.0.json):\n * 1. Within a major, a minor may only ADD. A field added after x.0 is OPTIONAL in the schema\n * (an older peer omits it) and is listed in FIELDS_SINCE with the minor that added it.\n * 2. A writer never sends a field newer than the version its peer negotiated (hello/welcome, or\n * the /call version header): older peers' strict schemas refuse unknown keys. `forPeer`\n * does the stripping; the core's Router applies it to every result and error it sends.\n * 3. A reader that needs a newer field checks the peer's version and says so loudly when the\n * peer is older (e.g. aidream's local_proxy marks a patch answer from a 1.0 app).\n */\nimport type { OpName } from \"./schema/registry\";\nimport type { ErrorReasonName } from \"./types\";\nimport { PROTOCOL_MAJOR, PROTOCOL_MINOR } from \"./schema/primitives\";\n\n/**\n * Fields added after x.0, by schema location: a named schema (`FsPatchResult`), a property path\n * inside one (`ProtocolErrorBody.data`), or a union branch (`RelayCallResponse|0`).\n */\nexport const FIELDS_SINCE = {\n FsPatchResult: { edits_applied: \"1.1\", edits_failed: \"1.1\" },\n \"ProtocolErrorBody.data\": { edits_failed: \"1.1\" },\n \"RelayCallResponse|0\": { protocol_version: \"1.1\" },\n \"RelayCallResponse|1\": { protocol_version: \"1.1\" },\n} as const satisfies Record<string, Record<string, `${number}.${number}`>>;\n\nexport type FieldsSincePath = keyof typeof FIELDS_SINCE;\n\n/**\n * 1.0 fields that a later minor lets be null, and what a peer older than that minor is sent\n * instead (the value that meant the same thing before). Widening a field any other way is a major.\n */\nexport const NULL_SINCE = {\n \"RelayDeviceStatusEvent.since_ms\": { since: \"1.1\", olderPeersGet: 0 },\n} as const satisfies Record<string, { since: `${number}.${number}`; olderPeersGet: unknown }>;\n\n/**\n * Error reasons added after x.0, with the minor that added each. An older peer's strict enum would\n * refuse the whole error body, so `forPeer` drops a reason the peer does not know (the code, the\n * message and `retryable` still tell it what happened).\n */\nexport const REASONS_SINCE = {\n runtime_not_installed: \"1.2\",\n model_not_installed: \"1.2\",\n unsupported_media: \"1.2\",\n download_failed: \"1.2\",\n service_starting: \"1.2\",\n service_restarted: \"1.2\",\n service_failed: \"1.2\",\n} as const satisfies Partial<Record<ErrorReasonName, `${number}.${number}`>>;\n\n/** A device status for a reader at `version`: `since_ms` null (\"never\") becomes 0 before 1.1. */\nexport function statusForPeer<T extends { since_ms: number | null }>(status: T, version: string): T {\n const rule = NULL_SINCE[\"RelayDeviceStatusEvent.since_ms\"];\n return status.since_ms === null && !knows(version, rule.since) ? { ...status, since_ms: rule.olderPeersGet } : status;\n}\n\n/**\n * A WebSocket client announces the newest minor it reads at connect time by also offering\n * `matrx.v<major>.<minor>` beside SUBPROTOCOL (servers still answer SUBPROTOCOL). Before hello is\n * possible, this is how the relay picks the right shape for its greeting.\n */\nexport function versionSubprotocol(version: string): string {\n return `matrx.v${version}`;\n}\n\n/** The version a client announced in its offered subprotocols; \"1.0\" when it did not. */\nexport function announcedVersion(offered: readonly string[]): string {\n let best = `${PROTOCOL_MAJOR}.0`;\n for (const p of offered) {\n const m = /^matrx\\.v(\\d+\\.\\d+)$/.exec(p.trim());\n if (m?.[1] && compareVersions(m[1], best) > 0 && m[1].startsWith(`${PROTOCOL_MAJOR}.`)) best = m[1];\n }\n return best;\n}\n\n/** \"1.10\" > \"1.9\". Same-major comparison of \"major.minor\" strings. */\nexport function compareVersions(a: string, b: string): number {\n const [am = 0, an = 0] = a.split(\".\").map(Number);\n const [bm = 0, bn = 0] = b.split(\".\").map(Number);\n return am - bm || an - bn;\n}\n\n/** True when a peer at `version` knows a field added in `since`. */\nexport function knows(version: string, since: string): boolean {\n return compareVersions(version, since) >= 0;\n}\n\n/** The version two peers speak: the lower minor within this major. */\nexport function negotiate(peerVersion: string): string {\n const [major = 0, minor = 0] = peerVersion.split(\".\").map(Number);\n if (major !== PROTOCOL_MAJOR) return `${PROTOCOL_MAJOR}.0`;\n return `${PROTOCOL_MAJOR}.${Math.min(minor, PROTOCOL_MINOR)}`;\n}\n\nfunction strip(value: unknown, fields: Record<string, string> | undefined, version: string): unknown {\n if (!fields || value === null || typeof value !== \"object\" || Array.isArray(value)) return value;\n let out: Record<string, unknown> | null = null;\n for (const [field, since] of Object.entries(fields)) {\n if (field in (value as object) && !knows(version, since)) {\n out ??= { ...(value as Record<string, unknown>) };\n delete out[field];\n }\n }\n return out ?? value;\n}\n\nconst RESULT_PATH = new Map<OpName, FieldsSincePath>([[\"fs.patch\", \"FsPatchResult\"]]);\n\n/**\n * What to send a peer that negotiated `version`: `result` of `op`, or an error body, with every\n * field newer than that version removed (rule 2). Unchanged for a current peer.\n */\nexport function forPeer(op: OpName, part: \"result\", value: unknown, version: string): unknown;\nexport function forPeer(op: OpName | null, part: \"error\", value: unknown, version: string): unknown;\nexport function forPeer(op: OpName | null, part: \"result\" | \"error\", value: unknown, version: string): unknown {\n if (part === \"result\") {\n const path = op ? RESULT_PATH.get(op) : undefined;\n return path ? strip(value, FIELDS_SINCE[path], version) : value;\n }\n if (value === null || typeof value !== \"object\") return value;\n const body = value as { data?: unknown };\n if (body.data === undefined) return value;\n let data = strip(body.data, FIELDS_SINCE[\"ProtocolErrorBody.data\"], version);\n const reason = (data as { reason?: unknown }).reason;\n const reasonSince = typeof reason === \"string\" ? (REASONS_SINCE as Record<string, string>)[reason] : undefined;\n if (reasonSince && !knows(version, reasonSince)) {\n const { reason: _dropped, ...rest } = data as Record<string, unknown>;\n data = rest;\n }\n return data === body.data ? value : { ...body, data };\n}\n\n/** Every op whose result has a versioned field is wired into forPeer (checked by the test). */\nexport const VERSIONED_RESULT_OPS: readonly OpName[] = [...RESULT_PATH.keys()];\n","// AUTO-GENERATED by scripts/generate.ts — DO NOT EDIT. `pnpm generate --check` fails on any hand edit.\n/** SHA-256 of generated/desktop-protocol.schema.json: the contract both sides of a service connection were built from. */\nexport const CONTRACT_SHA256 = \"ef9fd8c8ab611bf450730452a6cf48a4ebd566218b6e17e2834ef030fc2044cb\" as const;\n","/**\n * What a connecting side does after each WebSocket close — the ONE table every client reads (the\n * package client, the desktop's relay transport, any other dialer). Never keep a local list of\n * \"terminal\" codes: a code added to CloseCode without a rule here fails to compile.\n *\n * reconnect_now the far side went away on purpose or the socket died; dial again at once if the\n * connection had opened, with backoff otherwise (a dead network never spins).\n * reconnect transient refusal; dial again with backoff.\n * reauth the token was refused; get a FRESH token and dial once more. A second refusal in\n * a row (no successful open between) is terminal with outcome \"signed_out\".\n * stop retrying cannot help: stop dialing until something changes (a new sign-in, a\n * new device, an update) and show the outcome.\n */\nimport type { ErrorCodeName } from \"./types\";\nimport { CloseCode, type CloseCodeValue } from \"./schema/envelope\";\n\nexport type CloseAction = \"reconnect_now\" | \"reconnect\" | \"reauth\" | \"stop\";\n\n/** The one state a person is shown when dialing stops. */\nexport type CloseOutcome = \"signed_out\" | \"not_owned\" | \"removed\" | \"revoked\" | \"replaced\" | \"upgrade_required\";\n\nexport interface CloseRule {\n readonly action: CloseAction;\n /** Set for `stop` and `reauth` (the outcome when the fresh token is refused too). */\n readonly outcome?: CloseOutcome;\n /** The error a caller's pending work is failed with. */\n readonly error: readonly [ErrorCodeName, string];\n}\n\nexport const CLOSE_RULES = {\n [CloseCode.NORMAL]: { action: \"reconnect\", error: [\"DEVICE_OFFLINE\", \"Connection closed\"] },\n [CloseCode.GOING_AWAY]: { action: \"reconnect_now\", error: [\"DEVICE_OFFLINE\", \"Connection lost\"] },\n [CloseCode.ABNORMAL]: { action: \"reconnect_now\", error: [\"DEVICE_OFFLINE\", \"Connection lost\"] },\n [CloseCode.DEVICE_RECONNECTED]: { action: \"reconnect_now\", error: [\"DEVICE_OFFLINE\", \"Device reconnected\"] },\n [CloseCode.TRY_AGAIN_LATER]: { action: \"reconnect\", error: [\"DEVICE_OFFLINE\", \"Relay busy; retrying\"] },\n [CloseCode.AUTH_INVALID]: { action: \"reauth\", outcome: \"signed_out\", error: [\"AUTH_INVALID\", \"Sign-in was not accepted\"] },\n [CloseCode.AUTH_FORBIDDEN]: { action: \"stop\", outcome: \"not_owned\", error: [\"AUTH_FORBIDDEN\", \"Not this device's owner\"] },\n [CloseCode.DEVICE_NOT_FOUND]: { action: \"stop\", outcome: \"removed\", error: [\"NOT_FOUND\", \"Device not found\"] },\n [CloseCode.AUTH_EXPIRED]: { action: \"reauth\", outcome: \"signed_out\", error: [\"AUTH_EXPIRED\", \"Sign-in expired\"] },\n [CloseCode.REPLACED]: { action: \"stop\", outcome: \"replaced\", error: [\"CONFLICT\", \"Replaced by a newer connection\"] },\n [CloseCode.DEVICE_REVOKED]: { action: \"stop\", outcome: \"revoked\", error: [\"AUTH_DEVICE_REVOKED\", \"This device was revoked\"] },\n // A malformed message, or a connection the relay lost track of: a fresh socket starts clean.\n [CloseCode.PROTOCOL_ERROR]: { action: \"reconnect\", error: [\"PROTOCOL_ERROR\", \"Connection reset by the relay\"] },\n [CloseCode.UPGRADE_REQUIRED]: { action: \"stop\", outcome: \"upgrade_required\", error: [\"PROTOCOL_VERSION_UNSUPPORTED\", \"Protocol upgrade required\"] },\n} as const satisfies Record<CloseCodeValue, CloseRule>;\n\nconst UNKNOWN: CloseRule = { action: \"reconnect\", error: [\"DEVICE_OFFLINE\", \"Connection lost\"] };\n\n/** The rule for any close code; one this table does not know (or null: no close frame) reconnects with backoff. */\nexport function closeRule(code: number | null | undefined): CloseRule {\n if (code === null || code === undefined) return CLOSE_RULES[CloseCode.ABNORMAL];\n return (CLOSE_RULES as Record<number, CloseRule>)[code] ?? UNKNOWN;\n}\n\n/** True when dialing must stop after this close (no retry will help). */\nexport function isTerminalClose(code: number | null | undefined): boolean {\n return closeRule(code).action === \"stop\";\n}\n","/**\n * The local tool catalog (SPEC §10): every tool a platform agent calls on a person's computer, the\n * protocol ops it reaches, the group it ships in, and what became of each of matrx-local's 139\n * handlers (120 actions + the 19 action-enum dispatchers that fanned out to them).\n *\n * Data only. The status table (./status.ts) joins it with the harnesses' results, so a tool listed\n * here with no passing result reads \"untested\", never \"working\". Design and the reasons behind each\n * group: matrx-desktop/design/local-tools.md.\n */\nimport type { OpName } from \"../schema/registry\";\nimport type { ToolPlatform } from \"../schema/tools\";\n\nexport type ToolGroupId = \"files_shell\" | \"os_control\" | \"personal_automation\" | \"tools_service\" | \"ml_service\" | \"windows_admin\";\n\nexport interface ToolGroup {\n readonly id: ToolGroupId;\n readonly order: number;\n readonly title: string;\n /** Who implements the ops: a TS capability owner in the core, or a Python service. */\n readonly owner: \"core\" | \"python_tools\" | \"python_ml\";\n}\n\nexport const TOOL_GROUPS: readonly ToolGroup[] = [\n { id: \"files_shell\", order: 1, title: \"Files and shell\", owner: \"core\" },\n { id: \"os_control\", order: 2, title: \"Computer control\", owner: \"core\" },\n { id: \"personal_automation\", order: 3, title: \"Personal apps and automation\", owner: \"core\" },\n { id: \"tools_service\", order: 4, title: \"Documents, OCR and entities\", owner: \"python_tools\" },\n { id: \"ml_service\", order: 5, title: \"Speech\", owner: \"python_ml\" },\n { id: \"windows_admin\", order: 6, title: \"Windows administration\", owner: \"core\" },\n];\n\n/**\n * How an agent's call reaches the device. Both end at the relay's `POST /v1/devices/{id}/call`:\n * - `sandbox_proxy`: the cloud-sandbox-shaped tools (fs_*, shell_*). matrx-ai's `_sandbox_proxy`\n * calls aidream `/api/local-proxy/{device}/{fs|search|exec}/…`, which maps the route to its op.\n * Agent code never knows a laptop from a cloud box (SPEC §6.1).\n * - `device_op`: desktop-only capabilities. One generic route, `/api/local-proxy/{device}/op/{cap.op}`,\n * params and result exactly the op's schema; the tool definition is generated from that schema.\n * - `server`: runs on the aidream server even when the turn is bound to a device (a defect when\n * the tool reads a local path; see `note`).\n */\nexport type ToolPath = \"sandbox_proxy\" | \"device_op\" | \"server\";\n\n/** `built`: the ops exist and the tool is registered; `planned`: designed, not built; `broken`: registered but wrong on a device. */\nexport type ToolState = \"built\" | \"planned\" | \"broken\";\n\nexport interface CatalogTool {\n /** The platform registry name (`tool.definition.name`). */\n readonly name: string;\n readonly group: ToolGroupId;\n readonly state: ToolState;\n readonly path: ToolPath;\n /** Ops the tool sends. For `built` tools every one is in OPS (a test enforces it). */\n readonly ops: readonly string[];\n readonly platforms: readonly ToolPlatform[];\n /** One line for the status table. */\n readonly summary: string;\n /** Required for `broken`: what is wrong. */\n readonly note?: string;\n}\n\nconst ALL: readonly ToolPlatform[] = [\"darwin\", \"win32\", \"linux\"];\n\nexport const TOOL_CATALOG: readonly CatalogTool[] = [\n // ── 1. Files and shell (core `fs`, `exec`; the cloud sandbox's agent tools) ──────────────────\n { name: \"fs_read\", group: \"files_shell\", state: \"built\", path: \"sandbox_proxy\", ops: [\"fs.read\"], platforms: ALL, summary: \"Read a file, paged\" },\n { name: \"fs_write\", group: \"files_shell\", state: \"built\", path: \"sandbox_proxy\", ops: [\"fs.read\", \"fs.write\"], platforms: ALL, summary: \"Create or overwrite a file\" },\n { name: \"fs_edit\", group: \"files_shell\", state: \"built\", path: \"sandbox_proxy\", ops: [\"fs.read\", \"fs.patch\"], platforms: ALL, summary: \"Replace one exact string\" },\n { name: \"fs_patch\", group: \"files_shell\", state: \"built\", path: \"sandbox_proxy\", ops: [\"fs.read\", \"fs.patch\"], platforms: ALL, summary: \"Apply several exact edits at once\" },\n { name: \"fs_list\", group: \"files_shell\", state: \"built\", path: \"sandbox_proxy\", ops: [\"fs.list\"], platforms: ALL, summary: \"List a folder\" },\n { name: \"fs_mkdir\", group: \"files_shell\", state: \"built\", path: \"sandbox_proxy\", ops: [\"fs.mkdir\"], platforms: ALL, summary: \"Create a folder\" },\n { name: \"fs_search\", group: \"files_shell\", state: \"built\", path: \"sandbox_proxy\", ops: [\"fs.search_paths\", \"fs.search_content\"], platforms: ALL, summary: \"Find files by name or content\" },\n { name: \"shell_execute\", group: \"files_shell\", state: \"built\", path: \"sandbox_proxy\", ops: [\"exec.run\"], platforms: ALL, summary: \"Run a command in a folder\" },\n { name: \"shell_python\", group: \"files_shell\", state: \"built\", path: \"sandbox_proxy\", ops: [\"exec.run\"], platforms: ALL, summary: \"Run a Python script\" },\n {\n name: \"git_ingest\",\n group: \"files_shell\",\n state: \"broken\",\n path: \"server\",\n ops: [],\n platforms: ALL,\n summary: \"Digest a repository\",\n note: \"Armed with the files tools, but a local path is read on the server, not the bound device\",\n },\n { name: \"shell_job\", group: \"files_shell\", state: \"planned\", path: \"device_op\", ops: [\"exec.job.start\", \"exec.job.output\", \"exec.job.stop\"], platforms: ALL, summary: \"Background commands: start, read output, stop\" },\n\n // ── 2. Computer control (TS owners) ──────────────────────────────────────────────────────────\n { name: \"desktop_process\", group: \"os_control\", state: \"planned\", path: \"device_op\", ops: [\"proc.list\", \"proc.ports\", \"proc.kill\", \"proc.launch_app\", \"proc.focus_app\", \"proc.installed_apps\"], platforms: ALL, summary: \"Processes, ports and apps\" },\n { name: \"desktop_system\", group: \"os_control\", state: \"planned\", path: \"device_op\", ops: [\"sysinfo.get\", \"system.open_url\", \"system.open_path\", \"system.notify\"], platforms: ALL, summary: \"System facts, open, notify\" },\n { name: \"desktop_clipboard\", group: \"os_control\", state: \"planned\", path: \"device_op\", ops: [\"clipboard.read\", \"clipboard.write\"], platforms: ALL, summary: \"Read and write the clipboard\" },\n { name: \"desktop_screen\", group: \"os_control\", state: \"planned\", path: \"device_op\", ops: [\"screen.list\", \"screen.capture\"], platforms: ALL, summary: \"Displays and screenshots\" },\n { name: \"desktop_window\", group: \"os_control\", state: \"planned\", path: \"device_op\", ops: [\"window.list\", \"window.focus\", \"window.move\", \"window.minimize\"], platforms: ALL, summary: \"Find, focus and arrange windows\" },\n { name: \"desktop_input\", group: \"os_control\", state: \"planned\", path: \"device_op\", ops: [\"input.type_text\", \"input.hotkey\", \"input.mouse_click\", \"input.mouse_move\"], platforms: ALL, summary: \"Keyboard and mouse\" },\n { name: \"desktop_audio\", group: \"os_control\", state: \"planned\", path: \"device_op\", ops: [\"audio.devices\", \"audio.record\", \"audio.play\"], platforms: ALL, summary: \"Audio devices, record, play\" },\n { name: \"desktop_power\", group: \"os_control\", state: \"planned\", path: \"device_op\", ops: [\"power.status\", \"power.prevent_sleep\"], platforms: ALL, summary: \"Battery and keep awake\" },\n { name: \"desktop_resources\", group: \"os_control\", state: \"planned\", path: \"device_op\", ops: [\"resources.snapshot\", \"resources.top\"], platforms: ALL, summary: \"CPU, memory and disk use\" },\n { name: \"fs_watch\", group: \"os_control\", state: \"planned\", path: \"device_op\", ops: [\"fs.watch\"], platforms: ALL, summary: \"Watch a folder for changes\" },\n\n // ── 3. Personal apps and automation ──────────────────────────────────────────────────────────\n { name: \"desktop_automation\", group: \"personal_automation\", state: \"planned\", path: \"device_op\", ops: [\"automation.script\"], platforms: [\"darwin\", \"win32\"], summary: \"AppleScript on a Mac, PowerShell on Windows\" },\n { name: \"desktop_mail\", group: \"personal_automation\", state: \"planned\", path: \"device_op\", ops: [\"mail.accounts\", \"mail.list\", \"mail.send\"], platforms: [\"darwin\"], summary: \"The Mail app\" },\n { name: \"desktop_messages\", group: \"personal_automation\", state: \"planned\", path: \"device_op\", ops: [\"messages.conversations\", \"messages.list\", \"messages.send\"], platforms: [\"darwin\"], summary: \"The Messages app\" },\n { name: \"desktop_contacts\", group: \"personal_automation\", state: \"planned\", path: \"device_op\", ops: [\"contacts.search\", \"contacts.get\"], platforms: [\"darwin\"], summary: \"Contacts\" },\n { name: \"desktop_calendar\", group: \"personal_automation\", state: \"planned\", path: \"device_op\", ops: [\"calendar.list\", \"calendar.create\", \"reminders.list\", \"reminders.create\"], platforms: [\"darwin\"], summary: \"Calendar and reminders\" },\n { name: \"desktop_photos\", group: \"personal_automation\", state: \"planned\", path: \"device_op\", ops: [\"photos.search\", \"photos.get\"], platforms: [\"darwin\"], summary: \"Photos library\" },\n { name: \"desktop_location\", group: \"personal_automation\", state: \"planned\", path: \"device_op\", ops: [\"location.get\"], platforms: [\"darwin\", \"win32\"], summary: \"Where the computer is\" },\n { name: \"desktop_net\", group: \"personal_automation\", state: \"planned\", path: \"device_op\", ops: [\"net.info\", \"net.wifi\", \"net.bluetooth\", \"net.devices\", \"net.mdns\", \"net.scan\", \"net.download\"], platforms: ALL, summary: \"Local network and downloads\" },\n\n // ── 4. Python `tools` service ────────────────────────────────────────────────────────────────\n { name: \"desktop_documents\", group: \"tools_service\", state: \"planned\", path: \"device_op\", ops: [\"tools.pdf_extract\", \"tools.office_generate\", \"tools.ocr\", \"tools.image_resize\"], platforms: ALL, summary: \"PDF text, Office files, OCR, images\" },\n { name: \"desktop_entities\", group: \"tools_service\", state: \"planned\", path: \"device_op\", ops: [\"tools.ner\", \"tools.pii\"], platforms: ALL, summary: \"Names and private data, found on the device\" },\n\n // ── 5. Python `ml` service ───────────────────────────────────────────────────────────────────\n // Built: models.transcribe through local_proxy's POST /op/{cap.op} (matrx-ai implementations/desktop.py).\n // Whisper detects the language itself, so matrx-local's speech_locales needs no op of its own.\n { name: \"desktop_transcribe\", group: \"ml_service\", state: \"built\", path: \"device_op\", ops: [\"models.transcribe\"], platforms: ALL, summary: \"Speech to text on the device\" },\n\n // ── 6. Windows administration ────────────────────────────────────────────────────────────────\n { name: \"desktop_windows_admin\", group: \"windows_admin\", state: \"planned\", path: \"device_op\", ops: [\"windows.registry_read\", \"windows.registry_write\", \"windows.services\", \"windows.service_control\", \"windows.event_log\", \"windows.features\"], platforms: [\"win32\"], summary: \"Registry, services, event log\" },\n];\n\n/** What became of one matrx-local handler. */\nexport type LegacyDisposition =\n | { readonly kind: \"tool\"; readonly tool: string }\n | { readonly kind: \"dropped\"; readonly reason: string };\n\nconst tool = (name: string): LegacyDisposition => ({ kind: \"tool\", tool: name });\nconst dropped = (reason: string): LegacyDisposition => ({ kind: \"dropped\", reason });\n\nconst SHELL_COVERS = \"Done with shell_execute (mv, cp, rm, tar), as every coding agent does\";\nconst CLOUD_SCRAPER = \"The cloud scraper and research tools run with this computer as their network (the `proxy` capability)\";\n\n/** matrx-local's 120 actions (`app/tools/actions.py` ACTION_GROUPS), keyed `<mega tool>.<action>`. */\nexport const LEGACY_ACTIONS: Readonly<Record<string, LegacyDisposition>> = {\n \"local_file.read\": tool(\"fs_read\"),\n \"local_file.write\": tool(\"fs_write\"),\n \"local_file.edit\": tool(\"fs_edit\"),\n \"local_file.move\": dropped(SHELL_COVERS),\n \"local_file.copy\": dropped(SHELL_COVERS),\n \"local_file.delete\": dropped(SHELL_COVERS),\n \"local_file.rename\": dropped(SHELL_COVERS),\n \"local_file.mkdir\": tool(\"fs_mkdir\"),\n \"local_file.glob\": tool(\"fs_search\"),\n \"local_file.grep\": tool(\"fs_search\"),\n \"local_file.list\": tool(\"fs_list\"),\n \"local_file.places\": dropped(\"The device's home and folders reach the agent in its binding briefing (sysinfo.get)\"),\n \"local_file.find\": tool(\"fs_search\"),\n \"local_file.semantic_find\": dropped(\"Needs a local embedding index; returns with file sync's index, not before\"),\n\n \"local_shell.run\": tool(\"shell_execute\"),\n \"local_shell.output\": tool(\"shell_job\"),\n \"local_shell.stop\": tool(\"shell_job\"),\n\n \"local_window.list\": tool(\"desktop_window\"),\n \"local_window.focus\": tool(\"desktop_window\"),\n \"local_window.move\": tool(\"desktop_window\"),\n \"local_window.minimize\": tool(\"desktop_window\"),\n\n \"local_process.list\": tool(\"desktop_process\"),\n \"local_process.ports\": tool(\"desktop_process\"),\n \"local_process.launch_app\": tool(\"desktop_process\"),\n \"local_process.kill\": tool(\"desktop_process\"),\n \"local_process.focus_app\": tool(\"desktop_process\"),\n \"local_process.terminals\": dropped(\"Matrx 2 terminals are exec sessions; the person's own terminal windows are not the agent's\"),\n \"local_process.tail_terminal\": dropped(\"Matrx 2 terminals are exec sessions; the person's own terminal windows are not the agent's\"),\n \"local_process.installed_apps\": tool(\"desktop_process\"),\n\n \"local_input.type_text\": tool(\"desktop_input\"),\n \"local_input.hotkey\": tool(\"desktop_input\"),\n \"local_input.mouse_click\": tool(\"desktop_input\"),\n \"local_input.mouse_move\": tool(\"desktop_input\"),\n\n \"local_audio.devices\": tool(\"desktop_audio\"),\n \"local_audio.record\": tool(\"desktop_audio\"),\n \"local_audio.play\": tool(\"desktop_audio\"),\n \"local_audio.transcribe\": tool(\"desktop_transcribe\"),\n \"local_audio.transcribe_with_speech\": tool(\"desktop_transcribe\"),\n \"local_audio.speech_locales\": tool(\"desktop_transcribe\"),\n\n \"local_clipboard.read\": tool(\"desktop_clipboard\"),\n \"local_clipboard.write\": tool(\"desktop_clipboard\"),\n\n \"local_screen.screenshot\": tool(\"desktop_screen\"),\n \"local_screen.list\": tool(\"desktop_screen\"),\n \"local_screen.capture_book\": dropped(\"A one-off loop of screenshot plus page turn; the agent composes it from desktop_screen and desktop_input\"),\n\n \"local_system.info\": tool(\"desktop_system\"),\n \"local_system.open_url\": tool(\"desktop_system\"),\n \"local_system.open_path\": tool(\"desktop_system\"),\n \"local_system.notify\": tool(\"desktop_system\"),\n\n \"local_browser.navigate\": dropped(\"The browser agent is the extension (matrx-extend) and the cloud browser; a second Playwright on the device duplicates it\"),\n \"local_browser.click\": dropped(\"The browser agent is the extension (matrx-extend) and the cloud browser\"),\n \"local_browser.type_text\": dropped(\"The browser agent is the extension (matrx-extend) and the cloud browser\"),\n \"local_browser.extract\": dropped(\"The browser agent is the extension (matrx-extend) and the cloud browser\"),\n \"local_browser.screenshot\": dropped(\"The browser agent is the extension (matrx-extend) and the cloud browser\"),\n \"local_browser.eval\": dropped(\"The browser agent is the extension (matrx-extend) and the cloud browser\"),\n \"local_browser.tabs\": dropped(\"The browser agent is the extension (matrx-extend) and the cloud browser\"),\n \"local_browser.close\": dropped(\"The browser agent is the extension (matrx-extend) and the cloud browser\"),\n\n \"local_web.fetch\": dropped(CLOUD_SCRAPER),\n \"local_web.fetch_with_browser\": dropped(CLOUD_SCRAPER),\n \"local_web.scrape\": dropped(CLOUD_SCRAPER),\n \"local_web.search\": dropped(CLOUD_SCRAPER),\n \"local_web.research\": dropped(CLOUD_SCRAPER),\n \"local_web.download\": tool(\"desktop_net\"),\n \"local_web.upload\": dropped(\"Uploads are cloud files (matrx-files) and file sync, one upload path\"),\n\n \"local_net.info\": tool(\"desktop_net\"),\n \"local_net.scan\": tool(\"desktop_net\"),\n \"local_net.port_scan\": tool(\"desktop_net\"),\n \"local_net.mdns_discover\": tool(\"desktop_net\"),\n \"local_net.wifi_networks\": tool(\"desktop_net\"),\n \"local_net.bluetooth_devices\": tool(\"desktop_net\"),\n \"local_net.connected_devices\": tool(\"desktop_net\"),\n\n \"local_monitor.resources\": tool(\"desktop_resources\"),\n \"local_monitor.battery\": tool(\"desktop_power\"),\n \"local_monitor.disk_usage\": tool(\"desktop_resources\"),\n \"local_monitor.top_processes\": tool(\"desktop_resources\"),\n \"local_monitor.watch_directory\": tool(\"fs_watch\"),\n \"local_monitor.watch_events\": tool(\"fs_watch\"),\n \"local_monitor.stop_watch\": tool(\"fs_watch\"),\n \"local_monitor.heartbeat\": dropped(\"The relay's device status replaces the heartbeat\"),\n\n \"local_schedule.create\": dropped(\"One scheduler: the platform's runs the agent on time and reaches the device through the relay\"),\n \"local_schedule.list\": dropped(\"One scheduler: the platform's runs the agent on time and reaches the device through the relay\"),\n \"local_schedule.cancel\": dropped(\"One scheduler: the platform's runs the agent on time and reaches the device through the relay\"),\n \"local_schedule.prevent_sleep\": tool(\"desktop_power\"),\n\n \"local_documents.list\": dropped(\"matrx-local's private document store is gone; documents are files (fs_*) or cloud Knowledge\"),\n \"local_documents.folders\": dropped(\"matrx-local's private document store is gone; documents are files (fs_*) or cloud Knowledge\"),\n \"local_documents.read\": dropped(\"matrx-local's private document store is gone; documents are files (fs_*) or cloud Knowledge\"),\n \"local_documents.write\": dropped(\"matrx-local's private document store is gone; documents are files (fs_*) or cloud Knowledge\"),\n \"local_documents.search\": dropped(\"matrx-local's private document store is gone; documents are files (fs_*) or cloud Knowledge\"),\n\n \"local_media.ocr\": tool(\"desktop_documents\"),\n \"local_media.resize\": tool(\"desktop_documents\"),\n \"local_media.pdf_extract\": tool(\"desktop_documents\"),\n \"local_media.office_generate\": tool(\"desktop_documents\"),\n \"local_media.archive_create\": dropped(SHELL_COVERS),\n \"local_media.archive_extract\": dropped(SHELL_COVERS),\n\n \"local_ner.entities\": tool(\"desktop_entities\"),\n \"local_ner.pii\": tool(\"desktop_entities\"),\n\n \"local_mac_apps.applescript\": tool(\"desktop_automation\"),\n \"local_mac_apps.list_emails\": tool(\"desktop_mail\"),\n \"local_mac_apps.send_email\": tool(\"desktop_mail\"),\n \"local_mac_apps.email_accounts\": tool(\"desktop_mail\"),\n \"local_mac_apps.list_messages\": tool(\"desktop_messages\"),\n \"local_mac_apps.list_conversations\": tool(\"desktop_messages\"),\n \"local_mac_apps.send_message\": tool(\"desktop_messages\"),\n \"local_mac_apps.search_contacts\": tool(\"desktop_contacts\"),\n \"local_mac_apps.get_contact\": tool(\"desktop_contacts\"),\n \"local_mac_apps.list_events\": tool(\"desktop_calendar\"),\n \"local_mac_apps.create_event\": tool(\"desktop_calendar\"),\n \"local_mac_apps.list_reminders\": tool(\"desktop_calendar\"),\n \"local_mac_apps.create_reminder\": tool(\"desktop_calendar\"),\n \"local_mac_apps.search_photos\": tool(\"desktop_photos\"),\n \"local_mac_apps.get_photo\": tool(\"desktop_photos\"),\n \"local_mac_apps.location\": tool(\"desktop_location\"),\n\n \"local_windows_ps.run\": tool(\"desktop_automation\"),\n \"local_windows_ps.get_env\": dropped(\"Read with shell_execute; a per-command env rides exec.run\"),\n \"local_windows_ps.set_env\": dropped(\"Changing the person's persistent environment is not an agent tool\"),\n \"local_windows_ps.registry_read\": tool(\"desktop_windows_admin\"),\n \"local_windows_ps.registry_write\": tool(\"desktop_windows_admin\"),\n \"local_windows_ps.service_list\": tool(\"desktop_windows_admin\"),\n \"local_windows_ps.service_control\": tool(\"desktop_windows_admin\"),\n \"local_windows_ps.event_log\": tool(\"desktop_windows_admin\"),\n \"local_windows_ps.windows_features\": tool(\"desktop_windows_admin\"),\n};\n\n/**\n * matrx-local's 19 action-enum dispatchers. Each fanned an `action` out to the handlers above and\n * did nothing else; they retire with the `matrx-local` executor binding (the platform reaches a\n * device through the relay now, never by client delegation).\n */\nexport const LEGACY_DISPATCHERS: readonly string[] = [\n \"local_file\",\n \"local_shell\",\n \"local_window\",\n \"local_process\",\n \"local_input\",\n \"local_audio\",\n \"local_clipboard\",\n \"local_screen\",\n \"local_system\",\n \"local_browser\",\n \"local_web\",\n \"local_net\",\n \"local_monitor\",\n \"local_schedule\",\n \"local_documents\",\n \"local_media\",\n \"local_ner\",\n \"local_mac_apps\",\n \"local_windows_ps\",\n];\n\n/** Built tools' ops, typed: a built tool naming an op the protocol does not have fails to compile in the test. */\nexport function builtOps(): OpName[] {\n return TOOL_CATALOG.filter((t) => t.state === \"built\").flatMap((t) => t.ops as OpName[]);\n}\n","/**\n * The generated tool status table (SPEC §10): tool × level × platform, built ONLY from harness\n * results (`ToolResultsFile`) joined with the catalog. Never written by hand; the one status anyone\n * cites. `renderToolStatusMarkdown` is the committed text form; screens render `ToolStatus` itself.\n */\nimport { ToolResultsFile, type ToolLevel, type ToolLevelResult, type ToolPlatform, type ToolTransport } from \"../schema/tools\";\nimport { TOOL_CATALOG, TOOL_GROUPS, type CatalogTool, type ToolGroupId, type ToolState } from \"./catalog\";\n\nexport const TOOL_LEVELS: readonly ToolLevel[] = [\"programmatic\", \"protocol\", \"chat\"];\nexport const TOOL_PLATFORMS: readonly ToolPlatform[] = [\"darwin\", \"win32\", \"linux\"];\n\n/**\n * `pass`: every required proof passed and none failed. `partial`: passes so far, a required proof\n * missing (`missing` says which). `fail`: the latest run of some proof failed. `untested`: nothing\n * ran. `not_built`: the tool is planned. `unsupported`: the tool does not exist on this platform.\n */\nexport type CellState = \"pass\" | \"partial\" | \"fail\" | \"untested\" | \"not_built\" | \"unsupported\";\n\nexport interface StatusEvidence {\n readonly suite: string;\n readonly test: string;\n readonly transport: ToolTransport;\n readonly outcome: ToolLevelResult[\"outcome\"];\n readonly remote_network: boolean;\n readonly commit: string;\n readonly run_at_ms: number;\n readonly detail: string;\n}\n\nexport interface StatusCell {\n readonly state: CellState;\n /** Required proofs not yet passed, e.g. \"relay from another network\". */\n readonly missing: readonly string[];\n readonly last_run_at_ms: number | null;\n readonly evidence: readonly StatusEvidence[];\n}\n\nexport interface StatusRow {\n readonly tool: string;\n readonly group: ToolGroupId;\n readonly tool_state: ToolState;\n readonly summary: string;\n readonly note: string | null;\n readonly cells: Readonly<Record<ToolPlatform, Readonly<Record<ToolLevel, StatusCell>>>>;\n /** Working on a platform = all three levels pass there (SPEC §10). */\n readonly working: Readonly<Record<ToolPlatform, boolean>>;\n}\n\nexport interface ToolStatus {\n readonly schema: \"matrx.tool-status.v1\";\n readonly generated_at_ms: number;\n readonly commits: readonly string[];\n readonly rows: readonly StatusRow[];\n readonly totals: Readonly<Record<ToolPlatform, { readonly working: number; readonly built: number; readonly tools: number }>>;\n}\n\n/** What each level needs before it reads `pass`. Level 2 is the transports AND the relay from another network. */\nconst REQUIRED: Readonly<Record<ToolLevel, readonly { readonly label: string; readonly ok: (e: StatusEvidence) => boolean }[]>> = {\n programmatic: [{ label: \"in process\", ok: (e) => e.transport === \"in_process\" }],\n protocol: [\n { label: \"localhost\", ok: (e) => e.transport === \"localhost\" },\n { label: \"relay\", ok: (e) => e.transport === \"relay\" },\n { label: \"relay from another network\", ok: (e) => e.transport === \"relay\" && e.remote_network },\n ],\n chat: [{ label: \"a real agent in a real chat\", ok: (e) => e.transport === \"agent\" }],\n};\n\nfunction cellFor(tool: CatalogTool, platform: ToolPlatform, level: ToolLevel, evidence: StatusEvidence[]): StatusCell {\n if (!tool.platforms.includes(platform)) return { state: \"unsupported\", missing: [], last_run_at_ms: null, evidence: [] };\n // The latest run of each (suite, test, transport, network) decides; older runs are history.\n const latest = new Map<string, StatusEvidence>();\n for (const e of evidence) {\n const key = `${e.suite}\\u0000${e.test}\\u0000${e.transport}\\u0000${e.remote_network}`;\n const prev = latest.get(key);\n if (!prev || prev.run_at_ms < e.run_at_ms) latest.set(key, e);\n }\n const runs = [...latest.values()].filter((e) => e.outcome !== \"skip\").sort((a, b) => b.run_at_ms - a.run_at_ms);\n const last = runs[0]?.run_at_ms ?? null;\n if (tool.state === \"planned\" && runs.length === 0) return { state: \"not_built\", missing: [], last_run_at_ms: null, evidence: [] };\n if (runs.length === 0) return { state: \"untested\", missing: REQUIRED[level].map((r) => r.label), last_run_at_ms: null, evidence: [...latest.values()] };\n if (runs.some((e) => e.outcome === \"fail\")) return { state: \"fail\", missing: [], last_run_at_ms: last, evidence: runs };\n const missing = REQUIRED[level].filter((r) => !runs.some((e) => e.outcome === \"pass\" && r.ok(e))).map((r) => r.label);\n return { state: missing.length === 0 ? \"pass\" : \"partial\", missing, last_run_at_ms: last, evidence: runs };\n}\n\n/** Build the table from every results file. Throws when a file is off-contract (never silently skipped). */\nexport function buildToolStatus(files: readonly unknown[], opts: { readonly generatedAtMs: number }): ToolStatus {\n const parsed = files.map((f, i) => {\n const r = ToolResultsFile.safeParse(f);\n if (!r.success) throw new Error(`tool results file #${i} is off-contract: ${r.error.issues[0]?.path.join(\".\")} ${r.error.issues[0]?.message}`);\n return r.data;\n });\n const known = new Set(TOOL_CATALOG.map((t) => t.name));\n const byKey = new Map<string, StatusEvidence[]>();\n for (const file of parsed) {\n for (const r of file.results) {\n if (!known.has(r.tool)) throw new Error(`a result names ${r.tool}, which is not in the tool catalog`);\n const key = `${r.tool}|${r.platform}|${r.level}`;\n const list = byKey.get(key) ?? [];\n list.push({ suite: r.suite, test: r.test, transport: r.transport, outcome: r.outcome, remote_network: r.remote_network, commit: file.commit, run_at_ms: r.run_at_ms, detail: r.detail });\n byKey.set(key, list);\n }\n }\n const groupOrder = new Map(TOOL_GROUPS.map((g) => [g.id, g.order]));\n const tools = [...TOOL_CATALOG].sort((a, b) => (groupOrder.get(a.group) ?? 99) - (groupOrder.get(b.group) ?? 99));\n const rows: StatusRow[] = tools.map((tool) => {\n const cells = {} as Record<ToolPlatform, Record<ToolLevel, StatusCell>>;\n const working = {} as Record<ToolPlatform, boolean>;\n for (const platform of TOOL_PLATFORMS) {\n const perLevel = {} as Record<ToolLevel, StatusCell>;\n for (const level of TOOL_LEVELS) perLevel[level] = cellFor(tool, platform, level, byKey.get(`${tool.name}|${platform}|${level}`) ?? []);\n cells[platform] = perLevel;\n working[platform] = TOOL_LEVELS.every((l) => perLevel[l].state === \"pass\");\n }\n return { tool: tool.name, group: tool.group, tool_state: tool.state, summary: tool.summary, note: tool.note ?? null, cells, working };\n });\n const totals = {} as Record<ToolPlatform, { working: number; built: number; tools: number }>;\n for (const platform of TOOL_PLATFORMS) {\n const onPlatform = TOOL_CATALOG.filter((t) => t.platforms.includes(platform));\n totals[platform] = {\n working: rows.filter((r) => r.working[platform]).length,\n built: onPlatform.filter((t) => t.state !== \"planned\").length,\n tools: onPlatform.length,\n };\n }\n const commits = [...new Set(parsed.map((f) => f.commit))].sort();\n return { schema: \"matrx.tool-status.v1\", generated_at_ms: opts.generatedAtMs, commits, rows, totals };\n}\n\nconst MARK: Readonly<Record<CellState, string>> = { pass: \"✓\", partial: \"◐\", fail: \"✗\", untested: \"·\", not_built: \"—\", unsupported: \" \" };\n\n/** The committed text form. Columns: per platform, the three levels (P = programmatic, R = protocol, C = chat). */\nexport function renderToolStatusMarkdown(status: ToolStatus): string {\n const lines: string[] = [\n \"<!-- GENERATED by `pnpm tools:status` from test results. Never edit by hand. -->\",\n \"# Local tools: status\",\n \"\",\n `Generated ${new Date(status.generated_at_ms).toISOString()} from commits ${status.commits.join(\", \") || \"none\"}.`,\n \"\",\n \"✓ pass · ◐ passing so far, a required proof missing · ✗ fail · `·` untested · — not built. Levels: P programmatic, R protocol, C chat.\",\n \"\",\n \"| Platform | Working | Built | Tools |\",\n \"|---|---|---|---|\",\n ...TOOL_PLATFORMS.map((p) => `| ${p} | ${status.totals[p].working} | ${status.totals[p].built} | ${status.totals[p].tools} |`),\n \"\",\n ];\n for (const group of TOOL_GROUPS) {\n const rows = status.rows.filter((r) => r.group === group.id);\n if (rows.length === 0) continue;\n lines.push(`## ${group.order}. ${group.title}`, \"\", \"| Tool | darwin P R C | win32 P R C | linux P R C | Missing |\", \"|---|---|---|---|---|\");\n for (const r of rows) {\n const cols = TOOL_PLATFORMS.map((p) => TOOL_LEVELS.map((l) => MARK[r.cells[p][l].state]).join(\" \"));\n const missing = new Set<string>();\n for (const p of TOOL_PLATFORMS) for (const l of TOOL_LEVELS) for (const m of r.cells[p][l].missing) if (r.cells[p][l].state !== \"untested\") missing.add(`${p} ${l}: ${m}`);\n const name = r.tool_state === \"broken\" ? `${r.tool} (broken: ${r.note ?? \"\"})` : r.tool;\n lines.push(`| ${name} | ${cols.join(\" | \")} | ${[...missing].join(\"; \")} |`);\n }\n lines.push(\"\");\n }\n return lines.join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,E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KAAK,KAAK,IAAI,MAAMA,MAAK,KAAK,KAAK,CAAC,MAAM,CAAC,GAAG,OAAO,EAAE,KAAK,IAAI,CAAC,IAAI;AAAA,IAC7E;AACA,UAAM,KAAK,EAAE;AAAA,EACf;AACA,SAAO,MAAM,KAAK,IAAI;AACxB;","names":["import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","tool","rows","cols"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/schema/primitives.ts","../src/schema/errors.ts","../src/schema/frame.ts","../src/error.ts","../src/frame.ts","../src/schema/envelope.ts","../src/schema/sysinfo.ts","../src/schema/fs.ts","../src/schema/exec.ts","../src/schema/session.ts","../src/schema/relay.ts","../src/schema/models.ts","../src/schema/apps.ts","../src/schema/service.ts","../src/schema/tools.ts","../src/schema/registry.ts","../src/versioning.ts","../src/contract.ts","../src/close-policy.ts","../src/tools/catalog.ts","../src/tools/status.ts"],"sourcesContent":["/**\n * `@ai-matrx/desktop-protocol` — the one wire contract between Matrx 2 (the desktop core) and every\n * client (phone, web app, extension, server). SPEC P11: this zod source is THE source; the JSON\n * Schema in generated/ and the Pydantic models in aidream/_generated/desktop_protocol.py are\n * generated from it and CI fails on any drift (`pnpm generate --check`).\n *\n * Entries: `.` (schemas, OPS, EVENTS, error codes) · `./frame` (binary frame codec, zod-free)\n * · `./client` (reconnecting request/stream/credit/reattach client) · `./react` (hooks).\n */\nexport * from \"./schema/primitives\";\nexport * from \"./schema/errors\";\nexport * from \"./schema/frame\";\nexport * from \"./schema/envelope\";\nexport * from \"./schema/sysinfo\";\nexport * from \"./schema/fs\";\nexport * from \"./schema/exec\";\nexport * from \"./schema/session\";\nexport * from \"./schema/relay\";\nexport * from \"./schema/models\";\nexport * from \"./schema/apps\";\nexport * from \"./schema/service\";\nexport * from \"./schema/tools\";\nexport * from \"./schema/registry\";\nexport * from \"./versioning\";\nexport * from \"./contract\";\nexport * from \"./close-policy\";\nexport * from \"./tools/catalog\";\nexport * from \"./tools/status\";\nexport {\n FRAME_HEADER_BYTES,\n FRAME_STRUCT_FORMAT,\n FRAME_VERSION,\n FrameChannel,\n FrameFlag,\n decodeFrame,\n encodeFrame,\n stampCid,\n readCid,\n hasFlag,\n assertFrameHeader,\n BROADCAST_CID,\n connectionEndFrame,\n isConnectionEnd,\n} from \"./frame\";\nexport type { DecodedFrame, FrameChannelValue } from \"./frame\";\nexport { DesktopProtocolError, isDesktopProtocolError } from \"./error\";\nexport type { ErrorCodeName, ErrorData, ErrorReasonName } from \"./types\";\n","/** @ai-matrx/desktop-protocol — version and primitive schemas. Schema source: lint-enforced rules in scripts/check-schema-source.mjs. */\nimport { z } from \"zod\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Version\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const PROTOCOL_MAJOR = 1 as const;\n/**\n * Minor history (same major = compatible; see src/versioning.ts for the rule and FIELDS_SINCE):\n * 1.0 — the first contract.\n * 1.1 — fs.patch per-edit results; /call reports the negotiated version;\n * device status since_ms is null for a device that never connected.\n * 1.2 — the `models` capability (local transcription) and its error reasons (REASONS_SINCE);\n * the `apps` capability (desktop apps, their profiles and usage).\n */\nexport const PROTOCOL_MINOR = 2 as const;\n/** This package's version as the wire spells it (\"major.minor\"): hello, welcome, relay status. */\nexport const PROTOCOL_VERSION = `${PROTOCOL_MAJOR}.${PROTOCOL_MINOR}` as const;\n/** \"major.minor\". Same major = compatible (minor adds optional fields/ops only). */\nexport const ProtocolVersion = z\n .string()\n .regex(/^[1-9][0-9]{0,2}\\.[0-9]{1,3}$/);\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Primitives\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Client-generated request id, unique per session. */\nexport const RequestId = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[A-Za-z0-9_-]+$/);\n\n/** Long-lived resource handle minted by the core: \"<kind>_<base62>\" (pty_…, watch_…). */\nexport const ResourceId = z\n .string()\n .regex(/^(pty|watch)_[A-Za-z0-9]{16,40}$/);\n\n/**\n * = app_instances.id. A plain pattern, NOT z.uuid(): z.uuid() emits `format: uuid` + `pattern`,\n * which datamodel-codegen renders as `Annotated[UUID, Field(pattern=...)]` — a model Pydantic can\n * never validate (\"Unable to apply constraint 'pattern' … of type 'uuid'\"). generate.ts now\n * refuses format+pattern on one node so this class cannot come back.\n */\nexport const DeviceId = z\n .string()\n .regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/);\n\n/**\n * Absolute, normalized path: forward slashes on every OS, NFC. POSIX \"/...\" or Windows \"C:/...\".\n * Normalization happens once, in the fs owner (SPEC §9); the wire never carries backslashes.\n */\nexport const AbsPath = z\n .string()\n .min(1)\n .max(4096)\n .regex(/^(\\/|[A-Za-z]:\\/)[^\\\\\\u0000]*$/);\n\n/** Internal building blocks — deliberately unnamed in $defs (inlined wherever used). */\nexport const u32 = z.int().min(0).max(4_294_967_295);\nexport const nonNegInt = z.int().min(0);\n/** Unix epoch milliseconds. */\nexport const epochMs = z.int().min(0);\n\n// Inferred (output) types — same name as the schema, so `FsEntry` is both the validator and its type.\nexport type ProtocolVersion = z.output<typeof ProtocolVersion>;\nexport type RequestId = z.output<typeof RequestId>;\nexport type ResourceId = z.output<typeof ResourceId>;\nexport type DeviceId = z.output<typeof DeviceId>;\nexport type AbsPath = z.output<typeof AbsPath>;\n","/** @ai-matrx/desktop-protocol — error model (SPEC §5). Schema source: lint-enforced rules in scripts/check-schema-source.mjs. */\nimport { z } from \"zod\";\nimport type { ErrorCodeName, ErrorData, ErrorReasonName } from \"../types\";\nimport { AbsPath, ProtocolVersion, nonNegInt } from \"./primitives\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Errors (SPEC §5, plus the five additions marked NEW)\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const ErrorCode = z\n .enum([\n \"AUTH_REQUIRED\",\n \"AUTH_INVALID\",\n \"AUTH_EXPIRED\",\n \"AUTH_FORBIDDEN\", // signed in, but not this device's owner\n \"AUTH_DEVICE_REVOKED\", // kill switch\n \"PERMISSION_DENIED_OS\",\n \"NOT_FOUND\",\n \"CONFLICT\",\n \"INVALID_PARAMS\",\n \"RESOURCE_BUSY\",\n \"RESOURCE_GONE\",\n \"CANCELLED\",\n \"TIMEOUT\",\n \"PLATFORM_UNSUPPORTED\",\n \"RATE_LIMITED\",\n \"INTERNAL\",\n \"PROTOCOL_VERSION_UNSUPPORTED\", // NEW: hello refused, carries data.upgrade\n \"PROTOCOL_ERROR\", // NEW: malformed envelope/frame, credit overrun, unknown sid\n \"UNKNOWN_OPERATION\", // NEW: cap.op not served by this core version\n \"DEVICE_OFFLINE\", // NEW: relay has no live device socket (retryable)\n \"PAYLOAD_TOO_LARGE\", // NEW: message or frame above limits.max_*_bytes\n ]);\n\n/** Machine reason under a code, so clients branch without parsing messages. */\nexport const ErrorReason = z\n .enum([\n \"not_a_directory\",\n \"is_a_directory\",\n \"directory_not_empty\",\n \"already_exists\",\n \"stale_write\", // fs.write if_match_mtime_ms mismatch → CONFLICT\n \"binary_content\", // utf8 read of non-UTF-8 bytes → INVALID_PARAMS\n \"not_utf8_boundary\",\n \"patch_no_match\",\n \"patch_ambiguous\",\n \"resource_exited\",\n \"resource_expired\",\n \"control_taken\", // another client of the same user took control\n \"window_exhausted\",\n // 1.2 (REASONS_SINCE): the `models` capability and its supervised Python service\n \"runtime_not_installed\", // NOT_FOUND: install the inference runtime first (models.install)\n \"model_not_installed\", // NOT_FOUND: that model's weights are not on the device\n \"unsupported_media\", // INVALID_PARAMS: the file is not audio or video the decoder reads\n \"download_failed\", // install could not fetch a package or model file\n \"service_starting\", // RESOURCE_BUSY (retryable): the service is starting or restarting\n \"service_restarted\", // RESOURCE_GONE: the service died while this request ran\n \"service_failed\", // INTERNAL: the service could not be started (see models.status)\n ]);\n\n/**\n * One edit fs.patch could not apply — the daemon's `edits_failed[]` entry, verbatim: the edit's\n * index and the daemon's own reason text (\"old_text not found\", or \"old_text matches N locations —\n * add context or set replace_all=True\").\n */\nexport const FsPatchEditFailure = z.strictObject({ edit_index: nonNegInt, reason: z.string().max(300) });\n\nexport const ProtocolErrorBody = z\n .strictObject({\n code: ErrorCode,\n message: z.string().max(300), // short, human, never a stack trace or a token\n retryable: z.boolean(),\n data: z\n .strictObject({\n reason: ErrorReason.optional(),\n cap: z.string().max(32).optional(),\n op: z.string().max(64).optional(),\n path: AbsPath.optional(),\n settings_url: z.string().max(512).optional(), // PERMISSION_DENIED_OS deep link\n retry_after_ms: nonNegInt.optional(),\n limit_bytes: nonNegInt.optional(),\n /** fs.patch when every edit failed (CONFLICT, patch_no_match / patch_ambiguous): the daemon's 422 `failures`. */\n edits_failed: z.array(FsPatchEditFailure).max(256).optional(),\n upgrade: z\n .strictObject({\n min_version: ProtocolVersion,\n max_version: ProtocolVersion,\n download_url: z.url().optional(),\n })\n .optional(),\n })\n .optional(),\n });\n\n\n// Compile-time proof the zod-free twins in ../types.ts equal these schemas.\ntype Same<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;\ntype AssertTrue<T extends true> = T;\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype ErrorTwinCheck = [\n AssertTrue<Same<z.infer<typeof ErrorCode>, ErrorCodeName>>,\n AssertTrue<Same<z.infer<typeof ErrorReason>, ErrorReasonName>>,\n AssertTrue<Same<NonNullable<z.input<typeof ProtocolErrorBody>[\"data\"]>, ErrorData>>,\n];\n\n// Inferred (output) types — same name as the schema, so `FsEntry` is both the validator and its type.\nexport type ErrorCode = z.output<typeof ErrorCode>;\nexport type ErrorReason = z.output<typeof ErrorReason>;\nexport type ProtocolErrorBody = z.output<typeof ProtocolErrorBody>;\nexport type FsPatchEditFailure = z.output<typeof FsPatchEditFailure>;\n","/** @ai-matrx/desktop-protocol — binary frame header and flow-control constants. Schema source: lint-enforced rules in scripts/check-schema-source.mjs. */\nimport { z } from \"zod\";\nimport { FRAME_VERSION } from \"../frame\";\nimport type { FrameHeader as FrameHeaderShape } from \"../frame\";\nimport { u32 } from \"./primitives\";\n\n/** Zod twin of the codec's FrameHeader (layout documented in src/frame.ts) — for $defs and Pydantic. */\nexport const FrameHeader = z\n .strictObject({\n version: z.literal(FRAME_VERSION),\n flags: z.int().min(0).max(3),\n channel: z.union([z.literal(0), z.literal(1), z.literal(2), z.literal(3), z.literal(255)]),\n cid: u32,\n sid: u32,\n seq: u32,\n });\nexport type FrameHeader = z.infer<typeof FrameHeader>;\n\n/** Relay ↔ device hop: the header of a frame carrying one JSON envelope. cid 0 = broadcast (device → relay). */\nexport const RelayHopEnvelopeHeader = z\n .strictObject({\n version: z.literal(FRAME_VERSION),\n flags: z.literal(0),\n channel: z.literal(255),\n cid: u32,\n sid: z.literal(0),\n seq: z.literal(0),\n });\nexport type RelayHopEnvelopeHeader = z.infer<typeof RelayHopEnvelopeHeader>;\n\n/** Relay ↔ device hop: the header of a connection-end frame (FIN, empty payload; see connectionEndFrame). */\nexport const RelayHopConnectionEnd = z\n .strictObject({\n version: z.literal(FRAME_VERSION),\n flags: z.literal(1),\n channel: z.literal(255),\n cid: z.int().min(1).max(4_294_967_295),\n sid: z.literal(0),\n seq: z.literal(0),\n });\nexport type RelayHopConnectionEnd = z.infer<typeof RelayHopConnectionEnd>;\n\n// Compile-time proof the zod twin and the zod-free codec type are the same shape.\ntype Same<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;\ntype AssertTrue<T extends true> = T;\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype FrameHeaderTwinCheck = AssertTrue<Same<z.infer<typeof FrameHeader>, FrameHeaderShape>>;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Flow control (credits)\n//\n// The RECEIVER of a byte stream grants the SENDER a window in payload bytes. The sender may have at\n// most `window` un-credited payload bytes in flight per sid; it pauses its source (node-pty\n// pause(), file read loop) at zero and resumes on credit. Initial window = request's\n// `window_bytes` or limits.default_window_bytes. The receiver sends credit{n} after it has\n// CONSUMED n bytes (xterm write callback fired, file chunk persisted). Overrun → PROTOCOL_ERROR\n// and the stream is ended. Credits are end-to-end (client↔core), so the relay holds at most\n// sum(windows) per device and never buffers without bound. Unary JSON ops are not credited.\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const DEFAULT_WINDOW_BYTES = 262_144 as const; // 256 KiB\nexport const DEFAULT_MAX_FRAME_PAYLOAD_BYTES = 65_536 as const; // 64 KiB\nexport const DEFAULT_MAX_MESSAGE_BYTES = 8_388_608 as const; // 8 MiB JSON message cap\n\n","/**\n * The one error type every package entry throws. It carries the wire ErrorCode (SPEC §5), so a\n * caller branches on `code`/`retryable`/`data.reason` and never parses a message. Zod-free on\n * purpose: `./frame` (the relay hot path) throws it without pulling the schema graph.\n */\nimport type { ErrorCodeName, ErrorData } from \"./types\";\n\nexport class DesktopProtocolError extends Error {\n readonly code: ErrorCodeName;\n readonly retryable: boolean;\n readonly data: ErrorData | undefined;\n\n constructor(code: ErrorCodeName, message: string, options: { retryable?: boolean; data?: ErrorData; cause?: unknown } = {}) {\n super(message, options.cause === undefined ? undefined : { cause: options.cause });\n this.name = \"DesktopProtocolError\";\n this.code = code;\n this.retryable = options.retryable ?? false;\n this.data = options.data;\n }\n\n /** The wire body (ProtocolErrorBody) — what a core or relay sends for this error. */\n toBody(): { code: ErrorCodeName; message: string; retryable: boolean; data?: ErrorData } {\n return this.data === undefined\n ? { code: this.code, message: this.message, retryable: this.retryable }\n : { code: this.code, message: this.message, retryable: this.retryable, data: this.data };\n }\n}\n\nexport function isDesktopProtocolError(value: unknown): value is DesktopProtocolError {\n return value instanceof DesktopProtocolError || (value instanceof Error && value.name === \"DesktopProtocolError\" && \"code\" in value);\n}\n","/**\n * `@ai-matrx/desktop-protocol/frame` — the 16-byte binary frame codec. ZOD-FREE by design: the\n * relay Worker's hot path imports only this entry and must stay tiny.\n *\n * off size field notes\n * 0 u8 version = 1\n * 1 u8 flags bit0 FIN (last frame of this stream), bit1 REPLAY (from ring buffer),\n * bits2-7 reserved = 0\n * 2 u8 channel see FrameChannel\n * 3 u8 reserved = 0\n * 4 u32 cid relay connection id. 0 on every client↔relay hop; the relay stamps it on\n * the relay→device hop and strips it on the way back (rewrites 4 bytes in\n * place — the relay never parses payloads).\n * 8 u32 sid stream id, announced by the core in stream{meta:{kind:\"open\",sid}}\n * 12 u32 seq per-stream frame sequence, starts at 1, strictly +1\n *\n * Big-endian. Payload length = message length − 16 (one frame = one WS binary message).\n * Python struct format: \">BBBBIII\". The zod twin (FrameHeader in the root entry, and so the JSON\n * Schema and Pydantic model) is checked against this file by src/frame.test.ts.\n */\nimport { DesktopProtocolError } from \"./error\";\n\nexport const FRAME_HEADER_BYTES = 16 as const;\nexport const FRAME_VERSION = 1 as const;\nexport const FRAME_STRUCT_FORMAT = \">BBBBIII\" as const;\nexport const FrameFlag = { FIN: 0b01, REPLAY: 0b10 } as const;\nexport const FrameChannel = {\n /** core→client: pty output, fs.read_stream bytes */\n DATA: 0,\n /** core→client: stderr of a non-pty process (reserved for exec.spawn in v1.1) */\n STDERR: 1,\n /** client→core: keystrokes / stdin to sid */\n STDIN: 2,\n /** core→client: serialized terminal screen (attach when since_seq is outside the ring) */\n SNAPSHOT: 3,\n /** relay↔device hop only: a JSON envelope carried inside a binary frame so the relay can route\n * by cid without parsing JSON. Never seen by clients. */\n ENVELOPE: 255,\n} as const;\n\nexport type FrameChannelValue = (typeof FrameChannel)[keyof typeof FrameChannel];\n\nexport interface FrameHeader {\n version: typeof FRAME_VERSION;\n /** 0..3 — FrameFlag bits. */\n flags: number;\n channel: FrameChannelValue;\n cid: number;\n sid: number;\n seq: number;\n}\n\nexport interface DecodedFrame {\n header: FrameHeader;\n /** A VIEW into the input buffer (no copy). Copy it if you keep it past the input's lifetime. */\n payload: Uint8Array;\n}\n\nconst U32_MAX = 4_294_967_295;\nconst CHANNELS: ReadonlySet<number> = new Set(Object.values(FrameChannel));\n\nfunction frameError(message: string): DesktopProtocolError {\n return new DesktopProtocolError(\"PROTOCOL_ERROR\", message);\n}\n\nfunction checkU32(name: string, value: number): void {\n if (!Number.isInteger(value) || value < 0 || value > U32_MAX) throw frameError(`frame ${name} is not a u32: ${value}`);\n}\n\n/** Validate a header without zod. Throws DesktopProtocolError(PROTOCOL_ERROR). */\nexport function assertFrameHeader(h: FrameHeader): void {\n if (h.version !== FRAME_VERSION) throw frameError(`unsupported frame version ${String(h.version)}`);\n if (!Number.isInteger(h.flags) || h.flags < 0 || h.flags > 3) throw frameError(`reserved frame flag bits set: ${h.flags}`);\n if (!CHANNELS.has(h.channel)) throw frameError(`unknown frame channel ${String(h.channel)}`);\n checkU32(\"cid\", h.cid);\n checkU32(\"sid\", h.sid);\n checkU32(\"seq\", h.seq);\n}\n\nexport function encodeFrame(h: FrameHeader, payload: Uint8Array): Uint8Array {\n assertFrameHeader(h);\n const out = new Uint8Array(FRAME_HEADER_BYTES + payload.byteLength);\n const v = new DataView(out.buffer);\n v.setUint8(0, h.version);\n v.setUint8(1, h.flags);\n v.setUint8(2, h.channel);\n v.setUint8(3, 0);\n v.setUint32(4, h.cid);\n v.setUint32(8, h.sid);\n v.setUint32(12, h.seq);\n out.set(payload, FRAME_HEADER_BYTES);\n return out;\n}\n\nexport function decodeFrame(buf: ArrayBuffer | Uint8Array): DecodedFrame {\n const bytes = buf instanceof Uint8Array ? buf : new Uint8Array(buf);\n if (bytes.byteLength < FRAME_HEADER_BYTES) throw frameError(`short frame: ${bytes.byteLength} bytes`);\n const v = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n if (v.getUint8(3) !== 0) throw frameError(\"reserved frame byte 3 is not 0\");\n const header = {\n version: v.getUint8(0),\n flags: v.getUint8(1),\n channel: v.getUint8(2),\n cid: v.getUint32(4),\n sid: v.getUint32(8),\n seq: v.getUint32(12),\n } as FrameHeader;\n assertFrameHeader(header);\n return { header, payload: bytes.subarray(FRAME_HEADER_BYTES) };\n}\n\n/** Read only the 4-byte cid (relay routing) without decoding the rest. */\nexport function readCid(frame: Uint8Array): number {\n if (frame.byteLength < FRAME_HEADER_BYTES) throw frameError(`short frame: ${frame.byteLength} bytes`);\n return new DataView(frame.buffer, frame.byteOffset, frame.byteLength).getUint32(4);\n}\n\n/** Relay hot path: rewrite only the cid IN PLACE, never touch the payload. Returns the same array. */\nexport function stampCid(frame: Uint8Array, cid: number): Uint8Array {\n if (frame.byteLength < FRAME_HEADER_BYTES) throw frameError(`short frame: ${frame.byteLength} bytes`);\n checkU32(\"cid\", cid);\n new DataView(frame.buffer, frame.byteOffset, frame.byteLength).setUint32(4, cid);\n return frame;\n}\n\nexport function hasFlag(header: FrameHeader, flag: (typeof FrameFlag)[keyof typeof FrameFlag]): boolean {\n return (header.flags & flag) !== 0;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Relay ↔ device hop (never seen by clients). Every JSON envelope rides an ENVELOPE frame with\n// flags 0, sid 0, seq 0 and the client's cid; byte frames carry that cid too.\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** cid 0 on an ENVELOPE frame from the device: the relay delivers it to every client. */\nexport const BROADCAST_CID = 0 as const;\n\n/**\n * Connection end: an ENVELOPE frame with FIN, sid 0, seq 0 and NO payload, for connection `cid`.\n * Relay → device: client `cid` is gone — cancel its streams, detach its sessions (idempotent; it\n * may arrive more than once). Device → relay: close client `cid`.\n */\nexport function connectionEndFrame(cid: number): Uint8Array {\n if (cid === BROADCAST_CID) throw frameError(\"a connection end needs a client cid, not the broadcast cid 0\");\n return encodeFrame({ version: FRAME_VERSION, flags: FrameFlag.FIN, channel: FrameChannel.ENVELOPE, cid, sid: 0, seq: 0 }, new Uint8Array(0));\n}\n\n/** True for a decoded connection-end frame (see connectionEndFrame). */\nexport function isConnectionEnd(frame: DecodedFrame): boolean {\n const h = frame.header;\n return h.channel === FrameChannel.ENVELOPE && hasFlag(h, FrameFlag.FIN) && frame.payload.byteLength === 0 && h.cid !== BROADCAST_CID;\n}\n","/** @ai-matrx/desktop-protocol — the JSON envelope (SPEC §4). Schema source: lint-enforced rules in scripts/check-schema-source.mjs. */\nimport { z } from \"zod\";\nimport { ProtocolErrorBody } from \"./errors\";\nimport { DeviceId, ProtocolVersion, RequestId, ResourceId, epochMs, u32 } from \"./primitives\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Client types and hello\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const ClientType = z\n .enum([\"screen\", \"web\", \"extension\", \"server\", \"test\"]);\n\nexport const Limits = z\n .strictObject({\n max_message_bytes: z.int().min(65_536),\n max_frame_payload_bytes: z.int().min(4096),\n default_window_bytes: z.int().min(4096),\n max_streams_per_client: z.int().min(1),\n max_resources_per_user: z.int().min(1),\n });\n\nexport const OpDescriptor = z\n .strictObject({ cap: z.string().max(32), op: z.string().max(64), since: ProtocolVersion });\n\nexport const Welcome = z\n .strictObject({\n protocol_version: ProtocolVersion, // negotiated = min(client, core) within the same major\n session_id: z.string().min(8).max(64),\n client_id: z.string().min(8).max(64), // this connection's identity in the Session Manager\n device_id: DeviceId,\n device_name: z.string().max(128),\n app_version: z.string().max(32),\n platform: z.enum([\"darwin\", \"win32\", \"linux\"]),\n ops: z.array(OpDescriptor),\n limits: Limits,\n server_time_ms: epochMs,\n });\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Envelope (SPEC §4). Text WS messages carry exactly one of these as JSON.\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const HelloMsg = z\n .strictObject({\n type: z.literal(\"hello\"),\n id: RequestId, // answered by response{id, result: Welcome} or error{id}\n protocolVersion: ProtocolVersion,\n clientType: ClientType,\n clientVersion: z.string().min(1).max(32),\n });\n\nexport const RequestMsg = z\n .strictObject({\n id: RequestId,\n type: z.literal(\"request\"),\n cap: z.string().min(1).max(32),\n op: z.string().min(1).max(64),\n params: z.unknown(), // validated by the Router against OPS[cap.op].params — once, there\n });\n\nexport const ResponseMsg = z\n .strictObject({ id: RequestId, type: z.literal(\"response\"), result: z.unknown() });\n\nexport const ErrorMsg = z\n .strictObject({ id: RequestId, type: z.literal(\"error\"), error: ProtocolErrorBody });\n\nexport const StreamMeta = z\n .discriminatedUnion(\"kind\", [\n /** Binds request id → numeric sid; binary frames for this stream follow. */\n z.strictObject({\n kind: z.literal(\"open\"),\n sid: u32,\n window_bytes: z.int().min(4096),\n resource_id: ResourceId.optional(),\n }),\n /** Frames after this (channel SNAPSHOT) are a serialized screen; live DATA resumes after. */\n z.strictObject({ kind: z.literal(\"snapshot\"), cols: z.int().min(1), rows: z.int().min(1) }),\n /** Frames [from_seq, to_seq] are gone from the ring; a snapshot follows. */\n z.strictObject({ kind: z.literal(\"gap\"), from_seq: u32, to_seq: u32 }),\n ]);\n\nexport const StreamMsg = z\n .strictObject({ id: RequestId, type: z.literal(\"stream\"), seq: u32, meta: StreamMeta });\n\nexport const EndReason = z\n .enum([\"completed\", \"cancelled\", \"detached\", \"resource_exited\", \"error\"]);\n\nexport const EndMsg = z\n .strictObject({ id: RequestId, type: z.literal(\"end\"), seq: u32, reason: EndReason.optional() });\n\nexport const CancelMsg = z\n .strictObject({ id: RequestId, type: z.literal(\"cancel\") });\n\n/** Grant n more payload bytes for the stream opened by request `id` (either direction). */\nexport const CreditMsg = z\n .strictObject({ id: RequestId, type: z.literal(\"credit\"), n: z.int().min(1).max(2_147_483_647) });\n\nexport const EventMsg = z\n .strictObject({\n type: z.literal(\"event\"),\n cap: z.string().min(1).max(32),\n name: z.string().min(1).max(64),\n payload: z.unknown(), // validated against EVENTS[cap.name]\n resourceId: ResourceId.optional(),\n });\n\n/** Client↔relay only; the relay consumes these and never forwards them to the core. */\nexport const RelayMsg = z\n .discriminatedUnion(\"op\", [\n /** Fresh access token before the current one expires (relay closes 4008 at exp + 60 s). */\n z.strictObject({ type: z.literal(\"relay\"), op: z.literal(\"reauth\"), token: z.string().min(16).max(8192) }),\n ]);\n\n/**\n * Heartbeat. Sent as these EXACT bytes; the relay answers via the Durable Object\n * setWebSocketAutoResponse pair, so a heartbeat never wakes a hibernated object.\n * Interval 25 s (device and clients); 2 missed pongs = reconnect.\n */\nexport const PING_TEXT = '{\"type\":\"ping\"}' as const;\nexport const PONG_TEXT = '{\"type\":\"pong\"}' as const;\n\n/**\n * Every WebSocket (device, phone, browser, localhost) offers this subprotocol; the access token\n * rides beside it as `${BEARER_PREFIX}<token>`, never in the URL. The server echoes only SUBPROTOCOL.\n */\nexport const SUBPROTOCOL = \"matrx.v1\" as const;\nexport const BEARER_PREFIX = \"bearer.\" as const;\n\nexport const ClientToCoreMsg = z\n .discriminatedUnion(\"type\", [HelloMsg, RequestMsg, CancelMsg, CreditMsg]);\n\nexport const CoreToClientMsg = z\n .discriminatedUnion(\"type\", [ResponseMsg, ErrorMsg, StreamMsg, EndMsg, CreditMsg, EventMsg]);\n\n// ─────────────────────────────────────────────────────────────────────────────\n// WebSocket close codes (relay and localhost transport alike)\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const CloseCode = {\n NORMAL: 1000,\n GOING_AWAY: 1001, // app quit; relay: the device was silent for 75 s — reconnect\n /** Never sent by anyone: what a socket reports when it drops without a close frame. A relay\n * deploy (every Durable Object restarts) arrives as this — reconnect immediately. */\n ABNORMAL: 1006,\n /** Relay → clients: the device (re)connected, so the core session they spoke to is gone —\n * reconnect, hello, and reattach with since_seq. */\n DEVICE_RECONNECTED: 1012,\n TRY_AGAIN_LATER: 1013, // relay: signing keys or the device registry unreachable — retry\n AUTH_INVALID: 4001,\n AUTH_FORBIDDEN: 4003,\n DEVICE_NOT_FOUND: 4004,\n AUTH_EXPIRED: 4008, // no reauth before exp + 60 s\n REPLACED: 4009, // a newer device socket for the same device took over\n DEVICE_REVOKED: 4010, // kill switch — do NOT reconnect\n PROTOCOL_ERROR: 4400,\n UPGRADE_REQUIRED: 4426,\n} as const;\n\n/** Every close code above, as a schema (so Python sees the same table). */\nexport const CloseCodeValue = z.literal([1000, 1001, 1006, 1012, 1013, 4001, 4003, 4004, 4008, 4009, 4010, 4400, 4426]);\nexport type CloseCodeValue = z.output<typeof CloseCodeValue>;\n\n// Compile-time proof the schema lists exactly the CloseCode table.\ntype SameCodes<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;\ntype AssertCodes<T extends true> = T;\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype CloseCodeTableCheck = AssertCodes<SameCodes<CloseCodeValue, (typeof CloseCode)[keyof typeof CloseCode]>>;\n\n// Inferred (output) types — same name as the schema, so `FsEntry` is both the validator and its type.\nexport type ClientType = z.output<typeof ClientType>;\nexport type Limits = z.output<typeof Limits>;\nexport type OpDescriptor = z.output<typeof OpDescriptor>;\nexport type Welcome = z.output<typeof Welcome>;\nexport type HelloMsg = z.output<typeof HelloMsg>;\nexport type RequestMsg = z.output<typeof RequestMsg>;\nexport type ResponseMsg = z.output<typeof ResponseMsg>;\nexport type ErrorMsg = z.output<typeof ErrorMsg>;\nexport type StreamMeta = z.output<typeof StreamMeta>;\nexport type StreamMsg = z.output<typeof StreamMsg>;\nexport type EndReason = z.output<typeof EndReason>;\nexport type EndMsg = z.output<typeof EndMsg>;\nexport type CancelMsg = z.output<typeof CancelMsg>;\nexport type CreditMsg = z.output<typeof CreditMsg>;\nexport type EventMsg = z.output<typeof EventMsg>;\nexport type RelayMsg = z.output<typeof RelayMsg>;\nexport type ClientToCoreMsg = z.output<typeof ClientToCoreMsg>;\nexport type CoreToClientMsg = z.output<typeof CoreToClientMsg>;\n","/** @ai-matrx/desktop-protocol — cap sysinfo. Schema source: lint-enforced rules in scripts/check-schema-source.mjs. */\nimport { z } from \"zod\";\nimport { AbsPath, DeviceId, ProtocolVersion, nonNegInt } from \"./primitives\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n// sysinfo\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const OsPermissionName = z\n .enum([\n \"full_disk_access\",\n \"accessibility\",\n \"screen_recording\",\n \"microphone\",\n \"camera\",\n \"automation\",\n \"contacts\",\n \"calendars\",\n \"photos\",\n \"location\",\n \"local_network\",\n \"bluetooth\",\n \"notifications\",\n ]);\n\nexport const SysinfoGetParams = z.strictObject({});\nexport const SysinfoGetResult = z\n .strictObject({\n device_id: DeviceId,\n device_name: z.string().max(128),\n hostname: z.string().max(255),\n platform: z.enum([\"darwin\", \"win32\", \"linux\"]),\n os_version: z.string().max(64),\n arch: z.enum([\"arm64\", \"x64\"]),\n app_version: z.string().max(32),\n protocol_version: ProtocolVersion,\n user: z.strictObject({ username: z.string().max(128), shell: z.string().max(512) }),\n paths: z.strictObject({\n home: AbsPath,\n desktop: AbsPath,\n documents: AbsPath,\n downloads: AbsPath,\n app_data: AbsPath,\n temp: AbsPath,\n }),\n cpu: z.strictObject({ model: z.string().max(128), cores: z.int().min(1) }),\n memory: z.strictObject({ total_bytes: nonNegInt, free_bytes: nonNegInt }),\n uptime_seconds: nonNegInt,\n on_battery: z.boolean().nullable(),\n sleep_prevented: z.boolean(), // true while any remote session holds the power blocker\n permissions: z.array(\n z.strictObject({\n name: OsPermissionName,\n state: z.enum([\"granted\", \"denied\", \"not_determined\", \"not_applicable\"]),\n settings_url: z.string().max(512).nullable(),\n }),\n ),\n });\n\n// Inferred (output) types — same name as the schema, so `FsEntry` is both the validator and its type.\nexport type OsPermissionName = z.output<typeof OsPermissionName>;\nexport type SysinfoGetParams = z.output<typeof SysinfoGetParams>;\nexport type SysinfoGetResult = z.output<typeof SysinfoGetResult>;\n","/** @ai-matrx/desktop-protocol — cap fs. Schema source: lint-enforced rules in scripts/check-schema-source.mjs. */\nimport { z } from \"zod\";\nimport { FsPatchEditFailure } from \"./errors\";\nimport { AbsPath, ResourceId, epochMs, nonNegInt } from \"./primitives\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n// fs — mirrors matrx_agent daemon /fs/* field names (SPEC §6.1)\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const FsKind = z.enum([\"file\", \"dir\", \"symlink\"]);\n\n/**\n * = daemon get_stat_dict(), field for field (SPEC 6.1): what /fs/stat and every /fs/list entry\n * answer in the cloud sandbox. Never follows symlinks; `target` is the fully resolved target.\n */\nexport const FsEntry = z\n .strictObject({\n name: z.string().max(1024),\n path: AbsPath,\n kind: FsKind,\n size: nonNegInt,\n mtime: z.number().min(0), // seconds, float\n mode: z.int().min(0).max(0o7777),\n target: AbsPath.nullable(),\n });\n\nexport const FsListParams = z\n .strictObject({\n path: AbsPath,\n recursive: z.boolean().default(false),\n depth: z.int().min(1).max(32).default(1),\n pattern: z.string().max(256).optional(), // glob on name\n limit: z.int().min(1).max(5000).default(1000),\n page_token: z.string().max(256).optional(),\n // Desktop additions; their defaults ARE the daemon's behaviour: dotfiles listed, siblings in\n // binary (byte) order of name, depth-first.\n show_hidden: z.boolean().default(true),\n sort: z.enum([\"name\", \"mtime\", \"size\", \"kind\"]).default(\"name\"),\n });\nexport const FsListResult = z\n .strictObject({\n entries: z.array(FsEntry),\n truncated: z.boolean(),\n next_page_token: z.string().max(256).nullable(),\n scanned: nonNegInt,\n });\n\nexport const FsStatParams = z.strictObject({ path: AbsPath });\nexport const FsStatResult = FsEntry;\n\nexport const FsEncoding = z.enum([\"utf8\", \"base64\"]);\n\n/** Bounded read. offset = byte offset; limit = chars (utf8) or bytes (base64), as the daemon. */\nexport const FsReadParams = z\n .strictObject({\n path: AbsPath,\n encoding: FsEncoding.default(\"utf8\"),\n offset: nonNegInt.default(0),\n limit: z.int().min(1).max(4_194_304).default(262_144),\n });\nexport const FsReadResult = z\n .strictObject({\n content: z.string(),\n encoding: FsEncoding,\n size: nonNegInt,\n offset: nonNegInt,\n next_offset: nonNegInt,\n truncated: z.boolean(),\n mime: z.string().max(128).nullable(),\n mtime_ms: epochMs, // pass back as if_match_mtime_ms to guard a later write\n });\n\n/** Whole-file or ranged download as binary frames (channel DATA, credited). */\nexport const FsReadStreamParams = z\n .strictObject({\n path: AbsPath,\n offset: nonNegInt.default(0),\n length: nonNegInt.optional(), // absent = to EOF\n window_bytes: z.int().min(4096).max(16_777_216).optional(),\n });\n/** Unary result arrives first (size/mime), then stream{open} + DATA frames + end. */\nexport const FsReadStreamResult = z\n .strictObject({ size: nonNegInt, mime: z.string().max(128).nullable(), mtime_ms: epochMs });\n\nexport const FsWriteParams = z\n .strictObject({\n path: AbsPath,\n content: z.string().max(5_592_406), // ≤ 4 MiB of bytes after base64 decode\n encoding: FsEncoding.default(\"utf8\"),\n mode: z.int().min(0).max(0o7777).optional(),\n create_parents: z.boolean().default(false),\n /** Optimistic concurrency: CONFLICT/stale_write if the file changed since this mtime. */\n if_match_mtime_ms: epochMs.optional(),\n /** Refuse to replace an existing file (CONFLICT/already_exists). */\n exclusive: z.boolean().default(false),\n });\n/** Writes are atomic: temp file in the same directory + rename (daemon parity). */\nexport const FsWriteResult = z\n .strictObject({ path: AbsPath, size: nonNegInt, mtime_ms: epochMs, created: z.boolean() });\n\nexport const FsMkdirParams = z\n .strictObject({ path: AbsPath, parents: z.boolean().default(false) });\nexport const FsMkdirResult = z\n .strictObject({ path: AbsPath, created: z.boolean() });\n\n/** = daemon RenameRequest (/fs/rename). */\nexport const FsMoveParams = z\n .strictObject({ from_path: AbsPath, to_path: AbsPath, overwrite: z.boolean().default(false) });\nexport const FsMoveResult = z\n .strictObject({ from_path: AbsPath, to_path: AbsPath });\n\n/**\n * Delete. Default goes to the OS Trash (Finder/Explorer semantics: undoable from the phone's\n * \"Undo\" toast via fs.move back). to_trash:false is a permanent delete — the daemon's behaviour,\n * used by agents through _sandbox_proxy.\n */\nexport const FsDeleteParams = z\n .strictObject({\n path: AbsPath,\n recursive: z.boolean().default(false),\n to_trash: z.boolean().default(true),\n });\nexport const FsDeleteResult = z\n .strictObject({ deleted: z.literal(true), trashed_to: AbsPath.nullable() });\n\n/** Opens a watch resource; changes arrive as event fs.changed with resourceId. */\nexport const FsWatchParams = z\n .strictObject({\n path: AbsPath,\n recursive: z.boolean().default(false),\n ignore: z.array(z.string().max(256)).max(64).default([]),\n debounce_ms: z.int().min(0).max(5000).default(50),\n });\nexport const FsWatchResult = z\n .strictObject({ resource_id: ResourceId, path: AbsPath });\n\n// — Required by lane F (SPEC §6.1 parity sequence and every existing _sandbox_proxy call) —\n\n/** = daemon EditChunk / PatchRequest (/fs/patch). */\nexport const FsPatchParams = z\n .strictObject({\n path: AbsPath,\n edits: z\n .array(\n z.strictObject({\n old_text: z.string(),\n new_text: z.string(),\n replace_all: z.boolean().default(false),\n }),\n )\n .min(1)\n .max(256),\n create_if_missing: z.boolean().default(false),\n });\n/** One edit fs.patch applied — the daemon's `edits_applied[]` entry, verbatim. */\nexport const FsPatchEditApplied = z.strictObject({\n edit_index: nonNegInt,\n mode: z.enum([\"create\", \"replace\", \"replace_all\"]),\n /** Present for replace_all only, as the daemon sends it. */\n matches_replaced: nonNegInt.optional(),\n});\n\n/**\n * = the daemon's /fs/patch answer per edit: edits apply in order, each sees the previous result; an\n * edit whose old_text is missing, or matches more than once without replace_all, is skipped and\n * listed in edits_failed with the daemon's reason; the file is written when at least one applied.\n * (Every edit failing is a CONFLICT whose data.edits_failed lists them — the daemon's 422.)\n */\nexport const FsPatchResult = z.strictObject({\n path: AbsPath,\n applied: nonNegInt,\n size: nonNegInt,\n mtime_ms: epochMs,\n /** Since 1.1 (FIELDS_SINCE): a 1.0 app sends only `applied`. Always sent to a ≥1.1 peer. */\n edits_applied: z.array(FsPatchEditApplied).max(256).optional(),\n /** Since 1.1 (FIELDS_SINCE). */\n edits_failed: z.array(FsPatchEditFailure).max(256).optional(),\n});\n\n/** = daemon SearchPathRequest (/search/paths). */\nexport const FsSearchPathsParams = z\n .strictObject({\n pattern: z.string().min(1).max(512),\n cwd: AbsPath,\n hidden: z.boolean().default(false),\n max_results: z.int().min(1).max(5000).default(100),\n });\n/**\n * = the daemon's /search/paths answer (fd 8.3.1 in the sandbox image): paths RELATIVE to `cwd`, each\n * prefixed \"./\", sorted, cut to max_results. No truncation flag (the daemon has none).\n */\nexport const FsSearchPathsResult = z\n .strictObject({ paths: z.array(z.string().min(3).max(4096).regex(/^\\.\\/[^\\\\\\u0000]+$/)) });\n\n/** = daemon SearchContentRequest (/search/content). */\nexport const FsSearchContentParams = z\n .strictObject({\n query: z.string().min(1).max(1024),\n cwd: AbsPath,\n regex: z.boolean().default(true),\n case_sensitive: z.boolean().default(false),\n include: z.array(z.string().max(256)).max(64).optional(),\n exclude: z.array(z.string().max(256)).max(64).optional(),\n max_results: z.int().min(1).max(5000).default(100),\n });\n/**\n * = the daemon's /search/content answer (ripgrep 13 --json run in `cwd`): `path` RELATIVE to `cwd`\n * with no \"./\"; `lines` is the matching line with its newline; submatches are ripgrep's, byte\n * offsets within the line. max_results is per FILE (rg -m), as the daemon passes it. No truncation\n * flag (the daemon has none).\n */\nexport const FsSearchContentResult = z\n .strictObject({\n results: z.array(\n z.strictObject({\n path: z.string().min(1).max(4096).regex(/^[^/\\\\\\u0000][^\\\\\\u0000]*$/),\n lines: z.string(),\n line_number: z.int().min(1),\n submatches: z.array(\n z.strictObject({ match: z.strictObject({ text: z.string() }), start: nonNegInt, end: nonNegInt }),\n ),\n }),\n ),\n });\n\nexport const FsChange = z\n .strictObject({\n type: z.enum([\"created\", \"modified\", \"deleted\", \"moved\"]),\n path: AbsPath,\n to_path: AbsPath.optional(),\n kind: z.enum([\"file\", \"dir\", \"symlink\", \"unknown\"]),\n });\nexport const FsChangedEvent = z\n .strictObject({ changes: z.array(FsChange).min(1).max(1000), overflow: z.boolean() }); // overflow:true = events dropped; client re-lists\n\n// Inferred (output) types — same name as the schema, so `FsEntry` is both the validator and its type.\nexport type FsKind = z.output<typeof FsKind>;\nexport type FsEntry = z.output<typeof FsEntry>;\nexport type FsListParams = z.output<typeof FsListParams>;\nexport type FsListResult = z.output<typeof FsListResult>;\nexport type FsStatParams = z.output<typeof FsStatParams>;\nexport type FsStatResult = z.output<typeof FsStatResult>;\nexport type FsEncoding = z.output<typeof FsEncoding>;\nexport type FsReadParams = z.output<typeof FsReadParams>;\nexport type FsReadResult = z.output<typeof FsReadResult>;\nexport type FsReadStreamParams = z.output<typeof FsReadStreamParams>;\nexport type FsReadStreamResult = z.output<typeof FsReadStreamResult>;\nexport type FsWriteParams = z.output<typeof FsWriteParams>;\nexport type FsWriteResult = z.output<typeof FsWriteResult>;\nexport type FsMkdirParams = z.output<typeof FsMkdirParams>;\nexport type FsMkdirResult = z.output<typeof FsMkdirResult>;\nexport type FsMoveParams = z.output<typeof FsMoveParams>;\nexport type FsMoveResult = z.output<typeof FsMoveResult>;\nexport type FsDeleteParams = z.output<typeof FsDeleteParams>;\nexport type FsDeleteResult = z.output<typeof FsDeleteResult>;\nexport type FsWatchParams = z.output<typeof FsWatchParams>;\nexport type FsWatchResult = z.output<typeof FsWatchResult>;\nexport type FsPatchParams = z.output<typeof FsPatchParams>;\nexport type FsPatchResult = z.output<typeof FsPatchResult>;\nexport type FsPatchEditApplied = z.output<typeof FsPatchEditApplied>;\nexport type FsSearchPathsParams = z.output<typeof FsSearchPathsParams>;\nexport type FsSearchPathsResult = z.output<typeof FsSearchPathsResult>;\nexport type FsSearchContentParams = z.output<typeof FsSearchContentParams>;\nexport type FsSearchContentResult = z.output<typeof FsSearchContentResult>;\nexport type FsChange = z.output<typeof FsChange>;\nexport type FsChangedEvent = z.output<typeof FsChangedEvent>;\n","/** @ai-matrx/desktop-protocol — cap exec. Schema source: lint-enforced rules in scripts/check-schema-source.mjs. */\nimport { z } from \"zod\";\nimport { AbsPath, ResourceId, epochMs, nonNegInt, u32 } from \"./primitives\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n// exec — PTY sessions (resources) + one-shot run\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const Signal = z\n .enum([\"SIGINT\", \"SIGTERM\", \"SIGKILL\", \"SIGHUP\", \"SIGQUIT\", \"SIGTSTP\", \"SIGCONT\", \"SIGUSR1\", \"SIGUSR2\"]); // Windows: SIGINT→Ctrl-C event, SIGTERM/SIGKILL/SIGHUP→terminate, others PLATFORM_UNSUPPORTED\n\nconst cols = z.int().min(2).max(1000);\nconst rows = z.int().min(1).max(500);\n\n/**\n * Start a PTY. Response result = PtyInfo; the same request id then carries the output stream:\n * stream{meta:{kind:\"open\",sid,resource_id}} → DATA frames (credited) → end{reason}.\n * Input goes as STDIN frames on that sid (cheap per keystroke) or via exec.pty.write.\n */\nexport const ExecPtyStartParams = z\n .strictObject({\n cols,\n rows,\n cwd: AbsPath.optional(), // default: home\n shell: z.string().max(512).optional(), // default: user's login shell (PowerShell on Windows)\n args: z.array(z.string().max(4096)).max(64).optional(),\n env: z.record(z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(128), z.string().max(32_768)).optional(),\n name: z.string().max(64).optional(), // tab label\n window_bytes: z.int().min(4096).max(16_777_216).optional(),\n });\n\nexport const PtyInfo = z\n .strictObject({\n resource_id: ResourceId,\n pid: z.int().min(1),\n shell: z.string().max(512),\n cwd: AbsPath, // live, from OSC 7 / process cwd\n title: z.string().max(256),\n name: z.string().max(64).nullable(),\n cols,\n rows,\n state: z.enum([\"running\", \"exited\"]),\n exit_code: z.int().nullable(),\n exit_signal: Signal.nullable(),\n last_seq: u32,\n created_at_ms: epochMs,\n controller_client_id: z.string().max(64).nullable(), // null = orphaned (in grace period)\n attached_clients: nonNegInt,\n orphan_expires_at_ms: epochMs.nullable(),\n });\n\nexport const ExecPtyStartResult = PtyInfo;\n\nexport const ExecPtyWriteParams = z\n .strictObject({ resource_id: ResourceId, data: z.string().min(1).max(65_536) });\nexport const ExecPtyWriteResult = z.strictObject({ written: nonNegInt });\n\nexport const ExecPtyResizeParams = z\n .strictObject({ resource_id: ResourceId, cols, rows });\nexport const ExecPtyResizeResult = z.strictObject({ cols, rows });\n\n/** Delivered to the PTY's foreground process group (daemon parity: tcgetpgrp + killpg). */\nexport const ExecPtySignalParams = z\n .strictObject({ resource_id: ResourceId, signal: Signal });\nexport const ExecPtySignalResult = z.strictObject({ delivered: z.boolean() });\n\n/** SIGHUP the session, SIGKILL after grace_ms, reap, free the resource. Idempotent. */\nexport const ExecPtyKillParams = z\n .strictObject({ resource_id: ResourceId, grace_ms: z.int().min(0).max(30_000).default(2000) });\nexport const ExecPtyKillResult = z\n .strictObject({ exit_code: z.int().nullable(), exit_signal: Signal.nullable() });\n\nexport const ExecListParams = z.strictObject({});\nexport const ExecListResult = z.strictObject({ sessions: z.array(PtyInfo) });\n\n/**\n * One-shot command (agents, via _sandbox_proxy → /exec). Timeout ENFORCED (exit 124, daemon\n * convention). cwd is sticky per cwd_key: a later run with the same key and no cwd starts where\n * the last one ended (SPEC §6.1: \"cd sub && pwd\" then \"pwd\").\n */\nexport const ExecRunParams = z\n .strictObject({\n command: z.string().min(1).max(131_072),\n cwd: AbsPath.optional(),\n cwd_key: z.string().max(128).optional(),\n env: z.record(z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(128), z.string().max(32_768)).optional(),\n stdin: z.string().max(1_048_576).optional(),\n timeout: z.int().min(1).max(3600).default(60), // seconds, daemon parity\n max_output_bytes: z.int().min(1024).max(8_388_608).default(1_048_576),\n });\nexport const ExecRunResult = z\n .strictObject({\n exit_code: z.int(),\n stdout: z.string(),\n stderr: z.string(),\n cwd: AbsPath,\n duration_ms: nonNegInt,\n timed_out: z.boolean(),\n output_truncated: z.boolean(),\n });\n\nexport const ExecExitedEvent = z\n .strictObject({ exit_code: z.int().nullable(), exit_signal: Signal.nullable() });\nexport const ExecTitleEvent = z.strictObject({ title: z.string().max(256) });\nexport const ExecCwdEvent = z.strictObject({ cwd: AbsPath });\n\n// Inferred (output) types — same name as the schema, so `FsEntry` is both the validator and its type.\nexport type Signal = z.output<typeof Signal>;\nexport type ExecPtyStartParams = z.output<typeof ExecPtyStartParams>;\nexport type PtyInfo = z.output<typeof PtyInfo>;\nexport type ExecPtyStartResult = z.output<typeof ExecPtyStartResult>;\nexport type ExecPtyWriteParams = z.output<typeof ExecPtyWriteParams>;\nexport type ExecPtyWriteResult = z.output<typeof ExecPtyWriteResult>;\nexport type ExecPtyResizeParams = z.output<typeof ExecPtyResizeParams>;\nexport type ExecPtyResizeResult = z.output<typeof ExecPtyResizeResult>;\nexport type ExecPtySignalParams = z.output<typeof ExecPtySignalParams>;\nexport type ExecPtySignalResult = z.output<typeof ExecPtySignalResult>;\nexport type ExecPtyKillParams = z.output<typeof ExecPtyKillParams>;\nexport type ExecPtyKillResult = z.output<typeof ExecPtyKillResult>;\nexport type ExecListParams = z.output<typeof ExecListParams>;\nexport type ExecListResult = z.output<typeof ExecListResult>;\nexport type ExecRunParams = z.output<typeof ExecRunParams>;\nexport type ExecRunResult = z.output<typeof ExecRunResult>;\nexport type ExecExitedEvent = z.output<typeof ExecExitedEvent>;\nexport type ExecTitleEvent = z.output<typeof ExecTitleEvent>;\nexport type ExecCwdEvent = z.output<typeof ExecCwdEvent>;\n","/** @ai-matrx/desktop-protocol — cap session. Schema source: lint-enforced rules in scripts/check-schema-source.mjs. */\nimport { z } from \"zod\";\nimport { PtyInfo } from \"./exec\";\nimport { AbsPath, ResourceId, epochMs, u32 } from \"./primitives\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n// session — generic resource ownership (SPEC §3.3). One attach/detach for EVERY resource kind.\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Reattach after a drop. mode \"control\" by the same user takes control (previous controller is\n * demoted to read_only and gets session.control_changed). since_seq = last seq the client\n * rendered: frames (since_seq, last_seq] are replayed from the ring with the REPLAY flag; if they\n * have left the ring, stream{gap} + stream{snapshot} + SNAPSHOT frames come first.\n * Response = PtyInfo|FsWatchResult-shaped ResourceInfo; then the stream continues on a new sid.\n */\nexport const SessionAttachParams = z\n .strictObject({\n resource_id: ResourceId,\n mode: z.enum([\"control\", \"read_only\"]).default(\"control\"),\n since_seq: u32.optional(),\n window_bytes: z.int().min(4096).max(16_777_216).optional(),\n });\n\nexport const ResourceInfo = z\n .discriminatedUnion(\"kind\", [\n z.strictObject({ kind: z.literal(\"pty\"), pty: PtyInfo }),\n z.strictObject({\n kind: z.literal(\"watch\"),\n resource_id: ResourceId,\n path: AbsPath,\n orphan_expires_at_ms: epochMs.nullable(),\n }),\n ]);\nexport const SessionAttachResult = ResourceInfo;\n\n/** Leave the resource running (orphan grace starts if no other client controls it). */\nexport const SessionDetachParams = z.strictObject({ resource_id: ResourceId });\nexport const SessionDetachResult = z\n .strictObject({ orphan_expires_at_ms: epochMs.nullable() });\n\n/** Free a resource through its owner's cancel path (watch → unwatch; pty → exec.pty.kill). */\nexport const SessionReleaseParams = z.strictObject({ resource_id: ResourceId });\nexport const SessionReleaseResult = z.strictObject({ released: z.literal(true) });\n\nexport const SessionListParams = z.strictObject({});\nexport const SessionListResult = z.strictObject({ resources: z.array(ResourceInfo) });\n\nexport const SessionControlChangedEvent = z\n .strictObject({ controller_client_id: z.string().max(64).nullable(), your_mode: z.enum([\"control\", \"read_only\"]) });\n\n// Inferred (output) types — same name as the schema, so `FsEntry` is both the validator and its type.\nexport type SessionAttachParams = z.output<typeof SessionAttachParams>;\nexport type ResourceInfo = z.output<typeof ResourceInfo>;\nexport type SessionAttachResult = z.output<typeof SessionAttachResult>;\nexport type SessionDetachParams = z.output<typeof SessionDetachParams>;\nexport type SessionDetachResult = z.output<typeof SessionDetachResult>;\nexport type SessionReleaseParams = z.output<typeof SessionReleaseParams>;\nexport type SessionReleaseResult = z.output<typeof SessionReleaseResult>;\nexport type SessionListParams = z.output<typeof SessionListParams>;\nexport type SessionListResult = z.output<typeof SessionListResult>;\nexport type SessionControlChangedEvent = z.output<typeof SessionControlChangedEvent>;\n","/** @ai-matrx/desktop-protocol — cap relay. Schema source: lint-enforced rules in scripts/check-schema-source.mjs. */\nimport { z } from \"zod\";\nimport { ProtocolErrorBody } from \"./errors\";\nimport { ProtocolVersion, epochMs } from \"./primitives\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n// relay — events the relay itself emits to clients (cap \"relay\")\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const RelayDeviceStatusEvent = z\n .strictObject({\n online: z.boolean(),\n /**\n * When the device last went online/offline; null = it has never connected (since 1.1 —\n * NULL_SINCE: a 1.0 reader is sent 0, its old meaning).\n */\n since_ms: epochMs.nullable(),\n app_version: z.string().max(32).nullable(),\n protocol_version: ProtocolVersion.nullable(),\n });\nexport const RelayAuthExpiringEvent = z\n .strictObject({ expires_at_ms: epochMs });\n\n/** HTTP POST https://relay.matrxserver.com/v1/devices/{device_id}/call — unary ops only (lane F). */\nexport const RelayCallRequest = z\n .strictObject({\n cap: z.string().min(1).max(32),\n op: z.string().min(1).max(64),\n params: z.unknown(),\n timeout_ms: z.int().min(100).max(3_700_000).default(70_000),\n });\n/**\n * The caller of /call announces the newest protocol it reads in this request header; the relay\n * includes fields newer than 1.0 only when the announced version knows them (src/versioning.ts).\n */\nexport const RELAY_CALL_VERSION_HEADER = \"x-matrx-protocol-version\" as const;\n\nexport const RelayCallResponse = z\n .discriminatedUnion(\"ok\", [\n z.strictObject({\n ok: z.literal(true),\n result: z.unknown(),\n /** Since 1.1: the version the device negotiated for this call (its welcome). */\n protocol_version: ProtocolVersion.optional(),\n }),\n z.strictObject({\n ok: z.literal(false),\n error: ProtocolErrorBody,\n /** Since 1.1, as above (absent when the device never answered hello). */\n protocol_version: ProtocolVersion.optional(),\n }),\n ]);\n\n/**\n * How the relay runs one /call on the device: a fresh cid (its own connection) carrying exactly\n * RelayCallHello then RelayCallEnvelope, answered on that cid by response/error with id \"call\"\n * (an error on id \"hello\" also ends it), then a connection-end frame. A stream answer is refused.\n */\nexport const RELAY_CALL_HELLO_ID = \"hello\" as const;\nexport const RELAY_CALL_REQUEST_ID = \"call\" as const;\n\nexport const RelayCallHello = z\n .strictObject({\n type: z.literal(\"hello\"),\n id: z.literal(RELAY_CALL_HELLO_ID),\n protocolVersion: ProtocolVersion,\n clientType: z.literal(\"server\"),\n clientVersion: z.string().min(1).max(32),\n });\nexport const RelayCallEnvelope = z\n .strictObject({\n id: z.literal(RELAY_CALL_REQUEST_ID),\n type: z.literal(\"request\"),\n cap: z.string().min(1).max(32),\n op: z.string().min(1).max(64),\n params: z.unknown(),\n });\n\n/** HTTP GET /v1/devices/{device_id}/status (owner JWT). */\nexport const RelayStatusResponse = RelayDeviceStatusEvent;\n\n// Inferred (output) types — same name as the schema, so `FsEntry` is both the validator and its type.\nexport type RelayDeviceStatusEvent = z.output<typeof RelayDeviceStatusEvent>;\nexport type RelayAuthExpiringEvent = z.output<typeof RelayAuthExpiringEvent>;\nexport type RelayCallRequest = z.output<typeof RelayCallRequest>;\nexport type RelayCallResponse = z.output<typeof RelayCallResponse>;\nexport type RelayStatusResponse = z.output<typeof RelayStatusResponse>;\nexport type RelayCallHello = z.output<typeof RelayCallHello>;\nexport type RelayCallEnvelope = z.output<typeof RelayCallEnvelope>;\n","/**\n * @ai-matrx/desktop-protocol — the `models` capability (SPEC §6): local AI models on the device,\n * served by Matrx 2's `ml` Python service (SPEC §3.10). Schema source: lint-enforced rules in\n * scripts/check-schema-source.mjs.\n *\n * Two contracts share these shapes, both generated from this file (SPEC P11):\n * - the Router ops `models.*` (every transport: relay, localhost, extension, the app's screen);\n * - the internal service ops `ml.*` between the desktop core and the Python service\n * (src/schema/service.ts, `SERVICES` in registry.ts). A forwarded op uses the SAME named\n * schema on both hops, so the two can never disagree.\n */\nimport { z } from \"zod\";\nimport { AbsPath, RequestId, nonNegInt } from \"./primitives\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Transcription (local Whisper)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Whisper sizes the device can run (CTranslate2 weights). Larger = slower, more accurate. */\nexport const TranscriptionModelId = z.enum([\"tiny\", \"base\", \"small\", \"large-v3-turbo\"]);\n\n/** The heavy runtime (inference packages) is installed on first use, never shipped in the app. */\nexport const MlRuntimeState = z.enum([\"not_installed\", \"installing\", \"installed\", \"failed\"]);\n\n/** `packages`: the locked inference wheels; `model`: one model's weights; `verifying`: hashes and a load test. */\nexport const MlInstallPhase = z.enum([\"packages\", \"model\", \"verifying\"]);\n\nexport const MlInstallProgress = z.strictObject({\n phase: MlInstallPhase,\n /** What is being fetched now: a package or a model file name. */\n item: z.string().max(200),\n bytes_done: nonNegInt,\n /** Null while the total is not known yet. */\n bytes_total: nonNegInt.nullable(),\n});\n\nexport const TranscriptionModelInfo = z.strictObject({\n id: TranscriptionModelId,\n /** Download size of the weights. */\n size_bytes: nonNegInt,\n multilingual: z.boolean(),\n installed: z.boolean(),\n});\n\nexport const TranscriptSegment = z.strictObject({\n start_s: z.number().min(0),\n end_s: z.number().min(0),\n text: z.string().max(4000),\n});\n\n/** What the `ml` service itself reports (the core adds the supervisor's view in ModelsStatusResult). */\nexport const MlStatusParams = z.strictObject({});\nexport const MlStatusResult = z.strictObject({\n runtime: MlRuntimeState,\n /** Non-null while runtime or model files are being installed. */\n install: MlInstallProgress.nullable(),\n /** The last install failure, one human line; null when the last install succeeded or none ran. */\n error: z.string().max(300).nullable(),\n /** Where inference runs once the runtime is installed: `cuda` only when a usable GPU is present. */\n accelerator: z.enum([\"cpu\", \"cuda\"]),\n models: z.array(TranscriptionModelInfo).max(16),\n default_model: TranscriptionModelId,\n});\n\n/** Install the runtime (if missing) and one model's weights (default: the default model). */\nexport const ModelsInstallParams = z.strictObject({ model: TranscriptionModelId.optional() });\nexport const ModelsInstallResult = z.strictObject({ model: TranscriptionModelId, elapsed_ms: nonNegInt });\n\n/**\n * Transcribe an audio or video file on the device. Any format the bundled decoder reads (wav, mp3,\n * m4a, webm/opus, mp4…). `language` is ISO 639-1; omitted = detect. `translate` = into English.\n */\nexport const ModelsTranscribeParams = z.strictObject({\n path: AbsPath,\n model: TranscriptionModelId.optional(),\n language: z\n .string()\n .regex(/^[a-z]{2,3}$/)\n .optional(),\n task: z.enum([\"transcribe\", \"translate\"]).default(\"transcribe\"),\n});\nexport const ModelsTranscribeResult = z.strictObject({\n text: z.string().max(400_000),\n language: z.string().max(8),\n language_probability: z.number().min(0).max(1),\n duration_s: z.number().min(0),\n model: TranscriptionModelId,\n segments: z.array(TranscriptSegment).max(20_000),\n elapsed_ms: nonNegInt,\n});\n\n/** A progress report while `ml.install` / `ml.transcribe` runs. */\nexport const MlProgress = z.strictObject({\n kind: z.enum([\"install\", \"transcribe\"]),\n /** 0–1 when known (transcribe: audio covered so far; install: bytes so far). */\n fraction: z.number().min(0).max(1).nullable(),\n install: MlInstallProgress.nullable(),\n /** The segment just transcribed (transcribe only): text appears as it is recognised. */\n segment: TranscriptSegment.nullable(),\n});\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Router ops (`models.*`)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** The supervisor's view of the `ml` service process. */\nexport const MlServiceState = z.enum([\"starting\", \"ready\", \"restarting\", \"failed\", \"stopped\"]);\n\nexport const MlServiceStatus = z.strictObject({\n state: MlServiceState,\n pid: nonNegInt.nullable(),\n /** Restarts since the app started (crashes, missed health checks). */\n restarts: nonNegInt,\n /** The bundled interpreter's version once the service has answered, e.g. \"3.13.15\". */\n python: z.string().max(32).nullable(),\n /** Why the service is restarting or failed, one human line. */\n error: z.string().max(300).nullable(),\n});\n\nexport const ModelsStatusParams = z.strictObject({});\nexport const ModelsStatusResult = z.strictObject({\n service: MlServiceStatus,\n /** Null until the service has answered (starting, restarting, failed). */\n transcription: MlStatusResult.nullable(),\n});\n\n/** Sent to the client that started a `models.install` or `models.transcribe`, for that request. */\nexport const ModelsProgressEvent = z.strictObject({ request_id: RequestId, progress: MlProgress });\n\nexport type TranscriptionModelId = z.output<typeof TranscriptionModelId>;\nexport type MlStatusResult = z.output<typeof MlStatusResult>;\nexport type MlProgress = z.output<typeof MlProgress>;\nexport type ModelsStatusResult = z.output<typeof ModelsStatusResult>;\nexport type ModelsTranscribeParams = z.output<typeof ModelsTranscribeParams>;\nexport type ModelsTranscribeResult = z.output<typeof ModelsTranscribeResult>;\nexport type ModelsInstallParams = z.output<typeof ModelsInstallParams>;\nexport type ModelsInstallResult = z.output<typeof ModelsInstallResult>;\nexport type ModelsProgressEvent = z.output<typeof ModelsProgressEvent>;\nexport type TranscriptSegment = z.output<typeof TranscriptSegment>;\n","/**\n * @ai-matrx/desktop-protocol — cap apps (SPEC §6): the desktop apps a person uses (Claude, Codex,\n * Cursor, VS Code, Antigravity, and any app a later adapter adds), their profiles and usage.\n * Schema source: lint-enforced rules in scripts/check-schema-source.mjs.\n *\n * A profile is one data folder of one app on one device, so several accounts of the same app run\n * side by side. Profiles are the person's own rows in `users.desktop_app_profile` (the one\n * database); folders found on disk that no row names yet are listed with `id: null` so they can be\n * added. Nothing here is ever a credential: signing in happens inside the app.\n */\nimport { z } from \"zod\";\nimport { AbsPath, DeviceId, epochMs } from \"./primitives\";\n\n/** An adapter key: lowercase, open-ended (a new app needs only a new adapter). */\nexport const AppKey = z\n .string()\n .regex(/^[a-z][a-z0-9_-]{0,39}$/);\n\n/** A users.desktop_app_profile id. Plain pattern (see DeviceId for why not z.uuid()). */\nexport const AppProfileId = z\n .string()\n .regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/);\n\n/**\n * Where a profile's folder lives, RELATIVE to the app adapter's data root on that device: one or\n * more plain names joined by \"/\" (none starting with a dot, so never \".\" or \"..\"), never absolute.\n * Null on a profile means the app's own default profile. No lookaround: Pydantic's regex engine\n * has none.\n */\nexport const AppProfileLocator = z\n .string()\n .min(1)\n .max(512)\n .regex(/^[A-Za-z0-9 _()+@,-][A-Za-z0-9 ._()+@,-]{0,127}(\\/[A-Za-z0-9 _()+@,-][A-Za-z0-9 ._()+@,-]{0,127}){0,7}$/);\n\n/** supported: proven here; partial: works with a stated gap; unsupported: not on this OS. */\nexport const AppSupport = z.enum([\"supported\", \"partial\", \"unsupported\"]);\n\nexport const AppFeatureStatus = z.strictObject({\n status: AppSupport,\n /** One line, set whenever status is not \"supported\". */\n reason: z.string().max(140).nullable(),\n});\n\nexport const AppInfo = z.strictObject({\n app_key: AppKey,\n name: z.string().max(64),\n installed: z.boolean(),\n /** The app's own version string, or null when it is not installed or does not say. */\n version: z.string().max(64).nullable(),\n /** The install found (an .app bundle, an .exe, a binary), or null. */\n location: AbsPath.nullable(),\n /** Open the app at all on this OS. */\n open: AppFeatureStatus,\n /** Separate profiles (one account each) on this OS. */\n profiles: AppFeatureStatus,\n /** Plan usage read from the app's own files on this OS. */\n usage: AppFeatureStatus,\n});\n\n/** One plan-usage figure, as the app itself last recorded it. */\nexport const AppUsageReading = z.strictObject({\n window: z.enum([\"five_hour\", \"weekly\", \"extra\"]),\n /** 0–100 for five_hour and weekly; extra-usage spend as a percent of its cap (may pass 100). */\n percent: z.number().min(0).max(10_000),\n /** When the app recorded it. */\n sampled_at_ms: epochMs,\n /** True when the window has rolled over since the sample, so the figure has reset. */\n reset_since: z.boolean(),\n});\n\nexport const AppProfile = z.strictObject({\n /** The row's id; null for a folder found on disk that no row names yet. */\n id: AppProfileId.nullable(),\n app_key: AppKey,\n display_name: z.string().min(1).max(120),\n /** The account the person means to be signed in here; null when not stated (never guessed). */\n account_identity: z.string().min(3).max(320).nullable(),\n profile_locator: AppProfileLocator.nullable(),\n /** The device the row is tied to; null when the row names none. */\n device_id: DeviceId.nullable(),\n /** The folder this profile resolves to on this device; null for a row tied to another device. */\n folder: AbsPath.nullable(),\n /** The folder exists on this device. */\n on_disk: z.boolean(),\n /** An instance with this profile is running; null when it could not be determined. */\n running: z.boolean().nullable(),\n /** Usage the app recorded for this profile; null when the app exposes none here. */\n usage: z.array(AppUsageReading).nullable(),\n last_opened_ms: epochMs.nullable(),\n});\n\nexport const AppsListParams = z.strictObject({});\nexport const AppsListResult = z.strictObject({ apps: z.array(AppInfo) });\n\nexport const AppsProfilesListParams = z.strictObject({\n /** Only this app's profiles; every app's when absent. */\n app_key: AppKey.optional(),\n});\nexport const AppsProfilesListResult = z.strictObject({\n profiles: z.array(AppProfile),\n /**\n * Whether the saved rows could be read: false while signed out or offline, when only folders\n * found on disk are listed.\n */\n registry: z.enum([\"ok\", \"signed_out\", \"unavailable\"]),\n});\n\n/** Create (no id) or update (id) the person's own profile row. */\nexport const AppsProfilesSaveParams = z.strictObject({\n id: AppProfileId.optional(),\n app_key: AppKey,\n display_name: z.string().min(1).max(120),\n account_identity: z.string().min(3).max(320).nullable(),\n /** On create: the folder to use (one found on disk), or null for the app's default profile. Ignored on update. */\n profile_locator: AppProfileLocator.nullable(),\n /** On create with profile_locator null: make a new folder named after display_name instead. */\n new_folder: z.boolean().default(false),\n});\nexport const AppsProfilesSaveResult = AppProfile;\n\n/** Remove the row (soft delete). The folder on disk is never touched. */\nexport const AppsProfilesRemoveParams = z.strictObject({ id: AppProfileId });\nexport const AppsProfilesRemoveResult = z.strictObject({ removed: z.boolean() });\n\n/** Open the app with a profile (its default profile when profile_id is absent). */\nexport const AppsOpenParams = z.strictObject({\n app_key: AppKey,\n profile_id: AppProfileId.optional(),\n});\nexport const AppsOpenResult = z.strictObject({\n /** True when an instance with this profile was already running; it is brought forward. */\n already_running: z.boolean(),\n folder: AbsPath.nullable(),\n});\n\n// Inferred (output) types — same name as the schema, so `AppInfo` is both the validator and its type.\nexport type AppKey = z.output<typeof AppKey>;\nexport type AppProfileId = z.output<typeof AppProfileId>;\nexport type AppProfileLocator = z.output<typeof AppProfileLocator>;\nexport type AppSupport = z.output<typeof AppSupport>;\nexport type AppFeatureStatus = z.output<typeof AppFeatureStatus>;\nexport type AppInfo = z.output<typeof AppInfo>;\nexport type AppUsageReading = z.output<typeof AppUsageReading>;\nexport type AppProfile = z.output<typeof AppProfile>;\nexport type AppsListParams = z.output<typeof AppsListParams>;\nexport type AppsListResult = z.output<typeof AppsListResult>;\nexport type AppsProfilesListParams = z.output<typeof AppsProfilesListParams>;\nexport type AppsProfilesListResult = z.output<typeof AppsProfilesListResult>;\nexport type AppsProfilesSaveParams = z.output<typeof AppsProfilesSaveParams>;\nexport type AppsProfilesSaveResult = z.output<typeof AppsProfilesSaveResult>;\nexport type AppsProfilesRemoveParams = z.output<typeof AppsProfilesRemoveParams>;\nexport type AppsProfilesRemoveResult = z.output<typeof AppsProfilesRemoveResult>;\nexport type AppsOpenParams = z.output<typeof AppsOpenParams>;\nexport type AppsOpenResult = z.output<typeof AppsOpenResult>;\n","/**\n * @ai-matrx/desktop-protocol — the internal envelope between Matrx 2's core and its supervised\n * Python services (SPEC §3.10). Schema source: lint-enforced rules in scripts/check-schema-source.mjs.\n *\n * Never seen by a client: clients speak the Router protocol (envelope.ts); a capability owner in\n * the core forwards a Router op to its service op (SERVICES in registry.ts). One local socket per\n * service (a Unix socket on macOS/Linux, a named pipe on Windows). Each message is one frame:\n * a 4-byte big-endian length, then that many bytes of UTF-8 JSON (at most SERVICE_MAX_FRAME_BYTES).\n *\n * The first message on a connection is `hello` (the per-launch token the core handed the service\n * in its environment, plus the contract hash it was built against). A wrong token or a different\n * contract is answered with `error` id 0 and the connection is closed: the two sides of the\n * connection were generated from different contracts and must never talk (SPEC P11).\n */\nimport { z } from \"zod\";\nimport { ProtocolErrorBody } from \"./errors\";\nimport { nonNegInt, u32 } from \"./primitives\";\n\n/** The largest frame either side accepts (16 MiB). */\nexport const SERVICE_MAX_FRAME_BYTES = 16_777_216 as const;\n\n/** Supervised Python services. `tools` joins when it is built. */\nexport const ServiceName = z.enum([\"ml\"]);\n\n/** SHA-256 (hex) of generated/desktop-protocol.schema.json: CONTRACT_SHA256 on both sides. */\nexport const ContractHash = z.string().regex(/^[0-9a-f]{64}$/);\n\n/** The per-launch secret: 32 random bytes, base64url (43 characters). Passed by environment, never argv. */\nexport const ServiceToken = z.string().regex(/^[A-Za-z0-9_-]{43}$/);\n\n/** Request ids on a service connection: 1 and up; 0 answers a refused hello. (u32, inlined.) */\nconst ServiceRequestId = u32;\n\nexport const ServiceHello = z.strictObject({ type: z.literal(\"hello\"), token: ServiceToken, contract: ContractHash });\n\nexport const ServiceWelcome = z.strictObject({\n type: z.literal(\"welcome\"),\n service: ServiceName,\n contract: ContractHash,\n pid: nonNegInt,\n /** The interpreter's version, e.g. \"3.13.15\". */\n python: z.string().max(32),\n /** Every op this service serves; must equal SERVICES[service] exactly. */\n ops: z.array(z.string().min(1).max(64)).max(64),\n});\n\nexport const ServiceRequest = z.strictObject({\n type: z.literal(\"request\"),\n id: ServiceRequestId,\n op: z.string().min(1).max(64),\n params: z.unknown(), // validated by the service against SERVICES[service][op].params\n});\n\nexport const ServiceResponse = z.strictObject({\n type: z.literal(\"response\"),\n id: ServiceRequestId,\n result: z.unknown(), // validated by the core against SERVICES[service][op].result\n});\n\nexport const ServiceErrorMsg = z.strictObject({ type: z.literal(\"error\"), id: ServiceRequestId, error: ProtocolErrorBody });\n\n/** A running request's progress (validated against the service's progress schema). */\nexport const ServiceProgressMsg = z.strictObject({ type: z.literal(\"progress\"), id: ServiceRequestId, progress: z.unknown() });\n\nexport const ServiceCancel = z.strictObject({ type: z.literal(\"cancel\"), id: ServiceRequestId });\n\n/** Health check: the service answers `pong` at once from its event loop, even while it works. */\nexport const ServicePing = z.strictObject({ type: z.literal(\"ping\"), id: ServiceRequestId });\nexport const ServicePong = z.strictObject({\n type: z.literal(\"pong\"),\n id: ServiceRequestId,\n /** Requests running now. */\n busy: nonNegInt,\n});\n\n/** Finish quickly: cancel running work, answer nothing more, exit 0. */\nexport const ServiceShutdown = z.strictObject({ type: z.literal(\"shutdown\") });\n\nexport const CoreToServiceMsg = z.discriminatedUnion(\"type\", [ServiceHello, ServiceRequest, ServiceCancel, ServicePing, ServiceShutdown]);\nexport const ServiceToCoreMsg = z.discriminatedUnion(\"type\", [ServiceWelcome, ServiceResponse, ServiceErrorMsg, ServiceProgressMsg, ServicePong]);\n\nexport type ServiceName = z.output<typeof ServiceName>;\nexport type CoreToServiceMsg = z.output<typeof CoreToServiceMsg>;\nexport type ServiceToCoreMsg = z.output<typeof ServiceToCoreMsg>;\nexport type ServiceWelcome = z.output<typeof ServiceWelcome>;\n","/**\n * @ai-matrx/desktop-protocol — local tool proof records (SPEC §10). Schema source: lint-enforced\n * rules in scripts/check-schema-source.mjs.\n *\n * A tool is \"working\" only when three levels pass: programmatic (its owner, called directly on the\n * real OS), protocol (through the transports, including the relay), chat (a real platform agent in a\n * real chat calls it and gets the right result). Every harness that proves a level — the desktop's\n * vitest suites, aidream's live pytest — writes `ToolResultsFile`s; the status table is generated\n * from them (src/tools/status.ts) and is never written by hand. This file is the one contract\n * between those harnesses: the Pydantic twin in aidream/_generated/desktop_protocol.py is generated\n * from it, so the Python writers and the TS reader cannot drift.\n */\nimport { z } from \"zod\";\n\nexport const ToolLevel = z.enum([\"programmatic\", \"protocol\", \"chat\"]);\nexport const ToolOutcome = z.enum([\"pass\", \"fail\", \"skip\"]);\nexport const ToolPlatform = z.enum([\"darwin\", \"win32\", \"linux\"]);\n/**\n * How the call reached the owner. `in_process` is level 1; `localhost` and `relay` are level 2;\n * `agent` is level 3 (a model chose the call). `relay` means the platform's real path: a matrx-ai\n * tool → aidream local-proxy → the relay → the device.\n */\nexport const ToolTransport = z.enum([\"in_process\", \"localhost\", \"relay\", \"agent\"]);\n\n/** Tool names are the platform registry's (`tool.definition.name`): `fs_read`, `shell_execute`… */\nexport const ToolName = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-z][a-z0-9_]*$/);\n\nexport const ToolLevelResult = z.strictObject({\n tool: ToolName,\n level: ToolLevel,\n platform: ToolPlatform,\n transport: ToolTransport,\n outcome: ToolOutcome,\n /** True when the caller sat on a different network from the device (a phone on cellular, CI). */\n remote_network: z.boolean(),\n /** One line: what was asserted, or why it failed. Never a token, a file's contents or a path under a real home. */\n detail: z.string().max(500),\n /** The harness that produced it, e.g. `matrx-desktop test/tools/programmatic.test.ts`. */\n suite: z.string().min(1).max(200),\n /** The test case inside the suite. */\n test: z.string().min(1).max(300),\n run_at_ms: z.int().min(0),\n});\n\nexport const ToolResultsFile = z.strictObject({\n schema: z.literal(\"matrx.tool-results.v1\"),\n /** The producing repo's commit (short or full SHA). */\n commit: z.string().min(4).max(64),\n results: z.array(ToolLevelResult).max(10_000),\n});\n\nexport type ToolLevel = z.output<typeof ToolLevel>;\nexport type ToolOutcome = z.output<typeof ToolOutcome>;\nexport type ToolPlatform = z.output<typeof ToolPlatform>;\nexport type ToolTransport = z.output<typeof ToolTransport>;\nexport type ToolLevelResult = z.output<typeof ToolLevelResult>;\nexport type ToolResultsFile = z.output<typeof ToolResultsFile>;\n","/** @ai-matrx/desktop-protocol — the op and event registries (Router, client and Python are generated from these). */\nimport { z } from \"zod\";\nimport {\n AbsPath,\n DeviceId,\n ProtocolVersion,\n RequestId,\n ResourceId,\n} from \"./primitives\";\nimport {\n ErrorCode,\n ErrorReason,\n FsPatchEditFailure,\n ProtocolErrorBody,\n} from \"./errors\";\nimport {\n FrameHeader,\n RelayHopEnvelopeHeader,\n RelayHopConnectionEnd,\n} from \"./frame\";\nimport {\n CancelMsg,\n ClientToCoreMsg,\n ClientType,\n CoreToClientMsg,\n CreditMsg,\n EndMsg,\n EndReason,\n ErrorMsg,\n EventMsg,\n HelloMsg,\n Limits,\n OpDescriptor,\n RelayMsg,\n RequestMsg,\n ResponseMsg,\n StreamMeta,\n StreamMsg,\n Welcome,\n CloseCodeValue,\n} from \"./envelope\";\nimport {\n OsPermissionName,\n SysinfoGetParams,\n SysinfoGetResult,\n} from \"./sysinfo\";\nimport {\n FsChange,\n FsChangedEvent,\n FsDeleteParams,\n FsDeleteResult,\n FsEncoding,\n FsEntry,\n FsKind,\n FsListParams,\n FsListResult,\n FsMkdirParams,\n FsMkdirResult,\n FsMoveParams,\n FsMoveResult,\n FsPatchEditApplied,\n FsPatchParams,\n FsPatchResult,\n FsReadParams,\n FsReadResult,\n FsReadStreamParams,\n FsReadStreamResult,\n FsSearchContentParams,\n FsSearchContentResult,\n FsSearchPathsParams,\n FsSearchPathsResult,\n FsStatParams,\n FsStatResult,\n FsWatchParams,\n FsWatchResult,\n FsWriteParams,\n FsWriteResult,\n} from \"./fs\";\nimport {\n ExecCwdEvent,\n ExecExitedEvent,\n ExecListParams,\n ExecListResult,\n ExecPtyKillParams,\n ExecPtyKillResult,\n ExecPtyResizeParams,\n ExecPtyResizeResult,\n ExecPtySignalParams,\n ExecPtySignalResult,\n ExecPtyStartParams,\n ExecPtyStartResult,\n ExecPtyWriteParams,\n ExecPtyWriteResult,\n ExecRunParams,\n ExecRunResult,\n ExecTitleEvent,\n PtyInfo,\n Signal,\n} from \"./exec\";\nimport {\n ResourceInfo,\n SessionAttachParams,\n SessionAttachResult,\n SessionControlChangedEvent,\n SessionDetachParams,\n SessionDetachResult,\n SessionListParams,\n SessionListResult,\n SessionReleaseParams,\n SessionReleaseResult,\n} from \"./session\";\nimport {\n MlInstallPhase,\n MlInstallProgress,\n MlProgress,\n MlRuntimeState,\n MlServiceState,\n MlServiceStatus,\n MlStatusParams,\n MlStatusResult,\n ModelsInstallParams,\n ModelsInstallResult,\n ModelsProgressEvent,\n ModelsStatusParams,\n ModelsStatusResult,\n ModelsTranscribeParams,\n ModelsTranscribeResult,\n TranscriptionModelId,\n TranscriptionModelInfo,\n TranscriptSegment,\n} from \"./models\";\nimport {\n ContractHash,\n CoreToServiceMsg,\n ServiceCancel,\n ServiceErrorMsg,\n ServiceHello,\n ServiceName,\n ServicePing,\n ServicePong,\n ServiceProgressMsg,\n ServiceRequest,\n ServiceResponse,\n ServiceShutdown,\n ServiceToCoreMsg,\n ServiceToken,\n ServiceWelcome,\n} from \"./service\";\nimport {\n RelayAuthExpiringEvent,\n RelayCallRequest,\n RelayCallResponse,\n RelayDeviceStatusEvent,\n RelayCallHello,\n RelayCallEnvelope,\n} from \"./relay\";\nimport { ToolLevel, ToolLevelResult, ToolName, ToolOutcome, ToolPlatform, ToolResultsFile, ToolTransport } from \"./tools\";\n\nimport {\n AppFeatureStatus,\n AppInfo,\n AppKey,\n AppProfile,\n AppProfileId,\n AppProfileLocator,\n AppSupport,\n AppUsageReading,\n AppsListParams,\n AppsListResult,\n AppsOpenParams,\n AppsOpenResult,\n AppsProfilesListParams,\n AppsProfilesListResult,\n AppsProfilesRemoveParams,\n AppsProfilesRemoveResult,\n AppsProfilesSaveParams,\n AppsProfilesSaveResult,\n} from \"./apps\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Registries — the Router, the client and the Python side are all generated from these.\n// kind: unary = response only; stream = response, then stream/end on the same id;\n// resource = like stream and the result carries a resource_id the Session Manager owns.\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type OpSpec = {\n readonly params: z.ZodType;\n readonly result: z.ZodType;\n readonly kind: \"unary\" | \"stream\" | \"resource\";\n readonly since: \"1.0\" | \"1.2\";\n readonly errors: readonly z.infer<typeof ErrorCode>[];\n};\n\nconst FS_ERR = [\"NOT_FOUND\", \"PERMISSION_DENIED_OS\", \"INVALID_PARAMS\", \"RESOURCE_BUSY\", \"INTERNAL\"] as const;\n\nexport const OPS = {\n \"sysinfo.get\": { params: SysinfoGetParams, result: SysinfoGetResult, kind: \"unary\", since: \"1.0\", errors: [\"INTERNAL\"] },\n\n \"fs.list\": { params: FsListParams, result: FsListResult, kind: \"unary\", since: \"1.0\", errors: FS_ERR },\n \"fs.stat\": { params: FsStatParams, result: FsStatResult, kind: \"unary\", since: \"1.0\", errors: FS_ERR },\n \"fs.read\": { params: FsReadParams, result: FsReadResult, kind: \"unary\", since: \"1.0\", errors: [...FS_ERR, \"PAYLOAD_TOO_LARGE\"] },\n \"fs.read_stream\": { params: FsReadStreamParams, result: FsReadStreamResult, kind: \"stream\", since: \"1.0\", errors: [...FS_ERR, \"CANCELLED\"] },\n \"fs.write\": { params: FsWriteParams, result: FsWriteResult, kind: \"unary\", since: \"1.0\", errors: [...FS_ERR, \"CONFLICT\", \"PAYLOAD_TOO_LARGE\"] },\n \"fs.mkdir\": { params: FsMkdirParams, result: FsMkdirResult, kind: \"unary\", since: \"1.0\", errors: [...FS_ERR, \"CONFLICT\"] },\n \"fs.move\": { params: FsMoveParams, result: FsMoveResult, kind: \"unary\", since: \"1.0\", errors: [...FS_ERR, \"CONFLICT\"] },\n \"fs.delete\": { params: FsDeleteParams, result: FsDeleteResult, kind: \"unary\", since: \"1.0\", errors: FS_ERR },\n \"fs.watch\": { params: FsWatchParams, result: FsWatchResult, kind: \"resource\", since: \"1.0\", errors: [...FS_ERR, \"RATE_LIMITED\"] },\n \"fs.patch\": { params: FsPatchParams, result: FsPatchResult, kind: \"unary\", since: \"1.0\", errors: [...FS_ERR, \"CONFLICT\"] },\n \"fs.search_paths\": { params: FsSearchPathsParams, result: FsSearchPathsResult, kind: \"unary\", since: \"1.0\", errors: [...FS_ERR, \"TIMEOUT\"] },\n \"fs.search_content\": { params: FsSearchContentParams, result: FsSearchContentResult, kind: \"unary\", since: \"1.0\", errors: [...FS_ERR, \"TIMEOUT\"] },\n\n \"exec.pty.start\": { params: ExecPtyStartParams, result: ExecPtyStartResult, kind: \"resource\", since: \"1.0\", errors: [\"INVALID_PARAMS\", \"NOT_FOUND\", \"RATE_LIMITED\", \"PLATFORM_UNSUPPORTED\", \"INTERNAL\"] },\n \"exec.pty.write\": { params: ExecPtyWriteParams, result: ExecPtyWriteResult, kind: \"unary\", since: \"1.0\", errors: [\"RESOURCE_GONE\", \"AUTH_FORBIDDEN\", \"INVALID_PARAMS\"] },\n \"exec.pty.resize\": { params: ExecPtyResizeParams, result: ExecPtyResizeResult, kind: \"unary\", since: \"1.0\", errors: [\"RESOURCE_GONE\", \"AUTH_FORBIDDEN\"] },\n \"exec.pty.signal\": { params: ExecPtySignalParams, result: ExecPtySignalResult, kind: \"unary\", since: \"1.0\", errors: [\"RESOURCE_GONE\", \"AUTH_FORBIDDEN\", \"PLATFORM_UNSUPPORTED\"] },\n \"exec.pty.kill\": { params: ExecPtyKillParams, result: ExecPtyKillResult, kind: \"unary\", since: \"1.0\", errors: [\"RESOURCE_GONE\", \"AUTH_FORBIDDEN\"] },\n \"exec.list\": { params: ExecListParams, result: ExecListResult, kind: \"unary\", since: \"1.0\", errors: [\"INTERNAL\"] },\n \"exec.run\": { params: ExecRunParams, result: ExecRunResult, kind: \"unary\", since: \"1.0\", errors: [\"INVALID_PARAMS\", \"NOT_FOUND\", \"TIMEOUT\", \"CANCELLED\", \"INTERNAL\"] },\n\n \"session.attach\": { params: SessionAttachParams, result: SessionAttachResult, kind: \"stream\", since: \"1.0\", errors: [\"RESOURCE_GONE\", \"AUTH_FORBIDDEN\", \"RESOURCE_BUSY\"] },\n \"session.detach\": { params: SessionDetachParams, result: SessionDetachResult, kind: \"unary\", since: \"1.0\", errors: [\"RESOURCE_GONE\"] },\n \"session.release\": { params: SessionReleaseParams, result: SessionReleaseResult, kind: \"unary\", since: \"1.0\", errors: [\"RESOURCE_GONE\", \"AUTH_FORBIDDEN\"] },\n \"session.list\": { params: SessionListParams, result: SessionListResult, kind: \"unary\", since: \"1.0\", errors: [\"INTERNAL\"] },\n\n // Local models (SPEC §6), served by the `ml` Python service through SERVICES below.\n \"models.status\": { params: ModelsStatusParams, result: ModelsStatusResult, kind: \"unary\", since: \"1.2\", errors: [\"INTERNAL\"] },\n \"models.install\": { params: ModelsInstallParams, result: ModelsInstallResult, kind: \"unary\", since: \"1.2\", errors: [\"RESOURCE_BUSY\", \"RESOURCE_GONE\", \"TIMEOUT\", \"CANCELLED\", \"INTERNAL\"] },\n \"models.transcribe\": { params: ModelsTranscribeParams, result: ModelsTranscribeResult, kind: \"unary\", since: \"1.2\", errors: [\"NOT_FOUND\", \"INVALID_PARAMS\", \"PERMISSION_DENIED_OS\", \"RESOURCE_BUSY\", \"RESOURCE_GONE\", \"CANCELLED\", \"PAYLOAD_TOO_LARGE\", \"INTERNAL\"] },\n\n // Desktop apps and their profiles (SPEC §6 apps); profiles are rows in users.desktop_app_profile.\n \"apps.list\": { params: AppsListParams, result: AppsListResult, kind: \"unary\", since: \"1.2\", errors: [\"INTERNAL\"] },\n \"apps.profiles.list\": { params: AppsProfilesListParams, result: AppsProfilesListResult, kind: \"unary\", since: \"1.2\", errors: [\"NOT_FOUND\", \"INVALID_PARAMS\", \"INTERNAL\"] },\n \"apps.profiles.save\": { params: AppsProfilesSaveParams, result: AppsProfilesSaveResult, kind: \"unary\", since: \"1.2\", errors: [\"AUTH_REQUIRED\", \"AUTH_FORBIDDEN\", \"NOT_FOUND\", \"INVALID_PARAMS\", \"CONFLICT\", \"PLATFORM_UNSUPPORTED\", \"DEVICE_OFFLINE\", \"INTERNAL\"] },\n \"apps.profiles.remove\": { params: AppsProfilesRemoveParams, result: AppsProfilesRemoveResult, kind: \"unary\", since: \"1.2\", errors: [\"AUTH_REQUIRED\", \"AUTH_FORBIDDEN\", \"NOT_FOUND\", \"DEVICE_OFFLINE\", \"INTERNAL\"] },\n \"apps.open\": { params: AppsOpenParams, result: AppsOpenResult, kind: \"unary\", since: \"1.2\", errors: [\"NOT_FOUND\", \"PLATFORM_UNSUPPORTED\", \"AUTH_REQUIRED\", \"DEVICE_OFFLINE\", \"INTERNAL\"] },\n} as const satisfies Record<string, OpSpec>;\n\nexport type OpName = keyof typeof OPS;\nexport type OpParams<N extends OpName> = z.input<(typeof OPS)[N][\"params\"]>;\nexport type OpResult<N extends OpName> = z.output<(typeof OPS)[N][\"result\"]>;\n\nexport const EVENTS = {\n \"fs.changed\": FsChangedEvent,\n \"exec.exited\": ExecExitedEvent,\n \"exec.title\": ExecTitleEvent,\n \"exec.cwd\": ExecCwdEvent,\n \"session.control_changed\": SessionControlChangedEvent,\n \"models.progress\": ModelsProgressEvent,\n \"relay.device_status\": RelayDeviceStatusEvent,\n \"relay.auth_expiring\": RelayAuthExpiringEvent,\n} as const satisfies Record<string, z.ZodType>;\n\nexport type EventName = keyof typeof EVENTS;\n\n/**\n * Supervised Python services (SPEC §3.10) and the ops each serves over its local socket\n * (src/schema/service.ts). The Python side's handler protocol, op table and models are generated\n * from this table (scripts/gen_pydantic.py); the core's service client is typed by it. A Router\n * op that a capability owner forwards uses the same params/result schemas as its service op.\n */\nexport type ServiceOpSpec = { readonly params: z.ZodType; readonly result: z.ZodType };\nexport type ServiceSpec = { readonly progress: z.ZodType; readonly ops: Readonly<Record<string, ServiceOpSpec>> };\n\nexport const SERVICES = {\n ml: {\n progress: MlProgress,\n ops: {\n \"ml.status\": { params: MlStatusParams, result: MlStatusResult },\n \"ml.install\": { params: ModelsInstallParams, result: ModelsInstallResult },\n \"ml.transcribe\": { params: ModelsTranscribeParams, result: ModelsTranscribeResult },\n },\n },\n} as const satisfies Record<z.infer<typeof ServiceName>, ServiceSpec>;\n\nexport type ServiceId = keyof typeof SERVICES;\nexport type ServiceOpName<S extends ServiceId> = keyof (typeof SERVICES)[S][\"ops\"] & string;\n\n/**\n * Every schema that lands in the generated JSON Schema `$defs` under a stable name (and so becomes a\n * named Pydantic model). Order is the emission order. A test asserts every exported schema of\n * src/schema/* is either listed here or is a documented alias of a listed one.\n * Registered into a PRIVATE zod registry by scripts/generate.ts — never `.meta()`/`.describe()`,\n * which write zod's process-global registry as an import side effect.\n */\nexport const NAMED_SCHEMAS = {\n ProtocolVersion,\n RequestId,\n ResourceId,\n DeviceId,\n AbsPath,\n ErrorCode,\n ErrorReason,\n FsPatchEditFailure,\n ProtocolErrorBody,\n FrameHeader,\n ClientType,\n Limits,\n OpDescriptor,\n Welcome,\n HelloMsg,\n RequestMsg,\n ResponseMsg,\n ErrorMsg,\n StreamMeta,\n StreamMsg,\n EndReason,\n EndMsg,\n CancelMsg,\n CreditMsg,\n EventMsg,\n RelayMsg,\n ClientToCoreMsg,\n CoreToClientMsg,\n OsPermissionName,\n SysinfoGetParams,\n SysinfoGetResult,\n FsKind,\n FsEntry,\n FsListParams,\n FsListResult,\n FsStatParams,\n FsEncoding,\n FsReadParams,\n FsReadResult,\n FsReadStreamParams,\n FsReadStreamResult,\n FsWriteParams,\n FsWriteResult,\n FsMkdirParams,\n FsMkdirResult,\n FsMoveParams,\n FsMoveResult,\n FsDeleteParams,\n FsDeleteResult,\n FsWatchParams,\n FsWatchResult,\n FsPatchEditApplied,\n FsPatchParams,\n FsPatchResult,\n FsSearchPathsParams,\n FsSearchPathsResult,\n FsSearchContentParams,\n FsSearchContentResult,\n FsChange,\n FsChangedEvent,\n Signal,\n ExecPtyStartParams,\n PtyInfo,\n ExecPtyWriteParams,\n ExecPtyWriteResult,\n ExecPtyResizeParams,\n ExecPtyResizeResult,\n ExecPtySignalParams,\n ExecPtySignalResult,\n ExecPtyKillParams,\n ExecPtyKillResult,\n ExecListParams,\n ExecListResult,\n ExecRunParams,\n ExecRunResult,\n ExecExitedEvent,\n ExecTitleEvent,\n ExecCwdEvent,\n SessionAttachParams,\n ResourceInfo,\n SessionDetachParams,\n SessionDetachResult,\n SessionReleaseParams,\n SessionReleaseResult,\n SessionListParams,\n SessionListResult,\n SessionControlChangedEvent,\n TranscriptionModelId,\n MlRuntimeState,\n MlInstallPhase,\n MlInstallProgress,\n TranscriptionModelInfo,\n TranscriptSegment,\n MlStatusParams,\n MlStatusResult,\n ModelsInstallParams,\n ModelsInstallResult,\n ModelsTranscribeParams,\n ModelsTranscribeResult,\n MlProgress,\n MlServiceState,\n MlServiceStatus,\n ModelsStatusParams,\n ModelsStatusResult,\n ModelsProgressEvent,\n ServiceName,\n ContractHash,\n ServiceToken,\n ServiceHello,\n ServiceWelcome,\n ServiceRequest,\n ServiceResponse,\n ServiceErrorMsg,\n ServiceProgressMsg,\n ServiceCancel,\n ServicePing,\n ServicePong,\n ServiceShutdown,\n CoreToServiceMsg,\n ServiceToCoreMsg,\n RelayDeviceStatusEvent,\n RelayAuthExpiringEvent,\n RelayCallRequest,\n RelayCallResponse,\n RelayCallHello,\n RelayCallEnvelope,\n RelayHopEnvelopeHeader,\n RelayHopConnectionEnd,\n CloseCodeValue,\n ToolLevel,\n ToolOutcome,\n ToolPlatform,\n ToolTransport,\n ToolName,\n ToolLevelResult,\n ToolResultsFile,\n AppKey,\n AppProfileId,\n AppProfileLocator,\n AppSupport,\n AppFeatureStatus,\n AppInfo,\n AppUsageReading,\n AppProfile,\n AppsListParams,\n AppsListResult,\n AppsProfilesListParams,\n AppsProfilesListResult,\n AppsProfilesSaveParams,\n AppsProfilesRemoveParams,\n AppsProfilesRemoveResult,\n AppsOpenParams,\n AppsOpenResult,\n} as const satisfies Record<string, z.ZodType>;\n\nexport type NamedSchemaId = keyof typeof NAMED_SCHEMAS;\n","/**\n * Version skew is the normal state: a phone, the server and a desktop app in the field run\n * different package versions, and a minor protocol bump must never make any of them fail.\n *\n * THE RULE (enforced by src/versioning.test.ts against generated/baseline-1.0.json):\n * 1. Within a major, a minor may only ADD. A field added after x.0 is OPTIONAL in the schema\n * (an older peer omits it) and is listed in FIELDS_SINCE with the minor that added it.\n * 2. A writer never sends a field newer than the version its peer negotiated (hello/welcome, or\n * the /call version header): older peers' strict schemas refuse unknown keys. `forPeer`\n * does the stripping; the core's Router applies it to every result and error it sends.\n * 3. A reader that needs a newer field checks the peer's version and says so loudly when the\n * peer is older (e.g. aidream's local_proxy marks a patch answer from a 1.0 app).\n */\nimport type { OpName } from \"./schema/registry\";\nimport type { ErrorReasonName } from \"./types\";\nimport { PROTOCOL_MAJOR, PROTOCOL_MINOR } from \"./schema/primitives\";\n\n/**\n * Fields added after x.0, by schema location: a named schema (`FsPatchResult`), a property path\n * inside one (`ProtocolErrorBody.data`), or a union branch (`RelayCallResponse|0`).\n */\nexport const FIELDS_SINCE = {\n FsPatchResult: { edits_applied: \"1.1\", edits_failed: \"1.1\" },\n \"ProtocolErrorBody.data\": { edits_failed: \"1.1\" },\n \"RelayCallResponse|0\": { protocol_version: \"1.1\" },\n \"RelayCallResponse|1\": { protocol_version: \"1.1\" },\n} as const satisfies Record<string, Record<string, `${number}.${number}`>>;\n\nexport type FieldsSincePath = keyof typeof FIELDS_SINCE;\n\n/**\n * 1.0 fields that a later minor lets be null, and what a peer older than that minor is sent\n * instead (the value that meant the same thing before). Widening a field any other way is a major.\n */\nexport const NULL_SINCE = {\n \"RelayDeviceStatusEvent.since_ms\": { since: \"1.1\", olderPeersGet: 0 },\n} as const satisfies Record<string, { since: `${number}.${number}`; olderPeersGet: unknown }>;\n\n/**\n * Error reasons added after x.0, with the minor that added each. An older peer's strict enum would\n * refuse the whole error body, so `forPeer` drops a reason the peer does not know (the code, the\n * message and `retryable` still tell it what happened).\n */\nexport const REASONS_SINCE = {\n runtime_not_installed: \"1.2\",\n model_not_installed: \"1.2\",\n unsupported_media: \"1.2\",\n download_failed: \"1.2\",\n service_starting: \"1.2\",\n service_restarted: \"1.2\",\n service_failed: \"1.2\",\n} as const satisfies Partial<Record<ErrorReasonName, `${number}.${number}`>>;\n\n/** A device status for a reader at `version`: `since_ms` null (\"never\") becomes 0 before 1.1. */\nexport function statusForPeer<T extends { since_ms: number | null }>(status: T, version: string): T {\n const rule = NULL_SINCE[\"RelayDeviceStatusEvent.since_ms\"];\n return status.since_ms === null && !knows(version, rule.since) ? { ...status, since_ms: rule.olderPeersGet } : status;\n}\n\n/**\n * A WebSocket client announces the newest minor it reads at connect time by also offering\n * `matrx.v<major>.<minor>` beside SUBPROTOCOL (servers still answer SUBPROTOCOL). Before hello is\n * possible, this is how the relay picks the right shape for its greeting.\n */\nexport function versionSubprotocol(version: string): string {\n return `matrx.v${version}`;\n}\n\n/** The version a client announced in its offered subprotocols; \"1.0\" when it did not. */\nexport function announcedVersion(offered: readonly string[]): string {\n let best = `${PROTOCOL_MAJOR}.0`;\n for (const p of offered) {\n const m = /^matrx\\.v(\\d+\\.\\d+)$/.exec(p.trim());\n if (m?.[1] && compareVersions(m[1], best) > 0 && m[1].startsWith(`${PROTOCOL_MAJOR}.`)) best = m[1];\n }\n return best;\n}\n\n/** \"1.10\" > \"1.9\". Same-major comparison of \"major.minor\" strings. */\nexport function compareVersions(a: string, b: string): number {\n const [am = 0, an = 0] = a.split(\".\").map(Number);\n const [bm = 0, bn = 0] = b.split(\".\").map(Number);\n return am - bm || an - bn;\n}\n\n/** True when a peer at `version` knows a field added in `since`. */\nexport function knows(version: string, since: string): boolean {\n return compareVersions(version, since) >= 0;\n}\n\n/** The version two peers speak: the lower minor within this major. */\nexport function negotiate(peerVersion: string): string {\n const [major = 0, minor = 0] = peerVersion.split(\".\").map(Number);\n if (major !== PROTOCOL_MAJOR) return `${PROTOCOL_MAJOR}.0`;\n return `${PROTOCOL_MAJOR}.${Math.min(minor, PROTOCOL_MINOR)}`;\n}\n\nfunction strip(value: unknown, fields: Record<string, string> | undefined, version: string): unknown {\n if (!fields || value === null || typeof value !== \"object\" || Array.isArray(value)) return value;\n let out: Record<string, unknown> | null = null;\n for (const [field, since] of Object.entries(fields)) {\n if (field in (value as object) && !knows(version, since)) {\n out ??= { ...(value as Record<string, unknown>) };\n delete out[field];\n }\n }\n return out ?? value;\n}\n\nconst RESULT_PATH = new Map<OpName, FieldsSincePath>([[\"fs.patch\", \"FsPatchResult\"]]);\n\n/**\n * What to send a peer that negotiated `version`: `result` of `op`, or an error body, with every\n * field newer than that version removed (rule 2). Unchanged for a current peer.\n */\nexport function forPeer(op: OpName, part: \"result\", value: unknown, version: string): unknown;\nexport function forPeer(op: OpName | null, part: \"error\", value: unknown, version: string): unknown;\nexport function forPeer(op: OpName | null, part: \"result\" | \"error\", value: unknown, version: string): unknown {\n if (part === \"result\") {\n const path = op ? RESULT_PATH.get(op) : undefined;\n return path ? strip(value, FIELDS_SINCE[path], version) : value;\n }\n if (value === null || typeof value !== \"object\") return value;\n const body = value as { data?: unknown };\n if (body.data === undefined) return value;\n let data = strip(body.data, FIELDS_SINCE[\"ProtocolErrorBody.data\"], version);\n const reason = (data as { reason?: unknown }).reason;\n const reasonSince = typeof reason === \"string\" ? (REASONS_SINCE as Record<string, string>)[reason] : undefined;\n if (reasonSince && !knows(version, reasonSince)) {\n const { reason: _dropped, ...rest } = data as Record<string, unknown>;\n data = rest;\n }\n return data === body.data ? value : { ...body, data };\n}\n\n/** Every op whose result has a versioned field is wired into forPeer (checked by the test). */\nexport const VERSIONED_RESULT_OPS: readonly OpName[] = [...RESULT_PATH.keys()];\n","// AUTO-GENERATED by scripts/generate.ts — DO NOT EDIT. `pnpm generate --check` fails on any hand edit.\n/** SHA-256 of generated/desktop-protocol.schema.json: the contract both sides of a service connection were built from. */\nexport const CONTRACT_SHA256 = \"ef9fd8c8ab611bf450730452a6cf48a4ebd566218b6e17e2834ef030fc2044cb\" as const;\n","/**\n * What a connecting side does after each WebSocket close — the ONE table every client reads (the\n * package client, the desktop's relay transport, any other dialer). Never keep a local list of\n * \"terminal\" codes: a code added to CloseCode without a rule here fails to compile.\n *\n * reconnect_now the far side went away on purpose or the socket died; dial again at once if the\n * connection had opened, with backoff otherwise (a dead network never spins).\n * reconnect transient refusal; dial again with backoff.\n * reauth the token was refused; get a FRESH token and dial once more. A second refusal in\n * a row (no successful open between) is terminal with outcome \"signed_out\".\n * stop retrying cannot help: stop dialing until something changes (a new sign-in, a\n * new device, an update) and show the outcome.\n */\nimport type { ErrorCodeName } from \"./types\";\nimport { CloseCode, type CloseCodeValue } from \"./schema/envelope\";\n\nexport type CloseAction = \"reconnect_now\" | \"reconnect\" | \"reauth\" | \"stop\";\n\n/** The one state a person is shown when dialing stops. */\nexport type CloseOutcome = \"signed_out\" | \"not_owned\" | \"removed\" | \"revoked\" | \"replaced\" | \"upgrade_required\";\n\nexport interface CloseRule {\n readonly action: CloseAction;\n /** Set for `stop` and `reauth` (the outcome when the fresh token is refused too). */\n readonly outcome?: CloseOutcome;\n /** The error a caller's pending work is failed with. */\n readonly error: readonly [ErrorCodeName, string];\n}\n\nexport const CLOSE_RULES = {\n [CloseCode.NORMAL]: { action: \"reconnect\", error: [\"DEVICE_OFFLINE\", \"Connection closed\"] },\n [CloseCode.GOING_AWAY]: { action: \"reconnect_now\", error: [\"DEVICE_OFFLINE\", \"Connection lost\"] },\n [CloseCode.ABNORMAL]: { action: \"reconnect_now\", error: [\"DEVICE_OFFLINE\", \"Connection lost\"] },\n [CloseCode.DEVICE_RECONNECTED]: { action: \"reconnect_now\", error: [\"DEVICE_OFFLINE\", \"Device reconnected\"] },\n [CloseCode.TRY_AGAIN_LATER]: { action: \"reconnect\", error: [\"DEVICE_OFFLINE\", \"Relay busy; retrying\"] },\n [CloseCode.AUTH_INVALID]: { action: \"reauth\", outcome: \"signed_out\", error: [\"AUTH_INVALID\", \"Sign-in was not accepted\"] },\n [CloseCode.AUTH_FORBIDDEN]: { action: \"stop\", outcome: \"not_owned\", error: [\"AUTH_FORBIDDEN\", \"Not this device's owner\"] },\n [CloseCode.DEVICE_NOT_FOUND]: { action: \"stop\", outcome: \"removed\", error: [\"NOT_FOUND\", \"Device not found\"] },\n [CloseCode.AUTH_EXPIRED]: { action: \"reauth\", outcome: \"signed_out\", error: [\"AUTH_EXPIRED\", \"Sign-in expired\"] },\n [CloseCode.REPLACED]: { action: \"stop\", outcome: \"replaced\", error: [\"CONFLICT\", \"Replaced by a newer connection\"] },\n [CloseCode.DEVICE_REVOKED]: { action: \"stop\", outcome: \"revoked\", error: [\"AUTH_DEVICE_REVOKED\", \"This device was revoked\"] },\n // A malformed message, or a connection the relay lost track of: a fresh socket starts clean.\n [CloseCode.PROTOCOL_ERROR]: { action: \"reconnect\", error: [\"PROTOCOL_ERROR\", \"Connection reset by the relay\"] },\n [CloseCode.UPGRADE_REQUIRED]: { action: \"stop\", outcome: \"upgrade_required\", error: [\"PROTOCOL_VERSION_UNSUPPORTED\", \"Protocol upgrade required\"] },\n} as const satisfies Record<CloseCodeValue, CloseRule>;\n\nconst UNKNOWN: CloseRule = { action: \"reconnect\", error: [\"DEVICE_OFFLINE\", \"Connection lost\"] };\n\n/** The rule for any close code; one this table does not know (or null: no close frame) reconnects with backoff. */\nexport function closeRule(code: number | null | undefined): CloseRule {\n if (code === null || code === undefined) return CLOSE_RULES[CloseCode.ABNORMAL];\n return (CLOSE_RULES as Record<number, CloseRule>)[code] ?? UNKNOWN;\n}\n\n/** True when dialing must stop after this close (no retry will help). */\nexport function isTerminalClose(code: number | null | undefined): boolean {\n return closeRule(code).action === \"stop\";\n}\n","/**\n * The local tool catalog (SPEC §10): every tool a platform agent calls on a person's computer, the\n * protocol ops it reaches, the group it ships in, and what became of each of matrx-local's 139\n * handlers (120 actions + the 19 action-enum dispatchers that fanned out to them).\n *\n * Data only. The status table (./status.ts) joins it with the harnesses' results, so a tool listed\n * here with no passing result reads \"untested\", never \"working\". Design and the reasons behind each\n * group: matrx-desktop/design/local-tools.md.\n */\nimport type { OpName } from \"../schema/registry\";\nimport type { ToolPlatform } from \"../schema/tools\";\n\nexport type ToolGroupId = \"files_shell\" | \"os_control\" | \"personal_automation\" | \"tools_service\" | \"ml_service\" | \"windows_admin\";\n\nexport interface ToolGroup {\n readonly id: ToolGroupId;\n readonly order: number;\n readonly title: string;\n /** Who implements the ops: a TS capability owner in the core, or a Python service. */\n readonly owner: \"core\" | \"python_tools\" | \"python_ml\";\n}\n\nexport const TOOL_GROUPS: readonly ToolGroup[] = [\n { id: \"files_shell\", order: 1, title: \"Files and shell\", owner: \"core\" },\n { id: \"os_control\", order: 2, title: \"Computer control\", owner: \"core\" },\n { id: \"personal_automation\", order: 3, title: \"Personal apps and automation\", owner: \"core\" },\n { id: \"tools_service\", order: 4, title: \"Documents, OCR and entities\", owner: \"python_tools\" },\n { id: \"ml_service\", order: 5, title: \"Speech\", owner: \"python_ml\" },\n { id: \"windows_admin\", order: 6, title: \"Windows administration\", owner: \"core\" },\n];\n\n/**\n * How an agent's call reaches the device. Both end at the relay's `POST /v1/devices/{id}/call`:\n * - `sandbox_proxy`: the cloud-sandbox-shaped tools (fs_*, shell_*). matrx-ai's `_sandbox_proxy`\n * calls aidream `/api/local-proxy/{device}/{fs|search|exec}/…`, which maps the route to its op.\n * Agent code never knows a laptop from a cloud box (SPEC §6.1).\n * - `device_op`: desktop-only capabilities. One generic route, `/api/local-proxy/{device}/op/{cap.op}`,\n * params and result exactly the op's schema; the tool definition is generated from that schema.\n * - `server`: runs on the aidream server even when the turn is bound to a device (a defect when\n * the tool reads a local path; see `note`).\n */\nexport type ToolPath = \"sandbox_proxy\" | \"device_op\" | \"server\";\n\n/** `built`: the ops exist and the tool is registered; `planned`: designed, not built; `broken`: registered but wrong on a device. */\nexport type ToolState = \"built\" | \"planned\" | \"broken\";\n\nexport interface CatalogTool {\n /** The platform registry name (`tool.definition.name`). */\n readonly name: string;\n readonly group: ToolGroupId;\n readonly state: ToolState;\n readonly path: ToolPath;\n /** Ops the tool sends. For `built` tools every one is in OPS (a test enforces it). */\n readonly ops: readonly string[];\n readonly platforms: readonly ToolPlatform[];\n /** One line for the status table. */\n readonly summary: string;\n /** Required for `broken`: what is wrong. */\n readonly note?: string;\n}\n\nconst ALL: readonly ToolPlatform[] = [\"darwin\", \"win32\", \"linux\"];\n\nexport const TOOL_CATALOG: readonly CatalogTool[] = [\n // ── 1. Files and shell (core `fs`, `exec`; the cloud sandbox's agent tools) ──────────────────\n { name: \"fs_read\", group: \"files_shell\", state: \"built\", path: \"sandbox_proxy\", ops: [\"fs.read\"], platforms: ALL, summary: \"Read a file, paged\" },\n { name: \"fs_write\", group: \"files_shell\", state: \"built\", path: \"sandbox_proxy\", ops: [\"fs.read\", \"fs.write\"], platforms: ALL, summary: \"Create or overwrite a file\" },\n { name: \"fs_edit\", group: \"files_shell\", state: \"built\", path: \"sandbox_proxy\", ops: [\"fs.read\", \"fs.patch\"], platforms: ALL, summary: \"Replace one exact string\" },\n { name: \"fs_patch\", group: \"files_shell\", state: \"built\", path: \"sandbox_proxy\", ops: [\"fs.read\", \"fs.patch\"], platforms: ALL, summary: \"Apply several exact edits at once\" },\n { name: \"fs_list\", group: \"files_shell\", state: \"built\", path: \"sandbox_proxy\", ops: [\"fs.list\"], platforms: ALL, summary: \"List a folder\" },\n { name: \"fs_mkdir\", group: \"files_shell\", state: \"built\", path: \"sandbox_proxy\", ops: [\"fs.mkdir\"], platforms: ALL, summary: \"Create a folder\" },\n { name: \"fs_search\", group: \"files_shell\", state: \"built\", path: \"sandbox_proxy\", ops: [\"fs.search_paths\", \"fs.search_content\"], platforms: ALL, summary: \"Find files by name or content\" },\n { name: \"shell_execute\", group: \"files_shell\", state: \"built\", path: \"sandbox_proxy\", ops: [\"exec.run\"], platforms: ALL, summary: \"Run a command; cd carries over\" },\n { name: \"shell_python\", group: \"files_shell\", state: \"built\", path: \"sandbox_proxy\", ops: [\"exec.run\"], platforms: ALL, summary: \"Run a Python script\" },\n { name: \"shell_job\", group: \"files_shell\", state: \"planned\", path: \"device_op\", ops: [\"exec.job.start\", \"exec.job.output\", \"exec.job.stop\"], platforms: ALL, summary: \"Background commands: start, read output, stop\" },\n\n // ── 2. Computer control (TS owners) ──────────────────────────────────────────────────────────\n { name: \"desktop_process\", group: \"os_control\", state: \"planned\", path: \"device_op\", ops: [\"proc.list\", \"proc.ports\", \"proc.kill\", \"proc.launch_app\", \"proc.focus_app\", \"proc.installed_apps\"], platforms: ALL, summary: \"Processes, ports and apps\" },\n { name: \"desktop_system\", group: \"os_control\", state: \"planned\", path: \"device_op\", ops: [\"sysinfo.get\", \"system.open_url\", \"system.open_path\", \"system.notify\"], platforms: ALL, summary: \"System facts, open, notify\" },\n { name: \"desktop_clipboard\", group: \"os_control\", state: \"planned\", path: \"device_op\", ops: [\"clipboard.read\", \"clipboard.write\"], platforms: ALL, summary: \"Read and write the clipboard\" },\n { name: \"desktop_screen\", group: \"os_control\", state: \"planned\", path: \"device_op\", ops: [\"screen.list\", \"screen.capture\"], platforms: ALL, summary: \"Displays and screenshots\" },\n { name: \"desktop_window\", group: \"os_control\", state: \"planned\", path: \"device_op\", ops: [\"window.list\", \"window.focus\", \"window.move\", \"window.minimize\"], platforms: ALL, summary: \"Find, focus and arrange windows\" },\n { name: \"desktop_input\", group: \"os_control\", state: \"planned\", path: \"device_op\", ops: [\"input.type_text\", \"input.hotkey\", \"input.mouse_click\", \"input.mouse_move\"], platforms: ALL, summary: \"Keyboard and mouse\" },\n { name: \"desktop_audio\", group: \"os_control\", state: \"planned\", path: \"device_op\", ops: [\"audio.devices\", \"audio.record\", \"audio.play\"], platforms: ALL, summary: \"Audio devices, record, play\" },\n { name: \"desktop_power\", group: \"os_control\", state: \"planned\", path: \"device_op\", ops: [\"power.status\", \"power.prevent_sleep\"], platforms: ALL, summary: \"Battery and keep awake\" },\n { name: \"desktop_resources\", group: \"os_control\", state: \"planned\", path: \"device_op\", ops: [\"resources.snapshot\", \"resources.top\"], platforms: ALL, summary: \"CPU, memory and disk use\" },\n { name: \"fs_watch\", group: \"os_control\", state: \"planned\", path: \"device_op\", ops: [\"fs.watch\"], platforms: ALL, summary: \"Watch a folder for changes\" },\n\n // ── 3. Personal apps and automation ──────────────────────────────────────────────────────────\n { name: \"desktop_automation\", group: \"personal_automation\", state: \"planned\", path: \"device_op\", ops: [\"automation.script\"], platforms: [\"darwin\", \"win32\"], summary: \"AppleScript on a Mac, PowerShell on Windows\" },\n { name: \"desktop_mail\", group: \"personal_automation\", state: \"planned\", path: \"device_op\", ops: [\"mail.accounts\", \"mail.list\", \"mail.send\"], platforms: [\"darwin\"], summary: \"The Mail app\" },\n { name: \"desktop_messages\", group: \"personal_automation\", state: \"planned\", path: \"device_op\", ops: [\"messages.conversations\", \"messages.list\", \"messages.send\"], platforms: [\"darwin\"], summary: \"The Messages app\" },\n { name: \"desktop_contacts\", group: \"personal_automation\", state: \"planned\", path: \"device_op\", ops: [\"contacts.search\", \"contacts.get\"], platforms: [\"darwin\"], summary: \"Contacts\" },\n { name: \"desktop_calendar\", group: \"personal_automation\", state: \"planned\", path: \"device_op\", ops: [\"calendar.list\", \"calendar.create\", \"reminders.list\", \"reminders.create\"], platforms: [\"darwin\"], summary: \"Calendar and reminders\" },\n { name: \"desktop_photos\", group: \"personal_automation\", state: \"planned\", path: \"device_op\", ops: [\"photos.search\", \"photos.get\"], platforms: [\"darwin\"], summary: \"Photos library\" },\n { name: \"desktop_location\", group: \"personal_automation\", state: \"planned\", path: \"device_op\", ops: [\"location.get\"], platforms: [\"darwin\", \"win32\"], summary: \"Where the computer is\" },\n { name: \"desktop_net\", group: \"personal_automation\", state: \"planned\", path: \"device_op\", ops: [\"net.info\", \"net.wifi\", \"net.bluetooth\", \"net.devices\", \"net.mdns\", \"net.scan\", \"net.download\"], platforms: ALL, summary: \"Local network and downloads\" },\n\n // ── 4. Python `tools` service ────────────────────────────────────────────────────────────────\n { name: \"desktop_documents\", group: \"tools_service\", state: \"planned\", path: \"device_op\", ops: [\"tools.pdf_extract\", \"tools.office_generate\", \"tools.ocr\", \"tools.image_resize\"], platforms: ALL, summary: \"PDF text, Office files, OCR, images\" },\n { name: \"desktop_entities\", group: \"tools_service\", state: \"planned\", path: \"device_op\", ops: [\"tools.ner\", \"tools.pii\"], platforms: ALL, summary: \"Names and private data, found on the device\" },\n\n // ── 5. Python `ml` service ───────────────────────────────────────────────────────────────────\n // Built: models.transcribe through local_proxy's POST /op/{cap.op} (matrx-ai implementations/desktop.py).\n // Whisper detects the language itself, so matrx-local's speech_locales needs no op of its own.\n { name: \"desktop_transcribe\", group: \"ml_service\", state: \"built\", path: \"device_op\", ops: [\"models.transcribe\"], platforms: ALL, summary: \"Speech to text on the device\" },\n\n // ── 6. Windows administration ────────────────────────────────────────────────────────────────\n { name: \"desktop_windows_admin\", group: \"windows_admin\", state: \"planned\", path: \"device_op\", ops: [\"windows.registry_read\", \"windows.registry_write\", \"windows.services\", \"windows.service_control\", \"windows.event_log\", \"windows.features\"], platforms: [\"win32\"], summary: \"Registry, services, event log\" },\n];\n\n/**\n * Tools armed with a device binding that are deliberately NOT device tools, each with its reason.\n * They run on the server; the status table does not track them.\n */\nexport const EXCLUDED_TOOLS: Readonly<Record<string, string>> = {\n git_ingest:\n \"Runs on the server: it ingests repository URLs. A local path on a bound computer or sandbox is refused with the fs_* and shell remedy, since the server cannot see it\",\n};\n\n/** What became of one matrx-local handler. */\nexport type LegacyDisposition =\n | { readonly kind: \"tool\"; readonly tool: string }\n | { readonly kind: \"dropped\"; readonly reason: string };\n\nconst tool = (name: string): LegacyDisposition => ({ kind: \"tool\", tool: name });\nconst dropped = (reason: string): LegacyDisposition => ({ kind: \"dropped\", reason });\n\nconst SHELL_COVERS = \"Done with shell_execute (mv, cp, rm, tar), as every coding agent does\";\nconst CLOUD_SCRAPER = \"The cloud scraper and research tools run with this computer as their network (the `proxy` capability)\";\n\n/** matrx-local's 120 actions (`app/tools/actions.py` ACTION_GROUPS), keyed `<mega tool>.<action>`. */\nexport const LEGACY_ACTIONS: Readonly<Record<string, LegacyDisposition>> = {\n \"local_file.read\": tool(\"fs_read\"),\n \"local_file.write\": tool(\"fs_write\"),\n \"local_file.edit\": tool(\"fs_edit\"),\n \"local_file.move\": dropped(SHELL_COVERS),\n \"local_file.copy\": dropped(SHELL_COVERS),\n \"local_file.delete\": dropped(SHELL_COVERS),\n \"local_file.rename\": dropped(SHELL_COVERS),\n \"local_file.mkdir\": tool(\"fs_mkdir\"),\n \"local_file.glob\": tool(\"fs_search\"),\n \"local_file.grep\": tool(\"fs_search\"),\n \"local_file.list\": tool(\"fs_list\"),\n \"local_file.places\": dropped(\"The device's home and folders reach the agent in its binding briefing (sysinfo.get)\"),\n \"local_file.find\": tool(\"fs_search\"),\n \"local_file.semantic_find\": dropped(\"Needs a local embedding index; returns with file sync's index, not before\"),\n\n \"local_shell.run\": tool(\"shell_execute\"),\n \"local_shell.output\": tool(\"shell_job\"),\n \"local_shell.stop\": tool(\"shell_job\"),\n\n \"local_window.list\": tool(\"desktop_window\"),\n \"local_window.focus\": tool(\"desktop_window\"),\n \"local_window.move\": tool(\"desktop_window\"),\n \"local_window.minimize\": tool(\"desktop_window\"),\n\n \"local_process.list\": tool(\"desktop_process\"),\n \"local_process.ports\": tool(\"desktop_process\"),\n \"local_process.launch_app\": tool(\"desktop_process\"),\n \"local_process.kill\": tool(\"desktop_process\"),\n \"local_process.focus_app\": tool(\"desktop_process\"),\n \"local_process.terminals\": dropped(\"Matrx 2 terminals are exec sessions; the person's own terminal windows are not the agent's\"),\n \"local_process.tail_terminal\": dropped(\"Matrx 2 terminals are exec sessions; the person's own terminal windows are not the agent's\"),\n \"local_process.installed_apps\": tool(\"desktop_process\"),\n\n \"local_input.type_text\": tool(\"desktop_input\"),\n \"local_input.hotkey\": tool(\"desktop_input\"),\n \"local_input.mouse_click\": tool(\"desktop_input\"),\n \"local_input.mouse_move\": tool(\"desktop_input\"),\n\n \"local_audio.devices\": tool(\"desktop_audio\"),\n \"local_audio.record\": tool(\"desktop_audio\"),\n \"local_audio.play\": tool(\"desktop_audio\"),\n \"local_audio.transcribe\": tool(\"desktop_transcribe\"),\n \"local_audio.transcribe_with_speech\": tool(\"desktop_transcribe\"),\n \"local_audio.speech_locales\": tool(\"desktop_transcribe\"),\n\n \"local_clipboard.read\": tool(\"desktop_clipboard\"),\n \"local_clipboard.write\": tool(\"desktop_clipboard\"),\n\n \"local_screen.screenshot\": tool(\"desktop_screen\"),\n \"local_screen.list\": tool(\"desktop_screen\"),\n \"local_screen.capture_book\": dropped(\"A one-off loop of screenshot plus page turn; the agent composes it from desktop_screen and desktop_input\"),\n\n \"local_system.info\": tool(\"desktop_system\"),\n \"local_system.open_url\": tool(\"desktop_system\"),\n \"local_system.open_path\": tool(\"desktop_system\"),\n \"local_system.notify\": tool(\"desktop_system\"),\n\n \"local_browser.navigate\": dropped(\"The browser agent is the extension (matrx-extend) and the cloud browser; a second Playwright on the device duplicates it\"),\n \"local_browser.click\": dropped(\"The browser agent is the extension (matrx-extend) and the cloud browser\"),\n \"local_browser.type_text\": dropped(\"The browser agent is the extension (matrx-extend) and the cloud browser\"),\n \"local_browser.extract\": dropped(\"The browser agent is the extension (matrx-extend) and the cloud browser\"),\n \"local_browser.screenshot\": dropped(\"The browser agent is the extension (matrx-extend) and the cloud browser\"),\n \"local_browser.eval\": dropped(\"The browser agent is the extension (matrx-extend) and the cloud browser\"),\n \"local_browser.tabs\": dropped(\"The browser agent is the extension (matrx-extend) and the cloud browser\"),\n \"local_browser.close\": dropped(\"The browser agent is the extension (matrx-extend) and the cloud browser\"),\n\n \"local_web.fetch\": dropped(CLOUD_SCRAPER),\n \"local_web.fetch_with_browser\": dropped(CLOUD_SCRAPER),\n \"local_web.scrape\": dropped(CLOUD_SCRAPER),\n \"local_web.search\": dropped(CLOUD_SCRAPER),\n \"local_web.research\": dropped(CLOUD_SCRAPER),\n \"local_web.download\": tool(\"desktop_net\"),\n \"local_web.upload\": dropped(\"Uploads are cloud files (matrx-files) and file sync, one upload path\"),\n\n \"local_net.info\": tool(\"desktop_net\"),\n \"local_net.scan\": tool(\"desktop_net\"),\n \"local_net.port_scan\": tool(\"desktop_net\"),\n \"local_net.mdns_discover\": tool(\"desktop_net\"),\n \"local_net.wifi_networks\": tool(\"desktop_net\"),\n \"local_net.bluetooth_devices\": tool(\"desktop_net\"),\n \"local_net.connected_devices\": tool(\"desktop_net\"),\n\n \"local_monitor.resources\": tool(\"desktop_resources\"),\n \"local_monitor.battery\": tool(\"desktop_power\"),\n \"local_monitor.disk_usage\": tool(\"desktop_resources\"),\n \"local_monitor.top_processes\": tool(\"desktop_resources\"),\n \"local_monitor.watch_directory\": tool(\"fs_watch\"),\n \"local_monitor.watch_events\": tool(\"fs_watch\"),\n \"local_monitor.stop_watch\": tool(\"fs_watch\"),\n \"local_monitor.heartbeat\": dropped(\"The relay's device status replaces the heartbeat\"),\n\n \"local_schedule.create\": dropped(\"One scheduler: the platform's runs the agent on time and reaches the device through the relay\"),\n \"local_schedule.list\": dropped(\"One scheduler: the platform's runs the agent on time and reaches the device through the relay\"),\n \"local_schedule.cancel\": dropped(\"One scheduler: the platform's runs the agent on time and reaches the device through the relay\"),\n \"local_schedule.prevent_sleep\": tool(\"desktop_power\"),\n\n \"local_documents.list\": dropped(\"matrx-local's private document store is gone; documents are files (fs_*) or cloud Knowledge\"),\n \"local_documents.folders\": dropped(\"matrx-local's private document store is gone; documents are files (fs_*) or cloud Knowledge\"),\n \"local_documents.read\": dropped(\"matrx-local's private document store is gone; documents are files (fs_*) or cloud Knowledge\"),\n \"local_documents.write\": dropped(\"matrx-local's private document store is gone; documents are files (fs_*) or cloud Knowledge\"),\n \"local_documents.search\": dropped(\"matrx-local's private document store is gone; documents are files (fs_*) or cloud Knowledge\"),\n\n \"local_media.ocr\": tool(\"desktop_documents\"),\n \"local_media.resize\": tool(\"desktop_documents\"),\n \"local_media.pdf_extract\": tool(\"desktop_documents\"),\n \"local_media.office_generate\": tool(\"desktop_documents\"),\n \"local_media.archive_create\": dropped(SHELL_COVERS),\n \"local_media.archive_extract\": dropped(SHELL_COVERS),\n\n \"local_ner.entities\": tool(\"desktop_entities\"),\n \"local_ner.pii\": tool(\"desktop_entities\"),\n\n \"local_mac_apps.applescript\": tool(\"desktop_automation\"),\n \"local_mac_apps.list_emails\": tool(\"desktop_mail\"),\n \"local_mac_apps.send_email\": tool(\"desktop_mail\"),\n \"local_mac_apps.email_accounts\": tool(\"desktop_mail\"),\n \"local_mac_apps.list_messages\": tool(\"desktop_messages\"),\n \"local_mac_apps.list_conversations\": tool(\"desktop_messages\"),\n \"local_mac_apps.send_message\": tool(\"desktop_messages\"),\n \"local_mac_apps.search_contacts\": tool(\"desktop_contacts\"),\n \"local_mac_apps.get_contact\": tool(\"desktop_contacts\"),\n \"local_mac_apps.list_events\": tool(\"desktop_calendar\"),\n \"local_mac_apps.create_event\": tool(\"desktop_calendar\"),\n \"local_mac_apps.list_reminders\": tool(\"desktop_calendar\"),\n \"local_mac_apps.create_reminder\": tool(\"desktop_calendar\"),\n \"local_mac_apps.search_photos\": tool(\"desktop_photos\"),\n \"local_mac_apps.get_photo\": tool(\"desktop_photos\"),\n \"local_mac_apps.location\": tool(\"desktop_location\"),\n\n \"local_windows_ps.run\": tool(\"desktop_automation\"),\n \"local_windows_ps.get_env\": dropped(\"Read with shell_execute; a per-command env rides exec.run\"),\n \"local_windows_ps.set_env\": dropped(\"Changing the person's persistent environment is not an agent tool\"),\n \"local_windows_ps.registry_read\": tool(\"desktop_windows_admin\"),\n \"local_windows_ps.registry_write\": tool(\"desktop_windows_admin\"),\n \"local_windows_ps.service_list\": tool(\"desktop_windows_admin\"),\n \"local_windows_ps.service_control\": tool(\"desktop_windows_admin\"),\n \"local_windows_ps.event_log\": tool(\"desktop_windows_admin\"),\n \"local_windows_ps.windows_features\": tool(\"desktop_windows_admin\"),\n};\n\n/**\n * matrx-local's 19 action-enum dispatchers. Each fanned an `action` out to the handlers above and\n * did nothing else; they retire with the `matrx-local` executor binding (the platform reaches a\n * device through the relay now, never by client delegation).\n */\nexport const LEGACY_DISPATCHERS: readonly string[] = [\n \"local_file\",\n \"local_shell\",\n \"local_window\",\n \"local_process\",\n \"local_input\",\n \"local_audio\",\n \"local_clipboard\",\n \"local_screen\",\n \"local_system\",\n \"local_browser\",\n \"local_web\",\n \"local_net\",\n \"local_monitor\",\n \"local_schedule\",\n \"local_documents\",\n \"local_media\",\n \"local_ner\",\n \"local_mac_apps\",\n \"local_windows_ps\",\n];\n\n/** Built tools' ops, typed: a built tool naming an op the protocol does not have fails to compile in the test. */\nexport function builtOps(): OpName[] {\n return TOOL_CATALOG.filter((t) => t.state === \"built\").flatMap((t) => t.ops as OpName[]);\n}\n","/**\n * The generated tool status table (SPEC §10): tool × level × platform, built ONLY from harness\n * results (`ToolResultsFile`) joined with the catalog. Never written by hand; the one status anyone\n * cites. `renderToolStatusMarkdown` is the committed text form; screens render `ToolStatus` itself.\n */\nimport { ToolResultsFile, type ToolLevel, type ToolLevelResult, type ToolPlatform, type ToolTransport } from \"../schema/tools\";\nimport { EXCLUDED_TOOLS, TOOL_CATALOG, TOOL_GROUPS, type CatalogTool, type ToolGroupId, type ToolState } from \"./catalog\";\n\nexport const TOOL_LEVELS: readonly ToolLevel[] = [\"programmatic\", \"protocol\", \"chat\"];\nexport const TOOL_PLATFORMS: readonly ToolPlatform[] = [\"darwin\", \"win32\", \"linux\"];\n\n/**\n * `pass`: every required proof passed and none failed. `partial`: passes so far, a required proof\n * missing (`missing` says which). `fail`: the latest run of some proof failed. `untested`: nothing\n * ran. `not_built`: the tool is planned. `unsupported`: the tool does not exist on this platform.\n */\nexport type CellState = \"pass\" | \"partial\" | \"fail\" | \"untested\" | \"not_built\" | \"unsupported\";\n\nexport interface StatusEvidence {\n readonly suite: string;\n readonly test: string;\n readonly transport: ToolTransport;\n readonly outcome: ToolLevelResult[\"outcome\"];\n readonly remote_network: boolean;\n readonly commit: string;\n readonly run_at_ms: number;\n readonly detail: string;\n}\n\nexport interface StatusCell {\n readonly state: CellState;\n /** Required proofs not yet passed, e.g. \"relay from another network\". */\n readonly missing: readonly string[];\n readonly last_run_at_ms: number | null;\n readonly evidence: readonly StatusEvidence[];\n}\n\nexport interface StatusRow {\n readonly tool: string;\n readonly group: ToolGroupId;\n readonly tool_state: ToolState;\n readonly summary: string;\n readonly note: string | null;\n readonly cells: Readonly<Record<ToolPlatform, Readonly<Record<ToolLevel, StatusCell>>>>;\n /** Working on a platform = all three levels pass there (SPEC §10). */\n readonly working: Readonly<Record<ToolPlatform, boolean>>;\n}\n\nexport interface ToolStatus {\n readonly schema: \"matrx.tool-status.v1\";\n readonly generated_at_ms: number;\n readonly commits: readonly string[];\n readonly rows: readonly StatusRow[];\n readonly totals: Readonly<Record<ToolPlatform, { readonly working: number; readonly built: number; readonly tools: number }>>;\n}\n\n/** What each level needs before it reads `pass`. Level 2 is the transports AND the relay from another network. */\nconst REQUIRED: Readonly<Record<ToolLevel, readonly { readonly label: string; readonly ok: (e: StatusEvidence) => boolean }[]>> = {\n programmatic: [{ label: \"in process\", ok: (e) => e.transport === \"in_process\" }],\n protocol: [\n { label: \"localhost\", ok: (e) => e.transport === \"localhost\" },\n { label: \"relay\", ok: (e) => e.transport === \"relay\" },\n { label: \"relay from another network\", ok: (e) => e.transport === \"relay\" && e.remote_network },\n ],\n chat: [{ label: \"a real agent in a real chat\", ok: (e) => e.transport === \"agent\" }],\n};\n\nfunction cellFor(tool: CatalogTool, platform: ToolPlatform, level: ToolLevel, evidence: StatusEvidence[]): StatusCell {\n if (!tool.platforms.includes(platform)) return { state: \"unsupported\", missing: [], last_run_at_ms: null, evidence: [] };\n // The latest run of each (suite, test, transport, network) decides; older runs are history.\n const latest = new Map<string, StatusEvidence>();\n for (const e of evidence) {\n const key = `${e.suite}\\u0000${e.test}\\u0000${e.transport}\\u0000${e.remote_network}`;\n const prev = latest.get(key);\n if (!prev || prev.run_at_ms < e.run_at_ms) latest.set(key, e);\n }\n const runs = [...latest.values()].filter((e) => e.outcome !== \"skip\").sort((a, b) => b.run_at_ms - a.run_at_ms);\n const last = runs[0]?.run_at_ms ?? null;\n if (tool.state === \"planned\" && runs.length === 0) return { state: \"not_built\", missing: [], last_run_at_ms: null, evidence: [] };\n if (runs.length === 0) return { state: \"untested\", missing: REQUIRED[level].map((r) => r.label), last_run_at_ms: null, evidence: [...latest.values()] };\n if (runs.some((e) => e.outcome === \"fail\")) return { state: \"fail\", missing: [], last_run_at_ms: last, evidence: runs };\n const missing = REQUIRED[level].filter((r) => !runs.some((e) => e.outcome === \"pass\" && r.ok(e))).map((r) => r.label);\n return { state: missing.length === 0 ? \"pass\" : \"partial\", missing, last_run_at_ms: last, evidence: runs };\n}\n\n/** Build the table from every results file. Throws when a file is off-contract (never silently skipped). */\nexport function buildToolStatus(files: readonly unknown[], opts: { readonly generatedAtMs: number }): ToolStatus {\n const parsed = files.map((f, i) => {\n const r = ToolResultsFile.safeParse(f);\n if (!r.success) throw new Error(`tool results file #${i} is off-contract: ${r.error.issues[0]?.path.join(\".\")} ${r.error.issues[0]?.message}`);\n return r.data;\n });\n const known = new Set(TOOL_CATALOG.map((t) => t.name));\n const byKey = new Map<string, StatusEvidence[]>();\n for (const file of parsed) {\n for (const r of file.results) {\n if (!known.has(r.tool)) throw new Error(`a result names ${r.tool}, which is not in the tool catalog`);\n const key = `${r.tool}|${r.platform}|${r.level}`;\n const list = byKey.get(key) ?? [];\n list.push({ suite: r.suite, test: r.test, transport: r.transport, outcome: r.outcome, remote_network: r.remote_network, commit: file.commit, run_at_ms: r.run_at_ms, detail: r.detail });\n byKey.set(key, list);\n }\n }\n const groupOrder = new Map(TOOL_GROUPS.map((g) => [g.id, g.order]));\n const tools = [...TOOL_CATALOG].sort((a, b) => (groupOrder.get(a.group) ?? 99) - (groupOrder.get(b.group) ?? 99));\n const rows: StatusRow[] = tools.map((tool) => {\n const cells = {} as Record<ToolPlatform, Record<ToolLevel, StatusCell>>;\n const working = {} as Record<ToolPlatform, boolean>;\n for (const platform of TOOL_PLATFORMS) {\n const perLevel = {} as Record<ToolLevel, StatusCell>;\n for (const level of TOOL_LEVELS) perLevel[level] = cellFor(tool, platform, level, byKey.get(`${tool.name}|${platform}|${level}`) ?? []);\n cells[platform] = perLevel;\n working[platform] = TOOL_LEVELS.every((l) => perLevel[l].state === \"pass\");\n }\n return { tool: tool.name, group: tool.group, tool_state: tool.state, summary: tool.summary, note: tool.note ?? null, cells, working };\n });\n const totals = {} as Record<ToolPlatform, { working: number; built: number; tools: number }>;\n for (const platform of TOOL_PLATFORMS) {\n const onPlatform = TOOL_CATALOG.filter((t) => t.platforms.includes(platform));\n totals[platform] = {\n working: rows.filter((r) => r.working[platform]).length,\n built: onPlatform.filter((t) => t.state !== \"planned\").length,\n tools: onPlatform.length,\n };\n }\n const commits = [...new Set(parsed.map((f) => f.commit))].sort();\n return { schema: \"matrx.tool-status.v1\", generated_at_ms: opts.generatedAtMs, commits, rows, totals };\n}\n\nconst MARK: Readonly<Record<CellState, string>> = { pass: \"✓\", partial: \"◐\", fail: \"✗\", untested: \"·\", not_built: \"—\", unsupported: \" \" };\n\n/** The committed text form. Columns: per platform, the three levels (P = programmatic, R = protocol, C = chat). */\nexport function renderToolStatusMarkdown(status: ToolStatus): string {\n const lines: string[] = [\n \"<!-- GENERATED by `pnpm tools:status` from test results. Never edit by hand. -->\",\n \"# Local tools: status\",\n \"\",\n `Generated ${new Date(status.generated_at_ms).toISOString()} from commits ${status.commits.join(\", \") || \"none\"}.`,\n \"\",\n \"✓ pass · ◐ passing so far, a required proof missing · ✗ fail · `·` untested · — not built. Levels: P programmatic, R protocol, C chat.\",\n \"\",\n \"| Platform | Working | Built | Tools |\",\n \"|---|---|---|---|\",\n ...TOOL_PLATFORMS.map((p) => `| ${p} | ${status.totals[p].working} | ${status.totals[p].built} | ${status.totals[p].tools} |`),\n \"\",\n ];\n for (const group of TOOL_GROUPS) {\n const rows = status.rows.filter((r) => r.group === group.id);\n if (rows.length === 0) continue;\n lines.push(`## ${group.order}. ${group.title}`, \"\", \"| Tool | darwin P R C | win32 P R C | linux P R C | Missing |\", \"|---|---|---|---|---|\");\n for (const r of rows) {\n const cols = TOOL_PLATFORMS.map((p) => TOOL_LEVELS.map((l) => MARK[r.cells[p][l].state]).join(\" \"));\n const missing = new Set<string>();\n for (const p of TOOL_PLATFORMS) for (const l of TOOL_LEVELS) for (const m of r.cells[p][l].missing) if (r.cells[p][l].state !== \"untested\") missing.add(`${p} ${l}: ${m}`);\n const name = r.tool_state === \"broken\" ? `${r.tool} (broken: ${r.note ?? \"\"})` : r.tool;\n lines.push(`| ${name} | ${cols.join(\" | \")} | ${[...missing].join(\"; \")} |`);\n }\n lines.push(\"\");\n }\n const excluded = Object.entries(EXCLUDED_TOOLS);\n if (excluded.length > 0) {\n lines.push(\"## Not device tools\", \"\", \"| Tool | Why |\", \"|---|---|\", ...excluded.map(([name, why]) => `| ${name} | ${why} |`), \"\");\n }\n return lines.join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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AAE,MAAM,CAAC,EAAE,CAAC,EAAE,QAAS,KAAI,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,UAAU,WAAY,SAAQ,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;AACzK,YAAM,OAAO,EAAE,eAAe,WAAW,GAAG,EAAE,IAAI,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE;AACnF,YAAM,KAAK,KAAK,IAAI,MAAMA,MAAK,KAAK,KAAK,CAAC,MAAM,CAAC,GAAG,OAAO,EAAE,KAAK,IAAI,CAAC,IAAI;AAAA,IAC7E;AACA,UAAM,KAAK,EAAE;AAAA,EACf;AACA,QAAM,WAAW,OAAO,QAAQ,cAAc;AAC9C,MAAI,SAAS,SAAS,GAAG;AACvB,UAAM,KAAK,uBAAuB,IAAI,kBAAkB,aAAa,GAAG,SAAS,IAAI,CAAC,CAAC,MAAM,GAAG,MAAM,KAAK,IAAI,MAAM,GAAG,IAAI,GAAG,EAAE;AAAA,EACnI;AACA,SAAO,MAAM,KAAK,IAAI;AACxB;","names":["import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","tool","rows","cols"]}