@kici-dev/engine 0.1.20 → 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.
Files changed (38) hide show
  1. package/dist/approval/types.d.ts +1 -1
  2. package/dist/approval/types.js +1 -1
  3. package/dist/audit/access-log-policy.js +7 -0
  4. package/dist/audit/retention-policy.js +8 -0
  5. package/dist/check-mode.d.ts +33 -0
  6. package/dist/check-mode.js +36 -0
  7. package/dist/fanout/materialize.d.ts +21 -4
  8. package/dist/fanout/materialize.js +24 -5
  9. package/dist/index.d.ts +5 -1
  10. package/dist/index.js +11 -7
  11. package/dist/inventory.d.ts +101 -0
  12. package/dist/inventory.js +89 -0
  13. package/dist/labels-match.d.ts +52 -0
  14. package/dist/labels-match.js +24 -2
  15. package/dist/protocol/dashboard-write-operations.d.ts +8 -1
  16. package/dist/protocol/dashboard-write-operations.js +25 -4
  17. package/dist/protocol/messages/access-log.d.ts +25 -0
  18. package/dist/protocol/messages/access-log.js +5 -0
  19. package/dist/protocol/messages/auth.d.ts +2 -0
  20. package/dist/protocol/messages/capabilities.d.ts +2 -0
  21. package/dist/protocol/messages/dashboard.d.ts +669 -21
  22. package/dist/protocol/messages/dashboard.js +140 -7
  23. package/dist/protocol/messages/deployment-identity.d.ts +38 -0
  24. package/dist/protocol/messages/deployment-identity.js +28 -0
  25. package/dist/protocol/messages/execution-status.d.ts +5 -5
  26. package/dist/protocol/messages/orchestrator-agent.d.ts +70 -6
  27. package/dist/protocol/messages/orchestrator-agent.js +37 -8
  28. package/dist/protocol/messages/peer.d.ts +62 -3
  29. package/dist/protocol/messages/peer.js +16 -2
  30. package/dist/protocol/messages/platform-orchestrator.d.ts +172 -2
  31. package/dist/protocol/messages/source-registration.d.ts +15 -0
  32. package/dist/protocol/messages/source-registration.js +17 -1
  33. package/dist/trigger/types.d.ts +74 -22
  34. package/dist/trigger/types.js +41 -12
  35. package/dist/webhook/webhook-url-format.d.ts +9 -0
  36. package/dist/webhook/webhook-url-format.js +16 -0
  37. package/package.json +1 -1
  38. package/sbom.spdx.json +5 -5
@@ -1,6 +1,8 @@
1
1
  import "../../chunk-BTugEXQM.js";
2
+ import { CheckMode, CheckStepOutcome } from "../../check-mode.js";
2
3
  import { actorPrincipalSchema } from "./actor.js";
3
4
  import { initFailureSchema } from "./execution-status.js";
5
+ import { DeploymentContainerRuntimeSchema, DeploymentModeSchema } from "./deployment-identity.js";
4
6
  import { SourceSubtype } from "./source-registration.js";
5
7
  import { kiciBundleSchema } from "../../provenance/bundle.js";
6
8
  import { dashboardAccessLogListRequestSchema, dashboardAccessLogListResponseSchema } from "./access-log.js";
@@ -8,7 +10,9 @@ import { dashboardOrchLogsRequestSchema, dashboardOrchLogsResponseSchema } from
8
10
  import { EventLogSource, EventLogStatus, PayloadOmittedReason } from "./event-log.js";
9
11
  import { ScalerBackendType } from "../../scaler/scaler-backend-type.js";
10
12
  import { ApprovalDecision, HoldScope, approverClauseSchema } from "../../approval/types.js";
11
- 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";
12
16
  import { globalWorkflowsGetRequestSchema, globalWorkflowsGetResponseSchema, globalWorkflowsUpdateRequestSchema, globalWorkflowsUpdateResponseSchema } from "./dashboard-global-workflows.js";
13
17
  import { z } from "zod";
14
18
  //#region src/protocol/messages/dashboard.ts
@@ -41,7 +45,11 @@ const dashboardStepDetailSchema = z.object({
41
45
  /** Step type (e.g., 'hook:onCancel', 'hook:cleanup'). Omitted for regular steps. */
42
46
  stepType: z.string().optional(),
43
47
  /** Secret context names accessed by this step. null = tracking not available. */
44
- secretsAccessed: z.array(z.string()).nullable().optional()
48
+ secretsAccessed: z.array(z.string()).nullable().optional(),
49
+ /** Idempotent per-step outcome under a check mode. null/absent for non-check runs. */
50
+ checkOutcome: CheckStepOutcome.nullable().optional(),
51
+ /** Human-readable drift summary, present when the step reported drift. */
52
+ driftSummary: z.string().nullable().optional()
45
53
  });
46
54
  /** Job detail within a run detail response. */
47
55
  const dashboardJobDetailSchema = z.object({
@@ -75,12 +83,13 @@ const dashboardJobDetailSchema = z.object({
75
83
  /**
76
84
  * Upstream dependency edges for this job (one entry per `needs` declaration),
77
85
  * resolved by the orchestrator from execution_job_needs. `upstreamName` is the
78
- * upstream job name; `ifFailed` is the per-edge failure policy. null/absent when
79
- * 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.
80
89
  */
81
90
  needs: z.array(z.object({
82
91
  upstreamName: z.string(),
83
- ifFailed: IfFailedPolicy
92
+ runOn: NeedsRunOn
84
93
  })).nullable().optional(),
85
94
  steps: z.array(dashboardStepDetailSchema)
86
95
  });
@@ -985,6 +994,10 @@ const heldRunsListResponseSchema = z.object({
985
994
  clauses: z.array(approverClauseSchema),
986
995
  reason: z.string().nullable().optional()
987
996
  }).nullable().optional(),
997
+ payload: z.object({
998
+ summaryMarkdown: z.string(),
999
+ drift: z.unknown()
1000
+ }).nullable().optional(),
988
1001
  decisions: z.array(z.object({
989
1002
  approverUserId: z.string(),
990
1003
  decision: ApprovalDecision,
@@ -999,7 +1012,14 @@ const heldRunApproveRequestSchema = z.object({
999
1012
  type: z.literal("dashboard.held-runs.approve"),
1000
1013
  requestId: z.string(),
1001
1014
  actor: actorPrincipalSchema,
1002
- 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()
1003
1023
  });
1004
1024
  const heldRunApproveResponseSchema = z.object({
1005
1025
  type: z.literal("dashboard.held-runs.approve.response"),
@@ -1027,6 +1047,90 @@ const dashboardDiagnosticsRequestSchema = z.object({
1027
1047
  /** When false or omitted, agents[] is empty and aggregate fields are populated instead. */
1028
1048
  includeAgents: z.boolean().optional()
1029
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
+ });
1030
1134
  /** Agent info within the diagnostics response. */
1031
1135
  const diagnosticsAgentSchema = z.object({
1032
1136
  agentId: z.string(),
@@ -1424,6 +1528,13 @@ const testRelayTriggerRequestSchema = z.object({
1424
1528
  cliPublicKey: z.string().optional(),
1425
1529
  inlineLockFile: z.string().optional(),
1426
1530
  fullRepo: z.boolean().optional(),
1531
+ /** Run mode for idempotent steps; relayed onto the dispatch event. Omitted = apply. */
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(),
1427
1538
  secrets: z.record(z.string(), z.string()).optional(),
1428
1539
  encryptedSecrets: z.string().optional(),
1429
1540
  encryptedSecretsKey: z.string().optional()
@@ -1534,6 +1645,11 @@ const dashboardPlatformToOrchSchema = z.discriminatedUnion("type", [
1534
1645
  registrationDisableRequestSchema,
1535
1646
  registrationDeleteRequestSchema,
1536
1647
  dashboardDiagnosticsRequestSchema,
1648
+ dashboardFleetHostsRequestSchema,
1649
+ dashboardFleetHostRequestSchema,
1650
+ dashboardFleetPreviewRequestSchema,
1651
+ fleetHostDeclareRequestSchema,
1652
+ fleetHostRemoveRequestSchema,
1537
1653
  dashboardScalerCapacityRequestSchema,
1538
1654
  dashboardScalerAgentsRequestSchema,
1539
1655
  backendsListRequestSchema,
@@ -1598,6 +1714,11 @@ const dashboardOrchToPlatformSchema = z.discriminatedUnion("type", [
1598
1714
  registrationDisableResponseSchema,
1599
1715
  registrationDeleteResponseSchema,
1600
1716
  dashboardDiagnosticsResponseSchema,
1717
+ dashboardFleetHostsResponseSchema,
1718
+ dashboardFleetHostResponseSchema,
1719
+ dashboardFleetPreviewResponseSchema,
1720
+ fleetHostDeclareResponseSchema,
1721
+ fleetHostRemoveResponseSchema,
1601
1722
  dashboardScalerCapacityResponseSchema,
1602
1723
  dashboardScalerAgentsResponseSchema,
1603
1724
  backendsListResponseSchema,
@@ -1625,6 +1746,8 @@ const dashboardOrchToPlatformSchema = z.discriminatedUnion("type", [
1625
1746
  const dashboardRunDetailApiResponseSchema = z.object({
1626
1747
  jobs: z.array(dashboardJobDetailSchema),
1627
1748
  trustContext: trustContextSchema.optional(),
1749
+ /** Run mode for idempotent steps. A non-apply value labels the run a check-mode preview. */
1750
+ checkMode: CheckMode.nullable().optional(),
1628
1751
  /**
1629
1752
  * Structured init-failure signal for runs that never started a step. Set
1630
1753
  * when the run row was created via `recordInitFailureRun()` on the
@@ -1746,6 +1869,16 @@ const diagnosticsInfraOrchestratorSchema = z.object({
1746
1869
  raftTerm: z.number().nullable().optional(),
1747
1870
  raftLeaderId: z.string().nullable().optional(),
1748
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
+ }),
1749
1882
  s3LogAccess: z.boolean().nullable().optional(),
1750
1883
  agentCount: z.number(),
1751
1884
  runningJobs: z.number(),
@@ -1858,6 +1991,6 @@ const orgMemberSchema = z.object({
1858
1991
  /** Response for org members list endpoint. */
1859
1992
  const memberListResponseSchema = z.object({ members: z.array(orgMemberSchema) });
1860
1993
  //#endregion
1861
- 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 };
1862
1995
 
1863
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
@@ -21,6 +21,7 @@ export declare const ExecutionRunStatus: z.ZodEnum<{
21
21
  export type ExecutionRunStatus = z.infer<typeof ExecutionRunStatus>;
22
22
  /** Status values for execution jobs (execution_jobs table + job.status protocol messages). */
23
23
  export declare const ExecutionJobStatus: z.ZodEnum<{
24
+ skipped: "skipped";
24
25
  success: "success";
25
26
  pending: "pending";
26
27
  running: "running";
@@ -29,17 +30,16 @@ export declare const ExecutionJobStatus: z.ZodEnum<{
29
30
  cancelling: "cancelling";
30
31
  queued: "queued";
31
32
  recovering: "recovering";
32
- skipped: "skipped";
33
33
  timed_out_stale: "timed_out_stale";
34
34
  drift_dropped: "drift_dropped";
35
35
  }>;
36
36
  export type ExecutionJobStatus = z.infer<typeof ExecutionJobStatus>;
37
37
  /** Status values for execution steps (execution_steps table + step.status protocol messages). */
38
38
  export declare const ExecutionStepStatus: z.ZodEnum<{
39
+ skipped: "skipped";
39
40
  success: "success";
40
41
  running: "running";
41
42
  failed: "failed";
42
- skipped: "skipped";
43
43
  }>;
44
44
  export type ExecutionStepStatus = z.infer<typeof ExecutionStepStatus>;
45
45
  /**
@@ -112,8 +112,8 @@ export type CacheRunEventType = z.infer<typeof CacheRunEventType>;
112
112
  * - `error` — the restore/save failed (pack/extract/transport error).
113
113
  */
114
114
  export declare const CacheOutcome: z.ZodEnum<{
115
- error: "error";
116
115
  skipped: "skipped";
116
+ error: "error";
117
117
  hit: "hit";
118
118
  miss: "miss";
119
119
  saved: "saved";
@@ -202,10 +202,10 @@ export declare const stepStatusForwardSchema: z.ZodObject<{
202
202
  stepIndex: z.ZodNumber;
203
203
  stepName: z.ZodString;
204
204
  state: z.ZodEnum<{
205
+ skipped: "skipped";
205
206
  success: "success";
206
207
  running: "running";
207
208
  failed: "failed";
208
- skipped: "skipped";
209
209
  }>;
210
210
  timestamp: z.ZodNumber;
211
211
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -219,6 +219,7 @@ export declare const jobStatusForwardSchema: z.ZodObject<{
219
219
  jobId: z.ZodString;
220
220
  jobName: z.ZodString;
221
221
  status: z.ZodEnum<{
222
+ skipped: "skipped";
222
223
  success: "success";
223
224
  pending: "pending";
224
225
  running: "running";
@@ -227,7 +228,6 @@ export declare const jobStatusForwardSchema: z.ZodObject<{
227
228
  cancelling: "cancelling";
228
229
  queued: "queued";
229
230
  recovering: "recovering";
230
- skipped: "skipped";
231
231
  timed_out_stale: "timed_out_stale";
232
232
  drift_dropped: "drift_dropped";
233
233
  }>;
@@ -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";
@@ -158,6 +186,7 @@ export declare const agentRegisterSchema: z.ZodObject<{
158
186
  nodeVersion: z.ZodOptional<z.ZodString>;
159
187
  runningAsUser: z.ZodOptional<z.ZodString>;
160
188
  runningAsUid: z.ZodOptional<z.ZodNumber>;
189
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
161
190
  }, z.core.$strip>;
162
191
  /** Periodic agent status update. */
163
192
  export declare const agentStatusSchema: z.ZodObject<{
@@ -176,6 +205,7 @@ export declare const jobStatusSchema: z.ZodObject<{
176
205
  runId: z.ZodString;
177
206
  jobId: z.ZodString;
178
207
  state: z.ZodEnum<{
208
+ skipped: "skipped";
179
209
  success: "success";
180
210
  pending: "pending";
181
211
  running: "running";
@@ -184,7 +214,6 @@ export declare const jobStatusSchema: z.ZodObject<{
184
214
  cancelling: "cancelling";
185
215
  queued: "queued";
186
216
  recovering: "recovering";
187
- skipped: "skipped";
188
217
  timed_out_stale: "timed_out_stale";
189
218
  drift_dropped: "drift_dropped";
190
219
  }>;
@@ -267,10 +296,10 @@ export declare const agentStepStatusSchema: z.ZodObject<{
267
296
  stepIndex: z.ZodNumber;
268
297
  stepName: z.ZodString;
269
298
  state: z.ZodEnum<{
299
+ skipped: "skipped";
270
300
  success: "success";
271
301
  running: "running";
272
302
  failed: "failed";
273
- skipped: "skipped";
274
303
  }>;
275
304
  timestamp: z.ZodNumber;
276
305
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -490,12 +519,25 @@ export declare const StepApprovalOutcome: z.ZodEnum<{
490
519
  }>;
491
520
  export type StepApprovalOutcome = z.infer<typeof StepApprovalOutcome>;
492
521
  /**
493
- * 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
494
535
  * the agent is blocking its step loop until the orchestrator resolves the
495
536
  * approval. The orchestrator creates a step-scoped `held_runs` row from the
496
537
  * normalized requirement and replies with `step.approval-resolved` once the
497
538
  * hold is approved, rejected, or expired. The agent keeps heartbeats flowing
498
- * 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`.
499
541
  *
500
542
  * NOT fast-pathed — the `log.chunk` / `heartbeat` manual-validator invariant is
501
543
  * untouched by this message.
@@ -514,6 +556,10 @@ export declare const stepApprovalRequestSchema: z.ZodObject<{
514
556
  }, z.core.$strict>]>>;
515
557
  reason: z.ZodString;
516
558
  timeoutSeconds: z.ZodOptional<z.ZodNumber>;
559
+ payload: z.ZodOptional<z.ZodObject<{
560
+ summaryMarkdown: z.ZodString;
561
+ drift: z.ZodUnknown;
562
+ }, z.core.$strip>>;
517
563
  }, z.core.$strip>;
518
564
  export type StepApprovalRequest = z.infer<typeof stepApprovalRequestSchema>;
519
565
  /**
@@ -559,6 +605,19 @@ export declare const orchestratorToAgentMessageSchema: z.ZodDiscriminatedUnion<[
559
605
  requestId: z.ZodOptional<z.ZodString>;
560
606
  runPublicKey: z.ZodOptional<z.ZodString>;
561
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
+ }>>>;
562
621
  sourceAuth: z.ZodOptional<z.ZodObject<{
563
622
  kind: z.ZodEnum<{
564
623
  basic: "basic";
@@ -698,6 +757,7 @@ export declare const agentToOrchestratorMessageSchema: z.ZodDiscriminatedUnion<[
698
757
  nodeVersion: z.ZodOptional<z.ZodString>;
699
758
  runningAsUser: z.ZodOptional<z.ZodString>;
700
759
  runningAsUid: z.ZodOptional<z.ZodNumber>;
760
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
701
761
  }, z.core.$strip>, z.ZodObject<{
702
762
  type: z.ZodLiteral<"agent.status">;
703
763
  messageId: z.ZodString;
@@ -712,6 +772,7 @@ export declare const agentToOrchestratorMessageSchema: z.ZodDiscriminatedUnion<[
712
772
  runId: z.ZodString;
713
773
  jobId: z.ZodString;
714
774
  state: z.ZodEnum<{
775
+ skipped: "skipped";
715
776
  success: "success";
716
777
  pending: "pending";
717
778
  running: "running";
@@ -720,7 +781,6 @@ export declare const agentToOrchestratorMessageSchema: z.ZodDiscriminatedUnion<[
720
781
  cancelling: "cancelling";
721
782
  queued: "queued";
722
783
  recovering: "recovering";
723
- skipped: "skipped";
724
784
  timed_out_stale: "timed_out_stale";
725
785
  drift_dropped: "drift_dropped";
726
786
  }>;
@@ -763,10 +823,10 @@ export declare const agentToOrchestratorMessageSchema: z.ZodDiscriminatedUnion<[
763
823
  stepIndex: z.ZodNumber;
764
824
  stepName: z.ZodString;
765
825
  state: z.ZodEnum<{
826
+ skipped: "skipped";
766
827
  success: "success";
767
828
  running: "running";
768
829
  failed: "failed";
769
- skipped: "skipped";
770
830
  }>;
771
831
  timestamp: z.ZodNumber;
772
832
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -921,6 +981,10 @@ export declare const agentToOrchestratorMessageSchema: z.ZodDiscriminatedUnion<[
921
981
  }, z.core.$strict>]>>;
922
982
  reason: z.ZodString;
923
983
  timeoutSeconds: z.ZodOptional<z.ZodNumber>;
984
+ payload: z.ZodOptional<z.ZodObject<{
985
+ summaryMarkdown: z.ZodString;
986
+ drift: z.ZodUnknown;
987
+ }, z.core.$strip>>;
924
988
  }, z.core.$strip>], "type">;
925
989
  export type JobDispatch = z.infer<typeof jobDispatchSchema>;
926
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
@@ -224,7 +229,17 @@ const agentRegisterSchema = z.object({
224
229
  /** Username of the OS user running the agent process */
225
230
  runningAsUser: z.string().optional(),
226
231
  /** UID of the OS user running the agent process */
227
- runningAsUid: z.number().optional()
232
+ runningAsUid: z.number().optional(),
233
+ /**
234
+ * Agent-reported typed host-vars (the `KICI_PROPERTIES` bag). Values are
235
+ * `string | number | boolean`; shallow-merged into the host roster's
236
+ * `host_properties` (agent-reported keys win). Optional — omitted ⇒ none.
237
+ */
238
+ properties: z.record(z.string(), z.union([
239
+ z.string(),
240
+ z.number(),
241
+ z.boolean()
242
+ ])).optional()
228
243
  });
229
244
  /** Periodic agent status update. */
230
245
  const agentStatusSchema = z.object({
@@ -628,12 +643,24 @@ const StepApprovalOutcome = z.enum([
628
643
  "expired"
629
644
  ]);
630
645
  /**
631
- * 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
632
658
  * the agent is blocking its step loop until the orchestrator resolves the
633
659
  * approval. The orchestrator creates a step-scoped `held_runs` row from the
634
660
  * normalized requirement and replies with `step.approval-resolved` once the
635
661
  * hold is approved, rejected, or expired. The agent keeps heartbeats flowing
636
- * 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`.
637
664
  *
638
665
  * NOT fast-pathed — the `log.chunk` / `heartbeat` manual-validator invariant is
639
666
  * untouched by this message.
@@ -647,14 +674,16 @@ const stepApprovalRequestSchema = z.object({
647
674
  stepName: z.string(),
648
675
  /** AND-list of approver clauses (empty = any approval-capable member). */
649
676
  clauses: z.array(approverClauseSchema),
650
- /** Human label for the gate (from the SDK `requireApproval` reason). */
677
+ /** Human label for the gate (from the SDK `approval` reason). */
651
678
  reason: z.string(),
652
679
  /**
653
- * Per-gate timeout override (seconds) from the SDK `requireApproval.timeout`.
680
+ * Per-gate timeout override (seconds) from the SDK `approval.timeout`.
654
681
  * Absent ⇒ the orchestrator uses the org-default `approval_expiry_seconds`.
655
682
  * The orchestrator owns the authoritative `expiresAt` computation.
656
683
  */
657
- 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()
658
687
  });
659
688
  /**
660
689
  * Orchestrator -> Agent: resolution of a step-level approval hold. `requestId`
@@ -719,6 +748,6 @@ const agentToOrchestratorMessageSchema = z.discriminatedUnion("type", [
719
748
  stepApprovalRequestSchema
720
749
  ]);
721
750
  //#endregion
722
- 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 };
723
752
 
724
753
  //# sourceMappingURL=orchestrator-agent.js.map