@kici-dev/engine 0.1.21 → 0.1.23

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 (60) 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 +9 -0
  4. package/dist/audit/activity.d.ts +3 -1
  5. package/dist/audit/activity.js +8 -16
  6. package/dist/audit/retention-policy.js +12 -0
  7. package/dist/environment/host-match.d.ts +25 -0
  8. package/dist/environment/host-match.js +67 -0
  9. package/dist/environment/index.d.ts +1 -0
  10. package/dist/environment/scope-resolver.d.ts +15 -4
  11. package/dist/environment/scope-resolver.js +55 -15
  12. package/dist/environment/scope-template.d.ts +18 -0
  13. package/dist/environment/scope-template.js +43 -0
  14. package/dist/environment/types.d.ts +7 -0
  15. package/dist/fanout/materialize.d.ts +55 -4
  16. package/dist/fanout/materialize.js +95 -49
  17. package/dist/index.d.ts +4 -2
  18. package/dist/index.js +14 -8
  19. package/dist/inputs/build.d.ts +9 -0
  20. package/dist/inputs/build.js +44 -0
  21. package/dist/inputs/coerce.d.ts +25 -0
  22. package/dist/inputs/coerce.js +51 -0
  23. package/dist/inputs/descriptor.d.ts +53 -0
  24. package/dist/inputs/descriptor.js +42 -0
  25. package/dist/inputs/extract.d.ts +15 -0
  26. package/dist/inputs/extract.js +117 -0
  27. package/dist/inputs/index.d.ts +5 -0
  28. package/dist/inputs/index.js +6 -0
  29. package/dist/inventory.d.ts +2 -2
  30. package/dist/labels/compile.d.ts +9 -0
  31. package/dist/labels/compile.js +10 -1
  32. package/dist/labels-match.d.ts +52 -0
  33. package/dist/labels-match.js +22 -1
  34. package/dist/labels.d.ts +29 -0
  35. package/dist/labels.js +32 -1
  36. package/dist/metrics/catalog-policy.d.ts +7 -0
  37. package/dist/metrics/catalog-policy.js +11 -12
  38. package/dist/metrics/metric-catalog.generated.d.ts +2 -2
  39. package/dist/metrics/metric-catalog.generated.js +10 -2
  40. package/dist/protocol/dashboard-write-operations.d.ts +8 -1
  41. package/dist/protocol/dashboard-write-operations.js +25 -4
  42. package/dist/protocol/messages/access-log.d.ts +40 -0
  43. package/dist/protocol/messages/access-log.js +9 -1
  44. package/dist/protocol/messages/auth.d.ts +2 -0
  45. package/dist/protocol/messages/capabilities.d.ts +2 -0
  46. package/dist/protocol/messages/dashboard.d.ts +766 -25
  47. package/dist/protocol/messages/dashboard.js +173 -9
  48. package/dist/protocol/messages/deployment-identity.d.ts +38 -0
  49. package/dist/protocol/messages/deployment-identity.js +28 -0
  50. package/dist/protocol/messages/orchestrator-agent.d.ts +64 -2
  51. package/dist/protocol/messages/orchestrator-agent.js +26 -7
  52. package/dist/protocol/messages/peer.js +1 -1
  53. package/dist/protocol/messages/platform-orchestrator.d.ts +197 -2
  54. package/dist/protocol/messages/run-events.d.ts +1 -1
  55. package/dist/protocol/messages/source-registration.d.ts +15 -0
  56. package/dist/protocol/messages/source-registration.js +17 -1
  57. package/dist/trigger/types.d.ts +114 -22
  58. package/dist/trigger/types.js +53 -12
  59. package/package.json +9 -1
  60. package/sbom.spdx.json +5 -5
@@ -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>;
@@ -1071,7 +1073,10 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1071
1073
  component: z.ZodString;
1072
1074
  }, z.core.$strip>], "type">;
1073
1075
  environmentId: z.ZodString;
1074
- scopePatterns: z.ZodArray<z.ZodString>;
1076
+ bindings: z.ZodArray<z.ZodObject<{
1077
+ scopePattern: z.ZodString;
1078
+ hostPattern: z.ZodString;
1079
+ }, z.core.$strip>>;
1075
1080
  }, z.core.$strip>, z.ZodObject<{
1076
1081
  type: z.ZodLiteral<"dashboard.environments.secrets.list">;
1077
1082
  requestId: z.ZodString;
@@ -1294,6 +1299,7 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1294
1299
  component: z.ZodString;
1295
1300
  }, z.core.$strip>], "type">;
1296
1301
  heldRunId: z.ZodString;
1302
+ autoApprove: z.ZodOptional<z.ZodBoolean>;
1297
1303
  }, z.core.$strip>, z.ZodObject<{
1298
1304
  type: z.ZodLiteral<"dashboard.held-runs.reject">;
1299
1305
  requestId: z.ZodString;
@@ -1413,6 +1419,146 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1413
1419
  component: z.ZodString;
1414
1420
  }, z.core.$strip>], "type">;
1415
1421
  includeAgents: z.ZodOptional<z.ZodBoolean>;
1422
+ }, z.core.$strip>, z.ZodObject<{
1423
+ type: z.ZodLiteral<"dashboard.fleet.hosts">;
1424
+ requestId: z.ZodString;
1425
+ actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
1426
+ type: z.ZodLiteral<"user">;
1427
+ sub: z.ZodString;
1428
+ }, z.core.$strip>, z.ZodObject<{
1429
+ type: z.ZodLiteral<"api_key">;
1430
+ keyId: z.ZodString;
1431
+ ownerSub: z.ZodString;
1432
+ }, z.core.$strip>, z.ZodObject<{
1433
+ type: z.ZodLiteral<"service_account">;
1434
+ id: z.ZodString;
1435
+ }, z.core.$strip>, z.ZodObject<{
1436
+ type: z.ZodLiteral<"platform_operator">;
1437
+ sub: z.ZodString;
1438
+ reason: z.ZodString;
1439
+ sessionId: z.ZodOptional<z.ZodString>;
1440
+ }, z.core.$strip>, z.ZodObject<{
1441
+ type: z.ZodLiteral<"system">;
1442
+ component: z.ZodString;
1443
+ }, z.core.$strip>], "type">;
1444
+ }, z.core.$strip>, z.ZodObject<{
1445
+ type: z.ZodLiteral<"dashboard.fleet.host">;
1446
+ requestId: z.ZodString;
1447
+ actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
1448
+ type: z.ZodLiteral<"user">;
1449
+ sub: z.ZodString;
1450
+ }, z.core.$strip>, z.ZodObject<{
1451
+ type: z.ZodLiteral<"api_key">;
1452
+ keyId: z.ZodString;
1453
+ ownerSub: z.ZodString;
1454
+ }, z.core.$strip>, z.ZodObject<{
1455
+ type: z.ZodLiteral<"service_account">;
1456
+ id: z.ZodString;
1457
+ }, z.core.$strip>, z.ZodObject<{
1458
+ type: z.ZodLiteral<"platform_operator">;
1459
+ sub: z.ZodString;
1460
+ reason: z.ZodString;
1461
+ sessionId: z.ZodOptional<z.ZodString>;
1462
+ }, z.core.$strip>, z.ZodObject<{
1463
+ type: z.ZodLiteral<"system">;
1464
+ component: z.ZodString;
1465
+ }, z.core.$strip>], "type">;
1466
+ agentId: z.ZodString;
1467
+ }, z.core.$strip>, z.ZodObject<{
1468
+ type: z.ZodLiteral<"dashboard.fleet.preview">;
1469
+ requestId: z.ZodString;
1470
+ actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
1471
+ type: z.ZodLiteral<"user">;
1472
+ sub: z.ZodString;
1473
+ }, z.core.$strip>, z.ZodObject<{
1474
+ type: z.ZodLiteral<"api_key">;
1475
+ keyId: z.ZodString;
1476
+ ownerSub: z.ZodString;
1477
+ }, z.core.$strip>, z.ZodObject<{
1478
+ type: z.ZodLiteral<"service_account">;
1479
+ id: z.ZodString;
1480
+ }, z.core.$strip>, z.ZodObject<{
1481
+ type: z.ZodLiteral<"platform_operator">;
1482
+ sub: z.ZodString;
1483
+ reason: z.ZodString;
1484
+ sessionId: z.ZodOptional<z.ZodString>;
1485
+ }, z.core.$strip>, z.ZodObject<{
1486
+ type: z.ZodLiteral<"system">;
1487
+ component: z.ZodString;
1488
+ }, z.core.$strip>], "type">;
1489
+ workflowName: z.ZodString;
1490
+ }, z.core.$strip>, z.ZodObject<{
1491
+ type: z.ZodLiteral<"dashboard.fleet.workflows-for-host">;
1492
+ requestId: z.ZodString;
1493
+ actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
1494
+ type: z.ZodLiteral<"user">;
1495
+ sub: z.ZodString;
1496
+ }, z.core.$strip>, z.ZodObject<{
1497
+ type: z.ZodLiteral<"api_key">;
1498
+ keyId: z.ZodString;
1499
+ ownerSub: z.ZodString;
1500
+ }, z.core.$strip>, z.ZodObject<{
1501
+ type: z.ZodLiteral<"service_account">;
1502
+ id: z.ZodString;
1503
+ }, z.core.$strip>, z.ZodObject<{
1504
+ type: z.ZodLiteral<"platform_operator">;
1505
+ sub: z.ZodString;
1506
+ reason: z.ZodString;
1507
+ sessionId: z.ZodOptional<z.ZodString>;
1508
+ }, z.core.$strip>, z.ZodObject<{
1509
+ type: z.ZodLiteral<"system">;
1510
+ component: z.ZodString;
1511
+ }, z.core.$strip>], "type">;
1512
+ agentId: z.ZodString;
1513
+ }, z.core.$strip>, z.ZodObject<{
1514
+ type: z.ZodLiteral<"dashboard.fleet.host.declare">;
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;
1536
+ labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
1537
+ hostname: z.ZodOptional<z.ZodString>;
1538
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
1539
+ }, z.core.$strip>, z.ZodObject<{
1540
+ type: z.ZodLiteral<"dashboard.fleet.host.remove">;
1541
+ requestId: z.ZodString;
1542
+ actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
1543
+ type: z.ZodLiteral<"user">;
1544
+ sub: z.ZodString;
1545
+ }, z.core.$strip>, z.ZodObject<{
1546
+ type: z.ZodLiteral<"api_key">;
1547
+ keyId: z.ZodString;
1548
+ ownerSub: z.ZodString;
1549
+ }, z.core.$strip>, z.ZodObject<{
1550
+ type: z.ZodLiteral<"service_account">;
1551
+ id: z.ZodString;
1552
+ }, z.core.$strip>, z.ZodObject<{
1553
+ type: z.ZodLiteral<"platform_operator">;
1554
+ sub: z.ZodString;
1555
+ reason: z.ZodString;
1556
+ sessionId: z.ZodOptional<z.ZodString>;
1557
+ }, z.core.$strip>, z.ZodObject<{
1558
+ type: z.ZodLiteral<"system">;
1559
+ component: z.ZodString;
1560
+ }, z.core.$strip>], "type">;
1561
+ agentId: z.ZodString;
1416
1562
  }, z.core.$strip>, z.ZodObject<{
1417
1563
  type: z.ZodLiteral<"dashboard.scaler.capacity">;
1418
1564
  requestId: z.ZodString;
@@ -1849,6 +1995,8 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1849
1995
  "registration.disable": "registration.disable";
1850
1996
  "registration.delete": "registration.delete";
1851
1997
  "global_workflows.update": "global_workflows.update";
1998
+ "fleet.host.declare": "fleet.host.declare";
1999
+ "fleet.host.remove": "fleet.host.remove";
1852
2000
  "run.detail.read": "run.detail.read";
1853
2001
  "runs.list.read": "runs.list.read";
1854
2002
  "runs.filters.read": "runs.filters.read";
@@ -1888,6 +2036,7 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1888
2036
  "environment.history.read": "environment.history.read";
1889
2037
  "held_run.list.read": "held_run.list.read";
1890
2038
  "held_run.approve": "held_run.approve";
2039
+ "held_run.auto_approve": "held_run.auto_approve";
1891
2040
  "held_run.reject": "held_run.reject";
1892
2041
  "held_run.request": "held_run.request";
1893
2042
  "held_run.expire": "held_run.expire";
@@ -1895,6 +2044,9 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1895
2044
  "diagnostics.read": "diagnostics.read";
1896
2045
  "scaler.capacity.read": "scaler.capacity.read";
1897
2046
  "scaler.agents.read": "scaler.agents.read";
2047
+ "fleet.read": "fleet.read";
2048
+ "fleet.init_runner.bringup": "fleet.init_runner.bringup";
2049
+ "fleet.pre_boot.send": "fleet.pre_boot.send";
1898
2050
  "backend.list.read": "backend.list.read";
1899
2051
  "backend.get.read": "backend.get.read";
1900
2052
  "backend.sync": "backend.sync";
@@ -1912,6 +2064,7 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1912
2064
  platform_proxy: "platform_proxy";
1913
2065
  admin_http: "admin_http";
1914
2066
  admin_cli: "admin_cli";
2067
+ agent: "agent";
1915
2068
  }>>;
1916
2069
  outcome: z.ZodOptional<z.ZodEnum<{
1917
2070
  error: "error";
@@ -1931,6 +2084,7 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1931
2084
  backend: "backend";
1932
2085
  diagnostics: "diagnostics";
1933
2086
  scaler: "scaler";
2087
+ fleet: "fleet";
1934
2088
  held_run: "held_run";
1935
2089
  access_log: "access_log";
1936
2090
  event_dlq: "event_dlq";
@@ -2011,6 +2165,28 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
2011
2165
  check: "check";
2012
2166
  "check-fail-on-drift": "check-fail-on-drift";
2013
2167
  }>>;
2168
+ target: z.ZodOptional<z.ZodObject<{
2169
+ values: z.ZodArray<z.ZodObject<{
2170
+ include: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2171
+ kind: z.ZodLiteral<"exact">;
2172
+ value: z.ZodString;
2173
+ }, z.core.$strip>, z.ZodObject<{
2174
+ kind: z.ZodLiteral<"regex">;
2175
+ source: z.ZodString;
2176
+ flags: z.ZodString;
2177
+ }, z.core.$strip>], "kind">>;
2178
+ exclude: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2179
+ kind: z.ZodLiteral<"exact">;
2180
+ value: z.ZodString;
2181
+ }, z.core.$strip>, z.ZodObject<{
2182
+ kind: z.ZodLiteral<"regex">;
2183
+ source: z.ZodString;
2184
+ flags: z.ZodString;
2185
+ }, z.core.$strip>], "kind">>;
2186
+ }, z.core.$strip>>;
2187
+ allowEmpty: z.ZodBoolean;
2188
+ }, z.core.$strip>>;
2189
+ dispatchInputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2014
2190
  secrets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2015
2191
  encryptedSecrets: z.ZodOptional<z.ZodString>;
2016
2192
  encryptedSecretsKey: z.ZodOptional<z.ZodString>;
@@ -2309,6 +2485,8 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
2309
2485
  "backends.sync": "backends.sync";
2310
2486
  "backends.sync_one": "backends.sync_one";
2311
2487
  "backends.test": "backends.test";
2488
+ "fleet.host.declare": "fleet.host.declare";
2489
+ "fleet.host.remove": "fleet.host.remove";
2312
2490
  }> & z.core.$partial, z.ZodBoolean>>;
2313
2491
  }, z.core.$loose>;
2314
2492
  }, z.core.$strip>, z.ZodObject<{
@@ -2329,6 +2507,7 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
2329
2507
  universal_git: "universal_git";
2330
2508
  local: "local";
2331
2509
  }>;
2510
+ slug: z.ZodOptional<z.ZodString>;
2332
2511
  }, z.core.$strip>>;
2333
2512
  instanceId: z.ZodOptional<z.ZodString>;
2334
2513
  clusterName: z.ZodOptional<z.ZodString>;
@@ -2341,6 +2520,20 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
2341
2520
  independent: "independent";
2342
2521
  }>>;
2343
2522
  scalerBackends: z.ZodOptional<z.ZodArray<z.ZodString>>;
2523
+ deployment: z.ZodOptional<z.ZodObject<{
2524
+ mode: z.ZodEnum<{
2525
+ unknown: "unknown";
2526
+ systemd: "systemd";
2527
+ launchd: "launchd";
2528
+ windows: "windows";
2529
+ compose: "compose";
2530
+ }>;
2531
+ containerName: z.ZodOptional<z.ZodString>;
2532
+ containerRuntime: z.ZodOptional<z.ZodEnum<{
2533
+ podman: "podman";
2534
+ docker: "docker";
2535
+ }>>;
2536
+ }, z.core.$strip>>;
2344
2537
  s3LogAccess: z.ZodOptional<z.ZodBoolean>;
2345
2538
  queueTimeoutMs: z.ZodOptional<z.ZodNumber>;
2346
2539
  }, z.core.$strip>, z.ZodObject<{
@@ -2388,6 +2581,8 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
2388
2581
  "backends.sync": "backends.sync";
2389
2582
  "backends.sync_one": "backends.sync_one";
2390
2583
  "backends.test": "backends.test";
2584
+ "fleet.host.declare": "fleet.host.declare";
2585
+ "fleet.host.remove": "fleet.host.remove";
2391
2586
  }> & z.core.$partial, z.ZodBoolean>>;
2392
2587
  }, z.core.$loose>>;
2393
2588
  }, z.core.$strip>, z.ZodObject<{
@@ -2400,8 +2595,8 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
2400
2595
  timestampMs: z.ZodNumber;
2401
2596
  sourceService: z.ZodEnum<{
2402
2597
  platform: "platform";
2403
- orchestrator: "orchestrator";
2404
2598
  agent: "agent";
2599
+ orchestrator: "orchestrator";
2405
2600
  }>;
2406
2601
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2407
2602
  traceId: z.ZodOptional<z.ZodString>;
@@ -15,8 +15,8 @@ export declare const runEventMessageSchema: z.ZodObject<{
15
15
  timestampMs: z.ZodNumber;
16
16
  sourceService: z.ZodEnum<{
17
17
  platform: "platform";
18
- orchestrator: "orchestrator";
19
18
  agent: "agent";
19
+ orchestrator: "orchestrator";
20
20
  }>;
21
21
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
22
22
  traceId: z.ZodOptional<z.ZodString>;
@@ -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. */
@@ -15,16 +15,22 @@
15
15
  * Schema version 18: adds LockJob.runsOnAll host fan-out predicate + onUnreachable policy.
16
16
  * Schema version 19: adds LockJob.maxParallel/failFast fan-out concurrency (rolling waves).
17
17
  * Schema version 20: runsOn/runsOnAll/excludeLabels carry LabelMatcher (exact|regex) for glob+regex selectors.
18
+ * Schema version 23: adds LockDispatchTrigger.inputs (typed dispatch inputs descriptors).
19
+ * Schema version 24: adds LockJob.runsOnPick (deterministic single-host selection).
20
+ * Schema version 25: adds LockStep.retry (step retry policy data subset; retryIf is execution-only).
21
+ * Schema version 26: adds LockJob.includeUninitialized (runsOnAll fans out to declared-but-un-agented hosts, bringing up a temporary init-runner per fresh box).
18
22
  */
19
23
  import { z } from 'zod';
20
24
  import type { ProviderType } from '../provider/types.js';
21
25
  import type { ApproverClause } from '../approval/types.js';
26
+ import type { InputsDescriptorMap } from '../inputs/descriptor.js';
22
27
  import { LabelMatcher } from '../labels-match.js';
28
+ import { ExecutionJobStatus } from '../protocol/messages/execution-status.js';
23
29
  /** Schema version - increment on breaking changes */
24
- export declare const SCHEMA_VERSION: 21;
30
+ export declare const SCHEMA_VERSION: 26;
25
31
  /**
26
32
  * 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
33
+ * from an SDK `approval` at any of the three levels; consumed by the
28
34
  * orchestrator dispatch gate (and the agent step round-trip for step scope).
29
35
  */
30
36
  export interface LockApproval {
@@ -34,6 +40,11 @@ export interface LockApproval {
34
40
  readonly reason?: string;
35
41
  /** Per-gate expiry override (seconds); falls back to the org default. */
36
42
  readonly timeoutSeconds?: number;
43
+ /**
44
+ * When the gate fires. `always` (default) gates before the element; `drift`
45
+ * gates between a step's check and run on detected drift (step scope only).
46
+ */
47
+ readonly when: 'always' | 'drift';
37
48
  }
38
49
  /**
39
50
  * Source file reference with meaningful path.
@@ -133,6 +144,8 @@ export interface LockDispatchTrigger {
133
144
  readonly _type: 'dispatch';
134
145
  readonly types: readonly string[];
135
146
  readonly repos?: readonly LockBranchPattern[];
147
+ /** Typed dispatch-input descriptors (from `dispatch({ inputs })`). */
148
+ readonly inputs?: InputsDescriptorMap;
136
149
  }
137
150
  /**
138
151
  * Create trigger in lock file.
@@ -329,6 +342,13 @@ export interface LockStep {
329
342
  readonly continueOnError?: boolean;
330
343
  /** Step-level timeout in milliseconds. */
331
344
  readonly timeout?: number;
345
+ /** Retry policy data (retryIf is execution-only and never serialized). */
346
+ readonly retry?: {
347
+ readonly maxAttempts: number;
348
+ readonly delayMs: number;
349
+ readonly backoff: 'fixed' | 'exponential';
350
+ readonly maxDelayMs: number;
351
+ };
332
352
  /** Source location of the step() call in the original TypeScript file (for annotations). */
333
353
  readonly sourceLocation?: {
334
354
  readonly file: string;
@@ -352,38 +372,84 @@ export interface LockInlineValue {
352
372
  /** Type guard for inline expression values */
353
373
  export declare function isLockInlineValue(value: unknown): value is LockInlineValue;
354
374
  /**
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.
375
+ * Author-facing keyword sugar for a `needs` edge's run condition. Each keyword
376
+ * resolves (at compile time) to a set of upstream terminal statuses; the
377
+ * downstream edge is dispatch-satisfied when the upstream's terminal status is
378
+ * a member of that set.
359
379
  */
360
- export declare const IfFailedPolicy: z.ZodEnum<{
361
- run: "run";
362
- skip: "skip";
380
+ export declare const NeedsWhen: z.ZodEnum<{
381
+ always: "always";
382
+ "on-success": "on-success";
383
+ "on-skip": "on-skip";
384
+ "on-failure": "on-failure";
363
385
  }>;
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.
386
+ export type NeedsWhen = z.infer<typeof NeedsWhen>;
387
+ /**
388
+ * Normalized, DB-evaluable run condition for a `needs` edge: the non-empty set
389
+ * of upstream terminal statuses that satisfy the edge. The lock file and the
390
+ * orchestrator scheduler only ever see this resolved set (never a keyword), so
391
+ * gating stays a pure status-set membership test.
392
+ */
393
+ export declare const NeedsRunOn: z.ZodArray<z.ZodEnum<{
394
+ skipped: "skipped";
395
+ success: "success";
396
+ pending: "pending";
397
+ running: "running";
398
+ failed: "failed";
399
+ cancelled: "cancelled";
400
+ cancelling: "cancelling";
401
+ queued: "queued";
402
+ recovering: "recovering";
403
+ timed_out_stale: "timed_out_stale";
404
+ drift_dropped: "drift_dropped";
405
+ }>>;
406
+ export type NeedsRunOn = z.infer<typeof NeedsRunOn>;
407
+ /**
408
+ * Resolve the author-facing `when` (keyword sugar | raw status-set | unset) to
409
+ * the normalized status-set. An unset `when` defaults to success-only — the
410
+ * downstream runs only when the upstream succeeded.
411
+ */
412
+ export declare function resolveWhenToRunOn(when: NeedsWhen | ExecutionJobStatus[] | undefined): ExecutionJobStatus[];
413
+ /**
414
+ * Needs entry carrying the normalized run-on status-set.
415
+ * Used in lock file needs arrays for an explicit per-edge run condition.
368
416
  */
369
417
  export declare const NeedsEntrySchema: z.ZodObject<{
370
418
  name: z.ZodString;
371
- ifFailed: z.ZodDefault<z.ZodEnum<{
372
- run: "run";
373
- skip: "skip";
374
- }>>;
419
+ runOn: z.ZodDefault<z.ZodArray<z.ZodEnum<{
420
+ skipped: "skipped";
421
+ success: "success";
422
+ pending: "pending";
423
+ running: "running";
424
+ failed: "failed";
425
+ cancelled: "cancelled";
426
+ cancelling: "cancelling";
427
+ queued: "queued";
428
+ recovering: "recovering";
429
+ timed_out_stale: "timed_out_stale";
430
+ drift_dropped: "drift_dropped";
431
+ }>>>;
375
432
  }, z.core.$strip>;
376
433
  export type NeedsEntry = z.infer<typeof NeedsEntrySchema>;
377
434
  /**
378
- * Needs group entry with per-edge failure policy.
435
+ * Needs group entry carrying the normalized run-on status-set.
379
436
  * Used in lock file needs arrays for dynamic group dependencies.
380
437
  */
381
438
  export declare const NeedsGroupEntrySchema: z.ZodObject<{
382
439
  group: z.ZodString;
383
- ifFailed: z.ZodDefault<z.ZodEnum<{
384
- run: "run";
385
- skip: "skip";
386
- }>>;
440
+ runOn: z.ZodDefault<z.ZodArray<z.ZodEnum<{
441
+ skipped: "skipped";
442
+ success: "success";
443
+ pending: "pending";
444
+ running: "running";
445
+ failed: "failed";
446
+ cancelled: "cancelled";
447
+ cancelling: "cancelling";
448
+ queued: "queued";
449
+ recovering: "recovering";
450
+ timed_out_stale: "timed_out_stale";
451
+ drift_dropped: "drift_dropped";
452
+ }>>>;
387
453
  }, z.core.$strip>;
388
454
  export type NeedsGroupEntry = z.infer<typeof NeedsGroupEntrySchema>;
389
455
  /**
@@ -422,12 +488,30 @@ export declare const OnUnreachableMode: z.ZodEnum<{
422
488
  hold: "hold";
423
489
  }>;
424
490
  export type OnUnreachableMode = z.infer<typeof OnUnreachableMode>;
491
+ /**
492
+ * Single-agent selection policy when multiple agents match a `runsOn` selector.
493
+ *
494
+ * - `deterministic` (default): sort matching candidates by `agentId` and pick the
495
+ * lowest, so a run-once-on-one-host job is reproducible across re-runs.
496
+ * - `any`: pick any available agent (load spread).
497
+ */
498
+ export declare const RunsOnPick: z.ZodEnum<{
499
+ any: "any";
500
+ deterministic: "deterministic";
501
+ }>;
502
+ export type RunsOnPick = z.infer<typeof RunsOnPick>;
425
503
  export interface LockJob {
426
504
  readonly _type: 'static';
427
505
  readonly name: string;
428
506
  /** Single-agent targeting matchers. Absent when the job uses `runsOnAll` instead. */
429
507
  readonly runsOn?: readonly LabelMatcher[];
430
508
  readonly excludeLabels?: readonly LabelMatcher[];
509
+ /**
510
+ * Single-agent selection policy when more than one agent matches `runsOn`.
511
+ * `deterministic` (default) sorts candidates by `agentId` and picks the lowest;
512
+ * `any` picks any available agent. Absent on a `runsOnAll` fan-out job.
513
+ */
514
+ readonly runsOnPick?: RunsOnPick;
431
515
  /**
432
516
  * Host fan-out predicate (mutually exclusive with `runsOn`). When set, the job
433
517
  * fans out to every roster host matching the predicate, one pinned child per host.
@@ -435,6 +519,14 @@ export interface LockJob {
435
519
  readonly runsOnAll?: RunsOnAllPredicate;
436
520
  /** Failure policy for unreachable durable hosts in a `runsOnAll` fan-out. */
437
521
  readonly onUnreachable?: OnUnreachableMode;
522
+ /**
523
+ * Widen a `runsOnAll` fan-out to declared-but-un-agented hosts. When true,
524
+ * every roster host matching the predicate is a fan-out target even with no
525
+ * live agent: a fresh host gets a temporary init-runner brought up over SSH
526
+ * and its pinned steps run there; a live host runs on its own agent. Default
527
+ * absent ⇒ only live hosts (today's behavior governed by `onUnreachable`).
528
+ */
529
+ readonly includeUninitialized?: boolean;
438
530
  /**
439
531
  * Fan-out concurrency width (sliding window; `1` = serial). When set on a
440
532
  * fan-out job (matrix or `runsOnAll`), only the first `maxParallel` children