@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.js CHANGED
@@ -30,7 +30,7 @@ node_fs = __toESM(node_fs);
30
30
  let node_path = require("node:path");
31
31
  node_path = __toESM(node_path);
32
32
  let node_url = require("node:url");
33
- //#region ../types/dist/event-category-BmPm98n0.mjs
33
+ //#region ../types/dist/event-category-78tcBemo.mjs
34
34
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
35
35
  EventCategory["SystemBoot"] = "system.boot";
36
36
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -151,6 +151,23 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
151
151
  */
152
152
  EventCategory["AddonLoadRecovered"] = "addon.load-recovered";
153
153
  /**
154
+ * An addon is RUNNING although its installed package is below what the
155
+ * running server requires (`camstack.requires.addons` of the server, or the
156
+ * addon's own `requires.server`). Raised once per streak by the unsupported-
157
+ * addon tracker, on the hub and on agents; AlertCenter turns it into one
158
+ * operator alert per node and package. The addon is never held back for it.
159
+ *
160
+ * Payload: `{ packageName, addonId, nodeId, installedVersion, requiredMinimum, serverVersion, unmet }`.
161
+ */
162
+ EventCategory["AddonUnsupportedVersion"] = "addon.unsupported-version";
163
+ /**
164
+ * The package of an {@link AddonUnsupportedVersion} alert reached a supported
165
+ * version, or is no longer installed on the node. AlertCenter dismisses the matching alert.
166
+ *
167
+ * Payload: `{ packageName, addonId, nodeId }`.
168
+ */
169
+ EventCategory["AddonUnsupportedResolved"] = "addon.unsupported-resolved";
170
+ /**
154
171
  * Monitor scheduled the next retry for a failed addon. Transient —
155
172
  * surfaced to the UI for live-updating the "next retry in Ns"
156
173
  * countdown on the Addons page row, NOT persisted as an alert.
@@ -261,7 +278,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
261
278
  EventCategory["ProcessRestarted"] = "process.restarted";
262
279
  /**
263
280
  * The SET of storage locations changed — one was created, edited, enabled,
264
- * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
281
+ * disabled or deleted through the location instances or the forced-delete action.
265
282
  *
266
283
  * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
267
284
  * it must also converge on its own periodic path, because a dropped event
@@ -6012,7 +6029,7 @@ var ZodIssueCode = {
6012
6029
  var ZodFirstPartyTypeKind;
6013
6030
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6014
6031
  //#endregion
6015
- //#region ../types/dist/sleep-D7ZKm4nb.mjs
6032
+ //#region ../types/dist/sleep-CQP-REJp.mjs
6016
6033
  /**
6017
6034
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6018
6035
  * window to float samples (D455).
@@ -6369,6 +6386,59 @@ Object.fromEntries([
6369
6386
  function isValuelessField(field) {
6370
6387
  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";
6371
6388
  }
6389
+ /**
6390
+ * Base collector: flatten a hydrated `ConfigUISchemaWithValues` into
6391
+ * `key → { value, default }`, recursing through `group` and `sub-tabs`
6392
+ * layout fields. Keeping `value` and `default` SEPARATE (rather than
6393
+ * pre-resolving) lets callers both read the effective value AND detect
6394
+ * overrides (`value` differs from `default`). Structural over `unknown`;
6395
+ * malformed input yields an empty map, never throws.
6396
+ */
6397
+ function collectHydratedFieldEntries(schema) {
6398
+ const out = /* @__PURE__ */ new Map();
6399
+ if (typeof schema !== "object" || schema === null) return out;
6400
+ const sections = schema.sections;
6401
+ if (!Array.isArray(sections)) return out;
6402
+ for (const section of sections) if (typeof section === "object" && section !== null) collectFieldEntriesInto(section.fields, out);
6403
+ return out;
6404
+ }
6405
+ /** Recursive field walker for {@link collectHydratedFieldEntries}. */
6406
+ function collectFieldEntriesInto(fields, into) {
6407
+ if (!Array.isArray(fields)) return;
6408
+ for (const field of fields) {
6409
+ if (typeof field !== "object" || field === null) continue;
6410
+ const type = field.type;
6411
+ if (type === "group") {
6412
+ collectFieldEntriesInto(field.fields, into);
6413
+ continue;
6414
+ }
6415
+ if (type === "sub-tabs") {
6416
+ const tabs = field.tabs;
6417
+ if (Array.isArray(tabs)) {
6418
+ for (const tab of tabs) if (typeof tab === "object" && tab !== null) collectFieldEntriesInto(tab.fields, into);
6419
+ }
6420
+ continue;
6421
+ }
6422
+ const key = field.key;
6423
+ if (typeof key !== "string" || key.length === 0) continue;
6424
+ if (!("value" in field)) continue;
6425
+ into.set(key, {
6426
+ value: field.value,
6427
+ default: field.default
6428
+ });
6429
+ }
6430
+ }
6431
+ /**
6432
+ * Flatten a hydrated settings payload into `key → EFFECTIVE value`
6433
+ * (`value ?? default`). The read-side inverse of `hydrateSchema` for the
6434
+ * common "just give me the resolved values" case. Built on
6435
+ * {@link collectHydratedFieldEntries}.
6436
+ */
6437
+ function collectHydratedFieldValues(schema) {
6438
+ const out = /* @__PURE__ */ new Map();
6439
+ for (const [key, entry] of collectHydratedFieldEntries(schema)) out.set(key, entry.value ?? entry.default);
6440
+ return out;
6441
+ }
6372
6442
  function hydrateSchema(schema, values, options = {}) {
6373
6443
  return {
6374
6444
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
@@ -7174,6 +7244,21 @@ var SCOPED_SETTINGS_SCOPES = [
7174
7244
  "device-defaults",
7175
7245
  "node"
7176
7246
  ];
7247
+ /** The one refusal of a key a scope did not declare. */
7248
+ function assertDeclaredKeys(keys, declared) {
7249
+ const undeclared = keys.filter((key) => !declared.has(key));
7250
+ if (undeclared.length > 0) throw new Error(`scoped settings: [${undeclared.join(", ")}] not declared for this scope (declared: [${[...declared].join(", ")}])`);
7251
+ }
7252
+ /** Build the handle over an addon's scoped read, write and unset. */
7253
+ function createScopedSettings(deps) {
7254
+ return {
7255
+ async get() {
7256
+ return deps.schema.parse(await deps.read());
7257
+ },
7258
+ patch: (patch) => deps.write(Object.fromEntries(Object.entries(patch))),
7259
+ unset: (keys) => deps.unset(keys)
7260
+ };
7261
+ }
7177
7262
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
7178
7263
  var KeychainWriteRefusedError = class extends Error {
7179
7264
  fieldPath;
@@ -7749,7 +7834,16 @@ function createHandle(raw, opts) {
7749
7834
  return blob;
7750
7835
  }
7751
7836
  },
7752
- writeAddonStore: writeAddon
7837
+ writeAddonStore: writeAddon,
7838
+ removeClearedKeys: (keys) => serialize("addon", async () => {
7839
+ const stored = await readStoredAddonBlob(raw);
7840
+ index.seen("addon", stored);
7841
+ const removable = keys.filter((key) => collectSecretMarkerRefs(stored[key]).length === 0);
7842
+ if (removable.length === 0) return;
7843
+ const patch = Object.fromEntries(removable.map((key) => [key, void 0]));
7844
+ await raw.writeAddonStore(patch);
7845
+ index.wrote("addon", patch);
7846
+ })
7753
7847
  };
7754
7848
  }
7755
7849
  /** The context the addon sees, plus the private raw view and write outcome. */
@@ -8294,6 +8388,151 @@ var BaseAddon = class {
8294
8388
  }
8295
8389
  }
8296
8390
  /**
8391
+ * Hook: values layered over the stored ones when the FORM of one scope is served
8392
+ * ({@link getScopedSettings}) — a preview that derives dependent options without writing.
8393
+ * Never applied to {@link ScopedSettings.get} or to a write. `null` ⇒ no overlay.
8394
+ */
8395
+ async scopedSettingsOverlay(_scope, _cap, _nodeId) {
8396
+ return null;
8397
+ }
8398
+ /**
8399
+ * Hook: a write of one scope changed stored values (not called when the store reports no change,
8400
+ * e.g. the write-back of a stored secret). `keys` are the bare field keys of the write, node keys included.
8401
+ */
8402
+ async onScopedSettingsChanged(_scope, _cap, _keys) {}
8403
+ /** Typed handle over the CLUSTER settings `cap` declares (`clusterSettingsSchema`). */
8404
+ clusterSettings(cap, schema) {
8405
+ return this.scopedHandle("cluster", cap, schema);
8406
+ }
8407
+ /** Typed handle over the fleet defaults of the per-device settings `cap` declares. */
8408
+ deviceDefaults(cap, schema) {
8409
+ return this.scopedHandle("device-defaults", cap, schema);
8410
+ }
8411
+ /**
8412
+ * Typed handle over the settings `cap` owns PER NODE. `nodeId` omitted ⇒ the local node. A node
8413
+ * with no row yields the schema defaults — never a bare-key fallback.
8414
+ */
8415
+ nodeSettings(cap, schema, nodeId) {
8416
+ return this.scopedHandle("node", cap, schema, nodeId);
8417
+ }
8418
+ /**
8419
+ * {@link state} for a value that is kept per node: stored under `<key>@<nodeId>`, and the
8420
+ * settings store carries `nodeId` in the row data (D986 §1), so a forgotten node's rows go in one
8421
+ * central delete. `nodeId` omitted ⇒ the local node.
8422
+ */
8423
+ nodeState(key, schema, fallback, nodeId) {
8424
+ this._declaredStateKeys.add(key);
8425
+ return createDurableState({
8426
+ key: nodeScopedKey(key, nodeId ?? this._ctx?.kernel?.localNodeId ?? ""),
8427
+ schema,
8428
+ fallback,
8429
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
8430
+ write: async (patch) => {
8431
+ await this._ctx?.settings?.writeAddonStore(patch);
8432
+ },
8433
+ onParseError: (k, e) => this._ctx?.logger?.warn?.(`durable-state: stored "${k}" failed validation — using fallback`, { meta: {
8434
+ addonId: this._ctx?.id,
8435
+ key: k,
8436
+ error: String(e)
8437
+ } })
8438
+ });
8439
+ }
8440
+ /** The loaded schema `cap` declares for `scope`, or `null`. */
8441
+ async declaredScopedSchema(scope, cap) {
8442
+ await this.loadScopedSchemas(cap);
8443
+ return this.loadedScopedSchemas(cap).find((entry) => entry.scope === scope)?.schema ?? null;
8444
+ }
8445
+ async requireScopedSchema(scope, cap) {
8446
+ const schema = await this.declaredScopedSchema(scope, cap);
8447
+ if (schema === null) throw new Error(`${this.constructor.name}: cap "${cap}" declares no ${scope} settings`);
8448
+ return schema;
8449
+ }
8450
+ scopedKeys(schema) {
8451
+ return new Set(schema.sections.flatMap((section) => collectValueFieldKeys(section.fields)));
8452
+ }
8453
+ /** `store` narrowed to the keys `schema` declares. */
8454
+ narrowToScope(store, schema) {
8455
+ const keys = this.scopedKeys(schema);
8456
+ return Object.fromEntries(Object.entries(store).filter(([key]) => keys.has(key)));
8457
+ }
8458
+ scopedHandle(scope, cap, schema, nodeId) {
8459
+ return createScopedSettings({
8460
+ schema,
8461
+ read: async () => {
8462
+ const declared = await this.requireScopedSchema(scope, cap);
8463
+ const stored = this.narrowToScope(await this.resolveGlobalStore(nodeId, cap), declared);
8464
+ const effective = collectHydratedFieldValues(hydrateSchema(declared, stored));
8465
+ return {
8466
+ ...Object.fromEntries([...effective].filter(([, value]) => value !== void 0)),
8467
+ ...stored
8468
+ };
8469
+ },
8470
+ write: (patch) => this.writeScoped(scope, cap, patch, nodeId),
8471
+ unset: (keys) => this.unsetScoped(scope, cap, keys, nodeId)
8472
+ });
8473
+ }
8474
+ /** The one write path of the scoped API: declared keys only, then the global patch. */
8475
+ async writeScoped(scope, cap, patch, nodeId) {
8476
+ assertDeclaredKeys(Object.keys(patch), this.scopedKeys(await this.requireScopedSchema(scope, cap)));
8477
+ if (await this.applyGlobalPatch(patch, scope === "node" ? nodeId : void 0, cap)) await this.onScopedSettingsChanged(scope, cap, Object.keys(patch));
8478
+ }
8479
+ /**
8480
+ * Remove declared keys of one scope. A secret goes through {@link clearSecrets} — its keychain
8481
+ * value is released exactly as there — and the emptied row is then removed; every other key is
8482
+ * removed by an `undefined` patch (which a secret transform would read as "keep").
8483
+ */
8484
+ async unsetScoped(scope, cap, keys, nodeId) {
8485
+ assertDeclaredKeys(keys, this.scopedKeys(await this.requireScopedSchema(scope, cap)));
8486
+ const target = scope === "node" ? nodeId : void 0;
8487
+ const tree = this.addonSecretTree();
8488
+ const secretKeys = keys.filter((key) => tree.has(key));
8489
+ const plainKeys = keys.filter((key) => !tree.has(key));
8490
+ let changed = false;
8491
+ if (plainKeys.length > 0) {
8492
+ const patch = Object.fromEntries(plainKeys.map((key) => [key, void 0]));
8493
+ changed = await this.applyGlobalPatch(patch, target, cap) || changed;
8494
+ }
8495
+ if (secretKeys.length > 0) {
8496
+ await this.clearSecretKeys(secretKeys, target, cap);
8497
+ const node = normalizeNodeId(target ?? this._ctx?.kernel?.localNodeId);
8498
+ const rows = secretKeys.map((key) => scope === "node" ? nodeScopedKey(key, node) : key);
8499
+ if (this._secretSettings !== null) await this._secretSettings.removeClearedKeys(rows);
8500
+ else await this._ctx?.settings?.writeAddonStore(Object.fromEntries(rows.map((row) => [row, void 0])));
8501
+ changed = true;
8502
+ }
8503
+ if (changed) await this.onScopedSettingsChanged(scope, cap, [...keys]);
8504
+ }
8505
+ /**
8506
+ * The hydrated form of one scope of one capability's settings (any
8507
+ * {@link scopedSettingsOverlay} applied), or `null` when the capability declares nothing there.
8508
+ */
8509
+ async getScopedSettings(scope, cap, nodeId) {
8510
+ const schema = await this.declaredScopedSchema(scope, cap);
8511
+ if (schema === null) return null;
8512
+ const stored = this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema);
8513
+ const overlay = await this.scopedSettingsOverlay(scope, cap, nodeId);
8514
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(stored, overlay) : stored, { inlineSecretsAsViews: true });
8515
+ }
8516
+ /** The OPERATOR's write of declared keys of one scope (D787 secret semantics). */
8517
+ async updateScopedSettings(scope, cap, patch, nodeId) {
8518
+ this._operatorWriteDepth++;
8519
+ try {
8520
+ await this.writeScoped(scope, cap, patch, nodeId);
8521
+ } finally {
8522
+ this._operatorWriteDepth--;
8523
+ }
8524
+ }
8525
+ /**
8526
+ * The effective values (`stored ?? default`) of one scope, a secret as its `set` view — never
8527
+ * its value. `null` when the capability declares nothing for the scope.
8528
+ */
8529
+ async readScopedValues(scope, cap, nodeId) {
8530
+ const schema = await this.declaredScopedSchema(scope, cap);
8531
+ if (schema === null) return null;
8532
+ const form = hydrateSchema(schema, this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema), { inlineSecretsAsViews: true });
8533
+ return Object.fromEntries([...collectHydratedFieldValues(form)].filter(([, value]) => value !== void 0));
8534
+ }
8535
+ /**
8297
8536
  * What the create wizard and the integration edit page render for one instance: the addon's
8298
8537
  * per-instance schema when it declares one, else its global schema (what they always showed).
8299
8538
  */
@@ -8445,6 +8684,9 @@ var BaseAddon = class {
8445
8684
  * a keychain (an older kernel) it writes `''`, as such code always did.
8446
8685
  */
8447
8686
  async clearSecrets(keys, nodeId) {
8687
+ await this.clearSecretKeys(keys, nodeId);
8688
+ }
8689
+ async clearSecretKeys(keys, nodeId, cap) {
8448
8690
  const tree = this.addonSecretTree();
8449
8691
  const keychain = this._ctx?.secrets !== void 0;
8450
8692
  const stored = keychain ? await this.readAddonStoreWithRetry() : {};
@@ -8457,25 +8699,27 @@ var BaseAddon = class {
8457
8699
  const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
8458
8700
  patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
8459
8701
  }
8460
- await this.applyGlobalPatch(patch, nodeId);
8702
+ await this.applyGlobalPatch(patch, nodeId, cap);
8461
8703
  }
8462
- async applyGlobalPatch(barePatch, nodeId) {
8463
- await this.loadScopedSchemas();
8464
- const keys = this.perNodeKeys();
8704
+ /** Resolves `true` when the write changed stored values. */
8705
+ async applyGlobalPatch(barePatch, nodeId, cap) {
8706
+ await this.loadScopedSchemas(cap);
8707
+ const keys = this.perNodeKeys(cap);
8465
8708
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
8466
8709
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
8467
8710
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
8468
8711
  const handle = this._secretSettings;
8469
8712
  if (handle !== null) {
8470
8713
  const { changed } = await handle.writeAddonStore(scoped);
8471
- if (!changed) return;
8714
+ if (!changed) return false;
8472
8715
  } else await this._ctx?.settings?.writeAddonStore(scoped);
8473
- if (target !== localNode) return;
8716
+ if (target !== localNode) return true;
8474
8717
  await this.resolveConfig();
8475
8718
  await this.onConfigChanged();
8476
8719
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
8477
8720
  const legacy = this.globalSettingsSchema();
8478
8721
  this.maybeAutoRestart(Object.keys(barePatch), [...legacy === null ? [] : [legacy], ...this.loadedScopedSchemas().map((entry) => entry.schema)]);
8722
+ return true;
8479
8723
  }
8480
8724
  /**
8481
8725
  * The set of field keys the global settings schema declares `perNode: true`
@@ -10723,7 +10967,6 @@ var CAP_NAMES = Object.freeze([
10723
10967
  "notifier",
10724
10968
  "numeric-sensor",
10725
10969
  "oauth-integration",
10726
- "oidc-connections",
10727
10970
  "osd",
10728
10971
  "osd-manager",
10729
10972
  "pet-feeder",
@@ -12615,8 +12858,7 @@ Object.freeze({
12615
12858
  "device-provider": { "reloadDevice": 18e4 },
12616
12859
  "llm": {
12617
12860
  "generate": 6e5,
12618
- "generateVision": 6e5,
12619
- "testProfile": 6e5
12861
+ "generateVision": 6e5
12620
12862
  },
12621
12863
  "llm-runtime": {
12622
12864
  "complete": 6e5,
@@ -14211,17 +14453,18 @@ var IntegrationInstanceRefSchema = object({
14211
14453
  * message to what the kind supports — callers never special-case a service.
14212
14454
  *
14213
14455
  * DESIGN DECISIONS (locked):
14214
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14215
- * `setTargetEnabled`), each provider persisting via the `settings-store`
14216
- * cap. Rationale: the admin UI needs one uniform surface across the
14217
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14218
- * alternative would fork the UI per addon and cannot host the
14219
- * discovery→adopt flow.
14220
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14221
- * the generated cap-mount auto-`concatCollection`-fans them across every
14222
- * registered provider (notifiers addon + HA addon) so one catalog is
14223
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14224
- * `addonId` the generated collection router extracts from the call input.
14456
+ * - A target is an INSTANCE of this function cap (epic #440, step 6): the
14457
+ * providers serve their targets as `integration-instances` records, one
14458
+ * record kind per target kind, and the admin lists, adds, edits, switches
14459
+ * and deletes them through that cap. This cap keeps what an instance cannot
14460
+ * say: the kind catalogue (`listTargetKinds`: capabilities, delivery
14461
+ * parameters, brand icon), dispatch (`send`, `testTarget`) and the form
14462
+ * helpers (`discoverTargets`, `probeTargetConfig`).
14463
+ * - `listTargetKinds` / `discoverTargets` return arrays → the generated
14464
+ * cap-mount auto-`concatCollection`-fans them across every registered
14465
+ * provider so one catalog is routable. `send` / `testTarget` /
14466
+ * `probeTargetConfig` route to ONE provider by the `addonId` the generated
14467
+ * collection router extracts from the call input.
14225
14468
  * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14226
14469
  * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14227
14470
  * `storage` / `storage-provider` / `recording` caps over the same path. No
@@ -14466,7 +14709,7 @@ var TargetKindCapsSchema = object({
14466
14709
  * the union is large and not meant for runtime validation here; the exported
14467
14710
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14468
14711
  */
14469
- var ConfigSchemaPassthrough$4 = unknown();
14712
+ var ConfigSchemaPassthrough$3 = unknown();
14470
14713
  var TargetKindSchema = object({
14471
14714
  kind: string(),
14472
14715
  label: string(),
@@ -14503,7 +14746,7 @@ var TargetKindSchema = object({
14503
14746
  * its raster path, which is the safe default for an unknown image.
14504
14747
  */
14505
14748
  iconMediaType: string().optional(),
14506
- configSchema: ConfigSchemaPassthrough$4,
14749
+ configSchema: ConfigSchemaPassthrough$3,
14507
14750
  /**
14508
14751
  * The config keys that decide WHERE this kind's secrets are sent (server,
14509
14752
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -14525,9 +14768,11 @@ var TargetKindSchema = object({
14525
14768
  caps: TargetKindCapsSchema
14526
14769
  });
14527
14770
  /**
14528
- * A persisted target. `config` holds secrets; providers REDACT secret fields
14529
- * (return a presence marker only) when serving `listTargets` — never
14530
- * round-trip a stored secret to the UI.
14771
+ * A target as a provider's own code sees it (the notification-center bridge, the
14772
+ * send path): the flat record body split into the name, the switch and the
14773
+ * kind's fields. `config` holds secrets; a reader that serves it to a client
14774
+ * REDACTS secret fields (a presence marker only) — never round-trip a stored
14775
+ * secret to the UI.
14531
14776
  */
14532
14777
  var TargetSchema = object({
14533
14778
  id: string(),
@@ -14570,13 +14815,13 @@ var ProbeTargetConfigResultSchema = object({
14570
14815
  stateInstance: string().optional(),
14571
14816
  error: string().optional()
14572
14817
  });
14573
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
14818
+ method(object({}), array(TargetKindSchema)), method(object({
14574
14819
  kind: string(),
14575
14820
  config: record(string(), unknown()).optional(),
14576
14821
  /**
14577
14822
  * When editing / duplicating, the blank password field never round-trips
14578
14823
  * the stored token. Pass the source target id so the provider can restore
14579
- * secrets server-side before dialling (same merge as upsert).
14824
+ * secrets server-side before dialling.
14580
14825
  */
14581
14826
  targetId: string().optional()
14582
14827
  }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
@@ -14599,27 +14844,6 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
14599
14844
  }), TestResultSchema, {
14600
14845
  kind: "mutation",
14601
14846
  auth: "admin"
14602
- }), method(object({
14603
- target: TargetSchema,
14604
- /**
14605
- * Duplicate flow: create a NEW target id while copying secrets from an
14606
- * existing row. The UI never holds the stored token; blank / redacted
14607
- * password fields are restored from this source (D634 still applies if
14608
- * destinations diverge without a re-typed secret).
14609
- */
14610
- cloneSecretsFrom: string().optional()
14611
- }), TargetSchema, {
14612
- kind: "mutation",
14613
- auth: "admin"
14614
- }), method(object({ targetId: string() }), _void(), {
14615
- kind: "mutation",
14616
- auth: "admin"
14617
- }), method(object({
14618
- targetId: string(),
14619
- enabled: boolean()
14620
- }), _void(), {
14621
- kind: "mutation",
14622
- auth: "admin"
14623
14847
  });
14624
14848
  looseObject({
14625
14849
  name: string().min(1),
@@ -23199,7 +23423,6 @@ var SYSTEM_CAP_VOCABULARY = {
23199
23423
  "notification-output": system("notification delivery — reached through notifier devices and rules"),
23200
23424
  "notification-rules": system("notification rules — authored on their own page"),
23201
23425
  "oauth-integration": system(IDENTITY),
23202
- "oidc-connections": system(IDENTITY),
23203
23426
  "osd-manager": system(PIPELINE),
23204
23427
  "pipeline-executor": system(PIPELINE),
23205
23428
  "pipeline-orchestrator": system(PIPELINE),
@@ -45341,6 +45564,8 @@ var SettingsSchemaWithValuesSchema = object({
45341
45564
  });
45342
45565
  /** Patch object — keys are field names, values are the new field values. */
45343
45566
  var SettingsPatchSchema = record(string(), unknown());
45567
+ /** The scope of a scoped-settings call (D986): where the capability declared the values. */
45568
+ var ScopedSettingsScopeSchema = _enum(SCOPED_SETTINGS_SCOPES);
45344
45569
  /** Standard success response for update operations. */
45345
45570
  var SettingsUpdateResultSchema = object({ success: literal(true) });
45346
45571
  method(object({
@@ -45356,6 +45581,25 @@ method(object({
45356
45581
  kind: "mutation",
45357
45582
  auth: "admin"
45358
45583
  }), method(object({
45584
+ addonId: string(),
45585
+ cap: string(),
45586
+ scope: ScopedSettingsScopeSchema,
45587
+ nodeId: string().optional()
45588
+ }), SettingsSchemaWithValuesSchema.nullable()), method(object({
45589
+ addonId: string(),
45590
+ cap: string(),
45591
+ scope: ScopedSettingsScopeSchema,
45592
+ nodeId: string().optional(),
45593
+ patch: SettingsPatchSchema
45594
+ }), SettingsUpdateResultSchema, {
45595
+ kind: "mutation",
45596
+ auth: "admin"
45597
+ }), method(object({
45598
+ addonId: string(),
45599
+ cap: string(),
45600
+ scope: ScopedSettingsScopeSchema,
45601
+ nodeId: string().optional()
45602
+ }), record(string(), unknown()).nullable()), method(object({
45359
45603
  addonId: string(),
45360
45604
  nodeId: string().optional()
45361
45605
  }), SettingsSchemaWithValuesSchema.nullable()), method(object({
@@ -55211,7 +55455,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
55211
55455
  * or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
55212
55456
  * clears it.
55213
55457
  */
55214
- var ConfigSchemaPassthrough$3 = custom();
55458
+ var ConfigSchemaPassthrough$2 = custom();
55215
55459
  var IntegrationInstanceIdSchema = string().min(1);
55216
55460
  var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
55217
55461
  /**
@@ -55257,7 +55501,16 @@ var IntegrationInstanceKindSchema = object({
55257
55501
  /** Relative hub path to start an interactive account link of an instance of this kind. */
55258
55502
  connectPath: string().min(1).optional(),
55259
55503
  /** Relative hub path to disconnect that account. */
55260
- disconnectPath: string().min(1).optional()
55504
+ disconnectPath: string().min(1).optional(),
55505
+ /**
55506
+ * Parts of the edit dialog the flat form cannot draw (a node picker, a model source), named by a
55507
+ * GENERIC widget id the client maps to a component; a client that knows none of them shows none.
55508
+ * `connection` widgets write connection values, `model` widgets own the model choice.
55509
+ */
55510
+ widgets: array(object({
55511
+ id: string().min(1),
55512
+ placement: _enum(["connection", "model"])
55513
+ })).optional()
55261
55514
  });
55262
55515
  /**
55263
55516
  * How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
@@ -55355,7 +55608,7 @@ method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }), method
55355
55608
  id: IntegrationInstanceIdSchema.nullable(),
55356
55609
  /** The kind of the create form (`id: null`) of a provider with several. */
55357
55610
  kind: string().min(1).optional()
55358
- }), ConfigSchemaPassthrough$3, { auth: "admin" }), method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }), method(object({
55611
+ }), ConfigSchemaPassthrough$2, { auth: "admin" }), method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }), method(object({
55359
55612
  id: IntegrationInstanceIdSchema.optional(),
55360
55613
  name: string().min(1),
55361
55614
  kind: string().min(1).optional(),
@@ -56287,12 +56540,12 @@ var LlmModelInfoSchema = object({
56287
56540
  });
56288
56541
  /**
56289
56542
  * The provider-specific part of a profile, validated by the provider that owns
56290
- * the kind (`upsertProfile` refuses what it does not accept). A field its
56543
+ * the kind (saving an instance refuses what it does not accept). A field its
56291
56544
  * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
56292
56545
  * keychain, never in the row, and reads back as the redaction marker.
56293
56546
  */
56294
56547
  var LlmProviderConfigSchema = record(string(), unknown());
56295
- var LlmProfileSchema = object({
56548
+ object({
56296
56549
  id: string(),
56297
56550
  name: string(),
56298
56551
  /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
@@ -56386,8 +56639,8 @@ var LlmProviderWidgetSchema = object({
56386
56639
  /** ConfigUISchema tree passed through untyped on the wire (the
56387
56640
  * notification-output `ConfigSchemaPassthrough` precedent at
56388
56641
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
56389
- var ConfigSchemaPassthrough$2 = unknown();
56390
- var LlmProfileKindDescriptorSchema = object({
56642
+ var ConfigSchemaPassthrough$1 = unknown();
56643
+ object({
56391
56644
  kind: LlmProfileKindSchema,
56392
56645
  label: string(),
56393
56646
  /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
@@ -56395,9 +56648,9 @@ var LlmProfileKindDescriptorSchema = object({
56395
56648
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
56396
56649
  addonId: string(),
56397
56650
  /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
56398
- connectionSchema: ConfigSchemaPassthrough$2,
56651
+ connectionSchema: ConfigSchemaPassthrough$1,
56399
56652
  /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
56400
- advancedSchema: ConfigSchemaPassthrough$2.optional(),
56653
+ advancedSchema: ConfigSchemaPassthrough$1.optional(),
56401
56654
  /** The kind's defaults; a model from `listModels` may override any of them. */
56402
56655
  features: LlmModelFeaturesSchema,
56403
56656
  /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
@@ -56526,20 +56779,7 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
56526
56779
  }), method(object({
56527
56780
  addonId: string().optional(),
56528
56781
  requestId: string()
56529
- }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
56530
- kind: "mutation",
56531
- auth: "admin"
56532
- }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
56533
- kind: "mutation",
56534
- auth: "admin"
56535
- }), method(ProfileRefInputSchema, _void(), {
56536
- kind: "mutation",
56537
- auth: "admin"
56538
- }), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
56539
- kind: "mutation",
56540
- auth: "admin",
56541
- timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
56542
- }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
56782
+ }), _void(), { kind: "mutation" }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
56543
56783
  kind: "mutation",
56544
56784
  auth: "admin"
56545
56785
  }), method(object({}), array(LlmDefaultSchema)), method(object({
@@ -57534,20 +57774,7 @@ method(_void(), MeshStatusSchema), method(object({
57534
57774
  /** Optional hostname override the host should advertise once joined. */
57535
57775
  hostname: string().optional() }), object({
57536
57776
  /** Authentication URL the operator should open in a browser. */
57537
- 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({
57538
- /** Optional auth key — when provided, probes the key validity
57539
- * against the provider's API. Omit when already joined to
57540
- * just ping the daemon. */
57541
- authKey: string().optional() }), object({
57542
- ok: boolean(),
57543
- /** Provider-side identifier resolved by the probe (tailnet
57544
- * name for Tailscale, network id for ZeroTier, etc.). */
57545
- tenant: string().optional(),
57546
- /** Daemon binary version, when reachable. */
57547
- daemonVersion: string().optional(),
57548
- /** Human-readable error when `ok: false`. */
57549
- error: string().optional()
57550
- }), { kind: "mutation" });
57777
+ 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() }));
57551
57778
  object({
57552
57779
  value: number().nullable().meta(readingMeta("device", { label: "Total" })),
57553
57780
  lastFetchedAt: number()
@@ -67683,61 +67910,6 @@ var OauthIntegrationDescriptorSchema = object({
67683
67910
  });
67684
67911
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
67685
67912
  /**
67686
- * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
67687
- *
67688
- * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
67689
- * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
67690
- * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
67691
- * immutable after create.
67692
- */
67693
- var ConfigSchemaPassthrough$1 = unknown();
67694
- var OidcConnectionSchema = object({
67695
- id: string().min(1),
67696
- displayName: string(),
67697
- icon: string(),
67698
- issuerUrl: string(),
67699
- clientId: string(),
67700
- /** Client id + secret present — never the secret value. */
67701
- configured: boolean(),
67702
- /**
67703
- * Values for the connection form schema. `clientSecret` is a keychain
67704
- * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
67705
- */
67706
- formValues: record(string(), unknown()).optional()
67707
- });
67708
- /**
67709
- * Patch one connection. Omitted or empty `clientSecret` keeps the stored
67710
- * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
67711
- */
67712
- var OidcConnectionUpdateInputSchema = object({
67713
- id: string().min(1),
67714
- displayName: string().min(1),
67715
- icon: string().optional(),
67716
- issuerUrl: string().optional(),
67717
- clientId: string().optional(),
67718
- clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
67719
- redirectUri: string().optional(),
67720
- scopes: string().optional(),
67721
- usernameClaim: _enum([
67722
- "preferred_username",
67723
- "email",
67724
- "sub"
67725
- ]).optional()
67726
- });
67727
- method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
67728
- id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
67729
- displayName: string().min(1)
67730
- }), object({ id: string() }), {
67731
- kind: "mutation",
67732
- auth: "admin"
67733
- }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
67734
- kind: "mutation",
67735
- auth: "admin"
67736
- }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
67737
- kind: "mutation",
67738
- auth: "admin"
67739
- });
67740
- /**
67741
67913
  * Generic on-screen-display (video overlay) cap. Each camera exposes
67742
67914
  * a firmware-defined list of overlays (channel name, timestamp,
67743
67915
  * watermark, logo, …); the cap models them as a homogeneous array of
@@ -75139,21 +75311,6 @@ method(object({
75139
75311
  */
75140
75312
  ttlSec: union([number().int().positive(), literal("never")]).optional()
75141
75313
  }), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
75142
- var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
75143
- providerId: string().min(1),
75144
- displayName: string().min(1),
75145
- configSchema: unknown(),
75146
- nodeLocal: boolean(),
75147
- shouldSaveDiskSpace: literal(true),
75148
- minFreePercent: number().min(0).max(100)
75149
- }), object({
75150
- providerId: string().min(1),
75151
- displayName: string().min(1),
75152
- configSchema: unknown(),
75153
- nodeLocal: boolean(),
75154
- shouldSaveDiskSpace: literal(false),
75155
- minFreePercent: literal(null)
75156
- })]);
75157
75314
  method(object({
75158
75315
  location: StorageLocationRefSchema,
75159
75316
  relativePath: string()
@@ -75215,42 +75372,7 @@ method(object({
75215
75372
  }), _instanceof(Uint8Array), { auth: "admin" }), method(object({ downloadId: string() }), _void(), {
75216
75373
  kind: "mutation",
75217
75374
  auth: "admin"
75218
- }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(StorageLocationSchema.omit({
75219
- createdAt: true,
75220
- updatedAt: true
75221
- }), StorageLocationSchema, {
75222
- kind: "mutation",
75223
- auth: "admin"
75224
- }), method(object({
75225
- id: string(),
75226
- force: boolean().optional()
75227
- }), _void(), {
75228
- kind: "mutation",
75229
- auth: "admin"
75230
- }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
75231
- ok: boolean(),
75232
- error: string().optional()
75233
- }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
75234
- providerId: string(),
75235
- /**
75236
- * The location this config is an UNSAVED edit of, when there is one.
75237
- *
75238
- * `listLocations` replaces every declared secret with the redaction
75239
- * sentinel, so the edit modal's form state holds the sentinel for any
75240
- * credential the operator did not retype — and posting that here
75241
- * without a way to resolve it makes the provider try to authenticate
75242
- * as `__camstack_redacted__` and report the operator's own working
75243
- * password as wrong. Given this id, the orchestrator restores each
75244
- * sentinel from the stored config (same rule as `upsertLocation`)
75245
- * before dispatching. Omitted by the "Add location" wizard, where
75246
- * every value was typed just now and nothing is stored yet.
75247
- */
75248
- locationId: string().optional(),
75249
- config: record(string(), unknown())
75250
- }), object({
75251
- ok: boolean(),
75252
- error: string().optional()
75253
- }), { auth: "admin" });
75375
+ }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(_void(), array(StorageDrainProgressSchema).readonly());
75254
75376
  /** One table of the settings database. */
75255
75377
  var StorageTableSchema = object({
75256
75378
  /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
@@ -79431,6 +79553,20 @@ Object.freeze({
79431
79553
  access: "view",
79432
79554
  role: "admin"
79433
79555
  },
79556
+ "addonSettings.getScopedSettings": {
79557
+ capName: "addon-settings",
79558
+ capScope: "system",
79559
+ addonId: null,
79560
+ access: "view",
79561
+ role: "admin"
79562
+ },
79563
+ "addonSettings.readScopedValues": {
79564
+ capName: "addon-settings",
79565
+ capScope: "system",
79566
+ addonId: null,
79567
+ access: "view",
79568
+ role: "admin"
79569
+ },
79434
79570
  "addonSettings.unsetStoredSettingsKeys": {
79435
79571
  capName: "addon-settings",
79436
79572
  capScope: "system",
@@ -79452,6 +79588,13 @@ Object.freeze({
79452
79588
  access: "create",
79453
79589
  role: "admin"
79454
79590
  },
79591
+ "addonSettings.updateScopedSettings": {
79592
+ capName: "addon-settings",
79593
+ capScope: "system",
79594
+ addonId: null,
79595
+ access: "create",
79596
+ role: "admin"
79597
+ },
79455
79598
  "addonWidgets.listWidgets": {
79456
79599
  capName: "addon-widgets",
79457
79600
  capScope: "system",
@@ -82903,13 +83046,6 @@ Object.freeze({
82903
83046
  access: "delete",
82904
83047
  role: "admin"
82905
83048
  },
82906
- "llm.deleteProfile": {
82907
- capName: "llm",
82908
- capScope: "system",
82909
- addonId: null,
82910
- access: "delete",
82911
- role: "admin"
82912
- },
82913
83049
  "llm.generate": {
82914
83050
  capName: "llm",
82915
83051
  capScope: "system",
@@ -82973,20 +83109,6 @@ Object.freeze({
82973
83109
  access: "view",
82974
83110
  role: "admin"
82975
83111
  },
82976
- "llm.listProfileKinds": {
82977
- capName: "llm",
82978
- capScope: "system",
82979
- addonId: null,
82980
- access: "view",
82981
- role: "admin"
82982
- },
82983
- "llm.listProfiles": {
82984
- capName: "llm",
82985
- capScope: "system",
82986
- addonId: null,
82987
- access: "view",
82988
- role: "admin"
82989
- },
82990
83112
  "llm.listRuntimeNodes": {
82991
83113
  capName: "llm",
82992
83114
  capScope: "system",
@@ -82994,13 +83116,6 @@ Object.freeze({
82994
83116
  access: "view",
82995
83117
  role: "admin"
82996
83118
  },
82997
- "llm.migrateRawSecrets": {
82998
- capName: "llm",
82999
- capScope: "system",
83000
- addonId: null,
83001
- access: "create",
83002
- role: "admin"
83003
- },
83004
83119
  "llm.resolveModelRef": {
83005
83120
  capName: "llm",
83006
83121
  capScope: "system",
@@ -83029,20 +83144,6 @@ Object.freeze({
83029
83144
  access: "create",
83030
83145
  role: "admin"
83031
83146
  },
83032
- "llm.testProfile": {
83033
- capName: "llm",
83034
- capScope: "system",
83035
- addonId: null,
83036
- access: "create",
83037
- role: "admin"
83038
- },
83039
- "llm.upsertProfile": {
83040
- capName: "llm",
83041
- capScope: "system",
83042
- addonId: null,
83043
- access: "create",
83044
- role: "admin"
83045
- },
83046
83147
  "llmRuntime.appleAvailability": {
83047
83148
  capName: "llm-runtime",
83048
83149
  capScope: "system",
@@ -83547,13 +83648,6 @@ Object.freeze({
83547
83648
  access: "create",
83548
83649
  role: "admin"
83549
83650
  },
83550
- "meshNetwork.testConnection": {
83551
- capName: "mesh-network",
83552
- capScope: "system",
83553
- addonId: null,
83554
- access: "create",
83555
- role: "admin"
83556
- },
83557
83651
  "meter.getStatus": {
83558
83652
  capName: "meter",
83559
83653
  capScope: "device",
@@ -84212,13 +84306,6 @@ Object.freeze({
84212
84306
  access: "create",
84213
84307
  role: "admin"
84214
84308
  },
84215
- "notificationOutput.deleteTarget": {
84216
- capName: "notification-output",
84217
- capScope: "system",
84218
- addonId: null,
84219
- access: "delete",
84220
- role: "admin"
84221
- },
84222
84309
  "notificationOutput.discoverTargets": {
84223
84310
  capName: "notification-output",
84224
84311
  capScope: "system",
@@ -84226,13 +84313,6 @@ Object.freeze({
84226
84313
  access: "view",
84227
84314
  role: "admin"
84228
84315
  },
84229
- "notificationOutput.getTarget": {
84230
- capName: "notification-output",
84231
- capScope: "system",
84232
- addonId: null,
84233
- access: "view",
84234
- role: "admin"
84235
- },
84236
84316
  "notificationOutput.listTargetKinds": {
84237
84317
  capName: "notification-output",
84238
84318
  capScope: "system",
@@ -84240,13 +84320,6 @@ Object.freeze({
84240
84320
  access: "view",
84241
84321
  role: "admin"
84242
84322
  },
84243
- "notificationOutput.listTargets": {
84244
- capName: "notification-output",
84245
- capScope: "system",
84246
- addonId: null,
84247
- access: "view",
84248
- role: "admin"
84249
- },
84250
84323
  "notificationOutput.probeTargetConfig": {
84251
84324
  capName: "notification-output",
84252
84325
  capScope: "system",
@@ -84261,13 +84334,6 @@ Object.freeze({
84261
84334
  access: "create",
84262
84335
  role: "admin"
84263
84336
  },
84264
- "notificationOutput.setTargetEnabled": {
84265
- capName: "notification-output",
84266
- capScope: "system",
84267
- addonId: null,
84268
- access: "create",
84269
- role: "admin"
84270
- },
84271
84337
  "notificationOutput.testTarget": {
84272
84338
  capName: "notification-output",
84273
84339
  capScope: "system",
@@ -84275,13 +84341,6 @@ Object.freeze({
84275
84341
  access: "create",
84276
84342
  role: "admin"
84277
84343
  },
84278
- "notificationOutput.upsertTarget": {
84279
- capName: "notification-output",
84280
- capScope: "system",
84281
- addonId: null,
84282
- access: "create",
84283
- role: "admin"
84284
- },
84285
84344
  "notificationRules.activateAlarmProfile": {
84286
84345
  capName: "notification-rules",
84287
84346
  capScope: "system",
@@ -84541,41 +84600,6 @@ Object.freeze({
84541
84600
  access: "view",
84542
84601
  role: "admin"
84543
84602
  },
84544
- "oidcConnections.connectionFormSchema": {
84545
- capName: "oidc-connections",
84546
- capScope: "system",
84547
- addonId: null,
84548
- access: "view",
84549
- role: "admin"
84550
- },
84551
- "oidcConnections.createConnection": {
84552
- capName: "oidc-connections",
84553
- capScope: "system",
84554
- addonId: null,
84555
- access: "create",
84556
- role: "admin"
84557
- },
84558
- "oidcConnections.deleteConnection": {
84559
- capName: "oidc-connections",
84560
- capScope: "system",
84561
- addonId: null,
84562
- access: "delete",
84563
- role: "admin"
84564
- },
84565
- "oidcConnections.listConnections": {
84566
- capName: "oidc-connections",
84567
- capScope: "system",
84568
- addonId: null,
84569
- access: "view",
84570
- role: "admin"
84571
- },
84572
- "oidcConnections.updateConnection": {
84573
- capName: "oidc-connections",
84574
- capScope: "system",
84575
- addonId: null,
84576
- access: "create",
84577
- role: "admin"
84578
- },
84579
84603
  "osd.getStatus": {
84580
84604
  capName: "osd",
84581
84605
  capScope: "device",
@@ -87607,13 +87631,6 @@ Object.freeze({
87607
87631
  access: "delete",
87608
87632
  role: "admin"
87609
87633
  },
87610
- "storage.deleteLocation": {
87611
- capName: "storage",
87612
- capScope: "system",
87613
- addonId: null,
87614
- access: "delete",
87615
- role: "admin"
87616
- },
87617
87634
  "storage.endDownload": {
87618
87635
  capName: "storage",
87619
87636
  capScope: "system",
@@ -87670,13 +87687,6 @@ Object.freeze({
87670
87687
  access: "view",
87671
87688
  role: "admin"
87672
87689
  },
87673
- "storage.listProviders": {
87674
- capName: "storage",
87675
- capScope: "system",
87676
- addonId: null,
87677
- access: "view",
87678
- role: "admin"
87679
- },
87680
87690
  "storage.read": {
87681
87691
  capName: "storage",
87682
87692
  capScope: "system",
@@ -87698,27 +87708,6 @@ Object.freeze({
87698
87708
  access: "view",
87699
87709
  role: "admin"
87700
87710
  },
87701
- "storage.testConfig": {
87702
- capName: "storage",
87703
- capScope: "system",
87704
- addonId: null,
87705
- access: "view",
87706
- role: "admin"
87707
- },
87708
- "storage.testLocation": {
87709
- capName: "storage",
87710
- capScope: "system",
87711
- addonId: null,
87712
- access: "view",
87713
- role: "admin"
87714
- },
87715
- "storage.upsertLocation": {
87716
- capName: "storage",
87717
- capScope: "system",
87718
- addonId: null,
87719
- access: "create",
87720
- role: "admin"
87721
- },
87722
87711
  "storage.write": {
87723
87712
  capName: "storage",
87724
87713
  capScope: "system",
@@ -98480,7 +98469,7 @@ var LoadShedController = class LoadShedController {
98480
98469
  return state?.pausedAt !== null && state?.pausedAt !== void 0;
98481
98470
  }
98482
98471
  /**
98483
- * Mirrors the former inline block inside `updateGlobalSettings`: clear
98472
+ * Mirrors the former inline block inside the cluster-write follow-up: clear
98484
98473
  * load-shed pauses so suspended cameras get re-evaluated with the new
98485
98474
  * thresholds on the next dispatch cycle, then re-dispatch each of them.
98486
98475
  */
@@ -104323,9 +104312,12 @@ var DeviceConfigContributions = class {
104323
104312
  constructor(deps) {
104324
104313
  this.deps = deps;
104325
104314
  }
104326
- async updateGlobalSettings(patch) {
104315
+ /**
104316
+ * The side effects of a cluster settings write that already landed. Runs BEFORE
104317
+ * `applyRuntimeSettings`, so `topology.clusterRoles` still holds the previous roles here.
104318
+ */
104319
+ async afterClusterSettingsWritten() {
104327
104320
  const previousIngestNode = this.deps.topology.clusterRoles.ingestNode;
104328
- await this.deps.baseUpdateGlobalSettings(patch);
104329
104321
  const full = await this.deps.resolveGlobalStore();
104330
104322
  this.deps.setGlobalSettings({ ...full });
104331
104323
  this.deps.applyRuntimeSettings(full);
@@ -107957,7 +107949,7 @@ async function resetClusterRows(deps, isCustom) {
107957
107949
  if (read.kind === "present") stored.set(key, read.value);
107958
107950
  }
107959
107951
  const { patch, cleared } = clusterRowsToReset((key) => stored.get(key), isCustom);
107960
- if (cleared.length > 0) await deps.updateGlobalSettings({ ...patch });
107952
+ if (cleared.length > 0) await deps.patchClusterSettings({ ...patch });
107961
107953
  return cleared;
107962
107954
  }
107963
107955
  function logResetPin(logger, pin, trigger) {
@@ -112761,7 +112753,6 @@ async function buildOrchestratorControllers(deps) {
112761
112753
  deviceHasOnboardMotionCap: (deviceId) => deps.deviceHasOnboardMotionCap(deviceId),
112762
112754
  deviceHasActivitySignalCap: (deviceId) => deps.deviceHasActivitySignalCap(deviceId),
112763
112755
  deviceHasNativeObjectDetectionCap: (deviceId) => deps.deviceHasNativeObjectDetectionCap(deviceId),
112764
- baseUpdateGlobalSettings: (patch) => deps.baseUpdateGlobalSettings(patch),
112765
112756
  resolveGlobalStore: () => deps.resolveGlobalStore(),
112766
112757
  setGlobalSettings: (settings) => {
112767
112758
  globalSettings = settings;
@@ -115238,6 +115229,8 @@ function findStaleDevicePins(pins, nodes) {
115238
115229
  * because nobody discovers it is missing until they need it.
115239
115230
  */
115240
115231
  var customActions = pipelineOrchestratorActions;
115232
+ /** The cluster form is read and written key by key; the declared schema refuses any other key. */
115233
+ var CLUSTER_VALUES_SCHEMA = record(string(), unknown());
115241
115234
  var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddon {
115242
115235
  /** This node's Moleculer nodeId (from this.ctx.kernel.localNodeId). */
115243
115236
  localNodeId = "hub";
@@ -115379,7 +115372,7 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
115379
115372
  /**
115380
115373
  * Device-details aggregator contributions (`getDeviceSettingsContribution`/
115381
115374
  * `getDeviceLiveContribution`/`applyDeviceSettingsPatch`/
115382
- * `updateGlobalSettings`/`writeDeviceOrchestratorSettings`/
115375
+ * `afterClusterSettingsWritten`/`writeDeviceOrchestratorSettings`/
115383
115376
  * `splitPipelinePatch`/`applyPipelinePatch`) — see
115384
115377
  * `device-config-contributions.ts` (S11 Task 1 extraction, C13 remnant).
115385
115378
  * Owns nothing durable (reads through injected closures); constructed in
@@ -115387,6 +115380,8 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
115387
115380
  * exist. Stateless — no `dispose()`, just nulled at the end of `onShutdown`.
115388
115381
  */
115389
115382
  deviceConfig = null;
115383
+ /** True while the removed-model pin sweep runs, so its own cluster writes never re-enter it. */
115384
+ pinResetRunning = false;
115390
115385
  /**
115391
115386
  * Read-only test-seam compat accessor — mirrors the pre-S9 `protected
115392
115387
  * remoteHealthAttempts` field so `remote-health.spec.ts`'s subclass
@@ -115539,7 +115534,6 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
115539
115534
  isIdleSessionCamera: (deviceId) => this.isIdleSessionCamera(deviceId),
115540
115535
  deviceSettingsSchema: () => this.deviceSettingsSchema(),
115541
115536
  resolveGlobalStore: () => this.resolveGlobalStore(),
115542
- baseUpdateGlobalSettings: (patch) => super.updateGlobalSettings(patch),
115543
115537
  watchCapability: (capNames, handlers) => this.watchCapability(capNames, handlers),
115544
115538
  state: this.state.bind(this),
115545
115539
  rebalance: (opts) => this.rebalance(opts),
@@ -117313,7 +117307,8 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
117313
117307
  const auto = this.effectiveShares().current();
117314
117308
  if (auto !== null) await this.setLoadBalancingShares(auto.weights);
117315
117309
  }
117316
- await this.updateGlobalSettings({ [SHARE_SOURCE_SETTING_KEY]: input.source });
117310
+ await this.state(SHARE_SOURCE_SETTING_KEY, ShareSourceSchema, DEFAULT_SHARE_SOURCE).set(input.source);
117311
+ await this.afterClusterWrite([SHARE_SOURCE_SETTING_KEY]);
117317
117312
  this.ctx.logger.info("load balancing: share source changed", { meta: {
117318
117313
  from: previous,
117319
117314
  to: input.source
@@ -117490,9 +117485,18 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
117490
117485
  deviceSettingsSchema() {
117491
117486
  return this.schema({ sections: buildDeviceSettingsSections({ runnerNodeIds: this.topology.collectRunnerNodeIds() }) });
117492
117487
  }
117493
- async updateGlobalSettings(patch) {
117494
- await this.deviceConfig.updateGlobalSettings(patch);
117495
- if (CLUSTER_MODEL_SCOPED_STEPS.some((step) => typeof patch[clusterModelSettingKey(step.stepId)] === "string")) await this.resetRemovedModelPins("cluster-row-write");
117488
+ /** The cluster form's stored values, written under their bare keys. */
117489
+ clusterStore() {
117490
+ return this.clusterSettings(PIPELINE_ORCHESTRATOR_ID, CLUSTER_VALUES_SCHEMA);
117491
+ }
117492
+ async onScopedSettingsChanged(scope, cap, keys) {
117493
+ if (scope !== "cluster" || cap !== "pipeline-orchestrator") return;
117494
+ await this.afterClusterWrite(keys);
117495
+ }
117496
+ async afterClusterWrite(keys) {
117497
+ if (this.deviceConfig === null) return;
117498
+ await this.deviceConfig.afterClusterSettingsWritten();
117499
+ if (CLUSTER_MODEL_SCOPED_STEPS.some((step) => keys.includes(clusterModelSettingKey(step.stepId))) && !this.pinResetRunning) await this.resetRemovedModelPins("cluster-row-write");
117496
117500
  }
117497
117501
  /**
117498
117502
  * The ONE stored-pin reset (D725): drop every pin to a model deleted from
@@ -117516,6 +117520,14 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
117516
117520
  });
117517
117521
  }
117518
117522
  async resetRemovedModelPins(trigger) {
117523
+ this.pinResetRunning = true;
117524
+ try {
117525
+ return await this.runRemovedModelPinReset(trigger);
117526
+ } finally {
117527
+ this.pinResetRunning = false;
117528
+ }
117529
+ }
117530
+ async runRemovedModelPinReset(trigger) {
117519
117531
  return resetRemovedModelPins({
117520
117532
  listCustomModels: async () => {
117521
117533
  const api = this.ctx.api;
@@ -117524,7 +117536,7 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
117524
117536
  },
117525
117537
  resetStoredPins: (isCustom) => this.settingsStore.resetRemovedModelPins(isCustom),
117526
117538
  readStoredGlobalKey: (key) => this.readStoredGlobalKey(key),
117527
- updateGlobalSettings: (patch) => this.deviceConfig.updateGlobalSettings(patch),
117539
+ patchClusterSettings: (patch) => this.clusterStore().patch(patch),
117528
117540
  redispatchNode: (nodeId) => this.placement.redispatchCamerasOnAgent(nodeId),
117529
117541
  logger: this.ctx.logger
117530
117542
  }, trigger);