@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
@@ -1,4 +1,5 @@
1
1
  import "../chunk-BTugEXQM.js";
2
+ import { ExecutionJobStatus, TERMINAL_JOB_STATES } from "../protocol/messages/execution-status.js";
2
3
  import { z } from "zod";
3
4
  //#region src/trigger/types.ts
4
5
  /**
@@ -18,35 +19,67 @@ import { z } from "zod";
18
19
  * Schema version 18: adds LockJob.runsOnAll host fan-out predicate + onUnreachable policy.
19
20
  * Schema version 19: adds LockJob.maxParallel/failFast fan-out concurrency (rolling waves).
20
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).
21
26
  */
22
27
  /** Schema version - increment on breaking changes */
23
- const SCHEMA_VERSION = 21;
28
+ const SCHEMA_VERSION = 26;
24
29
  /** Type guard for inline expression values */
25
30
  function isLockInlineValue(value) {
26
31
  return typeof value === "object" && value !== null && value._type === "inline";
27
32
  }
28
33
  /**
29
- * Per-edge failure policy for a `needs` dependency: `skip` propagates an
30
- * upstream failure to the downstream job (default), `run` runs the downstream
31
- * job regardless of the upstream outcome. Single source of truth for this
32
- * value across lock-file schemas and protocol messages.
34
+ * Author-facing keyword sugar for a `needs` edge's run condition. Each keyword
35
+ * resolves (at compile time) to a set of upstream terminal statuses; the
36
+ * downstream edge is dispatch-satisfied when the upstream's terminal status is
37
+ * a member of that set.
33
38
  */
34
- const IfFailedPolicy = z.enum(["skip", "run"]);
39
+ const NeedsWhen = z.enum([
40
+ "on-success",
41
+ "always",
42
+ "on-skip",
43
+ "on-failure"
44
+ ]);
45
+ /**
46
+ * Normalized, DB-evaluable run condition for a `needs` edge: the non-empty set
47
+ * of upstream terminal statuses that satisfy the edge. The lock file and the
48
+ * orchestrator scheduler only ever see this resolved set (never a keyword), so
49
+ * gating stays a pure status-set membership test.
50
+ */
51
+ const NeedsRunOn = z.array(ExecutionJobStatus).nonempty();
52
+ const WHEN_TO_RUN_ON = {
53
+ "on-success": [ExecutionJobStatus.enum.success],
54
+ always: [...TERMINAL_JOB_STATES],
55
+ "on-skip": [ExecutionJobStatus.enum.success, ExecutionJobStatus.enum.skipped],
56
+ "on-failure": [ExecutionJobStatus.enum.failed, ExecutionJobStatus.enum.timed_out_stale]
57
+ };
35
58
  /**
36
- * Needs entry with per-edge failure policy.
37
- * Used in lock file needs arrays for explicit ifFailed override.
59
+ * Resolve the author-facing `when` (keyword sugar | raw status-set | unset) to
60
+ * the normalized status-set. An unset `when` defaults to success-only — the
61
+ * downstream runs only when the upstream succeeded.
62
+ */
63
+ function resolveWhenToRunOn(when) {
64
+ if (when === void 0) return [ExecutionJobStatus.enum.success];
65
+ if (Array.isArray(when)) return when;
66
+ return WHEN_TO_RUN_ON[when];
67
+ }
68
+ /**
69
+ * Needs entry carrying the normalized run-on status-set.
70
+ * Used in lock file needs arrays for an explicit per-edge run condition.
38
71
  */
39
72
  const NeedsEntrySchema = z.object({
40
73
  name: z.string(),
41
- ifFailed: IfFailedPolicy.default(IfFailedPolicy.enum.skip)
74
+ runOn: NeedsRunOn.default([ExecutionJobStatus.enum.success])
42
75
  });
43
76
  /**
44
- * Needs group entry with per-edge failure policy.
77
+ * Needs group entry carrying the normalized run-on status-set.
45
78
  * Used in lock file needs arrays for dynamic group dependencies.
46
79
  */
47
80
  const NeedsGroupEntrySchema = z.object({
48
81
  group: z.string(),
49
- ifFailed: IfFailedPolicy.default(IfFailedPolicy.enum.skip)
82
+ runOn: NeedsRunOn.default([ExecutionJobStatus.enum.success])
50
83
  });
51
84
  /**
52
85
  * Failure policy for a host fan-out (`runsOnAll`) when an expected durable host
@@ -65,6 +98,14 @@ const OnUnreachableMode = z.enum([
65
98
  "fail",
66
99
  "hold"
67
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"]);
68
109
  /** Type guard for static jobs */
69
110
  function isLockStaticJob(job) {
70
111
  return job._type === "static";
@@ -74,6 +115,6 @@ function isLockDynamicJobFn(job) {
74
115
  return job._type === "dynamic";
75
116
  }
76
117
  //#endregion
77
- export { IfFailedPolicy, NeedsEntrySchema, NeedsGroupEntrySchema, OnUnreachableMode, SCHEMA_VERSION, isLockDynamicJobFn, isLockInlineValue, isLockStaticJob };
118
+ export { NeedsEntrySchema, NeedsGroupEntrySchema, NeedsRunOn, NeedsWhen, OnUnreachableMode, RunsOnPick, SCHEMA_VERSION, isLockDynamicJobFn, isLockInlineValue, isLockStaticJob, resolveWhenToRunOn };
78
119
 
79
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.21",
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.21",
6
- "documentNamespace": "https://kici.dev/sbom/%40kici-dev%2Fengine/0.1.21/e80a4720-81f4-4549-ae95-80ee7a5c127e",
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-23T05:10:06Z",
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.21",
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.21"
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.",