@kici-dev/engine 0.1.26 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/dist/approval/types.d.ts +11 -4
  2. package/dist/approval/types.js +11 -4
  3. package/dist/artifacts/name.d.ts +60 -0
  4. package/dist/artifacts/name.js +71 -0
  5. package/dist/audit/access-log-policy.d.ts +1 -1
  6. package/dist/audit/access-log-policy.js +20 -11
  7. package/dist/audit/activity.d.ts +12 -12
  8. package/dist/audit/retention-policy.js +40 -22
  9. package/dist/billing/plan-type.d.ts +53 -0
  10. package/dist/billing/plan-type.js +70 -0
  11. package/dist/bundler/rolldown-config.d.ts +3 -3
  12. package/dist/check-mode.d.ts +1 -1
  13. package/dist/context/concurrency-strategy.d.ts +34 -0
  14. package/dist/context/concurrency-strategy.js +35 -0
  15. package/dist/context/held-run-job-id.d.ts +45 -0
  16. package/dist/context/held-run-job-id.js +56 -0
  17. package/dist/context/held-run-status.d.ts +33 -0
  18. package/dist/context/held-run-status.js +37 -0
  19. package/dist/context/hold-expiry.d.ts +20 -0
  20. package/dist/context/hold-expiry.js +25 -0
  21. package/dist/context/hold-reason.d.ts +33 -0
  22. package/dist/context/hold-reason.js +23 -0
  23. package/dist/context/hold-type.d.ts +40 -0
  24. package/dist/context/hold-type.js +61 -0
  25. package/dist/{environment → context}/host-match.js +1 -1
  26. package/dist/context/index.d.ts +14 -0
  27. package/dist/context/index.js +12 -0
  28. package/dist/context/multi-context.d.ts +30 -0
  29. package/dist/context/multi-context.js +38 -0
  30. package/dist/context/scope-name.d.ts +29 -0
  31. package/dist/context/scope-name.js +49 -0
  32. package/dist/context/scope-resolver.d.ts +79 -0
  33. package/dist/{environment → context}/scope-resolver.js +47 -17
  34. package/dist/{environment → context}/scope-template.js +1 -1
  35. package/dist/{environment → context}/types.d.ts +25 -22
  36. package/dist/{environment → context}/types.js +3 -3
  37. package/dist/dev-ops/operations.d.ts +9 -1
  38. package/dist/dev-ops/operations.js +37 -20
  39. package/dist/diagnostics/infra-alert.d.ts +71 -0
  40. package/dist/diagnostics/infra-alert.js +60 -0
  41. package/dist/env/environment-allowlist.d.ts +26 -3
  42. package/dist/env/environment-allowlist.js +35 -1
  43. package/dist/fanout/materialize.d.ts +16 -0
  44. package/dist/fanout/materialize.js +34 -5
  45. package/dist/index.d.ts +16 -7
  46. package/dist/index.js +38 -23
  47. package/dist/inputs/descriptor.d.ts +9 -9
  48. package/dist/inventory.d.ts +4 -4
  49. package/dist/labels.d.ts +82 -2
  50. package/dist/labels.js +119 -1
  51. package/dist/matrix/expand.d.ts +49 -2
  52. package/dist/matrix/expand.js +102 -13
  53. package/dist/matrix/format.d.ts +6 -1
  54. package/dist/matrix/format.js +6 -1
  55. package/dist/mcp/held-run-resolve.d.ts +7 -10
  56. package/dist/mcp/held-run-resolve.js +33 -7
  57. package/dist/metrics/catalog-policy.js +4 -4
  58. package/dist/metrics/metric-catalog.generated.d.ts +954 -734
  59. package/dist/metrics/metric-catalog.generated.js +296 -32
  60. package/dist/metrics/metric-kind-compat.d.ts +26 -0
  61. package/dist/metrics/metric-kind-compat.js +33 -0
  62. package/dist/protocol/analytics-events.d.ts +6 -6
  63. package/dist/protocol/dashboard-api-errors.d.ts +13 -0
  64. package/dist/protocol/dashboard-api-errors.js +17 -0
  65. package/dist/protocol/dashboard-write-operations.d.ts +143 -86
  66. package/dist/protocol/dashboard-write-operations.js +143 -69
  67. package/dist/protocol/messages/access-log.d.ts +438 -388
  68. package/dist/protocol/messages/access-log.js +24 -14
  69. package/dist/protocol/messages/actor.d.ts +2 -2
  70. package/dist/protocol/messages/agent-dev-ops.d.ts +4 -2
  71. package/dist/protocol/messages/agent-dev-ops.js +2 -5
  72. package/dist/protocol/messages/agent-run-result.d.ts +74 -64
  73. package/dist/protocol/messages/agent-run-result.js +1 -1
  74. package/dist/protocol/messages/auth.d.ts +35 -23
  75. package/dist/protocol/messages/browser.d.ts +81 -5
  76. package/dist/protocol/messages/browser.js +53 -2
  77. package/dist/protocol/messages/capabilities.d.ts +106 -31
  78. package/dist/protocol/messages/capabilities.js +94 -10
  79. package/dist/protocol/messages/common.d.ts +45 -2
  80. package/dist/protocol/messages/common.js +64 -3
  81. package/dist/protocol/messages/dashboard-sealed-write.d.ts +52 -0
  82. package/dist/protocol/messages/dashboard-sealed-write.js +57 -0
  83. package/dist/protocol/messages/dashboard.d.ts +1232 -706
  84. package/dist/protocol/messages/dashboard.js +387 -220
  85. package/dist/protocol/messages/deployment-identity.d.ts +37 -10
  86. package/dist/protocol/messages/deployment-identity.js +30 -3
  87. package/dist/protocol/messages/event-log.d.ts +5 -5
  88. package/dist/protocol/messages/execution-status.d.ts +198 -62
  89. package/dist/protocol/messages/execution-status.js +114 -46
  90. package/dist/protocol/messages/heartbeat-health.d.ts +83 -0
  91. package/dist/protocol/messages/heartbeat-health.js +87 -0
  92. package/dist/protocol/messages/log-stream.d.ts +18 -0
  93. package/dist/protocol/messages/log-stream.js +19 -0
  94. package/dist/protocol/messages/oidc-mint.d.ts +7 -0
  95. package/dist/protocol/messages/oidc-mint.js +7 -0
  96. package/dist/protocol/messages/orchestrator-agent.d.ts +264 -67
  97. package/dist/protocol/messages/orchestrator-agent.js +170 -5
  98. package/dist/protocol/messages/pat-kind.d.ts +1 -1
  99. package/dist/protocol/messages/peer.d.ts +122 -58
  100. package/dist/protocol/messages/peer.js +37 -2
  101. package/dist/protocol/messages/platform-orchestrator.d.ts +603 -258
  102. package/dist/protocol/messages/platform-orchestrator.js +131 -21
  103. package/dist/protocol/messages/run-events.d.ts +5 -5
  104. package/dist/protocol/messages/scaler-event.d.ts +3 -3
  105. package/dist/protocol/messages/source-registration.d.ts +56 -13
  106. package/dist/protocol/messages/source-registration.js +49 -6
  107. package/dist/protocol/session-policy.d.ts +20 -0
  108. package/dist/protocol/session-policy.js +25 -0
  109. package/dist/protocol/source-origin.d.ts +1 -1
  110. package/dist/provenance/attestation-origin.d.ts +1 -1
  111. package/dist/provenance/schema.d.ts +11 -11
  112. package/dist/provenance/verify.js +2 -1
  113. package/dist/provider/changed-files-fetcher.d.ts +21 -2
  114. package/dist/provider/check-run-conclusion.d.ts +2 -2
  115. package/dist/provider/check-status-poster.d.ts +23 -0
  116. package/dist/provider/index.d.ts +2 -2
  117. package/dist/registration/registerable-trigger-type.d.ts +14 -13
  118. package/dist/registration/registerable-trigger-type.js +1 -0
  119. package/dist/sandbox/capabilities.d.ts +6 -0
  120. package/dist/sandbox/capabilities.js +57 -0
  121. package/dist/scaler/scaler-backend-type.d.ts +1 -1
  122. package/dist/status/presentation.d.ts +89 -0
  123. package/dist/status/presentation.js +163 -0
  124. package/dist/trigger/compiled-matchers.d.ts +13 -0
  125. package/dist/trigger/compiled-matchers.js +44 -0
  126. package/dist/trigger/event-buckets.d.ts +44 -0
  127. package/dist/trigger/event-buckets.js +93 -0
  128. package/dist/trigger/matcher.d.ts +7 -3
  129. package/dist/trigger/matcher.js +53 -15
  130. package/dist/trigger/schedule-key.d.ts +14 -0
  131. package/dist/trigger/schedule-key.js +21 -0
  132. package/dist/trigger/trigger-event-type.d.ts +1 -1
  133. package/dist/trigger/trigger-event-type.js +2 -0
  134. package/dist/trigger/types.d.ts +178 -47
  135. package/dist/trigger/types.js +82 -24
  136. package/dist/webhook/event-types.d.ts +56 -0
  137. package/dist/webhook/event-types.js +59 -0
  138. package/dist/ws/ws-like.d.ts +13 -0
  139. package/package.json +26 -10
  140. package/sbom.spdx.json +10 -10
  141. package/dist/environment/index.d.ts +0 -6
  142. package/dist/environment/index.js +0 -5
  143. package/dist/environment/multi-env.d.ts +0 -30
  144. package/dist/environment/multi-env.js +0 -38
  145. package/dist/environment/scope-resolver.d.ts +0 -46
  146. package/dist/package-manager.d.ts +0 -20
  147. package/dist/protocol/messages/observe.d.ts +0 -76
  148. package/dist/protocol/messages/saas-orchestrator.d.ts +0 -2179
  149. package/dist/protocol/messages/test-run.d.ts +0 -59
  150. package/dist/state-machine/index.d.ts +0 -2
  151. package/dist/state-machine/index.js +0 -3
  152. package/dist/state-machine/machine.d.ts +0 -34
  153. package/dist/state-machine/machine.js +0 -103
  154. package/dist/state-machine/types.d.ts +0 -34
  155. package/dist/state-machine/types.js +0 -15
  156. /package/dist/{environment → context}/host-match.d.ts +0 -0
  157. /package/dist/{environment → context}/scope-template.d.ts +0 -0
@@ -1,38 +1,65 @@
1
1
  import { z } from 'zod';
2
2
  /** How the orchestrator process itself was deployed (not how it runs agents). */
3
3
  export declare const DeploymentModeSchema: z.ZodEnum<{
4
- unknown: "unknown";
5
- systemd: "systemd";
4
+ compose: "compose";
6
5
  launchd: "launchd";
6
+ systemd: "systemd";
7
+ unknown: "unknown";
7
8
  windows: "windows";
8
- compose: "compose";
9
9
  }>;
10
10
  export type DeploymentMode = z.infer<typeof DeploymentModeSchema>;
11
11
  /** Container runtime that launched a `compose`-mode orchestrator. */
12
12
  export declare const DeploymentContainerRuntimeSchema: z.ZodEnum<{
13
- podman: "podman";
14
13
  docker: "docker";
14
+ podman: "podman";
15
15
  }>;
16
16
  export type DeploymentContainerRuntime = z.infer<typeof DeploymentContainerRuntimeSchema>;
17
17
  /**
18
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
19
+ * kici-admin invocation in the dashboard Infrastructure page. Container fields are
20
20
  * populated only for the `compose` mode; a hand-run orchestrator reports
21
- * `mode: 'unknown'` with no container fields.
21
+ * `mode: 'unknown'` with no container fields. `adminInvocation` is the pinned
22
+ * `<node> <kici-admin>` invocation for posix bare-metal (`systemd` / `launchd`),
23
+ * set by the orchestrator from its own `process.execPath` so a copied command
24
+ * runs under the unit's pinned runtime rather than whatever `node` the
25
+ * operator's shell resolves. The orchestrator locates the shim on disk and omits
26
+ * the field when it cannot, so a reader may always fall back to a PATH-resolved
27
+ * bare `kici-admin`. It is a live-host runtime path, carried only on the
28
+ * in-memory identity (never persisted).
29
+ *
30
+ * The value is a shell command, not a pair of raw paths: either half is
31
+ * single-quoted (POSIX `'\''` escaping) when its path holds whitespace or another
32
+ * shell metacharacter, so it can be pasted as-is. A reader that only displays it
33
+ * needs no special handling; a reader that wants the shim path back out has to
34
+ * split it as shell words rather than on the last space.
35
+ *
36
+ * `adminPath` is the Windows counterpart and is set only for `mode: 'windows'`:
37
+ * the absolute path of the `kici-admin.cmd` launcher, when the orchestrator can
38
+ * locate it. Unlike `adminInvocation` it is a RAW path and never a command —
39
+ * nothing about it is quoted or escaped. That is deliberate: cmd.exe runs a
40
+ * double-quoted path in command position while PowerShell merely *prints* it
41
+ * (it needs the `&` call operator), so the same path has to be written two
42
+ * different ways and only the reader knows which shell it is rendering for. A
43
+ * producer that pre-quoted would take that choice away. It is a live-host
44
+ * runtime path, carried only on the in-memory identity (never persisted), and
45
+ * omitted when the launcher cannot be located so a reader falls back to a
46
+ * PATH-resolved bare `kici-admin.cmd`.
22
47
  */
23
48
  export declare const DeploymentIdentitySchema: z.ZodObject<{
24
49
  mode: z.ZodEnum<{
25
- unknown: "unknown";
26
- systemd: "systemd";
50
+ compose: "compose";
27
51
  launchd: "launchd";
52
+ systemd: "systemd";
53
+ unknown: "unknown";
28
54
  windows: "windows";
29
- compose: "compose";
30
55
  }>;
31
56
  containerName: z.ZodOptional<z.ZodString>;
32
57
  containerRuntime: z.ZodOptional<z.ZodEnum<{
33
- podman: "podman";
34
58
  docker: "docker";
59
+ podman: "podman";
35
60
  }>>;
61
+ adminInvocation: z.ZodOptional<z.ZodString>;
62
+ adminPath: z.ZodOptional<z.ZodString>;
36
63
  }, z.core.$strip>;
37
64
  export type DeploymentIdentity = z.infer<typeof DeploymentIdentitySchema>;
38
65
  //# sourceMappingURL=deployment-identity.d.ts.map
@@ -13,14 +13,41 @@ const DeploymentModeSchema = z.enum([
13
13
  const DeploymentContainerRuntimeSchema = z.enum(["podman", "docker"]);
14
14
  /**
15
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
16
+ * kici-admin invocation in the dashboard Infrastructure page. Container fields are
17
17
  * populated only for the `compose` mode; a hand-run orchestrator reports
18
- * `mode: 'unknown'` with no container fields.
18
+ * `mode: 'unknown'` with no container fields. `adminInvocation` is the pinned
19
+ * `<node> <kici-admin>` invocation for posix bare-metal (`systemd` / `launchd`),
20
+ * set by the orchestrator from its own `process.execPath` so a copied command
21
+ * runs under the unit's pinned runtime rather than whatever `node` the
22
+ * operator's shell resolves. The orchestrator locates the shim on disk and omits
23
+ * the field when it cannot, so a reader may always fall back to a PATH-resolved
24
+ * bare `kici-admin`. It is a live-host runtime path, carried only on the
25
+ * in-memory identity (never persisted).
26
+ *
27
+ * The value is a shell command, not a pair of raw paths: either half is
28
+ * single-quoted (POSIX `'\''` escaping) when its path holds whitespace or another
29
+ * shell metacharacter, so it can be pasted as-is. A reader that only displays it
30
+ * needs no special handling; a reader that wants the shim path back out has to
31
+ * split it as shell words rather than on the last space.
32
+ *
33
+ * `adminPath` is the Windows counterpart and is set only for `mode: 'windows'`:
34
+ * the absolute path of the `kici-admin.cmd` launcher, when the orchestrator can
35
+ * locate it. Unlike `adminInvocation` it is a RAW path and never a command —
36
+ * nothing about it is quoted or escaped. That is deliberate: cmd.exe runs a
37
+ * double-quoted path in command position while PowerShell merely *prints* it
38
+ * (it needs the `&` call operator), so the same path has to be written two
39
+ * different ways and only the reader knows which shell it is rendering for. A
40
+ * producer that pre-quoted would take that choice away. It is a live-host
41
+ * runtime path, carried only on the in-memory identity (never persisted), and
42
+ * omitted when the launcher cannot be located so a reader falls back to a
43
+ * PATH-resolved bare `kici-admin.cmd`.
19
44
  */
20
45
  const DeploymentIdentitySchema = z.object({
21
46
  mode: DeploymentModeSchema,
22
47
  containerName: z.string().min(1).optional(),
23
- containerRuntime: DeploymentContainerRuntimeSchema.optional()
48
+ containerRuntime: DeploymentContainerRuntimeSchema.optional(),
49
+ adminInvocation: z.string().min(1).optional(),
50
+ adminPath: z.string().min(1).optional()
24
51
  });
25
52
  //#endregion
26
53
  export { DeploymentContainerRuntimeSchema, DeploymentIdentitySchema, DeploymentModeSchema };
@@ -16,12 +16,12 @@ import { z } from 'zod';
16
16
  * the message.
17
17
  */
18
18
  export declare const EventLogStatus: z.ZodEnum<{
19
- failed: "failed";
20
- received: "received";
21
- processed: "processed";
22
19
  duplicate: "duplicate";
23
- lockfile_missing: "lockfile_missing";
20
+ failed: "failed";
24
21
  lockfile_corrupt: "lockfile_corrupt";
22
+ lockfile_missing: "lockfile_missing";
23
+ processed: "processed";
24
+ received: "received";
25
25
  }>;
26
26
  export type EventLogStatus = z.infer<typeof EventLogStatus>;
27
27
  /**
@@ -46,8 +46,8 @@ export type PayloadOmittedReason = z.infer<typeof PayloadOmittedReason>;
46
46
  * - `direct` — Direct HTTP ingress (independent / hybrid mode).
47
47
  */
48
48
  export declare const EventLogSource: z.ZodEnum<{
49
- relay: "relay";
50
49
  direct: "direct";
50
+ relay: "relay";
51
51
  }>;
52
52
  export type EventLogSource = z.infer<typeof EventLogSource>;
53
53
  //# sourceMappingURL=event-log.d.ts.map
@@ -11,8 +11,8 @@ export declare const STATE_REPLAY_MAX_RUNS = 500;
11
11
  export declare const MAX_JOBS_PER_RUN = 1000;
12
12
  /** Max number of `runsOn` / `secretsAccessed` label entries on a job/step. */
13
13
  export declare const RUNS_ON_LABELS_MAX = 30;
14
- /** Max number of bound deployment-environment names on a job. */
15
- export declare const ENVIRONMENTS_MAX = 30;
14
+ /** Max number of bound context names on a job. */
15
+ export declare const CONTEXTS_MAX = 30;
16
16
  /**
17
17
  * Status values for execution runs (execution_runs table).
18
18
  *
@@ -24,28 +24,37 @@ export declare const ENVIRONMENTS_MAX = 30;
24
24
  * transitions to `cancelled`.
25
25
  */
26
26
  export declare const ExecutionRunStatus: z.ZodEnum<{
27
- success: "success";
28
- pending: "pending";
29
- running: "running";
30
- failed: "failed";
31
27
  cancelled: "cancelled";
32
28
  cancelling: "cancelling";
29
+ failed: "failed";
33
30
  held: "held";
31
+ pending: "pending";
32
+ running: "running";
33
+ success: "success";
34
34
  }>;
35
35
  export type ExecutionRunStatus = z.infer<typeof ExecutionRunStatus>;
36
- /** Status values for execution jobs (execution_jobs table + job.status protocol messages). */
36
+ /**
37
+ * Status values for execution jobs (execution_jobs table + job.status protocol messages).
38
+ *
39
+ * `unroutable` = the job's `runsOn` matched no agent for the whole queue
40
+ * window, so it never ran. Distinct from `failed` (a failed job ran and has
41
+ * logs to read; an unroutable one has a fleet/label problem to fix), from
42
+ * `skipped` (a condition deliberately excluded it) and from `timed_out_stale`
43
+ * (capacity existed but never freed up).
44
+ */
37
45
  export declare const ExecutionJobStatus: z.ZodEnum<{
38
- skipped: "skipped";
39
- success: "success";
40
- pending: "pending";
41
- running: "running";
42
- failed: "failed";
43
46
  cancelled: "cancelled";
44
47
  cancelling: "cancelling";
48
+ drift_dropped: "drift_dropped";
49
+ failed: "failed";
50
+ pending: "pending";
45
51
  queued: "queued";
46
52
  recovering: "recovering";
53
+ running: "running";
54
+ skipped: "skipped";
55
+ success: "success";
47
56
  timed_out_stale: "timed_out_stale";
48
- drift_dropped: "drift_dropped";
57
+ unroutable: "unroutable";
49
58
  }>;
50
59
  export type ExecutionJobStatus = z.infer<typeof ExecutionJobStatus>;
51
60
  /**
@@ -65,12 +74,12 @@ export declare function statusOptionsForLevel(level: 'run' | 'job'): readonly st
65
74
  * - `cancelled` — a parallel-group sibling aborted by fail-fast (NOT a failure).
66
75
  */
67
76
  export declare const ExecutionStepStatus: z.ZodEnum<{
68
- skipped: "skipped";
69
- success: "success";
77
+ cancelled: "cancelled";
78
+ failed: "failed";
70
79
  pending: "pending";
71
80
  running: "running";
72
- failed: "failed";
73
- cancelled: "cancelled";
81
+ skipped: "skipped";
82
+ success: "success";
74
83
  }>;
75
84
  export type ExecutionStepStatus = z.infer<typeof ExecutionStepStatus>;
76
85
  /**
@@ -83,9 +92,9 @@ export type ExecutionStepStatus = z.infer<typeof ExecutionStepStatus>;
83
92
  * only for the dashboard band aggregate, not persisted per step.
84
93
  */
85
94
  export declare const StepConcurrencyKind: z.ZodEnum<{
86
- sequential: "sequential";
87
95
  "parallel-child": "parallel-child";
88
96
  "parallel-group": "parallel-group";
97
+ sequential: "sequential";
89
98
  }>;
90
99
  export type StepConcurrencyKind = z.infer<typeof StepConcurrencyKind>;
91
100
  /**
@@ -115,21 +124,45 @@ export type TimeoutReason = z.infer<typeof TimeoutReason>;
115
124
  * Scope is carried separately on `initFailureSchema.scope`:
116
125
  * - `run`-scoped categories fail the whole run before any job runs
117
126
  * (secret_resolution, install_secrets, lock_resolution,
118
- * build_coordination).
127
+ * build_coordination, approval_misconfig, sandbox_denied, trust_policy).
119
128
  * - `job`-scoped categories fail one job and leave siblings alone
120
- * (environment_rules, dynamic_eval, no_agent, matrix_expansion).
129
+ * (context_rules, dynamic_eval, no_agent, matrix_expansion).
121
130
  */
122
131
  export declare const InitFailureCategory: z.ZodEnum<{
123
- secret_resolution: "secret_resolution";
124
- install_secrets: "install_secrets";
125
- lock_resolution: "lock_resolution";
132
+ approval_misconfig: "approval_misconfig";
126
133
  build_coordination: "build_coordination";
127
- environment_rules: "environment_rules";
134
+ context_rules: "context_rules";
128
135
  dynamic_eval: "dynamic_eval";
129
- no_agent: "no_agent";
136
+ install_secrets: "install_secrets";
137
+ lock_resolution: "lock_resolution";
130
138
  matrix_expansion: "matrix_expansion";
139
+ no_agent: "no_agent";
140
+ sandbox_denied: "sandbox_denied";
141
+ secret_resolution: "secret_resolution";
142
+ trust_policy: "trust_policy";
131
143
  }>;
132
144
  export type InitFailureCategory = z.infer<typeof InitFailureCategory>;
145
+ /**
146
+ * Why a terminal run failed (only meaningful for failed/cancelled runs):
147
+ * - never_started — init failure (no_agent/secret/lock/build); no step ran.
148
+ * - timed_out — a job timed out (never dispatched, or agent went silent).
149
+ * - dead_orchestrator — the Platform failed the run because its orchestrator died.
150
+ * - step_failure — a job actually ran and failed.
151
+ * - cancelled — the run was cancelled.
152
+ *
153
+ * Derived at run completion from the terminal job statuses, because
154
+ * `timed_out`/`step_failure` both collapse to run-status `failed` — the status
155
+ * alone can't carry it. `never_started` is stamped by the init-failure paths and
156
+ * `dead_orchestrator` is stamped Platform-side by the dead-orchestrator detector.
157
+ */
158
+ export declare const RunFailureClass: z.ZodEnum<{
159
+ cancelled: "cancelled";
160
+ dead_orchestrator: "dead_orchestrator";
161
+ never_started: "never_started";
162
+ step_failure: "step_failure";
163
+ timed_out: "timed_out";
164
+ }>;
165
+ export type RunFailureClass = z.infer<typeof RunFailureClass>;
133
166
  /**
134
167
  * `step_type` values for the user-facing cache pseudo-steps that appear in the
135
168
  * run timeline. Mirrors the `hook:*` pseudo-step `step_type` convention: each
@@ -158,13 +191,21 @@ export type CacheRunEventType = z.infer<typeof CacheRunEventType>;
158
191
  * - `error` — the restore/save failed (pack/extract/transport error).
159
192
  */
160
193
  export declare const CacheOutcome: z.ZodEnum<{
161
- skipped: "skipped";
162
194
  error: "error";
163
195
  hit: "hit";
164
196
  miss: "miss";
165
197
  saved: "saved";
198
+ skipped: "skipped";
166
199
  }>;
167
200
  export type CacheOutcome = z.infer<typeof CacheOutcome>;
201
+ /**
202
+ * Failure reason the Platform records on a run it fails because that run's
203
+ * orchestrator disconnected and did not reconnect within the stale threshold.
204
+ * Written by the Platform stale-detector into `execution_runs.failure_reason`
205
+ * and matched by the dashboard to render the "stale / offline" run badge. A
206
+ * shared constant so the writer (Platform) and reader (dashboard) never drift.
207
+ */
208
+ export declare const DEAD_ORCH_FAILURE_REASON = "Orchestrator disconnected and did not recover";
168
209
  /** Structured init-failure signal. Presence on a run/job means "never started". */
169
210
  export declare const initFailureSchema: z.ZodObject<{
170
211
  scope: z.ZodEnum<{
@@ -172,14 +213,17 @@ export declare const initFailureSchema: z.ZodObject<{
172
213
  run: "run";
173
214
  }>;
174
215
  category: z.ZodEnum<{
175
- secret_resolution: "secret_resolution";
176
- install_secrets: "install_secrets";
177
- lock_resolution: "lock_resolution";
216
+ approval_misconfig: "approval_misconfig";
178
217
  build_coordination: "build_coordination";
179
- environment_rules: "environment_rules";
218
+ context_rules: "context_rules";
180
219
  dynamic_eval: "dynamic_eval";
181
- no_agent: "no_agent";
220
+ install_secrets: "install_secrets";
221
+ lock_resolution: "lock_resolution";
182
222
  matrix_expansion: "matrix_expansion";
223
+ no_agent: "no_agent";
224
+ sandbox_denied: "sandbox_denied";
225
+ secret_resolution: "secret_resolution";
226
+ trust_policy: "trust_policy";
183
227
  }>;
184
228
  message: z.ZodString;
185
229
  jobName: z.ZodOptional<z.ZodString>;
@@ -189,6 +233,20 @@ export type InitFailure = z.infer<typeof initFailureSchema>;
189
233
  export declare const TERMINAL_RUN_STATES: ReadonlySet<string>;
190
234
  /** Terminal job states that indicate the job is no longer running. */
191
235
  export declare const TERMINAL_JOB_STATES: ReadonlySet<string>;
236
+ /**
237
+ * The type-level counterpart of `TERMINAL_JOB_STATES`.
238
+ *
239
+ * Written as `Exclude<>` of the non-terminal statuses, never `Extract<>` of the
240
+ * terminal ones. That direction is load-bearing: `Extract<ExecutionJobStatus,
241
+ * 'success' | …>` does not widen when a value is added to the enum, so an
242
+ * exhaustive switch over it keeps compiling and its `never` default arm is
243
+ * inert. `Exclude<>` does widen, so a new status becomes a compile error at
244
+ * every switch that claims to be total over the terminal set — which is the
245
+ * only reason to write such a switch.
246
+ */
247
+ export type TerminalJobStatus = Exclude<ExecutionJobStatus, 'pending' | 'queued' | 'running' | 'recovering' | 'cancelling'>;
248
+ /** Terminal step states that indicate the step is no longer running. */
249
+ export declare const TERMINAL_STEP_STATES: ReadonlySet<string>;
192
250
  /** Structured execution status update for Platform metadata tracking. */
193
251
  export declare const executionStatusSchema: z.ZodObject<{
194
252
  type: z.ZodLiteral<"execution.status">;
@@ -196,14 +254,15 @@ export declare const executionStatusSchema: z.ZodObject<{
196
254
  runId: z.ZodString;
197
255
  workflowName: z.ZodString;
198
256
  status: z.ZodEnum<{
199
- success: "success";
200
- pending: "pending";
201
- running: "running";
202
- failed: "failed";
203
257
  cancelled: "cancelled";
204
258
  cancelling: "cancelling";
259
+ failed: "failed";
205
260
  held: "held";
261
+ pending: "pending";
262
+ running: "running";
263
+ success: "success";
206
264
  }>;
265
+ routingKey: z.ZodOptional<z.ZodString>;
207
266
  repoIdentifier: z.ZodOptional<z.ZodString>;
208
267
  repoProvider: z.ZodOptional<z.ZodString>;
209
268
  localWorkingTree: z.ZodOptional<z.ZodBoolean>;
@@ -231,18 +290,28 @@ export declare const executionStatusSchema: z.ZodObject<{
231
290
  run: "run";
232
291
  }>;
233
292
  category: z.ZodEnum<{
234
- secret_resolution: "secret_resolution";
235
- install_secrets: "install_secrets";
236
- lock_resolution: "lock_resolution";
293
+ approval_misconfig: "approval_misconfig";
237
294
  build_coordination: "build_coordination";
238
- environment_rules: "environment_rules";
295
+ context_rules: "context_rules";
239
296
  dynamic_eval: "dynamic_eval";
240
- no_agent: "no_agent";
297
+ install_secrets: "install_secrets";
298
+ lock_resolution: "lock_resolution";
241
299
  matrix_expansion: "matrix_expansion";
300
+ no_agent: "no_agent";
301
+ sandbox_denied: "sandbox_denied";
302
+ secret_resolution: "secret_resolution";
303
+ trust_policy: "trust_policy";
242
304
  }>;
243
305
  message: z.ZodString;
244
306
  jobName: z.ZodOptional<z.ZodString>;
245
307
  }, z.core.$strip>>;
308
+ failureClass: z.ZodOptional<z.ZodEnum<{
309
+ cancelled: "cancelled";
310
+ dead_orchestrator: "dead_orchestrator";
311
+ never_started: "never_started";
312
+ step_failure: "step_failure";
313
+ timed_out: "timed_out";
314
+ }>>;
246
315
  }, z.core.$strip>;
247
316
  /** Per-step status forwarded from agent to Platform (real-time). */
248
317
  export declare const stepStatusForwardSchema: z.ZodObject<{
@@ -254,20 +323,20 @@ export declare const stepStatusForwardSchema: z.ZodObject<{
254
323
  stepIndex: z.ZodNumber;
255
324
  stepName: z.ZodString;
256
325
  state: z.ZodEnum<{
257
- skipped: "skipped";
258
- success: "success";
326
+ cancelled: "cancelled";
327
+ failed: "failed";
259
328
  pending: "pending";
260
329
  running: "running";
261
- failed: "failed";
262
- cancelled: "cancelled";
330
+ skipped: "skipped";
331
+ success: "success";
263
332
  }>;
264
333
  timestamp: z.ZodNumber;
265
334
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
266
335
  secretsAccessed: z.ZodOptional<z.ZodArray<z.ZodString>>;
267
336
  concurrencyKind: z.ZodOptional<z.ZodEnum<{
268
- sequential: "sequential";
269
337
  "parallel-child": "parallel-child";
270
338
  "parallel-group": "parallel-group";
339
+ sequential: "sequential";
271
340
  }>>;
272
341
  groupId: z.ZodOptional<z.ZodString>;
273
342
  }, z.core.$strip>;
@@ -279,17 +348,18 @@ export declare const jobStatusForwardSchema: z.ZodObject<{
279
348
  jobId: z.ZodString;
280
349
  jobName: z.ZodString;
281
350
  status: z.ZodEnum<{
282
- skipped: "skipped";
283
- success: "success";
284
- pending: "pending";
285
- running: "running";
286
- failed: "failed";
287
351
  cancelled: "cancelled";
288
352
  cancelling: "cancelling";
353
+ drift_dropped: "drift_dropped";
354
+ failed: "failed";
355
+ pending: "pending";
289
356
  queued: "queued";
290
357
  recovering: "recovering";
358
+ running: "running";
359
+ skipped: "skipped";
360
+ success: "success";
291
361
  timed_out_stale: "timed_out_stale";
292
- drift_dropped: "drift_dropped";
362
+ unroutable: "unroutable";
293
363
  }>;
294
364
  matrixValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
295
365
  startedAt: z.ZodOptional<z.ZodNumber>;
@@ -299,7 +369,7 @@ export declare const jobStatusForwardSchema: z.ZodObject<{
299
369
  agentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
300
370
  orchestratorId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
301
371
  runsOnLabels: z.ZodOptional<z.ZodArray<z.ZodString>>;
302
- environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
372
+ contexts: z.ZodOptional<z.ZodArray<z.ZodString>>;
303
373
  logBytes: z.ZodOptional<z.ZodNumber>;
304
374
  timestamp: z.ZodNumber;
305
375
  initFailure: z.ZodOptional<z.ZodObject<{
@@ -308,20 +378,79 @@ export declare const jobStatusForwardSchema: z.ZodObject<{
308
378
  run: "run";
309
379
  }>;
310
380
  category: z.ZodEnum<{
311
- secret_resolution: "secret_resolution";
312
- install_secrets: "install_secrets";
313
- lock_resolution: "lock_resolution";
381
+ approval_misconfig: "approval_misconfig";
314
382
  build_coordination: "build_coordination";
315
- environment_rules: "environment_rules";
383
+ context_rules: "context_rules";
316
384
  dynamic_eval: "dynamic_eval";
317
- no_agent: "no_agent";
385
+ install_secrets: "install_secrets";
386
+ lock_resolution: "lock_resolution";
318
387
  matrix_expansion: "matrix_expansion";
388
+ no_agent: "no_agent";
389
+ sandbox_denied: "sandbox_denied";
390
+ secret_resolution: "secret_resolution";
391
+ trust_policy: "trust_policy";
319
392
  }>;
320
393
  message: z.ZodString;
321
394
  jobName: z.ZodOptional<z.ZodString>;
322
395
  }, z.core.$strip>>;
323
396
  }, z.core.$strip>;
324
397
  /** State replay sent on orchestrator reconnection -- full snapshot of active runs and jobs. */
398
+ /**
399
+ * A single run's full mirror-projection shape, as carried in `state.replay`.
400
+ *
401
+ * Carried by the orchestrator-reconnect `state.replay` push and consumed by the
402
+ * Platform's shared `upsertRunMirror` mirror-projection helper. Extracting it as
403
+ * a named schema keeps a single source of truth for any future reconciliation
404
+ * path that projects the same per-run shape.
405
+ */
406
+ export declare const stateReplayRunSchema: z.ZodObject<{
407
+ runId: z.ZodString;
408
+ workflowName: z.ZodString;
409
+ status: z.ZodEnum<{
410
+ cancelled: "cancelled";
411
+ cancelling: "cancelling";
412
+ failed: "failed";
413
+ held: "held";
414
+ pending: "pending";
415
+ running: "running";
416
+ success: "success";
417
+ }>;
418
+ routingKey: z.ZodOptional<z.ZodString>;
419
+ repoIdentifier: z.ZodOptional<z.ZodString>;
420
+ sha: z.ZodOptional<z.ZodString>;
421
+ ref: z.ZodOptional<z.ZodString>;
422
+ triggerEvent: z.ZodOptional<z.ZodString>;
423
+ commitMessage: z.ZodOptional<z.ZodString>;
424
+ jobCount: z.ZodNumber;
425
+ startedAt: z.ZodNumber;
426
+ completedAt: z.ZodOptional<z.ZodNumber>;
427
+ durationMs: z.ZodOptional<z.ZodNumber>;
428
+ parentRunId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
429
+ originalRunId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
430
+ triggeredBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
431
+ triggeredByAgentLabel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
432
+ failureReason: z.ZodOptional<z.ZodString>;
433
+ failureClass: z.ZodOptional<z.ZodEnum<{
434
+ cancelled: "cancelled";
435
+ dead_orchestrator: "dead_orchestrator";
436
+ never_started: "never_started";
437
+ step_failure: "step_failure";
438
+ timed_out: "timed_out";
439
+ }>>;
440
+ jobs: z.ZodArray<z.ZodObject<{
441
+ jobId: z.ZodString;
442
+ jobName: z.ZodString;
443
+ status: z.ZodString;
444
+ startedAt: z.ZodOptional<z.ZodNumber>;
445
+ completedAt: z.ZodOptional<z.ZodNumber>;
446
+ durationMs: z.ZodOptional<z.ZodNumber>;
447
+ errorMessage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
448
+ agentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
449
+ runsOnLabels: z.ZodOptional<z.ZodArray<z.ZodString>>;
450
+ contexts: z.ZodOptional<z.ZodArray<z.ZodString>>;
451
+ }, z.core.$strip>>;
452
+ }, z.core.$strip>;
453
+ export type StateReplayRun = z.infer<typeof stateReplayRunSchema>;
325
454
  export declare const stateReplaySchema: z.ZodObject<{
326
455
  type: z.ZodLiteral<"state.replay">;
327
456
  messageId: z.ZodString;
@@ -329,13 +458,13 @@ export declare const stateReplaySchema: z.ZodObject<{
329
458
  runId: z.ZodString;
330
459
  workflowName: z.ZodString;
331
460
  status: z.ZodEnum<{
332
- success: "success";
333
- pending: "pending";
334
- running: "running";
335
- failed: "failed";
336
461
  cancelled: "cancelled";
337
462
  cancelling: "cancelling";
463
+ failed: "failed";
338
464
  held: "held";
465
+ pending: "pending";
466
+ running: "running";
467
+ success: "success";
339
468
  }>;
340
469
  routingKey: z.ZodOptional<z.ZodString>;
341
470
  repoIdentifier: z.ZodOptional<z.ZodString>;
@@ -352,6 +481,13 @@ export declare const stateReplaySchema: z.ZodObject<{
352
481
  triggeredBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
353
482
  triggeredByAgentLabel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
354
483
  failureReason: z.ZodOptional<z.ZodString>;
484
+ failureClass: z.ZodOptional<z.ZodEnum<{
485
+ cancelled: "cancelled";
486
+ dead_orchestrator: "dead_orchestrator";
487
+ never_started: "never_started";
488
+ step_failure: "step_failure";
489
+ timed_out: "timed_out";
490
+ }>>;
355
491
  jobs: z.ZodArray<z.ZodObject<{
356
492
  jobId: z.ZodString;
357
493
  jobName: z.ZodString;
@@ -362,7 +498,7 @@ export declare const stateReplaySchema: z.ZodObject<{
362
498
  errorMessage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
363
499
  agentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
364
500
  runsOnLabels: z.ZodOptional<z.ZodArray<z.ZodString>>;
365
- environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
501
+ contexts: z.ZodOptional<z.ZodArray<z.ZodString>>;
366
502
  }, z.core.$strip>>;
367
503
  }, z.core.$strip>>;
368
504
  timestamp: z.ZodNumber;