@kici-dev/engine 0.1.3 → 0.1.5

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.
@@ -130,6 +130,8 @@ const POLICY_BY_ACTION = {
130
130
  "backend.sync.one": { kind: "always" },
131
131
  "backend.test": { kind: "always" },
132
132
  "global_workflows.update": { kind: "always" },
133
+ "org_settings.dashboard_write_policy.update": { kind: "always" },
134
+ "cluster_name.update": { kind: "always" },
133
135
  "access_log.list.read": { kind: "always" },
134
136
  "event_dlq.list.read": {
135
137
  kind: "sample",
@@ -137,7 +139,8 @@ const POLICY_BY_ACTION = {
137
139
  },
138
140
  "event_dlq.retry": { kind: "always" },
139
141
  "event_dlq.discard": { kind: "always" },
140
- archive_chunk: { kind: "always" }
142
+ archive_chunk: { kind: "always" },
143
+ purge_chunk: { kind: "always" }
141
144
  };
142
145
  /**
143
146
  * Tiny FNV-1a 32-bit hash. Used for stable hash-based sampling so a single
@@ -55,6 +55,8 @@ const ACCESS_LOG_WARM_DAYS = {
55
55
  "backend.sync.one": 180,
56
56
  "backend.test": 180,
57
57
  "global_workflows.update": 180,
58
+ "org_settings.dashboard_write_policy.update": 180,
59
+ "cluster_name.update": 180,
58
60
  "event_dlq.list.read": 30,
59
61
  "event_dlq.retry": 180,
60
62
  "event_dlq.discard": 180,
@@ -64,7 +66,8 @@ const ACCESS_LOG_WARM_DAYS = {
64
66
  "secret_scope.create": 365,
65
67
  "secret_scope.rename": 365,
66
68
  "secret_scope.delete": 365,
67
- archive_chunk: 365
69
+ archive_chunk: 365,
70
+ purge_chunk: 365
68
71
  };
69
72
  /** Override outcomes that promote retention to 180 days regardless of action. */
70
73
  const FORENSIC_OUTCOME_DAYS = 180;
@@ -103,6 +106,7 @@ const COMPLIANCE_AUDIT_PREFIXES = [
103
106
  ];
104
107
  const COMPLIANCE_AUDIT_EXACT = new Set([
105
108
  "archive_chunk",
109
+ "purge_chunk",
106
110
  "replay_chunk",
107
111
  "scheduled_job_failure"
108
112
  ]);
@@ -283,6 +287,8 @@ const ACCESS_LOG_COLD_DAYS = {
283
287
  "backend.sync.one": 730,
284
288
  "backend.test": 730,
285
289
  "global_workflows.update": 730,
290
+ "org_settings.dashboard_write_policy.update": 730,
291
+ "cluster_name.update": 730,
286
292
  "event_dlq.list.read": 180,
287
293
  "event_dlq.retry": 730,
288
294
  "event_dlq.discard": 730,
@@ -292,7 +298,8 @@ const ACCESS_LOG_COLD_DAYS = {
292
298
  "secret_scope.create": "forever",
293
299
  "secret_scope.rename": "forever",
294
300
  "secret_scope.delete": "forever",
295
- archive_chunk: "forever"
301
+ archive_chunk: "forever",
302
+ purge_chunk: "forever"
296
303
  };
297
304
  /** Override outcome cold-retention (forensic — 2 years). */
298
305
  const FORENSIC_OUTCOME_COLD_DAYS = 730;
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { SourceProvider, SourceSubtype, sourceDeregisterAckSchema, sourceDeregis
9
9
  import { AccessLogAction, AccessLogOutcome, AccessLogSource, AccessLogTargetType, accessLogFilterSchema, accessLogItemSchema, dashboardAccessLogListRequestSchema, dashboardAccessLogListResponseSchema } from "./protocol/messages/access-log.js";
10
10
  import { browserJobContextSchema, browserRunEventSchema, dashboardOrchLogsRequestSchema, dashboardOrchLogsResponseSchema, jobContextMessageSchema, runEventMessageSchema } from "./protocol/messages/run-events.js";
11
11
  import { EventLogSource, EventLogStatus, PayloadOmittedReason } from "./protocol/messages/event-log.js";
12
- import { EventLogPayloadStreamError, HeldRunQueueType, HeldRunStatus, backendGetRequestSchema, backendGetResponseSchema, backendItemSchema, backendSyncRequestSchema, backendSyncResponseSchema, backendTestRequestSchema, backendTestResponseSchema, backendsListRequestSchema, backendsListResponseSchema, backendsSyncAllRequestSchema, backendsSyncAllResponseSchema, browserEventLogPayloadChunkSchema, dashboardDiagnosticsRequestSchema, dashboardDiagnosticsResponseSchema, dashboardEventLogDetailRequestSchema, dashboardEventLogListRequestSchema, dashboardEventLogPayloadChunkSchema, dashboardEventLogPayloadStreamRequestSchema, dashboardJobDetailSchema, dashboardOrchToPlatformSchema, dashboardPayloadRequestSchema, dashboardPlatformToOrchSchema, dashboardRunDetailApiResponseSchema, dashboardRunDetailRequestSchema, dashboardRunDetailResponseSchema, dashboardScalerAgentsRequestSchema, dashboardScalerAgentsResponseSchema, dashboardScalerCapacityRequestSchema, dashboardScalerCapacityResponseSchema, dashboardStepLogsApiResponseSchema, dashboardStepLogsRequestSchema, dashboardStepLogsResponseSchema, envBindingsListRequestSchema, envBindingsSetRequestSchema, envCreateRequestSchema, envDeleteRequestSchema, envGetRequestSchema, envHistoryRequestSchema, envListRequestSchema, envSecretDeleteRequestSchema, envSecretScopeCreateRequestSchema, envSecretScopeDeleteRequestSchema, envSecretScopeRenameRequestSchema, envSecretSetRequestSchema, envSecretsListRequestSchema, envSourceOverrideDeleteRequestSchema, envSourceOverrideSetRequestSchema, envSourceOverridesListRequestSchema, envUpdateRequestSchema, envVarDeleteRequestSchema, envVarSetRequestSchema, envVarsListRequestSchema, eventLogListItemSchema, heldRunApproveRequestSchema, heldRunRejectRequestSchema, heldRunsListRequestSchema, identityLinkItemSchema, identityLinkListResponseSchema, manualScheduleRequestSchema, memberIdentityLinkSchema, memberListResponseSchema, memberRoleAssignmentSchema, orgMemberSchema, registrationDeleteRequestSchema, registrationDisableRequestSchema, registrationItemSchema, registrationsListRequestSchema, registrationsListResponseSchema, runCancelRequestSchema, runEventSchema, runLineageResponseSchema, runRerunRequestSchema, trustPolicyResponseSchema } from "./protocol/messages/dashboard.js";
12
+ import { EventLogPayloadStreamError, HeldRunQueueType, HeldRunStatus, backendGetRequestSchema, backendGetResponseSchema, backendItemSchema, backendSyncRequestSchema, backendSyncResponseSchema, backendTestRequestSchema, backendTestResponseSchema, backendsListRequestSchema, backendsListResponseSchema, backendsSyncAllRequestSchema, backendsSyncAllResponseSchema, browserEventLogPayloadChunkSchema, dashboardDiagnosticsRequestSchema, dashboardDiagnosticsResponseSchema, dashboardEventDlqCountRequestSchema, dashboardEventDlqDiscardRequestSchema, dashboardEventDlqListItemSchema, dashboardEventDlqListRequestSchema, dashboardEventDlqRetryRequestSchema, dashboardEventLogDetailRequestSchema, dashboardEventLogListRequestSchema, dashboardEventLogPayloadChunkSchema, dashboardEventLogPayloadStreamRequestSchema, dashboardJobDetailSchema, dashboardOrchToPlatformSchema, dashboardPayloadRequestSchema, dashboardPlatformToOrchSchema, dashboardRunDetailApiResponseSchema, dashboardRunDetailRequestSchema, dashboardRunDetailResponseSchema, dashboardScalerAgentsRequestSchema, dashboardScalerAgentsResponseSchema, dashboardScalerCapacityRequestSchema, dashboardScalerCapacityResponseSchema, dashboardStepLogsApiResponseSchema, dashboardStepLogsRequestSchema, dashboardStepLogsResponseSchema, envBindingsListRequestSchema, envBindingsSetRequestSchema, envCreateRequestSchema, envDeleteRequestSchema, envGetRequestSchema, envHistoryRequestSchema, envListRequestSchema, envSecretDeleteRequestSchema, envSecretScopeCreateRequestSchema, envSecretScopeDeleteRequestSchema, envSecretScopeRenameRequestSchema, envSecretSetRequestSchema, envSecretsListRequestSchema, envSourceOverrideDeleteRequestSchema, envSourceOverrideSetRequestSchema, envSourceOverridesListRequestSchema, envUpdateRequestSchema, envVarDeleteRequestSchema, envVarSetRequestSchema, envVarsListRequestSchema, eventLogListItemSchema, heldRunApproveRequestSchema, heldRunRejectRequestSchema, heldRunsListRequestSchema, identityLinkItemSchema, identityLinkListResponseSchema, manualScheduleRequestSchema, memberIdentityLinkSchema, memberListResponseSchema, memberRoleAssignmentSchema, orgMemberSchema, registrationDeleteRequestSchema, registrationDisableRequestSchema, registrationItemSchema, registrationsListRequestSchema, registrationsListResponseSchema, runCancelRequestSchema, runEventSchema, runLineageResponseSchema, runRerunRequestSchema, trustPolicyResponseSchema } from "./protocol/messages/dashboard.js";
13
13
  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";
14
14
  import { AccessLogPolicyKind, POLICY_BY_ACTION, fnv1a32, shouldRecordAccess, shouldRecordSecretResolve } from "./audit/access-log-policy.js";
15
15
  import { ACCESS_LOG_COLD_DAYS, ACCESS_LOG_WARM_DAYS, accessLogWarmSqlCase, auditLogColdDays, auditLogWarmDays, auditLogWarmSqlCase, getAccessLogColdDays, getAccessLogWarmDays, getAuditLogColdDays, getAuditLogWarmDays, getSecretAuditLogColdDays, getSecretAuditLogWarmDays, minAccessLogWarmDays, minAuditLogWarmDays, minSecretAuditLogWarmDays, secretAuditLogColdDays, secretAuditLogWarmDays, secretAuditLogWarmSqlCase } from "./audit/retention-policy.js";
@@ -30,7 +30,7 @@ import { isTerminal, transition } from "./state-machine/machine.js";
30
30
  import "./state-machine/index.js";
31
31
  import { CheckRunConclusion } from "./provider/check-run-conclusion.js";
32
32
  import "./provider/index.js";
33
- import { WS_CLOSE_AGENT_AUTH_FAILED, WS_CLOSE_AUTH_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 } from "./ws/close-codes.js";
33
+ import { WS_CLOSE_AGENT_AUTH_FAILED, WS_CLOSE_AUTH_TIMEOUT, WS_CLOSE_CLUSTER_NAME_CONFLICT, 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 } from "./ws/close-codes.js";
34
34
  import { WsRateLimiter } from "./ws/rate-limiter.js";
35
35
  import { AGENT_REQUIRED_KICI_VARS, ALLOWED_SYSTEM_VARS, KICI_AGENT_ENV_PREFIX, SANDBOX_DEFAULT_VARS } from "./env/environment-allowlist.js";
36
36
  import "./secrets/index.js";
@@ -42,4 +42,4 @@ import { parseMemoryString, resourceRequestNestedSchema, resourceSpecSchema, val
42
42
  import { RegisterableTriggerType } from "./registration/registerable-trigger-type.js";
43
43
  import { createWorkflowBundleConfig } from "./bundler/rolldown-config.js";
44
44
  import "./bundler/index.js";
45
- export { ACCESS_LOG_COLD_DAYS, ACCESS_LOG_WARM_DAYS, AGENT_REQUIRED_KICI_VARS, ALLOWED_SYSTEM_VARS, AccessLogAction, AccessLogOutcome, AccessLogPolicyKind, AccessLogSource, AccessLogTargetType, ActivityFilterSource, ActivityRowSource, ActorType, CheckRunConclusion, EVENT_LOG_PAYLOAD_CHUNK_BYTES, EventLogPayloadStreamError, EventLogSource, EventLogStatus, ExecutionJobStatus, ExecutionRunStatus, ExecutionStepStatus, HeldRunQueueType, HeldRunStatus, KICI_AGENT_ENV_PREFIX, KNOWN_ROLES, MIN_PROTOCOL_VERSION, NeedsEntrySchema, NeedsGroupEntrySchema, ORCH_CAPABILITIES, OrchRole, POLICY_BY_ACTION, PROTOCOL_VERSION, PayloadOmittedReason, RegisterableTriggerType, SANDBOX_DEFAULT_VARS, SCHEMA_VERSION, ScalerBackendType, SourceProvider, SourceSubtype, TERMINAL_JOB_STATES, TERMINAL_RUN_STATES, TRIGGER_EVENT_META, TRIGGER_EVENT_TYPES, WEBHOOK_RELAY_CHUNK_SIZE, WEBHOOK_RELAY_MAX_BODY_BYTES, WS_CLOSE_AGENT_AUTH_FAILED, WS_CLOSE_AUTH_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, 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, configAckSchema, createTraceEntry, createWorkflowBundleConfig, createWorkflowDecision, dashboardAccessLogListRequestSchema, dashboardAccessLogListResponseSchema, dashboardDiagnosticsRequestSchema, dashboardDiagnosticsResponseSchema, dashboardEventLogDetailRequestSchema, dashboardEventLogListRequestSchema, dashboardEventLogPayloadChunkSchema, dashboardEventLogPayloadStreamRequestSchema, dashboardJobDetailSchema, dashboardOrchLogsRequestSchema, dashboardOrchLogsResponseSchema, dashboardOrchToPlatformSchema, dashboardPayloadRequestSchema, dashboardPlatformToOrchSchema, dashboardRunDetailApiResponseSchema, dashboardRunDetailRequestSchema, dashboardRunDetailResponseSchema, dashboardScalerAgentsRequestSchema, dashboardScalerAgentsResponseSchema, dashboardScalerCapacityRequestSchema, dashboardScalerCapacityResponseSchema, dashboardStepLogsApiResponseSchema, dashboardStepLogsRequestSchema, dashboardStepLogsResponseSchema, decodeActivityCursor, deriveOsArchLabels, encodeActivityCursor, envBindingsListRequestSchema, envBindingsSetRequestSchema, envCreateRequestSchema, envDeleteRequestSchema, envGetRequestSchema, envHistoryRequestSchema, envListRequestSchema, envSecretDeleteRequestSchema, envSecretScopeCreateRequestSchema, envSecretScopeDeleteRequestSchema, envSecretScopeRenameRequestSchema, envSecretSetRequestSchema, envSecretsListRequestSchema, envSourceOverrideDeleteRequestSchema, envSourceOverrideSetRequestSchema, envSourceOverridesListRequestSchema, envUpdateRequestSchema, envVarDeleteRequestSchema, envVarSetRequestSchema, envVarsListRequestSchema, errorSchema, eventEmitResponseSchema, eventEmitSchema, eventLogListItemSchema, executionEventSchema, executionStatusSchema, flattenActor, fnv1a32, getAccessLogColdDays, getAccessLogWarmDays, getAuditLogColdDays, getAuditLogWarmDays, getSecretAuditLogColdDays, getSecretAuditLogWarmDays, gitAuthSchema, hasOrchCapability, heartbeatSchema, heldRunApproveRequestSchema, heldRunRejectRequestSchema, heldRunsListRequestSchema, hostLabel, identityLinkItemSchema, identityLinkListResponseSchema, isLockDynamicJobFn, isLockInlineValue, isLockStaticJob, isTerminal, jobCancelSchema, jobConcurrencyAckSchema, jobConcurrencyReportSchema, jobContextMessageSchema, jobDispatchSchema, jobProgressSchema, jobRerouteAckSchema, jobRerouteSchema, jobStatusForwardSchema, jobStatusSchema, joinRequestSchema, joinResponseSchema, logChunkSchema, logPullOrchToPlatformSchema, logPullPlatformToOrchSchema, manualScheduleRequestSchema, matchAllWorkflows, matchBranchPattern, matchPathPatterns, matchRepoPatterns, matchScopePattern, matchWorkflowTriggers, memberIdentityLinkSchema, memberListResponseSchema, memberRoleAssignmentSchema, mergeAutoLabels, minAccessLogWarmDays, minAuditLogWarmDays, minSecretAuditLogWarmDays, nackSchema, normalizeRunsOn, observeCompleteSchema, observeLogSchema, observeStatusSchema, observeStepSchema, observeSubscribeSchema, orchCapabilitiesSchema, orchMetricsSchema, orchestratorToAgentMessageSchema, orchestratorToPlatformMessageSchema, orgMemberSchema, parseActor, parseMemoryString, peerAgentTokenRevokeSchema, peerAuthRequestSchema, peerAuthResponseSchema, peerCapabilitiesSchema, peerConfigReloadResponseSchema, peerConfigReloadSchema, peerDiscoverSchema, peerFromPeerMessageSchema, peerHeartbeatSchema, peerHelloResponseSchema, peerHelloSchema, peerJobCancelSchema, peerLeavingSchema, peerToPeerMessageSchema, peerUpdateSchema, platformOperatorActorSchema, platformToBrowserMessageSchema, platformToOrchestratorMessageSchema, raftAppendEntriesSchema, raftVoteRequestSchema, raftVoteResponseSchema, registerAckSchema, registrationDeleteRequestSchema, registrationDisableRequestSchema, registrationItemSchema, registrationsListRequestSchema, registrationsListResponseSchema, resolveRoleLabels, resolveRunIdSugar, resolveSecretsForEnvironment, resourceRequestNestedSchema, resourceSpecSchema, runCancelRequestSchema, runEventMessageSchema, runEventSchema, runLineageResponseSchema, runRerunRequestSchema, scalerLabel, secretAuditLogColdDays, secretAuditLogWarmDays, secretAuditLogWarmSqlCase, serviceAccountActorSchema, shouldRecordAccess, shouldRecordSecretResolve, sourceDeregisterAckSchema, sourceDeregisterSchema, sourceRegistrationAckSchema, sourceRegistrationSchema, staleCheckrunCleanupSchema, stateReplaySchema, stepStatusForwardSchema, stringifyActor, stripScopePrefix, systemActorSchema, testCancelResponseSchema, testCancelSchema, testEventSchema, testTriggerResponseSchema, testTriggerSchema, transition, trustPolicyResponseSchema, trustPolicyUpdateSchema, userActorSchema, validateNoReservedLabels, validateResourceRequest, webhookAckSchema, webhookRelayChunkSchema, webhookRelaySchema, webhookRelayStartSchema };
45
+ export { ACCESS_LOG_COLD_DAYS, ACCESS_LOG_WARM_DAYS, AGENT_REQUIRED_KICI_VARS, ALLOWED_SYSTEM_VARS, AccessLogAction, AccessLogOutcome, AccessLogPolicyKind, AccessLogSource, AccessLogTargetType, ActivityFilterSource, ActivityRowSource, ActorType, CheckRunConclusion, EVENT_LOG_PAYLOAD_CHUNK_BYTES, EventLogPayloadStreamError, EventLogSource, EventLogStatus, ExecutionJobStatus, ExecutionRunStatus, ExecutionStepStatus, HeldRunQueueType, HeldRunStatus, KICI_AGENT_ENV_PREFIX, KNOWN_ROLES, MIN_PROTOCOL_VERSION, NeedsEntrySchema, NeedsGroupEntrySchema, ORCH_CAPABILITIES, OrchRole, POLICY_BY_ACTION, PROTOCOL_VERSION, PayloadOmittedReason, RegisterableTriggerType, SANDBOX_DEFAULT_VARS, SCHEMA_VERSION, ScalerBackendType, SourceProvider, SourceSubtype, TERMINAL_JOB_STATES, TERMINAL_RUN_STATES, TRIGGER_EVENT_META, TRIGGER_EVENT_TYPES, 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_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, 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, configAckSchema, createTraceEntry, createWorkflowBundleConfig, createWorkflowDecision, dashboardAccessLogListRequestSchema, dashboardAccessLogListResponseSchema, dashboardDiagnosticsRequestSchema, dashboardDiagnosticsResponseSchema, dashboardEventDlqCountRequestSchema, dashboardEventDlqDiscardRequestSchema, dashboardEventDlqListItemSchema, dashboardEventDlqListRequestSchema, dashboardEventDlqRetryRequestSchema, dashboardEventLogDetailRequestSchema, dashboardEventLogListRequestSchema, dashboardEventLogPayloadChunkSchema, dashboardEventLogPayloadStreamRequestSchema, dashboardJobDetailSchema, dashboardOrchLogsRequestSchema, dashboardOrchLogsResponseSchema, dashboardOrchToPlatformSchema, dashboardPayloadRequestSchema, dashboardPlatformToOrchSchema, dashboardRunDetailApiResponseSchema, dashboardRunDetailRequestSchema, dashboardRunDetailResponseSchema, dashboardScalerAgentsRequestSchema, dashboardScalerAgentsResponseSchema, dashboardScalerCapacityRequestSchema, dashboardScalerCapacityResponseSchema, dashboardStepLogsApiResponseSchema, dashboardStepLogsRequestSchema, dashboardStepLogsResponseSchema, decodeActivityCursor, deriveOsArchLabels, encodeActivityCursor, envBindingsListRequestSchema, envBindingsSetRequestSchema, envCreateRequestSchema, envDeleteRequestSchema, envGetRequestSchema, envHistoryRequestSchema, envListRequestSchema, envSecretDeleteRequestSchema, envSecretScopeCreateRequestSchema, envSecretScopeDeleteRequestSchema, envSecretScopeRenameRequestSchema, envSecretSetRequestSchema, envSecretsListRequestSchema, envSourceOverrideDeleteRequestSchema, envSourceOverrideSetRequestSchema, envSourceOverridesListRequestSchema, envUpdateRequestSchema, envVarDeleteRequestSchema, envVarSetRequestSchema, envVarsListRequestSchema, errorSchema, eventEmitResponseSchema, eventEmitSchema, eventLogListItemSchema, executionEventSchema, executionStatusSchema, flattenActor, fnv1a32, getAccessLogColdDays, getAccessLogWarmDays, getAuditLogColdDays, getAuditLogWarmDays, getSecretAuditLogColdDays, getSecretAuditLogWarmDays, gitAuthSchema, hasOrchCapability, heartbeatSchema, heldRunApproveRequestSchema, heldRunRejectRequestSchema, heldRunsListRequestSchema, hostLabel, identityLinkItemSchema, identityLinkListResponseSchema, isLockDynamicJobFn, isLockInlineValue, isLockStaticJob, isTerminal, jobCancelSchema, jobConcurrencyAckSchema, jobConcurrencyReportSchema, jobContextMessageSchema, jobDispatchSchema, jobProgressSchema, jobRerouteAckSchema, jobRerouteSchema, jobStatusForwardSchema, jobStatusSchema, joinRequestSchema, joinResponseSchema, logChunkSchema, logPullOrchToPlatformSchema, logPullPlatformToOrchSchema, manualScheduleRequestSchema, matchAllWorkflows, matchBranchPattern, matchPathPatterns, matchRepoPatterns, matchScopePattern, matchWorkflowTriggers, memberIdentityLinkSchema, memberListResponseSchema, memberRoleAssignmentSchema, mergeAutoLabels, minAccessLogWarmDays, minAuditLogWarmDays, minSecretAuditLogWarmDays, nackSchema, normalizeRunsOn, observeCompleteSchema, observeLogSchema, observeStatusSchema, observeStepSchema, observeSubscribeSchema, orchCapabilitiesSchema, orchMetricsSchema, orchestratorToAgentMessageSchema, orchestratorToPlatformMessageSchema, orgMemberSchema, parseActor, parseMemoryString, peerAgentTokenRevokeSchema, peerAuthRequestSchema, peerAuthResponseSchema, peerCapabilitiesSchema, peerConfigReloadResponseSchema, peerConfigReloadSchema, peerDiscoverSchema, peerFromPeerMessageSchema, peerHeartbeatSchema, peerHelloResponseSchema, peerHelloSchema, peerJobCancelSchema, peerLeavingSchema, peerToPeerMessageSchema, peerUpdateSchema, platformOperatorActorSchema, platformToBrowserMessageSchema, platformToOrchestratorMessageSchema, raftAppendEntriesSchema, raftVoteRequestSchema, raftVoteResponseSchema, registerAckSchema, registrationDeleteRequestSchema, registrationDisableRequestSchema, registrationItemSchema, registrationsListRequestSchema, registrationsListResponseSchema, resolveRoleLabels, resolveRunIdSugar, resolveSecretsForEnvironment, resourceRequestNestedSchema, resourceSpecSchema, runCancelRequestSchema, runEventMessageSchema, runEventSchema, runLineageResponseSchema, runRerunRequestSchema, scalerLabel, secretAuditLogColdDays, secretAuditLogWarmDays, secretAuditLogWarmSqlCase, serviceAccountActorSchema, shouldRecordAccess, shouldRecordSecretResolve, sourceDeregisterAckSchema, sourceDeregisterSchema, sourceRegistrationAckSchema, sourceRegistrationSchema, staleCheckrunCleanupSchema, stateReplaySchema, stepStatusForwardSchema, stringifyActor, stripScopePrefix, systemActorSchema, testCancelResponseSchema, testCancelSchema, testEventSchema, testTriggerResponseSchema, testTriggerSchema, transition, trustPolicyResponseSchema, trustPolicyUpdateSchema, userActorSchema, validateNoReservedLabels, validateResourceRequest, webhookAckSchema, webhookRelayChunkSchema, webhookRelaySchema, webhookRelayStartSchema };
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Hand-maintained label-value policy on top of the auto-generated
3
+ * `MetricLabels` / `MetricKind` allow-list in
4
+ * `./metric-catalog.generated.ts`. Consumed by the Platform's
5
+ * orchestrator-metrics filter (`packages/platform/src/ws/metrics-filter.ts`)
6
+ * to harden the WS `orch.metrics` push path against pollution of the
7
+ * monitoring system.
8
+ *
9
+ * Three layers compose:
10
+ *
11
+ * 1. `MetricNames` (auto) — every catalog metric name.
12
+ * 2. `MetricLabels` (auto) — allow-list of label KEYS per metric.
13
+ * 3. `METRIC_LABEL_POLICY` (here) — value constraints per (metric, key):
14
+ * either a closed enum (`values`) or a cardinality cap
15
+ * (`maxUniqueValues`). Labels without a policy entry pass through
16
+ * unconstrained — they were already on the auto allow-list, so
17
+ * the producer guarantees the value shape.
18
+ *
19
+ * Browser-safe: pure constants, no Node imports.
20
+ */
21
+ import { type MetricName } from './metric-catalog.generated.js';
22
+ /**
23
+ * Per-label policy: enum-constrained values OR a cardinality cap.
24
+ */
25
+ export interface LabelPolicy {
26
+ /** Closed enum of acceptable label values. */
27
+ values?: readonly string[];
28
+ /**
29
+ * Cap on distinct values per (orgId, routingKey, metric, labelKey)
30
+ * tracked by the Platform-side cardinality tracker. Values beyond the
31
+ * cap collapse to the literal `__overflow__` — total counts are
32
+ * preserved, dimensionality is bounded.
33
+ */
34
+ maxUniqueValues?: number;
35
+ }
36
+ /** Literal value substituted for cap-exceeded label values. */
37
+ export declare const OVERFLOW_LABEL_VALUE = "__overflow__";
38
+ /**
39
+ * Set of catalog metric names the orchestrator is allowed to push over
40
+ * `orch.metrics`. Derived from `MetricService` so the membership stays
41
+ * in lock-step with codegen: orchestrator owns its own `kici_orch_*`,
42
+ * `kici_cross_source_*`, and `kici_universal_git_*` metrics, plus
43
+ * `kici_agent_*` metrics forwarded by `AgentMetricsAggregator`. Every
44
+ * `kici_platform_*` / `kici_org_*` / `kici_plan_*` / `kici_valkey_*` /
45
+ * `kici_webhook*` / `kici_ws_*` / `kici_build_*` / `kici_cache_*` /
46
+ * `kici_orgs_*` series is Platform-emitted locally and would be a
47
+ * tenancy violation if accepted from the wire.
48
+ *
49
+ * The synthetic `runtime` service covers the Node.js runtime metrics
50
+ * (`nodejs.*` / `v8js.*`) the orchestrator emits via
51
+ * `RuntimeNodeInstrumentation`. They describe the orchestrator process,
52
+ * so they are valid push payloads alongside `kici_orch_*`.
53
+ */
54
+ export declare const ORCH_PUSHED_METRIC_NAMES: ReadonlySet<MetricName>;
55
+ /**
56
+ * Per-metric, per-label value policy. Missing entries (or missing label
57
+ * keys within an entry) mean "no value-level constraint" — the label key
58
+ * still has to appear in the auto-generated `MetricLabels[name]` allow
59
+ * list to make it past the filter.
60
+ *
61
+ * User-controlled labels (the three flagged below) get a numeric cap
62
+ * instead of an enum. Anything past the cap collapses to
63
+ * `OVERFLOW_LABEL_VALUE` so dashboards keep their counts but cannot be
64
+ * inflated past N+1 distinct series.
65
+ */
66
+ export declare const METRIC_LABEL_POLICY: Partial<Record<MetricName, Partial<Record<string, LabelPolicy>>>>;
67
+ //# sourceMappingURL=catalog-policy.d.ts.map
@@ -0,0 +1,246 @@
1
+ import "../chunk-gOLHoazu.js";
2
+ import { MetricNames, MetricService } from "./metric-catalog.generated.js";
3
+ //#region src/metrics/catalog-policy.ts
4
+ /**
5
+ * Hand-maintained label-value policy on top of the auto-generated
6
+ * `MetricLabels` / `MetricKind` allow-list in
7
+ * `./metric-catalog.generated.ts`. Consumed by the Platform's
8
+ * orchestrator-metrics filter (`packages/platform/src/ws/metrics-filter.ts`)
9
+ * to harden the WS `orch.metrics` push path against pollution of the
10
+ * monitoring system.
11
+ *
12
+ * Three layers compose:
13
+ *
14
+ * 1. `MetricNames` (auto) — every catalog metric name.
15
+ * 2. `MetricLabels` (auto) — allow-list of label KEYS per metric.
16
+ * 3. `METRIC_LABEL_POLICY` (here) — value constraints per (metric, key):
17
+ * either a closed enum (`values`) or a cardinality cap
18
+ * (`maxUniqueValues`). Labels without a policy entry pass through
19
+ * unconstrained — they were already on the auto allow-list, so
20
+ * the producer guarantees the value shape.
21
+ *
22
+ * Browser-safe: pure constants, no Node imports.
23
+ */
24
+ /** Literal value substituted for cap-exceeded label values. */
25
+ const OVERFLOW_LABEL_VALUE = "__overflow__";
26
+ /**
27
+ * Set of catalog metric names the orchestrator is allowed to push over
28
+ * `orch.metrics`. Derived from `MetricService` so the membership stays
29
+ * in lock-step with codegen: orchestrator owns its own `kici_orch_*`,
30
+ * `kici_cross_source_*`, and `kici_universal_git_*` metrics, plus
31
+ * `kici_agent_*` metrics forwarded by `AgentMetricsAggregator`. Every
32
+ * `kici_platform_*` / `kici_org_*` / `kici_plan_*` / `kici_valkey_*` /
33
+ * `kici_webhook*` / `kici_ws_*` / `kici_build_*` / `kici_cache_*` /
34
+ * `kici_orgs_*` series is Platform-emitted locally and would be a
35
+ * tenancy violation if accepted from the wire.
36
+ *
37
+ * The synthetic `runtime` service covers the Node.js runtime metrics
38
+ * (`nodejs.*` / `v8js.*`) the orchestrator emits via
39
+ * `RuntimeNodeInstrumentation`. They describe the orchestrator process,
40
+ * so they are valid push payloads alongside `kici_orch_*`.
41
+ */
42
+ const ORCH_PUSHED_METRIC_NAMES = new Set(Object.entries(MetricService).filter(([, svc]) => svc === "orchestrator" || svc === "agent" || svc === "runtime").map(([key]) => MetricNames[key]));
43
+ /** Closed enum of the four scaler-backend label values an agent can carry. */
44
+ const AGENT_SCALER_VALUES = [
45
+ "stateful",
46
+ "container",
47
+ "firecracker",
48
+ "bare-metal"
49
+ ];
50
+ /**
51
+ * Closed enum of scaler values the orchestrator's own resource-usage
52
+ * gauges emit. `__global__` is the orchestrator-wide rollup row; the
53
+ * other four match `AGENT_SCALER_VALUES`.
54
+ */
55
+ const ORCH_SCALER_VALUES = ["__global__", ...AGENT_SCALER_VALUES];
56
+ /** Closed enum of the five scheduled jobs the orchestrator runs (mirrors `OrchestratorScheduledJobName`). */
57
+ const ORCH_JOB_VALUES = [
58
+ "cleanup",
59
+ "orphan-secret-cleanup",
60
+ "token-cleanup",
61
+ "cold-store-archive",
62
+ "cold-store-purge"
63
+ ];
64
+ /**
65
+ * Per-metric, per-label value policy. Missing entries (or missing label
66
+ * keys within an entry) mean "no value-level constraint" — the label key
67
+ * still has to appear in the auto-generated `MetricLabels[name]` allow
68
+ * list to make it past the filter.
69
+ *
70
+ * User-controlled labels (the three flagged below) get a numeric cap
71
+ * instead of an enum. Anything past the cap collapses to
72
+ * `OVERFLOW_LABEL_VALUE` so dashboards keep their counts but cannot be
73
+ * inflated past N+1 distinct series.
74
+ */
75
+ const METRIC_LABEL_POLICY = {
76
+ kici_orch_dispatch_queue_depth: { status: { values: ["pending", "dispatched"] } },
77
+ kici_orch_dispatch_queue_depth_by_label: {
78
+ status: { values: ["pending"] },
79
+ label: { maxUniqueValues: 200 }
80
+ },
81
+ kici_orch_webhooks_received_total: {
82
+ source: { values: [
83
+ "relay",
84
+ "pipeline",
85
+ "generic",
86
+ "direct"
87
+ ] },
88
+ event: { maxUniqueValues: 50 }
89
+ },
90
+ kici_orch_webhooks_processed_total: { result: { values: [
91
+ "matched",
92
+ "skipped",
93
+ "error",
94
+ "handled",
95
+ "dispatched"
96
+ ] } },
97
+ kici_orch_executions_total: { status: { values: [
98
+ "running",
99
+ "success",
100
+ "failed",
101
+ "cancelled"
102
+ ] } },
103
+ kici_orch_steps_total: { status: { values: [
104
+ "running",
105
+ "success",
106
+ "failed",
107
+ "skipped"
108
+ ] } },
109
+ kici_orch_github_check_run_total: { operation: { values: [
110
+ "create",
111
+ "update",
112
+ "stale_cleanup"
113
+ ] } },
114
+ kici_orch_scaler_config_reloads_total: { result: { values: [
115
+ "attempted",
116
+ "success",
117
+ "failed"
118
+ ] } },
119
+ kici_orch_config_reload_total: {
120
+ result: { values: [
121
+ "attempted",
122
+ "success",
123
+ "failed"
124
+ ] },
125
+ source: { values: [
126
+ "sighup",
127
+ "http",
128
+ "cluster",
129
+ "cli"
130
+ ] }
131
+ },
132
+ kici_orch_scaler_cpus_used: {
133
+ scaler: { values: ORCH_SCALER_VALUES },
134
+ machinePool: { maxUniqueValues: 50 }
135
+ },
136
+ kici_orch_scaler_memory_bytes_used: {
137
+ scaler: { values: ORCH_SCALER_VALUES },
138
+ machinePool: { maxUniqueValues: 50 }
139
+ },
140
+ kici_orch_install_secrets_decisions_total: {
141
+ decision: { values: ["pass", "reject"] },
142
+ reason: { values: [
143
+ "ok",
144
+ "malformed_ref",
145
+ "invalid_url_scheme",
146
+ "missing_env_store",
147
+ "missing_secret_resolver",
148
+ "env_not_found",
149
+ "protection_rule_block",
150
+ "missing_token",
151
+ "missing_install_env"
152
+ ] }
153
+ },
154
+ kici_orch_install_secrets_npm_registry_used_total: {
155
+ channel: { values: ["registries", "install_env"] },
156
+ provider: { values: ["static"] },
157
+ scope: { maxUniqueValues: 100 }
158
+ },
159
+ kici_orch_install_secrets_contributor_stripped_total: { trust_tier: { values: ["unknown", "known"] } },
160
+ kici_orch_install_secrets_token_resolution_duration_seconds: { environment: { maxUniqueValues: 50 } },
161
+ kici_cross_source_errors_total: { reason: { values: ["clone_token", "bundle_missing"] } },
162
+ kici_universal_git_registration_errors_total: { reason: { values: [
163
+ "invalid_config",
164
+ "bundle_build",
165
+ "registration"
166
+ ] } },
167
+ kici_orch_trust_match_refused_no_id_total: { reason: { values: [
168
+ "event_missing",
169
+ "link_missing",
170
+ "id_mismatch"
171
+ ] } },
172
+ kici_orch_job_runs_total: {
173
+ job: { values: ORCH_JOB_VALUES },
174
+ result: { values: ["success", "failure"] }
175
+ },
176
+ kici_orch_job_duration_seconds: { job: { values: ORCH_JOB_VALUES } },
177
+ kici_orch_job_last_success_timestamp_seconds: { job: { values: ORCH_JOB_VALUES } },
178
+ kici_orch_job_last_failure_timestamp_seconds: { job: { values: ORCH_JOB_VALUES } },
179
+ kici_orch_job_consecutive_failures: { job: { values: ORCH_JOB_VALUES } },
180
+ kici_agent_jobs_total: {
181
+ status: { values: [
182
+ "success",
183
+ "failed",
184
+ "cancelled"
185
+ ] },
186
+ scaler: { values: AGENT_SCALER_VALUES }
187
+ },
188
+ kici_agent_jobs_active: { scaler: { values: AGENT_SCALER_VALUES } },
189
+ kici_agent_steps_total: {
190
+ status: { values: [
191
+ "success",
192
+ "failed",
193
+ "skipped"
194
+ ] },
195
+ scaler: { values: AGENT_SCALER_VALUES }
196
+ },
197
+ kici_agent_step_duration_seconds: { scaler: { values: AGENT_SCALER_VALUES } },
198
+ kici_agent_clone_duration_seconds: { scaler: { values: AGENT_SCALER_VALUES } },
199
+ kici_agent_log_bytes_total: { scaler: { values: AGENT_SCALER_VALUES } },
200
+ kici_agent_log_backpressure_events_total: {
201
+ mode: { values: ["pause", "drop"] },
202
+ scaler: { values: AGENT_SCALER_VALUES }
203
+ },
204
+ kici_agent_log_lines_dropped_total: { scaler: { values: AGENT_SCALER_VALUES } },
205
+ kici_agent_log_backpressure_active: {
206
+ mode: { values: ["pause", "drop"] },
207
+ scaler: { values: AGENT_SCALER_VALUES }
208
+ },
209
+ kici_agent_connection_status: { scaler: { values: AGENT_SCALER_VALUES } },
210
+ "nodejs.eventloop.delay.max": { scaler: { values: AGENT_SCALER_VALUES } },
211
+ "nodejs.eventloop.delay.mean": { scaler: { values: AGENT_SCALER_VALUES } },
212
+ "nodejs.eventloop.delay.min": { scaler: { values: AGENT_SCALER_VALUES } },
213
+ "nodejs.eventloop.delay.p50": { scaler: { values: AGENT_SCALER_VALUES } },
214
+ "nodejs.eventloop.delay.p90": { scaler: { values: AGENT_SCALER_VALUES } },
215
+ "nodejs.eventloop.delay.p99": { scaler: { values: AGENT_SCALER_VALUES } },
216
+ "nodejs.eventloop.delay.stddev": { scaler: { values: AGENT_SCALER_VALUES } },
217
+ "nodejs.eventloop.utilization": { scaler: { values: AGENT_SCALER_VALUES } },
218
+ "nodejs.eventloop.time": {
219
+ "nodejs.eventloop.state": { maxUniqueValues: 4 },
220
+ scaler: { values: AGENT_SCALER_VALUES }
221
+ },
222
+ "v8js.gc.duration": {
223
+ "v8js.gc.type": { maxUniqueValues: 6 },
224
+ scaler: { values: AGENT_SCALER_VALUES }
225
+ },
226
+ "v8js.memory.heap.limit": {
227
+ "v8js.heap.space.name": { maxUniqueValues: 20 },
228
+ scaler: { values: AGENT_SCALER_VALUES }
229
+ },
230
+ "v8js.memory.heap.used": {
231
+ "v8js.heap.space.name": { maxUniqueValues: 20 },
232
+ scaler: { values: AGENT_SCALER_VALUES }
233
+ },
234
+ "v8js.memory.heap.space.available_size": {
235
+ "v8js.heap.space.name": { maxUniqueValues: 20 },
236
+ scaler: { values: AGENT_SCALER_VALUES }
237
+ },
238
+ "v8js.memory.heap.space.physical_size": {
239
+ "v8js.heap.space.name": { maxUniqueValues: 20 },
240
+ scaler: { values: AGENT_SCALER_VALUES }
241
+ }
242
+ };
243
+ //#endregion
244
+ export { METRIC_LABEL_POLICY, ORCH_PUSHED_METRIC_NAMES, OVERFLOW_LABEL_VALUE };
245
+
246
+ //# sourceMappingURL=catalog-policy.js.map