@kici-dev/engine 0.1.21 → 0.1.22

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.
@@ -2,6 +2,7 @@ import "../../chunk-BTugEXQM.js";
2
2
  import { CheckMode, CheckStepOutcome } from "../../check-mode.js";
3
3
  import { actorPrincipalSchema } from "./actor.js";
4
4
  import { initFailureSchema } from "./execution-status.js";
5
+ import { DeploymentContainerRuntimeSchema, DeploymentModeSchema } from "./deployment-identity.js";
5
6
  import { SourceSubtype } from "./source-registration.js";
6
7
  import { kiciBundleSchema } from "../../provenance/bundle.js";
7
8
  import { dashboardAccessLogListRequestSchema, dashboardAccessLogListResponseSchema } from "./access-log.js";
@@ -9,7 +10,9 @@ import { dashboardOrchLogsRequestSchema, dashboardOrchLogsResponseSchema } from
9
10
  import { EventLogSource, EventLogStatus, PayloadOmittedReason } from "./event-log.js";
10
11
  import { ScalerBackendType } from "../../scaler/scaler-backend-type.js";
11
12
  import { ApprovalDecision, HoldScope, approverClauseSchema } from "../../approval/types.js";
12
- import { IfFailedPolicy } from "../../trigger/types.js";
13
+ import { NeedsRunOn, OnUnreachableMode } from "../../trigger/types.js";
14
+ import { HostTargetSelector } from "../../labels-match.js";
15
+ import { HostInventoryEntry } from "../../inventory.js";
13
16
  import { globalWorkflowsGetRequestSchema, globalWorkflowsGetResponseSchema, globalWorkflowsUpdateRequestSchema, globalWorkflowsUpdateResponseSchema } from "./dashboard-global-workflows.js";
14
17
  import { z } from "zod";
15
18
  //#region src/protocol/messages/dashboard.ts
@@ -80,12 +83,13 @@ const dashboardJobDetailSchema = z.object({
80
83
  /**
81
84
  * Upstream dependency edges for this job (one entry per `needs` declaration),
82
85
  * resolved by the orchestrator from execution_job_needs. `upstreamName` is the
83
- * upstream job name; `ifFailed` is the per-edge failure policy. null/absent when
84
- * the job has no upstreams.
86
+ * upstream job name; `runOn` is the per-edge run-on status-set (the upstream
87
+ * terminal statuses that satisfy the edge). null/absent when the job has no
88
+ * upstreams.
85
89
  */
86
90
  needs: z.array(z.object({
87
91
  upstreamName: z.string(),
88
- ifFailed: IfFailedPolicy
92
+ runOn: NeedsRunOn
89
93
  })).nullable().optional(),
90
94
  steps: z.array(dashboardStepDetailSchema)
91
95
  });
@@ -990,6 +994,10 @@ const heldRunsListResponseSchema = z.object({
990
994
  clauses: z.array(approverClauseSchema),
991
995
  reason: z.string().nullable().optional()
992
996
  }).nullable().optional(),
997
+ payload: z.object({
998
+ summaryMarkdown: z.string(),
999
+ drift: z.unknown()
1000
+ }).nullable().optional(),
993
1001
  decisions: z.array(z.object({
994
1002
  approverUserId: z.string(),
995
1003
  decision: ApprovalDecision,
@@ -1004,7 +1012,14 @@ const heldRunApproveRequestSchema = z.object({
1004
1012
  type: z.literal("dashboard.held-runs.approve"),
1005
1013
  requestId: z.string(),
1006
1014
  actor: actorPrincipalSchema,
1007
- heldRunId: z.string()
1015
+ heldRunId: z.string(),
1016
+ /**
1017
+ * Set by the `kici run --approve-all` breakglass: the approval was issued by
1018
+ * the run's own dispatcher auto-approving every gate of that run. Eligibility
1019
+ * is still enforced (this only changes the audit action to
1020
+ * `held_run.auto_approve`); it is never a bypass.
1021
+ */
1022
+ autoApprove: z.boolean().optional()
1008
1023
  });
1009
1024
  const heldRunApproveResponseSchema = z.object({
1010
1025
  type: z.literal("dashboard.held-runs.approve.response"),
@@ -1032,6 +1047,90 @@ const dashboardDiagnosticsRequestSchema = z.object({
1032
1047
  /** When false or omitted, agents[] is empty and aggregate fields are populated instead. */
1033
1048
  includeAgents: z.boolean().optional()
1034
1049
  });
1050
+ /** A run pinned to a host, for the host-detail "recent runs" list. */
1051
+ const fleetPinnedRunSchema = z.object({
1052
+ runId: z.string(),
1053
+ workflowName: z.string().nullable(),
1054
+ status: z.string(),
1055
+ createdAt: z.string()
1056
+ });
1057
+ /** A host matched by a runsOnAll preview, plus how the fan-out would treat it. */
1058
+ const fleetPreviewHostSchema = z.object({
1059
+ entry: HostInventoryEntry,
1060
+ disposition: z.enum([
1061
+ "target",
1062
+ "unreachable-durable",
1063
+ "skipped-ephemeral"
1064
+ ])
1065
+ });
1066
+ const dashboardFleetHostsRequestSchema = z.object({
1067
+ type: z.literal("dashboard.fleet.hosts"),
1068
+ requestId: z.string(),
1069
+ actor: actorPrincipalSchema
1070
+ });
1071
+ const dashboardFleetHostRequestSchema = z.object({
1072
+ type: z.literal("dashboard.fleet.host"),
1073
+ requestId: z.string(),
1074
+ actor: actorPrincipalSchema,
1075
+ agentId: z.string()
1076
+ });
1077
+ const dashboardFleetPreviewRequestSchema = z.object({
1078
+ type: z.literal("dashboard.fleet.preview"),
1079
+ requestId: z.string(),
1080
+ actor: actorPrincipalSchema,
1081
+ workflowName: z.string()
1082
+ });
1083
+ const dashboardFleetHostsResponseSchema = z.object({
1084
+ type: z.literal("dashboard.fleet.hosts.response"),
1085
+ requestId: z.string(),
1086
+ hosts: z.array(HostInventoryEntry)
1087
+ });
1088
+ const dashboardFleetHostResponseSchema = z.object({
1089
+ type: z.literal("dashboard.fleet.host.response"),
1090
+ requestId: z.string(),
1091
+ host: HostInventoryEntry.nullable(),
1092
+ runs: z.array(fleetPinnedRunSchema)
1093
+ });
1094
+ const dashboardFleetPreviewResponseSchema = z.object({
1095
+ type: z.literal("dashboard.fleet.preview.response"),
1096
+ requestId: z.string(),
1097
+ matched: z.array(fleetPreviewHostSchema),
1098
+ onUnreachable: OnUnreachableMode,
1099
+ estimatedChildCount: z.number()
1100
+ });
1101
+ /** Declare a static host into the roster (wraps HostRosterStore.declareStatic). */
1102
+ const fleetHostDeclareRequestSchema = z.object({
1103
+ type: z.literal("dashboard.fleet.host.declare"),
1104
+ requestId: z.string(),
1105
+ actor: actorPrincipalSchema,
1106
+ agentId: z.string(),
1107
+ labels: z.array(z.string()),
1108
+ hostname: z.string().optional(),
1109
+ properties: z.record(z.string(), z.union([
1110
+ z.string(),
1111
+ z.number(),
1112
+ z.boolean()
1113
+ ])).optional()
1114
+ });
1115
+ const fleetHostDeclareResponseSchema = z.object({
1116
+ type: z.literal("dashboard.fleet.host.declare.response"),
1117
+ requestId: z.string(),
1118
+ declared: z.boolean().optional(),
1119
+ error: z.string().optional()
1120
+ });
1121
+ /** Remove a host from the roster by agent id (HostRosterStore.removeStatic). */
1122
+ const fleetHostRemoveRequestSchema = z.object({
1123
+ type: z.literal("dashboard.fleet.host.remove"),
1124
+ requestId: z.string(),
1125
+ actor: actorPrincipalSchema,
1126
+ agentId: z.string()
1127
+ });
1128
+ const fleetHostRemoveResponseSchema = z.object({
1129
+ type: z.literal("dashboard.fleet.host.remove.response"),
1130
+ requestId: z.string(),
1131
+ removed: z.boolean().optional(),
1132
+ error: z.string().optional()
1133
+ });
1035
1134
  /** Agent info within the diagnostics response. */
1036
1135
  const diagnosticsAgentSchema = z.object({
1037
1136
  agentId: z.string(),
@@ -1431,6 +1530,11 @@ const testRelayTriggerRequestSchema = z.object({
1431
1530
  fullRepo: z.boolean().optional(),
1432
1531
  /** Run mode for idempotent steps; relayed onto the dispatch event. Omitted = apply. */
1433
1532
  checkMode: CheckMode.optional(),
1533
+ /**
1534
+ * Runtime host narrowing from `kici run --target`. Intersects each runsOnAll
1535
+ * job's matched roster with this selector. Omitted for webhook runs.
1536
+ */
1537
+ target: HostTargetSelector.optional(),
1434
1538
  secrets: z.record(z.string(), z.string()).optional(),
1435
1539
  encryptedSecrets: z.string().optional(),
1436
1540
  encryptedSecretsKey: z.string().optional()
@@ -1541,6 +1645,11 @@ const dashboardPlatformToOrchSchema = z.discriminatedUnion("type", [
1541
1645
  registrationDisableRequestSchema,
1542
1646
  registrationDeleteRequestSchema,
1543
1647
  dashboardDiagnosticsRequestSchema,
1648
+ dashboardFleetHostsRequestSchema,
1649
+ dashboardFleetHostRequestSchema,
1650
+ dashboardFleetPreviewRequestSchema,
1651
+ fleetHostDeclareRequestSchema,
1652
+ fleetHostRemoveRequestSchema,
1544
1653
  dashboardScalerCapacityRequestSchema,
1545
1654
  dashboardScalerAgentsRequestSchema,
1546
1655
  backendsListRequestSchema,
@@ -1605,6 +1714,11 @@ const dashboardOrchToPlatformSchema = z.discriminatedUnion("type", [
1605
1714
  registrationDisableResponseSchema,
1606
1715
  registrationDeleteResponseSchema,
1607
1716
  dashboardDiagnosticsResponseSchema,
1717
+ dashboardFleetHostsResponseSchema,
1718
+ dashboardFleetHostResponseSchema,
1719
+ dashboardFleetPreviewResponseSchema,
1720
+ fleetHostDeclareResponseSchema,
1721
+ fleetHostRemoveResponseSchema,
1608
1722
  dashboardScalerCapacityResponseSchema,
1609
1723
  dashboardScalerAgentsResponseSchema,
1610
1724
  backendsListResponseSchema,
@@ -1755,6 +1869,16 @@ const diagnosticsInfraOrchestratorSchema = z.object({
1755
1869
  raftTerm: z.number().nullable().optional(),
1756
1870
  raftLeaderId: z.string().nullable().optional(),
1757
1871
  scalerBackends: z.array(z.string()),
1872
+ /**
1873
+ * Self-reported deployment shape, used by the dashboard to build the correct
1874
+ * per-orchestrator kici-admin invocation. Orchestrators that never reported
1875
+ * it serialize as `mode: 'unknown'` with null container fields.
1876
+ */
1877
+ deployment: z.object({
1878
+ mode: DeploymentModeSchema,
1879
+ containerName: z.string().nullable(),
1880
+ containerRuntime: DeploymentContainerRuntimeSchema.nullable()
1881
+ }),
1758
1882
  s3LogAccess: z.boolean().nullable().optional(),
1759
1883
  agentCount: z.number(),
1760
1884
  runningJobs: z.number(),
@@ -1867,6 +1991,6 @@ const orgMemberSchema = z.object({
1867
1991
  /** Response for org members list endpoint. */
1868
1992
  const memberListResponseSchema = z.object({ members: z.array(orgMemberSchema) });
1869
1993
  //#endregion
1870
- export { EnvDeleteErrorCode, EventLogPayloadStreamError, HeldRunQueueType, HeldRunStatus, TestRelayType, attestationListItemSchema, backendGetRequestSchema, backendGetResponseSchema, backendItemSchema, backendSyncRequestSchema, backendSyncResponseSchema, backendTestRequestSchema, backendTestResponseSchema, backendsListRequestSchema, backendsListResponseSchema, backendsSyncAllRequestSchema, backendsSyncAllResponseSchema, browserEventLogPayloadChunkSchema, dashboardAttestationsApiResponseSchema, dashboardAttestationsListRequestSchema, dashboardAttestationsListResponseSchema, dashboardDiagnosticsRequestSchema, dashboardDiagnosticsResponseSchema, dashboardEventDlqCountRequestSchema, dashboardEventDlqDiscardRequestSchema, dashboardEventDlqListItemSchema, dashboardEventDlqListRequestSchema, dashboardEventDlqRetryRequestSchema, dashboardEventLogDetailRequestSchema, dashboardEventLogListRequestSchema, dashboardEventLogPayloadChunkSchema, dashboardEventLogPayloadStreamRequestSchema, dashboardJobDetailSchema, dashboardOrchToPlatformSchema, dashboardPayloadRequestSchema, dashboardPlatformToOrchSchema, dashboardRunDetailApiResponseSchema, dashboardRunDetailRequestSchema, dashboardRunDetailResponseSchema, dashboardRunSummarySchema, dashboardRunsFiltersRequestSchema, dashboardRunsFiltersResponseSchema, dashboardRunsListRequestSchema, dashboardRunsListResponseSchema, dashboardScalerAgentsRequestSchema, dashboardScalerAgentsResponseSchema, dashboardScalerCapacityRequestSchema, dashboardScalerCapacityResponseSchema, dashboardSourceSummarySchema, dashboardSourcesListRequestSchema, dashboardSourcesListResponseSchema, dashboardStepLogsApiResponseSchema, dashboardStepLogsRequestSchema, dashboardStepLogsResponseSchema, diagnosticsInfrastructureResponseSchema, diagnosticsSummaryResponseSchema, envBindingsListRequestSchema, envBindingsSetRequestSchema, envCreateRequestSchema, envDeleteRequestSchema, envGetRequestSchema, envHistoryRequestSchema, envListRequestSchema, envSecretDeleteRequestSchema, envSecretScopeCreateRequestSchema, envSecretScopeDeleteRequestSchema, envSecretScopeRenameRequestSchema, envSecretSetRequestSchema, envSecretsListRequestSchema, envSourceOverrideDeleteRequestSchema, envSourceOverrideSetRequestSchema, envSourceOverridesListRequestSchema, envTestAccessSetRequestSchema, envUpdateRequestSchema, envVarDeleteRequestSchema, envVarSetRequestSchema, envVarsListRequestSchema, eventLogListItemSchema, heldRunApproveRequestSchema, heldRunRejectRequestSchema, heldRunsListRequestSchema, identityLinkItemSchema, identityLinkListResponseSchema, manualScheduleRequestSchema, memberIdentityLinkSchema, memberListResponseSchema, memberRoleAssignmentSchema, orgMemberSchema, registrationDeleteRequestSchema, registrationDisableRequestSchema, registrationItemSchema, registrationsListRequestSchema, registrationsListResponseSchema, runCancelRequestSchema, runEventSchema, runLineageResponseSchema, runListItemSchema, runListResponseSchema, runRerunRequestSchema, testRelayCancelRequestSchema, testRelayCancelResponseSchema, testRelayRunLogsRequestSchema, testRelayRunLogsResponseSchema, testRelayRunStatusRequestSchema, testRelayRunStatusResponseSchema, testRelayTriggerRequestSchema, testRelayTriggerResponseSchema, testRelayUploadsInitRequestSchema, testRelayUploadsInitResponseSchema, trustPolicyResponseSchema };
1994
+ export { EnvDeleteErrorCode, EventLogPayloadStreamError, HeldRunQueueType, HeldRunStatus, TestRelayType, attestationListItemSchema, backendGetRequestSchema, backendGetResponseSchema, backendItemSchema, backendSyncRequestSchema, backendSyncResponseSchema, backendTestRequestSchema, backendTestResponseSchema, backendsListRequestSchema, backendsListResponseSchema, backendsSyncAllRequestSchema, backendsSyncAllResponseSchema, browserEventLogPayloadChunkSchema, dashboardAttestationsApiResponseSchema, dashboardAttestationsListRequestSchema, dashboardAttestationsListResponseSchema, dashboardDiagnosticsRequestSchema, dashboardDiagnosticsResponseSchema, dashboardEventDlqCountRequestSchema, dashboardEventDlqDiscardRequestSchema, dashboardEventDlqListItemSchema, dashboardEventDlqListRequestSchema, dashboardEventDlqRetryRequestSchema, dashboardEventLogDetailRequestSchema, dashboardEventLogListRequestSchema, dashboardEventLogPayloadChunkSchema, dashboardEventLogPayloadStreamRequestSchema, dashboardFleetHostRequestSchema, dashboardFleetHostResponseSchema, dashboardFleetHostsRequestSchema, dashboardFleetHostsResponseSchema, dashboardFleetPreviewRequestSchema, dashboardFleetPreviewResponseSchema, dashboardJobDetailSchema, dashboardOrchToPlatformSchema, dashboardPayloadRequestSchema, dashboardPlatformToOrchSchema, dashboardRunDetailApiResponseSchema, dashboardRunDetailRequestSchema, dashboardRunDetailResponseSchema, dashboardRunSummarySchema, dashboardRunsFiltersRequestSchema, dashboardRunsFiltersResponseSchema, dashboardRunsListRequestSchema, dashboardRunsListResponseSchema, dashboardScalerAgentsRequestSchema, dashboardScalerAgentsResponseSchema, dashboardScalerCapacityRequestSchema, dashboardScalerCapacityResponseSchema, dashboardSourceSummarySchema, dashboardSourcesListRequestSchema, dashboardSourcesListResponseSchema, dashboardStepLogsApiResponseSchema, dashboardStepLogsRequestSchema, dashboardStepLogsResponseSchema, diagnosticsInfrastructureResponseSchema, diagnosticsSummaryResponseSchema, envBindingsListRequestSchema, envBindingsSetRequestSchema, envCreateRequestSchema, envDeleteRequestSchema, envGetRequestSchema, envHistoryRequestSchema, envListRequestSchema, envSecretDeleteRequestSchema, envSecretScopeCreateRequestSchema, envSecretScopeDeleteRequestSchema, envSecretScopeRenameRequestSchema, envSecretSetRequestSchema, envSecretsListRequestSchema, envSourceOverrideDeleteRequestSchema, envSourceOverrideSetRequestSchema, envSourceOverridesListRequestSchema, envTestAccessSetRequestSchema, envUpdateRequestSchema, envVarDeleteRequestSchema, envVarSetRequestSchema, envVarsListRequestSchema, eventLogListItemSchema, fleetHostDeclareRequestSchema, fleetHostDeclareResponseSchema, fleetHostRemoveRequestSchema, fleetHostRemoveResponseSchema, fleetPinnedRunSchema, fleetPreviewHostSchema, heldRunApproveRequestSchema, heldRunRejectRequestSchema, heldRunsListRequestSchema, identityLinkItemSchema, identityLinkListResponseSchema, manualScheduleRequestSchema, memberIdentityLinkSchema, memberListResponseSchema, memberRoleAssignmentSchema, orgMemberSchema, registrationDeleteRequestSchema, registrationDisableRequestSchema, registrationItemSchema, registrationsListRequestSchema, registrationsListResponseSchema, runCancelRequestSchema, runEventSchema, runLineageResponseSchema, runListItemSchema, runListResponseSchema, runRerunRequestSchema, testRelayCancelRequestSchema, testRelayCancelResponseSchema, testRelayRunLogsRequestSchema, testRelayRunLogsResponseSchema, testRelayRunStatusRequestSchema, testRelayRunStatusResponseSchema, testRelayTriggerRequestSchema, testRelayTriggerResponseSchema, testRelayUploadsInitRequestSchema, testRelayUploadsInitResponseSchema, trustPolicyResponseSchema };
1871
1995
 
1872
1996
  //# sourceMappingURL=dashboard.js.map
@@ -0,0 +1,38 @@
1
+ import { z } from 'zod';
2
+ /** How the orchestrator process itself was deployed (not how it runs agents). */
3
+ export declare const DeploymentModeSchema: z.ZodEnum<{
4
+ unknown: "unknown";
5
+ systemd: "systemd";
6
+ launchd: "launchd";
7
+ windows: "windows";
8
+ compose: "compose";
9
+ }>;
10
+ export type DeploymentMode = z.infer<typeof DeploymentModeSchema>;
11
+ /** Container runtime that launched a `compose`-mode orchestrator. */
12
+ export declare const DeploymentContainerRuntimeSchema: z.ZodEnum<{
13
+ podman: "podman";
14
+ docker: "docker";
15
+ }>;
16
+ export type DeploymentContainerRuntime = z.infer<typeof DeploymentContainerRuntimeSchema>;
17
+ /**
18
+ * The orchestrator's self-reported deployment shape, used to build the correct
19
+ * kici-admin invocation in the dashboard diagnostics page. Container fields are
20
+ * populated only for the `compose` mode; a hand-run orchestrator reports
21
+ * `mode: 'unknown'` with no container fields.
22
+ */
23
+ export declare const DeploymentIdentitySchema: z.ZodObject<{
24
+ mode: z.ZodEnum<{
25
+ unknown: "unknown";
26
+ systemd: "systemd";
27
+ launchd: "launchd";
28
+ windows: "windows";
29
+ compose: "compose";
30
+ }>;
31
+ containerName: z.ZodOptional<z.ZodString>;
32
+ containerRuntime: z.ZodOptional<z.ZodEnum<{
33
+ podman: "podman";
34
+ docker: "docker";
35
+ }>>;
36
+ }, z.core.$strip>;
37
+ export type DeploymentIdentity = z.infer<typeof DeploymentIdentitySchema>;
38
+ //# sourceMappingURL=deployment-identity.d.ts.map
@@ -0,0 +1,28 @@
1
+ import "../../chunk-BTugEXQM.js";
2
+ import { z } from "zod";
3
+ //#region src/protocol/messages/deployment-identity.ts
4
+ /** How the orchestrator process itself was deployed (not how it runs agents). */
5
+ const DeploymentModeSchema = z.enum([
6
+ "systemd",
7
+ "launchd",
8
+ "windows",
9
+ "compose",
10
+ "unknown"
11
+ ]);
12
+ /** Container runtime that launched a `compose`-mode orchestrator. */
13
+ const DeploymentContainerRuntimeSchema = z.enum(["podman", "docker"]);
14
+ /**
15
+ * The orchestrator's self-reported deployment shape, used to build the correct
16
+ * kici-admin invocation in the dashboard diagnostics page. Container fields are
17
+ * populated only for the `compose` mode; a hand-run orchestrator reports
18
+ * `mode: 'unknown'` with no container fields.
19
+ */
20
+ const DeploymentIdentitySchema = z.object({
21
+ mode: DeploymentModeSchema,
22
+ containerName: z.string().min(1).optional(),
23
+ containerRuntime: DeploymentContainerRuntimeSchema.optional()
24
+ });
25
+ //#endregion
26
+ export { DeploymentContainerRuntimeSchema, DeploymentIdentitySchema, DeploymentModeSchema };
27
+
28
+ //# sourceMappingURL=deployment-identity.js.map
@@ -22,10 +22,25 @@ export type CacheRefScope = z.infer<typeof CacheRefScope>;
22
22
  *
23
23
  * - `jobs` maps an upstream job name to its outputs record.
24
24
  * - `groups` maps a dynamic group name to its ordered member job names.
25
+ * - `statuses` maps an upstream job name to its terminal status, so the
26
+ * generator's `ctx.needs.<job>.status` reflects the frozen upstream outcome.
25
27
  */
26
28
  export declare const upstreamSnapshotSchema: z.ZodObject<{
27
29
  jobs: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
28
30
  groups: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
31
+ statuses: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
32
+ skipped: "skipped";
33
+ success: "success";
34
+ pending: "pending";
35
+ running: "running";
36
+ failed: "failed";
37
+ cancelled: "cancelled";
38
+ cancelling: "cancelling";
39
+ queued: "queued";
40
+ recovering: "recovering";
41
+ timed_out_stale: "timed_out_stale";
42
+ drift_dropped: "drift_dropped";
43
+ }>>>;
29
44
  }, z.core.$strip>;
30
45
  export type UpstreamSnapshot = z.infer<typeof upstreamSnapshotSchema>;
31
46
  /**
@@ -79,6 +94,19 @@ export declare const jobDispatchSchema: z.ZodObject<{
79
94
  requestId: z.ZodOptional<z.ZodString>;
80
95
  runPublicKey: z.ZodOptional<z.ZodString>;
81
96
  upstreamJobOutputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
97
+ upstreamJobStatuses: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
98
+ skipped: "skipped";
99
+ success: "success";
100
+ pending: "pending";
101
+ running: "running";
102
+ failed: "failed";
103
+ cancelled: "cancelled";
104
+ cancelling: "cancelling";
105
+ queued: "queued";
106
+ recovering: "recovering";
107
+ timed_out_stale: "timed_out_stale";
108
+ drift_dropped: "drift_dropped";
109
+ }>>>;
82
110
  sourceAuth: z.ZodOptional<z.ZodObject<{
83
111
  kind: z.ZodEnum<{
84
112
  basic: "basic";
@@ -491,12 +519,25 @@ export declare const StepApprovalOutcome: z.ZodEnum<{
491
519
  }>;
492
520
  export type StepApprovalOutcome = z.infer<typeof StepApprovalOutcome>;
493
521
  /**
494
- * Agent -> Orchestrator: a step carrying `requireApproval` is about to run and
522
+ * Drift payload carried on a `when: 'drift'` step-approval hold. Captured from
523
+ * the step's check/summarize: `summaryMarkdown` is the author's `summarize(drift)`
524
+ * rendering, `drift` is the structured drift blob. Rendered in the dashboard
525
+ * approval queue + the CLI so the operator sees the computed diff before
526
+ * approving the apply.
527
+ */
528
+ export declare const stepApprovalPayloadSchema: z.ZodObject<{
529
+ summaryMarkdown: z.ZodString;
530
+ drift: z.ZodUnknown;
531
+ }, z.core.$strip>;
532
+ export type StepApprovalPayload = z.infer<typeof stepApprovalPayloadSchema>;
533
+ /**
534
+ * Agent -> Orchestrator: a step carrying an `approval` gate is about to run and
495
535
  * the agent is blocking its step loop until the orchestrator resolves the
496
536
  * approval. The orchestrator creates a step-scoped `held_runs` row from the
497
537
  * normalized requirement and replies with `step.approval-resolved` once the
498
538
  * hold is approved, rejected, or expired. The agent keeps heartbeats flowing
499
- * during the wait so it is not reaped as stale.
539
+ * during the wait so it is not reaped as stale. For a `when: 'drift'` gate the
540
+ * request carries the computed drift `payload`.
500
541
  *
501
542
  * NOT fast-pathed — the `log.chunk` / `heartbeat` manual-validator invariant is
502
543
  * untouched by this message.
@@ -515,6 +556,10 @@ export declare const stepApprovalRequestSchema: z.ZodObject<{
515
556
  }, z.core.$strict>]>>;
516
557
  reason: z.ZodString;
517
558
  timeoutSeconds: z.ZodOptional<z.ZodNumber>;
559
+ payload: z.ZodOptional<z.ZodObject<{
560
+ summaryMarkdown: z.ZodString;
561
+ drift: z.ZodUnknown;
562
+ }, z.core.$strip>>;
518
563
  }, z.core.$strip>;
519
564
  export type StepApprovalRequest = z.infer<typeof stepApprovalRequestSchema>;
520
565
  /**
@@ -560,6 +605,19 @@ export declare const orchestratorToAgentMessageSchema: z.ZodDiscriminatedUnion<[
560
605
  requestId: z.ZodOptional<z.ZodString>;
561
606
  runPublicKey: z.ZodOptional<z.ZodString>;
562
607
  upstreamJobOutputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
608
+ upstreamJobStatuses: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
609
+ skipped: "skipped";
610
+ success: "success";
611
+ pending: "pending";
612
+ running: "running";
613
+ failed: "failed";
614
+ cancelled: "cancelled";
615
+ cancelling: "cancelling";
616
+ queued: "queued";
617
+ recovering: "recovering";
618
+ timed_out_stale: "timed_out_stale";
619
+ drift_dropped: "drift_dropped";
620
+ }>>>;
563
621
  sourceAuth: z.ZodOptional<z.ZodObject<{
564
622
  kind: z.ZodEnum<{
565
623
  basic: "basic";
@@ -923,6 +981,10 @@ export declare const agentToOrchestratorMessageSchema: z.ZodDiscriminatedUnion<[
923
981
  }, z.core.$strict>]>>;
924
982
  reason: z.ZodString;
925
983
  timeoutSeconds: z.ZodOptional<z.ZodNumber>;
984
+ payload: z.ZodOptional<z.ZodObject<{
985
+ summaryMarkdown: z.ZodString;
986
+ drift: z.ZodUnknown;
987
+ }, z.core.$strip>>;
926
988
  }, z.core.$strip>], "type">;
927
989
  export type JobDispatch = z.infer<typeof jobDispatchSchema>;
928
990
  export type JobCancel = z.infer<typeof jobCancelSchema>;
@@ -22,10 +22,13 @@ const CacheRefScope = z.enum(["shared", "isolated"]);
22
22
  *
23
23
  * - `jobs` maps an upstream job name to its outputs record.
24
24
  * - `groups` maps a dynamic group name to its ordered member job names.
25
+ * - `statuses` maps an upstream job name to its terminal status, so the
26
+ * generator's `ctx.needs.<job>.status` reflects the frozen upstream outcome.
25
27
  */
26
28
  const upstreamSnapshotSchema = z.object({
27
29
  jobs: z.record(z.string(), z.record(z.string(), z.unknown())),
28
- groups: z.record(z.string(), z.array(z.string()))
30
+ groups: z.record(z.string(), z.array(z.string())),
31
+ statuses: z.record(z.string(), ExecutionJobStatus).optional()
29
32
  });
30
33
  /**
31
34
  * Structured git-clone auth material. Carries everything the agent needs to
@@ -93,6 +96,8 @@ const jobDispatchSchema = z.object({
93
96
  runPublicKey: z.string().optional(),
94
97
  /** Plain outputs from upstream jobs (keyed by job name, then by step name). Populated for downstream jobs with `needs` dependencies. */
95
98
  upstreamJobOutputs: z.record(z.string(), z.record(z.string(), z.unknown())).optional(),
99
+ /** Terminal status of each upstream job (keyed by job name; per-child for fan-out). Powers `ctx.needs.<job>.status`. */
100
+ upstreamJobStatuses: z.record(z.string(), ExecutionJobStatus).optional(),
96
101
  /**
97
102
  * Structured clone auth for the source repo. Preferred over `token` (which
98
103
  * remains as a backward-compat field for same-provider GitHub App flows
@@ -638,12 +643,24 @@ const StepApprovalOutcome = z.enum([
638
643
  "expired"
639
644
  ]);
640
645
  /**
641
- * Agent -> Orchestrator: a step carrying `requireApproval` is about to run and
646
+ * Drift payload carried on a `when: 'drift'` step-approval hold. Captured from
647
+ * the step's check/summarize: `summaryMarkdown` is the author's `summarize(drift)`
648
+ * rendering, `drift` is the structured drift blob. Rendered in the dashboard
649
+ * approval queue + the CLI so the operator sees the computed diff before
650
+ * approving the apply.
651
+ */
652
+ const stepApprovalPayloadSchema = z.object({
653
+ summaryMarkdown: z.string(),
654
+ drift: z.unknown()
655
+ });
656
+ /**
657
+ * Agent -> Orchestrator: a step carrying an `approval` gate is about to run and
642
658
  * the agent is blocking its step loop until the orchestrator resolves the
643
659
  * approval. The orchestrator creates a step-scoped `held_runs` row from the
644
660
  * normalized requirement and replies with `step.approval-resolved` once the
645
661
  * hold is approved, rejected, or expired. The agent keeps heartbeats flowing
646
- * during the wait so it is not reaped as stale.
662
+ * during the wait so it is not reaped as stale. For a `when: 'drift'` gate the
663
+ * request carries the computed drift `payload`.
647
664
  *
648
665
  * NOT fast-pathed — the `log.chunk` / `heartbeat` manual-validator invariant is
649
666
  * untouched by this message.
@@ -657,14 +674,16 @@ const stepApprovalRequestSchema = z.object({
657
674
  stepName: z.string(),
658
675
  /** AND-list of approver clauses (empty = any approval-capable member). */
659
676
  clauses: z.array(approverClauseSchema),
660
- /** Human label for the gate (from the SDK `requireApproval` reason). */
677
+ /** Human label for the gate (from the SDK `approval` reason). */
661
678
  reason: z.string(),
662
679
  /**
663
- * Per-gate timeout override (seconds) from the SDK `requireApproval.timeout`.
680
+ * Per-gate timeout override (seconds) from the SDK `approval.timeout`.
664
681
  * Absent ⇒ the orchestrator uses the org-default `approval_expiry_seconds`.
665
682
  * The orchestrator owns the authoritative `expiresAt` computation.
666
683
  */
667
- timeoutSeconds: z.number().int().positive().optional()
684
+ timeoutSeconds: z.number().int().positive().optional(),
685
+ /** Computed drift payload, present only for `when: 'drift'` gates. */
686
+ payload: stepApprovalPayloadSchema.optional()
668
687
  });
669
688
  /**
670
689
  * Orchestrator -> Agent: resolution of a step-level approval hold. `requestId`
@@ -729,6 +748,6 @@ const agentToOrchestratorMessageSchema = z.discriminatedUnion("type", [
729
748
  stepApprovalRequestSchema
730
749
  ]);
731
750
  //#endregion
732
- export { CacheRefScope, JobRejectReason, StepApprovalOutcome, agentApiRequestSchema, agentApiResponseSchema, agentAuthFailureSchema, agentAuthRequestSchema, agentAuthSuccessSchema, agentLogChunkSchema, agentMetricsSchema, agentRegisterSchema, agentStatusSchema, agentStepStatusSchema, agentToOrchestratorMessageSchema, cacheUserRestoreRequestSchema, cacheUserRestoreResponseSchema, cacheUserSaveCompleteSchema, cacheUserSaveRequestSchema, cacheUserSaveResponseSchema, configAckSchema, eventEmitResponseSchema, eventEmitSchema, fleetBundleChunkSchema, fleetBundleErrorSchema, fleetLogsRequestSchema, gitAuthSchema, jobAckSchema, jobCancelSchema, jobConcurrencyAckSchema, jobConcurrencyReportSchema, jobDispatchSchema, jobRejectSchema, jobStatusSchema, orchestratorToAgentMessageSchema, provenanceUploadCompleteSchema, provenanceUploadRequestSchema, provenanceUploadResponseSchema, registerAckSchema, stepApprovalRequestSchema, stepApprovalResolvedSchema, upstreamSnapshotSchema };
751
+ export { CacheRefScope, JobRejectReason, StepApprovalOutcome, agentApiRequestSchema, agentApiResponseSchema, agentAuthFailureSchema, agentAuthRequestSchema, agentAuthSuccessSchema, agentLogChunkSchema, agentMetricsSchema, agentRegisterSchema, agentStatusSchema, agentStepStatusSchema, agentToOrchestratorMessageSchema, cacheUserRestoreRequestSchema, cacheUserRestoreResponseSchema, cacheUserSaveCompleteSchema, cacheUserSaveRequestSchema, cacheUserSaveResponseSchema, configAckSchema, eventEmitResponseSchema, eventEmitSchema, fleetBundleChunkSchema, fleetBundleErrorSchema, fleetLogsRequestSchema, gitAuthSchema, jobAckSchema, jobCancelSchema, jobConcurrencyAckSchema, jobConcurrencyReportSchema, jobDispatchSchema, jobRejectSchema, jobStatusSchema, orchestratorToAgentMessageSchema, provenanceUploadCompleteSchema, provenanceUploadRequestSchema, provenanceUploadResponseSchema, registerAckSchema, stepApprovalPayloadSchema, stepApprovalRequestSchema, stepApprovalResolvedSchema, upstreamSnapshotSchema };
733
752
 
734
753
  //# sourceMappingURL=orchestrator-agent.js.map
@@ -1,7 +1,7 @@
1
1
  import "../../chunk-BTugEXQM.js";
2
2
  import { ExecutionJobStatus } from "./execution-status.js";
3
- import { ScalerEventType } from "./scaler-event.js";
4
3
  import { LabelMatcher } from "../../labels-match.js";
4
+ import { ScalerEventType } from "./scaler-event.js";
5
5
  import { z } from "zod";
6
6
  //#region src/protocol/messages/peer.ts
7
7
  /** Agent summary included in peer heartbeat and auth response messages. */