@kici-dev/engine 0.14.2 → 0.16.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 (58) hide show
  1. package/dist/approval/expiry-duration.d.ts +11 -0
  2. package/dist/approval/expiry-duration.js +29 -0
  3. package/dist/audit/access-log-policy.js +2 -0
  4. package/dist/audit/retention-policy.d.ts +1 -1
  5. package/dist/audit/retention-policy.js +5 -1
  6. package/dist/auth/permissions.d.ts +69 -0
  7. package/dist/auth/permissions.js +51 -0
  8. package/dist/context/hold-type.d.ts +0 -19
  9. package/dist/context/hold-type.js +1 -37
  10. package/dist/context/index.d.ts +1 -1
  11. package/dist/context/index.js +2 -2
  12. package/dist/index.d.ts +7 -2
  13. package/dist/index.js +20 -15
  14. package/dist/labels.d.ts +2 -17
  15. package/dist/labels.js +3 -33
  16. package/dist/mcp/held-run-resolve.d.ts +2 -5
  17. package/dist/mcp/held-run-resolve.js +3 -4
  18. package/dist/metrics/metric-catalog.generated.d.ts +0 -5
  19. package/dist/metrics/metric-catalog.generated.js +0 -6
  20. package/dist/protocol/messages/access-log.d.ts +10 -0
  21. package/dist/protocol/messages/access-log.js +2 -0
  22. package/dist/protocol/messages/auth.d.ts +7 -8
  23. package/dist/protocol/messages/auth.js +12 -17
  24. package/dist/protocol/messages/browser.js +1 -1
  25. package/dist/protocol/messages/capabilities.d.ts +21 -100
  26. package/dist/protocol/messages/capabilities.js +22 -124
  27. package/dist/protocol/messages/dashboard.d.ts +64 -22
  28. package/dist/protocol/messages/dashboard.js +43 -40
  29. package/dist/protocol/messages/execution-status.d.ts +3 -3
  30. package/dist/protocol/messages/execution-status.js +7 -12
  31. package/dist/protocol/messages/join.d.ts +73 -2
  32. package/dist/protocol/messages/join.js +101 -12
  33. package/dist/protocol/messages/orchestrator-agent.d.ts +35 -40
  34. package/dist/protocol/messages/orchestrator-agent.js +63 -96
  35. package/dist/protocol/messages/peer.d.ts +278 -26
  36. package/dist/protocol/messages/peer.js +120 -65
  37. package/dist/protocol/messages/platform-orchestrator.d.ts +36 -141
  38. package/dist/protocol/messages/platform-orchestrator.js +24 -86
  39. package/dist/protocol/messages/source-registration.d.ts +0 -13
  40. package/dist/protocol/messages/source-registration.js +9 -10
  41. package/dist/protocol/version.d.ts +9 -15
  42. package/dist/protocol/version.js +9 -15
  43. package/dist/provenance/id-token-claim-names.d.ts +3 -5
  44. package/dist/provenance/id-token-claim-names.js +3 -5
  45. package/dist/status/presentation.d.ts +2 -14
  46. package/dist/status/presentation.js +3 -23
  47. package/dist/trigger/types.d.ts +125 -34
  48. package/dist/trigger/types.js +9 -24
  49. package/dist/util/date.d.ts +7 -0
  50. package/dist/util/date.js +14 -0
  51. package/dist/util/parse-duration.d.ts +6 -0
  52. package/dist/util/parse-duration.js +21 -0
  53. package/dist/util/sleep.d.ts +3 -0
  54. package/dist/util/sleep.js +10 -0
  55. package/dist/webhook/webhook-url-format.d.ts +2 -2
  56. package/dist/webhook/webhook-url-format.js +2 -2
  57. package/package.json +1 -1
  58. package/sbom.spdx.json +5 -5
@@ -1,7 +1,7 @@
1
1
  import "../../rolldown-runtime-ClRpJifh.js";
2
+ import { LogStream } from "./log-stream.js";
2
3
  import { ExecutionJobStatus } from "./execution-status.js";
3
4
  import { LabelMatcher } from "../../labels-match.js";
4
- import { LogStream } from "./log-stream.js";
5
5
  import { ScalerEventType } from "./scaler-event.js";
6
6
  import { z } from "zod";
7
7
  //#region src/protocol/messages/peer.ts
@@ -67,13 +67,29 @@ const scalerCapacitySummarySchema = z.object({
67
67
  */
68
68
  labelSetMandatoryLabels: z.array(z.array(z.string()))
69
69
  }).strict();
70
- /** Peer hello: initiator sends ephemeral X25519 public key and nonce. */
70
+ /** Peer authentication schemes. A server lists the ones it accepts in `peer.hello`. */
71
+ const PeerAuthScheme = z.enum(["mutual-v2"]);
72
+ /** How a peer proves itself: with its persisted credential, or with a join token on first join. */
73
+ const PeerAuthMode = z.enum(["credential", "token"]);
74
+ /**
75
+ * The reason a server gives a peer that authenticates without mutual-v2 (a
76
+ * proof or token field, or no scheme). It is none of the credential-divergence
77
+ * reasons, so that peer keeps its credential file.
78
+ */
79
+ const PEER_MUTUAL_AUTH_REQUIRED_REASON = "Mutual peer authentication required";
80
+ /** Peer hello: the server sends its ephemeral X25519 public key, a nonce and its schemes. */
71
81
  const peerHelloSchema = z.object({
72
82
  type: z.literal("peer.hello"),
73
83
  /** Base64-encoded X25519 DER SPKI ephemeral public key. */
74
84
  ephemeralPublicKey: z.string(),
75
85
  /** Base64-encoded 32-byte random nonce (HKDF salt). */
76
- nonce: z.string()
86
+ nonce: z.string(),
87
+ /**
88
+ * The authentication schemes this server accepts. Strings rather than an
89
+ * enum, so a hello naming a scheme this build does not know still parses.
90
+ * Optional so a hello naming none reaches the client's explicit refusal.
91
+ */
92
+ authSchemes: z.array(z.string()).optional()
77
93
  });
78
94
  /** Peer hello response: responder sends their ephemeral X25519 public key. */
79
95
  const peerHelloResponseSchema = z.object({
@@ -81,19 +97,21 @@ const peerHelloResponseSchema = z.object({
81
97
  /** Base64-encoded X25519 DER SPKI ephemeral public key. */
82
98
  ephemeralPublicKey: z.string()
83
99
  });
84
- /** Peer auth request sent after ECDH handshake (encrypted channel established). */
100
+ /** Peer auth request sent after the ECDH handshake, under the handshake key. */
85
101
  const peerAuthRequestSchema = z.object({
86
102
  type: z.literal("peer.auth.request"),
87
103
  instanceId: z.string(),
88
- /** Join token (first connection via token-based auth). */
89
- token: z.string().optional(),
90
- /** HMAC proof of credential ownership (reconnection). */
91
- proof: z.string().optional(),
92
104
  protocolVersion: z.number(),
93
- /** Software version of the connecting peer (for version compat check). */
105
+ /** Software version of the connecting peer (logged). */
94
106
  softwareVersion: z.string().optional(),
95
- /** Role of the connecting peer. */
96
- role: z.enum(["coordinator", "worker"]).optional()
107
+ /** Role of the connecting peer, as it declares it. */
108
+ role: z.enum(["coordinator", "worker"]).optional(),
109
+ scheme: PeerAuthScheme,
110
+ mode: PeerAuthMode,
111
+ /** Hex HMAC-SHA256 proof bound to the handshake transcript. */
112
+ clientProof: z.string(),
113
+ /** The join token's base64url routing segment. The server requires it in token mode. */
114
+ tokenRouting: z.string().optional()
97
115
  });
98
116
  /** Peer auth response indicating whether the connection was accepted. */
99
117
  const peerAuthResponseSchema = z.object({
@@ -101,6 +119,8 @@ const peerAuthResponseSchema = z.object({
101
119
  accepted: z.boolean(),
102
120
  instanceId: z.string().optional(),
103
121
  reason: z.string().optional(),
122
+ /** Hex proof that the server holds the same credential or token; present on every acceptance. */
123
+ serverProof: z.string().optional(),
104
124
  /** Session credential issued on first join (worker stores for reconnection). */
105
125
  sessionCredential: z.string().optional(),
106
126
  /** Assigned role echoed back to the connecting peer. */
@@ -120,13 +140,13 @@ const peerHeartbeatSchema = z.object({
120
140
  draining: z.boolean(),
121
141
  agents: z.array(peerAgentSummarySchema),
122
142
  capabilities: peerCapabilitiesSchema,
123
- /** Optional scaler capacity data for on-demand backends (backward compatible). */
143
+ /** Scaler capacity data for on-demand backends. */
124
144
  scalerCapacity: z.array(scalerCapacitySummarySchema).optional(),
125
- /** Shared config version for cross-orchestrator config sync (backward compatible). */
145
+ /** Shared config version for cross-orchestrator config sync. */
126
146
  configVersion: z.number().optional(),
127
- /** Registry version for cross-orchestrator registration sync (backward compatible). */
147
+ /** Registry version for cross-orchestrator registration sync. */
128
148
  registryVersion: z.number().optional(),
129
- /** Cluster-settings version for the coordinator→worker settings pull (backward compatible). */
149
+ /** Cluster-settings version for the coordinator→worker settings pull. */
130
150
  clusterSettingsVersion: z.number().optional(),
131
151
  timestamp: z.number(),
132
152
  hostname: z.string().optional(),
@@ -173,7 +193,7 @@ const jobRerouteSchema = z.object({
173
193
  jobName: z.string(),
174
194
  workflowName: z.string(),
175
195
  runsOnLabels: z.array(z.array(z.string())),
176
- /** Labels that the dispatched agent must NOT have (optional for backward compatibility). */
196
+ /** Labels that the dispatched agent must NOT have. Absent is `[]`. */
177
197
  excludeLabels: z.array(z.string()).optional(),
178
198
  /**
179
199
  * Glob/regex include matchers the receiving peer's agent labels must
@@ -187,11 +207,8 @@ const jobRerouteSchema = z.object({
187
207
  excludePatterns: z.array(LabelMatcher).optional(),
188
208
  triedConnections: z.array(z.string()),
189
209
  maxHops: z.number(),
190
- /**
191
- * The worker's spawn-retry budget for this job. Absent from an older sender:
192
- * the worker applies its own configured default.
193
- */
194
- spawnRetry: rerouteSpawnRetrySchema.optional(),
210
+ /** The worker's spawn-retry budget for this job. */
211
+ spawnRetry: rerouteSpawnRetrySchema,
195
212
  coordinatorId: z.string(),
196
213
  requestId: z.string().optional(),
197
214
  traceId: z.string().optional(),
@@ -314,7 +331,7 @@ const peerLogChunkSchema = z.object({
314
331
  lines: z.array(z.object({
315
332
  text: z.string(),
316
333
  timestamp: z.number(),
317
- stream: LogStream.optional()
334
+ stream: LogStream
318
335
  }))
319
336
  });
320
337
  /** Cache upload request: worker -> coordinator. Worker agent needs upload URL. */
@@ -336,6 +353,65 @@ const peerCacheUploadResponseSchema = z.object({
336
353
  uploadUrl: z.string()
337
354
  });
338
355
  /**
356
+ * What a scaler config reload did on one orchestrator. `rejected`: the file did
357
+ * not load or validate, or an added scaler did not build, and nothing applied.
358
+ * `not-configured`: the orchestrator runs without a scaler config, so there is
359
+ * nothing to reload. `unreachable`: the request did not reach the orchestrator,
360
+ * or it did not answer in time.
361
+ */
362
+ const ScalerReloadOutcome = z.enum([
363
+ "applied",
364
+ "rejected",
365
+ "not-configured",
366
+ "unreachable"
367
+ ]);
368
+ /**
369
+ * What an applied scaler reload changed, as scaler names per bucket. `updated`
370
+ * holds the kept scalers whose entry changed and `unchanged` the rest of them;
371
+ * `global` names the changed top-level limits (`globalMaxAgents`,
372
+ * `globalResourceCap`).
373
+ */
374
+ const scalerReloadPlanSchema = z.object({
375
+ added: z.array(z.string()),
376
+ updated: z.array(z.string()),
377
+ unchanged: z.array(z.string()),
378
+ retired: z.array(z.string()),
379
+ resurrected: z.array(z.string()),
380
+ global: z.array(z.string())
381
+ });
382
+ /** One orchestrator's scaler reload outcome, its plan when applied, its errors when refused. */
383
+ const scalerReloadAnswerSchema = z.object({
384
+ outcome: ScalerReloadOutcome,
385
+ plan: scalerReloadPlanSchema.optional(),
386
+ errors: z.array(z.string()).optional()
387
+ });
388
+ /** One orchestrator's answer to a scaler reload, as `kici-admin scaler reload` reports it. */
389
+ const scalerReloadInstanceResultSchema = scalerReloadAnswerSchema.extend({
390
+ instanceId: z.string(),
391
+ role: z.enum([
392
+ "coordinator",
393
+ "worker",
394
+ "unknown"
395
+ ]),
396
+ /** Why the outcome is what it is, for an instance that was not reached or did not answer. */
397
+ detail: z.string().optional()
398
+ });
399
+ /**
400
+ * Scaler reload request: the orchestrator that received `kici-admin scaler
401
+ * reload` asks each connected peer to re-read its own scaler config. The peer
402
+ * answers with peer.scaler.reload.response.
403
+ */
404
+ const peerScalerReloadRequestSchema = z.object({
405
+ type: z.literal("peer.scaler.reload.request"),
406
+ messageId: z.string()
407
+ });
408
+ /** Scaler reload response: the peer's outcome, its plan when applied, its errors when rejected. */
409
+ const peerScalerReloadResponseSchema = scalerReloadAnswerSchema.extend({
410
+ type: z.literal("peer.scaler.reload.response"),
411
+ messageId: z.string(),
412
+ detail: z.string().optional()
413
+ });
414
+ /**
339
415
  * Config reload request: forwarded from one orchestrator to a specific peer
340
416
  * when an operator calls POST /admin/config/reload with a `target` parameter.
341
417
  * The receiving peer executes a local reload and replies with
@@ -358,7 +434,9 @@ const peerConfigReloadResponseSchema = z.object({
358
434
  version: z.number().optional(),
359
435
  errors: z.array(z.string()).optional(),
360
436
  restartRequired: z.array(z.string()).optional(),
361
- fieldsChanged: z.array(z.string()).optional()
437
+ fieldsChanged: z.array(z.string()).optional(),
438
+ /** The target peer's scaler config reload outcome, when it runs a scaler config. */
439
+ scaler: scalerReloadAnswerSchema.optional()
362
440
  });
363
441
  /** How a live Firecracker VM relates to the orchestrator on its host. */
364
442
  const ScalerVmStatus = z.enum([
@@ -478,12 +556,13 @@ const peerForgetResponseSchema = z.object({
478
556
  */
479
557
  const workerClusterSettingsSchema = z.object({
480
558
  agentTokenTtlMs: z.number(),
559
+ /** How long a Firecracker spawn waits for the VM's API socket. */
560
+ firecrackerApiSocketWaitMs: z.number(),
481
561
  /**
482
- * How long a Firecracker spawn waits for the VM's API socket. Optional: a
483
- * leader that predates the knob omits it, and the worker keeps its own
484
- * configured default.
562
+ * The concurrency-slot wait timeout a worker sends on each `job.dispatch`,
563
+ * from `cluster_settings.concurrency_wait_timeout_ms`.
485
564
  */
486
- firecrackerApiSocketWaitMs: z.number().optional()
565
+ concurrencyWaitTimeoutMs: z.number()
487
566
  });
488
567
  /**
489
568
  * Cluster-settings pull request: a DB-less worker asks a connected coordinator
@@ -578,13 +657,16 @@ const peerScalerEventSchema = z.object({
578
657
  /**
579
658
  * The worker's retry verdict on a `scaler.failed` for a job under its spawn-retry
580
659
  * budget: false while attempts remain, true on the last one. Absent on a repeated
581
- * report of one failed spawn, on every other relay, and from an older worker; the
582
- * coordinator then keeps its spawn window running unchanged.
660
+ * report of one failed spawn and on every other relay; the coordinator then keeps
661
+ * its spawn window running unchanged.
583
662
  */
584
663
  final: z.boolean().optional()
585
664
  });
586
- /** All peer-to-peer messages (outbound from this node). */
587
- const peerToPeerMessageSchema = z.discriminatedUnion("type", [
665
+ /**
666
+ * Every peer message type. Both directions carry the same set: each node sends
667
+ * and receives every type, so one list backs both unions.
668
+ */
669
+ const peerMessageSchemas = [
588
670
  peerHelloSchema,
589
671
  peerHelloResponseSchema,
590
672
  peerAuthRequestSchema,
@@ -605,6 +687,8 @@ const peerToPeerMessageSchema = z.discriminatedUnion("type", [
605
687
  peerConfigReloadResponseSchema,
606
688
  peerScalerOrphansRequestSchema,
607
689
  peerScalerOrphansResponseSchema,
690
+ peerScalerReloadRequestSchema,
691
+ peerScalerReloadResponseSchema,
608
692
  peerForgetRequestSchema,
609
693
  peerForgetResponseSchema,
610
694
  peerClusterSettingsRequestSchema,
@@ -615,41 +699,12 @@ const peerToPeerMessageSchema = z.discriminatedUnion("type", [
615
699
  peerLeavingSchema,
616
700
  peerAgentTokenRevokeSchema,
617
701
  peerScalerEventSchema
618
- ]);
702
+ ];
703
+ /** All peer-to-peer messages (outbound from this node). */
704
+ const peerToPeerMessageSchema = z.discriminatedUnion("type", peerMessageSchemas);
619
705
  /** All peer-to-peer messages (inbound to this node). */
620
- const peerFromPeerMessageSchema = z.discriminatedUnion("type", [
621
- peerHelloSchema,
622
- peerHelloResponseSchema,
623
- peerAuthRequestSchema,
624
- peerAuthResponseSchema,
625
- peerHeartbeatSchema,
626
- jobRerouteSchema,
627
- jobRerouteAckSchema,
628
- jobProgressSchema,
629
- jobProgressAckSchema,
630
- peerJobCancelSchema,
631
- raftVoteRequestSchema,
632
- raftVoteResponseSchema,
633
- raftAppendEntriesSchema,
634
- peerLogChunkSchema,
635
- peerCacheUploadRequestSchema,
636
- peerCacheUploadResponseSchema,
637
- peerConfigReloadSchema,
638
- peerConfigReloadResponseSchema,
639
- peerScalerOrphansRequestSchema,
640
- peerScalerOrphansResponseSchema,
641
- peerForgetRequestSchema,
642
- peerForgetResponseSchema,
643
- peerClusterSettingsRequestSchema,
644
- peerClusterSettingsResponseSchema,
645
- peerLogsCollectRequestSchema,
646
- peerLogsCollectChunkSchema,
647
- peerLogsCollectErrorSchema,
648
- peerLeavingSchema,
649
- peerAgentTokenRevokeSchema,
650
- peerScalerEventSchema
651
- ]);
706
+ const peerFromPeerMessageSchema = z.discriminatedUnion("type", peerMessageSchemas);
652
707
  //#endregion
653
- export { PeerForgetOutcome, ScalerOrphansAction, ScalerVmStatus, ScalerVmStopOutcome, ScalerVmTracker, fleetSelectionSchema, jobProgressAckSchema, jobProgressSchema, jobRerouteAckSchema, jobRerouteSchema, peerAgentTokenRevokeSchema, peerAuthRequestSchema, peerAuthResponseSchema, peerCapabilitiesSchema, peerClusterSettingsRequestSchema, peerClusterSettingsResponseSchema, peerConfigReloadResponseSchema, peerConfigReloadSchema, peerForgetRequestSchema, peerForgetResponseSchema, peerFromPeerMessageSchema, peerHeartbeatSchema, peerHelloResponseSchema, peerHelloSchema, peerJobCancelSchema, peerLeavingSchema, peerLogsCollectChunkSchema, peerLogsCollectErrorSchema, peerLogsCollectRequestSchema, peerScalerEventSchema, peerScalerOrphansRequestSchema, peerScalerOrphansResponseSchema, peerToPeerMessageSchema, raftAppendEntriesSchema, raftVoteRequestSchema, raftVoteResponseSchema, rerouteSpawnRetrySchema, scalerLiveVmSchema, scalerVmStopResultSchema, workerClusterSettingsSchema };
708
+ export { PEER_MUTUAL_AUTH_REQUIRED_REASON, PeerAuthMode, PeerAuthScheme, PeerForgetOutcome, ScalerOrphansAction, ScalerReloadOutcome, ScalerVmStatus, ScalerVmStopOutcome, ScalerVmTracker, fleetSelectionSchema, jobProgressAckSchema, jobProgressSchema, jobRerouteAckSchema, jobRerouteSchema, peerAgentTokenRevokeSchema, peerAuthRequestSchema, peerAuthResponseSchema, peerCapabilitiesSchema, peerClusterSettingsRequestSchema, peerClusterSettingsResponseSchema, peerConfigReloadResponseSchema, peerConfigReloadSchema, peerForgetRequestSchema, peerForgetResponseSchema, peerFromPeerMessageSchema, peerHeartbeatSchema, peerHelloResponseSchema, peerHelloSchema, peerJobCancelSchema, peerLeavingSchema, peerLogsCollectChunkSchema, peerLogsCollectErrorSchema, peerLogsCollectRequestSchema, peerScalerEventSchema, peerScalerOrphansRequestSchema, peerScalerOrphansResponseSchema, peerScalerReloadRequestSchema, peerScalerReloadResponseSchema, peerToPeerMessageSchema, raftAppendEntriesSchema, raftVoteRequestSchema, raftVoteResponseSchema, rerouteSpawnRetrySchema, scalerLiveVmSchema, scalerReloadAnswerSchema, scalerReloadInstanceResultSchema, scalerReloadPlanSchema, scalerVmStopResultSchema, workerClusterSettingsSchema };
654
709
 
655
710
  //# sourceMappingURL=peer.js.map
@@ -5,20 +5,15 @@ import { z } from 'zod';
5
5
  * from the enclosing message so the orchestrator's evaluator and cache can type
6
6
  * against the policy alone.
7
7
  */
8
+ /** Seconds in an hour. */
9
+ export declare const SECONDS_PER_HOUR = 3600;
8
10
  /**
9
- * Documented default hours a security hold stays open.
11
+ * Documented default window a security hold stays open: 72 hours.
10
12
  *
11
13
  * The single owner of the value: the fail-closed policy, the orchestrator's
12
14
  * stored-policy default, and the hold-sizing fallback all read it, so the
13
15
  * number cannot drift between the two packages that enforce it.
14
16
  */
15
- export declare const DEFAULT_APPROVAL_EXPIRY_HOURS = 72;
16
- /** Seconds in an hour — the one conversion between the two expiry spellings. */
17
- export declare const SECONDS_PER_HOUR = 3600;
18
- /**
19
- * The same documented default as {@link DEFAULT_APPROVAL_EXPIRY_HOURS}, in the
20
- * granularity the policy actually stores.
21
- */
22
17
  export declare const DEFAULT_APPROVAL_EXPIRY_SECONDS: number;
23
18
  /**
24
19
  * The shortest expressible security-hold window.
@@ -29,34 +24,8 @@ export declare const DEFAULT_APPROVAL_EXPIRY_SECONDS: number;
29
24
  * opinion that also puts the window back out of reach of a test.
30
25
  */
31
26
  export declare const MIN_APPROVAL_EXPIRY_SECONDS = 1;
32
- /** The longest window the Platform accepts: one year, the bound already applied to hours. */
33
- export declare const MAX_APPROVAL_EXPIRY_HOURS = 8760;
34
- /** {@link MAX_APPROVAL_EXPIRY_HOURS} in seconds, so neither spelling outranges the other. */
27
+ /** The longest window the Platform accepts: one year. */
35
28
  export declare const MAX_APPROVAL_EXPIRY_SECONDS: number;
36
- /**
37
- * The window a policy actually means, in seconds.
38
- *
39
- * `approvalExpirySeconds` is the authority and `approvalExpiryHours` its coarse
40
- * spelling, so the more specific field wins whenever both are present — the
41
- * only rule that never discards what an operator asked for. A policy carrying
42
- * neither (an older peer that sent no window at all) falls back to the
43
- * documented default.
44
- */
45
- export declare function approvalExpirySecondsOf(policy: {
46
- approvalExpiryHours?: number | null;
47
- approvalExpirySeconds?: number | null;
48
- }): number;
49
- /**
50
- * The coarse `approvalExpiryHours` view of a window stored in seconds.
51
- *
52
- * Rounds UP, and never below one hour. A sub-hour window has no exact hours
53
- * spelling, and the peer reading this field is one that cannot express the real
54
- * value anyway — so the choice is which way to be wrong. Rounding up yields a
55
- * longer hold than asked for, which stays approvable; rounding down yields zero,
56
- * which is the already-expired hold `MIN_APPROVAL_EXPIRY_SECONDS` exists to
57
- * prevent.
58
- */
59
- export declare function approvalExpiryHoursOf(seconds: number): number;
60
29
  /**
61
30
  * The org-level fork switch: the setting an org's trust policy carries for how
62
31
  * fork pull requests are treated. Each value names what the operator is
@@ -102,8 +71,7 @@ export declare const trustPolicySchema: z.ZodObject<{
102
71
  hold: "hold";
103
72
  ignore: "ignore";
104
73
  }>;
105
- approvalExpiryHours: z.ZodNumber;
106
- approvalExpirySeconds: z.ZodOptional<z.ZodNumber>;
74
+ approvalExpirySeconds: z.ZodNumber;
107
75
  }, z.core.$strict>;
108
76
  export type TrustPolicy = z.infer<typeof trustPolicySchema>;
109
77
  /** Trust policy update pushed from Platform to orchestrator when policy or identity links change. */
@@ -116,8 +84,7 @@ export declare const trustPolicyUpdateSchema: z.ZodObject<{
116
84
  hold: "hold";
117
85
  ignore: "ignore";
118
86
  }>;
119
- approvalExpiryHours: z.ZodNumber;
120
- approvalExpirySeconds: z.ZodOptional<z.ZodNumber>;
87
+ approvalExpirySeconds: z.ZodNumber;
121
88
  }, z.core.$strict>;
122
89
  identityLinks: z.ZodArray<z.ZodObject<{
123
90
  userId: z.ZodString;
@@ -289,18 +256,12 @@ export declare const staleCheckrunCleanupSchema: z.ZodObject<{
289
256
  export type StaleCheckrunCleanup = z.infer<typeof staleCheckrunCleanupSchema>;
290
257
  /**
291
258
  * Platform capability advertisement, sent once by the Platform after the
292
- * orchestrator authenticates. The orchestrator caches it per connection and
293
- * pre-flight-checks its own feature-gated sends against it, so a self-hosted
294
- * orchestrator running ahead of the hosted Platform surfaces a diagnosable
295
- * capability gap instead of firing a frame the Platform would silently drop.
296
- * Payload is `platformCapabilitiesSchema` (`.passthrough()`, absent =
297
- * unsupported).
259
+ * orchestrator authenticates. Payload is `platformCapabilitiesSchema`, which
260
+ * defines no flag at protocol 4.
298
261
  */
299
262
  export declare const platformCapabilitiesMessageSchema: z.ZodObject<{
300
263
  type: z.ZodLiteral<"platform.capabilities">;
301
- capabilities: z.ZodObject<{
302
- orchMetrics: z.ZodOptional<z.ZodBoolean>;
303
- }, z.core.$loose>;
264
+ capabilities: z.ZodObject<{}, z.core.$loose>;
304
265
  }, z.core.$strip>;
305
266
  export type PlatformCapabilitiesMessage = z.infer<typeof platformCapabilitiesMessageSchema>;
306
267
  /**
@@ -388,22 +349,21 @@ export type PlanHeadroom = z.infer<typeof planHeadroomSchema>;
388
349
  /**
389
350
  * Acknowledgment that a webhook was received and processing started.
390
351
  *
391
- * Under the chunked relay protocol the orchestrator also reports the HMAC
392
- * verification outcome here via `result`, and may include a non-secret-bearing
393
- * diagnostic in `reason` when result is a rejection. Both fields are optional
394
- * for backward compatibility during the rollout: pre-cutover senders omit them.
352
+ * The orchestrator reports the HMAC verification outcome via `result`, and may
353
+ * include a non-secret-bearing diagnostic in `reason` when result is a
354
+ * rejection.
395
355
  */
396
356
  export declare const webhookAckSchema: z.ZodObject<{
397
357
  type: z.ZodLiteral<"webhook.ack">;
398
358
  messageId: z.ZodString;
399
359
  deliveryId: z.ZodString;
400
- result: z.ZodOptional<z.ZodEnum<{
360
+ result: z.ZodEnum<{
401
361
  accepted: "accepted";
402
362
  rejected_misconfigured: "rejected_misconfigured";
403
363
  rejected_signature: "rejected_signature";
404
364
  rejected_unknown_source: "rejected_unknown_source";
405
365
  shed_retry_later: "shed_retry_later";
406
- }>>;
366
+ }>;
407
367
  reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
408
368
  }, z.core.$strip>;
409
369
  /** Execution lifecycle event reported back to Platform. */
@@ -429,10 +389,10 @@ export declare const logChunkSchema: z.ZodObject<{
429
389
  stepIndex: z.ZodNumber;
430
390
  lines: z.ZodArray<z.ZodString>;
431
391
  timestamp: z.ZodNumber;
432
- stream: z.ZodOptional<z.ZodEnum<{
392
+ stream: z.ZodEnum<{
433
393
  stderr: "stderr";
434
394
  stdout: "stdout";
435
- }>>;
395
+ }>;
436
396
  }, z.core.$strip>;
437
397
  /**
438
398
  * Phase of an orchestration/provisioning log line. Mirrors the phases the
@@ -486,67 +446,6 @@ export declare const cacheStatsSchema: z.ZodObject<{
486
446
  hit: z.ZodBoolean;
487
447
  }, z.core.$strip>;
488
448
  export type CacheStats = z.infer<typeof cacheStatsSchema>;
489
- /**
490
- * Runtime broadcast of an updated dashboard-write policy. Carries the
491
- * orch's full capabilities object (same shape as `orchCapabilitiesSchema`
492
- * via `auth.request`) so Platform's per-org cache can be replaced
493
- * wholesale rather than merged. Emitted by the orch whenever an
494
- * operator flips a switch via `kici-admin org-settings dashboard-writes`;
495
- * Platform receives it, updates its cache, and re-broadcasts the
496
- * relevant subset to any connected dashboard SPA sessions.
497
- */
498
- export declare const orchCapabilitiesUpdateSchema: z.ZodObject<{
499
- type: z.ZodLiteral<"orch.capabilities.update">;
500
- capabilities: z.ZodObject<{
501
- orchRole: z.ZodOptional<z.ZodEnum<{
502
- coordinator: "coordinator";
503
- worker: "worker";
504
- }>>;
505
- dashboardWrites: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
506
- "attestations.retry": "attestations.retry";
507
- "backends.sync": "backends.sync";
508
- "backends.sync_one": "backends.sync_one";
509
- "backends.test": "backends.test";
510
- "contexts.bindings.set": "contexts.bindings.set";
511
- "contexts.create": "contexts.create";
512
- "contexts.delete": "contexts.delete";
513
- "contexts.source_overrides.delete": "contexts.source_overrides.delete";
514
- "contexts.source_overrides.set": "contexts.source_overrides.set";
515
- "contexts.test_access.set": "contexts.test_access.set";
516
- "contexts.update": "contexts.update";
517
- "event_dlq.discard": "event_dlq.discard";
518
- "event_dlq.retry": "event_dlq.retry";
519
- "fleet.host.declare": "fleet.host.declare";
520
- "fleet.host.remove": "fleet.host.remove";
521
- "global_workflows.update": "global_workflows.update";
522
- "held_runs.approve": "held_runs.approve";
523
- "held_runs.reject": "held_runs.reject";
524
- "registration.delete": "registration.delete";
525
- "registration.disable": "registration.disable";
526
- "secrets.delete": "secrets.delete";
527
- "secrets.scope.create": "secrets.scope.create";
528
- "secrets.scope.delete": "secrets.scope.delete";
529
- "secrets.scope.rename": "secrets.scope.rename";
530
- "secrets.set": "secrets.set";
531
- "variables.delete": "variables.delete";
532
- "variables.set": "variables.set";
533
- }> & z.core.$partial, z.ZodEnum<{
534
- disabled: "disabled";
535
- encrypted: "encrypted";
536
- permissive: "permissive";
537
- }>>>;
538
- supportedDashboardRequests: z.ZodOptional<z.ZodArray<z.ZodString>>;
539
- dashboardEncryptionKey: z.ZodOptional<z.ZodObject<{
540
- kty: z.ZodLiteral<"OKP">;
541
- crv: z.ZodLiteral<"X25519">;
542
- x: z.ZodString;
543
- kid: z.ZodString;
544
- use: z.ZodOptional<z.ZodLiteral<"enc">>;
545
- }, z.core.$loose>>;
546
- dashboardVerifiedIssuer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
547
- }, z.core.$loose>;
548
- }, z.core.$strip>;
549
- export type OrchCapabilitiesUpdate = z.infer<typeof orchCapabilitiesUpdateSchema>;
550
449
  /** All messages that flow from Platform to Orchestrator.
551
450
  *
552
451
  * The single-frame `webhookRelaySchema` is intentionally NOT a member of this
@@ -587,8 +486,7 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
587
486
  hold: "hold";
588
487
  ignore: "ignore";
589
488
  }>;
590
- approvalExpiryHours: z.ZodNumber;
591
- approvalExpirySeconds: z.ZodOptional<z.ZodNumber>;
489
+ approvalExpirySeconds: z.ZodNumber;
592
490
  }, z.core.$strict>;
593
491
  identityLinks: z.ZodArray<z.ZodObject<{
594
492
  userId: z.ZodString;
@@ -630,9 +528,9 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
630
528
  }, z.core.$strip>, z.ZodObject<{
631
529
  type: z.ZodLiteral<"auth.success">;
632
530
  connectionId: z.ZodString;
633
- orgPublicAlias: z.ZodOptional<z.ZodString>;
634
- orgId: z.ZodOptional<z.ZodString>;
635
- provenanceIssuer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
531
+ orgPublicAlias: z.ZodString;
532
+ orgId: z.ZodString;
533
+ githubWebhookUrl: z.ZodNullable<z.ZodString>;
636
534
  }, z.core.$strip>, z.ZodObject<{
637
535
  type: z.ZodLiteral<"auth.failure">;
638
536
  reason: z.ZodString;
@@ -670,9 +568,7 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
670
568
  }, z.core.$strip>>;
671
569
  }, z.core.$strip>, z.ZodObject<{
672
570
  type: z.ZodLiteral<"platform.capabilities">;
673
- capabilities: z.ZodObject<{
674
- orchMetrics: z.ZodOptional<z.ZodBoolean>;
675
- }, z.core.$loose>;
571
+ capabilities: z.ZodObject<{}, z.core.$loose>;
676
572
  }, z.core.$strip>, z.ZodObject<{
677
573
  type: z.ZodLiteral<"plan.headroom">;
678
574
  maxWorkerPeers: z.ZodNumber;
@@ -1124,7 +1020,7 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1124
1020
  component: z.ZodString;
1125
1021
  }, z.core.$strip>], "type">;
1126
1022
  runId: z.ZodString;
1127
- routingKey: z.ZodOptional<z.ZodString>;
1023
+ routingKey: z.ZodString;
1128
1024
  }, z.core.$strip>, z.ZodObject<{
1129
1025
  type: z.ZodLiteral<"run.manual_schedule.request">;
1130
1026
  requestId: z.ZodString;
@@ -2961,6 +2857,7 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
2961
2857
  "db.create_role": "db.create_role";
2962
2858
  "db.ensure": "db.ensure";
2963
2859
  "db.fresh": "db.fresh";
2860
+ "db.migrate": "db.migrate";
2964
2861
  "db.refresh_collation_version": "db.refresh_collation_version";
2965
2862
  "db.reindex": "db.reindex";
2966
2863
  "diagnostics.read": "diagnostics.read";
@@ -3004,6 +2901,7 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
3004
2901
  "scaler.capacity.read": "scaler.capacity.read";
3005
2902
  "scaler.orphan.stop": "scaler.orphan.stop";
3006
2903
  "scaler.orphans.read": "scaler.orphans.read";
2904
+ "scaler.reload": "scaler.reload";
3007
2905
  "secret.delete": "secret.delete";
3008
2906
  "secret.list.read": "secret.list.read";
3009
2907
  "secret.reveal": "secret.reveal";
@@ -3271,13 +3169,13 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
3271
3169
  type: z.ZodLiteral<"webhook.ack">;
3272
3170
  messageId: z.ZodString;
3273
3171
  deliveryId: z.ZodString;
3274
- result: z.ZodOptional<z.ZodEnum<{
3172
+ result: z.ZodEnum<{
3275
3173
  accepted: "accepted";
3276
3174
  rejected_misconfigured: "rejected_misconfigured";
3277
3175
  rejected_signature: "rejected_signature";
3278
3176
  rejected_unknown_source: "rejected_unknown_source";
3279
3177
  shed_retry_later: "shed_retry_later";
3280
- }>>;
3178
+ }>;
3281
3179
  reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3282
3180
  }, z.core.$strip>, z.ZodObject<{
3283
3181
  type: z.ZodLiteral<"execution.event">;
@@ -3299,10 +3197,10 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
3299
3197
  stepIndex: z.ZodNumber;
3300
3198
  lines: z.ZodArray<z.ZodString>;
3301
3199
  timestamp: z.ZodNumber;
3302
- stream: z.ZodOptional<z.ZodEnum<{
3200
+ stream: z.ZodEnum<{
3303
3201
  stderr: "stderr";
3304
3202
  stdout: "stdout";
3305
- }>>;
3203
+ }>;
3306
3204
  }, z.core.$strip>, z.ZodObject<{
3307
3205
  type: z.ZodLiteral<"orch-log.chunk">;
3308
3206
  runId: z.ZodString;
@@ -3382,7 +3280,7 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
3382
3280
  step_failure: "step_failure";
3383
3281
  timed_out: "timed_out";
3384
3282
  }>>;
3385
- statusEpoch: z.ZodOptional<z.ZodNumber>;
3283
+ statusEpoch: z.ZodNumber;
3386
3284
  }, z.core.$strip>, z.ZodObject<{
3387
3285
  type: z.ZodLiteral<"step.status.forward">;
3388
3286
  messageId: z.ZodString;
@@ -3504,7 +3402,7 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
3504
3402
  step_failure: "step_failure";
3505
3403
  timed_out: "timed_out";
3506
3404
  }>>;
3507
- statusEpoch: z.ZodOptional<z.ZodNumber>;
3405
+ statusEpoch: z.ZodNumber;
3508
3406
  jobs: z.ZodArray<z.ZodObject<{
3509
3407
  jobId: z.ZodString;
3510
3408
  jobName: z.ZodString;
@@ -3522,10 +3420,10 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
3522
3420
  }, z.core.$strip>, z.ZodObject<{
3523
3421
  type: z.ZodLiteral<"orch.capabilities.update">;
3524
3422
  capabilities: z.ZodObject<{
3525
- orchRole: z.ZodOptional<z.ZodEnum<{
3423
+ orchRole: z.ZodEnum<{
3526
3424
  coordinator: "coordinator";
3527
3425
  worker: "worker";
3528
- }>>;
3426
+ }>;
3529
3427
  dashboardWrites: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
3530
3428
  "attestations.retry": "attestations.retry";
3531
3429
  "backends.sync": "backends.sync";
@@ -3559,7 +3457,6 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
3559
3457
  encrypted: "encrypted";
3560
3458
  permissive: "permissive";
3561
3459
  }>>>;
3562
- supportedDashboardRequests: z.ZodOptional<z.ZodArray<z.ZodString>>;
3563
3460
  dashboardEncryptionKey: z.ZodOptional<z.ZodObject<{
3564
3461
  kty: z.ZodLiteral<"OKP">;
3565
3462
  crv: z.ZodLiteral<"X25519">;
@@ -3639,11 +3536,11 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
3639
3536
  type: z.ZodLiteral<"auth.request">;
3640
3537
  token: z.ZodString;
3641
3538
  protocolVersion: z.ZodNumber;
3642
- capabilities: z.ZodOptional<z.ZodObject<{
3643
- orchRole: z.ZodOptional<z.ZodEnum<{
3539
+ capabilities: z.ZodObject<{
3540
+ orchRole: z.ZodEnum<{
3644
3541
  coordinator: "coordinator";
3645
3542
  worker: "worker";
3646
- }>>;
3543
+ }>;
3647
3544
  dashboardWrites: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
3648
3545
  "attestations.retry": "attestations.retry";
3649
3546
  "backends.sync": "backends.sync";
@@ -3677,7 +3574,6 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
3677
3574
  encrypted: "encrypted";
3678
3575
  permissive: "permissive";
3679
3576
  }>>>;
3680
- supportedDashboardRequests: z.ZodOptional<z.ZodArray<z.ZodString>>;
3681
3577
  dashboardEncryptionKey: z.ZodOptional<z.ZodObject<{
3682
3578
  kty: z.ZodLiteral<"OKP">;
3683
3579
  crv: z.ZodLiteral<"X25519">;
@@ -3686,7 +3582,7 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
3686
3582
  use: z.ZodOptional<z.ZodLiteral<"enc">>;
3687
3583
  }, z.core.$loose>>;
3688
3584
  dashboardVerifiedIssuer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3689
- }, z.core.$loose>>;
3585
+ }, z.core.$loose>;
3690
3586
  }, z.core.$strip>, z.ZodObject<{
3691
3587
  type: z.ZodLiteral<"heartbeat">;
3692
3588
  timestamp: z.ZodNumber;
@@ -3808,7 +3704,6 @@ export declare const ORCH_TO_PLATFORM_RECOGNIZED_TYPES: ReadonlySet<string>;
3808
3704
  export declare const PLATFORM_TO_ORCH_RECOGNIZED_TYPES: ReadonlySet<string>;
3809
3705
  export type WebhookRelay = z.infer<typeof webhookRelaySchema>;
3810
3706
  export type WebhookAck = z.infer<typeof webhookAckSchema>;
3811
- export type ExecutionEvent = z.infer<typeof executionEventSchema>;
3812
3707
  export type LogChunk = z.infer<typeof logChunkSchema>;
3813
3708
  export type PeerDiscover = z.infer<typeof peerDiscoverSchema>;
3814
3709
  export type PeerUpdate = z.infer<typeof peerUpdateSchema>;