@kici-dev/engine 0.1.23 → 0.1.25

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 (146) 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.d.ts +4 -1
  4. package/dist/audit/access-log-policy.js +11 -2
  5. package/dist/audit/activity.d.ts +4 -2
  6. package/dist/audit/activity.js +15 -1
  7. package/dist/audit/retention-policy.js +5 -3
  8. package/dist/bundler/index.js +1 -1
  9. package/dist/bundler/rolldown-config.js +1 -1
  10. package/dist/check-mode.js +1 -1
  11. package/dist/dev-ops/operations.d.ts +56 -0
  12. package/dist/dev-ops/operations.js +135 -0
  13. package/dist/env/environment-allowlist.js +1 -1
  14. package/dist/environment/host-match.js +1 -1
  15. package/dist/environment/index.d.ts +2 -0
  16. package/dist/environment/index.js +4 -2
  17. package/dist/environment/multi-env.d.ts +30 -0
  18. package/dist/environment/multi-env.js +38 -0
  19. package/dist/environment/scope-resolver.js +1 -1
  20. package/dist/environment/scope-template.js +1 -1
  21. package/dist/environment/types.d.ts +8 -2
  22. package/dist/environment/types.js +19 -2
  23. package/dist/fanout/materialize.js +3 -3
  24. package/dist/index.d.ts +10 -1
  25. package/dist/index.js +25 -13
  26. package/dist/inputs/build.js +1 -1
  27. package/dist/inputs/coerce.js +1 -1
  28. package/dist/inputs/descriptor.js +1 -1
  29. package/dist/inputs/extract.js +1 -1
  30. package/dist/inputs/index.d.ts +1 -0
  31. package/dist/inputs/index.js +3 -2
  32. package/dist/inputs/schedule.d.ts +19 -0
  33. package/dist/inputs/schedule.js +33 -0
  34. package/dist/inventory.js +1 -1
  35. package/dist/labels/compile.js +1 -1
  36. package/dist/labels-match.js +1 -1
  37. package/dist/labels.js +2 -2
  38. package/dist/matrix/expand.js +1 -1
  39. package/dist/matrix/format.js +1 -1
  40. package/dist/mcp/fence.d.ts +22 -0
  41. package/dist/mcp/fence.js +65 -0
  42. package/dist/mcp/held-run-resolve.d.ts +52 -0
  43. package/dist/mcp/held-run-resolve.js +53 -0
  44. package/dist/mcp/tool-schemas.d.ts +74 -0
  45. package/dist/mcp/tool-schemas.js +78 -0
  46. package/dist/metrics/catalog-policy.js +1 -1
  47. package/dist/metrics/metric-catalog.generated.d.ts +105 -0
  48. package/dist/metrics/metric-catalog.generated.js +127 -1
  49. package/dist/protocol/analytics-events.js +1 -1
  50. package/dist/protocol/cluster-name.js +1 -1
  51. package/dist/protocol/dashboard-global-workflows.js +1 -1
  52. package/dist/protocol/dashboard-write-operations.d.ts +5 -1
  53. package/dist/protocol/dashboard-write-operations.js +13 -2
  54. package/dist/protocol/event-log-payload.js +1 -1
  55. package/dist/protocol/messages/access-log.d.ts +43 -20
  56. package/dist/protocol/messages/access-log.js +16 -2
  57. package/dist/protocol/messages/actor.d.ts +21 -0
  58. package/dist/protocol/messages/actor.js +42 -8
  59. package/dist/protocol/messages/agent-dev-ops.d.ts +118 -0
  60. package/dist/protocol/messages/agent-dev-ops.js +89 -0
  61. package/dist/protocol/messages/agent-run-result.d.ts +425 -0
  62. package/dist/protocol/messages/agent-run-result.js +165 -0
  63. package/dist/protocol/messages/auth.d.ts +3 -0
  64. package/dist/protocol/messages/auth.js +11 -2
  65. package/dist/protocol/messages/browser.js +1 -1
  66. package/dist/protocol/messages/capabilities.d.ts +3 -0
  67. package/dist/protocol/messages/capabilities.js +16 -3
  68. package/dist/protocol/messages/common.js +1 -1
  69. package/dist/protocol/messages/dashboard-global-workflows.d.ts +14 -0
  70. package/dist/protocol/messages/dashboard-global-workflows.js +1 -1
  71. package/dist/protocol/messages/dashboard.d.ts +1998 -48
  72. package/dist/protocol/messages/dashboard.js +269 -15
  73. package/dist/protocol/messages/deployment-identity.js +1 -1
  74. package/dist/protocol/messages/event-log.js +1 -1
  75. package/dist/protocol/messages/execution-status.d.ts +67 -4
  76. package/dist/protocol/messages/execution-status.js +133 -57
  77. package/dist/protocol/messages/join.js +1 -1
  78. package/dist/protocol/messages/log-pull.js +1 -1
  79. package/dist/protocol/messages/oidc-mint.d.ts +51 -0
  80. package/dist/protocol/messages/oidc-mint.js +55 -0
  81. package/dist/protocol/messages/oidc-token-relay.d.ts +31 -4
  82. package/dist/protocol/messages/oidc-token-relay.js +22 -7
  83. package/dist/protocol/messages/orchestrator-agent.d.ts +66 -5
  84. package/dist/protocol/messages/orchestrator-agent.js +35 -3
  85. package/dist/protocol/messages/pat-kind.d.ts +16 -0
  86. package/dist/protocol/messages/pat-kind.js +17 -0
  87. package/dist/protocol/messages/peer.d.ts +7 -7
  88. package/dist/protocol/messages/peer.js +1 -1
  89. package/dist/protocol/messages/platform-orchestrator.d.ts +685 -17
  90. package/dist/protocol/messages/platform-orchestrator.js +8 -5
  91. package/dist/protocol/messages/run-events.d.ts +8 -1
  92. package/dist/protocol/messages/run-events.js +1 -1
  93. package/dist/protocol/messages/scaler-event.js +1 -1
  94. package/dist/protocol/messages/source-registration.js +1 -1
  95. package/dist/protocol/source-origin.d.ts +20 -0
  96. package/dist/protocol/source-origin.js +21 -0
  97. package/dist/protocol/version.js +1 -1
  98. package/dist/provenance/attestation-origin.d.ts +18 -0
  99. package/dist/provenance/attestation-origin.js +22 -0
  100. package/dist/provenance/bundle.js +1 -1
  101. package/dist/provenance/dsse.js +1 -1
  102. package/dist/provenance/schema.d.ts +48 -0
  103. package/dist/provenance/schema.js +21 -7
  104. package/dist/provenance/statement-hash.d.ts +9 -0
  105. package/dist/provenance/statement-hash.js +17 -0
  106. package/dist/provenance/verify.d.ts +7 -0
  107. package/dist/provenance/verify.js +49 -10
  108. package/dist/provider/changed-files-fetcher.js +1 -1
  109. package/dist/provider/check-run-conclusion.d.ts +1 -1
  110. package/dist/provider/check-run-conclusion.js +1 -1
  111. package/dist/provider/check-status-poster.js +1 -1
  112. package/dist/provider/clone-token-provider.js +1 -1
  113. package/dist/provider/contributor-resolver.js +1 -1
  114. package/dist/provider/index.js +1 -1
  115. package/dist/provider/lock-file-fetcher.js +1 -1
  116. package/dist/provider/lock-file-parse-error.js +1 -1
  117. package/dist/provider/repo-url-builder.js +1 -1
  118. package/dist/provider/types.js +1 -1
  119. package/dist/provider/webhook-normalizer.js +1 -1
  120. package/dist/registration/registerable-trigger-type.d.ts +1 -1
  121. package/dist/registration/registerable-trigger-type.js +1 -1
  122. package/dist/{chunk-BTugEXQM.js → rolldown-runtime-ClRpJifh.js} +0 -1
  123. package/dist/scaler/resource-types.js +1 -1
  124. package/dist/scaler/scaler-backend-type.js +1 -1
  125. package/dist/secrets/index.d.ts +1 -1
  126. package/dist/secrets/index.js +1 -1
  127. package/dist/secrets/types.d.ts +0 -24
  128. package/dist/secrets/types.js +1 -1
  129. package/dist/state-machine/index.js +1 -1
  130. package/dist/state-machine/machine.js +1 -1
  131. package/dist/state-machine/types.js +1 -1
  132. package/dist/trigger/decision-trace.js +1 -1
  133. package/dist/trigger/jsonpath-matcher.js +1 -1
  134. package/dist/trigger/matcher.js +1 -1
  135. package/dist/trigger/trigger-event-type.js +1 -1
  136. package/dist/trigger/types.d.ts +35 -7
  137. package/dist/trigger/types.js +8 -3
  138. package/dist/webhook/signature.js +1 -1
  139. package/dist/webhook/webhook-url-format.d.ts +7 -0
  140. package/dist/webhook/webhook-url-format.js +11 -2
  141. package/dist/ws/close-codes.d.ts +8 -2
  142. package/dist/ws/close-codes.js +10 -4
  143. package/dist/ws/rate-limiter.js +1 -1
  144. package/dist/ws/ws-like.js +1 -1
  145. package/package.json +9 -1
  146. package/sbom.spdx.json +5 -5
@@ -1,11 +1,12 @@
1
- import "../../chunk-BTugEXQM.js";
1
+ import "../../rolldown-runtime-ClRpJifh.js";
2
2
  import { heartbeatSchema } from "./common.js";
3
- import { orchCapabilitiesSchema } from "./capabilities.js";
4
- import { authFailureSchema, authRequestSchema, authSuccessSchema } from "./auth.js";
5
3
  import { executionStatusSchema, jobStatusForwardSchema, stateReplaySchema, stepStatusForwardSchema } from "./execution-status.js";
6
- import { sourceDeregisterAckSchema, sourceDeregisterSchema, sourceRegistrationAckSchema, sourceRegistrationSchema } from "./source-registration.js";
7
4
  import { jobContextMessageSchema, runEventMessageSchema } from "./run-events.js";
5
+ import { sourceDeregisterAckSchema, sourceDeregisterSchema, sourceRegistrationAckSchema, sourceRegistrationSchema } from "./source-registration.js";
8
6
  import { dashboardPlatformToOrchSchema } from "./dashboard.js";
7
+ import { orchCapabilitiesSchema } from "./capabilities.js";
8
+ import { authFailureSchema, authRequestSchema, authSuccessSchema } from "./auth.js";
9
+ import { oidcMintRequestSchema, oidcMintResponseSchema } from "./oidc-mint.js";
9
10
  import { z } from "zod";
10
11
  //#region src/protocol/messages/platform-orchestrator.ts
11
12
  /** Trust policy update pushed from Platform to orchestrator when policy or identity links change. */
@@ -338,6 +339,7 @@ const platformToOrchestratorMessageSchema = z.discriminatedUnion("type", [
338
339
  peerDiscoverSchema,
339
340
  peerUpdateSchema,
340
341
  staleCheckrunCleanupSchema,
342
+ oidcMintResponseSchema,
341
343
  ...dashboardPlatformToOrchSchema.options
342
344
  ]);
343
345
  /** All messages that flow from Orchestrator to Platform.
@@ -363,7 +365,8 @@ const orchestratorToPlatformMessageSchema = z.discriminatedUnion("type", [
363
365
  heartbeatSchema,
364
366
  runEventMessageSchema,
365
367
  jobContextMessageSchema,
366
- orchMetricsSchema
368
+ orchMetricsSchema,
369
+ oidcMintRequestSchema
367
370
  ]);
368
371
  //#endregion
369
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 };
@@ -14,8 +14,8 @@ export declare const runEventMessageSchema: z.ZodObject<{
14
14
  eventType: z.ZodString;
15
15
  timestampMs: z.ZodNumber;
16
16
  sourceService: z.ZodEnum<{
17
- platform: "platform";
18
17
  agent: "agent";
18
+ platform: "platform";
19
19
  orchestrator: "orchestrator";
20
20
  }>;
21
21
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -125,10 +125,17 @@ export declare const dashboardOrchLogsRequestSchema: z.ZodObject<{
125
125
  actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
126
126
  type: z.ZodLiteral<"user">;
127
127
  sub: z.ZodString;
128
+ agent: z.ZodOptional<z.ZodObject<{
129
+ patId: z.ZodString;
130
+ label: z.ZodString;
131
+ }, z.core.$strip>>;
128
132
  }, z.core.$strip>, z.ZodObject<{
129
133
  type: z.ZodLiteral<"api_key">;
130
134
  keyId: z.ZodString;
131
135
  ownerSub: z.ZodString;
136
+ agent: z.ZodOptional<z.ZodObject<{
137
+ label: z.ZodString;
138
+ }, z.core.$strip>>;
132
139
  }, z.core.$strip>, z.ZodObject<{
133
140
  type: z.ZodLiteral<"service_account">;
134
141
  id: z.ZodString;
@@ -1,4 +1,4 @@
1
- import "../../chunk-BTugEXQM.js";
1
+ import "../../rolldown-runtime-ClRpJifh.js";
2
2
  import { actorPrincipalSchema } from "./actor.js";
3
3
  import { z } from "zod";
4
4
  //#region src/protocol/messages/run-events.ts
@@ -1,4 +1,4 @@
1
- import "../../chunk-BTugEXQM.js";
1
+ import "../../rolldown-runtime-ClRpJifh.js";
2
2
  import { z } from "zod";
3
3
  //#region src/protocol/messages/scaler-event.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import "../../chunk-BTugEXQM.js";
1
+ import "../../rolldown-runtime-ClRpJifh.js";
2
2
  import { DeploymentIdentitySchema } from "./deployment-identity.js";
3
3
  import { z } from "zod";
4
4
  //#region src/protocol/messages/source-registration.ts
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * How a run was initiated, as branded into provenance attestations.
4
+ *
5
+ * `triggered` — a webhook event that resolved to a cloned commit; the
6
+ * repository/ref/sha coordinates come from a real VCS event.
7
+ * `run-remote` — a developer's local working-tree overlay (`kici run remote`):
8
+ * the source coordinates are caller-supplied, not a triggered VCS event.
9
+ *
10
+ * The brand is org-asserted (derived from the orchestrator-reported
11
+ * `local_working_tree` flag on the run). The one un-forgeable trust anchor is
12
+ * the origin org id; the brand and the repo/ref/sha are scoped to that org's
13
+ * infrastructure.
14
+ */
15
+ export declare const SourceOrigin: z.ZodEnum<{
16
+ triggered: "triggered";
17
+ "run-remote": "run-remote";
18
+ }>;
19
+ export type SourceOrigin = z.infer<typeof SourceOrigin>;
20
+ //# sourceMappingURL=source-origin.d.ts.map
@@ -0,0 +1,21 @@
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
+ import { z } from "zod";
3
+ //#region src/protocol/source-origin.ts
4
+ /**
5
+ * How a run was initiated, as branded into provenance attestations.
6
+ *
7
+ * `triggered` — a webhook event that resolved to a cloned commit; the
8
+ * repository/ref/sha coordinates come from a real VCS event.
9
+ * `run-remote` — a developer's local working-tree overlay (`kici run remote`):
10
+ * the source coordinates are caller-supplied, not a triggered VCS event.
11
+ *
12
+ * The brand is org-asserted (derived from the orchestrator-reported
13
+ * `local_working_tree` flag on the run). The one un-forgeable trust anchor is
14
+ * the origin org id; the brand and the repo/ref/sha are scoped to that org's
15
+ * infrastructure.
16
+ */
17
+ const SourceOrigin = z.enum(["triggered", "run-remote"]);
18
+ //#endregion
19
+ export { SourceOrigin };
20
+
21
+ //# sourceMappingURL=source-origin.js.map
@@ -1,4 +1,4 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  //#region src/protocol/version.ts
3
3
  /**
4
4
  * Protocol version. Sent during WebSocket handshake.
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * When the Platform identity token bound into a provenance bundle was minted,
4
+ * relative to the build. Orthogonal to the run's `SourceOrigin` brand.
5
+ * `live` — minted synchronously during the build (no deferral).
6
+ * `deferred` — the build's mint failed transiently; the token was minted later
7
+ * against run/job rows the Platform already had (transient-blip recovery).
8
+ * `offline-backfill` — the run was ingested while the Platform was fully down;
9
+ * the run/job rows were backfilled before the deferred mint. The temporal gap
10
+ * is disclosed, never hidden.
11
+ */
12
+ export declare const AttestationOrigin: z.ZodEnum<{
13
+ live: "live";
14
+ deferred: "deferred";
15
+ "offline-backfill": "offline-backfill";
16
+ }>;
17
+ export type AttestationOrigin = z.infer<typeof AttestationOrigin>;
18
+ //# sourceMappingURL=attestation-origin.d.ts.map
@@ -0,0 +1,22 @@
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
+ import { z } from "zod";
3
+ //#region src/provenance/attestation-origin.ts
4
+ /**
5
+ * When the Platform identity token bound into a provenance bundle was minted,
6
+ * relative to the build. Orthogonal to the run's `SourceOrigin` brand.
7
+ * `live` — minted synchronously during the build (no deferral).
8
+ * `deferred` — the build's mint failed transiently; the token was minted later
9
+ * against run/job rows the Platform already had (transient-blip recovery).
10
+ * `offline-backfill` — the run was ingested while the Platform was fully down;
11
+ * the run/job rows were backfilled before the deferred mint. The temporal gap
12
+ * is disclosed, never hidden.
13
+ */
14
+ const AttestationOrigin = z.enum([
15
+ "live",
16
+ "deferred",
17
+ "offline-backfill"
18
+ ]);
19
+ //#endregion
20
+ export { AttestationOrigin };
21
+
22
+ //# sourceMappingURL=attestation-origin.js.map
@@ -1,4 +1,4 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  import { dsseEnvelopeSchema } from "./dsse.js";
3
3
  import { z } from "zod";
4
4
  //#region src/provenance/bundle.ts
@@ -1,4 +1,4 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  import { z } from "zod";
3
3
  //#region src/provenance/dsse.ts
4
4
  /**
@@ -204,6 +204,7 @@ export declare const kiciWorkflowExternalParametersSchema: z.ZodObject<{
204
204
  ref: z.ZodString;
205
205
  path: z.ZodString;
206
206
  }, z.core.$strip>;
207
+ provider: z.ZodOptional<z.ZodString>;
207
208
  }, z.core.$loose>;
208
209
  export type KiciWorkflowExternalParameters = z.infer<typeof kiciWorkflowExternalParametersSchema>;
209
210
  /** KiCI workflow internal parameters: run-scoped build context. */
@@ -211,6 +212,17 @@ export declare const kiciWorkflowInternalParametersSchema: z.ZodObject<{
211
212
  commit: z.ZodOptional<z.ZodString>;
212
213
  runId: z.ZodOptional<z.ZodString>;
213
214
  jobId: z.ZodOptional<z.ZodString>;
215
+ orgId: z.ZodOptional<z.ZodString>;
216
+ sourceOrigin: z.ZodOptional<z.ZodEnum<{
217
+ triggered: "triggered";
218
+ "run-remote": "run-remote";
219
+ }>>;
220
+ attestationOrigin: z.ZodOptional<z.ZodEnum<{
221
+ live: "live";
222
+ deferred: "deferred";
223
+ "offline-backfill": "offline-backfill";
224
+ }>>;
225
+ statementHash: z.ZodOptional<z.ZodString>;
214
226
  }, z.core.$loose>;
215
227
  export type KiciWorkflowInternalParameters = z.infer<typeof kiciWorkflowInternalParametersSchema>;
216
228
  /** KiCI build definition: pins the buildType and types the workflow params. */
@@ -231,11 +243,23 @@ export declare const kiciBuildDefinitionSchema: z.ZodObject<{
231
243
  ref: z.ZodString;
232
244
  path: z.ZodString;
233
245
  }, z.core.$strip>;
246
+ provider: z.ZodOptional<z.ZodString>;
234
247
  }, z.core.$loose>;
235
248
  internalParameters: z.ZodOptional<z.ZodObject<{
236
249
  commit: z.ZodOptional<z.ZodString>;
237
250
  runId: z.ZodOptional<z.ZodString>;
238
251
  jobId: z.ZodOptional<z.ZodString>;
252
+ orgId: z.ZodOptional<z.ZodString>;
253
+ sourceOrigin: z.ZodOptional<z.ZodEnum<{
254
+ triggered: "triggered";
255
+ "run-remote": "run-remote";
256
+ }>>;
257
+ attestationOrigin: z.ZodOptional<z.ZodEnum<{
258
+ live: "live";
259
+ deferred: "deferred";
260
+ "offline-backfill": "offline-backfill";
261
+ }>>;
262
+ statementHash: z.ZodOptional<z.ZodString>;
239
263
  }, z.core.$loose>>;
240
264
  }, z.core.$strip>;
241
265
  export type KiciBuildDefinition = z.infer<typeof kiciBuildDefinitionSchema>;
@@ -292,11 +316,23 @@ export declare const kiciProvenancePredicateSchema: z.ZodObject<{
292
316
  ref: z.ZodString;
293
317
  path: z.ZodString;
294
318
  }, z.core.$strip>;
319
+ provider: z.ZodOptional<z.ZodString>;
295
320
  }, z.core.$loose>;
296
321
  internalParameters: z.ZodOptional<z.ZodObject<{
297
322
  commit: z.ZodOptional<z.ZodString>;
298
323
  runId: z.ZodOptional<z.ZodString>;
299
324
  jobId: z.ZodOptional<z.ZodString>;
325
+ orgId: z.ZodOptional<z.ZodString>;
326
+ sourceOrigin: z.ZodOptional<z.ZodEnum<{
327
+ triggered: "triggered";
328
+ "run-remote": "run-remote";
329
+ }>>;
330
+ attestationOrigin: z.ZodOptional<z.ZodEnum<{
331
+ live: "live";
332
+ deferred: "deferred";
333
+ "offline-backfill": "offline-backfill";
334
+ }>>;
335
+ statementHash: z.ZodOptional<z.ZodString>;
300
336
  }, z.core.$loose>>;
301
337
  }, z.core.$strip>;
302
338
  runDetails: z.ZodObject<{
@@ -362,11 +398,23 @@ export declare const kiciProvenanceStatementSchema: z.ZodObject<{
362
398
  ref: z.ZodString;
363
399
  path: z.ZodString;
364
400
  }, z.core.$strip>;
401
+ provider: z.ZodOptional<z.ZodString>;
365
402
  }, z.core.$loose>;
366
403
  internalParameters: z.ZodOptional<z.ZodObject<{
367
404
  commit: z.ZodOptional<z.ZodString>;
368
405
  runId: z.ZodOptional<z.ZodString>;
369
406
  jobId: z.ZodOptional<z.ZodString>;
407
+ orgId: z.ZodOptional<z.ZodString>;
408
+ sourceOrigin: z.ZodOptional<z.ZodEnum<{
409
+ triggered: "triggered";
410
+ "run-remote": "run-remote";
411
+ }>>;
412
+ attestationOrigin: z.ZodOptional<z.ZodEnum<{
413
+ live: "live";
414
+ deferred: "deferred";
415
+ "offline-backfill": "offline-backfill";
416
+ }>>;
417
+ statementHash: z.ZodOptional<z.ZodString>;
370
418
  }, z.core.$loose>>;
371
419
  }, z.core.$strip>;
372
420
  runDetails: z.ZodObject<{
@@ -1,4 +1,6 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
+ import { SourceOrigin } from "../protocol/source-origin.js";
3
+ import { AttestationOrigin } from "./attestation-origin.js";
2
4
  import { z } from "zod";
3
5
  //#region src/provenance/schema.ts
4
6
  /**
@@ -105,16 +107,28 @@ const inTotoStatementSchema = z.object({
105
107
  predicate: z.record(z.string(), z.unknown())
106
108
  });
107
109
  /** KiCI workflow external parameters: the workflow source coordinates. */
108
- const kiciWorkflowExternalParametersSchema = z.object({ workflow: z.object({
109
- repository: z.string(),
110
- ref: z.string(),
111
- path: z.string()
112
- }) }).passthrough();
110
+ const kiciWorkflowExternalParametersSchema = z.object({
111
+ workflow: z.object({
112
+ repository: z.string(),
113
+ ref: z.string(),
114
+ path: z.string()
115
+ }),
116
+ /** Informational source provider (github / gitlab / bitbucket / local). Not a trust signal. */
117
+ provider: z.string().optional()
118
+ }).passthrough();
113
119
  /** KiCI workflow internal parameters: run-scoped build context. */
114
120
  const kiciWorkflowInternalParametersSchema = z.object({
115
121
  commit: z.string().optional(),
116
122
  runId: z.string().optional(),
117
- jobId: z.string().optional()
123
+ jobId: z.string().optional(),
124
+ /** Authoritative origin: the customer's public org id (Platform-asserted). */
125
+ orgId: z.string().optional(),
126
+ /** Source-origin brand: triggered vs kici run remote (local working-tree overlay). */
127
+ sourceOrigin: SourceOrigin.optional(),
128
+ /** Mint-timing marker frozen into a deferred statement at build time. */
129
+ attestationOrigin: AttestationOrigin.optional(),
130
+ /** SHA-256 of this statement's payload — the deferred-mint binding. */
131
+ statementHash: z.string().optional()
118
132
  }).passthrough();
119
133
  /** KiCI build definition: pins the buildType and types the workflow params. */
120
134
  const kiciBuildDefinitionSchema = buildDefinitionSchema.extend({
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Lowercase-hex SHA-256 of the DSSE statement payload bytes. This is the binding
3
+ * a deferred OIDC mint commits to (truth-contract property 2): the later token
4
+ * carries this hash as a claim so the Platform identity cannot be re-bound to a
5
+ * different frozen statement at retry time. Browser-safe: `crypto.subtle` only,
6
+ * so the verifier (dashboard + CLI) can recompute it.
7
+ */
8
+ export declare function computeStatementHash(payload: Uint8Array): Promise<string>;
9
+ //# sourceMappingURL=statement-hash.d.ts.map
@@ -0,0 +1,17 @@
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
+ //#region src/provenance/statement-hash.ts
3
+ /**
4
+ * Lowercase-hex SHA-256 of the DSSE statement payload bytes. This is the binding
5
+ * a deferred OIDC mint commits to (truth-contract property 2): the later token
6
+ * carries this hash as a claim so the Platform identity cannot be re-bound to a
7
+ * different frozen statement at retry time. Browser-safe: `crypto.subtle` only,
8
+ * so the verifier (dashboard + CLI) can recompute it.
9
+ */
10
+ async function computeStatementHash(payload) {
11
+ const digest = await crypto.subtle.digest("SHA-256", payload);
12
+ return Array.from(new Uint8Array(digest)).map((b) => b.toString(16).padStart(2, "0")).join("");
13
+ }
14
+ //#endregion
15
+ export { computeStatementHash };
16
+
17
+ //# sourceMappingURL=statement-hash.js.map
@@ -23,6 +23,7 @@
23
23
  */
24
24
  import { type JSONWebKeySet } from 'jose';
25
25
  import { type KiciProvenanceStatement } from './schema.js';
26
+ import { AttestationOrigin } from './attestation-origin.js';
26
27
  /** Tri-state outcome of a single verification check. */
27
28
  export type CheckStatus = 'pass' | 'fail' | 'skipped';
28
29
  /** Per-check verification outcomes. */
@@ -46,6 +47,12 @@ export interface VerifyResult {
46
47
  claims?: Record<string, unknown>;
47
48
  statement?: KiciProvenanceStatement;
48
49
  failures: string[];
50
+ /**
51
+ * Mint-timing origin of the identity token: `live` (minted during the build,
52
+ * cross-checked field-by-field), or `deferred` / `offline-backfill` (minted
53
+ * later, bound to the frozen statement by hash — the temporal gap is disclosed).
54
+ */
55
+ attestationOrigin?: AttestationOrigin;
49
56
  }
50
57
  export interface VerifyKiciBundleOptions {
51
58
  /** The bundle to verify (validated against `kiciBundleSchema`). */
@@ -1,7 +1,9 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
+ import { AttestationOrigin } from "./attestation-origin.js";
2
3
  import { dssePae } from "./dsse.js";
3
4
  import { kiciBundleSchema } from "./bundle.js";
4
5
  import { kiciProvenanceStatementSchema } from "./schema.js";
6
+ import { computeStatementHash } from "./statement-hash.js";
5
7
  import { calculateJwkThumbprint, createLocalJWKSet, importJWK, jwtVerify } from "jose";
6
8
  //#region src/provenance/verify.ts
7
9
  /**
@@ -63,13 +65,19 @@ async function verifyKiciBundle(opts) {
63
65
  }
64
66
  const bundle = parsed.data;
65
67
  checks.schema = "pass";
66
- const statementBytes = b64ToBytes(bundle.dsseEnvelope.payload);
67
68
  let statement;
68
- const stmt = kiciProvenanceStatementSchema.safeParse(JSON.parse(new TextDecoder().decode(statementBytes)));
69
- if (!stmt.success) {
69
+ let statementBytes;
70
+ try {
71
+ statementBytes = b64ToBytes(bundle.dsseEnvelope.payload);
72
+ const stmt = kiciProvenanceStatementSchema.safeParse(JSON.parse(new TextDecoder().decode(statementBytes)));
73
+ if (!stmt.success) {
74
+ checks.schema = "fail";
75
+ failures.push("statement_schema_invalid");
76
+ } else statement = stmt.data;
77
+ } catch {
70
78
  checks.schema = "fail";
71
- failures.push("statement_schema_invalid");
72
- } else statement = stmt.data;
79
+ failures.push("statement_payload_invalid");
80
+ }
73
81
  let claims;
74
82
  try {
75
83
  const { payload } = await jwtVerify(bundle.verificationMaterial.identityToken, createLocalJWKSet(opts.jwks), {
@@ -83,6 +91,7 @@ async function verifyKiciBundle(opts) {
83
91
  failures.push("identity_token_invalid");
84
92
  }
85
93
  try {
94
+ if (!statementBytes) throw new Error("no statement bytes");
86
95
  const pubJwk = bundle.verificationMaterial.publicKey;
87
96
  const thumbprint = await calculateJwkThumbprint(pubJwk, "sha256");
88
97
  if (bundle.dsseEnvelope.signatures[0].keyid !== thumbprint) throw new Error("keyid does not match public-key thumbprint");
@@ -96,11 +105,18 @@ async function verifyKiciBundle(opts) {
96
105
  checks.dsse = "fail";
97
106
  failures.push("dsse_signature_invalid");
98
107
  }
99
- if (statement && claims) {
108
+ const attestationOrigin = resolveAttestationOrigin(claims, statement);
109
+ if (statement && claims && statementBytes) if (attestationOrigin === AttestationOrigin.enum.live) {
100
110
  const ok = crossCheckBuildContext(statement, claims);
101
111
  checks.buildContext = ok ? "pass" : "fail";
102
112
  if (!ok) failures.push("build_context_mismatch");
103
113
  } else {
114
+ const actual = await computeStatementHash(statementBytes);
115
+ const ok = typeof claims.statement_hash === "string" && claims.statement_hash === actual;
116
+ checks.buildContext = ok ? "pass" : "fail";
117
+ if (!ok) failures.push("statement_hash_mismatch");
118
+ }
119
+ else {
104
120
  checks.buildContext = "fail";
105
121
  failures.push("build_context_uncheckable");
106
122
  }
@@ -115,15 +131,38 @@ async function verifyKiciBundle(opts) {
115
131
  checks,
116
132
  claims,
117
133
  statement,
118
- failures
134
+ failures,
135
+ attestationOrigin
119
136
  };
120
137
  }
121
- /** The statement's build context must equal the (server-truth) JWT claims. */
138
+ /** Derive the mint-timing origin from the token claim, then the frozen statement. */
139
+ function resolveAttestationOrigin(claims, statement) {
140
+ const fromClaim = AttestationOrigin.safeParse(claims?.attestation_origin);
141
+ if (fromClaim.success) return fromClaim.data;
142
+ const internal = statement?.predicate.buildDefinition.internalParameters;
143
+ const fromStatement = AttestationOrigin.safeParse(internal?.attestationOrigin);
144
+ return fromStatement.success ? fromStatement.data : AttestationOrigin.enum.live;
145
+ }
146
+ /**
147
+ * The statement's build context must equal the (server-truth) JWT claims.
148
+ *
149
+ * Only the **claims** side is normalized (`?? ''`): the producer coerces a
150
+ * null/absent `repository` / `ref` / `workflow_ref` claim into the
151
+ * schema-required empty string and omits `commit` entirely when `sha` is
152
+ * falsy, so a null/absent claim is compared against that coerced `''` /
153
+ * omitted-commit. The **statement** side stays strict — a non-empty
154
+ * attacker-controlled statement field never matches a null claim
155
+ * (`'evil/repo' === (null ?? '')` → `'evil/repo' === ''` → false), and an
156
+ * empty statement field never matches a non-null claim — so this relaxation
157
+ * is forgery-safe in exactly one direction: empty/absent statement ⇔
158
+ * null/absent claim, and nothing else. `runId` / `jobId` are always minted,
159
+ * so they stay strict.
160
+ */
122
161
  function crossCheckBuildContext(statement, claims) {
123
162
  const bd = statement.predicate.buildDefinition;
124
163
  const wf = bd.externalParameters.workflow;
125
164
  const ip = bd.internalParameters ?? {};
126
- return wf.repository === claims.repository && wf.ref === claims.ref && wf.path === claims.workflow_ref && ip.commit === claims.sha && ip.runId === claims.kici_run_id && ip.jobId === claims.kici_job_id;
165
+ return wf.repository === (claims.repository ?? "") && wf.ref === (claims.ref ?? "") && wf.path === (claims.workflow_ref ?? "") && (ip.commit ?? "") === (claims.sha ?? "") && ip.runId === claims.kici_run_id && ip.jobId === claims.kici_job_id;
127
166
  }
128
167
  /** At least one subject must carry a digest matching the supplied artifact digest. */
129
168
  function checkSubjectDigest(statement, expected) {
@@ -1,2 +1,2 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  export {};
@@ -8,8 +8,8 @@ import { z } from 'zod';
8
8
  export declare const CheckRunConclusion: z.ZodEnum<{
9
9
  success: "success";
10
10
  cancelled: "cancelled";
11
- failure: "failure";
12
11
  timed_out: "timed_out";
12
+ failure: "failure";
13
13
  }>;
14
14
  export type CheckRunConclusion = z.infer<typeof CheckRunConclusion>;
15
15
  //# sourceMappingURL=check-run-conclusion.d.ts.map
@@ -1,4 +1,4 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  import { z } from "zod";
3
3
  //#region src/provider/check-run-conclusion.ts
4
4
  /**
@@ -1,2 +1,2 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  export {};
@@ -1,2 +1,2 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  export {};
@@ -1,2 +1,2 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  export {};
@@ -1,4 +1,4 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  import { LockFileParseError } from "./lock-file-parse-error.js";
3
3
  import { CheckRunConclusion } from "./check-run-conclusion.js";
4
4
  export { CheckRunConclusion, LockFileParseError };
@@ -1,2 +1,2 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  export {};
@@ -1,4 +1,4 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  //#region src/provider/lock-file-parse-error.ts
3
3
  /**
4
4
  * Thrown by a LockFileFetcher when a lock file is present at the repo ref but
@@ -1,2 +1,2 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  export {};
@@ -1,2 +1,2 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  export {};
@@ -1,2 +1,2 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  export {};
@@ -26,10 +26,10 @@ import { z } from 'zod';
26
26
  */
27
27
  export declare const RegisterableTriggerType: z.ZodEnum<{
28
28
  dispatch: "dispatch";
29
+ push: "push";
29
30
  status: "status";
30
31
  generic_webhook: "generic_webhook";
31
32
  pr: "pr";
32
- push: "push";
33
33
  tag: "tag";
34
34
  comment: "comment";
35
35
  review: "review";
@@ -1,4 +1,4 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  import { z } from "zod";
3
3
  //#region src/registration/registerable-trigger-type.ts
4
4
  /**
@@ -1,4 +1,3 @@
1
1
  import "node:module";
2
- import.meta.url;
3
2
  //#endregion
4
3
  export {};
@@ -1,4 +1,4 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  import { z } from "zod";
3
3
  //#region src/scaler/resource-types.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  import { z } from "zod";
3
3
  //#region src/scaler/scaler-backend-type.ts
4
4
  /**
@@ -3,5 +3,5 @@
3
3
  *
4
4
  * Re-exports scope-based secret store types and audit entry.
5
5
  */
6
- export type { SecretStore, AuditEntry, BackendType, BackendHealthStatus, BackendDescriptor, AddBackendParams, BackendManager, BackendSyncManager, } from './types.js';
6
+ export type { SecretStore, AuditEntry, BackendType, BackendHealthStatus, BackendDescriptor, AddBackendParams, BackendSyncManager, } from './types.js';
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  export {};