@kici-dev/engine 0.1.23 → 0.1.25

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 (146) 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.d.ts +4 -1
  4. package/dist/audit/access-log-policy.js +11 -2
  5. package/dist/audit/activity.d.ts +4 -2
  6. package/dist/audit/activity.js +15 -1
  7. package/dist/audit/retention-policy.js +5 -3
  8. package/dist/bundler/index.js +1 -1
  9. package/dist/bundler/rolldown-config.js +1 -1
  10. package/dist/check-mode.js +1 -1
  11. package/dist/dev-ops/operations.d.ts +56 -0
  12. package/dist/dev-ops/operations.js +135 -0
  13. package/dist/env/environment-allowlist.js +1 -1
  14. package/dist/environment/host-match.js +1 -1
  15. package/dist/environment/index.d.ts +2 -0
  16. package/dist/environment/index.js +4 -2
  17. package/dist/environment/multi-env.d.ts +30 -0
  18. package/dist/environment/multi-env.js +38 -0
  19. package/dist/environment/scope-resolver.js +1 -1
  20. package/dist/environment/scope-template.js +1 -1
  21. package/dist/environment/types.d.ts +8 -2
  22. package/dist/environment/types.js +19 -2
  23. package/dist/fanout/materialize.js +3 -3
  24. package/dist/index.d.ts +10 -1
  25. package/dist/index.js +25 -13
  26. package/dist/inputs/build.js +1 -1
  27. package/dist/inputs/coerce.js +1 -1
  28. package/dist/inputs/descriptor.js +1 -1
  29. package/dist/inputs/extract.js +1 -1
  30. package/dist/inputs/index.d.ts +1 -0
  31. package/dist/inputs/index.js +3 -2
  32. package/dist/inputs/schedule.d.ts +19 -0
  33. package/dist/inputs/schedule.js +33 -0
  34. package/dist/inventory.js +1 -1
  35. package/dist/labels/compile.js +1 -1
  36. package/dist/labels-match.js +1 -1
  37. package/dist/labels.js +2 -2
  38. package/dist/matrix/expand.js +1 -1
  39. package/dist/matrix/format.js +1 -1
  40. package/dist/mcp/fence.d.ts +22 -0
  41. package/dist/mcp/fence.js +65 -0
  42. package/dist/mcp/held-run-resolve.d.ts +52 -0
  43. package/dist/mcp/held-run-resolve.js +53 -0
  44. package/dist/mcp/tool-schemas.d.ts +74 -0
  45. package/dist/mcp/tool-schemas.js +78 -0
  46. package/dist/metrics/catalog-policy.js +1 -1
  47. package/dist/metrics/metric-catalog.generated.d.ts +105 -0
  48. package/dist/metrics/metric-catalog.generated.js +127 -1
  49. package/dist/protocol/analytics-events.js +1 -1
  50. package/dist/protocol/cluster-name.js +1 -1
  51. package/dist/protocol/dashboard-global-workflows.js +1 -1
  52. package/dist/protocol/dashboard-write-operations.d.ts +5 -1
  53. package/dist/protocol/dashboard-write-operations.js +13 -2
  54. package/dist/protocol/event-log-payload.js +1 -1
  55. package/dist/protocol/messages/access-log.d.ts +43 -20
  56. package/dist/protocol/messages/access-log.js +16 -2
  57. package/dist/protocol/messages/actor.d.ts +21 -0
  58. package/dist/protocol/messages/actor.js +42 -8
  59. package/dist/protocol/messages/agent-dev-ops.d.ts +118 -0
  60. package/dist/protocol/messages/agent-dev-ops.js +89 -0
  61. package/dist/protocol/messages/agent-run-result.d.ts +425 -0
  62. package/dist/protocol/messages/agent-run-result.js +165 -0
  63. package/dist/protocol/messages/auth.d.ts +3 -0
  64. package/dist/protocol/messages/auth.js +11 -2
  65. package/dist/protocol/messages/browser.js +1 -1
  66. package/dist/protocol/messages/capabilities.d.ts +3 -0
  67. package/dist/protocol/messages/capabilities.js +16 -3
  68. package/dist/protocol/messages/common.js +1 -1
  69. package/dist/protocol/messages/dashboard-global-workflows.d.ts +14 -0
  70. package/dist/protocol/messages/dashboard-global-workflows.js +1 -1
  71. package/dist/protocol/messages/dashboard.d.ts +1998 -48
  72. package/dist/protocol/messages/dashboard.js +269 -15
  73. package/dist/protocol/messages/deployment-identity.js +1 -1
  74. package/dist/protocol/messages/event-log.js +1 -1
  75. package/dist/protocol/messages/execution-status.d.ts +67 -4
  76. package/dist/protocol/messages/execution-status.js +133 -57
  77. package/dist/protocol/messages/join.js +1 -1
  78. package/dist/protocol/messages/log-pull.js +1 -1
  79. package/dist/protocol/messages/oidc-mint.d.ts +51 -0
  80. package/dist/protocol/messages/oidc-mint.js +55 -0
  81. package/dist/protocol/messages/oidc-token-relay.d.ts +31 -4
  82. package/dist/protocol/messages/oidc-token-relay.js +22 -7
  83. package/dist/protocol/messages/orchestrator-agent.d.ts +66 -5
  84. package/dist/protocol/messages/orchestrator-agent.js +35 -3
  85. package/dist/protocol/messages/pat-kind.d.ts +16 -0
  86. package/dist/protocol/messages/pat-kind.js +17 -0
  87. package/dist/protocol/messages/peer.d.ts +7 -7
  88. package/dist/protocol/messages/peer.js +1 -1
  89. package/dist/protocol/messages/platform-orchestrator.d.ts +685 -17
  90. package/dist/protocol/messages/platform-orchestrator.js +8 -5
  91. package/dist/protocol/messages/run-events.d.ts +8 -1
  92. package/dist/protocol/messages/run-events.js +1 -1
  93. package/dist/protocol/messages/scaler-event.js +1 -1
  94. package/dist/protocol/messages/source-registration.js +1 -1
  95. package/dist/protocol/source-origin.d.ts +20 -0
  96. package/dist/protocol/source-origin.js +21 -0
  97. package/dist/protocol/version.js +1 -1
  98. package/dist/provenance/attestation-origin.d.ts +18 -0
  99. package/dist/provenance/attestation-origin.js +22 -0
  100. package/dist/provenance/bundle.js +1 -1
  101. package/dist/provenance/dsse.js +1 -1
  102. package/dist/provenance/schema.d.ts +48 -0
  103. package/dist/provenance/schema.js +21 -7
  104. package/dist/provenance/statement-hash.d.ts +9 -0
  105. package/dist/provenance/statement-hash.js +17 -0
  106. package/dist/provenance/verify.d.ts +7 -0
  107. package/dist/provenance/verify.js +49 -10
  108. package/dist/provider/changed-files-fetcher.js +1 -1
  109. package/dist/provider/check-run-conclusion.d.ts +1 -1
  110. package/dist/provider/check-run-conclusion.js +1 -1
  111. package/dist/provider/check-status-poster.js +1 -1
  112. package/dist/provider/clone-token-provider.js +1 -1
  113. package/dist/provider/contributor-resolver.js +1 -1
  114. package/dist/provider/index.js +1 -1
  115. package/dist/provider/lock-file-fetcher.js +1 -1
  116. package/dist/provider/lock-file-parse-error.js +1 -1
  117. package/dist/provider/repo-url-builder.js +1 -1
  118. package/dist/provider/types.js +1 -1
  119. package/dist/provider/webhook-normalizer.js +1 -1
  120. package/dist/registration/registerable-trigger-type.d.ts +1 -1
  121. package/dist/registration/registerable-trigger-type.js +1 -1
  122. package/dist/{chunk-BTugEXQM.js → rolldown-runtime-ClRpJifh.js} +0 -1
  123. package/dist/scaler/resource-types.js +1 -1
  124. package/dist/scaler/scaler-backend-type.js +1 -1
  125. package/dist/secrets/index.d.ts +1 -1
  126. package/dist/secrets/index.js +1 -1
  127. package/dist/secrets/types.d.ts +0 -24
  128. package/dist/secrets/types.js +1 -1
  129. package/dist/state-machine/index.js +1 -1
  130. package/dist/state-machine/machine.js +1 -1
  131. package/dist/state-machine/types.js +1 -1
  132. package/dist/trigger/decision-trace.js +1 -1
  133. package/dist/trigger/jsonpath-matcher.js +1 -1
  134. package/dist/trigger/matcher.js +1 -1
  135. package/dist/trigger/trigger-event-type.js +1 -1
  136. package/dist/trigger/types.d.ts +35 -7
  137. package/dist/trigger/types.js +8 -3
  138. package/dist/webhook/signature.js +1 -1
  139. package/dist/webhook/webhook-url-format.d.ts +7 -0
  140. package/dist/webhook/webhook-url-format.js +11 -2
  141. package/dist/ws/close-codes.d.ts +8 -2
  142. package/dist/ws/close-codes.js +10 -4
  143. package/dist/ws/rate-limiter.js +1 -1
  144. package/dist/ws/ws-like.js +1 -1
  145. package/package.json +9 -1
  146. package/sbom.spdx.json +5 -5
@@ -21,9 +21,9 @@ export declare const approverClauseSchema: z.ZodUnion<readonly [z.ZodObject<{
21
21
  export type ApproverClause = z.infer<typeof approverClauseSchema>;
22
22
  /** Granularity of a held element. */
23
23
  export declare const HoldScope: z.ZodEnum<{
24
+ workflow: "workflow";
24
25
  job: "job";
25
26
  step: "step";
26
- workflow: "workflow";
27
27
  }>;
28
28
  export type HoldScope = z.infer<typeof HoldScope>;
29
29
  /** What triggered the hold: an environment policy (mandatory) or SDK code (explicit). */
@@ -1,4 +1,4 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  import { z } from "zod";
3
3
  //#region src/approval/types.ts
4
4
  /**
@@ -11,7 +11,10 @@
11
11
  * 1. `outcome !== 'allowed'` → always record (denied/error are full-fidelity).
12
12
  * 2. `actor.type === 'platform_operator'` → always record (compliance: any
13
13
  * activity by a non-org member must be auditable in full).
14
- * 3. The per-action `POLICY_BY_ACTION` decision (`always` / `sample` /
14
+ * 3. agent-attributed actor (`actor.agent` present) always record. The
15
+ * agent-provenance guarantee is that every action an agent takes is fully
16
+ * auditable; a sampled subset would break it.
17
+ * 4. The per-action `POLICY_BY_ACTION` decision (`always` / `sample` /
15
18
  * `rate_limit`).
16
19
  *
17
20
  * Browser-safe: this module MUST NOT import any Node built-ins (`node:crypto`
@@ -1,4 +1,5 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
+ import { agentLabelOf } from "../protocol/messages/actor.js";
2
3
  import { z } from "zod";
3
4
  //#region src/audit/access-log-policy.ts
4
5
  /**
@@ -14,7 +15,10 @@ import { z } from "zod";
14
15
  * 1. `outcome !== 'allowed'` → always record (denied/error are full-fidelity).
15
16
  * 2. `actor.type === 'platform_operator'` → always record (compliance: any
16
17
  * activity by a non-org member must be auditable in full).
17
- * 3. The per-action `POLICY_BY_ACTION` decision (`always` / `sample` /
18
+ * 3. agent-attributed actor (`actor.agent` present) always record. The
19
+ * agent-provenance guarantee is that every action an agent takes is fully
20
+ * auditable; a sampled subset would break it.
21
+ * 4. The per-action `POLICY_BY_ACTION` decision (`always` / `sample` /
18
22
  * `rate_limit`).
19
23
  *
20
24
  * Browser-safe: this module MUST NOT import any Node built-ins (`node:crypto`
@@ -38,6 +42,10 @@ const POLICY_BY_ACTION = {
38
42
  kind: "sample",
39
43
  allowedRate: .05
40
44
  },
45
+ "run.structured.read": {
46
+ kind: "sample",
47
+ allowedRate: .05
48
+ },
41
49
  "runs.list.read": {
42
50
  kind: "sample",
43
51
  allowedRate: .05
@@ -206,6 +214,7 @@ function actorKey(actor) {
206
214
  function shouldRecordAccess(action, outcome, actor, requestId, limiter) {
207
215
  if (outcome !== "allowed") return true;
208
216
  if (actor.type === "platform_operator") return true;
217
+ if (agentLabelOf(actor) !== null) return true;
209
218
  const policy = POLICY_BY_ACTION[action];
210
219
  switch (policy.kind) {
211
220
  case "always": return true;
@@ -73,10 +73,10 @@ export declare const activityRowSchema: z.ZodObject<{
73
73
  details: z.ZodNullable<z.ZodUnknown>;
74
74
  requestId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
75
75
  origin: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
76
+ agent: "agent";
76
77
  platform_proxy: "platform_proxy";
77
78
  admin_http: "admin_http";
78
79
  admin_cli: "admin_cli";
79
- agent: "agent";
80
80
  }>>>;
81
81
  }, z.core.$strip>;
82
82
  export type ActivityRow = z.infer<typeof activityRowSchema>;
@@ -106,15 +106,17 @@ export declare const activityFilterSchema: z.ZodObject<{
106
106
  denied: "denied";
107
107
  }>>;
108
108
  origin: z.ZodOptional<z.ZodEnum<{
109
+ agent: "agent";
109
110
  platform_proxy: "platform_proxy";
110
111
  admin_http: "admin_http";
111
112
  admin_cli: "admin_cli";
112
- agent: "agent";
113
113
  }>>;
114
114
  targetType: z.ZodOptional<z.ZodString>;
115
115
  targetId: z.ZodOptional<z.ZodString>;
116
116
  runId: z.ZodOptional<z.ZodString>;
117
117
  q: z.ZodOptional<z.ZodString>;
118
+ agentLabel: z.ZodOptional<z.ZodString>;
119
+ agentOnly: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodCodec<z.ZodString, z.ZodBoolean>]>>;
118
120
  from: z.ZodOptional<z.ZodString>;
119
121
  to: z.ZodOptional<z.ZodString>;
120
122
  cursor: z.ZodOptional<z.ZodString>;
@@ -1,4 +1,4 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  import { ActorType } from "../protocol/messages/actor.js";
3
3
  import { AccessLogOutcome, AccessLogSource } from "../protocol/messages/access-log.js";
4
4
  import { z } from "zod";
@@ -97,6 +97,20 @@ const activityFilterSchema = z.object({
97
97
  runId: z.string().optional(),
98
98
  /** Full-text search over access_log.error_message and audit_log.details::text. */
99
99
  q: z.string().optional(),
100
+ /**
101
+ * Exact-match filter on the agent provenance label. Only the access_log half
102
+ * of the federation carries an agent label, so an agent filter restricts the
103
+ * stream to agent-attributed access-log rows.
104
+ */
105
+ agentLabel: z.string().max(255).optional(),
106
+ /**
107
+ * When true, return only agent-attributed rows (access_log `agent_label IS NOT NULL`).
108
+ * Arrives as a query string (`?agentOnly=false`), so parse it with `z.stringbool()`
109
+ * — NOT `z.coerce.boolean()`, whose `z.coerce.boolean('false') === true` is a
110
+ * confirmed footgun. The `z.boolean()` arm keeps a native boolean acceptable for
111
+ * programmatic callers (mirrors how `limit` tolerates both a number and a string).
112
+ */
113
+ agentOnly: z.union([z.boolean(), z.stringbool()]).optional(),
100
114
  /** ISO timestamp lower bound (inclusive). */
101
115
  from: z.string().optional(),
102
116
  /** ISO timestamp upper bound (exclusive). */
@@ -1,4 +1,4 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  //#region src/audit/retention-policy.ts
3
3
  /**
4
4
  * Warm-retention days per `AccessLogAction`. Exhaustive over the enum so a
@@ -13,6 +13,7 @@ import "../chunk-BTugEXQM.js";
13
13
  */
14
14
  const ACCESS_LOG_WARM_DAYS = {
15
15
  "run.detail.read": 30,
16
+ "run.structured.read": 30,
16
17
  "runs.list.read": 30,
17
18
  "runs.filters.read": 30,
18
19
  "sources.list.read": 30,
@@ -117,7 +118,7 @@ const COMPLIANCE_AUDIT_PREFIXES = [
117
118
  "platform-admin.",
118
119
  "support-read."
119
120
  ];
120
- const COMPLIANCE_AUDIT_EXACT = new Set([
121
+ const COMPLIANCE_AUDIT_EXACT = /* @__PURE__ */ new Set([
121
122
  "archive_chunk",
122
123
  "purge_chunk",
123
124
  "replay_chunk",
@@ -144,7 +145,7 @@ function getAuditLogWarmDays(args) {
144
145
  * promotes to 180 days. There is no `actor_type` column on this table, so
145
146
  * the platform_operator override does not apply.
146
147
  */
147
- const SAMPLED_RESOLVE_ACTIONS = new Set(["resolve", "resolve_named"]);
148
+ const SAMPLED_RESOLVE_ACTIONS = /* @__PURE__ */ new Set(["resolve", "resolve_named"]);
148
149
  function secretAuditLogWarmDays(action) {
149
150
  if (SAMPLED_RESOLVE_ACTIONS.has(action)) return 30;
150
151
  return 365;
@@ -257,6 +258,7 @@ function secretAuditLogWarmSqlCase() {
257
258
  */
258
259
  const ACCESS_LOG_COLD_DAYS = {
259
260
  "run.detail.read": 180,
261
+ "run.structured.read": 180,
260
262
  "runs.list.read": 180,
261
263
  "runs.filters.read": 180,
262
264
  "sources.list.read": 180,
@@ -1,3 +1,3 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  import { createWorkflowBundleConfig } from "./rolldown-config.js";
3
3
  export { createWorkflowBundleConfig };
@@ -1,4 +1,4 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  //#region src/bundler/rolldown-config.ts
3
3
  /**
4
4
  * Create a rolldown configuration for workflow bundling.
@@ -1,4 +1,4 @@
1
- import "./chunk-BTugEXQM.js";
1
+ import "./rolldown-runtime-ClRpJifh.js";
2
2
  import { z } from "zod";
3
3
  //#region src/check-mode.ts
4
4
  /**
@@ -0,0 +1,56 @@
1
+ /**
2
+ * The developer-operations API contract. One row per workflow-developer-core
3
+ * operation, declaring which entrypoints expose it — HTTP (the shared REST API
4
+ * behind both the web UI and the `kici` CLI), MCP (the agent tool surface), and
5
+ * a curated UI flag. The congruence tests assert each entrypoint's real surface
6
+ * matches this registry, so a new route / CLI command / MCP tool that drifts
7
+ * from the contract fails the build.
8
+ *
9
+ * Three row states, one honest ledger:
10
+ *
11
+ * - **Live everywhere it should be** — `entrypoints.mcp: true` with `mcpTool`
12
+ * set. The registered developer MCP tools land here; their booleans mirror the
13
+ * actual current surface so every harness passes on landing.
14
+ * - **Planned MCP tool** — `mcpAppropriate: true` but `entrypoints.mcp: false`,
15
+ * `mcpTool: null`. An agent-appropriate op that exists in HTTP/CLI but is not
16
+ * yet an MCP tool. The consistency test permits this (`mcp ⟹ mcpAppropriate`,
17
+ * not the converse), so the row is a visible, testable to-do.
18
+ * - **Never an MCP tool** — `mcpAppropriate: false`, `entrypoints.mcp: false`.
19
+ * Secret-value writes and destructive deletes: agent safety encoded in data.
20
+ *
21
+ * Browser-safe: data + TypeScript types only, no Node imports, so it lives in
22
+ * the engine barrel importable by the web UI, the CLI, and the Platform.
23
+ */
24
+ export type DeveloperOpDomain = 'runs' | 'workflows' | 'environments' | 'secrets' | 'held-runs' | 'diagnostics' | 'orchestrators' | 'sources' | 'dlq' | 'attestations' | 'activity' | 'orgs';
25
+ export type DeveloperOpKind = 'read' | 'write';
26
+ /** Which of the three entrypoints a developer op is (or should be) exposed on. */
27
+ export interface DeveloperOpEntrypoints {
28
+ /** The shared Platform REST API (backs both the web UI and the `kici` CLI). */
29
+ http: boolean;
30
+ /** The `kici` CLI command tree. */
31
+ cli: boolean;
32
+ /** The developer MCP tool surface. */
33
+ mcp: boolean;
34
+ /** Curated: the op has a dashboard affordance (not machine-introspectable). */
35
+ ui: boolean;
36
+ }
37
+ export interface DeveloperOperation {
38
+ /** Stable id, e.g. 'runs.list', 'held-runs.approve'. Unique across the table. */
39
+ id: string;
40
+ domain: DeveloperOpDomain;
41
+ kind: DeveloperOpKind;
42
+ /** Intended entrypoint coverage — the contract the harness enforces. */
43
+ entrypoints: DeveloperOpEntrypoints;
44
+ /** False ⇒ never an MCP tool (secret-value write, destructive delete). */
45
+ mcpAppropriate: boolean;
46
+ /** MCP tool name when `entrypoints.mcp` is true; null otherwise. */
47
+ mcpTool: string | null;
48
+ }
49
+ /**
50
+ * The workflow-developer core. Developer plane only — org-membership-scoped,
51
+ * agent-attributed; never orchestrator-admin or tenant control-plane territory.
52
+ */
53
+ export declare const DEVELOPER_OPERATIONS: readonly DeveloperOperation[];
54
+ /** All ops a given entrypoint should expose. */
55
+ export declare function developerOpsForEntrypoint(ep: keyof DeveloperOpEntrypoints): DeveloperOperation[];
56
+ //# sourceMappingURL=operations.d.ts.map
@@ -0,0 +1,135 @@
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
+ //#region src/dev-ops/operations.ts
3
+ /** Build a row, defaulting every unspecified entrypoint to false. */
4
+ function op(id, domain, kind, ep, mcpAppropriate, mcpTool) {
5
+ return {
6
+ id,
7
+ domain,
8
+ kind,
9
+ entrypoints: {
10
+ http: false,
11
+ cli: false,
12
+ mcp: false,
13
+ ui: false,
14
+ ...ep
15
+ },
16
+ mcpAppropriate,
17
+ mcpTool
18
+ };
19
+ }
20
+ /**
21
+ * The workflow-developer core. Developer plane only — org-membership-scoped,
22
+ * agent-attributed; never orchestrator-admin or tenant control-plane territory.
23
+ */
24
+ const DEVELOPER_OPERATIONS = [
25
+ op("runs.list", "runs", "read", {
26
+ http: true,
27
+ cli: true,
28
+ mcp: true,
29
+ ui: true
30
+ }, true, "list_runs"),
31
+ op("runs.get", "runs", "read", {
32
+ http: true,
33
+ cli: true,
34
+ mcp: true,
35
+ ui: true
36
+ }, true, "get_run"),
37
+ op("runs.stepLogs", "runs", "read", {
38
+ http: true,
39
+ cli: true,
40
+ mcp: true,
41
+ ui: true
42
+ }, true, "get_step_logs"),
43
+ op("runs.cancel", "runs", "write", {
44
+ http: true,
45
+ cli: true,
46
+ mcp: true,
47
+ ui: true
48
+ }, true, "cancel_run"),
49
+ op("runs.cancelByBranch", "runs", "write", {
50
+ http: true,
51
+ cli: true,
52
+ mcp: true,
53
+ ui: false
54
+ }, true, "cancel_runs_by_branch"),
55
+ op("runs.rerun", "runs", "write", {
56
+ http: true,
57
+ cli: true,
58
+ mcp: true,
59
+ ui: true
60
+ }, true, "rerun_run"),
61
+ op("workflows.list", "workflows", "read", {
62
+ http: true,
63
+ cli: true,
64
+ mcp: true,
65
+ ui: true
66
+ }, true, "list_workflows"),
67
+ op("workflows.trigger", "workflows", "write", {
68
+ http: true,
69
+ cli: false,
70
+ mcp: true,
71
+ ui: true
72
+ }, true, "trigger_run"),
73
+ op("secrets.list", "secrets", "read", {
74
+ http: true,
75
+ cli: true,
76
+ mcp: true,
77
+ ui: true
78
+ }, true, "list_secrets"),
79
+ op("secrets.set", "secrets", "write", {
80
+ http: true,
81
+ cli: false,
82
+ mcp: false,
83
+ ui: true
84
+ }, false, null),
85
+ op("secrets.delete", "secrets", "write", {
86
+ http: true,
87
+ cli: false,
88
+ mcp: false,
89
+ ui: true
90
+ }, false, null),
91
+ op("environments.delete", "environments", "write", {
92
+ http: true,
93
+ cli: false,
94
+ mcp: false,
95
+ ui: true
96
+ }, false, null),
97
+ op("held-runs.approve", "held-runs", "write", {
98
+ http: true,
99
+ cli: true,
100
+ mcp: true,
101
+ ui: true
102
+ }, true, "approve_run"),
103
+ op("held-runs.reject", "held-runs", "write", {
104
+ http: true,
105
+ cli: true,
106
+ mcp: true,
107
+ ui: true
108
+ }, true, "reject_run"),
109
+ op("diagnostics.get", "diagnostics", "read", {
110
+ http: true,
111
+ cli: true,
112
+ mcp: true,
113
+ ui: true
114
+ }, true, "get_diagnostics"),
115
+ op("orchestrators.list", "orchestrators", "read", {
116
+ http: true,
117
+ cli: true,
118
+ mcp: true,
119
+ ui: true
120
+ }, true, "list_orchestrators"),
121
+ op("orgs.list", "orgs", "read", {
122
+ http: true,
123
+ cli: true,
124
+ mcp: true,
125
+ ui: true
126
+ }, true, "list_orgs")
127
+ ];
128
+ /** All ops a given entrypoint should expose. */
129
+ function developerOpsForEntrypoint(ep) {
130
+ return DEVELOPER_OPERATIONS.filter((o) => o.entrypoints[ep]);
131
+ }
132
+ //#endregion
133
+ export { DEVELOPER_OPERATIONS, developerOpsForEntrypoint };
134
+
135
+ //# sourceMappingURL=operations.js.map
@@ -1,4 +1,4 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  //#region src/env/environment-allowlist.ts
3
3
  /**
4
4
  * Shared environment allowlist constants for KiCI.
@@ -1,4 +1,4 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  import { matcherMatches } from "../labels-match.js";
3
3
  import { assertSafeRegex, toLabelMatcher } from "../labels/compile.js";
4
4
  //#region src/environment/host-match.ts
@@ -1,4 +1,6 @@
1
1
  export type { Environment, EnvironmentBinding, EnvironmentVariable, EnvironmentSourceOverride, ScopedSecret, HeldRun, ProtectionGateResult, TrustTier, } from './types.js';
2
+ export { TrustTierSchema } from './types.js';
2
3
  export { resolveSecretsForEnvironment, matchScopePattern, stripScopePrefix, } from './scope-resolver.js';
3
4
  export type { HostFacts } from './host-match.js';
5
+ export { mergeOrderedMaps, EnvGateRejectReason } from './multi-env.js';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,5 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
+ import { TrustTierSchema } from "./types.js";
2
3
  import { matchScopePattern, resolveSecretsForEnvironment, stripScopePrefix } from "./scope-resolver.js";
3
- export { matchScopePattern, resolveSecretsForEnvironment, stripScopePrefix };
4
+ import { EnvGateRejectReason, mergeOrderedMaps } from "./multi-env.js";
5
+ export { EnvGateRejectReason, TrustTierSchema, matchScopePattern, mergeOrderedMaps, resolveSecretsForEnvironment, stripScopePrefix };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Multi-environment merge helpers shared across the orchestrator dispatch path.
3
+ *
4
+ * A job may bind several deployment environments in order; their resolved
5
+ * secrets/variables are folded last-wins (a later environment's key overrides an
6
+ * earlier one) and their protection gates combine all-must-pass. This module is
7
+ * browser-safe (pure functions + a Zod enum, no Node built-ins) so it can be
8
+ * exported from the engine environment barrel.
9
+ */
10
+ import { z } from 'zod';
11
+ /**
12
+ * Reason a single bound environment rejects a run under all-must-pass
13
+ * aggregation. Used to name which environment and which rule blocked dispatch.
14
+ */
15
+ export declare const EnvGateRejectReason: z.ZodEnum<{
16
+ branch_restricted: "branch_restricted";
17
+ trigger_filtered: "trigger_filtered";
18
+ repo_unmatched: "repo_unmatched";
19
+ trust_too_low: "trust_too_low";
20
+ env_disabled: "env_disabled";
21
+ env_not_found: "env_not_found";
22
+ }>;
23
+ export type EnvGateRejectReason = z.infer<typeof EnvGateRejectReason>;
24
+ /**
25
+ * Fold an ordered list of per-environment resolved maps into one. Later entries
26
+ * override earlier keys (last-wins), matching the documented merge order for
27
+ * `environments: [...]`.
28
+ */
29
+ export declare function mergeOrderedMaps(maps: ReadonlyArray<Record<string, string>>): Record<string, string>;
30
+ //# sourceMappingURL=multi-env.d.ts.map
@@ -0,0 +1,38 @@
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
+ import { z } from "zod";
3
+ //#region src/environment/multi-env.ts
4
+ /**
5
+ * Multi-environment merge helpers shared across the orchestrator dispatch path.
6
+ *
7
+ * A job may bind several deployment environments in order; their resolved
8
+ * secrets/variables are folded last-wins (a later environment's key overrides an
9
+ * earlier one) and their protection gates combine all-must-pass. This module is
10
+ * browser-safe (pure functions + a Zod enum, no Node built-ins) so it can be
11
+ * exported from the engine environment barrel.
12
+ */
13
+ /**
14
+ * Reason a single bound environment rejects a run under all-must-pass
15
+ * aggregation. Used to name which environment and which rule blocked dispatch.
16
+ */
17
+ const EnvGateRejectReason = z.enum([
18
+ "branch_restricted",
19
+ "trigger_filtered",
20
+ "repo_unmatched",
21
+ "trust_too_low",
22
+ "env_disabled",
23
+ "env_not_found"
24
+ ]);
25
+ /**
26
+ * Fold an ordered list of per-environment resolved maps into one. Later entries
27
+ * override earlier keys (last-wins), matching the documented merge order for
28
+ * `environments: [...]`.
29
+ */
30
+ function mergeOrderedMaps(maps) {
31
+ const out = {};
32
+ for (const m of maps) Object.assign(out, m);
33
+ return out;
34
+ }
35
+ //#endregion
36
+ export { EnvGateRejectReason, mergeOrderedMaps };
37
+
38
+ //# sourceMappingURL=multi-env.js.map
@@ -1,4 +1,4 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  import { hostSpecificity, matchHostPattern } from "./host-match.js";
3
3
  import { substituteScopePattern } from "./scope-template.js";
4
4
  import picomatch from "picomatch";
@@ -1,4 +1,4 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  //#region src/environment/scope-template.ts
3
3
  /** A substituted value must be a single literal path segment — no `/` or glob. */
4
4
  const SAFE_SEGMENT = /^[A-Za-z0-9._-]+$/;
@@ -4,6 +4,7 @@
4
4
  * Environments are org-level entities that group secrets, variables,
5
5
  * and protection rules for deployment targets (dev, staging, production).
6
6
  */
7
+ import { z } from 'zod';
7
8
  import type { ApproverClause } from '../approval/types.js';
8
9
  /** Environment entity — org-level deployment target with protection rules. */
9
10
  export interface Environment {
@@ -79,8 +80,13 @@ export interface EnvironmentSourceOverride {
79
80
  createdAt: string;
80
81
  updatedAt: string;
81
82
  }
82
- /** Trust tier for contributor-based CI execution gating. */
83
- export type TrustTier = 'trusted' | 'known' | 'unknown';
83
+ /** Trust tier for contributor-based CI execution gating (single source of truth). */
84
+ export declare const TrustTierSchema: z.ZodEnum<{
85
+ unknown: "unknown";
86
+ known: "known";
87
+ trusted: "trusted";
88
+ }>;
89
+ export type TrustTier = z.infer<typeof TrustTierSchema>;
84
90
  /** Held run record for protection gate enforcement. */
85
91
  export interface HeldRun {
86
92
  id: string;
@@ -1,2 +1,19 @@
1
- import "../chunk-BTugEXQM.js";
2
- export {};
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
+ import { z } from "zod";
3
+ //#region src/environment/types.ts
4
+ /**
5
+ * Environment types for KiCI's deployment environment model.
6
+ *
7
+ * Environments are org-level entities that group secrets, variables,
8
+ * and protection rules for deployment targets (dev, staging, production).
9
+ */
10
+ /** Trust tier for contributor-based CI execution gating (single source of truth). */
11
+ const TrustTierSchema = z.enum([
12
+ "trusted",
13
+ "known",
14
+ "unknown"
15
+ ]);
16
+ //#endregion
17
+ export { TrustTierSchema };
18
+
19
+ //# sourceMappingURL=types.js.map
@@ -1,4 +1,4 @@
1
- import "../chunk-BTugEXQM.js";
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
2
  import { applyIncludeExclude, expandMatrix } from "../matrix/expand.js";
3
3
  import { formatExpandedJobName } from "../matrix/format.js";
4
4
  //#region src/fanout/materialize.ts
@@ -118,7 +118,7 @@ function materializeResolvedMatrix(lockJob, combos) {
118
118
  assignFanoutPositions(jobs, variantLabelOf);
119
119
  return {
120
120
  jobs,
121
- expansionMap: new Map([[lockJob.name, jobs.map((j) => j.expandedName)]])
121
+ expansionMap: /* @__PURE__ */ new Map([[lockJob.name, jobs.map((j) => j.expandedName)]])
122
122
  };
123
123
  }
124
124
  /**
@@ -163,7 +163,7 @@ function materializeResolvedHosts(lockJob, agents, maxHosts) {
163
163
  assignFanoutPositions(jobs, (child) => child.pinnedAgentId ?? "");
164
164
  return {
165
165
  jobs,
166
- expansionMap: new Map([[lockJob.name, jobs.map((j) => j.expandedName)]])
166
+ expansionMap: /* @__PURE__ */ new Map([[lockJob.name, jobs.map((j) => j.expandedName)]])
167
167
  };
168
168
  }
169
169
  /**
package/dist/index.d.ts CHANGED
@@ -9,12 +9,21 @@
9
9
  * - WebSocket close codes (unified across all tiers)
10
10
  */
11
11
  export * from './protocol/version.js';
12
+ export * from './protocol/source-origin.js';
13
+ export * from './provenance/attestation-origin.js';
12
14
  export * from './protocol/messages/common.js';
13
15
  export * from './protocol/messages/actor.js';
16
+ export * from './protocol/messages/pat-kind.js';
17
+ export * from './mcp/tool-schemas.js';
18
+ export * from './mcp/held-run-resolve.js';
19
+ export * from './mcp/fence.js';
14
20
  export * from './protocol/messages/auth.js';
15
21
  export * from './protocol/messages/capabilities.js';
16
22
  export { webhookRelaySchema, webhookRelayStartSchema, webhookRelayChunkSchema, webhookAckSchema, WebhookRelayResult, WEBHOOK_RELAY_MAX_BODY_BYTES, WEBHOOK_RELAY_CHUNK_SIZE, executionEventSchema, logChunkSchema, peerDiscoverSchema, peerUpdateSchema, cacheStatsSchema, orchMetricsSchema, platformToOrchestratorMessageSchema, orchestratorToPlatformMessageSchema, type WebhookRelay, type WebhookRelayStart, type WebhookRelayChunk, type WebhookAck, type LogChunk, type PeerDiscover, type PeerUpdate, type CacheStats, type OrchMetrics, trustPolicyUpdateSchema, type TrustPolicyUpdate, staleCheckrunCleanupSchema, type StaleCheckrunCleanup, type PlatformToOrchestratorMessage, type OrchestratorToPlatformMessage, } from './protocol/messages/platform-orchestrator.js';
17
23
  export * from './protocol/messages/execution-status.js';
24
+ export * from './protocol/messages/agent-run-result.js';
25
+ export * from './protocol/messages/agent-dev-ops.js';
26
+ export * from './dev-ops/operations.js';
18
27
  export * from './protocol/messages/deployment-identity.js';
19
28
  export * from './protocol/messages/scaler-event.js';
20
29
  export * from './protocol/messages/event-log.js';
@@ -39,7 +48,7 @@ export * from './trigger/matcher.js';
39
48
  export * from './inputs/index.js';
40
49
  export * from './state-machine/index.js';
41
50
  export * from './provider/index.js';
42
- export { githubWebhookPath } from './webhook/webhook-url-format.js';
51
+ export { githubWebhookPath, githubIngressPath } from './webhook/webhook-url-format.js';
43
52
  export type { WsLike } from './ws/ws-like.js';
44
53
  export * from './ws/close-codes.js';
45
54
  export { WsRateLimiter } from './ws/rate-limiter.js';