@kici-dev/engine 0.1.17 → 0.1.18

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.
@@ -15,7 +15,7 @@
15
15
  * This is an explicit allowlist -- anything NOT listed here is stripped.
16
16
  * Adding new variables to the host process will NOT leak them downstream.
17
17
  */
18
- export declare const ALLOWED_SYSTEM_VARS: readonly ["PATH", "HOME", "USER", "SHELL", "LANG", "LC_ALL", "TERM", "TMPDIR", "NODE_PATH", "TZ"];
18
+ export declare const ALLOWED_SYSTEM_VARS: readonly ["PATH", "HOME", "USER", "SHELL", "LANG", "LC_ALL", "TERM", "TMPDIR", "NODE_PATH", "TZ", "PATHEXT", "SystemRoot", "windir", "COMSPEC", "TEMP", "TMP", "USERPROFILE", "LOCALAPPDATA", "APPDATA", "PROCESSOR_ARCHITECTURE", "NUMBER_OF_PROCESSORS"];
19
19
  /**
20
20
  * Default environment variables injected into every sandbox execution.
21
21
  *
@@ -27,7 +27,18 @@ const ALLOWED_SYSTEM_VARS = [
27
27
  "TERM",
28
28
  "TMPDIR",
29
29
  "NODE_PATH",
30
- "TZ"
30
+ "TZ",
31
+ "PATHEXT",
32
+ "SystemRoot",
33
+ "windir",
34
+ "COMSPEC",
35
+ "TEMP",
36
+ "TMP",
37
+ "USERPROFILE",
38
+ "LOCALAPPDATA",
39
+ "APPDATA",
40
+ "PROCESSOR_ARCHITECTURE",
41
+ "NUMBER_OF_PROCESSORS"
31
42
  ];
32
43
  /**
33
44
  * Default environment variables injected into every sandbox execution.
@@ -2,6 +2,15 @@ import { type MatrixValues } from '../matrix/expand.js';
2
2
  import type { LockJob } from '../trigger/types.js';
3
3
  /** Hard cap on children per fanned job — mirrors the compiler's MAX_STATIC_MATRIX_JOBS. */
4
4
  export declare const MAX_FANOUT_JOBS = 256;
5
+ /**
6
+ * The kind of fan-out a materialized child belongs to. `matrix` children come
7
+ * from a matrix expansion (one per combination); `host` children come from a
8
+ * `runsOnAll` fan-out (one pinned execution per roster host).
9
+ */
10
+ export declare enum VariantKind {
11
+ matrix = "matrix",
12
+ host = "host"
13
+ }
5
14
  /**
6
15
  * Thrown when a job's matrix cannot be materialized into dispatchable children:
7
16
  * zero combinations after exclude, or more combinations than {@link MAX_FANOUT_JOBS}.
@@ -13,8 +22,25 @@ export declare class FanoutError extends Error {
13
22
  constructor(jobName: string, message: string);
14
23
  }
15
24
  /**
16
- * One dispatchable unit produced from a lock job. `variantKind` is `'matrix'`
17
- * today; the shape is variant-agnostic so a future host fan-out can add `'host'`.
25
+ * A roster host resolved as a target of a `runsOnAll` fan-out. Carries the
26
+ * identity the dispatcher pins to and the agent facts exposed as `ctx.agent`.
27
+ */
28
+ export interface ResolvedHostAgent {
29
+ /** Agent id the child pins to. */
30
+ agentId: string;
31
+ /** Hostname (falls back to agentId). */
32
+ host: string;
33
+ /** The host's label set. */
34
+ labels: readonly string[];
35
+ platform?: string;
36
+ arch?: string;
37
+ /** Which orchestrator owns the live WS (null = not currently connected). */
38
+ connectedInstanceId?: string | null;
39
+ }
40
+ /**
41
+ * One dispatchable unit produced from a lock job. `variantKind` is `matrix` for
42
+ * a matrix combination child and `host` for a `runsOnAll` per-host child; absent
43
+ * for a non-fanned job.
18
44
  */
19
45
  export interface MaterializedJob {
20
46
  /** The originating lock job. Its matrix/include/exclude are NOT dispatched as-is. */
@@ -24,14 +50,22 @@ export interface MaterializedJob {
24
50
  /** `${baseName} (${suffix})` for fanned children, else `baseName`. */
25
51
  expandedName: string;
26
52
  /** Present only for fanned children. */
27
- variantKind?: 'matrix';
28
- /** The combination values for a fanned child; absent for non-fanned jobs. */
53
+ variantKind?: VariantKind;
54
+ /** The combination values for a matrix child; absent for non-matrix jobs. */
29
55
  variantValues?: MatrixValues;
30
56
  /**
31
57
  * True when the job carries a dynamic matrix the orchestrator cannot expand —
32
58
  * it must route through the agent-eval flow and be re-materialized from the result.
33
59
  */
34
60
  pendingDynamicMatrix?: boolean;
61
+ /** The agent this child is pinned to. */
62
+ pinnedAgentId?: string;
63
+ /** The host this child runs on (also the variant label / name suffix). */
64
+ host?: string;
65
+ /** The resolved host agent facts, exposed to the step as `ctx.agent`. */
66
+ agent?: ResolvedHostAgent;
67
+ /** Which orchestrator owns the pinned agent's live WS (null = not connected). */
68
+ connectedInstanceId?: string | null;
35
69
  }
36
70
  export interface FanoutResult {
37
71
  jobs: MaterializedJob[];
@@ -58,6 +92,28 @@ export declare function matrixEnvelopeFields(mat: MaterializedJob): {
58
92
  * enforces the same cap / zero-combination guards.
59
93
  */
60
94
  export declare function materializeResolvedMatrix(lockJob: LockJob, combos: readonly MatrixValues[]): FanoutResult;
95
+ /**
96
+ * The job-config envelope fields that identify a materialized host child: the
97
+ * expanded `name`, the `baseJobName`, the `pinnedAgentId`, the `host` (exposed as
98
+ * `ctx.host` and persisted as `variant_label`), and the resolved `agent` facts
99
+ * (exposed as `ctx.agent`). The matrix sibling is {@link matrixEnvelopeFields}.
100
+ */
101
+ export declare function hostEnvelopeFields(mat: MaterializedJob): {
102
+ name: string;
103
+ baseJobName: string;
104
+ pinnedAgentId?: string;
105
+ host?: string;
106
+ agent?: ResolvedHostAgent;
107
+ connectedInstanceId?: string | null;
108
+ };
109
+ /**
110
+ * Build materialized host children from a resolved target-host list (produced by
111
+ * the roster-backed resolution branch at dispatch time). Emits one pinned child
112
+ * per host, sibling to {@link materializeResolvedMatrix}. `maxHosts` is the
113
+ * orchestrator `maxFanoutHosts` config (default 1024) — NOT {@link MAX_FANOUT_JOBS}
114
+ * (the 256 matrix cap is GitHub-Actions author-error parity, irrelevant to fleet size).
115
+ */
116
+ export declare function materializeResolvedHosts(lockJob: LockJob, agents: readonly ResolvedHostAgent[], maxHosts: number): FanoutResult;
61
117
  /**
62
118
  * Expand each lock job's static matrix into N dispatchable children (one per
63
119
  * combination), passing non-matrix and dynamic-matrix jobs through 1:1.
@@ -5,6 +5,16 @@ import { formatExpandedJobName } from "../matrix/format.js";
5
5
  /** Hard cap on children per fanned job — mirrors the compiler's MAX_STATIC_MATRIX_JOBS. */
6
6
  const MAX_FANOUT_JOBS = 256;
7
7
  /**
8
+ * The kind of fan-out a materialized child belongs to. `matrix` children come
9
+ * from a matrix expansion (one per combination); `host` children come from a
10
+ * `runsOnAll` fan-out (one pinned execution per roster host).
11
+ */
12
+ let VariantKind = /* @__PURE__ */ function(VariantKind) {
13
+ VariantKind["matrix"] = "matrix";
14
+ VariantKind["host"] = "host";
15
+ return VariantKind;
16
+ }({});
17
+ /**
8
18
  * Thrown when a job's matrix cannot be materialized into dispatchable children:
9
19
  * zero combinations after exclude, or more combinations than {@link MAX_FANOUT_JOBS}.
10
20
  * Callers map this onto the `matrix_expansion` init-failure category.
@@ -61,6 +71,53 @@ function materializeResolvedMatrix(lockJob, combos) {
61
71
  };
62
72
  }
63
73
  /**
74
+ * The job-config envelope fields that identify a materialized host child: the
75
+ * expanded `name`, the `baseJobName`, the `pinnedAgentId`, the `host` (exposed as
76
+ * `ctx.host` and persisted as `variant_label`), and the resolved `agent` facts
77
+ * (exposed as `ctx.agent`). The matrix sibling is {@link matrixEnvelopeFields}.
78
+ */
79
+ function hostEnvelopeFields(mat) {
80
+ return {
81
+ name: mat.expandedName,
82
+ baseJobName: mat.baseName,
83
+ ...mat.pinnedAgentId && { pinnedAgentId: mat.pinnedAgentId },
84
+ ...mat.host && { host: mat.host },
85
+ ...mat.agent && { agent: mat.agent },
86
+ ...mat.connectedInstanceId !== void 0 && { connectedInstanceId: mat.connectedInstanceId }
87
+ };
88
+ }
89
+ /**
90
+ * Build materialized host children from a resolved target-host list (produced by
91
+ * the roster-backed resolution branch at dispatch time). Emits one pinned child
92
+ * per host, sibling to {@link materializeResolvedMatrix}. `maxHosts` is the
93
+ * orchestrator `maxFanoutHosts` config (default 1024) — NOT {@link MAX_FANOUT_JOBS}
94
+ * (the 256 matrix cap is GitHub-Actions author-error parity, irrelevant to fleet size).
95
+ */
96
+ function materializeResolvedHosts(lockJob, agents, maxHosts) {
97
+ if (agents.length === 0) throw new FanoutError(lockJob.name, `runsOnAll for job '${lockJob.name}' matched zero matching hosts`);
98
+ if (agents.length > maxHosts) throw new FanoutError(lockJob.name, `runsOnAll for job '${lockJob.name}' matched ${agents.length} hosts (max ${maxHosts})`);
99
+ const jobs = [];
100
+ const names = [];
101
+ for (const agent of agents) {
102
+ const expandedName = `${lockJob.name} (${agent.host})`;
103
+ names.push(expandedName);
104
+ jobs.push({
105
+ lockJob,
106
+ baseName: lockJob.name,
107
+ expandedName,
108
+ variantKind: "host",
109
+ pinnedAgentId: agent.agentId,
110
+ host: agent.host,
111
+ agent,
112
+ connectedInstanceId: agent.connectedInstanceId ?? null
113
+ });
114
+ }
115
+ return {
116
+ jobs,
117
+ expansionMap: new Map([[lockJob.name, names]])
118
+ };
119
+ }
120
+ /**
64
121
  * Expand each lock job's static matrix into N dispatchable children (one per
65
122
  * combination), passing non-matrix and dynamic-matrix jobs through 1:1.
66
123
  * Dynamic-matrix jobs are flagged `pendingDynamicMatrix` for the eval flow.
@@ -114,6 +171,6 @@ function materializeFanout(staticJobs) {
114
171
  };
115
172
  }
116
173
  //#endregion
117
- export { FanoutError, MAX_FANOUT_JOBS, materializeFanout, materializeResolvedMatrix, matrixEnvelopeFields };
174
+ export { FanoutError, MAX_FANOUT_JOBS, VariantKind, hostEnvelopeFields, materializeFanout, materializeResolvedHosts, materializeResolvedMatrix, matrixEnvelopeFields };
118
175
 
119
176
  //# sourceMappingURL=materialize.js.map
package/dist/index.d.ts CHANGED
@@ -47,6 +47,7 @@ export * from './environment/index.js';
47
47
  export { deriveOsArchLabels, hostLabel, parseHostLabel, HOST_LABEL_PREFIX, agentTypeLabel, scalerLabel, mergeAutoLabels, normalizeRunsOn, KNOWN_ROLES, resolveRoleLabels, validateNoReservedLabels, scalerAgentLabels, isSelfReportedLabel, SELF_REPORTED_LABEL_PREFIXES, } from './labels.js';
48
48
  export type { NormalizedRunsOn } from './labels.js';
49
49
  export type { AgentRole } from './labels.js';
50
+ export { LabelMatcher, matcherMatches, matcherSatisfiedBy, partitionMatchers, compileRegexMatcher, } from './labels-match.js';
50
51
  export * from './scaler/scaler-backend-type.js';
51
52
  export * from './scaler/resource-types.js';
52
53
  export * from './registration/registerable-trigger-type.js';
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import { browserJobContextSchema, browserRunEventSchema, dashboardOrchLogsReques
11
11
  import { EventLogSource, EventLogStatus, PayloadOmittedReason } from "./protocol/messages/event-log.js";
12
12
  import { ScalerBackendType } from "./scaler/scaler-backend-type.js";
13
13
  import { ApprovalDecision, HoldScope, TriggerSource, approvalRequirementSchema, approverClauseSchema } from "./approval/types.js";
14
- import { IfFailedPolicy, NeedsEntrySchema, NeedsGroupEntrySchema, SCHEMA_VERSION, isLockDynamicJobFn, isLockInlineValue, isLockStaticJob } from "./trigger/types.js";
14
+ import { IfFailedPolicy, NeedsEntrySchema, NeedsGroupEntrySchema, OnUnreachableMode, SCHEMA_VERSION, isLockDynamicJobFn, isLockInlineValue, isLockStaticJob } from "./trigger/types.js";
15
15
  import { EnvDeleteErrorCode, EventLogPayloadStreamError, HeldRunQueueType, HeldRunStatus, TestRelayType, attestationListItemSchema, backendGetRequestSchema, backendGetResponseSchema, backendItemSchema, backendSyncRequestSchema, backendSyncResponseSchema, backendTestRequestSchema, backendTestResponseSchema, backendsListRequestSchema, backendsListResponseSchema, backendsSyncAllRequestSchema, backendsSyncAllResponseSchema, browserEventLogPayloadChunkSchema, dashboardAttestationsApiResponseSchema, dashboardAttestationsListRequestSchema, dashboardAttestationsListResponseSchema, dashboardDiagnosticsRequestSchema, dashboardDiagnosticsResponseSchema, dashboardEventDlqCountRequestSchema, dashboardEventDlqDiscardRequestSchema, dashboardEventDlqListItemSchema, dashboardEventDlqListRequestSchema, dashboardEventDlqRetryRequestSchema, dashboardEventLogDetailRequestSchema, dashboardEventLogListRequestSchema, dashboardEventLogPayloadChunkSchema, dashboardEventLogPayloadStreamRequestSchema, dashboardJobDetailSchema, dashboardOrchToPlatformSchema, dashboardPayloadRequestSchema, dashboardPlatformToOrchSchema, dashboardRunDetailApiResponseSchema, dashboardRunDetailRequestSchema, dashboardRunDetailResponseSchema, dashboardRunSummarySchema, dashboardRunsFiltersRequestSchema, dashboardRunsFiltersResponseSchema, dashboardRunsListRequestSchema, dashboardRunsListResponseSchema, dashboardScalerAgentsRequestSchema, dashboardScalerAgentsResponseSchema, dashboardScalerCapacityRequestSchema, dashboardScalerCapacityResponseSchema, dashboardSourceSummarySchema, dashboardSourcesListRequestSchema, dashboardSourcesListResponseSchema, dashboardStepLogsApiResponseSchema, dashboardStepLogsRequestSchema, dashboardStepLogsResponseSchema, diagnosticsInfrastructureResponseSchema, diagnosticsSummaryResponseSchema, envBindingsListRequestSchema, envBindingsSetRequestSchema, envCreateRequestSchema, envDeleteRequestSchema, envGetRequestSchema, envHistoryRequestSchema, envListRequestSchema, envSecretDeleteRequestSchema, envSecretScopeCreateRequestSchema, envSecretScopeDeleteRequestSchema, envSecretScopeRenameRequestSchema, envSecretSetRequestSchema, envSecretsListRequestSchema, envSourceOverrideDeleteRequestSchema, envSourceOverrideSetRequestSchema, envSourceOverridesListRequestSchema, envTestAccessSetRequestSchema, envUpdateRequestSchema, envVarDeleteRequestSchema, envVarSetRequestSchema, envVarsListRequestSchema, eventLogListItemSchema, heldRunApproveRequestSchema, heldRunRejectRequestSchema, heldRunsListRequestSchema, identityLinkItemSchema, identityLinkListResponseSchema, manualScheduleRequestSchema, memberIdentityLinkSchema, memberListResponseSchema, memberRoleAssignmentSchema, orgMemberSchema, registrationDeleteRequestSchema, registrationDisableRequestSchema, registrationItemSchema, registrationsListRequestSchema, registrationsListResponseSchema, runCancelRequestSchema, runEventSchema, runLineageResponseSchema, runListItemSchema, runListResponseSchema, runRerunRequestSchema, testRelayCancelRequestSchema, testRelayCancelResponseSchema, testRelayRunLogsRequestSchema, testRelayRunLogsResponseSchema, testRelayRunStatusRequestSchema, testRelayRunStatusResponseSchema, testRelayTriggerRequestSchema, testRelayTriggerResponseSchema, testRelayUploadsInitRequestSchema, testRelayUploadsInitResponseSchema, trustPolicyResponseSchema } from "./protocol/messages/dashboard.js";
16
16
  import { WEBHOOK_RELAY_CHUNK_SIZE, WEBHOOK_RELAY_MAX_BODY_BYTES, WebhookRelayResult, cacheStatsSchema, executionEventSchema, logChunkSchema, orchMetricsSchema, orchestratorToPlatformMessageSchema, peerDiscoverSchema, peerUpdateSchema, platformToOrchestratorMessageSchema, staleCheckrunCleanupSchema, trustPolicyUpdateSchema, webhookAckSchema, webhookRelayChunkSchema, webhookRelaySchema, webhookRelayStartSchema } from "./protocol/messages/platform-orchestrator.js";
17
17
  import { ScalerEventType } from "./protocol/messages/scaler-event.js";
@@ -22,8 +22,9 @@ import { logPullOrchToPlatformSchema, logPullPlatformToOrchSchema } from "./prot
22
22
  import { EVENT_LOG_PAYLOAD_CHUNK_BYTES } from "./protocol/event-log-payload.js";
23
23
  import { browserAuthFailureSchema, browserAuthRefreshSchema, browserAuthRequestSchema, browserAuthSuccessSchema, browserErrorSchema, browserEventLogPayloadFetchSchema, browserGapSchema, browserJobNewSchema, browserJobStatusSchema, browserLogLinesSchema, browserLogStreamTerminatedReason, browserLogStreamTerminatedSchema, browserLogSubscribeSchema, browserLogUnsubscribeSchema, browserPingSchema, browserPongSchema, browserRunNewSchema, browserRunStatusSchema, browserStatusSubscribeSchema, browserStatusUnsubscribeSchema, browserStepStatusSchema, browserToPlatformMessageSchema, platformToBrowserMessageSchema } from "./protocol/messages/browser.js";
24
24
  import { joinRequestSchema, joinResponseSchema } from "./protocol/messages/join.js";
25
+ import { LabelMatcher, compileRegexMatcher, matcherMatches, matcherSatisfiedBy, partitionMatchers } from "./labels-match.js";
25
26
  import { fleetSelectionSchema, jobProgressSchema, jobRerouteAckSchema, jobRerouteSchema, peerAgentTokenRevokeSchema, peerAuthRequestSchema, peerAuthResponseSchema, peerCapabilitiesSchema, peerConfigReloadResponseSchema, peerConfigReloadSchema, peerFromPeerMessageSchema, peerHeartbeatSchema, peerHelloResponseSchema, peerHelloSchema, peerJobCancelSchema, peerLeavingSchema, peerLogsCollectChunkSchema, peerLogsCollectErrorSchema, peerLogsCollectRequestSchema, peerScalerEventSchema, peerToPeerMessageSchema, raftAppendEntriesSchema, raftVoteRequestSchema, raftVoteResponseSchema } from "./protocol/messages/peer.js";
26
- import { CacheRefScope, JobRejectReason, StepApprovalOutcome, agentApiRequestSchema, agentApiResponseSchema, agentAuthFailureSchema, agentAuthRequestSchema, agentAuthSuccessSchema, agentLogChunkSchema, agentMetricsSchema, agentRegisterSchema, agentStatusSchema, agentStepStatusSchema, agentToOrchestratorMessageSchema, cacheUserRestoreRequestSchema, cacheUserRestoreResponseSchema, cacheUserSaveCompleteSchema, cacheUserSaveRequestSchema, cacheUserSaveResponseSchema, configAckSchema, eventEmitResponseSchema, eventEmitSchema, fleetBundleChunkSchema, fleetBundleErrorSchema, fleetLogsRequestSchema, gitAuthSchema, jobAckSchema, jobCancelSchema, jobConcurrencyAckSchema, jobConcurrencyReportSchema, jobDispatchSchema, jobRejectSchema, jobStatusSchema, orchestratorToAgentMessageSchema, provenanceUploadCompleteSchema, provenanceUploadRequestSchema, provenanceUploadResponseSchema, registerAckSchema, stepApprovalRequestSchema, stepApprovalResolvedSchema } from "./protocol/messages/orchestrator-agent.js";
27
+ import { CacheRefScope, JobRejectReason, StepApprovalOutcome, agentApiRequestSchema, agentApiResponseSchema, agentAuthFailureSchema, agentAuthRequestSchema, agentAuthSuccessSchema, agentLogChunkSchema, agentMetricsSchema, agentRegisterSchema, agentStatusSchema, agentStepStatusSchema, agentToOrchestratorMessageSchema, cacheUserRestoreRequestSchema, cacheUserRestoreResponseSchema, cacheUserSaveCompleteSchema, cacheUserSaveRequestSchema, cacheUserSaveResponseSchema, configAckSchema, eventEmitResponseSchema, eventEmitSchema, fleetBundleChunkSchema, fleetBundleErrorSchema, fleetLogsRequestSchema, gitAuthSchema, jobAckSchema, jobCancelSchema, jobConcurrencyAckSchema, jobConcurrencyReportSchema, jobDispatchSchema, jobRejectSchema, jobStatusSchema, orchestratorToAgentMessageSchema, provenanceUploadCompleteSchema, provenanceUploadRequestSchema, provenanceUploadResponseSchema, registerAckSchema, stepApprovalRequestSchema, stepApprovalResolvedSchema, upstreamSnapshotSchema } from "./protocol/messages/orchestrator-agent.js";
27
28
  import { TRIGGER_EVENT_META, TRIGGER_EVENT_TYPES } from "./trigger/trigger-event-type.js";
28
29
  import { createTraceEntry, createWorkflowDecision } from "./trigger/decision-trace.js";
29
30
  import { matchAllWorkflows, matchBranchPattern, matchPathPatterns, matchRepoPatterns, matchWorkflowTriggers } from "./trigger/matcher.js";
@@ -45,5 +46,5 @@ import { createWorkflowBundleConfig } from "./bundler/rolldown-config.js";
45
46
  import "./bundler/index.js";
46
47
  import { applyIncludeExclude, expandMatrix, expandMultiDimension, expandSingleDimension } from "./matrix/expand.js";
47
48
  import { formatExpandedJobName, formatMatrixSuffix } from "./matrix/format.js";
48
- import { FanoutError, MAX_FANOUT_JOBS, materializeFanout, materializeResolvedMatrix, matrixEnvelopeFields } from "./fanout/materialize.js";
49
- export { ACCESS_LOG_COLD_DAYS, ACCESS_LOG_WARM_DAYS, AGENT_REQUIRED_KICI_VARS, ALLOWED_SYSTEM_VARS, AccessLogAction, AccessLogOutcome, AccessLogPolicyKind, AccessLogSource, AccessLogTargetType, ActivityFilterSource, ActivityRowSource, ActorType, ApprovalDecision, CacheOutcome, CacheRefScope, CacheRunEventType, CacheStepType, CheckRunConclusion, EVENT_LOG_PAYLOAD_CHUNK_BYTES, EnvDeleteErrorCode, EventLogPayloadStreamError, EventLogSource, EventLogStatus, ExecutionJobStatus, ExecutionRunStatus, ExecutionStepStatus, FanoutError, HOST_LABEL_PREFIX, HeldRunQueueType, HeldRunStatus, HoldScope, IfFailedPolicy, InitFailureCategory, JobRejectReason, KICI_AGENT_ENV_PREFIX, KNOWN_ROLES, LockFileParseError, MAX_FANOUT_JOBS, MIN_PROTOCOL_VERSION, NeedsEntrySchema, NeedsGroupEntrySchema, ORCH_CAPABILITIES, OrchRole, POLICY_BY_ACTION, PROTOCOL_VERSION, PayloadOmittedReason, RegisterableTriggerType, SANDBOX_DEFAULT_VARS, SCHEMA_VERSION, SELF_REPORTED_LABEL_PREFIXES, ScalerBackendType, ScalerEventType, SourceProvider, SourceSubtype, StepApprovalOutcome, TERMINAL_JOB_STATES, TERMINAL_RUN_STATES, TRIGGER_EVENT_META, TRIGGER_EVENT_TYPES, TestRelayType, TimeoutReason, TriggerSource, WEBHOOK_RELAY_CHUNK_SIZE, WEBHOOK_RELAY_MAX_BODY_BYTES, WS_CLOSE_AGENT_AUTH_FAILED, WS_CLOSE_AUTH_TIMEOUT, WS_CLOSE_CLUSTER_NAME_CONFLICT, WS_CLOSE_DISPATCH_ACK_TIMEOUT, WS_CLOSE_GOING_AWAY, WS_CLOSE_HEARTBEAT_TIMEOUT, WS_CLOSE_INTERNAL_ERROR, WS_CLOSE_INVALID_MESSAGE, WS_CLOSE_PLAN_LIMIT, WS_CLOSE_PROTOCOL_ERROR, WS_CLOSE_RUN_NOT_FOUND, WS_CLOSE_UNAUTHORIZED, WS_MAX_PAYLOAD_BYTES, WebhookRelayResult, WsRateLimiter, accessLogFilterSchema, accessLogItemSchema, accessLogWarmSqlCase, ackSchema, activityCursorSchema, activityFilterSchema, activityRowSchema, actorPrincipalSchema, agentApiRequestSchema, agentApiResponseSchema, agentAuthFailureSchema, agentAuthRequestSchema, agentAuthSuccessSchema, agentLogChunkSchema, agentMetricsSchema, agentRegisterSchema, agentStatusSchema, agentStepStatusSchema, agentToOrchestratorMessageSchema, agentTypeLabel, apiKeyActorSchema, applyIncludeExclude, approvalRequirementSchema, approverClauseSchema, attestationListItemSchema, auditLogColdDays, auditLogWarmDays, auditLogWarmSqlCase, authFailureSchema, authRequestSchema, authSuccessSchema, backendGetRequestSchema, backendGetResponseSchema, backendItemSchema, backendSyncRequestSchema, backendSyncResponseSchema, backendTestRequestSchema, backendTestResponseSchema, backendsListRequestSchema, backendsListResponseSchema, backendsSyncAllRequestSchema, backendsSyncAllResponseSchema, browserAuthFailureSchema, browserAuthRefreshSchema, browserAuthRequestSchema, browserAuthSuccessSchema, browserErrorSchema, browserEventLogPayloadChunkSchema, browserEventLogPayloadFetchSchema, browserGapSchema, browserJobContextSchema, browserJobNewSchema, browserJobStatusSchema, browserLogLinesSchema, browserLogStreamTerminatedReason, browserLogStreamTerminatedSchema, browserLogSubscribeSchema, browserLogUnsubscribeSchema, browserPingSchema, browserPongSchema, browserRunEventSchema, browserRunNewSchema, browserRunStatusSchema, browserStatusSubscribeSchema, browserStatusUnsubscribeSchema, browserStepStatusSchema, browserToPlatformMessageSchema, cacheStatsSchema, cacheUserRestoreRequestSchema, cacheUserRestoreResponseSchema, cacheUserSaveCompleteSchema, cacheUserSaveRequestSchema, cacheUserSaveResponseSchema, configAckSchema, createTraceEntry, createWorkflowBundleConfig, createWorkflowDecision, dashboardAccessLogListRequestSchema, dashboardAccessLogListResponseSchema, dashboardAttestationsApiResponseSchema, dashboardAttestationsListRequestSchema, dashboardAttestationsListResponseSchema, dashboardDiagnosticsRequestSchema, dashboardDiagnosticsResponseSchema, dashboardEventDlqCountRequestSchema, dashboardEventDlqDiscardRequestSchema, dashboardEventDlqListItemSchema, dashboardEventDlqListRequestSchema, dashboardEventDlqRetryRequestSchema, dashboardEventLogDetailRequestSchema, dashboardEventLogListRequestSchema, dashboardEventLogPayloadChunkSchema, dashboardEventLogPayloadStreamRequestSchema, dashboardJobDetailSchema, dashboardOrchLogsRequestSchema, dashboardOrchLogsResponseSchema, dashboardOrchToPlatformSchema, dashboardPayloadRequestSchema, dashboardPlatformToOrchSchema, dashboardRunDetailApiResponseSchema, dashboardRunDetailRequestSchema, dashboardRunDetailResponseSchema, dashboardRunSummarySchema, dashboardRunsFiltersRequestSchema, dashboardRunsFiltersResponseSchema, dashboardRunsListRequestSchema, dashboardRunsListResponseSchema, dashboardScalerAgentsRequestSchema, dashboardScalerAgentsResponseSchema, dashboardScalerCapacityRequestSchema, dashboardScalerCapacityResponseSchema, dashboardSourceSummarySchema, dashboardSourcesListRequestSchema, dashboardSourcesListResponseSchema, dashboardStepLogsApiResponseSchema, dashboardStepLogsRequestSchema, dashboardStepLogsResponseSchema, decodeActivityCursor, deriveOsArchLabels, diagnosticsInfrastructureResponseSchema, diagnosticsSummaryResponseSchema, encodeActivityCursor, envBindingsListRequestSchema, envBindingsSetRequestSchema, envCreateRequestSchema, envDeleteRequestSchema, envGetRequestSchema, envHistoryRequestSchema, envListRequestSchema, envSecretDeleteRequestSchema, envSecretScopeCreateRequestSchema, envSecretScopeDeleteRequestSchema, envSecretScopeRenameRequestSchema, envSecretSetRequestSchema, envSecretsListRequestSchema, envSourceOverrideDeleteRequestSchema, envSourceOverrideSetRequestSchema, envSourceOverridesListRequestSchema, envTestAccessSetRequestSchema, envUpdateRequestSchema, envVarDeleteRequestSchema, envVarSetRequestSchema, envVarsListRequestSchema, errorSchema, eventEmitResponseSchema, eventEmitSchema, eventLogListItemSchema, executionEventSchema, executionStatusSchema, expandMatrix, expandMultiDimension, expandSingleDimension, flattenActor, fleetBundleChunkSchema, fleetBundleErrorSchema, fleetLogsRequestSchema, fleetSelectionSchema, fnv1a32, formatExpandedJobName, formatMatrixSuffix, getAccessLogColdDays, getAccessLogWarmDays, getAuditLogColdDays, getAuditLogWarmDays, getSecretAuditLogColdDays, getSecretAuditLogWarmDays, gitAuthSchema, hasOrchCapability, heartbeatSchema, heldRunApproveRequestSchema, heldRunRejectRequestSchema, heldRunsListRequestSchema, hostLabel, identityLinkItemSchema, identityLinkListResponseSchema, initFailureSchema, isLockDynamicJobFn, isLockInlineValue, isLockStaticJob, isSelfReportedLabel, isTerminal, jobAckSchema, jobCancelSchema, jobConcurrencyAckSchema, jobConcurrencyReportSchema, jobContextMessageSchema, jobDispatchSchema, jobProgressSchema, jobRejectSchema, jobRerouteAckSchema, jobRerouteSchema, jobStatusForwardSchema, jobStatusSchema, joinRequestSchema, joinResponseSchema, logChunkSchema, logPullOrchToPlatformSchema, logPullPlatformToOrchSchema, manualScheduleRequestSchema, matchAllWorkflows, matchBranchPattern, matchPathPatterns, matchRepoPatterns, matchScopePattern, matchWorkflowTriggers, materializeFanout, materializeResolvedMatrix, matrixEnvelopeFields, memberIdentityLinkSchema, memberListResponseSchema, memberRoleAssignmentSchema, mergeAutoLabels, minAccessLogWarmDays, minAuditLogWarmDays, minSecretAuditLogWarmDays, nackSchema, normalizeRunsOn, orchCapabilitiesSchema, orchMetricsSchema, orchestratorToAgentMessageSchema, orchestratorToPlatformMessageSchema, orgMemberSchema, parseActor, parseHostLabel, parseMemoryString, peerAgentTokenRevokeSchema, peerAuthRequestSchema, peerAuthResponseSchema, peerCapabilitiesSchema, peerConfigReloadResponseSchema, peerConfigReloadSchema, peerDiscoverSchema, peerFromPeerMessageSchema, peerHeartbeatSchema, peerHelloResponseSchema, peerHelloSchema, peerJobCancelSchema, peerLeavingSchema, peerLogsCollectChunkSchema, peerLogsCollectErrorSchema, peerLogsCollectRequestSchema, peerScalerEventSchema, peerToPeerMessageSchema, peerUpdateSchema, platformOperatorActorSchema, platformToBrowserMessageSchema, platformToOrchestratorMessageSchema, provenanceUploadCompleteSchema, provenanceUploadRequestSchema, provenanceUploadResponseSchema, raftAppendEntriesSchema, raftVoteRequestSchema, raftVoteResponseSchema, registerAckSchema, registrationDeleteRequestSchema, registrationDisableRequestSchema, registrationItemSchema, registrationsListRequestSchema, registrationsListResponseSchema, resolveRoleLabels, resolveRunIdSugar, resolveSecretsForEnvironment, resourceRequestNestedSchema, resourceSpecSchema, runCancelRequestSchema, runEventMessageSchema, runEventSchema, runLineageResponseSchema, runListItemSchema, runListResponseSchema, runRerunRequestSchema, scalerAgentLabels, scalerLabel, secretAuditLogColdDays, secretAuditLogWarmDays, secretAuditLogWarmSqlCase, serviceAccountActorSchema, shouldRecordAccess, shouldRecordSecretResolve, sourceDeregisterAckSchema, sourceDeregisterSchema, sourceRegistrationAckSchema, sourceRegistrationSchema, staleCheckrunCleanupSchema, stateReplaySchema, stepApprovalRequestSchema, stepApprovalResolvedSchema, stepStatusForwardSchema, stringifyActor, stripScopePrefix, systemActorSchema, testRelayCancelRequestSchema, testRelayCancelResponseSchema, testRelayRunLogsRequestSchema, testRelayRunLogsResponseSchema, testRelayRunStatusRequestSchema, testRelayRunStatusResponseSchema, testRelayTriggerRequestSchema, testRelayTriggerResponseSchema, testRelayUploadsInitRequestSchema, testRelayUploadsInitResponseSchema, transition, trustPolicyResponseSchema, trustPolicyUpdateSchema, userActorSchema, validateNoReservedLabels, validateResourceRequest, webhookAckSchema, webhookRelayChunkSchema, webhookRelaySchema, webhookRelayStartSchema };
49
+ import { FanoutError, MAX_FANOUT_JOBS, VariantKind, hostEnvelopeFields, materializeFanout, materializeResolvedHosts, materializeResolvedMatrix, matrixEnvelopeFields } from "./fanout/materialize.js";
50
+ export { ACCESS_LOG_COLD_DAYS, ACCESS_LOG_WARM_DAYS, AGENT_REQUIRED_KICI_VARS, ALLOWED_SYSTEM_VARS, AccessLogAction, AccessLogOutcome, AccessLogPolicyKind, AccessLogSource, AccessLogTargetType, ActivityFilterSource, ActivityRowSource, ActorType, ApprovalDecision, CacheOutcome, CacheRefScope, CacheRunEventType, CacheStepType, CheckRunConclusion, EVENT_LOG_PAYLOAD_CHUNK_BYTES, EnvDeleteErrorCode, EventLogPayloadStreamError, EventLogSource, EventLogStatus, ExecutionJobStatus, ExecutionRunStatus, ExecutionStepStatus, FanoutError, HOST_LABEL_PREFIX, HeldRunQueueType, HeldRunStatus, HoldScope, IfFailedPolicy, InitFailureCategory, JobRejectReason, KICI_AGENT_ENV_PREFIX, KNOWN_ROLES, LabelMatcher, LockFileParseError, MAX_FANOUT_JOBS, MIN_PROTOCOL_VERSION, NeedsEntrySchema, NeedsGroupEntrySchema, ORCH_CAPABILITIES, OnUnreachableMode, OrchRole, POLICY_BY_ACTION, PROTOCOL_VERSION, PayloadOmittedReason, RegisterableTriggerType, SANDBOX_DEFAULT_VARS, SCHEMA_VERSION, SELF_REPORTED_LABEL_PREFIXES, ScalerBackendType, ScalerEventType, SourceProvider, SourceSubtype, StepApprovalOutcome, TERMINAL_JOB_STATES, TERMINAL_RUN_STATES, TRIGGER_EVENT_META, TRIGGER_EVENT_TYPES, TestRelayType, TimeoutReason, TriggerSource, VariantKind, WEBHOOK_RELAY_CHUNK_SIZE, WEBHOOK_RELAY_MAX_BODY_BYTES, WS_CLOSE_AGENT_AUTH_FAILED, WS_CLOSE_AUTH_TIMEOUT, WS_CLOSE_CLUSTER_NAME_CONFLICT, WS_CLOSE_DISPATCH_ACK_TIMEOUT, WS_CLOSE_GOING_AWAY, WS_CLOSE_HEARTBEAT_TIMEOUT, WS_CLOSE_INTERNAL_ERROR, WS_CLOSE_INVALID_MESSAGE, WS_CLOSE_PLAN_LIMIT, WS_CLOSE_PROTOCOL_ERROR, WS_CLOSE_RUN_NOT_FOUND, WS_CLOSE_UNAUTHORIZED, WS_MAX_PAYLOAD_BYTES, WebhookRelayResult, WsRateLimiter, accessLogFilterSchema, accessLogItemSchema, accessLogWarmSqlCase, ackSchema, activityCursorSchema, activityFilterSchema, activityRowSchema, actorPrincipalSchema, agentApiRequestSchema, agentApiResponseSchema, agentAuthFailureSchema, agentAuthRequestSchema, agentAuthSuccessSchema, agentLogChunkSchema, agentMetricsSchema, agentRegisterSchema, agentStatusSchema, agentStepStatusSchema, agentToOrchestratorMessageSchema, agentTypeLabel, apiKeyActorSchema, applyIncludeExclude, approvalRequirementSchema, approverClauseSchema, attestationListItemSchema, auditLogColdDays, auditLogWarmDays, auditLogWarmSqlCase, authFailureSchema, authRequestSchema, authSuccessSchema, backendGetRequestSchema, backendGetResponseSchema, backendItemSchema, backendSyncRequestSchema, backendSyncResponseSchema, backendTestRequestSchema, backendTestResponseSchema, backendsListRequestSchema, backendsListResponseSchema, backendsSyncAllRequestSchema, backendsSyncAllResponseSchema, browserAuthFailureSchema, browserAuthRefreshSchema, browserAuthRequestSchema, browserAuthSuccessSchema, browserErrorSchema, browserEventLogPayloadChunkSchema, browserEventLogPayloadFetchSchema, browserGapSchema, browserJobContextSchema, browserJobNewSchema, browserJobStatusSchema, browserLogLinesSchema, browserLogStreamTerminatedReason, browserLogStreamTerminatedSchema, browserLogSubscribeSchema, browserLogUnsubscribeSchema, browserPingSchema, browserPongSchema, browserRunEventSchema, browserRunNewSchema, browserRunStatusSchema, browserStatusSubscribeSchema, browserStatusUnsubscribeSchema, browserStepStatusSchema, browserToPlatformMessageSchema, cacheStatsSchema, cacheUserRestoreRequestSchema, cacheUserRestoreResponseSchema, cacheUserSaveCompleteSchema, cacheUserSaveRequestSchema, cacheUserSaveResponseSchema, compileRegexMatcher, configAckSchema, createTraceEntry, createWorkflowBundleConfig, createWorkflowDecision, dashboardAccessLogListRequestSchema, dashboardAccessLogListResponseSchema, dashboardAttestationsApiResponseSchema, dashboardAttestationsListRequestSchema, dashboardAttestationsListResponseSchema, dashboardDiagnosticsRequestSchema, dashboardDiagnosticsResponseSchema, dashboardEventDlqCountRequestSchema, dashboardEventDlqDiscardRequestSchema, dashboardEventDlqListItemSchema, dashboardEventDlqListRequestSchema, dashboardEventDlqRetryRequestSchema, dashboardEventLogDetailRequestSchema, dashboardEventLogListRequestSchema, dashboardEventLogPayloadChunkSchema, dashboardEventLogPayloadStreamRequestSchema, dashboardJobDetailSchema, dashboardOrchLogsRequestSchema, dashboardOrchLogsResponseSchema, dashboardOrchToPlatformSchema, dashboardPayloadRequestSchema, dashboardPlatformToOrchSchema, dashboardRunDetailApiResponseSchema, dashboardRunDetailRequestSchema, dashboardRunDetailResponseSchema, dashboardRunSummarySchema, dashboardRunsFiltersRequestSchema, dashboardRunsFiltersResponseSchema, dashboardRunsListRequestSchema, dashboardRunsListResponseSchema, dashboardScalerAgentsRequestSchema, dashboardScalerAgentsResponseSchema, dashboardScalerCapacityRequestSchema, dashboardScalerCapacityResponseSchema, dashboardSourceSummarySchema, dashboardSourcesListRequestSchema, dashboardSourcesListResponseSchema, dashboardStepLogsApiResponseSchema, dashboardStepLogsRequestSchema, dashboardStepLogsResponseSchema, decodeActivityCursor, deriveOsArchLabels, diagnosticsInfrastructureResponseSchema, diagnosticsSummaryResponseSchema, encodeActivityCursor, envBindingsListRequestSchema, envBindingsSetRequestSchema, envCreateRequestSchema, envDeleteRequestSchema, envGetRequestSchema, envHistoryRequestSchema, envListRequestSchema, envSecretDeleteRequestSchema, envSecretScopeCreateRequestSchema, envSecretScopeDeleteRequestSchema, envSecretScopeRenameRequestSchema, envSecretSetRequestSchema, envSecretsListRequestSchema, envSourceOverrideDeleteRequestSchema, envSourceOverrideSetRequestSchema, envSourceOverridesListRequestSchema, envTestAccessSetRequestSchema, envUpdateRequestSchema, envVarDeleteRequestSchema, envVarSetRequestSchema, envVarsListRequestSchema, errorSchema, eventEmitResponseSchema, eventEmitSchema, eventLogListItemSchema, executionEventSchema, executionStatusSchema, expandMatrix, expandMultiDimension, expandSingleDimension, flattenActor, fleetBundleChunkSchema, fleetBundleErrorSchema, fleetLogsRequestSchema, fleetSelectionSchema, fnv1a32, formatExpandedJobName, formatMatrixSuffix, getAccessLogColdDays, getAccessLogWarmDays, getAuditLogColdDays, getAuditLogWarmDays, getSecretAuditLogColdDays, getSecretAuditLogWarmDays, gitAuthSchema, hasOrchCapability, heartbeatSchema, heldRunApproveRequestSchema, heldRunRejectRequestSchema, heldRunsListRequestSchema, hostEnvelopeFields, hostLabel, identityLinkItemSchema, identityLinkListResponseSchema, initFailureSchema, isLockDynamicJobFn, isLockInlineValue, isLockStaticJob, isSelfReportedLabel, isTerminal, jobAckSchema, jobCancelSchema, jobConcurrencyAckSchema, jobConcurrencyReportSchema, jobContextMessageSchema, jobDispatchSchema, jobProgressSchema, jobRejectSchema, jobRerouteAckSchema, jobRerouteSchema, jobStatusForwardSchema, jobStatusSchema, joinRequestSchema, joinResponseSchema, logChunkSchema, logPullOrchToPlatformSchema, logPullPlatformToOrchSchema, manualScheduleRequestSchema, matchAllWorkflows, matchBranchPattern, matchPathPatterns, matchRepoPatterns, matchScopePattern, matchWorkflowTriggers, matcherMatches, matcherSatisfiedBy, materializeFanout, materializeResolvedHosts, materializeResolvedMatrix, matrixEnvelopeFields, memberIdentityLinkSchema, memberListResponseSchema, memberRoleAssignmentSchema, mergeAutoLabels, minAccessLogWarmDays, minAuditLogWarmDays, minSecretAuditLogWarmDays, nackSchema, normalizeRunsOn, orchCapabilitiesSchema, orchMetricsSchema, orchestratorToAgentMessageSchema, orchestratorToPlatformMessageSchema, orgMemberSchema, parseActor, parseHostLabel, parseMemoryString, partitionMatchers, peerAgentTokenRevokeSchema, peerAuthRequestSchema, peerAuthResponseSchema, peerCapabilitiesSchema, peerConfigReloadResponseSchema, peerConfigReloadSchema, peerDiscoverSchema, peerFromPeerMessageSchema, peerHeartbeatSchema, peerHelloResponseSchema, peerHelloSchema, peerJobCancelSchema, peerLeavingSchema, peerLogsCollectChunkSchema, peerLogsCollectErrorSchema, peerLogsCollectRequestSchema, peerScalerEventSchema, peerToPeerMessageSchema, peerUpdateSchema, platformOperatorActorSchema, platformToBrowserMessageSchema, platformToOrchestratorMessageSchema, provenanceUploadCompleteSchema, provenanceUploadRequestSchema, provenanceUploadResponseSchema, raftAppendEntriesSchema, raftVoteRequestSchema, raftVoteResponseSchema, registerAckSchema, registrationDeleteRequestSchema, registrationDisableRequestSchema, registrationItemSchema, registrationsListRequestSchema, registrationsListResponseSchema, resolveRoleLabels, resolveRunIdSugar, resolveSecretsForEnvironment, resourceRequestNestedSchema, resourceSpecSchema, runCancelRequestSchema, runEventMessageSchema, runEventSchema, runLineageResponseSchema, runListItemSchema, runListResponseSchema, runRerunRequestSchema, scalerAgentLabels, scalerLabel, secretAuditLogColdDays, secretAuditLogWarmDays, secretAuditLogWarmSqlCase, serviceAccountActorSchema, shouldRecordAccess, shouldRecordSecretResolve, sourceDeregisterAckSchema, sourceDeregisterSchema, sourceRegistrationAckSchema, sourceRegistrationSchema, staleCheckrunCleanupSchema, stateReplaySchema, stepApprovalRequestSchema, stepApprovalResolvedSchema, stepStatusForwardSchema, stringifyActor, stripScopePrefix, systemActorSchema, testRelayCancelRequestSchema, testRelayCancelResponseSchema, testRelayRunLogsRequestSchema, testRelayRunLogsResponseSchema, testRelayRunStatusRequestSchema, testRelayRunStatusResponseSchema, testRelayTriggerRequestSchema, testRelayTriggerResponseSchema, testRelayUploadsInitRequestSchema, testRelayUploadsInitResponseSchema, transition, trustPolicyResponseSchema, trustPolicyUpdateSchema, upstreamSnapshotSchema, userActorSchema, validateNoReservedLabels, validateResourceRequest, webhookAckSchema, webhookRelayChunkSchema, webhookRelaySchema, webhookRelayStartSchema };
@@ -0,0 +1,40 @@
1
+ import type { LabelMatcher } from '../labels-match.js';
2
+ /**
3
+ * Reject a ReDoS-prone regex. `safe-regex` is a star-height heuristic — the
4
+ * orchestrator is single-tenant, so a slipped-through pattern only stalls the
5
+ * author's own orchestrator. Globs are linear by construction but pass through
6
+ * here for uniformity.
7
+ */
8
+ export declare function assertSafeRegex(source: string, flags: string, ctx: string): void;
9
+ /**
10
+ * Convert one author selector element into a `LabelMatcher`.
11
+ * - `RegExp` → regex matcher (source + flags captured verbatim).
12
+ * - string that picomatch detects as a glob → regex via `picomatch.makeRe`.
13
+ * - any other string → exact.
14
+ * `ctx` is a human label (e.g. "job 'web' runsOn") used in ReDoS errors.
15
+ */
16
+ export declare function toLabelMatcher(el: string | RegExp, ctx: string): LabelMatcher;
17
+ export type SelectorEl = string | RegExp;
18
+ export type RunsOnAuthorInput = SelectorEl | readonly SelectorEl[] | {
19
+ labels: SelectorEl | readonly SelectorEl[];
20
+ exclude?: SelectorEl | readonly SelectorEl[];
21
+ };
22
+ export type RunsOnAllAuthorInput = string | RegExp | readonly SelectorEl[] | {
23
+ include: readonly {
24
+ all: readonly SelectorEl[];
25
+ }[];
26
+ exclude?: readonly SelectorEl[];
27
+ };
28
+ /** Normalize a `runsOn` author value into include + exclude matchers. */
29
+ export declare function normalizeRunsOnToMatchers(runsOn: RunsOnAuthorInput, ctx: string): {
30
+ include: LabelMatcher[];
31
+ exclude: LabelMatcher[];
32
+ };
33
+ /** Normalize a `runsOnAll` author value into include groups + exclude matchers. */
34
+ export declare function normalizeRunsOnAllToMatchers(input: RunsOnAllAuthorInput, ctx: string): {
35
+ include: LabelMatcher[][];
36
+ exclude: LabelMatcher[];
37
+ };
38
+ /** Re-validate every regex matcher in a parsed lock selector (orchestrator lock-load). */
39
+ export declare function assertMatchersSafe(matchers: readonly LabelMatcher[], ctx: string): void;
40
+ //# sourceMappingURL=compile.d.ts.map
@@ -0,0 +1,91 @@
1
+ import "../chunk-BTugEXQM.js";
2
+ import picomatch from "picomatch";
3
+ import safeRegex from "safe-regex";
4
+ //#region src/labels/compile.ts
5
+ /**
6
+ * Reject a ReDoS-prone regex. `safe-regex` is a star-height heuristic — the
7
+ * orchestrator is single-tenant, so a slipped-through pattern only stalls the
8
+ * author's own orchestrator. Globs are linear by construction but pass through
9
+ * here for uniformity.
10
+ */
11
+ function assertSafeRegex(source, flags, ctx) {
12
+ if (!safeRegex(new RegExp(source, flags))) throw new Error(`${ctx}: regex /${source}/${flags} is ReDoS-prone — rejected`);
13
+ }
14
+ /**
15
+ * Convert one author selector element into a `LabelMatcher`.
16
+ * - `RegExp` → regex matcher (source + flags captured verbatim).
17
+ * - string that picomatch detects as a glob → regex via `picomatch.makeRe`.
18
+ * - any other string → exact.
19
+ * `ctx` is a human label (e.g. "job 'web' runsOn") used in ReDoS errors.
20
+ */
21
+ function toLabelMatcher(el, ctx) {
22
+ if (el instanceof RegExp) {
23
+ assertSafeRegex(el.source, el.flags, ctx);
24
+ return {
25
+ kind: "regex",
26
+ source: el.source,
27
+ flags: el.flags
28
+ };
29
+ }
30
+ if (picomatch.scan(el).isGlob) {
31
+ const re = picomatch.makeRe(el);
32
+ if (!(re instanceof RegExp)) throw new Error(`${ctx}: glob '${el}' is not a valid pattern`);
33
+ assertSafeRegex(re.source, re.flags, ctx);
34
+ return {
35
+ kind: "regex",
36
+ source: re.source,
37
+ flags: re.flags
38
+ };
39
+ }
40
+ return {
41
+ kind: "exact",
42
+ value: el
43
+ };
44
+ }
45
+ const asArray = (v) => Array.isArray(v) ? v : [v];
46
+ /** Normalize a `runsOn` author value into include + exclude matchers. */
47
+ function normalizeRunsOnToMatchers(runsOn, ctx) {
48
+ if (typeof runsOn === "string" || runsOn instanceof RegExp) return {
49
+ include: [toLabelMatcher(runsOn, ctx)],
50
+ exclude: []
51
+ };
52
+ if (Array.isArray(runsOn)) return {
53
+ include: runsOn.map((e) => toLabelMatcher(e, ctx)),
54
+ exclude: []
55
+ };
56
+ const sel = runsOn;
57
+ return {
58
+ include: asArray(sel.labels).map((e) => toLabelMatcher(e, ctx)),
59
+ exclude: sel.exclude ? asArray(sel.exclude).map((e) => toLabelMatcher(e, ctx)) : []
60
+ };
61
+ }
62
+ /** Normalize a `runsOnAll` author value into include groups + exclude matchers. */
63
+ function normalizeRunsOnAllToMatchers(input, ctx) {
64
+ if (typeof input === "string" || input instanceof RegExp) return {
65
+ include: [[toLabelMatcher(input, ctx)]],
66
+ exclude: []
67
+ };
68
+ if (Array.isArray(input)) {
69
+ const include = [];
70
+ const exclude = [];
71
+ for (const entry of input) if (typeof entry === "string" && entry.startsWith("!")) exclude.push(toLabelMatcher(entry.slice(1), ctx));
72
+ else include.push(toLabelMatcher(entry, ctx));
73
+ return {
74
+ include: include.length ? [include] : [],
75
+ exclude
76
+ };
77
+ }
78
+ const obj = input;
79
+ return {
80
+ include: obj.include.map((g) => g.all.map((e) => toLabelMatcher(e, ctx))),
81
+ exclude: (obj.exclude ?? []).map((e) => toLabelMatcher(e, ctx))
82
+ };
83
+ }
84
+ /** Re-validate every regex matcher in a parsed lock selector (orchestrator lock-load). */
85
+ function assertMatchersSafe(matchers, ctx) {
86
+ for (const m of matchers) if (m.kind === "regex") assertSafeRegex(m.source, m.flags, ctx);
87
+ }
88
+ //#endregion
89
+ export { assertMatchersSafe, assertSafeRegex, normalizeRunsOnAllToMatchers, normalizeRunsOnToMatchers, toLabelMatcher };
90
+
91
+ //# sourceMappingURL=compile.js.map
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * A single label selector element after compilation. Globs are converted to
4
+ * regex at compile time, so the lock file only ever carries `exact` or `regex`.
5
+ * This module is browser-safe (pure `RegExp`, zod only) and lives in the engine
6
+ * barrel; glob conversion and the ReDoS gate live in the Node-only
7
+ * `@kici-dev/engine/labels/compile` subpath.
8
+ */
9
+ export declare const LabelMatcher: z.ZodDiscriminatedUnion<[z.ZodObject<{
10
+ kind: z.ZodLiteral<"exact">;
11
+ value: z.ZodString;
12
+ }, z.core.$strip>, z.ZodObject<{
13
+ kind: z.ZodLiteral<"regex">;
14
+ source: z.ZodString;
15
+ flags: z.ZodString;
16
+ }, z.core.$strip>], "kind">;
17
+ export type LabelMatcher = z.infer<typeof LabelMatcher>;
18
+ /** Compile (and cache) the `RegExp` for a regex matcher. */
19
+ export declare function compileRegexMatcher(m: {
20
+ source: string;
21
+ flags: string;
22
+ }): RegExp;
23
+ /** Whether a single label string satisfies the matcher. */
24
+ export declare function matcherMatches(m: LabelMatcher, label: string): boolean;
25
+ /** Whether some label in the set satisfies the matcher. */
26
+ export declare function matcherSatisfiedBy(m: LabelMatcher, labels: ReadonlySet<string>): boolean;
27
+ /** Split a matcher list into exact label strings and the remaining regex matchers. */
28
+ export declare function partitionMatchers(ms: readonly LabelMatcher[]): {
29
+ exact: string[];
30
+ regex: LabelMatcher[];
31
+ };
32
+ //# sourceMappingURL=labels-match.d.ts.map
@@ -0,0 +1,55 @@
1
+ import "./chunk-BTugEXQM.js";
2
+ import { z } from "zod";
3
+ //#region src/labels-match.ts
4
+ /**
5
+ * A single label selector element after compilation. Globs are converted to
6
+ * regex at compile time, so the lock file only ever carries `exact` or `regex`.
7
+ * This module is browser-safe (pure `RegExp`, zod only) and lives in the engine
8
+ * barrel; glob conversion and the ReDoS gate live in the Node-only
9
+ * `@kici-dev/engine/labels/compile` subpath.
10
+ */
11
+ const LabelMatcher = z.discriminatedUnion("kind", [z.object({
12
+ kind: z.literal("exact"),
13
+ value: z.string()
14
+ }), z.object({
15
+ kind: z.literal("regex"),
16
+ source: z.string(),
17
+ flags: z.string()
18
+ })]);
19
+ const regexCache = /* @__PURE__ */ new Map();
20
+ /** Compile (and cache) the `RegExp` for a regex matcher. */
21
+ function compileRegexMatcher(m) {
22
+ const key = `${m.flags} ${m.source}`;
23
+ let re = regexCache.get(key);
24
+ if (!re) {
25
+ re = new RegExp(m.source, m.flags);
26
+ regexCache.set(key, re);
27
+ }
28
+ return re;
29
+ }
30
+ /** Whether a single label string satisfies the matcher. */
31
+ function matcherMatches(m, label) {
32
+ return m.kind === "exact" ? label === m.value : compileRegexMatcher(m).test(label);
33
+ }
34
+ /** Whether some label in the set satisfies the matcher. */
35
+ function matcherSatisfiedBy(m, labels) {
36
+ if (m.kind === "exact") return labels.has(m.value);
37
+ const re = compileRegexMatcher(m);
38
+ for (const label of labels) if (re.test(label)) return true;
39
+ return false;
40
+ }
41
+ /** Split a matcher list into exact label strings and the remaining regex matchers. */
42
+ function partitionMatchers(ms) {
43
+ const exact = [];
44
+ const regex = [];
45
+ for (const m of ms) if (m.kind === "exact") exact.push(m.value);
46
+ else regex.push(m);
47
+ return {
48
+ exact,
49
+ regex
50
+ };
51
+ }
52
+ //#endregion
53
+ export { LabelMatcher, compileRegexMatcher, matcherMatches, matcherSatisfiedBy, partitionMatchers };
54
+
55
+ //# sourceMappingURL=labels-match.js.map
@@ -17,6 +17,11 @@ export interface MatrixValues {
17
17
  /** Multi-dimensional: named properties */
18
18
  [dimension: string]: string | undefined;
19
19
  }
20
+ /**
21
+ * Compute the cartesian product of the given value sets in row-major order.
22
+ * An empty set list yields a single empty tuple; any empty set yields no tuples.
23
+ */
24
+ export declare function cartesianProduct<T>(sets: T[][]): T[][];
20
25
  /**
21
26
  * Expand single-dimension matrix (array form) to MatrixValues array.
22
27
  * Each value becomes {value: string}.
@@ -24,7 +29,7 @@ export interface MatrixValues {
24
29
  export declare function expandSingleDimension(matrix: StaticMatrixArray): MatrixValues[];
25
30
  /**
26
31
  * Expand multi-dimensional matrix (object form) to MatrixValues array.
27
- * Uses fast-cartesian to compute cartesian product of all dimensions.
32
+ * Computes the cartesian product of all dimensions.
28
33
  * Dimension names are sorted for deterministic output.
29
34
  */
30
35
  export declare function expandMultiDimension(matrix: StaticMatrixObject): MatrixValues[];
@@ -1,7 +1,13 @@
1
1
  import "../chunk-BTugEXQM.js";
2
- import fastCartesian from "fast-cartesian";
3
2
  //#region src/matrix/expand.ts
4
3
  /**
4
+ * Compute the cartesian product of the given value sets in row-major order.
5
+ * An empty set list yields a single empty tuple; any empty set yields no tuples.
6
+ */
7
+ function cartesianProduct(sets) {
8
+ return sets.reduce((acc, set) => acc.flatMap((tuple) => set.map((value) => [...tuple, value])), [[]]);
9
+ }
10
+ /**
5
11
  * Expand single-dimension matrix (array form) to MatrixValues array.
6
12
  * Each value becomes {value: string}.
7
13
  */
@@ -10,7 +16,7 @@ function expandSingleDimension(matrix) {
10
16
  }
11
17
  /**
12
18
  * Expand multi-dimensional matrix (object form) to MatrixValues array.
13
- * Uses fast-cartesian to compute cartesian product of all dimensions.
19
+ * Computes the cartesian product of all dimensions.
14
20
  * Dimension names are sorted for deterministic output.
15
21
  */
16
22
  function expandMultiDimension(matrix) {
@@ -18,7 +24,7 @@ function expandMultiDimension(matrix) {
18
24
  if (dimensions.length === 0) return [];
19
25
  dimensions.sort((a, b) => a[0].localeCompare(b[0]));
20
26
  const names = dimensions.map(([name]) => name);
21
- return fastCartesian(dimensions.map(([, values]) => values)).map((combo) => {
27
+ return cartesianProduct(dimensions.map(([, values]) => values)).map((combo) => {
22
28
  const result = {};
23
29
  names.forEach((name, idx) => {
24
30
  result[name] = combo[idx];
@@ -61,6 +67,6 @@ function applyIncludeExclude(expanded, include, exclude) {
61
67
  return result;
62
68
  }
63
69
  //#endregion
64
- export { applyIncludeExclude, expandMatrix, expandMultiDimension, expandSingleDimension };
70
+ export { applyIncludeExclude, cartesianProduct, expandMatrix, expandMultiDimension, expandSingleDimension };
65
71
 
66
72
  //# sourceMappingURL=expand.js.map
@@ -6,8 +6,9 @@ import "../chunk-BTugEXQM.js";
6
6
  * Multi-dimensional: "linux, 18"
7
7
  */
8
8
  function formatMatrixSuffix(matrixValues) {
9
- if ("value" in matrixValues && matrixValues.value !== void 0) return matrixValues.value;
10
- return Object.values(matrixValues).filter((v) => v !== void 0).join(", ");
9
+ const defined = Object.entries(matrixValues).filter(([, v]) => v !== void 0);
10
+ if (defined.length === 1 && defined[0][0] === "value") return defined[0][1];
11
+ return defined.map(([, v]) => v).join(", ");
11
12
  }
12
13
  /** Expanded child job name: `${baseName} (${suffix})`. MUST match the local executor. */
13
14
  function formatExpandedJobName(baseName, matrixValues) {