sessionpipe-core 0.10.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.
@@ -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<{
@@ -195,6 +203,16 @@ export declare const EventData: z.ZodObject<{
195
203
  manual: "manual";
196
204
  }>;
197
205
  }, z.core.$loose>;
206
+ "limits.observed": z.ZodObject<{
207
+ windows: z.ZodArray<z.ZodObject<{
208
+ id: z.ZodString;
209
+ used_percent: z.ZodNumber;
210
+ resets_at: z.ZodOptional<z.ZodISODateTime>;
211
+ window_minutes: z.ZodOptional<z.ZodInt>;
212
+ }, z.core.$loose>>;
213
+ plan: z.ZodOptional<z.ZodString>;
214
+ account_id: z.ZodOptional<z.ZodString>;
215
+ }, z.core.$loose>;
198
216
  native: z.ZodObject<{}, z.core.$loose>;
199
217
  }, z.core.$strip>;
200
218
  export declare const Batch: z.ZodObject<{
@@ -264,9 +282,25 @@ export declare const ControlKind: z.ZodEnum<{
264
282
  cancel: "cancel";
265
283
  "key.add": "key.add";
266
284
  "permission.answer": "permission.answer";
285
+ pool: "pool";
267
286
  prompt: "prompt";
268
287
  start: "start";
269
288
  }>;
289
+ /** What a `pool` command asks of the machine's account pool (CONTROL.md §6 `pool`). */
290
+ export declare const PoolAction: z.ZodEnum<{
291
+ disable: "disable";
292
+ enable: "enable";
293
+ "login.begin": "login.begin";
294
+ "login.complete": "login.complete";
295
+ off: "off";
296
+ on: "on";
297
+ order: "order";
298
+ refresh: "refresh";
299
+ remove: "remove";
300
+ }>;
301
+ /** A pooled account's id: what `session.account_id` and `limits.observed.account_id`
302
+ * carry for it (Claude Code: the account UUID), or a pending sign-in's id. */
303
+ export declare const PoolAccountId: z.ZodString;
270
304
  /** The kinds of key a machine or a receiver handles (CONTROL.md §2). Absent: passkeys only. */
271
305
  export declare const KeyTypes: z.ZodArray<z.ZodEnum<{
272
306
  device: "device";
@@ -320,6 +354,7 @@ export declare const ControlCommand: z.ZodObject<{
320
354
  cancel: "cancel";
321
355
  "key.add": "key.add";
322
356
  "permission.answer": "permission.answer";
357
+ pool: "pool";
323
358
  prompt: "prompt";
324
359
  start: "start";
325
360
  }>;
@@ -358,6 +393,20 @@ export declare const ControlCommand: z.ZodObject<{
358
393
  safe: "safe";
359
394
  }>>;
360
395
  model: z.ZodOptional<z.ZodString>;
396
+ pool_action: z.ZodOptional<z.ZodEnum<{
397
+ disable: "disable";
398
+ enable: "enable";
399
+ "login.begin": "login.begin";
400
+ "login.complete": "login.complete";
401
+ off: "off";
402
+ on: "on";
403
+ order: "order";
404
+ refresh: "refresh";
405
+ remove: "remove";
406
+ }>>;
407
+ pool_account: z.ZodOptional<z.ZodString>;
408
+ pool_order: z.ZodOptional<z.ZodArray<z.ZodString>>;
409
+ pool_code: z.ZodOptional<z.ZodString>;
361
410
  nonce: z.ZodString;
362
411
  iat: z.ZodInt;
363
412
  }, z.core.$strip>;
@@ -594,6 +643,58 @@ export declare const ControlPaired: z.ZodObject<{
594
643
  sink_token: z.ZodOptional<z.ZodString>;
595
644
  account: z.ZodOptional<z.ZodString>;
596
645
  }, z.core.$strip>;
646
+ /** One account in the machine's pool, as its hello lists it (CONTROL.md §2 `pool`).
647
+ * `id` is the string `session.account_id` and `limits.observed.account_id` carry, so
648
+ * a receiver joins the three without a map. The email travels only here. */
649
+ export declare const PoolAccount: z.ZodObject<{
650
+ id: z.ZodString;
651
+ email: z.ZodOptional<z.ZodString>;
652
+ label: z.ZodOptional<z.ZodString>;
653
+ enabled: z.ZodBoolean;
654
+ status: z.ZodEnum<{
655
+ disabled: "disabled";
656
+ error: "error";
657
+ limited: "limited";
658
+ ready: "ready";
659
+ }>;
660
+ current: z.ZodOptional<z.ZodBoolean>;
661
+ until: z.ZodOptional<z.ZodISODateTime>;
662
+ windows: z.ZodOptional<z.ZodArray<z.ZodObject<{
663
+ id: z.ZodString;
664
+ used_percent: z.ZodNumber;
665
+ resets_at: z.ZodOptional<z.ZodISODateTime>;
666
+ window_minutes: z.ZodOptional<z.ZodInt>;
667
+ }, z.core.$loose>>>;
668
+ limited_by: z.ZodOptional<z.ZodString>;
669
+ }, z.core.$strip>;
670
+ /** The machine's account pool (CONTROL.md §2 `pool`): present in EVERY hello of a daemon
671
+ * that knows the pool (`on: false`, `accounts: []` when nothing is set up), so a
672
+ * receiver tells "no pool" from "an old daemon"; `accounts` in the machine's order. */
673
+ export declare const ControlHelloPool: z.ZodObject<{
674
+ on: z.ZodBoolean;
675
+ harness: z.ZodString;
676
+ accounts: z.ZodArray<z.ZodObject<{
677
+ id: z.ZodString;
678
+ email: z.ZodOptional<z.ZodString>;
679
+ label: z.ZodOptional<z.ZodString>;
680
+ enabled: z.ZodBoolean;
681
+ status: z.ZodEnum<{
682
+ disabled: "disabled";
683
+ error: "error";
684
+ limited: "limited";
685
+ ready: "ready";
686
+ }>;
687
+ current: z.ZodOptional<z.ZodBoolean>;
688
+ until: z.ZodOptional<z.ZodISODateTime>;
689
+ windows: z.ZodOptional<z.ZodArray<z.ZodObject<{
690
+ id: z.ZodString;
691
+ used_percent: z.ZodNumber;
692
+ resets_at: z.ZodOptional<z.ZodISODateTime>;
693
+ window_minutes: z.ZodOptional<z.ZodInt>;
694
+ }, z.core.$loose>>>;
695
+ limited_by: z.ZodOptional<z.ZodString>;
696
+ }, z.core.$strip>>;
697
+ }, z.core.$strip>;
597
698
  /** `POST {control}/hello`: what the machine can do right now. */
598
699
  export declare const ControlHello: z.ZodObject<{
599
700
  name: z.ZodString;
@@ -644,6 +745,31 @@ export declare const ControlHello: z.ZodObject<{
644
745
  device: "device";
645
746
  passkey: "passkey";
646
747
  }>>>;
748
+ pool: z.ZodOptional<z.ZodObject<{
749
+ on: z.ZodBoolean;
750
+ harness: z.ZodString;
751
+ accounts: z.ZodArray<z.ZodObject<{
752
+ id: z.ZodString;
753
+ email: z.ZodOptional<z.ZodString>;
754
+ label: z.ZodOptional<z.ZodString>;
755
+ enabled: z.ZodBoolean;
756
+ status: z.ZodEnum<{
757
+ disabled: "disabled";
758
+ error: "error";
759
+ limited: "limited";
760
+ ready: "ready";
761
+ }>;
762
+ current: z.ZodOptional<z.ZodBoolean>;
763
+ until: z.ZodOptional<z.ZodISODateTime>;
764
+ windows: z.ZodOptional<z.ZodArray<z.ZodObject<{
765
+ id: z.ZodString;
766
+ used_percent: z.ZodNumber;
767
+ resets_at: z.ZodOptional<z.ZodISODateTime>;
768
+ window_minutes: z.ZodOptional<z.ZodInt>;
769
+ }, z.core.$loose>>>;
770
+ limited_by: z.ZodOptional<z.ZodString>;
771
+ }, z.core.$strip>>;
772
+ }, z.core.$strip>>;
647
773
  }, z.core.$strip>;
648
774
  export declare const WellKnown: z.ZodObject<{
649
775
  protocol: z.ZodArray<z.ZodInt>;
@@ -827,6 +953,16 @@ export declare const SCHEMAS: {
827
953
  manual: "manual";
828
954
  }>;
829
955
  }, z.core.$loose>;
956
+ "limits.observed": z.ZodObject<{
957
+ windows: z.ZodArray<z.ZodObject<{
958
+ id: z.ZodString;
959
+ used_percent: z.ZodNumber;
960
+ resets_at: z.ZodOptional<z.ZodISODateTime>;
961
+ window_minutes: z.ZodOptional<z.ZodInt>;
962
+ }, z.core.$loose>>;
963
+ plan: z.ZodOptional<z.ZodString>;
964
+ account_id: z.ZodOptional<z.ZodString>;
965
+ }, z.core.$loose>;
830
966
  native: z.ZodObject<{}, z.core.$loose>;
831
967
  }, z.core.$strip>;
832
968
  readonly batch: z.ZodObject<{
@@ -949,6 +1085,7 @@ export declare const SCHEMAS: {
949
1085
  cancel: "cancel";
950
1086
  "key.add": "key.add";
951
1087
  "permission.answer": "permission.answer";
1088
+ pool: "pool";
952
1089
  prompt: "prompt";
953
1090
  start: "start";
954
1091
  }>;
@@ -987,6 +1124,20 @@ export declare const SCHEMAS: {
987
1124
  safe: "safe";
988
1125
  }>>;
989
1126
  model: z.ZodOptional<z.ZodString>;
1127
+ pool_action: z.ZodOptional<z.ZodEnum<{
1128
+ disable: "disable";
1129
+ enable: "enable";
1130
+ "login.begin": "login.begin";
1131
+ "login.complete": "login.complete";
1132
+ off: "off";
1133
+ on: "on";
1134
+ order: "order";
1135
+ refresh: "refresh";
1136
+ remove: "remove";
1137
+ }>>;
1138
+ pool_account: z.ZodOptional<z.ZodString>;
1139
+ pool_order: z.ZodOptional<z.ZodArray<z.ZodString>>;
1140
+ pool_code: z.ZodOptional<z.ZodString>;
990
1141
  nonce: z.ZodString;
991
1142
  iat: z.ZodInt;
992
1143
  }, z.core.$strip>;
@@ -1196,6 +1347,31 @@ export declare const SCHEMAS: {
1196
1347
  device: "device";
1197
1348
  passkey: "passkey";
1198
1349
  }>>>;
1350
+ pool: z.ZodOptional<z.ZodObject<{
1351
+ on: z.ZodBoolean;
1352
+ harness: z.ZodString;
1353
+ accounts: z.ZodArray<z.ZodObject<{
1354
+ id: z.ZodString;
1355
+ email: z.ZodOptional<z.ZodString>;
1356
+ label: z.ZodOptional<z.ZodString>;
1357
+ enabled: z.ZodBoolean;
1358
+ status: z.ZodEnum<{
1359
+ disabled: "disabled";
1360
+ error: "error";
1361
+ limited: "limited";
1362
+ ready: "ready";
1363
+ }>;
1364
+ current: z.ZodOptional<z.ZodBoolean>;
1365
+ until: z.ZodOptional<z.ZodISODateTime>;
1366
+ windows: z.ZodOptional<z.ZodArray<z.ZodObject<{
1367
+ id: z.ZodString;
1368
+ used_percent: z.ZodNumber;
1369
+ resets_at: z.ZodOptional<z.ZodISODateTime>;
1370
+ window_minutes: z.ZodOptional<z.ZodInt>;
1371
+ }, z.core.$loose>>>;
1372
+ limited_by: z.ZodOptional<z.ZodString>;
1373
+ }, z.core.$strip>>;
1374
+ }, z.core.$strip>>;
1199
1375
  }, z.core.$strip>;
1200
1376
  };
1201
1377
  //# 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,EAC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;;;;;;;;;;;;;;;iBA4CvB,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsCpB,CAAC;AAEH,+DAA+D;AAC/D,eAAO,MAAM,OAAO;aAClB,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aACL,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aACZ,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aACL,gBAAgB;;;;;;;;;aAChB,KAAK;;;;;aACL,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aACZ,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;aACP,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aACjB,eAAe;;;;;;;;aACf,aAAa;;;;;;;;;;;;aACb,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aACd,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aACb,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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.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 = [
@@ -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,
@@ -186,6 +194,14 @@ var EventData = z.object({
186
194
  "subagent.started": Loose.extend({ agent_id: z.string().max(128), agent_type: z.string().max(128).optional() }),
187
195
  "subagent.ended": Loose.extend({ agent_id: z.string().max(128), agent_type: z.string().max(128).optional() }),
188
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
+ }),
189
205
  native: Loose
190
206
  });
191
207
  var Batch = z.object({ events: z.array(Event).min(1).max(50) });
@@ -204,7 +220,19 @@ var Capability = z.enum(["events", "backfill", "forget", "control", "native"]);
204
220
  var B64Url = z.string().regex(/^[A-Za-z0-9_-]*$/, "base64url, no padding");
205
221
  var MachineId = z.string().regex(/^m_[A-Za-z0-9_-]{16,40}$/, "m_ + 16\u201340 base64url");
206
222
  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"]);
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");
208
236
  var KeyTypes = z.array(z.enum(["passkey", "device"])).min(1).max(2);
209
237
  var DeliveryMode = z.enum(["sdk", "waiter", "turn", "api", "resume", "fork"]);
210
238
  var StartPermission = z.enum(["read", "safe", "edits", "auto"]);
@@ -257,6 +285,15 @@ var ControlCommand = z.object({
257
285
  permission: StartPermission.optional(),
258
286
  /** start only: the model the harness runs. As `permission`: only when advertised. */
259
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(),
260
297
  /** At least 16 random bytes, base64url. */
261
298
  nonce: z.string().regex(/^[A-Za-z0-9_-]{22,64}$/),
262
299
  /** Epoch ms, the signing device's clock. */
@@ -406,6 +443,33 @@ var ControlPaired = z.object({
406
443
  * say whose passkey it now trusts. */
407
444
  account: z.string().max(200).optional()
408
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
+ });
409
473
  var ControlHello = z.object({
410
474
  name: z.string().min(1).max(80),
411
475
  harnesses: z.array(z.string().regex(/^[a-z][a-z0-9-]{0,39}$/)).max(20),
@@ -442,7 +506,10 @@ var ControlHello = z.object({
442
506
  })
443
507
  ).refine((o) => Object.keys(o).length <= 50, "at most 50 harnesses").meta({ maxProperties: 50 }).optional(),
444
508
  /** As in control-pair.json. */
445
- key_types: KeyTypes.optional()
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()
446
513
  });
447
514
  var WellKnown = z.object({
448
515
  protocol: z.array(z.int().min(1)).min(1),
@@ -508,6 +575,7 @@ export {
508
575
  ControlFile,
509
576
  ControlGrant,
510
577
  ControlHello,
578
+ ControlHelloPool,
511
579
  ControlKey,
512
580
  ControlKind,
513
581
  ControlMessage,
@@ -526,9 +594,13 @@ export {
526
594
  HarnessAccount,
527
595
  KNOWN_TYPES,
528
596
  KeyTypes,
597
+ LimitWindow,
529
598
  MachineId,
530
599
  ModelId,
531
600
  PROTOCOL,
601
+ PoolAccount,
602
+ PoolAccountId,
603
+ PoolAction,
532
604
  Privacy,
533
605
  Rfc3339,
534
606
  RunLevel,