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