sessionpipe-core 0.10.0 → 0.12.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 (39) hide show
  1. package/dist/control.js +61 -3
  2. package/dist/control.js.map +2 -2
  3. package/dist/index.js +2519 -1848
  4. package/dist/index.js.map +4 -4
  5. package/dist/schema/v1.d.ts +179 -1
  6. package/dist/schema/v1.d.ts.map +1 -1
  7. package/dist/schema.js +81 -4
  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/claude-code-control.d.ts.map +1 -1
  12. package/dist/src/adapters/claude-code-pool.d.ts +116 -0
  13. package/dist/src/adapters/claude-code-pool.d.ts.map +1 -0
  14. package/dist/src/adapters/claude-code.d.ts +26 -1
  15. package/dist/src/adapters/claude-code.d.ts.map +1 -1
  16. package/dist/src/adapters/claude-shaped.d.ts +3 -0
  17. package/dist/src/adapters/claude-shaped.d.ts.map +1 -1
  18. package/dist/src/adapters/codex-config.d.ts +2 -1
  19. package/dist/src/adapters/codex-config.d.ts.map +1 -1
  20. package/dist/src/adapters/codex-control.d.ts.map +1 -1
  21. package/dist/src/adapters/codex.d.ts +9 -0
  22. package/dist/src/adapters/codex.d.ts.map +1 -1
  23. package/dist/src/adapters/gemini-cli.d.ts +4 -0
  24. package/dist/src/adapters/gemini-cli.d.ts.map +1 -1
  25. package/dist/src/adapters/headless.d.ts +23 -0
  26. package/dist/src/adapters/headless.d.ts.map +1 -1
  27. package/dist/src/adapters/types.d.ts +18 -1
  28. package/dist/src/adapters/types.d.ts.map +1 -1
  29. package/dist/src/config.d.ts +6 -0
  30. package/dist/src/config.d.ts.map +1 -1
  31. package/dist/src/control/verify.d.ts +27 -1
  32. package/dist/src/control/verify.d.ts.map +1 -1
  33. package/dist/src/index.d.ts +1 -0
  34. package/dist/src/index.d.ts.map +1 -1
  35. package/dist/src/privacy/filter.d.ts.map +1 -1
  36. package/dist/src/types.d.ts +4 -0
  37. package/dist/src/types.d.ts.map +1 -1
  38. package/dist/version.js +1 -1
  39. package/package.json +2 -2
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  export declare const PROTOCOL = 1;
3
3
  /** Dotted, lowercase. Unknown types MUST be accepted and stored. */
4
4
  export declare const EventType: z.ZodString;
5
- export declare const KNOWN_TYPES: readonly ["session.started", "session.heartbeat", "session.ended", "session.backfill", "session.forgotten", "turn.started", "turn.ended", "turn.transcript", "turn.progress", "tool.started", "tool.ended", "files.changed", "attention.needed", "attention.cleared", "subagent.started", "subagent.ended", "context.compacted", "native"];
5
+ export declare const KNOWN_TYPES: readonly ["session.started", "session.heartbeat", "session.ended", "session.backfill", "session.forgotten", "turn.started", "turn.ended", "turn.transcript", "turn.progress", "tool.started", "tool.ended", "files.changed", "attention.needed", "attention.cleared", "subagent.started", "subagent.ended", "context.compacted", "limits.observed", "native"];
6
6
  /** The lowest tier that carries each known type. */
7
7
  export declare const TYPE_TIER: Record<(typeof KNOWN_TYPES)[number], 0 | 1 | 2 | 3>;
8
8
  export declare const HARNESS_NAMES: readonly ["claude-code", "codex", "gemini-cli", "antigravity", "devin", "cursor", "copilot-cli", "droid", "kiro", "opencode"];
@@ -84,6 +84,14 @@ export declare const AttentionKind: z.ZodEnum<{
84
84
  permission: "permission";
85
85
  question: "question";
86
86
  }>;
87
+ /** One usage window of an account: `id` is the harness's own name for it (`five_hour`,
88
+ * `seven_day`, `primary` …); `used_percent` passes 100 once a spend limit is exceeded. */
89
+ export declare const LimitWindow: z.ZodObject<{
90
+ id: z.ZodString;
91
+ used_percent: z.ZodNumber;
92
+ resets_at: z.ZodOptional<z.ZodISODateTime>;
93
+ window_minutes: z.ZodOptional<z.ZodInt>;
94
+ }, z.core.$loose>;
87
95
  export declare const EventData: z.ZodObject<{
88
96
  "session.started": z.ZodObject<{
89
97
  source: z.ZodEnum<{
@@ -188,6 +196,7 @@ export declare const EventData: z.ZodObject<{
188
196
  "subagent.ended": z.ZodObject<{
189
197
  agent_id: z.ZodString;
190
198
  agent_type: z.ZodOptional<z.ZodString>;
199
+ background: z.ZodOptional<z.ZodInt>;
191
200
  }, z.core.$loose>;
192
201
  "context.compacted": z.ZodObject<{
193
202
  trigger: z.ZodEnum<{
@@ -195,6 +204,16 @@ export declare const EventData: z.ZodObject<{
195
204
  manual: "manual";
196
205
  }>;
197
206
  }, z.core.$loose>;
207
+ "limits.observed": z.ZodObject<{
208
+ windows: z.ZodArray<z.ZodObject<{
209
+ id: z.ZodString;
210
+ used_percent: z.ZodNumber;
211
+ resets_at: z.ZodOptional<z.ZodISODateTime>;
212
+ window_minutes: z.ZodOptional<z.ZodInt>;
213
+ }, z.core.$loose>>;
214
+ plan: z.ZodOptional<z.ZodString>;
215
+ account_id: z.ZodOptional<z.ZodString>;
216
+ }, z.core.$loose>;
198
217
  native: z.ZodObject<{}, z.core.$loose>;
199
218
  }, z.core.$strip>;
200
219
  export declare const Batch: z.ZodObject<{
@@ -264,9 +283,25 @@ export declare const ControlKind: z.ZodEnum<{
264
283
  cancel: "cancel";
265
284
  "key.add": "key.add";
266
285
  "permission.answer": "permission.answer";
286
+ pool: "pool";
267
287
  prompt: "prompt";
268
288
  start: "start";
269
289
  }>;
290
+ /** What a `pool` command asks of the machine's account pool (CONTROL.md §6 `pool`). */
291
+ export declare const PoolAction: z.ZodEnum<{
292
+ disable: "disable";
293
+ enable: "enable";
294
+ "login.begin": "login.begin";
295
+ "login.complete": "login.complete";
296
+ off: "off";
297
+ on: "on";
298
+ order: "order";
299
+ refresh: "refresh";
300
+ remove: "remove";
301
+ }>;
302
+ /** A pooled account's id: what `session.account_id` and `limits.observed.account_id`
303
+ * carry for it (Claude Code: the account UUID), or a pending sign-in's id. */
304
+ export declare const PoolAccountId: z.ZodString;
270
305
  /** The kinds of key a machine or a receiver handles (CONTROL.md §2). Absent: passkeys only. */
271
306
  export declare const KeyTypes: z.ZodArray<z.ZodEnum<{
272
307
  device: "device";
@@ -320,6 +355,7 @@ export declare const ControlCommand: z.ZodObject<{
320
355
  cancel: "cancel";
321
356
  "key.add": "key.add";
322
357
  "permission.answer": "permission.answer";
358
+ pool: "pool";
323
359
  prompt: "prompt";
324
360
  start: "start";
325
361
  }>;
@@ -358,6 +394,20 @@ export declare const ControlCommand: z.ZodObject<{
358
394
  safe: "safe";
359
395
  }>>;
360
396
  model: z.ZodOptional<z.ZodString>;
397
+ pool_action: z.ZodOptional<z.ZodEnum<{
398
+ disable: "disable";
399
+ enable: "enable";
400
+ "login.begin": "login.begin";
401
+ "login.complete": "login.complete";
402
+ off: "off";
403
+ on: "on";
404
+ order: "order";
405
+ refresh: "refresh";
406
+ remove: "remove";
407
+ }>>;
408
+ pool_account: z.ZodOptional<z.ZodString>;
409
+ pool_order: z.ZodOptional<z.ZodArray<z.ZodString>>;
410
+ pool_code: z.ZodOptional<z.ZodString>;
361
411
  nonce: z.ZodString;
362
412
  iat: z.ZodInt;
363
413
  }, z.core.$strip>;
@@ -594,6 +644,58 @@ export declare const ControlPaired: z.ZodObject<{
594
644
  sink_token: z.ZodOptional<z.ZodString>;
595
645
  account: z.ZodOptional<z.ZodString>;
596
646
  }, z.core.$strip>;
647
+ /** One account in the machine's pool, as its hello lists it (CONTROL.md §2 `pool`).
648
+ * `id` is the string `session.account_id` and `limits.observed.account_id` carry, so
649
+ * a receiver joins the three without a map. The email travels only here. */
650
+ export declare const PoolAccount: z.ZodObject<{
651
+ id: z.ZodString;
652
+ email: z.ZodOptional<z.ZodString>;
653
+ label: z.ZodOptional<z.ZodString>;
654
+ enabled: z.ZodBoolean;
655
+ status: z.ZodEnum<{
656
+ disabled: "disabled";
657
+ error: "error";
658
+ limited: "limited";
659
+ ready: "ready";
660
+ }>;
661
+ current: z.ZodOptional<z.ZodBoolean>;
662
+ until: z.ZodOptional<z.ZodISODateTime>;
663
+ windows: z.ZodOptional<z.ZodArray<z.ZodObject<{
664
+ id: z.ZodString;
665
+ used_percent: z.ZodNumber;
666
+ resets_at: z.ZodOptional<z.ZodISODateTime>;
667
+ window_minutes: z.ZodOptional<z.ZodInt>;
668
+ }, z.core.$loose>>>;
669
+ limited_by: z.ZodOptional<z.ZodString>;
670
+ }, z.core.$strip>;
671
+ /** The machine's account pool (CONTROL.md §2 `pool`): present in EVERY hello of a daemon
672
+ * that knows the pool (`on: false`, `accounts: []` when nothing is set up), so a
673
+ * receiver tells "no pool" from "an old daemon"; `accounts` in the machine's order. */
674
+ export declare const ControlHelloPool: z.ZodObject<{
675
+ on: z.ZodBoolean;
676
+ harness: z.ZodString;
677
+ accounts: z.ZodArray<z.ZodObject<{
678
+ id: z.ZodString;
679
+ email: z.ZodOptional<z.ZodString>;
680
+ label: z.ZodOptional<z.ZodString>;
681
+ enabled: z.ZodBoolean;
682
+ status: z.ZodEnum<{
683
+ disabled: "disabled";
684
+ error: "error";
685
+ limited: "limited";
686
+ ready: "ready";
687
+ }>;
688
+ current: z.ZodOptional<z.ZodBoolean>;
689
+ until: z.ZodOptional<z.ZodISODateTime>;
690
+ windows: z.ZodOptional<z.ZodArray<z.ZodObject<{
691
+ id: z.ZodString;
692
+ used_percent: z.ZodNumber;
693
+ resets_at: z.ZodOptional<z.ZodISODateTime>;
694
+ window_minutes: z.ZodOptional<z.ZodInt>;
695
+ }, z.core.$loose>>>;
696
+ limited_by: z.ZodOptional<z.ZodString>;
697
+ }, z.core.$strip>>;
698
+ }, z.core.$strip>;
597
699
  /** `POST {control}/hello`: what the machine can do right now. */
598
700
  export declare const ControlHello: z.ZodObject<{
599
701
  name: z.ZodString;
@@ -644,6 +746,31 @@ export declare const ControlHello: z.ZodObject<{
644
746
  device: "device";
645
747
  passkey: "passkey";
646
748
  }>>>;
749
+ pool: z.ZodOptional<z.ZodObject<{
750
+ on: z.ZodBoolean;
751
+ harness: z.ZodString;
752
+ accounts: z.ZodArray<z.ZodObject<{
753
+ id: z.ZodString;
754
+ email: z.ZodOptional<z.ZodString>;
755
+ label: z.ZodOptional<z.ZodString>;
756
+ enabled: z.ZodBoolean;
757
+ status: z.ZodEnum<{
758
+ disabled: "disabled";
759
+ error: "error";
760
+ limited: "limited";
761
+ ready: "ready";
762
+ }>;
763
+ current: z.ZodOptional<z.ZodBoolean>;
764
+ until: z.ZodOptional<z.ZodISODateTime>;
765
+ windows: z.ZodOptional<z.ZodArray<z.ZodObject<{
766
+ id: z.ZodString;
767
+ used_percent: z.ZodNumber;
768
+ resets_at: z.ZodOptional<z.ZodISODateTime>;
769
+ window_minutes: z.ZodOptional<z.ZodInt>;
770
+ }, z.core.$loose>>>;
771
+ limited_by: z.ZodOptional<z.ZodString>;
772
+ }, z.core.$strip>>;
773
+ }, z.core.$strip>>;
647
774
  }, z.core.$strip>;
648
775
  export declare const WellKnown: z.ZodObject<{
649
776
  protocol: z.ZodArray<z.ZodInt>;
@@ -820,6 +947,7 @@ export declare const SCHEMAS: {
820
947
  "subagent.ended": z.ZodObject<{
821
948
  agent_id: z.ZodString;
822
949
  agent_type: z.ZodOptional<z.ZodString>;
950
+ background: z.ZodOptional<z.ZodInt>;
823
951
  }, z.core.$loose>;
824
952
  "context.compacted": z.ZodObject<{
825
953
  trigger: z.ZodEnum<{
@@ -827,6 +955,16 @@ export declare const SCHEMAS: {
827
955
  manual: "manual";
828
956
  }>;
829
957
  }, z.core.$loose>;
958
+ "limits.observed": z.ZodObject<{
959
+ windows: z.ZodArray<z.ZodObject<{
960
+ id: z.ZodString;
961
+ used_percent: z.ZodNumber;
962
+ resets_at: z.ZodOptional<z.ZodISODateTime>;
963
+ window_minutes: z.ZodOptional<z.ZodInt>;
964
+ }, z.core.$loose>>;
965
+ plan: z.ZodOptional<z.ZodString>;
966
+ account_id: z.ZodOptional<z.ZodString>;
967
+ }, z.core.$loose>;
830
968
  native: z.ZodObject<{}, z.core.$loose>;
831
969
  }, z.core.$strip>;
832
970
  readonly batch: z.ZodObject<{
@@ -949,6 +1087,7 @@ export declare const SCHEMAS: {
949
1087
  cancel: "cancel";
950
1088
  "key.add": "key.add";
951
1089
  "permission.answer": "permission.answer";
1090
+ pool: "pool";
952
1091
  prompt: "prompt";
953
1092
  start: "start";
954
1093
  }>;
@@ -987,6 +1126,20 @@ export declare const SCHEMAS: {
987
1126
  safe: "safe";
988
1127
  }>>;
989
1128
  model: z.ZodOptional<z.ZodString>;
1129
+ pool_action: z.ZodOptional<z.ZodEnum<{
1130
+ disable: "disable";
1131
+ enable: "enable";
1132
+ "login.begin": "login.begin";
1133
+ "login.complete": "login.complete";
1134
+ off: "off";
1135
+ on: "on";
1136
+ order: "order";
1137
+ refresh: "refresh";
1138
+ remove: "remove";
1139
+ }>>;
1140
+ pool_account: z.ZodOptional<z.ZodString>;
1141
+ pool_order: z.ZodOptional<z.ZodArray<z.ZodString>>;
1142
+ pool_code: z.ZodOptional<z.ZodString>;
990
1143
  nonce: z.ZodString;
991
1144
  iat: z.ZodInt;
992
1145
  }, z.core.$strip>;
@@ -1196,6 +1349,31 @@ export declare const SCHEMAS: {
1196
1349
  device: "device";
1197
1350
  passkey: "passkey";
1198
1351
  }>>>;
1352
+ pool: z.ZodOptional<z.ZodObject<{
1353
+ on: z.ZodBoolean;
1354
+ harness: z.ZodString;
1355
+ accounts: z.ZodArray<z.ZodObject<{
1356
+ id: z.ZodString;
1357
+ email: z.ZodOptional<z.ZodString>;
1358
+ label: z.ZodOptional<z.ZodString>;
1359
+ enabled: z.ZodBoolean;
1360
+ status: z.ZodEnum<{
1361
+ disabled: "disabled";
1362
+ error: "error";
1363
+ limited: "limited";
1364
+ ready: "ready";
1365
+ }>;
1366
+ current: z.ZodOptional<z.ZodBoolean>;
1367
+ until: z.ZodOptional<z.ZodISODateTime>;
1368
+ windows: z.ZodOptional<z.ZodArray<z.ZodObject<{
1369
+ id: z.ZodString;
1370
+ used_percent: z.ZodNumber;
1371
+ resets_at: z.ZodOptional<z.ZodISODateTime>;
1372
+ window_minutes: z.ZodOptional<z.ZodInt>;
1373
+ }, z.core.$loose>>>;
1374
+ limited_by: z.ZodOptional<z.ZodString>;
1375
+ }, z.core.$strip>>;
1376
+ }, z.core.$strip>>;
1199
1377
  }, z.core.$strip>;
1200
1378
  };
1201
1379
  //# sourceMappingURL=v1.d.ts.map
@@ -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,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAmBzE,CAAC;AAEF,eAAO,MAAM,aAAa,YACxB,aAAa,EACb,OAAO,EACP,YAAY,EACZ,aAAa,EACb,OAAO,EACP,QAAQ,EACR,aAAa,EACb,OAAO,EACP,MAAM,EACN,UAAU,CACF,CAAC;AAEX,eAAO,MAAM,IAAI,UAAwB,CAAC;AAC1C,eAAO,MAAM,IAAI,aAAuD,CAAC;AACzE,eAAO,MAAM,OAAO,kBAAkD,CAAC;AACvE,eAAO,MAAM,SAAS,aAIQ,CAAC;AAC/B,eAAO,MAAM,QAAQ,aAA+C,CAAC;AAErE,eAAO,MAAM,OAAO;;;;iBAMlB,CAAC;AAEH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;iBA0BlB,CAAC;AAEH,eAAO,MAAM,O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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.10.0 · Apache-2.0 · https://sessionpipe.org
1
+ // sessionpipe-core 0.12.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 = [
@@ -111,6 +113,12 @@ var Event = z.object({
111
113
  });
112
114
  var Loose = z.object({}).loose();
113
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
+ });
114
122
  var EventData = z.object({
115
123
  "session.started": Loose.extend({ source: z.enum(["startup", "resume", "clear", "compact", "fork", "unknown"]) }),
116
124
  "session.heartbeat": Loose,
@@ -184,8 +192,21 @@ var EventData = z.object({
184
192
  how: z.enum(["answered", "cancelled", "timeout", "unknown"])
185
193
  }),
186
194
  "subagent.started": Loose.extend({ agent_id: z.string().max(128), agent_type: z.string().max(128).optional() }),
187
- "subagent.ended": Loose.extend({ agent_id: z.string().max(128), agent_type: z.string().max(128).optional() }),
195
+ "subagent.ended": Loose.extend({
196
+ agent_id: z.string().max(128),
197
+ agent_type: z.string().max(128).optional(),
198
+ /** 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. */
199
+ background: z.int().min(0).optional()
200
+ }),
188
201
  "context.compacted": Loose.extend({ trigger: z.enum(["manual", "auto"]) }),
202
+ /** The account's usage limits as the harness last reported them: one per window. */
203
+ "limits.observed": Loose.extend({
204
+ windows: z.array(LimitWindow).min(1).max(8),
205
+ plan: z.string().max(64).optional(),
206
+ /** The account the numbers belong to, as `session.account_id` spells it, when the
207
+ * session was served by another account than its own (the pool, CONTROL.md §2). */
208
+ account_id: z.string().max(128).optional()
209
+ }),
189
210
  native: Loose
190
211
  });
191
212
  var Batch = z.object({ events: z.array(Event).min(1).max(50) });
@@ -204,7 +225,19 @@ var Capability = z.enum(["events", "backfill", "forget", "control", "native"]);
204
225
  var B64Url = z.string().regex(/^[A-Za-z0-9_-]*$/, "base64url, no padding");
205
226
  var MachineId = z.string().regex(/^m_[A-Za-z0-9_-]{16,40}$/, "m_ + 16\u201340 base64url");
206
227
  var SessionRef = z.string().regex(/^[a-z][a-z0-9-]{0,39}:[A-Za-z0-9._:-]{1,128}$/, "<harness>:<session id>");
207
- var ControlKind = z.enum(["prompt", "permission.answer", "cancel", "start", "key.add"]);
228
+ var ControlKind = z.enum(["prompt", "permission.answer", "cancel", "start", "key.add", "pool"]);
229
+ var PoolAction = z.enum([
230
+ "on",
231
+ "off",
232
+ "enable",
233
+ "disable",
234
+ "remove",
235
+ "order",
236
+ "refresh",
237
+ "login.begin",
238
+ "login.complete"
239
+ ]);
240
+ var PoolAccountId = z.string().regex(/^[A-Za-z0-9._:-]{1,128}$/, "an account id");
208
241
  var KeyTypes = z.array(z.enum(["passkey", "device"])).min(1).max(2);
209
242
  var DeliveryMode = z.enum(["sdk", "waiter", "turn", "api", "resume", "fork"]);
210
243
  var StartPermission = z.enum(["read", "safe", "edits", "auto"]);
@@ -257,6 +290,15 @@ var ControlCommand = z.object({
257
290
  permission: StartPermission.optional(),
258
291
  /** start only: the model the harness runs. As `permission`: only when advertised. */
259
292
  model: ModelId.optional(),
293
+ /** pool (session `sessionpipe:pool`): what to do with the machine's account pool.
294
+ * Each action takes exactly the fields CONTROL.md §6 `pool` lists for it. */
295
+ pool_action: PoolAction.optional(),
296
+ /** enable, disable, remove, login.complete (the pending sign-in's id); refresh MAY. */
297
+ pool_account: PoolAccountId.optional(),
298
+ /** order: every account of the pool, once each, in the order wanted. */
299
+ pool_order: z.array(PoolAccountId).min(1).max(20).meta({ uniqueItems: true }).optional(),
300
+ /** login.complete: what the person pasted back from the sign-in page (`code#state`). */
301
+ pool_code: z.string().min(1).max(512).regex(/^[^\r\n]+$/, "one line").optional(),
260
302
  /** At least 16 random bytes, base64url. */
261
303
  nonce: z.string().regex(/^[A-Za-z0-9_-]{22,64}$/),
262
304
  /** Epoch ms, the signing device's clock. */
@@ -406,6 +448,33 @@ var ControlPaired = z.object({
406
448
  * say whose passkey it now trusts. */
407
449
  account: z.string().max(200).optional()
408
450
  });
451
+ var PoolAccount = z.object({
452
+ id: PoolAccountId,
453
+ email: z.string().max(254).optional(),
454
+ /** What the person calls it, when they named it. */
455
+ label: z.string().min(1).max(80).optional(),
456
+ enabled: z.boolean(),
457
+ /** ready: has room; limited: every window the pool watches is used up until `until`;
458
+ * error: needs the person (sign in again); disabled: turned off by the person. */
459
+ status: z.enum(["ready", "limited", "error", "disabled"]),
460
+ /** Serving new sessions right now. At most one account says so. */
461
+ current: z.boolean().optional(),
462
+ /** limited: when it has room again, where the machine knows. */
463
+ until: Rfc3339.optional(),
464
+ /** The account's freshest numbers, as limits.observed would carry them: from the
465
+ * idle usage poll when no session asked recently, since an idle account's numbers
466
+ * ride on no session and would reach no receiver otherwise. */
467
+ windows: z.array(LimitWindow).min(1).max(8).optional(),
468
+ /** limited or error only: what took the account out. A window's id (`seven_day`), or
469
+ * `rejected` (the vendor's status) or `error` (sign in again) for the non-window causes. */
470
+ limited_by: z.string().regex(/^[a-z0-9_]{1,64}$/).optional()
471
+ });
472
+ var ControlHelloPool = z.object({
473
+ on: z.boolean(),
474
+ /** The harness the pool serves. Only `claude-code` today. */
475
+ harness: HarnessName,
476
+ accounts: z.array(PoolAccount).max(20)
477
+ });
409
478
  var ControlHello = z.object({
410
479
  name: z.string().min(1).max(80),
411
480
  harnesses: z.array(z.string().regex(/^[a-z][a-z0-9-]{0,39}$/)).max(20),
@@ -442,7 +511,10 @@ var ControlHello = z.object({
442
511
  })
443
512
  ).refine((o) => Object.keys(o).length <= 50, "at most 50 harnesses").meta({ maxProperties: 50 }).optional(),
444
513
  /** As in control-pair.json. */
445
- key_types: KeyTypes.optional()
514
+ key_types: KeyTypes.optional(),
515
+ /** The machine's account pool, when its daemon has one; sent again the moment the
516
+ * pool changes. A hello without it is a daemon that predates the pool. */
517
+ pool: ControlHelloPool.optional()
446
518
  });
447
519
  var WellKnown = z.object({
448
520
  protocol: z.array(z.int().min(1)).min(1),
@@ -508,6 +580,7 @@ export {
508
580
  ControlFile,
509
581
  ControlGrant,
510
582
  ControlHello,
583
+ ControlHelloPool,
511
584
  ControlKey,
512
585
  ControlKind,
513
586
  ControlMessage,
@@ -526,9 +599,13 @@ export {
526
599
  HarnessAccount,
527
600
  KNOWN_TYPES,
528
601
  KeyTypes,
602
+ LimitWindow,
529
603
  MachineId,
530
604
  ModelId,
531
605
  PROTOCOL,
606
+ PoolAccount,
607
+ PoolAccountId,
608
+ PoolAction,
532
609
  Privacy,
533
610
  Rfc3339,
534
611
  RunLevel,