sessionpipe-core 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/control.js +180 -13
  2. package/dist/control.js.map +2 -2
  3. package/dist/index.js +2133 -965
  4. package/dist/index.js.map +4 -4
  5. package/dist/schema/v1.d.ts +443 -34
  6. package/dist/schema/v1.d.ts.map +1 -1
  7. package/dist/schema.js +201 -34
  8. package/dist/schema.js.map +2 -2
  9. package/dist/service.js +155 -0
  10. package/dist/service.js.map +7 -0
  11. package/dist/src/adapters/acp-control.d.ts +87 -0
  12. package/dist/src/adapters/acp-control.d.ts.map +1 -0
  13. package/dist/src/adapters/antigravity-control.d.ts +15 -5
  14. package/dist/src/adapters/antigravity-control.d.ts.map +1 -1
  15. package/dist/src/adapters/claude-code-control.d.ts +39 -4
  16. package/dist/src/adapters/claude-code-control.d.ts.map +1 -1
  17. package/dist/src/adapters/claude-code-pool.d.ts +116 -0
  18. package/dist/src/adapters/claude-code-pool.d.ts.map +1 -0
  19. package/dist/src/adapters/claude-code.d.ts +20 -1
  20. package/dist/src/adapters/claude-code.d.ts.map +1 -1
  21. package/dist/src/adapters/claude-shaped.d.ts +3 -0
  22. package/dist/src/adapters/claude-shaped.d.ts.map +1 -1
  23. package/dist/src/adapters/codex-config.d.ts +2 -1
  24. package/dist/src/adapters/codex-config.d.ts.map +1 -1
  25. package/dist/src/adapters/codex-control.d.ts +23 -7
  26. package/dist/src/adapters/codex-control.d.ts.map +1 -1
  27. package/dist/src/adapters/codex.d.ts +9 -0
  28. package/dist/src/adapters/codex.d.ts.map +1 -1
  29. package/dist/src/adapters/gemini-cli.d.ts +3 -0
  30. package/dist/src/adapters/gemini-cli.d.ts.map +1 -1
  31. package/dist/src/adapters/headless.d.ts +4 -1
  32. package/dist/src/adapters/headless.d.ts.map +1 -1
  33. package/dist/src/adapters/index.d.ts +7 -1
  34. package/dist/src/adapters/index.d.ts.map +1 -1
  35. package/dist/src/adapters/types.d.ts +18 -1
  36. package/dist/src/adapters/types.d.ts.map +1 -1
  37. package/dist/src/config.d.ts +6 -0
  38. package/dist/src/config.d.ts.map +1 -1
  39. package/dist/src/control/verify.d.ts +99 -17
  40. package/dist/src/control/verify.d.ts.map +1 -1
  41. package/dist/src/index.d.ts +3 -1
  42. package/dist/src/index.d.ts.map +1 -1
  43. package/dist/src/launched-by.d.ts +12 -0
  44. package/dist/src/launched-by.d.ts.map +1 -0
  45. package/dist/src/paths.d.ts +4 -0
  46. package/dist/src/paths.d.ts.map +1 -1
  47. package/dist/src/privacy/filter.d.ts.map +1 -1
  48. package/dist/src/service/index.d.ts +83 -0
  49. package/dist/src/service/index.d.ts.map +1 -0
  50. package/dist/src/types.d.ts +4 -0
  51. package/dist/src/types.d.ts.map +1 -1
  52. package/dist/src/version.d.ts +39 -0
  53. package/dist/src/version.d.ts.map +1 -0
  54. package/dist/version.js +75 -0
  55. package/dist/version.js.map +7 -0
  56. package/package.json +10 -2
@@ -1 +1 @@
1
- {"version":3,"file":"v1.d.ts","sourceRoot":"","sources":["../../schema/v1.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,QAAQ,IAAI,CAAC;AAE1B,oEAAoE;AACpE,eAAO,MAAM,SAAS,aAE2E,CAAC;AAElG,eAAO,MAAM,WAAW,YACtB,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,QAAQ,CACA,CAAC;AAEX,oDAAoD;AACpD,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,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;;;;;;;;;;;;;;;;aACd,sBAAsB;;;;;;;aACtB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAChB,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACP,CAAC"}
package/dist/schema.js CHANGED
@@ -1,4 +1,4 @@
1
- // sessionpipe-core 0.9.0 · Apache-2.0 · https://sessionpipe.org
1
+ // sessionpipe-core 0.11.0 · Apache-2.0 · https://sessionpipe.org
2
2
 
3
3
  // schema/v1.ts
4
4
  import { z } from "zod";
@@ -22,6 +22,7 @@ var KNOWN_TYPES = [
22
22
  "subagent.started",
23
23
  "subagent.ended",
24
24
  "context.compacted",
25
+ "limits.observed",
25
26
  "native"
26
27
  ];
27
28
  var TYPE_TIER = {
@@ -42,6 +43,7 @@ var TYPE_TIER = {
42
43
  "subagent.started": 1,
43
44
  "subagent.ended": 1,
44
45
  "context.compacted": 1,
46
+ "limits.observed": 1,
45
47
  native: 3
46
48
  };
47
49
  var HARNESS_NAMES = [
@@ -84,7 +86,13 @@ var Session = z.object({
84
86
  url: z.url().max(1024).optional(),
85
87
  /** An id, never an email. */
86
88
  account_id: z.string().max(128).optional(),
87
- parent_id: SessionId.nullable().optional()
89
+ /** Whether a person attends the session, in the harness's own word. Absent = unknown, never false. */
90
+ attended: z.boolean().optional(),
91
+ parent_id: SessionId.nullable().optional(),
92
+ /** `<harness>:<id>` of the session that started this one on purpose (a script running
93
+ * `claude -p` for it), from the launcher's environment. Absent for a subagent, whose
94
+ * launcher is its parent, and when nothing says. */
95
+ launched_by: z.string().regex(/^[a-z][a-z0-9-]{0,39}:[A-Za-z0-9._:-]{1,128}$/).optional()
88
96
  });
89
97
  var Privacy = z.object({
90
98
  /** The redaction rulesets that ran; `secrets@1` always above tier 0. */
@@ -105,19 +113,38 @@ var Event = z.object({
105
113
  });
106
114
  var Loose = z.object({}).loose();
107
115
  var AttentionKind = z.enum(["permission", "question", "elicitation", "idle", "error"]);
116
+ var LimitWindow = Loose.extend({
117
+ id: z.string().regex(/^[a-z0-9_]{1,64}$/),
118
+ used_percent: z.number().min(0),
119
+ resets_at: Rfc3339.optional(),
120
+ window_minutes: z.int().min(1).optional()
121
+ });
108
122
  var EventData = z.object({
109
123
  "session.started": Loose.extend({ source: z.enum(["startup", "resume", "clear", "compact", "fork", "unknown"]) }),
110
124
  "session.heartbeat": Loose,
111
125
  "session.ended": Loose.extend({ reason: z.enum(["clear", "logout", "exit", "other"]) }),
112
126
  "session.backfill": Loose.extend({ started_at: Rfc3339, last_at: Rfc3339, turns: z.int().min(0).optional() }),
113
127
  "session.forgotten": Loose,
114
- "turn.started": Loose.extend({ turn_id: z.string().max(128).optional(), prompt_chars: z.int().min(0).optional() }),
128
+ "turn.started": Loose.extend({
129
+ turn_id: z.string().max(128).optional(),
130
+ prompt_chars: z.int().min(0).optional(),
131
+ /** The harness's OWN word for who submitted the prompt, forwarded verbatim; not an enum
132
+ * of this spec (Claude Code: user, sdk, system, loop_wakeup, schedule_wakeup,
133
+ * poll_event), and a different vocabulary from session.started.source. A bare word:
134
+ * tier 0 is not redacted, so the shape is the only guard. */
135
+ submitted_by: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9_.-]{0,39}$/, "a bare word, at most 40 characters").optional(),
136
+ /** True when the prompt text is a block the harness wrote rather than words a person
137
+ * typed; never a claim that no person caused the turn. */
138
+ injected: z.boolean().optional()
139
+ }),
115
140
  "turn.ended": Loose.extend({
116
141
  turn_id: z.string().max(128).optional(),
117
142
  reason: z.enum(["stop", "interrupt", "error"]),
118
143
  /** The harness's error class when reason is error (rate_limit, overloaded, authentication_failed, server_error …). */
119
144
  error: z.string().max(200).optional(),
120
- ms: z.int().min(0).optional()
145
+ ms: z.int().min(0).optional(),
146
+ /** 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. */
147
+ background: z.int().min(0).optional()
121
148
  }),
122
149
  "turn.transcript": Loose.extend({
123
150
  turn: z.int().min(0),
@@ -167,6 +194,14 @@ var EventData = z.object({
167
194
  "subagent.started": Loose.extend({ agent_id: z.string().max(128), agent_type: z.string().max(128).optional() }),
168
195
  "subagent.ended": Loose.extend({ agent_id: z.string().max(128), agent_type: z.string().max(128).optional() }),
169
196
  "context.compacted": Loose.extend({ trigger: z.enum(["manual", "auto"]) }),
197
+ /** The account's usage limits as the harness last reported them: one per window. */
198
+ "limits.observed": Loose.extend({
199
+ windows: z.array(LimitWindow).min(1).max(8),
200
+ plan: z.string().max(64).optional(),
201
+ /** The account the numbers belong to, as `session.account_id` spells it, when the
202
+ * session was served by another account than its own (the pool, CONTROL.md §2). */
203
+ account_id: z.string().max(128).optional()
204
+ }),
170
205
  native: Loose
171
206
  });
172
207
  var Batch = z.object({ events: z.array(Event).min(1).max(50) });
@@ -185,8 +220,25 @@ var Capability = z.enum(["events", "backfill", "forget", "control", "native"]);
185
220
  var B64Url = z.string().regex(/^[A-Za-z0-9_-]*$/, "base64url, no padding");
186
221
  var MachineId = z.string().regex(/^m_[A-Za-z0-9_-]{16,40}$/, "m_ + 16\u201340 base64url");
187
222
  var SessionRef = z.string().regex(/^[a-z][a-z0-9-]{0,39}:[A-Za-z0-9._:-]{1,128}$/, "<harness>:<session id>");
188
- var ControlKind = z.enum(["prompt", "permission.answer", "cancel", "start", "key.add"]);
223
+ var ControlKind = z.enum(["prompt", "permission.answer", "cancel", "start", "key.add", "pool"]);
224
+ var PoolAction = z.enum([
225
+ "on",
226
+ "off",
227
+ "enable",
228
+ "disable",
229
+ "remove",
230
+ "order",
231
+ "refresh",
232
+ "login.begin",
233
+ "login.complete"
234
+ ]);
235
+ var PoolAccountId = z.string().regex(/^[A-Za-z0-9._:-]{1,128}$/, "an account id");
236
+ var KeyTypes = z.array(z.enum(["passkey", "device"])).min(1).max(2);
189
237
  var DeliveryMode = z.enum(["sdk", "waiter", "turn", "api", "resume", "fork"]);
238
+ var StartPermission = z.enum(["read", "safe", "edits", "auto"]);
239
+ var RunLevel = z.enum(["read", "safe", "edits", "auto", "inherit"]);
240
+ var ModelId = z.string().min(1).max(100).regex(/^[A-Za-z0-9][A-Za-z0-9._:/@[\]-]*$/, "a model id");
241
+ var HarnessName = z.string().regex(/^[a-z][a-z0-9-]{0,39}$/);
190
242
  var ControlFile = z.object({
191
243
  /** Written as is (NFC) into the session's folder: no slash, backslash or control
192
244
  * character, not starting with a dot. */
@@ -215,20 +267,33 @@ var ControlCommand = z.object({
215
267
  decision: z.enum(["allow", "deny"]).optional(),
216
268
  /** Shown to the model beside a decision. */
217
269
  note: z.string().max(2e3).optional(),
218
- /** start: the absolute folder the new session runs in. */
270
+ /** start: the folder the new session runs in: absolute, or `~` / `~/…` under the
271
+ * home of the user the machine's daemon runs as, as events write it. */
219
272
  cwd: z.string().max(1024).optional(),
220
- /** key.add (session `sessionpipe:keys`): the new device's passkey, which the machine
221
- * trusts once a key it already trusts signed this command. */
222
- key: z.object({
223
- id: z.string().regex(/^[A-Za-z0-9_-]{16,1400}$/),
224
- alg: z.union([z.literal(-7), z.literal(-257)]),
225
- spki: z.string().regex(/^[A-Za-z0-9_-]{40,2000}$/)
226
- }).optional(),
273
+ /** key.add (session `sessionpipe:keys`): the new device's key (a passkey or a device
274
+ * key, control-key.json), which the machine trusts once a key it already trusts
275
+ * signed this command. */
276
+ key: z.lazy(() => ControlKey).optional(),
227
277
  /** key.add: what the person calls the device. */
228
278
  name: z.string().min(1).max(80).optional(),
229
- /** start only: 1–10 files, together at most 50 MiB, downloaded and checked by hash
230
- * before the session starts. */
279
+ /** start, prompt: 1–10 files, together at most 50 MiB, downloaded and checked by hash
280
+ * before the session starts or the message is delivered. On a prompt, only to a
281
+ * machine whose hello says `prompt_files`. */
231
282
  files: z.array(ControlFile).min(1).max(10).optional(),
283
+ /** start only: the level the new session runs at, at most the machine's mode. Send
284
+ * it only to a machine whose hello advertises it for the harness (`start`). */
285
+ permission: StartPermission.optional(),
286
+ /** start only: the model the harness runs. As `permission`: only when advertised. */
287
+ model: ModelId.optional(),
288
+ /** pool (session `sessionpipe:pool`): what to do with the machine's account pool.
289
+ * Each action takes exactly the fields CONTROL.md §6 `pool` lists for it. */
290
+ pool_action: PoolAction.optional(),
291
+ /** enable, disable, remove, login.complete (the pending sign-in's id); refresh MAY. */
292
+ pool_account: PoolAccountId.optional(),
293
+ /** order: every account of the pool, once each, in the order wanted. */
294
+ pool_order: z.array(PoolAccountId).min(1).max(20).meta({ uniqueItems: true }).optional(),
295
+ /** login.complete: what the person pasted back from the sign-in page (`code#state`). */
296
+ pool_code: z.string().min(1).max(512).regex(/^[^\r\n]+$/, "one line").optional(),
232
297
  /** At least 16 random bytes, base64url. */
233
298
  nonce: z.string().regex(/^[A-Za-z0-9_-]{22,64}$/),
234
299
  /** Epoch ms, the signing device's clock. */
@@ -250,11 +315,29 @@ var ControlAssertion = z.object({
250
315
  cd: B64Url.min(1),
251
316
  sig: B64Url.min(1)
252
317
  });
253
- var ControlKey = z.object({
254
- id: B64Url.min(16).max(1400),
255
- alg: z.union([z.literal(-7), z.literal(-257)]),
256
- spki: B64Url.min(1)
318
+ var ControlDeviceSignature = z.strictObject({
319
+ cred: B64Url.min(1),
320
+ /** 64 bytes r‖s, base64url without padding. */
321
+ sig: B64Url.min(1)
257
322
  });
323
+ var ControlKey = z.xor([
324
+ z.strictObject({
325
+ id: B64Url.min(16).max(1400),
326
+ alg: z.union([z.literal(-7), z.literal(-257)]),
327
+ spki: B64Url.min(1)
328
+ }),
329
+ z.strictObject({
330
+ /** SHA-256 of the SPKI bytes, base64url without padding. */
331
+ id: z.string().regex(/^[A-Za-z0-9_-]{43}$/, "SHA-256 of the spki, base64url"),
332
+ alg: z.literal(-7),
333
+ spki: B64Url.min(1),
334
+ type: z.literal("device"),
335
+ /** The private key was made in a hardware key store and never leaves it. */
336
+ store: z.literal("hardware"),
337
+ /** The store will not sign without verifying the person, every time. */
338
+ uv: z.literal("each-use")
339
+ })
340
+ ]);
258
341
  var ControlMessage = z.object({
259
342
  /** The receiver's id for this message; the ack key. Not signed: the nonce inside cmd is. */
260
343
  id: Ulid,
@@ -262,10 +345,14 @@ var ControlMessage = z.object({
262
345
  cmd: z.string().min(1).max(48e3),
263
346
  /** The day key's ECDSA P-256 / SHA-256 signature over cmd: raw r‖s, base64url. */
264
347
  csig: B64Url.nullable().optional(),
265
- /** The grant vouching for the day key: its string plus the passkey's assertion over sha256(str). */
266
- grant: ControlAssertion.extend({ str: z.string().min(1).max(2e3) }).nullable().optional(),
267
- /** Instead of csig + grant: one passkey assertion over sha256(cmd). */
268
- confirm: ControlAssertion.nullable().optional(),
348
+ /** The grant vouching for the day key: its string plus the passkey's assertion over
349
+ * sha256(str), or a device key's signature over it (CONTROL.md §3.2). */
350
+ grant: z.xor([
351
+ ControlAssertion.extend({ str: z.string().min(1).max(2e3) }),
352
+ ControlDeviceSignature.extend({ str: z.string().min(1).max(2e3) })
353
+ ]).nullable().optional(),
354
+ /** Instead of csig + grant: one passkey assertion (or device signature) over sha256(cmd). */
355
+ confirm: z.xor([ControlAssertion, ControlDeviceSignature]).nullable().optional(),
269
356
  /** The receiver's clock. */
270
357
  at: Rfc3339,
271
358
  /** After this the machine MUST NOT act and acks `expired`; at most 24 h after `at`. */
@@ -284,20 +371,27 @@ var ControlAck = z.object({
284
371
  /** The session that took it, when not the one named (a fork's copy, a started session). */
285
372
  session: SessionRef.optional(),
286
373
  /** refused: the verifier's code, or the machine's own (`folder`, `no_attention`, `busy`);
287
- * failed: `file` when a start's attachment couldn't be fetched, checked or written. */
374
+ * failed: `file` when a start's attachment couldn't be fetched, checked or written,
375
+ * `model` when the harness wouldn't run the start's model. */
288
376
  code: z.string().regex(/^[a-z_]{1,40}$/).optional(),
289
377
  detail: z.string().max(500).optional(),
290
378
  /** resume / fork / start: the agent's reply, redacted by the secrets ruleset. */
291
379
  reply: z.string().max(2e4).optional(),
292
380
  /** progress only: rises with every progress ack for this id; a receiver keeps the highest. */
293
- seq: z.int().min(0).optional()
381
+ seq: z.int().min(0).optional(),
382
+ /** taken, delivered of a start: the options it ran with (`model` only when one was
383
+ * asked for). A receiver shows this, never what was asked. */
384
+ applied: z.strictObject({ permission: RunLevel.optional(), model: ModelId.optional() }).optional()
294
385
  })
295
386
  ).min(1)
296
387
  });
297
388
  var HarnessAccount = z.object({
298
389
  harness: z.string().regex(/^[a-z][a-z0-9-]{0,39}$/),
299
390
  id: z.string().min(1).max(128),
300
- email: z.string().max(254).optional()
391
+ email: z.string().max(254).optional(),
392
+ /** What to call an account that has no email: a Claude Code home that runs on
393
+ * another API is named by its endpoint's host (`api.z.ai`). */
394
+ name: z.string().min(1).max(200).optional()
301
395
  });
302
396
  var ControlPairStart = z.object({
303
397
  /** Open pairing: a random secret only this terminal knows. Status polls present it
@@ -312,14 +406,18 @@ var ControlPairStart = z.object({
312
406
  /** The folders the machine lets sessions run in, for the receiver's "new session"
313
407
  * picker. Informational: the machine checks its own list again. */
314
408
  folders: z.array(z.string().max(1024)).max(50).optional(),
315
- /** safe: nothing that needs approval runs unattended; auto: the harness's auto mode. */
316
- mode: z.enum(["safe", "auto"]).optional(),
409
+ /** safe: nothing that needs approval runs unattended; auto: the harness's auto mode;
410
+ * inherit: no permission flag, each harness's own default there. Chosen at the machine. */
411
+ mode: z.enum(["safe", "auto", "inherit"]).optional(),
317
412
  /** The harness accounts signed in here, so the receiver's board can name each
318
413
  * `session.account_id` (CONTROL.md §2). */
319
414
  accounts: z.array(HarnessAccount).max(20).optional(),
320
415
  /** The machine takes `files` on a start (downloads, checks and writes them). A
321
416
  * machine that doesn't say so may ignore them: a receiver SHOULD NOT send it files. */
322
- files: z.boolean().optional()
417
+ files: z.boolean().optional(),
418
+ /** The kinds of key this machine takes (unique; absent means `["passkey"]`). A
419
+ * client offers a device key only to a machine that lists `device`. */
420
+ key_types: KeyTypes.optional()
323
421
  });
324
422
  var ControlPairStarted = z.object({
325
423
  machine: MachineId,
@@ -331,8 +429,10 @@ var ControlPairStarted = z.object({
331
429
  });
332
430
  var ControlPaired = z.object({
333
431
  status: z.enum(["pending", "paired", "expired"]),
432
+ /** The key approved, whole: a device key keeps its type, store and uv. */
334
433
  key: ControlKey.optional(),
335
- proof: ControlAssertion.optional(),
434
+ /** The key's proof: a passkey assertion, or a device signature for purpose `pair`. */
435
+ proof: z.xor([ControlAssertion, ControlDeviceSignature]).optional(),
336
436
  /** The machine's own bearer for polls, acks and hello: opens nothing else. Minted
337
437
  * once, at the first pairing of a machine. */
338
438
  token: z.string().min(16).max(256).optional(),
@@ -343,6 +443,33 @@ var ControlPaired = z.object({
343
443
  * say whose passkey it now trusts. */
344
444
  account: z.string().max(200).optional()
345
445
  });
446
+ var PoolAccount = z.object({
447
+ id: PoolAccountId,
448
+ email: z.string().max(254).optional(),
449
+ /** What the person calls it, when they named it. */
450
+ label: z.string().min(1).max(80).optional(),
451
+ enabled: z.boolean(),
452
+ /** ready: has room; limited: every window the pool watches is used up until `until`;
453
+ * error: needs the person (sign in again); disabled: turned off by the person. */
454
+ status: z.enum(["ready", "limited", "error", "disabled"]),
455
+ /** Serving new sessions right now. At most one account says so. */
456
+ current: z.boolean().optional(),
457
+ /** limited: when it has room again, where the machine knows. */
458
+ until: Rfc3339.optional(),
459
+ /** The account's freshest numbers, as limits.observed would carry them: from the
460
+ * idle usage poll when no session asked recently, since an idle account's numbers
461
+ * ride on no session and would reach no receiver otherwise. */
462
+ windows: z.array(LimitWindow).min(1).max(8).optional(),
463
+ /** limited or error only: what took the account out. A window's id (`seven_day`), or
464
+ * `rejected` (the vendor's status) or `error` (sign in again) for the non-window causes. */
465
+ limited_by: z.string().regex(/^[a-z0-9_]{1,64}$/).optional()
466
+ });
467
+ var ControlHelloPool = z.object({
468
+ on: z.boolean(),
469
+ /** The harness the pool serves. Only `claude-code` today. */
470
+ harness: HarnessName,
471
+ accounts: z.array(PoolAccount).max(20)
472
+ });
346
473
  var ControlHello = z.object({
347
474
  name: z.string().min(1).max(80),
348
475
  harnesses: z.array(z.string().regex(/^[a-z][a-z0-9-]{0,39}$/)).max(20),
@@ -354,11 +481,35 @@ var ControlHello = z.object({
354
481
  waiting: z.array(SessionRef).max(500).optional(),
355
482
  /** As in control-pair.json: informational, re-checked on the machine. */
356
483
  folders: z.array(z.string().max(1024)).max(50).optional(),
357
- mode: z.enum(["safe", "auto"]).optional(),
484
+ mode: z.enum(["safe", "auto", "inherit"]).optional(),
358
485
  /** As in control-pair.json: read again for every hello, so a new sign-in is named. */
359
486
  accounts: z.array(HarnessAccount).max(20).optional(),
360
487
  /** As in control-pair.json. */
361
- files: z.boolean().optional()
488
+ files: z.boolean().optional(),
489
+ /** The machine takes `files` on a prompt too (CONTROL.md §6 `prompt`). One that
490
+ * doesn't say so refuses them: a receiver SHOULD NOT send it a prompt with files. */
491
+ prompt_files: z.boolean().optional(),
492
+ /** Per harness in `harnesses`: the options a start may carry (CONTROL.md §2). No
493
+ * entry: neither `permission` nor `model`. */
494
+ start: z.record(
495
+ HarnessName,
496
+ z.object({
497
+ /** The levels it starts at here, already capped by `mode`. */
498
+ permissions: z.array(StartPermission).min(1).max(4).meta({ uniqueItems: true }),
499
+ /** What a start that names none gets: one of `permissions`, or `inherit` on an
500
+ * inherit machine. */
501
+ permission: RunLevel,
502
+ /** Model ids the harness offers here: a suggestion, not a promise. */
503
+ models: z.array(ModelId).max(50).optional(),
504
+ /** Any well-formed model is passed to the harness (which may still reject it). */
505
+ any_model: z.boolean().optional()
506
+ })
507
+ ).refine((o) => Object.keys(o).length <= 50, "at most 50 harnesses").meta({ maxProperties: 50 }).optional(),
508
+ /** As in control-pair.json. */
509
+ key_types: KeyTypes.optional(),
510
+ /** The machine's account pool, when its daemon has one; sent again the moment the
511
+ * pool changes. A hello without it is a daemon that predates the pool. */
512
+ pool: ControlHelloPool.optional()
362
513
  });
363
514
  var WellKnown = z.object({
364
515
  protocol: z.array(z.int().min(1)).min(1),
@@ -381,11 +532,17 @@ var WellKnown = z.object({
381
532
  /** How commands are signed: the WebAuthn rp id keys are enrolled for, and the algorithms. */
382
533
  signing: z.object({
383
534
  rp_id: z.string().min(1).max(253),
384
- algs: z.array(z.union([z.literal(-7), z.literal(-257)])).min(1)
535
+ algs: z.array(z.union([z.literal(-7), z.literal(-257)])).min(1),
536
+ /** The kinds of key the receiver stores and carries whole (CONTROL.md §2).
537
+ * Absent means `["passkey"]`. */
538
+ key_types: KeyTypes.optional()
385
539
  }),
386
540
  /** Informational: the receiver accepts `files` on a start and serves
387
541
  * `GET {control}/files/{sha256}`. */
388
- files: z.boolean().optional()
542
+ files: z.boolean().optional(),
543
+ /** The receiver shows a machine in `inherit` mode as that, never as safe or auto.
544
+ * A daemon pairs in, or switches to, `inherit` only with receivers that say so. */
545
+ inherit: z.boolean().optional()
389
546
  }).optional()
390
547
  });
391
548
  var SCHEMAS = {
@@ -414,9 +571,11 @@ export {
414
571
  ControlAck,
415
572
  ControlAssertion,
416
573
  ControlCommand,
574
+ ControlDeviceSignature,
417
575
  ControlFile,
418
576
  ControlGrant,
419
577
  ControlHello,
578
+ ControlHelloPool,
420
579
  ControlKey,
421
580
  ControlKind,
422
581
  ControlMessage,
@@ -434,14 +593,22 @@ export {
434
593
  Harness,
435
594
  HarnessAccount,
436
595
  KNOWN_TYPES,
596
+ KeyTypes,
597
+ LimitWindow,
437
598
  MachineId,
599
+ ModelId,
438
600
  PROTOCOL,
601
+ PoolAccount,
602
+ PoolAccountId,
603
+ PoolAction,
439
604
  Privacy,
440
605
  Rfc3339,
606
+ RunLevel,
441
607
  SCHEMAS,
442
608
  Session,
443
609
  SessionId,
444
610
  SessionRef,
611
+ StartPermission,
445
612
  TYPE_TIER,
446
613
  Tier,
447
614
  ToolName,
@@ -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 \"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 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 parent_id: SessionId.nullable().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\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({ turn_id: z.string().max(128).optional(), prompt_chars: z.int().min(0).optional() }),\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 }),\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({ agent_id: z.string().max(128), agent_type: z.string().max(128).optional() }),\n \"context.compacted\": Loose.extend({ trigger: z.enum([\"manual\", \"auto\"]) }),\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\"]);\nexport const DeliveryMode = z.enum([\"sdk\", \"waiter\", \"turn\", \"api\", \"resume\", \"fork\"]);\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 absolute folder the new session runs in. */\n cwd: z.string().max(1024).optional(),\n /** key.add (session `sessionpipe:keys`): the new device's passkey, which the machine\n * trusts once a key it already trusts signed this command. */\n key: z\n .object({\n id: z.string().regex(/^[A-Za-z0-9_-]{16,1400}$/),\n alg: z.union([z.literal(-7), z.literal(-257)]),\n spki: z.string().regex(/^[A-Za-z0-9_-]{40,2000}$/),\n })\n .optional(),\n /** key.add: what the person calls the device. */\n name: z.string().min(1).max(80).optional(),\n /** start only: 1\u201310 files, together at most 50 MiB, downloaded and checked by hash\n * before the session starts. */\n files: z.array(ControlFile).min(1).max(10).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 key enrolled on a machine: a passkey's credential id, COSE alg, SPKI. */\nexport const ControlKey = z.object({\n id: B64Url.min(16).max(1400),\n alg: z.union([z.literal(-7), z.literal(-257)]),\n spki: B64Url.min(1),\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 sha256(str). */\n grant: ControlAssertion.extend({ str: z.string().min(1).max(2000) })\n .nullable()\n .optional(),\n /** Instead of csig + grant: one passkey assertion over sha256(cmd). */\n confirm: ControlAssertion.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 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 }),\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});\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 mode: z.enum([\"safe\", \"auto\"]).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});\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 key: ControlKey.optional(),\n proof: ControlAssertion.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/** `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\"]).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});\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 }),\n /** Informational: the receiver accepts `files` on a start and serves\n * `GET {control}/files/{sha256}`. */\n files: 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,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,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 \"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({ agent_id: z.string().max(128), agent_type: z.string().max(128).optional() }),\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,E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