@camstack/addon-pipeline-orchestrator 1.2.664 → 1.2.665

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.
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import { createHash, randomUUID } from "node:crypto";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
- //#region ../types/dist/event-category-BmPm98n0.mjs
5
+ //#region ../types/dist/event-category-78tcBemo.mjs
6
6
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
7
7
  EventCategory["SystemBoot"] = "system.boot";
8
8
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -123,6 +123,23 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
123
123
  */
124
124
  EventCategory["AddonLoadRecovered"] = "addon.load-recovered";
125
125
  /**
126
+ * An addon is RUNNING although its installed package is below what the
127
+ * running server requires (`camstack.requires.addons` of the server, or the
128
+ * addon's own `requires.server`). Raised once per streak by the unsupported-
129
+ * addon tracker, on the hub and on agents; AlertCenter turns it into one
130
+ * operator alert per node and package. The addon is never held back for it.
131
+ *
132
+ * Payload: `{ packageName, addonId, nodeId, installedVersion, requiredMinimum, serverVersion, unmet }`.
133
+ */
134
+ EventCategory["AddonUnsupportedVersion"] = "addon.unsupported-version";
135
+ /**
136
+ * The package of an {@link AddonUnsupportedVersion} alert reached a supported
137
+ * version, or is no longer installed on the node. AlertCenter dismisses the matching alert.
138
+ *
139
+ * Payload: `{ packageName, addonId, nodeId }`.
140
+ */
141
+ EventCategory["AddonUnsupportedResolved"] = "addon.unsupported-resolved";
142
+ /**
126
143
  * Monitor scheduled the next retry for a failed addon. Transient —
127
144
  * surfaced to the UI for live-updating the "next retry in Ns"
128
145
  * countdown on the Addons page row, NOT persisted as an alert.
@@ -233,7 +250,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
233
250
  EventCategory["ProcessRestarted"] = "process.restarted";
234
251
  /**
235
252
  * The SET of storage locations changed — one was created, edited, enabled,
236
- * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
253
+ * disabled or deleted through the location instances or the forced-delete action.
237
254
  *
238
255
  * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
239
256
  * it must also converge on its own periodic path, because a dropped event
@@ -5984,7 +6001,7 @@ var ZodIssueCode = {
5984
6001
  var ZodFirstPartyTypeKind;
5985
6002
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5986
6003
  //#endregion
5987
- //#region ../types/dist/sleep-D7ZKm4nb.mjs
6004
+ //#region ../types/dist/sleep-CQP-REJp.mjs
5988
6005
  /**
5989
6006
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5990
6007
  * window to float samples (D455).
@@ -6341,6 +6358,59 @@ Object.fromEntries([
6341
6358
  function isValuelessField(field) {
6342
6359
  return field.type === "separator" || field.type === "info" || field.type === "qr-code" || field.type === "button" || field.type === "object-array" || field.type === "widget" || field.type === "addon-action-button" || field.type === "device-action-button" || field.type === "account-sign-in" || field.type === "secret-presence";
6343
6360
  }
6361
+ /**
6362
+ * Base collector: flatten a hydrated `ConfigUISchemaWithValues` into
6363
+ * `key → { value, default }`, recursing through `group` and `sub-tabs`
6364
+ * layout fields. Keeping `value` and `default` SEPARATE (rather than
6365
+ * pre-resolving) lets callers both read the effective value AND detect
6366
+ * overrides (`value` differs from `default`). Structural over `unknown`;
6367
+ * malformed input yields an empty map, never throws.
6368
+ */
6369
+ function collectHydratedFieldEntries(schema) {
6370
+ const out = /* @__PURE__ */ new Map();
6371
+ if (typeof schema !== "object" || schema === null) return out;
6372
+ const sections = schema.sections;
6373
+ if (!Array.isArray(sections)) return out;
6374
+ for (const section of sections) if (typeof section === "object" && section !== null) collectFieldEntriesInto(section.fields, out);
6375
+ return out;
6376
+ }
6377
+ /** Recursive field walker for {@link collectHydratedFieldEntries}. */
6378
+ function collectFieldEntriesInto(fields, into) {
6379
+ if (!Array.isArray(fields)) return;
6380
+ for (const field of fields) {
6381
+ if (typeof field !== "object" || field === null) continue;
6382
+ const type = field.type;
6383
+ if (type === "group") {
6384
+ collectFieldEntriesInto(field.fields, into);
6385
+ continue;
6386
+ }
6387
+ if (type === "sub-tabs") {
6388
+ const tabs = field.tabs;
6389
+ if (Array.isArray(tabs)) {
6390
+ for (const tab of tabs) if (typeof tab === "object" && tab !== null) collectFieldEntriesInto(tab.fields, into);
6391
+ }
6392
+ continue;
6393
+ }
6394
+ const key = field.key;
6395
+ if (typeof key !== "string" || key.length === 0) continue;
6396
+ if (!("value" in field)) continue;
6397
+ into.set(key, {
6398
+ value: field.value,
6399
+ default: field.default
6400
+ });
6401
+ }
6402
+ }
6403
+ /**
6404
+ * Flatten a hydrated settings payload into `key → EFFECTIVE value`
6405
+ * (`value ?? default`). The read-side inverse of `hydrateSchema` for the
6406
+ * common "just give me the resolved values" case. Built on
6407
+ * {@link collectHydratedFieldEntries}.
6408
+ */
6409
+ function collectHydratedFieldValues(schema) {
6410
+ const out = /* @__PURE__ */ new Map();
6411
+ for (const [key, entry] of collectHydratedFieldEntries(schema)) out.set(key, entry.value ?? entry.default);
6412
+ return out;
6413
+ }
6344
6414
  function hydrateSchema(schema, values, options = {}) {
6345
6415
  return {
6346
6416
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
@@ -7146,6 +7216,21 @@ var SCOPED_SETTINGS_SCOPES = [
7146
7216
  "device-defaults",
7147
7217
  "node"
7148
7218
  ];
7219
+ /** The one refusal of a key a scope did not declare. */
7220
+ function assertDeclaredKeys(keys, declared) {
7221
+ const undeclared = keys.filter((key) => !declared.has(key));
7222
+ if (undeclared.length > 0) throw new Error(`scoped settings: [${undeclared.join(", ")}] not declared for this scope (declared: [${[...declared].join(", ")}])`);
7223
+ }
7224
+ /** Build the handle over an addon's scoped read, write and unset. */
7225
+ function createScopedSettings(deps) {
7226
+ return {
7227
+ async get() {
7228
+ return deps.schema.parse(await deps.read());
7229
+ },
7230
+ patch: (patch) => deps.write(Object.fromEntries(Object.entries(patch))),
7231
+ unset: (keys) => deps.unset(keys)
7232
+ };
7233
+ }
7149
7234
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
7150
7235
  var KeychainWriteRefusedError = class extends Error {
7151
7236
  fieldPath;
@@ -7721,7 +7806,16 @@ function createHandle(raw, opts) {
7721
7806
  return blob;
7722
7807
  }
7723
7808
  },
7724
- writeAddonStore: writeAddon
7809
+ writeAddonStore: writeAddon,
7810
+ removeClearedKeys: (keys) => serialize("addon", async () => {
7811
+ const stored = await readStoredAddonBlob(raw);
7812
+ index.seen("addon", stored);
7813
+ const removable = keys.filter((key) => collectSecretMarkerRefs(stored[key]).length === 0);
7814
+ if (removable.length === 0) return;
7815
+ const patch = Object.fromEntries(removable.map((key) => [key, void 0]));
7816
+ await raw.writeAddonStore(patch);
7817
+ index.wrote("addon", patch);
7818
+ })
7725
7819
  };
7726
7820
  }
7727
7821
  /** The context the addon sees, plus the private raw view and write outcome. */
@@ -8266,6 +8360,151 @@ var BaseAddon = class {
8266
8360
  }
8267
8361
  }
8268
8362
  /**
8363
+ * Hook: values layered over the stored ones when the FORM of one scope is served
8364
+ * ({@link getScopedSettings}) — a preview that derives dependent options without writing.
8365
+ * Never applied to {@link ScopedSettings.get} or to a write. `null` ⇒ no overlay.
8366
+ */
8367
+ async scopedSettingsOverlay(_scope, _cap, _nodeId) {
8368
+ return null;
8369
+ }
8370
+ /**
8371
+ * Hook: a write of one scope changed stored values (not called when the store reports no change,
8372
+ * e.g. the write-back of a stored secret). `keys` are the bare field keys of the write, node keys included.
8373
+ */
8374
+ async onScopedSettingsChanged(_scope, _cap, _keys) {}
8375
+ /** Typed handle over the CLUSTER settings `cap` declares (`clusterSettingsSchema`). */
8376
+ clusterSettings(cap, schema) {
8377
+ return this.scopedHandle("cluster", cap, schema);
8378
+ }
8379
+ /** Typed handle over the fleet defaults of the per-device settings `cap` declares. */
8380
+ deviceDefaults(cap, schema) {
8381
+ return this.scopedHandle("device-defaults", cap, schema);
8382
+ }
8383
+ /**
8384
+ * Typed handle over the settings `cap` owns PER NODE. `nodeId` omitted ⇒ the local node. A node
8385
+ * with no row yields the schema defaults — never a bare-key fallback.
8386
+ */
8387
+ nodeSettings(cap, schema, nodeId) {
8388
+ return this.scopedHandle("node", cap, schema, nodeId);
8389
+ }
8390
+ /**
8391
+ * {@link state} for a value that is kept per node: stored under `<key>@<nodeId>`, and the
8392
+ * settings store carries `nodeId` in the row data (D986 §1), so a forgotten node's rows go in one
8393
+ * central delete. `nodeId` omitted ⇒ the local node.
8394
+ */
8395
+ nodeState(key, schema, fallback, nodeId) {
8396
+ this._declaredStateKeys.add(key);
8397
+ return createDurableState({
8398
+ key: nodeScopedKey(key, nodeId ?? this._ctx?.kernel?.localNodeId ?? ""),
8399
+ schema,
8400
+ fallback,
8401
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
8402
+ write: async (patch) => {
8403
+ await this._ctx?.settings?.writeAddonStore(patch);
8404
+ },
8405
+ onParseError: (k, e) => this._ctx?.logger?.warn?.(`durable-state: stored "${k}" failed validation — using fallback`, { meta: {
8406
+ addonId: this._ctx?.id,
8407
+ key: k,
8408
+ error: String(e)
8409
+ } })
8410
+ });
8411
+ }
8412
+ /** The loaded schema `cap` declares for `scope`, or `null`. */
8413
+ async declaredScopedSchema(scope, cap) {
8414
+ await this.loadScopedSchemas(cap);
8415
+ return this.loadedScopedSchemas(cap).find((entry) => entry.scope === scope)?.schema ?? null;
8416
+ }
8417
+ async requireScopedSchema(scope, cap) {
8418
+ const schema = await this.declaredScopedSchema(scope, cap);
8419
+ if (schema === null) throw new Error(`${this.constructor.name}: cap "${cap}" declares no ${scope} settings`);
8420
+ return schema;
8421
+ }
8422
+ scopedKeys(schema) {
8423
+ return new Set(schema.sections.flatMap((section) => collectValueFieldKeys(section.fields)));
8424
+ }
8425
+ /** `store` narrowed to the keys `schema` declares. */
8426
+ narrowToScope(store, schema) {
8427
+ const keys = this.scopedKeys(schema);
8428
+ return Object.fromEntries(Object.entries(store).filter(([key]) => keys.has(key)));
8429
+ }
8430
+ scopedHandle(scope, cap, schema, nodeId) {
8431
+ return createScopedSettings({
8432
+ schema,
8433
+ read: async () => {
8434
+ const declared = await this.requireScopedSchema(scope, cap);
8435
+ const stored = this.narrowToScope(await this.resolveGlobalStore(nodeId, cap), declared);
8436
+ const effective = collectHydratedFieldValues(hydrateSchema(declared, stored));
8437
+ return {
8438
+ ...Object.fromEntries([...effective].filter(([, value]) => value !== void 0)),
8439
+ ...stored
8440
+ };
8441
+ },
8442
+ write: (patch) => this.writeScoped(scope, cap, patch, nodeId),
8443
+ unset: (keys) => this.unsetScoped(scope, cap, keys, nodeId)
8444
+ });
8445
+ }
8446
+ /** The one write path of the scoped API: declared keys only, then the global patch. */
8447
+ async writeScoped(scope, cap, patch, nodeId) {
8448
+ assertDeclaredKeys(Object.keys(patch), this.scopedKeys(await this.requireScopedSchema(scope, cap)));
8449
+ if (await this.applyGlobalPatch(patch, scope === "node" ? nodeId : void 0, cap)) await this.onScopedSettingsChanged(scope, cap, Object.keys(patch));
8450
+ }
8451
+ /**
8452
+ * Remove declared keys of one scope. A secret goes through {@link clearSecrets} — its keychain
8453
+ * value is released exactly as there — and the emptied row is then removed; every other key is
8454
+ * removed by an `undefined` patch (which a secret transform would read as "keep").
8455
+ */
8456
+ async unsetScoped(scope, cap, keys, nodeId) {
8457
+ assertDeclaredKeys(keys, this.scopedKeys(await this.requireScopedSchema(scope, cap)));
8458
+ const target = scope === "node" ? nodeId : void 0;
8459
+ const tree = this.addonSecretTree();
8460
+ const secretKeys = keys.filter((key) => tree.has(key));
8461
+ const plainKeys = keys.filter((key) => !tree.has(key));
8462
+ let changed = false;
8463
+ if (plainKeys.length > 0) {
8464
+ const patch = Object.fromEntries(plainKeys.map((key) => [key, void 0]));
8465
+ changed = await this.applyGlobalPatch(patch, target, cap) || changed;
8466
+ }
8467
+ if (secretKeys.length > 0) {
8468
+ await this.clearSecretKeys(secretKeys, target, cap);
8469
+ const node = normalizeNodeId(target ?? this._ctx?.kernel?.localNodeId);
8470
+ const rows = secretKeys.map((key) => scope === "node" ? nodeScopedKey(key, node) : key);
8471
+ if (this._secretSettings !== null) await this._secretSettings.removeClearedKeys(rows);
8472
+ else await this._ctx?.settings?.writeAddonStore(Object.fromEntries(rows.map((row) => [row, void 0])));
8473
+ changed = true;
8474
+ }
8475
+ if (changed) await this.onScopedSettingsChanged(scope, cap, [...keys]);
8476
+ }
8477
+ /**
8478
+ * The hydrated form of one scope of one capability's settings (any
8479
+ * {@link scopedSettingsOverlay} applied), or `null` when the capability declares nothing there.
8480
+ */
8481
+ async getScopedSettings(scope, cap, nodeId) {
8482
+ const schema = await this.declaredScopedSchema(scope, cap);
8483
+ if (schema === null) return null;
8484
+ const stored = this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema);
8485
+ const overlay = await this.scopedSettingsOverlay(scope, cap, nodeId);
8486
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(stored, overlay) : stored, { inlineSecretsAsViews: true });
8487
+ }
8488
+ /** The OPERATOR's write of declared keys of one scope (D787 secret semantics). */
8489
+ async updateScopedSettings(scope, cap, patch, nodeId) {
8490
+ this._operatorWriteDepth++;
8491
+ try {
8492
+ await this.writeScoped(scope, cap, patch, nodeId);
8493
+ } finally {
8494
+ this._operatorWriteDepth--;
8495
+ }
8496
+ }
8497
+ /**
8498
+ * The effective values (`stored ?? default`) of one scope, a secret as its `set` view — never
8499
+ * its value. `null` when the capability declares nothing for the scope.
8500
+ */
8501
+ async readScopedValues(scope, cap, nodeId) {
8502
+ const schema = await this.declaredScopedSchema(scope, cap);
8503
+ if (schema === null) return null;
8504
+ const form = hydrateSchema(schema, this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema), { inlineSecretsAsViews: true });
8505
+ return Object.fromEntries([...collectHydratedFieldValues(form)].filter(([, value]) => value !== void 0));
8506
+ }
8507
+ /**
8269
8508
  * What the create wizard and the integration edit page render for one instance: the addon's
8270
8509
  * per-instance schema when it declares one, else its global schema (what they always showed).
8271
8510
  */
@@ -8417,6 +8656,9 @@ var BaseAddon = class {
8417
8656
  * a keychain (an older kernel) it writes `''`, as such code always did.
8418
8657
  */
8419
8658
  async clearSecrets(keys, nodeId) {
8659
+ await this.clearSecretKeys(keys, nodeId);
8660
+ }
8661
+ async clearSecretKeys(keys, nodeId, cap) {
8420
8662
  const tree = this.addonSecretTree();
8421
8663
  const keychain = this._ctx?.secrets !== void 0;
8422
8664
  const stored = keychain ? await this.readAddonStoreWithRetry() : {};
@@ -8429,25 +8671,27 @@ var BaseAddon = class {
8429
8671
  const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
8430
8672
  patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
8431
8673
  }
8432
- await this.applyGlobalPatch(patch, nodeId);
8674
+ await this.applyGlobalPatch(patch, nodeId, cap);
8433
8675
  }
8434
- async applyGlobalPatch(barePatch, nodeId) {
8435
- await this.loadScopedSchemas();
8436
- const keys = this.perNodeKeys();
8676
+ /** Resolves `true` when the write changed stored values. */
8677
+ async applyGlobalPatch(barePatch, nodeId, cap) {
8678
+ await this.loadScopedSchemas(cap);
8679
+ const keys = this.perNodeKeys(cap);
8437
8680
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
8438
8681
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
8439
8682
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
8440
8683
  const handle = this._secretSettings;
8441
8684
  if (handle !== null) {
8442
8685
  const { changed } = await handle.writeAddonStore(scoped);
8443
- if (!changed) return;
8686
+ if (!changed) return false;
8444
8687
  } else await this._ctx?.settings?.writeAddonStore(scoped);
8445
- if (target !== localNode) return;
8688
+ if (target !== localNode) return true;
8446
8689
  await this.resolveConfig();
8447
8690
  await this.onConfigChanged();
8448
8691
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
8449
8692
  const legacy = this.globalSettingsSchema();
8450
8693
  this.maybeAutoRestart(Object.keys(barePatch), [...legacy === null ? [] : [legacy], ...this.loadedScopedSchemas().map((entry) => entry.schema)]);
8694
+ return true;
8451
8695
  }
8452
8696
  /**
8453
8697
  * The set of field keys the global settings schema declares `perNode: true`
@@ -10695,7 +10939,6 @@ var CAP_NAMES = Object.freeze([
10695
10939
  "notifier",
10696
10940
  "numeric-sensor",
10697
10941
  "oauth-integration",
10698
- "oidc-connections",
10699
10942
  "osd",
10700
10943
  "osd-manager",
10701
10944
  "pet-feeder",
@@ -12587,8 +12830,7 @@ Object.freeze({
12587
12830
  "device-provider": { "reloadDevice": 18e4 },
12588
12831
  "llm": {
12589
12832
  "generate": 6e5,
12590
- "generateVision": 6e5,
12591
- "testProfile": 6e5
12833
+ "generateVision": 6e5
12592
12834
  },
12593
12835
  "llm-runtime": {
12594
12836
  "complete": 6e5,
@@ -14183,17 +14425,18 @@ var IntegrationInstanceRefSchema = object({
14183
14425
  * message to what the kind supports — callers never special-case a service.
14184
14426
  *
14185
14427
  * DESIGN DECISIONS (locked):
14186
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14187
- * `setTargetEnabled`), each provider persisting via the `settings-store`
14188
- * cap. Rationale: the admin UI needs one uniform surface across the
14189
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14190
- * alternative would fork the UI per addon and cannot host the
14191
- * discovery→adopt flow.
14192
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14193
- * the generated cap-mount auto-`concatCollection`-fans them across every
14194
- * registered provider (notifiers addon + HA addon) so one catalog is
14195
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14196
- * `addonId` the generated collection router extracts from the call input.
14428
+ * - A target is an INSTANCE of this function cap (epic #440, step 6): the
14429
+ * providers serve their targets as `integration-instances` records, one
14430
+ * record kind per target kind, and the admin lists, adds, edits, switches
14431
+ * and deletes them through that cap. This cap keeps what an instance cannot
14432
+ * say: the kind catalogue (`listTargetKinds`: capabilities, delivery
14433
+ * parameters, brand icon), dispatch (`send`, `testTarget`) and the form
14434
+ * helpers (`discoverTargets`, `probeTargetConfig`).
14435
+ * - `listTargetKinds` / `discoverTargets` return arrays → the generated
14436
+ * cap-mount auto-`concatCollection`-fans them across every registered
14437
+ * provider so one catalog is routable. `send` / `testTarget` /
14438
+ * `probeTargetConfig` route to ONE provider by the `addonId` the generated
14439
+ * collection router extracts from the call input.
14197
14440
  * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14198
14441
  * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14199
14442
  * `storage` / `storage-provider` / `recording` caps over the same path. No
@@ -14438,7 +14681,7 @@ var TargetKindCapsSchema = object({
14438
14681
  * the union is large and not meant for runtime validation here; the exported
14439
14682
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14440
14683
  */
14441
- var ConfigSchemaPassthrough$4 = unknown();
14684
+ var ConfigSchemaPassthrough$3 = unknown();
14442
14685
  var TargetKindSchema = object({
14443
14686
  kind: string(),
14444
14687
  label: string(),
@@ -14475,7 +14718,7 @@ var TargetKindSchema = object({
14475
14718
  * its raster path, which is the safe default for an unknown image.
14476
14719
  */
14477
14720
  iconMediaType: string().optional(),
14478
- configSchema: ConfigSchemaPassthrough$4,
14721
+ configSchema: ConfigSchemaPassthrough$3,
14479
14722
  /**
14480
14723
  * The config keys that decide WHERE this kind's secrets are sent (server,
14481
14724
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -14497,9 +14740,11 @@ var TargetKindSchema = object({
14497
14740
  caps: TargetKindCapsSchema
14498
14741
  });
14499
14742
  /**
14500
- * A persisted target. `config` holds secrets; providers REDACT secret fields
14501
- * (return a presence marker only) when serving `listTargets` — never
14502
- * round-trip a stored secret to the UI.
14743
+ * A target as a provider's own code sees it (the notification-center bridge, the
14744
+ * send path): the flat record body split into the name, the switch and the
14745
+ * kind's fields. `config` holds secrets; a reader that serves it to a client
14746
+ * REDACTS secret fields (a presence marker only) — never round-trip a stored
14747
+ * secret to the UI.
14503
14748
  */
14504
14749
  var TargetSchema = object({
14505
14750
  id: string(),
@@ -14542,13 +14787,13 @@ var ProbeTargetConfigResultSchema = object({
14542
14787
  stateInstance: string().optional(),
14543
14788
  error: string().optional()
14544
14789
  });
14545
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
14790
+ method(object({}), array(TargetKindSchema)), method(object({
14546
14791
  kind: string(),
14547
14792
  config: record(string(), unknown()).optional(),
14548
14793
  /**
14549
14794
  * When editing / duplicating, the blank password field never round-trips
14550
14795
  * the stored token. Pass the source target id so the provider can restore
14551
- * secrets server-side before dialling (same merge as upsert).
14796
+ * secrets server-side before dialling.
14552
14797
  */
14553
14798
  targetId: string().optional()
14554
14799
  }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
@@ -14571,27 +14816,6 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
14571
14816
  }), TestResultSchema, {
14572
14817
  kind: "mutation",
14573
14818
  auth: "admin"
14574
- }), method(object({
14575
- target: TargetSchema,
14576
- /**
14577
- * Duplicate flow: create a NEW target id while copying secrets from an
14578
- * existing row. The UI never holds the stored token; blank / redacted
14579
- * password fields are restored from this source (D634 still applies if
14580
- * destinations diverge without a re-typed secret).
14581
- */
14582
- cloneSecretsFrom: string().optional()
14583
- }), TargetSchema, {
14584
- kind: "mutation",
14585
- auth: "admin"
14586
- }), method(object({ targetId: string() }), _void(), {
14587
- kind: "mutation",
14588
- auth: "admin"
14589
- }), method(object({
14590
- targetId: string(),
14591
- enabled: boolean()
14592
- }), _void(), {
14593
- kind: "mutation",
14594
- auth: "admin"
14595
14819
  });
14596
14820
  looseObject({
14597
14821
  name: string().min(1),
@@ -23171,7 +23395,6 @@ var SYSTEM_CAP_VOCABULARY = {
23171
23395
  "notification-output": system("notification delivery — reached through notifier devices and rules"),
23172
23396
  "notification-rules": system("notification rules — authored on their own page"),
23173
23397
  "oauth-integration": system(IDENTITY),
23174
- "oidc-connections": system(IDENTITY),
23175
23398
  "osd-manager": system(PIPELINE),
23176
23399
  "pipeline-executor": system(PIPELINE),
23177
23400
  "pipeline-orchestrator": system(PIPELINE),
@@ -45313,6 +45536,8 @@ var SettingsSchemaWithValuesSchema = object({
45313
45536
  });
45314
45537
  /** Patch object — keys are field names, values are the new field values. */
45315
45538
  var SettingsPatchSchema = record(string(), unknown());
45539
+ /** The scope of a scoped-settings call (D986): where the capability declared the values. */
45540
+ var ScopedSettingsScopeSchema = _enum(SCOPED_SETTINGS_SCOPES);
45316
45541
  /** Standard success response for update operations. */
45317
45542
  var SettingsUpdateResultSchema = object({ success: literal(true) });
45318
45543
  method(object({
@@ -45328,6 +45553,25 @@ method(object({
45328
45553
  kind: "mutation",
45329
45554
  auth: "admin"
45330
45555
  }), method(object({
45556
+ addonId: string(),
45557
+ cap: string(),
45558
+ scope: ScopedSettingsScopeSchema,
45559
+ nodeId: string().optional()
45560
+ }), SettingsSchemaWithValuesSchema.nullable()), method(object({
45561
+ addonId: string(),
45562
+ cap: string(),
45563
+ scope: ScopedSettingsScopeSchema,
45564
+ nodeId: string().optional(),
45565
+ patch: SettingsPatchSchema
45566
+ }), SettingsUpdateResultSchema, {
45567
+ kind: "mutation",
45568
+ auth: "admin"
45569
+ }), method(object({
45570
+ addonId: string(),
45571
+ cap: string(),
45572
+ scope: ScopedSettingsScopeSchema,
45573
+ nodeId: string().optional()
45574
+ }), record(string(), unknown()).nullable()), method(object({
45331
45575
  addonId: string(),
45332
45576
  nodeId: string().optional()
45333
45577
  }), SettingsSchemaWithValuesSchema.nullable()), method(object({
@@ -55183,7 +55427,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
55183
55427
  * or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
55184
55428
  * clears it.
55185
55429
  */
55186
- var ConfigSchemaPassthrough$3 = custom();
55430
+ var ConfigSchemaPassthrough$2 = custom();
55187
55431
  var IntegrationInstanceIdSchema = string().min(1);
55188
55432
  var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
55189
55433
  /**
@@ -55229,7 +55473,16 @@ var IntegrationInstanceKindSchema = object({
55229
55473
  /** Relative hub path to start an interactive account link of an instance of this kind. */
55230
55474
  connectPath: string().min(1).optional(),
55231
55475
  /** Relative hub path to disconnect that account. */
55232
- disconnectPath: string().min(1).optional()
55476
+ disconnectPath: string().min(1).optional(),
55477
+ /**
55478
+ * Parts of the edit dialog the flat form cannot draw (a node picker, a model source), named by a
55479
+ * GENERIC widget id the client maps to a component; a client that knows none of them shows none.
55480
+ * `connection` widgets write connection values, `model` widgets own the model choice.
55481
+ */
55482
+ widgets: array(object({
55483
+ id: string().min(1),
55484
+ placement: _enum(["connection", "model"])
55485
+ })).optional()
55233
55486
  });
55234
55487
  /**
55235
55488
  * How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
@@ -55327,7 +55580,7 @@ method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }), method
55327
55580
  id: IntegrationInstanceIdSchema.nullable(),
55328
55581
  /** The kind of the create form (`id: null`) of a provider with several. */
55329
55582
  kind: string().min(1).optional()
55330
- }), ConfigSchemaPassthrough$3, { auth: "admin" }), method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }), method(object({
55583
+ }), ConfigSchemaPassthrough$2, { auth: "admin" }), method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }), method(object({
55331
55584
  id: IntegrationInstanceIdSchema.optional(),
55332
55585
  name: string().min(1),
55333
55586
  kind: string().min(1).optional(),
@@ -56259,12 +56512,12 @@ var LlmModelInfoSchema = object({
56259
56512
  });
56260
56513
  /**
56261
56514
  * The provider-specific part of a profile, validated by the provider that owns
56262
- * the kind (`upsertProfile` refuses what it does not accept). A field its
56515
+ * the kind (saving an instance refuses what it does not accept). A field its
56263
56516
  * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
56264
56517
  * keychain, never in the row, and reads back as the redaction marker.
56265
56518
  */
56266
56519
  var LlmProviderConfigSchema = record(string(), unknown());
56267
- var LlmProfileSchema = object({
56520
+ object({
56268
56521
  id: string(),
56269
56522
  name: string(),
56270
56523
  /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
@@ -56358,8 +56611,8 @@ var LlmProviderWidgetSchema = object({
56358
56611
  /** ConfigUISchema tree passed through untyped on the wire (the
56359
56612
  * notification-output `ConfigSchemaPassthrough` precedent at
56360
56613
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
56361
- var ConfigSchemaPassthrough$2 = unknown();
56362
- var LlmProfileKindDescriptorSchema = object({
56614
+ var ConfigSchemaPassthrough$1 = unknown();
56615
+ object({
56363
56616
  kind: LlmProfileKindSchema,
56364
56617
  label: string(),
56365
56618
  /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
@@ -56367,9 +56620,9 @@ var LlmProfileKindDescriptorSchema = object({
56367
56620
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
56368
56621
  addonId: string(),
56369
56622
  /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
56370
- connectionSchema: ConfigSchemaPassthrough$2,
56623
+ connectionSchema: ConfigSchemaPassthrough$1,
56371
56624
  /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
56372
- advancedSchema: ConfigSchemaPassthrough$2.optional(),
56625
+ advancedSchema: ConfigSchemaPassthrough$1.optional(),
56373
56626
  /** The kind's defaults; a model from `listModels` may override any of them. */
56374
56627
  features: LlmModelFeaturesSchema,
56375
56628
  /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
@@ -56498,20 +56751,7 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
56498
56751
  }), method(object({
56499
56752
  addonId: string().optional(),
56500
56753
  requestId: string()
56501
- }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
56502
- kind: "mutation",
56503
- auth: "admin"
56504
- }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
56505
- kind: "mutation",
56506
- auth: "admin"
56507
- }), method(ProfileRefInputSchema, _void(), {
56508
- kind: "mutation",
56509
- auth: "admin"
56510
- }), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
56511
- kind: "mutation",
56512
- auth: "admin",
56513
- timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
56514
- }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
56754
+ }), _void(), { kind: "mutation" }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
56515
56755
  kind: "mutation",
56516
56756
  auth: "admin"
56517
56757
  }), method(object({}), array(LlmDefaultSchema)), method(object({
@@ -57506,20 +57746,7 @@ method(_void(), MeshStatusSchema), method(object({
57506
57746
  /** Optional hostname override the host should advertise once joined. */
57507
57747
  hostname: string().optional() }), object({
57508
57748
  /** Authentication URL the operator should open in a browser. */
57509
- loginUrl: string() }), { kind: "mutation" }), method(_void(), object({ left: literal(true) }), { kind: "mutation" }), method(_void(), object({ loggedOut: literal(true) }), { kind: "mutation" }), method(_void(), object({ peers: array(MeshPeerSchema).readonly() })), method(object({
57510
- /** Optional auth key — when provided, probes the key validity
57511
- * against the provider's API. Omit when already joined to
57512
- * just ping the daemon. */
57513
- authKey: string().optional() }), object({
57514
- ok: boolean(),
57515
- /** Provider-side identifier resolved by the probe (tailnet
57516
- * name for Tailscale, network id for ZeroTier, etc.). */
57517
- tenant: string().optional(),
57518
- /** Daemon binary version, when reachable. */
57519
- daemonVersion: string().optional(),
57520
- /** Human-readable error when `ok: false`. */
57521
- error: string().optional()
57522
- }), { kind: "mutation" });
57749
+ loginUrl: string() }), { kind: "mutation" }), method(_void(), object({ left: literal(true) }), { kind: "mutation" }), method(_void(), object({ loggedOut: literal(true) }), { kind: "mutation" }), method(_void(), object({ peers: array(MeshPeerSchema).readonly() }));
57523
57750
  object({
57524
57751
  value: number().nullable().meta(readingMeta("device", { label: "Total" })),
57525
57752
  lastFetchedAt: number()
@@ -67655,61 +67882,6 @@ var OauthIntegrationDescriptorSchema = object({
67655
67882
  });
67656
67883
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
67657
67884
  /**
67658
- * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
67659
- *
67660
- * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
67661
- * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
67662
- * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
67663
- * immutable after create.
67664
- */
67665
- var ConfigSchemaPassthrough$1 = unknown();
67666
- var OidcConnectionSchema = object({
67667
- id: string().min(1),
67668
- displayName: string(),
67669
- icon: string(),
67670
- issuerUrl: string(),
67671
- clientId: string(),
67672
- /** Client id + secret present — never the secret value. */
67673
- configured: boolean(),
67674
- /**
67675
- * Values for the connection form schema. `clientSecret` is a keychain
67676
- * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
67677
- */
67678
- formValues: record(string(), unknown()).optional()
67679
- });
67680
- /**
67681
- * Patch one connection. Omitted or empty `clientSecret` keeps the stored
67682
- * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
67683
- */
67684
- var OidcConnectionUpdateInputSchema = object({
67685
- id: string().min(1),
67686
- displayName: string().min(1),
67687
- icon: string().optional(),
67688
- issuerUrl: string().optional(),
67689
- clientId: string().optional(),
67690
- clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
67691
- redirectUri: string().optional(),
67692
- scopes: string().optional(),
67693
- usernameClaim: _enum([
67694
- "preferred_username",
67695
- "email",
67696
- "sub"
67697
- ]).optional()
67698
- });
67699
- method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
67700
- id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
67701
- displayName: string().min(1)
67702
- }), object({ id: string() }), {
67703
- kind: "mutation",
67704
- auth: "admin"
67705
- }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
67706
- kind: "mutation",
67707
- auth: "admin"
67708
- }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
67709
- kind: "mutation",
67710
- auth: "admin"
67711
- });
67712
- /**
67713
67885
  * Generic on-screen-display (video overlay) cap. Each camera exposes
67714
67886
  * a firmware-defined list of overlays (channel name, timestamp,
67715
67887
  * watermark, logo, …); the cap models them as a homogeneous array of
@@ -75111,21 +75283,6 @@ method(object({
75111
75283
  */
75112
75284
  ttlSec: union([number().int().positive(), literal("never")]).optional()
75113
75285
  }), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
75114
- var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
75115
- providerId: string().min(1),
75116
- displayName: string().min(1),
75117
- configSchema: unknown(),
75118
- nodeLocal: boolean(),
75119
- shouldSaveDiskSpace: literal(true),
75120
- minFreePercent: number().min(0).max(100)
75121
- }), object({
75122
- providerId: string().min(1),
75123
- displayName: string().min(1),
75124
- configSchema: unknown(),
75125
- nodeLocal: boolean(),
75126
- shouldSaveDiskSpace: literal(false),
75127
- minFreePercent: literal(null)
75128
- })]);
75129
75286
  method(object({
75130
75287
  location: StorageLocationRefSchema,
75131
75288
  relativePath: string()
@@ -75187,42 +75344,7 @@ method(object({
75187
75344
  }), _instanceof(Uint8Array), { auth: "admin" }), method(object({ downloadId: string() }), _void(), {
75188
75345
  kind: "mutation",
75189
75346
  auth: "admin"
75190
- }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(StorageLocationSchema.omit({
75191
- createdAt: true,
75192
- updatedAt: true
75193
- }), StorageLocationSchema, {
75194
- kind: "mutation",
75195
- auth: "admin"
75196
- }), method(object({
75197
- id: string(),
75198
- force: boolean().optional()
75199
- }), _void(), {
75200
- kind: "mutation",
75201
- auth: "admin"
75202
- }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
75203
- ok: boolean(),
75204
- error: string().optional()
75205
- }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
75206
- providerId: string(),
75207
- /**
75208
- * The location this config is an UNSAVED edit of, when there is one.
75209
- *
75210
- * `listLocations` replaces every declared secret with the redaction
75211
- * sentinel, so the edit modal's form state holds the sentinel for any
75212
- * credential the operator did not retype — and posting that here
75213
- * without a way to resolve it makes the provider try to authenticate
75214
- * as `__camstack_redacted__` and report the operator's own working
75215
- * password as wrong. Given this id, the orchestrator restores each
75216
- * sentinel from the stored config (same rule as `upsertLocation`)
75217
- * before dispatching. Omitted by the "Add location" wizard, where
75218
- * every value was typed just now and nothing is stored yet.
75219
- */
75220
- locationId: string().optional(),
75221
- config: record(string(), unknown())
75222
- }), object({
75223
- ok: boolean(),
75224
- error: string().optional()
75225
- }), { auth: "admin" });
75347
+ }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(_void(), array(StorageDrainProgressSchema).readonly());
75226
75348
  /** One table of the settings database. */
75227
75349
  var StorageTableSchema = object({
75228
75350
  /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
@@ -79403,6 +79525,20 @@ Object.freeze({
79403
79525
  access: "view",
79404
79526
  role: "admin"
79405
79527
  },
79528
+ "addonSettings.getScopedSettings": {
79529
+ capName: "addon-settings",
79530
+ capScope: "system",
79531
+ addonId: null,
79532
+ access: "view",
79533
+ role: "admin"
79534
+ },
79535
+ "addonSettings.readScopedValues": {
79536
+ capName: "addon-settings",
79537
+ capScope: "system",
79538
+ addonId: null,
79539
+ access: "view",
79540
+ role: "admin"
79541
+ },
79406
79542
  "addonSettings.unsetStoredSettingsKeys": {
79407
79543
  capName: "addon-settings",
79408
79544
  capScope: "system",
@@ -79424,6 +79560,13 @@ Object.freeze({
79424
79560
  access: "create",
79425
79561
  role: "admin"
79426
79562
  },
79563
+ "addonSettings.updateScopedSettings": {
79564
+ capName: "addon-settings",
79565
+ capScope: "system",
79566
+ addonId: null,
79567
+ access: "create",
79568
+ role: "admin"
79569
+ },
79427
79570
  "addonWidgets.listWidgets": {
79428
79571
  capName: "addon-widgets",
79429
79572
  capScope: "system",
@@ -82875,13 +83018,6 @@ Object.freeze({
82875
83018
  access: "delete",
82876
83019
  role: "admin"
82877
83020
  },
82878
- "llm.deleteProfile": {
82879
- capName: "llm",
82880
- capScope: "system",
82881
- addonId: null,
82882
- access: "delete",
82883
- role: "admin"
82884
- },
82885
83021
  "llm.generate": {
82886
83022
  capName: "llm",
82887
83023
  capScope: "system",
@@ -82945,20 +83081,6 @@ Object.freeze({
82945
83081
  access: "view",
82946
83082
  role: "admin"
82947
83083
  },
82948
- "llm.listProfileKinds": {
82949
- capName: "llm",
82950
- capScope: "system",
82951
- addonId: null,
82952
- access: "view",
82953
- role: "admin"
82954
- },
82955
- "llm.listProfiles": {
82956
- capName: "llm",
82957
- capScope: "system",
82958
- addonId: null,
82959
- access: "view",
82960
- role: "admin"
82961
- },
82962
83084
  "llm.listRuntimeNodes": {
82963
83085
  capName: "llm",
82964
83086
  capScope: "system",
@@ -82966,13 +83088,6 @@ Object.freeze({
82966
83088
  access: "view",
82967
83089
  role: "admin"
82968
83090
  },
82969
- "llm.migrateRawSecrets": {
82970
- capName: "llm",
82971
- capScope: "system",
82972
- addonId: null,
82973
- access: "create",
82974
- role: "admin"
82975
- },
82976
83091
  "llm.resolveModelRef": {
82977
83092
  capName: "llm",
82978
83093
  capScope: "system",
@@ -83001,20 +83116,6 @@ Object.freeze({
83001
83116
  access: "create",
83002
83117
  role: "admin"
83003
83118
  },
83004
- "llm.testProfile": {
83005
- capName: "llm",
83006
- capScope: "system",
83007
- addonId: null,
83008
- access: "create",
83009
- role: "admin"
83010
- },
83011
- "llm.upsertProfile": {
83012
- capName: "llm",
83013
- capScope: "system",
83014
- addonId: null,
83015
- access: "create",
83016
- role: "admin"
83017
- },
83018
83119
  "llmRuntime.appleAvailability": {
83019
83120
  capName: "llm-runtime",
83020
83121
  capScope: "system",
@@ -83519,13 +83620,6 @@ Object.freeze({
83519
83620
  access: "create",
83520
83621
  role: "admin"
83521
83622
  },
83522
- "meshNetwork.testConnection": {
83523
- capName: "mesh-network",
83524
- capScope: "system",
83525
- addonId: null,
83526
- access: "create",
83527
- role: "admin"
83528
- },
83529
83623
  "meter.getStatus": {
83530
83624
  capName: "meter",
83531
83625
  capScope: "device",
@@ -84184,13 +84278,6 @@ Object.freeze({
84184
84278
  access: "create",
84185
84279
  role: "admin"
84186
84280
  },
84187
- "notificationOutput.deleteTarget": {
84188
- capName: "notification-output",
84189
- capScope: "system",
84190
- addonId: null,
84191
- access: "delete",
84192
- role: "admin"
84193
- },
84194
84281
  "notificationOutput.discoverTargets": {
84195
84282
  capName: "notification-output",
84196
84283
  capScope: "system",
@@ -84198,13 +84285,6 @@ Object.freeze({
84198
84285
  access: "view",
84199
84286
  role: "admin"
84200
84287
  },
84201
- "notificationOutput.getTarget": {
84202
- capName: "notification-output",
84203
- capScope: "system",
84204
- addonId: null,
84205
- access: "view",
84206
- role: "admin"
84207
- },
84208
84288
  "notificationOutput.listTargetKinds": {
84209
84289
  capName: "notification-output",
84210
84290
  capScope: "system",
@@ -84212,13 +84292,6 @@ Object.freeze({
84212
84292
  access: "view",
84213
84293
  role: "admin"
84214
84294
  },
84215
- "notificationOutput.listTargets": {
84216
- capName: "notification-output",
84217
- capScope: "system",
84218
- addonId: null,
84219
- access: "view",
84220
- role: "admin"
84221
- },
84222
84295
  "notificationOutput.probeTargetConfig": {
84223
84296
  capName: "notification-output",
84224
84297
  capScope: "system",
@@ -84233,13 +84306,6 @@ Object.freeze({
84233
84306
  access: "create",
84234
84307
  role: "admin"
84235
84308
  },
84236
- "notificationOutput.setTargetEnabled": {
84237
- capName: "notification-output",
84238
- capScope: "system",
84239
- addonId: null,
84240
- access: "create",
84241
- role: "admin"
84242
- },
84243
84309
  "notificationOutput.testTarget": {
84244
84310
  capName: "notification-output",
84245
84311
  capScope: "system",
@@ -84247,13 +84313,6 @@ Object.freeze({
84247
84313
  access: "create",
84248
84314
  role: "admin"
84249
84315
  },
84250
- "notificationOutput.upsertTarget": {
84251
- capName: "notification-output",
84252
- capScope: "system",
84253
- addonId: null,
84254
- access: "create",
84255
- role: "admin"
84256
- },
84257
84316
  "notificationRules.activateAlarmProfile": {
84258
84317
  capName: "notification-rules",
84259
84318
  capScope: "system",
@@ -84513,41 +84572,6 @@ Object.freeze({
84513
84572
  access: "view",
84514
84573
  role: "admin"
84515
84574
  },
84516
- "oidcConnections.connectionFormSchema": {
84517
- capName: "oidc-connections",
84518
- capScope: "system",
84519
- addonId: null,
84520
- access: "view",
84521
- role: "admin"
84522
- },
84523
- "oidcConnections.createConnection": {
84524
- capName: "oidc-connections",
84525
- capScope: "system",
84526
- addonId: null,
84527
- access: "create",
84528
- role: "admin"
84529
- },
84530
- "oidcConnections.deleteConnection": {
84531
- capName: "oidc-connections",
84532
- capScope: "system",
84533
- addonId: null,
84534
- access: "delete",
84535
- role: "admin"
84536
- },
84537
- "oidcConnections.listConnections": {
84538
- capName: "oidc-connections",
84539
- capScope: "system",
84540
- addonId: null,
84541
- access: "view",
84542
- role: "admin"
84543
- },
84544
- "oidcConnections.updateConnection": {
84545
- capName: "oidc-connections",
84546
- capScope: "system",
84547
- addonId: null,
84548
- access: "create",
84549
- role: "admin"
84550
- },
84551
84575
  "osd.getStatus": {
84552
84576
  capName: "osd",
84553
84577
  capScope: "device",
@@ -87579,13 +87603,6 @@ Object.freeze({
87579
87603
  access: "delete",
87580
87604
  role: "admin"
87581
87605
  },
87582
- "storage.deleteLocation": {
87583
- capName: "storage",
87584
- capScope: "system",
87585
- addonId: null,
87586
- access: "delete",
87587
- role: "admin"
87588
- },
87589
87606
  "storage.endDownload": {
87590
87607
  capName: "storage",
87591
87608
  capScope: "system",
@@ -87642,13 +87659,6 @@ Object.freeze({
87642
87659
  access: "view",
87643
87660
  role: "admin"
87644
87661
  },
87645
- "storage.listProviders": {
87646
- capName: "storage",
87647
- capScope: "system",
87648
- addonId: null,
87649
- access: "view",
87650
- role: "admin"
87651
- },
87652
87662
  "storage.read": {
87653
87663
  capName: "storage",
87654
87664
  capScope: "system",
@@ -87670,27 +87680,6 @@ Object.freeze({
87670
87680
  access: "view",
87671
87681
  role: "admin"
87672
87682
  },
87673
- "storage.testConfig": {
87674
- capName: "storage",
87675
- capScope: "system",
87676
- addonId: null,
87677
- access: "view",
87678
- role: "admin"
87679
- },
87680
- "storage.testLocation": {
87681
- capName: "storage",
87682
- capScope: "system",
87683
- addonId: null,
87684
- access: "view",
87685
- role: "admin"
87686
- },
87687
- "storage.upsertLocation": {
87688
- capName: "storage",
87689
- capScope: "system",
87690
- addonId: null,
87691
- access: "create",
87692
- role: "admin"
87693
- },
87694
87683
  "storage.write": {
87695
87684
  capName: "storage",
87696
87685
  capScope: "system",
@@ -98452,7 +98441,7 @@ var LoadShedController = class LoadShedController {
98452
98441
  return state?.pausedAt !== null && state?.pausedAt !== void 0;
98453
98442
  }
98454
98443
  /**
98455
- * Mirrors the former inline block inside `updateGlobalSettings`: clear
98444
+ * Mirrors the former inline block inside the cluster-write follow-up: clear
98456
98445
  * load-shed pauses so suspended cameras get re-evaluated with the new
98457
98446
  * thresholds on the next dispatch cycle, then re-dispatch each of them.
98458
98447
  */
@@ -104295,9 +104284,12 @@ var DeviceConfigContributions = class {
104295
104284
  constructor(deps) {
104296
104285
  this.deps = deps;
104297
104286
  }
104298
- async updateGlobalSettings(patch) {
104287
+ /**
104288
+ * The side effects of a cluster settings write that already landed. Runs BEFORE
104289
+ * `applyRuntimeSettings`, so `topology.clusterRoles` still holds the previous roles here.
104290
+ */
104291
+ async afterClusterSettingsWritten() {
104299
104292
  const previousIngestNode = this.deps.topology.clusterRoles.ingestNode;
104300
- await this.deps.baseUpdateGlobalSettings(patch);
104301
104293
  const full = await this.deps.resolveGlobalStore();
104302
104294
  this.deps.setGlobalSettings({ ...full });
104303
104295
  this.deps.applyRuntimeSettings(full);
@@ -107929,7 +107921,7 @@ async function resetClusterRows(deps, isCustom) {
107929
107921
  if (read.kind === "present") stored.set(key, read.value);
107930
107922
  }
107931
107923
  const { patch, cleared } = clusterRowsToReset((key) => stored.get(key), isCustom);
107932
- if (cleared.length > 0) await deps.updateGlobalSettings({ ...patch });
107924
+ if (cleared.length > 0) await deps.patchClusterSettings({ ...patch });
107933
107925
  return cleared;
107934
107926
  }
107935
107927
  function logResetPin(logger, pin, trigger) {
@@ -112733,7 +112725,6 @@ async function buildOrchestratorControllers(deps) {
112733
112725
  deviceHasOnboardMotionCap: (deviceId) => deps.deviceHasOnboardMotionCap(deviceId),
112734
112726
  deviceHasActivitySignalCap: (deviceId) => deps.deviceHasActivitySignalCap(deviceId),
112735
112727
  deviceHasNativeObjectDetectionCap: (deviceId) => deps.deviceHasNativeObjectDetectionCap(deviceId),
112736
- baseUpdateGlobalSettings: (patch) => deps.baseUpdateGlobalSettings(patch),
112737
112728
  resolveGlobalStore: () => deps.resolveGlobalStore(),
112738
112729
  setGlobalSettings: (settings) => {
112739
112730
  globalSettings = settings;
@@ -115210,6 +115201,8 @@ function findStaleDevicePins(pins, nodes) {
115210
115201
  * because nobody discovers it is missing until they need it.
115211
115202
  */
115212
115203
  var customActions = pipelineOrchestratorActions;
115204
+ /** The cluster form is read and written key by key; the declared schema refuses any other key. */
115205
+ var CLUSTER_VALUES_SCHEMA = record(string(), unknown());
115213
115206
  var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddon {
115214
115207
  /** This node's Moleculer nodeId (from this.ctx.kernel.localNodeId). */
115215
115208
  localNodeId = "hub";
@@ -115351,7 +115344,7 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
115351
115344
  /**
115352
115345
  * Device-details aggregator contributions (`getDeviceSettingsContribution`/
115353
115346
  * `getDeviceLiveContribution`/`applyDeviceSettingsPatch`/
115354
- * `updateGlobalSettings`/`writeDeviceOrchestratorSettings`/
115347
+ * `afterClusterSettingsWritten`/`writeDeviceOrchestratorSettings`/
115355
115348
  * `splitPipelinePatch`/`applyPipelinePatch`) — see
115356
115349
  * `device-config-contributions.ts` (S11 Task 1 extraction, C13 remnant).
115357
115350
  * Owns nothing durable (reads through injected closures); constructed in
@@ -115359,6 +115352,8 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
115359
115352
  * exist. Stateless — no `dispose()`, just nulled at the end of `onShutdown`.
115360
115353
  */
115361
115354
  deviceConfig = null;
115355
+ /** True while the removed-model pin sweep runs, so its own cluster writes never re-enter it. */
115356
+ pinResetRunning = false;
115362
115357
  /**
115363
115358
  * Read-only test-seam compat accessor — mirrors the pre-S9 `protected
115364
115359
  * remoteHealthAttempts` field so `remote-health.spec.ts`'s subclass
@@ -115511,7 +115506,6 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
115511
115506
  isIdleSessionCamera: (deviceId) => this.isIdleSessionCamera(deviceId),
115512
115507
  deviceSettingsSchema: () => this.deviceSettingsSchema(),
115513
115508
  resolveGlobalStore: () => this.resolveGlobalStore(),
115514
- baseUpdateGlobalSettings: (patch) => super.updateGlobalSettings(patch),
115515
115509
  watchCapability: (capNames, handlers) => this.watchCapability(capNames, handlers),
115516
115510
  state: this.state.bind(this),
115517
115511
  rebalance: (opts) => this.rebalance(opts),
@@ -117285,7 +117279,8 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
117285
117279
  const auto = this.effectiveShares().current();
117286
117280
  if (auto !== null) await this.setLoadBalancingShares(auto.weights);
117287
117281
  }
117288
- await this.updateGlobalSettings({ [SHARE_SOURCE_SETTING_KEY]: input.source });
117282
+ await this.state(SHARE_SOURCE_SETTING_KEY, ShareSourceSchema, DEFAULT_SHARE_SOURCE).set(input.source);
117283
+ await this.afterClusterWrite([SHARE_SOURCE_SETTING_KEY]);
117289
117284
  this.ctx.logger.info("load balancing: share source changed", { meta: {
117290
117285
  from: previous,
117291
117286
  to: input.source
@@ -117462,9 +117457,18 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
117462
117457
  deviceSettingsSchema() {
117463
117458
  return this.schema({ sections: buildDeviceSettingsSections({ runnerNodeIds: this.topology.collectRunnerNodeIds() }) });
117464
117459
  }
117465
- async updateGlobalSettings(patch) {
117466
- await this.deviceConfig.updateGlobalSettings(patch);
117467
- if (CLUSTER_MODEL_SCOPED_STEPS.some((step) => typeof patch[clusterModelSettingKey(step.stepId)] === "string")) await this.resetRemovedModelPins("cluster-row-write");
117460
+ /** The cluster form's stored values, written under their bare keys. */
117461
+ clusterStore() {
117462
+ return this.clusterSettings(PIPELINE_ORCHESTRATOR_ID, CLUSTER_VALUES_SCHEMA);
117463
+ }
117464
+ async onScopedSettingsChanged(scope, cap, keys) {
117465
+ if (scope !== "cluster" || cap !== "pipeline-orchestrator") return;
117466
+ await this.afterClusterWrite(keys);
117467
+ }
117468
+ async afterClusterWrite(keys) {
117469
+ if (this.deviceConfig === null) return;
117470
+ await this.deviceConfig.afterClusterSettingsWritten();
117471
+ if (CLUSTER_MODEL_SCOPED_STEPS.some((step) => keys.includes(clusterModelSettingKey(step.stepId))) && !this.pinResetRunning) await this.resetRemovedModelPins("cluster-row-write");
117468
117472
  }
117469
117473
  /**
117470
117474
  * The ONE stored-pin reset (D725): drop every pin to a model deleted from
@@ -117488,6 +117492,14 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
117488
117492
  });
117489
117493
  }
117490
117494
  async resetRemovedModelPins(trigger) {
117495
+ this.pinResetRunning = true;
117496
+ try {
117497
+ return await this.runRemovedModelPinReset(trigger);
117498
+ } finally {
117499
+ this.pinResetRunning = false;
117500
+ }
117501
+ }
117502
+ async runRemovedModelPinReset(trigger) {
117491
117503
  return resetRemovedModelPins({
117492
117504
  listCustomModels: async () => {
117493
117505
  const api = this.ctx.api;
@@ -117496,7 +117508,7 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
117496
117508
  },
117497
117509
  resetStoredPins: (isCustom) => this.settingsStore.resetRemovedModelPins(isCustom),
117498
117510
  readStoredGlobalKey: (key) => this.readStoredGlobalKey(key),
117499
- updateGlobalSettings: (patch) => this.deviceConfig.updateGlobalSettings(patch),
117511
+ patchClusterSettings: (patch) => this.clusterStore().patch(patch),
117500
117512
  redispatchNode: (nodeId) => this.placement.redispatchCamerasOnAgent(nodeId),
117501
117513
  logger: this.ctx.logger
117502
117514
  }, trigger);