@kici-dev/engine 0.1.27 → 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 (148) hide show
  1. package/dist/approval/types.d.ts +8 -1
  2. package/dist/approval/types.js +8 -1
  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 +8 -0
  7. package/dist/audit/activity.d.ts +12 -12
  8. package/dist/audit/retention-policy.js +16 -0
  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/context/index.d.ts +9 -1
  26. package/dist/context/index.js +9 -2
  27. package/dist/context/multi-context.d.ts +3 -3
  28. package/dist/context/scope-name.d.ts +29 -0
  29. package/dist/context/scope-name.js +49 -0
  30. package/dist/context/scope-resolver.d.ts +33 -0
  31. package/dist/context/scope-resolver.js +45 -15
  32. package/dist/context/types.d.ts +8 -5
  33. package/dist/dev-ops/operations.d.ts +8 -0
  34. package/dist/dev-ops/operations.js +36 -19
  35. package/dist/diagnostics/infra-alert.d.ts +71 -0
  36. package/dist/diagnostics/infra-alert.js +60 -0
  37. package/dist/env/environment-allowlist.d.ts +4 -4
  38. package/dist/fanout/materialize.d.ts +16 -0
  39. package/dist/fanout/materialize.js +32 -3
  40. package/dist/index.d.ts +15 -6
  41. package/dist/index.js +34 -19
  42. package/dist/inputs/descriptor.d.ts +9 -9
  43. package/dist/inventory.d.ts +4 -4
  44. package/dist/labels.d.ts +82 -2
  45. package/dist/labels.js +119 -1
  46. package/dist/matrix/expand.d.ts +49 -2
  47. package/dist/matrix/expand.js +102 -13
  48. package/dist/matrix/format.d.ts +6 -1
  49. package/dist/matrix/format.js +6 -1
  50. package/dist/mcp/held-run-resolve.d.ts +7 -10
  51. package/dist/mcp/held-run-resolve.js +33 -7
  52. package/dist/metrics/catalog-policy.js +4 -4
  53. package/dist/metrics/metric-catalog.generated.d.ts +954 -739
  54. package/dist/metrics/metric-catalog.generated.js +278 -20
  55. package/dist/metrics/metric-kind-compat.d.ts +26 -0
  56. package/dist/metrics/metric-kind-compat.js +33 -0
  57. package/dist/protocol/analytics-events.d.ts +6 -6
  58. package/dist/protocol/dashboard-api-errors.d.ts +1 -0
  59. package/dist/protocol/dashboard-api-errors.js +5 -1
  60. package/dist/protocol/dashboard-write-operations.d.ts +143 -86
  61. package/dist/protocol/dashboard-write-operations.js +91 -17
  62. package/dist/protocol/messages/access-log.d.ts +437 -392
  63. package/dist/protocol/messages/access-log.js +11 -2
  64. package/dist/protocol/messages/actor.d.ts +2 -2
  65. package/dist/protocol/messages/agent-dev-ops.d.ts +4 -2
  66. package/dist/protocol/messages/agent-dev-ops.js +2 -5
  67. package/dist/protocol/messages/agent-run-result.d.ts +72 -62
  68. package/dist/protocol/messages/auth.d.ts +35 -23
  69. package/dist/protocol/messages/browser.d.ts +81 -5
  70. package/dist/protocol/messages/browser.js +53 -2
  71. package/dist/protocol/messages/capabilities.d.ts +106 -31
  72. package/dist/protocol/messages/capabilities.js +94 -10
  73. package/dist/protocol/messages/common.d.ts +45 -2
  74. package/dist/protocol/messages/common.js +64 -3
  75. package/dist/protocol/messages/dashboard-sealed-write.d.ts +52 -0
  76. package/dist/protocol/messages/dashboard-sealed-write.js +57 -0
  77. package/dist/protocol/messages/dashboard.d.ts +1022 -498
  78. package/dist/protocol/messages/dashboard.js +198 -31
  79. package/dist/protocol/messages/deployment-identity.d.ts +37 -10
  80. package/dist/protocol/messages/deployment-identity.js +30 -3
  81. package/dist/protocol/messages/event-log.d.ts +5 -5
  82. package/dist/protocol/messages/execution-status.d.ts +189 -53
  83. package/dist/protocol/messages/execution-status.js +108 -40
  84. package/dist/protocol/messages/heartbeat-health.d.ts +83 -0
  85. package/dist/protocol/messages/heartbeat-health.js +87 -0
  86. package/dist/protocol/messages/log-stream.d.ts +18 -0
  87. package/dist/protocol/messages/log-stream.js +19 -0
  88. package/dist/protocol/messages/oidc-mint.d.ts +7 -0
  89. package/dist/protocol/messages/oidc-mint.js +7 -0
  90. package/dist/protocol/messages/orchestrator-agent.d.ts +264 -67
  91. package/dist/protocol/messages/orchestrator-agent.js +170 -5
  92. package/dist/protocol/messages/pat-kind.d.ts +1 -1
  93. package/dist/protocol/messages/peer.d.ts +122 -58
  94. package/dist/protocol/messages/peer.js +37 -2
  95. package/dist/protocol/messages/platform-orchestrator.d.ts +561 -217
  96. package/dist/protocol/messages/platform-orchestrator.js +131 -21
  97. package/dist/protocol/messages/run-events.d.ts +5 -5
  98. package/dist/protocol/messages/scaler-event.d.ts +3 -3
  99. package/dist/protocol/messages/source-registration.d.ts +56 -13
  100. package/dist/protocol/messages/source-registration.js +49 -6
  101. package/dist/protocol/source-origin.d.ts +1 -1
  102. package/dist/provenance/attestation-origin.d.ts +1 -1
  103. package/dist/provenance/schema.d.ts +11 -11
  104. package/dist/provenance/verify.js +2 -1
  105. package/dist/provider/changed-files-fetcher.d.ts +21 -2
  106. package/dist/provider/check-run-conclusion.d.ts +2 -2
  107. package/dist/provider/check-status-poster.d.ts +23 -0
  108. package/dist/provider/index.d.ts +2 -2
  109. package/dist/registration/registerable-trigger-type.d.ts +14 -13
  110. package/dist/registration/registerable-trigger-type.js +1 -0
  111. package/dist/sandbox/capabilities.d.ts +6 -0
  112. package/dist/sandbox/capabilities.js +57 -0
  113. package/dist/scaler/scaler-backend-type.d.ts +1 -1
  114. package/dist/status/presentation.d.ts +89 -0
  115. package/dist/status/presentation.js +163 -0
  116. package/dist/trigger/compiled-matchers.d.ts +13 -0
  117. package/dist/trigger/compiled-matchers.js +44 -0
  118. package/dist/trigger/event-buckets.d.ts +44 -0
  119. package/dist/trigger/event-buckets.js +93 -0
  120. package/dist/trigger/matcher.d.ts +7 -3
  121. package/dist/trigger/matcher.js +53 -15
  122. package/dist/trigger/schedule-key.d.ts +14 -0
  123. package/dist/trigger/schedule-key.js +21 -0
  124. package/dist/trigger/trigger-event-type.d.ts +1 -1
  125. package/dist/trigger/trigger-event-type.js +2 -0
  126. package/dist/trigger/types.d.ts +173 -43
  127. package/dist/trigger/types.js +82 -25
  128. package/dist/webhook/event-types.d.ts +56 -0
  129. package/dist/webhook/event-types.js +59 -0
  130. package/dist/ws/ws-like.d.ts +13 -0
  131. package/package.json +12 -4
  132. package/sbom.spdx.json +10 -10
  133. package/dist/environment/host-match.d.ts +0 -25
  134. package/dist/environment/index.d.ts +0 -6
  135. package/dist/environment/multi-env.d.ts +0 -30
  136. package/dist/environment/scope-resolver.d.ts +0 -46
  137. package/dist/environment/scope-template.d.ts +0 -18
  138. package/dist/environment/types.d.ts +0 -119
  139. package/dist/package-manager.d.ts +0 -20
  140. package/dist/protocol/messages/observe.d.ts +0 -76
  141. package/dist/protocol/messages/saas-orchestrator.d.ts +0 -2179
  142. package/dist/protocol/messages/test-run.d.ts +0 -59
  143. package/dist/state-machine/index.d.ts +0 -2
  144. package/dist/state-machine/index.js +0 -3
  145. package/dist/state-machine/machine.d.ts +0 -34
  146. package/dist/state-machine/machine.js +0 -103
  147. package/dist/state-machine/types.d.ts +0 -34
  148. package/dist/state-machine/types.js +0 -15
@@ -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";
25
24
  job: "job";
26
25
  step: "step";
26
+ workflow: "workflow";
27
27
  }>;
28
28
  export type HoldScope = z.infer<typeof HoldScope>;
29
29
  /** What triggered the hold: a context policy (mandatory) or SDK code (explicit). */
@@ -32,6 +32,13 @@ export declare const TriggerSource: z.ZodEnum<{
32
32
  explicit: "explicit";
33
33
  }>;
34
34
  export type TriggerSource = z.infer<typeof TriggerSource>;
35
+ /**
36
+ * A valid manual-approval timeout: a positive integer number of seconds. The
37
+ * single source of truth for the positivity invariant — referenced by the
38
+ * `step.approval-request` wire schema, the SDK compile-time check, and the
39
+ * orchestrator's pre-dispatch approval-timeout guard.
40
+ */
41
+ export declare const approvalTimeoutSecondsSchema: z.ZodNumber;
35
42
  /**
36
43
  * The normalized requirement attached to a held element. `clauses` is a flat
37
44
  * AND list; an empty list means "any approval-capable org member". `expiresAt`
@@ -25,6 +25,13 @@ const HoldScope = z.enum([
25
25
  /** What triggered the hold: a context policy (mandatory) or SDK code (explicit). */
26
26
  const TriggerSource = z.enum(["context", "explicit"]);
27
27
  /**
28
+ * A valid manual-approval timeout: a positive integer number of seconds. The
29
+ * single source of truth for the positivity invariant — referenced by the
30
+ * `step.approval-request` wire schema, the SDK compile-time check, and the
31
+ * orchestrator's pre-dispatch approval-timeout guard.
32
+ */
33
+ const approvalTimeoutSecondsSchema = z.number().int().positive();
34
+ /**
28
35
  * The normalized requirement attached to a held element. `clauses` is a flat
29
36
  * AND list; an empty list means "any approval-capable org member". `expiresAt`
30
37
  * is an ISO timestamp; on expiry the element is rejected.
@@ -37,6 +44,6 @@ const approvalRequirementSchema = z.object({
37
44
  /** An individual approve/reject decision recorded against a held element. */
38
45
  const ApprovalDecision = z.enum(["approve", "reject"]);
39
46
  //#endregion
40
- export { ApprovalDecision, HoldScope, TriggerSource, approvalRequirementSchema, approverClauseSchema };
47
+ export { ApprovalDecision, HoldScope, TriggerSource, approvalRequirementSchema, approvalTimeoutSecondsSchema, approverClauseSchema };
41
48
 
42
49
  //# sourceMappingURL=types.js.map
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Artifact name contract, shared by every tier that handles a name.
3
+ *
4
+ * An artifact name is the user-facing key an artifact is uploaded under and
5
+ * downloaded by, and it becomes a path segment of the storage object key. It is
6
+ * therefore restricted to a conservative, filesystem/URL-safe character set
7
+ * (letters, digits, `.`, `_`, `-`) with a bounded length, so names stay portable
8
+ * across storage backends and can never escape their per-run prefix.
9
+ *
10
+ * The schema lives in the engine — not the SDK — because it is a trust-boundary
11
+ * contract, not just an SDK ergonomic. The orchestrator validates every inbound
12
+ * name against it before minting a presigned PUT, the agent sandbox validates it
13
+ * at the call site, and `@kici-dev/sdk` re-exports it so workflow authors keep
14
+ * the same public symbol. One definition, three consumers: a name the SDK
15
+ * accepts is exactly a name the orchestrator accepts.
16
+ *
17
+ * The rejection **message** lives here too, for the same reason: a workflow
18
+ * author must read one sentence whichever tier refused the name.
19
+ *
20
+ * Pure Zod, no `node:*` imports — safe for the browser-facing engine barrel.
21
+ */
22
+ import { z } from 'zod';
23
+ /** Maximum length of an artifact name, in characters. */
24
+ export declare const ARTIFACT_NAME_MAX_LENGTH = 128;
25
+ /**
26
+ * Zod schema validating an artifact name.
27
+ *
28
+ * The character set and the all-dots exclusion together make the mapping from a
29
+ * name to its storage segment the identity, and therefore injective: two
30
+ * distinct accepted names can never produce the same key. A name outside the
31
+ * character set would be sanitized onto some other name's segment (`a/b` and
32
+ * `a_b` both become `a_b`), and an all-dots name has to be escaped away from a
33
+ * path-canonicalizable segment (`.` and `_.` would both become `_.`). Either
34
+ * collision lets a second upload silently overwrite the first object while both
35
+ * records keep their own hash, so both are rejected outright.
36
+ */
37
+ export declare const ArtifactNameSchema: z.ZodString;
38
+ /** Prefix every artifact-name rejection carries, so callers can match on it. */
39
+ export declare const ARTIFACT_INVALID_NAME_PREFIX = "invalid artifact name";
40
+ /**
41
+ * Message for a name that fails the {@link ArtifactNameSchema} contract.
42
+ *
43
+ * Lives beside the schema, not in either consumer, because the rejection wording
44
+ * is part of the contract: the agent sandbox validates at the call site and the
45
+ * orchestrator validates at the trust boundary, and a workflow author must read
46
+ * the same sentence whichever tier refused the name. `detail` is one of the
47
+ * schema's own fixed messages (via {@link checkArtifactName}), never caller
48
+ * input.
49
+ */
50
+ export declare function artifactInvalidNameError(detail: string): string;
51
+ /**
52
+ * Validate a name against the shared contract, returning the schema's own
53
+ * message on failure and `null` when the name conforms.
54
+ *
55
+ * Only the first issue is reported. The schema's checks are ordered and each
56
+ * carries a single fixed message, so one detail fully describes the violation —
57
+ * and rendering exactly one keeps every tier's message identical.
58
+ */
59
+ export declare function checkArtifactName(name: string): string | null;
60
+ //# sourceMappingURL=name.d.ts.map
@@ -0,0 +1,71 @@
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
+ import { z } from "zod";
3
+ //#region src/artifacts/name.ts
4
+ /**
5
+ * Artifact name contract, shared by every tier that handles a name.
6
+ *
7
+ * An artifact name is the user-facing key an artifact is uploaded under and
8
+ * downloaded by, and it becomes a path segment of the storage object key. It is
9
+ * therefore restricted to a conservative, filesystem/URL-safe character set
10
+ * (letters, digits, `.`, `_`, `-`) with a bounded length, so names stay portable
11
+ * across storage backends and can never escape their per-run prefix.
12
+ *
13
+ * The schema lives in the engine — not the SDK — because it is a trust-boundary
14
+ * contract, not just an SDK ergonomic. The orchestrator validates every inbound
15
+ * name against it before minting a presigned PUT, the agent sandbox validates it
16
+ * at the call site, and `@kici-dev/sdk` re-exports it so workflow authors keep
17
+ * the same public symbol. One definition, three consumers: a name the SDK
18
+ * accepts is exactly a name the orchestrator accepts.
19
+ *
20
+ * The rejection **message** lives here too, for the same reason: a workflow
21
+ * author must read one sentence whichever tier refused the name.
22
+ *
23
+ * Pure Zod, no `node:*` imports — safe for the browser-facing engine barrel.
24
+ */
25
+ /** Maximum length of an artifact name, in characters. */
26
+ const ARTIFACT_NAME_MAX_LENGTH = 128;
27
+ /**
28
+ * Zod schema validating an artifact name.
29
+ *
30
+ * The character set and the all-dots exclusion together make the mapping from a
31
+ * name to its storage segment the identity, and therefore injective: two
32
+ * distinct accepted names can never produce the same key. A name outside the
33
+ * character set would be sanitized onto some other name's segment (`a/b` and
34
+ * `a_b` both become `a_b`), and an all-dots name has to be escaped away from a
35
+ * path-canonicalizable segment (`.` and `_.` would both become `_.`). Either
36
+ * collision lets a second upload silently overwrite the first object while both
37
+ * records keep their own hash, so both are rejected outright.
38
+ */
39
+ const ArtifactNameSchema = z.string().min(1, "artifact name must be non-empty").max(128, `artifact name must be <= 128 chars`).regex(/^[A-Za-z0-9._-]+$/, "artifact name may only contain letters, digits, \".\", \"_\", and \"-\"").refine((n) => !/^\.+$/.test(n), "artifact name must contain more than dots");
40
+ /** Prefix every artifact-name rejection carries, so callers can match on it. */
41
+ const ARTIFACT_INVALID_NAME_PREFIX = "invalid artifact name";
42
+ /**
43
+ * Message for a name that fails the {@link ArtifactNameSchema} contract.
44
+ *
45
+ * Lives beside the schema, not in either consumer, because the rejection wording
46
+ * is part of the contract: the agent sandbox validates at the call site and the
47
+ * orchestrator validates at the trust boundary, and a workflow author must read
48
+ * the same sentence whichever tier refused the name. `detail` is one of the
49
+ * schema's own fixed messages (via {@link checkArtifactName}), never caller
50
+ * input.
51
+ */
52
+ function artifactInvalidNameError(detail) {
53
+ return `${ARTIFACT_INVALID_NAME_PREFIX}: ${detail}`;
54
+ }
55
+ /**
56
+ * Validate a name against the shared contract, returning the schema's own
57
+ * message on failure and `null` when the name conforms.
58
+ *
59
+ * Only the first issue is reported. The schema's checks are ordered and each
60
+ * carries a single fixed message, so one detail fully describes the violation —
61
+ * and rendering exactly one keeps every tier's message identical.
62
+ */
63
+ function checkArtifactName(name) {
64
+ const parsed = ArtifactNameSchema.safeParse(name);
65
+ if (parsed.success) return null;
66
+ return parsed.error.issues[0]?.message ?? "artifact name is not permitted";
67
+ }
68
+ //#endregion
69
+ export { ARTIFACT_INVALID_NAME_PREFIX, ARTIFACT_NAME_MAX_LENGTH, ArtifactNameSchema, artifactInvalidNameError, checkArtifactName };
70
+
71
+ //# sourceMappingURL=name.js.map
@@ -27,8 +27,8 @@ import { type ActorPrincipal } from '../protocol/messages/actor.js';
27
27
  /** Discriminator for the per-action policy entry. */
28
28
  export declare const AccessLogPolicyKind: z.ZodEnum<{
29
29
  always: "always";
30
- sample: "sample";
31
30
  rate_limit: "rate_limit";
31
+ sample: "sample";
32
32
  }>;
33
33
  export type AccessLogPolicyKind = z.infer<typeof AccessLogPolicyKind>;
34
34
  export type AccessLogPolicy = {
@@ -67,6 +67,7 @@ const POLICY_BY_ACTION = {
67
67
  allowedRate: .1
68
68
  },
69
69
  "attestations.read": { kind: "always" },
70
+ "artifacts.read": { kind: "always" },
70
71
  "event_log.list.read": {
71
72
  kind: "sample",
72
73
  allowedRate: .05
@@ -164,8 +165,15 @@ const POLICY_BY_ACTION = {
164
165
  "fleet.pre_boot.send": { kind: "always" },
165
166
  "global_workflows.update": { kind: "always" },
166
167
  "org_settings.dashboard_write_policy.update": { kind: "always" },
168
+ "trust_policy.updated": { kind: "always" },
167
169
  "cluster_name.update": { kind: "always" },
168
170
  "attestation.retry": { kind: "always" },
171
+ "db.fresh": { kind: "always" },
172
+ "db.ensure": { kind: "always" },
173
+ "db.create_role": { kind: "always" },
174
+ "db.create_readonly_user": { kind: "always" },
175
+ "db.reindex": { kind: "always" },
176
+ "db.refresh_collation_version": { kind: "always" },
169
177
  "access_log.list.read": { kind: "always" },
170
178
  "event_dlq.list.read": {
171
179
  kind: "sample",
@@ -31,8 +31,8 @@ export type ActivityRowSource = z.infer<typeof ActivityRowSource>;
31
31
  */
32
32
  export declare const ActivityFilterSource: z.ZodEnum<{
33
33
  access_log: "access_log";
34
- audit_log: "audit_log";
35
34
  all: "all";
35
+ audit_log: "audit_log";
36
36
  }>;
37
37
  export type ActivityFilterSource = z.infer<typeof ActivityFilterSource>;
38
38
  /**
@@ -51,11 +51,11 @@ export declare const activityRowSchema: z.ZodObject<{
51
51
  }>;
52
52
  createdAt: z.ZodString;
53
53
  actorType: z.ZodEnum<{
54
- user: "user";
55
54
  api_key: "api_key";
56
- service_account: "service_account";
57
55
  platform_operator: "platform_operator";
56
+ service_account: "service_account";
58
57
  system: "system";
58
+ user: "user";
59
59
  }>;
60
60
  actorId: z.ZodString;
61
61
  actorMeta: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -65,18 +65,18 @@ export declare const activityRowSchema: z.ZodObject<{
65
65
  targetType: z.ZodNullable<z.ZodString>;
66
66
  targetId: z.ZodNullable<z.ZodString>;
67
67
  outcome: z.ZodNullable<z.ZodEnum<{
68
- error: "error";
69
68
  allowed: "allowed";
70
69
  denied: "denied";
70
+ error: "error";
71
71
  }>>;
72
72
  errorMessage: z.ZodNullable<z.ZodString>;
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
+ admin_cli: "admin_cli";
77
+ admin_http: "admin_http";
76
78
  agent: "agent";
77
79
  platform_proxy: "platform_proxy";
78
- admin_http: "admin_http";
79
- admin_cli: "admin_cli";
80
80
  }>>>;
81
81
  }, z.core.$strip>;
82
82
  export type ActivityRow = z.infer<typeof activityRowSchema>;
@@ -88,28 +88,28 @@ export type ActivityRow = z.infer<typeof activityRowSchema>;
88
88
  export declare const activityFilterSchema: z.ZodObject<{
89
89
  source: z.ZodDefault<z.ZodEnum<{
90
90
  access_log: "access_log";
91
- audit_log: "audit_log";
92
91
  all: "all";
92
+ audit_log: "audit_log";
93
93
  }>>;
94
94
  actorType: z.ZodOptional<z.ZodEnum<{
95
- user: "user";
96
95
  api_key: "api_key";
97
- service_account: "service_account";
98
96
  platform_operator: "platform_operator";
97
+ service_account: "service_account";
99
98
  system: "system";
99
+ user: "user";
100
100
  }>>;
101
101
  actorId: z.ZodOptional<z.ZodString>;
102
102
  action: z.ZodOptional<z.ZodString>;
103
103
  outcome: z.ZodOptional<z.ZodEnum<{
104
- error: "error";
105
104
  allowed: "allowed";
106
105
  denied: "denied";
106
+ error: "error";
107
107
  }>>;
108
108
  origin: z.ZodOptional<z.ZodEnum<{
109
+ admin_cli: "admin_cli";
110
+ admin_http: "admin_http";
109
111
  agent: "agent";
110
112
  platform_proxy: "platform_proxy";
111
- admin_http: "admin_http";
112
- admin_cli: "admin_cli";
113
113
  }>>;
114
114
  targetType: z.ZodOptional<z.ZodString>;
115
115
  targetId: z.ZodOptional<z.ZodString>;
@@ -20,6 +20,7 @@ const ACCESS_LOG_WARM_DAYS = {
20
20
  "run.orch_logs.read": 30,
21
21
  "step.logs.read": 30,
22
22
  "attestations.read": 30,
23
+ "artifacts.read": 30,
23
24
  "event_log.list.read": 30,
24
25
  "context.list.read": 30,
25
26
  "context.get.read": 30,
@@ -70,8 +71,15 @@ const ACCESS_LOG_WARM_DAYS = {
70
71
  "fleet.pre_boot.send": 180,
71
72
  "global_workflows.update": 180,
72
73
  "org_settings.dashboard_write_policy.update": 180,
74
+ "trust_policy.updated": 180,
73
75
  "cluster_name.update": 180,
74
76
  "attestation.retry": 180,
77
+ "db.fresh": 180,
78
+ "db.ensure": 180,
79
+ "db.create_role": 180,
80
+ "db.create_readonly_user": 180,
81
+ "db.reindex": 180,
82
+ "db.refresh_collation_version": 180,
75
83
  "event_dlq.list.read": 30,
76
84
  "event_dlq.retry": 180,
77
85
  "event_dlq.discard": 180,
@@ -266,6 +274,7 @@ const ACCESS_LOG_COLD_DAYS = {
266
274
  "run.orch_logs.read": 180,
267
275
  "step.logs.read": 180,
268
276
  "attestations.read": 180,
277
+ "artifacts.read": 180,
269
278
  "event_log.list.read": 180,
270
279
  "context.list.read": 180,
271
280
  "context.get.read": 180,
@@ -316,8 +325,15 @@ const ACCESS_LOG_COLD_DAYS = {
316
325
  "fleet.pre_boot.send": 730,
317
326
  "global_workflows.update": 730,
318
327
  "org_settings.dashboard_write_policy.update": 730,
328
+ "trust_policy.updated": 730,
319
329
  "cluster_name.update": 730,
320
330
  "attestation.retry": 730,
331
+ "db.fresh": 730,
332
+ "db.ensure": 730,
333
+ "db.create_role": 730,
334
+ "db.create_readonly_user": 730,
335
+ "db.reindex": 730,
336
+ "db.refresh_collation_version": 730,
321
337
  "event_dlq.list.read": 180,
322
338
  "event_dlq.retry": 730,
323
339
  "event_dlq.discard": 730,
@@ -0,0 +1,53 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Plan tier discriminator. Single source of truth for the four hosted tiers
4
+ * (`free`, `pro`, `team`, `business`); Enterprise is `pro` / `team` /
5
+ * `business` with a custom `plan_config` override, not a tier of its own.
6
+ *
7
+ * Lives in the engine rather than the Platform package because the browser
8
+ * dashboard needs the same vocabulary and cannot import a private package.
9
+ * Pure Zod with no Node built-ins, so it is safe on the engine barrel.
10
+ *
11
+ * Use `PlanType` (the Zod schema) inside other schemas; use `PlanType.enum.X`
12
+ * to reference a specific value in code; use `type PlanType` for the derived
13
+ * TypeScript type.
14
+ */
15
+ export declare const PlanType: z.ZodEnum<{
16
+ business: "business";
17
+ free: "free";
18
+ pro: "pro";
19
+ team: "team";
20
+ }>;
21
+ export type PlanType = z.infer<typeof PlanType>;
22
+ /**
23
+ * The purchasable subset of `PlanType`. `free` is the default state an org
24
+ * lands in, never something checkout can be started for, so every checkout /
25
+ * upgrade / subscription-metadata surface takes this narrower enum instead of
26
+ * re-spelling the three paid tiers by hand.
27
+ */
28
+ export declare const PaidPlanType: z.ZodEnum<{
29
+ business: "business";
30
+ pro: "pro";
31
+ team: "team";
32
+ }>;
33
+ export type PaidPlanType = z.infer<typeof PaidPlanType>;
34
+ /** Every hosted tier, in ascending rank order. */
35
+ export declare const PLAN_TYPES: readonly PlanType[];
36
+ /**
37
+ * Narrow a tier to the purchasable subset (everything except `free`). Derived
38
+ * from `PaidPlanType`, so a new paid tier needs no edit here and no edit at any
39
+ * call site that used to spell the paid set out as a boolean chain.
40
+ */
41
+ export declare function isPaidTier(tier: PlanType): tier is PaidPlanType;
42
+ /**
43
+ * Rank a plan tier for up/down direction comparisons.
44
+ *
45
+ * The `Object.hasOwn` guard is not defensive padding: a bare index into an
46
+ * object literal inherits `Object.prototype`, so `planRank('toString')` would
47
+ * return a *function* rather than a number, and any `??`-style fallback a
48
+ * caller wrapped it in would never fire. Every current caller passes a
49
+ * `safeParse`d tier, so the throw is unreachable in practice — but a loud
50
+ * error beats silently ranking a forged string above `business`.
51
+ */
52
+ export declare function planRank(p: PlanType): number;
53
+ //# sourceMappingURL=plan-type.d.ts.map
@@ -0,0 +1,70 @@
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
+ import { z } from "zod";
3
+ //#region src/billing/plan-type.ts
4
+ /**
5
+ * Plan tier discriminator. Single source of truth for the four hosted tiers
6
+ * (`free`, `pro`, `team`, `business`); Enterprise is `pro` / `team` /
7
+ * `business` with a custom `plan_config` override, not a tier of its own.
8
+ *
9
+ * Lives in the engine rather than the Platform package because the browser
10
+ * dashboard needs the same vocabulary and cannot import a private package.
11
+ * Pure Zod with no Node built-ins, so it is safe on the engine barrel.
12
+ *
13
+ * Use `PlanType` (the Zod schema) inside other schemas; use `PlanType.enum.X`
14
+ * to reference a specific value in code; use `type PlanType` for the derived
15
+ * TypeScript type.
16
+ */
17
+ const PlanType = z.enum([
18
+ "free",
19
+ "pro",
20
+ "team",
21
+ "business"
22
+ ]);
23
+ /**
24
+ * The purchasable subset of `PlanType`. `free` is the default state an org
25
+ * lands in, never something checkout can be started for, so every checkout /
26
+ * upgrade / subscription-metadata surface takes this narrower enum instead of
27
+ * re-spelling the three paid tiers by hand.
28
+ */
29
+ const PaidPlanType = PlanType.exclude(["free"]);
30
+ /** Every hosted tier, in ascending rank order. */
31
+ const PLAN_TYPES = PlanType.options;
32
+ /**
33
+ * Narrow a tier to the purchasable subset (everything except `free`). Derived
34
+ * from `PaidPlanType`, so a new paid tier needs no edit here and no edit at any
35
+ * call site that used to spell the paid set out as a boolean chain.
36
+ */
37
+ function isPaidTier(tier) {
38
+ return PaidPlanType.safeParse(tier).success;
39
+ }
40
+ /**
41
+ * Monotonic tier rank for up/down comparison. free < pro < team < business.
42
+ *
43
+ * Typed `Record<PlanType, number>` on purpose: adding a tier to the enum
44
+ * without ranking it fails `pnpm typecheck` instead of silently yielding
45
+ * `undefined` at runtime.
46
+ */
47
+ const PLAN_RANK = {
48
+ [PlanType.enum.free]: 0,
49
+ [PlanType.enum.pro]: 1,
50
+ [PlanType.enum.team]: 2,
51
+ [PlanType.enum.business]: 3
52
+ };
53
+ /**
54
+ * Rank a plan tier for up/down direction comparisons.
55
+ *
56
+ * The `Object.hasOwn` guard is not defensive padding: a bare index into an
57
+ * object literal inherits `Object.prototype`, so `planRank('toString')` would
58
+ * return a *function* rather than a number, and any `??`-style fallback a
59
+ * caller wrapped it in would never fire. Every current caller passes a
60
+ * `safeParse`d tier, so the throw is unreachable in practice — but a loud
61
+ * error beats silently ranking a forged string above `business`.
62
+ */
63
+ function planRank(p) {
64
+ if (!Object.hasOwn(PLAN_RANK, p)) throw new Error(`planRank: '${String(p)}' is not a plan tier`);
65
+ return PLAN_RANK[p];
66
+ }
67
+ //#endregion
68
+ export { PLAN_TYPES, PaidPlanType, PlanType, isPaidTier, planRank };
69
+
70
+ //# sourceMappingURL=plan-type.js.map
@@ -22,7 +22,7 @@ export interface WorkflowBundleOptions {
22
22
  */
23
23
  export declare function createWorkflowBundleConfig(options: WorkflowBundleOptions): {
24
24
  input: string;
25
- platform: "node";
25
+ platform: 'node';
26
26
  external: string[];
27
27
  treeshake: boolean;
28
28
  cwd: string | undefined;
@@ -33,8 +33,8 @@ export declare function createWorkflowBundleConfig(options: WorkflowBundleOption
33
33
  };
34
34
  output: {
35
35
  file: string | undefined;
36
- format: "es";
37
- sourcemap: boolean | "inline";
36
+ format: 'es';
37
+ sourcemap: "inline" | boolean;
38
38
  inlineDynamicImports: boolean;
39
39
  };
40
40
  };
@@ -23,11 +23,11 @@ export type CheckMode = z.infer<typeof CheckMode>;
23
23
  * dry-run -> "would change", no_check -> "no check".
24
24
  */
25
25
  export declare const CheckStepOutcome: z.ZodEnum<{
26
- skipped: "skipped";
27
26
  applied: "applied";
28
27
  declined: "declined";
29
28
  "dry-run": "dry-run";
30
29
  no_check: "no_check";
30
+ skipped: "skipped";
31
31
  }>;
32
32
  export type CheckStepOutcome = z.infer<typeof CheckStepOutcome>;
33
33
  //# sourceMappingURL=check-mode.d.ts.map
@@ -0,0 +1,34 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * What a context does with a run that arrives while its concurrency limit is
4
+ * saturated. Single source of truth shared by the dashboard protection form, the
5
+ * context domain type, the orchestrator's context store and protection
6
+ * aggregate, and the concurrency gate.
7
+ *
8
+ * - `queue` — hold the run until a slot frees. The strategy applied when a
9
+ * context sets a limit but no explicit strategy.
10
+ * - `cancel-pending` — drop the already-waiting run in favour of the new one.
11
+ *
12
+ * Not to be confused with the protection gates' `action` vocabulary
13
+ * (`'hold' | 'wait' | 'queue'` on `ProtectionGateResult`), which shares the
14
+ * `queue` spelling and means something else entirely.
15
+ *
16
+ * The orchestrator's `contexts.concurrency_strategy` column stays typed as
17
+ * `string` so a row written by a different orchestrator version never fails to
18
+ * map; this enum is the vocabulary every writer validates against.
19
+ *
20
+ * Pure Zod, no `node:*` imports — safe for the browser-facing engine barrel.
21
+ */
22
+ export declare const ConcurrencyStrategy: z.ZodEnum<{
23
+ "cancel-pending": "cancel-pending";
24
+ queue: "queue";
25
+ }>;
26
+ export type ConcurrencyStrategy = z.infer<typeof ConcurrencyStrategy>;
27
+ /**
28
+ * The strategy applied when a context carries an effective concurrency limit but
29
+ * no explicit strategy. Lives beside the enum so the dashboard form and the
30
+ * orchestrator aggregate cannot pick different defaults — a mismatch reads as a
31
+ * permanently dirty protection form.
32
+ */
33
+ export declare const DEFAULT_CONCURRENCY_STRATEGY: ConcurrencyStrategy;
34
+ //# sourceMappingURL=concurrency-strategy.d.ts.map
@@ -0,0 +1,35 @@
1
+ import "../rolldown-runtime-ClRpJifh.js";
2
+ import { z } from "zod";
3
+ //#region src/context/concurrency-strategy.ts
4
+ /**
5
+ * What a context does with a run that arrives while its concurrency limit is
6
+ * saturated. Single source of truth shared by the dashboard protection form, the
7
+ * context domain type, the orchestrator's context store and protection
8
+ * aggregate, and the concurrency gate.
9
+ *
10
+ * - `queue` — hold the run until a slot frees. The strategy applied when a
11
+ * context sets a limit but no explicit strategy.
12
+ * - `cancel-pending` — drop the already-waiting run in favour of the new one.
13
+ *
14
+ * Not to be confused with the protection gates' `action` vocabulary
15
+ * (`'hold' | 'wait' | 'queue'` on `ProtectionGateResult`), which shares the
16
+ * `queue` spelling and means something else entirely.
17
+ *
18
+ * The orchestrator's `contexts.concurrency_strategy` column stays typed as
19
+ * `string` so a row written by a different orchestrator version never fails to
20
+ * map; this enum is the vocabulary every writer validates against.
21
+ *
22
+ * Pure Zod, no `node:*` imports — safe for the browser-facing engine barrel.
23
+ */
24
+ const ConcurrencyStrategy = z.enum(["queue", "cancel-pending"]);
25
+ /**
26
+ * The strategy applied when a context carries an effective concurrency limit but
27
+ * no explicit strategy. Lives beside the enum so the dashboard form and the
28
+ * orchestrator aggregate cannot pick different defaults — a mismatch reads as a
29
+ * permanently dirty protection form.
30
+ */
31
+ const DEFAULT_CONCURRENCY_STRATEGY = ConcurrencyStrategy.enum.queue;
32
+ //#endregion
33
+ export { ConcurrencyStrategy, DEFAULT_CONCURRENCY_STRATEGY };
34
+
35
+ //# sourceMappingURL=concurrency-strategy.js.map
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Run-wide sentinel values for `held_runs.job_id`.
3
+ *
4
+ * The column normally carries the held job's expanded name (a matrix child
5
+ * keeps its own `build (18)` form), which is what the dashboard approval queue
6
+ * renders and what `kici approve --job <name>` resolves. Some holds are not
7
+ * scoped to a single job and use a sentinel instead: the workflow install gate,
8
+ * and the PR-wide security holds the org trust policy raises.
9
+ *
10
+ * The orchestrator writes these values and the dashboard reads them back to
11
+ * render a human-meaningful row label, so they live here rather than as a
12
+ * literal on each side — a rename on the writer must not silently stop the
13
+ * reader from recognising the sentinel.
14
+ */
15
+ /** Sentinel `job_id` for the PR-wide workflow-modification security hold. */
16
+ export declare const WORKFLOW_MODIFICATION_JOB_ID = "__workflow_modification__";
17
+ /**
18
+ * Sentinel `job_id` per PR-wide security-hold reason, written when the org
19
+ * trust policy holds a run.
20
+ *
21
+ * `workflow_modification` keeps its historical value so holds created before
22
+ * the policy was enforced still resolve by job id.
23
+ *
24
+ * Covers the org trust policy's own three arms ONLY. `context_trust` is
25
+ * deliberately absent: that hold comes from the per-context minimum-trust gate,
26
+ * which writes the real expanded job name (a matrix child keeps its `build (18)`
27
+ * form) so the operator can approve that job specifically. A sentinel for it
28
+ * would be a value nothing ever writes.
29
+ *
30
+ * Keyed by the orchestrator's `TrustPolicyHoldReason`; the key set is asserted
31
+ * against that type in the orchestrator's own test rather than importing it
32
+ * here (the engine must not depend on the orchestrator).
33
+ */
34
+ export declare const SECURITY_HOLD_JOB_IDS: {
35
+ readonly workflow_modification: "__workflow_modification__";
36
+ readonly fork_pr: '__fork_pr__';
37
+ readonly unknown_contributor: '__unknown_contributor__';
38
+ };
39
+ /** Human-meaningful label per security-hold sentinel, rendered by the dashboard. */
40
+ export declare const SECURITY_HOLD_JOB_LABELS: Record<string, string>;
41
+ /** Sentinel `job_id` prefix for the workflow install gate, suffixed by the workflow name. */
42
+ export declare const INSTALL_JOB_ID_PREFIX = "__install__";
43
+ /** The install-gate sentinel `job_id` for a workflow. */
44
+ export declare function installGateJobId(workflowName: string): string;
45
+ //# sourceMappingURL=held-run-job-id.d.ts.map