@kici-dev/engine 0.1.27 → 0.3.0

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 (148) hide show
  1. package/dist/approval/types.d.ts +8 -1
  2. package/dist/approval/types.js +8 -1
  3. package/dist/artifacts/name.d.ts +60 -0
  4. package/dist/artifacts/name.js +71 -0
  5. package/dist/audit/access-log-policy.d.ts +1 -1
  6. package/dist/audit/access-log-policy.js +8 -0
  7. package/dist/audit/activity.d.ts +12 -12
  8. package/dist/audit/retention-policy.js +16 -0
  9. package/dist/billing/plan-type.d.ts +53 -0
  10. package/dist/billing/plan-type.js +70 -0
  11. package/dist/bundler/rolldown-config.d.ts +3 -3
  12. package/dist/check-mode.d.ts +1 -1
  13. package/dist/context/concurrency-strategy.d.ts +34 -0
  14. package/dist/context/concurrency-strategy.js +35 -0
  15. package/dist/context/held-run-job-id.d.ts +45 -0
  16. package/dist/context/held-run-job-id.js +56 -0
  17. package/dist/context/held-run-status.d.ts +33 -0
  18. package/dist/context/held-run-status.js +37 -0
  19. package/dist/context/hold-expiry.d.ts +20 -0
  20. package/dist/context/hold-expiry.js +25 -0
  21. package/dist/context/hold-reason.d.ts +33 -0
  22. package/dist/context/hold-reason.js +23 -0
  23. package/dist/context/hold-type.d.ts +40 -0
  24. package/dist/context/hold-type.js +61 -0
  25. package/dist/context/index.d.ts +9 -1
  26. package/dist/context/index.js +9 -2
  27. package/dist/context/multi-context.d.ts +3 -3
  28. package/dist/context/scope-name.d.ts +29 -0
  29. package/dist/context/scope-name.js +49 -0
  30. package/dist/context/scope-resolver.d.ts +33 -0
  31. package/dist/context/scope-resolver.js +45 -15
  32. package/dist/context/types.d.ts +8 -5
  33. package/dist/dev-ops/operations.d.ts +8 -0
  34. package/dist/dev-ops/operations.js +36 -19
  35. package/dist/diagnostics/infra-alert.d.ts +71 -0
  36. package/dist/diagnostics/infra-alert.js +60 -0
  37. package/dist/env/environment-allowlist.d.ts +4 -4
  38. package/dist/fanout/materialize.d.ts +16 -0
  39. package/dist/fanout/materialize.js +32 -3
  40. package/dist/index.d.ts +15 -6
  41. package/dist/index.js +34 -19
  42. package/dist/inputs/descriptor.d.ts +9 -9
  43. package/dist/inventory.d.ts +4 -4
  44. package/dist/labels.d.ts +82 -2
  45. package/dist/labels.js +119 -1
  46. package/dist/matrix/expand.d.ts +49 -2
  47. package/dist/matrix/expand.js +102 -13
  48. package/dist/matrix/format.d.ts +6 -1
  49. package/dist/matrix/format.js +6 -1
  50. package/dist/mcp/held-run-resolve.d.ts +7 -10
  51. package/dist/mcp/held-run-resolve.js +33 -7
  52. package/dist/metrics/catalog-policy.js +4 -4
  53. package/dist/metrics/metric-catalog.generated.d.ts +959 -739
  54. package/dist/metrics/metric-catalog.generated.js +284 -20
  55. package/dist/metrics/metric-kind-compat.d.ts +26 -0
  56. package/dist/metrics/metric-kind-compat.js +33 -0
  57. package/dist/protocol/analytics-events.d.ts +6 -6
  58. package/dist/protocol/dashboard-api-errors.d.ts +1 -0
  59. package/dist/protocol/dashboard-api-errors.js +5 -1
  60. package/dist/protocol/dashboard-write-operations.d.ts +143 -86
  61. package/dist/protocol/dashboard-write-operations.js +91 -17
  62. package/dist/protocol/messages/access-log.d.ts +437 -392
  63. package/dist/protocol/messages/access-log.js +11 -2
  64. package/dist/protocol/messages/actor.d.ts +2 -2
  65. package/dist/protocol/messages/agent-dev-ops.d.ts +4 -2
  66. package/dist/protocol/messages/agent-dev-ops.js +2 -5
  67. package/dist/protocol/messages/agent-run-result.d.ts +72 -62
  68. package/dist/protocol/messages/auth.d.ts +35 -23
  69. package/dist/protocol/messages/browser.d.ts +81 -5
  70. package/dist/protocol/messages/browser.js +53 -2
  71. package/dist/protocol/messages/capabilities.d.ts +106 -31
  72. package/dist/protocol/messages/capabilities.js +94 -10
  73. package/dist/protocol/messages/common.d.ts +45 -2
  74. package/dist/protocol/messages/common.js +64 -3
  75. package/dist/protocol/messages/dashboard-sealed-write.d.ts +52 -0
  76. package/dist/protocol/messages/dashboard-sealed-write.js +57 -0
  77. package/dist/protocol/messages/dashboard.d.ts +1026 -498
  78. package/dist/protocol/messages/dashboard.js +208 -31
  79. package/dist/protocol/messages/deployment-identity.d.ts +37 -10
  80. package/dist/protocol/messages/deployment-identity.js +30 -3
  81. package/dist/protocol/messages/event-log.d.ts +5 -5
  82. package/dist/protocol/messages/execution-status.d.ts +189 -53
  83. package/dist/protocol/messages/execution-status.js +108 -40
  84. package/dist/protocol/messages/heartbeat-health.d.ts +83 -0
  85. package/dist/protocol/messages/heartbeat-health.js +87 -0
  86. package/dist/protocol/messages/log-stream.d.ts +18 -0
  87. package/dist/protocol/messages/log-stream.js +19 -0
  88. package/dist/protocol/messages/oidc-mint.d.ts +7 -0
  89. package/dist/protocol/messages/oidc-mint.js +7 -0
  90. package/dist/protocol/messages/orchestrator-agent.d.ts +264 -67
  91. package/dist/protocol/messages/orchestrator-agent.js +170 -5
  92. package/dist/protocol/messages/pat-kind.d.ts +1 -1
  93. package/dist/protocol/messages/peer.d.ts +122 -58
  94. package/dist/protocol/messages/peer.js +37 -2
  95. package/dist/protocol/messages/platform-orchestrator.d.ts +561 -217
  96. package/dist/protocol/messages/platform-orchestrator.js +131 -21
  97. package/dist/protocol/messages/run-events.d.ts +5 -5
  98. package/dist/protocol/messages/scaler-event.d.ts +3 -3
  99. package/dist/protocol/messages/source-registration.d.ts +56 -13
  100. package/dist/protocol/messages/source-registration.js +49 -6
  101. package/dist/protocol/source-origin.d.ts +1 -1
  102. package/dist/provenance/attestation-origin.d.ts +1 -1
  103. package/dist/provenance/schema.d.ts +11 -11
  104. package/dist/provenance/verify.js +2 -1
  105. package/dist/provider/changed-files-fetcher.d.ts +21 -2
  106. package/dist/provider/check-run-conclusion.d.ts +2 -2
  107. package/dist/provider/check-status-poster.d.ts +23 -0
  108. package/dist/provider/index.d.ts +2 -2
  109. package/dist/registration/registerable-trigger-type.d.ts +14 -13
  110. package/dist/registration/registerable-trigger-type.js +1 -0
  111. package/dist/sandbox/capabilities.d.ts +6 -0
  112. package/dist/sandbox/capabilities.js +57 -0
  113. package/dist/scaler/scaler-backend-type.d.ts +1 -1
  114. package/dist/status/presentation.d.ts +89 -0
  115. package/dist/status/presentation.js +163 -0
  116. package/dist/trigger/compiled-matchers.d.ts +13 -0
  117. package/dist/trigger/compiled-matchers.js +44 -0
  118. package/dist/trigger/event-buckets.d.ts +44 -0
  119. package/dist/trigger/event-buckets.js +93 -0
  120. package/dist/trigger/matcher.d.ts +7 -3
  121. package/dist/trigger/matcher.js +53 -15
  122. package/dist/trigger/schedule-key.d.ts +14 -0
  123. package/dist/trigger/schedule-key.js +21 -0
  124. package/dist/trigger/trigger-event-type.d.ts +1 -1
  125. package/dist/trigger/trigger-event-type.js +2 -0
  126. package/dist/trigger/types.d.ts +173 -43
  127. package/dist/trigger/types.js +82 -25
  128. package/dist/webhook/event-types.d.ts +56 -0
  129. package/dist/webhook/event-types.js +59 -0
  130. package/dist/ws/ws-like.d.ts +13 -0
  131. package/package.json +12 -4
  132. package/sbom.spdx.json +10 -10
  133. package/dist/environment/host-match.d.ts +0 -25
  134. package/dist/environment/index.d.ts +0 -6
  135. package/dist/environment/multi-env.d.ts +0 -30
  136. package/dist/environment/scope-resolver.d.ts +0 -46
  137. package/dist/environment/scope-template.d.ts +0 -18
  138. package/dist/environment/types.d.ts +0 -119
  139. package/dist/package-manager.d.ts +0 -20
  140. package/dist/protocol/messages/observe.d.ts +0 -76
  141. package/dist/protocol/messages/saas-orchestrator.d.ts +0 -2179
  142. package/dist/protocol/messages/test-run.d.ts +0 -59
  143. package/dist/state-machine/index.d.ts +0 -2
  144. package/dist/state-machine/index.js +0 -3
  145. package/dist/state-machine/machine.d.ts +0 -34
  146. package/dist/state-machine/machine.js +0 -103
  147. package/dist/state-machine/types.d.ts +0 -34
  148. package/dist/state-machine/types.js +0 -15
@@ -1,32 +1,54 @@
1
1
  import "../../rolldown-runtime-ClRpJifh.js";
2
- import { heartbeatSchema } from "./common.js";
2
+ import { heartbeatSchema, nackSchema } from "./common.js";
3
3
  import { executionStatusSchema, jobStatusForwardSchema, stateReplaySchema, stepStatusForwardSchema } from "./execution-status.js";
4
4
  import { jobContextMessageSchema, runEventMessageSchema } from "./run-events.js";
5
5
  import { sourceDeregisterAckSchema, sourceDeregisterSchema, sourceRegistrationAckSchema, sourceRegistrationSchema } from "./source-registration.js";
6
6
  import { dashboardPlatformToOrchSchema } from "./dashboard.js";
7
- import { orchCapabilitiesSchema } from "./capabilities.js";
7
+ import { OrchRole, orchCapabilitiesSchema, platformCapabilitiesSchema } from "./capabilities.js";
8
8
  import { authFailureSchema, authRequestSchema, authSuccessSchema } from "./auth.js";
9
+ import { LogStream } from "./log-stream.js";
9
10
  import { oidcMintRequestSchema, oidcMintResponseSchema } from "./oidc-mint.js";
10
11
  import { z } from "zod";
11
12
  //#region src/protocol/messages/platform-orchestrator.ts
13
+ /**
14
+ * Org trust policy — Platform-owned tenant policy pushed to the orchestrator.
15
+ * The orchestrator caches and enforces it; it never owns it. Named separately
16
+ * from the enclosing message so the orchestrator's evaluator and cache can type
17
+ * against the policy alone.
18
+ */
19
+ /**
20
+ * Documented default hours a security hold stays open.
21
+ *
22
+ * The single owner of the value: the fail-closed policy, the orchestrator's
23
+ * stored-policy default, and the hold-sizing fallback all read it, so the
24
+ * number cannot drift between the two packages that enforce it.
25
+ */
26
+ const DEFAULT_APPROVAL_EXPIRY_HOURS = 72;
27
+ const trustPolicySchema = z.object({
28
+ forkPolicy: z.enum([
29
+ "hold",
30
+ "reject",
31
+ "allow"
32
+ ]),
33
+ unknownContributorPolicy: z.enum(["hold", "reject"]),
34
+ workflowChangePolicy: z.enum([
35
+ "hold",
36
+ "reject",
37
+ "allow"
38
+ ]),
39
+ /**
40
+ * Hours a security hold stays open. Integer and positive: the column is
41
+ * INTEGER NOT NULL, so a fractional value throws inside the fire-and-forget
42
+ * persist and the policy is then silently never stored, and a zero or
43
+ * negative value mints an already-expired hold.
44
+ */
45
+ approvalExpiryHours: z.number().int().min(1)
46
+ });
12
47
  /** Trust policy update pushed from Platform to orchestrator when policy or identity links change. */
13
48
  const trustPolicyUpdateSchema = z.object({
14
49
  type: z.literal("trust_policy.update"),
15
50
  orgId: z.string(),
16
- policy: z.object({
17
- forkPolicy: z.enum([
18
- "hold",
19
- "reject",
20
- "allow"
21
- ]),
22
- unknownContributorPolicy: z.enum(["hold", "reject"]),
23
- workflowChangePolicy: z.enum([
24
- "hold",
25
- "reject",
26
- "allow"
27
- ]),
28
- approvalExpiryHours: z.number()
29
- }),
51
+ policy: trustPolicySchema,
30
52
  identityLinks: z.array(z.object({
31
53
  userId: z.string(),
32
54
  provider: z.string(),
@@ -101,12 +123,18 @@ const webhookRelaySchema = z.object({
101
123
  * is malformed (e.g. invalid JSON in generic_webhook_sources.verification_config) or
102
124
  * the chunked stream itself was malformed (out-of-order, oversize, base64 decode fail,
103
125
  * missing chunks at finalization, TTL expiry). Maps to HTTP 500.
126
+ * - `shed_retry_later`: the orchestrator's ingest admission controller is
127
+ * saturated and shed this delivery (event-loop overload or per-org/global
128
+ * cap). Maps to HTTP 429 + Retry-After — a terminal, RETRYABLE result: the
129
+ * caller redelivers, the delivery is not lost, and Platform does NOT fail
130
+ * over to a pool peer (peers share the same overloaded orchestrator DB).
104
131
  */
105
132
  const WebhookRelayResult = z.enum([
106
133
  "accepted",
107
134
  "rejected_signature",
108
135
  "rejected_unknown_source",
109
- "rejected_misconfigured"
136
+ "rejected_misconfigured",
137
+ "shed_retry_later"
110
138
  ]);
111
139
  /**
112
140
  * Maximum total body size accepted by the chunked webhook relay protocol.
@@ -193,7 +221,7 @@ const peerUpdateSchema = z.object({
193
221
  instanceId: z.string().optional(),
194
222
  address: z.string().nullable(),
195
223
  routingKeys: z.array(z.string()),
196
- orchRole: z.enum(["coordinator", "worker"]).optional()
224
+ orchRole: OrchRole.optional()
197
225
  }))
198
226
  });
199
227
  /**
@@ -215,6 +243,19 @@ const staleCheckrunCleanupSchema = z.object({
215
243
  }))
216
244
  });
217
245
  /**
246
+ * Platform capability advertisement, sent once by the Platform after the
247
+ * orchestrator authenticates. The orchestrator caches it per connection and
248
+ * pre-flight-checks its own feature-gated sends against it, so a self-hosted
249
+ * orchestrator running ahead of the hosted Platform surfaces a diagnosable
250
+ * capability gap instead of firing a frame the Platform would silently drop.
251
+ * Payload is `platformCapabilitiesSchema` (`.passthrough()`, absent =
252
+ * unsupported).
253
+ */
254
+ const platformCapabilitiesMessageSchema = z.object({
255
+ type: z.literal("platform.capabilities"),
256
+ capabilities: platformCapabilitiesSchema
257
+ });
258
+ /**
218
259
  * Periodic OTel metrics push from orchestrator to Platform for centralized observability.
219
260
  *
220
261
  * Schema bounds are the first line of defence against pollution of the
@@ -296,7 +337,46 @@ const logChunkSchema = z.object({
296
337
  jobId: z.string(),
297
338
  stepIndex: z.number(),
298
339
  lines: z.array(z.string()),
299
- timestamp: z.number()
340
+ timestamp: z.number(),
341
+ /**
342
+ * Which stream these lines came from. Optional for backward compatibility
343
+ * with orchestrators that do not send it; absent is read as `stdout`.
344
+ */
345
+ stream: LogStream.optional()
346
+ });
347
+ /**
348
+ * Phase of an orchestration/provisioning log line. Mirrors the phases the
349
+ * orchestrator writes into its per-job orchestration/provisioning JSONL files
350
+ * and that the dashboard splits the run-detail orch-log viewer by. `unknown`
351
+ * is the fallback for a line whose stored phase is missing/unrecognized.
352
+ */
353
+ const OrchLogPhase = z.enum([
354
+ "dispatch",
355
+ "setup",
356
+ "provisioning",
357
+ "teardown",
358
+ "unknown"
359
+ ]);
360
+ /**
361
+ * Live orchestration/provisioning log line(s) pushed orchestrator -> Platform.
362
+ *
363
+ * Emitted at the orchestrator's `writeOrchLog` / provisioning-write tap points
364
+ * (in addition to persisting to LogStorage, which stays the authoritative
365
+ * backfill source). Platform fans this out to browser subscribers keyed by
366
+ * `(runId, jobId)` as an `orch-log.lines` message. `lines` carries the raw
367
+ * message strings for this phase; `ts` is the write timestamp (ms).
368
+ *
369
+ * Best-effort: a push failure never breaks dispatch (fire-and-forget at the
370
+ * write site). Not correlated/acked, so — unlike step `log.chunk` — it is not
371
+ * fast-pathed and carries no `messageId`.
372
+ */
373
+ const orchLogChunkSchema = z.object({
374
+ type: z.literal("orch-log.chunk"),
375
+ runId: z.string(),
376
+ jobId: z.string(),
377
+ phase: OrchLogPhase,
378
+ lines: z.array(z.string()),
379
+ ts: z.number()
300
380
  });
301
381
  /** Cache lookup statistics forwarded from orchestrator to Platform for centralized metrics. */
302
382
  const cacheStatsSchema = z.object({
@@ -340,6 +420,8 @@ const platformToOrchestratorMessageSchema = z.discriminatedUnion("type", [
340
420
  peerUpdateSchema,
341
421
  staleCheckrunCleanupSchema,
342
422
  oidcMintResponseSchema,
423
+ platformCapabilitiesMessageSchema,
424
+ nackSchema,
343
425
  ...dashboardPlatformToOrchSchema.options
344
426
  ]);
345
427
  /** All messages that flow from Orchestrator to Platform.
@@ -353,6 +435,7 @@ const orchestratorToPlatformMessageSchema = z.discriminatedUnion("type", [
353
435
  webhookAckSchema,
354
436
  executionEventSchema,
355
437
  logChunkSchema,
438
+ orchLogChunkSchema,
356
439
  executionStatusSchema,
357
440
  stepStatusForwardSchema,
358
441
  jobStatusForwardSchema,
@@ -366,9 +449,36 @@ const orchestratorToPlatformMessageSchema = z.discriminatedUnion("type", [
366
449
  runEventMessageSchema,
367
450
  jobContextMessageSchema,
368
451
  orchMetricsSchema,
369
- oidcMintRequestSchema
452
+ oidcMintRequestSchema,
453
+ nackSchema
370
454
  ]);
455
+ /**
456
+ * Extract the discriminator `type` values a schema recognizes: every option of a
457
+ * discriminated union, or the single `type` literal of an object schema. Reuses
458
+ * the `schema.options.map((o) => o.shape.type.value)` idiom already used for
459
+ * `DASHBOARD_REQUEST_TYPES`, so a recognized-type set derived through this helper
460
+ * can never drift from the schema it is built from.
461
+ */
462
+ function collectDiscriminatorTypes(schema) {
463
+ if ("options" in schema) return schema.options.map((option) => option.shape.type.value);
464
+ return [schema.shape.type.value];
465
+ }
466
+ /**
467
+ * Every message `type` the orchestrator→Platform mainline union recognizes.
468
+ * The Platform WS handler unions this with its extra recognition-chain schemas
469
+ * (log-pull, dashboard responses, cluster join) to decide whether a frame that
470
+ * failed validation is a known-but-invalid type (close the connection) or a
471
+ * genuinely-unknown one (version-skew NACK + keep alive).
472
+ */
473
+ const ORCH_TO_PLATFORM_RECOGNIZED_TYPES = new Set(collectDiscriminatorTypes(orchestratorToPlatformMessageSchema));
474
+ /**
475
+ * Every message `type` the Platform→orchestrator mainline union recognizes
476
+ * (dashboard request types included — they are members of this union). The
477
+ * orchestrator's platform client unions this with its extra recognition-chain
478
+ * schemas to make the same known-but-invalid vs unknown decision.
479
+ */
480
+ const PLATFORM_TO_ORCH_RECOGNIZED_TYPES = new Set(collectDiscriminatorTypes(platformToOrchestratorMessageSchema));
371
481
  //#endregion
372
- export { WEBHOOK_RELAY_CHUNK_SIZE, WEBHOOK_RELAY_MAX_BODY_BYTES, WebhookRelayResult, cacheStatsSchema, executionEventSchema, logChunkSchema, orchCapabilitiesUpdateSchema, orchMetricsSchema, orchestratorToPlatformMessageSchema, peerDiscoverSchema, peerUpdateSchema, platformToOrchestratorMessageSchema, staleCheckrunCleanupSchema, trustPolicyUpdateSchema, webhookAckSchema, webhookRelayChunkSchema, webhookRelaySchema, webhookRelayStartSchema };
482
+ export { DEFAULT_APPROVAL_EXPIRY_HOURS, ORCH_TO_PLATFORM_RECOGNIZED_TYPES, OrchLogPhase, PLATFORM_TO_ORCH_RECOGNIZED_TYPES, WEBHOOK_RELAY_CHUNK_SIZE, WEBHOOK_RELAY_MAX_BODY_BYTES, WebhookRelayResult, cacheStatsSchema, collectDiscriminatorTypes, executionEventSchema, logChunkSchema, orchCapabilitiesUpdateSchema, orchLogChunkSchema, orchMetricsSchema, orchestratorToPlatformMessageSchema, peerDiscoverSchema, peerUpdateSchema, platformCapabilitiesMessageSchema, platformToOrchestratorMessageSchema, staleCheckrunCleanupSchema, trustPolicySchema, trustPolicyUpdateSchema, webhookAckSchema, webhookRelayChunkSchema, webhookRelaySchema, webhookRelayStartSchema };
373
483
 
374
484
  //# sourceMappingURL=platform-orchestrator.js.map
@@ -15,8 +15,8 @@ export declare const runEventMessageSchema: z.ZodObject<{
15
15
  timestampMs: z.ZodNumber;
16
16
  sourceService: z.ZodEnum<{
17
17
  agent: "agent";
18
- platform: "platform";
19
18
  orchestrator: "orchestrator";
19
+ platform: "platform";
20
20
  }>;
21
21
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
22
22
  traceId: z.ZodOptional<z.ZodString>;
@@ -41,10 +41,10 @@ export declare const jobContextMessageSchema: z.ZodObject<{
41
41
  name: z.ZodString;
42
42
  value: z.ZodString;
43
43
  category: z.ZodEnum<{
44
- user: "user";
45
- system: "system";
46
44
  inherited: "inherited";
47
45
  secret: "secret";
46
+ system: "system";
47
+ user: "user";
48
48
  }>;
49
49
  }, z.core.$strip>>>;
50
50
  runtime: z.ZodOptional<z.ZodObject<{
@@ -93,10 +93,10 @@ export declare const browserJobContextSchema: z.ZodObject<{
93
93
  name: z.ZodString;
94
94
  value: z.ZodString;
95
95
  category: z.ZodEnum<{
96
- user: "user";
97
- system: "system";
98
96
  inherited: "inherited";
99
97
  secret: "secret";
98
+ system: "system";
99
+ user: "user";
100
100
  }>;
101
101
  }, z.core.$strip>>>;
102
102
  runtime: z.ZodOptional<z.ZodObject<{
@@ -9,11 +9,11 @@ import { z } from 'zod';
9
9
  * notation: `ScalerEventType.enum['scaler.failed']`.
10
10
  */
11
11
  export declare const ScalerEventType: z.ZodEnum<{
12
- "scaler.provisioning": "scaler.provisioning";
12
+ "agent.connecting": "agent.connecting";
13
+ "scaler.failed": "scaler.failed";
13
14
  "scaler.network": "scaler.network";
15
+ "scaler.provisioning": "scaler.provisioning";
14
16
  "scaler.ready": "scaler.ready";
15
- "scaler.failed": "scaler.failed";
16
- "agent.connecting": "agent.connecting";
17
17
  }>;
18
18
  export type ScalerEventType = z.infer<typeof ScalerEventType>;
19
19
  //# sourceMappingURL=scaler-event.d.ts.map
@@ -18,12 +18,52 @@ import { z } from 'zod';
18
18
  * cloned via `file://`).
19
19
  */
20
20
  export declare const SourceSubtype: z.ZodEnum<{
21
- github_app: "github_app";
22
21
  generic_webhook: "generic_webhook";
23
- universal_git: "universal_git";
22
+ github_app: "github_app";
24
23
  local: "local";
24
+ universal_git: "universal_git";
25
25
  }>;
26
26
  export type SourceSubtype = z.infer<typeof SourceSubtype>;
27
+ /**
28
+ * Operating mode of a customer-deployed orchestrator. The single source of
29
+ * truth for the `KICI_MODE` vocabulary — the orchestrator config schema, the
30
+ * `source.register` protocol message, and the Platform's relay-eligibility
31
+ * filter all read it from here.
32
+ *
33
+ * - `platform` — the hosted Platform relays every webhook; no local ingress.
34
+ * - `hybrid` — Platform relay **plus** the orchestrator's own direct
35
+ * (GitHub / generic) ingress; full hosted observability.
36
+ * - `observed` — the orchestrator ingests only its OWN webhooks (nothing
37
+ * transits the Platform) but keeps its Platform WebSocket for
38
+ * hosted observability. The Platform never relays to it and
39
+ * records its sources as observe-only.
40
+ * - `independent` — own ingress only, no Platform connection at all.
41
+ */
42
+ export declare const OrchestratorMode: z.ZodEnum<{
43
+ hybrid: "hybrid";
44
+ independent: "independent";
45
+ observed: "observed";
46
+ platform: "platform";
47
+ }>;
48
+ export type OrchestratorMode = z.infer<typeof OrchestratorMode>;
49
+ /**
50
+ * Modes in which the orchestrator holds a Platform WebSocket connection (and so
51
+ * requires `KICI_PLATFORM_URL` + `KICI_PLATFORM_TOKEN`). `observed` connects for
52
+ * observability + observe-only source registration; `independent` never does.
53
+ */
54
+ export declare const PLATFORM_CONNECTED_MODES: readonly OrchestratorMode[];
55
+ /**
56
+ * Modes in which the orchestrator accepts Platform-relayed webhooks. `observed`
57
+ * is deliberately absent: it ingests only its own webhooks, and both sides
58
+ * enforce that (the orchestrator refuses any relay it receives, and the Platform
59
+ * excludes observed connections from every relay-candidate lookup).
60
+ */
61
+ export declare const RELAY_INGRESS_MODES: readonly OrchestratorMode[];
62
+ /**
63
+ * Modes in which the orchestrator serves its OWN webhook ingress (the direct
64
+ * GitHub route plus generic webhook sources).
65
+ */
66
+ export declare const OWN_INGRESS_MODES: readonly OrchestratorMode[];
27
67
  /**
28
68
  * Source provider family used by Platform's webhook router. Coarser-grained
29
69
  * than `SourceSubtype` — every universal-git / generic_webhook / local row
@@ -31,10 +71,10 @@ export type SourceSubtype = z.infer<typeof SourceSubtype>;
31
71
  * generic webhook ingress.
32
72
  */
33
73
  export declare const SourceProvider: z.ZodEnum<{
34
- github: "github";
35
- gitlab: "gitlab";
36
74
  bitbucket: "bitbucket";
37
75
  generic: "generic";
76
+ github: "github";
77
+ gitlab: "gitlab";
38
78
  }>;
39
79
  export type SourceProvider = z.infer<typeof SourceProvider>;
40
80
  /** Source registration sent by orchestrator to Platform after auth.success. */
@@ -43,18 +83,18 @@ export declare const sourceRegistrationSchema: z.ZodObject<{
43
83
  messageId: z.ZodString;
44
84
  sources: z.ZodArray<z.ZodObject<{
45
85
  provider: z.ZodEnum<{
46
- github: "github";
47
- gitlab: "gitlab";
48
86
  bitbucket: "bitbucket";
49
87
  generic: "generic";
88
+ github: "github";
89
+ gitlab: "gitlab";
50
90
  }>;
51
91
  routingKey: z.ZodString;
52
92
  name: z.ZodString;
53
93
  subtype: z.ZodEnum<{
54
- github_app: "github_app";
55
94
  generic_webhook: "generic_webhook";
56
- universal_git: "universal_git";
95
+ github_app: "github_app";
57
96
  local: "local";
97
+ universal_git: "universal_git";
58
98
  }>;
59
99
  slug: z.ZodOptional<z.ZodString>;
60
100
  }, z.core.$strip>>;
@@ -64,24 +104,27 @@ export declare const sourceRegistrationSchema: z.ZodObject<{
64
104
  address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
65
105
  version: z.ZodOptional<z.ZodString>;
66
106
  mode: z.ZodOptional<z.ZodEnum<{
67
- platform: "platform";
68
107
  hybrid: "hybrid";
69
108
  independent: "independent";
109
+ observed: "observed";
110
+ platform: "platform";
70
111
  }>>;
71
112
  scalerBackends: z.ZodOptional<z.ZodArray<z.ZodString>>;
72
113
  deployment: z.ZodOptional<z.ZodObject<{
73
114
  mode: z.ZodEnum<{
74
- unknown: "unknown";
75
- systemd: "systemd";
115
+ compose: "compose";
76
116
  launchd: "launchd";
117
+ systemd: "systemd";
118
+ unknown: "unknown";
77
119
  windows: "windows";
78
- compose: "compose";
79
120
  }>;
80
121
  containerName: z.ZodOptional<z.ZodString>;
81
122
  containerRuntime: z.ZodOptional<z.ZodEnum<{
82
- podman: "podman";
83
123
  docker: "docker";
124
+ podman: "podman";
84
125
  }>>;
126
+ adminInvocation: z.ZodOptional<z.ZodString>;
127
+ adminPath: z.ZodOptional<z.ZodString>;
85
128
  }, z.core.$strip>>;
86
129
  s3LogAccess: z.ZodOptional<z.ZodBoolean>;
87
130
  queueTimeoutMs: z.ZodOptional<z.ZodNumber>;
@@ -27,6 +27,53 @@ const SourceSubtype = z.enum([
27
27
  "local"
28
28
  ]);
29
29
  /**
30
+ * Operating mode of a customer-deployed orchestrator. The single source of
31
+ * truth for the `KICI_MODE` vocabulary — the orchestrator config schema, the
32
+ * `source.register` protocol message, and the Platform's relay-eligibility
33
+ * filter all read it from here.
34
+ *
35
+ * - `platform` — the hosted Platform relays every webhook; no local ingress.
36
+ * - `hybrid` — Platform relay **plus** the orchestrator's own direct
37
+ * (GitHub / generic) ingress; full hosted observability.
38
+ * - `observed` — the orchestrator ingests only its OWN webhooks (nothing
39
+ * transits the Platform) but keeps its Platform WebSocket for
40
+ * hosted observability. The Platform never relays to it and
41
+ * records its sources as observe-only.
42
+ * - `independent` — own ingress only, no Platform connection at all.
43
+ */
44
+ const OrchestratorMode = z.enum([
45
+ "platform",
46
+ "hybrid",
47
+ "independent",
48
+ "observed"
49
+ ]);
50
+ /**
51
+ * Modes in which the orchestrator holds a Platform WebSocket connection (and so
52
+ * requires `KICI_PLATFORM_URL` + `KICI_PLATFORM_TOKEN`). `observed` connects for
53
+ * observability + observe-only source registration; `independent` never does.
54
+ */
55
+ const PLATFORM_CONNECTED_MODES = [
56
+ OrchestratorMode.enum.platform,
57
+ OrchestratorMode.enum.hybrid,
58
+ OrchestratorMode.enum.observed
59
+ ];
60
+ /**
61
+ * Modes in which the orchestrator accepts Platform-relayed webhooks. `observed`
62
+ * is deliberately absent: it ingests only its own webhooks, and both sides
63
+ * enforce that (the orchestrator refuses any relay it receives, and the Platform
64
+ * excludes observed connections from every relay-candidate lookup).
65
+ */
66
+ const RELAY_INGRESS_MODES = [OrchestratorMode.enum.platform, OrchestratorMode.enum.hybrid];
67
+ /**
68
+ * Modes in which the orchestrator serves its OWN webhook ingress (the direct
69
+ * GitHub route plus generic webhook sources).
70
+ */
71
+ const OWN_INGRESS_MODES = [
72
+ OrchestratorMode.enum.hybrid,
73
+ OrchestratorMode.enum.independent,
74
+ OrchestratorMode.enum.observed
75
+ ];
76
+ /**
30
77
  * Source provider family used by Platform's webhook router. Coarser-grained
31
78
  * than `SourceSubtype` — every universal-git / generic_webhook / local row
32
79
  * collapses to `'generic'` here because Platform routes them through the same
@@ -93,11 +140,7 @@ const sourceRegistrationSchema = z.object({
93
140
  /** Orchestrator version (e.g. "0.0.1"). Optional for backward compatibility with older orchestrators. */
94
141
  version: z.string().optional(),
95
142
  /** Orchestrator config mode. Optional for backward compatibility. */
96
- mode: z.enum([
97
- "platform",
98
- "hybrid",
99
- "independent"
100
- ]).optional(),
143
+ mode: OrchestratorMode.optional(),
101
144
  /** Scaler backends configured on this orchestrator (e.g. ["container", "firecracker"]). */
102
145
  scalerBackends: z.array(z.string()).optional(),
103
146
  /**
@@ -154,6 +197,6 @@ const sourceDeregisterAckSchema = z.object({
154
197
  removed: z.array(z.string())
155
198
  });
156
199
  //#endregion
157
- export { SourceProvider, SourceSubtype, acceptedSourceSchema, sourceDeregisterAckSchema, sourceDeregisterSchema, sourceRegistrationAckSchema, sourceRegistrationSchema };
200
+ export { OWN_INGRESS_MODES, OrchestratorMode, PLATFORM_CONNECTED_MODES, RELAY_INGRESS_MODES, SourceProvider, SourceSubtype, acceptedSourceSchema, sourceDeregisterAckSchema, sourceDeregisterSchema, sourceRegistrationAckSchema, sourceRegistrationSchema };
158
201
 
159
202
  //# sourceMappingURL=source-registration.js.map
@@ -13,8 +13,8 @@ import { z } from 'zod';
13
13
  * infrastructure.
14
14
  */
15
15
  export declare const SourceOrigin: z.ZodEnum<{
16
- triggered: "triggered";
17
16
  "run-remote": "run-remote";
17
+ triggered: "triggered";
18
18
  }>;
19
19
  export type SourceOrigin = z.infer<typeof SourceOrigin>;
20
20
  //# sourceMappingURL=source-origin.d.ts.map
@@ -10,8 +10,8 @@ import { z } from 'zod';
10
10
  * is disclosed, never hidden.
11
11
  */
12
12
  export declare const AttestationOrigin: z.ZodEnum<{
13
- live: "live";
14
13
  deferred: "deferred";
14
+ live: "live";
15
15
  "offline-backfill": "offline-backfill";
16
16
  }>;
17
17
  export type AttestationOrigin = z.infer<typeof AttestationOrigin>;
@@ -28,11 +28,11 @@ export declare const KICI_WORKFLOW_BUILD_TYPE = "https://kici.dev/buildtypes/wor
28
28
  * documents the common set so producer code and tests don't repeat literals.
29
29
  */
30
30
  export declare const DigestAlgorithm: z.ZodEnum<{
31
+ dirHash: "dirHash";
32
+ gitCommit: "gitCommit";
33
+ sha1: "sha1";
31
34
  sha256: "sha256";
32
35
  sha512: "sha512";
33
- sha1: "sha1";
34
- gitCommit: "gitCommit";
35
- dirHash: "dirHash";
36
36
  }>;
37
37
  export type DigestAlgorithm = z.infer<typeof DigestAlgorithm>;
38
38
  /**
@@ -214,12 +214,12 @@ export declare const kiciWorkflowInternalParametersSchema: z.ZodObject<{
214
214
  jobId: z.ZodOptional<z.ZodString>;
215
215
  orgId: z.ZodOptional<z.ZodString>;
216
216
  sourceOrigin: z.ZodOptional<z.ZodEnum<{
217
- triggered: "triggered";
218
217
  "run-remote": "run-remote";
218
+ triggered: "triggered";
219
219
  }>>;
220
220
  attestationOrigin: z.ZodOptional<z.ZodEnum<{
221
- live: "live";
222
221
  deferred: "deferred";
222
+ live: "live";
223
223
  "offline-backfill": "offline-backfill";
224
224
  }>>;
225
225
  statementHash: z.ZodOptional<z.ZodString>;
@@ -251,12 +251,12 @@ export declare const kiciBuildDefinitionSchema: z.ZodObject<{
251
251
  jobId: z.ZodOptional<z.ZodString>;
252
252
  orgId: z.ZodOptional<z.ZodString>;
253
253
  sourceOrigin: z.ZodOptional<z.ZodEnum<{
254
- triggered: "triggered";
255
254
  "run-remote": "run-remote";
255
+ triggered: "triggered";
256
256
  }>>;
257
257
  attestationOrigin: z.ZodOptional<z.ZodEnum<{
258
- live: "live";
259
258
  deferred: "deferred";
259
+ live: "live";
260
260
  "offline-backfill": "offline-backfill";
261
261
  }>>;
262
262
  statementHash: z.ZodOptional<z.ZodString>;
@@ -324,12 +324,12 @@ export declare const kiciProvenancePredicateSchema: z.ZodObject<{
324
324
  jobId: z.ZodOptional<z.ZodString>;
325
325
  orgId: z.ZodOptional<z.ZodString>;
326
326
  sourceOrigin: z.ZodOptional<z.ZodEnum<{
327
- triggered: "triggered";
328
327
  "run-remote": "run-remote";
328
+ triggered: "triggered";
329
329
  }>>;
330
330
  attestationOrigin: z.ZodOptional<z.ZodEnum<{
331
- live: "live";
332
331
  deferred: "deferred";
332
+ live: "live";
333
333
  "offline-backfill": "offline-backfill";
334
334
  }>>;
335
335
  statementHash: z.ZodOptional<z.ZodString>;
@@ -406,12 +406,12 @@ export declare const kiciProvenanceStatementSchema: z.ZodObject<{
406
406
  jobId: z.ZodOptional<z.ZodString>;
407
407
  orgId: z.ZodOptional<z.ZodString>;
408
408
  sourceOrigin: z.ZodOptional<z.ZodEnum<{
409
- triggered: "triggered";
410
409
  "run-remote": "run-remote";
410
+ triggered: "triggered";
411
411
  }>>;
412
412
  attestationOrigin: z.ZodOptional<z.ZodEnum<{
413
- live: "live";
414
413
  deferred: "deferred";
414
+ live: "live";
415
415
  "offline-backfill": "offline-backfill";
416
416
  }>>;
417
417
  statementHash: z.ZodOptional<z.ZodString>;
@@ -82,7 +82,8 @@ async function verifyKiciBundle(opts) {
82
82
  try {
83
83
  const { payload } = await jwtVerify(bundle.verificationMaterial.identityToken, createLocalJWKSet(opts.jwks), {
84
84
  issuer: opts.expectedIssuer,
85
- audience: opts.expectedAudience
85
+ audience: opts.expectedAudience,
86
+ algorithms: ["ES256"]
86
87
  });
87
88
  claims = payload;
88
89
  checks.jwt = "pass";
@@ -5,6 +5,25 @@
5
5
  * Used by the orchestrator for path-based trigger filtering.
6
6
  */
7
7
  import type { ProviderType } from './types.js';
8
+ import type { ChangedFilesStatus } from '../trigger/types.js';
9
+ /**
10
+ * Result of a changed-files fetch.
11
+ *
12
+ * `status` distinguishes an authoritative diff from a capability gap so path
13
+ * filters never infer a no-match from an empty list:
14
+ * - `fetched` — the list is authoritative; an empty `files` genuinely means
15
+ * "no files changed" and does NOT match a path filter.
16
+ * - `unavailable` — the diff could not be determined (e.g. a universal-git PR
17
+ * event with no per-commit diff in the webhook body). Path filters match
18
+ * conservatively so a real change is never silently dropped.
19
+ *
20
+ * `skipped` is intentionally NOT a fetcher outcome — it is set by the pipeline
21
+ * when no trigger has path patterns and the fetch never runs.
22
+ */
23
+ export interface ChangedFilesResult {
24
+ files: string[];
25
+ status: Extract<ChangedFilesStatus, 'fetched' | 'unavailable'>;
26
+ }
8
27
  export interface ChangedFilesFetcher {
9
28
  readonly provider: ProviderType;
10
29
  /**
@@ -17,8 +36,8 @@ export interface ChangedFilesFetcher {
17
36
  * @param eventType - Normalized event type ("pull_request" or "push")
18
37
  * @param payload - Raw webhook payload (provider-specific)
19
38
  * @param credentials - Provider-specific auth credentials
20
- * @returns Array of changed file paths (relative to repo root)
39
+ * @returns The changed file paths (relative to repo root) plus an availability status.
21
40
  */
22
- getChangedFiles(repoIdentifier: string, eventType: string, payload: unknown, credentials: unknown): Promise<string[]>;
41
+ getChangedFiles(repoIdentifier: string, eventType: string, payload: unknown, credentials: unknown): Promise<ChangedFilesResult>;
23
42
  }
24
43
  //# sourceMappingURL=changed-files-fetcher.d.ts.map
@@ -6,10 +6,10 @@ import { z } from 'zod';
6
6
  * Access values: CheckRunConclusion.enum.success, CheckRunConclusion.enum.failure, etc.
7
7
  */
8
8
  export declare const CheckRunConclusion: z.ZodEnum<{
9
- success: "success";
10
9
  cancelled: "cancelled";
11
- timed_out: "timed_out";
12
10
  failure: "failure";
11
+ success: "success";
12
+ timed_out: "timed_out";
13
13
  }>;
14
14
  export type CheckRunConclusion = z.infer<typeof CheckRunConclusion>;
15
15
  //# sourceMappingURL=check-run-conclusion.d.ts.map
@@ -7,9 +7,32 @@
7
7
  import type { ProviderType } from './types.js';
8
8
  /** Status values for a check run. */
9
9
  export type CheckStatus = 'pending' | 'success' | 'failure' | 'neutral';
10
+ /** A single workflow-file change detected between base and head lock files. */
11
+ export interface WorkflowModificationInfo {
12
+ changeType: string;
13
+ workflowName: string;
14
+ }
10
15
  /** Posts check statuses to a git hosting provider. */
11
16
  export interface CheckStatusPoster {
12
17
  readonly provider: ProviderType;
13
18
  postCheckStatus(repoIdentifier: string, commitSha: string, status: CheckStatus, title: string, summary: string, credentials: unknown): Promise<void>;
19
+ /**
20
+ * Post an informational (neutral) check listing workflow-file modifications
21
+ * detected in a PR. Uses a distinct check name from the security-hold check so
22
+ * the two never overwrite each other.
23
+ */
24
+ postWorkflowModificationCheck(repoIdentifier: string, commitSha: string, modifications: WorkflowModificationInfo[], credentials: unknown): Promise<void>;
25
+ /**
26
+ * Post an informational (neutral) check recording that the organization's
27
+ * global workflows were skipped because the org trust policy held or rejected
28
+ * the event.
29
+ *
30
+ * Its own check name, for the same reason as the workflow-modification check:
31
+ * the security-hold check is a single named run per commit, so posting this
32
+ * notice through `postCheckStatus` would UPDATE that run and replace the
33
+ * pending "Held for approval" state with a completed neutral conclusion —
34
+ * unblocking a branch protection rule that requires the security check.
35
+ */
36
+ postGlobalWorkflowsSkippedCheck(repoIdentifier: string, commitSha: string, summary: string, credentials: unknown): Promise<void>;
14
37
  }
15
38
  //# sourceMappingURL=check-status-poster.d.ts.map