@kici-dev/engine 0.1.14 → 0.1.16

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 (48) hide show
  1. package/README.md +13 -1
  2. package/dist/approval/types.d.ts +56 -0
  3. package/dist/approval/types.js +42 -0
  4. package/dist/audit/access-log-policy.js +14 -0
  5. package/dist/audit/retention-policy.js +10 -0
  6. package/dist/environment/types.d.ts +8 -0
  7. package/dist/index.d.ts +2 -1
  8. package/dist/index.js +10 -8
  9. package/dist/labels.d.ts +7 -0
  10. package/dist/labels.js +11 -2
  11. package/dist/metrics/metric-catalog.generated.d.ts +50 -0
  12. package/dist/metrics/metric-catalog.generated.js +60 -0
  13. package/dist/protocol/analytics-events.d.ts +16 -0
  14. package/dist/protocol/analytics-events.js +20 -0
  15. package/dist/protocol/dashboard-write-operations.d.ts +4 -1
  16. package/dist/protocol/dashboard-write-operations.js +11 -1
  17. package/dist/protocol/messages/access-log.d.ts +26 -0
  18. package/dist/protocol/messages/access-log.js +5 -0
  19. package/dist/protocol/messages/actor.d.ts +2 -0
  20. package/dist/protocol/messages/actor.js +12 -2
  21. package/dist/protocol/messages/auth.d.ts +1 -0
  22. package/dist/protocol/messages/capabilities.d.ts +1 -0
  23. package/dist/protocol/messages/dashboard-global-workflows.d.ts +2 -0
  24. package/dist/protocol/messages/dashboard.d.ts +619 -6
  25. package/dist/protocol/messages/dashboard.js +179 -10
  26. package/dist/protocol/messages/event-log.d.ts +4 -0
  27. package/dist/protocol/messages/event-log.js +4 -0
  28. package/dist/protocol/messages/execution-status.d.ts +56 -3
  29. package/dist/protocol/messages/execution-status.js +44 -4
  30. package/dist/protocol/messages/orchestrator-agent.d.ts +284 -0
  31. package/dist/protocol/messages/orchestrator-agent.js +202 -4
  32. package/dist/protocol/messages/peer.d.ts +89 -0
  33. package/dist/protocol/messages/peer.js +50 -2
  34. package/dist/protocol/messages/platform-orchestrator.d.ts +168 -6
  35. package/dist/protocol/messages/platform-orchestrator.js +15 -56
  36. package/dist/protocol/messages/run-events.d.ts +1 -0
  37. package/dist/provenance/schema.d.ts +407 -0
  38. package/dist/provenance/schema.js +143 -0
  39. package/dist/provider/index.d.ts +1 -0
  40. package/dist/provider/index.js +2 -1
  41. package/dist/provider/lock-file-parse-error.d.ts +14 -0
  42. package/dist/provider/lock-file-parse-error.js +22 -0
  43. package/dist/trigger/types.d.ts +29 -1
  44. package/dist/trigger/types.js +4 -1
  45. package/dist/ws/close-codes.d.ts +7 -0
  46. package/dist/ws/close-codes.js +8 -1
  47. package/package.json +19 -8
  48. package/sbom.spdx.json +5 -5
@@ -46,6 +46,7 @@ const MetricNames = {
46
46
  KICI_ORCH_JOB_RUNS_TOTAL: "kici_orch_job_runs_total",
47
47
  KICI_ORCH_LOG_BYTES_STORED_TOTAL: "kici_orch_log_bytes_stored_total",
48
48
  KICI_ORCH_LOG_CHUNKS_RECEIVED_TOTAL: "kici_orch_log_chunks_received_total",
49
+ KICI_ORCH_PG_POOL_CLIENT_ERRORS_TOTAL: "kici_orch_pg_pool_client_errors_total",
49
50
  KICI_ORCH_SCALER_CONFIG_RELOADS_TOTAL: "kici_orch_scaler_config_reloads_total",
50
51
  KICI_ORCH_SCALER_CPUS_USED: "kici_orch_scaler_cpus_used",
51
52
  KICI_ORCH_SCALER_MEMORY_BYTES_USED: "kici_orch_scaler_memory_bytes_used",
@@ -88,16 +89,25 @@ const MetricNames = {
88
89
  KICI_PLATFORM_MIMIR_RELAY_ERRORS_TOTAL: "kici_platform_mimir_relay_errors_total",
89
90
  KICI_PLATFORM_ORCH_METRICS_FILTERED_TOTAL: "kici_platform_orch_metrics_filtered_total",
90
91
  KICI_PLATFORM_ORPHAN_CONNECTIONS_SWEPT_TOTAL: "kici_platform_orphan_connections_swept_total",
92
+ KICI_PLATFORM_PG_POOL_CLIENT_ERRORS_TOTAL: "kici_platform_pg_pool_client_errors_total",
91
93
  KICI_PLATFORM_STALE_ORCHESTRATORS_TOTAL: "kici_platform_stale_orchestrators_total",
92
94
  KICI_PLATFORM_STALE_PLATFORM_CONNECTIONS_EVICTED_TOTAL: "kici_platform_stale_platform_connections_evicted_total",
93
95
  KICI_PLATFORM_STALE_RUNS_FAILED_TOTAL: "kici_platform_stale_runs_failed_total",
94
96
  KICI_PLATFORM_STEP_STATUS_FORWARDS_TOTAL: "kici_platform_step_status_forwards_total",
97
+ KICI_REGISTRATIONS_TOTAL: "kici_registrations_total",
95
98
  KICI_UNIVERSAL_GIT_REGISTRATION_ERRORS_TOTAL: "kici_universal_git_registration_errors_total",
96
99
  KICI_VALKEY_CONNECTION_STATUS: "kici_valkey_connection_status",
97
100
  KICI_VALKEY_PUBLISH_TOTAL: "kici_valkey_publish_total",
98
101
  KICI_VALKEY_RELAY_LATENCY_SECONDS: "kici_valkey_relay_latency_seconds",
99
102
  KICI_VALKEY_SUBSCRIBE_RECEIVE_TOTAL: "kici_valkey_subscribe_receive_total",
103
+ KICI_WEBHOOK_BUFFER_BYTES: "kici_webhook_buffer_bytes",
104
+ KICI_WEBHOOK_BUFFER_DEPTH: "kici_webhook_buffer_depth",
105
+ KICI_WEBHOOK_BUFFER_OLDEST_AGE_SECONDS: "kici_webhook_buffer_oldest_age_seconds",
106
+ KICI_WEBHOOK_PG_BREAKER_STATE: "kici_webhook_pg_breaker_state",
107
+ KICI_WEBHOOK_PG_BREAKER_TRANSITIONS_TOTAL: "kici_webhook_pg_breaker_transitions_total",
108
+ KICI_WEBHOOK_PG_DEGRADED_TOTAL: "kici_webhook_pg_degraded_total",
100
109
  KICI_WEBHOOK_PROCESSING_SECONDS: "kici_webhook_processing_seconds",
110
+ KICI_WEBHOOK_REPLAY_DURATION_SECONDS: "kici_webhook_replay_duration_seconds",
101
111
  KICI_WEBHOOK_SIGNATURE_FAILURES_TOTAL: "kici_webhook_signature_failures_total",
102
112
  KICI_WEBHOOKS_RECEIVED_TOTAL: "kici_webhooks_received_total",
103
113
  KICI_WS_CONNECTIONS_ACTIVE: "kici_ws_connections_active",
@@ -172,6 +182,7 @@ const MetricLabels = {
172
182
  KICI_ORCH_JOB_RUNS_TOTAL: ["job", "result"],
173
183
  KICI_ORCH_LOG_BYTES_STORED_TOTAL: [],
174
184
  KICI_ORCH_LOG_CHUNKS_RECEIVED_TOTAL: [],
185
+ KICI_ORCH_PG_POOL_CLIENT_ERRORS_TOTAL: ["source"],
175
186
  KICI_ORCH_SCALER_CONFIG_RELOADS_TOTAL: ["result"],
176
187
  KICI_ORCH_SCALER_CPUS_USED: ["scaler", "machinePool"],
177
188
  KICI_ORCH_SCALER_MEMORY_BYTES_USED: ["scaler", "machinePool"],
@@ -214,16 +225,25 @@ const MetricLabels = {
214
225
  KICI_PLATFORM_MIMIR_RELAY_ERRORS_TOTAL: ["reason"],
215
226
  KICI_PLATFORM_ORCH_METRICS_FILTERED_TOTAL: ["reason", "metric"],
216
227
  KICI_PLATFORM_ORPHAN_CONNECTIONS_SWEPT_TOTAL: [],
228
+ KICI_PLATFORM_PG_POOL_CLIENT_ERRORS_TOTAL: ["source"],
217
229
  KICI_PLATFORM_STALE_ORCHESTRATORS_TOTAL: [],
218
230
  KICI_PLATFORM_STALE_PLATFORM_CONNECTIONS_EVICTED_TOTAL: ["org_id"],
219
231
  KICI_PLATFORM_STALE_RUNS_FAILED_TOTAL: [],
220
232
  KICI_PLATFORM_STEP_STATUS_FORWARDS_TOTAL: ["state"],
233
+ KICI_REGISTRATIONS_TOTAL: [],
221
234
  KICI_UNIVERSAL_GIT_REGISTRATION_ERRORS_TOTAL: ["reason"],
222
235
  KICI_VALKEY_CONNECTION_STATUS: ["role"],
223
236
  KICI_VALKEY_PUBLISH_TOTAL: ["channel"],
224
237
  KICI_VALKEY_RELAY_LATENCY_SECONDS: ["status"],
225
238
  KICI_VALKEY_SUBSCRIBE_RECEIVE_TOTAL: ["channel"],
239
+ KICI_WEBHOOK_BUFFER_BYTES: [],
240
+ KICI_WEBHOOK_BUFFER_DEPTH: [],
241
+ KICI_WEBHOOK_BUFFER_OLDEST_AGE_SECONDS: [],
242
+ KICI_WEBHOOK_PG_BREAKER_STATE: [],
243
+ KICI_WEBHOOK_PG_BREAKER_TRANSITIONS_TOTAL: [],
244
+ KICI_WEBHOOK_PG_DEGRADED_TOTAL: ["outcome", "org_id"],
226
245
  KICI_WEBHOOK_PROCESSING_SECONDS: ["event"],
246
+ KICI_WEBHOOK_REPLAY_DURATION_SECONDS: [],
227
247
  KICI_WEBHOOK_SIGNATURE_FAILURES_TOTAL: ["source", "org_id"],
228
248
  KICI_WEBHOOKS_RECEIVED_TOTAL: [
229
249
  "event",
@@ -298,6 +318,7 @@ const MetricKind = {
298
318
  KICI_ORCH_JOB_RUNS_TOTAL: "counter",
299
319
  KICI_ORCH_LOG_BYTES_STORED_TOTAL: "counter",
300
320
  KICI_ORCH_LOG_CHUNKS_RECEIVED_TOTAL: "counter",
321
+ KICI_ORCH_PG_POOL_CLIENT_ERRORS_TOTAL: "counter",
301
322
  KICI_ORCH_SCALER_CONFIG_RELOADS_TOTAL: "counter",
302
323
  KICI_ORCH_SCALER_CPUS_USED: "observableGauge",
303
324
  KICI_ORCH_SCALER_MEMORY_BYTES_USED: "observableGauge",
@@ -340,16 +361,25 @@ const MetricKind = {
340
361
  KICI_PLATFORM_MIMIR_RELAY_ERRORS_TOTAL: "counter",
341
362
  KICI_PLATFORM_ORCH_METRICS_FILTERED_TOTAL: "counter",
342
363
  KICI_PLATFORM_ORPHAN_CONNECTIONS_SWEPT_TOTAL: "counter",
364
+ KICI_PLATFORM_PG_POOL_CLIENT_ERRORS_TOTAL: "counter",
343
365
  KICI_PLATFORM_STALE_ORCHESTRATORS_TOTAL: "counter",
344
366
  KICI_PLATFORM_STALE_PLATFORM_CONNECTIONS_EVICTED_TOTAL: "counter",
345
367
  KICI_PLATFORM_STALE_RUNS_FAILED_TOTAL: "counter",
346
368
  KICI_PLATFORM_STEP_STATUS_FORWARDS_TOTAL: "counter",
369
+ KICI_REGISTRATIONS_TOTAL: "counter",
347
370
  KICI_UNIVERSAL_GIT_REGISTRATION_ERRORS_TOTAL: "counter",
348
371
  KICI_VALKEY_CONNECTION_STATUS: "observableGauge",
349
372
  KICI_VALKEY_PUBLISH_TOTAL: "counter",
350
373
  KICI_VALKEY_RELAY_LATENCY_SECONDS: "histogram",
351
374
  KICI_VALKEY_SUBSCRIBE_RECEIVE_TOTAL: "counter",
375
+ KICI_WEBHOOK_BUFFER_BYTES: "observableGauge",
376
+ KICI_WEBHOOK_BUFFER_DEPTH: "observableGauge",
377
+ KICI_WEBHOOK_BUFFER_OLDEST_AGE_SECONDS: "observableGauge",
378
+ KICI_WEBHOOK_PG_BREAKER_STATE: "observableGauge",
379
+ KICI_WEBHOOK_PG_BREAKER_TRANSITIONS_TOTAL: "counter",
380
+ KICI_WEBHOOK_PG_DEGRADED_TOTAL: "counter",
352
381
  KICI_WEBHOOK_PROCESSING_SECONDS: "histogram",
382
+ KICI_WEBHOOK_REPLAY_DURATION_SECONDS: "histogram",
353
383
  KICI_WEBHOOK_SIGNATURE_FAILURES_TOTAL: "counter",
354
384
  KICI_WEBHOOKS_RECEIVED_TOTAL: "counter",
355
385
  KICI_WS_CONNECTIONS_ACTIVE: "upDownCounter",
@@ -420,6 +450,7 @@ const MetricDescription = {
420
450
  KICI_ORCH_JOB_RUNS_TOTAL: "Scheduled job run outcomes, by job and result (success/failure)",
421
451
  KICI_ORCH_LOG_BYTES_STORED_TOTAL: "Total bytes of log data written to storage",
422
452
  KICI_ORCH_LOG_CHUNKS_RECEIVED_TOTAL: "Total number of log chunks received from agents",
453
+ KICI_ORCH_PG_POOL_CLIENT_ERRORS_TOTAL: "Total pg connection errors absorbed without a process restart",
423
454
  KICI_ORCH_SCALER_CONFIG_RELOADS_TOTAL: "Total number of scaler config reload operations",
424
455
  KICI_ORCH_SCALER_CPUS_USED: "Current CPU reservations summed by scaler / pool. scaler=\"__global__\" is the orchestrator-wide total; machinePool=\"<name>\" rows reflect the on-disk ledger.",
425
456
  KICI_ORCH_SCALER_MEMORY_BYTES_USED: "Current memory reservations (bytes) summed by scaler / pool. scaler=\"__global__\" is the orchestrator-wide total; machinePool=\"<name>\" rows reflect the on-disk ledger.",
@@ -462,16 +493,25 @@ const MetricDescription = {
462
493
  KICI_PLATFORM_MIMIR_RELAY_ERRORS_TOTAL: "Total Mimir push-relay errors (Platform-embedded metrics). Labels: reason.",
463
494
  KICI_PLATFORM_ORCH_METRICS_FILTERED_TOTAL: "Orchestrator-pushed metric data points dropped or rewritten by the catalog allow-list. Labels: reason, metric.",
464
495
  KICI_PLATFORM_ORPHAN_CONNECTIONS_SWEPT_TOTAL: "Total orphan connections swept from platform_connections",
496
+ KICI_PLATFORM_PG_POOL_CLIENT_ERRORS_TOTAL: "Total pg connection errors absorbed without a process restart",
465
497
  KICI_PLATFORM_STALE_ORCHESTRATORS_TOTAL: "Total orchestrators detected as permanently disconnected",
466
498
  KICI_PLATFORM_STALE_PLATFORM_CONNECTIONS_EVICTED_TOTAL: "platform_connections rows evicted by source.register DB dedup (same-instance reconnect path)",
467
499
  KICI_PLATFORM_STALE_RUNS_FAILED_TOTAL: "Total execution runs failed due to orchestrator staleness",
468
500
  KICI_PLATFORM_STEP_STATUS_FORWARDS_TOTAL: "Total step status forwards received",
501
+ KICI_REGISTRATIONS_TOTAL: "Total user registrations (new personal orgs created on first login)",
469
502
  KICI_UNIVERSAL_GIT_REGISTRATION_ERRORS_TOTAL: "Errors encountered while registering universal-git provider bundles",
470
503
  KICI_VALKEY_CONNECTION_STATUS: "Valkey connection status per role (1=connected, 0=disconnected)",
471
504
  KICI_VALKEY_PUBLISH_TOTAL: "Total messages published to Valkey channels",
472
505
  KICI_VALKEY_RELAY_LATENCY_SECONDS: "Latency of cross-instance Valkey relay operations in seconds",
473
506
  KICI_VALKEY_SUBSCRIBE_RECEIVE_TOTAL: "Total messages received from Valkey subscriptions",
507
+ KICI_WEBHOOK_BUFFER_BYTES: "Total buffered webhook bytes (global Valkey counter)",
508
+ KICI_WEBHOOK_BUFFER_DEPTH: "Buffered webhook count per org",
509
+ KICI_WEBHOOK_BUFFER_OLDEST_AGE_SECONDS: "Age of the oldest buffered webhook per org, in seconds",
510
+ KICI_WEBHOOK_PG_BREAKER_STATE: "PG circuit-breaker state on this instance (0=closed,1=degraded,2=open)",
511
+ KICI_WEBHOOK_PG_BREAKER_TRANSITIONS_TOTAL: "PG circuit-breaker state transitions",
512
+ KICI_WEBHOOK_PG_DEGRADED_TOTAL: "Webhooks handled in PG-degraded mode, by outcome",
474
513
  KICI_WEBHOOK_PROCESSING_SECONDS: "Webhook processing duration in seconds",
514
+ KICI_WEBHOOK_REPLAY_DURATION_SECONDS: "Buffered-webhook replay latency (enqueue → delivered) in seconds",
475
515
  KICI_WEBHOOK_SIGNATURE_FAILURES_TOTAL: "Total number of webhooks rejected at orchestrator signature verification",
476
516
  KICI_WEBHOOKS_RECEIVED_TOTAL: "Total number of webhooks received",
477
517
  KICI_WS_CONNECTIONS_ACTIVE: "Current number of active WebSocket connections",
@@ -549,6 +589,7 @@ const MetricService = {
549
589
  KICI_ORCH_JOB_RUNS_TOTAL: "orchestrator",
550
590
  KICI_ORCH_LOG_BYTES_STORED_TOTAL: "orchestrator",
551
591
  KICI_ORCH_LOG_CHUNKS_RECEIVED_TOTAL: "orchestrator",
592
+ KICI_ORCH_PG_POOL_CLIENT_ERRORS_TOTAL: "orchestrator",
552
593
  KICI_ORCH_SCALER_CONFIG_RELOADS_TOTAL: "orchestrator",
553
594
  KICI_ORCH_SCALER_CPUS_USED: "orchestrator",
554
595
  KICI_ORCH_SCALER_MEMORY_BYTES_USED: "orchestrator",
@@ -591,16 +632,25 @@ const MetricService = {
591
632
  KICI_PLATFORM_MIMIR_RELAY_ERRORS_TOTAL: "platform",
592
633
  KICI_PLATFORM_ORCH_METRICS_FILTERED_TOTAL: "platform",
593
634
  KICI_PLATFORM_ORPHAN_CONNECTIONS_SWEPT_TOTAL: "platform",
635
+ KICI_PLATFORM_PG_POOL_CLIENT_ERRORS_TOTAL: "platform",
594
636
  KICI_PLATFORM_STALE_ORCHESTRATORS_TOTAL: "platform",
595
637
  KICI_PLATFORM_STALE_PLATFORM_CONNECTIONS_EVICTED_TOTAL: "platform",
596
638
  KICI_PLATFORM_STALE_RUNS_FAILED_TOTAL: "platform",
597
639
  KICI_PLATFORM_STEP_STATUS_FORWARDS_TOTAL: "platform",
640
+ KICI_REGISTRATIONS_TOTAL: "platform",
598
641
  KICI_UNIVERSAL_GIT_REGISTRATION_ERRORS_TOTAL: "orchestrator",
599
642
  KICI_VALKEY_CONNECTION_STATUS: "platform",
600
643
  KICI_VALKEY_PUBLISH_TOTAL: "platform",
601
644
  KICI_VALKEY_RELAY_LATENCY_SECONDS: "platform",
602
645
  KICI_VALKEY_SUBSCRIBE_RECEIVE_TOTAL: "platform",
646
+ KICI_WEBHOOK_BUFFER_BYTES: "platform",
647
+ KICI_WEBHOOK_BUFFER_DEPTH: "platform",
648
+ KICI_WEBHOOK_BUFFER_OLDEST_AGE_SECONDS: "platform",
649
+ KICI_WEBHOOK_PG_BREAKER_STATE: "platform",
650
+ KICI_WEBHOOK_PG_BREAKER_TRANSITIONS_TOTAL: "platform",
651
+ KICI_WEBHOOK_PG_DEGRADED_TOTAL: "platform",
603
652
  KICI_WEBHOOK_PROCESSING_SECONDS: "platform",
653
+ KICI_WEBHOOK_REPLAY_DURATION_SECONDS: "platform",
604
654
  KICI_WEBHOOK_SIGNATURE_FAILURES_TOTAL: "platform",
605
655
  KICI_WEBHOOKS_RECEIVED_TOTAL: "platform",
606
656
  KICI_WS_CONNECTIONS_ACTIVE: "platform",
@@ -672,6 +722,7 @@ const ALL_METRIC_NAMES = [
672
722
  "kici_orch_job_runs_total",
673
723
  "kici_orch_log_bytes_stored_total",
674
724
  "kici_orch_log_chunks_received_total",
725
+ "kici_orch_pg_pool_client_errors_total",
675
726
  "kici_orch_scaler_config_reloads_total",
676
727
  "kici_orch_scaler_cpus_used",
677
728
  "kici_orch_scaler_memory_bytes_used",
@@ -714,16 +765,25 @@ const ALL_METRIC_NAMES = [
714
765
  "kici_platform_mimir_relay_errors_total",
715
766
  "kici_platform_orch_metrics_filtered_total",
716
767
  "kici_platform_orphan_connections_swept_total",
768
+ "kici_platform_pg_pool_client_errors_total",
717
769
  "kici_platform_stale_orchestrators_total",
718
770
  "kici_platform_stale_platform_connections_evicted_total",
719
771
  "kici_platform_stale_runs_failed_total",
720
772
  "kici_platform_step_status_forwards_total",
773
+ "kici_registrations_total",
721
774
  "kici_universal_git_registration_errors_total",
722
775
  "kici_valkey_connection_status",
723
776
  "kici_valkey_publish_total",
724
777
  "kici_valkey_relay_latency_seconds",
725
778
  "kici_valkey_subscribe_receive_total",
779
+ "kici_webhook_buffer_bytes",
780
+ "kici_webhook_buffer_depth",
781
+ "kici_webhook_buffer_oldest_age_seconds",
782
+ "kici_webhook_pg_breaker_state",
783
+ "kici_webhook_pg_breaker_transitions_total",
784
+ "kici_webhook_pg_degraded_total",
726
785
  "kici_webhook_processing_seconds",
786
+ "kici_webhook_replay_duration_seconds",
727
787
  "kici_webhook_signature_failures_total",
728
788
  "kici_webhooks_received_total",
729
789
  "kici_ws_connections_active",
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ export declare const AnalyticsEvent: z.ZodEnum<{
3
+ login: "login";
4
+ org_created: "org_created";
5
+ secret_created: "secret_created";
6
+ workflow_run_triggered: "workflow_run_triggered";
7
+ run_viewed: "run_viewed";
8
+ billing_plan_selected: "billing_plan_selected";
9
+ code_copy: "code_copy";
10
+ docs_search: "docs_search";
11
+ cta_dashboard: "cta_dashboard";
12
+ }>;
13
+ export type AnalyticsEvent = z.infer<typeof AnalyticsEvent>;
14
+ /** The catalogue as a plain array (for build-time mirroring + tests). */
15
+ export declare const ANALYTICS_EVENTS: ("login" | "org_created" | "secret_created" | "workflow_run_triggered" | "run_viewed" | "billing_plan_selected" | "code_copy" | "docs_search" | "cta_dashboard")[];
16
+ //# sourceMappingURL=analytics-events.d.ts.map
@@ -0,0 +1,20 @@
1
+ import "../chunk-gOLHoazu.js";
2
+ import { z } from "zod";
3
+ //#region src/protocol/analytics-events.ts
4
+ const AnalyticsEvent = z.enum([
5
+ "login",
6
+ "org_created",
7
+ "secret_created",
8
+ "workflow_run_triggered",
9
+ "run_viewed",
10
+ "billing_plan_selected",
11
+ "code_copy",
12
+ "docs_search",
13
+ "cta_dashboard"
14
+ ]);
15
+ /** The catalogue as a plain array (for build-time mirroring + tests). */
16
+ const ANALYTICS_EVENTS = AnalyticsEvent.options;
17
+ //#endregion
18
+ export { ANALYTICS_EVENTS, AnalyticsEvent };
19
+
20
+ //# sourceMappingURL=analytics-events.js.map
@@ -29,6 +29,7 @@ export declare const DashboardWriteOperation: z.ZodEnum<{
29
29
  "variables.delete": "variables.delete";
30
30
  "environments.create": "environments.create";
31
31
  "environments.update": "environments.update";
32
+ "environments.test_access.set": "environments.test_access.set";
32
33
  "environments.delete": "environments.delete";
33
34
  "environments.bindings.set": "environments.bindings.set";
34
35
  "environments.source_overrides.set": "environments.source_overrides.set";
@@ -114,6 +115,7 @@ export declare const dashboardWritePolicyMap: z.ZodRecord<z.ZodEnum<{
114
115
  "variables.delete": "variables.delete";
115
116
  "environments.create": "environments.create";
116
117
  "environments.update": "environments.update";
118
+ "environments.test_access.set": "environments.test_access.set";
117
119
  "environments.delete": "environments.delete";
118
120
  "environments.bindings.set": "environments.bindings.set";
119
121
  "environments.source_overrides.set": "environments.source_overrides.set";
@@ -139,6 +141,7 @@ export declare const dashboardWritePolicyMapSchema: z.ZodDefault<z.ZodRecord<z.Z
139
141
  "variables.delete": "variables.delete";
140
142
  "environments.create": "environments.create";
141
143
  "environments.update": "environments.update";
144
+ "environments.test_access.set": "environments.test_access.set";
142
145
  "environments.delete": "environments.delete";
143
146
  "environments.bindings.set": "environments.bindings.set";
144
147
  "environments.source_overrides.set": "environments.source_overrides.set";
@@ -161,7 +164,7 @@ export declare const dashboardWritePolicyMapSchema: z.ZodDefault<z.ZodRecord<z.Z
161
164
  export declare function isDashboardWriteOperationEnabled(policy: DashboardWritePolicyMap | null | undefined, op: DashboardWriteOperation): boolean;
162
165
  /**
163
166
  * Expand a (possibly sparse) policy map into the full effective state
164
- * for all 23 operations. Operations the policy doesn't mention come
167
+ * for all 24 operations. Operations the policy doesn't mention come
165
168
  * back as `true` (permissive). Used by the orch HTTP admin response,
166
169
  * the WS `orch.capabilities` broadcast, and the dashboard's policy
167
170
  * page so consumers see the full picture, not the sparse storage shape.
@@ -31,6 +31,7 @@ const DashboardWriteOperation = z.enum([
31
31
  "variables.delete",
32
32
  "environments.create",
33
33
  "environments.update",
34
+ "environments.test_access.set",
34
35
  "environments.delete",
35
36
  "environments.bindings.set",
36
37
  "environments.source_overrides.set",
@@ -57,6 +58,7 @@ const DASHBOARD_WRITE_OPERATION_VALUES = Object.freeze([
57
58
  "variables.delete",
58
59
  "environments.create",
59
60
  "environments.update",
61
+ "environments.test_access.set",
60
62
  "environments.delete",
61
63
  "environments.bindings.set",
62
64
  "environments.source_overrides.set",
@@ -160,6 +162,14 @@ const DASHBOARD_WRITE_OPERATIONS = Object.freeze([
160
162
  sensitivity: "authority",
161
163
  cliEquivalent: "kici-admin environment set-policy"
162
164
  },
165
+ {
166
+ name: "environments.test_access.set",
167
+ wireMessageType: "dashboard.environments.test_access.set",
168
+ category: "Environments",
169
+ label: "Set environment test access",
170
+ sensitivity: "authority",
171
+ cliEquivalent: "kici-admin environment set-policy --allow-local-execution"
172
+ },
163
173
  {
164
174
  name: "environments.delete",
165
175
  wireMessageType: "dashboard.environments.delete",
@@ -308,7 +318,7 @@ function isDashboardWriteOperationEnabled(policy, op) {
308
318
  }
309
319
  /**
310
320
  * Expand a (possibly sparse) policy map into the full effective state
311
- * for all 23 operations. Operations the policy doesn't mention come
321
+ * for all 24 operations. Operations the policy doesn't mention come
312
322
  * back as `true` (permissive). Used by the orch HTTP admin response,
313
323
  * the WS `orch.capabilities` broadcast, and the dashboard's policy
314
324
  * page so consumers see the full picture, not the sparse storage shape.
@@ -57,6 +57,9 @@ export declare const AccessLogAction: z.ZodEnum<{
57
57
  "registration.delete": "registration.delete";
58
58
  "global_workflows.update": "global_workflows.update";
59
59
  "run.detail.read": "run.detail.read";
60
+ "runs.list.read": "runs.list.read";
61
+ "runs.filters.read": "runs.filters.read";
62
+ "sources.list.read": "sources.list.read";
60
63
  "run.payload.read": "run.payload.read";
61
64
  "run.orch_logs.read": "run.orch_logs.read";
62
65
  "step.logs.read": "step.logs.read";
@@ -91,6 +94,8 @@ export declare const AccessLogAction: z.ZodEnum<{
91
94
  "held_run.list.read": "held_run.list.read";
92
95
  "held_run.approve": "held_run.approve";
93
96
  "held_run.reject": "held_run.reject";
97
+ "held_run.request": "held_run.request";
98
+ "held_run.expire": "held_run.expire";
94
99
  "registration.list.read": "registration.list.read";
95
100
  "diagnostics.read": "diagnostics.read";
96
101
  "scaler.capacity.read": "scaler.capacity.read";
@@ -138,6 +143,9 @@ export declare const accessLogItemSchema: z.ZodObject<{
138
143
  "registration.delete": "registration.delete";
139
144
  "global_workflows.update": "global_workflows.update";
140
145
  "run.detail.read": "run.detail.read";
146
+ "runs.list.read": "runs.list.read";
147
+ "runs.filters.read": "runs.filters.read";
148
+ "sources.list.read": "sources.list.read";
141
149
  "run.payload.read": "run.payload.read";
142
150
  "run.orch_logs.read": "run.orch_logs.read";
143
151
  "step.logs.read": "step.logs.read";
@@ -172,6 +180,8 @@ export declare const accessLogItemSchema: z.ZodObject<{
172
180
  "held_run.list.read": "held_run.list.read";
173
181
  "held_run.approve": "held_run.approve";
174
182
  "held_run.reject": "held_run.reject";
183
+ "held_run.request": "held_run.request";
184
+ "held_run.expire": "held_run.expire";
175
185
  "registration.list.read": "registration.list.read";
176
186
  "diagnostics.read": "diagnostics.read";
177
187
  "scaler.capacity.read": "scaler.capacity.read";
@@ -241,6 +251,9 @@ export declare const accessLogFilterSchema: z.ZodObject<{
241
251
  "registration.delete": "registration.delete";
242
252
  "global_workflows.update": "global_workflows.update";
243
253
  "run.detail.read": "run.detail.read";
254
+ "runs.list.read": "runs.list.read";
255
+ "runs.filters.read": "runs.filters.read";
256
+ "sources.list.read": "sources.list.read";
244
257
  "run.payload.read": "run.payload.read";
245
258
  "run.orch_logs.read": "run.orch_logs.read";
246
259
  "step.logs.read": "step.logs.read";
@@ -275,6 +288,8 @@ export declare const accessLogFilterSchema: z.ZodObject<{
275
288
  "held_run.list.read": "held_run.list.read";
276
289
  "held_run.approve": "held_run.approve";
277
290
  "held_run.reject": "held_run.reject";
291
+ "held_run.request": "held_run.request";
292
+ "held_run.expire": "held_run.expire";
278
293
  "registration.list.read": "registration.list.read";
279
294
  "diagnostics.read": "diagnostics.read";
280
295
  "scaler.capacity.read": "scaler.capacity.read";
@@ -345,6 +360,7 @@ export declare const dashboardAccessLogListRequestSchema: z.ZodObject<{
345
360
  type: z.ZodLiteral<"platform_operator">;
346
361
  sub: z.ZodString;
347
362
  reason: z.ZodString;
363
+ sessionId: z.ZodOptional<z.ZodString>;
348
364
  }, z.core.$strip>, z.ZodObject<{
349
365
  type: z.ZodLiteral<"system">;
350
366
  component: z.ZodString;
@@ -365,6 +381,9 @@ export declare const dashboardAccessLogListRequestSchema: z.ZodObject<{
365
381
  "registration.delete": "registration.delete";
366
382
  "global_workflows.update": "global_workflows.update";
367
383
  "run.detail.read": "run.detail.read";
384
+ "runs.list.read": "runs.list.read";
385
+ "runs.filters.read": "runs.filters.read";
386
+ "sources.list.read": "sources.list.read";
368
387
  "run.payload.read": "run.payload.read";
369
388
  "run.orch_logs.read": "run.orch_logs.read";
370
389
  "step.logs.read": "step.logs.read";
@@ -399,6 +418,8 @@ export declare const dashboardAccessLogListRequestSchema: z.ZodObject<{
399
418
  "held_run.list.read": "held_run.list.read";
400
419
  "held_run.approve": "held_run.approve";
401
420
  "held_run.reject": "held_run.reject";
421
+ "held_run.request": "held_run.request";
422
+ "held_run.expire": "held_run.expire";
402
423
  "registration.list.read": "registration.list.read";
403
424
  "diagnostics.read": "diagnostics.read";
404
425
  "scaler.capacity.read": "scaler.capacity.read";
@@ -478,6 +499,9 @@ export declare const dashboardAccessLogListResponseSchema: z.ZodObject<{
478
499
  "registration.delete": "registration.delete";
479
500
  "global_workflows.update": "global_workflows.update";
480
501
  "run.detail.read": "run.detail.read";
502
+ "runs.list.read": "runs.list.read";
503
+ "runs.filters.read": "runs.filters.read";
504
+ "sources.list.read": "sources.list.read";
481
505
  "run.payload.read": "run.payload.read";
482
506
  "run.orch_logs.read": "run.orch_logs.read";
483
507
  "step.logs.read": "step.logs.read";
@@ -512,6 +536,8 @@ export declare const dashboardAccessLogListResponseSchema: z.ZodObject<{
512
536
  "held_run.list.read": "held_run.list.read";
513
537
  "held_run.approve": "held_run.approve";
514
538
  "held_run.reject": "held_run.reject";
539
+ "held_run.request": "held_run.request";
540
+ "held_run.expire": "held_run.expire";
515
541
  "registration.list.read": "registration.list.read";
516
542
  "diagnostics.read": "diagnostics.read";
517
543
  "scaler.capacity.read": "scaler.capacity.read";
@@ -52,6 +52,9 @@ const AccessLogTargetType = z.enum([
52
52
  */
53
53
  const AccessLogAction = z.enum([
54
54
  "run.detail.read",
55
+ "runs.list.read",
56
+ "runs.filters.read",
57
+ "sources.list.read",
55
58
  "run.payload.read",
56
59
  "run.orch_logs.read",
57
60
  "step.logs.read",
@@ -86,6 +89,8 @@ const AccessLogAction = z.enum([
86
89
  "held_run.list.read",
87
90
  "held_run.approve",
88
91
  "held_run.reject",
92
+ "held_run.request",
93
+ "held_run.expire",
89
94
  "registration.list.read",
90
95
  "registration.disable",
91
96
  "registration.delete",
@@ -37,6 +37,7 @@ export declare const platformOperatorActorSchema: z.ZodObject<{
37
37
  type: z.ZodLiteral<"platform_operator">;
38
38
  sub: z.ZodString;
39
39
  reason: z.ZodString;
40
+ sessionId: z.ZodOptional<z.ZodString>;
40
41
  }, z.core.$strip>;
41
42
  export type PlatformOperatorActor = z.infer<typeof platformOperatorActorSchema>;
42
43
  export declare const systemActorSchema: z.ZodObject<{
@@ -58,6 +59,7 @@ export declare const actorPrincipalSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
58
59
  type: z.ZodLiteral<"platform_operator">;
59
60
  sub: z.ZodString;
60
61
  reason: z.ZodString;
62
+ sessionId: z.ZodOptional<z.ZodString>;
61
63
  }, z.core.$strip>, z.ZodObject<{
62
64
  type: z.ZodLiteral<"system">;
63
65
  component: z.ZodString;
@@ -44,7 +44,14 @@ const platformOperatorActorSchema = z.object({
44
44
  * Length bounds reject empty / obviously-bad-faith values; not a ticket
45
45
  * pattern (we support multiple incident systems).
46
46
  */
47
- reason: z.string().min(10).max(200)
47
+ reason: z.string().min(4).max(200),
48
+ /**
49
+ * Support-session id, when the operator is reading through a dashboard
50
+ * support session (not the kici-platform-admin CLI break-glass path).
51
+ * Recorded in `access_log.actor_meta.sessionId` so the customer's activity
52
+ * page can tie each operator read back to the session that authorised it.
53
+ */
54
+ sessionId: z.string().min(1).optional()
48
55
  });
49
56
  const systemActorSchema = z.object({
50
57
  type: z.literal(ActorType.enum.system),
@@ -124,7 +131,10 @@ function flattenActor(actor) {
124
131
  case "platform_operator": return {
125
132
  actorType: "platform_operator",
126
133
  actorId: actor.sub,
127
- actorMeta: { reason: actor.reason }
134
+ actorMeta: {
135
+ reason: actor.reason,
136
+ ...actor.sessionId ? { sessionId: actor.sessionId } : {}
137
+ }
128
138
  };
129
139
  case "system": return {
130
140
  actorType: "system",
@@ -19,6 +19,7 @@ export declare const authRequestSchema: z.ZodObject<{
19
19
  "variables.delete": "variables.delete";
20
20
  "environments.create": "environments.create";
21
21
  "environments.update": "environments.update";
22
+ "environments.test_access.set": "environments.test_access.set";
22
23
  "environments.delete": "environments.delete";
23
24
  "environments.bindings.set": "environments.bindings.set";
24
25
  "environments.source_overrides.set": "environments.source_overrides.set";
@@ -38,6 +38,7 @@ export declare const orchCapabilitiesSchema: z.ZodObject<{
38
38
  "variables.delete": "variables.delete";
39
39
  "environments.create": "environments.create";
40
40
  "environments.update": "environments.update";
41
+ "environments.test_access.set": "environments.test_access.set";
41
42
  "environments.delete": "environments.delete";
42
43
  "environments.bindings.set": "environments.bindings.set";
43
44
  "environments.source_overrides.set": "environments.source_overrides.set";
@@ -67,6 +67,7 @@ export declare const globalWorkflowsGetRequestSchema: z.ZodObject<{
67
67
  type: z.ZodLiteral<"platform_operator">;
68
68
  sub: z.ZodString;
69
69
  reason: z.ZodString;
70
+ sessionId: z.ZodOptional<z.ZodString>;
70
71
  }, z.core.$strip>, z.ZodObject<{
71
72
  type: z.ZodLiteral<"system">;
72
73
  component: z.ZodString;
@@ -95,6 +96,7 @@ export declare const globalWorkflowsUpdateRequestSchema: z.ZodObject<{
95
96
  type: z.ZodLiteral<"platform_operator">;
96
97
  sub: z.ZodString;
97
98
  reason: z.ZodString;
99
+ sessionId: z.ZodOptional<z.ZodString>;
98
100
  }, z.core.$strip>, z.ZodObject<{
99
101
  type: z.ZodLiteral<"system">;
100
102
  component: z.ZodString;