sessionpipe-core 0.12.0 → 0.13.1

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.
Files changed (39) hide show
  1. package/dist/control.js +26 -11
  2. package/dist/control.js.map +3 -3
  3. package/dist/index.js +550 -175
  4. package/dist/index.js.map +4 -4
  5. package/dist/schema/v1.d.ts +87 -1
  6. package/dist/schema/v1.d.ts.map +1 -1
  7. package/dist/schema.js +86 -11
  8. package/dist/schema.js.map +2 -2
  9. package/dist/service.js +1 -1
  10. package/dist/src/adapters/acp-control.d.ts.map +1 -1
  11. package/dist/src/adapters/antigravity.d.ts.map +1 -1
  12. package/dist/src/adapters/claude-code-control.d.ts +136 -6
  13. package/dist/src/adapters/claude-code-control.d.ts.map +1 -1
  14. package/dist/src/adapters/claude-code.d.ts.map +1 -1
  15. package/dist/src/adapters/claude-shaped.d.ts +10 -0
  16. package/dist/src/adapters/claude-shaped.d.ts.map +1 -1
  17. package/dist/src/adapters/codex.d.ts.map +1 -1
  18. package/dist/src/adapters/devin.d.ts +1 -1
  19. package/dist/src/adapters/devin.d.ts.map +1 -1
  20. package/dist/src/adapters/headless.d.ts +3 -1
  21. package/dist/src/adapters/headless.d.ts.map +1 -1
  22. package/dist/src/adapters/types.d.ts +8 -1
  23. package/dist/src/adapters/types.d.ts.map +1 -1
  24. package/dist/src/config.d.ts +15 -1
  25. package/dist/src/config.d.ts.map +1 -1
  26. package/dist/src/control/verify.d.ts +3 -0
  27. package/dist/src/control/verify.d.ts.map +1 -1
  28. package/dist/src/index.d.ts +4 -4
  29. package/dist/src/index.d.ts.map +1 -1
  30. package/dist/src/launched-by.d.ts +20 -3
  31. package/dist/src/launched-by.d.ts.map +1 -1
  32. package/dist/src/outbox.d.ts +35 -2
  33. package/dist/src/outbox.d.ts.map +1 -1
  34. package/dist/src/privacy/filter.d.ts.map +1 -1
  35. package/dist/src/privacy/pii.d.ts.map +1 -1
  36. package/dist/src/readers/transcripts.d.ts +11 -1
  37. package/dist/src/readers/transcripts.d.ts.map +1 -1
  38. package/dist/version.js +1 -1
  39. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../schema/v1.ts"],
4
- "sourcesContent": ["// SPDX-License-Identifier: Apache-2.0\n// The one source for the protocol's shapes. schemas/v1/*.json are GENERATED from\n// this file (`npm run schemas`); core's runtime types are inferred from it with\n// type-only imports, so zod never enters the zero-dependency bundle. Prose lives in\n// spec/PROTOCOL.md; a rule that is not encoded here is a MUST in words only.\nimport { z } from \"zod\";\n\nexport const PROTOCOL = 1;\n\n/** Dotted, lowercase. Unknown types MUST be accepted and stored. */\nexport const EventType = z\n .string()\n .regex(/^(?:native|[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+)$/, \"dotted lowercase type, or native\");\n\nexport const KNOWN_TYPES = [\n \"session.started\",\n \"session.heartbeat\",\n \"session.ended\",\n \"session.backfill\",\n \"session.forgotten\",\n \"turn.started\",\n \"turn.ended\",\n \"turn.transcript\",\n \"turn.progress\",\n \"tool.started\",\n \"tool.ended\",\n \"files.changed\",\n \"attention.needed\",\n \"attention.cleared\",\n \"subagent.started\",\n \"subagent.ended\",\n \"context.compacted\",\n \"limits.observed\",\n \"native\",\n] as const;\n\n/** The lowest tier that carries each known type. */\nexport const TYPE_TIER: Record<(typeof KNOWN_TYPES)[number], 0 | 1 | 2 | 3> = {\n \"session.started\": 0,\n \"session.heartbeat\": 0,\n \"session.ended\": 0,\n \"session.backfill\": 0,\n \"session.forgotten\": 0,\n \"turn.started\": 0,\n \"turn.ended\": 0,\n \"turn.transcript\": 2,\n \"turn.progress\": 2,\n \"tool.started\": 1,\n \"tool.ended\": 1,\n \"files.changed\": 1,\n \"attention.needed\": 0,\n \"attention.cleared\": 0,\n \"subagent.started\": 1,\n \"subagent.ended\": 1,\n \"context.compacted\": 1,\n \"limits.observed\": 1,\n native: 3,\n};\n\nexport const HARNESS_NAMES = [\n \"claude-code\",\n \"codex\",\n \"gemini-cli\",\n \"antigravity\",\n \"devin\",\n \"cursor\",\n \"copilot-cli\",\n \"droid\",\n \"kiro\",\n \"opencode\",\n] as const;\n\nexport const Tier = z.int().min(0).max(3);\nexport const Ulid = z.string().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/, \"ULID\");\nexport const Rfc3339 = z.iso.datetime({ offset: false, precision: 3 });\nexport const SessionId = z\n .string()\n .min(1)\n .max(128)\n .regex(/^[A-Za-z0-9._:-]+$/);\nexport const ToolName = z.string().regex(/^[A-Za-z0-9_.:-]{1,120}$/);\n\nexport const Harness = z.object({\n /** From the registry in ADAPTERS.md; a name outside it is allowed ([a-z0-9-]). */\n name: z.string().regex(/^[a-z][a-z0-9-]{0,39}$/),\n version: z.string().max(64).optional(),\n /** The harness's own event name (`PostToolUse`, `agentStop`). */\n event: z.string().max(64).optional(),\n});\n\nexport const Session = z.object({\n id: SessionId,\n /** Monotonic per session per sender; the dedup key with harness.name and id. */\n seq: z.int().min(0),\n machine: z.string().max(80).optional(),\n /** Home is written `~`. */\n cwd: z.string().max(1024).optional(),\n /** A remote URL with credentials stripped. */\n repo: z.string().max(512).optional(),\n branch: z.string().max(256).optional(),\n model: z.string().max(128).optional(),\n title: z.string().max(200).optional(),\n title_source: z.enum([\"custom\", \"harness\", \"first-ask\"]).optional(),\n url: z.url().max(1024).optional(),\n /** An id, never an email. */\n account_id: z.string().max(128).optional(),\n /** Whether a person attends the session, in the harness's own word. Absent = unknown, never false. */\n attended: z.boolean().optional(),\n parent_id: SessionId.nullable().optional(),\n /** `<harness>:<id>` of the session that started this one on purpose (a script running\n * `claude -p` for it), from the launcher's environment. Absent for a subagent, whose\n * launcher is its parent, and when nothing says. */\n launched_by: z\n .string()\n .regex(/^[a-z][a-z0-9-]{0,39}:[A-Za-z0-9._:-]{1,128}$/)\n .optional(),\n});\n\nexport const Privacy = z.object({\n /** The redaction rulesets that ran; `secrets@1` always above tier 0. */\n rulesets: z.array(z.string().regex(/^[a-z][a-z0-9-]*@\\d+$/)),\n pii: z.boolean(),\n});\n\nexport const Event = z.object({\n protocol: z.literal(PROTOCOL),\n id: Ulid,\n type: EventType,\n time: Rfc3339,\n tier: Tier,\n harness: Harness,\n session: Session,\n privacy: Privacy,\n /** Per type (see EventData); extra keys allowed and kept. */\n data: z.record(z.string(), z.unknown()),\n});\n\n// --- data per type --------------------------------------------------------------\n\nconst Loose = z.object({}).loose();\nexport const AttentionKind = z.enum([\"permission\", \"question\", \"elicitation\", \"idle\", \"error\"]);\n\n/** One usage window of an account: `id` is the harness's own name for it (`five_hour`,\n * `seven_day`, `primary` \u2026); `used_percent` passes 100 once a spend limit is exceeded. */\nexport const LimitWindow = Loose.extend({\n id: z.string().regex(/^[a-z0-9_]{1,64}$/),\n used_percent: z.number().min(0),\n resets_at: Rfc3339.optional(),\n window_minutes: z.int().min(1).optional(),\n});\n\nexport const EventData = z.object({\n \"session.started\": Loose.extend({ source: z.enum([\"startup\", \"resume\", \"clear\", \"compact\", \"fork\", \"unknown\"]) }),\n \"session.heartbeat\": Loose,\n \"session.ended\": Loose.extend({ reason: z.enum([\"clear\", \"logout\", \"exit\", \"other\"]) }),\n \"session.backfill\": Loose.extend({ started_at: Rfc3339, last_at: Rfc3339, turns: z.int().min(0).optional() }),\n \"session.forgotten\": Loose,\n \"turn.started\": Loose.extend({\n turn_id: z.string().max(128).optional(),\n prompt_chars: z.int().min(0).optional(),\n /** The harness's OWN word for who submitted the prompt, forwarded verbatim; not an enum\n * of this spec (Claude Code: user, sdk, system, loop_wakeup, schedule_wakeup,\n * poll_event), and a different vocabulary from session.started.source. A bare word:\n * tier 0 is not redacted, so the shape is the only guard. */\n submitted_by: z\n .string()\n .regex(/^[A-Za-z0-9][A-Za-z0-9_.-]{0,39}$/, \"a bare word, at most 40 characters\")\n .optional(),\n /** True when the prompt text is a block the harness wrote rather than words a person\n * typed; never a claim that no person caused the turn. */\n injected: z.boolean().optional(),\n }),\n \"turn.ended\": Loose.extend({\n turn_id: z.string().max(128).optional(),\n reason: z.enum([\"stop\", \"interrupt\", \"error\"]),\n /** The harness's error class when reason is error (rate_limit, overloaded, authentication_failed, server_error \u2026). */\n error: z.string().max(200).optional(),\n ms: z.int().min(0).optional(),\n /** Background work the harness reports still in flight as the turn ends, each of which wakes the session when it finishes (Claude Code: shell commands, monitors, subagents, workflows). Absent when the harness doesn't say. */\n background: z.int().min(0).optional(),\n }),\n \"turn.transcript\": Loose.extend({\n turn: z.int().min(0),\n user: z.string().max(20_000),\n assistant: z.string().max(20_000),\n at: Rfc3339,\n }),\n /** The turn still running: its prompt and what the assistant has said so far. A\n * later turn.progress for the same turn replaces it; the turn.transcript with the\n * same number supersedes it. Over 20 000 chars, the assistant side keeps its END. */\n \"turn.progress\": Loose.extend({\n turn: z.int().min(0),\n user: z.string().max(20_000),\n assistant: z.string().max(20_000),\n at: Rfc3339,\n }),\n \"tool.started\": Loose.extend({\n tool: ToolName,\n call_id: z.string().max(128).optional(),\n turn_id: z.string().max(128).optional(),\n /** Set when a subagent made the call. */\n agent_id: z.string().max(128).optional(),\n input: z.unknown().optional(),\n }),\n \"tool.ended\": Loose.extend({\n tool: ToolName,\n call_id: z.string().max(128).optional(),\n turn_id: z.string().max(128).optional(),\n agent_id: z.string().max(128).optional(),\n ms: z.int().min(0).optional(),\n ok: z.boolean(),\n error: z.string().max(2000).optional(),\n input: z.unknown().optional(),\n output: z.unknown().optional(),\n }),\n \"files.changed\": Loose.extend({ paths: z.array(z.string().max(1024)).max(500) }),\n \"attention.needed\": Loose.extend({\n attention_id: z.string().max(128),\n kind: AttentionKind,\n tool: ToolName.optional(),\n message: z.string().max(200).optional(),\n }),\n \"attention.cleared\": Loose.extend({\n attention_id: z.string().max(128),\n how: z.enum([\"answered\", \"cancelled\", \"timeout\", \"unknown\"]),\n }),\n \"subagent.started\": Loose.extend({ agent_id: z.string().max(128), agent_type: z.string().max(128).optional() }),\n \"subagent.ended\": Loose.extend({\n agent_id: z.string().max(128),\n agent_type: z.string().max(128).optional(),\n /** Background work still in flight once this subagent is out of it, counted as `turn.ended.background` is. Absent when the harness doesn't say. */\n background: z.int().min(0).optional(),\n }),\n \"context.compacted\": Loose.extend({ trigger: z.enum([\"manual\", \"auto\"]) }),\n /** The account's usage limits as the harness last reported them: one per window. */\n \"limits.observed\": Loose.extend({\n windows: z.array(LimitWindow).min(1).max(8),\n plan: z.string().max(64).optional(),\n /** The account the numbers belong to, as `session.account_id` spells it, when the\n * session was served by another account than its own (the pool, CONTROL.md \u00A72). */\n account_id: z.string().max(128).optional(),\n }),\n native: Loose,\n});\n\n// --- wire -----------------------------------------------------------------------\n\nexport const Batch = z.object({ events: z.array(Event).min(1).max(50) });\n\nexport const BatchResponse = z.object({\n accepted: z.int().min(0),\n duplicates: z.int().min(0),\n rejected: z.array(z.object({ id: Ulid, reason: z.string().max(200) })),\n max_tier: Tier,\n});\n\nexport const ErrorResponse = z.object({\n reason: z.string().max(200),\n supported: z.array(z.int()).optional(),\n max_tier: Tier.optional(),\n});\n\nexport const Capability = z.enum([\"events\", \"backfill\", \"forget\", \"control\", \"native\"]);\n\n// --- control (CONTROL.md) ---------------------------------------------------------\n\nconst B64Url = z.string().regex(/^[A-Za-z0-9_-]*$/, \"base64url, no padding\");\nexport const MachineId = z.string().regex(/^m_[A-Za-z0-9_-]{16,40}$/, \"m_ + 16\u201340 base64url\");\n/** `<harness>:<id>`; the id follows its adapter's rule (Claude Code: a UUID). */\nexport const SessionRef = z.string().regex(/^[a-z][a-z0-9-]{0,39}:[A-Za-z0-9._:-]{1,128}$/, \"<harness>:<session id>\");\nexport const ControlKind = z.enum([\"prompt\", \"permission.answer\", \"cancel\", \"start\", \"key.add\", \"pool\"]);\n/** What a `pool` command asks of the machine's account pool (CONTROL.md \u00A76 `pool`). */\nexport const PoolAction = z.enum([\n \"on\",\n \"off\",\n \"enable\",\n \"disable\",\n \"remove\",\n \"order\",\n \"refresh\",\n \"login.begin\",\n \"login.complete\",\n]);\n/** A pooled account's id: what `session.account_id` and `limits.observed.account_id`\n * carry for it (Claude Code: the account UUID), or a pending sign-in's id. */\nexport const PoolAccountId = z.string().regex(/^[A-Za-z0-9._:-]{1,128}$/, \"an account id\");\n/** The kinds of key a machine or a receiver handles (CONTROL.md \u00A72). Absent: passkeys only. */\nexport const KeyTypes = z\n .array(z.enum([\"passkey\", \"device\"]))\n .min(1)\n .max(2);\nexport const DeliveryMode = z.enum([\"sdk\", \"waiter\", \"turn\", \"api\", \"resume\", \"fork\"]);\n/** How much a started session may do without anyone approving it (CONTROL.md \u00A73.1),\n * narrowest first. Closed: nothing is wider than `auto`. */\nexport const StartPermission = z.enum([\"read\", \"safe\", \"edits\", \"auto\"]);\n/** What a start ran with, or gets by default: a level, or `inherit` (no permission flag,\n * the harness's own default) on a machine the person put in inherit mode. Never a\n * command's `permission`. */\nexport const RunLevel = z.enum([\"read\", \"safe\", \"edits\", \"auto\", \"inherit\"]);\n/** A model id as the harness names it, passed as one argument: never a leading dash. */\nexport const ModelId = z\n .string()\n .min(1)\n .max(100)\n .regex(/^[A-Za-z0-9][A-Za-z0-9._:/@[\\]-]*$/, \"a model id\");\nconst HarnessName = z.string().regex(/^[a-z][a-z0-9-]{0,39}$/);\n\n/** A file attached to a `start` (CONTROL.md \u00A73.1). The bytes wait on the receiver\n * (`GET {control}/files/{sha256}`); the signed hash is what the machine checks.\n * Beyond this shape the verifier also checks: the name's length after NFC, names\n * unique case-insensitively, and the sizes adding up to at most 50 MiB. */\nexport const ControlFile = z.object({\n /** Written as is (NFC) into the session's folder: no slash, backslash or control\n * character, not starting with a dot. */\n name: z\n .string()\n .min(1)\n .max(200)\n .regex(\n // biome-ignore lint/suspicious/noControlCharactersInRegex: control characters are what it rejects\n /^[^./\\\\\\x00-\\x1f\\x7f][^/\\\\\\x00-\\x1f\\x7f]*$/,\n \"a file name: no slash, backslash, control character or leading dot\",\n ),\n /** Media type, `type/subtype` (case-insensitive). */\n type: z\n .string()\n .min(1)\n .max(100)\n .regex(/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]*\\/[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]*$/, \"type/subtype\"),\n /** Bytes: 1 to 25 MiB. */\n size: z.int().min(1).max(26_214_400),\n /** SHA-256 of the bytes, base64url without padding. */\n sha256: z.string().regex(/^[A-Za-z0-9_-]{43}$/, \"43 base64url characters\"),\n});\n\n/** The signed command, as the device writes it. The machine verifies the EXACT string\n * it received (control.json `cmd`) and never re-serializes it. */\nexport const ControlCommand = z.object({\n v: z.literal(1),\n t: z.literal(\"sessionpipe.control\"),\n machine: MachineId,\n kind: ControlKind,\n session: SessionRef,\n /** prompt, start: the message for the model. */\n text: z.string().min(1).max(20_000).optional(),\n /** permission.answer: the attention_id being answered. */\n for: z.string().min(1).max(128).optional(),\n decision: z.enum([\"allow\", \"deny\"]).optional(),\n /** Shown to the model beside a decision. */\n note: z.string().max(2000).optional(),\n /** start: the folder the new session runs in: absolute, or `~` / `~/\u2026` under the\n * home of the user the machine's daemon runs as, as events write it. */\n cwd: z.string().max(1024).optional(),\n /** key.add (session `sessionpipe:keys`): the new device's key (a passkey or a device\n * key, control-key.json), which the machine trusts once a key it already trusts\n * signed this command. */\n key: z.lazy(() => ControlKey).optional(),\n /** key.add: what the person calls the device. */\n name: z.string().min(1).max(80).optional(),\n /** start, prompt: 1\u201310 files, together at most 50 MiB, downloaded and checked by hash\n * before the session starts or the message is delivered. On a prompt, only to a\n * machine whose hello says `prompt_files`. */\n files: z.array(ControlFile).min(1).max(10).optional(),\n /** start only: the level the new session runs at, at most the machine's mode. Send\n * it only to a machine whose hello advertises it for the harness (`start`). */\n permission: StartPermission.optional(),\n /** start only: the model the harness runs. As `permission`: only when advertised. */\n model: ModelId.optional(),\n /** pool (session `sessionpipe:pool`): what to do with the machine's account pool.\n * Each action takes exactly the fields CONTROL.md \u00A76 `pool` lists for it. */\n pool_action: PoolAction.optional(),\n /** enable, disable, remove, login.complete (the pending sign-in's id); refresh MAY. */\n pool_account: PoolAccountId.optional(),\n /** order: every account of the pool, once each, in the order wanted. */\n pool_order: z.array(PoolAccountId).min(1).max(20).meta({ uniqueItems: true }).optional(),\n /** login.complete: what the person pasted back from the sign-in page (`code#state`). */\n pool_code: z\n .string()\n .min(1)\n .max(512)\n .regex(/^[^\\r\\n]+$/, \"one line\")\n .optional(),\n /** At least 16 random bytes, base64url. */\n nonce: z.string().regex(/^[A-Za-z0-9_-]{22,64}$/),\n /** Epoch ms, the signing device's clock. */\n iat: z.int().min(1),\n});\n\n/** A day grant's signed string: a passkey vouches for a device key for \u2264 24 h. */\nexport const ControlGrant = z.object({\n v: z.literal(1),\n t: z.literal(\"sessionpipe.grant\"),\n /** The day key: P-256 SPKI, base64url. */\n pub: B64Url.min(1),\n iat: z.int().min(1),\n exp: z.int().min(1),\n /** The receiver's WebAuthn rp id (well-known control.signing.rp_id). */\n rp: z.string().min(1).max(253),\n});\n\n/** A WebAuthn assertion: credential id, authenticatorData, clientDataJSON, signature. */\nexport const ControlAssertion = z.object({\n cred: B64Url.min(1),\n ad: B64Url.min(1),\n cd: B64Url.min(1),\n sig: B64Url.min(1),\n});\n\n/** A device key's signature (CONTROL.md \u00A73.2): its id and 64 bytes r\u2016s over\n * `sessionpipe.device.v1\u23CE<purpose>\u23CE<rp id>\u23CE<challenge>`. Nothing else. The shape\n * only, like an assertion's: the machine reads the key from its own record and checks\n * the rest (a 43-character id, exactly 64 bytes), so a carrier never decides a kind. */\nexport const ControlDeviceSignature = z.strictObject({\n cred: B64Url.min(1),\n /** 64 bytes r\u2016s, base64url without padding. */\n sig: B64Url.min(1),\n});\n\n/** A key enrolled on a machine, closed: a passkey (credential id, COSE alg, SPKI), or a\n * device key an app holds in hardware (CONTROL.md \u00A72 \"Device keys\"), which names\n * itself by its SPKI's SHA-256 and says how it is held. A machine refuses any other\n * field or value, so a kind added later is refused by every machine that predates it. */\nexport const ControlKey = z.xor([\n z.strictObject({\n id: B64Url.min(16).max(1400),\n alg: z.union([z.literal(-7), z.literal(-257)]),\n spki: B64Url.min(1),\n }),\n z.strictObject({\n /** SHA-256 of the SPKI bytes, base64url without padding. */\n id: z.string().regex(/^[A-Za-z0-9_-]{43}$/, \"SHA-256 of the spki, base64url\"),\n alg: z.literal(-7),\n spki: B64Url.min(1),\n type: z.literal(\"device\"),\n /** The private key was made in a hardware key store and never leaves it. */\n store: z.literal(\"hardware\"),\n /** The store will not sign without verifying the person, every time. */\n uv: z.literal(\"each-use\"),\n }),\n]);\n\n/** One message as a receiver carries it: its own envelope around the signed bytes. */\nexport const ControlMessage = z.object({\n /** The receiver's id for this message; the ack key. Not signed: the nonce inside cmd is. */\n id: Ulid,\n /** The command string, exactly as signed (\u2264 48 000 characters). */\n cmd: z.string().min(1).max(48_000),\n /** The day key's ECDSA P-256 / SHA-256 signature over cmd: raw r\u2016s, base64url. */\n csig: B64Url.nullable().optional(),\n /** The grant vouching for the day key: its string plus the passkey's assertion over\n * sha256(str), or a device key's signature over it (CONTROL.md \u00A73.2). */\n grant: z\n .xor([\n ControlAssertion.extend({ str: z.string().min(1).max(2000) }),\n ControlDeviceSignature.extend({ str: z.string().min(1).max(2000) }),\n ])\n .nullable()\n .optional(),\n /** Instead of csig + grant: one passkey assertion (or device signature) over sha256(cmd). */\n confirm: z.xor([ControlAssertion, ControlDeviceSignature]).nullable().optional(),\n /** The receiver's clock. */\n at: Rfc3339,\n /** After this the machine MUST NOT act and acks `expired`; at most 24 h after `at`. */\n expires_at: Rfc3339,\n});\n\nexport const ControlPoll = z.object({ messages: z.array(ControlMessage) });\n\n/** `taken` is the one non-final outcome: the machine verified the message and is\n * delivering it (a headless resume can take minutes); a final ack follows. */\n/** `progress` (not final): the answer so far, whole, in `reply`, with a rising `seq`.\n * `taken` (not final): verified and being delivered. Every other outcome is final. */\nexport const ControlOutcome = z.enum([\"progress\", \"taken\", \"delivered\", \"expired\", \"unsupported\", \"failed\", \"refused\"]);\n\nexport const ControlAck = z.object({\n acks: z\n .array(\n z.object({\n id: Ulid,\n outcome: ControlOutcome,\n at: Rfc3339,\n /** delivered: how it reached the session. */\n mode: DeliveryMode.optional(),\n /** The session that took it, when not the one named (a fork's copy, a started session). */\n session: SessionRef.optional(),\n /** refused: the verifier's code, or the machine's own (`folder`, `no_attention`, `busy`);\n * failed: `file` when a start's attachment couldn't be fetched, checked or written,\n * `model` when the harness wouldn't run the start's model. */\n code: z\n .string()\n .regex(/^[a-z_]{1,40}$/)\n .optional(),\n detail: z.string().max(500).optional(),\n /** resume / fork / start: the agent's reply, redacted by the secrets ruleset. */\n reply: z.string().max(20_000).optional(),\n /** progress only: rises with every progress ack for this id; a receiver keeps the highest. */\n seq: z.int().min(0).optional(),\n /** taken, delivered of a start: the options it ran with (`model` only when one was\n * asked for). A receiver shows this, never what was asked. */\n applied: z.strictObject({ permission: RunLevel.optional(), model: ModelId.optional() }).optional(),\n }),\n )\n .min(1),\n});\n\n/** A harness account signed in on the machine: the id `session.account_id` carries,\n * and the email it signs in with, so a receiver the person paired with can name the\n * account rather than show an id. Only pair and hello carry it, never an event. */\nexport const HarnessAccount = z.object({\n harness: z.string().regex(/^[a-z][a-z0-9-]{0,39}$/),\n id: z.string().min(1).max(128),\n email: z.string().max(254).optional(),\n /** What to call an account that has no email: a Claude Code home that runs on\n * another API is named by its endpoint's host (`api.z.ai`). */\n name: z.string().min(1).max(200).optional(),\n});\n\n/** `POST {control}/pair`, sent with the person's sink token from their own terminal \u2014\n * or, where the receiver declares `control.open_pairing`, with no token and a\n * `poll_key` (CONTROL.md \u00A72). */\nexport const ControlPairStart = z.object({\n /** Open pairing: a random secret only this terminal knows. Status polls present it\n * as their bearer; the receiver keeps only a hash. */\n poll_key: z\n .string()\n .regex(/^[A-Za-z0-9_-]{22,128}$/)\n .optional(),\n /** Set when adding a key to a machine already paired. */\n machine: MachineId.optional(),\n name: z.string().min(1).max(80),\n harnesses: z.array(z.string().regex(/^[a-z][a-z0-9-]{0,39}$/)).max(20),\n modes: z.array(DeliveryMode),\n version: z.string().max(40),\n /** The folders the machine lets sessions run in, for the receiver's \"new session\"\n * picker. Informational: the machine checks its own list again. */\n folders: z.array(z.string().max(1024)).max(50).optional(),\n /** safe: nothing that needs approval runs unattended; auto: the harness's auto mode;\n * inherit: no permission flag, each harness's own default there. Chosen at the machine. */\n mode: z.enum([\"safe\", \"auto\", \"inherit\"]).optional(),\n /** The harness accounts signed in here, so the receiver's board can name each\n * `session.account_id` (CONTROL.md \u00A72). */\n accounts: z.array(HarnessAccount).max(20).optional(),\n /** The machine takes `files` on a start (downloads, checks and writes them). A\n * machine that doesn't say so may ignore them: a receiver SHOULD NOT send it files. */\n files: z.boolean().optional(),\n /** The kinds of key this machine takes (unique; absent means `[\"passkey\"]`). A\n * client offers a device key only to a machine that lists `device`. */\n key_types: KeyTypes.optional(),\n});\n\n/** The receiver's answer: where the person confirms, and the digits both screens show. */\nexport const ControlPairStarted = z.object({\n machine: MachineId,\n code: z.string().regex(/^[A-Za-z0-9_-]{6,32}$/),\n url: z.url(),\n /** Six digits the terminal and the receiver's page both show. */\n check: z.string().regex(/^\\d{6}$/),\n expires_at: Rfc3339,\n});\n\n/** `GET {control}/pair?code=\u2026` once the person confirmed. The machine verifies `proof`\n * over sha256(\"sessionpipe.pair:<machine>:<code>\") before it trusts `key`. */\nexport const ControlPaired = z.object({\n status: z.enum([\"pending\", \"paired\", \"expired\"]),\n /** The key approved, whole: a device key keeps its type, store and uv. */\n key: ControlKey.optional(),\n /** The key's proof: a passkey assertion, or a device signature for purpose `pair`. */\n proof: z.xor([ControlAssertion, ControlDeviceSignature]).optional(),\n /** The machine's own bearer for polls, acks and hello: opens nothing else. Minted\n * once, at the first pairing of a machine. */\n token: z.string().min(16).max(256).optional(),\n /** Optional: a key for the events lane (`sink add`), so the receiver's session board\n * shows this machine without a second step. Handed over once. */\n sink_token: z.string().min(16).max(256).optional(),\n /** Optional: who approved, in the receiver's words (a @handle), so the terminal can\n * say whose passkey it now trusts. */\n account: z.string().max(200).optional(),\n});\n\n/** One account in the machine's pool, as its hello lists it (CONTROL.md \u00A72 `pool`).\n * `id` is the string `session.account_id` and `limits.observed.account_id` carry, so\n * a receiver joins the three without a map. The email travels only here. */\nexport const PoolAccount = z.object({\n id: PoolAccountId,\n email: z.string().max(254).optional(),\n /** What the person calls it, when they named it. */\n label: z.string().min(1).max(80).optional(),\n enabled: z.boolean(),\n /** ready: has room; limited: every window the pool watches is used up until `until`;\n * error: needs the person (sign in again); disabled: turned off by the person. */\n status: z.enum([\"ready\", \"limited\", \"error\", \"disabled\"]),\n /** Serving new sessions right now. At most one account says so. */\n current: z.boolean().optional(),\n /** limited: when it has room again, where the machine knows. */\n until: Rfc3339.optional(),\n /** The account's freshest numbers, as limits.observed would carry them: from the\n * idle usage poll when no session asked recently, since an idle account's numbers\n * ride on no session and would reach no receiver otherwise. */\n windows: z.array(LimitWindow).min(1).max(8).optional(),\n /** limited or error only: what took the account out. A window's id (`seven_day`), or\n * `rejected` (the vendor's status) or `error` (sign in again) for the non-window causes. */\n limited_by: z\n .string()\n .regex(/^[a-z0-9_]{1,64}$/)\n .optional(),\n});\n\n/** The machine's account pool (CONTROL.md \u00A72 `pool`): present in EVERY hello of a daemon\n * that knows the pool (`on: false`, `accounts: []` when nothing is set up), so a\n * receiver tells \"no pool\" from \"an old daemon\"; `accounts` in the machine's order. */\nexport const ControlHelloPool = z.object({\n on: z.boolean(),\n /** The harness the pool serves. Only `claude-code` today. */\n harness: HarnessName,\n accounts: z.array(PoolAccount).max(20),\n});\n\n/** `POST {control}/hello`: what the machine can do right now. */\nexport const ControlHello = z.object({\n name: z.string().min(1).max(80),\n harnesses: z.array(z.string().regex(/^[a-z][a-z0-9-]{0,39}$/)).max(20),\n modes: z.array(DeliveryMode),\n /** Credential ids of the keys enrolled on the machine. */\n keys: z.array(B64Url.min(16).max(1400)).max(50),\n version: z.string().max(40),\n /** Live sessions with a waiter parked on the daemon's socket. */\n waiting: z.array(SessionRef).max(500).optional(),\n /** As in control-pair.json: informational, re-checked on the machine. */\n folders: z.array(z.string().max(1024)).max(50).optional(),\n mode: z.enum([\"safe\", \"auto\", \"inherit\"]).optional(),\n /** As in control-pair.json: read again for every hello, so a new sign-in is named. */\n accounts: z.array(HarnessAccount).max(20).optional(),\n /** As in control-pair.json. */\n files: z.boolean().optional(),\n /** The machine takes `files` on a prompt too (CONTROL.md \u00A76 `prompt`). One that\n * doesn't say so refuses them: a receiver SHOULD NOT send it a prompt with files. */\n prompt_files: z.boolean().optional(),\n /** Per harness in `harnesses`: the options a start may carry (CONTROL.md \u00A72). No\n * entry: neither `permission` nor `model`. */\n start: z\n .record(\n HarnessName,\n z.object({\n /** The levels it starts at here, already capped by `mode`. */\n permissions: z.array(StartPermission).min(1).max(4).meta({ uniqueItems: true }),\n /** What a start that names none gets: one of `permissions`, or `inherit` on an\n * inherit machine. */\n permission: RunLevel,\n /** Model ids the harness offers here: a suggestion, not a promise. */\n models: z.array(ModelId).max(50).optional(),\n /** Any well-formed model is passed to the harness (which may still reject it). */\n any_model: z.boolean().optional(),\n }),\n )\n .refine((o) => Object.keys(o).length <= 50, \"at most 50 harnesses\")\n .meta({ maxProperties: 50 })\n .optional(),\n /** As in control-pair.json. */\n key_types: KeyTypes.optional(),\n /** The machine's account pool, when its daemon has one; sent again the moment the\n * pool changes. A hello without it is a daemon that predates the pool. */\n pool: ControlHelloPool.optional(),\n});\n\nexport const WellKnown = z.object({\n protocol: z.array(z.int().min(1)).min(1),\n max_tier: Tier,\n capabilities: z.array(z.string().regex(/^[a-z][a-z0-9-]*$/)),\n auth: z.array(z.enum([\"bearer\"])).default([\"bearer\"]),\n endpoints: z.object({\n events: z.string(),\n control: z.string().optional(),\n native: z.string().optional(),\n }),\n batch: z.object({ max_events: z.int().min(1).max(50), max_bytes: z.int().min(1024).max(262_144) }),\n control: z\n .object({\n wait_max_s: z.int().min(1).max(60),\n /** Pairing may start with no token: the person approves the link signed in. */\n open_pairing: z.boolean().optional(),\n /** MCP servers (`mcp__<server>`) a session answering this receiver's message may\n * use without asking. MCP servers only: a daemon ignores anything else. */\n session_tools: z\n .array(z.string().regex(/^mcp__[A-Za-z0-9_-]{1,64}$/))\n .max(8)\n .optional(),\n /** How commands are signed: the WebAuthn rp id keys are enrolled for, and the algorithms. */\n signing: z.object({\n rp_id: z.string().min(1).max(253),\n algs: z.array(z.union([z.literal(-7), z.literal(-257)])).min(1),\n /** The kinds of key the receiver stores and carries whole (CONTROL.md \u00A72).\n * Absent means `[\"passkey\"]`. */\n key_types: KeyTypes.optional(),\n }),\n /** Informational: the receiver accepts `files` on a start and serves\n * `GET {control}/files/{sha256}`. */\n files: z.boolean().optional(),\n /** The receiver shows a machine in `inherit` mode as that, never as safe or auto.\n * A daemon pairs in, or switches to, `inherit` only with receivers that say so. */\n inherit: z.boolean().optional(),\n })\n .optional(),\n});\n\n/** What `npm run schemas` writes to schemas/v1/<name>.json. */\nexport const SCHEMAS = {\n event: Event,\n \"event-data\": EventData,\n batch: Batch,\n \"batch-response\": BatchResponse,\n error: ErrorResponse,\n \"well-known\": WellKnown,\n control: ControlMessage,\n \"control-command\": ControlCommand,\n \"control-grant\": ControlGrant,\n \"control-key\": ControlKey,\n \"control-poll\": ControlPoll,\n \"control-ack\": ControlAck,\n \"control-pair\": ControlPairStart,\n \"control-pair-started\": ControlPairStarted,\n \"control-paired\": ControlPaired,\n \"control-hello\": ControlHello,\n} as const;\n"],
5
- "mappings": ";;;AAKA,SAAS,SAAS;AAEX,IAAM,WAAW;AAGjB,IAAM,YAAY,EACtB,OAAO,EACP,MAAM,qDAAqD,kCAAkC;AAEzF,IAAM,cAAc;AAAA,EACzB;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;AACF;AAGO,IAAM,YAAiE;AAAA,EAC5E,mBAAmB;AAAA,EACnB,qBA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AC;AAAA;AAAA;AAAA,MAG9D,WAAW,SAAS,SAAS;AAAA,IAC/B,CAAC;AAAA;AAAA;AAAA,IAGD,OAAO,EAAE,QAAQ,EAAE,SAAS;AAAA;AAAA;AAAA,IAG5B,SAAS,EAAE,QAAQ,EAAE,SAAS;AAAA,EAChC,CAAC,EACA,SAAS;AACd,CAAC;AAGM,IAAM,UAAU;AAAA,EACrB,OAAO;AAAA,EACP,cAAc;AAAA,EACd,OAAO;AAAA,EACP,kBAAkB;AAAA,EAClB,OAAO;AAAA,EACP,cAAc;AAAA,EACd,SAAS;AAAA,EACT,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,wBAAwB;AAAA,EACxB,kBAAkB;AAAA,EAClB,iBAAiB;AACnB;",
4
+ "sourcesContent": ["// SPDX-License-Identifier: Apache-2.0\n// The one source for the protocol's shapes. schemas/v1/*.json are GENERATED from\n// this file (`npm run schemas`); core's runtime types are inferred from it with\n// type-only imports, so zod never enters the zero-dependency bundle. Prose lives in\n// spec/PROTOCOL.md; a rule that is not encoded here is a MUST in words only.\nimport { z } from \"zod\";\n\nexport const PROTOCOL = 1;\n\n/** Dotted, lowercase. Unknown types MUST be accepted and stored. */\nexport const EventType = z\n .string()\n .regex(/^(?:native|[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+)$/, \"dotted lowercase type, or native\");\n\nexport const KNOWN_TYPES = [\n \"session.started\",\n \"session.heartbeat\",\n \"session.ended\",\n \"session.backfill\",\n \"session.forgotten\",\n \"turn.started\",\n \"turn.ended\",\n \"turn.transcript\",\n \"turn.progress\",\n \"tool.started\",\n \"tool.ended\",\n \"files.changed\",\n \"attention.needed\",\n \"attention.cleared\",\n \"subagent.started\",\n \"subagent.ended\",\n \"context.compacted\",\n \"limits.observed\",\n \"delegation.started\",\n \"delegation.ended\",\n \"native\",\n] as const;\n\n/** The lowest tier that carries each known type. */\nexport const TYPE_TIER: Record<(typeof KNOWN_TYPES)[number], 0 | 1 | 2 | 3> = {\n \"session.started\": 0,\n \"session.heartbeat\": 0,\n \"session.ended\": 0,\n \"session.backfill\": 0,\n \"session.forgotten\": 0,\n \"turn.started\": 0,\n \"turn.ended\": 0,\n \"turn.transcript\": 2,\n \"turn.progress\": 2,\n \"tool.started\": 1,\n \"tool.ended\": 1,\n \"files.changed\": 1,\n \"attention.needed\": 0,\n \"attention.cleared\": 0,\n \"subagent.started\": 1,\n \"subagent.ended\": 1,\n \"context.compacted\": 1,\n \"limits.observed\": 1,\n \"delegation.started\": 0,\n \"delegation.ended\": 0,\n native: 3,\n};\n\nexport const HARNESS_NAMES = [\n \"claude-code\",\n \"codex\",\n \"gemini-cli\",\n \"antigravity\",\n \"devin\",\n \"cursor\",\n \"copilot-cli\",\n \"droid\",\n \"kiro\",\n \"opencode\",\n] as const;\n\nexport const Tier = z.int().min(0).max(3);\nexport const Ulid = z.string().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/, \"ULID\");\nexport const Rfc3339 = z.iso.datetime({ offset: false, precision: 3 });\nexport const SessionId = z\n .string()\n .min(1)\n .max(128)\n .regex(/^[A-Za-z0-9._:-]+$/);\nexport const ToolName = z.string().regex(/^[A-Za-z0-9_.:-]{1,120}$/);\n\nexport const Harness = z.object({\n /** From the registry in ADAPTERS.md; a name outside it is allowed ([a-z0-9-]). */\n name: z.string().regex(/^[a-z][a-z0-9-]{0,39}$/),\n version: z.string().max(64).optional(),\n /** The harness's own event name (`PostToolUse`, `agentStop`). */\n event: z.string().max(64).optional(),\n});\n\nexport const Session = z.object({\n id: SessionId,\n /** Monotonic per session per sender; the dedup key with harness.name and id. */\n seq: z.int().min(0),\n machine: z.string().max(80).optional(),\n /** Home is written `~`. */\n cwd: z.string().max(1024).optional(),\n /** A remote URL with credentials stripped. */\n repo: z.string().max(512).optional(),\n branch: z.string().max(256).optional(),\n model: z.string().max(128).optional(),\n title: z.string().max(200).optional(),\n title_source: z.enum([\"custom\", \"harness\", \"first-ask\"]).optional(),\n url: z.url().max(1024).optional(),\n /** An id, never an email. */\n account_id: z.string().max(128).optional(),\n /** Whether a person attends the session, in the harness's own word. Absent = unknown, never false. */\n attended: z.boolean().optional(),\n parent_id: SessionId.nullable().optional(),\n /** `<harness>:<id>` of the session that started this one on purpose (a script running\n * `claude -p` for it), from the launcher's environment. Absent for a subagent, whose\n * launcher is its parent, and when nothing says. */\n launched_by: z\n .string()\n .regex(/^[a-z][a-z0-9-]{0,39}:[A-Za-z0-9._:-]{1,128}$/)\n .optional(),\n /** `<harness>:<id>` of the session this one answers: the machine's daemon started or\n * resumed it for that session's ask, or for a handoff (CONTROL.md \u00A76, \u00A713), and the\n * child's environment says so. On every event of the child. Lineage across\n * harnesses, as `parent_id` is within one; never authority, never a subagent. */\n delegated_by: z\n .string()\n .regex(/^[a-z][a-z0-9-]{0,39}:[A-Za-z0-9._:-]{1,128}$/)\n .optional(),\n});\n\nexport const Privacy = z.object({\n /** The redaction rulesets that ran; `secrets@1` always above tier 0. */\n rulesets: z.array(z.string().regex(/^[a-z][a-z0-9-]*@\\d+$/)),\n pii: z.boolean(),\n});\n\nexport const Event = z.object({\n protocol: z.literal(PROTOCOL),\n id: Ulid,\n type: EventType,\n time: Rfc3339,\n tier: Tier,\n harness: Harness,\n session: Session,\n privacy: Privacy,\n /** Per type (see EventData); extra keys allowed and kept. */\n data: z.record(z.string(), z.unknown()),\n});\n\n// --- data per type --------------------------------------------------------------\n\nconst Loose = z.object({}).loose();\nexport const AttentionKind = z.enum([\"permission\", \"question\", \"elicitation\", \"idle\", \"error\"]);\n\n/** One usage window of an account: `id` is the harness's own name for it (`five_hour`,\n * `seven_day`, `primary` \u2026); `used_percent` passes 100 once a spend limit is exceeded. */\nexport const LimitWindow = Loose.extend({\n id: z.string().regex(/^[a-z0-9_]{1,64}$/),\n used_percent: z.number().min(0),\n resets_at: Rfc3339.optional(),\n window_minutes: z.int().min(1).optional(),\n});\n\nexport const EventData = z.object({\n \"session.started\": Loose.extend({ source: z.enum([\"startup\", \"resume\", \"clear\", \"compact\", \"fork\", \"unknown\"]) }),\n \"session.heartbeat\": Loose,\n \"session.ended\": Loose.extend({ reason: z.enum([\"clear\", \"logout\", \"exit\", \"other\"]) }),\n \"session.backfill\": Loose.extend({ started_at: Rfc3339, last_at: Rfc3339, turns: z.int().min(0).optional() }),\n \"session.forgotten\": Loose,\n \"turn.started\": Loose.extend({\n turn_id: z.string().max(128).optional(),\n prompt_chars: z.int().min(0).optional(),\n /** The harness's OWN word for who submitted the prompt, forwarded verbatim; not an enum\n * of this spec (Claude Code: user, sdk, system, loop_wakeup, schedule_wakeup,\n * poll_event), and a different vocabulary from session.started.source. A bare word:\n * tier 0 is not redacted, so the shape is the only guard. */\n submitted_by: z\n .string()\n .regex(/^[A-Za-z0-9][A-Za-z0-9_.-]{0,39}$/, \"a bare word, at most 40 characters\")\n .optional(),\n /** True when the prompt text is a block the harness wrote rather than words a person\n * typed; never a claim that no person caused the turn. `injected` on\n * turn.transcript says the same of a turn's ask, for the other way an ask arrives\n * from somewhere other than this session's own keyboard (CONTROL.md \u00A76.3). */\n injected: z.boolean().optional(),\n }),\n \"turn.ended\": Loose.extend({\n turn_id: z.string().max(128).optional(),\n reason: z.enum([\"stop\", \"interrupt\", \"error\"]),\n /** The harness's error class when reason is error (rate_limit, overloaded, authentication_failed, server_error \u2026). */\n error: z.string().max(200).optional(),\n ms: z.int().min(0).optional(),\n /** Background work the harness reports still in flight as the turn ends, each of which wakes the session when it finishes (Claude Code: shell commands, monitors, subagents, workflows). Absent when the harness doesn't say. */\n background: z.int().min(0).optional(),\n }),\n \"turn.transcript\": Loose.extend({\n turn: z.int().min(0),\n user: z.string().max(20_000),\n assistant: z.string().max(20_000),\n at: Rfc3339,\n /** The ask reached the session from somewhere other than its own keyboard: another\n * local session handed it over or a channel pushed it, the two ways a control\n * daemon reaches a session in place (CONTROL.md \u00A76.3, \u00A78). The words are the\n * person's; the arrival was not. Absent means a turn asked for where the session\n * runs. Like turn.started's `injected`, and never a claim that no person is behind\n * the ask. */\n injected: z.literal(true).optional(),\n }),\n /** The turn still running: its prompt and what the assistant has said so far. A\n * later turn.progress for the same turn replaces it; the turn.transcript with the\n * same number supersedes it. Over 20 000 chars, the assistant side keeps its END. */\n \"turn.progress\": Loose.extend({\n turn: z.int().min(0),\n user: z.string().max(20_000),\n assistant: z.string().max(20_000),\n at: Rfc3339,\n /** As on turn.transcript: the ask reached the session from somewhere other than its\n * own keyboard. A running turn says it too, or a board would show the person's\n * relayed words as typed there until the turn ends. */\n injected: z.literal(true).optional(),\n }),\n \"tool.started\": Loose.extend({\n tool: ToolName,\n call_id: z.string().max(128).optional(),\n turn_id: z.string().max(128).optional(),\n /** Set when a subagent made the call. */\n agent_id: z.string().max(128).optional(),\n input: z.unknown().optional(),\n }),\n \"tool.ended\": Loose.extend({\n tool: ToolName,\n call_id: z.string().max(128).optional(),\n turn_id: z.string().max(128).optional(),\n agent_id: z.string().max(128).optional(),\n ms: z.int().min(0).optional(),\n ok: z.boolean(),\n error: z.string().max(2000).optional(),\n input: z.unknown().optional(),\n output: z.unknown().optional(),\n }),\n \"files.changed\": Loose.extend({ paths: z.array(z.string().max(1024)).max(500) }),\n \"attention.needed\": Loose.extend({\n attention_id: z.string().max(128),\n kind: AttentionKind,\n tool: ToolName.optional(),\n message: z.string().max(200).optional(),\n /** Set when a subagent asked. */\n agent_id: z.string().max(128).optional(),\n }),\n \"attention.cleared\": Loose.extend({\n attention_id: z.string().max(128),\n how: z.enum([\"answered\", \"cancelled\", \"timeout\", \"unknown\"]),\n }),\n \"subagent.started\": Loose.extend({ agent_id: z.string().max(128), agent_type: z.string().max(128).optional() }),\n \"subagent.ended\": Loose.extend({\n agent_id: z.string().max(128),\n agent_type: z.string().max(128).optional(),\n /** Background work still in flight once this subagent is out of it, counted as `turn.ended.background` is. Absent when the harness doesn't say. */\n background: z.int().min(0).optional(),\n }),\n \"context.compacted\": Loose.extend({ trigger: z.enum([\"manual\", \"auto\"]) }),\n /** The account's usage limits as the harness last reported them: one per window. */\n \"limits.observed\": Loose.extend({\n windows: z.array(LimitWindow).min(1).max(8),\n plan: z.string().max(64).optional(),\n /** The account the numbers belong to, as `session.account_id` spells it, when the\n * session was served by another account than its own (the pool, CONTROL.md \u00A72). */\n account_id: z.string().max(128).optional(),\n }),\n /** The daemon on this machine took an ask from this session (CONTROL.md \u00A713), or a\n * command with `reply_to` naming it (\u00A76). On the asking session, with its own seq. */\n \"delegation.started\": Loose.extend({\n ask_id: Ulid,\n via: z.enum([\"ask\", \"handoff\"]),\n /** The agent asked. */\n harness: z.string().regex(/^[a-z][a-z0-9-]{0,39}$/),\n /** The session that answers, once known: at once for a handoff or an ask to an\n * existing session; for a new session, when the harness reveals its id. */\n to: z\n .string()\n .regex(/^[a-z][a-z0-9-]{0,39}:[A-Za-z0-9._:-]{1,128}$/)\n .optional(),\n /** Tier 1: what was asked, cut to 200 characters, redacted. */\n text: z.string().max(200).optional(),\n }),\n /** The asked agent's turn ended, or the ask failed before one. */\n \"delegation.ended\": Loose.extend({\n ask_id: Ulid,\n to: z\n .string()\n .regex(/^[a-z][a-z0-9-]{0,39}:[A-Za-z0-9._:-]{1,128}$/)\n .optional(),\n ok: z.boolean(),\n ms: z.int().min(0),\n /** When not ok: why, in at most 200 characters. */\n error: z.string().max(200).optional(),\n /** A handoff only: whether the answer reached `reply_to`. */\n relayed: z.enum([\"delivered\", \"unsupported\", \"failed\"]).optional(),\n /** Tier 2: the answer, redacted. */\n reply: z.string().max(20_000).optional(),\n }),\n native: Loose,\n});\n\n// --- wire -----------------------------------------------------------------------\n\nexport const Batch = z.object({ events: z.array(Event).min(1).max(50) });\n\nexport const BatchResponse = z.object({\n accepted: z.int().min(0),\n duplicates: z.int().min(0),\n rejected: z.array(z.object({ id: Ulid, reason: z.string().max(200) })),\n max_tier: Tier,\n});\n\nexport const ErrorResponse = z.object({\n reason: z.string().max(200),\n supported: z.array(z.int()).optional(),\n max_tier: Tier.optional(),\n});\n\nexport const Capability = z.enum([\"events\", \"backfill\", \"forget\", \"control\", \"native\"]);\n\n// --- control (CONTROL.md) ---------------------------------------------------------\n\nconst B64Url = z.string().regex(/^[A-Za-z0-9_-]*$/, \"base64url, no padding\");\nexport const MachineId = z.string().regex(/^m_[A-Za-z0-9_-]{16,40}$/, \"m_ + 16\u201340 base64url\");\n/** `<harness>:<id>`; the id follows its adapter's rule (Claude Code: a UUID). */\nexport const SessionRef = z.string().regex(/^[a-z][a-z0-9-]{0,39}:[A-Za-z0-9._:-]{1,128}$/, \"<harness>:<session id>\");\nexport const ControlKind = z.enum([\"prompt\", \"permission.answer\", \"cancel\", \"start\", \"key.add\", \"pool\"]);\n/** What a `pool` command asks of the machine's account pool (CONTROL.md \u00A76 `pool`). */\nexport const PoolAction = z.enum([\n \"on\",\n \"off\",\n \"enable\",\n \"disable\",\n \"remove\",\n \"order\",\n \"refresh\",\n \"login.begin\",\n \"login.complete\",\n]);\n/** A pooled account's id: what `session.account_id` and `limits.observed.account_id`\n * carry for it (Claude Code: the account UUID), or a pending sign-in's id. */\nexport const PoolAccountId = z.string().regex(/^[A-Za-z0-9._:-]{1,128}$/, \"an account id\");\n/** The kinds of key a machine or a receiver handles (CONTROL.md \u00A72). Absent: passkeys only. */\nexport const KeyTypes = z\n .array(z.enum([\"passkey\", \"device\"]))\n .min(1)\n .max(2);\nexport const DeliveryMode = z.enum([\"sdk\", \"waiter\", \"turn\", \"inbox\", \"api\", \"resume\", \"fork\"]);\n/** How much a started session may do without anyone approving it (CONTROL.md \u00A73.1),\n * narrowest first. Closed: nothing is wider than `auto`. */\nexport const StartPermission = z.enum([\"read\", \"safe\", \"edits\", \"auto\"]);\n/** What a start ran with, or gets by default: a level, or `inherit` (no permission flag,\n * the harness's own default) on a machine the person put in inherit mode. Never a\n * command's `permission`. */\nexport const RunLevel = z.enum([\"read\", \"safe\", \"edits\", \"auto\", \"inherit\"]);\n/** A model id as the harness names it, passed as one argument: never a leading dash. */\nexport const ModelId = z\n .string()\n .min(1)\n .max(100)\n .regex(/^[A-Za-z0-9][A-Za-z0-9._:/@[\\]-]*$/, \"a model id\");\nconst HarnessName = z.string().regex(/^[a-z][a-z0-9-]{0,39}$/);\n\n/** A file attached to a `start` (CONTROL.md \u00A73.1). The bytes wait on the receiver\n * (`GET {control}/files/{sha256}`); the signed hash is what the machine checks.\n * Beyond this shape the verifier also checks: the name's length after NFC, names\n * unique case-insensitively, and the sizes adding up to at most 50 MiB. */\nexport const ControlFile = z.object({\n /** Written as is (NFC) into the session's folder: no slash, backslash or control\n * character, not starting with a dot. */\n name: z\n .string()\n .min(1)\n .max(200)\n .regex(\n // biome-ignore lint/suspicious/noControlCharactersInRegex: control characters are what it rejects\n /^[^./\\\\\\x00-\\x1f\\x7f][^/\\\\\\x00-\\x1f\\x7f]*$/,\n \"a file name: no slash, backslash, control character or leading dot\",\n ),\n /** Media type, `type/subtype` (case-insensitive). */\n type: z\n .string()\n .min(1)\n .max(100)\n .regex(/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]*\\/[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]*$/, \"type/subtype\"),\n /** Bytes: 1 to 25 MiB. */\n size: z.int().min(1).max(26_214_400),\n /** SHA-256 of the bytes, base64url without padding. */\n sha256: z.string().regex(/^[A-Za-z0-9_-]{43}$/, \"43 base64url characters\"),\n});\n\n/** The signed command, as the device writes it. The machine verifies the EXACT string\n * it received (control.json `cmd`) and never re-serializes it. */\nexport const ControlCommand = z.object({\n v: z.literal(1),\n t: z.literal(\"sessionpipe.control\"),\n machine: MachineId,\n kind: ControlKind,\n session: SessionRef,\n /** prompt, start: the message for the model. */\n text: z.string().min(1).max(20_000).optional(),\n /** permission.answer: the attention_id being answered. */\n for: z.string().min(1).max(128).optional(),\n decision: z.enum([\"allow\", \"deny\"]).optional(),\n /** Shown to the model beside a decision. */\n note: z.string().max(2000).optional(),\n /** start: the folder the new session runs in: absolute, or `~` / `~/\u2026` under the\n * home of the user the machine's daemon runs as, as events write it. */\n cwd: z.string().max(1024).optional(),\n /** key.add (session `sessionpipe:keys`): the new device's key (a passkey or a device\n * key, control-key.json), which the machine trusts once a key it already trusts\n * signed this command. */\n key: z.lazy(() => ControlKey).optional(),\n /** key.add: what the person calls the device. */\n name: z.string().min(1).max(80).optional(),\n /** start, prompt: 1\u201310 files, together at most 50 MiB, downloaded and checked by hash\n * before the session starts or the message is delivered. On a prompt, only to a\n * machine whose hello says `prompt_files`. */\n files: z.array(ControlFile).min(1).max(10).optional(),\n /** start only: the level the new session runs at, at most the machine's mode. Send\n * it only to a machine whose hello advertises it for the harness (`start`). */\n permission: StartPermission.optional(),\n /** start only: the model the harness runs. As `permission`: only when advertised. */\n model: ModelId.optional(),\n /** pool (session `sessionpipe:pool`): what to do with the machine's account pool.\n * Each action takes exactly the fields CONTROL.md \u00A76 `pool` lists for it. */\n pool_action: PoolAction.optional(),\n /** enable, disable, remove, login.complete (the pending sign-in's id); refresh MAY. */\n pool_account: PoolAccountId.optional(),\n /** order: every account of the pool, once each, in the order wanted. */\n pool_order: z.array(PoolAccountId).min(1).max(20).meta({ uniqueItems: true }).optional(),\n /** login.complete: what the person pasted back from the sign-in page (`code#state`). */\n pool_code: z\n .string()\n .min(1)\n .max(512)\n .regex(/^[^\\r\\n]+$/, \"one line\")\n .optional(),\n /** start, prompt: a session on the same machine that gets the answer as a message\n * once the command's turn ends (CONTROL.md \u00A76, a handoff). Never the command's own\n * session. Send it only to a machine whose hello says `handoff`. */\n reply_to: SessionRef.optional(),\n /** At least 16 random bytes, base64url. */\n nonce: z.string().regex(/^[A-Za-z0-9_-]{22,64}$/),\n /** Epoch ms, the signing device's clock. */\n iat: z.int().min(1),\n});\n\n/** A day grant's signed string: a passkey vouches for a device key for \u2264 24 h. */\nexport const ControlGrant = z.object({\n v: z.literal(1),\n t: z.literal(\"sessionpipe.grant\"),\n /** The day key: P-256 SPKI, base64url. */\n pub: B64Url.min(1),\n iat: z.int().min(1),\n exp: z.int().min(1),\n /** The receiver's WebAuthn rp id (well-known control.signing.rp_id). */\n rp: z.string().min(1).max(253),\n});\n\n/** A WebAuthn assertion: credential id, authenticatorData, clientDataJSON, signature. */\nexport const ControlAssertion = z.object({\n cred: B64Url.min(1),\n ad: B64Url.min(1),\n cd: B64Url.min(1),\n sig: B64Url.min(1),\n});\n\n/** A device key's signature (CONTROL.md \u00A73.2): its id and 64 bytes r\u2016s over\n * `sessionpipe.device.v1\u23CE<purpose>\u23CE<rp id>\u23CE<challenge>`. Nothing else. The shape\n * only, like an assertion's: the machine reads the key from its own record and checks\n * the rest (a 43-character id, exactly 64 bytes), so a carrier never decides a kind. */\nexport const ControlDeviceSignature = z.strictObject({\n cred: B64Url.min(1),\n /** 64 bytes r\u2016s, base64url without padding. */\n sig: B64Url.min(1),\n});\n\n/** A key enrolled on a machine, closed: a passkey (credential id, COSE alg, SPKI), or a\n * device key an app holds in hardware (CONTROL.md \u00A72 \"Device keys\"), which names\n * itself by its SPKI's SHA-256 and says how it is held. A machine refuses any other\n * field or value, so a kind added later is refused by every machine that predates it. */\nexport const ControlKey = z.xor([\n z.strictObject({\n id: B64Url.min(16).max(1400),\n alg: z.union([z.literal(-7), z.literal(-257)]),\n spki: B64Url.min(1),\n }),\n z.strictObject({\n /** SHA-256 of the SPKI bytes, base64url without padding. */\n id: z.string().regex(/^[A-Za-z0-9_-]{43}$/, \"SHA-256 of the spki, base64url\"),\n alg: z.literal(-7),\n spki: B64Url.min(1),\n type: z.literal(\"device\"),\n /** The private key was made in a hardware key store and never leaves it. */\n store: z.literal(\"hardware\"),\n /** The store will not sign without verifying the person, every time. */\n uv: z.literal(\"each-use\"),\n }),\n]);\n\n/** One message as a receiver carries it: its own envelope around the signed bytes. */\nexport const ControlMessage = z.object({\n /** The receiver's id for this message; the ack key. Not signed: the nonce inside cmd is. */\n id: Ulid,\n /** The command string, exactly as signed (\u2264 48 000 characters). */\n cmd: z.string().min(1).max(48_000),\n /** The day key's ECDSA P-256 / SHA-256 signature over cmd: raw r\u2016s, base64url. */\n csig: B64Url.nullable().optional(),\n /** The grant vouching for the day key: its string plus the passkey's assertion over\n * sha256(str), or a device key's signature over it (CONTROL.md \u00A73.2). */\n grant: z\n .xor([\n ControlAssertion.extend({ str: z.string().min(1).max(2000) }),\n ControlDeviceSignature.extend({ str: z.string().min(1).max(2000) }),\n ])\n .nullable()\n .optional(),\n /** Instead of csig + grant: one passkey assertion (or device signature) over sha256(cmd). */\n confirm: z.xor([ControlAssertion, ControlDeviceSignature]).nullable().optional(),\n /** The receiver's clock. */\n at: Rfc3339,\n /** After this the machine MUST NOT act and acks `expired`; at most 24 h after `at`. */\n expires_at: Rfc3339,\n});\n\nexport const ControlPoll = z.object({ messages: z.array(ControlMessage) });\n\n/** `taken` is the one non-final outcome: the machine verified the message and is\n * delivering it (a headless resume can take minutes); a final ack follows. */\n/** `progress` (not final): the answer so far, whole, in `reply`, with a rising `seq`.\n * `taken` (not final): verified and being delivered. Every other outcome is final. */\nexport const ControlOutcome = z.enum([\"progress\", \"taken\", \"delivered\", \"expired\", \"unsupported\", \"failed\", \"refused\"]);\n\nexport const ControlAck = z.object({\n acks: z\n .array(\n z.object({\n id: Ulid,\n outcome: ControlOutcome,\n at: Rfc3339,\n /** delivered: how it reached the session. */\n mode: DeliveryMode.optional(),\n /** The session that took it, when not the one named (a fork's copy, a started session). */\n session: SessionRef.optional(),\n /** The answer came from a COPY of the session the command named, which this\n * names: the person is owed the fact that their words went somewhere else. */\n copy_of: SessionRef.optional(),\n /** refused: the verifier's code, or the machine's own (`folder`, `no_attention`, `busy`,\n * `ambiguous_home` when one session id is filed in several of the harness's accounts);\n * failed: `file` when a start's attachment couldn't be fetched, checked or written,\n * `model` when the harness wouldn't run the start's model, `held` when a message was\n * written into a live session's own inbox and that session didn't take it (\u00A76.3). */\n code: z\n .string()\n .regex(/^[a-z_]{1,40}$/)\n .optional(),\n detail: z.string().max(500).optional(),\n /** resume / fork / start: the agent's reply, redacted by the secrets ruleset. */\n reply: z.string().max(20_000).optional(),\n /** progress only: rises with every progress ack for this id; a receiver keeps the highest. */\n seq: z.int().min(0).optional(),\n /** taken, delivered of a start: the options it ran with (`model` only when one was\n * asked for). A receiver shows this, never what was asked. */\n applied: z.strictObject({ permission: RunLevel.optional(), model: ModelId.optional() }).optional(),\n }),\n )\n .min(1),\n});\n\n/** A harness account signed in on the machine: the id `session.account_id` carries,\n * and the email it signs in with, so a receiver the person paired with can name the\n * account rather than show an id. Only pair and hello carry it, never an event. */\nexport const HarnessAccount = z.object({\n harness: z.string().regex(/^[a-z][a-z0-9-]{0,39}$/),\n id: z.string().min(1).max(128),\n email: z.string().max(254).optional(),\n /** What to call an account that has no email: a Claude Code home that runs on\n * another API is named by its endpoint's host (`api.z.ai`). */\n name: z.string().min(1).max(200).optional(),\n});\n\n/** `POST {control}/pair`, sent with the person's sink token from their own terminal \u2014\n * or, where the receiver declares `control.open_pairing`, with no token and a\n * `poll_key` (CONTROL.md \u00A72). */\nexport const ControlPairStart = z.object({\n /** Open pairing: a random secret only this terminal knows. Status polls present it\n * as their bearer; the receiver keeps only a hash. */\n poll_key: z\n .string()\n .regex(/^[A-Za-z0-9_-]{22,128}$/)\n .optional(),\n /** Set when adding a key to a machine already paired. */\n machine: MachineId.optional(),\n name: z.string().min(1).max(80),\n harnesses: z.array(z.string().regex(/^[a-z][a-z0-9-]{0,39}$/)).max(20),\n modes: z.array(DeliveryMode),\n version: z.string().max(40),\n /** The folders the machine lets sessions run in, for the receiver's \"new session\"\n * picker. Informational: the machine checks its own list again. */\n folders: z.array(z.string().max(1024)).max(50).optional(),\n /** safe: nothing that needs approval runs unattended; auto: the harness's auto mode;\n * inherit: no permission flag, each harness's own default there. Chosen at the machine. */\n mode: z.enum([\"safe\", \"auto\", \"inherit\"]).optional(),\n /** The harness accounts signed in here, so the receiver's board can name each\n * `session.account_id` (CONTROL.md \u00A72). */\n accounts: z.array(HarnessAccount).max(20).optional(),\n /** The machine takes `files` on a start (downloads, checks and writes them). A\n * machine that doesn't say so may ignore them: a receiver SHOULD NOT send it files. */\n files: z.boolean().optional(),\n /** The kinds of key this machine takes (unique; absent means `[\"passkey\"]`). A\n * client offers a device key only to a machine that lists `device`. */\n key_types: KeyTypes.optional(),\n /** Sessions on this machine may ask another agent through its daemon (CONTROL.md\n * \u00A713). Informational: a receiver can neither start an ask nor switch it. */\n ask: z.boolean().optional(),\n /** The machine takes `reply_to` on a prompt or a start (CONTROL.md \u00A76). One that\n * doesn't say so refuses it: a receiver SHOULD NOT send it one. */\n handoff: z.boolean().optional(),\n});\n\n/** The receiver's answer: where the person confirms, and the digits both screens show. */\nexport const ControlPairStarted = z.object({\n machine: MachineId,\n code: z.string().regex(/^[A-Za-z0-9_-]{6,32}$/),\n url: z.url(),\n /** Six digits the terminal and the receiver's page both show. */\n check: z.string().regex(/^\\d{6}$/),\n expires_at: Rfc3339,\n});\n\n/** `GET {control}/pair?code=\u2026` once the person confirmed. The machine verifies `proof`\n * over sha256(\"sessionpipe.pair:<machine>:<code>\") before it trusts `key`. */\nexport const ControlPaired = z.object({\n status: z.enum([\"pending\", \"paired\", \"expired\"]),\n /** The key approved, whole: a device key keeps its type, store and uv. */\n key: ControlKey.optional(),\n /** The key's proof: a passkey assertion, or a device signature for purpose `pair`. */\n proof: z.xor([ControlAssertion, ControlDeviceSignature]).optional(),\n /** The machine's own bearer for polls, acks and hello: opens nothing else. Minted\n * once, at the first pairing of a machine. */\n token: z.string().min(16).max(256).optional(),\n /** Optional: a key for the events lane (`sink add`), so the receiver's session board\n * shows this machine without a second step. Handed over once. */\n sink_token: z.string().min(16).max(256).optional(),\n /** Optional: who approved, in the receiver's words (a @handle), so the terminal can\n * say whose passkey it now trusts. */\n account: z.string().max(200).optional(),\n});\n\n/** One account in the machine's pool, as its hello lists it (CONTROL.md \u00A72 `pool`).\n * `id` is the string `session.account_id` and `limits.observed.account_id` carry, so\n * a receiver joins the three without a map. The email travels only here. */\nexport const PoolAccount = z.object({\n id: PoolAccountId,\n email: z.string().max(254).optional(),\n /** What the person calls it, when they named it. */\n label: z.string().min(1).max(80).optional(),\n enabled: z.boolean(),\n /** ready: has room; limited: every window the pool watches is used up until `until`;\n * error: needs the person (sign in again); disabled: turned off by the person. */\n status: z.enum([\"ready\", \"limited\", \"error\", \"disabled\"]),\n /** Serving new sessions right now. At most one account says so. */\n current: z.boolean().optional(),\n /** limited: when it has room again, where the machine knows. */\n until: Rfc3339.optional(),\n /** The account's freshest numbers, as limits.observed would carry them: from the\n * idle usage poll when no session asked recently, since an idle account's numbers\n * ride on no session and would reach no receiver otherwise. */\n windows: z.array(LimitWindow).min(1).max(8).optional(),\n /** limited or error only: what took the account out. A window's id (`seven_day`), or\n * `rejected` (the vendor's status) or `error` (sign in again) for the non-window causes. */\n limited_by: z\n .string()\n .regex(/^[a-z0-9_]{1,64}$/)\n .optional(),\n});\n\n/** The machine's account pool (CONTROL.md \u00A72 `pool`): present in EVERY hello of a daemon\n * that knows the pool (`on: false`, `accounts: []` when nothing is set up), so a\n * receiver tells \"no pool\" from \"an old daemon\"; `accounts` in the machine's order. */\nexport const ControlHelloPool = z.object({\n on: z.boolean(),\n /** The harness the pool serves. Only `claude-code` today. */\n harness: HarnessName,\n accounts: z.array(PoolAccount).max(20),\n});\n\n/** `POST {control}/hello`: what the machine can do right now. */\nexport const ControlHello = z.object({\n name: z.string().min(1).max(80),\n harnesses: z.array(z.string().regex(/^[a-z][a-z0-9-]{0,39}$/)).max(20),\n modes: z.array(DeliveryMode),\n /** Credential ids of the keys enrolled on the machine. */\n keys: z.array(B64Url.min(16).max(1400)).max(50),\n version: z.string().max(40),\n /** Live sessions with a waiter parked on the daemon's socket. */\n waiting: z.array(SessionRef).max(500).optional(),\n /** As in control-pair.json: informational, re-checked on the machine. */\n folders: z.array(z.string().max(1024)).max(50).optional(),\n mode: z.enum([\"safe\", \"auto\", \"inherit\"]).optional(),\n /** As in control-pair.json: read again for every hello, so a new sign-in is named. */\n accounts: z.array(HarnessAccount).max(20).optional(),\n /** As in control-pair.json. */\n files: z.boolean().optional(),\n /** The machine takes `files` on a prompt too (CONTROL.md \u00A76 `prompt`). One that\n * doesn't say so refuses them: a receiver SHOULD NOT send it a prompt with files. */\n prompt_files: z.boolean().optional(),\n /** Per harness in `harnesses`: the options a start may carry (CONTROL.md \u00A72). No\n * entry: neither `permission` nor `model`. */\n start: z\n .record(\n HarnessName,\n z.object({\n /** The levels it starts at here, already capped by `mode`. */\n permissions: z.array(StartPermission).min(1).max(4).meta({ uniqueItems: true }),\n /** What a start that names none gets: one of `permissions`, or `inherit` on an\n * inherit machine. */\n permission: RunLevel,\n /** Model ids the harness offers here: a suggestion, not a promise. */\n models: z.array(ModelId).max(50).optional(),\n /** Any well-formed model is passed to the harness (which may still reject it). */\n any_model: z.boolean().optional(),\n }),\n )\n .refine((o) => Object.keys(o).length <= 50, \"at most 50 harnesses\")\n .meta({ maxProperties: 50 })\n .optional(),\n /** As in control-pair.json. */\n key_types: KeyTypes.optional(),\n /** The machine's account pool, when its daemon has one; sent again the moment the\n * pool changes. A hello without it is a daemon that predates the pool. */\n pool: ControlHelloPool.optional(),\n /** As in control-pair.json; read again for every hello, so `sessionpipe ask off` shows. */\n ask: z.boolean().optional(),\n /** As in control-pair.json. */\n handoff: z.boolean().optional(),\n});\n\nexport const WellKnown = z.object({\n protocol: z.array(z.int().min(1)).min(1),\n max_tier: Tier,\n capabilities: z.array(z.string().regex(/^[a-z][a-z0-9-]*$/)),\n auth: z.array(z.enum([\"bearer\"])).default([\"bearer\"]),\n endpoints: z.object({\n events: z.string(),\n control: z.string().optional(),\n native: z.string().optional(),\n }),\n batch: z.object({ max_events: z.int().min(1).max(50), max_bytes: z.int().min(1024).max(262_144) }),\n /** The tool events the receiver would rather be sent (PROTOCOL.md \u00A74, *Thinned tool\n * events*): `all`, every one (what an absent field means); `main`, a subagent's thinned\n * to at most one `tool.ended` per session per minute; `beat`, every session's thinned\n * so. A sender honours it unless the sink's owner chose otherwise; a sender that\n * predates the field sends every tool event. */\n tools: z.enum([\"all\", \"main\", \"beat\"]).optional(),\n control: z\n .object({\n wait_max_s: z.int().min(1).max(60),\n /** Pairing may start with no token: the person approves the link signed in. */\n open_pairing: z.boolean().optional(),\n /** MCP servers (`mcp__<server>`) a session answering this receiver's message may\n * use without asking. MCP servers only: a daemon ignores anything else. */\n session_tools: z\n .array(z.string().regex(/^mcp__[A-Za-z0-9_-]{1,64}$/))\n .max(8)\n .optional(),\n /** How commands are signed: the WebAuthn rp id keys are enrolled for, and the algorithms. */\n signing: z.object({\n rp_id: z.string().min(1).max(253),\n algs: z.array(z.union([z.literal(-7), z.literal(-257)])).min(1),\n /** The kinds of key the receiver stores and carries whole (CONTROL.md \u00A72).\n * Absent means `[\"passkey\"]`. */\n key_types: KeyTypes.optional(),\n }),\n /** Informational: the receiver accepts `files` on a start and serves\n * `GET {control}/files/{sha256}`. */\n files: z.boolean().optional(),\n /** The receiver shows a machine in `inherit` mode as that, never as safe or auto.\n * A daemon pairs in, or switches to, `inherit` only with receivers that say so. */\n inherit: z.boolean().optional(),\n })\n .optional(),\n});\n\n/** What `npm run schemas` writes to schemas/v1/<name>.json. */\nexport const SCHEMAS = {\n event: Event,\n \"event-data\": EventData,\n batch: Batch,\n \"batch-response\": BatchResponse,\n error: ErrorResponse,\n \"well-known\": WellKnown,\n control: ControlMessage,\n \"control-command\": ControlCommand,\n \"control-grant\": ControlGrant,\n \"control-key\": ControlKey,\n \"control-poll\": ControlPoll,\n \"control-ack\": ControlAck,\n \"control-pair\": ControlPairStart,\n \"control-pair-started\": ControlPairStarted,\n \"control-paired\": ControlPaired,\n \"control-hello\": ControlHello,\n} as const;\n"],
5
+ "mappings": ";;;AAKA,SAAS,SAAS;AAEX,IAAM,WAAW;AAGjB,IAAM,YAAY,EACtB,OAAO,EACP,MAAM,qDAAqD,kCAAkC;AAEzF,IAAM,cAAc;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;A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2.0 · https://sessionpipe.org
2
2
 
3
3
  // src/service/index.ts
4
4
  import { execFileSync } from "node:child_process";
@@ -1 +1 @@
1
- {"version":3,"file":"acp-control.d.ts","sourceRoot":"","sources":["../../../src/adapters/acp-control.ts"],"names":[],"mappings":"AAeA,OAAO,EAAkD,KAAK,IAAI,EAAuB,MAAM,eAAe,CAAC;AAE/G,MAAM,WAAW,QAAQ;IACvB,0GAA0G;IAC1G,OAAO,EAAE,MAAM,CAAC;IAChB,yBAAyB;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,oFAAoF;AACpF,eAAO,MAAM,UAAU,EAAE,SAAS,QAAQ,EA0CzC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAAqC,CAAC;AAEjF,eAAO,MAAM,QAAQ,YAAa,MAAM,KAAG,QAAQ,GAAG,SAA0D,CAAC;AAEjH,mFAAmF;AACnF,eAAO,MAAM,WAAW,YAAa,MAAM,KAAG,MAAuE,CAAC;AAEtH;+EAC+E;AAC/E,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,IAAI,SAAe,EACnB,OAAO,SAAiC,GACvC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,IAAI,CAgBxC;AAED,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,EAAE,CAE3E;AAED,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAIpC,UAAU,MAAM;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;2BAG2B;AAC3B,wBAA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E,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAiBjH;AAED;uEACuE;AACvE,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE;IAAE,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GACnG,MAAM,GAAG,IAAI,CAiBf;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAA;CAAE,GAC3E,YAAY,CAyBd"}
@@ -14,6 +14,10 @@ export interface Caps {
14
14
  /** `--output-format stream-json` with `--include-partial-messages`: the answer can be
15
15
  * forwarded as it is written. Optional so older callers' literals still type. */
16
16
  stream?: boolean;
17
+ /** Why `claude --help` couldn't be read, when it couldn't: it timed out (a machine still
18
+ * starting up), or failed without listing `--permission-mode`. Such caps say nothing
19
+ * about this Claude Code's modes, so they are never read as "it has none". */
20
+ unread?: string;
17
21
  }
18
22
  export declare function parseCaps(help: string): Caps;
19
23
  /** Permission flags for a level (a machine's mode is one: safe, auto, inherit). Read:
@@ -21,8 +25,9 @@ export declare function parseCaps(help: string): Caps;
21
25
  * Auto: Claude Code's own auto mode. Inherit: none, so the turn starts in the mode
22
26
  * Claude Code picks by itself here, its settings' `permissions.defaultMode` (a resume
23
27
  * too: Claude Code never restores a session's earlier mode). A level this Claude Code
24
- * has no mode for is a refusal, never another level. Never bypassPermissions — no path
25
- * here writes it. */
28
+ * has no mode for is a refusal, never another level, and so is every level but inherit
29
+ * while its --help can't be read (safe would otherwise run with no flag at all). Never
30
+ * bypassPermissions — no path here writes it. */
26
31
  export declare function modeFlags(level: RunLevel, caps: Caps): {
27
32
  args: string[];
28
33
  } | {
@@ -33,7 +38,9 @@ export declare function modeFlags(level: RunLevel, caps: Caps): {
33
38
  * only narrow to a level that never runs anything needing approval. */
34
39
  export declare const ceilingLevel: (mode: Mode) => StartPermission;
35
40
  /** The levels a start may ask Claude Code for on a machine in `mode`: never above its
36
- * ceiling, and each only where `claude --help` lists the mode it maps to (safe always). */
41
+ * ceiling, and each only where `claude --help` lists the mode it maps to (safe always).
42
+ * None while that --help couldn't be read: an offered safe would be taken and then run
43
+ * with no permission flag at all. */
37
44
  export declare function offeredLevels(mode: Mode, caps: Caps): StartPermission[];
38
45
  /** What a start that names no level gets: what the machine's mode means for Claude Code. */
39
46
  export declare const defaultLevel: (mode: Mode) => RunLevel;
@@ -59,7 +66,8 @@ export declare function claudeArgs(o: {
59
66
  error: string;
60
67
  };
61
68
  /** The env a headless turn runs with: ours, minus the markers that make Claude Code
62
- * think it runs inside another session, with CLAUDE_CONFIG_DIR naming the account. */
69
+ * think it runs inside another session and minus any lineage this process inherited
70
+ * (jobEnv), with CLAUDE_CONFIG_DIR naming the account. */
63
71
  export declare function claudeEnv(configDir?: string, env?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
64
72
  /** Whether Claude Code is signed in for one account, in Claude Code's own words
65
73
  * (`claude auth status --json`). `loggedIn: null` means this Claude Code can't say
@@ -75,22 +83,144 @@ export declare function claudeLogin(bin: string, configDir?: string, env?: NodeJ
75
83
  export declare function loginCommand(configDir: string | undefined): string;
76
84
  /** What to tell the person when an account isn't signed in for the daemon. */
77
85
  export declare function loginHint(configDir: string | undefined, platform?: NodeJS.Platform): string;
78
- export declare function detectCaps(bin: string): Caps;
86
+ /** What `claude --help` lists. A run that fails still counts when it printed its
87
+ * `--permission-mode` line; one that didn't (a timeout on a machine still starting up,
88
+ * most often) is `unread`, never a Claude Code with no modes. */
89
+ export declare function detectCaps(bin: string, timeoutMs?: number): Caps;
79
90
  export interface Transcript {
80
91
  file: string;
81
92
  configDir: string;
82
93
  project: string;
83
94
  }
84
95
  /** <config dir>/projects/<folder>/<session>.jsonl in any Claude Code config dir. */
85
- export declare function findTranscript(session: string, dirs: string[]): Transcript | null;
96
+ export declare function findTranscript(session: string, dirs: readonly string[]): Transcript | null;
97
+ /** Every config dir that holds this session's transcript, in the order given. One
98
+ * session id can be filed in several accounts: a transcript copied between homes, the
99
+ * same id resumed under another account. There were six such ids on one Mac in
100
+ * October 2026, and picking the first — which is what reading one home does — put a
101
+ * message into an account that was signed out. */
102
+ export declare function findTranscripts(session: string, dirs: readonly string[]): Transcript[];
103
+ /** Which Claude Code account a session belongs to, when more than one has its
104
+ * transcript: the one whose own `sessions/` says a live process holds it. `ambiguous`
105
+ * is a refusal rather than a guess — it names every account that has the transcript,
106
+ * and in `live` the ones holding it open, which is none of them or more than one. Both
107
+ * are named by their directory name alone, since an ack travels to the receiver. Null
108
+ * when no account has the session at all. */
109
+ export type HomeChoice = {
110
+ transcript: Transcript;
111
+ } | {
112
+ ambiguous: string[];
113
+ live: string[];
114
+ };
115
+ export declare function resolveHome(session: string, dirs: readonly string[]): HomeChoice | null;
86
116
  /** The folder a session runs in, from its transcript's own records (never from a
87
117
  * command): the `cwd` whose project name is the folder the transcript is filed
88
118
  * under, else the first `cwd`. Streams; a line over 2 MB is skipped. */
89
119
  export declare function sessionFolder(t: Transcript, cap?: number): string | null;
120
+ /** One live Claude Code process's registry row, `<config>/sessions/<pid>.json`, as the
121
+ * in-place `inbox` lane needs it (spec/CONTROL.md §6.3). Every session that registers
122
+ * files one — a terminal window, the desktop app and a claude.ai bridge worker alike,
123
+ * all of them `kind: "interactive"`; a `-p` one-shot's row is not one of those. */
124
+ export interface LiveRecord {
125
+ /** The config dir this row was read from: the lane never crosses accounts. */
126
+ configDir: string;
127
+ file: string;
128
+ pid: number;
129
+ /** Claude Code's own local inbox for this process, or null when it published none. */
130
+ socket: string | null;
131
+ /** 1 is the only inbox protocol this code speaks; anything else is refused. */
132
+ peerProtocol: number | null;
133
+ /** The process's start time as the registry spells it (UTC), so a recycled pid can be
134
+ * told from the process that filed the row. */
135
+ procStart: string | null;
136
+ status: string | null;
137
+ /** `interactive` for a session the harness holds open for the person. */
138
+ kind: string | null;
139
+ entrypoint: string | null;
140
+ /** `<pid>.<sha>.key`, 0600: where the inbox's auth token lives (needed off macOS). */
141
+ keyFile: string | null;
142
+ }
143
+ /** Every live registry row for this session, across the config dirs given. A row whose
144
+ * pid is gone is not one: the file outlives the process. */
145
+ export declare function liveRecords(session: string, dirs: string | readonly string[]): LiveRecord[];
146
+ /** The ONE live process that holds this session, or null. Two rows — two accounts, or
147
+ * two processes in one — is a refusal rather than a guess: a lane that writes into a
148
+ * live session has to know which process it is writing to (spec/CONTROL.md §6.3). */
149
+ export declare function liveRecord(session: string, dirs: string | readonly string[]): LiveRecord | null;
90
150
  /** A Claude Code process holds this session right now: its registry file,
91
151
  * <config>/sessions/<pid>.json, names it and the pid is alive (interactive and
92
152
  * Agent SDK sessions both file one). */
93
153
  export declare function liveProcess(session: string, configDir: string): boolean;
154
+ /** Claude Code's own permission modes, by how much a turn may do in them without being
155
+ * asked about (its own order, 2.1.310). `plan` writes nothing at all. `default`,
156
+ * `manual` and `dontAsk` share a step: none of them lets anything through that needs
157
+ * approval — the first two ask the person, `dontAsk` refuses instead. `acceptEdits`
158
+ * writes files; `auto` runs most things; `bypassPermissions` asks about nothing.
159
+ *
160
+ * Used to tell one mode from another and to compare two, never to pick one. -1 is "not
161
+ * a mode this code knows", which compares below everything. */
162
+ export declare const MODE_RANK: Record<string, number>;
163
+ export declare const CLAUDE_MODES: string[];
164
+ export declare const modeRank: (m: string | null | undefined) => number;
165
+ /** The permission mode a hook payload reports for its own session, or null. Claude Code
166
+ * writes `permission_mode` on every hook payload; `permissionMode` is the spelling its
167
+ * transcript records use, and is read too so one reader serves both.
168
+ *
169
+ * This is the only place a mode the person chose at the keyboard can be read from: a
170
+ * session's registry row doesn't carry it, and the transcript names it only on turns
171
+ * that happen to record one. hook.ts repeats the shape test, because it imports nothing
172
+ * but node builtins. */
173
+ export declare function hookMode(payload: unknown): string | null;
174
+ /** The permission class Claude Code's own inbox checks a sender's declared class
175
+ * against (2.1.310): `bypassPermissions` is `bypass`; a mode that prompts before it
176
+ * acts is `prompting`. `plan` is neither — its class there depends on a capability and
177
+ * a TTY this code cannot see — and nor is `auto`, nor a mode nothing has recorded, so
178
+ * those get no in-place lane at all (spec/CONTROL.md §6.3). */
179
+ export declare function peerClass(mode: string | null | undefined): "bypass" | "prompting" | null;
180
+ /** One Claude Code account's permission settings, user scope only
181
+ * (`<config dir>/settings.json`): a folder's own settings may tighten these but never
182
+ * loosen them, and a managed policy may tighten them further. Only the three keys
183
+ * something here acts on.
184
+ *
185
+ * Reading user scope alone can overstate how wide a home is, never understate it, and
186
+ * everything that reads this treats a wider answer as a reason NOT to act (the inbox
187
+ * lane needs the machine's class to equal the session's own; a narrowing is re-asserted
188
+ * only where the home's default is at least as wide). */
189
+ export interface HomeSettings {
190
+ /** `permissions.defaultMode`: what a session with no flag starts in. Null: not said,
191
+ * or the file could not be read. */
192
+ defaultMode: string | null;
193
+ /** `disableAutoMode: "disable"`: asking for auto mode quietly gives Manual instead. */
194
+ disableAutoMode: boolean;
195
+ /** `disableBypassPermissionsMode: "disable"`: this home cannot be in bypass at all. */
196
+ disableBypass: boolean;
197
+ }
198
+ export declare const NO_HOME_SETTINGS: HomeSettings;
199
+ export declare function homeSettings(configDir: string | undefined, home?: string): HomeSettings;
200
+ /** The `--permission-mode` a relaunch of ONE session re-asserts, or null for no flag at
201
+ * all (spec/CONTROL.md §6 `prompt`). Only a narrowing the session itself chose, and
202
+ * only where it is one:
203
+ *
204
+ * - `plan` always: nothing this harness has is narrower, so it cannot widen anything;
205
+ * - `dontAsk` and `acceptEdits` where the account's own default is at least as wide
206
+ * (`MODE_RANK`), so a re-assertion is never wider than what the machine itself does
207
+ * with no flag. Settings that can't be read mean it isn't re-asserted;
208
+ * - everything else — `default`, `manual`, `auto`, `bypassPermissions`, nothing
209
+ * recorded — is no flag, and the account's own default decides.
210
+ *
211
+ * The default it compares against is the account's own (`permissions.defaultMode`, user
212
+ * scope). A folder's settings or a managed policy may narrow that further, invisibly
213
+ * here; both narrow what the re-asserted mode can actually do too, so the comparison
214
+ * errs on the side of asking.
215
+ *
216
+ * It never returns `auto` or `bypassPermissions`: the two values a setting can quietly
217
+ * turn into something else, and the two this code must never write. `auto` is the
218
+ * incident this came from — it asks for a mode that `disableAutoMode` turns into Manual,
219
+ * so a session that recorded it gets no flag and the account's default instead.
220
+ *
221
+ * No flag is not neutral. On a fleet whose accounts default to bypass it is the widest
222
+ * outcome there is, which is why a narrowing the person chose has to be said again. */
223
+ export declare function relaunchMode(recorded: string | null | undefined, home: HomeSettings): string | null;
94
224
  /** Written in the last 90 s, and not by a job of ours. */
95
225
  export declare function recentlyWritten(file: string, ourLastEnd?: number, now?: number): boolean;
96
226
  /** Run one headless turn (headless.ts). Streaming (`--output-format stream-json`), only
@@ -1 +1 @@
1
- {"version":3,"file":"claude-code-control.d.ts","sourceRoot":"","sources":["../../../src/adapters/claude-code-control.ts"],"names":[],"mappings":"AAYA,OAAO,EAAa,KAAK,QAAQ,EAAqB,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACzG,OAAO,EAEL,cAAc,EACd,KAAK,KAAK,EACV,KAAK,IAAI,EAET,KAAK,UAAU,EACf,KAAK,SAAS,EAEf,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAE,KAAK,KAAK,EAAE,KAAK,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;AAMjE,6EAA6E;AAC7E,eAAO,MAAM,UAAU,MAAO,MAAM,KAAK,MAAM,WAM9C,CAAC;AAEF;mEACmE;AACnE,wBAAgB,UAAU,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,EAAE,IAAI,SAAe,GAAG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,EAAE,MAAM,EAAE,EAAE,IAAI,SAAY,GAAG,cAAc,EAAE,CAUjF;AAcD;yEACyE;AACzE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG7C;AA2DD;;qFAEqF;AACrF,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,KAAK,EAAE,UAAU,GAChB,YAAY,CA6Fd;AA2BD;4DAC4D;AAC5D,wBAAsB,iBAAiB,CACrC,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,KAAK,EAAE,UAAU,EACjB,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,GAAG,SAAa,GACf,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAehC;AAmBD;;;2CAG2C;AAC3C,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAwC7F;AAMD;;;;+BAI+B;AAC/B,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAqBrG;AAED,6GAA6G;AAC7G,eAAO,MAAM,kBAAkB,QAAO,IAIrC,CAAC"}
@@ -53,6 +53,16 @@ export declare function formatJson(value: unknown, f: {
53
53
  }): string;
54
54
  /** Back-compat helper for callers that only read. */
55
55
  export declare function readJson(file: string): Record<string, unknown>;
56
+ /** Write a config file back, its folder made first. Null once written; otherwise the
57
+ * report for the refusal (see `refused`), which the caller returns in place of its own.
58
+ * `existed` is whether the file was there before: a file cut short is still one
59
+ * sessionpipe made, and the config remembers it as `created`. */
60
+ export declare function writeBack(file: string, text: string, existed?: boolean): InstallReport | null;
61
+ /** Remove a config file sessionpipe created and uninstall has emptied. A delete needs
62
+ * the folder's leave where a write needs only the file's, so a delete refused (a
63
+ * ~/.claude owned by root, a folder ACL on Windows) writes the file back empty instead:
64
+ * our hooks come out either way, and the note says what stayed. */
65
+ export declare function removeEmptied(file: string, empty: string): InstallReport;
56
66
  export declare function installClaudeShaped(file: string, harness: string, events: readonly string[], cmd: HookCommand, o: ClaudeShapedOptions): InstallReport;
57
67
  export declare function uninstallClaudeShaped(file: string, events: readonly string[], opts?: {
58
68
  created?: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"claude-shaped.d.ts","sourceRoot":"","sources":["../../../src/adapters/claude-shaped.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAClC,kEAAkE;IAClE,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAClD,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;8DAC0D;IAC1D,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACnD,6EAA6E;IAC7E,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED;iGACiG;AACjG,eAAO,MAAM,IAAI,QAA+F,CAAC;AACjH,eAAO,MAAM,MAAM,MAAO;IAAE,KAAK,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,KAAG,OACwC,CAAC;AAExG,MAAM,MAAM,QAAQ,GAChB;IACE,EAAE,EAAE,IAAI,CAAC;IACT,OAAO,EAAE,IAAI,CAAC;IACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,MA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AAM,EACZ,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAAO,GAC3C,aAAa,CAqBf;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,GAAG,EAAE,WAAW,EAChB,CAAC,EAAE,mBAAmB,GACrB,SAAS,GAAG,OAAO,GAAG,SAAS,CAiBjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../src/adapters/codex.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAI1C,OAAO,KAAK,EACV,OAAO,EAOP,YAAY,EACb,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,YAAY,YACvB,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,MAAM,EACN,WAAW,EACX,eAAe,EACf,cAAc,EACd,YAAY,EACZ,aAAa,EACb,YAAY,CACJ,CAAC;AAmFX;;gEAEgE;AAChE,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,IAAI,CAwBjG;AAeD,eAAO,MAAM,KAAK,EAAE,OA0MnB,CAAC;AAWF;;;;;;+BAM+B;AAC/B,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,iBAAiB,CAAC,GAAG,IAAI,CA0B1E;AAED,0FAA0F;AAC1F,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CA2DrD"}
1
+ {"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../src/adapters/codex.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAI1C,OAAO,KAAK,EACV,OAAO,EAQP,YAAY,EACb,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,YAAY,YACvB,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,MAAM,EACN,WAAW,EACX,eAAe,EACf,cAAc,EACd,YAAY,EACZ,aAAa,EACb,YAAY,CACJ,CAAC;AA2FX;;gEAEgE;AAChE,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,IAAI,CAwBjG;AAoBD,eAAO,MAAM,KAAK,EAAE,OAoOnB,CAAC;AAWF;;;;;;+BAM+B;AAC/B,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,iBAAiB,CAAC,GAAG,IAAI,CA0B1E;AAED,0FAA0F;AAC1F,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CA2DrD"}
@@ -17,7 +17,7 @@ export declare function splitRef(ref: string | undefined): {
17
17
  db: string;
18
18
  session: string;
19
19
  } | null;
20
- export declare const CHAIN_SQL = "WITH RECURSIVE chain(node_id, parent_node_id, chat_message, created_at) AS (\n SELECT node_id, parent_node_id, chat_message, created_at FROM message_nodes\n WHERE session_id = ? AND node_id = (SELECT main_chain_id FROM sessions WHERE id = ?)\n UNION ALL\n SELECT m.node_id, m.parent_node_id, m.chat_message, m.created_at FROM message_nodes m\n JOIN chain c ON m.node_id = c.parent_node_id AND m.session_id = ? AND m.node_id >= ?\n)\nSELECT node_id, chat_message, created_at FROM chain ORDER BY node_id DESC LIMIT 4000";
20
+ export declare const CHAIN_SQL = "WITH RECURSIVE chain(node_id, parent_node_id, chat_message, created_at) AS (\n SELECT node_id, parent_node_id, chat_message, created_at FROM message_nodes\n WHERE session_id = ? AND node_id = (SELECT main_chain_id FROM sessions WHERE id = ?)\n UNION\n SELECT m.node_id, m.parent_node_id, m.chat_message, m.created_at FROM message_nodes m\n JOIN chain c ON m.node_id = c.parent_node_id AND m.session_id = ? AND m.node_id >= ?\n)\nSELECT node_id, chat_message, created_at FROM chain ORDER BY node_id DESC LIMIT 4000";
21
21
  /** The canonical chain as turns. `node_id` is the cursor: it rises along the chain and
22
22
  * is stable across a resume, so a later read starts where the last one stopped.
23
23
  * `role: "system"` is Cognition's own prompt (and the skills manifest, and the
@@ -1 +1 @@
1
- {"version":3,"file":"devin.d.ts","sourceRoot":"","sources":["../../../src/adapters/devin.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EACV,OAAO,EAMP,cAAc,EACf,MAAM,YAAY,CAAC;AAGpB;6EAC6E;AAC7E,eAAO,MAAM,YAAY,YACvB,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,MAAM,EACN,gBAAgB,EAChB,YAAY,CACJ,CAAC;AAWX;+EAC+E;AAC/E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAK7D;AAID,yEAAyE;AACzE,eAAO,MAAM,cAAc,SAAS,MAAM,CAAC,UAAU,KAAiB,MAGY,CAAC;AAEnF,wFAAwF;AACxF,eAAO,MAAM,YAAY,SAAS,MAAM,CAAC,UAAU,KAAiB,MAG2B,CAAC;AAoBhG,eAAO,MAAM,KAAK,EAAE,OAmJnB,CAAC;AASF;yEACyE;AACzE,eAAO,MAAM,aAAa,OAAQ,MAAM,WAAW,MAAM,KAAG,MAA4B,CAAC;AACzF,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAOxF;AAYD,eAAO,MAAM,SAAS,khBAOyE,CAAC;AAyChG;;;;kCAIkC;AAClC,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MA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ED,mFAAmF;AACnF,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,SAAS,CAQrF;AAED;sFACsF;AACtF,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,SAAS,CAIrF"}
@@ -39,7 +39,9 @@ export declare function probe(bin: string, args: string[]): {
39
39
  };
40
40
  /** The env every headless turn runs with: SESSIONPIPE_CONTROL_JOB tells the turn's own
41
41
  * hooks that the daemon runs it, so its Stop hook never takes a message meant for a
42
- * person's session (cli/src/hook.ts). */
42
+ * person's session (cli/src/hook.ts); and none of the lineage this process inherited
43
+ * (a daemon started from inside an asked session), so a child carries only what its
44
+ * caller adds after this (CONTROL.md §13). */
43
45
  export declare function jobEnv(env?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
44
46
  /** Whether a harness is signed in, in its own words. `loggedIn: null` means it can't
45
47
  * say (too old, or it didn't answer): never a reason to refuse. */