@camstack/addon-pipeline-orchestrator 1.2.664 → 1.2.666

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/assets/viewer/.viewer-current-files.json +24 -24
  3. package/assets/viewer/.viewer-version +1 -1
  4. package/assets/viewer/_expo/static/js/web/Clipboard-cba253dbeeeb383ce66f3c84fbe67025.js +8 -0
  5. package/assets/viewer/_expo/static/js/web/Haptics-4770c6d7c73d2becf4ac20cfd82301e3.js +3 -0
  6. package/assets/viewer/_expo/static/js/web/[frameId]-528f1ef5ec6602be658268df473077be.js +23 -0
  7. package/assets/viewer/_expo/static/js/web/[id]-71ad765384f2942198bfca7743db54f1.js +61 -0
  8. package/assets/viewer/_expo/static/js/web/[id]-78f7c87c88400a873d0b533e7c23f76a.js +5 -0
  9. package/assets/viewer/_expo/static/js/web/[id]-9567e4993a3f1d89c3110b2641846af2.js +2 -0
  10. package/assets/viewer/_expo/static/js/web/[id]-f3da975fca51aba463a0f02017e72a65.js +7 -0
  11. package/assets/viewer/_expo/static/js/web/[section]-b015bac86cf9f4878c5e8039708fc7d1.js +31 -0
  12. package/assets/viewer/_expo/static/js/web/{__common-c1006820c503eeb932053de50a0c5744.js → __common-5347bf558599c0f47249bb63f3bc8096.js} +1836 -1836
  13. package/assets/viewer/_expo/static/js/web/_layout-fa940306541897e284d2e42a3dae7308.js +24 -0
  14. package/assets/viewer/_expo/static/js/web/add-server-dc8c504e936a81d69e40f6efa6ac7b2b.js +2 -0
  15. package/assets/viewer/_expo/static/js/web/adhoc-9d63ed0305edf18069cc3f3f2e6ccd1d.js +1 -0
  16. package/assets/viewer/_expo/static/js/web/alarm-8c1402344adf58c18245c2a1da1a316b.js +1 -0
  17. package/assets/viewer/_expo/static/js/web/cameras-6a7062fac61db150930c4ea824098806.js +27 -0
  18. package/assets/viewer/_expo/static/js/web/connect-a04da8316c872406a85fecfac72afb97.js +2 -0
  19. package/assets/viewer/_expo/static/js/web/enroll-6fe018df6035905080abf2163931500a.js +19 -0
  20. package/assets/viewer/_expo/static/js/web/history-7e0ec59e8eda500a3c79400f9d048933.js +3 -0
  21. package/assets/viewer/_expo/static/js/web/index-2d40982745027241350379ea664ebf48.js +1 -0
  22. package/assets/viewer/_expo/static/js/web/index-7fb91729ac1133d8e8e2873ea9046958.js +2 -0
  23. package/assets/viewer/_expo/static/js/web/index-8c0a589c651d0905b5f092442bdea699.js +1 -0
  24. package/assets/viewer/_expo/static/js/web/{index-bba520e9de4e43f8c1b628f27c49c35c.js → index-b2db94a55da06710686c8d231c3a160f.js} +2 -2
  25. package/assets/viewer/_expo/static/js/web/index-cdd684984f16d19f8d2c87782de30fa6.js +4 -0
  26. package/assets/viewer/_expo/static/js/web/new-41d5293ef3668dcabd305dd0cec83c60.js +2 -0
  27. package/assets/viewer/_expo/static/js/web/sign-in-ac807c2017f1f0665288ee84bfc94787.js +38 -0
  28. package/assets/viewer/index.html +1 -1
  29. package/dist/_stub.js +2 -2
  30. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-eCr2uk4a.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-DwIPrVyT.mjs} +2 -2
  31. package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DfqFDwlL.mjs +26 -0
  32. package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-Bvy1zYP3.mjs +26 -0
  33. package/dist/{hostInit-BMliBDra.mjs → hostInit-CvQwlIiI.mjs} +2 -2
  34. package/dist/index.js +376 -433
  35. package/dist/index.mjs +376 -433
  36. package/dist/remoteEntry.js +1 -1
  37. package/package.json +2 -2
  38. package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CSVAOMjE.mjs +0 -26
  39. package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-Dguynk7E.mjs +0 -26
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`. */
@@ -76481,7 +76603,7 @@ var TerminalInstanceInfoSchema = object({
76481
76603
  /**
76482
76604
  * False while the node the instance is bound to is not in the cluster
76483
76605
  * topology (forgotten, renamed, re-paired). The instance is kept; the
76484
- * operator re-points it with `updateInstance({ targetNodeId })`.
76606
+ * operator re-points it on the Terminal page.
76485
76607
  */
76486
76608
  nodeInCluster: boolean(),
76487
76609
  profileId: string(),
@@ -76519,41 +76641,7 @@ var TerminalOutputBatchSchema = object({
76519
76641
  snapshot: string().optional(),
76520
76642
  events: array(TerminalOutputEventSchema).readonly()
76521
76643
  });
76522
- method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalInstanceInfoSchema).readonly(), { auth: "admin" }), method(object({
76523
- targetNodeId: string().min(1),
76524
- profileId: string().min(1),
76525
- name: string().trim().min(1).max(160).optional(),
76526
- executable: string().max(1024).optional(),
76527
- args: array(string().max(2048)).max(64).optional(),
76528
- cwd: string().max(1024).optional(),
76529
- environment: array(string().max(4096)).max(64).optional(),
76530
- profileSettings: ProfileSettingsBagSchema.optional()
76531
- }), TerminalInstanceInfoSchema, {
76532
- kind: "mutation",
76533
- auth: "admin"
76534
- }), method(object({
76535
- instanceId: string().min(1),
76536
- /** Re-point the instance to another node; the profile must exist there. */
76537
- targetNodeId: string().min(1).max(256).optional(),
76538
- name: string().trim().min(1).max(160).optional(),
76539
- executable: string().max(1024).optional(),
76540
- args: array(string().max(2048)).max(64).optional(),
76541
- cwd: string().max(1024).optional(),
76542
- environment: array(string().max(4096)).max(64).optional(),
76543
- profileSettings: ProfileSettingsBagSchema.optional()
76544
- }), TerminalInstanceInfoSchema, {
76545
- kind: "mutation",
76546
- auth: "admin"
76547
- }), method(object({ instanceId: string().min(1) }), _void(), {
76548
- kind: "mutation",
76549
- auth: "admin"
76550
- }), method(object({
76551
- instanceId: string().min(1),
76552
- enabled: boolean()
76553
- }), TerminalInstanceInfoSchema, {
76554
- kind: "mutation",
76555
- auth: "admin"
76556
- }), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
76644
+ method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
76557
76645
  stableId: string().min(1),
76558
76646
  name: string().trim().min(1).max(160).optional()
76559
76647
  }), TerminalInstanceInfoSchema, {
@@ -79431,6 +79519,20 @@ Object.freeze({
79431
79519
  access: "view",
79432
79520
  role: "admin"
79433
79521
  },
79522
+ "addonSettings.getScopedSettings": {
79523
+ capName: "addon-settings",
79524
+ capScope: "system",
79525
+ addonId: null,
79526
+ access: "view",
79527
+ role: "admin"
79528
+ },
79529
+ "addonSettings.readScopedValues": {
79530
+ capName: "addon-settings",
79531
+ capScope: "system",
79532
+ addonId: null,
79533
+ access: "view",
79534
+ role: "admin"
79535
+ },
79434
79536
  "addonSettings.unsetStoredSettingsKeys": {
79435
79537
  capName: "addon-settings",
79436
79538
  capScope: "system",
@@ -79452,6 +79554,13 @@ Object.freeze({
79452
79554
  access: "create",
79453
79555
  role: "admin"
79454
79556
  },
79557
+ "addonSettings.updateScopedSettings": {
79558
+ capName: "addon-settings",
79559
+ capScope: "system",
79560
+ addonId: null,
79561
+ access: "create",
79562
+ role: "admin"
79563
+ },
79455
79564
  "addonWidgets.listWidgets": {
79456
79565
  capName: "addon-widgets",
79457
79566
  capScope: "system",
@@ -82903,13 +83012,6 @@ Object.freeze({
82903
83012
  access: "delete",
82904
83013
  role: "admin"
82905
83014
  },
82906
- "llm.deleteProfile": {
82907
- capName: "llm",
82908
- capScope: "system",
82909
- addonId: null,
82910
- access: "delete",
82911
- role: "admin"
82912
- },
82913
83015
  "llm.generate": {
82914
83016
  capName: "llm",
82915
83017
  capScope: "system",
@@ -82973,20 +83075,6 @@ Object.freeze({
82973
83075
  access: "view",
82974
83076
  role: "admin"
82975
83077
  },
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
83078
  "llm.listRuntimeNodes": {
82991
83079
  capName: "llm",
82992
83080
  capScope: "system",
@@ -82994,13 +83082,6 @@ Object.freeze({
82994
83082
  access: "view",
82995
83083
  role: "admin"
82996
83084
  },
82997
- "llm.migrateRawSecrets": {
82998
- capName: "llm",
82999
- capScope: "system",
83000
- addonId: null,
83001
- access: "create",
83002
- role: "admin"
83003
- },
83004
83085
  "llm.resolveModelRef": {
83005
83086
  capName: "llm",
83006
83087
  capScope: "system",
@@ -83029,20 +83110,6 @@ Object.freeze({
83029
83110
  access: "create",
83030
83111
  role: "admin"
83031
83112
  },
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
83113
  "llmRuntime.appleAvailability": {
83047
83114
  capName: "llm-runtime",
83048
83115
  capScope: "system",
@@ -83547,13 +83614,6 @@ Object.freeze({
83547
83614
  access: "create",
83548
83615
  role: "admin"
83549
83616
  },
83550
- "meshNetwork.testConnection": {
83551
- capName: "mesh-network",
83552
- capScope: "system",
83553
- addonId: null,
83554
- access: "create",
83555
- role: "admin"
83556
- },
83557
83617
  "meter.getStatus": {
83558
83618
  capName: "meter",
83559
83619
  capScope: "device",
@@ -84212,13 +84272,6 @@ Object.freeze({
84212
84272
  access: "create",
84213
84273
  role: "admin"
84214
84274
  },
84215
- "notificationOutput.deleteTarget": {
84216
- capName: "notification-output",
84217
- capScope: "system",
84218
- addonId: null,
84219
- access: "delete",
84220
- role: "admin"
84221
- },
84222
84275
  "notificationOutput.discoverTargets": {
84223
84276
  capName: "notification-output",
84224
84277
  capScope: "system",
@@ -84226,13 +84279,6 @@ Object.freeze({
84226
84279
  access: "view",
84227
84280
  role: "admin"
84228
84281
  },
84229
- "notificationOutput.getTarget": {
84230
- capName: "notification-output",
84231
- capScope: "system",
84232
- addonId: null,
84233
- access: "view",
84234
- role: "admin"
84235
- },
84236
84282
  "notificationOutput.listTargetKinds": {
84237
84283
  capName: "notification-output",
84238
84284
  capScope: "system",
@@ -84240,13 +84286,6 @@ Object.freeze({
84240
84286
  access: "view",
84241
84287
  role: "admin"
84242
84288
  },
84243
- "notificationOutput.listTargets": {
84244
- capName: "notification-output",
84245
- capScope: "system",
84246
- addonId: null,
84247
- access: "view",
84248
- role: "admin"
84249
- },
84250
84289
  "notificationOutput.probeTargetConfig": {
84251
84290
  capName: "notification-output",
84252
84291
  capScope: "system",
@@ -84261,13 +84300,6 @@ Object.freeze({
84261
84300
  access: "create",
84262
84301
  role: "admin"
84263
84302
  },
84264
- "notificationOutput.setTargetEnabled": {
84265
- capName: "notification-output",
84266
- capScope: "system",
84267
- addonId: null,
84268
- access: "create",
84269
- role: "admin"
84270
- },
84271
84303
  "notificationOutput.testTarget": {
84272
84304
  capName: "notification-output",
84273
84305
  capScope: "system",
@@ -84275,13 +84307,6 @@ Object.freeze({
84275
84307
  access: "create",
84276
84308
  role: "admin"
84277
84309
  },
84278
- "notificationOutput.upsertTarget": {
84279
- capName: "notification-output",
84280
- capScope: "system",
84281
- addonId: null,
84282
- access: "create",
84283
- role: "admin"
84284
- },
84285
84310
  "notificationRules.activateAlarmProfile": {
84286
84311
  capName: "notification-rules",
84287
84312
  capScope: "system",
@@ -84541,41 +84566,6 @@ Object.freeze({
84541
84566
  access: "view",
84542
84567
  role: "admin"
84543
84568
  },
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
84569
  "osd.getStatus": {
84580
84570
  capName: "osd",
84581
84571
  capScope: "device",
@@ -87607,13 +87597,6 @@ Object.freeze({
87607
87597
  access: "delete",
87608
87598
  role: "admin"
87609
87599
  },
87610
- "storage.deleteLocation": {
87611
- capName: "storage",
87612
- capScope: "system",
87613
- addonId: null,
87614
- access: "delete",
87615
- role: "admin"
87616
- },
87617
87600
  "storage.endDownload": {
87618
87601
  capName: "storage",
87619
87602
  capScope: "system",
@@ -87670,13 +87653,6 @@ Object.freeze({
87670
87653
  access: "view",
87671
87654
  role: "admin"
87672
87655
  },
87673
- "storage.listProviders": {
87674
- capName: "storage",
87675
- capScope: "system",
87676
- addonId: null,
87677
- access: "view",
87678
- role: "admin"
87679
- },
87680
87656
  "storage.read": {
87681
87657
  capName: "storage",
87682
87658
  capScope: "system",
@@ -87698,27 +87674,6 @@ Object.freeze({
87698
87674
  access: "view",
87699
87675
  role: "admin"
87700
87676
  },
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
87677
  "storage.write": {
87723
87678
  capName: "storage",
87724
87679
  capScope: "system",
@@ -88496,27 +88451,6 @@ Object.freeze({
88496
88451
  access: "create",
88497
88452
  role: "admin"
88498
88453
  },
88499
- "terminalSession.createInstance": {
88500
- capName: "terminal-session",
88501
- capScope: "system",
88502
- addonId: null,
88503
- access: "create",
88504
- role: "admin"
88505
- },
88506
- "terminalSession.deleteInstance": {
88507
- capName: "terminal-session",
88508
- capScope: "system",
88509
- addonId: null,
88510
- access: "delete",
88511
- role: "admin"
88512
- },
88513
- "terminalSession.listInstances": {
88514
- capName: "terminal-session",
88515
- capScope: "system",
88516
- addonId: null,
88517
- access: "view",
88518
- role: "admin"
88519
- },
88520
88454
  "terminalSession.listLegacyCameras": {
88521
88455
  capName: "terminal-session",
88522
88456
  capScope: "system",
@@ -88559,20 +88493,6 @@ Object.freeze({
88559
88493
  access: "create",
88560
88494
  role: "admin"
88561
88495
  },
88562
- "terminalSession.setInstanceEnabled": {
88563
- capName: "terminal-session",
88564
- capScope: "system",
88565
- addonId: null,
88566
- access: "create",
88567
- role: "admin"
88568
- },
88569
- "terminalSession.updateInstance": {
88570
- capName: "terminal-session",
88571
- capScope: "system",
88572
- addonId: null,
88573
- access: "create",
88574
- role: "admin"
88575
- },
88576
88496
  "terminalSession.writeInput": {
88577
88497
  capName: "terminal-session",
88578
88498
  capScope: "system",
@@ -98480,7 +98400,7 @@ var LoadShedController = class LoadShedController {
98480
98400
  return state?.pausedAt !== null && state?.pausedAt !== void 0;
98481
98401
  }
98482
98402
  /**
98483
- * Mirrors the former inline block inside `updateGlobalSettings`: clear
98403
+ * Mirrors the former inline block inside the cluster-write follow-up: clear
98484
98404
  * load-shed pauses so suspended cameras get re-evaluated with the new
98485
98405
  * thresholds on the next dispatch cycle, then re-dispatch each of them.
98486
98406
  */
@@ -104323,9 +104243,12 @@ var DeviceConfigContributions = class {
104323
104243
  constructor(deps) {
104324
104244
  this.deps = deps;
104325
104245
  }
104326
- async updateGlobalSettings(patch) {
104246
+ /**
104247
+ * The side effects of a cluster settings write that already landed. Runs BEFORE
104248
+ * `applyRuntimeSettings`, so `topology.clusterRoles` still holds the previous roles here.
104249
+ */
104250
+ async afterClusterSettingsWritten() {
104327
104251
  const previousIngestNode = this.deps.topology.clusterRoles.ingestNode;
104328
- await this.deps.baseUpdateGlobalSettings(patch);
104329
104252
  const full = await this.deps.resolveGlobalStore();
104330
104253
  this.deps.setGlobalSettings({ ...full });
104331
104254
  this.deps.applyRuntimeSettings(full);
@@ -107957,7 +107880,7 @@ async function resetClusterRows(deps, isCustom) {
107957
107880
  if (read.kind === "present") stored.set(key, read.value);
107958
107881
  }
107959
107882
  const { patch, cleared } = clusterRowsToReset((key) => stored.get(key), isCustom);
107960
- if (cleared.length > 0) await deps.updateGlobalSettings({ ...patch });
107883
+ if (cleared.length > 0) await deps.patchClusterSettings({ ...patch });
107961
107884
  return cleared;
107962
107885
  }
107963
107886
  function logResetPin(logger, pin, trigger) {
@@ -112761,7 +112684,6 @@ async function buildOrchestratorControllers(deps) {
112761
112684
  deviceHasOnboardMotionCap: (deviceId) => deps.deviceHasOnboardMotionCap(deviceId),
112762
112685
  deviceHasActivitySignalCap: (deviceId) => deps.deviceHasActivitySignalCap(deviceId),
112763
112686
  deviceHasNativeObjectDetectionCap: (deviceId) => deps.deviceHasNativeObjectDetectionCap(deviceId),
112764
- baseUpdateGlobalSettings: (patch) => deps.baseUpdateGlobalSettings(patch),
112765
112687
  resolveGlobalStore: () => deps.resolveGlobalStore(),
112766
112688
  setGlobalSettings: (settings) => {
112767
112689
  globalSettings = settings;
@@ -115238,6 +115160,8 @@ function findStaleDevicePins(pins, nodes) {
115238
115160
  * because nobody discovers it is missing until they need it.
115239
115161
  */
115240
115162
  var customActions = pipelineOrchestratorActions;
115163
+ /** The cluster form is read and written key by key; the declared schema refuses any other key. */
115164
+ var CLUSTER_VALUES_SCHEMA = record(string(), unknown());
115241
115165
  var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddon {
115242
115166
  /** This node's Moleculer nodeId (from this.ctx.kernel.localNodeId). */
115243
115167
  localNodeId = "hub";
@@ -115379,7 +115303,7 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
115379
115303
  /**
115380
115304
  * Device-details aggregator contributions (`getDeviceSettingsContribution`/
115381
115305
  * `getDeviceLiveContribution`/`applyDeviceSettingsPatch`/
115382
- * `updateGlobalSettings`/`writeDeviceOrchestratorSettings`/
115306
+ * `afterClusterSettingsWritten`/`writeDeviceOrchestratorSettings`/
115383
115307
  * `splitPipelinePatch`/`applyPipelinePatch`) — see
115384
115308
  * `device-config-contributions.ts` (S11 Task 1 extraction, C13 remnant).
115385
115309
  * Owns nothing durable (reads through injected closures); constructed in
@@ -115387,6 +115311,8 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
115387
115311
  * exist. Stateless — no `dispose()`, just nulled at the end of `onShutdown`.
115388
115312
  */
115389
115313
  deviceConfig = null;
115314
+ /** True while the removed-model pin sweep runs, so its own cluster writes never re-enter it. */
115315
+ pinResetRunning = false;
115390
115316
  /**
115391
115317
  * Read-only test-seam compat accessor — mirrors the pre-S9 `protected
115392
115318
  * remoteHealthAttempts` field so `remote-health.spec.ts`'s subclass
@@ -115539,7 +115465,6 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
115539
115465
  isIdleSessionCamera: (deviceId) => this.isIdleSessionCamera(deviceId),
115540
115466
  deviceSettingsSchema: () => this.deviceSettingsSchema(),
115541
115467
  resolveGlobalStore: () => this.resolveGlobalStore(),
115542
- baseUpdateGlobalSettings: (patch) => super.updateGlobalSettings(patch),
115543
115468
  watchCapability: (capNames, handlers) => this.watchCapability(capNames, handlers),
115544
115469
  state: this.state.bind(this),
115545
115470
  rebalance: (opts) => this.rebalance(opts),
@@ -117313,7 +117238,8 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
117313
117238
  const auto = this.effectiveShares().current();
117314
117239
  if (auto !== null) await this.setLoadBalancingShares(auto.weights);
117315
117240
  }
117316
- await this.updateGlobalSettings({ [SHARE_SOURCE_SETTING_KEY]: input.source });
117241
+ await this.state(SHARE_SOURCE_SETTING_KEY, ShareSourceSchema, DEFAULT_SHARE_SOURCE).set(input.source);
117242
+ await this.afterClusterWrite([SHARE_SOURCE_SETTING_KEY]);
117317
117243
  this.ctx.logger.info("load balancing: share source changed", { meta: {
117318
117244
  from: previous,
117319
117245
  to: input.source
@@ -117490,9 +117416,18 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
117490
117416
  deviceSettingsSchema() {
117491
117417
  return this.schema({ sections: buildDeviceSettingsSections({ runnerNodeIds: this.topology.collectRunnerNodeIds() }) });
117492
117418
  }
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");
117419
+ /** The cluster form's stored values, written under their bare keys. */
117420
+ clusterStore() {
117421
+ return this.clusterSettings(PIPELINE_ORCHESTRATOR_ID, CLUSTER_VALUES_SCHEMA);
117422
+ }
117423
+ async onScopedSettingsChanged(scope, cap, keys) {
117424
+ if (scope !== "cluster" || cap !== "pipeline-orchestrator") return;
117425
+ await this.afterClusterWrite(keys);
117426
+ }
117427
+ async afterClusterWrite(keys) {
117428
+ if (this.deviceConfig === null) return;
117429
+ await this.deviceConfig.afterClusterSettingsWritten();
117430
+ if (CLUSTER_MODEL_SCOPED_STEPS.some((step) => keys.includes(clusterModelSettingKey(step.stepId))) && !this.pinResetRunning) await this.resetRemovedModelPins("cluster-row-write");
117496
117431
  }
117497
117432
  /**
117498
117433
  * The ONE stored-pin reset (D725): drop every pin to a model deleted from
@@ -117516,6 +117451,14 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
117516
117451
  });
117517
117452
  }
117518
117453
  async resetRemovedModelPins(trigger) {
117454
+ this.pinResetRunning = true;
117455
+ try {
117456
+ return await this.runRemovedModelPinReset(trigger);
117457
+ } finally {
117458
+ this.pinResetRunning = false;
117459
+ }
117460
+ }
117461
+ async runRemovedModelPinReset(trigger) {
117519
117462
  return resetRemovedModelPins({
117520
117463
  listCustomModels: async () => {
117521
117464
  const api = this.ctx.api;
@@ -117524,7 +117467,7 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
117524
117467
  },
117525
117468
  resetStoredPins: (isCustom) => this.settingsStore.resetRemovedModelPins(isCustom),
117526
117469
  readStoredGlobalKey: (key) => this.readStoredGlobalKey(key),
117527
- updateGlobalSettings: (patch) => this.deviceConfig.updateGlobalSettings(patch),
117470
+ patchClusterSettings: (patch) => this.clusterStore().patch(patch),
117528
117471
  redispatchNode: (nodeId) => this.placement.redispatchCamerasOnAgent(nodeId),
117529
117472
  logger: this.ctx.logger
117530
117473
  }, trigger);