@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
@@ -2,7 +2,7 @@
2
2
  * Shared approval requirement + clause types.
3
3
  *
4
4
  * One normalized `ApprovalRequirement` is produced by both approval triggers —
5
- * a mandatory environment policy and an explicit SDK `approval` config — and is
5
+ * a mandatory context policy and an explicit SDK `approval` config — and is
6
6
  * consumed identically by the orchestrator gate, the resolver, the held-run
7
7
  * store, and the agent step round-trip. Pure Zod (no node built-ins), so this
8
8
  * module is safe in the browser-facing engine barrel.
@@ -21,17 +21,24 @@ 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
- /** What triggered the hold: an environment policy (mandatory) or SDK code (explicit). */
29
+ /** What triggered the hold: a context policy (mandatory) or SDK code (explicit). */
30
30
  export declare const TriggerSource: z.ZodEnum<{
31
- environment: "environment";
31
+ context: "context";
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`
@@ -5,7 +5,7 @@ import { z } from "zod";
5
5
  * Shared approval requirement + clause types.
6
6
  *
7
7
  * One normalized `ApprovalRequirement` is produced by both approval triggers —
8
- * a mandatory environment policy and an explicit SDK `approval` config — and is
8
+ * a mandatory context policy and an explicit SDK `approval` config — and is
9
9
  * consumed identically by the orchestrator gate, the resolver, the held-run
10
10
  * store, and the agent step round-trip. Pure Zod (no node built-ins), so this
11
11
  * module is safe in the browser-facing engine barrel.
@@ -22,8 +22,15 @@ const HoldScope = z.enum([
22
22
  "job",
23
23
  "step"
24
24
  ]);
25
- /** What triggered the hold: an environment policy (mandatory) or SDK code (explicit). */
26
- const TriggerSource = z.enum(["environment", "explicit"]);
25
+ /** What triggered the hold: a context policy (mandatory) or SDK code (explicit). */
26
+ const TriggerSource = z.enum(["context", "explicit"]);
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();
27
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`
@@ -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,11 +67,12 @@ 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
73
74
  },
74
- "environment.list.read": {
75
+ "context.list.read": {
75
76
  kind: "sample",
76
77
  allowedRate: .1
77
78
  },
@@ -83,11 +84,11 @@ const POLICY_BY_ACTION = {
83
84
  kind: "sample",
84
85
  allowedRate: .1
85
86
  },
86
- "environment.get.read": {
87
+ "context.get.read": {
87
88
  kind: "sample",
88
89
  allowedRate: .2
89
90
  },
90
- "environment.history.read": {
91
+ "context.history.read": {
91
92
  kind: "sample",
92
93
  allowedRate: .2
93
94
  },
@@ -95,7 +96,7 @@ const POLICY_BY_ACTION = {
95
96
  kind: "sample",
96
97
  allowedRate: .2
97
98
  },
98
- "env_binding.list.read": {
99
+ "context_binding.list.read": {
99
100
  kind: "sample",
100
101
  allowedRate: .2
101
102
  },
@@ -131,16 +132,16 @@ const POLICY_BY_ACTION = {
131
132
  "job.cancel": { kind: "always" },
132
133
  "event_log.detail.read": { kind: "always" },
133
134
  "event_log.payload.read": { kind: "always" },
134
- "environment.create": { kind: "always" },
135
- "environment.update": { kind: "always" },
136
- "environment.delete": { kind: "always" },
137
- "env_var.list.read": { kind: "always" },
138
- "env_var.set": { kind: "always" },
139
- "env_var.delete": { kind: "always" },
135
+ "context.create": { kind: "always" },
136
+ "context.update": { kind: "always" },
137
+ "context.delete": { kind: "always" },
138
+ "context_var.list.read": { kind: "always" },
139
+ "context_var.set": { kind: "always" },
140
+ "context_var.delete": { kind: "always" },
140
141
  "source_override.list.read": { kind: "always" },
141
142
  "source_override.set": { kind: "always" },
142
143
  "source_override.delete": { kind: "always" },
143
- "env_binding.set": { kind: "always" },
144
+ "context_binding.set": { kind: "always" },
144
145
  "secret.list.read": { kind: "always" },
145
146
  "secret.set": { kind: "always" },
146
147
  "secret.delete": { kind: "always" },
@@ -164,7 +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" },
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" },
168
177
  "access_log.list.read": { kind: "always" },
169
178
  "event_dlq.list.read": {
170
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,14 +20,15 @@ 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
- "environment.list.read": 30,
25
- "environment.get.read": 30,
26
- "environment.history.read": 30,
25
+ "context.list.read": 30,
26
+ "context.get.read": 30,
27
+ "context.history.read": 30,
27
28
  "registration.list.read": 30,
28
29
  "global_workflows.get.read": 30,
29
30
  "held_run.list.read": 30,
30
- "env_binding.list.read": 30,
31
+ "context_binding.list.read": 30,
31
32
  "backend.list.read": 30,
32
33
  "backend.get.read": 30,
33
34
  "diagnostics.read": 30,
@@ -37,7 +38,7 @@ const ACCESS_LOG_WARM_DAYS = {
37
38
  "event_log.detail.read": 180,
38
39
  "event_log.payload.read": 180,
39
40
  "run.payload.read": 180,
40
- "env_var.list.read": 180,
41
+ "context_var.list.read": 180,
41
42
  "source_override.list.read": 180,
42
43
  "access_log.list.read": 180,
43
44
  "secret.list.read": 180,
@@ -46,14 +47,14 @@ const ACCESS_LOG_WARM_DAYS = {
46
47
  "run.manual_schedule": 180,
47
48
  "run.trigger": 180,
48
49
  "job.cancel": 180,
49
- "environment.create": 180,
50
- "environment.update": 180,
51
- "environment.delete": 180,
52
- "env_var.set": 180,
53
- "env_var.delete": 180,
50
+ "context.create": 180,
51
+ "context.update": 180,
52
+ "context.delete": 180,
53
+ "context_var.set": 180,
54
+ "context_var.delete": 180,
54
55
  "source_override.set": 180,
55
56
  "source_override.delete": 180,
56
- "env_binding.set": 180,
57
+ "context_binding.set": 180,
57
58
  "held_run.approve": 180,
58
59
  "held_run.auto_approve": 180,
59
60
  "held_run.reject": 180,
@@ -70,7 +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,
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,
74
83
  "event_dlq.list.read": 30,
75
84
  "event_dlq.retry": 180,
76
85
  "event_dlq.discard": 180,
@@ -265,14 +274,15 @@ const ACCESS_LOG_COLD_DAYS = {
265
274
  "run.orch_logs.read": 180,
266
275
  "step.logs.read": 180,
267
276
  "attestations.read": 180,
277
+ "artifacts.read": 180,
268
278
  "event_log.list.read": 180,
269
- "environment.list.read": 180,
270
- "environment.get.read": 180,
271
- "environment.history.read": 180,
279
+ "context.list.read": 180,
280
+ "context.get.read": 180,
281
+ "context.history.read": 180,
272
282
  "registration.list.read": 180,
273
283
  "global_workflows.get.read": 180,
274
284
  "held_run.list.read": 180,
275
- "env_binding.list.read": 180,
285
+ "context_binding.list.read": 180,
276
286
  "backend.list.read": 180,
277
287
  "backend.get.read": 180,
278
288
  "diagnostics.read": 30,
@@ -282,7 +292,7 @@ const ACCESS_LOG_COLD_DAYS = {
282
292
  "event_log.detail.read": 730,
283
293
  "event_log.payload.read": 730,
284
294
  "run.payload.read": 730,
285
- "env_var.list.read": 730,
295
+ "context_var.list.read": 730,
286
296
  "source_override.list.read": 730,
287
297
  "access_log.list.read": 730,
288
298
  "secret.list.read": 730,
@@ -291,14 +301,14 @@ const ACCESS_LOG_COLD_DAYS = {
291
301
  "run.manual_schedule": 730,
292
302
  "run.trigger": 730,
293
303
  "job.cancel": 730,
294
- "environment.create": 730,
295
- "environment.update": 730,
296
- "environment.delete": 730,
297
- "env_var.set": 730,
298
- "env_var.delete": 730,
304
+ "context.create": 730,
305
+ "context.update": 730,
306
+ "context.delete": 730,
307
+ "context_var.set": 730,
308
+ "context_var.delete": 730,
299
309
  "source_override.set": 730,
300
310
  "source_override.delete": 730,
301
- "env_binding.set": 730,
311
+ "context_binding.set": 730,
302
312
  "held_run.approve": 730,
303
313
  "held_run.auto_approve": 730,
304
314
  "held_run.reject": 730,
@@ -315,7 +325,15 @@ const ACCESS_LOG_COLD_DAYS = {
315
325
  "fleet.pre_boot.send": 730,
316
326
  "global_workflows.update": 730,
317
327
  "org_settings.dashboard_write_policy.update": 730,
328
+ "trust_policy.updated": 730,
318
329
  "cluster_name.update": 730,
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,
319
337
  "event_dlq.list.read": 180,
320
338
  "event_dlq.retry": 730,
321
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