@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
@@ -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
  /**
@@ -20,33 +21,61 @@ import { z } from "zod";
20
21
  * Schema version 20: runsOn/runsOnAll/excludeLabels carry LabelMatcher (exact|regex) for glob+regex selectors.
21
22
  */
22
23
  /** Schema version - increment on breaking changes */
23
- const SCHEMA_VERSION = 20;
24
+ const SCHEMA_VERSION = 22;
24
25
  /** Type guard for inline expression values */
25
26
  function isLockInlineValue(value) {
26
27
  return typeof value === "object" && value !== null && value._type === "inline";
27
28
  }
28
29
  /**
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.
30
+ * Author-facing keyword sugar for a `needs` edge's run condition. Each keyword
31
+ * resolves (at compile time) to a set of upstream terminal statuses; the
32
+ * downstream edge is dispatch-satisfied when the upstream's terminal status is
33
+ * a member of that set.
33
34
  */
34
- const IfFailedPolicy = z.enum(["skip", "run"]);
35
+ const NeedsWhen = z.enum([
36
+ "on-success",
37
+ "always",
38
+ "on-skip",
39
+ "on-failure"
40
+ ]);
41
+ /**
42
+ * Normalized, DB-evaluable run condition for a `needs` edge: the non-empty set
43
+ * of upstream terminal statuses that satisfy the edge. The lock file and the
44
+ * orchestrator scheduler only ever see this resolved set (never a keyword), so
45
+ * gating stays a pure status-set membership test.
46
+ */
47
+ const NeedsRunOn = z.array(ExecutionJobStatus).nonempty();
48
+ const WHEN_TO_RUN_ON = {
49
+ "on-success": [ExecutionJobStatus.enum.success],
50
+ always: [...TERMINAL_JOB_STATES],
51
+ "on-skip": [ExecutionJobStatus.enum.success, ExecutionJobStatus.enum.skipped],
52
+ "on-failure": [ExecutionJobStatus.enum.failed, ExecutionJobStatus.enum.timed_out_stale]
53
+ };
54
+ /**
55
+ * Resolve the author-facing `when` (keyword sugar | raw status-set | unset) to
56
+ * the normalized status-set. An unset `when` defaults to success-only — the
57
+ * downstream runs only when the upstream succeeded.
58
+ */
59
+ function resolveWhenToRunOn(when) {
60
+ if (when === void 0) return [ExecutionJobStatus.enum.success];
61
+ if (Array.isArray(when)) return when;
62
+ return WHEN_TO_RUN_ON[when];
63
+ }
35
64
  /**
36
- * Needs entry with per-edge failure policy.
37
- * Used in lock file needs arrays for explicit ifFailed override.
65
+ * Needs entry carrying the normalized run-on status-set.
66
+ * Used in lock file needs arrays for an explicit per-edge run condition.
38
67
  */
39
68
  const NeedsEntrySchema = z.object({
40
69
  name: z.string(),
41
- ifFailed: IfFailedPolicy.default(IfFailedPolicy.enum.skip)
70
+ runOn: NeedsRunOn.default([ExecutionJobStatus.enum.success])
42
71
  });
43
72
  /**
44
- * Needs group entry with per-edge failure policy.
73
+ * Needs group entry carrying the normalized run-on status-set.
45
74
  * Used in lock file needs arrays for dynamic group dependencies.
46
75
  */
47
76
  const NeedsGroupEntrySchema = z.object({
48
77
  group: z.string(),
49
- ifFailed: IfFailedPolicy.default(IfFailedPolicy.enum.skip)
78
+ runOn: NeedsRunOn.default([ExecutionJobStatus.enum.success])
50
79
  });
51
80
  /**
52
81
  * Failure policy for a host fan-out (`runsOnAll`) when an expected durable host
@@ -74,6 +103,6 @@ function isLockDynamicJobFn(job) {
74
103
  return job._type === "dynamic";
75
104
  }
76
105
  //#endregion
77
- export { IfFailedPolicy, NeedsEntrySchema, NeedsGroupEntrySchema, OnUnreachableMode, SCHEMA_VERSION, isLockDynamicJobFn, isLockInlineValue, isLockStaticJob };
106
+ export { NeedsEntrySchema, NeedsGroupEntrySchema, NeedsRunOn, NeedsWhen, OnUnreachableMode, SCHEMA_VERSION, isLockDynamicJobFn, isLockInlineValue, isLockStaticJob, resolveWhenToRunOn };
78
107
 
79
108
  //# sourceMappingURL=types.js.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Route shape for a GitHub App webhook. Org-scoped, NOT app-scoped — the app
3
+ * id does not appear, so the URL is resolvable before the App exists (the
4
+ * manifest setup flow needs it up front to bake into the App manifest). Shared
5
+ * by the Platform's webhook-URL builder and the orchestrator's manifest
6
+ * pre-flight so the two never drift.
7
+ */
8
+ export declare function githubWebhookPath(orgId: string): string;
9
+ //# sourceMappingURL=webhook-url-format.d.ts.map
@@ -0,0 +1,16 @@
1
+ import "../chunk-BTugEXQM.js";
2
+ //#region src/webhook/webhook-url-format.ts
3
+ /**
4
+ * Route shape for a GitHub App webhook. Org-scoped, NOT app-scoped — the app
5
+ * id does not appear, so the URL is resolvable before the App exists (the
6
+ * manifest setup flow needs it up front to bake into the App manifest). Shared
7
+ * by the Platform's webhook-URL builder and the orchestrator's manifest
8
+ * pre-flight so the two never drift.
9
+ */
10
+ function githubWebhookPath(orgId) {
11
+ return `/webhook/${orgId}/github`;
12
+ }
13
+ //#endregion
14
+ export { githubWebhookPath };
15
+
16
+ //# sourceMappingURL=webhook-url-format.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kici-dev/engine",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
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",
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.20",
6
- "documentNamespace": "https://kici.dev/sbom/%40kici-dev%2Fengine/0.1.20/00caaa58-0c0e-4385-ac94-cdebc74f5d65",
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",
7
7
  "creationInfo": {
8
- "created": "2026-06-19T09:07:10Z",
8
+ "created": "2026-06-24T06:02:58Z",
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.20",
57
+ "versionInfo": "0.1.22",
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.20"
68
+ "referenceLocator": "pkg:npm/%40kici-dev/engine@0.1.22"
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.",