@kici-dev/engine 0.5.0 → 0.6.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 (68) hide show
  1. package/dist/audit/access-log-policy.js +1 -0
  2. package/dist/audit/retention-policy.js +2 -0
  3. package/dist/context/held-run-job-id.d.ts +26 -10
  4. package/dist/context/held-run-job-id.js +30 -11
  5. package/dist/context/index.d.ts +1 -1
  6. package/dist/context/index.js +3 -3
  7. package/dist/context/types.d.ts +10 -1
  8. package/dist/context/types.js +10 -1
  9. package/dist/index.d.ts +4 -2
  10. package/dist/index.js +14 -11
  11. package/dist/labels.d.ts +66 -12
  12. package/dist/labels.js +74 -17
  13. package/dist/mcp/held-run-resolve.d.ts +40 -0
  14. package/dist/mcp/held-run-resolve.js +68 -15
  15. package/dist/mcp/tool-schemas.d.ts +4 -0
  16. package/dist/mcp/tool-schemas.js +13 -1
  17. package/dist/metrics/catalog-policy.d.ts +6 -3
  18. package/dist/metrics/catalog-policy.js +31 -10
  19. package/dist/metrics/metric-catalog.generated.d.ts +110 -0
  20. package/dist/metrics/metric-catalog.generated.js +132 -0
  21. package/dist/protocol/dashboard-global-workflows.js +2 -2
  22. package/dist/protocol/event-log-payload.js +1 -1
  23. package/dist/protocol/messages/access-log.d.ts +5 -0
  24. package/dist/protocol/messages/access-log.js +1 -0
  25. package/dist/protocol/messages/actor.d.ts +13 -2
  26. package/dist/protocol/messages/actor.js +16 -5
  27. package/dist/protocol/messages/common.js +1 -1
  28. package/dist/protocol/messages/dashboard-global-workflows.d.ts +21 -0
  29. package/dist/protocol/messages/dashboard-global-workflows.js +28 -1
  30. package/dist/protocol/messages/dashboard.d.ts +43 -5
  31. package/dist/protocol/messages/dashboard.js +55 -6
  32. package/dist/protocol/messages/execution-status.d.ts +41 -0
  33. package/dist/protocol/messages/execution-status.js +53 -2
  34. package/dist/protocol/messages/git-credential-relay.d.ts +78 -0
  35. package/dist/protocol/messages/git-credential-relay.js +86 -0
  36. package/dist/protocol/messages/orchestrator-agent.d.ts +89 -0
  37. package/dist/protocol/messages/orchestrator-agent.js +98 -3
  38. package/dist/protocol/messages/peer.d.ts +7 -0
  39. package/dist/protocol/messages/peer.js +18 -1
  40. package/dist/protocol/messages/platform-orchestrator.d.ts +150 -0
  41. package/dist/protocol/messages/platform-orchestrator.js +164 -19
  42. package/dist/protocol/version.d.ts +19 -2
  43. package/dist/protocol/version.js +20 -3
  44. package/dist/provenance/verify.js +11 -10
  45. package/dist/provider/check-status-poster.d.ts +24 -3
  46. package/dist/provider/contributor-resolver.d.ts +11 -3
  47. package/dist/provider/git-credential.d.ts +77 -0
  48. package/dist/provider/git-credential.js +10 -0
  49. package/dist/provider/index.d.ts +2 -0
  50. package/dist/provider/index.js +2 -1
  51. package/dist/provider/webhook-normalizer.d.ts +12 -12
  52. package/dist/repo/pattern-negation.d.ts +73 -0
  53. package/dist/repo/pattern-negation.js +86 -0
  54. package/dist/scaler/registry-auth.d.ts +18 -0
  55. package/dist/scaler/registry-auth.js +28 -0
  56. package/dist/scaler/scaler-backend-type.d.ts +35 -0
  57. package/dist/scaler/scaler-backend-type.js +39 -2
  58. package/dist/scaler/scaler-events.d.ts +79 -0
  59. package/dist/scaler/scaler-events.js +87 -0
  60. package/dist/trigger/content-requirements.js +1 -1
  61. package/dist/trigger/decision-trace.d.ts +79 -0
  62. package/dist/trigger/decision-trace.js +116 -8
  63. package/dist/trigger/matcher.js +4 -2
  64. package/dist/trigger/types.d.ts +87 -7
  65. package/dist/trigger/types.js +6 -1
  66. package/dist/ws/rate-limiter.js +3 -3
  67. package/package.json +11 -3
  68. package/sbom.spdx.json +15 -15
@@ -381,6 +381,12 @@ export declare const dashboardJobDetailSchema: z.ZodObject<{
381
381
  baseJobName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
382
382
  variantKind: z.ZodOptional<z.ZodNullable<z.ZodString>>;
383
383
  variantLabel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
384
+ jobKind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
385
+ gate: "gate";
386
+ proxy: "proxy";
387
+ standard: "standard";
388
+ }>>>;
389
+ summonedRunId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
384
390
  startedAt: z.ZodNullable<z.ZodNumber>;
385
391
  completedAt: z.ZodNullable<z.ZodNumber>;
386
392
  durationMs: z.ZodNullable<z.ZodNumber>;
@@ -392,7 +398,7 @@ export declare const dashboardJobDetailSchema: z.ZodObject<{
392
398
  contexts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
393
399
  skippedContexts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
394
400
  envWarning: z.ZodOptional<z.ZodNullable<z.ZodString>>;
395
- outputs: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
401
+ outputs: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
396
402
  secretOutputKeys: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
397
403
  initFailure: z.ZodOptional<z.ZodObject<{
398
404
  scope: z.ZodEnum<{
@@ -471,6 +477,12 @@ export declare const dashboardRunDetailResponseSchema: z.ZodObject<{
471
477
  baseJobName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
472
478
  variantKind: z.ZodOptional<z.ZodNullable<z.ZodString>>;
473
479
  variantLabel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
480
+ jobKind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
481
+ gate: "gate";
482
+ proxy: "proxy";
483
+ standard: "standard";
484
+ }>>>;
485
+ summonedRunId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
474
486
  startedAt: z.ZodNullable<z.ZodNumber>;
475
487
  completedAt: z.ZodNullable<z.ZodNumber>;
476
488
  durationMs: z.ZodNullable<z.ZodNumber>;
@@ -482,7 +494,7 @@ export declare const dashboardRunDetailResponseSchema: z.ZodObject<{
482
494
  contexts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
483
495
  skippedContexts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
484
496
  envWarning: z.ZodOptional<z.ZodNullable<z.ZodString>>;
485
- outputs: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
497
+ outputs: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
486
498
  secretOutputKeys: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
487
499
  initFailure: z.ZodOptional<z.ZodObject<{
488
500
  scope: z.ZodEnum<{
@@ -3568,6 +3580,7 @@ export declare const dashboardDiagnosticsResponseSchema: z.ZodObject<{
3568
3580
  type: z.ZodEnum<{
3569
3581
  "bare-metal": "bare-metal";
3570
3582
  container: "container";
3583
+ event: "event";
3571
3584
  firecracker: "firecracker";
3572
3585
  kubernetes: "kubernetes";
3573
3586
  }>;
@@ -6746,6 +6759,7 @@ export declare const dashboardPlatformToOrchSchema: z.ZodDiscriminatedUnion<[z.Z
6746
6759
  "source_override.set": "source_override.set";
6747
6760
  "sources.list.read": "sources.list.read";
6748
6761
  "step.logs.read": "step.logs.read";
6762
+ "trust_directory.updated": "trust_directory.updated";
6749
6763
  "trust_policy.updated": "trust_policy.updated";
6750
6764
  }>>;
6751
6765
  source: z.ZodOptional<z.ZodEnum<{
@@ -7001,6 +7015,12 @@ export declare const dashboardOrchToPlatformSchema: z.ZodDiscriminatedUnion<[z.Z
7001
7015
  baseJobName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7002
7016
  variantKind: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7003
7017
  variantLabel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7018
+ jobKind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
7019
+ gate: "gate";
7020
+ proxy: "proxy";
7021
+ standard: "standard";
7022
+ }>>>;
7023
+ summonedRunId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7004
7024
  startedAt: z.ZodNullable<z.ZodNumber>;
7005
7025
  completedAt: z.ZodNullable<z.ZodNumber>;
7006
7026
  durationMs: z.ZodNullable<z.ZodNumber>;
@@ -7012,7 +7032,7 @@ export declare const dashboardOrchToPlatformSchema: z.ZodDiscriminatedUnion<[z.Z
7012
7032
  contexts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
7013
7033
  skippedContexts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
7014
7034
  envWarning: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7015
- outputs: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
7035
+ outputs: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
7016
7036
  secretOutputKeys: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
7017
7037
  initFailure: z.ZodOptional<z.ZodObject<{
7018
7038
  scope: z.ZodEnum<{
@@ -7909,6 +7929,7 @@ export declare const dashboardOrchToPlatformSchema: z.ZodDiscriminatedUnion<[z.Z
7909
7929
  type: z.ZodEnum<{
7910
7930
  "bare-metal": "bare-metal";
7911
7931
  container: "container";
7932
+ event: "event";
7912
7933
  firecracker: "firecracker";
7913
7934
  kubernetes: "kubernetes";
7914
7935
  }>;
@@ -8467,6 +8488,7 @@ export declare const dashboardOrchToPlatformSchema: z.ZodDiscriminatedUnion<[z.Z
8467
8488
  "source_override.set": "source_override.set";
8468
8489
  "sources.list.read": "sources.list.read";
8469
8490
  "step.logs.read": "step.logs.read";
8491
+ "trust_directory.updated": "trust_directory.updated";
8470
8492
  "trust_policy.updated": "trust_policy.updated";
8471
8493
  }>;
8472
8494
  targetType: z.ZodNullable<z.ZodEnum<{
@@ -8636,6 +8658,12 @@ export declare const dashboardRunDetailApiResponseSchema: z.ZodObject<{
8636
8658
  baseJobName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8637
8659
  variantKind: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8638
8660
  variantLabel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8661
+ jobKind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
8662
+ gate: "gate";
8663
+ proxy: "proxy";
8664
+ standard: "standard";
8665
+ }>>>;
8666
+ summonedRunId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8639
8667
  startedAt: z.ZodNullable<z.ZodNumber>;
8640
8668
  completedAt: z.ZodNullable<z.ZodNumber>;
8641
8669
  durationMs: z.ZodNullable<z.ZodNumber>;
@@ -8647,7 +8675,7 @@ export declare const dashboardRunDetailApiResponseSchema: z.ZodObject<{
8647
8675
  contexts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
8648
8676
  skippedContexts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
8649
8677
  envWarning: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8650
- outputs: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
8678
+ outputs: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
8651
8679
  secretOutputKeys: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
8652
8680
  initFailure: z.ZodOptional<z.ZodObject<{
8653
8681
  scope: z.ZodEnum<{
@@ -9206,12 +9234,20 @@ export declare const runEventSchema: z.ZodObject<{
9206
9234
  parentSpanId: z.ZodNullable<z.ZodString>;
9207
9235
  }, z.core.$strip>;
9208
9236
  export type RunEvent = z.infer<typeof runEventSchema>;
9209
- /** Trust policy response (from trust_policies table). */
9237
+ /**
9238
+ * Trust policy response (from trust_policies table).
9239
+ *
9240
+ * `approvalExpirySeconds` is the authoritative window and `approvalExpiryHours`
9241
+ * its coarse, rounded-up view, so a client reading only the older field still
9242
+ * gets a usable number. Both are always sent by this build; the seconds field is
9243
+ * optional so a dashboard build reading an older Platform still parses.
9244
+ */
9210
9245
  export declare const trustPolicyResponseSchema: z.ZodObject<{
9211
9246
  forkPolicy: z.ZodString;
9212
9247
  unknownContributorPolicy: z.ZodString;
9213
9248
  workflowChangePolicy: z.ZodString;
9214
9249
  approvalExpiryHours: z.ZodNumber;
9250
+ approvalExpirySeconds: z.ZodOptional<z.ZodNumber>;
9215
9251
  }, z.core.$strip>;
9216
9252
  export type TrustPolicy = z.infer<typeof trustPolicyResponseSchema>;
9217
9253
  /** Single identity link item. */
@@ -9259,6 +9295,7 @@ export declare const orgMemberSchema: z.ZodObject<{
9259
9295
  suspendedAt: z.ZodNullable<z.ZodCoercedString<unknown>>;
9260
9296
  joinedAt: z.ZodCoercedString<unknown>;
9261
9297
  ciTrustLevel: z.ZodString;
9298
+ ciTrustOverride: z.ZodOptional<z.ZodNullable<z.ZodString>>;
9262
9299
  identityLinks: z.ZodArray<z.ZodObject<{
9263
9300
  provider: z.ZodString;
9264
9301
  providerUsername: z.ZodString;
@@ -9279,6 +9316,7 @@ export declare const memberListResponseSchema: z.ZodObject<{
9279
9316
  suspendedAt: z.ZodNullable<z.ZodCoercedString<unknown>>;
9280
9317
  joinedAt: z.ZodCoercedString<unknown>;
9281
9318
  ciTrustLevel: z.ZodString;
9319
+ ciTrustOverride: z.ZodOptional<z.ZodNullable<z.ZodString>>;
9282
9320
  identityLinks: z.ZodArray<z.ZodObject<{
9283
9321
  provider: z.ZodString;
9284
9322
  providerUsername: z.ZodString;
@@ -5,7 +5,7 @@ import { AttestationOrigin } from "../../provenance/attestation-origin.js";
5
5
  import { actorPrincipalSchema } from "./actor.js";
6
6
  import { HeldRunStatus } from "../../context/held-run-status.js";
7
7
  import { dashboardSealedEnvelopeSchema } from "./dashboard-sealed-write.js";
8
- import { StepConcurrencyKind, initFailureSchema, stateReplayRunSchema } from "./execution-status.js";
8
+ import { JobKind, StepConcurrencyKind, initFailureSchema, stateReplayRunSchema } from "./execution-status.js";
9
9
  import { agentRunResultSchema } from "./agent-run-result.js";
10
10
  import { kiciBundleSchema } from "../../provenance/bundle.js";
11
11
  import { dashboardAccessLogListRequestSchema, dashboardAccessLogListResponseSchema } from "./access-log.js";
@@ -126,6 +126,19 @@ const dashboardJobDetailSchema = z.object({
126
126
  variantKind: z.string().nullable().optional(),
127
127
  /** Fan-out label for a child: matrix suffix or hostname; null for non-fanned jobs. */
128
128
  variantLabel: z.string().nullable().optional(),
129
+ /**
130
+ * Job kind: `standard` runs steps on an agent, `gate` is an invoke gate, and
131
+ * `proxy` mirrors a summoned source-repo run. Absent/null for a standard job.
132
+ *
133
+ * OPTIONAL, and must stay optional: the wire protocol is compatibility-
134
+ * protected, so an orchestrator that predates invoke gates omits it.
135
+ */
136
+ jobKind: JobKind.nullable().optional(),
137
+ /**
138
+ * For a `proxy` job, the summoned source-repo run this job mirrors; the
139
+ * dashboard links the proxy node through to it. null/absent otherwise.
140
+ */
141
+ summonedRunId: z.string().nullable().optional(),
129
142
  startedAt: z.number().nullable(),
130
143
  completedAt: z.number().nullable(),
131
144
  durationMs: z.number().nullable(),
@@ -138,7 +151,7 @@ const dashboardJobDetailSchema = z.object({
138
151
  * a matching agent or scaler backend appears.
139
152
  *
140
153
  * OPTIONAL, and must stay optional: the wire protocol is compatibility-
141
- * protected, so an orchestrator that predates the unroutable probe simply
154
+ * protected, so an orchestrator that predates the unroutable probe
142
155
  * omits it.
143
156
  */
144
157
  routingReason: z.string().nullable().optional(),
@@ -157,8 +170,22 @@ const dashboardJobDetailSchema = z.object({
157
170
  skippedContexts: z.array(z.string()).nullable().optional(),
158
171
  /** User-visible warning naming the skipped test-run contexts. null/absent when none. */
159
172
  envWarning: z.string().nullable().optional(),
160
- /** Aggregated step outputs (step-keyed map). Present when job completed successfully with outputs. */
161
- outputs: z.record(z.string(), z.record(z.string(), z.unknown())).nullable().optional(),
173
+ /**
174
+ * A job's non-secret outputs. Present when the job completed successfully with
175
+ * outputs.
176
+ *
177
+ * The value is intentionally `z.record(z.string(), z.unknown())` — the same
178
+ * loose shape the wire (`job.status.data.outputs`) and `InvokeResult.outputs`
179
+ * use — because two job kinds populate it with two different shapes:
180
+ * - a **standard** job carries the agent's step-keyed map
181
+ * (`{ <stepName>: { <outputKey>: value } }`), so each value is itself a map;
182
+ * - a **proxy** job mirrors a summoned run, and a run's outputs are FLAT
183
+ * (`{ <outputKey>: value }`, values scalar), matching `InvokeResult.outputs`.
184
+ *
185
+ * A stricter step-keyed record type rejected the flat proxy shape and failed
186
+ * the whole run-detail response, so the schema accepts either.
187
+ */
188
+ outputs: z.record(z.string(), z.unknown()).nullable().optional(),
162
189
  /** Secret output key names produced by this job (values are NOT included -- display masked). */
163
190
  secretOutputKeys: z.array(z.string()).nullable().optional(),
164
191
  /**
@@ -2410,12 +2437,20 @@ const runEventSchema = z.object({
2410
2437
  spanId: z.string().nullable(),
2411
2438
  parentSpanId: z.string().nullable()
2412
2439
  });
2413
- /** Trust policy response (from trust_policies table). */
2440
+ /**
2441
+ * Trust policy response (from trust_policies table).
2442
+ *
2443
+ * `approvalExpirySeconds` is the authoritative window and `approvalExpiryHours`
2444
+ * its coarse, rounded-up view, so a client reading only the older field still
2445
+ * gets a usable number. Both are always sent by this build; the seconds field is
2446
+ * optional so a dashboard build reading an older Platform still parses.
2447
+ */
2414
2448
  const trustPolicyResponseSchema = z.object({
2415
2449
  forkPolicy: z.string(),
2416
2450
  unknownContributorPolicy: z.string(),
2417
2451
  workflowChangePolicy: z.string(),
2418
- approvalExpiryHours: z.number()
2452
+ approvalExpiryHours: z.number(),
2453
+ approvalExpirySeconds: z.number().optional()
2419
2454
  });
2420
2455
  /** Single identity link item. */
2421
2456
  const identityLinkItemSchema = z.object({
@@ -2448,6 +2483,20 @@ const orgMemberSchema = z.object({
2448
2483
  suspendedAt: z.coerce.string().nullable(),
2449
2484
  joinedAt: z.coerce.string(),
2450
2485
  ciTrustLevel: z.string(),
2486
+ /**
2487
+ * The per-member `ci_trust` override, when one is stored, or `null` when the
2488
+ * member's level is entirely role-derived.
2489
+ *
2490
+ * Carried beside `ciTrustLevel` rather than folded into it, because the two
2491
+ * answer different questions. `ciTrustLevel` is the effective level the CI
2492
+ * trust gate decides with — the role-derived level with any override applied
2493
+ * on top — so it cannot say which half produced it. An override OUTRANKS the
2494
+ * roles, so an org that lowered a member by override has no way to see that,
2495
+ * and no way to undo it, from a payload that reports only the result.
2496
+ *
2497
+ * Optional so an older client keeps parsing the response.
2498
+ */
2499
+ ciTrustOverride: z.string().nullable().optional(),
2451
2500
  identityLinks: z.array(memberIdentityLinkSchema)
2452
2501
  });
2453
2502
  /** Response for org members list endpoint. */
@@ -57,6 +57,18 @@ export declare const ExecutionJobStatus: z.ZodEnum<{
57
57
  unroutable: "unroutable";
58
58
  }>;
59
59
  export type ExecutionJobStatus = z.infer<typeof ExecutionJobStatus>;
60
+ /**
61
+ * Job kind on the wire. `standard` runs steps on an agent; `gate` is an invoke
62
+ * gate that summons source-repo runs instead of running steps; `proxy` mirrors
63
+ * one summoned run's lifecycle. The orchestrator's DB `JobKind` enum mirrors
64
+ * these members.
65
+ */
66
+ export declare const JobKind: z.ZodEnum<{
67
+ gate: "gate";
68
+ proxy: "proxy";
69
+ standard: "standard";
70
+ }>;
71
+ export type JobKind = z.infer<typeof JobKind>;
60
72
  /**
61
73
  * The status values a notification subscription may target at the given level.
62
74
  *
@@ -174,6 +186,28 @@ export declare const CacheStepType: z.ZodEnum<{
174
186
  "cache:save": "cache:save";
175
187
  }>;
176
188
  export type CacheStepType = z.infer<typeof CacheStepType>;
189
+ /**
190
+ * `step_type` values for pseudo-steps that run BEFORE a job's real steps.
191
+ *
192
+ * A run's step timeline is ordered by `step_index`, and every pseudo-step index
193
+ * sits ABOVE the real steps (the wire schema requires a non-negative index, and
194
+ * the in-sandbox allocators claim a high block). That is fine for the cache
195
+ * pseudo-steps, which mostly bracket the work — but a job's image build runs
196
+ * strictly first, and rendering it last reads as though it happened last.
197
+ *
198
+ * A reader therefore sorts these types ahead of everything else, by TYPE rather
199
+ * than by index. Keeping the ordering rule here — rather than as a negative
200
+ * index — is deliberate: `step.status` rejects a negative index outright, so an
201
+ * agent that sent one to an older orchestrator would have its connection closed
202
+ * mid-job, and two consumers (the check-run reporter's array write, the
203
+ * dashboard's `stepIndex >= 0` log gate) treat a negative index as absent.
204
+ */
205
+ export declare const SetupStepType: z.ZodEnum<{
206
+ "container:build": "container:build";
207
+ }>;
208
+ export type SetupStepType = z.infer<typeof SetupStepType>;
209
+ /** True when a `step_type` names a pseudo-step that ran before the real steps. */
210
+ export declare function isSetupStepType(stepType: string | null | undefined): boolean;
177
211
  /** `run.event` types emitted for user-facing cache operations. */
178
212
  export declare const CacheRunEventType: z.ZodEnum<{
179
213
  "cache.restore": "cache.restore";
@@ -265,6 +299,7 @@ export declare const executionStatusSchema: z.ZodObject<{
265
299
  routingKey: z.ZodOptional<z.ZodString>;
266
300
  repoIdentifier: z.ZodOptional<z.ZodString>;
267
301
  workflowRepoIdentifier: z.ZodOptional<z.ZodString>;
302
+ isGlobalEvalRound: z.ZodOptional<z.ZodBoolean>;
268
303
  repoProvider: z.ZodOptional<z.ZodString>;
269
304
  localWorkingTree: z.ZodOptional<z.ZodBoolean>;
270
305
  sha: z.ZodOptional<z.ZodString>;
@@ -394,6 +429,12 @@ export declare const jobStatusForwardSchema: z.ZodObject<{
394
429
  message: z.ZodString;
395
430
  jobName: z.ZodOptional<z.ZodString>;
396
431
  }, z.core.$strip>>;
432
+ jobKind: z.ZodOptional<z.ZodEnum<{
433
+ gate: "gate";
434
+ proxy: "proxy";
435
+ standard: "standard";
436
+ }>>;
437
+ summonedRunId: z.ZodOptional<z.ZodString>;
397
438
  }, z.core.$strip>;
398
439
  /** State replay sent on orchestrator reconnection -- full snapshot of active runs and jobs. */
399
440
  /**
@@ -58,6 +58,17 @@ const ExecutionJobStatus = z.enum([
58
58
  "unroutable"
59
59
  ]);
60
60
  /**
61
+ * Job kind on the wire. `standard` runs steps on an agent; `gate` is an invoke
62
+ * gate that summons source-repo runs instead of running steps; `proxy` mirrors
63
+ * one summoned run's lifecycle. The orchestrator's DB `JobKind` enum mirrors
64
+ * these members.
65
+ */
66
+ const JobKind = z.enum([
67
+ "standard",
68
+ "gate",
69
+ "proxy"
70
+ ]);
71
+ /**
61
72
  * The status values a notification subscription may target at the given level.
62
73
  *
63
74
  * A run-level subscription matches against an `ExecutionRunStatus`; a job-level
@@ -164,6 +175,27 @@ const RunFailureClass = z.enum([
164
175
  * dashboard can render it inline alongside the real steps.
165
176
  */
166
177
  const CacheStepType = z.enum(["cache:restore", "cache:save"]);
178
+ /**
179
+ * `step_type` values for pseudo-steps that run BEFORE a job's real steps.
180
+ *
181
+ * A run's step timeline is ordered by `step_index`, and every pseudo-step index
182
+ * sits ABOVE the real steps (the wire schema requires a non-negative index, and
183
+ * the in-sandbox allocators claim a high block). That is fine for the cache
184
+ * pseudo-steps, which mostly bracket the work — but a job's image build runs
185
+ * strictly first, and rendering it last reads as though it happened last.
186
+ *
187
+ * A reader therefore sorts these types ahead of everything else, by TYPE rather
188
+ * than by index. Keeping the ordering rule here — rather than as a negative
189
+ * index — is deliberate: `step.status` rejects a negative index outright, so an
190
+ * agent that sent one to an older orchestrator would have its connection closed
191
+ * mid-job, and two consumers (the check-run reporter's array write, the
192
+ * dashboard's `stepIndex >= 0` log gate) treat a negative index as absent.
193
+ */
194
+ const SetupStepType = z.enum(["container:build"]);
195
+ /** True when a `step_type` names a pseudo-step that ran before the real steps. */
196
+ function isSetupStepType(stepType) {
197
+ return stepType != null && SetupStepType.safeParse(stepType).success;
198
+ }
167
199
  /** `run.event` types emitted for user-facing cache operations. */
168
200
  const CacheRunEventType = z.enum(["cache.restore", "cache.save"]);
169
201
  /**
@@ -248,6 +280,17 @@ const executionStatusSchema = z.object({
248
280
  */
249
281
  workflowRepoIdentifier: z.string().max(256).optional(),
250
282
  /**
283
+ * True when this run records a global evaluation round rather than a
284
+ * workflow.
285
+ *
286
+ * The Platform mirrors it so its own re-run refusal can admit a round: a
287
+ * round is definitionally cross-repository, and re-running one re-evaluates
288
+ * the original event instead of resolving a workflow out of the acted-on
289
+ * repository's lock file. Absent means an ordinary run — optional for
290
+ * backward compatibility with an orchestrator that never sends it.
291
+ */
292
+ isGlobalEvalRound: z.boolean().optional(),
293
+ /**
251
294
  * Run-level repo provider (origin host: `github` / `gitlab` / `bitbucket` /
252
295
  * `local`). Distinct from the routing-key-derived source provider; drives the
253
296
  * dashboard's provider-aware repo links.
@@ -351,7 +394,15 @@ const jobStatusForwardSchema = z.object({
351
394
  logBytes: z.number().int().nonnegative().optional(),
352
395
  timestamp: z.number(),
353
396
  /** Structured init-failure signal — set for synthetic rejected-* / init-failed-* jobs. */
354
- initFailure: initFailureSchema.optional()
397
+ initFailure: initFailureSchema.optional(),
398
+ /**
399
+ * Job kind. Absent means an ordinary `standard` job. `gate`/`proxy` mark an
400
+ * invoke gate and its per-run proxy children. Additive/optional — an older
401
+ * peer ignores it.
402
+ */
403
+ jobKind: JobKind.optional(),
404
+ /** For a `proxy` job, the summoned run it mirrors. Additive/optional. */
405
+ summonedRunId: z.string().max(128).optional()
355
406
  });
356
407
  /** State replay sent on orchestrator reconnection -- full snapshot of active runs and jobs. */
357
408
  /**
@@ -411,6 +462,6 @@ const stateReplaySchema = z.object({
411
462
  timestamp: z.number()
412
463
  });
413
464
  //#endregion
414
- export { CONTEXTS_MAX, CacheOutcome, CacheRunEventType, CacheStepType, DEAD_ORCH_FAILURE_REASON, ExecutionJobStatus, ExecutionRunStatus, ExecutionStepStatus, InitFailureCategory, MAX_JOBS_PER_RUN, REPO_IDENTIFIER_MAX, RUNS_ON_LABELS_MAX, RunFailureClass, STATE_REPLAY_MAX_RUNS, STATUS_FREE_TEXT_MAX, STATUS_ID_MAX, StepConcurrencyKind, TERMINAL_JOB_STATES, TERMINAL_RUN_STATES, TERMINAL_STEP_STATES, TimeoutReason, executionStatusSchema, initFailureSchema, jobStatusForwardSchema, stateReplayRunSchema, stateReplaySchema, statusOptionsForLevel, stepStatusForwardSchema };
465
+ export { CONTEXTS_MAX, CacheOutcome, CacheRunEventType, CacheStepType, DEAD_ORCH_FAILURE_REASON, ExecutionJobStatus, ExecutionRunStatus, ExecutionStepStatus, InitFailureCategory, JobKind, MAX_JOBS_PER_RUN, REPO_IDENTIFIER_MAX, RUNS_ON_LABELS_MAX, RunFailureClass, STATE_REPLAY_MAX_RUNS, STATUS_FREE_TEXT_MAX, STATUS_ID_MAX, SetupStepType, StepConcurrencyKind, TERMINAL_JOB_STATES, TERMINAL_RUN_STATES, TERMINAL_STEP_STATES, TimeoutReason, executionStatusSchema, initFailureSchema, isSetupStepType, jobStatusForwardSchema, stateReplayRunSchema, stateReplaySchema, statusOptionsForLevel, stepStatusForwardSchema };
415
466
 
416
467
  //# sourceMappingURL=execution-status.js.map
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Agent → orchestrator relay for git credentials.
3
+ *
4
+ * The agent's credential helper calls this on every git network operation, so
5
+ * a token is always minted seconds before use — which is what defeats the
6
+ * one-hour GitHub App installation-token expiry for arbitrarily long jobs.
7
+ *
8
+ * Mirrors the browser-safe types in `provider/git-credential.ts`; this module
9
+ * is the validating half and is the only one that imports Zod.
10
+ */
11
+ import { z } from 'zod';
12
+ /** Method name on the agent private API registry. */
13
+ export declare const GIT_CREDENTIAL_REQUEST_METHOD = "git.credential.request";
14
+ export declare const gitCredentialRefSchema: z.ZodUnion<readonly [z.ZodIntersection<z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
15
+ kind: z.ZodLiteral<"app">;
16
+ }, z.core.$strip>, z.ZodObject<{
17
+ [x: string]: z.ZodOptional<z.ZodString>;
18
+ }, z.core.$strip>>, z.ZodObject<{
19
+ [x: string]: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strip>>, z.ZodObject<{
21
+ [x: string]: z.ZodOptional<z.ZodString>;
22
+ }, z.core.$strip>>, z.ZodIntersection<z.ZodObject<{
23
+ kind: z.ZodLiteral<"token">;
24
+ user: z.ZodOptional<z.ZodString>;
25
+ }, z.core.$strip>, z.ZodObject<{
26
+ [x: string]: z.ZodOptional<z.ZodString>;
27
+ }, z.core.$strip>>, z.ZodIntersection<z.ZodObject<{
28
+ kind: z.ZodLiteral<"ssh">;
29
+ }, z.core.$strip>, z.ZodObject<{
30
+ [x: string]: z.ZodOptional<z.ZodString>;
31
+ }, z.core.$strip>>]>;
32
+ export declare const gitCredentialRequestParamsSchema: z.ZodObject<{
33
+ jobId: z.ZodString;
34
+ repositories: z.ZodArray<z.ZodString>;
35
+ ref: z.ZodOptional<z.ZodUnion<readonly [z.ZodIntersection<z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
36
+ kind: z.ZodLiteral<"app">;
37
+ }, z.core.$strip>, z.ZodObject<{
38
+ [x: string]: z.ZodOptional<z.ZodString>;
39
+ }, z.core.$strip>>, z.ZodObject<{
40
+ [x: string]: z.ZodOptional<z.ZodString>;
41
+ }, z.core.$strip>>, z.ZodObject<{
42
+ [x: string]: z.ZodOptional<z.ZodString>;
43
+ }, z.core.$strip>>, z.ZodIntersection<z.ZodObject<{
44
+ kind: z.ZodLiteral<"token">;
45
+ user: z.ZodOptional<z.ZodString>;
46
+ }, z.core.$strip>, z.ZodObject<{
47
+ [x: string]: z.ZodOptional<z.ZodString>;
48
+ }, z.core.$strip>>, z.ZodIntersection<z.ZodObject<{
49
+ kind: z.ZodLiteral<"ssh">;
50
+ }, z.core.$strip>, z.ZodObject<{
51
+ [x: string]: z.ZodOptional<z.ZodString>;
52
+ }, z.core.$strip>>]>>;
53
+ permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
54
+ }, z.core.$strip>;
55
+ export type GitCredentialRequestParams = z.infer<typeof gitCredentialRequestParamsSchema>;
56
+ export declare const gitCredentialGrantSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
57
+ scoped: z.ZodLiteral<false>;
58
+ }, z.core.$strip>, z.ZodObject<{
59
+ scoped: z.ZodLiteral<true>;
60
+ permissions: z.ZodRecord<z.ZodString, z.ZodString>;
61
+ }, z.core.$strip>], "scoped">;
62
+ export declare const gitCredentialResultSchema: z.ZodObject<{
63
+ kind: z.ZodEnum<{
64
+ basic: "basic";
65
+ ssh: "ssh";
66
+ }>;
67
+ user: z.ZodOptional<z.ZodString>;
68
+ secret: z.ZodString;
69
+ grant: z.ZodDiscriminatedUnion<[z.ZodObject<{
70
+ scoped: z.ZodLiteral<false>;
71
+ }, z.core.$strip>, z.ZodObject<{
72
+ scoped: z.ZodLiteral<true>;
73
+ permissions: z.ZodRecord<z.ZodString, z.ZodString>;
74
+ }, z.core.$strip>], "scoped">;
75
+ expiresAt: z.ZodNullable<z.ZodString>;
76
+ }, z.core.$strip>;
77
+ export type GitCredentialRelayResult = z.infer<typeof gitCredentialResultSchema>;
78
+ //# sourceMappingURL=git-credential-relay.d.ts.map
@@ -0,0 +1,86 @@
1
+ import "../../rolldown-runtime-ClRpJifh.js";
2
+ import { z } from "zod";
3
+ //#region src/protocol/messages/git-credential-relay.ts
4
+ /**
5
+ * Agent → orchestrator relay for git credentials.
6
+ *
7
+ * The agent's credential helper calls this on every git network operation, so
8
+ * a token is always minted seconds before use — which is what defeats the
9
+ * one-hour GitHub App installation-token expiry for arbitrarily long jobs.
10
+ *
11
+ * Mirrors the browser-safe types in `provider/git-credential.ts`; this module
12
+ * is the validating half and is the only one that imports Zod.
13
+ */
14
+ /** Method name on the agent private API registry. */
15
+ const GIT_CREDENTIAL_REQUEST_METHOD = "git.credential.request";
16
+ /**
17
+ * A repository must be named explicitly — no wildcards, no "every repo in the
18
+ * installation". A write grant is therefore always a specific repository
19
+ * written down in the workflow source and reviewable in a diff.
20
+ */
21
+ const repositorySchema = z.string().min(1).max(512).refine((v) => !v.includes("*") && !v.includes("?"), { message: "repository must be explicit — wildcards are not accepted" });
22
+ /**
23
+ * Requested permissions.
24
+ *
25
+ * Deliberate carve-out from the enums-over-hardcoded-strings rule: GitHub adds
26
+ * permissions over time, and a closed enum would mean a permission GitHub
27
+ * shipped yesterday needs an SDK release before anyone can use it. Known keys
28
+ * are typed in the SDK for autocomplete; here they pass through verbatim for
29
+ * the forge itself to accept or reject.
30
+ */
31
+ const permissionsSchema = z.record(z.string().min(1), z.string().min(1));
32
+ /**
33
+ * Exactly one of `<name>Secret` / `<name>Value` per pair.
34
+ *
35
+ * `*Secret` is a qualified `<context>:<secret-name>` reference — the same form
36
+ * `packages/sdk/src/workflow.ts` validates with `isQualifiedSecretRef` — so the
37
+ * context travels with the reference and nothing has to infer a scope.
38
+ * `*Value` is material supplied at runtime.
39
+ */
40
+ function sourced(name) {
41
+ const qualified = z.string().min(1).refine((v) => {
42
+ const i = v.indexOf(":");
43
+ return i > 0 && i < v.length - 1 && !v.slice(i + 1).includes(":");
44
+ }, { message: `${name}Secret must be a qualified <context>:<secret-name> reference` }).refine((v) => !v.startsWith("-----BEGIN") && !/^gh[pousr]_/.test(v) && !v.startsWith("github_pat_"), { message: `${name}Secret looks like the credential itself, not the name of a secret holding it. Use ${name}Value if you genuinely have runtime material.` });
45
+ return z.object({
46
+ [`${name}Secret`]: qualified.optional(),
47
+ [`${name}Value`]: z.string().min(1).optional()
48
+ }).refine((o) => Boolean(o[`${name}Secret`]) !== Boolean(o[`${name}Value`]), { message: `exactly one of ${name}Secret or ${name}Value must be set` });
49
+ }
50
+ const gitCredentialRefSchema = z.union([
51
+ z.object({ kind: z.literal("app") }).and(sourced("appId")).and(sourced("installationId")).and(sourced("privateKey")),
52
+ z.object({
53
+ kind: z.literal("token"),
54
+ user: z.string().optional()
55
+ }).and(sourced("token")),
56
+ z.object({ kind: z.literal("ssh") }).and(sourced("privateKey"))
57
+ ]);
58
+ const gitCredentialRequestParamsSchema = z.object({
59
+ jobId: z.string().min(1),
60
+ /**
61
+ * Every repository the credential must cover, most-specific first.
62
+ *
63
+ * A list rather than one name because a GitHub App token is minted per
64
+ * installation and can name several repositories at once — which is the
65
+ * point of `getToken({ repositories })`. The credential helper, which is
66
+ * asked about one URL at a time, sends a one-element list.
67
+ */
68
+ repositories: z.array(repositorySchema).min(1),
69
+ ref: gitCredentialRefSchema.optional(),
70
+ permissions: permissionsSchema.optional()
71
+ });
72
+ const gitCredentialGrantSchema = z.discriminatedUnion("scoped", [z.object({ scoped: z.literal(false) }), z.object({
73
+ scoped: z.literal(true),
74
+ permissions: permissionsSchema
75
+ })]);
76
+ const gitCredentialResultSchema = z.object({
77
+ kind: z.enum(["basic", "ssh"]),
78
+ user: z.string().optional(),
79
+ secret: z.string(),
80
+ grant: gitCredentialGrantSchema,
81
+ expiresAt: z.string().nullable()
82
+ });
83
+ //#endregion
84
+ export { GIT_CREDENTIAL_REQUEST_METHOD, gitCredentialGrantSchema, gitCredentialRefSchema, gitCredentialRequestParamsSchema, gitCredentialResultSchema };
85
+
86
+ //# sourceMappingURL=git-credential-relay.js.map