@camstack/types 1.2.118 → 1.2.119

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.
@@ -189,7 +189,65 @@ export declare abstract class BaseAddon<TConfig extends object = Record<string,
189
189
  protected globalSettingsSchema(_cap?: string): ConfigUISchema | null;
190
190
  /** Override to provide device-level settings UI schema. */
191
191
  protected deviceSettingsSchema(): ConfigUISchema | null;
192
+ /**
193
+ * INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
194
+ * ARE the configuration of its integration.
195
+ *
196
+ * Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
197
+ * operator should find on the addon's integration page (System →
198
+ * Integrations → <name>) rather than only in the cluster-wide list of every
199
+ * addon. Empty (the default) means the addon has no integration-level
200
+ * settings and no such surface is offered — this is opt-in, because whether
201
+ * an addon's configuration IS its integration's configuration depends on the
202
+ * nature of the integration.
203
+ *
204
+ * WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
205
+ * the ONE global schema, in the ONE addon store, written by the ONE
206
+ * `updateGlobalSettings` path. There is deliberately no
207
+ * `updateIntegrationSettings`: a second write path is how a surface acquires
208
+ * a second store key, and this repo has shipped that twice (`btmPath@hub`,
209
+ * D266). Selecting sections cannot introduce a key that selecting cannot.
210
+ *
211
+ * WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
212
+ * `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
213
+ * removed with the reason recorded at
214
+ * `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
215
+ * determined by WHICH schema it lives in, not by a field-level marker."* A
216
+ * marker sprinkled across sections also has to borrow a field that already
217
+ * means something else; borrowing `section.tab` put the literal word
218
+ * "integration" into an operator-facing tab bar, because `tab` means "how to
219
+ * GROUP this visually" and cannot also mean "where this lives" (D269
220
+ * supersedes D268). One declaration, in one place, next to the schema whose
221
+ * ids it names.
222
+ */
223
+ protected integrationSettingSections(): readonly string[];
192
224
  getGlobalSettings(overlay?: Record<string, unknown>, cap?: string, nodeId?: string): Promise<ConfigUISchemaWithValues | null>;
225
+ /**
226
+ * The integration-level view of this addon's settings: exactly the sections
227
+ * named by {@link integrationSettingSections}, hydrated from the SAME store
228
+ * `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
229
+ *
230
+ * Returns `null` when the addon declared nothing — an addon that opts out has
231
+ * no integration settings surface at all, rather than an empty one that reads
232
+ * as a failed load.
233
+ *
234
+ * Three properties hold BY CONSTRUCTION, which is why they are here in core
235
+ * and not in whichever UI happens to render this:
236
+ *
237
+ * 1. **One key.** The payload is a SUBSET of the global schema, so a field
238
+ * shown here is the same field, with the same bare key, that the addon's
239
+ * own page shows. There is no integration-specific writer — callers save
240
+ * through `updateGlobalSettings` — so a second store key is unreachable,
241
+ * not merely discouraged.
242
+ * 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
243
+ * is `<key>@<nodeId>` and an integration is not a node; whichever node
244
+ * such a field silently picked would be a wrong answer for the operator
245
+ * who opened the page (D266).
246
+ * 3. **No silent typo.** A declared id that names no section throws. The
247
+ * alternative — skip it — turns a rename into a surface that quietly
248
+ * empties, which looks exactly like an addon with nothing to configure.
249
+ */
250
+ getIntegrationSettings(nodeId?: string): Promise<ConfigUISchemaWithValues | null>;
193
251
  /**
194
252
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
195
253
  * every `perNode: true` field carries THAT node's scoped value on its bare
package/dist/addon.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_event_category = require("./event-category-BaEgqJNv.js");
3
- const require_sleep = require("./sleep-9d8tJRbO.js");
3
+ const require_sleep = require("./sleep-DUxF5DdC.js");
4
4
  const require_err_msg = require("./err-msg-COpsHMw2.js");
5
5
  //#region src/generated/cap-input-defaults.ts
6
6
  /**
package/dist/addon.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as EventCategory } from "./event-category-BZL-fdNj.mjs";
2
- import { B as ReadinessRegistry, E as adminUiCapability, L as nodePin, R as readNodePin, St as emitReadiness, T as DeviceType, V as ReadinessTimeoutError, W as scopeKey, _t as DisposerChain, a as asJsonObject, b as deviceOpsCapability, d as BOOT_RECOVERY_BACKOFF_MS, f as DEVICE_SCOPED_CAPS, gt as DATAPLANE_SECRET_HEADER, h as createEventBusSliceSource, j as expandCapMethods, m as createDeviceProxy, p as isDeviceScopedCap, s as asString, t as sleep, u as parseJsonUnknown, vt as BaseAddon, x as viewerUiCapability, yt as normalizeAddonInitResult } from "./sleep-Dolp38qx.mjs";
2
+ import { B as ReadinessRegistry, E as adminUiCapability, L as nodePin, R as readNodePin, St as emitReadiness, T as DeviceType, V as ReadinessTimeoutError, W as scopeKey, _t as DisposerChain, a as asJsonObject, b as deviceOpsCapability, d as BOOT_RECOVERY_BACKOFF_MS, f as DEVICE_SCOPED_CAPS, gt as DATAPLANE_SECRET_HEADER, h as createEventBusSliceSource, j as expandCapMethods, m as createDeviceProxy, p as isDeviceScopedCap, s as asString, t as sleep, u as parseJsonUnknown, vt as BaseAddon, x as viewerUiCapability, yt as normalizeAddonInitResult } from "./sleep-C9C8EoK8.mjs";
3
3
  import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
4
4
  //#region src/generated/cap-input-defaults.ts
5
5
  /**
@@ -126,6 +126,35 @@ export declare const addonSettingsCapability: {
126
126
  }, z.core.$strip>, z.ZodObject<{
127
127
  success: z.ZodLiteral<true>;
128
128
  }, z.core.$strip>, "mutation">;
129
+ readonly getIntegrationSettings: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
130
+ addonId: z.ZodString;
131
+ nodeId: z.ZodOptional<z.ZodString>;
132
+ }, z.core.$strip>, z.ZodNullable<z.ZodObject<{
133
+ tabs: z.ZodOptional<z.ZodArray<z.ZodObject<{
134
+ id: z.ZodString;
135
+ label: z.ZodString;
136
+ icon: z.ZodString;
137
+ order: z.ZodOptional<z.ZodNumber>;
138
+ }, z.core.$strip>>>;
139
+ sections: z.ZodArray<z.ZodObject<{
140
+ id: z.ZodString;
141
+ title: z.ZodString;
142
+ description: z.ZodOptional<z.ZodString>;
143
+ style: z.ZodOptional<z.ZodEnum<{
144
+ card: "card";
145
+ accordion: "accordion";
146
+ }>>;
147
+ defaultCollapsed: z.ZodOptional<z.ZodBoolean>;
148
+ columns: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>]>>;
149
+ tab: z.ZodOptional<z.ZodString>;
150
+ location: z.ZodOptional<z.ZodEnum<{
151
+ settings: "settings";
152
+ "top-tab": "top-tab";
153
+ }>>;
154
+ order: z.ZodOptional<z.ZodNumber>;
155
+ fields: z.ZodArray<z.ZodAny>;
156
+ }, z.core.$strip>>;
157
+ }, z.core.$strip>>, import("./capability-definition.js").CapabilityMethodKind>;
129
158
  readonly getDeviceSettings: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
130
159
  addonId: z.ZodString;
131
160
  deviceId: z.ZodNumber;
@@ -61,9 +61,13 @@ export type AudioBackendChoice = (typeof AUDIO_BACKEND_CHOICES)[number]['value']
61
61
  /**
62
62
  * Shared shape of the audio-analyzer addon's global settings.
63
63
  * `audioBackend` = operator choice (wins); `probedBestAudioBackend`
64
- * = hint refreshed by `reprobeAudioEngine`. `selectedAudioModel`
65
- * replaces the orchestrator's legacy
66
- * `AgentPipelineSettings.audio.modelId`.
64
+ * = hint refreshed by `reprobeAudioEngine`.
65
+ *
66
+ * There is NO model id here. The backend IS the model: YAMNet ships one
67
+ * ONNX graph and Apple SoundAnalysis is a built-in with nothing swappable,
68
+ * so `createAudioPipeline` takes a backend and no model. A
69
+ * `selectedAudioModel` select shipped here until 2026-08-28 (D272) and
70
+ * reached inference on no path — it was a log field.
67
71
  *
68
72
  * NOTE — enable/disable is NOT stored here:
69
73
  * - per-device: `audio-analysis` wrapper cap + `setWrapperActive`
@@ -75,7 +79,6 @@ export type AudioBackendChoice = (typeof AUDIO_BACKEND_CHOICES)[number]['value']
75
79
  export interface AudioAnalyzerGlobalConfig {
76
80
  readonly audioBackend: AudioBackendChoice;
77
81
  readonly probedBestAudioBackend: string;
78
- readonly selectedAudioModel: string;
79
82
  }
80
83
  export declare const DEFAULT_AUDIO_ANALYZER_CONFIG: AudioAnalyzerGlobalConfig;
81
84
  export declare const audioAnalyzerCapability: {
@@ -209,6 +209,13 @@ export type AppRouter = TrpcCoreRouter<{
209
209
  output: z.infer<typeof addonSettingsCapability.methods.updateGlobalSettings.output>;
210
210
  meta: object;
211
211
  }>;
212
+ getIntegrationSettings: TRPCQueryProcedure<{
213
+ input: {
214
+ [x: string]: unknown;
215
+ } & z.input<typeof addonSettingsCapability.methods.getIntegrationSettings.input>;
216
+ output: z.infer<typeof addonSettingsCapability.methods.getIntegrationSettings.output>;
217
+ meta: object;
218
+ }>;
212
219
  getDeviceSettings: TRPCQueryProcedure<{
213
220
  input: {
214
221
  [x: string]: unknown;
@@ -6,7 +6,7 @@
6
6
  * scope+access check inside `protectedProcedure` (see
7
7
  * `server/backend/src/api/trpc/trpc.middleware.ts`).
8
8
  *
9
- * Coverage: 975 method paths across 125 capabilities.
9
+ * Coverage: 976 method paths across 125 capabilities.
10
10
  */
11
11
  import type { CapabilityMethodAccess } from '../capabilities/capability-definition.js';
12
12
  export interface MethodAccessRecord {
@@ -56,7 +56,7 @@ import type { userManagementCapability } from '../capabilities/user-management.c
56
56
  export interface SystemProxy {
57
57
  readonly addonPages: Pick<InferProvider<typeof addonPagesCapability>, 'listPages'>;
58
58
  readonly addons: Pick<InferProvider<typeof addonsCapability>, 'list' | 'getLogs' | 'listPackages' | 'installPackage' | 'installFromWorkspace' | 'isWorkspaceAvailable' | 'listWorkspacePackages' | 'uninstallPackage' | 'reloadPackages' | 'searchAvailable' | 'listUpdates' | 'updatePackage' | 'rollbackPackage' | 'forceRefresh' | 'restartServer' | 'getLastRestart' | 'listFrameworkPackages' | 'listCapabilityProviders' | 'setCapabilityProviderEnabled' | 'getVersions' | 'restartAddon' | 'retryLoad' | 'getAutoUpdateSettings' | 'setAutoUpdateSettings' | 'getAddonAutoUpdate' | 'setAddonAutoUpdate' | 'applyAutoUpdateToAll' | 'custom' | 'startJob' | 'getJob' | 'listJobs' | 'cancelJob' | 'onAddonLogs'>;
59
- readonly addonSettings: Pick<InferProvider<typeof addonSettingsCapability>, 'getGlobalSettings' | 'updateGlobalSettings'>;
59
+ readonly addonSettings: Pick<InferProvider<typeof addonSettingsCapability>, 'getGlobalSettings' | 'updateGlobalSettings' | 'getIntegrationSettings'>;
60
60
  readonly addonWidgets: Pick<InferProvider<typeof addonWidgetsCapability>, 'listWidgets'>;
61
61
  readonly alerts: Pick<InferProvider<typeof alertsCapability>, 'emit' | 'update' | 'list' | 'getUnreadCount' | 'markRead' | 'markAllRead' | 'dismiss'>;
62
62
  readonly audioAnalyzer: Pick<InferProvider<typeof audioAnalyzerCapability>, 'analyseChunk' | 'classify' | 'isReady' | 'dispose' | 'reprobeAudioEngine'>;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_event_category = require("./event-category-BaEgqJNv.js");
3
- const require_sleep = require("./sleep-9d8tJRbO.js");
3
+ const require_sleep = require("./sleep-DUxF5DdC.js");
4
4
  const require_canonical_hash = require("./canonical-hash-DNV8S5ET.js");
5
5
  const require_enums = require("./enums.js");
6
6
  const require_err_msg = require("./err-msg-COpsHMw2.js");
@@ -5128,6 +5128,10 @@ var addonSettingsCapability = {
5128
5128
  kind: "mutation",
5129
5129
  auth: "admin"
5130
5130
  }),
5131
+ getIntegrationSettings: require_sleep.method(zod.z.object({
5132
+ addonId: zod.z.string(),
5133
+ nodeId: zod.z.string().optional()
5134
+ }), SettingsSchemaWithValuesSchema.nullable()),
5131
5135
  getDeviceSettings: require_sleep.method(zod.z.object({
5132
5136
  addonId: zod.z.string(),
5133
5137
  deviceId: zod.z.number(),
@@ -5549,8 +5553,7 @@ var AUDIO_BACKEND_CHOICES = [
5549
5553
  ];
5550
5554
  var DEFAULT_AUDIO_ANALYZER_CONFIG = {
5551
5555
  audioBackend: "auto",
5552
- probedBestAudioBackend: "",
5553
- selectedAudioModel: ""
5556
+ probedBestAudioBackend: ""
5554
5557
  };
5555
5558
  var audioAnalyzerCapability = {
5556
5559
  name: "audio-analyzer",
@@ -37385,6 +37388,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
37385
37388
  addonId: null,
37386
37389
  access: "view"
37387
37390
  },
37391
+ "addonSettings.getIntegrationSettings": {
37392
+ capName: "addon-settings",
37393
+ capScope: "system",
37394
+ addonId: null,
37395
+ access: "view"
37396
+ },
37388
37397
  "addonSettings.updateDeviceSettings": {
37389
37398
  capName: "addon-settings",
37390
37399
  capScope: "system",
@@ -45639,7 +45648,8 @@ function createSystemProxy(api) {
45639
45648
  },
45640
45649
  addonSettings: {
45641
45650
  getGlobalSettings: (input) => dispatch("addonSettings", "getGlobalSettings", "query", input),
45642
- updateGlobalSettings: (input) => dispatch("addonSettings", "updateGlobalSettings", "mutation", input)
45651
+ updateGlobalSettings: (input) => dispatch("addonSettings", "updateGlobalSettings", "mutation", input),
45652
+ getIntegrationSettings: (input) => dispatch("addonSettings", "getIntegrationSettings", "query", input)
45643
45653
  },
45644
45654
  addonWidgets: { listWidgets: (input) => dispatch("addonWidgets", "listWidgets", "query", input) },
45645
45655
  alerts: {
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as EventCategory } from "./event-category-BZL-fdNj.mjs";
2
- import { $ as DecodedFrameSchema, A as event, B as ReadinessRegistry, C as DeviceFeature, Ct as isEvent, D as DEFAULT_RUNTIME_STATE_DURABILITY, Dt as collectHydratedFieldValues, E as adminUiCapability, Et as collectHydratedFieldEntries, F as systemMethod, G as BrokerStatsSchema, H as emitDownForOwnedCaps, I as CAP_NODE_PIN_CONTEXT_KEY, J as CamProfileSchema, K as BrokerStatusSchema, L as nodePin, M as isDeviceConfigCap, N as method, O as DEVICE_SETTINGS_CONTRIBUTION_METHODS, Ot as hydrateSchema, P as resolveCapMount, Q as DecodedAudioChunkSchema, R as readNodePin, S as ChargingStatus, St as emitReadiness, T as DeviceType, Tt as WELL_KNOWN_TAB_MAP, U as readinessKey, V as ReadinessTimeoutError, W as scopeKey, X as CamStreamResolutionSchema, Y as CamStreamKindSchema, Z as CameraStreamSchema, _ as createMirrorSource, _t as DisposerChain, a as asJsonObject, at as ProfileSlotStatusSchema, b as deviceOpsCapability, bt as createDurableState, c as parseJsonArray, ct as SubscribeAudioChunksInputSchema, d as BOOT_RECOVERY_BACKOFF_MS, dt as SubscribeFramesResultSchema, et as EncodedPacketSchema, f as DEVICE_SCOPED_CAPS, ft as makeProfileBrokerId, g as createLazyTrpcSource, gt as DATAPLANE_SECRET_HEADER, h as createEventBusSliceSource, ht as selectAssignedProfileSlots, i as asJsonArray, it as ProfileSlotSchema, j as expandCapMethods, k as DEVICE_STATUS_METHOD, kt as resolveHydratedFieldValue, l as parseJsonObject, lt as SubscribeAudioChunksResultSchema, m as createDeviceProxy, mt as parseProfileBrokerId, n as sleepCancellable, nt as FrameHandleSchema, o as asNumber, ot as StreamSourceEntrySchema, p as isDeviceScopedCap, pt as makeSourceBrokerId, q as CAM_PROFILE_ORDER, r as asBoolean, rt as ProfileRtspEntrySchema, s as asString, st as StreamSourceSchema, t as sleep, tt as FrameHandleFormatSchema, u as parseJsonUnknown, ut as SubscribeFramesInputSchema, v as createSliceHandle, vt as BaseAddon, w as DeviceRole, wt as WELL_KNOWN_TABS, x as viewerUiCapability, xt as createEvent, y as RawStateResultSchema, yt as normalizeAddonInitResult, z as toNodeId } from "./sleep-Dolp38qx.mjs";
2
+ import { $ as DecodedFrameSchema, A as event, B as ReadinessRegistry, C as DeviceFeature, Ct as isEvent, D as DEFAULT_RUNTIME_STATE_DURABILITY, Dt as collectHydratedFieldValues, E as adminUiCapability, Et as collectHydratedFieldEntries, F as systemMethod, G as BrokerStatsSchema, H as emitDownForOwnedCaps, I as CAP_NODE_PIN_CONTEXT_KEY, J as CamProfileSchema, K as BrokerStatusSchema, L as nodePin, M as isDeviceConfigCap, N as method, O as DEVICE_SETTINGS_CONTRIBUTION_METHODS, Ot as hydrateSchema, P as resolveCapMount, Q as DecodedAudioChunkSchema, R as readNodePin, S as ChargingStatus, St as emitReadiness, T as DeviceType, Tt as WELL_KNOWN_TAB_MAP, U as readinessKey, V as ReadinessTimeoutError, W as scopeKey, X as CamStreamResolutionSchema, Y as CamStreamKindSchema, Z as CameraStreamSchema, _ as createMirrorSource, _t as DisposerChain, a as asJsonObject, at as ProfileSlotStatusSchema, b as deviceOpsCapability, bt as createDurableState, c as parseJsonArray, ct as SubscribeAudioChunksInputSchema, d as BOOT_RECOVERY_BACKOFF_MS, dt as SubscribeFramesResultSchema, et as EncodedPacketSchema, f as DEVICE_SCOPED_CAPS, ft as makeProfileBrokerId, g as createLazyTrpcSource, gt as DATAPLANE_SECRET_HEADER, h as createEventBusSliceSource, ht as selectAssignedProfileSlots, i as asJsonArray, it as ProfileSlotSchema, j as expandCapMethods, k as DEVICE_STATUS_METHOD, kt as resolveHydratedFieldValue, l as parseJsonObject, lt as SubscribeAudioChunksResultSchema, m as createDeviceProxy, mt as parseProfileBrokerId, n as sleepCancellable, nt as FrameHandleSchema, o as asNumber, ot as StreamSourceEntrySchema, p as isDeviceScopedCap, pt as makeSourceBrokerId, q as CAM_PROFILE_ORDER, r as asBoolean, rt as ProfileRtspEntrySchema, s as asString, st as StreamSourceSchema, t as sleep, tt as FrameHandleFormatSchema, u as parseJsonUnknown, ut as SubscribeFramesInputSchema, v as createSliceHandle, vt as BaseAddon, w as DeviceRole, wt as WELL_KNOWN_TABS, x as viewerUiCapability, xt as createEvent, y as RawStateResultSchema, yt as normalizeAddonInitResult, z as toNodeId } from "./sleep-C9C8EoK8.mjs";
3
3
  import { a as buildAudioArgs, c as buildVideoArgs, d as logBannerArgs, f as pickVideoEncoder, i as audioPlanFromEncodeProfile, l as invocationFromEncodeProfile, n as Fmp4BoxSplitter, o as buildFfmpegArgs, r as AUDIO_PRESETS, s as buildInputArgs, t as canonicalHash, u as isSoftwareDecode } from "./canonical-hash-rO1sRmEK.mjs";
4
4
  import { EventSourceType } from "./enums.mjs";
5
5
  import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
@@ -5127,6 +5127,10 @@ var addonSettingsCapability = {
5127
5127
  kind: "mutation",
5128
5128
  auth: "admin"
5129
5129
  }),
5130
+ getIntegrationSettings: method(z.object({
5131
+ addonId: z.string(),
5132
+ nodeId: z.string().optional()
5133
+ }), SettingsSchemaWithValuesSchema.nullable()),
5130
5134
  getDeviceSettings: method(z.object({
5131
5135
  addonId: z.string(),
5132
5136
  deviceId: z.number(),
@@ -5548,8 +5552,7 @@ var AUDIO_BACKEND_CHOICES = [
5548
5552
  ];
5549
5553
  var DEFAULT_AUDIO_ANALYZER_CONFIG = {
5550
5554
  audioBackend: "auto",
5551
- probedBestAudioBackend: "",
5552
- selectedAudioModel: ""
5555
+ probedBestAudioBackend: ""
5553
5556
  };
5554
5557
  var audioAnalyzerCapability = {
5555
5558
  name: "audio-analyzer",
@@ -37377,6 +37380,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
37377
37380
  addonId: null,
37378
37381
  access: "view"
37379
37382
  },
37383
+ "addonSettings.getIntegrationSettings": {
37384
+ capName: "addon-settings",
37385
+ capScope: "system",
37386
+ addonId: null,
37387
+ access: "view"
37388
+ },
37380
37389
  "addonSettings.updateDeviceSettings": {
37381
37390
  capName: "addon-settings",
37382
37391
  capScope: "system",
@@ -45631,7 +45640,8 @@ function createSystemProxy(api) {
45631
45640
  },
45632
45641
  addonSettings: {
45633
45642
  getGlobalSettings: (input) => dispatch("addonSettings", "getGlobalSettings", "query", input),
45634
- updateGlobalSettings: (input) => dispatch("addonSettings", "updateGlobalSettings", "mutation", input)
45643
+ updateGlobalSettings: (input) => dispatch("addonSettings", "updateGlobalSettings", "mutation", input),
45644
+ getIntegrationSettings: (input) => dispatch("addonSettings", "getIntegrationSettings", "query", input)
45635
45645
  },
45636
45646
  addonWidgets: { listWidgets: (input) => dispatch("addonWidgets", "listWidgets", "query", input) },
45637
45647
  alerts: {
@@ -790,6 +790,17 @@ export interface ICamstackAddon {
790
790
  * persisted store. */
791
791
  getGlobalSettings?(overlay?: Record<string, unknown>, cap?: string, nodeId?: string): Promise<ConfigUISchemaWithValues | null>;
792
792
  updateGlobalSettings?(patch: Record<string, unknown>, nodeId?: string): Promise<void>;
793
+ /**
794
+ * Integration-level settings — the subset of the global schema the addon
795
+ * declared as its INTEGRATION's configuration (`BaseAddon.
796
+ * integrationSettingSections`). `null` ⇒ none declared, so the surface is
797
+ * not offered.
798
+ *
799
+ * There is no matching updater on purpose: the payload is a subset of the
800
+ * global schema, so `updateGlobalSettings` is the writer and the store key
801
+ * stays the one bare key. See `addon-settings.cap.ts`.
802
+ */
803
+ getIntegrationSettings?(nodeId?: string): Promise<ConfigUISchemaWithValues | null>;
793
804
  /** Level 2 — per-device settings (schema + values). Appears in
794
805
  * Device Overrides. */
795
806
  getDeviceSettings?(deviceId: number): Promise<ConfigUISchemaWithValues>;
@@ -685,6 +685,40 @@ var BaseAddon = class {
685
685
  deviceSettingsSchema() {
686
686
  return null;
687
687
  }
688
+ /**
689
+ * INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
690
+ * ARE the configuration of its integration.
691
+ *
692
+ * Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
693
+ * operator should find on the addon's integration page (System →
694
+ * Integrations → <name>) rather than only in the cluster-wide list of every
695
+ * addon. Empty (the default) means the addon has no integration-level
696
+ * settings and no such surface is offered — this is opt-in, because whether
697
+ * an addon's configuration IS its integration's configuration depends on the
698
+ * nature of the integration.
699
+ *
700
+ * WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
701
+ * the ONE global schema, in the ONE addon store, written by the ONE
702
+ * `updateGlobalSettings` path. There is deliberately no
703
+ * `updateIntegrationSettings`: a second write path is how a surface acquires
704
+ * a second store key, and this repo has shipped that twice (`btmPath@hub`,
705
+ * D266). Selecting sections cannot introduce a key that selecting cannot.
706
+ *
707
+ * WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
708
+ * `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
709
+ * removed with the reason recorded at
710
+ * `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
711
+ * determined by WHICH schema it lives in, not by a field-level marker."* A
712
+ * marker sprinkled across sections also has to borrow a field that already
713
+ * means something else; borrowing `section.tab` put the literal word
714
+ * "integration" into an operator-facing tab bar, because `tab` means "how to
715
+ * GROUP this visually" and cannot also mean "where this lives" (D269
716
+ * supersedes D268). One declaration, in one place, next to the schema whose
717
+ * ids it names.
718
+ */
719
+ integrationSettingSections() {
720
+ return [];
721
+ }
688
722
  async getGlobalSettings(overlay, cap, nodeId) {
689
723
  const schema = this.globalSettingsSchema(cap);
690
724
  if (!schema) return { sections: [] };
@@ -695,6 +729,55 @@ var BaseAddon = class {
695
729
  } : projected);
696
730
  }
697
731
  /**
732
+ * The integration-level view of this addon's settings: exactly the sections
733
+ * named by {@link integrationSettingSections}, hydrated from the SAME store
734
+ * `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
735
+ *
736
+ * Returns `null` when the addon declared nothing — an addon that opts out has
737
+ * no integration settings surface at all, rather than an empty one that reads
738
+ * as a failed load.
739
+ *
740
+ * Three properties hold BY CONSTRUCTION, which is why they are here in core
741
+ * and not in whichever UI happens to render this:
742
+ *
743
+ * 1. **One key.** The payload is a SUBSET of the global schema, so a field
744
+ * shown here is the same field, with the same bare key, that the addon's
745
+ * own page shows. There is no integration-specific writer — callers save
746
+ * through `updateGlobalSettings` — so a second store key is unreachable,
747
+ * not merely discouraged.
748
+ * 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
749
+ * is `<key>@<nodeId>` and an integration is not a node; whichever node
750
+ * such a field silently picked would be a wrong answer for the operator
751
+ * who opened the page (D266).
752
+ * 3. **No silent typo.** A declared id that names no section throws. The
753
+ * alternative — skip it — turns a rename into a surface that quietly
754
+ * empties, which looks exactly like an addon with nothing to configure.
755
+ */
756
+ async getIntegrationSettings(nodeId) {
757
+ const declared = this.integrationSettingSections();
758
+ if (declared.length === 0) return null;
759
+ const schema = this.globalSettingsSchema();
760
+ if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
761
+ const byId = new Map(schema.sections.map((section) => [section.id, section]));
762
+ const sections = [];
763
+ for (const id of declared) {
764
+ const section = byId.get(id);
765
+ if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
766
+ const fields = dropPerNodeFields(section.fields);
767
+ if (fields.length === 0) continue;
768
+ sections.push({
769
+ ...section,
770
+ fields
771
+ });
772
+ }
773
+ if (sections.length === 0) return null;
774
+ const projected = await this.resolveGlobalStore(nodeId);
775
+ return hydrateSchema({
776
+ ...schema,
777
+ sections
778
+ }, projected);
779
+ }
780
+ /**
698
781
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
699
782
  * every `perNode: true` field carries THAT node's scoped value on its bare
700
783
  * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
@@ -998,6 +1081,41 @@ var BaseAddon = class {
998
1081
  * `hydrateSchema` does. Valueless structural fields (separator/info/…)
999
1082
  * don't declare `perNode` and are excluded by the `in` narrowing.
1000
1083
  */
1084
+ /**
1085
+ * The same fields with every `perNode: true` one removed, recursing into layout
1086
+ * containers exactly as {@link collectPerNodeFieldKeys} does. A container left
1087
+ * with no child is dropped rather than rendered empty.
1088
+ *
1089
+ * Used by `getIntegrationSettings`: an integration is not a node, so a field
1090
+ * whose store key is `<key>@<nodeId>` has no node to belong to there.
1091
+ */
1092
+ function dropPerNodeFields(fields) {
1093
+ const kept = [];
1094
+ for (const field of fields) {
1095
+ if (field.type === "group") {
1096
+ const inner = dropPerNodeFields(field.fields);
1097
+ if (inner.length > 0) kept.push({
1098
+ ...field,
1099
+ fields: inner
1100
+ });
1101
+ continue;
1102
+ }
1103
+ if (field.type === "sub-tabs") {
1104
+ const tabs = field.tabs.map((tab) => ({
1105
+ ...tab,
1106
+ fields: dropPerNodeFields(tab.fields)
1107
+ })).filter((tab) => tab.fields.length > 0);
1108
+ if (tabs.length > 0) kept.push({
1109
+ ...field,
1110
+ tabs
1111
+ });
1112
+ continue;
1113
+ }
1114
+ if ("perNode" in field && field.perNode === true) continue;
1115
+ kept.push(field);
1116
+ }
1117
+ return kept;
1118
+ }
1001
1119
  function collectPerNodeFieldKeys(fields) {
1002
1120
  const collected = [];
1003
1121
  for (const field of fields) {
@@ -685,6 +685,40 @@ var BaseAddon = class {
685
685
  deviceSettingsSchema() {
686
686
  return null;
687
687
  }
688
+ /**
689
+ * INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
690
+ * ARE the configuration of its integration.
691
+ *
692
+ * Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
693
+ * operator should find on the addon's integration page (System →
694
+ * Integrations → <name>) rather than only in the cluster-wide list of every
695
+ * addon. Empty (the default) means the addon has no integration-level
696
+ * settings and no such surface is offered — this is opt-in, because whether
697
+ * an addon's configuration IS its integration's configuration depends on the
698
+ * nature of the integration.
699
+ *
700
+ * WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
701
+ * the ONE global schema, in the ONE addon store, written by the ONE
702
+ * `updateGlobalSettings` path. There is deliberately no
703
+ * `updateIntegrationSettings`: a second write path is how a surface acquires
704
+ * a second store key, and this repo has shipped that twice (`btmPath@hub`,
705
+ * D266). Selecting sections cannot introduce a key that selecting cannot.
706
+ *
707
+ * WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
708
+ * `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
709
+ * removed with the reason recorded at
710
+ * `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
711
+ * determined by WHICH schema it lives in, not by a field-level marker."* A
712
+ * marker sprinkled across sections also has to borrow a field that already
713
+ * means something else; borrowing `section.tab` put the literal word
714
+ * "integration" into an operator-facing tab bar, because `tab` means "how to
715
+ * GROUP this visually" and cannot also mean "where this lives" (D269
716
+ * supersedes D268). One declaration, in one place, next to the schema whose
717
+ * ids it names.
718
+ */
719
+ integrationSettingSections() {
720
+ return [];
721
+ }
688
722
  async getGlobalSettings(overlay, cap, nodeId) {
689
723
  const schema = this.globalSettingsSchema(cap);
690
724
  if (!schema) return { sections: [] };
@@ -695,6 +729,55 @@ var BaseAddon = class {
695
729
  } : projected);
696
730
  }
697
731
  /**
732
+ * The integration-level view of this addon's settings: exactly the sections
733
+ * named by {@link integrationSettingSections}, hydrated from the SAME store
734
+ * `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
735
+ *
736
+ * Returns `null` when the addon declared nothing — an addon that opts out has
737
+ * no integration settings surface at all, rather than an empty one that reads
738
+ * as a failed load.
739
+ *
740
+ * Three properties hold BY CONSTRUCTION, which is why they are here in core
741
+ * and not in whichever UI happens to render this:
742
+ *
743
+ * 1. **One key.** The payload is a SUBSET of the global schema, so a field
744
+ * shown here is the same field, with the same bare key, that the addon's
745
+ * own page shows. There is no integration-specific writer — callers save
746
+ * through `updateGlobalSettings` — so a second store key is unreachable,
747
+ * not merely discouraged.
748
+ * 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
749
+ * is `<key>@<nodeId>` and an integration is not a node; whichever node
750
+ * such a field silently picked would be a wrong answer for the operator
751
+ * who opened the page (D266).
752
+ * 3. **No silent typo.** A declared id that names no section throws. The
753
+ * alternative — skip it — turns a rename into a surface that quietly
754
+ * empties, which looks exactly like an addon with nothing to configure.
755
+ */
756
+ async getIntegrationSettings(nodeId) {
757
+ const declared = this.integrationSettingSections();
758
+ if (declared.length === 0) return null;
759
+ const schema = this.globalSettingsSchema();
760
+ if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
761
+ const byId = new Map(schema.sections.map((section) => [section.id, section]));
762
+ const sections = [];
763
+ for (const id of declared) {
764
+ const section = byId.get(id);
765
+ if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
766
+ const fields = dropPerNodeFields(section.fields);
767
+ if (fields.length === 0) continue;
768
+ sections.push({
769
+ ...section,
770
+ fields
771
+ });
772
+ }
773
+ if (sections.length === 0) return null;
774
+ const projected = await this.resolveGlobalStore(nodeId);
775
+ return hydrateSchema({
776
+ ...schema,
777
+ sections
778
+ }, projected);
779
+ }
780
+ /**
698
781
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
699
782
  * every `perNode: true` field carries THAT node's scoped value on its bare
700
783
  * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
@@ -998,6 +1081,41 @@ var BaseAddon = class {
998
1081
  * `hydrateSchema` does. Valueless structural fields (separator/info/…)
999
1082
  * don't declare `perNode` and are excluded by the `in` narrowing.
1000
1083
  */
1084
+ /**
1085
+ * The same fields with every `perNode: true` one removed, recursing into layout
1086
+ * containers exactly as {@link collectPerNodeFieldKeys} does. A container left
1087
+ * with no child is dropped rather than rendered empty.
1088
+ *
1089
+ * Used by `getIntegrationSettings`: an integration is not a node, so a field
1090
+ * whose store key is `<key>@<nodeId>` has no node to belong to there.
1091
+ */
1092
+ function dropPerNodeFields(fields) {
1093
+ const kept = [];
1094
+ for (const field of fields) {
1095
+ if (field.type === "group") {
1096
+ const inner = dropPerNodeFields(field.fields);
1097
+ if (inner.length > 0) kept.push({
1098
+ ...field,
1099
+ fields: inner
1100
+ });
1101
+ continue;
1102
+ }
1103
+ if (field.type === "sub-tabs") {
1104
+ const tabs = field.tabs.map((tab) => ({
1105
+ ...tab,
1106
+ fields: dropPerNodeFields(tab.fields)
1107
+ })).filter((tab) => tab.fields.length > 0);
1108
+ if (tabs.length > 0) kept.push({
1109
+ ...field,
1110
+ tabs
1111
+ });
1112
+ continue;
1113
+ }
1114
+ if ("perNode" in field && field.perNode === true) continue;
1115
+ kept.push(field);
1116
+ }
1117
+ return kept;
1118
+ }
1001
1119
  function collectPerNodeFieldKeys(fields) {
1002
1120
  const collected = [];
1003
1121
  for (const field of fields) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.2.118",
3
+ "version": "1.2.119",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",