@kici-dev/engine 0.5.0 → 0.6.1

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 +46 -5
  31. package/dist/protocol/messages/dashboard.js +67 -7
  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
  }>;
@@ -3861,6 +3874,7 @@ export declare const registrationItemSchema: z.ZodObject<{
3861
3874
  }>>;
3862
3875
  provider: z.ZodString;
3863
3876
  }, z.core.$strip>>>;
3877
+ isGlobal: z.ZodOptional<z.ZodBoolean>;
3864
3878
  }, z.core.$strip>;
3865
3879
  /** Response with workflow registrations. */
3866
3880
  export declare const registrationsListResponseSchema: z.ZodObject<{
@@ -3891,6 +3905,7 @@ export declare const registrationsListResponseSchema: z.ZodObject<{
3891
3905
  }>>;
3892
3906
  provider: z.ZodString;
3893
3907
  }, z.core.$strip>>>;
3908
+ isGlobal: z.ZodOptional<z.ZodBoolean>;
3894
3909
  }, z.core.$strip>>>;
3895
3910
  registryVersion: z.ZodNumber;
3896
3911
  registryUpdatedAt: z.ZodString;
@@ -6746,6 +6761,7 @@ export declare const dashboardPlatformToOrchSchema: z.ZodDiscriminatedUnion<[z.Z
6746
6761
  "source_override.set": "source_override.set";
6747
6762
  "sources.list.read": "sources.list.read";
6748
6763
  "step.logs.read": "step.logs.read";
6764
+ "trust_directory.updated": "trust_directory.updated";
6749
6765
  "trust_policy.updated": "trust_policy.updated";
6750
6766
  }>>;
6751
6767
  source: z.ZodOptional<z.ZodEnum<{
@@ -7001,6 +7017,12 @@ export declare const dashboardOrchToPlatformSchema: z.ZodDiscriminatedUnion<[z.Z
7001
7017
  baseJobName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7002
7018
  variantKind: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7003
7019
  variantLabel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7020
+ jobKind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
7021
+ gate: "gate";
7022
+ proxy: "proxy";
7023
+ standard: "standard";
7024
+ }>>>;
7025
+ summonedRunId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7004
7026
  startedAt: z.ZodNullable<z.ZodNumber>;
7005
7027
  completedAt: z.ZodNullable<z.ZodNumber>;
7006
7028
  durationMs: z.ZodNullable<z.ZodNumber>;
@@ -7012,7 +7034,7 @@ export declare const dashboardOrchToPlatformSchema: z.ZodDiscriminatedUnion<[z.Z
7012
7034
  contexts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
7013
7035
  skippedContexts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
7014
7036
  envWarning: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7015
- outputs: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
7037
+ outputs: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
7016
7038
  secretOutputKeys: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
7017
7039
  initFailure: z.ZodOptional<z.ZodObject<{
7018
7040
  scope: z.ZodEnum<{
@@ -7831,6 +7853,7 @@ export declare const dashboardOrchToPlatformSchema: z.ZodDiscriminatedUnion<[z.Z
7831
7853
  }>>;
7832
7854
  provider: z.ZodString;
7833
7855
  }, z.core.$strip>>>;
7856
+ isGlobal: z.ZodOptional<z.ZodBoolean>;
7834
7857
  }, z.core.$strip>>>;
7835
7858
  registryVersion: z.ZodNumber;
7836
7859
  registryUpdatedAt: z.ZodString;
@@ -7909,6 +7932,7 @@ export declare const dashboardOrchToPlatformSchema: z.ZodDiscriminatedUnion<[z.Z
7909
7932
  type: z.ZodEnum<{
7910
7933
  "bare-metal": "bare-metal";
7911
7934
  container: "container";
7935
+ event: "event";
7912
7936
  firecracker: "firecracker";
7913
7937
  kubernetes: "kubernetes";
7914
7938
  }>;
@@ -8467,6 +8491,7 @@ export declare const dashboardOrchToPlatformSchema: z.ZodDiscriminatedUnion<[z.Z
8467
8491
  "source_override.set": "source_override.set";
8468
8492
  "sources.list.read": "sources.list.read";
8469
8493
  "step.logs.read": "step.logs.read";
8494
+ "trust_directory.updated": "trust_directory.updated";
8470
8495
  "trust_policy.updated": "trust_policy.updated";
8471
8496
  }>;
8472
8497
  targetType: z.ZodNullable<z.ZodEnum<{
@@ -8636,6 +8661,12 @@ export declare const dashboardRunDetailApiResponseSchema: z.ZodObject<{
8636
8661
  baseJobName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8637
8662
  variantKind: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8638
8663
  variantLabel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8664
+ jobKind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
8665
+ gate: "gate";
8666
+ proxy: "proxy";
8667
+ standard: "standard";
8668
+ }>>>;
8669
+ summonedRunId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8639
8670
  startedAt: z.ZodNullable<z.ZodNumber>;
8640
8671
  completedAt: z.ZodNullable<z.ZodNumber>;
8641
8672
  durationMs: z.ZodNullable<z.ZodNumber>;
@@ -8647,7 +8678,7 @@ export declare const dashboardRunDetailApiResponseSchema: z.ZodObject<{
8647
8678
  contexts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
8648
8679
  skippedContexts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
8649
8680
  envWarning: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8650
- outputs: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
8681
+ outputs: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
8651
8682
  secretOutputKeys: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
8652
8683
  initFailure: z.ZodOptional<z.ZodObject<{
8653
8684
  scope: z.ZodEnum<{
@@ -9206,12 +9237,20 @@ export declare const runEventSchema: z.ZodObject<{
9206
9237
  parentSpanId: z.ZodNullable<z.ZodString>;
9207
9238
  }, z.core.$strip>;
9208
9239
  export type RunEvent = z.infer<typeof runEventSchema>;
9209
- /** Trust policy response (from trust_policies table). */
9240
+ /**
9241
+ * Trust policy response (from trust_policies table).
9242
+ *
9243
+ * `approvalExpirySeconds` is the authoritative window and `approvalExpiryHours`
9244
+ * its coarse, rounded-up view, so a client reading only the older field still
9245
+ * gets a usable number. Both are always sent by this build; the seconds field is
9246
+ * optional so a dashboard build reading an older Platform still parses.
9247
+ */
9210
9248
  export declare const trustPolicyResponseSchema: z.ZodObject<{
9211
9249
  forkPolicy: z.ZodString;
9212
9250
  unknownContributorPolicy: z.ZodString;
9213
9251
  workflowChangePolicy: z.ZodString;
9214
9252
  approvalExpiryHours: z.ZodNumber;
9253
+ approvalExpirySeconds: z.ZodOptional<z.ZodNumber>;
9215
9254
  }, z.core.$strip>;
9216
9255
  export type TrustPolicy = z.infer<typeof trustPolicyResponseSchema>;
9217
9256
  /** Single identity link item. */
@@ -9259,6 +9298,7 @@ export declare const orgMemberSchema: z.ZodObject<{
9259
9298
  suspendedAt: z.ZodNullable<z.ZodCoercedString<unknown>>;
9260
9299
  joinedAt: z.ZodCoercedString<unknown>;
9261
9300
  ciTrustLevel: z.ZodString;
9301
+ ciTrustOverride: z.ZodOptional<z.ZodNullable<z.ZodString>>;
9262
9302
  identityLinks: z.ZodArray<z.ZodObject<{
9263
9303
  provider: z.ZodString;
9264
9304
  providerUsername: z.ZodString;
@@ -9279,6 +9319,7 @@ export declare const memberListResponseSchema: z.ZodObject<{
9279
9319
  suspendedAt: z.ZodNullable<z.ZodCoercedString<unknown>>;
9280
9320
  joinedAt: z.ZodCoercedString<unknown>;
9281
9321
  ciTrustLevel: z.ZodString;
9322
+ ciTrustOverride: z.ZodOptional<z.ZodNullable<z.ZodString>>;
9282
9323
  identityLinks: z.ZodArray<z.ZodObject<{
9283
9324
  provider: z.ZodString;
9284
9325
  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
  /**
@@ -1760,7 +1787,18 @@ const registrationItemSchema = z.object({
1760
1787
  * (legacy / global-workflow rows). Mirrors the shape attached to run
1761
1788
  * summaries so the dashboard can reuse the same icon/label helpers.
1762
1789
  */
1763
- source: registrationSourceSchema.nullable().optional()
1790
+ source: registrationSourceSchema.nullable().optional(),
1791
+ /**
1792
+ * True when this registration is a global workflow — one whose trigger
1793
+ * carries `repos:`, so it fires on events from other repos in the org.
1794
+ *
1795
+ * Optional because an orchestrator predating this field omits it. A reader
1796
+ * that needs a value for such a row derives one from `triggers[].repos`,
1797
+ * which is the same signal the orchestrator classifies on at registration
1798
+ * time. Prefer this field when present: it mirrors the `is_global` column
1799
+ * the dispatcher itself reads, so it cannot drift from dispatch behaviour.
1800
+ */
1801
+ isGlobal: z.boolean().optional()
1764
1802
  });
1765
1803
  /** Response with workflow registrations. */
1766
1804
  const registrationsListResponseSchema = z.object({
@@ -2410,12 +2448,20 @@ const runEventSchema = z.object({
2410
2448
  spanId: z.string().nullable(),
2411
2449
  parentSpanId: z.string().nullable()
2412
2450
  });
2413
- /** Trust policy response (from trust_policies table). */
2451
+ /**
2452
+ * Trust policy response (from trust_policies table).
2453
+ *
2454
+ * `approvalExpirySeconds` is the authoritative window and `approvalExpiryHours`
2455
+ * its coarse, rounded-up view, so a client reading only the older field still
2456
+ * gets a usable number. Both are always sent by this build; the seconds field is
2457
+ * optional so a dashboard build reading an older Platform still parses.
2458
+ */
2414
2459
  const trustPolicyResponseSchema = z.object({
2415
2460
  forkPolicy: z.string(),
2416
2461
  unknownContributorPolicy: z.string(),
2417
2462
  workflowChangePolicy: z.string(),
2418
- approvalExpiryHours: z.number()
2463
+ approvalExpiryHours: z.number(),
2464
+ approvalExpirySeconds: z.number().optional()
2419
2465
  });
2420
2466
  /** Single identity link item. */
2421
2467
  const identityLinkItemSchema = z.object({
@@ -2448,6 +2494,20 @@ const orgMemberSchema = z.object({
2448
2494
  suspendedAt: z.coerce.string().nullable(),
2449
2495
  joinedAt: z.coerce.string(),
2450
2496
  ciTrustLevel: z.string(),
2497
+ /**
2498
+ * The per-member `ci_trust` override, when one is stored, or `null` when the
2499
+ * member's level is entirely role-derived.
2500
+ *
2501
+ * Carried beside `ciTrustLevel` rather than folded into it, because the two
2502
+ * answer different questions. `ciTrustLevel` is the effective level the CI
2503
+ * trust gate decides with — the role-derived level with any override applied
2504
+ * on top — so it cannot say which half produced it. An override OUTRANKS the
2505
+ * roles, so an org that lowered a member by override has no way to see that,
2506
+ * and no way to undo it, from a payload that reports only the result.
2507
+ *
2508
+ * Optional so an older client keeps parsing the response.
2509
+ */
2510
+ ciTrustOverride: z.string().nullable().optional(),
2451
2511
  identityLinks: z.array(memberIdentityLinkSchema)
2452
2512
  });
2453
2513
  /** 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