@kici-dev/engine 0.1.22 → 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 (44) hide show
  1. package/dist/audit/access-log-policy.js +2 -0
  2. package/dist/audit/activity.d.ts +3 -1
  3. package/dist/audit/activity.js +8 -16
  4. package/dist/audit/retention-policy.js +4 -0
  5. package/dist/environment/host-match.d.ts +25 -0
  6. package/dist/environment/host-match.js +67 -0
  7. package/dist/environment/index.d.ts +1 -0
  8. package/dist/environment/scope-resolver.d.ts +15 -4
  9. package/dist/environment/scope-resolver.js +55 -15
  10. package/dist/environment/scope-template.d.ts +18 -0
  11. package/dist/environment/scope-template.js +43 -0
  12. package/dist/environment/types.d.ts +7 -0
  13. package/dist/fanout/materialize.d.ts +34 -0
  14. package/dist/fanout/materialize.js +72 -45
  15. package/dist/index.d.ts +2 -1
  16. package/dist/index.js +10 -5
  17. package/dist/inputs/build.d.ts +9 -0
  18. package/dist/inputs/build.js +44 -0
  19. package/dist/inputs/coerce.d.ts +25 -0
  20. package/dist/inputs/coerce.js +51 -0
  21. package/dist/inputs/descriptor.d.ts +53 -0
  22. package/dist/inputs/descriptor.js +42 -0
  23. package/dist/inputs/extract.d.ts +15 -0
  24. package/dist/inputs/extract.js +117 -0
  25. package/dist/inputs/index.d.ts +5 -0
  26. package/dist/inputs/index.js +6 -0
  27. package/dist/labels/compile.d.ts +9 -0
  28. package/dist/labels/compile.js +10 -1
  29. package/dist/labels.d.ts +29 -0
  30. package/dist/labels.js +32 -1
  31. package/dist/metrics/catalog-policy.d.ts +7 -0
  32. package/dist/metrics/catalog-policy.js +11 -12
  33. package/dist/metrics/metric-catalog.generated.d.ts +2 -2
  34. package/dist/metrics/metric-catalog.generated.js +10 -2
  35. package/dist/protocol/messages/access-log.d.ts +15 -0
  36. package/dist/protocol/messages/access-log.js +4 -1
  37. package/dist/protocol/messages/dashboard.d.ts +146 -6
  38. package/dist/protocol/messages/dashboard.js +50 -10
  39. package/dist/protocol/messages/platform-orchestrator.d.ts +33 -3
  40. package/dist/protocol/messages/run-events.d.ts +1 -1
  41. package/dist/trigger/types.d.ts +41 -1
  42. package/dist/trigger/types.js +14 -2
  43. package/package.json +9 -1
  44. package/sbom.spdx.json +5 -5
@@ -1073,7 +1073,10 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1073
1073
  component: z.ZodString;
1074
1074
  }, z.core.$strip>], "type">;
1075
1075
  environmentId: z.ZodString;
1076
- scopePatterns: z.ZodArray<z.ZodString>;
1076
+ bindings: z.ZodArray<z.ZodObject<{
1077
+ scopePattern: z.ZodString;
1078
+ hostPattern: z.ZodString;
1079
+ }, z.core.$strip>>;
1077
1080
  }, z.core.$strip>, z.ZodObject<{
1078
1081
  type: z.ZodLiteral<"dashboard.environments.secrets.list">;
1079
1082
  requestId: z.ZodString;
@@ -1484,6 +1487,29 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1484
1487
  component: z.ZodString;
1485
1488
  }, z.core.$strip>], "type">;
1486
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;
1487
1513
  }, z.core.$strip>, z.ZodObject<{
1488
1514
  type: z.ZodLiteral<"dashboard.fleet.host.declare">;
1489
1515
  requestId: z.ZodString;
@@ -1507,7 +1533,7 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1507
1533
  component: z.ZodString;
1508
1534
  }, z.core.$strip>], "type">;
1509
1535
  agentId: z.ZodString;
1510
- labels: z.ZodArray<z.ZodString>;
1536
+ labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
1511
1537
  hostname: z.ZodOptional<z.ZodString>;
1512
1538
  properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
1513
1539
  }, z.core.$strip>, z.ZodObject<{
@@ -2019,6 +2045,8 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
2019
2045
  "scaler.capacity.read": "scaler.capacity.read";
2020
2046
  "scaler.agents.read": "scaler.agents.read";
2021
2047
  "fleet.read": "fleet.read";
2048
+ "fleet.init_runner.bringup": "fleet.init_runner.bringup";
2049
+ "fleet.pre_boot.send": "fleet.pre_boot.send";
2022
2050
  "backend.list.read": "backend.list.read";
2023
2051
  "backend.get.read": "backend.get.read";
2024
2052
  "backend.sync": "backend.sync";
@@ -2036,6 +2064,7 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
2036
2064
  platform_proxy: "platform_proxy";
2037
2065
  admin_http: "admin_http";
2038
2066
  admin_cli: "admin_cli";
2067
+ agent: "agent";
2039
2068
  }>>;
2040
2069
  outcome: z.ZodOptional<z.ZodEnum<{
2041
2070
  error: "error";
@@ -2157,6 +2186,7 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
2157
2186
  }, z.core.$strip>>;
2158
2187
  allowEmpty: z.ZodBoolean;
2159
2188
  }, z.core.$strip>>;
2189
+ dispatchInputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2160
2190
  secrets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2161
2191
  encryptedSecrets: z.ZodOptional<z.ZodString>;
2162
2192
  encryptedSecretsKey: z.ZodOptional<z.ZodString>;
@@ -2565,8 +2595,8 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
2565
2595
  timestampMs: z.ZodNumber;
2566
2596
  sourceService: z.ZodEnum<{
2567
2597
  platform: "platform";
2568
- orchestrator: "orchestrator";
2569
2598
  agent: "agent";
2599
+ orchestrator: "orchestrator";
2570
2600
  }>;
2571
2601
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2572
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>;
@@ -15,14 +15,19 @@
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';
23
28
  import { ExecutionJobStatus } from '../protocol/messages/execution-status.js';
24
29
  /** Schema version - increment on breaking changes */
25
- export declare const SCHEMA_VERSION: 22;
30
+ export declare const SCHEMA_VERSION: 26;
26
31
  /**
27
32
  * Normalized approval config carried in the lock file. Produced by the compiler
28
33
  * from an SDK `approval` at any of the three levels; consumed by the
@@ -139,6 +144,8 @@ export interface LockDispatchTrigger {
139
144
  readonly _type: 'dispatch';
140
145
  readonly types: readonly string[];
141
146
  readonly repos?: readonly LockBranchPattern[];
147
+ /** Typed dispatch-input descriptors (from `dispatch({ inputs })`). */
148
+ readonly inputs?: InputsDescriptorMap;
142
149
  }
143
150
  /**
144
151
  * Create trigger in lock file.
@@ -335,6 +342,13 @@ export interface LockStep {
335
342
  readonly continueOnError?: boolean;
336
343
  /** Step-level timeout in milliseconds. */
337
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
+ };
338
352
  /** Source location of the step() call in the original TypeScript file (for annotations). */
339
353
  readonly sourceLocation?: {
340
354
  readonly file: string;
@@ -474,12 +488,30 @@ export declare const OnUnreachableMode: z.ZodEnum<{
474
488
  hold: "hold";
475
489
  }>;
476
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>;
477
503
  export interface LockJob {
478
504
  readonly _type: 'static';
479
505
  readonly name: string;
480
506
  /** Single-agent targeting matchers. Absent when the job uses `runsOnAll` instead. */
481
507
  readonly runsOn?: readonly LabelMatcher[];
482
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;
483
515
  /**
484
516
  * Host fan-out predicate (mutually exclusive with `runsOn`). When set, the job
485
517
  * fans out to every roster host matching the predicate, one pinned child per host.
@@ -487,6 +519,14 @@ export interface LockJob {
487
519
  readonly runsOnAll?: RunsOnAllPredicate;
488
520
  /** Failure policy for unreachable durable hosts in a `runsOnAll` fan-out. */
489
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;
490
530
  /**
491
531
  * Fan-out concurrency width (sliding window; `1` = serial). When set on a
492
532
  * fan-out job (matrix or `runsOnAll`), only the first `maxParallel` children
@@ -19,9 +19,13 @@ import { z } from "zod";
19
19
  * Schema version 18: adds LockJob.runsOnAll host fan-out predicate + onUnreachable policy.
20
20
  * Schema version 19: adds LockJob.maxParallel/failFast fan-out concurrency (rolling waves).
21
21
  * Schema version 20: runsOn/runsOnAll/excludeLabels carry LabelMatcher (exact|regex) for glob+regex selectors.
22
+ * Schema version 23: adds LockDispatchTrigger.inputs (typed dispatch inputs descriptors).
23
+ * Schema version 24: adds LockJob.runsOnPick (deterministic single-host selection).
24
+ * Schema version 25: adds LockStep.retry (step retry policy data subset; retryIf is execution-only).
25
+ * Schema version 26: adds LockJob.includeUninitialized (runsOnAll fans out to declared-but-un-agented hosts, bringing up a temporary init-runner per fresh box).
22
26
  */
23
27
  /** Schema version - increment on breaking changes */
24
- const SCHEMA_VERSION = 22;
28
+ const SCHEMA_VERSION = 26;
25
29
  /** Type guard for inline expression values */
26
30
  function isLockInlineValue(value) {
27
31
  return typeof value === "object" && value !== null && value._type === "inline";
@@ -94,6 +98,14 @@ const OnUnreachableMode = z.enum([
94
98
  "fail",
95
99
  "hold"
96
100
  ]);
101
+ /**
102
+ * Single-agent selection policy when multiple agents match a `runsOn` selector.
103
+ *
104
+ * - `deterministic` (default): sort matching candidates by `agentId` and pick the
105
+ * lowest, so a run-once-on-one-host job is reproducible across re-runs.
106
+ * - `any`: pick any available agent (load spread).
107
+ */
108
+ const RunsOnPick = z.enum(["deterministic", "any"]);
97
109
  /** Type guard for static jobs */
98
110
  function isLockStaticJob(job) {
99
111
  return job._type === "static";
@@ -103,6 +115,6 @@ function isLockDynamicJobFn(job) {
103
115
  return job._type === "dynamic";
104
116
  }
105
117
  //#endregion
106
- export { NeedsEntrySchema, NeedsGroupEntrySchema, NeedsRunOn, NeedsWhen, OnUnreachableMode, SCHEMA_VERSION, isLockDynamicJobFn, isLockInlineValue, isLockStaticJob, resolveWhenToRunOn };
118
+ export { NeedsEntrySchema, NeedsGroupEntrySchema, NeedsRunOn, NeedsWhen, OnUnreachableMode, RunsOnPick, SCHEMA_VERSION, isLockDynamicJobFn, isLockInlineValue, isLockStaticJob, resolveWhenToRunOn };
107
119
 
108
120
  //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kici-dev/engine",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "description": "Shared business logic for the KiCI CI/CD stack: protocol, triggers, state machine, and provider interfaces used by the Platform relay, orchestrator, and compiler.",
5
5
  "keywords": [
6
6
  "ci",
@@ -53,6 +53,14 @@
53
53
  "import": "./dist/labels/compile.js",
54
54
  "types": "./dist/labels/compile.d.ts"
55
55
  },
56
+ "./environment/host-match": {
57
+ "import": "./dist/environment/host-match.js",
58
+ "types": "./dist/environment/host-match.d.ts"
59
+ },
60
+ "./environment/scope-template": {
61
+ "import": "./dist/environment/scope-template.js",
62
+ "types": "./dist/environment/scope-template.d.ts"
63
+ },
56
64
  "./protocol/dashboard-global-workflows": {
57
65
  "import": "./dist/protocol/dashboard-global-workflows.js",
58
66
  "types": "./dist/protocol/dashboard-global-workflows.d.ts"
package/sbom.spdx.json CHANGED
@@ -2,10 +2,10 @@
2
2
  "spdxVersion": "SPDX-2.3",
3
3
  "dataLicense": "CC0-1.0",
4
4
  "SPDXID": "SPDXRef-DOCUMENT",
5
- "name": "@kici-dev/engine@0.1.22",
6
- "documentNamespace": "https://kici.dev/sbom/%40kici-dev%2Fengine/0.1.22/5dc6919d-c8a2-40b2-aba3-44650ecac92f",
5
+ "name": "@kici-dev/engine@0.1.23",
6
+ "documentNamespace": "https://kici.dev/sbom/%40kici-dev%2Fengine/0.1.23/8d393c8b-11ae-4191-987e-130f8fca7033",
7
7
  "creationInfo": {
8
- "created": "2026-06-24T06:02:58Z",
8
+ "created": "2026-06-25T11:12:41Z",
9
9
  "creators": [
10
10
  "Tool: kici-sbom-generator"
11
11
  ]
@@ -54,7 +54,7 @@
54
54
  {
55
55
  "SPDXID": "SPDXRef-RootPackage",
56
56
  "name": "@kici-dev/engine",
57
- "versionInfo": "0.1.22",
57
+ "versionInfo": "0.1.23",
58
58
  "downloadLocation": "NOASSERTION",
59
59
  "filesAnalyzed": false,
60
60
  "licenseConcluded": "NOASSERTION",
@@ -65,7 +65,7 @@
65
65
  {
66
66
  "referenceCategory": "PACKAGE-MANAGER",
67
67
  "referenceType": "purl",
68
- "referenceLocator": "pkg:npm/%40kici-dev/engine@0.1.22"
68
+ "referenceLocator": "pkg:npm/%40kici-dev/engine@0.1.23"
69
69
  }
70
70
  ],
71
71
  "description": "Shared business logic for the KiCI CI/CD stack: protocol, triggers, state machine, and provider interfaces used by the Platform relay, orchestrator, and compiler.",