@kici-dev/engine 0.1.2 → 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.
@@ -177,7 +177,21 @@ export declare const staleCheckrunCleanupSchema: z.ZodObject<{
177
177
  }, z.core.$strip>>;
178
178
  }, z.core.$strip>;
179
179
  export type StaleCheckrunCleanup = z.infer<typeof staleCheckrunCleanupSchema>;
180
- /** Periodic OTel metrics push from orchestrator to Platform for centralized observability. */
180
+ /**
181
+ * Periodic OTel metrics push from orchestrator to Platform for centralized observability.
182
+ *
183
+ * Schema bounds are the first line of defence against pollution of the
184
+ * Platform's monitoring system: a malformed or hostile push fails Zod
185
+ * parse at the WS edge and never reaches the aggregator or the Mimir
186
+ * relay. The content-level allow-list (catalog) is enforced one step
187
+ * deeper — see `packages/platform/src/ws/metrics-filter.ts`.
188
+ *
189
+ * Caps:
190
+ * - 2000 metric data points per push (one orch ships ~60 today)
191
+ * - 128-char metric name, 64-char label key, 256-char label value
192
+ * - 15 labels per series (KiCI metrics carry ~5 today)
193
+ * - 30 explicit histogram buckets (largest histogram has 9 boundaries)
194
+ */
181
195
  export declare const orchMetricsSchema: z.ZodObject<{
182
196
  type: z.ZodLiteral<"orch.metrics">;
183
197
  messageId: z.ZodString;
@@ -255,6 +269,50 @@ export declare const cacheStatsSchema: z.ZodObject<{
255
269
  hit: z.ZodBoolean;
256
270
  }, z.core.$strip>;
257
271
  export type CacheStats = z.infer<typeof cacheStatsSchema>;
272
+ /**
273
+ * Runtime broadcast of an updated dashboard-write policy. Carries the
274
+ * orch's full capabilities object (same shape as `orchCapabilitiesSchema`
275
+ * via `auth.request`) so Platform's per-org cache can be replaced
276
+ * wholesale rather than merged. Emitted by the orch whenever an
277
+ * operator flips a switch via `kici-admin org-settings dashboard-writes`;
278
+ * Platform receives it, updates its cache, and re-broadcasts the
279
+ * relevant subset to any connected dashboard SPA sessions.
280
+ */
281
+ export declare const orchCapabilitiesUpdateSchema: z.ZodObject<{
282
+ type: z.ZodLiteral<"orch.capabilities.update">;
283
+ capabilities: z.ZodObject<{
284
+ orchRole: z.ZodOptional<z.ZodEnum<{
285
+ coordinator: "coordinator";
286
+ worker: "worker";
287
+ }>>;
288
+ dashboardWrites: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
289
+ "secrets.set": "secrets.set";
290
+ "secrets.delete": "secrets.delete";
291
+ "secrets.scope.create": "secrets.scope.create";
292
+ "secrets.scope.rename": "secrets.scope.rename";
293
+ "secrets.scope.delete": "secrets.scope.delete";
294
+ "variables.set": "variables.set";
295
+ "variables.delete": "variables.delete";
296
+ "environments.create": "environments.create";
297
+ "environments.update": "environments.update";
298
+ "environments.delete": "environments.delete";
299
+ "environments.bindings.set": "environments.bindings.set";
300
+ "environments.source_overrides.set": "environments.source_overrides.set";
301
+ "environments.source_overrides.delete": "environments.source_overrides.delete";
302
+ "held_runs.approve": "held_runs.approve";
303
+ "held_runs.reject": "held_runs.reject";
304
+ "event_dlq.retry": "event_dlq.retry";
305
+ "event_dlq.discard": "event_dlq.discard";
306
+ "registration.disable": "registration.disable";
307
+ "registration.delete": "registration.delete";
308
+ "global_workflows.update": "global_workflows.update";
309
+ "backends.sync": "backends.sync";
310
+ "backends.sync_one": "backends.sync_one";
311
+ "backends.test": "backends.test";
312
+ }> & z.core.$partial, z.ZodBoolean>>;
313
+ }, z.core.$loose>;
314
+ }, z.core.$strip>;
315
+ export type OrchCapabilitiesUpdate = z.infer<typeof orchCapabilitiesUpdateSchema>;
258
316
  /** All messages that flow from Platform to Orchestrator.
259
317
  *
260
318
  * The single-frame `webhookRelaySchema` is intentionally NOT a member of this
@@ -1424,6 +1482,98 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1424
1482
  orgId: z.ZodString;
1425
1483
  deliveryId: z.ZodString;
1426
1484
  routingKey: z.ZodOptional<z.ZodString>;
1485
+ }, z.core.$strip>, z.ZodObject<{
1486
+ type: z.ZodLiteral<"dashboard.event-dlq.list">;
1487
+ requestId: z.ZodString;
1488
+ actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
1489
+ type: z.ZodLiteral<"user">;
1490
+ sub: z.ZodString;
1491
+ }, z.core.$strip>, z.ZodObject<{
1492
+ type: z.ZodLiteral<"api_key">;
1493
+ keyId: z.ZodString;
1494
+ ownerSub: z.ZodString;
1495
+ }, z.core.$strip>, z.ZodObject<{
1496
+ type: z.ZodLiteral<"service_account">;
1497
+ id: z.ZodString;
1498
+ }, z.core.$strip>, z.ZodObject<{
1499
+ type: z.ZodLiteral<"platform_operator">;
1500
+ sub: z.ZodString;
1501
+ reason: z.ZodString;
1502
+ }, z.core.$strip>, z.ZodObject<{
1503
+ type: z.ZodLiteral<"system">;
1504
+ component: z.ZodString;
1505
+ }, z.core.$strip>], "type">;
1506
+ orgId: z.ZodString;
1507
+ limit: z.ZodOptional<z.ZodNumber>;
1508
+ before: z.ZodOptional<z.ZodString>;
1509
+ }, z.core.$strip>, z.ZodObject<{
1510
+ type: z.ZodLiteral<"dashboard.event-dlq.count">;
1511
+ requestId: z.ZodString;
1512
+ actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
1513
+ type: z.ZodLiteral<"user">;
1514
+ sub: z.ZodString;
1515
+ }, z.core.$strip>, z.ZodObject<{
1516
+ type: z.ZodLiteral<"api_key">;
1517
+ keyId: z.ZodString;
1518
+ ownerSub: z.ZodString;
1519
+ }, z.core.$strip>, z.ZodObject<{
1520
+ type: z.ZodLiteral<"service_account">;
1521
+ id: z.ZodString;
1522
+ }, z.core.$strip>, z.ZodObject<{
1523
+ type: z.ZodLiteral<"platform_operator">;
1524
+ sub: z.ZodString;
1525
+ reason: z.ZodString;
1526
+ }, z.core.$strip>, z.ZodObject<{
1527
+ type: z.ZodLiteral<"system">;
1528
+ component: z.ZodString;
1529
+ }, z.core.$strip>], "type">;
1530
+ orgId: z.ZodString;
1531
+ }, z.core.$strip>, z.ZodObject<{
1532
+ type: z.ZodLiteral<"dashboard.event-dlq.retry">;
1533
+ requestId: z.ZodString;
1534
+ actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
1535
+ type: z.ZodLiteral<"user">;
1536
+ sub: z.ZodString;
1537
+ }, z.core.$strip>, z.ZodObject<{
1538
+ type: z.ZodLiteral<"api_key">;
1539
+ keyId: z.ZodString;
1540
+ ownerSub: z.ZodString;
1541
+ }, z.core.$strip>, z.ZodObject<{
1542
+ type: z.ZodLiteral<"service_account">;
1543
+ id: z.ZodString;
1544
+ }, z.core.$strip>, z.ZodObject<{
1545
+ type: z.ZodLiteral<"platform_operator">;
1546
+ sub: z.ZodString;
1547
+ reason: z.ZodString;
1548
+ }, z.core.$strip>, z.ZodObject<{
1549
+ type: z.ZodLiteral<"system">;
1550
+ component: z.ZodString;
1551
+ }, z.core.$strip>], "type">;
1552
+ orgId: z.ZodString;
1553
+ eventId: z.ZodString;
1554
+ }, z.core.$strip>, z.ZodObject<{
1555
+ type: z.ZodLiteral<"dashboard.event-dlq.discard">;
1556
+ requestId: z.ZodString;
1557
+ actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
1558
+ type: z.ZodLiteral<"user">;
1559
+ sub: z.ZodString;
1560
+ }, z.core.$strip>, z.ZodObject<{
1561
+ type: z.ZodLiteral<"api_key">;
1562
+ keyId: z.ZodString;
1563
+ ownerSub: z.ZodString;
1564
+ }, z.core.$strip>, z.ZodObject<{
1565
+ type: z.ZodLiteral<"service_account">;
1566
+ id: z.ZodString;
1567
+ }, z.core.$strip>, z.ZodObject<{
1568
+ type: z.ZodLiteral<"platform_operator">;
1569
+ sub: z.ZodString;
1570
+ reason: z.ZodString;
1571
+ }, z.core.$strip>, z.ZodObject<{
1572
+ type: z.ZodLiteral<"system">;
1573
+ component: z.ZodString;
1574
+ }, z.core.$strip>], "type">;
1575
+ orgId: z.ZodString;
1576
+ eventId: z.ZodString;
1427
1577
  }, z.core.$strip>, z.ZodObject<{
1428
1578
  type: z.ZodLiteral<"dashboard.global-workflows.get">;
1429
1579
  requestId: z.ZodString;
@@ -1510,6 +1660,11 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1510
1660
  }>>;
1511
1661
  actorId: z.ZodOptional<z.ZodString>;
1512
1662
  action: z.ZodOptional<z.ZodEnum<{
1663
+ "event_dlq.retry": "event_dlq.retry";
1664
+ "event_dlq.discard": "event_dlq.discard";
1665
+ "registration.disable": "registration.disable";
1666
+ "registration.delete": "registration.delete";
1667
+ "global_workflows.update": "global_workflows.update";
1513
1668
  "run.detail.read": "run.detail.read";
1514
1669
  "run.payload.read": "run.payload.read";
1515
1670
  "run.orch_logs.read": "run.orch_logs.read";
@@ -1546,8 +1701,6 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1546
1701
  "held_run.approve": "held_run.approve";
1547
1702
  "held_run.reject": "held_run.reject";
1548
1703
  "registration.list.read": "registration.list.read";
1549
- "registration.disable": "registration.disable";
1550
- "registration.delete": "registration.delete";
1551
1704
  "diagnostics.read": "diagnostics.read";
1552
1705
  "scaler.capacity.read": "scaler.capacity.read";
1553
1706
  "scaler.agents.read": "scaler.agents.read";
@@ -1557,12 +1710,12 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1557
1710
  "backend.sync.one": "backend.sync.one";
1558
1711
  "backend.test": "backend.test";
1559
1712
  "global_workflows.get.read": "global_workflows.get.read";
1560
- "global_workflows.update": "global_workflows.update";
1713
+ "org_settings.dashboard_write_policy.update": "org_settings.dashboard_write_policy.update";
1714
+ "cluster_name.update": "cluster_name.update";
1561
1715
  "access_log.list.read": "access_log.list.read";
1562
1716
  "event_dlq.list.read": "event_dlq.list.read";
1563
- "event_dlq.retry": "event_dlq.retry";
1564
- "event_dlq.discard": "event_dlq.discard";
1565
1717
  archive_chunk: "archive_chunk";
1718
+ purge_chunk: "purge_chunk";
1566
1719
  }>>;
1567
1720
  source: z.ZodOptional<z.ZodEnum<{
1568
1721
  platform_proxy: "platform_proxy";
@@ -1590,6 +1743,8 @@ export declare const platformToOrchestratorMessageSchema: z.ZodDiscriminatedUnio
1590
1743
  held_run: "held_run";
1591
1744
  access_log: "access_log";
1592
1745
  event_dlq: "event_dlq";
1746
+ org_settings: "org_settings";
1747
+ cluster_meta: "cluster_meta";
1593
1748
  }>>;
1594
1749
  targetId: z.ZodOptional<z.ZodString>;
1595
1750
  fromTimestamp: z.ZodOptional<z.ZodString>;
@@ -1751,6 +1906,39 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
1751
1906
  }, z.core.$strip>>;
1752
1907
  }, z.core.$strip>>;
1753
1908
  timestamp: z.ZodNumber;
1909
+ }, z.core.$strip>, z.ZodObject<{
1910
+ type: z.ZodLiteral<"orch.capabilities.update">;
1911
+ capabilities: z.ZodObject<{
1912
+ orchRole: z.ZodOptional<z.ZodEnum<{
1913
+ coordinator: "coordinator";
1914
+ worker: "worker";
1915
+ }>>;
1916
+ dashboardWrites: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
1917
+ "secrets.set": "secrets.set";
1918
+ "secrets.delete": "secrets.delete";
1919
+ "secrets.scope.create": "secrets.scope.create";
1920
+ "secrets.scope.rename": "secrets.scope.rename";
1921
+ "secrets.scope.delete": "secrets.scope.delete";
1922
+ "variables.set": "variables.set";
1923
+ "variables.delete": "variables.delete";
1924
+ "environments.create": "environments.create";
1925
+ "environments.update": "environments.update";
1926
+ "environments.delete": "environments.delete";
1927
+ "environments.bindings.set": "environments.bindings.set";
1928
+ "environments.source_overrides.set": "environments.source_overrides.set";
1929
+ "environments.source_overrides.delete": "environments.source_overrides.delete";
1930
+ "held_runs.approve": "held_runs.approve";
1931
+ "held_runs.reject": "held_runs.reject";
1932
+ "event_dlq.retry": "event_dlq.retry";
1933
+ "event_dlq.discard": "event_dlq.discard";
1934
+ "registration.disable": "registration.disable";
1935
+ "registration.delete": "registration.delete";
1936
+ "global_workflows.update": "global_workflows.update";
1937
+ "backends.sync": "backends.sync";
1938
+ "backends.sync_one": "backends.sync_one";
1939
+ "backends.test": "backends.test";
1940
+ }> & z.core.$partial, z.ZodBoolean>>;
1941
+ }, z.core.$loose>;
1754
1942
  }, z.core.$strip>, z.ZodObject<{
1755
1943
  type: z.ZodLiteral<"source.register">;
1756
1944
  messageId: z.ZodString;
@@ -1771,6 +1959,8 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
1771
1959
  }>;
1772
1960
  }, z.core.$strip>>;
1773
1961
  instanceId: z.ZodOptional<z.ZodString>;
1962
+ clusterName: z.ZodOptional<z.ZodString>;
1963
+ clusterId: z.ZodOptional<z.ZodString>;
1774
1964
  address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1775
1965
  version: z.ZodOptional<z.ZodString>;
1776
1966
  mode: z.ZodOptional<z.ZodEnum<{
@@ -1801,6 +1991,31 @@ export declare const orchestratorToPlatformMessageSchema: z.ZodDiscriminatedUnio
1801
1991
  coordinator: "coordinator";
1802
1992
  worker: "worker";
1803
1993
  }>>;
1994
+ dashboardWrites: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
1995
+ "secrets.set": "secrets.set";
1996
+ "secrets.delete": "secrets.delete";
1997
+ "secrets.scope.create": "secrets.scope.create";
1998
+ "secrets.scope.rename": "secrets.scope.rename";
1999
+ "secrets.scope.delete": "secrets.scope.delete";
2000
+ "variables.set": "variables.set";
2001
+ "variables.delete": "variables.delete";
2002
+ "environments.create": "environments.create";
2003
+ "environments.update": "environments.update";
2004
+ "environments.delete": "environments.delete";
2005
+ "environments.bindings.set": "environments.bindings.set";
2006
+ "environments.source_overrides.set": "environments.source_overrides.set";
2007
+ "environments.source_overrides.delete": "environments.source_overrides.delete";
2008
+ "held_runs.approve": "held_runs.approve";
2009
+ "held_runs.reject": "held_runs.reject";
2010
+ "event_dlq.retry": "event_dlq.retry";
2011
+ "event_dlq.discard": "event_dlq.discard";
2012
+ "registration.disable": "registration.disable";
2013
+ "registration.delete": "registration.delete";
2014
+ "global_workflows.update": "global_workflows.update";
2015
+ "backends.sync": "backends.sync";
2016
+ "backends.sync_one": "backends.sync_one";
2017
+ "backends.test": "backends.test";
2018
+ }> & z.core.$partial, z.ZodBoolean>>;
1804
2019
  }, z.core.$loose>>;
1805
2020
  }, z.core.$strip>, z.ZodObject<{
1806
2021
  type: z.ZodLiteral<"heartbeat">;
@@ -1,12 +1,13 @@
1
1
  import "../../chunk-gOLHoazu.js";
2
2
  import { heartbeatSchema } from "./common.js";
3
+ import { orchCapabilitiesSchema } from "./capabilities.js";
3
4
  import { authFailureSchema, authRequestSchema, authSuccessSchema } from "./auth.js";
4
5
  import { executionStatusSchema, jobStatusForwardSchema, stateReplaySchema, stepStatusForwardSchema } from "./execution-status.js";
5
6
  import { sourceDeregisterAckSchema, sourceDeregisterSchema, sourceRegistrationAckSchema, sourceRegistrationSchema } from "./source-registration.js";
6
7
  import { dashboardAccessLogListRequestSchema } from "./access-log.js";
7
8
  import { dashboardOrchLogsRequestSchema, jobContextMessageSchema, runEventMessageSchema } from "./run-events.js";
8
9
  import { globalWorkflowsGetRequestSchema, globalWorkflowsUpdateRequestSchema } from "./dashboard-global-workflows.js";
9
- import { backendGetRequestSchema, backendSyncRequestSchema, backendTestRequestSchema, backendsListRequestSchema, backendsSyncAllRequestSchema, dashboardDiagnosticsRequestSchema, dashboardEventLogDetailRequestSchema, dashboardEventLogListRequestSchema, dashboardEventLogPayloadStreamRequestSchema, dashboardPayloadRequestSchema, dashboardRunDetailRequestSchema, dashboardScalerAgentsRequestSchema, dashboardScalerCapacityRequestSchema, dashboardStepLogsRequestSchema, envBindingsListRequestSchema, envBindingsSetRequestSchema, envCreateRequestSchema, envDeleteRequestSchema, envGetRequestSchema, envHistoryRequestSchema, envListRequestSchema, envSecretDeleteRequestSchema, envSecretScopeCreateRequestSchema, envSecretScopeDeleteRequestSchema, envSecretScopeRenameRequestSchema, envSecretSetRequestSchema, envSecretsListRequestSchema, envSourceOverrideDeleteRequestSchema, envSourceOverrideSetRequestSchema, envSourceOverridesListRequestSchema, envUpdateRequestSchema, envVarDeleteRequestSchema, envVarSetRequestSchema, envVarsListRequestSchema, heldRunApproveRequestSchema, heldRunRejectRequestSchema, heldRunsListRequestSchema, manualScheduleRequestSchema, registrationDeleteRequestSchema, registrationDisableRequestSchema, registrationsListRequestSchema, runCancelRequestSchema, runRerunRequestSchema } from "./dashboard.js";
10
+ import { backendGetRequestSchema, backendSyncRequestSchema, backendTestRequestSchema, backendsListRequestSchema, backendsSyncAllRequestSchema, dashboardDiagnosticsRequestSchema, dashboardEventDlqCountRequestSchema, dashboardEventDlqDiscardRequestSchema, dashboardEventDlqListRequestSchema, dashboardEventDlqRetryRequestSchema, dashboardEventLogDetailRequestSchema, dashboardEventLogListRequestSchema, dashboardEventLogPayloadStreamRequestSchema, dashboardPayloadRequestSchema, dashboardRunDetailRequestSchema, dashboardScalerAgentsRequestSchema, dashboardScalerCapacityRequestSchema, dashboardStepLogsRequestSchema, envBindingsListRequestSchema, envBindingsSetRequestSchema, envCreateRequestSchema, envDeleteRequestSchema, envGetRequestSchema, envHistoryRequestSchema, envListRequestSchema, envSecretDeleteRequestSchema, envSecretScopeCreateRequestSchema, envSecretScopeDeleteRequestSchema, envSecretScopeRenameRequestSchema, envSecretSetRequestSchema, envSecretsListRequestSchema, envSourceOverrideDeleteRequestSchema, envSourceOverrideSetRequestSchema, envSourceOverridesListRequestSchema, envUpdateRequestSchema, envVarDeleteRequestSchema, envVarSetRequestSchema, envVarsListRequestSchema, heldRunApproveRequestSchema, heldRunRejectRequestSchema, heldRunsListRequestSchema, manualScheduleRequestSchema, registrationDeleteRequestSchema, registrationDisableRequestSchema, registrationsListRequestSchema, runCancelRequestSchema, runRerunRequestSchema } from "./dashboard.js";
10
11
  import { z } from "zod";
11
12
  //#region src/protocol/messages/platform-orchestrator.ts
12
13
  /** Trust policy update pushed from Platform to orchestrator when policy or identity links change. */
@@ -203,12 +204,26 @@ const staleCheckrunCleanupSchema = z.object({
203
204
  jobNames: z.array(z.string())
204
205
  }))
205
206
  });
206
- /** Periodic OTel metrics push from orchestrator to Platform for centralized observability. */
207
+ /**
208
+ * Periodic OTel metrics push from orchestrator to Platform for centralized observability.
209
+ *
210
+ * Schema bounds are the first line of defence against pollution of the
211
+ * Platform's monitoring system: a malformed or hostile push fails Zod
212
+ * parse at the WS edge and never reaches the aggregator or the Mimir
213
+ * relay. The content-level allow-list (catalog) is enforced one step
214
+ * deeper — see `packages/platform/src/ws/metrics-filter.ts`.
215
+ *
216
+ * Caps:
217
+ * - 2000 metric data points per push (one orch ships ~60 today)
218
+ * - 128-char metric name, 64-char label key, 256-char label value
219
+ * - 15 labels per series (KiCI metrics carry ~5 today)
220
+ * - 30 explicit histogram buckets (largest histogram has 9 boundaries)
221
+ */
207
222
  const orchMetricsSchema = z.object({
208
223
  type: z.literal("orch.metrics"),
209
- messageId: z.string(),
224
+ messageId: z.string().max(128),
210
225
  metrics: z.array(z.object({
211
- name: z.string(),
226
+ name: z.string().min(1).max(128),
212
227
  type: z.enum([
213
228
  "counter",
214
229
  "histogram",
@@ -216,14 +231,14 @@ const orchMetricsSchema = z.object({
216
231
  "upDownCounter"
217
232
  ]),
218
233
  value: z.number().optional(),
219
- labels: z.record(z.string(), z.string()).optional(),
234
+ labels: z.record(z.string().max(64), z.string().max(256)).refine((m) => Object.keys(m).length <= 15, { message: "metric carries more than 15 labels" }).optional(),
220
235
  buckets: z.array(z.object({
221
236
  le: z.number(),
222
237
  count: z.number()
223
- })).optional(),
238
+ })).max(30).optional(),
224
239
  count: z.number().optional(),
225
240
  sum: z.number().optional()
226
- })),
241
+ })).max(2e3),
227
242
  timestamp: z.number()
228
243
  });
229
244
  /**
@@ -279,6 +294,19 @@ const cacheStatsSchema = z.object({
279
294
  cacheType: z.enum(["source", "dep"]),
280
295
  hit: z.boolean()
281
296
  });
297
+ /**
298
+ * Runtime broadcast of an updated dashboard-write policy. Carries the
299
+ * orch's full capabilities object (same shape as `orchCapabilitiesSchema`
300
+ * via `auth.request`) so Platform's per-org cache can be replaced
301
+ * wholesale rather than merged. Emitted by the orch whenever an
302
+ * operator flips a switch via `kici-admin org-settings dashboard-writes`;
303
+ * Platform receives it, updates its cache, and re-broadcasts the
304
+ * relevant subset to any connected dashboard SPA sessions.
305
+ */
306
+ const orchCapabilitiesUpdateSchema = z.object({
307
+ type: z.literal("orch.capabilities.update"),
308
+ capabilities: orchCapabilitiesSchema
309
+ });
282
310
  /** All messages that flow from Platform to Orchestrator.
283
311
  *
284
312
  * The single-frame `webhookRelaySchema` is intentionally NOT a member of this
@@ -345,6 +373,10 @@ const platformToOrchestratorMessageSchema = z.discriminatedUnion("type", [
345
373
  dashboardEventLogListRequestSchema,
346
374
  dashboardEventLogDetailRequestSchema,
347
375
  dashboardEventLogPayloadStreamRequestSchema,
376
+ dashboardEventDlqListRequestSchema,
377
+ dashboardEventDlqCountRequestSchema,
378
+ dashboardEventDlqRetryRequestSchema,
379
+ dashboardEventDlqDiscardRequestSchema,
348
380
  globalWorkflowsGetRequestSchema,
349
381
  globalWorkflowsUpdateRequestSchema,
350
382
  dashboardAccessLogListRequestSchema
@@ -364,6 +396,7 @@ const orchestratorToPlatformMessageSchema = z.discriminatedUnion("type", [
364
396
  stepStatusForwardSchema,
365
397
  jobStatusForwardSchema,
366
398
  stateReplaySchema,
399
+ orchCapabilitiesUpdateSchema,
367
400
  sourceRegistrationSchema,
368
401
  sourceDeregisterSchema,
369
402
  cacheStatsSchema,
@@ -374,6 +407,6 @@ const orchestratorToPlatformMessageSchema = z.discriminatedUnion("type", [
374
407
  orchMetricsSchema
375
408
  ]);
376
409
  //#endregion
377
- export { WEBHOOK_RELAY_CHUNK_SIZE, WEBHOOK_RELAY_MAX_BODY_BYTES, WebhookRelayResult, cacheStatsSchema, executionEventSchema, logChunkSchema, orchMetricsSchema, orchestratorToPlatformMessageSchema, peerDiscoverSchema, peerUpdateSchema, platformToOrchestratorMessageSchema, staleCheckrunCleanupSchema, trustPolicyUpdateSchema, webhookAckSchema, webhookRelayChunkSchema, webhookRelaySchema, webhookRelayStartSchema };
410
+ export { WEBHOOK_RELAY_CHUNK_SIZE, WEBHOOK_RELAY_MAX_BODY_BYTES, WebhookRelayResult, cacheStatsSchema, executionEventSchema, logChunkSchema, orchCapabilitiesUpdateSchema, orchMetricsSchema, orchestratorToPlatformMessageSchema, peerDiscoverSchema, peerUpdateSchema, platformToOrchestratorMessageSchema, staleCheckrunCleanupSchema, trustPolicyUpdateSchema, webhookAckSchema, webhookRelayChunkSchema, webhookRelaySchema, webhookRelayStartSchema };
378
411
 
379
412
  //# sourceMappingURL=platform-orchestrator.js.map
@@ -57,6 +57,8 @@ export declare const sourceRegistrationSchema: z.ZodObject<{
57
57
  }>;
58
58
  }, z.core.$strip>>;
59
59
  instanceId: z.ZodOptional<z.ZodString>;
60
+ clusterName: z.ZodOptional<z.ZodString>;
61
+ clusterId: z.ZodOptional<z.ZodString>;
60
62
  address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
61
63
  version: z.ZodOptional<z.ZodString>;
62
64
  mode: z.ZodOptional<z.ZodEnum<{
@@ -57,6 +57,27 @@ const sourceRegistrationSchema = z.object({
57
57
  })),
58
58
  /** Orchestrator cluster instance ID for peer correlation. */
59
59
  instanceId: z.string().optional(),
60
+ /**
61
+ * Human-friendly cluster name resolved on orch boot (`cluster_meta.cluster_name`).
62
+ * Used by Platform to populate the per-orch dashboard URL segment
63
+ * (`/orgs/:cId/orchestrators/:clusterName/...`). Validation happens
64
+ * Platform-side via `clusterNameSchema`. Platform accepts N
65
+ * connected orchestrators per `(org_id, cluster_name)` — HA-cluster
66
+ * siblings share one cluster identity — and the dashboard listing
67
+ * dedupes by cluster name server-side.
68
+ */
69
+ clusterName: z.string().optional(),
70
+ /**
71
+ * Orchestrator DB identifier (UUID, seeded by orch migration 001 in
72
+ * `cluster_meta` key `'cluster_id'`). Lets Platform distinguish two
73
+ * different orchestrator clusters that accidentally share the same
74
+ * `clusterName` in one org: every coord in an HA cluster shares the
75
+ * same orch DB and therefore the same `clusterId`, while two unrelated
76
+ * clusters carry distinct UUIDs. Optional — older orchestrators that
77
+ * haven't been redeployed yet won't publish it, in which case Platform
78
+ * skips the cross-cluster collision warn for that connection.
79
+ */
80
+ clusterId: z.string().uuid().optional(),
60
81
  /** Reachable address for peer-to-peer connections (from KICI_CLUSTER_ADDRESS env var). */
61
82
  address: z.string().nullable().optional(),
62
83
  /** Orchestrator version (e.g. "0.0.1"). Optional for backward compatibility with older orchestrators. */
@@ -25,6 +25,7 @@ import { z } from 'zod';
25
25
  * Access values: RegisterableTriggerType.enum.kici_event, etc.
26
26
  */
27
27
  export declare const RegisterableTriggerType: z.ZodEnum<{
28
+ dispatch: "dispatch";
28
29
  status: "status";
29
30
  generic_webhook: "generic_webhook";
30
31
  pr: "pr";
@@ -34,7 +35,6 @@ export declare const RegisterableTriggerType: z.ZodEnum<{
34
35
  review: "review";
35
36
  review_comment: "review_comment";
36
37
  release: "release";
37
- dispatch: "dispatch";
38
38
  create: "create";
39
39
  delete: "delete";
40
40
  workflow_run: "workflow_run";
@@ -23,6 +23,12 @@ export declare const WS_CLOSE_INTERNAL_ERROR = 4006;
23
23
  export declare const WS_CLOSE_AGENT_AUTH_FAILED = 4010;
24
24
  /** The connection was closed because the organization has reached its plan limit. */
25
25
  export declare const WS_CLOSE_PLAN_LIMIT = 4020;
26
+ /**
27
+ * The orchestrator's reported `cluster_name` collides with another
28
+ * already-connected orchestrator in the same org. Operator must rename
29
+ * via `kici-admin cluster-name set <name>` before reconnecting.
30
+ */
31
+ export declare const WS_CLOSE_CLUSTER_NAME_CONFLICT = 4011;
26
32
  /** The connection was closed because the requested run was not found. */
27
33
  export declare const WS_CLOSE_RUN_NOT_FOUND = 4030;
28
34
  //# sourceMappingURL=close-codes.d.ts.map
@@ -25,9 +25,15 @@ const WS_CLOSE_INTERNAL_ERROR = 4006;
25
25
  const WS_CLOSE_AGENT_AUTH_FAILED = 4010;
26
26
  /** The connection was closed because the organization has reached its plan limit. */
27
27
  const WS_CLOSE_PLAN_LIMIT = 4020;
28
+ /**
29
+ * The orchestrator's reported `cluster_name` collides with another
30
+ * already-connected orchestrator in the same org. Operator must rename
31
+ * via `kici-admin cluster-name set <name>` before reconnecting.
32
+ */
33
+ const WS_CLOSE_CLUSTER_NAME_CONFLICT = 4011;
28
34
  /** The connection was closed because the requested run was not found. */
29
35
  const WS_CLOSE_RUN_NOT_FOUND = 4030;
30
36
  //#endregion
31
- export { 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 };
37
+ export { 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 };
32
38
 
33
39
  //# sourceMappingURL=close-codes.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kici-dev/engine",
3
- "version": "0.1.2",
3
+ "version": "0.1.5",
4
4
  "description": "Shared business logic for the KiCI CI/CD stack: protocol, triggers, state machine, and provider interfaces used by the Platform relay, orchestrator, and compiler.",
5
5
  "keywords": [
6
6
  "kici",
@@ -29,7 +29,6 @@
29
29
  "sbom.spdx.json"
30
30
  ],
31
31
  "publishConfig": {
32
- "registry": "https://registry.npmjs.org/",
33
32
  "access": "public"
34
33
  },
35
34
  "main": "dist/index.js",
@@ -51,9 +50,21 @@
51
50
  "import": "./dist/protocol/dashboard-global-workflows.js",
52
51
  "types": "./dist/protocol/dashboard-global-workflows.d.ts"
53
52
  },
53
+ "./protocol/dashboard-write-operations": {
54
+ "import": "./dist/protocol/dashboard-write-operations.js",
55
+ "types": "./dist/protocol/dashboard-write-operations.d.ts"
56
+ },
57
+ "./protocol/cluster-name": {
58
+ "import": "./dist/protocol/cluster-name.js",
59
+ "types": "./dist/protocol/cluster-name.d.ts"
60
+ },
54
61
  "./metrics/catalog": {
55
62
  "import": "./dist/metrics/metric-catalog.generated.js",
56
63
  "types": "./dist/metrics/metric-catalog.generated.d.ts"
64
+ },
65
+ "./metrics/catalog-policy": {
66
+ "import": "./dist/metrics/catalog-policy.js",
67
+ "types": "./dist/metrics/catalog-policy.d.ts"
57
68
  }
58
69
  },
59
70
  "dependencies": {
package/sbom.spdx.json CHANGED
@@ -2,10 +2,10 @@
2
2
  "spdxVersion": "SPDX-2.3",
3
3
  "dataLicense": "CC0-1.0",
4
4
  "SPDXID": "SPDXRef-DOCUMENT",
5
- "name": "@kici-dev/engine@0.1.2",
6
- "documentNamespace": "https://kici.dev/sbom/%40kici-dev%2Fengine/0.1.2/56f22633-645d-449b-9f23-47a5f4a15afe",
5
+ "name": "@kici-dev/engine@0.1.5",
6
+ "documentNamespace": "https://kici.dev/sbom/%40kici-dev%2Fengine/0.1.5/63e62f7b-3fc8-4c73-862d-0b7e86eab0ae",
7
7
  "creationInfo": {
8
- "created": "2026-05-15T11:43:44Z",
8
+ "created": "2026-05-25T13:20:28Z",
9
9
  "creators": [
10
10
  "Tool: kici-sbom-generator"
11
11
  ]
@@ -54,7 +54,7 @@
54
54
  {
55
55
  "SPDXID": "SPDXRef-RootPackage",
56
56
  "name": "@kici-dev/engine",
57
- "versionInfo": "0.1.2",
57
+ "versionInfo": "0.1.5",
58
58
  "downloadLocation": "NOASSERTION",
59
59
  "filesAnalyzed": false,
60
60
  "licenseConcluded": "NOASSERTION",
@@ -65,7 +65,7 @@
65
65
  {
66
66
  "referenceCategory": "PACKAGE-MANAGER",
67
67
  "referenceType": "purl",
68
- "referenceLocator": "pkg:npm/%40kici-dev/engine@0.1.2"
68
+ "referenceLocator": "pkg:npm/%40kici-dev/engine@0.1.5"
69
69
  }
70
70
  ],
71
71
  "description": "Shared business logic for the KiCI CI/CD stack: protocol, triggers, state machine, and provider interfaces used by the Platform relay, orchestrator, and compiler.",