@kici-dev/orchestrator 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1363,7 +1363,7 @@ var logger$147, SOFTWARE_VERSION$1, PeerClient$1;
1363
1363
  var init_peer_client = __esmMin((() => {
1364
1364
  init_peer_crypto();
1365
1365
  logger$147 = createLogger({ prefix: "peer-client" });
1366
- SOFTWARE_VERSION$1 = "0.10.0";
1366
+ SOFTWARE_VERSION$1 = "0.11.0";
1367
1367
  PeerClient$1 = class {
1368
1368
  ws = null;
1369
1369
  _state = "disconnected";
@@ -3377,7 +3377,7 @@ var init_peer_handler = __esmMin((() => {
3377
3377
  init_peer_crypto();
3378
3378
  init_join_token();
3379
3379
  logger$145 = createLogger({ prefix: "peer-handler" });
3380
- SOFTWARE_VERSION = "0.10.0";
3380
+ SOFTWARE_VERSION = "0.11.0";
3381
3381
  RATE_LIMIT_MAX = 5;
3382
3382
  RATE_LIMIT_WINDOW_MS = 6e4;
3383
3383
  }));
@@ -63401,6 +63401,10 @@ var init_variable_store = __esmMin((() => {
63401
63401
  async listSourceOverrides(orgId, contextId, routingKey) {
63402
63402
  return this.db.selectFrom("context_source_overrides").selectAll().where("org_id", "=", orgId).where("context_id", "=", contextId).where("routing_key", "=", routingKey).execute();
63403
63403
  }
63404
+ /** List every source override in a context, across all routing keys. */
63405
+ async listAllSourceOverrides(orgId, contextId) {
63406
+ return this.db.selectFrom("context_source_overrides").selectAll().where("org_id", "=", orgId).where("context_id", "=", contextId).orderBy("routing_key", "asc").orderBy("key", "asc").execute();
63407
+ }
63404
63408
  /** Upsert a source override. */
63405
63409
  async setSourceOverride(orgId, contextId, routingKey, key, value) {
63406
63410
  await this.db.insertInto("context_source_overrides").values({
@@ -63464,6 +63468,12 @@ var init_variable_store = __esmMin((() => {
63464
63468
  * GET /api/v1/admin/contexts/:name/variables?orgId=<id> — list org-level variables
63465
63469
  * PUT /api/v1/admin/contexts/:name/variables/:key?orgId=<id> — upsert variable
63466
63470
  * DELETE /api/v1/admin/contexts/:name/variables/:key?orgId=<id> — delete variable
63471
+ * GET /api/v1/admin/contexts/:name/source-overrides?orgId=<id>[&routingKey=<k>]
63472
+ * — list per-source overrides
63473
+ * PUT /api/v1/admin/contexts/:name/source-overrides/:routingKey/:key?orgId=<id>
63474
+ * — upsert a source override
63475
+ * DELETE /api/v1/admin/contexts/:name/source-overrides/:routingKey/:key?orgId=<id>
63476
+ * — delete a source override
63467
63477
  *
63468
63478
  * Backs the `kici-admin context` dual-mode CLI. Offline (direct-DB) mode
63469
63479
  * bypasses this router entirely — the CLI calls `*Direct` helpers from
@@ -63793,13 +63803,86 @@ function createAdminContextRoutes(deps) {
63793
63803
  return handleError$5(c, err);
63794
63804
  }
63795
63805
  });
63806
+ registerSourceOverrideRoutes(app, deps, envStore, variableStore);
63796
63807
  return app;
63797
63808
  }
63809
+ /**
63810
+ * Per-source variable overrides — the operator path for the dashboard's
63811
+ * `contexts.source_overrides.*` writes. The context is addressed by name with
63812
+ * `?orgId=`, like the variable routes; the stores key it by id.
63813
+ */
63814
+ function registerSourceOverrideRoutes(app, deps, envStore, variableStore) {
63815
+ app.get("/contexts/:name/source-overrides", async (c) => {
63816
+ try {
63817
+ deps.rbac.requirePermission(c.get("role"), "secret.read");
63818
+ const orgId = c.req.query("orgId");
63819
+ const routingKey = c.req.query("routingKey");
63820
+ const name = c.req.param("name");
63821
+ if (!orgId) return c.json({ error: "orgId required" }, 400);
63822
+ const env = await envStore.getByName(orgId, name);
63823
+ if (!env) return c.json({ error: `context not found (org=${orgId}, name=${name})` }, 404);
63824
+ const overrides = routingKey ? await variableStore.listSourceOverrides(orgId, env.id, routingKey) : await variableStore.listAllSourceOverrides(orgId, env.id);
63825
+ return c.json({ overrides: overrides.map((o) => ({
63826
+ routing_key: o.routing_key,
63827
+ key: o.key,
63828
+ value: o.value,
63829
+ updated_at: o.updated_at
63830
+ })) });
63831
+ } catch (err) {
63832
+ return handleError$5(c, err);
63833
+ }
63834
+ });
63835
+ app.put("/contexts/:name/source-overrides/:routingKey/:key", async (c) => {
63836
+ try {
63837
+ deps.rbac.requirePermission(c.get("role"), "secret.write");
63838
+ const body = setSourceOverrideSchema.parse(await c.req.json());
63839
+ const orgId = c.req.query("orgId");
63840
+ const name = c.req.param("name");
63841
+ const routingKey = c.req.param("routingKey");
63842
+ const key = c.req.param("key");
63843
+ if (!orgId) return c.json({ error: "orgId required" }, 400);
63844
+ const env = await envStore.getByName(orgId, name);
63845
+ if (!env) return c.json({ error: `context not found (org=${orgId}, name=${name})` }, 404);
63846
+ await variableStore.setSourceOverride(orgId, env.id, routingKey, key, body.value);
63847
+ logger$53.info("context source override set", {
63848
+ orgId,
63849
+ context: name,
63850
+ routingKey,
63851
+ key
63852
+ });
63853
+ return c.json({ set: true });
63854
+ } catch (err) {
63855
+ return handleError$5(c, err);
63856
+ }
63857
+ });
63858
+ app.delete("/contexts/:name/source-overrides/:routingKey/:key", async (c) => {
63859
+ try {
63860
+ deps.rbac.requirePermission(c.get("role"), "secret.delete");
63861
+ const orgId = c.req.query("orgId");
63862
+ const name = c.req.param("name");
63863
+ const routingKey = c.req.param("routingKey");
63864
+ const key = c.req.param("key");
63865
+ if (!orgId) return c.json({ error: "orgId required" }, 400);
63866
+ const env = await envStore.getByName(orgId, name);
63867
+ if (!env) return c.json({ error: `context not found (org=${orgId}, name=${name})` }, 404);
63868
+ await variableStore.deleteSourceOverride(orgId, env.id, routingKey, key);
63869
+ logger$53.info("context source override deleted", {
63870
+ orgId,
63871
+ context: name,
63872
+ routingKey,
63873
+ key
63874
+ });
63875
+ return c.json({ deleted: true });
63876
+ } catch (err) {
63877
+ return handleError$5(c, err);
63878
+ }
63879
+ });
63880
+ }
63798
63881
  function handleError$5(c, err) {
63799
63882
  logger$53.error("admin-contexts route failed", { error: toErrorMessage(err) });
63800
63883
  return handleAdminError(c, err, logger$53);
63801
63884
  }
63802
- var logger$53, repoPatternsSchema, createContextSchema, bindSchema, setPolicySchema, createTemplateSchema, setVariableSchema;
63885
+ var logger$53, repoPatternsSchema, createContextSchema, bindSchema, setPolicySchema, createTemplateSchema, setVariableSchema, setSourceOverrideSchema;
63803
63886
  var init_admin_contexts = __esmMin((() => {
63804
63887
  init_context_store();
63805
63888
  init_binding_store();
@@ -63855,6 +63938,7 @@ var init_admin_contexts = __esmMin((() => {
63855
63938
  value: z.string(),
63856
63939
  locked: z.boolean().optional()
63857
63940
  });
63941
+ setSourceOverrideSchema = z.object({ value: z.string() });
63858
63942
  }));
63859
63943
  //#endregion
63860
63944
  //#region src/routes/admin-queue-execution.ts
@@ -64258,6 +64342,18 @@ function createAdminRoutes(deps) {
64258
64342
  if (scopeError) return c.json({ error: scopeError }, 400);
64259
64343
  if (!resolved.store.createScope) return c.json({ error: `Backend '${resolved.backendName}' does not support scope creation` }, 400);
64260
64344
  await resolved.store.createScope(parsed.orgId, resolved.path);
64345
+ await deps.auditLogger.log({
64346
+ action: "createScope",
64347
+ contextName: parsed.scope,
64348
+ routingKey: null,
64349
+ secretKeys: null,
64350
+ outcome: "allowed",
64351
+ runId: null,
64352
+ jobId: null,
64353
+ userId: c.get("userId"),
64354
+ role: c.get("role"),
64355
+ metadata: { orgId: parsed.orgId }
64356
+ });
64261
64357
  return c.json({ created: true }, 200);
64262
64358
  } catch (err) {
64263
64359
  return handleError$3(c, err);
@@ -64282,6 +64378,21 @@ function createAdminRoutes(deps) {
64282
64378
  if (scopeError) return c.json({ error: scopeError }, 400);
64283
64379
  if (!from.store.renameScope) return c.json({ error: `Backend '${from.backendName}' does not support scope rename` }, 400);
64284
64380
  await from.store.renameScope(parsed.orgId, from.path, to.path);
64381
+ await deps.auditLogger.log({
64382
+ action: "renameScope",
64383
+ contextName: parsed.oldScope,
64384
+ routingKey: null,
64385
+ secretKeys: null,
64386
+ outcome: "allowed",
64387
+ runId: null,
64388
+ jobId: null,
64389
+ userId: c.get("userId"),
64390
+ role: c.get("role"),
64391
+ metadata: {
64392
+ orgId: parsed.orgId,
64393
+ newScope: parsed.newScope
64394
+ }
64395
+ });
64285
64396
  return c.json({ renamed: true }, 200);
64286
64397
  } catch (err) {
64287
64398
  return handleError$3(c, err);
@@ -64297,6 +64408,18 @@ function createAdminRoutes(deps) {
64297
64408
  const resolved = await routeScope(scope);
64298
64409
  if (!resolved.store.deleteScope) return c.json({ error: `Backend '${resolved.backendName}' does not support scope deletion` }, 400);
64299
64410
  await resolved.store.deleteScope(orgId, resolved.path);
64411
+ await deps.auditLogger.log({
64412
+ action: "deleteScope",
64413
+ contextName: scope,
64414
+ routingKey: null,
64415
+ secretKeys: null,
64416
+ outcome: "allowed",
64417
+ runId: null,
64418
+ jobId: null,
64419
+ userId: c.get("userId"),
64420
+ role: c.get("role"),
64421
+ metadata: { orgId }
64422
+ });
64300
64423
  return c.json({ deleted: true }, 200);
64301
64424
  } catch (err) {
64302
64425
  return handleError$3(c, err);
@@ -66731,8 +66854,8 @@ var init_satisfiability = __esmMin((() => {
66731
66854
  /**
66732
66855
  * Admin API routes for workflow registration management.
66733
66856
  *
66734
- * Provides endpoints for listing, inspecting, refreshing, and deleting
66735
- * workflow registrations. All routes are protected by Bearer token
66857
+ * Provides endpoints for listing, inspecting, refreshing, disabling and
66858
+ * deleting workflow registrations. All routes are protected by Bearer token
66736
66859
  * authentication via the existing admin auth middleware pattern.
66737
66860
  */
66738
66861
  /**
@@ -66865,6 +66988,31 @@ function createAdminRegistrationRoutes(deps) {
66865
66988
  return handleError$1(c, err);
66866
66989
  }
66867
66990
  });
66991
+ app.patch("/api/v1/admin/registrations/:id/disable", async (c) => {
66992
+ try {
66993
+ deps.rbac.requirePermission(c.get("role"), "context.update");
66994
+ const id = c.req.param("id");
66995
+ const parsed = disableSchema.parse(await c.req.json());
66996
+ const existing = await deps.registrationStore.getById(id);
66997
+ if (!existing) return c.json({ error: "Registration not found" }, 404);
66998
+ const denied = enforceRoutingKeyScope(c, existing.routing_key);
66999
+ if (denied) return denied;
67000
+ if (!await deps.registrationStore.setDisabled(id, parsed.disabled)) return c.json({ error: "Registration not found" }, 404);
67001
+ const registryVersion = await deps.registrationStore.bumpVersion();
67002
+ await deps.registrationIndex.refreshIfNeeded(registryVersion);
67003
+ logger$45.info("Registration disabled flag set", {
67004
+ id,
67005
+ disabled: parsed.disabled,
67006
+ registryVersion
67007
+ });
67008
+ return c.json({
67009
+ disabled: parsed.disabled,
67010
+ registryVersion
67011
+ }, 200);
67012
+ } catch (err) {
67013
+ return handleError$1(c, err);
67014
+ }
67015
+ });
66868
67016
  app.delete("/api/v1/admin/registrations/:id", async (c) => {
66869
67017
  try {
66870
67018
  deps.rbac.requirePermission(c.get("role"), "context.delete");
@@ -66893,7 +67041,7 @@ function createAdminRegistrationRoutes(deps) {
66893
67041
  function handleError$1(c, err) {
66894
67042
  return handleAdminError(c, err, logger$45);
66895
67043
  }
66896
- var logger$45, refreshSchema, registerManualSchema;
67044
+ var logger$45, refreshSchema, disableSchema, registerManualSchema;
66897
67045
  var init_admin_registrations = __esmMin((() => {
66898
67046
  init_context_store();
66899
67047
  init_satisfiability();
@@ -66905,6 +67053,7 @@ var init_admin_registrations = __esmMin((() => {
66905
67053
  routingKey: z.string().min(1),
66906
67054
  repoIdentifier: z.string().min(1)
66907
67055
  });
67056
+ disableSchema = z.object({ disabled: z.boolean() });
66908
67057
  registerManualSchema = z.object({
66909
67058
  lockFileContents: z.string().min(1),
66910
67059
  repoIdentifier: z.string().min(1),
@@ -69094,14 +69243,14 @@ var init_admin_config = __esmMin((() => {
69094
69243
  function createHealthRoutes$1(deps = {}) {
69095
69244
  return createHealthRoutes({
69096
69245
  livenessInfo: () => ({
69097
- version: "0.10.0",
69098
- buildDate: "2026-09-25T02:21:19.808Z",
69099
- buildCommit: "4a01d4919",
69100
- sdkVersion: "0.10.0",
69246
+ version: "0.11.0",
69247
+ buildDate: "2026-09-25T15:27:17.455Z",
69248
+ buildCommit: "399bc9f6b",
69249
+ sdkVersion: "0.11.0",
69101
69250
  sdkBundleHash: "b012bd8bace3df9e574252bf290c652bc39766da617acf51729a08586756266d",
69102
- sharedVersion: "0.10.0",
69251
+ sharedVersion: "0.11.0",
69103
69252
  sharedBundleHash: "c43dafa78ecdfdff530b94f7f0629d297ce9d9ed71b06b3cb893db87b00aaea7",
69104
- engineVersion: "0.10.0",
69253
+ engineVersion: "0.11.0",
69105
69254
  engineBundleHash: "0253acfa2150e263bde9698a0d8e95950cd1d94d95ae5ac3b94180bd9f139d0a"
69106
69255
  }),
69107
69256
  readinessCheck: deps.db ? async () => {
@@ -69137,7 +69286,7 @@ function createCapabilitiesRoutes() {
69137
69286
  const app = new Hono();
69138
69287
  app.get("/api/v1/capabilities", (c) => {
69139
69288
  const manifest = {
69140
- orchestratorVersion: "0.10.0",
69289
+ orchestratorVersion: "0.11.0",
69141
69290
  protocolVersion: PROTOCOL_VERSION,
69142
69291
  minProtocolVersion: MIN_PROTOCOL_VERSION
69143
69292
  };
@@ -72087,7 +72236,7 @@ var init_app = __esmMin((() => {
72087
72236
  init_log_chunk_sink();
72088
72237
  init_agent_metrics_aggregator();
72089
72238
  logger$32 = createLogger({ prefix: "app" });
72090
- ORCHESTRATOR_VERSION$2 = "0.10.0";
72239
+ ORCHESTRATOR_VERSION$2 = "0.11.0";
72091
72240
  SourceLocationStore = class {
72092
72241
  cache = /* @__PURE__ */ new Map();
72093
72242
  key(workflowName, jobName) {
@@ -80324,7 +80473,7 @@ var init_audit_logger = __esmMin((() => {
80324
80473
  * engine's `shouldRecordSecretResolve` helper) since they're written
80325
80474
  * once per JOB-step secret resolution and dwarf every other action's
80326
80475
  * volume. Denied resolves and every other action (`setSecret`,
80327
- * `deleteSecret`, `rotateKey`, `secret-outputs.reveal`) bypass the
80476
+ * `deleteSecret`, the scope writes, `rotateKey`, `secret-outputs.reveal`) bypass the
80328
80477
  * sampler — they are transactional with the mutation and must always
80329
80478
  * land.
80330
80479
  *
@@ -89526,13 +89675,13 @@ var init_worker_core = __esmMin((() => {
89526
89675
  init_worker_outbox_relay();
89527
89676
  init_reroute_dispatch();
89528
89677
  init_app_on_error();
89529
- ORCHESTRATOR_VERSION$1 = "0.10.0";
89530
- WORKER_BUILD_COMMIT = "4a01d4919";
89531
- WORKER_SDK_VERSION = "0.10.0";
89678
+ ORCHESTRATOR_VERSION$1 = "0.11.0";
89679
+ WORKER_BUILD_COMMIT = "399bc9f6b";
89680
+ WORKER_SDK_VERSION = "0.11.0";
89532
89681
  WORKER_SDK_BUNDLE_HASH = "b012bd8bace3df9e574252bf290c652bc39766da617acf51729a08586756266d";
89533
- WORKER_SHARED_VERSION = "0.10.0";
89682
+ WORKER_SHARED_VERSION = "0.11.0";
89534
89683
  WORKER_SHARED_BUNDLE_HASH = "c43dafa78ecdfdff530b94f7f0629d297ce9d9ed71b06b3cb893db87b00aaea7";
89535
- WORKER_ENGINE_VERSION = "0.10.0";
89684
+ WORKER_ENGINE_VERSION = "0.11.0";
89536
89685
  WORKER_ENGINE_BUNDLE_HASH = "0253acfa2150e263bde9698a0d8e95950cd1d94d95ae5ac3b94180bd9f139d0a";
89537
89686
  logger$2 = createLogger({ prefix: "worker" });
89538
89687
  DRAIN_TIMEOUT_MS = 3e5;
@@ -89557,13 +89706,13 @@ var init_worker_core = __esmMin((() => {
89557
89706
  * Graceful shutdown:
89558
89707
  * agent WS -> heartbeat -> HTTP -> DB
89559
89708
  */
89560
- const ORCHESTRATOR_VERSION = "0.10.0";
89561
- const BUILD_COMMIT = "4a01d4919";
89562
- const SDK_VERSION = "0.10.0";
89709
+ const ORCHESTRATOR_VERSION = "0.11.0";
89710
+ const BUILD_COMMIT = "399bc9f6b";
89711
+ const SDK_VERSION = "0.11.0";
89563
89712
  const SDK_BUNDLE_HASH = "b012bd8bace3df9e574252bf290c652bc39766da617acf51729a08586756266d";
89564
- const SHARED_VERSION = "0.10.0";
89713
+ const SHARED_VERSION = "0.11.0";
89565
89714
  const SHARED_BUNDLE_HASH = "c43dafa78ecdfdff530b94f7f0629d297ce9d9ed71b06b3cb893db87b00aaea7";
89566
- const ENGINE_VERSION = "0.10.0";
89715
+ const ENGINE_VERSION = "0.11.0";
89567
89716
  const ENGINE_BUNDLE_HASH = "0253acfa2150e263bde9698a0d8e95950cd1d94d95ae5ac3b94180bd9f139d0a";
89568
89717
  const otelSdk = initTelemetry({
89569
89718
  serviceName: "kici-orchestrator",
@@ -1,7 +1,7 @@
1
1
  {
2
- "version": "0.10.0",
2
+ "version": "0.11.0",
3
3
  "images": {
4
- "kici-agent": "sha256:f4b278ff8694016ad46b741b199b7363ce083ccef892f62ad640576e8e7c275e",
5
- "kici-orchestrator": "sha256:4bb360a18d6193cd0fed233541bee6ba1fa44c9a1052b4a26c4578426d45c9fa"
4
+ "kici-agent": "sha256:3a7a387964836acf6f89bdd31a4ee285383349926db21ef90d43905a5bce1dd4",
5
+ "kici-orchestrator": "sha256:8ee2909b622f813348506589c25b8b7d4ef2333604e1bc919e15016304822a27"
6
6
  }
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kici-dev/orchestrator",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Customer-deployable orchestrator for the KiCI CI/CD stack. Receives webhook events (direct or via Platform relay), matches triggers against the lock file, and dispatches jobs to connected agents.",
5
5
  "keywords": [
6
6
  "ci",
@@ -90,8 +90,8 @@
90
90
  "ws": "^8.21.3",
91
91
  "yaml": "^2.9.1",
92
92
  "zod": "^4.6.5",
93
- "@kici-dev/engine": "0.10.0",
94
- "@kici-dev/shared": "0.10.0"
93
+ "@kici-dev/engine": "0.11.0",
94
+ "@kici-dev/shared": "0.11.0"
95
95
  },
96
96
  "kici": {
97
97
  "metrics": {
@@ -106,7 +106,7 @@
106
106
  "@types/dockerode": "^4.0.1",
107
107
  "@types/ws": "^8.18.1",
108
108
  "kysely-ctl": "^0.21.0",
109
- "@kici-dev/agent": "0.10.0"
109
+ "@kici-dev/agent": "0.11.0"
110
110
  },
111
111
  "scripts": {
112
112
  "build": "node ../../scripts/build-service.mjs && tsc --emitDeclarationOnly",