@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,6 +1,20 @@
1
- import "../../chunk-BTugEXQM.js";
1
+ import "../../rolldown-runtime-ClRpJifh.js";
2
2
  import { z } from "zod";
3
3
  //#region src/protocol/messages/execution-status.ts
4
+ /** Max length for ids and short identifier fields (runId, jobId, sha, ref, …). */
5
+ const STATUS_ID_MAX = 128;
6
+ /** Max length for the repo identifier (`owner/repo` can be long). */
7
+ const REPO_IDENTIFIER_MAX = 256;
8
+ /** Max length for free-text fields (commit message, failure/error reason). */
9
+ const STATUS_FREE_TEXT_MAX = 2e3;
10
+ /** Max number of runs in a single `state.replay` snapshot. */
11
+ const STATE_REPLAY_MAX_RUNS = 500;
12
+ /** Max number of jobs attached to a single run in a `state.replay` snapshot. */
13
+ const MAX_JOBS_PER_RUN = 1e3;
14
+ /** Max number of `runsOn` / `secretsAccessed` label entries on a job/step. */
15
+ const RUNS_ON_LABELS_MAX = 30;
16
+ /** Max number of bound deployment-environment names on a job. */
17
+ const ENVIRONMENTS_MAX = 30;
4
18
  /**
5
19
  * Status values for execution runs (execution_runs table).
6
20
  *
@@ -34,12 +48,45 @@ const ExecutionJobStatus = z.enum([
34
48
  "timed_out_stale",
35
49
  "drift_dropped"
36
50
  ]);
37
- /** Status values for execution steps (execution_steps table + step.status protocol messages). */
51
+ /**
52
+ * The status values a notification subscription may target at the given level.
53
+ *
54
+ * A run-level subscription matches against an `ExecutionRunStatus`; a job-level
55
+ * subscription matches against an `ExecutionJobStatus` (which carries job-only
56
+ * terminal states like `timed_out_stale` / `drift_dropped` / `skipped`). Both
57
+ * the Platform validation and the dashboard editor derive their allowed set
58
+ * from this single helper so server validation and UI options cannot diverge.
59
+ */
60
+ function statusOptionsForLevel(level) {
61
+ return level === "job" ? ExecutionJobStatus.options : ExecutionRunStatus.options;
62
+ }
63
+ /**
64
+ * Status values for execution steps (execution_steps table + step.status protocol messages).
65
+ *
66
+ * - `pending` — a parallel-group child queued behind `maxParallel`, not yet launched.
67
+ * - `cancelled` — a parallel-group sibling aborted by fail-fast (NOT a failure).
68
+ */
38
69
  const ExecutionStepStatus = z.enum([
39
70
  "running",
40
71
  "success",
41
72
  "failed",
42
- "skipped"
73
+ "skipped",
74
+ "pending",
75
+ "cancelled"
76
+ ]);
77
+ /**
78
+ * How a step participates in a job's step concurrency model.
79
+ *
80
+ * - `sequential` — an ordinary step in the flat step sequence.
81
+ * - `parallel-child` — a child of a `parallel()` group, running concurrently
82
+ * with its siblings, each its own observable step.
83
+ * - `parallel-group` — the structural group wrapper (no flat step index); used
84
+ * only for the dashboard band aggregate, not persisted per step.
85
+ */
86
+ const StepConcurrencyKind = z.enum([
87
+ "sequential",
88
+ "parallel-child",
89
+ "parallel-group"
43
90
  ]);
44
91
  /**
45
92
  * Distinct reasons a run/job ended because a configured wall-clock timeout
@@ -109,18 +156,18 @@ const initFailureSchema = z.object({
109
156
  scope: z.enum(["run", "job"]),
110
157
  category: InitFailureCategory,
111
158
  /** Human-readable failure message (same content surfaced by RunFailureSummary). */
112
- message: z.string(),
159
+ message: z.string().max(STATUS_FREE_TEXT_MAX),
113
160
  /** Set when scope === 'job'. */
114
- jobName: z.string().optional()
161
+ jobName: z.string().max(128).optional()
115
162
  });
116
163
  /** Terminal run states that indicate the run has completed. */
117
- const TERMINAL_RUN_STATES = new Set([
164
+ const TERMINAL_RUN_STATES = /* @__PURE__ */ new Set([
118
165
  ExecutionRunStatus.enum.success,
119
166
  ExecutionRunStatus.enum.failed,
120
167
  ExecutionRunStatus.enum.cancelled
121
168
  ]);
122
169
  /** Terminal job states that indicate the job is no longer running. */
123
- const TERMINAL_JOB_STATES = new Set([
170
+ const TERMINAL_JOB_STATES = /* @__PURE__ */ new Set([
124
171
  ExecutionJobStatus.enum.success,
125
172
  ExecutionJobStatus.enum.failed,
126
173
  ExecutionJobStatus.enum.cancelled,
@@ -131,31 +178,52 @@ const TERMINAL_JOB_STATES = new Set([
131
178
  /** Structured execution status update for Platform metadata tracking. */
132
179
  const executionStatusSchema = z.object({
133
180
  type: z.literal("execution.status"),
134
- messageId: z.string(),
135
- runId: z.string(),
136
- workflowName: z.string(),
181
+ messageId: z.string().max(128),
182
+ runId: z.string().max(128),
183
+ workflowName: z.string().max(128),
137
184
  status: ExecutionRunStatus,
138
- repoIdentifier: z.string().optional(),
139
- sha: z.string().optional(),
185
+ repoIdentifier: z.string().max(256).optional(),
186
+ /**
187
+ * Run-level repo provider (origin host: `github` / `gitlab` / `bitbucket` /
188
+ * `local`). Distinct from the routing-key-derived source provider; drives the
189
+ * dashboard's provider-aware repo links.
190
+ */
191
+ repoProvider: z.string().max(128).optional(),
192
+ /** True when the run executed a developer's uploaded local working tree (`kici run remote`). */
193
+ localWorkingTree: z.boolean().optional(),
194
+ sha: z.string().max(128).optional(),
140
195
  /** Git branch or tag (e.g. "main", "refs/tags/v1.0"). */
141
- ref: z.string().optional(),
196
+ ref: z.string().max(128).optional(),
142
197
  /** Trigger event type (e.g. "push", "pr:open"). */
143
- triggerEvent: z.string().optional(),
198
+ triggerEvent: z.string().max(128).optional(),
144
199
  /** First line of the commit message. */
145
- commitMessage: z.string().optional(),
200
+ commitMessage: z.string().max(STATUS_FREE_TEXT_MAX).optional(),
146
201
  jobCount: z.number().optional(),
147
202
  startedAt: z.number(),
148
203
  completedAt: z.number().optional(),
149
204
  durationMs: z.number().optional(),
150
205
  timestamp: z.number(),
151
206
  /** Parent run ID for re-run lineage (null/undefined for original runs). */
152
- parentRunId: z.string().nullable().optional(),
207
+ parentRunId: z.string().max(128).nullable().optional(),
153
208
  /** Root ancestor run ID for re-run lineage (null/undefined for original runs). Always points to the first run in the chain. */
154
- originalRunId: z.string().nullable().optional(),
209
+ originalRunId: z.string().max(128).nullable().optional(),
155
210
  /** User identity that triggered this re-run (null/undefined for webhook-triggered). */
156
- triggeredBy: z.string().nullable().optional(),
211
+ triggeredBy: z.string().max(128).nullable().optional(),
212
+ /** Agent provenance label when the run was triggered through an agent credential. */
213
+ triggeredByAgentLabel: z.string().max(128).nullable().optional(),
214
+ /**
215
+ * Triggering-actor identity captured from the provider event (the pusher / PR
216
+ * author), distinct from `triggeredBy` (the KiCI re-run user). Provider
217
+ * identities only — never tenant attribution (the wire-schema invariant: no
218
+ * `orgId` here). Powers the dashboard "triggered by @x" and actor-scope
219
+ * notifications. `triggerActorUsername` uses the wider repo-identifier bound
220
+ * because provider logins can be long display names.
221
+ */
222
+ triggerActorProvider: z.string().max(128).nullable().optional(),
223
+ triggerActorUsername: z.string().max(256).nullable().optional(),
224
+ triggerActorUserId: z.string().max(128).nullable().optional(),
157
225
  /** Human-readable reason why the run failed (only present for failed runs). */
158
- failureReason: z.string().optional(),
226
+ failureReason: z.string().max(STATUS_FREE_TEXT_MAX).optional(),
159
227
  /**
160
228
  * Total raw log bytes accumulated across all jobs of this run, summed by the
161
229
  * orchestrator from per-step `logBytesStreamed` values reported by the agent.
@@ -173,35 +241,41 @@ const executionStatusSchema = z.object({
173
241
  /** Per-step status forwarded from agent to Platform (real-time). */
174
242
  const stepStatusForwardSchema = z.object({
175
243
  type: z.literal("step.status.forward"),
176
- messageId: z.string(),
177
- runId: z.string(),
178
- jobId: z.string(),
179
- jobName: z.string(),
244
+ messageId: z.string().max(128),
245
+ runId: z.string().max(128),
246
+ jobId: z.string().max(128),
247
+ jobName: z.string().max(128),
180
248
  stepIndex: z.number(),
181
- stepName: z.string(),
249
+ stepName: z.string().max(256),
182
250
  state: ExecutionStepStatus,
183
251
  timestamp: z.number(),
184
- data: z.record(z.string(), z.unknown()).optional(),
252
+ data: z.record(z.string().max(128), z.unknown()).optional(),
185
253
  /** Secret key names accessed by this step. Forwarded from agent for dashboard display. */
186
- secretsAccessed: z.array(z.string()).optional()
254
+ secretsAccessed: z.array(z.string().max(128)).max(30).optional(),
255
+ /** Step concurrency role; absent means an ordinary sequential step. */
256
+ concurrencyKind: StepConcurrencyKind.optional(),
257
+ /** Parallel-group correlation id shared by a group's children (e.g. `g0`). */
258
+ groupId: z.string().max(128).optional()
187
259
  });
188
260
  /** Per-job status forwarded from orchestrator to Platform (real-time). */
189
261
  const jobStatusForwardSchema = z.object({
190
262
  type: z.literal("job.status.forward"),
191
- messageId: z.string(),
192
- runId: z.string(),
193
- jobId: z.string(),
194
- jobName: z.string(),
263
+ messageId: z.string().max(128),
264
+ runId: z.string().max(128),
265
+ jobId: z.string().max(128),
266
+ jobName: z.string().max(128),
195
267
  status: ExecutionJobStatus,
196
- matrixValues: z.record(z.string(), z.unknown()).optional(),
268
+ matrixValues: z.record(z.string().max(128), z.unknown()).optional(),
197
269
  startedAt: z.number().optional(),
198
270
  completedAt: z.number().optional(),
199
271
  durationMs: z.number().optional(),
200
- errorMessage: z.string().nullable().optional(),
201
- agentId: z.string().nullable().optional(),
202
- orchestratorId: z.string().nullable().optional(),
272
+ errorMessage: z.string().max(STATUS_FREE_TEXT_MAX).nullable().optional(),
273
+ agentId: z.string().max(128).nullable().optional(),
274
+ orchestratorId: z.string().max(128).nullable().optional(),
203
275
  /** Labels used for agent routing. */
204
- runsOnLabels: z.array(z.string()).optional(),
276
+ runsOnLabels: z.array(z.string().max(128)).max(30).optional(),
277
+ /** Ordered bound deployment-environment names for this job (multi-env jobs). */
278
+ environments: z.array(z.string().max(128)).max(30).optional(),
205
279
  /**
206
280
  * Total raw log bytes accumulated across all steps of this job, summed by
207
281
  * the orchestrator from per-step `logBytesStreamed` values reported by the
@@ -216,41 +290,43 @@ const jobStatusForwardSchema = z.object({
216
290
  /** State replay sent on orchestrator reconnection -- full snapshot of active runs and jobs. */
217
291
  const stateReplaySchema = z.object({
218
292
  type: z.literal("state.replay"),
219
- messageId: z.string(),
293
+ messageId: z.string().max(128),
220
294
  runs: z.array(z.object({
221
- runId: z.string(),
222
- workflowName: z.string(),
295
+ runId: z.string().max(128),
296
+ workflowName: z.string().max(128),
223
297
  status: ExecutionRunStatus,
224
- routingKey: z.string().optional(),
225
- repoIdentifier: z.string().optional(),
226
- sha: z.string().optional(),
227
- ref: z.string().optional(),
228
- triggerEvent: z.string().optional(),
229
- commitMessage: z.string().optional(),
298
+ routingKey: z.string().max(128).optional(),
299
+ repoIdentifier: z.string().max(256).optional(),
300
+ sha: z.string().max(128).optional(),
301
+ ref: z.string().max(128).optional(),
302
+ triggerEvent: z.string().max(128).optional(),
303
+ commitMessage: z.string().max(STATUS_FREE_TEXT_MAX).optional(),
230
304
  jobCount: z.number(),
231
305
  startedAt: z.number(),
232
306
  completedAt: z.number().optional(),
233
307
  durationMs: z.number().optional(),
234
- parentRunId: z.string().nullable().optional(),
235
- originalRunId: z.string().nullable().optional(),
236
- triggeredBy: z.string().nullable().optional(),
308
+ parentRunId: z.string().max(128).nullable().optional(),
309
+ originalRunId: z.string().max(128).nullable().optional(),
310
+ triggeredBy: z.string().max(128).nullable().optional(),
311
+ triggeredByAgentLabel: z.string().max(128).nullable().optional(),
237
312
  /** Human-readable reason why the run failed (only present for failed runs). */
238
- failureReason: z.string().optional(),
313
+ failureReason: z.string().max(STATUS_FREE_TEXT_MAX).optional(),
239
314
  jobs: z.array(z.object({
240
- jobId: z.string(),
241
- jobName: z.string(),
242
- status: z.string(),
315
+ jobId: z.string().max(128),
316
+ jobName: z.string().max(128),
317
+ status: z.string().max(128),
243
318
  startedAt: z.number().optional(),
244
319
  completedAt: z.number().optional(),
245
320
  durationMs: z.number().optional(),
246
- errorMessage: z.string().nullable().optional(),
247
- agentId: z.string().nullable().optional(),
248
- runsOnLabels: z.array(z.string()).optional()
249
- }))
250
- })),
321
+ errorMessage: z.string().max(STATUS_FREE_TEXT_MAX).nullable().optional(),
322
+ agentId: z.string().max(128).nullable().optional(),
323
+ runsOnLabels: z.array(z.string().max(128)).max(30).optional(),
324
+ environments: z.array(z.string().max(128)).max(30).optional()
325
+ })).max(MAX_JOBS_PER_RUN)
326
+ })).max(500),
251
327
  timestamp: z.number()
252
328
  });
253
329
  //#endregion
254
- export { CacheOutcome, CacheRunEventType, CacheStepType, ExecutionJobStatus, ExecutionRunStatus, ExecutionStepStatus, InitFailureCategory, TERMINAL_JOB_STATES, TERMINAL_RUN_STATES, TimeoutReason, executionStatusSchema, initFailureSchema, jobStatusForwardSchema, stateReplaySchema, stepStatusForwardSchema };
330
+ export { CacheOutcome, CacheRunEventType, CacheStepType, ENVIRONMENTS_MAX, ExecutionJobStatus, ExecutionRunStatus, ExecutionStepStatus, InitFailureCategory, MAX_JOBS_PER_RUN, REPO_IDENTIFIER_MAX, RUNS_ON_LABELS_MAX, STATE_REPLAY_MAX_RUNS, STATUS_FREE_TEXT_MAX, STATUS_ID_MAX, StepConcurrencyKind, TERMINAL_JOB_STATES, TERMINAL_RUN_STATES, TimeoutReason, executionStatusSchema, initFailureSchema, jobStatusForwardSchema, stateReplaySchema, statusOptionsForLevel, stepStatusForwardSchema };
255
331
 
256
332
  //# sourceMappingURL=execution-status.js.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/protocol/messages/join.ts
4
4
  /** Join request sent by a new orchestrator (via Platform relay or direct peer). */
@@ -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/log-pull.ts
4
4
  /** Request historical logs for a completed or running execution. */
@@ -0,0 +1,51 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Error discriminator for a failed provenance mint, carried on
4
+ * `oidc.mint.response.error.code`. Mirrors the three orchestrator-side error
5
+ * classes that consume it:
6
+ * rejected -> run/job missing or job terminal (MintRejectedError)
7
+ * unavailable -> the Platform signer/issuer is not configured (MintUnavailableError)
8
+ * failed -> any other Platform-side failure (MintRelayError)
9
+ */
10
+ export declare const OidcMintErrorCode: z.ZodEnum<{
11
+ failed: "failed";
12
+ rejected: "rejected";
13
+ unavailable: "unavailable";
14
+ }>;
15
+ export type OidcMintErrorCode = z.infer<typeof OidcMintErrorCode>;
16
+ /** orchestrator -> Platform: request a short-lived OIDC ID token for a job. */
17
+ export declare const oidcMintRequestSchema: z.ZodObject<{
18
+ type: z.ZodLiteral<"oidc.mint.request">;
19
+ requestId: z.ZodString;
20
+ orchestratorId: z.ZodString;
21
+ runId: z.ZodString;
22
+ jobId: z.ZodString;
23
+ audience: z.ZodString;
24
+ deferred: z.ZodOptional<z.ZodLiteral<true>>;
25
+ statementHash: z.ZodOptional<z.ZodString>;
26
+ origin: z.ZodOptional<z.ZodEnum<{
27
+ deferred: "deferred";
28
+ "offline-backfill": "offline-backfill";
29
+ }>>;
30
+ }, z.core.$strip>;
31
+ export type OidcMintRequest = z.infer<typeof oidcMintRequestSchema>;
32
+ /** Platform -> orchestrator: the minted token or a typed error (exactly one). */
33
+ export declare const oidcMintResponseSchema: z.ZodObject<{
34
+ type: z.ZodLiteral<"oidc.mint.response">;
35
+ requestId: z.ZodString;
36
+ result: z.ZodOptional<z.ZodObject<{
37
+ token: z.ZodString;
38
+ expiresIn: z.ZodNumber;
39
+ jti: z.ZodString;
40
+ }, z.core.$strip>>;
41
+ error: z.ZodOptional<z.ZodObject<{
42
+ code: z.ZodEnum<{
43
+ failed: "failed";
44
+ rejected: "rejected";
45
+ unavailable: "unavailable";
46
+ }>;
47
+ message: z.ZodString;
48
+ }, z.core.$strip>>;
49
+ }, z.core.$strip>;
50
+ export type OidcMintResponse = z.infer<typeof oidcMintResponseSchema>;
51
+ //# sourceMappingURL=oidc-mint.d.ts.map
@@ -0,0 +1,55 @@
1
+ import "../../rolldown-runtime-ClRpJifh.js";
2
+ import { AttestationOrigin } from "../../provenance/attestation-origin.js";
3
+ import { z } from "zod";
4
+ //#region src/protocol/messages/oidc-mint.ts
5
+ /**
6
+ * Error discriminator for a failed provenance mint, carried on
7
+ * `oidc.mint.response.error.code`. Mirrors the three orchestrator-side error
8
+ * classes that consume it:
9
+ * rejected -> run/job missing or job terminal (MintRejectedError)
10
+ * unavailable -> the Platform signer/issuer is not configured (MintUnavailableError)
11
+ * failed -> any other Platform-side failure (MintRelayError)
12
+ */
13
+ const OidcMintErrorCode = z.enum([
14
+ "rejected",
15
+ "unavailable",
16
+ "failed"
17
+ ]);
18
+ /** orchestrator -> Platform: request a short-lived OIDC ID token for a job. */
19
+ const oidcMintRequestSchema = z.object({
20
+ type: z.literal("oidc.mint.request"),
21
+ requestId: z.string().min(1),
22
+ orchestratorId: z.string().min(1),
23
+ runId: z.string().min(1),
24
+ jobId: z.string().min(1),
25
+ audience: z.string().min(1).max(255),
26
+ /**
27
+ * Deferred fulfilment (attest-later): when true, the mint knowingly targets a
28
+ * completed job and binds `statementHash` + `origin` into the token. Absent
29
+ * for the live agent path. `orgId` is never on the wire — the Platform derives
30
+ * it from the authenticated connection.
31
+ */
32
+ deferred: z.literal(true).optional(),
33
+ /** SHA-256 of the frozen DSSE statement the deferred token binds to. */
34
+ statementHash: z.string().optional(),
35
+ /** Mint-timing origin for a deferred fulfilment (never `live` here). */
36
+ origin: AttestationOrigin.extract(["deferred", "offline-backfill"]).optional()
37
+ });
38
+ /** Platform -> orchestrator: the minted token or a typed error (exactly one). */
39
+ const oidcMintResponseSchema = z.object({
40
+ type: z.literal("oidc.mint.response"),
41
+ requestId: z.string().min(1),
42
+ result: z.object({
43
+ token: z.string().min(1),
44
+ expiresIn: z.number().int().positive(),
45
+ jti: z.string().min(1)
46
+ }).optional(),
47
+ error: z.object({
48
+ code: OidcMintErrorCode,
49
+ message: z.string()
50
+ }).optional()
51
+ }).refine((m) => m.result === void 0 !== (m.error === void 0), { message: "oidc.mint.response must carry exactly one of result | error" });
52
+ //#endregion
53
+ export { OidcMintErrorCode, oidcMintRequestSchema, oidcMintResponseSchema };
54
+
55
+ //# sourceMappingURL=oidc-mint.js.map
@@ -18,14 +18,41 @@ export declare const oidcTokenRequestParamsSchema: z.ZodObject<{
18
18
  audience: z.ZodString;
19
19
  }, z.core.$strip>;
20
20
  export type OidcTokenRequestParams = z.infer<typeof oidcTokenRequestParamsSchema>;
21
+ export { OidcMintErrorCode } from './oidc-mint.js';
22
+ export type { OidcMintErrorCode as OidcMintErrorCodeType } from './oidc-mint.js';
23
+ /** A successfully minted ID token bound to a job. */
24
+ export declare const oidcMintedTokenSchema: z.ZodObject<{
25
+ token: z.ZodString;
26
+ expiresIn: z.ZodNumber;
27
+ jti: z.ZodString;
28
+ }, z.core.$strip>;
29
+ export type OidcMintedToken = z.infer<typeof oidcMintedTokenSchema>;
21
30
  /**
22
- * Result the orchestrator returns to the agent: the minted short-lived JWT
23
- * plus its lifetime and identifier.
31
+ * Result the orchestrator returns to the agent: either the minted short-lived
32
+ * JWT, or when the mint failed transiently (`unavailable`/`failed`, never
33
+ * `rejected`) — a `deferred` signal so the agent freezes the statement and
34
+ * reports it for later fulfilment. A permanent `rejected` is thrown, never
35
+ * returned, so it is not part of this union.
24
36
  */
25
- export declare const oidcTokenResultSchema: z.ZodObject<{
37
+ export declare const oidcTokenResultSchema: z.ZodUnion<readonly [z.ZodObject<{
26
38
  token: z.ZodString;
27
39
  expiresIn: z.ZodNumber;
28
40
  jti: z.ZodString;
29
- }, z.core.$strip>;
41
+ }, z.core.$strip>, z.ZodObject<{
42
+ deferred: z.ZodLiteral<true>;
43
+ code: z.ZodEnum<{
44
+ failed: "failed";
45
+ unavailable: "unavailable";
46
+ }>;
47
+ }, z.core.$strip>]>;
30
48
  export type OidcTokenResult = z.infer<typeof oidcTokenResultSchema>;
49
+ /** Extra fields a deferred *fulfilment* mint carries (orchestrator -> Platform). */
50
+ export declare const deferredMintParamsSchema: z.ZodObject<{
51
+ statementHash: z.ZodString;
52
+ origin: z.ZodEnum<{
53
+ deferred: "deferred";
54
+ "offline-backfill": "offline-backfill";
55
+ }>;
56
+ }, z.core.$strip>;
57
+ export type DeferredMintParams = z.infer<typeof deferredMintParamsSchema>;
31
58
  //# sourceMappingURL=oidc-token-relay.d.ts.map
@@ -1,4 +1,6 @@
1
- import "../../chunk-BTugEXQM.js";
1
+ import "../../rolldown-runtime-ClRpJifh.js";
2
+ import { AttestationOrigin } from "../../provenance/attestation-origin.js";
3
+ import { OidcMintErrorCode } from "./oidc-mint.js";
2
4
  import { z } from "zod";
3
5
  //#region src/protocol/messages/oidc-token-relay.ts
4
6
  /**
@@ -19,16 +21,29 @@ const oidcTokenRequestParamsSchema = z.object({
19
21
  jobId: z.string().min(1),
20
22
  audience: z.string().min(1).max(255)
21
23
  });
22
- /**
23
- * Result the orchestrator returns to the agent: the minted short-lived JWT
24
- * plus its lifetime and identifier.
25
- */
26
- const oidcTokenResultSchema = z.object({
24
+ /** A successfully minted ID token bound to a job. */
25
+ const oidcMintedTokenSchema = z.object({
27
26
  token: z.string(),
28
27
  expiresIn: z.number().int().positive(),
29
28
  jti: z.string()
30
29
  });
30
+ /**
31
+ * Result the orchestrator returns to the agent: either the minted short-lived
32
+ * JWT, or — when the mint failed transiently (`unavailable`/`failed`, never
33
+ * `rejected`) — a `deferred` signal so the agent freezes the statement and
34
+ * reports it for later fulfilment. A permanent `rejected` is thrown, never
35
+ * returned, so it is not part of this union.
36
+ */
37
+ const oidcTokenResultSchema = z.union([oidcMintedTokenSchema, z.object({
38
+ deferred: z.literal(true),
39
+ code: z.enum(["unavailable", "failed"])
40
+ })]);
41
+ /** Extra fields a deferred *fulfilment* mint carries (orchestrator -> Platform). */
42
+ const deferredMintParamsSchema = z.object({
43
+ statementHash: z.string(),
44
+ origin: AttestationOrigin.extract(["deferred", "offline-backfill"])
45
+ });
31
46
  //#endregion
32
- export { OIDC_TOKEN_REQUEST_METHOD, oidcTokenRequestParamsSchema, oidcTokenResultSchema };
47
+ export { OIDC_TOKEN_REQUEST_METHOD, OidcMintErrorCode, deferredMintParamsSchema, oidcMintedTokenSchema, oidcTokenRequestParamsSchema, oidcTokenResultSchema };
33
48
 
34
49
  //# sourceMappingURL=oidc-token-relay.js.map
@@ -298,8 +298,10 @@ export declare const agentStepStatusSchema: z.ZodObject<{
298
298
  state: z.ZodEnum<{
299
299
  skipped: "skipped";
300
300
  success: "success";
301
+ pending: "pending";
301
302
  running: "running";
302
303
  failed: "failed";
304
+ cancelled: "cancelled";
303
305
  }>;
304
306
  timestamp: z.ZodNumber;
305
307
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -313,6 +315,12 @@ export declare const agentStepStatusSchema: z.ZodObject<{
313
315
  "hook:afterStep": "hook:afterStep";
314
316
  }>>;
315
317
  secretsAccessed: z.ZodOptional<z.ZodArray<z.ZodString>>;
318
+ concurrencyKind: z.ZodOptional<z.ZodEnum<{
319
+ sequential: "sequential";
320
+ "parallel-child": "parallel-child";
321
+ "parallel-group": "parallel-group";
322
+ }>>;
323
+ groupId: z.ZodOptional<z.ZodString>;
316
324
  logBytesStreamed: z.ZodOptional<z.ZodNumber>;
317
325
  }, z.core.$strip>;
318
326
  /** Agent -> Orchestrator: report that a job belongs to a concurrency group. */
@@ -342,8 +350,8 @@ export declare const jobConcurrencyAckSchema: z.ZodObject<{
342
350
  type: z.ZodLiteral<"job.concurrency.ack">;
343
351
  requestId: z.ZodString;
344
352
  action: z.ZodEnum<{
345
- proceed: "proceed";
346
353
  wait: "wait";
354
+ proceed: "proceed";
347
355
  cancel: "cancel";
348
356
  }>;
349
357
  reason: z.ZodOptional<z.ZodString>;
@@ -418,6 +426,32 @@ export declare const provenanceUploadCompleteSchema: z.ZodObject<{
418
426
  subjectDigest: z.ZodString;
419
427
  mediaType: z.ZodString;
420
428
  }, z.core.$strip>;
429
+ /**
430
+ * Agent -> Orchestrator: capture a frozen, DSSE-signed provenance statement for
431
+ * later minting (the transient mint-failure path). No upload happens; the
432
+ * orchestrator persists the envelope in its deferred-attestation outbox and the
433
+ * job completes green. The identity token is minted later and bound to the
434
+ * frozen statement by `statementHash`.
435
+ */
436
+ export declare const provenanceUploadDeferSchema: z.ZodObject<{
437
+ type: z.ZodLiteral<"provenance.upload.defer">;
438
+ messageId: z.ZodString;
439
+ jobId: z.ZodString;
440
+ subjectName: z.ZodString;
441
+ subjectDigest: z.ZodString;
442
+ audience: z.ZodString;
443
+ mediaType: z.ZodString;
444
+ statementHash: z.ZodString;
445
+ dsseEnvelope: z.ZodObject<{
446
+ payloadType: z.ZodString;
447
+ payload: z.ZodString;
448
+ signatures: z.ZodArray<z.ZodObject<{
449
+ keyid: z.ZodString;
450
+ sig: z.ZodString;
451
+ }, z.core.$strip>>;
452
+ }, z.core.$strip>;
453
+ publicKey: z.ZodRecord<z.ZodString, z.ZodUnknown>;
454
+ }, z.core.$strip>;
421
455
  /** Agent -> Orchestrator: emit a custom event from a running workflow step. */
422
456
  export declare const eventEmitSchema: z.ZodObject<{
423
457
  type: z.ZodLiteral<"event.emit">;
@@ -513,8 +547,8 @@ export declare const fleetBundleErrorSchema: z.ZodObject<{
513
547
  }, z.core.$strip>;
514
548
  /** Outcome of a step-level approval hold, sent back to the waiting agent. */
515
549
  export declare const StepApprovalOutcome: z.ZodEnum<{
516
- rejected: "rejected";
517
550
  approved: "approved";
551
+ rejected: "rejected";
518
552
  expired: "expired";
519
553
  }>;
520
554
  export type StepApprovalOutcome = z.infer<typeof StepApprovalOutcome>;
@@ -575,8 +609,8 @@ export declare const stepApprovalResolvedSchema: z.ZodObject<{
575
609
  jobId: z.ZodString;
576
610
  stepIndex: z.ZodNumber;
577
611
  outcome: z.ZodEnum<{
578
- rejected: "rejected";
579
612
  approved: "approved";
613
+ rejected: "rejected";
580
614
  expired: "expired";
581
615
  }>;
582
616
  reason: z.ZodOptional<z.ZodString>;
@@ -674,8 +708,8 @@ export declare const orchestratorToAgentMessageSchema: z.ZodDiscriminatedUnion<[
674
708
  type: z.ZodLiteral<"job.concurrency.ack">;
675
709
  requestId: z.ZodString;
676
710
  action: z.ZodEnum<{
677
- proceed: "proceed";
678
711
  wait: "wait";
712
+ proceed: "proceed";
679
713
  cancel: "cancel";
680
714
  }>;
681
715
  reason: z.ZodOptional<z.ZodString>;
@@ -729,8 +763,8 @@ export declare const orchestratorToAgentMessageSchema: z.ZodDiscriminatedUnion<[
729
763
  jobId: z.ZodString;
730
764
  stepIndex: z.ZodNumber;
731
765
  outcome: z.ZodEnum<{
732
- rejected: "rejected";
733
766
  approved: "approved";
767
+ rejected: "rejected";
734
768
  expired: "expired";
735
769
  }>;
736
770
  reason: z.ZodOptional<z.ZodString>;
@@ -825,8 +859,10 @@ export declare const agentToOrchestratorMessageSchema: z.ZodDiscriminatedUnion<[
825
859
  state: z.ZodEnum<{
826
860
  skipped: "skipped";
827
861
  success: "success";
862
+ pending: "pending";
828
863
  running: "running";
829
864
  failed: "failed";
865
+ cancelled: "cancelled";
830
866
  }>;
831
867
  timestamp: z.ZodNumber;
832
868
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -840,6 +876,12 @@ export declare const agentToOrchestratorMessageSchema: z.ZodDiscriminatedUnion<[
840
876
  "hook:afterStep": "hook:afterStep";
841
877
  }>>;
842
878
  secretsAccessed: z.ZodOptional<z.ZodArray<z.ZodString>>;
879
+ concurrencyKind: z.ZodOptional<z.ZodEnum<{
880
+ sequential: "sequential";
881
+ "parallel-child": "parallel-child";
882
+ "parallel-group": "parallel-group";
883
+ }>>;
884
+ groupId: z.ZodOptional<z.ZodString>;
843
885
  logBytesStreamed: z.ZodOptional<z.ZodNumber>;
844
886
  }, z.core.$strip>, z.ZodObject<{
845
887
  type: z.ZodLiteral<"job.heartbeat">;
@@ -917,6 +959,24 @@ export declare const agentToOrchestratorMessageSchema: z.ZodDiscriminatedUnion<[
917
959
  subjectName: z.ZodString;
918
960
  subjectDigest: z.ZodString;
919
961
  mediaType: z.ZodString;
962
+ }, z.core.$strip>, z.ZodObject<{
963
+ type: z.ZodLiteral<"provenance.upload.defer">;
964
+ messageId: z.ZodString;
965
+ jobId: z.ZodString;
966
+ subjectName: z.ZodString;
967
+ subjectDigest: z.ZodString;
968
+ audience: z.ZodString;
969
+ mediaType: z.ZodString;
970
+ statementHash: z.ZodString;
971
+ dsseEnvelope: z.ZodObject<{
972
+ payloadType: z.ZodString;
973
+ payload: z.ZodString;
974
+ signatures: z.ZodArray<z.ZodObject<{
975
+ keyid: z.ZodString;
976
+ sig: z.ZodString;
977
+ }, z.core.$strip>>;
978
+ }, z.core.$strip>;
979
+ publicKey: z.ZodRecord<z.ZodString, z.ZodUnknown>;
920
980
  }, z.core.$strip>, z.ZodObject<{
921
981
  type: z.ZodLiteral<"event.emit">;
922
982
  jobId: z.ZodString;
@@ -1002,6 +1062,7 @@ export type CacheUserSaveComplete = z.infer<typeof cacheUserSaveCompleteSchema>;
1002
1062
  export type ProvenanceUploadRequest = z.infer<typeof provenanceUploadRequestSchema>;
1003
1063
  export type ProvenanceUploadResponse = z.infer<typeof provenanceUploadResponseSchema>;
1004
1064
  export type ProvenanceUploadComplete = z.infer<typeof provenanceUploadCompleteSchema>;
1065
+ export type ProvenanceUploadDefer = z.infer<typeof provenanceUploadDeferSchema>;
1005
1066
  export type FleetLogsRequest = z.infer<typeof fleetLogsRequestSchema>;
1006
1067
  export type FleetBundleChunk = z.infer<typeof fleetBundleChunkSchema>;
1007
1068
  export type FleetBundleError = z.infer<typeof fleetBundleErrorSchema>;