@camstack/server 1.2.786 → 1.2.787

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 (101) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/api/core/cap-providers.js +62 -96
  3. package/dist/api/trpc/generated-cap-mounts.js +1 -10
  4. package/dist/api/trpc/generated-cap-routers.js +2289 -2366
  5. package/dist/core/addon/addon-registry.service.js +17 -13
  6. package/dist/core/addon/instances-of-cap.js +35 -0
  7. package/package.json +31 -40
  8. package/system/dist/addon-utils.mjs +1 -1
  9. package/system/dist/{agent-https-snFEmSqQ.js → agent-https--lvZp4PX.js} +1 -1
  10. package/system/dist/{agent-https-D779EYj3.mjs → agent-https-pSCzmbQd.mjs} +1 -1
  11. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  12. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +4 -4
  13. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  14. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +5 -5
  15. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  16. package/system/dist/builtins/alerts/alerts.addon.mjs +3 -3
  17. package/system/dist/builtins/autotrack/index.js +1 -1
  18. package/system/dist/builtins/autotrack/index.mjs +1 -1
  19. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  20. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +5 -5
  21. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  22. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  23. package/system/dist/builtins/camera-grid/index.js +1 -1
  24. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  25. package/system/dist/builtins/composer/composer.addon.js +3 -3
  26. package/system/dist/builtins/composer/composer.addon.mjs +3 -3
  27. package/system/dist/builtins/console-logging/index.js +1 -1
  28. package/system/dist/builtins/console-logging/index.mjs +1 -1
  29. package/system/dist/builtins/core-blocks/core-blocks.addon.js +3 -3
  30. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
  31. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  32. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  33. package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
  34. package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
  35. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  36. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  37. package/system/dist/builtins/keychain/index.js +4 -4
  38. package/system/dist/builtins/keychain/index.mjs +4 -4
  39. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  40. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  41. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  42. package/system/dist/builtins/local-auth/local-auth.addon.mjs +5 -5
  43. package/system/dist/builtins/local-network/local-network.addon.js +2 -2
  44. package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
  45. package/system/dist/builtins/loki-logging/index.js +1 -1
  46. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  47. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  48. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +10 -10
  49. package/system/dist/builtins/platform-probe/index.js +1 -1
  50. package/system/dist/builtins/platform-probe/index.mjs +10 -10
  51. package/system/dist/builtins/record-entries/index.js +1 -1
  52. package/system/dist/builtins/record-entries/index.mjs +1 -1
  53. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  54. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  55. package/system/dist/builtins/snapshot/index.js +1 -1
  56. package/system/dist/builtins/snapshot/index.mjs +1 -1
  57. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  58. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +20 -20
  59. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  60. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  61. package/system/dist/builtins/sqlite-storage/integration-record-kinds.d.ts +0 -1
  62. package/system/dist/builtins/sqlite-storage/integration-registry.d.ts +2 -4
  63. package/system/dist/builtins/sqlite-storage/migrations/migration-types.d.ts +6 -1
  64. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +7 -4
  65. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +7 -4
  66. package/system/dist/builtins/storage-orchestrator/drain-state-store.d.ts +4 -8
  67. package/system/dist/builtins/storage-orchestrator/location-store.d.ts +9 -26
  68. package/system/dist/builtins/storage-orchestrator/record-kinds.d.ts +0 -1
  69. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +35 -407
  70. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +36 -407
  71. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  72. package/system/dist/builtins/system-config/system-config.addon.mjs +115 -115
  73. package/system/dist/builtins/winston-logging/index.js +1 -1
  74. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  75. package/system/dist/{capture-engine-NZ11ORZS.js → capture-engine-CTFHb-UX.js} +1 -1
  76. package/system/dist/{capture-engine-DkTEWrRe.mjs → capture-engine-N1-UaQr0.mjs} +1 -1
  77. package/system/dist/{composition-sources-B9-lkIvO.mjs → composition-sources-Qe3MRI1x.mjs} +1 -1
  78. package/system/dist/{composition-sources-B6GYTy_7.js → composition-sources-Yjz-b6-8.js} +1 -1
  79. package/system/dist/{constants-DR8hdi45.js → constants-7gannWcO.js} +1 -1
  80. package/system/dist/{constants--9ui1LK0.mjs → constants-lWMAnwmj.mjs} +1 -1
  81. package/system/dist/{coral-accelerators-DBlgWB8k.mjs → coral-accelerators-BW3OcrLD.mjs} +6 -6
  82. package/system/dist/{custom-action-registry-B9zFBNVa.mjs → custom-action-registry-N7flBDwT.mjs} +37 -37
  83. package/system/dist/{device-ca-D-7tAHJ_.mjs → device-ca-8lpRo9Ss.mjs} +1 -1
  84. package/system/dist/{device-ca-sIFmKkGM.js → device-ca-HGx3Pwb6.js} +1 -1
  85. package/system/dist/{dist-D-iGSnX_.mjs → dist-DgZrPBbX.mjs} +668 -839
  86. package/system/dist/{dist-h3Yla8gE.js → dist-j7uy5oG9.js} +668 -839
  87. package/system/dist/file-host-worker.js +1 -1
  88. package/system/dist/file-host-worker.mjs +1 -1
  89. package/system/dist/{hub-mdns-ciao-DuEfM0fI.mjs → hub-mdns-ciao-BM3peDu1.mjs} +2 -2
  90. package/system/dist/{hub-mdns-ciao-C5DkUEZF.js → hub-mdns-ciao-BUKHJL6N.js} +2 -2
  91. package/system/dist/index.d.ts +2 -2
  92. package/system/dist/index.js +40 -220
  93. package/system/dist/index.mjs +253 -431
  94. package/system/dist/{legacy-integration-rows-door-DTDD5wwC.js → legacy-integration-rows-door-D51X6Fdr.js} +1 -1
  95. package/system/dist/{legacy-integration-rows-door-BTdhD-Yp.mjs → legacy-integration-rows-door-DIm4Q3Jj.mjs} +1 -1
  96. package/system/dist/migrations/hub/2026-11-06-drop-legacy-integrations-and-storage-locations.d.ts +12 -0
  97. package/system/dist/{restore-archive-CkAD_-E9.js → restore-archive-8jRnSzmw.js} +1 -1
  98. package/system/dist/{restore-archive-DQWz5Wp-.mjs → restore-archive-D-Wmp8OK.mjs} +94 -94
  99. package/system/dist/{wal-maintenance-DouX1XsY.mjs → wal-maintenance-CBnqPn4u.mjs} +0 -0
  100. package/system/dist/{wal-maintenance-CB-O-GPP.js → wal-maintenance-D0FMnpba.js} +0 -0
  101. package/system/package.json +1 -1
@@ -1171,7 +1171,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1171
1171
  return DeviceRole;
1172
1172
  }({});
1173
1173
  //#endregion
1174
- //#region ../types/dist/sleep-CmjWurK5.mjs
1174
+ //#region ../types/dist/sleep-CdKka2ri.mjs
1175
1175
  /**
1176
1176
  * The audio chunk plane's byte format, and the ONE expansion from a coded
1177
1177
  * window to float samples (D455).
@@ -4889,37 +4889,179 @@ function normalizeAddonInitResult(result) {
4889
4889
  if (Array.isArray(result)) return { providers: result };
4890
4890
  return result;
4891
4891
  }
4892
+ z.object({
4893
+ field: z.string().min(1),
4894
+ on: z.literal("advance")
4895
+ });
4896
+ /** The catalog field path of an item field: `<itemsPath>[].<field>` (`items[].level`). */
4897
+ function historyItemFieldPath(itemsPath, field) {
4898
+ return `${itemsPath}[].${field}`;
4899
+ }
4900
+ /** Capture floor (ms) applied to `gauge` / `counter` series when a field states none. */
4901
+ var HISTORY_DEFAULT_MIN_INTERVAL_MS = 1e4;
4892
4902
  /**
4893
- * Per-listener shared-secret header the hub injects on every reverse-proxied
4894
- * data-plane request and the addon's framework wrapper validates — so only the
4895
- * hub can reach the addon's `127.0.0.1` listener. Defined here (shared by the
4896
- * core proxy and the kernel listener) to keep both off a kernel↔core import.
4903
+ * Resolve the EFFECTIVE mount hint for a cap — the explicit `mount` when
4904
+ * present, else the scope/mode/deviceNative-derived default. Single source
4905
+ * of truth shared by the runtime builder and any codegen that needs the
4906
+ * same classification, so the two can never disagree.
4897
4907
  */
4898
- var DATAPLANE_SECRET_HEADER = "x-camstack-dataplane-secret";
4908
+ function resolveCapMount(def) {
4909
+ if (def.mount) return def.mount;
4910
+ if (def.deviceNative === true) return { kind: "device-native" };
4911
+ if (def.scope === "device" && def.kind === "wrapper") return { kind: "device-scoped" };
4912
+ if (def.mode === "collection") return { kind: "collection" };
4913
+ return { kind: "singleton" };
4914
+ }
4899
4915
  /**
4900
- * The share-view scope kinds a share-link token can carry. The hub mints
4901
- * and validates them (`ShareViewGrantSchema` builds its
4902
- * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
4916
+ * Output schema shared by the contribution + live methods.
4917
+ *
4918
+ * Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
4919
+ * tabs[]) without importing from `../interfaces/config-ui.js` — a
4920
+ * concrete-but-lenient Zod object keeps tRPC output inference happy
4921
+ * (using `z.unknown()` here collapses unrelated router branches to
4922
+ * `unknown` when the generator re-inlines the huge AppRouter type).
4923
+ *
4924
+ * `.passthrough()` on sections/fields accepts whatever FormBuilder
4925
+ * extensions the caller adds (showWhen, displayScale, …) without
4926
+ * rebuilding every time a new field kind is introduced.
4903
4927
  */
4904
- var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
4905
- /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
4906
- var PeerBytesTicketSchema = z.object({
4907
- /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
4908
- url: z.string().min(1),
4909
- /**
4910
- * The HOST node this URL means something on — the hub or a named agent,
4911
- * never a runner. {@link AddonPeerBytes.open} compares it to its own and
4912
- * refuses `cross-node` by name when they differ, without dialling.
4913
- */
4914
- hostNodeId: z.string().min(1),
4915
- expiresAtMs: z.number().int().nonnegative(),
4916
- /**
4917
- * What the producer DECLARED the body to be, when it knows — `null` when it
4918
- * does not. Never `0` for unknown (D393): a consumer sizing a bound off this
4919
- * must be able to tell "the producer did not say" from "the body is empty".
4920
- */
4921
- declaredBytes: z.number().int().nonnegative().nullable()
4928
+ var ContributionSectionSchema = z.object({
4929
+ id: z.string(),
4930
+ title: z.string(),
4931
+ description: z.string().optional(),
4932
+ style: z.enum(["card", "accordion"]).optional(),
4933
+ defaultCollapsed: z.boolean().optional(),
4934
+ columns: z.union([
4935
+ z.literal(1),
4936
+ z.literal(2),
4937
+ z.literal(3),
4938
+ z.literal(4)
4939
+ ]).optional(),
4940
+ tab: z.string().optional(),
4941
+ location: z.enum([
4942
+ "settings",
4943
+ "top-tab",
4944
+ "hero"
4945
+ ]).optional(),
4946
+ order: z.number().optional(),
4947
+ fields: z.array(z.any())
4922
4948
  });
4949
+ var ContributionTabSchema = z.object({
4950
+ id: z.string(),
4951
+ label: z.string(),
4952
+ icon: z.string(),
4953
+ order: z.number().optional()
4954
+ });
4955
+ var ContributionOutputSchema = z.object({
4956
+ tabs: z.array(ContributionTabSchema).optional(),
4957
+ sections: z.array(ContributionSectionSchema)
4958
+ }).nullable();
4959
+ var DEVICE_SETTINGS_CONTRIBUTION_METHODS = {
4960
+ getDeviceSettingsContribution: {
4961
+ input: z.object({ deviceId: z.number() }),
4962
+ output: ContributionOutputSchema,
4963
+ kind: "query",
4964
+ auth: "protected"
4965
+ },
4966
+ getDeviceLiveContribution: {
4967
+ input: z.object({ deviceId: z.number() }),
4968
+ output: ContributionOutputSchema,
4969
+ kind: "query",
4970
+ auth: "protected"
4971
+ },
4972
+ applyDeviceSettingsPatch: {
4973
+ input: z.object({
4974
+ deviceId: z.number(),
4975
+ patch: z.record(z.string(), z.unknown())
4976
+ }),
4977
+ output: z.object({ success: z.literal(true) }),
4978
+ kind: "mutation",
4979
+ auth: "admin"
4980
+ }
4981
+ };
4982
+ /**
4983
+ * Schema for the `getStatus` method auto-injected when a cap declares
4984
+ * `status`. The runtime shape of the output is the cap's own
4985
+ * `status.schema` — but at codegen time we need a concrete Zod to emit
4986
+ * a typed tRPC route, so we keep the output as `z.unknown().nullable()`
4987
+ * here and tighten it on the client side via the generated
4988
+ * `CapStatusTypeMap` (see `scripts/generate-cap-status-types.ts`).
4989
+ */
4990
+ var DEVICE_STATUS_METHOD = { getStatus: {
4991
+ input: z.object({ deviceId: z.number() }),
4992
+ output: z.unknown().nullable(),
4993
+ kind: "query",
4994
+ auth: "protected"
4995
+ } };
4996
+ /**
4997
+ * Expand a cap def's methods map with every auto-injected method:
4998
+ * - `exposesDeviceSettings: true` → 3 contribution methods
4999
+ * - `status: {...}` → `getStatus`
5000
+ *
5001
+ * Callers walk `expandCapMethods(def)` instead of `def.methods` when
5002
+ * they need the effective runtime method surface (Moleculer actions,
5003
+ * proxy shape, tRPC router entries). The cap def stays the single
5004
+ * source of truth. Providers still declare their concrete `methods`
5005
+ * block; the expansion happens at every consumption point, so there's
5006
+ * no accidental divergence between the declared surface and what's
5007
+ * actually mounted.
5008
+ */
5009
+ function expandCapMethods(def) {
5010
+ let out = def.methods;
5011
+ if (def.exposesDeviceSettings) out = {
5012
+ ...DEVICE_SETTINGS_CONTRIBUTION_METHODS,
5013
+ ...out
5014
+ };
5015
+ if (def.status) out = {
5016
+ ...DEVICE_STATUS_METHOD,
5017
+ ...out
5018
+ };
5019
+ return out;
5020
+ }
5021
+ function method(input, output, options) {
5022
+ return {
5023
+ input,
5024
+ output,
5025
+ kind: options?.kind ?? "query",
5026
+ ...options?.auth !== void 0 ? { auth: options.auth } : {},
5027
+ ...options?.access !== void 0 ? { access: options.access } : {},
5028
+ ...options?.role !== void 0 ? { role: options.role } : {},
5029
+ ...options?.caller !== void 0 ? { caller: options.caller } : {},
5030
+ timeoutMs: options?.timeoutMs
5031
+ };
5032
+ }
5033
+ /**
5034
+ * A wrapper/system-only method: served exclusively by the cap's system-level
5035
+ * provider (`InferProvider`), and OPTIONAL on `InferNativeProvider` so per-device
5036
+ * driver natives don't stub out a wrapper concern (e.g. a cross-device cache
5037
+ * overview). The `systemOnly: true` literal is what `InferNativeProvider` keys on.
5038
+ */
5039
+ function systemMethod(input, output, options) {
5040
+ return {
5041
+ ...method(input, output, options),
5042
+ systemOnly: true
5043
+ };
5044
+ }
5045
+ /**
5046
+ * A method a SOURCE of a collection cap may legitimately not serve — OPTIONAL
5047
+ * on `InferProvider`. The `providerOptional: true` literal is what
5048
+ * `InferProvider` keys on; see {@link CapabilityMethodSchema.providerOptional}
5049
+ * for when this is the honest answer and when it is a soft stub.
5050
+ */
5051
+ function optionalMethod(input, output, options) {
5052
+ return {
5053
+ ...method(input, output, options),
5054
+ providerOptional: true
5055
+ };
5056
+ }
5057
+ /** Shorthand to define an event schema */
5058
+ function event(data) {
5059
+ return { data };
5060
+ }
5061
+ /** Type guard: does this cap declare the D14 device-config archetype? */
5062
+ function isDeviceConfigCap(def) {
5063
+ return def?.deviceConfig !== void 0;
5064
+ }
4923
5065
  function defOf(schema) {
4924
5066
  const zodBag = Reflect.get(schema, "_zod");
4925
5067
  if (typeof zodBag !== "object" || zodBag === null) return {};
@@ -5146,23 +5288,6 @@ function defineRecordKinds(specs) {
5146
5288
  return out;
5147
5289
  }
5148
5290
  /**
5149
- * The scope rule of `transact`, shared by the engine, the provider and the
5150
- * in-memory records so they cannot disagree: every op's kind sits in ONE
5151
- * database file, and when more than one kind is involved they all name the
5152
- * SAME `transactFamily`. A refusal names the rule; nothing is split silently.
5153
- */
5154
- /** Throws {@link TransactRefusedError} unless the kinds may share one transaction. */
5155
- function assertTransactScope(members) {
5156
- const byKind = /* @__PURE__ */ new Map();
5157
- for (const m of members) byKind.set(m.kind, m);
5158
- const kinds = [...byKind.values()];
5159
- if (new Set(kinds.map((m) => m.declaration.database)).size > 1) throw new TransactRefusedError(`cross-file: the ops span more than one database file (${kinds.map((m) => `${m.kind}@${m.declaration.database}`).join(", ")}); a transaction lives in ONE file`);
5160
- if (kinds.length <= 1) return;
5161
- const missing = kinds.filter((m) => m.declaration.transactFamily === void 0);
5162
- if (missing.length > 0) throw new TransactRefusedError(`no-family: ${missing.map((m) => m.kind).join(", ")} declare no transactFamily; kinds that must agree through transact share one`);
5163
- if (new Set(kinds.map((m) => m.declaration.transactFamily)).size > 1) throw new TransactRefusedError(`cross-family: the ops span more than one transactFamily (${kinds.map((m) => `${m.kind}=${String(m.declaration.transactFamily)}`).join(", ")})`);
5164
- }
5165
- /**
5166
5291
  * Declare one entry kind. An entry is configuration: never trimmed by the
5167
5292
  * engine, never aged, belonging to no device.
5168
5293
  */
@@ -5185,178 +5310,53 @@ function defineEntryKind(name, spec) {
5185
5310
  if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
5186
5311
  return defined;
5187
5312
  }
5188
- z.object({
5189
- field: z.string().min(1),
5190
- on: z.literal("advance")
5191
- });
5192
- /** The catalog field path of an item field: `<itemsPath>[].<field>` (`items[].level`). */
5193
- function historyItemFieldPath(itemsPath, field) {
5194
- return `${itemsPath}[].${field}`;
5195
- }
5196
- /** Capture floor (ms) applied to `gauge` / `counter` series when a field states none. */
5197
- var HISTORY_DEFAULT_MIN_INTERVAL_MS = 1e4;
5198
5313
  /**
5199
- * Resolve the EFFECTIVE mount hint for a cap — the explicit `mount` when
5200
- * present, else the scope/mode/deviceNative-derived default. Single source
5201
- * of truth shared by the runtime builder and any codegen that needs the
5202
- * same classification, so the two can never disagree.
5314
+ * Per-listener shared-secret header the hub injects on every reverse-proxied
5315
+ * data-plane request and the addon's framework wrapper validates — so only the
5316
+ * hub can reach the addon's `127.0.0.1` listener. Defined here (shared by the
5317
+ * core proxy and the kernel listener) to keep both off a kernel↔core import.
5203
5318
  */
5204
- function resolveCapMount(def) {
5205
- if (def.mount) return def.mount;
5206
- if (def.deviceNative === true) return { kind: "device-native" };
5207
- if (def.scope === "device" && def.kind === "wrapper") return { kind: "device-scoped" };
5208
- if (def.mode === "collection") return { kind: "collection" };
5209
- return { kind: "singleton" };
5210
- }
5319
+ var DATAPLANE_SECRET_HEADER = "x-camstack-dataplane-secret";
5211
5320
  /**
5212
- * Output schema shared by the contribution + live methods.
5213
- *
5214
- * Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
5215
- * tabs[]) without importing from `../interfaces/config-ui.js` — a
5216
- * concrete-but-lenient Zod object keeps tRPC output inference happy
5217
- * (using `z.unknown()` here collapses unrelated router branches to
5218
- * `unknown` when the generator re-inlines the huge AppRouter type).
5219
- *
5220
- * `.passthrough()` on sections/fields accepts whatever FormBuilder
5221
- * extensions the caller adds (showWhen, displayScale, …) without
5222
- * rebuilding every time a new field kind is introduced.
5321
+ * The share-view scope kinds a share-link token can carry. The hub mints
5322
+ * and validates them (`ShareViewGrantSchema` builds its
5323
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
5223
5324
  */
5224
- var ContributionSectionSchema = z.object({
5225
- id: z.string(),
5226
- title: z.string(),
5227
- description: z.string().optional(),
5228
- style: z.enum(["card", "accordion"]).optional(),
5229
- defaultCollapsed: z.boolean().optional(),
5230
- columns: z.union([
5231
- z.literal(1),
5232
- z.literal(2),
5233
- z.literal(3),
5234
- z.literal(4)
5235
- ]).optional(),
5236
- tab: z.string().optional(),
5237
- location: z.enum([
5238
- "settings",
5239
- "top-tab",
5240
- "hero"
5241
- ]).optional(),
5242
- order: z.number().optional(),
5243
- fields: z.array(z.any())
5244
- });
5245
- var ContributionTabSchema = z.object({
5246
- id: z.string(),
5247
- label: z.string(),
5248
- icon: z.string(),
5249
- order: z.number().optional()
5325
+ var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
5326
+ /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
5327
+ var PeerBytesTicketSchema = z.object({
5328
+ /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
5329
+ url: z.string().min(1),
5330
+ /**
5331
+ * The HOST node this URL means something on — the hub or a named agent,
5332
+ * never a runner. {@link AddonPeerBytes.open} compares it to its own and
5333
+ * refuses `cross-node` by name when they differ, without dialling.
5334
+ */
5335
+ hostNodeId: z.string().min(1),
5336
+ expiresAtMs: z.number().int().nonnegative(),
5337
+ /**
5338
+ * What the producer DECLARED the body to be, when it knows — `null` when it
5339
+ * does not. Never `0` for unknown (D393): a consumer sizing a bound off this
5340
+ * must be able to tell "the producer did not say" from "the body is empty".
5341
+ */
5342
+ declaredBytes: z.number().int().nonnegative().nullable()
5250
5343
  });
5251
- var ContributionOutputSchema = z.object({
5252
- tabs: z.array(ContributionTabSchema).optional(),
5253
- sections: z.array(ContributionSectionSchema)
5254
- }).nullable();
5255
- var DEVICE_SETTINGS_CONTRIBUTION_METHODS = {
5256
- getDeviceSettingsContribution: {
5257
- input: z.object({ deviceId: z.number() }),
5258
- output: ContributionOutputSchema,
5259
- kind: "query",
5260
- auth: "protected"
5261
- },
5262
- getDeviceLiveContribution: {
5263
- input: z.object({ deviceId: z.number() }),
5264
- output: ContributionOutputSchema,
5265
- kind: "query",
5266
- auth: "protected"
5267
- },
5268
- applyDeviceSettingsPatch: {
5269
- input: z.object({
5270
- deviceId: z.number(),
5271
- patch: z.record(z.string(), z.unknown())
5272
- }),
5273
- output: z.object({ success: z.literal(true) }),
5274
- kind: "mutation",
5275
- auth: "admin"
5276
- }
5277
- };
5278
- /**
5279
- * Schema for the `getStatus` method auto-injected when a cap declares
5280
- * `status`. The runtime shape of the output is the cap's own
5281
- * `status.schema` — but at codegen time we need a concrete Zod to emit
5282
- * a typed tRPC route, so we keep the output as `z.unknown().nullable()`
5283
- * here and tighten it on the client side via the generated
5284
- * `CapStatusTypeMap` (see `scripts/generate-cap-status-types.ts`).
5285
- */
5286
- var DEVICE_STATUS_METHOD = { getStatus: {
5287
- input: z.object({ deviceId: z.number() }),
5288
- output: z.unknown().nullable(),
5289
- kind: "query",
5290
- auth: "protected"
5291
- } };
5292
- /**
5293
- * Expand a cap def's methods map with every auto-injected method:
5294
- * - `exposesDeviceSettings: true` → 3 contribution methods
5295
- * - `status: {...}` → `getStatus`
5296
- *
5297
- * Callers walk `expandCapMethods(def)` instead of `def.methods` when
5298
- * they need the effective runtime method surface (Moleculer actions,
5299
- * proxy shape, tRPC router entries). The cap def stays the single
5300
- * source of truth. Providers still declare their concrete `methods`
5301
- * block; the expansion happens at every consumption point, so there's
5302
- * no accidental divergence between the declared surface and what's
5303
- * actually mounted.
5304
- */
5305
- function expandCapMethods(def) {
5306
- let out = def.methods;
5307
- if (def.exposesDeviceSettings) out = {
5308
- ...DEVICE_SETTINGS_CONTRIBUTION_METHODS,
5309
- ...out
5310
- };
5311
- if (def.status) out = {
5312
- ...DEVICE_STATUS_METHOD,
5313
- ...out
5314
- };
5315
- return out;
5316
- }
5317
- function method(input, output, options) {
5318
- return {
5319
- input,
5320
- output,
5321
- kind: options?.kind ?? "query",
5322
- ...options?.auth !== void 0 ? { auth: options.auth } : {},
5323
- ...options?.access !== void 0 ? { access: options.access } : {},
5324
- ...options?.role !== void 0 ? { role: options.role } : {},
5325
- ...options?.caller !== void 0 ? { caller: options.caller } : {},
5326
- timeoutMs: options?.timeoutMs
5327
- };
5328
- }
5329
- /**
5330
- * A wrapper/system-only method: served exclusively by the cap's system-level
5331
- * provider (`InferProvider`), and OPTIONAL on `InferNativeProvider` so per-device
5332
- * driver natives don't stub out a wrapper concern (e.g. a cross-device cache
5333
- * overview). The `systemOnly: true` literal is what `InferNativeProvider` keys on.
5334
- */
5335
- function systemMethod(input, output, options) {
5336
- return {
5337
- ...method(input, output, options),
5338
- systemOnly: true
5339
- };
5340
- }
5341
5344
  /**
5342
- * A method a SOURCE of a collection cap may legitimately not serve — OPTIONAL
5343
- * on `InferProvider`. The `providerOptional: true` literal is what
5344
- * `InferProvider` keys on; see {@link CapabilityMethodSchema.providerOptional}
5345
- * for when this is the honest answer and when it is a soft stub.
5345
+ * The scope rule of `transact`, shared by the engine, the provider and the
5346
+ * in-memory records so they cannot disagree: every op's kind sits in ONE
5347
+ * database file, and when more than one kind is involved they all name the
5348
+ * SAME `transactFamily`. A refusal names the rule; nothing is split silently.
5346
5349
  */
5347
- function optionalMethod(input, output, options) {
5348
- return {
5349
- ...method(input, output, options),
5350
- providerOptional: true
5351
- };
5352
- }
5353
- /** Shorthand to define an event schema */
5354
- function event(data) {
5355
- return { data };
5356
- }
5357
- /** Type guard: does this cap declare the D14 device-config archetype? */
5358
- function isDeviceConfigCap(def) {
5359
- return def?.deviceConfig !== void 0;
5350
+ /** Throws {@link TransactRefusedError} unless the kinds may share one transaction. */
5351
+ function assertTransactScope(members) {
5352
+ const byKind = /* @__PURE__ */ new Map();
5353
+ for (const m of members) byKind.set(m.kind, m);
5354
+ const kinds = [...byKind.values()];
5355
+ if (new Set(kinds.map((m) => m.declaration.database)).size > 1) throw new TransactRefusedError(`cross-file: the ops span more than one database file (${kinds.map((m) => `${m.kind}@${m.declaration.database}`).join(", ")}); a transaction lives in ONE file`);
5356
+ if (kinds.length <= 1) return;
5357
+ const missing = kinds.filter((m) => m.declaration.transactFamily === void 0);
5358
+ if (missing.length > 0) throw new TransactRefusedError(`no-family: ${missing.map((m) => m.kind).join(", ")} declare no transactFamily; kinds that must agree through transact share one`);
5359
+ if (new Set(kinds.map((m) => m.declaration.transactFamily)).size > 1) throw new TransactRefusedError(`cross-family: the ops span more than one transactFamily (${kinds.map((m) => `${m.kind}=${String(m.declaration.transactFamily)}`).join(", ")})`);
5360
5360
  }
5361
5361
  var READING_QUANTITIES = [
5362
5362
  "temperature",
@@ -6671,7 +6671,6 @@ var CAP_NAMES = Object.freeze([
6671
6671
  "climate-control",
6672
6672
  "color",
6673
6673
  "composer",
6674
- "connection-test",
6675
6674
  "connectivity",
6676
6675
  "consumables",
6677
6676
  "contact",
@@ -8691,8 +8690,7 @@ Object.freeze({
8691
8690
  "offerArtifact": 3e5,
8692
8691
  "readResult": 3e5,
8693
8692
  "submitJob": 18e5,
8694
- "uploadDataset": 72e5,
8695
- "validateCredentials": 3e4
8693
+ "uploadDataset": 72e5
8696
8694
  }
8697
8695
  });
8698
8696
  /**
@@ -11781,6 +11779,456 @@ var IntegrationInstanceRefSchema = z.object({
11781
11779
  candidateStableId: z.string().optional()
11782
11780
  });
11783
11781
  /**
11782
+ * notification-output — canonical, capability-gated notification delivery.
11783
+ *
11784
+ * Apprise-derived model (see
11785
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
11786
+ * callers emit ONE canonical `Notification`; each provider declares a
11787
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
11788
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
11789
+ * message to what the kind supports — callers never special-case a service.
11790
+ *
11791
+ * DESIGN DECISIONS (locked):
11792
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
11793
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
11794
+ * cap. Rationale: the admin UI needs one uniform surface across the
11795
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
11796
+ * alternative would fork the UI per addon and cannot host the
11797
+ * discovery→adopt flow.
11798
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
11799
+ * the generated cap-mount auto-`concatCollection`-fans them across every
11800
+ * registered provider (notifiers addon + HA addon) so one catalog is
11801
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
11802
+ * `addonId` the generated collection router extracts from the call input.
11803
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
11804
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
11805
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
11806
+ * base64 fallback needed.
11807
+ *
11808
+ * TODO (deferred, closed-set change — separate decision): add
11809
+ * `providerKind: 'notify'` so notification providers surface on the unified
11810
+ * admin "Integrations" page.
11811
+ */
11812
+ /**
11813
+ * Zentik-derived typed-media enum — the superset across every kind. Each
11814
+ * adapter picks what it supports and the degrade engine filters the rest.
11815
+ */
11816
+ var AttachmentMediaTypeSchema = z.enum([
11817
+ "image",
11818
+ "video",
11819
+ "gif",
11820
+ "audio",
11821
+ "icon"
11822
+ ]);
11823
+ /**
11824
+ * A single attachment. Exactly one of `url` (remote source, most adapters
11825
+ * prefer this) or `bytes` (inline source; required for Pushover-style
11826
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
11827
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
11828
+ */
11829
+ var AttachmentSchema = z.object({
11830
+ mediaType: AttachmentMediaTypeSchema,
11831
+ url: z.string().optional(),
11832
+ bytes: z.instanceof(Uint8Array).optional(),
11833
+ mime: z.string().optional(),
11834
+ name: z.string().optional()
11835
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
11836
+ var NotificationFormatSchema = z.enum([
11837
+ "text",
11838
+ "markdown",
11839
+ "html"
11840
+ ]);
11841
+ /**
11842
+ * The CLOSED icon vocabulary an action button may use.
11843
+ *
11844
+ * A closed set, not a free string, and that is the whole point: an arbitrary
11845
+ * icon name is one that ntfy renders, zentik silently drops, and nobody
11846
+ * notices — the same class of gap as a zone vocabulary nothing produced
11847
+ * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
11848
+ * declares `actionIcons: false` and the degrade engine strips the field.
11849
+ *
11850
+ * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
11851
+ * renderer's icon set; "acknowledge" survives an adapter that draws it
11852
+ * differently.
11853
+ *
11854
+ * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
11855
+ *
11856
+ * These names are for US. **No adapter may forward one verbatim.** Each maps
11857
+ * the whole set onto its own renderer's vocabulary through a
11858
+ * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
11859
+ * fallback, so adding a member here fails every adapter's build until someone
11860
+ * decides its glyph, which is the only place that decision can be made
11861
+ * honestly.
11862
+ *
11863
+ * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
11864
+ * `disarm` straight through; iOS feeds that string to
11865
+ * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
11866
+ * and every snooze and alarm button arrived BLANK. A pass-through is not a
11867
+ * mapping, and "the field is documented" is not "the value renders".
11868
+ *
11869
+ * Adding a member is TRAIN-BOUND. The enum lives in the published
11870
+ * `@camstack/server` closure and the cap seam validates against the HUB's copy,
11871
+ * so an addon that emits a token the running hub does not know does not lose an
11872
+ * icon — its whole `send` fails Zod validation and the notification never
11873
+ * arrives. Never emit a new token from an addon before the train carrying it.
11874
+ */
11875
+ var NotificationActionIconSchema = z.enum([
11876
+ "acknowledge",
11877
+ "dismiss",
11878
+ "silence",
11879
+ "snooze",
11880
+ "view",
11881
+ "play",
11882
+ "open",
11883
+ "close",
11884
+ "lock",
11885
+ "unlock",
11886
+ "arm",
11887
+ "arm-home",
11888
+ "arm-away",
11889
+ "arm-night",
11890
+ "disarm",
11891
+ "light",
11892
+ "alert",
11893
+ "camera"
11894
+ ]);
11895
+ /** A single tap-through action button. */
11896
+ var NotificationActionSchema = z.object({
11897
+ id: z.string(),
11898
+ label: z.string(),
11899
+ url: z.string().optional(),
11900
+ /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
11901
+ icon: NotificationActionIconSchema.optional(),
11902
+ /**
11903
+ * Renders in a warning style where the notifier supports it.
11904
+ *
11905
+ * A HINT, never a gate. The callback's authority is its token and nothing
11906
+ * else — see `notification-center/action-token.ts` for what that does and
11907
+ * does not buy.
11908
+ */
11909
+ destructive: z.boolean().optional(),
11910
+ /**
11911
+ * How the tap should REACH the url.
11912
+ *
11913
+ * `navigate` (absent, and every button authored before this field) opens it:
11914
+ * the phone leaves the notification and shows whatever the callback returns.
11915
+ * That is right for a button whose answer the operator wants to read.
11916
+ *
11917
+ * `background` fires it as a POST and stays put. It exists for the buttons
11918
+ * whose whole point is not to interrupt — "silence this for 30 minutes" is
11919
+ * an answer to the notification, and being thrown into a browser tab to
11920
+ * confirm it costs more attention than the notification did. A backend that
11921
+ * cannot do a background call renders it as an ordinary link (the adapters
11922
+ * fall back rather than dropping the button), so this is a preference, never
11923
+ * a requirement.
11924
+ */
11925
+ mode: z.enum(["navigate", "background"]).optional()
11926
+ });
11927
+ /** A delivery parameter value: what a notifier declared it takes. */
11928
+ var DeliveryParamValueSchema = z.union([
11929
+ z.string(),
11930
+ z.number(),
11931
+ z.boolean()
11932
+ ]);
11933
+ /**
11934
+ * One extra delivery parameter a notifier KIND declares (D938). A rule that
11935
+ * addresses a target of that kind may set it; a kind that declares nothing is
11936
+ * never handed one. The admin UI derives its control from this descriptor —
11937
+ * no editor knows a service by name.
11938
+ *
11939
+ * Optional fields are `.optional()`, never `.default()` (a Zod default does not
11940
+ * run on the addon cap path).
11941
+ */
11942
+ var DeliveryParamSchema = z.object({
11943
+ key: z.string().min(1),
11944
+ label: z.string(),
11945
+ /** i18n key of the label, resolved by the declaring addon's namespace. */
11946
+ labelKey: z.string().optional(),
11947
+ type: z.enum([
11948
+ "enum",
11949
+ "number",
11950
+ "boolean",
11951
+ "string"
11952
+ ]),
11953
+ /** `enum` only: the closed set of accepted values. */
11954
+ options: z.array(z.object({
11955
+ value: z.string(),
11956
+ label: z.string()
11957
+ })).optional(),
11958
+ /** `number` only. */
11959
+ min: z.number().optional(),
11960
+ max: z.number().optional(),
11961
+ /** What the notifier does when the rule sets nothing; shown as the placeholder. */
11962
+ default: DeliveryParamValueSchema.optional()
11963
+ });
11964
+ /**
11965
+ * The canonical notification. `body` is the only hard field (Apprise model).
11966
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
11967
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
11968
+ * the adapter maps this ordinal onto its native level. `level?` is an
11969
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
11970
+ * `priority` for that one target.
11971
+ */
11972
+ var NotificationSchema = z.object({
11973
+ body: z.string(),
11974
+ title: z.string().optional(),
11975
+ format: NotificationFormatSchema.default("text"),
11976
+ priority: z.number().int().min(1).max(5).default(3),
11977
+ level: z.string().optional(),
11978
+ attachments: z.array(AttachmentSchema).optional(),
11979
+ clickUrl: z.string().optional(),
11980
+ actions: z.array(NotificationActionSchema).optional(),
11981
+ sound: z.string().optional(),
11982
+ ttl: z.number().optional(),
11983
+ tag: z.string().optional(),
11984
+ deviceId: z.number().optional(),
11985
+ eventId: z.string().optional(),
11986
+ metadata: z.record(z.string(), z.unknown()).optional(),
11987
+ /**
11988
+ * Values for the parameters the target's kind DECLARES in
11989
+ * {@link TargetKindSchema} `deliveryParams`. Already validated against the
11990
+ * declaration by the sender; a notifier reads only the keys it declared.
11991
+ */
11992
+ delivery: z.record(z.string(), DeliveryParamValueSchema).optional()
11993
+ });
11994
+ /** One declared native severity/priority level for a kind. */
11995
+ var TargetKindLevelSchema = z.object({
11996
+ id: z.string(),
11997
+ label: z.string(),
11998
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
11999
+ ordinal: z.number().int().min(1).max(5).nullable(),
12000
+ flags: z.object({
12001
+ critical: z.boolean().optional(),
12002
+ silent: z.boolean().optional(),
12003
+ noPush: z.boolean().optional()
12004
+ }).optional(),
12005
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
12006
+ requires: z.array(z.string()).optional(),
12007
+ description: z.string().optional()
12008
+ });
12009
+ /** Attachment capabilities for a kind (drives the degrade engine + test panel). */
12010
+ var TargetKindAttachmentsCapsSchema = z.object({
12011
+ mediaTypes: z.array(AttachmentMediaTypeSchema),
12012
+ mode: z.enum([
12013
+ "url",
12014
+ "bytes",
12015
+ "both"
12016
+ ]),
12017
+ max: z.number().int().nonnegative(),
12018
+ maxBytes: z.number().int().positive().optional()
12019
+ });
12020
+ /** The full capability block consulted before dispatch. */
12021
+ var TargetKindCapsSchema = z.object({
12022
+ attachments: TargetKindAttachmentsCapsSchema,
12023
+ /** Max action buttons (0 = none). */
12024
+ actions: z.number().int().nonnegative(),
12025
+ /**
12026
+ * Whether this kind renders a per-action ICON.
12027
+ *
12028
+ * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
12029
+ * run on the addon cap path — three production failures in one day taught
12030
+ * this repo that once. Absent is read as false by the degrade engine, which
12031
+ * is the safe direction: an icon that is not rendered costs nothing, an icon
12032
+ * assumed and dropped costs the operator's trust in the field.
12033
+ */
12034
+ actionIcons: z.boolean().optional(),
12035
+ levels: z.array(TargetKindLevelSchema),
12036
+ format: z.array(NotificationFormatSchema),
12037
+ clickUrl: z.boolean(),
12038
+ sound: z.boolean(),
12039
+ ttl: z.boolean(),
12040
+ bodyMaxLen: z.number().int().positive()
12041
+ });
12042
+ /**
12043
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
12044
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
12045
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
12046
+ * the union is large and not meant for runtime validation here; the exported
12047
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
12048
+ */
12049
+ var ConfigSchemaPassthrough$4 = z.unknown();
12050
+ var TargetKindSchema = z.object({
12051
+ kind: z.string(),
12052
+ label: z.string(),
12053
+ icon: z.string(),
12054
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
12055
+ addonId: z.string(),
12056
+ /**
12057
+ * URL of the kind's bundled BRAND icon, served by the providing addon over
12058
+ * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
12059
+ * when the addon bundles no icon for that kind — the client then falls back
12060
+ * to a neutral glyph rather than rendering the raw `icon` NAME as text.
12061
+ *
12062
+ * Root-relative on purpose: it resolves against whatever origin serves a web
12063
+ * client, and a native client joins it onto its own hub base.
12064
+ *
12065
+ * DECLARED here deliberately. It used to travel as an undeclared passthrough
12066
+ * field that survived only because the runtime cap-router forwards provider
12067
+ * output verbatim — so every consumer had to re-declare it by hand to stop
12068
+ * its own Zod parse from stripping it, and the whole arrangement would have
12069
+ * broken silently the moment output validation was tightened anywhere.
12070
+ */
12071
+ iconUrl: z.string().optional(),
12072
+ /**
12073
+ * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
12074
+ *
12075
+ * The server knows this and therefore says it, because the client cannot
12076
+ * safely guess: a React-Native client renders SVG and raster through two
12077
+ * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
12078
+ * not decode SVG on iOS/Android), so without this it silently fell back to a
12079
+ * placeholder glyph for every vector icon while the web build looked fine.
12080
+ *
12081
+ * Absent when {@link iconUrl} is absent, or for a legacy provider that has
12082
+ * not been updated — a client that cannot determine the type should prefer
12083
+ * its raster path, which is the safe default for an unknown image.
12084
+ */
12085
+ iconMediaType: z.string().optional(),
12086
+ configSchema: ConfigSchemaPassthrough$4,
12087
+ /**
12088
+ * The config keys that decide WHERE this kind's secrets are sent (server,
12089
+ * base URL, instance, chat, recipient). A save that changes any of them
12090
+ * while leaving a secret redacted is refused by the provider (D634), so an
12091
+ * editor uses this to ask for the secret on exactly those edits instead of
12092
+ * on every edit.
12093
+ *
12094
+ * Optional: absent from a provider that holds no secret (the Home Assistant
12095
+ * kinds) and from a provider older than this field — an editor that finds
12096
+ * it absent must assume ANY edit may need the secret.
12097
+ */
12098
+ destinationKeys: z.array(z.string()).optional(),
12099
+ supportsDiscovery: z.boolean(),
12100
+ /**
12101
+ * Extra delivery parameters a rule may set for a target of this kind (D938).
12102
+ * Absent = none; the rule editor then offers nothing.
12103
+ */
12104
+ deliveryParams: z.array(DeliveryParamSchema).optional(),
12105
+ caps: TargetKindCapsSchema
12106
+ });
12107
+ /**
12108
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
12109
+ * (return a presence marker only) when serving `listTargets` — never
12110
+ * round-trip a stored secret to the UI.
12111
+ */
12112
+ var TargetSchema = z.object({
12113
+ id: z.string(),
12114
+ name: z.string(),
12115
+ kind: z.string(),
12116
+ addonId: z.string(),
12117
+ enabled: z.boolean(),
12118
+ config: z.record(z.string(), z.unknown())
12119
+ });
12120
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
12121
+ var DiscoveredTargetSchema = z.object({
12122
+ kind: z.string(),
12123
+ suggestedName: z.string(),
12124
+ config: z.record(z.string(), z.unknown())
12125
+ });
12126
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
12127
+ var RenderedAsSchema = z.object({
12128
+ level: z.string(),
12129
+ format: NotificationFormatSchema,
12130
+ attachmentsSent: z.number().int().nonnegative(),
12131
+ actionsSent: z.number().int().nonnegative(),
12132
+ truncated: z.boolean(),
12133
+ dropped: z.array(z.string())
12134
+ });
12135
+ var SendResultSchema = z.object({
12136
+ success: z.boolean(),
12137
+ error: z.string().optional(),
12138
+ renderedAs: RenderedAsSchema.optional()
12139
+ });
12140
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
12141
+ var TestResultSchema = SendResultSchema;
12142
+ /**
12143
+ * Pre-save credential probe against a partial (unsaved) target config.
12144
+ * `resolvedUrl` never includes secrets (token stripped from path).
12145
+ */
12146
+ var ProbeTargetConfigResultSchema = z.object({
12147
+ ok: z.boolean(),
12148
+ resolvedUrl: z.string(),
12149
+ httpStatus: z.number().int().optional(),
12150
+ stateInstance: z.string().optional(),
12151
+ error: z.string().optional()
12152
+ });
12153
+ var notificationOutputCapability = {
12154
+ name: "notification-output",
12155
+ scope: "system",
12156
+ mode: "collection",
12157
+ methods: {
12158
+ listTargetKinds: method(z.object({}), z.array(TargetKindSchema)),
12159
+ listTargets: method(z.object({}), z.array(TargetSchema), { auth: "admin" }),
12160
+ /**
12161
+ * One target WITH secrets — admin edit / duplicate hydration only.
12162
+ * `listTargets` stays redacted; the editor loads this so password fields
12163
+ * are filled (masked in the input) and a save can round-trip the token
12164
+ * when a destination changes (Duplicate with a new chatId, etc.).
12165
+ */
12166
+ getTarget: method(z.object({ targetId: z.string() }), TargetSchema, { auth: "admin" }),
12167
+ discoverTargets: method(z.object({
12168
+ kind: z.string(),
12169
+ config: z.record(z.string(), z.unknown()).optional(),
12170
+ /**
12171
+ * When editing / duplicating, the blank password field never round-trips
12172
+ * the stored token. Pass the source target id so the provider can restore
12173
+ * secrets server-side before dialling (same merge as upsert).
12174
+ */
12175
+ targetId: z.string().optional()
12176
+ }), z.array(DiscoveredTargetSchema), { auth: "admin" }),
12177
+ probeTargetConfig: method(z.object({
12178
+ kind: z.string(),
12179
+ config: z.record(z.string(), z.unknown()),
12180
+ /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
12181
+ targetId: z.string().optional()
12182
+ }), ProbeTargetConfigResultSchema, {
12183
+ kind: "mutation",
12184
+ auth: "admin"
12185
+ }),
12186
+ send: method(z.object({
12187
+ targetId: z.string(),
12188
+ notification: NotificationSchema
12189
+ }), SendResultSchema, {
12190
+ kind: "mutation",
12191
+ auth: "admin"
12192
+ }),
12193
+ testTarget: method(z.object({
12194
+ targetId: z.string(),
12195
+ sample: NotificationSchema.optional()
12196
+ }), TestResultSchema, {
12197
+ kind: "mutation",
12198
+ auth: "admin"
12199
+ }),
12200
+ upsertTarget: method(z.object({
12201
+ target: TargetSchema,
12202
+ /**
12203
+ * Duplicate flow: create a NEW target id while copying secrets from an
12204
+ * existing row. The UI never holds the stored token; blank / redacted
12205
+ * password fields are restored from this source (D634 still applies if
12206
+ * destinations diverge without a re-typed secret).
12207
+ */
12208
+ cloneSecretsFrom: z.string().optional()
12209
+ }), TargetSchema, {
12210
+ kind: "mutation",
12211
+ auth: "admin"
12212
+ }),
12213
+ deleteTarget: method(z.object({ targetId: z.string() }), z.void(), {
12214
+ kind: "mutation",
12215
+ auth: "admin"
12216
+ }),
12217
+ setTargetEnabled: method(z.object({
12218
+ targetId: z.string(),
12219
+ enabled: z.boolean()
12220
+ }), z.void(), {
12221
+ kind: "mutation",
12222
+ auth: "admin"
12223
+ })
12224
+ }
12225
+ };
12226
+ z.looseObject({
12227
+ name: z.string().min(1),
12228
+ enabled: z.boolean().optional()
12229
+ });
12230
+ TargetSchema.omit({ id: true });
12231
+ /**
11784
12232
  * Shared video / audio encode profile schemas used by every consumer
11785
12233
  * that asks the stream broker to spawn a derived stream
11786
12234
  * (WebRTC, HAP, Alexa, custom addons).
@@ -20812,7 +21260,6 @@ var SYSTEM_CAP_VOCABULARY = {
20812
21260
  "calendar-source": system(INTERNAL),
20813
21261
  calendars: system("calendars feed schedules and conditions, not device actions"),
20814
21262
  composer: system("device composition — an authoring tool, not an action"),
20815
- "connection-test": system(INTERNAL),
20816
21263
  "core-blocks": system(INTERNAL),
20817
21264
  "custom-model-registry": system(ML),
20818
21265
  "data-store-provider": system(INTERNAL),
@@ -44492,451 +44939,6 @@ function normalizeActionUnits(actions, resolver, path = "steps") {
44492
44939
  warnings
44493
44940
  };
44494
44941
  }
44495
- /**
44496
- * notification-output — canonical, capability-gated notification delivery.
44497
- *
44498
- * Apprise-derived model (see
44499
- * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
44500
- * callers emit ONE canonical `Notification`; each provider declares a
44501
- * per-kind capability descriptor (`TargetKind`), and the pure degrade
44502
- * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
44503
- * message to what the kind supports — callers never special-case a service.
44504
- *
44505
- * DESIGN DECISIONS (locked):
44506
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
44507
- * `setTargetEnabled`), each provider persisting via the `settings-store`
44508
- * cap. Rationale: the admin UI needs one uniform surface across the
44509
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
44510
- * alternative would fork the UI per addon and cannot host the
44511
- * discovery→adopt flow.
44512
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
44513
- * the generated cap-mount auto-`concatCollection`-fans them across every
44514
- * registered provider (notifiers addon + HA addon) so one catalog is
44515
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
44516
- * `addonId` the generated collection router extracts from the call input.
44517
- * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
44518
- * transformer) + UDS MsgPack both round-trip typed arrays — already used by
44519
- * `storage` / `storage-provider` / `recording` caps over the same path. No
44520
- * base64 fallback needed.
44521
- *
44522
- * TODO (deferred, closed-set change — separate decision): add
44523
- * `providerKind: 'notify'` so notification providers surface on the unified
44524
- * admin "Integrations" page.
44525
- */
44526
- /**
44527
- * Zentik-derived typed-media enum — the superset across every kind. Each
44528
- * adapter picks what it supports and the degrade engine filters the rest.
44529
- */
44530
- var AttachmentMediaTypeSchema = z.enum([
44531
- "image",
44532
- "video",
44533
- "gif",
44534
- "audio",
44535
- "icon"
44536
- ]);
44537
- /**
44538
- * A single attachment. Exactly one of `url` (remote source, most adapters
44539
- * prefer this) or `bytes` (inline source; required for Pushover-style
44540
- * bytes-only kinds) MUST be present — the degrade engine expresses a
44541
- * url→bytes fetch as a `needsFetch` directive the adapter executes.
44542
- */
44543
- var AttachmentSchema = z.object({
44544
- mediaType: AttachmentMediaTypeSchema,
44545
- url: z.string().optional(),
44546
- bytes: z.instanceof(Uint8Array).optional(),
44547
- mime: z.string().optional(),
44548
- name: z.string().optional()
44549
- }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
44550
- var NotificationFormatSchema = z.enum([
44551
- "text",
44552
- "markdown",
44553
- "html"
44554
- ]);
44555
- /**
44556
- * The CLOSED icon vocabulary an action button may use.
44557
- *
44558
- * A closed set, not a free string, and that is the whole point: an arbitrary
44559
- * icon name is one that ntfy renders, zentik silently drops, and nobody
44560
- * notices — the same class of gap as a zone vocabulary nothing produced
44561
- * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
44562
- * declares `actionIcons: false` and the degrade engine strips the field.
44563
- *
44564
- * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
44565
- * renderer's icon set; "acknowledge" survives an adapter that draws it
44566
- * differently.
44567
- *
44568
- * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
44569
- *
44570
- * These names are for US. **No adapter may forward one verbatim.** Each maps
44571
- * the whole set onto its own renderer's vocabulary through a
44572
- * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
44573
- * fallback, so adding a member here fails every adapter's build until someone
44574
- * decides its glyph, which is the only place that decision can be made
44575
- * honestly.
44576
- *
44577
- * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
44578
- * `disarm` straight through; iOS feeds that string to
44579
- * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
44580
- * and every snooze and alarm button arrived BLANK. A pass-through is not a
44581
- * mapping, and "the field is documented" is not "the value renders".
44582
- *
44583
- * Adding a member is TRAIN-BOUND. The enum lives in the published
44584
- * `@camstack/server` closure and the cap seam validates against the HUB's copy,
44585
- * so an addon that emits a token the running hub does not know does not lose an
44586
- * icon — its whole `send` fails Zod validation and the notification never
44587
- * arrives. Never emit a new token from an addon before the train carrying it.
44588
- */
44589
- var NotificationActionIconSchema = z.enum([
44590
- "acknowledge",
44591
- "dismiss",
44592
- "silence",
44593
- "snooze",
44594
- "view",
44595
- "play",
44596
- "open",
44597
- "close",
44598
- "lock",
44599
- "unlock",
44600
- "arm",
44601
- "arm-home",
44602
- "arm-away",
44603
- "arm-night",
44604
- "disarm",
44605
- "light",
44606
- "alert",
44607
- "camera"
44608
- ]);
44609
- /** A single tap-through action button. */
44610
- var NotificationActionSchema = z.object({
44611
- id: z.string(),
44612
- label: z.string(),
44613
- url: z.string().optional(),
44614
- /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
44615
- icon: NotificationActionIconSchema.optional(),
44616
- /**
44617
- * Renders in a warning style where the notifier supports it.
44618
- *
44619
- * A HINT, never a gate. The callback's authority is its token and nothing
44620
- * else — see `notification-center/action-token.ts` for what that does and
44621
- * does not buy.
44622
- */
44623
- destructive: z.boolean().optional(),
44624
- /**
44625
- * How the tap should REACH the url.
44626
- *
44627
- * `navigate` (absent, and every button authored before this field) opens it:
44628
- * the phone leaves the notification and shows whatever the callback returns.
44629
- * That is right for a button whose answer the operator wants to read.
44630
- *
44631
- * `background` fires it as a POST and stays put. It exists for the buttons
44632
- * whose whole point is not to interrupt — "silence this for 30 minutes" is
44633
- * an answer to the notification, and being thrown into a browser tab to
44634
- * confirm it costs more attention than the notification did. A backend that
44635
- * cannot do a background call renders it as an ordinary link (the adapters
44636
- * fall back rather than dropping the button), so this is a preference, never
44637
- * a requirement.
44638
- */
44639
- mode: z.enum(["navigate", "background"]).optional()
44640
- });
44641
- /** A delivery parameter value: what a notifier declared it takes. */
44642
- var DeliveryParamValueSchema = z.union([
44643
- z.string(),
44644
- z.number(),
44645
- z.boolean()
44646
- ]);
44647
- /**
44648
- * One extra delivery parameter a notifier KIND declares (D938). A rule that
44649
- * addresses a target of that kind may set it; a kind that declares nothing is
44650
- * never handed one. The admin UI derives its control from this descriptor —
44651
- * no editor knows a service by name.
44652
- *
44653
- * Optional fields are `.optional()`, never `.default()` (a Zod default does not
44654
- * run on the addon cap path).
44655
- */
44656
- var DeliveryParamSchema = z.object({
44657
- key: z.string().min(1),
44658
- label: z.string(),
44659
- /** i18n key of the label, resolved by the declaring addon's namespace. */
44660
- labelKey: z.string().optional(),
44661
- type: z.enum([
44662
- "enum",
44663
- "number",
44664
- "boolean",
44665
- "string"
44666
- ]),
44667
- /** `enum` only: the closed set of accepted values. */
44668
- options: z.array(z.object({
44669
- value: z.string(),
44670
- label: z.string()
44671
- })).optional(),
44672
- /** `number` only. */
44673
- min: z.number().optional(),
44674
- max: z.number().optional(),
44675
- /** What the notifier does when the rule sets nothing; shown as the placeholder. */
44676
- default: DeliveryParamValueSchema.optional()
44677
- });
44678
- /**
44679
- * The canonical notification. `body` is the only hard field (Apprise model).
44680
- * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
44681
- * NOT a fixed severity enum — each kind declares its own `caps.levels` and
44682
- * the adapter maps this ordinal onto its native level. `level?` is an
44683
- * optional kind-native level id (`emergency`, `silent`, …) that overrides
44684
- * `priority` for that one target.
44685
- */
44686
- var NotificationSchema = z.object({
44687
- body: z.string(),
44688
- title: z.string().optional(),
44689
- format: NotificationFormatSchema.default("text"),
44690
- priority: z.number().int().min(1).max(5).default(3),
44691
- level: z.string().optional(),
44692
- attachments: z.array(AttachmentSchema).optional(),
44693
- clickUrl: z.string().optional(),
44694
- actions: z.array(NotificationActionSchema).optional(),
44695
- sound: z.string().optional(),
44696
- ttl: z.number().optional(),
44697
- tag: z.string().optional(),
44698
- deviceId: z.number().optional(),
44699
- eventId: z.string().optional(),
44700
- metadata: z.record(z.string(), z.unknown()).optional(),
44701
- /**
44702
- * Values for the parameters the target's kind DECLARES in
44703
- * {@link TargetKindSchema} `deliveryParams`. Already validated against the
44704
- * declaration by the sender; a notifier reads only the keys it declared.
44705
- */
44706
- delivery: z.record(z.string(), DeliveryParamValueSchema).optional()
44707
- });
44708
- /** One declared native severity/priority level for a kind. */
44709
- var TargetKindLevelSchema = z.object({
44710
- id: z.string(),
44711
- label: z.string(),
44712
- /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
44713
- ordinal: z.number().int().min(1).max(5).nullable(),
44714
- flags: z.object({
44715
- critical: z.boolean().optional(),
44716
- silent: z.boolean().optional(),
44717
- noPush: z.boolean().optional()
44718
- }).optional(),
44719
- /** e.g. Pushover `emergency` requires `retry` / `expire`. */
44720
- requires: z.array(z.string()).optional(),
44721
- description: z.string().optional()
44722
- });
44723
- /** Attachment capabilities for a kind (drives the degrade engine + test panel). */
44724
- var TargetKindAttachmentsCapsSchema = z.object({
44725
- mediaTypes: z.array(AttachmentMediaTypeSchema),
44726
- mode: z.enum([
44727
- "url",
44728
- "bytes",
44729
- "both"
44730
- ]),
44731
- max: z.number().int().nonnegative(),
44732
- maxBytes: z.number().int().positive().optional()
44733
- });
44734
- /** The full capability block consulted before dispatch. */
44735
- var TargetKindCapsSchema = z.object({
44736
- attachments: TargetKindAttachmentsCapsSchema,
44737
- /** Max action buttons (0 = none). */
44738
- actions: z.number().int().nonnegative(),
44739
- /**
44740
- * Whether this kind renders a per-action ICON.
44741
- *
44742
- * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
44743
- * run on the addon cap path — three production failures in one day taught
44744
- * this repo that once. Absent is read as false by the degrade engine, which
44745
- * is the safe direction: an icon that is not rendered costs nothing, an icon
44746
- * assumed and dropped costs the operator's trust in the field.
44747
- */
44748
- actionIcons: z.boolean().optional(),
44749
- levels: z.array(TargetKindLevelSchema),
44750
- format: z.array(NotificationFormatSchema),
44751
- clickUrl: z.boolean(),
44752
- sound: z.boolean(),
44753
- ttl: z.boolean(),
44754
- bodyMaxLen: z.number().int().positive()
44755
- });
44756
- /**
44757
- * `configSchema` is a `ConfigUISchema` tree passed through to the admin
44758
- * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
44759
- * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
44760
- * the union is large and not meant for runtime validation here; the exported
44761
- * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
44762
- */
44763
- var ConfigSchemaPassthrough$4 = z.unknown();
44764
- var TargetKindSchema = z.object({
44765
- kind: z.string(),
44766
- label: z.string(),
44767
- icon: z.string(),
44768
- /** Stamped by each provider so the concat-fanned catalog stays routable. */
44769
- addonId: z.string(),
44770
- /**
44771
- * URL of the kind's bundled BRAND icon, served by the providing addon over
44772
- * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
44773
- * when the addon bundles no icon for that kind — the client then falls back
44774
- * to a neutral glyph rather than rendering the raw `icon` NAME as text.
44775
- *
44776
- * Root-relative on purpose: it resolves against whatever origin serves a web
44777
- * client, and a native client joins it onto its own hub base.
44778
- *
44779
- * DECLARED here deliberately. It used to travel as an undeclared passthrough
44780
- * field that survived only because the runtime cap-router forwards provider
44781
- * output verbatim — so every consumer had to re-declare it by hand to stop
44782
- * its own Zod parse from stripping it, and the whole arrangement would have
44783
- * broken silently the moment output validation was tightened anywhere.
44784
- */
44785
- iconUrl: z.string().optional(),
44786
- /**
44787
- * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
44788
- *
44789
- * The server knows this and therefore says it, because the client cannot
44790
- * safely guess: a React-Native client renders SVG and raster through two
44791
- * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
44792
- * not decode SVG on iOS/Android), so without this it silently fell back to a
44793
- * placeholder glyph for every vector icon while the web build looked fine.
44794
- *
44795
- * Absent when {@link iconUrl} is absent, or for a legacy provider that has
44796
- * not been updated — a client that cannot determine the type should prefer
44797
- * its raster path, which is the safe default for an unknown image.
44798
- */
44799
- iconMediaType: z.string().optional(),
44800
- configSchema: ConfigSchemaPassthrough$4,
44801
- /**
44802
- * The config keys that decide WHERE this kind's secrets are sent (server,
44803
- * base URL, instance, chat, recipient). A save that changes any of them
44804
- * while leaving a secret redacted is refused by the provider (D634), so an
44805
- * editor uses this to ask for the secret on exactly those edits instead of
44806
- * on every edit.
44807
- *
44808
- * Optional: absent from a provider that holds no secret (the Home Assistant
44809
- * kinds) and from a provider older than this field — an editor that finds
44810
- * it absent must assume ANY edit may need the secret.
44811
- */
44812
- destinationKeys: z.array(z.string()).optional(),
44813
- supportsDiscovery: z.boolean(),
44814
- /**
44815
- * Extra delivery parameters a rule may set for a target of this kind (D938).
44816
- * Absent = none; the rule editor then offers nothing.
44817
- */
44818
- deliveryParams: z.array(DeliveryParamSchema).optional(),
44819
- caps: TargetKindCapsSchema
44820
- });
44821
- /**
44822
- * A persisted target. `config` holds secrets; providers REDACT secret fields
44823
- * (return a presence marker only) when serving `listTargets` — never
44824
- * round-trip a stored secret to the UI.
44825
- */
44826
- var TargetSchema = z.object({
44827
- id: z.string(),
44828
- name: z.string(),
44829
- kind: z.string(),
44830
- addonId: z.string(),
44831
- enabled: z.boolean(),
44832
- config: z.record(z.string(), z.unknown())
44833
- });
44834
- /** A discovery-surfaced candidate (config is partial + non-secret). */
44835
- var DiscoveredTargetSchema = z.object({
44836
- kind: z.string(),
44837
- suggestedName: z.string(),
44838
- config: z.record(z.string(), z.unknown())
44839
- });
44840
- /** The degrade engine's report — what was resolved / dropped / degraded. */
44841
- var RenderedAsSchema = z.object({
44842
- level: z.string(),
44843
- format: NotificationFormatSchema,
44844
- attachmentsSent: z.number().int().nonnegative(),
44845
- actionsSent: z.number().int().nonnegative(),
44846
- truncated: z.boolean(),
44847
- dropped: z.array(z.string())
44848
- });
44849
- var SendResultSchema = z.object({
44850
- success: z.boolean(),
44851
- error: z.string().optional(),
44852
- renderedAs: RenderedAsSchema.optional()
44853
- });
44854
- /** Same shape as SendResult — kept as a distinct name for the test panel. */
44855
- var TestResultSchema = SendResultSchema;
44856
- /**
44857
- * Pre-save credential probe against a partial (unsaved) target config.
44858
- * `resolvedUrl` never includes secrets (token stripped from path).
44859
- */
44860
- var ProbeTargetConfigResultSchema = z.object({
44861
- ok: z.boolean(),
44862
- resolvedUrl: z.string(),
44863
- httpStatus: z.number().int().optional(),
44864
- stateInstance: z.string().optional(),
44865
- error: z.string().optional()
44866
- });
44867
- var notificationOutputCapability = {
44868
- name: "notification-output",
44869
- scope: "system",
44870
- mode: "collection",
44871
- methods: {
44872
- listTargetKinds: method(z.object({}), z.array(TargetKindSchema)),
44873
- listTargets: method(z.object({}), z.array(TargetSchema), { auth: "admin" }),
44874
- /**
44875
- * One target WITH secrets — admin edit / duplicate hydration only.
44876
- * `listTargets` stays redacted; the editor loads this so password fields
44877
- * are filled (masked in the input) and a save can round-trip the token
44878
- * when a destination changes (Duplicate with a new chatId, etc.).
44879
- */
44880
- getTarget: method(z.object({ targetId: z.string() }), TargetSchema, { auth: "admin" }),
44881
- discoverTargets: method(z.object({
44882
- kind: z.string(),
44883
- config: z.record(z.string(), z.unknown()).optional(),
44884
- /**
44885
- * When editing / duplicating, the blank password field never round-trips
44886
- * the stored token. Pass the source target id so the provider can restore
44887
- * secrets server-side before dialling (same merge as upsert).
44888
- */
44889
- targetId: z.string().optional()
44890
- }), z.array(DiscoveredTargetSchema), { auth: "admin" }),
44891
- probeTargetConfig: method(z.object({
44892
- kind: z.string(),
44893
- config: z.record(z.string(), z.unknown()),
44894
- /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
44895
- targetId: z.string().optional()
44896
- }), ProbeTargetConfigResultSchema, {
44897
- kind: "mutation",
44898
- auth: "admin"
44899
- }),
44900
- send: method(z.object({
44901
- targetId: z.string(),
44902
- notification: NotificationSchema
44903
- }), SendResultSchema, {
44904
- kind: "mutation",
44905
- auth: "admin"
44906
- }),
44907
- testTarget: method(z.object({
44908
- targetId: z.string(),
44909
- sample: NotificationSchema.optional()
44910
- }), TestResultSchema, {
44911
- kind: "mutation",
44912
- auth: "admin"
44913
- }),
44914
- upsertTarget: method(z.object({
44915
- target: TargetSchema,
44916
- /**
44917
- * Duplicate flow: create a NEW target id while copying secrets from an
44918
- * existing row. The UI never holds the stored token; blank / redacted
44919
- * password fields are restored from this source (D634 still applies if
44920
- * destinations diverge without a re-typed secret).
44921
- */
44922
- cloneSecretsFrom: z.string().optional()
44923
- }), TargetSchema, {
44924
- kind: "mutation",
44925
- auth: "admin"
44926
- }),
44927
- deleteTarget: method(z.object({ targetId: z.string() }), z.void(), {
44928
- kind: "mutation",
44929
- auth: "admin"
44930
- }),
44931
- setTargetEnabled: method(z.object({
44932
- targetId: z.string(),
44933
- enabled: z.boolean()
44934
- }), z.void(), {
44935
- kind: "mutation",
44936
- auth: "admin"
44937
- })
44938
- }
44939
- };
44940
44942
  z.enum([
44941
44943
  "automation",
44942
44944
  "action",
@@ -50842,45 +50844,6 @@ var composerCapability = {
50842
50844
  getStates: method(z.object({ blockIds: z.array(z.string()) }), z.object({ states: z.array(CompositionBlockStateSchema) }), { auth: "admin" })
50843
50845
  }
50844
50846
  };
50845
- var ConnectionTestOutcomeSchema = z.discriminatedUnion("outcome", [
50846
- z.object({
50847
- outcome: z.literal("validated"),
50848
- /** Round-trip of the sign-in, when the provider measured it. */
50849
- latencyMs: z.number().nonnegative().optional(),
50850
- /** Optional human detail worth showing next to the tick
50851
- * ("3 devices visible on this account"). */
50852
- detail: z.string().optional()
50853
- }).strict(),
50854
- z.object({
50855
- outcome: z.literal("rejected"),
50856
- error: z.string()
50857
- }).strict(),
50858
- z.object({
50859
- outcome: z.literal("inconclusive"),
50860
- error: z.string()
50861
- }).strict()
50862
- ]);
50863
- var ConnectionTestInputSchema = z.object({
50864
- /** Candidate integration settings, exactly as the create form collected them. */
50865
- settings: z.record(z.string(), z.unknown()) });
50866
- /**
50867
- * What the provider's test actually DOES, so the UI can say it in words before
50868
- * the operator presses the button ("Signs in to the Dreo cloud"). Purely
50869
- * descriptive — it never changes routing.
50870
- */
50871
- var ConnectionTestDescriptorSchema = z.object({ label: z.string() });
50872
- var connectionTestCapability = {
50873
- name: "connection-test",
50874
- scope: "system",
50875
- mode: "collection",
50876
- methods: {
50877
- testSettings: method(ConnectionTestInputSchema, ConnectionTestOutcomeSchema, {
50878
- kind: "mutation",
50879
- auth: "admin"
50880
- }),
50881
- describeTest: method(z.void(), ConnectionTestDescriptorSchema, { auth: "admin" })
50882
- }
50883
- };
50884
50847
  /**
50885
50848
  * Upstream-system connectivity sensor — distinct from `device-status`,
50886
50849
  * which is the kernel-managed online/offline flag for the device's
@@ -62456,10 +62419,9 @@ var AvailableIntegrationTypeSchema = z.object({
62456
62419
  * locations" checkbox. Provider-declared in the addon manifest. */
62457
62420
  supportsLocationImport: z.boolean(),
62458
62421
  /**
62459
- * True when this integration DECLARES a pre-creation test (the
62460
- * `connection-test` cap, or a broker whose settings it stores). Drives the
62461
- * Test button: an integration that cannot be tested must say so up front
62462
- * rather than offering a button that always answers the same nonsense.
62422
+ * True when this integration's instances declare a Test (`integration-instances.describe().canTest`,
62423
+ * D1016). An integration that cannot be tested must say so up front rather than offering a
62424
+ * button that always answers the same nonsense.
62463
62425
  */
62464
62426
  canTest: z.boolean(),
62465
62427
  existingInstances: z.array(z.object({
@@ -62513,7 +62475,9 @@ var CreateIntegrationInputSchema = z.object({
62513
62475
  info: z.record(z.string(), z.unknown()).optional(),
62514
62476
  /** `stableId` of the discovery candidate the form was seeded from (D984). */
62515
62477
  originStableId: z.string().optional(),
62516
- settings: z.record(z.string(), z.unknown()).optional()
62478
+ settings: z.record(z.string(), z.unknown()).optional(),
62479
+ /** The instance kind being created, for a provider with several; omitted = its only testable kind. */
62480
+ kind: z.string().min(1).optional()
62517
62481
  });
62518
62482
  var UpdateIntegrationInputSchema = z.object({
62519
62483
  id: z.string(),
@@ -62550,14 +62514,7 @@ var integrationsCapability = {
62550
62514
  kind: "mutation",
62551
62515
  auth: "admin"
62552
62516
  }),
62553
- getAvailableTypes: method(z.void(), z.array(AvailableIntegrationTypeSchema), { auth: "admin" }),
62554
- testConnection: method(z.object({
62555
- addonId: z.string(),
62556
- settings: z.record(z.string(), z.unknown())
62557
- }), TestConnectionResultSchema, {
62558
- kind: "mutation",
62559
- auth: "admin"
62560
- })
62517
+ getAvailableTypes: method(z.void(), z.array(AvailableIntegrationTypeSchema), { auth: "admin" })
62561
62518
  },
62562
62519
  /** BIG PLAN 2: declarative mount hint — read by `@camstack/server/system` `buildCapRouters`. */
62563
62520
  mount: { kind: "server-provided" }
@@ -73796,13 +73753,6 @@ var AddBrokerInputSchema = z.object({
73796
73753
  });
73797
73754
  var AddBrokerResultSchema = z.object({ id: z.string() });
73798
73755
  var IdInputSchema = z.object({ id: z.string() });
73799
- var TestResultSchema$1 = z.discriminatedUnion("ok", [z.object({
73800
- ok: z.literal(true),
73801
- latencyMs: z.number()
73802
- }), z.object({
73803
- ok: z.literal(false),
73804
- error: z.string()
73805
- })]);
73806
73756
  var StartEmbeddedInputSchema = z.object({
73807
73757
  port: z.number().int().min(1).max(65535).default(1883),
73808
73758
  /** Allow anonymous connect (no username/password). Default: false. */
@@ -73839,10 +73789,6 @@ var mqttBrokerCapability = {
73839
73789
  kind: "mutation",
73840
73790
  auth: "admin"
73841
73791
  }),
73842
- testConnection: method(IdInputSchema, TestResultSchema$1, {
73843
- kind: "mutation",
73844
- auth: "admin"
73845
- }),
73846
73792
  startEmbeddedBroker: method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, {
73847
73793
  kind: "mutation",
73848
73794
  auth: "admin"
@@ -89596,7 +89542,7 @@ var TrainingProviderTypeSchema = z.object({
89596
89542
  label: z.string(),
89597
89543
  /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
89598
89544
  iconAsset: z.string(),
89599
- /** Owning `training-provider` addon — collection selector for createEntry. */
89545
+ /** Owning `training-provider` addon. */
89600
89546
  addonId: z.string(),
89601
89547
  /**
89602
89548
  * Fields for one entry of this type (credentials + defaults). Absent on a
@@ -89641,36 +89587,6 @@ var TrainingProviderDescriptorSchema = z.object({
89641
89587
  */
89642
89588
  formValues: z.record(z.string(), z.unknown()).optional()
89643
89589
  });
89644
- /**
89645
- * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
89646
- * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
89647
- * `{ $secretClear: true }` clears it.
89648
- */
89649
- var TrainingProviderUpdateEntryInputSchema = z.object({
89650
- entryId: z.string().min(1),
89651
- name: z.string().min(1),
89652
- tokenId: z.string().optional(),
89653
- tokenSecret: z.union([z.string(), z.object({ $secretClear: z.literal(true) })]).optional(),
89654
- environment: z.string().optional(),
89655
- gpuType: z.string().optional(),
89656
- region: z.string().optional(),
89657
- costCapUsd: z.number().nonnegative().optional(),
89658
- maxRuntimeSec: z.number().int().positive().optional(),
89659
- failedDatasetGraceHours: z.number().nonnegative().optional()
89660
- });
89661
- var TrainingCredentialCheckSchema = z.object({
89662
- ok: z.boolean(),
89663
- /** Workspace / account name, when the provider says. */
89664
- account: z.string().optional(),
89665
- reason: z.enum([
89666
- "missing",
89667
- "invalid",
89668
- "forbidden",
89669
- "network",
89670
- "quota"
89671
- ]).optional(),
89672
- detail: z.string().optional()
89673
- });
89674
89590
  var ProviderJobStateSchema = z.enum([
89675
89591
  "pending",
89676
89592
  "starting",
@@ -89729,36 +89645,6 @@ var trainingProviderCapability = {
89729
89645
  describeTypes: method(z.object({}), z.array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }),
89730
89646
  /** Configured entries (pills). Concat-fans. */
89731
89647
  listEntries: method(z.object({}), z.array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }),
89732
- /**
89733
- * Create an entry under this provider type. Pin with `{ addonId }` of the
89734
- * type's owning addon (from describeTypes).
89735
- */
89736
- createEntry: method(z.object({
89737
- typeId: z.string().min(1),
89738
- name: z.string().min(1)
89739
- }), z.object({ entryId: z.string() }), {
89740
- kind: "mutation",
89741
- auth: "admin"
89742
- }),
89743
- /** Delete an entry. Pin with the owning `{ addonId }`. */
89744
- deleteEntry: method(z.object({ entryId: z.string().min(1) }), z.object({ ok: z.literal(true) }), {
89745
- kind: "mutation",
89746
- auth: "admin"
89747
- }),
89748
- /**
89749
- * Update one entry (name, credentials, defaults). Pin with owning
89750
- * `{ addonId }`. Empty/omitted `tokenSecret` keeps the stored secret.
89751
- */
89752
- updateEntry: method(TrainingProviderUpdateEntryInputSchema, z.object({ ok: z.literal(true) }), {
89753
- kind: "mutation",
89754
- auth: "admin"
89755
- }),
89756
- /** Call the provider with the entry's stored credentials. Never returns them. */
89757
- validateCredentials: method(z.object({ entryId: z.string().min(1) }), TrainingCredentialCheckSchema, {
89758
- kind: "mutation",
89759
- auth: "admin",
89760
- timeoutMs: 3e4
89761
- }),
89762
89648
  /** USD range for a run of `gpuSeconds` on `gpuType` in `region`. */
89763
89649
  estimateJob: method(z.object({
89764
89650
  entryId: z.string().min(1),
@@ -92410,7 +92296,6 @@ var ALL_CAPABILITY_DEFINITIONS = [
92410
92296
  climateControlCapability,
92411
92297
  colorCapability,
92412
92298
  composerCapability,
92413
- connectionTestCapability,
92414
92299
  connectivityCapability,
92415
92300
  consumablesCapability,
92416
92301
  contactCapability,
@@ -97246,20 +97131,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
97246
97131
  access: "view",
97247
97132
  role: "admin"
97248
97133
  },
97249
- "connectionTest.describeTest": {
97250
- capName: "connection-test",
97251
- capScope: "system",
97252
- addonId: null,
97253
- access: "view",
97254
- role: "admin"
97255
- },
97256
- "connectionTest.testSettings": {
97257
- capName: "connection-test",
97258
- capScope: "system",
97259
- addonId: null,
97260
- access: "create",
97261
- role: "admin"
97262
- },
97263
97134
  "connectivity.getStatus": {
97264
97135
  capName: "connectivity",
97265
97136
  capScope: "device",
@@ -99626,13 +99497,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
99626
99497
  access: "view",
99627
99498
  role: "admin"
99628
99499
  },
99629
- "integrations.testConnection": {
99630
- capName: "integrations",
99631
- capScope: "system",
99632
- addonId: null,
99633
- access: "create",
99634
- role: "admin"
99635
- },
99636
99500
  "integrations.update": {
99637
99501
  capName: "integrations",
99638
99502
  capScope: "system",
@@ -100865,13 +100729,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
100865
100729
  access: "create",
100866
100730
  role: "admin"
100867
100731
  },
100868
- "mqttBroker.testConnection": {
100869
- capName: "mqtt-broker",
100870
- capScope: "system",
100871
- addonId: null,
100872
- access: "create",
100873
- role: "admin"
100874
- },
100875
100732
  "nativeObjectDetection.getOptions": {
100876
100733
  capName: "native-object-detection",
100877
100734
  capScope: "device",
@@ -105702,20 +105559,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
105702
105559
  access: "create",
105703
105560
  role: "admin"
105704
105561
  },
105705
- "trainingProvider.createEntry": {
105706
- capName: "training-provider",
105707
- capScope: "system",
105708
- addonId: null,
105709
- access: "create",
105710
- role: "admin"
105711
- },
105712
- "trainingProvider.deleteEntry": {
105713
- capName: "training-provider",
105714
- capScope: "system",
105715
- addonId: null,
105716
- access: "delete",
105717
- role: "admin"
105718
- },
105719
105562
  "trainingProvider.describe": {
105720
105563
  capName: "training-provider",
105721
105564
  capScope: "system",
@@ -105786,13 +105629,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
105786
105629
  access: "create",
105787
105630
  role: "admin"
105788
105631
  },
105789
- "trainingProvider.updateEntry": {
105790
- capName: "training-provider",
105791
- capScope: "system",
105792
- addonId: null,
105793
- access: "create",
105794
- role: "admin"
105795
- },
105796
105632
  "trainingProvider.uploadDataset": {
105797
105633
  capName: "training-provider",
105798
105634
  capScope: "system",
@@ -105800,13 +105636,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
105800
105636
  access: "create",
105801
105637
  role: "admin"
105802
105638
  },
105803
- "trainingProvider.validateCredentials": {
105804
- capName: "training-provider",
105805
- capScope: "system",
105806
- addonId: null,
105807
- access: "create",
105808
- role: "admin"
105809
- },
105810
105639
  "turnProvider.getTurnServers": {
105811
105640
  capName: "turn-provider",
105812
105641
  capScope: "system",