@kici-dev/engine 0.15.0 → 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 (54) 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 +18 -13
  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 -10
  23. package/dist/protocol/messages/auth.js +8 -22
  24. package/dist/protocol/messages/browser.js +1 -1
  25. package/dist/protocol/messages/capabilities.d.ts +21 -106
  26. package/dist/protocol/messages/capabilities.js +23 -133
  27. package/dist/protocol/messages/dashboard.d.ts +24 -28
  28. package/dist/protocol/messages/dashboard.js +19 -38
  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/orchestrator-agent.d.ts +35 -40
  32. package/dist/protocol/messages/orchestrator-agent.js +63 -96
  33. package/dist/protocol/messages/peer.d.ts +223 -18
  34. package/dist/protocol/messages/peer.js +90 -55
  35. package/dist/protocol/messages/platform-orchestrator.d.ts +36 -145
  36. package/dist/protocol/messages/platform-orchestrator.js +24 -86
  37. package/dist/protocol/messages/source-registration.d.ts +0 -13
  38. package/dist/protocol/messages/source-registration.js +9 -10
  39. package/dist/protocol/version.d.ts +9 -15
  40. package/dist/protocol/version.js +9 -15
  41. package/dist/provenance/id-token-claim-names.d.ts +3 -5
  42. package/dist/provenance/id-token-claim-names.js +3 -5
  43. package/dist/status/presentation.d.ts +2 -14
  44. package/dist/status/presentation.js +3 -23
  45. package/dist/trigger/types.d.ts +125 -34
  46. package/dist/trigger/types.js +9 -24
  47. package/dist/util/date.d.ts +7 -0
  48. package/dist/util/date.js +14 -0
  49. package/dist/util/parse-duration.d.ts +6 -0
  50. package/dist/util/parse-duration.js +21 -0
  51. package/dist/util/sleep.d.ts +3 -0
  52. package/dist/util/sleep.js +10 -0
  53. package/package.json +1 -1
  54. package/sbom.spdx.json +5 -5
@@ -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,68 +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
- clusterJoinV2: z.ZodOptional<z.ZodBoolean>;
548
- }, z.core.$loose>;
549
- }, z.core.$strip>;
550
- export type OrchCapabilitiesUpdate = z.infer<typeof orchCapabilitiesUpdateSchema>;
551
449
  /** All messages that flow from Platform to Orchestrator.
552
450
  *
553
451
  * The single-frame `webhookRelaySchema` is intentionally NOT a member of this
@@ -588,8 +486,7 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
588
486
  hold: "hold";
589
487
  ignore: "ignore";
590
488
  }>;
591
- approvalExpiryHours: z.ZodNumber;
592
- approvalExpirySeconds: z.ZodOptional<z.ZodNumber>;
489
+ approvalExpirySeconds: z.ZodNumber;
593
490
  }, z.core.$strict>;
594
491
  identityLinks: z.ZodArray<z.ZodObject<{
595
492
  userId: z.ZodString;
@@ -631,10 +528,9 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
631
528
  }, z.core.$strip>, z.ZodObject<{
632
529
  type: z.ZodLiteral<"auth.success">;
633
530
  connectionId: z.ZodString;
634
- orgPublicAlias: z.ZodOptional<z.ZodString>;
635
- orgId: z.ZodOptional<z.ZodString>;
636
- provenanceIssuer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
637
- githubWebhookUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
531
+ orgPublicAlias: z.ZodString;
532
+ orgId: z.ZodString;
533
+ githubWebhookUrl: z.ZodNullable<z.ZodString>;
638
534
  }, z.core.$strip>, z.ZodObject<{
639
535
  type: z.ZodLiteral<"auth.failure">;
640
536
  reason: z.ZodString;
@@ -672,9 +568,7 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
672
568
  }, z.core.$strip>>;
673
569
  }, z.core.$strip>, z.ZodObject<{
674
570
  type: z.ZodLiteral<"platform.capabilities">;
675
- capabilities: z.ZodObject<{
676
- orchMetrics: z.ZodOptional<z.ZodBoolean>;
677
- }, z.core.$loose>;
571
+ capabilities: z.ZodObject<{}, z.core.$loose>;
678
572
  }, z.core.$strip>, z.ZodObject<{
679
573
  type: z.ZodLiteral<"plan.headroom">;
680
574
  maxWorkerPeers: z.ZodNumber;
@@ -1126,7 +1020,7 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1126
1020
  component: z.ZodString;
1127
1021
  }, z.core.$strip>], "type">;
1128
1022
  runId: z.ZodString;
1129
- routingKey: z.ZodOptional<z.ZodString>;
1023
+ routingKey: z.ZodString;
1130
1024
  }, z.core.$strip>, z.ZodObject<{
1131
1025
  type: z.ZodLiteral<"run.manual_schedule.request">;
1132
1026
  requestId: z.ZodString;
@@ -2963,6 +2857,7 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
2963
2857
  "db.create_role": "db.create_role";
2964
2858
  "db.ensure": "db.ensure";
2965
2859
  "db.fresh": "db.fresh";
2860
+ "db.migrate": "db.migrate";
2966
2861
  "db.refresh_collation_version": "db.refresh_collation_version";
2967
2862
  "db.reindex": "db.reindex";
2968
2863
  "diagnostics.read": "diagnostics.read";
@@ -3006,6 +2901,7 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
3006
2901
  "scaler.capacity.read": "scaler.capacity.read";
3007
2902
  "scaler.orphan.stop": "scaler.orphan.stop";
3008
2903
  "scaler.orphans.read": "scaler.orphans.read";
2904
+ "scaler.reload": "scaler.reload";
3009
2905
  "secret.delete": "secret.delete";
3010
2906
  "secret.list.read": "secret.list.read";
3011
2907
  "secret.reveal": "secret.reveal";
@@ -3273,13 +3169,13 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
3273
3169
  type: z.ZodLiteral<"webhook.ack">;
3274
3170
  messageId: z.ZodString;
3275
3171
  deliveryId: z.ZodString;
3276
- result: z.ZodOptional<z.ZodEnum<{
3172
+ result: z.ZodEnum<{
3277
3173
  accepted: "accepted";
3278
3174
  rejected_misconfigured: "rejected_misconfigured";
3279
3175
  rejected_signature: "rejected_signature";
3280
3176
  rejected_unknown_source: "rejected_unknown_source";
3281
3177
  shed_retry_later: "shed_retry_later";
3282
- }>>;
3178
+ }>;
3283
3179
  reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3284
3180
  }, z.core.$strip>, z.ZodObject<{
3285
3181
  type: z.ZodLiteral<"execution.event">;
@@ -3301,10 +3197,10 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
3301
3197
  stepIndex: z.ZodNumber;
3302
3198
  lines: z.ZodArray<z.ZodString>;
3303
3199
  timestamp: z.ZodNumber;
3304
- stream: z.ZodOptional<z.ZodEnum<{
3200
+ stream: z.ZodEnum<{
3305
3201
  stderr: "stderr";
3306
3202
  stdout: "stdout";
3307
- }>>;
3203
+ }>;
3308
3204
  }, z.core.$strip>, z.ZodObject<{
3309
3205
  type: z.ZodLiteral<"orch-log.chunk">;
3310
3206
  runId: z.ZodString;
@@ -3384,7 +3280,7 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
3384
3280
  step_failure: "step_failure";
3385
3281
  timed_out: "timed_out";
3386
3282
  }>>;
3387
- statusEpoch: z.ZodOptional<z.ZodNumber>;
3283
+ statusEpoch: z.ZodNumber;
3388
3284
  }, z.core.$strip>, z.ZodObject<{
3389
3285
  type: z.ZodLiteral<"step.status.forward">;
3390
3286
  messageId: z.ZodString;
@@ -3506,7 +3402,7 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
3506
3402
  step_failure: "step_failure";
3507
3403
  timed_out: "timed_out";
3508
3404
  }>>;
3509
- statusEpoch: z.ZodOptional<z.ZodNumber>;
3405
+ statusEpoch: z.ZodNumber;
3510
3406
  jobs: z.ZodArray<z.ZodObject<{
3511
3407
  jobId: z.ZodString;
3512
3408
  jobName: z.ZodString;
@@ -3524,10 +3420,10 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
3524
3420
  }, z.core.$strip>, z.ZodObject<{
3525
3421
  type: z.ZodLiteral<"orch.capabilities.update">;
3526
3422
  capabilities: z.ZodObject<{
3527
- orchRole: z.ZodOptional<z.ZodEnum<{
3423
+ orchRole: z.ZodEnum<{
3528
3424
  coordinator: "coordinator";
3529
3425
  worker: "worker";
3530
- }>>;
3426
+ }>;
3531
3427
  dashboardWrites: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
3532
3428
  "attestations.retry": "attestations.retry";
3533
3429
  "backends.sync": "backends.sync";
@@ -3561,7 +3457,6 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
3561
3457
  encrypted: "encrypted";
3562
3458
  permissive: "permissive";
3563
3459
  }>>>;
3564
- supportedDashboardRequests: z.ZodOptional<z.ZodArray<z.ZodString>>;
3565
3460
  dashboardEncryptionKey: z.ZodOptional<z.ZodObject<{
3566
3461
  kty: z.ZodLiteral<"OKP">;
3567
3462
  crv: z.ZodLiteral<"X25519">;
@@ -3570,7 +3465,6 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
3570
3465
  use: z.ZodOptional<z.ZodLiteral<"enc">>;
3571
3466
  }, z.core.$loose>>;
3572
3467
  dashboardVerifiedIssuer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3573
- clusterJoinV2: z.ZodOptional<z.ZodBoolean>;
3574
3468
  }, z.core.$loose>;
3575
3469
  }, z.core.$strip>, z.ZodObject<{
3576
3470
  type: z.ZodLiteral<"source.register">;
@@ -3642,11 +3536,11 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
3642
3536
  type: z.ZodLiteral<"auth.request">;
3643
3537
  token: z.ZodString;
3644
3538
  protocolVersion: z.ZodNumber;
3645
- capabilities: z.ZodOptional<z.ZodObject<{
3646
- orchRole: z.ZodOptional<z.ZodEnum<{
3539
+ capabilities: z.ZodObject<{
3540
+ orchRole: z.ZodEnum<{
3647
3541
  coordinator: "coordinator";
3648
3542
  worker: "worker";
3649
- }>>;
3543
+ }>;
3650
3544
  dashboardWrites: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
3651
3545
  "attestations.retry": "attestations.retry";
3652
3546
  "backends.sync": "backends.sync";
@@ -3680,7 +3574,6 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
3680
3574
  encrypted: "encrypted";
3681
3575
  permissive: "permissive";
3682
3576
  }>>>;
3683
- supportedDashboardRequests: z.ZodOptional<z.ZodArray<z.ZodString>>;
3684
3577
  dashboardEncryptionKey: z.ZodOptional<z.ZodObject<{
3685
3578
  kty: z.ZodLiteral<"OKP">;
3686
3579
  crv: z.ZodLiteral<"X25519">;
@@ -3689,8 +3582,7 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
3689
3582
  use: z.ZodOptional<z.ZodLiteral<"enc">>;
3690
3583
  }, z.core.$loose>>;
3691
3584
  dashboardVerifiedIssuer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3692
- clusterJoinV2: z.ZodOptional<z.ZodBoolean>;
3693
- }, z.core.$loose>>;
3585
+ }, z.core.$loose>;
3694
3586
  }, z.core.$strip>, z.ZodObject<{
3695
3587
  type: z.ZodLiteral<"heartbeat">;
3696
3588
  timestamp: z.ZodNumber;
@@ -3812,7 +3704,6 @@ export declare const ORCH_TO_PLATFORM_RECOGNIZED_TYPES: ReadonlySet<string>;
3812
3704
  export declare const PLATFORM_TO_ORCH_RECOGNIZED_TYPES: ReadonlySet<string>;
3813
3705
  export type WebhookRelay = z.infer<typeof webhookRelaySchema>;
3814
3706
  export type WebhookAck = z.infer<typeof webhookAckSchema>;
3815
- export type ExecutionEvent = z.infer<typeof executionEventSchema>;
3816
3707
  export type LogChunk = z.infer<typeof logChunkSchema>;
3817
3708
  export type PeerDiscover = z.infer<typeof peerDiscoverSchema>;
3818
3709
  export type PeerUpdate = z.infer<typeof peerUpdateSchema>;
@@ -1,12 +1,12 @@
1
1
  import "../../rolldown-runtime-ClRpJifh.js";
2
2
  import { heartbeatSchema, nackSchema } from "./common.js";
3
- import { executionStatusSchema, jobStatusForwardSchema, stateReplaySchema, stepStatusForwardSchema } from "./execution-status.js";
4
- import { jobContextMessageSchema, runEventMessageSchema } from "./run-events.js";
5
- import { sourceDeregisterAckSchema, sourceDeregisterSchema, sourceRegistrationAckSchema, sourceRegistrationSchema } from "./source-registration.js";
6
- import { dashboardPlatformToOrchSchema } from "./dashboard.js";
7
3
  import { OrchRole, orchCapabilitiesSchema, platformCapabilitiesSchema } from "./capabilities.js";
8
4
  import { authFailureSchema, authRequestSchema, authSuccessSchema } from "./auth.js";
9
5
  import { LogStream } from "./log-stream.js";
6
+ import { executionStatusSchema, jobStatusForwardSchema, stateReplaySchema, stepStatusForwardSchema } from "./execution-status.js";
7
+ import { sourceDeregisterAckSchema, sourceDeregisterSchema, sourceRegistrationAckSchema, sourceRegistrationSchema } from "./source-registration.js";
8
+ import { jobContextMessageSchema, runEventMessageSchema } from "./run-events.js";
9
+ import { dashboardPlatformToOrchSchema } from "./dashboard.js";
10
10
  import { z } from "zod";
11
11
  //#region src/protocol/messages/platform-orchestrator.ts
12
12
  /**
@@ -15,20 +15,15 @@ import { z } from "zod";
15
15
  * from the enclosing message so the orchestrator's evaluator and cache can type
16
16
  * against the policy alone.
17
17
  */
18
+ /** Seconds in an hour. */
19
+ const SECONDS_PER_HOUR = 3600;
18
20
  /**
19
- * Documented default hours a security hold stays open.
21
+ * Documented default window a security hold stays open: 72 hours.
20
22
  *
21
23
  * The single owner of the value: the fail-closed policy, the orchestrator's
22
24
  * stored-policy default, and the hold-sizing fallback all read it, so the
23
25
  * number cannot drift between the two packages that enforce it.
24
26
  */
25
- const DEFAULT_APPROVAL_EXPIRY_HOURS = 72;
26
- /** Seconds in an hour — the one conversion between the two expiry spellings. */
27
- const SECONDS_PER_HOUR = 3600;
28
- /**
29
- * The same documented default as {@link DEFAULT_APPROVAL_EXPIRY_HOURS}, in the
30
- * granularity the policy actually stores.
31
- */
32
27
  const DEFAULT_APPROVAL_EXPIRY_SECONDS = 72 * SECONDS_PER_HOUR;
33
28
  /**
34
29
  * The shortest expressible security-hold window.
@@ -39,37 +34,8 @@ const DEFAULT_APPROVAL_EXPIRY_SECONDS = 72 * SECONDS_PER_HOUR;
39
34
  * opinion that also puts the window back out of reach of a test.
40
35
  */
41
36
  const MIN_APPROVAL_EXPIRY_SECONDS = 1;
42
- /** The longest window the Platform accepts: one year, the bound already applied to hours. */
43
- const MAX_APPROVAL_EXPIRY_HOURS = 8760;
44
- /** {@link MAX_APPROVAL_EXPIRY_HOURS} in seconds, so neither spelling outranges the other. */
45
- const MAX_APPROVAL_EXPIRY_SECONDS = MAX_APPROVAL_EXPIRY_HOURS * SECONDS_PER_HOUR;
46
- /**
47
- * The window a policy actually means, in seconds.
48
- *
49
- * `approvalExpirySeconds` is the authority and `approvalExpiryHours` its coarse
50
- * spelling, so the more specific field wins whenever both are present — the
51
- * only rule that never discards what an operator asked for. A policy carrying
52
- * neither (an older peer that sent no window at all) falls back to the
53
- * documented default.
54
- */
55
- function approvalExpirySecondsOf(policy) {
56
- if (policy.approvalExpirySeconds != null) return policy.approvalExpirySeconds;
57
- if (policy.approvalExpiryHours != null) return policy.approvalExpiryHours * SECONDS_PER_HOUR;
58
- return DEFAULT_APPROVAL_EXPIRY_SECONDS;
59
- }
60
- /**
61
- * The coarse `approvalExpiryHours` view of a window stored in seconds.
62
- *
63
- * Rounds UP, and never below one hour. A sub-hour window has no exact hours
64
- * spelling, and the peer reading this field is one that cannot express the real
65
- * value anyway — so the choice is which way to be wrong. Rounding up yields a
66
- * longer hold than asked for, which stays approvable; rounding down yields zero,
67
- * which is the already-expired hold `MIN_APPROVAL_EXPIRY_SECONDS` exists to
68
- * prevent.
69
- */
70
- function approvalExpiryHoursOf(seconds) {
71
- return Math.max(1, Math.ceil(seconds / SECONDS_PER_HOUR));
72
- }
37
+ /** The longest window the Platform accepts: one year. */
38
+ const MAX_APPROVAL_EXPIRY_SECONDS = 8760 * SECONDS_PER_HOUR;
73
39
  /**
74
40
  * The org-level fork switch: the setting an org's trust policy carries for how
75
41
  * fork pull requests are treated. Each value names what the operator is
@@ -110,31 +76,14 @@ const CiTrustLevel = z.enum([
110
76
  const trustPolicySchema = z.object({
111
77
  forkPolicy: ForkPolicy,
112
78
  /**
113
- * Hours a security hold stays open — the coarse spelling of
114
- * `approvalExpirySeconds`, kept required so an orchestrator or CLI on an
115
- * older build still receives a window it can read. Not deprecated: it is read,
116
- * enforced whenever no seconds value accompanies it, and remains the
117
- * ergonomic way to say "72 hours".
118
- *
119
- * Integer and positive: the column is INTEGER NOT NULL, so a fractional value
120
- * throws inside the fire-and-forget persist and the policy is then silently
121
- * never stored, and a zero or negative value mints an already-expired hold.
122
- */
123
- approvalExpiryHours: z.number().int().min(1),
124
- /**
125
- * Seconds a security hold stays open — the authoritative window, and the one
126
- * granularity that can express a sub-hour hold.
79
+ * Seconds a security hold stays open.
127
80
  *
128
- * Optional because an older Platform sends only the hours field; a frame
129
- * without it resolves through {@link approvalExpirySecondsOf}, which falls
130
- * back to `approvalExpiryHours * SECONDS_PER_HOUR`. When both are present this
131
- * one wins, at every layer.
132
- *
133
- * Integer and at least {@link MIN_APPROVAL_EXPIRY_SECONDS} for the same two
134
- * reasons the hours field is: the column is INTEGER, and a non-positive window
81
+ * Integer and at least {@link MIN_APPROVAL_EXPIRY_SECONDS}: the column is
82
+ * INTEGER, so a fractional value throws inside the fire-and-forget persist
83
+ * and the policy is then silently never stored, and a non-positive window
135
84
  * mints an already-expired hold.
136
85
  */
137
- approvalExpirySeconds: z.number().int().min(1).optional()
86
+ approvalExpirySeconds: z.number().int().min(1)
138
87
  }).strict();
139
88
  /** Trust policy update pushed from Platform to orchestrator when policy or identity links change. */
140
89
  const trustPolicyUpdateSchema = z.object({
@@ -345,12 +294,8 @@ const staleCheckrunCleanupSchema = z.object({
345
294
  });
346
295
  /**
347
296
  * Platform capability advertisement, sent once by the Platform after the
348
- * orchestrator authenticates. The orchestrator caches it per connection and
349
- * pre-flight-checks its own feature-gated sends against it, so a self-hosted
350
- * orchestrator running ahead of the hosted Platform surfaces a diagnosable
351
- * capability gap instead of firing a frame the Platform would silently drop.
352
- * Payload is `platformCapabilitiesSchema` (`.passthrough()`, absent =
353
- * unsupported).
297
+ * orchestrator authenticates. Payload is `platformCapabilitiesSchema`, which
298
+ * defines no flag at protocol 4.
354
299
  */
355
300
  const platformCapabilitiesMessageSchema = z.object({
356
301
  type: z.literal("platform.capabilities"),
@@ -436,20 +381,16 @@ const planHeadroomSchema = z.object({
436
381
  /**
437
382
  * Acknowledgment that a webhook was received and processing started.
438
383
  *
439
- * Under the chunked relay protocol the orchestrator also reports the HMAC
440
- * verification outcome here via `result`, and may include a non-secret-bearing
441
- * diagnostic in `reason` when result is a rejection. Both fields are optional
442
- * for backward compatibility during the rollout: pre-cutover senders omit them.
384
+ * The orchestrator reports the HMAC verification outcome via `result`, and may
385
+ * include a non-secret-bearing diagnostic in `reason` when result is a
386
+ * rejection.
443
387
  */
444
388
  const webhookAckSchema = z.object({
445
389
  type: z.literal("webhook.ack"),
446
390
  messageId: z.string(),
447
391
  deliveryId: z.string(),
448
- /**
449
- * Verification + processing outcome. Required from the chunked relay path
450
- * (commit 3 onwards on the orch side); pre-chunked acks omit this.
451
- */
452
- result: WebhookRelayResult.optional(),
392
+ /** Verification + processing outcome. */
393
+ result: WebhookRelayResult,
453
394
  /**
454
395
  * Optional non-secret-bearing diagnostic for rejection cases. MUST NOT
455
396
  * include any secret material (HMAC keys, bearer tokens, computed signatures).
@@ -479,11 +420,8 @@ const logChunkSchema = z.object({
479
420
  stepIndex: z.number(),
480
421
  lines: z.array(z.string()),
481
422
  timestamp: z.number(),
482
- /**
483
- * Which stream these lines came from. Optional for backward compatibility
484
- * with orchestrators that do not send it; absent is read as `stdout`.
485
- */
486
- stream: LogStream.optional()
423
+ /** Which stream these lines came from. */
424
+ stream: LogStream
487
425
  });
488
426
  /**
489
427
  * Phase of an orchestration/provisioning log line. Mirrors the phases the
@@ -620,6 +558,6 @@ const ORCH_TO_PLATFORM_RECOGNIZED_TYPES = new Set(collectDiscriminatorTypes(orch
620
558
  */
621
559
  const PLATFORM_TO_ORCH_RECOGNIZED_TYPES = new Set(collectDiscriminatorTypes(platformToOrchestratorMessageSchema));
622
560
  //#endregion
623
- export { CLUSTER_MEMBERSHIP_MAX_WORKERS, CiTrustLevel, DEFAULT_APPROVAL_EXPIRY_HOURS, DEFAULT_APPROVAL_EXPIRY_SECONDS, ForkPolicy, MAX_APPROVAL_EXPIRY_HOURS, MAX_APPROVAL_EXPIRY_SECONDS, MIN_APPROVAL_EXPIRY_SECONDS, ORCH_TO_PLATFORM_RECOGNIZED_TYPES, OrchLogPhase, PLATFORM_TO_ORCH_RECOGNIZED_TYPES, SECONDS_PER_HOUR, WEBHOOK_RELAY_CHUNK_SIZE, WEBHOOK_RELAY_MAX_BODY_BYTES, WebhookRelayResult, approvalExpiryHoursOf, approvalExpirySecondsOf, cacheStatsSchema, clusterMembershipSchema, collectDiscriminatorTypes, executionEventSchema, logChunkSchema, orchCapabilitiesUpdateSchema, orchLogChunkSchema, orchMetricsSchema, orchestratorToPlatformMessageSchema, peerDiscoverSchema, peerUpdateSchema, planHeadroomSchema, platformCapabilitiesMessageSchema, platformToOrchestratorMessageSchema, staleCheckrunCleanupSchema, trustPolicySchema, trustPolicyUpdateSchema, webhookAckSchema, webhookRelayChunkSchema, webhookRelaySchema, webhookRelayStartSchema };
561
+ export { CLUSTER_MEMBERSHIP_MAX_WORKERS, CiTrustLevel, DEFAULT_APPROVAL_EXPIRY_SECONDS, ForkPolicy, MAX_APPROVAL_EXPIRY_SECONDS, MIN_APPROVAL_EXPIRY_SECONDS, ORCH_TO_PLATFORM_RECOGNIZED_TYPES, OrchLogPhase, PLATFORM_TO_ORCH_RECOGNIZED_TYPES, SECONDS_PER_HOUR, WEBHOOK_RELAY_CHUNK_SIZE, WEBHOOK_RELAY_MAX_BODY_BYTES, WebhookRelayResult, cacheStatsSchema, clusterMembershipSchema, collectDiscriminatorTypes, executionEventSchema, logChunkSchema, orchLogChunkSchema, orchMetricsSchema, orchestratorToPlatformMessageSchema, peerDiscoverSchema, peerUpdateSchema, planHeadroomSchema, platformCapabilitiesMessageSchema, platformToOrchestratorMessageSchema, staleCheckrunCleanupSchema, trustPolicySchema, trustPolicyUpdateSchema, webhookAckSchema, webhookRelayChunkSchema, webhookRelaySchema, webhookRelayStartSchema };
624
562
 
625
563
  //# sourceMappingURL=platform-orchestrator.js.map
@@ -134,19 +134,6 @@ export declare const sourceRegistrationSchema: z.ZodObject<{
134
134
  s3LogAccess: z.ZodOptional<z.ZodBoolean>;
135
135
  queueTimeoutMs: z.ZodOptional<z.ZodNumber>;
136
136
  }, z.core.$strip>;
137
- /**
138
- * One accepted source in a {@link sourceRegistrationAckSchema}. Carries the
139
- * public webhook URL the Platform computed for this routing key so the
140
- * orchestrator (which only knows its org *alias*, never the canonical org id)
141
- * can surface it to the operator — e.g. `kici-admin source add` printing the
142
- * URL to paste into a GitHub App. `webhookUrl` is null when the Platform has
143
- * no public webhook base configured (`config.webhookPublicUrl` unset).
144
- */
145
- export declare const acceptedSourceSchema: z.ZodObject<{
146
- routingKey: z.ZodString;
147
- webhookUrl: z.ZodNullable<z.ZodString>;
148
- }, z.core.$strip>;
149
- export type AcceptedSource = z.infer<typeof acceptedSourceSchema>;
150
137
  /** Platform acknowledgment of source registration. */
151
138
  export declare const sourceRegistrationAckSchema: z.ZodObject<{
152
139
  type: z.ZodLiteral<"source.register.ack">;
@@ -131,30 +131,29 @@ const sourceRegistrationSchema = z.object({
131
131
  * different orchestrator clusters that accidentally share the same
132
132
  * `clusterName` in one org: every coord in an HA cluster shares the
133
133
  * same orch DB and therefore the same `clusterId`, while two unrelated
134
- * clusters carry distinct UUIDs. Optional — older orchestrators that
135
- * haven't been redeployed yet won't publish it, in which case Platform
136
- * skips the cross-cluster collision warn for that connection.
134
+ * clusters carry distinct UUIDs. Absent when the orchestrator could not
135
+ * read its cluster id, in which case Platform skips the cross-cluster
136
+ * collision warn for that connection.
137
137
  */
138
138
  clusterId: z.string().uuid().optional(),
139
139
  /** Reachable address for peer-to-peer connections (from KICI_CLUSTER_ADDRESS env var). */
140
140
  address: z.string().nullable().optional(),
141
- /** Orchestrator version (e.g. "0.0.1"). Optional for backward compatibility with older orchestrators. */
141
+ /** Orchestrator version (e.g. "0.0.1"). Absent when the orchestrator cannot read its own version. */
142
142
  version: z.string().optional(),
143
- /** Orchestrator config mode. Optional for backward compatibility. */
143
+ /** Orchestrator config mode. */
144
144
  mode: OrchestratorMode.optional(),
145
145
  /** Scaler backends configured on this orchestrator (e.g. ["container", "firecracker"]). */
146
146
  scalerBackends: z.array(z.string()).optional(),
147
147
  /**
148
148
  * How the orchestrator process itself was deployed (systemd/launchd/windows/
149
149
  * compose/unknown), used by the dashboard to build the correct kici-admin
150
- * invocation. Optional: older orchestrators that haven't been redeployed don't
151
- * publish it, in which case the dashboard treats the shape as `unknown`.
150
+ * invocation. Absent when the orchestrator cannot detect it, in which case
151
+ * the dashboard treats the shape as `unknown`.
152
152
  */
153
153
  deployment: DeploymentIdentitySchema.optional(),
154
154
  /**
155
155
  * Where this orchestrator's own config files live on its host, so the
156
- * dashboard can point an operator straight at them. Optional: an
157
- * orchestrator that predates the field omits it, and each member is omitted
156
+ * dashboard can point an operator straight at them. Each member is omitted
158
157
  * independently when that path is not knowable.
159
158
  */
160
159
  configPaths: ConfigPathsSchema.optional(),
@@ -205,6 +204,6 @@ const sourceDeregisterAckSchema = z.object({
205
204
  removed: z.array(z.string())
206
205
  });
207
206
  //#endregion
208
- export { OWN_INGRESS_MODES, OrchestratorMode, PLATFORM_CONNECTED_MODES, RELAY_INGRESS_MODES, SourceProvider, SourceSubtype, acceptedSourceSchema, sourceDeregisterAckSchema, sourceDeregisterSchema, sourceRegistrationAckSchema, sourceRegistrationSchema };
207
+ export { OWN_INGRESS_MODES, OrchestratorMode, PLATFORM_CONNECTED_MODES, RELAY_INGRESS_MODES, SourceProvider, SourceSubtype, sourceDeregisterAckSchema, sourceDeregisterSchema, sourceRegistrationAckSchema, sourceRegistrationSchema };
209
208
 
210
209
  //# sourceMappingURL=source-registration.js.map