@kici-dev/engine 0.1.20 → 0.1.22

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 (38) hide show
  1. package/dist/approval/types.d.ts +1 -1
  2. package/dist/approval/types.js +1 -1
  3. package/dist/audit/access-log-policy.js +7 -0
  4. package/dist/audit/retention-policy.js +8 -0
  5. package/dist/check-mode.d.ts +33 -0
  6. package/dist/check-mode.js +36 -0
  7. package/dist/fanout/materialize.d.ts +21 -4
  8. package/dist/fanout/materialize.js +24 -5
  9. package/dist/index.d.ts +5 -1
  10. package/dist/index.js +11 -7
  11. package/dist/inventory.d.ts +101 -0
  12. package/dist/inventory.js +89 -0
  13. package/dist/labels-match.d.ts +52 -0
  14. package/dist/labels-match.js +24 -2
  15. package/dist/protocol/dashboard-write-operations.d.ts +8 -1
  16. package/dist/protocol/dashboard-write-operations.js +25 -4
  17. package/dist/protocol/messages/access-log.d.ts +25 -0
  18. package/dist/protocol/messages/access-log.js +5 -0
  19. package/dist/protocol/messages/auth.d.ts +2 -0
  20. package/dist/protocol/messages/capabilities.d.ts +2 -0
  21. package/dist/protocol/messages/dashboard.d.ts +669 -21
  22. package/dist/protocol/messages/dashboard.js +140 -7
  23. package/dist/protocol/messages/deployment-identity.d.ts +38 -0
  24. package/dist/protocol/messages/deployment-identity.js +28 -0
  25. package/dist/protocol/messages/execution-status.d.ts +5 -5
  26. package/dist/protocol/messages/orchestrator-agent.d.ts +70 -6
  27. package/dist/protocol/messages/orchestrator-agent.js +37 -8
  28. package/dist/protocol/messages/peer.d.ts +62 -3
  29. package/dist/protocol/messages/peer.js +16 -2
  30. package/dist/protocol/messages/platform-orchestrator.d.ts +172 -2
  31. package/dist/protocol/messages/source-registration.d.ts +15 -0
  32. package/dist/protocol/messages/source-registration.js +17 -1
  33. package/dist/trigger/types.d.ts +74 -22
  34. package/dist/trigger/types.js +41 -12
  35. package/dist/webhook/webhook-url-format.d.ts +9 -0
  36. package/dist/webhook/webhook-url-format.js +16 -0
  37. package/package.json +1 -1
  38. package/sbom.spdx.json +5 -5
@@ -214,6 +214,7 @@ export declare const jobProgressSchema: z.ZodObject<{
214
214
  stepIndex: z.ZodNumber;
215
215
  stepName: z.ZodString;
216
216
  state: z.ZodEnum<{
217
+ skipped: "skipped";
217
218
  success: "success";
218
219
  pending: "pending";
219
220
  running: "running";
@@ -222,13 +223,36 @@ export declare const jobProgressSchema: z.ZodObject<{
222
223
  cancelling: "cancelling";
223
224
  queued: "queued";
224
225
  recovering: "recovering";
225
- skipped: "skipped";
226
226
  timed_out_stale: "timed_out_stale";
227
227
  drift_dropped: "drift_dropped";
228
228
  }>;
229
229
  timestamp: z.ZodNumber;
230
230
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
231
231
  }, z.core.$strip>;
232
+ /**
233
+ * Acknowledgement sent coordinator -> worker once the coordinator has applied
234
+ * a terminal `job.progress` (kind='job') to its run/job DB rows. The worker
235
+ * uses it to prune the matching record from its durable outbox. Carries
236
+ * `state` for debuggability; `(runId, jobId)` is the dedup key.
237
+ */
238
+ export declare const jobProgressAckSchema: z.ZodObject<{
239
+ type: z.ZodLiteral<"job.progress.ack">;
240
+ runId: z.ZodString;
241
+ jobId: z.ZodString;
242
+ state: z.ZodEnum<{
243
+ skipped: "skipped";
244
+ success: "success";
245
+ pending: "pending";
246
+ running: "running";
247
+ failed: "failed";
248
+ cancelled: "cancelled";
249
+ cancelling: "cancelling";
250
+ queued: "queued";
251
+ recovering: "recovering";
252
+ timed_out_stale: "timed_out_stale";
253
+ drift_dropped: "drift_dropped";
254
+ }>;
255
+ }, z.core.$strip>;
232
256
  /** Request to cancel a job on a peer orchestrator. */
233
257
  export declare const peerJobCancelSchema: z.ZodObject<{
234
258
  type: z.ZodLiteral<"peer.job.cancel">;
@@ -555,6 +579,7 @@ export declare const peerToPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
555
579
  stepIndex: z.ZodNumber;
556
580
  stepName: z.ZodString;
557
581
  state: z.ZodEnum<{
582
+ skipped: "skipped";
558
583
  success: "success";
559
584
  pending: "pending";
560
585
  running: "running";
@@ -563,12 +588,28 @@ export declare const peerToPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
563
588
  cancelling: "cancelling";
564
589
  queued: "queued";
565
590
  recovering: "recovering";
566
- skipped: "skipped";
567
591
  timed_out_stale: "timed_out_stale";
568
592
  drift_dropped: "drift_dropped";
569
593
  }>;
570
594
  timestamp: z.ZodNumber;
571
595
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
596
+ }, z.core.$strip>, z.ZodObject<{
597
+ type: z.ZodLiteral<"job.progress.ack">;
598
+ runId: z.ZodString;
599
+ jobId: z.ZodString;
600
+ state: z.ZodEnum<{
601
+ skipped: "skipped";
602
+ success: "success";
603
+ pending: "pending";
604
+ running: "running";
605
+ failed: "failed";
606
+ cancelled: "cancelled";
607
+ cancelling: "cancelling";
608
+ queued: "queued";
609
+ recovering: "recovering";
610
+ timed_out_stale: "timed_out_stale";
611
+ drift_dropped: "drift_dropped";
612
+ }>;
572
613
  }, z.core.$strip>, z.ZodObject<{
573
614
  type: z.ZodLiteral<"peer.job.cancel">;
574
615
  runId: z.ZodString;
@@ -839,6 +880,7 @@ export declare const peerFromPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodOb
839
880
  stepIndex: z.ZodNumber;
840
881
  stepName: z.ZodString;
841
882
  state: z.ZodEnum<{
883
+ skipped: "skipped";
842
884
  success: "success";
843
885
  pending: "pending";
844
886
  running: "running";
@@ -847,12 +889,28 @@ export declare const peerFromPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodOb
847
889
  cancelling: "cancelling";
848
890
  queued: "queued";
849
891
  recovering: "recovering";
850
- skipped: "skipped";
851
892
  timed_out_stale: "timed_out_stale";
852
893
  drift_dropped: "drift_dropped";
853
894
  }>;
854
895
  timestamp: z.ZodNumber;
855
896
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
897
+ }, z.core.$strip>, z.ZodObject<{
898
+ type: z.ZodLiteral<"job.progress.ack">;
899
+ runId: z.ZodString;
900
+ jobId: z.ZodString;
901
+ state: z.ZodEnum<{
902
+ skipped: "skipped";
903
+ success: "success";
904
+ pending: "pending";
905
+ running: "running";
906
+ failed: "failed";
907
+ cancelled: "cancelled";
908
+ cancelling: "cancelling";
909
+ queued: "queued";
910
+ recovering: "recovering";
911
+ timed_out_stale: "timed_out_stale";
912
+ drift_dropped: "drift_dropped";
913
+ }>;
856
914
  }, z.core.$strip>, z.ZodObject<{
857
915
  type: z.ZodLiteral<"peer.job.cancel">;
858
916
  runId: z.ZodString;
@@ -964,6 +1022,7 @@ export type ScalerCapacitySummary = z.infer<typeof scalerCapacitySummarySchema>;
964
1022
  export type PeerHeartbeat = z.infer<typeof peerHeartbeatSchema>;
965
1023
  export type JobReroute = z.infer<typeof jobRerouteSchema>;
966
1024
  export type JobProgress = z.infer<typeof jobProgressSchema>;
1025
+ export type JobProgressAck = z.infer<typeof jobProgressAckSchema>;
967
1026
  export type PeerScalerEvent = z.infer<typeof peerScalerEventSchema>;
968
1027
  export type PeerJobCancel = z.infer<typeof peerJobCancelSchema>;
969
1028
  export type RaftVoteRequest = z.infer<typeof raftVoteRequestSchema>;
@@ -1,7 +1,7 @@
1
1
  import "../../chunk-BTugEXQM.js";
2
2
  import { ExecutionJobStatus } from "./execution-status.js";
3
- import { ScalerEventType } from "./scaler-event.js";
4
3
  import { LabelMatcher } from "../../labels-match.js";
4
+ import { ScalerEventType } from "./scaler-event.js";
5
5
  import { z } from "zod";
6
6
  //#region src/protocol/messages/peer.ts
7
7
  /** Agent summary included in peer heartbeat and auth response messages. */
@@ -242,6 +242,18 @@ const jobProgressSchema = z.object({
242
242
  timestamp: z.number(),
243
243
  data: z.record(z.string(), z.unknown()).optional()
244
244
  });
245
+ /**
246
+ * Acknowledgement sent coordinator -> worker once the coordinator has applied
247
+ * a terminal `job.progress` (kind='job') to its run/job DB rows. The worker
248
+ * uses it to prune the matching record from its durable outbox. Carries
249
+ * `state` for debuggability; `(runId, jobId)` is the dedup key.
250
+ */
251
+ const jobProgressAckSchema = z.object({
252
+ type: z.literal("job.progress.ack"),
253
+ runId: z.string(),
254
+ jobId: z.string(),
255
+ state: ExecutionJobStatus
256
+ });
245
257
  /** Request to cancel a job on a peer orchestrator. */
246
258
  const peerJobCancelSchema = z.object({
247
259
  type: z.literal("peer.job.cancel"),
@@ -408,6 +420,7 @@ const peerToPeerMessageSchema = z.discriminatedUnion("type", [
408
420
  jobRerouteSchema,
409
421
  jobRerouteAckSchema,
410
422
  jobProgressSchema,
423
+ jobProgressAckSchema,
411
424
  peerJobCancelSchema,
412
425
  raftVoteRequestSchema,
413
426
  raftVoteResponseSchema,
@@ -434,6 +447,7 @@ const peerFromPeerMessageSchema = z.discriminatedUnion("type", [
434
447
  jobRerouteSchema,
435
448
  jobRerouteAckSchema,
436
449
  jobProgressSchema,
450
+ jobProgressAckSchema,
437
451
  peerJobCancelSchema,
438
452
  raftVoteRequestSchema,
439
453
  raftVoteResponseSchema,
@@ -451,6 +465,6 @@ const peerFromPeerMessageSchema = z.discriminatedUnion("type", [
451
465
  peerScalerEventSchema
452
466
  ]);
453
467
  //#endregion
454
- export { fleetSelectionSchema, jobProgressSchema, jobRerouteAckSchema, jobRerouteSchema, peerAgentTokenRevokeSchema, peerAuthRequestSchema, peerAuthResponseSchema, peerCapabilitiesSchema, peerConfigReloadResponseSchema, peerConfigReloadSchema, peerFromPeerMessageSchema, peerHeartbeatSchema, peerHelloResponseSchema, peerHelloSchema, peerJobCancelSchema, peerLeavingSchema, peerLogsCollectChunkSchema, peerLogsCollectErrorSchema, peerLogsCollectRequestSchema, peerScalerEventSchema, peerToPeerMessageSchema, raftAppendEntriesSchema, raftVoteRequestSchema, raftVoteResponseSchema };
468
+ export { fleetSelectionSchema, jobProgressAckSchema, jobProgressSchema, jobRerouteAckSchema, jobRerouteSchema, peerAgentTokenRevokeSchema, peerAuthRequestSchema, peerAuthResponseSchema, peerCapabilitiesSchema, peerConfigReloadResponseSchema, peerConfigReloadSchema, peerFromPeerMessageSchema, peerHeartbeatSchema, peerHelloResponseSchema, peerHelloSchema, peerJobCancelSchema, peerLeavingSchema, peerLogsCollectChunkSchema, peerLogsCollectErrorSchema, peerLogsCollectRequestSchema, peerScalerEventSchema, peerToPeerMessageSchema, raftAppendEntriesSchema, raftVoteRequestSchema, raftVoteResponseSchema };
455
469
 
456
470
  //# sourceMappingURL=peer.js.map
@@ -314,6 +314,8 @@ export declare const orchCapabilitiesUpdateSchema: z.ZodObject<{
314
314
  "backends.sync": "backends.sync";
315
315
  "backends.sync_one": "backends.sync_one";
316
316
  "backends.test": "backends.test";
317
+ "fleet.host.declare": "fleet.host.declare";
318
+ "fleet.host.remove": "fleet.host.remove";
317
319
  }> & z.core.$partial, z.ZodBoolean>>;
318
320
  }, z.core.$loose>;
319
321
  }, z.core.$strip>;
@@ -1294,6 +1296,7 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1294
1296
  component: z.ZodString;
1295
1297
  }, z.core.$strip>], "type">;
1296
1298
  heldRunId: z.ZodString;
1299
+ autoApprove: z.ZodOptional<z.ZodBoolean>;
1297
1300
  }, z.core.$strip>, z.ZodObject<{
1298
1301
  type: z.ZodLiteral<"dashboard.held-runs.reject">;
1299
1302
  requestId: z.ZodString;
@@ -1413,6 +1416,123 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1413
1416
  component: z.ZodString;
1414
1417
  }, z.core.$strip>], "type">;
1415
1418
  includeAgents: z.ZodOptional<z.ZodBoolean>;
1419
+ }, z.core.$strip>, z.ZodObject<{
1420
+ type: z.ZodLiteral<"dashboard.fleet.hosts">;
1421
+ requestId: z.ZodString;
1422
+ actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
1423
+ type: z.ZodLiteral<"user">;
1424
+ sub: z.ZodString;
1425
+ }, z.core.$strip>, z.ZodObject<{
1426
+ type: z.ZodLiteral<"api_key">;
1427
+ keyId: z.ZodString;
1428
+ ownerSub: z.ZodString;
1429
+ }, z.core.$strip>, z.ZodObject<{
1430
+ type: z.ZodLiteral<"service_account">;
1431
+ id: z.ZodString;
1432
+ }, z.core.$strip>, z.ZodObject<{
1433
+ type: z.ZodLiteral<"platform_operator">;
1434
+ sub: z.ZodString;
1435
+ reason: z.ZodString;
1436
+ sessionId: z.ZodOptional<z.ZodString>;
1437
+ }, z.core.$strip>, z.ZodObject<{
1438
+ type: z.ZodLiteral<"system">;
1439
+ component: z.ZodString;
1440
+ }, z.core.$strip>], "type">;
1441
+ }, z.core.$strip>, z.ZodObject<{
1442
+ type: z.ZodLiteral<"dashboard.fleet.host">;
1443
+ requestId: z.ZodString;
1444
+ actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
1445
+ type: z.ZodLiteral<"user">;
1446
+ sub: z.ZodString;
1447
+ }, z.core.$strip>, z.ZodObject<{
1448
+ type: z.ZodLiteral<"api_key">;
1449
+ keyId: z.ZodString;
1450
+ ownerSub: z.ZodString;
1451
+ }, z.core.$strip>, z.ZodObject<{
1452
+ type: z.ZodLiteral<"service_account">;
1453
+ id: z.ZodString;
1454
+ }, z.core.$strip>, z.ZodObject<{
1455
+ type: z.ZodLiteral<"platform_operator">;
1456
+ sub: z.ZodString;
1457
+ reason: z.ZodString;
1458
+ sessionId: z.ZodOptional<z.ZodString>;
1459
+ }, z.core.$strip>, z.ZodObject<{
1460
+ type: z.ZodLiteral<"system">;
1461
+ component: z.ZodString;
1462
+ }, z.core.$strip>], "type">;
1463
+ agentId: z.ZodString;
1464
+ }, z.core.$strip>, z.ZodObject<{
1465
+ type: z.ZodLiteral<"dashboard.fleet.preview">;
1466
+ requestId: z.ZodString;
1467
+ actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
1468
+ type: z.ZodLiteral<"user">;
1469
+ sub: z.ZodString;
1470
+ }, z.core.$strip>, z.ZodObject<{
1471
+ type: z.ZodLiteral<"api_key">;
1472
+ keyId: z.ZodString;
1473
+ ownerSub: z.ZodString;
1474
+ }, z.core.$strip>, z.ZodObject<{
1475
+ type: z.ZodLiteral<"service_account">;
1476
+ id: z.ZodString;
1477
+ }, z.core.$strip>, z.ZodObject<{
1478
+ type: z.ZodLiteral<"platform_operator">;
1479
+ sub: z.ZodString;
1480
+ reason: z.ZodString;
1481
+ sessionId: z.ZodOptional<z.ZodString>;
1482
+ }, z.core.$strip>, z.ZodObject<{
1483
+ type: z.ZodLiteral<"system">;
1484
+ component: z.ZodString;
1485
+ }, z.core.$strip>], "type">;
1486
+ workflowName: z.ZodString;
1487
+ }, z.core.$strip>, z.ZodObject<{
1488
+ type: z.ZodLiteral<"dashboard.fleet.host.declare">;
1489
+ requestId: z.ZodString;
1490
+ actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
1491
+ type: z.ZodLiteral<"user">;
1492
+ sub: z.ZodString;
1493
+ }, z.core.$strip>, z.ZodObject<{
1494
+ type: z.ZodLiteral<"api_key">;
1495
+ keyId: z.ZodString;
1496
+ ownerSub: z.ZodString;
1497
+ }, z.core.$strip>, z.ZodObject<{
1498
+ type: z.ZodLiteral<"service_account">;
1499
+ id: z.ZodString;
1500
+ }, z.core.$strip>, z.ZodObject<{
1501
+ type: z.ZodLiteral<"platform_operator">;
1502
+ sub: z.ZodString;
1503
+ reason: z.ZodString;
1504
+ sessionId: z.ZodOptional<z.ZodString>;
1505
+ }, z.core.$strip>, z.ZodObject<{
1506
+ type: z.ZodLiteral<"system">;
1507
+ component: z.ZodString;
1508
+ }, z.core.$strip>], "type">;
1509
+ agentId: z.ZodString;
1510
+ labels: z.ZodArray<z.ZodString>;
1511
+ hostname: z.ZodOptional<z.ZodString>;
1512
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
1513
+ }, z.core.$strip>, z.ZodObject<{
1514
+ type: z.ZodLiteral<"dashboard.fleet.host.remove">;
1515
+ requestId: z.ZodString;
1516
+ actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
1517
+ type: z.ZodLiteral<"user">;
1518
+ sub: z.ZodString;
1519
+ }, z.core.$strip>, z.ZodObject<{
1520
+ type: z.ZodLiteral<"api_key">;
1521
+ keyId: z.ZodString;
1522
+ ownerSub: z.ZodString;
1523
+ }, z.core.$strip>, z.ZodObject<{
1524
+ type: z.ZodLiteral<"service_account">;
1525
+ id: z.ZodString;
1526
+ }, z.core.$strip>, z.ZodObject<{
1527
+ type: z.ZodLiteral<"platform_operator">;
1528
+ sub: z.ZodString;
1529
+ reason: z.ZodString;
1530
+ sessionId: z.ZodOptional<z.ZodString>;
1531
+ }, z.core.$strip>, z.ZodObject<{
1532
+ type: z.ZodLiteral<"system">;
1533
+ component: z.ZodString;
1534
+ }, z.core.$strip>], "type">;
1535
+ agentId: z.ZodString;
1416
1536
  }, z.core.$strip>, z.ZodObject<{
1417
1537
  type: z.ZodLiteral<"dashboard.scaler.capacity">;
1418
1538
  requestId: z.ZodString;
@@ -1849,6 +1969,8 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1849
1969
  "registration.disable": "registration.disable";
1850
1970
  "registration.delete": "registration.delete";
1851
1971
  "global_workflows.update": "global_workflows.update";
1972
+ "fleet.host.declare": "fleet.host.declare";
1973
+ "fleet.host.remove": "fleet.host.remove";
1852
1974
  "run.detail.read": "run.detail.read";
1853
1975
  "runs.list.read": "runs.list.read";
1854
1976
  "runs.filters.read": "runs.filters.read";
@@ -1888,6 +2010,7 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1888
2010
  "environment.history.read": "environment.history.read";
1889
2011
  "held_run.list.read": "held_run.list.read";
1890
2012
  "held_run.approve": "held_run.approve";
2013
+ "held_run.auto_approve": "held_run.auto_approve";
1891
2014
  "held_run.reject": "held_run.reject";
1892
2015
  "held_run.request": "held_run.request";
1893
2016
  "held_run.expire": "held_run.expire";
@@ -1895,6 +2018,7 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1895
2018
  "diagnostics.read": "diagnostics.read";
1896
2019
  "scaler.capacity.read": "scaler.capacity.read";
1897
2020
  "scaler.agents.read": "scaler.agents.read";
2021
+ "fleet.read": "fleet.read";
1898
2022
  "backend.list.read": "backend.list.read";
1899
2023
  "backend.get.read": "backend.get.read";
1900
2024
  "backend.sync": "backend.sync";
@@ -1931,6 +2055,7 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1931
2055
  backend: "backend";
1932
2056
  diagnostics: "diagnostics";
1933
2057
  scaler: "scaler";
2058
+ fleet: "fleet";
1934
2059
  held_run: "held_run";
1935
2060
  access_log: "access_log";
1936
2061
  event_dlq: "event_dlq";
@@ -2006,6 +2131,32 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
2006
2131
  cliPublicKey: z.ZodOptional<z.ZodString>;
2007
2132
  inlineLockFile: z.ZodOptional<z.ZodString>;
2008
2133
  fullRepo: z.ZodOptional<z.ZodBoolean>;
2134
+ checkMode: z.ZodOptional<z.ZodEnum<{
2135
+ apply: "apply";
2136
+ check: "check";
2137
+ "check-fail-on-drift": "check-fail-on-drift";
2138
+ }>>;
2139
+ target: z.ZodOptional<z.ZodObject<{
2140
+ values: z.ZodArray<z.ZodObject<{
2141
+ include: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2142
+ kind: z.ZodLiteral<"exact">;
2143
+ value: z.ZodString;
2144
+ }, z.core.$strip>, z.ZodObject<{
2145
+ kind: z.ZodLiteral<"regex">;
2146
+ source: z.ZodString;
2147
+ flags: z.ZodString;
2148
+ }, z.core.$strip>], "kind">>;
2149
+ exclude: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2150
+ kind: z.ZodLiteral<"exact">;
2151
+ value: z.ZodString;
2152
+ }, z.core.$strip>, z.ZodObject<{
2153
+ kind: z.ZodLiteral<"regex">;
2154
+ source: z.ZodString;
2155
+ flags: z.ZodString;
2156
+ }, z.core.$strip>], "kind">>;
2157
+ }, z.core.$strip>>;
2158
+ allowEmpty: z.ZodBoolean;
2159
+ }, z.core.$strip>>;
2009
2160
  secrets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2010
2161
  encryptedSecrets: z.ZodOptional<z.ZodString>;
2011
2162
  encryptedSecretsKey: z.ZodOptional<z.ZodString>;
@@ -2175,10 +2326,10 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
2175
2326
  stepIndex: z.ZodNumber;
2176
2327
  stepName: z.ZodString;
2177
2328
  state: z.ZodEnum<{
2329
+ skipped: "skipped";
2178
2330
  success: "success";
2179
2331
  running: "running";
2180
2332
  failed: "failed";
2181
- skipped: "skipped";
2182
2333
  }>;
2183
2334
  timestamp: z.ZodNumber;
2184
2335
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -2190,6 +2341,7 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
2190
2341
  jobId: z.ZodString;
2191
2342
  jobName: z.ZodString;
2192
2343
  status: z.ZodEnum<{
2344
+ skipped: "skipped";
2193
2345
  success: "success";
2194
2346
  pending: "pending";
2195
2347
  running: "running";
@@ -2198,7 +2350,6 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
2198
2350
  cancelling: "cancelling";
2199
2351
  queued: "queued";
2200
2352
  recovering: "recovering";
2201
- skipped: "skipped";
2202
2353
  timed_out_stale: "timed_out_stale";
2203
2354
  drift_dropped: "drift_dropped";
2204
2355
  }>;
@@ -2304,6 +2455,8 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
2304
2455
  "backends.sync": "backends.sync";
2305
2456
  "backends.sync_one": "backends.sync_one";
2306
2457
  "backends.test": "backends.test";
2458
+ "fleet.host.declare": "fleet.host.declare";
2459
+ "fleet.host.remove": "fleet.host.remove";
2307
2460
  }> & z.core.$partial, z.ZodBoolean>>;
2308
2461
  }, z.core.$loose>;
2309
2462
  }, z.core.$strip>, z.ZodObject<{
@@ -2324,6 +2477,7 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
2324
2477
  universal_git: "universal_git";
2325
2478
  local: "local";
2326
2479
  }>;
2480
+ slug: z.ZodOptional<z.ZodString>;
2327
2481
  }, z.core.$strip>>;
2328
2482
  instanceId: z.ZodOptional<z.ZodString>;
2329
2483
  clusterName: z.ZodOptional<z.ZodString>;
@@ -2336,6 +2490,20 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
2336
2490
  independent: "independent";
2337
2491
  }>>;
2338
2492
  scalerBackends: z.ZodOptional<z.ZodArray<z.ZodString>>;
2493
+ deployment: z.ZodOptional<z.ZodObject<{
2494
+ mode: z.ZodEnum<{
2495
+ unknown: "unknown";
2496
+ systemd: "systemd";
2497
+ launchd: "launchd";
2498
+ windows: "windows";
2499
+ compose: "compose";
2500
+ }>;
2501
+ containerName: z.ZodOptional<z.ZodString>;
2502
+ containerRuntime: z.ZodOptional<z.ZodEnum<{
2503
+ podman: "podman";
2504
+ docker: "docker";
2505
+ }>>;
2506
+ }, z.core.$strip>>;
2339
2507
  s3LogAccess: z.ZodOptional<z.ZodBoolean>;
2340
2508
  queueTimeoutMs: z.ZodOptional<z.ZodNumber>;
2341
2509
  }, z.core.$strip>, z.ZodObject<{
@@ -2383,6 +2551,8 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
2383
2551
  "backends.sync": "backends.sync";
2384
2552
  "backends.sync_one": "backends.sync_one";
2385
2553
  "backends.test": "backends.test";
2554
+ "fleet.host.declare": "fleet.host.declare";
2555
+ "fleet.host.remove": "fleet.host.remove";
2386
2556
  }> & z.core.$partial, z.ZodBoolean>>;
2387
2557
  }, z.core.$loose>>;
2388
2558
  }, z.core.$strip>, z.ZodObject<{
@@ -56,6 +56,7 @@ export declare const sourceRegistrationSchema: z.ZodObject<{
56
56
  universal_git: "universal_git";
57
57
  local: "local";
58
58
  }>;
59
+ slug: z.ZodOptional<z.ZodString>;
59
60
  }, z.core.$strip>>;
60
61
  instanceId: z.ZodOptional<z.ZodString>;
61
62
  clusterName: z.ZodOptional<z.ZodString>;
@@ -68,6 +69,20 @@ export declare const sourceRegistrationSchema: z.ZodObject<{
68
69
  independent: "independent";
69
70
  }>>;
70
71
  scalerBackends: z.ZodOptional<z.ZodArray<z.ZodString>>;
72
+ deployment: z.ZodOptional<z.ZodObject<{
73
+ mode: z.ZodEnum<{
74
+ unknown: "unknown";
75
+ systemd: "systemd";
76
+ launchd: "launchd";
77
+ windows: "windows";
78
+ compose: "compose";
79
+ }>;
80
+ containerName: z.ZodOptional<z.ZodString>;
81
+ containerRuntime: z.ZodOptional<z.ZodEnum<{
82
+ podman: "podman";
83
+ docker: "docker";
84
+ }>>;
85
+ }, z.core.$strip>>;
71
86
  s3LogAccess: z.ZodOptional<z.ZodBoolean>;
72
87
  queueTimeoutMs: z.ZodOptional<z.ZodNumber>;
73
88
  }, z.core.$strip>;
@@ -1,4 +1,5 @@
1
1
  import "../../chunk-BTugEXQM.js";
2
+ import { DeploymentIdentitySchema } from "./deployment-identity.js";
2
3
  import { z } from "zod";
3
4
  //#region src/protocol/messages/source-registration.ts
4
5
  /**
@@ -54,7 +55,15 @@ const sourceRegistrationSchema = z.object({
54
55
  * Fine-grained source subtype. See {@link SourceSubtype} for the full
55
56
  * mapping. Required — pre-release, no backward-compat shims.
56
57
  */
57
- subtype: SourceSubtype
58
+ subtype: SourceSubtype,
59
+ /**
60
+ * GitHub App slug (the URL-safe identifier GitHub assigns, e.g.
61
+ * `my-kici-app`). Only set for GitHub-App sources, where GitHub is the
62
+ * source of truth for both the display `name` and the `slug`. Optional —
63
+ * generic / universal-git / local sources have no slug, and a GitHub
64
+ * source whose identity fetch hasn't run yet leaves it unset.
65
+ */
66
+ slug: z.string().min(1).optional()
58
67
  })),
59
68
  /** Orchestrator cluster instance ID for peer correlation. */
60
69
  instanceId: z.string().optional(),
@@ -91,6 +100,13 @@ const sourceRegistrationSchema = z.object({
91
100
  ]).optional(),
92
101
  /** Scaler backends configured on this orchestrator (e.g. ["container", "firecracker"]). */
93
102
  scalerBackends: z.array(z.string()).optional(),
103
+ /**
104
+ * How the orchestrator process itself was deployed (systemd/launchd/windows/
105
+ * compose/unknown), used by the dashboard to build the correct kici-admin
106
+ * invocation. Optional: older orchestrators that haven't been redeployed don't
107
+ * publish it, in which case the dashboard treats the shape as `unknown`.
108
+ */
109
+ deployment: DeploymentIdentitySchema.optional(),
94
110
  /** Whether this orchestrator has S3 log storage configured. Used for multi-orch pool validation. */
95
111
  s3LogAccess: z.boolean().optional(),
96
112
  /** Queue timeout in ms. Platform uses this (with margin) for safety-net GC of stale queued jobs. */
@@ -20,11 +20,12 @@ import { z } from 'zod';
20
20
  import type { ProviderType } from '../provider/types.js';
21
21
  import type { ApproverClause } from '../approval/types.js';
22
22
  import { LabelMatcher } from '../labels-match.js';
23
+ import { ExecutionJobStatus } from '../protocol/messages/execution-status.js';
23
24
  /** Schema version - increment on breaking changes */
24
- export declare const SCHEMA_VERSION: 20;
25
+ export declare const SCHEMA_VERSION: 22;
25
26
  /**
26
27
  * Normalized approval config carried in the lock file. Produced by the compiler
27
- * from an SDK `requireApproval` at any of the three levels; consumed by the
28
+ * from an SDK `approval` at any of the three levels; consumed by the
28
29
  * orchestrator dispatch gate (and the agent step round-trip for step scope).
29
30
  */
30
31
  export interface LockApproval {
@@ -34,6 +35,11 @@ export interface LockApproval {
34
35
  readonly reason?: string;
35
36
  /** Per-gate expiry override (seconds); falls back to the org default. */
36
37
  readonly timeoutSeconds?: number;
38
+ /**
39
+ * When the gate fires. `always` (default) gates before the element; `drift`
40
+ * gates between a step's check and run on detected drift (step scope only).
41
+ */
42
+ readonly when: 'always' | 'drift';
37
43
  }
38
44
  /**
39
45
  * Source file reference with meaningful path.
@@ -352,38 +358,84 @@ export interface LockInlineValue {
352
358
  /** Type guard for inline expression values */
353
359
  export declare function isLockInlineValue(value: unknown): value is LockInlineValue;
354
360
  /**
355
- * Per-edge failure policy for a `needs` dependency: `skip` propagates an
356
- * upstream failure to the downstream job (default), `run` runs the downstream
357
- * job regardless of the upstream outcome. Single source of truth for this
358
- * value across lock-file schemas and protocol messages.
361
+ * Author-facing keyword sugar for a `needs` edge's run condition. Each keyword
362
+ * resolves (at compile time) to a set of upstream terminal statuses; the
363
+ * downstream edge is dispatch-satisfied when the upstream's terminal status is
364
+ * a member of that set.
359
365
  */
360
- export declare const IfFailedPolicy: z.ZodEnum<{
361
- run: "run";
362
- skip: "skip";
366
+ export declare const NeedsWhen: z.ZodEnum<{
367
+ always: "always";
368
+ "on-success": "on-success";
369
+ "on-skip": "on-skip";
370
+ "on-failure": "on-failure";
363
371
  }>;
364
- export type IfFailedPolicy = z.infer<typeof IfFailedPolicy>;
365
- /**
366
- * Needs entry with per-edge failure policy.
367
- * Used in lock file needs arrays for explicit ifFailed override.
372
+ export type NeedsWhen = z.infer<typeof NeedsWhen>;
373
+ /**
374
+ * Normalized, DB-evaluable run condition for a `needs` edge: the non-empty set
375
+ * of upstream terminal statuses that satisfy the edge. The lock file and the
376
+ * orchestrator scheduler only ever see this resolved set (never a keyword), so
377
+ * gating stays a pure status-set membership test.
378
+ */
379
+ export declare const NeedsRunOn: z.ZodArray<z.ZodEnum<{
380
+ skipped: "skipped";
381
+ success: "success";
382
+ pending: "pending";
383
+ running: "running";
384
+ failed: "failed";
385
+ cancelled: "cancelled";
386
+ cancelling: "cancelling";
387
+ queued: "queued";
388
+ recovering: "recovering";
389
+ timed_out_stale: "timed_out_stale";
390
+ drift_dropped: "drift_dropped";
391
+ }>>;
392
+ export type NeedsRunOn = z.infer<typeof NeedsRunOn>;
393
+ /**
394
+ * Resolve the author-facing `when` (keyword sugar | raw status-set | unset) to
395
+ * the normalized status-set. An unset `when` defaults to success-only — the
396
+ * downstream runs only when the upstream succeeded.
397
+ */
398
+ export declare function resolveWhenToRunOn(when: NeedsWhen | ExecutionJobStatus[] | undefined): ExecutionJobStatus[];
399
+ /**
400
+ * Needs entry carrying the normalized run-on status-set.
401
+ * Used in lock file needs arrays for an explicit per-edge run condition.
368
402
  */
369
403
  export declare const NeedsEntrySchema: z.ZodObject<{
370
404
  name: z.ZodString;
371
- ifFailed: z.ZodDefault<z.ZodEnum<{
372
- run: "run";
373
- skip: "skip";
374
- }>>;
405
+ runOn: z.ZodDefault<z.ZodArray<z.ZodEnum<{
406
+ skipped: "skipped";
407
+ success: "success";
408
+ pending: "pending";
409
+ running: "running";
410
+ failed: "failed";
411
+ cancelled: "cancelled";
412
+ cancelling: "cancelling";
413
+ queued: "queued";
414
+ recovering: "recovering";
415
+ timed_out_stale: "timed_out_stale";
416
+ drift_dropped: "drift_dropped";
417
+ }>>>;
375
418
  }, z.core.$strip>;
376
419
  export type NeedsEntry = z.infer<typeof NeedsEntrySchema>;
377
420
  /**
378
- * Needs group entry with per-edge failure policy.
421
+ * Needs group entry carrying the normalized run-on status-set.
379
422
  * Used in lock file needs arrays for dynamic group dependencies.
380
423
  */
381
424
  export declare const NeedsGroupEntrySchema: z.ZodObject<{
382
425
  group: z.ZodString;
383
- ifFailed: z.ZodDefault<z.ZodEnum<{
384
- run: "run";
385
- skip: "skip";
386
- }>>;
426
+ runOn: z.ZodDefault<z.ZodArray<z.ZodEnum<{
427
+ skipped: "skipped";
428
+ success: "success";
429
+ pending: "pending";
430
+ running: "running";
431
+ failed: "failed";
432
+ cancelled: "cancelled";
433
+ cancelling: "cancelling";
434
+ queued: "queued";
435
+ recovering: "recovering";
436
+ timed_out_stale: "timed_out_stale";
437
+ drift_dropped: "drift_dropped";
438
+ }>>>;
387
439
  }, z.core.$strip>;
388
440
  export type NeedsGroupEntry = z.infer<typeof NeedsGroupEntrySchema>;
389
441
  /**