@camstack/addon-export-alexa 1.2.185 → 1.2.187

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.
@@ -34,7 +34,7 @@ let node_path = require("node:path");
34
34
  node_path = __toESM(node_path, 1);
35
35
  require("node:child_process");
36
36
  require("node:zlib");
37
- //#region ../types/dist/event-category-BmPm98n0.mjs
37
+ //#region ../types/dist/event-category-78tcBemo.mjs
38
38
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
39
39
  EventCategory["SystemBoot"] = "system.boot";
40
40
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -155,6 +155,23 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
155
155
  */
156
156
  EventCategory["AddonLoadRecovered"] = "addon.load-recovered";
157
157
  /**
158
+ * An addon is RUNNING although its installed package is below what the
159
+ * running server requires (`camstack.requires.addons` of the server, or the
160
+ * addon's own `requires.server`). Raised once per streak by the unsupported-
161
+ * addon tracker, on the hub and on agents; AlertCenter turns it into one
162
+ * operator alert per node and package. The addon is never held back for it.
163
+ *
164
+ * Payload: `{ packageName, addonId, nodeId, installedVersion, requiredMinimum, serverVersion, unmet }`.
165
+ */
166
+ EventCategory["AddonUnsupportedVersion"] = "addon.unsupported-version";
167
+ /**
168
+ * The package of an {@link AddonUnsupportedVersion} alert reached a supported
169
+ * version, or is no longer installed on the node. AlertCenter dismisses the matching alert.
170
+ *
171
+ * Payload: `{ packageName, addonId, nodeId }`.
172
+ */
173
+ EventCategory["AddonUnsupportedResolved"] = "addon.unsupported-resolved";
174
+ /**
158
175
  * Monitor scheduled the next retry for a failed addon. Transient —
159
176
  * surfaced to the UI for live-updating the "next retry in Ns"
160
177
  * countdown on the Addons page row, NOT persisted as an alert.
@@ -265,7 +282,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
265
282
  EventCategory["ProcessRestarted"] = "process.restarted";
266
283
  /**
267
284
  * The SET of storage locations changed — one was created, edited, enabled,
268
- * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
285
+ * disabled or deleted through the location instances or the forced-delete action.
269
286
  *
270
287
  * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
271
288
  * it must also converge on its own periodic path, because a dropped event
@@ -6016,7 +6033,7 @@ var ZodIssueCode = {
6016
6033
  var ZodFirstPartyTypeKind;
6017
6034
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6018
6035
  //#endregion
6019
- //#region ../types/dist/sleep-CmjWurK5.mjs
6036
+ //#region ../types/dist/sleep-AEnTN3b4.mjs
6020
6037
  /**
6021
6038
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6022
6039
  * window to float samples (D455).
@@ -6725,10 +6742,33 @@ function integrationRowsApiOver(api) {
6725
6742
  };
6726
6743
  }
6727
6744
  var PREFIX$1 = "records/";
6745
+ /**
6746
+ * Cross-realm brand. An addon bundles its own copy of this module (D15) while
6747
+ * `ctx.records` is the HOST's door, so an error thrown by the host is an
6748
+ * instance of the host's classes, not of the addon's. The brand plus the code
6749
+ * make `instanceof` answer by identity of the failure, not of the copy.
6750
+ */
6751
+ var RECORDS_ERROR_BRAND = Symbol.for("camstack.records-error");
6752
+ function carriesBrand(value) {
6753
+ return typeof value === "object" && value !== null && Reflect.get(value, RECORDS_ERROR_BRAND) === true;
6754
+ }
6728
6755
  /** The base of every records failure. `detail` is the human part of the message. */
6729
6756
  var RecordsError = class extends Error {
6757
+ /** The code a subclass stands for; the base stands for every code. */
6758
+ static code = void 0;
6759
+ /**
6760
+ * `instanceof` across copies of this module: any branded error is a
6761
+ * `RecordsError`, and is an instance of a subclass only when its code is the
6762
+ * subclass's code. Same-copy answers are unchanged.
6763
+ */
6764
+ static [Symbol.hasInstance](value) {
6765
+ if (Function.prototype[Symbol.hasInstance].call(this, value)) return true;
6766
+ if (!carriesBrand(value)) return false;
6767
+ return this.code === void 0 || value.code === this.code;
6768
+ }
6730
6769
  code;
6731
6770
  detail;
6771
+ [RECORDS_ERROR_BRAND] = true;
6732
6772
  constructor(code, detail) {
6733
6773
  super(`${PREFIX$1}${code}: ${detail}`);
6734
6774
  this.name = "RecordsError";
@@ -6737,29 +6777,33 @@ var RecordsError = class extends Error {
6737
6777
  }
6738
6778
  };
6739
6779
  /** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
6740
- var RevConflictError = class extends RecordsError {
6780
+ var RevConflictError = class RevConflictError extends RecordsError {
6781
+ static code = "rev-conflict";
6741
6782
  constructor(detail) {
6742
- super("rev-conflict", detail);
6783
+ super(RevConflictError.code, detail);
6743
6784
  this.name = "RevConflictError";
6744
6785
  }
6745
6786
  };
6746
6787
  /** The keychain could not store or serve a value: explicit, never an empty string. */
6747
- var RecordSecretUnavailableError = class extends RecordsError {
6788
+ var RecordSecretUnavailableError = class RecordSecretUnavailableError extends RecordsError {
6789
+ static code = "secret-unavailable";
6748
6790
  constructor(detail) {
6749
- super("secret-unavailable", detail);
6791
+ super(RecordSecretUnavailableError.code, detail);
6750
6792
  this.name = "RecordSecretUnavailableError";
6751
6793
  }
6752
6794
  };
6753
- var InvalidRecordError = class extends RecordsError {
6795
+ var InvalidRecordError = class InvalidRecordError extends RecordsError {
6796
+ static code = "invalid-record";
6754
6797
  constructor(detail) {
6755
- super("invalid-record", detail);
6798
+ super(InvalidRecordError.code, detail);
6756
6799
  this.name = "InvalidRecordError";
6757
6800
  }
6758
6801
  };
6759
6802
  /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
6760
- var DeclarationRefusedError = class extends RecordsError {
6803
+ var DeclarationRefusedError = class DeclarationRefusedError extends RecordsError {
6804
+ static code = "declaration-refused";
6761
6805
  constructor(detail) {
6762
- super("declaration-refused", detail);
6806
+ super(DeclarationRefusedError.code, detail);
6763
6807
  this.name = "DeclarationRefusedError";
6764
6808
  }
6765
6809
  };
@@ -7237,17 +7281,35 @@ var RecordIntegrationInstances = class {
7237
7281
  ...kind !== void 0 ? { kind } : {}
7238
7282
  });
7239
7283
  if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
7284
+ const initial = this.hooks.initialBody(name, kind);
7285
+ const patch = this.patchOf(values ?? {});
7286
+ if (Object.keys(patch).length > 0) Object.assign(patch, await this.hooks.validateWrite?.({
7287
+ kind,
7288
+ body: {
7289
+ ...initial,
7290
+ ...patch
7291
+ }
7292
+ }));
7240
7293
  await this.handle.put({
7241
7294
  id: minted,
7242
- data: this.hooks.initialBody(name, kind)
7295
+ data: initial
7243
7296
  }, { ifRev: 0 });
7244
- const patch = this.patchOf(values ?? {});
7245
7297
  if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
7246
7298
  await this.hooks.onChanged?.(minted, "created");
7247
7299
  return { id: minted };
7248
7300
  };
7249
7301
  updateInstance = async ({ id, name, values }) => {
7250
7302
  const patch = this.patchOf(values);
7303
+ if (this.hooks.validateWrite !== void 0 && Object.keys(patch).length > 0) {
7304
+ const stored = await this.handle.get(id);
7305
+ if (stored !== null) Object.assign(patch, await this.hooks.validateWrite({
7306
+ kind: void 0,
7307
+ body: {
7308
+ ...stored.data,
7309
+ ...patch
7310
+ }
7311
+ }));
7312
+ }
7251
7313
  if (name !== void 0) patch[this.nameField] = name;
7252
7314
  await this.handle.patch(id, patch);
7253
7315
  await this.hooks.onChanged?.(id, "updated");
@@ -9554,271 +9616,6 @@ function normalizeAddonInitResult(result) {
9554
9616
  if (Array.isArray(result)) return { providers: result };
9555
9617
  return result;
9556
9618
  }
9557
- /**
9558
- * The share-view scope kinds a share-link token can carry. The hub mints
9559
- * and validates them (`ShareViewGrantSchema` builds its
9560
- * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
9561
- */
9562
- var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
9563
- /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
9564
- var PeerBytesTicketSchema = object({
9565
- /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
9566
- url: string().min(1),
9567
- /**
9568
- * The HOST node this URL means something on — the hub or a named agent,
9569
- * never a runner. {@link AddonPeerBytes.open} compares it to its own and
9570
- * refuses `cross-node` by name when they differ, without dialling.
9571
- */
9572
- hostNodeId: string().min(1),
9573
- expiresAtMs: number().int().nonnegative(),
9574
- /**
9575
- * What the producer DECLARED the body to be, when it knows — `null` when it
9576
- * does not. Never `0` for unknown (D393): a consumer sizing a bound off this
9577
- * must be able to tell "the producer did not say" from "the body is empty".
9578
- */
9579
- declaredBytes: number().int().nonnegative().nullable()
9580
- });
9581
- function defOf(schema) {
9582
- const zodBag = Reflect.get(schema, "_zod");
9583
- if (typeof zodBag !== "object" || zodBag === null) return {};
9584
- const def = Reflect.get(zodBag, "def");
9585
- if (typeof def !== "object" || def === null) return {};
9586
- return def;
9587
- }
9588
- function declaredHere(schema) {
9589
- return globalRegistry.get(schema)?.secret === true;
9590
- }
9591
- /** Wrapper kinds whose `innerType` is the field itself. */
9592
- var WRAPPERS = new Set([
9593
- "optional",
9594
- "nullable",
9595
- "default",
9596
- "prefault",
9597
- "catch",
9598
- "readonly",
9599
- "nonoptional"
9600
- ]);
9601
- /**
9602
- * The schema layers that make up ONE field: the schema itself and every
9603
- * wrapper below it (optional / default / nullable / readonly / catch), plus
9604
- * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
9605
- * `.transform` on `in`).
9606
- */
9607
- function layersOf(schema) {
9608
- const out = [];
9609
- const queue = [schema];
9610
- while (queue.length > 0) {
9611
- const s = queue.shift();
9612
- if (!s || out.includes(s)) continue;
9613
- out.push(s);
9614
- const def = defOf(s);
9615
- if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
9616
- if (def.type === "pipe") {
9617
- if (def.in) queue.push(def.in);
9618
- if (def.out) queue.push(def.out);
9619
- }
9620
- }
9621
- return out;
9622
- }
9623
- /** True when any layer of this field declares `.meta({ secret: true })`. */
9624
- function isZodSecret(schema) {
9625
- return layersOf(schema).some(declaredHere);
9626
- }
9627
- /**
9628
- * Every declared secret path in a config schema: dotted keys, `[]` for "each
9629
- * element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
9630
- * map" (`applianceSecrets{}`). A declared
9631
- * object or array is reported as one path and not descended into — everything
9632
- * under it is secret.
9633
- */
9634
- function collectZodSecretPaths(schema, prefix = "") {
9635
- if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
9636
- const paths = [];
9637
- for (const layer of layersOf(schema)) {
9638
- const def = defOf(layer);
9639
- if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
9640
- else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
9641
- else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
9642
- else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
9643
- else if (def.type === "intersection") {
9644
- if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
9645
- if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
9646
- }
9647
- }
9648
- return [...new Set(paths)];
9649
- }
9650
- /**
9651
- * Record kinds (D881): the declaration an addon makes of one kind of fact, the
9652
- * Zod row schema that describes it, and the helper that turns the two into the
9653
- * JSON the engine stores.
9654
- *
9655
- * A kind is declared ONCE, next to the code that owns it, and the engine's
9656
- * reconciler creates its indexes - nothing creates DDL at runtime from a write.
9657
- * Everything the generic machinery needs (secret fields, the entry descriptor)
9658
- * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
9659
- * never a field name (D879).
9660
- */
9661
- /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
9662
- var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
9663
- var RecordIndexSchema = object({
9664
- name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
9665
- fields: array(RecordFieldPathSchema).min(1).max(4),
9666
- unique: boolean().optional()
9667
- }).strict();
9668
- var RecordRetentionSchema = union([
9669
- object({
9670
- ttlMs: number().int().positive(),
9671
- from: _enum(["at", "write"])
9672
- }).strict(),
9673
- object({
9674
- maxRows: number().int().positive().optional(),
9675
- maxRowsPerDevice: number().int().positive().optional()
9676
- }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
9677
- object({
9678
- owner: string().min(1),
9679
- reason: string().min(1)
9680
- }).strict(),
9681
- object({ none: string().min(1) }).strict()
9682
- ]);
9683
- /** The descriptor a generic entries UI reads (D881 "generic entries"). */
9684
- var EntryDescriptorSchema = object({
9685
- title: string().min(1),
9686
- /** The record body field shown as the entry's name. */
9687
- nameField: string().min(1),
9688
- /** JSON Schema of the entry body; `secret: true` marks a password field. */
9689
- fields: record(string(), unknown())
9690
- }).strict();
9691
- /** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
9692
- var RecordKindDeclarationSchema = object({
9693
- database: _enum(RECORD_DATABASES).default("settings"),
9694
- class: _enum(RECORD_CLASSES),
9695
- writeTrigger: string().min(1),
9696
- device: _enum([
9697
- "required",
9698
- "optional",
9699
- "none"
9700
- ]).default("none"),
9701
- at: _enum(["required", "none"]).default("none"),
9702
- indexes: array(RecordIndexSchema).max(8).default([]),
9703
- retention: RecordRetentionSchema,
9704
- deviceRemoval: _enum(["delete", "none"]).default("none"),
9705
- maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
9706
- /** Derived from the Zod schema; never written by hand. */
9707
- secretPaths: array(string().min(1)).default([]),
9708
- /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
9709
- secretArrayKeys: record(string(), string()).default({}),
9710
- /** Kinds that must agree through `transact` sit in one file under one family name. */
9711
- transactFamily: string().min(1).optional(),
9712
- entry: EntryDescriptorSchema.optional()
9713
- }).strict();
9714
- /** The kind names: lower-case, dash separated, short enough for an index name. */
9715
- var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
9716
- /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
9717
- function assertValidDeclaration(name, decl) {
9718
- const refuse = (why) => {
9719
- throw new DeclarationRefusedError(`kind "${name}": ${why}`);
9720
- };
9721
- if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
9722
- const seen = /* @__PURE__ */ new Set();
9723
- for (const index of decl.indexes) {
9724
- if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
9725
- seen.add(index.name);
9726
- }
9727
- const { retention } = decl;
9728
- const hasSecrets = decl.secretPaths.length > 0;
9729
- if ("ttlMs" in retention) {
9730
- if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
9731
- if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
9732
- }
9733
- if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
9734
- if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
9735
- if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
9736
- if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
9737
- const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
9738
- if (decl.database === "settings" && bound > 5e4) refuse(`a row bound above ${RECORD_SETTINGS_MAX_ROWS} belongs in database: "events" (a big delete on the settings thread stalls every configuration read)`);
9739
- }
9740
- if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
9741
- for (const path of decl.secretPaths) for (const prefix of secretArrayPrefixes(path)) if (decl.secretArrayKeys[prefix] === void 0) refuse(`secret path "${path}" crosses the array "${prefix}": declare its id key in secretArrayKeys`);
9742
- }
9743
- function bodyFieldsOf(schema) {
9744
- return { ...toJSONSchema(schema, {
9745
- unrepresentable: "any",
9746
- io: "input"
9747
- }) };
9748
- }
9749
- function isRecordLike(value) {
9750
- return typeof value === "object" && value !== null && !Array.isArray(value);
9751
- }
9752
- /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
9753
- function hasNameField(json, field) {
9754
- const branches = json["oneOf"] ?? json["anyOf"];
9755
- if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
9756
- const properties = json["properties"];
9757
- return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
9758
- }
9759
- /**
9760
- * Declare the kinds of a package. The keys are the kind names. The result is
9761
- * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
9762
- * types its handle from.
9763
- */
9764
- function defineRecordKinds(specs) {
9765
- const out = {};
9766
- for (const [name, spec] of Object.entries(specs)) {
9767
- const secretPaths = collectZodSecretPaths(spec.schema);
9768
- const nameField = spec.entry?.nameField ?? "name";
9769
- const fields = bodyFieldsOf(spec.schema);
9770
- if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
9771
- const parsed = RecordKindDeclarationSchema.parse({
9772
- database: spec.database,
9773
- class: spec.class,
9774
- writeTrigger: spec.writeTrigger,
9775
- device: spec.device,
9776
- at: spec.at,
9777
- indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
9778
- retention: spec.retention,
9779
- deviceRemoval: spec.deviceRemoval,
9780
- maxDataBytes: spec.maxDataBytes,
9781
- secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
9782
- secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
9783
- transactFamily: spec.transactFamily,
9784
- entry: spec.entry === void 0 ? void 0 : {
9785
- title: spec.entry.title,
9786
- nameField,
9787
- fields
9788
- }
9789
- });
9790
- assertValidDeclaration(name, parsed);
9791
- out[name] = {
9792
- name,
9793
- schema: spec.schema,
9794
- declaration: parsed
9795
- };
9796
- }
9797
- return out;
9798
- }
9799
- /**
9800
- * Declare one entry kind. An entry is configuration: never trimmed by the
9801
- * engine, never aged, belonging to no device.
9802
- */
9803
- function defineEntryKind(name, spec) {
9804
- const defined = defineRecordKinds({ [name]: {
9805
- schema: spec.schema,
9806
- class: "config",
9807
- writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
9808
- retention: { none: "an entry goes only when the operator deletes it" },
9809
- ...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
9810
- ...spec.database === void 0 ? {} : { database: spec.database },
9811
- ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
9812
- ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
9813
- ...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
9814
- entry: {
9815
- title: spec.title,
9816
- ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
9817
- }
9818
- } })[name];
9819
- if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
9820
- return defined;
9821
- }
9822
9619
  object({
9823
9620
  field: string().min(1),
9824
9621
  on: literal("advance")
@@ -9907,6 +9704,271 @@ function optionalMethod(input, output, options) {
9907
9704
  providerOptional: true
9908
9705
  };
9909
9706
  }
9707
+ function defOf(schema) {
9708
+ const zodBag = Reflect.get(schema, "_zod");
9709
+ if (typeof zodBag !== "object" || zodBag === null) return {};
9710
+ const def = Reflect.get(zodBag, "def");
9711
+ if (typeof def !== "object" || def === null) return {};
9712
+ return def;
9713
+ }
9714
+ function declaredHere(schema) {
9715
+ return globalRegistry.get(schema)?.secret === true;
9716
+ }
9717
+ /** Wrapper kinds whose `innerType` is the field itself. */
9718
+ var WRAPPERS = new Set([
9719
+ "optional",
9720
+ "nullable",
9721
+ "default",
9722
+ "prefault",
9723
+ "catch",
9724
+ "readonly",
9725
+ "nonoptional"
9726
+ ]);
9727
+ /**
9728
+ * The schema layers that make up ONE field: the schema itself and every
9729
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
9730
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
9731
+ * `.transform` on `in`).
9732
+ */
9733
+ function layersOf(schema) {
9734
+ const out = [];
9735
+ const queue = [schema];
9736
+ while (queue.length > 0) {
9737
+ const s = queue.shift();
9738
+ if (!s || out.includes(s)) continue;
9739
+ out.push(s);
9740
+ const def = defOf(s);
9741
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
9742
+ if (def.type === "pipe") {
9743
+ if (def.in) queue.push(def.in);
9744
+ if (def.out) queue.push(def.out);
9745
+ }
9746
+ }
9747
+ return out;
9748
+ }
9749
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
9750
+ function isZodSecret(schema) {
9751
+ return layersOf(schema).some(declaredHere);
9752
+ }
9753
+ /**
9754
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
9755
+ * element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
9756
+ * map" (`applianceSecrets{}`). A declared
9757
+ * object or array is reported as one path and not descended into — everything
9758
+ * under it is secret.
9759
+ */
9760
+ function collectZodSecretPaths(schema, prefix = "") {
9761
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
9762
+ const paths = [];
9763
+ for (const layer of layersOf(schema)) {
9764
+ const def = defOf(layer);
9765
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
9766
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
9767
+ else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
9768
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
9769
+ else if (def.type === "intersection") {
9770
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
9771
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
9772
+ }
9773
+ }
9774
+ return [...new Set(paths)];
9775
+ }
9776
+ /**
9777
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
9778
+ * Zod row schema that describes it, and the helper that turns the two into the
9779
+ * JSON the engine stores.
9780
+ *
9781
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
9782
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
9783
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
9784
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
9785
+ * never a field name (D879).
9786
+ */
9787
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
9788
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
9789
+ var RecordIndexSchema = object({
9790
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
9791
+ fields: array(RecordFieldPathSchema).min(1).max(4),
9792
+ unique: boolean().optional()
9793
+ }).strict();
9794
+ var RecordRetentionSchema = union([
9795
+ object({
9796
+ ttlMs: number().int().positive(),
9797
+ from: _enum(["at", "write"])
9798
+ }).strict(),
9799
+ object({
9800
+ maxRows: number().int().positive().optional(),
9801
+ maxRowsPerDevice: number().int().positive().optional()
9802
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
9803
+ object({
9804
+ owner: string().min(1),
9805
+ reason: string().min(1)
9806
+ }).strict(),
9807
+ object({ none: string().min(1) }).strict()
9808
+ ]);
9809
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
9810
+ var EntryDescriptorSchema = object({
9811
+ title: string().min(1),
9812
+ /** The record body field shown as the entry's name. */
9813
+ nameField: string().min(1),
9814
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
9815
+ fields: record(string(), unknown())
9816
+ }).strict();
9817
+ /** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
9818
+ var RecordKindDeclarationSchema = object({
9819
+ database: _enum(RECORD_DATABASES).default("settings"),
9820
+ class: _enum(RECORD_CLASSES),
9821
+ writeTrigger: string().min(1),
9822
+ device: _enum([
9823
+ "required",
9824
+ "optional",
9825
+ "none"
9826
+ ]).default("none"),
9827
+ at: _enum(["required", "none"]).default("none"),
9828
+ indexes: array(RecordIndexSchema).max(8).default([]),
9829
+ retention: RecordRetentionSchema,
9830
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
9831
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
9832
+ /** Derived from the Zod schema; never written by hand. */
9833
+ secretPaths: array(string().min(1)).default([]),
9834
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
9835
+ secretArrayKeys: record(string(), string()).default({}),
9836
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
9837
+ transactFamily: string().min(1).optional(),
9838
+ entry: EntryDescriptorSchema.optional()
9839
+ }).strict();
9840
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
9841
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
9842
+ /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
9843
+ function assertValidDeclaration(name, decl) {
9844
+ const refuse = (why) => {
9845
+ throw new DeclarationRefusedError(`kind "${name}": ${why}`);
9846
+ };
9847
+ if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
9848
+ const seen = /* @__PURE__ */ new Set();
9849
+ for (const index of decl.indexes) {
9850
+ if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
9851
+ seen.add(index.name);
9852
+ }
9853
+ const { retention } = decl;
9854
+ const hasSecrets = decl.secretPaths.length > 0;
9855
+ if ("ttlMs" in retention) {
9856
+ if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
9857
+ if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
9858
+ }
9859
+ if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
9860
+ if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
9861
+ if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
9862
+ if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
9863
+ const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
9864
+ if (decl.database === "settings" && bound > 5e4) refuse(`a row bound above ${RECORD_SETTINGS_MAX_ROWS} belongs in database: "events" (a big delete on the settings thread stalls every configuration read)`);
9865
+ }
9866
+ if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
9867
+ for (const path of decl.secretPaths) for (const prefix of secretArrayPrefixes(path)) if (decl.secretArrayKeys[prefix] === void 0) refuse(`secret path "${path}" crosses the array "${prefix}": declare its id key in secretArrayKeys`);
9868
+ }
9869
+ function bodyFieldsOf(schema) {
9870
+ return { ...toJSONSchema(schema, {
9871
+ unrepresentable: "any",
9872
+ io: "input"
9873
+ }) };
9874
+ }
9875
+ function isRecordLike(value) {
9876
+ return typeof value === "object" && value !== null && !Array.isArray(value);
9877
+ }
9878
+ /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
9879
+ function hasNameField(json, field) {
9880
+ const branches = json["oneOf"] ?? json["anyOf"];
9881
+ if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
9882
+ const properties = json["properties"];
9883
+ return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
9884
+ }
9885
+ /**
9886
+ * Declare the kinds of a package. The keys are the kind names. The result is
9887
+ * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
9888
+ * types its handle from.
9889
+ */
9890
+ function defineRecordKinds(specs) {
9891
+ const out = {};
9892
+ for (const [name, spec] of Object.entries(specs)) {
9893
+ const secretPaths = collectZodSecretPaths(spec.schema);
9894
+ const nameField = spec.entry?.nameField ?? "name";
9895
+ const fields = bodyFieldsOf(spec.schema);
9896
+ if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
9897
+ const parsed = RecordKindDeclarationSchema.parse({
9898
+ database: spec.database,
9899
+ class: spec.class,
9900
+ writeTrigger: spec.writeTrigger,
9901
+ device: spec.device,
9902
+ at: spec.at,
9903
+ indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
9904
+ retention: spec.retention,
9905
+ deviceRemoval: spec.deviceRemoval,
9906
+ maxDataBytes: spec.maxDataBytes,
9907
+ secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
9908
+ secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
9909
+ transactFamily: spec.transactFamily,
9910
+ entry: spec.entry === void 0 ? void 0 : {
9911
+ title: spec.entry.title,
9912
+ nameField,
9913
+ fields
9914
+ }
9915
+ });
9916
+ assertValidDeclaration(name, parsed);
9917
+ out[name] = {
9918
+ name,
9919
+ schema: spec.schema,
9920
+ declaration: parsed
9921
+ };
9922
+ }
9923
+ return out;
9924
+ }
9925
+ /**
9926
+ * Declare one entry kind. An entry is configuration: never trimmed by the
9927
+ * engine, never aged, belonging to no device.
9928
+ */
9929
+ function defineEntryKind(name, spec) {
9930
+ const defined = defineRecordKinds({ [name]: {
9931
+ schema: spec.schema,
9932
+ class: "config",
9933
+ writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
9934
+ retention: { none: "an entry goes only when the operator deletes it" },
9935
+ ...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
9936
+ ...spec.database === void 0 ? {} : { database: spec.database },
9937
+ ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
9938
+ ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
9939
+ ...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
9940
+ entry: {
9941
+ title: spec.title,
9942
+ ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
9943
+ }
9944
+ } })[name];
9945
+ if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
9946
+ return defined;
9947
+ }
9948
+ /**
9949
+ * The share-view scope kinds a share-link token can carry. The hub mints
9950
+ * and validates them (`ShareViewGrantSchema` builds its
9951
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
9952
+ */
9953
+ var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
9954
+ /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
9955
+ var PeerBytesTicketSchema = object({
9956
+ /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
9957
+ url: string().min(1),
9958
+ /**
9959
+ * The HOST node this URL means something on — the hub or a named agent,
9960
+ * never a runner. {@link AddonPeerBytes.open} compares it to its own and
9961
+ * refuses `cross-node` by name when they differ, without dialling.
9962
+ */
9963
+ hostNodeId: string().min(1),
9964
+ expiresAtMs: number().int().nonnegative(),
9965
+ /**
9966
+ * What the producer DECLARED the body to be, when it knows — `null` when it
9967
+ * does not. Never `0` for unknown (D393): a consumer sizing a bound off this
9968
+ * must be able to tell "the producer did not say" from "the body is empty".
9969
+ */
9970
+ declaredBytes: number().int().nonnegative().nullable()
9971
+ });
9910
9972
  var READING_QUANTITIES = [
9911
9973
  "temperature",
9912
9974
  "pressure",
@@ -10507,7 +10569,6 @@ var CAP_NAMES = Object.freeze([
10507
10569
  "climate-control",
10508
10570
  "color",
10509
10571
  "composer",
10510
- "connection-test",
10511
10572
  "connectivity",
10512
10573
  "consumables",
10513
10574
  "contact",
@@ -10597,7 +10658,6 @@ var CAP_NAMES = Object.freeze([
10597
10658
  "notifier",
10598
10659
  "numeric-sensor",
10599
10660
  "oauth-integration",
10600
- "oidc-connections",
10601
10661
  "osd",
10602
10662
  "osd-manager",
10603
10663
  "pet-feeder",
@@ -12489,8 +12549,7 @@ Object.freeze({
12489
12549
  "device-provider": { "reloadDevice": 18e4 },
12490
12550
  "llm": {
12491
12551
  "generate": 6e5,
12492
- "generateVision": 6e5,
12493
- "testProfile": 6e5
12552
+ "generateVision": 6e5
12494
12553
  },
12495
12554
  "llm-runtime": {
12496
12555
  "complete": 6e5,
@@ -12527,8 +12586,7 @@ Object.freeze({
12527
12586
  "offerArtifact": 3e5,
12528
12587
  "readResult": 3e5,
12529
12588
  "submitJob": 18e5,
12530
- "uploadDataset": 72e5,
12531
- "validateCredentials": 3e4
12589
+ "uploadDataset": 72e5
12532
12590
  }
12533
12591
  });
12534
12592
  object({
@@ -14000,6 +14058,414 @@ function buildCapturingReply(envelope) {
14000
14058
  };
14001
14059
  return wrapper;
14002
14060
  }
14061
+ /**
14062
+ * notification-output — canonical, capability-gated notification delivery.
14063
+ *
14064
+ * Apprise-derived model (see
14065
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14066
+ * callers emit ONE canonical `Notification`; each provider declares a
14067
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
14068
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14069
+ * message to what the kind supports — callers never special-case a service.
14070
+ *
14071
+ * DESIGN DECISIONS (locked):
14072
+ * - A target is an INSTANCE of this function cap (epic #440, step 6): the
14073
+ * providers serve their targets as `integration-instances` records, one
14074
+ * record kind per target kind, and the admin lists, adds, edits, switches
14075
+ * and deletes them through that cap. This cap keeps what an instance cannot
14076
+ * say: the kind catalogue (`listTargetKinds`: capabilities, delivery
14077
+ * parameters, brand icon), dispatch (`send`, `testTarget`) and the form
14078
+ * helpers (`discoverTargets`, `probeTargetConfig`).
14079
+ * - `listTargetKinds` / `discoverTargets` return arrays → the generated
14080
+ * cap-mount auto-`concatCollection`-fans them across every registered
14081
+ * provider so one catalog is routable. `send` / `testTarget` /
14082
+ * `probeTargetConfig` route to ONE provider by the `addonId` the generated
14083
+ * collection router extracts from the call input.
14084
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14085
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14086
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
14087
+ * base64 fallback needed.
14088
+ *
14089
+ * TODO (deferred, closed-set change — separate decision): add
14090
+ * `providerKind: 'notify'` so notification providers surface on the unified
14091
+ * admin "Integrations" page.
14092
+ */
14093
+ /**
14094
+ * Zentik-derived typed-media enum — the superset across every kind. Each
14095
+ * adapter picks what it supports and the degrade engine filters the rest.
14096
+ */
14097
+ var AttachmentMediaTypeSchema = _enum([
14098
+ "image",
14099
+ "video",
14100
+ "gif",
14101
+ "audio",
14102
+ "icon"
14103
+ ]);
14104
+ /**
14105
+ * A single attachment. Exactly one of `url` (remote source, most adapters
14106
+ * prefer this) or `bytes` (inline source; required for Pushover-style
14107
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
14108
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
14109
+ */
14110
+ var AttachmentSchema = object({
14111
+ mediaType: AttachmentMediaTypeSchema,
14112
+ url: string().optional(),
14113
+ bytes: _instanceof(Uint8Array).optional(),
14114
+ mime: string().optional(),
14115
+ name: string().optional()
14116
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14117
+ var NotificationFormatSchema = _enum([
14118
+ "text",
14119
+ "markdown",
14120
+ "html"
14121
+ ]);
14122
+ /**
14123
+ * The CLOSED icon vocabulary an action button may use.
14124
+ *
14125
+ * A closed set, not a free string, and that is the whole point: an arbitrary
14126
+ * icon name is one that ntfy renders, zentik silently drops, and nobody
14127
+ * notices — the same class of gap as a zone vocabulary nothing produced
14128
+ * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
14129
+ * declares `actionIcons: false` and the degrade engine strips the field.
14130
+ *
14131
+ * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
14132
+ * renderer's icon set; "acknowledge" survives an adapter that draws it
14133
+ * differently.
14134
+ *
14135
+ * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
14136
+ *
14137
+ * These names are for US. **No adapter may forward one verbatim.** Each maps
14138
+ * the whole set onto its own renderer's vocabulary through a
14139
+ * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
14140
+ * fallback, so adding a member here fails every adapter's build until someone
14141
+ * decides its glyph, which is the only place that decision can be made
14142
+ * honestly.
14143
+ *
14144
+ * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
14145
+ * `disarm` straight through; iOS feeds that string to
14146
+ * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
14147
+ * and every snooze and alarm button arrived BLANK. A pass-through is not a
14148
+ * mapping, and "the field is documented" is not "the value renders".
14149
+ *
14150
+ * Adding a member is TRAIN-BOUND. The enum lives in the published
14151
+ * `@camstack/server` closure and the cap seam validates against the HUB's copy,
14152
+ * so an addon that emits a token the running hub does not know does not lose an
14153
+ * icon — its whole `send` fails Zod validation and the notification never
14154
+ * arrives. Never emit a new token from an addon before the train carrying it.
14155
+ */
14156
+ var NotificationActionIconSchema = _enum([
14157
+ "acknowledge",
14158
+ "dismiss",
14159
+ "silence",
14160
+ "snooze",
14161
+ "view",
14162
+ "play",
14163
+ "open",
14164
+ "close",
14165
+ "lock",
14166
+ "unlock",
14167
+ "arm",
14168
+ "arm-home",
14169
+ "arm-away",
14170
+ "arm-night",
14171
+ "disarm",
14172
+ "light",
14173
+ "alert",
14174
+ "camera"
14175
+ ]);
14176
+ /** A single tap-through action button. */
14177
+ var NotificationActionSchema = object({
14178
+ id: string(),
14179
+ label: string(),
14180
+ url: string().optional(),
14181
+ /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
14182
+ icon: NotificationActionIconSchema.optional(),
14183
+ /**
14184
+ * Renders in a warning style where the notifier supports it.
14185
+ *
14186
+ * A HINT, never a gate. The callback's authority is its token and nothing
14187
+ * else — see `notification-center/action-token.ts` for what that does and
14188
+ * does not buy.
14189
+ */
14190
+ destructive: boolean().optional(),
14191
+ /**
14192
+ * How the tap should REACH the url.
14193
+ *
14194
+ * `navigate` (absent, and every button authored before this field) opens it:
14195
+ * the phone leaves the notification and shows whatever the callback returns.
14196
+ * That is right for a button whose answer the operator wants to read.
14197
+ *
14198
+ * `background` fires it as a POST and stays put. It exists for the buttons
14199
+ * whose whole point is not to interrupt — "silence this for 30 minutes" is
14200
+ * an answer to the notification, and being thrown into a browser tab to
14201
+ * confirm it costs more attention than the notification did. A backend that
14202
+ * cannot do a background call renders it as an ordinary link (the adapters
14203
+ * fall back rather than dropping the button), so this is a preference, never
14204
+ * a requirement.
14205
+ */
14206
+ mode: _enum(["navigate", "background"]).optional()
14207
+ });
14208
+ /** A delivery parameter value: what a notifier declared it takes. */
14209
+ var DeliveryParamValueSchema = union([
14210
+ string(),
14211
+ number(),
14212
+ boolean()
14213
+ ]);
14214
+ /**
14215
+ * One extra delivery parameter a notifier KIND declares (D938). A rule that
14216
+ * addresses a target of that kind may set it; a kind that declares nothing is
14217
+ * never handed one. The admin UI derives its control from this descriptor —
14218
+ * no editor knows a service by name.
14219
+ *
14220
+ * Optional fields are `.optional()`, never `.default()` (a Zod default does not
14221
+ * run on the addon cap path).
14222
+ */
14223
+ var DeliveryParamSchema = object({
14224
+ key: string().min(1),
14225
+ label: string(),
14226
+ /** i18n key of the label, resolved by the declaring addon's namespace. */
14227
+ labelKey: string().optional(),
14228
+ type: _enum([
14229
+ "enum",
14230
+ "number",
14231
+ "boolean",
14232
+ "string"
14233
+ ]),
14234
+ /** `enum` only: the closed set of accepted values. */
14235
+ options: array(object({
14236
+ value: string(),
14237
+ label: string()
14238
+ })).optional(),
14239
+ /** `number` only. */
14240
+ min: number().optional(),
14241
+ max: number().optional(),
14242
+ /** What the notifier does when the rule sets nothing; shown as the placeholder. */
14243
+ default: DeliveryParamValueSchema.optional()
14244
+ });
14245
+ /**
14246
+ * The canonical notification. `body` is the only hard field (Apprise model).
14247
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14248
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14249
+ * the adapter maps this ordinal onto its native level. `level?` is an
14250
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
14251
+ * `priority` for that one target.
14252
+ */
14253
+ var NotificationSchema = object({
14254
+ body: string(),
14255
+ title: string().optional(),
14256
+ format: NotificationFormatSchema.default("text"),
14257
+ priority: number().int().min(1).max(5).default(3),
14258
+ level: string().optional(),
14259
+ attachments: array(AttachmentSchema).optional(),
14260
+ clickUrl: string().optional(),
14261
+ actions: array(NotificationActionSchema).optional(),
14262
+ sound: string().optional(),
14263
+ ttl: number().optional(),
14264
+ tag: string().optional(),
14265
+ deviceId: number().optional(),
14266
+ eventId: string().optional(),
14267
+ metadata: record(string(), unknown()).optional(),
14268
+ /**
14269
+ * Values for the parameters the target's kind DECLARES in
14270
+ * {@link TargetKindSchema} `deliveryParams`. Already validated against the
14271
+ * declaration by the sender; a notifier reads only the keys it declared.
14272
+ */
14273
+ delivery: record(string(), DeliveryParamValueSchema).optional()
14274
+ });
14275
+ /** One declared native severity/priority level for a kind. */
14276
+ var TargetKindLevelSchema = object({
14277
+ id: string(),
14278
+ label: string(),
14279
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14280
+ ordinal: number().int().min(1).max(5).nullable(),
14281
+ flags: object({
14282
+ critical: boolean().optional(),
14283
+ silent: boolean().optional(),
14284
+ noPush: boolean().optional()
14285
+ }).optional(),
14286
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14287
+ requires: array(string()).optional(),
14288
+ description: string().optional()
14289
+ });
14290
+ /** The full capability block consulted before dispatch. */
14291
+ var TargetKindCapsSchema = object({
14292
+ attachments: object({
14293
+ mediaTypes: array(AttachmentMediaTypeSchema),
14294
+ mode: _enum([
14295
+ "url",
14296
+ "bytes",
14297
+ "both"
14298
+ ]),
14299
+ max: number().int().nonnegative(),
14300
+ maxBytes: number().int().positive().optional()
14301
+ }),
14302
+ /** Max action buttons (0 = none). */
14303
+ actions: number().int().nonnegative(),
14304
+ /**
14305
+ * Whether this kind renders a per-action ICON.
14306
+ *
14307
+ * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
14308
+ * run on the addon cap path — three production failures in one day taught
14309
+ * this repo that once. Absent is read as false by the degrade engine, which
14310
+ * is the safe direction: an icon that is not rendered costs nothing, an icon
14311
+ * assumed and dropped costs the operator's trust in the field.
14312
+ */
14313
+ actionIcons: boolean().optional(),
14314
+ levels: array(TargetKindLevelSchema),
14315
+ format: array(NotificationFormatSchema),
14316
+ clickUrl: boolean(),
14317
+ sound: boolean(),
14318
+ ttl: boolean(),
14319
+ bodyMaxLen: number().int().positive()
14320
+ });
14321
+ /**
14322
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14323
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14324
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14325
+ * the union is large and not meant for runtime validation here; the exported
14326
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14327
+ */
14328
+ var ConfigSchemaPassthrough$3 = unknown();
14329
+ var TargetKindSchema = object({
14330
+ kind: string(),
14331
+ label: string(),
14332
+ icon: string(),
14333
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
14334
+ addonId: string(),
14335
+ /**
14336
+ * URL of the kind's bundled BRAND icon, served by the providing addon over
14337
+ * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
14338
+ * when the addon bundles no icon for that kind — the client then falls back
14339
+ * to a neutral glyph rather than rendering the raw `icon` NAME as text.
14340
+ *
14341
+ * Root-relative on purpose: it resolves against whatever origin serves a web
14342
+ * client, and a native client joins it onto its own hub base.
14343
+ *
14344
+ * DECLARED here deliberately. It used to travel as an undeclared passthrough
14345
+ * field that survived only because the runtime cap-router forwards provider
14346
+ * output verbatim — so every consumer had to re-declare it by hand to stop
14347
+ * its own Zod parse from stripping it, and the whole arrangement would have
14348
+ * broken silently the moment output validation was tightened anywhere.
14349
+ */
14350
+ iconUrl: string().optional(),
14351
+ /**
14352
+ * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
14353
+ *
14354
+ * The server knows this and therefore says it, because the client cannot
14355
+ * safely guess: a React-Native client renders SVG and raster through two
14356
+ * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
14357
+ * not decode SVG on iOS/Android), so without this it silently fell back to a
14358
+ * placeholder glyph for every vector icon while the web build looked fine.
14359
+ *
14360
+ * Absent when {@link iconUrl} is absent, or for a legacy provider that has
14361
+ * not been updated — a client that cannot determine the type should prefer
14362
+ * its raster path, which is the safe default for an unknown image.
14363
+ */
14364
+ iconMediaType: string().optional(),
14365
+ configSchema: ConfigSchemaPassthrough$3,
14366
+ /**
14367
+ * The config keys that decide WHERE this kind's secrets are sent (server,
14368
+ * base URL, instance, chat, recipient). A save that changes any of them
14369
+ * while leaving a secret redacted is refused by the provider (D634), so an
14370
+ * editor uses this to ask for the secret on exactly those edits instead of
14371
+ * on every edit.
14372
+ *
14373
+ * Optional: absent from a provider that holds no secret (the Home Assistant
14374
+ * kinds) and from a provider older than this field — an editor that finds
14375
+ * it absent must assume ANY edit may need the secret.
14376
+ */
14377
+ destinationKeys: array(string()).optional(),
14378
+ supportsDiscovery: boolean(),
14379
+ /**
14380
+ * Extra delivery parameters a rule may set for a target of this kind (D938).
14381
+ * Absent = none; the rule editor then offers nothing.
14382
+ */
14383
+ deliveryParams: array(DeliveryParamSchema).optional(),
14384
+ caps: TargetKindCapsSchema
14385
+ });
14386
+ /**
14387
+ * A target as a provider's own code sees it (the notification-center bridge, the
14388
+ * send path): the flat record body split into the name, the switch and the
14389
+ * kind's fields. `config` holds secrets; a reader that serves it to a client
14390
+ * REDACTS secret fields (a presence marker only) — never round-trip a stored
14391
+ * secret to the UI.
14392
+ */
14393
+ var TargetSchema = object({
14394
+ id: string(),
14395
+ name: string(),
14396
+ kind: string(),
14397
+ addonId: string(),
14398
+ enabled: boolean(),
14399
+ config: record(string(), unknown())
14400
+ });
14401
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
14402
+ var DiscoveredTargetSchema = object({
14403
+ kind: string(),
14404
+ suggestedName: string(),
14405
+ config: record(string(), unknown())
14406
+ });
14407
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
14408
+ var RenderedAsSchema = object({
14409
+ level: string(),
14410
+ format: NotificationFormatSchema,
14411
+ attachmentsSent: number().int().nonnegative(),
14412
+ actionsSent: number().int().nonnegative(),
14413
+ truncated: boolean(),
14414
+ dropped: array(string())
14415
+ });
14416
+ var SendResultSchema = object({
14417
+ success: boolean(),
14418
+ error: string().optional(),
14419
+ renderedAs: RenderedAsSchema.optional()
14420
+ });
14421
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
14422
+ var TestResultSchema = SendResultSchema;
14423
+ /**
14424
+ * Pre-save credential probe against a partial (unsaved) target config.
14425
+ * `resolvedUrl` never includes secrets (token stripped from path).
14426
+ */
14427
+ var ProbeTargetConfigResultSchema = object({
14428
+ ok: boolean(),
14429
+ resolvedUrl: string(),
14430
+ httpStatus: number().int().optional(),
14431
+ stateInstance: string().optional(),
14432
+ error: string().optional()
14433
+ });
14434
+ method(object({}), array(TargetKindSchema)), method(object({
14435
+ kind: string(),
14436
+ config: record(string(), unknown()).optional(),
14437
+ /**
14438
+ * When editing / duplicating, the blank password field never round-trips
14439
+ * the stored token. Pass the source target id so the provider can restore
14440
+ * secrets server-side before dialling.
14441
+ */
14442
+ targetId: string().optional()
14443
+ }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
14444
+ kind: string(),
14445
+ config: record(string(), unknown()),
14446
+ /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
14447
+ targetId: string().optional()
14448
+ }), ProbeTargetConfigResultSchema, {
14449
+ kind: "mutation",
14450
+ auth: "admin"
14451
+ }), method(object({
14452
+ targetId: string(),
14453
+ notification: NotificationSchema
14454
+ }), SendResultSchema, {
14455
+ kind: "mutation",
14456
+ auth: "admin"
14457
+ }), method(object({
14458
+ targetId: string(),
14459
+ sample: NotificationSchema.optional()
14460
+ }), TestResultSchema, {
14461
+ kind: "mutation",
14462
+ auth: "admin"
14463
+ });
14464
+ looseObject({
14465
+ name: string().min(1),
14466
+ enabled: boolean().optional()
14467
+ });
14468
+ TargetSchema.omit({ id: true });
14003
14469
  var EncodeProfileSchema = object({
14004
14470
  video: object({
14005
14471
  codec: _enum([
@@ -22387,7 +22853,6 @@ var SYSTEM_CAP_VOCABULARY = {
22387
22853
  "calendar-source": system(INTERNAL),
22388
22854
  calendars: system("calendars feed schedules and conditions, not device actions"),
22389
22855
  composer: system("device composition — an authoring tool, not an action"),
22390
- "connection-test": system(INTERNAL),
22391
22856
  "core-blocks": system(INTERNAL),
22392
22857
  "custom-model-registry": system(ML),
22393
22858
  "data-store-provider": system(INTERNAL),
@@ -22432,7 +22897,6 @@ var SYSTEM_CAP_VOCABULARY = {
22432
22897
  "notification-output": system("notification delivery — reached through notifier devices and rules"),
22433
22898
  "notification-rules": system("notification rules — authored on their own page"),
22434
22899
  "oauth-integration": system(IDENTITY),
22435
- "oidc-connections": system(IDENTITY),
22436
22900
  "osd-manager": system(PIPELINE),
22437
22901
  "pipeline-executor": system(PIPELINE),
22438
22902
  "pipeline-orchestrator": system(PIPELINE),
@@ -44304,427 +44768,6 @@ var UnitWarningSchema = object({
44304
44768
  assumedUnit: string(),
44305
44769
  message: string()
44306
44770
  });
44307
- /**
44308
- * notification-output — canonical, capability-gated notification delivery.
44309
- *
44310
- * Apprise-derived model (see
44311
- * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
44312
- * callers emit ONE canonical `Notification`; each provider declares a
44313
- * per-kind capability descriptor (`TargetKind`), and the pure degrade
44314
- * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
44315
- * message to what the kind supports — callers never special-case a service.
44316
- *
44317
- * DESIGN DECISIONS (locked):
44318
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
44319
- * `setTargetEnabled`), each provider persisting via the `settings-store`
44320
- * cap. Rationale: the admin UI needs one uniform surface across the
44321
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
44322
- * alternative would fork the UI per addon and cannot host the
44323
- * discovery→adopt flow.
44324
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
44325
- * the generated cap-mount auto-`concatCollection`-fans them across every
44326
- * registered provider (notifiers addon + HA addon) so one catalog is
44327
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
44328
- * `addonId` the generated collection router extracts from the call input.
44329
- * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
44330
- * transformer) + UDS MsgPack both round-trip typed arrays — already used by
44331
- * `storage` / `storage-provider` / `recording` caps over the same path. No
44332
- * base64 fallback needed.
44333
- *
44334
- * TODO (deferred, closed-set change — separate decision): add
44335
- * `providerKind: 'notify'` so notification providers surface on the unified
44336
- * admin "Integrations" page.
44337
- */
44338
- /**
44339
- * Zentik-derived typed-media enum — the superset across every kind. Each
44340
- * adapter picks what it supports and the degrade engine filters the rest.
44341
- */
44342
- var AttachmentMediaTypeSchema = _enum([
44343
- "image",
44344
- "video",
44345
- "gif",
44346
- "audio",
44347
- "icon"
44348
- ]);
44349
- /**
44350
- * A single attachment. Exactly one of `url` (remote source, most adapters
44351
- * prefer this) or `bytes` (inline source; required for Pushover-style
44352
- * bytes-only kinds) MUST be present — the degrade engine expresses a
44353
- * url→bytes fetch as a `needsFetch` directive the adapter executes.
44354
- */
44355
- var AttachmentSchema = object({
44356
- mediaType: AttachmentMediaTypeSchema,
44357
- url: string().optional(),
44358
- bytes: _instanceof(Uint8Array).optional(),
44359
- mime: string().optional(),
44360
- name: string().optional()
44361
- }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
44362
- var NotificationFormatSchema = _enum([
44363
- "text",
44364
- "markdown",
44365
- "html"
44366
- ]);
44367
- /**
44368
- * The CLOSED icon vocabulary an action button may use.
44369
- *
44370
- * A closed set, not a free string, and that is the whole point: an arbitrary
44371
- * icon name is one that ntfy renders, zentik silently drops, and nobody
44372
- * notices — the same class of gap as a zone vocabulary nothing produced
44373
- * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
44374
- * declares `actionIcons: false` and the degrade engine strips the field.
44375
- *
44376
- * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
44377
- * renderer's icon set; "acknowledge" survives an adapter that draws it
44378
- * differently.
44379
- *
44380
- * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
44381
- *
44382
- * These names are for US. **No adapter may forward one verbatim.** Each maps
44383
- * the whole set onto its own renderer's vocabulary through a
44384
- * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
44385
- * fallback, so adding a member here fails every adapter's build until someone
44386
- * decides its glyph, which is the only place that decision can be made
44387
- * honestly.
44388
- *
44389
- * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
44390
- * `disarm` straight through; iOS feeds that string to
44391
- * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
44392
- * and every snooze and alarm button arrived BLANK. A pass-through is not a
44393
- * mapping, and "the field is documented" is not "the value renders".
44394
- *
44395
- * Adding a member is TRAIN-BOUND. The enum lives in the published
44396
- * `@camstack/server` closure and the cap seam validates against the HUB's copy,
44397
- * so an addon that emits a token the running hub does not know does not lose an
44398
- * icon — its whole `send` fails Zod validation and the notification never
44399
- * arrives. Never emit a new token from an addon before the train carrying it.
44400
- */
44401
- var NotificationActionIconSchema = _enum([
44402
- "acknowledge",
44403
- "dismiss",
44404
- "silence",
44405
- "snooze",
44406
- "view",
44407
- "play",
44408
- "open",
44409
- "close",
44410
- "lock",
44411
- "unlock",
44412
- "arm",
44413
- "arm-home",
44414
- "arm-away",
44415
- "arm-night",
44416
- "disarm",
44417
- "light",
44418
- "alert",
44419
- "camera"
44420
- ]);
44421
- /** A single tap-through action button. */
44422
- var NotificationActionSchema = object({
44423
- id: string(),
44424
- label: string(),
44425
- url: string().optional(),
44426
- /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
44427
- icon: NotificationActionIconSchema.optional(),
44428
- /**
44429
- * Renders in a warning style where the notifier supports it.
44430
- *
44431
- * A HINT, never a gate. The callback's authority is its token and nothing
44432
- * else — see `notification-center/action-token.ts` for what that does and
44433
- * does not buy.
44434
- */
44435
- destructive: boolean().optional(),
44436
- /**
44437
- * How the tap should REACH the url.
44438
- *
44439
- * `navigate` (absent, and every button authored before this field) opens it:
44440
- * the phone leaves the notification and shows whatever the callback returns.
44441
- * That is right for a button whose answer the operator wants to read.
44442
- *
44443
- * `background` fires it as a POST and stays put. It exists for the buttons
44444
- * whose whole point is not to interrupt — "silence this for 30 minutes" is
44445
- * an answer to the notification, and being thrown into a browser tab to
44446
- * confirm it costs more attention than the notification did. A backend that
44447
- * cannot do a background call renders it as an ordinary link (the adapters
44448
- * fall back rather than dropping the button), so this is a preference, never
44449
- * a requirement.
44450
- */
44451
- mode: _enum(["navigate", "background"]).optional()
44452
- });
44453
- /** A delivery parameter value: what a notifier declared it takes. */
44454
- var DeliveryParamValueSchema = union([
44455
- string(),
44456
- number(),
44457
- boolean()
44458
- ]);
44459
- /**
44460
- * One extra delivery parameter a notifier KIND declares (D938). A rule that
44461
- * addresses a target of that kind may set it; a kind that declares nothing is
44462
- * never handed one. The admin UI derives its control from this descriptor —
44463
- * no editor knows a service by name.
44464
- *
44465
- * Optional fields are `.optional()`, never `.default()` (a Zod default does not
44466
- * run on the addon cap path).
44467
- */
44468
- var DeliveryParamSchema = object({
44469
- key: string().min(1),
44470
- label: string(),
44471
- /** i18n key of the label, resolved by the declaring addon's namespace. */
44472
- labelKey: string().optional(),
44473
- type: _enum([
44474
- "enum",
44475
- "number",
44476
- "boolean",
44477
- "string"
44478
- ]),
44479
- /** `enum` only: the closed set of accepted values. */
44480
- options: array(object({
44481
- value: string(),
44482
- label: string()
44483
- })).optional(),
44484
- /** `number` only. */
44485
- min: number().optional(),
44486
- max: number().optional(),
44487
- /** What the notifier does when the rule sets nothing; shown as the placeholder. */
44488
- default: DeliveryParamValueSchema.optional()
44489
- });
44490
- /**
44491
- * The canonical notification. `body` is the only hard field (Apprise model).
44492
- * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
44493
- * NOT a fixed severity enum — each kind declares its own `caps.levels` and
44494
- * the adapter maps this ordinal onto its native level. `level?` is an
44495
- * optional kind-native level id (`emergency`, `silent`, …) that overrides
44496
- * `priority` for that one target.
44497
- */
44498
- var NotificationSchema = object({
44499
- body: string(),
44500
- title: string().optional(),
44501
- format: NotificationFormatSchema.default("text"),
44502
- priority: number().int().min(1).max(5).default(3),
44503
- level: string().optional(),
44504
- attachments: array(AttachmentSchema).optional(),
44505
- clickUrl: string().optional(),
44506
- actions: array(NotificationActionSchema).optional(),
44507
- sound: string().optional(),
44508
- ttl: number().optional(),
44509
- tag: string().optional(),
44510
- deviceId: number().optional(),
44511
- eventId: string().optional(),
44512
- metadata: record(string(), unknown()).optional(),
44513
- /**
44514
- * Values for the parameters the target's kind DECLARES in
44515
- * {@link TargetKindSchema} `deliveryParams`. Already validated against the
44516
- * declaration by the sender; a notifier reads only the keys it declared.
44517
- */
44518
- delivery: record(string(), DeliveryParamValueSchema).optional()
44519
- });
44520
- /** One declared native severity/priority level for a kind. */
44521
- var TargetKindLevelSchema = object({
44522
- id: string(),
44523
- label: string(),
44524
- /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
44525
- ordinal: number().int().min(1).max(5).nullable(),
44526
- flags: object({
44527
- critical: boolean().optional(),
44528
- silent: boolean().optional(),
44529
- noPush: boolean().optional()
44530
- }).optional(),
44531
- /** e.g. Pushover `emergency` requires `retry` / `expire`. */
44532
- requires: array(string()).optional(),
44533
- description: string().optional()
44534
- });
44535
- /** The full capability block consulted before dispatch. */
44536
- var TargetKindCapsSchema = object({
44537
- attachments: object({
44538
- mediaTypes: array(AttachmentMediaTypeSchema),
44539
- mode: _enum([
44540
- "url",
44541
- "bytes",
44542
- "both"
44543
- ]),
44544
- max: number().int().nonnegative(),
44545
- maxBytes: number().int().positive().optional()
44546
- }),
44547
- /** Max action buttons (0 = none). */
44548
- actions: number().int().nonnegative(),
44549
- /**
44550
- * Whether this kind renders a per-action ICON.
44551
- *
44552
- * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
44553
- * run on the addon cap path — three production failures in one day taught
44554
- * this repo that once. Absent is read as false by the degrade engine, which
44555
- * is the safe direction: an icon that is not rendered costs nothing, an icon
44556
- * assumed and dropped costs the operator's trust in the field.
44557
- */
44558
- actionIcons: boolean().optional(),
44559
- levels: array(TargetKindLevelSchema),
44560
- format: array(NotificationFormatSchema),
44561
- clickUrl: boolean(),
44562
- sound: boolean(),
44563
- ttl: boolean(),
44564
- bodyMaxLen: number().int().positive()
44565
- });
44566
- /**
44567
- * `configSchema` is a `ConfigUISchema` tree passed through to the admin
44568
- * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
44569
- * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
44570
- * the union is large and not meant for runtime validation here; the exported
44571
- * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
44572
- */
44573
- var ConfigSchemaPassthrough$4 = unknown();
44574
- var TargetKindSchema = object({
44575
- kind: string(),
44576
- label: string(),
44577
- icon: string(),
44578
- /** Stamped by each provider so the concat-fanned catalog stays routable. */
44579
- addonId: string(),
44580
- /**
44581
- * URL of the kind's bundled BRAND icon, served by the providing addon over
44582
- * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
44583
- * when the addon bundles no icon for that kind — the client then falls back
44584
- * to a neutral glyph rather than rendering the raw `icon` NAME as text.
44585
- *
44586
- * Root-relative on purpose: it resolves against whatever origin serves a web
44587
- * client, and a native client joins it onto its own hub base.
44588
- *
44589
- * DECLARED here deliberately. It used to travel as an undeclared passthrough
44590
- * field that survived only because the runtime cap-router forwards provider
44591
- * output verbatim — so every consumer had to re-declare it by hand to stop
44592
- * its own Zod parse from stripping it, and the whole arrangement would have
44593
- * broken silently the moment output validation was tightened anywhere.
44594
- */
44595
- iconUrl: string().optional(),
44596
- /**
44597
- * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
44598
- *
44599
- * The server knows this and therefore says it, because the client cannot
44600
- * safely guess: a React-Native client renders SVG and raster through two
44601
- * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
44602
- * not decode SVG on iOS/Android), so without this it silently fell back to a
44603
- * placeholder glyph for every vector icon while the web build looked fine.
44604
- *
44605
- * Absent when {@link iconUrl} is absent, or for a legacy provider that has
44606
- * not been updated — a client that cannot determine the type should prefer
44607
- * its raster path, which is the safe default for an unknown image.
44608
- */
44609
- iconMediaType: string().optional(),
44610
- configSchema: ConfigSchemaPassthrough$4,
44611
- /**
44612
- * The config keys that decide WHERE this kind's secrets are sent (server,
44613
- * base URL, instance, chat, recipient). A save that changes any of them
44614
- * while leaving a secret redacted is refused by the provider (D634), so an
44615
- * editor uses this to ask for the secret on exactly those edits instead of
44616
- * on every edit.
44617
- *
44618
- * Optional: absent from a provider that holds no secret (the Home Assistant
44619
- * kinds) and from a provider older than this field — an editor that finds
44620
- * it absent must assume ANY edit may need the secret.
44621
- */
44622
- destinationKeys: array(string()).optional(),
44623
- supportsDiscovery: boolean(),
44624
- /**
44625
- * Extra delivery parameters a rule may set for a target of this kind (D938).
44626
- * Absent = none; the rule editor then offers nothing.
44627
- */
44628
- deliveryParams: array(DeliveryParamSchema).optional(),
44629
- caps: TargetKindCapsSchema
44630
- });
44631
- /**
44632
- * A persisted target. `config` holds secrets; providers REDACT secret fields
44633
- * (return a presence marker only) when serving `listTargets` — never
44634
- * round-trip a stored secret to the UI.
44635
- */
44636
- var TargetSchema = object({
44637
- id: string(),
44638
- name: string(),
44639
- kind: string(),
44640
- addonId: string(),
44641
- enabled: boolean(),
44642
- config: record(string(), unknown())
44643
- });
44644
- /** A discovery-surfaced candidate (config is partial + non-secret). */
44645
- var DiscoveredTargetSchema = object({
44646
- kind: string(),
44647
- suggestedName: string(),
44648
- config: record(string(), unknown())
44649
- });
44650
- /** The degrade engine's report — what was resolved / dropped / degraded. */
44651
- var RenderedAsSchema = object({
44652
- level: string(),
44653
- format: NotificationFormatSchema,
44654
- attachmentsSent: number().int().nonnegative(),
44655
- actionsSent: number().int().nonnegative(),
44656
- truncated: boolean(),
44657
- dropped: array(string())
44658
- });
44659
- var SendResultSchema = object({
44660
- success: boolean(),
44661
- error: string().optional(),
44662
- renderedAs: RenderedAsSchema.optional()
44663
- });
44664
- /** Same shape as SendResult — kept as a distinct name for the test panel. */
44665
- var TestResultSchema = SendResultSchema;
44666
- /**
44667
- * Pre-save credential probe against a partial (unsaved) target config.
44668
- * `resolvedUrl` never includes secrets (token stripped from path).
44669
- */
44670
- var ProbeTargetConfigResultSchema = object({
44671
- ok: boolean(),
44672
- resolvedUrl: string(),
44673
- httpStatus: number().int().optional(),
44674
- stateInstance: string().optional(),
44675
- error: string().optional()
44676
- });
44677
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
44678
- kind: string(),
44679
- config: record(string(), unknown()).optional(),
44680
- /**
44681
- * When editing / duplicating, the blank password field never round-trips
44682
- * the stored token. Pass the source target id so the provider can restore
44683
- * secrets server-side before dialling (same merge as upsert).
44684
- */
44685
- targetId: string().optional()
44686
- }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
44687
- kind: string(),
44688
- config: record(string(), unknown()),
44689
- /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
44690
- targetId: string().optional()
44691
- }), ProbeTargetConfigResultSchema, {
44692
- kind: "mutation",
44693
- auth: "admin"
44694
- }), method(object({
44695
- targetId: string(),
44696
- notification: NotificationSchema
44697
- }), SendResultSchema, {
44698
- kind: "mutation",
44699
- auth: "admin"
44700
- }), method(object({
44701
- targetId: string(),
44702
- sample: NotificationSchema.optional()
44703
- }), TestResultSchema, {
44704
- kind: "mutation",
44705
- auth: "admin"
44706
- }), method(object({
44707
- target: TargetSchema,
44708
- /**
44709
- * Duplicate flow: create a NEW target id while copying secrets from an
44710
- * existing row. The UI never holds the stored token; blank / redacted
44711
- * password fields are restored from this source (D634 still applies if
44712
- * destinations diverge without a re-typed secret).
44713
- */
44714
- cloneSecretsFrom: string().optional()
44715
- }), TargetSchema, {
44716
- kind: "mutation",
44717
- auth: "admin"
44718
- }), method(object({ targetId: string() }), _void(), {
44719
- kind: "mutation",
44720
- auth: "admin"
44721
- }), method(object({
44722
- targetId: string(),
44723
- enabled: boolean()
44724
- }), _void(), {
44725
- kind: "mutation",
44726
- auth: "admin"
44727
- });
44728
44771
  function errorText(err) {
44729
44772
  return err instanceof Error ? err.message : String(err);
44730
44773
  }
@@ -48688,37 +48731,6 @@ method(object({
48688
48731
  kind: "mutation",
48689
48732
  auth: "admin"
48690
48733
  }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
48691
- var ConnectionTestOutcomeSchema = discriminatedUnion("outcome", [
48692
- object({
48693
- outcome: literal("validated"),
48694
- /** Round-trip of the sign-in, when the provider measured it. */
48695
- latencyMs: number().nonnegative().optional(),
48696
- /** Optional human detail worth showing next to the tick
48697
- * ("3 devices visible on this account"). */
48698
- detail: string().optional()
48699
- }).strict(),
48700
- object({
48701
- outcome: literal("rejected"),
48702
- error: string()
48703
- }).strict(),
48704
- object({
48705
- outcome: literal("inconclusive"),
48706
- error: string()
48707
- }).strict()
48708
- ]);
48709
- var ConnectionTestInputSchema = object({
48710
- /** Candidate integration settings, exactly as the create form collected them. */
48711
- settings: record(string(), unknown()) });
48712
- /**
48713
- * What the provider's test actually DOES, so the UI can say it in words before
48714
- * the operator presses the button ("Signs in to the Dreo cloud"). Purely
48715
- * descriptive — it never changes routing.
48716
- */
48717
- var ConnectionTestDescriptorSchema = object({ label: string() });
48718
- method(ConnectionTestInputSchema, ConnectionTestOutcomeSchema, {
48719
- kind: "mutation",
48720
- auth: "admin"
48721
- }), method(_void(), ConnectionTestDescriptorSchema, { auth: "admin" });
48722
48734
  object({
48723
48735
  /** True when the upstream system considers the entity connected. */
48724
48736
  connected: boolean(),
@@ -54641,10 +54653,9 @@ var AvailableIntegrationTypeSchema = object({
54641
54653
  * locations" checkbox. Provider-declared in the addon manifest. */
54642
54654
  supportsLocationImport: boolean(),
54643
54655
  /**
54644
- * True when this integration DECLARES a pre-creation test (the
54645
- * `connection-test` cap, or a broker whose settings it stores). Drives the
54646
- * Test button: an integration that cannot be tested must say so up front
54647
- * rather than offering a button that always answers the same nonsense.
54656
+ * True when this integration's instances declare a Test (`integration-instances.describe().canTest`,
54657
+ * D1016). An integration that cannot be tested must say so up front rather than offering a
54658
+ * button that always answers the same nonsense.
54648
54659
  */
54649
54660
  canTest: boolean(),
54650
54661
  existingInstances: array(object({
@@ -54698,7 +54709,9 @@ var CreateIntegrationInputSchema = object({
54698
54709
  info: record(string(), unknown()).optional(),
54699
54710
  /** `stableId` of the discovery candidate the form was seeded from (D984). */
54700
54711
  originStableId: string().optional(),
54701
- settings: record(string(), unknown()).optional()
54712
+ settings: record(string(), unknown()).optional(),
54713
+ /** The instance kind being created, for a provider with several; omitted = its only testable kind. */
54714
+ kind: string().min(1).optional()
54702
54715
  });
54703
54716
  var UpdateIntegrationInputSchema = object({
54704
54717
  id: string(),
@@ -54724,13 +54737,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
54724
54737
  }), method(object({ id: string() }), DeleteIntegrationResultSchema, {
54725
54738
  kind: "mutation",
54726
54739
  auth: "admin"
54727
- }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" }), method(object({
54728
- addonId: string(),
54729
- settings: record(string(), unknown())
54730
- }), TestConnectionResultSchema, {
54731
- kind: "mutation",
54732
- auth: "admin"
54733
- });
54740
+ }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" });
54734
54741
  /**
54735
54742
  * `integration-instances` - the connection of an addon that holds ONE or SEVERAL
54736
54743
  * (an account, a relay, a destination) as typed records (D985, D986). The addon's
@@ -54750,7 +54757,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
54750
54757
  * or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
54751
54758
  * clears it.
54752
54759
  */
54753
- var ConfigSchemaPassthrough$3 = custom();
54760
+ var ConfigSchemaPassthrough$2 = custom();
54754
54761
  var IntegrationInstanceIdSchema = string().min(1);
54755
54762
  var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
54756
54763
  /**
@@ -54796,7 +54803,16 @@ var IntegrationInstanceKindSchema = object({
54796
54803
  /** Relative hub path to start an interactive account link of an instance of this kind. */
54797
54804
  connectPath: string().min(1).optional(),
54798
54805
  /** Relative hub path to disconnect that account. */
54799
- disconnectPath: string().min(1).optional()
54806
+ disconnectPath: string().min(1).optional(),
54807
+ /**
54808
+ * Parts of the edit dialog the flat form cannot draw (a node picker, a model source), named by a
54809
+ * GENERIC widget id the client maps to a component; a client that knows none of them shows none.
54810
+ * `connection` widgets write connection values, `model` widgets own the model choice.
54811
+ */
54812
+ widgets: array(object({
54813
+ id: string().min(1),
54814
+ placement: _enum(["connection", "model"])
54815
+ })).optional()
54800
54816
  });
54801
54817
  /**
54802
54818
  * How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
@@ -54901,7 +54917,7 @@ var integrationInstancesCapability = {
54901
54917
  id: IntegrationInstanceIdSchema.nullable(),
54902
54918
  /** The kind of the create form (`id: null`) of a provider with several. */
54903
54919
  kind: string().min(1).optional()
54904
- }), ConfigSchemaPassthrough$3, { auth: "admin" }),
54920
+ }), ConfigSchemaPassthrough$2, { auth: "admin" }),
54905
54921
  listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
54906
54922
  getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
54907
54923
  /**
@@ -55852,12 +55868,12 @@ var LlmModelInfoSchema = object({
55852
55868
  });
55853
55869
  /**
55854
55870
  * The provider-specific part of a profile, validated by the provider that owns
55855
- * the kind (`upsertProfile` refuses what it does not accept). A field its
55871
+ * the kind (saving an instance refuses what it does not accept). A field its
55856
55872
  * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
55857
55873
  * keychain, never in the row, and reads back as the redaction marker.
55858
55874
  */
55859
55875
  var LlmProviderConfigSchema = record(string(), unknown());
55860
- var LlmProfileSchema = object({
55876
+ object({
55861
55877
  id: string(),
55862
55878
  name: string(),
55863
55879
  /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
@@ -55951,8 +55967,8 @@ var LlmProviderWidgetSchema = object({
55951
55967
  /** ConfigUISchema tree passed through untyped on the wire (the
55952
55968
  * notification-output `ConfigSchemaPassthrough` precedent at
55953
55969
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
55954
- var ConfigSchemaPassthrough$2 = unknown();
55955
- var LlmProfileKindDescriptorSchema = object({
55970
+ var ConfigSchemaPassthrough$1 = unknown();
55971
+ object({
55956
55972
  kind: LlmProfileKindSchema,
55957
55973
  label: string(),
55958
55974
  /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
@@ -55960,9 +55976,9 @@ var LlmProfileKindDescriptorSchema = object({
55960
55976
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
55961
55977
  addonId: string(),
55962
55978
  /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
55963
- connectionSchema: ConfigSchemaPassthrough$2,
55979
+ connectionSchema: ConfigSchemaPassthrough$1,
55964
55980
  /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
55965
- advancedSchema: ConfigSchemaPassthrough$2.optional(),
55981
+ advancedSchema: ConfigSchemaPassthrough$1.optional(),
55966
55982
  /** The kind's defaults; a model from `listModels` may override any of them. */
55967
55983
  features: LlmModelFeaturesSchema,
55968
55984
  /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
@@ -56091,20 +56107,7 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
56091
56107
  }), method(object({
56092
56108
  addonId: string().optional(),
56093
56109
  requestId: string()
56094
- }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
56095
- kind: "mutation",
56096
- auth: "admin"
56097
- }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
56098
- kind: "mutation",
56099
- auth: "admin"
56100
- }), method(ProfileRefInputSchema, _void(), {
56101
- kind: "mutation",
56102
- auth: "admin"
56103
- }), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
56104
- kind: "mutation",
56105
- auth: "admin",
56106
- timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
56107
- }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
56110
+ }), _void(), { kind: "mutation" }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
56108
56111
  kind: "mutation",
56109
56112
  auth: "admin"
56110
56113
  }), method(object({}), array(LlmDefaultSchema)), method(object({
@@ -57099,20 +57102,7 @@ method(_void(), MeshStatusSchema), method(object({
57099
57102
  /** Optional hostname override the host should advertise once joined. */
57100
57103
  hostname: string().optional() }), object({
57101
57104
  /** Authentication URL the operator should open in a browser. */
57102
- loginUrl: string() }), { kind: "mutation" }), method(_void(), object({ left: literal(true) }), { kind: "mutation" }), method(_void(), object({ loggedOut: literal(true) }), { kind: "mutation" }), method(_void(), object({ peers: array(MeshPeerSchema).readonly() })), method(object({
57103
- /** Optional auth key — when provided, probes the key validity
57104
- * against the provider's API. Omit when already joined to
57105
- * just ping the daemon. */
57106
- authKey: string().optional() }), object({
57107
- ok: boolean(),
57108
- /** Provider-side identifier resolved by the probe (tailnet
57109
- * name for Tailscale, network id for ZeroTier, etc.). */
57110
- tenant: string().optional(),
57111
- /** Daemon binary version, when reachable. */
57112
- daemonVersion: string().optional(),
57113
- /** Human-readable error when `ok: false`. */
57114
- error: string().optional()
57115
- }), { kind: "mutation" });
57105
+ loginUrl: string() }), { kind: "mutation" }), method(_void(), object({ left: literal(true) }), { kind: "mutation" }), method(_void(), object({ loggedOut: literal(true) }), { kind: "mutation" }), method(_void(), object({ peers: array(MeshPeerSchema).readonly() }));
57116
57106
  object({
57117
57107
  value: number().nullable().meta(readingMeta("device", { label: "Total" })),
57118
57108
  lastFetchedAt: number()
@@ -62973,13 +62963,6 @@ var AddBrokerInputSchema = object({
62973
62963
  });
62974
62964
  var AddBrokerResultSchema = object({ id: string() });
62975
62965
  var IdInputSchema = object({ id: string() });
62976
- var TestResultSchema$1 = discriminatedUnion("ok", [object({
62977
- ok: literal(true),
62978
- latencyMs: number()
62979
- }), object({
62980
- ok: literal(false),
62981
- error: string()
62982
- })]);
62983
62966
  var StartEmbeddedInputSchema = object({
62984
62967
  port: number().int().min(1).max(65535).default(1883),
62985
62968
  /** Allow anonymous connect (no username/password). Default: false. */
@@ -63002,9 +62985,6 @@ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnection
63002
62985
  }), method(IdInputSchema, _void(), {
63003
62986
  kind: "mutation",
63004
62987
  auth: "admin"
63005
- }), method(IdInputSchema, TestResultSchema$1, {
63006
- kind: "mutation",
63007
- auth: "admin"
63008
62988
  }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, {
63009
62989
  kind: "mutation",
63010
62990
  auth: "admin"
@@ -66796,61 +66776,6 @@ var oauthIntegrationCapability = {
66796
66776
  getDescriptor: method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" }) }
66797
66777
  };
66798
66778
  /**
66799
- * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
66800
- *
66801
- * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
66802
- * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
66803
- * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
66804
- * immutable after create.
66805
- */
66806
- var ConfigSchemaPassthrough$1 = unknown();
66807
- var OidcConnectionSchema = object({
66808
- id: string().min(1),
66809
- displayName: string(),
66810
- icon: string(),
66811
- issuerUrl: string(),
66812
- clientId: string(),
66813
- /** Client id + secret present — never the secret value. */
66814
- configured: boolean(),
66815
- /**
66816
- * Values for the connection form schema. `clientSecret` is a keychain
66817
- * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
66818
- */
66819
- formValues: record(string(), unknown()).optional()
66820
- });
66821
- /**
66822
- * Patch one connection. Omitted or empty `clientSecret` keeps the stored
66823
- * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
66824
- */
66825
- var OidcConnectionUpdateInputSchema = object({
66826
- id: string().min(1),
66827
- displayName: string().min(1),
66828
- icon: string().optional(),
66829
- issuerUrl: string().optional(),
66830
- clientId: string().optional(),
66831
- clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
66832
- redirectUri: string().optional(),
66833
- scopes: string().optional(),
66834
- usernameClaim: _enum([
66835
- "preferred_username",
66836
- "email",
66837
- "sub"
66838
- ]).optional()
66839
- });
66840
- method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
66841
- id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
66842
- displayName: string().min(1)
66843
- }), object({ id: string() }), {
66844
- kind: "mutation",
66845
- auth: "admin"
66846
- }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
66847
- kind: "mutation",
66848
- auth: "admin"
66849
- }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
66850
- kind: "mutation",
66851
- auth: "admin"
66852
- });
66853
- /**
66854
66779
  * Generic on-screen-display (video overlay) cap. Each camera exposes
66855
66780
  * a firmware-defined list of overlays (channel name, timestamp,
66856
66781
  * watermark, logo, …); the cap models them as a homogeneous array of
@@ -73023,21 +72948,6 @@ method(object({
73023
72948
  */
73024
72949
  ttlSec: union([number().int().positive(), literal("never")]).optional()
73025
72950
  }), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
73026
- var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
73027
- providerId: string().min(1),
73028
- displayName: string().min(1),
73029
- configSchema: unknown(),
73030
- nodeLocal: boolean(),
73031
- shouldSaveDiskSpace: literal(true),
73032
- minFreePercent: number().min(0).max(100)
73033
- }), object({
73034
- providerId: string().min(1),
73035
- displayName: string().min(1),
73036
- configSchema: unknown(),
73037
- nodeLocal: boolean(),
73038
- shouldSaveDiskSpace: literal(false),
73039
- minFreePercent: literal(null)
73040
- })]);
73041
72951
  method(object({
73042
72952
  location: StorageLocationRefSchema,
73043
72953
  relativePath: string()
@@ -73099,42 +73009,7 @@ method(object({
73099
73009
  }), _instanceof(Uint8Array), { auth: "admin" }), method(object({ downloadId: string() }), _void(), {
73100
73010
  kind: "mutation",
73101
73011
  auth: "admin"
73102
- }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(StorageLocationSchema.omit({
73103
- createdAt: true,
73104
- updatedAt: true
73105
- }), StorageLocationSchema, {
73106
- kind: "mutation",
73107
- auth: "admin"
73108
- }), method(object({
73109
- id: string(),
73110
- force: boolean().optional()
73111
- }), _void(), {
73112
- kind: "mutation",
73113
- auth: "admin"
73114
- }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
73115
- ok: boolean(),
73116
- error: string().optional()
73117
- }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
73118
- providerId: string(),
73119
- /**
73120
- * The location this config is an UNSAVED edit of, when there is one.
73121
- *
73122
- * `listLocations` replaces every declared secret with the redaction
73123
- * sentinel, so the edit modal's form state holds the sentinel for any
73124
- * credential the operator did not retype — and posting that here
73125
- * without a way to resolve it makes the provider try to authenticate
73126
- * as `__camstack_redacted__` and report the operator's own working
73127
- * password as wrong. Given this id, the orchestrator restores each
73128
- * sentinel from the stored config (same rule as `upsertLocation`)
73129
- * before dispatching. Omitted by the "Add location" wizard, where
73130
- * every value was typed just now and nothing is stored yet.
73131
- */
73132
- locationId: string().optional(),
73133
- config: record(string(), unknown())
73134
- }), object({
73135
- ok: boolean(),
73136
- error: string().optional()
73137
- }), { auth: "admin" });
73012
+ }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(_void(), array(StorageDrainProgressSchema).readonly());
73138
73013
  /** One table of the settings database. */
73139
73014
  var StorageTableSchema = object({
73140
73015
  /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
@@ -74651,7 +74526,7 @@ var TrainingProviderTypeSchema = object({
74651
74526
  label: string(),
74652
74527
  /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
74653
74528
  iconAsset: string(),
74654
- /** Owning `training-provider` addon — collection selector for createEntry. */
74529
+ /** Owning `training-provider` addon. */
74655
74530
  addonId: string(),
74656
74531
  /**
74657
74532
  * Fields for one entry of this type (credentials + defaults). Absent on a
@@ -74696,36 +74571,6 @@ var TrainingProviderDescriptorSchema = object({
74696
74571
  */
74697
74572
  formValues: record(string(), unknown()).optional()
74698
74573
  });
74699
- /**
74700
- * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
74701
- * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
74702
- * `{ $secretClear: true }` clears it.
74703
- */
74704
- var TrainingProviderUpdateEntryInputSchema = object({
74705
- entryId: string().min(1),
74706
- name: string().min(1),
74707
- tokenId: string().optional(),
74708
- tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
74709
- environment: string().optional(),
74710
- gpuType: string().optional(),
74711
- region: string().optional(),
74712
- costCapUsd: number().nonnegative().optional(),
74713
- maxRuntimeSec: number().int().positive().optional(),
74714
- failedDatasetGraceHours: number().nonnegative().optional()
74715
- });
74716
- var TrainingCredentialCheckSchema = object({
74717
- ok: boolean(),
74718
- /** Workspace / account name, when the provider says. */
74719
- account: string().optional(),
74720
- reason: _enum([
74721
- "missing",
74722
- "invalid",
74723
- "forbidden",
74724
- "network",
74725
- "quota"
74726
- ]).optional(),
74727
- detail: string().optional()
74728
- });
74729
74574
  var ProviderJobStateSchema = _enum([
74730
74575
  "pending",
74731
74576
  "starting",
@@ -74773,22 +74618,6 @@ var TrainingLogLineSchema = object({
74773
74618
  text: string()
74774
74619
  });
74775
74620
  method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
74776
- typeId: string().min(1),
74777
- name: string().min(1)
74778
- }), object({ entryId: string() }), {
74779
- kind: "mutation",
74780
- auth: "admin"
74781
- }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
74782
- kind: "mutation",
74783
- auth: "admin"
74784
- }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
74785
- kind: "mutation",
74786
- auth: "admin"
74787
- }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
74788
- kind: "mutation",
74789
- auth: "admin",
74790
- timeoutMs: 3e4
74791
- }), method(object({
74792
74621
  entryId: string().min(1),
74793
74622
  gpuType: string(),
74794
74623
  region: string(),
@@ -78174,20 +78003,6 @@ Object.freeze({
78174
78003
  access: "view",
78175
78004
  role: "admin"
78176
78005
  },
78177
- "connectionTest.describeTest": {
78178
- capName: "connection-test",
78179
- capScope: "system",
78180
- addonId: null,
78181
- access: "view",
78182
- role: "admin"
78183
- },
78184
- "connectionTest.testSettings": {
78185
- capName: "connection-test",
78186
- capScope: "system",
78187
- addonId: null,
78188
- access: "create",
78189
- role: "admin"
78190
- },
78191
78006
  "connectivity.getStatus": {
78192
78007
  capName: "connectivity",
78193
78008
  capScope: "device",
@@ -80554,13 +80369,6 @@ Object.freeze({
80554
80369
  access: "view",
80555
80370
  role: "admin"
80556
80371
  },
80557
- "integrations.testConnection": {
80558
- capName: "integrations",
80559
- capScope: "system",
80560
- addonId: null,
80561
- access: "create",
80562
- role: "admin"
80563
- },
80564
80372
  "integrations.update": {
80565
80373
  capName: "integrations",
80566
80374
  capScope: "system",
@@ -80813,13 +80621,6 @@ Object.freeze({
80813
80621
  access: "delete",
80814
80622
  role: "admin"
80815
80623
  },
80816
- "llm.deleteProfile": {
80817
- capName: "llm",
80818
- capScope: "system",
80819
- addonId: null,
80820
- access: "delete",
80821
- role: "admin"
80822
- },
80823
80624
  "llm.generate": {
80824
80625
  capName: "llm",
80825
80626
  capScope: "system",
@@ -80883,20 +80684,6 @@ Object.freeze({
80883
80684
  access: "view",
80884
80685
  role: "admin"
80885
80686
  },
80886
- "llm.listProfileKinds": {
80887
- capName: "llm",
80888
- capScope: "system",
80889
- addonId: null,
80890
- access: "view",
80891
- role: "admin"
80892
- },
80893
- "llm.listProfiles": {
80894
- capName: "llm",
80895
- capScope: "system",
80896
- addonId: null,
80897
- access: "view",
80898
- role: "admin"
80899
- },
80900
80687
  "llm.listRuntimeNodes": {
80901
80688
  capName: "llm",
80902
80689
  capScope: "system",
@@ -80904,13 +80691,6 @@ Object.freeze({
80904
80691
  access: "view",
80905
80692
  role: "admin"
80906
80693
  },
80907
- "llm.migrateRawSecrets": {
80908
- capName: "llm",
80909
- capScope: "system",
80910
- addonId: null,
80911
- access: "create",
80912
- role: "admin"
80913
- },
80914
80694
  "llm.resolveModelRef": {
80915
80695
  capName: "llm",
80916
80696
  capScope: "system",
@@ -80939,20 +80719,6 @@ Object.freeze({
80939
80719
  access: "create",
80940
80720
  role: "admin"
80941
80721
  },
80942
- "llm.testProfile": {
80943
- capName: "llm",
80944
- capScope: "system",
80945
- addonId: null,
80946
- access: "create",
80947
- role: "admin"
80948
- },
80949
- "llm.upsertProfile": {
80950
- capName: "llm",
80951
- capScope: "system",
80952
- addonId: null,
80953
- access: "create",
80954
- role: "admin"
80955
- },
80956
80722
  "llmRuntime.appleAvailability": {
80957
80723
  capName: "llm-runtime",
80958
80724
  capScope: "system",
@@ -81457,13 +81223,6 @@ Object.freeze({
81457
81223
  access: "create",
81458
81224
  role: "admin"
81459
81225
  },
81460
- "meshNetwork.testConnection": {
81461
- capName: "mesh-network",
81462
- capScope: "system",
81463
- addonId: null,
81464
- access: "create",
81465
- role: "admin"
81466
- },
81467
81226
  "meter.getStatus": {
81468
81227
  capName: "meter",
81469
81228
  capScope: "device",
@@ -81793,13 +81552,6 @@ Object.freeze({
81793
81552
  access: "create",
81794
81553
  role: "admin"
81795
81554
  },
81796
- "mqttBroker.testConnection": {
81797
- capName: "mqtt-broker",
81798
- capScope: "system",
81799
- addonId: null,
81800
- access: "create",
81801
- role: "admin"
81802
- },
81803
81555
  "nativeObjectDetection.getOptions": {
81804
81556
  capName: "native-object-detection",
81805
81557
  capScope: "device",
@@ -82129,13 +81881,6 @@ Object.freeze({
82129
81881
  access: "create",
82130
81882
  role: "admin"
82131
81883
  },
82132
- "notificationOutput.deleteTarget": {
82133
- capName: "notification-output",
82134
- capScope: "system",
82135
- addonId: null,
82136
- access: "delete",
82137
- role: "admin"
82138
- },
82139
81884
  "notificationOutput.discoverTargets": {
82140
81885
  capName: "notification-output",
82141
81886
  capScope: "system",
@@ -82143,13 +81888,6 @@ Object.freeze({
82143
81888
  access: "view",
82144
81889
  role: "admin"
82145
81890
  },
82146
- "notificationOutput.getTarget": {
82147
- capName: "notification-output",
82148
- capScope: "system",
82149
- addonId: null,
82150
- access: "view",
82151
- role: "admin"
82152
- },
82153
81891
  "notificationOutput.listTargetKinds": {
82154
81892
  capName: "notification-output",
82155
81893
  capScope: "system",
@@ -82157,13 +81895,6 @@ Object.freeze({
82157
81895
  access: "view",
82158
81896
  role: "admin"
82159
81897
  },
82160
- "notificationOutput.listTargets": {
82161
- capName: "notification-output",
82162
- capScope: "system",
82163
- addonId: null,
82164
- access: "view",
82165
- role: "admin"
82166
- },
82167
81898
  "notificationOutput.probeTargetConfig": {
82168
81899
  capName: "notification-output",
82169
81900
  capScope: "system",
@@ -82178,13 +81909,6 @@ Object.freeze({
82178
81909
  access: "create",
82179
81910
  role: "admin"
82180
81911
  },
82181
- "notificationOutput.setTargetEnabled": {
82182
- capName: "notification-output",
82183
- capScope: "system",
82184
- addonId: null,
82185
- access: "create",
82186
- role: "admin"
82187
- },
82188
81912
  "notificationOutput.testTarget": {
82189
81913
  capName: "notification-output",
82190
81914
  capScope: "system",
@@ -82192,13 +81916,6 @@ Object.freeze({
82192
81916
  access: "create",
82193
81917
  role: "admin"
82194
81918
  },
82195
- "notificationOutput.upsertTarget": {
82196
- capName: "notification-output",
82197
- capScope: "system",
82198
- addonId: null,
82199
- access: "create",
82200
- role: "admin"
82201
- },
82202
81919
  "notificationRules.activateAlarmProfile": {
82203
81920
  capName: "notification-rules",
82204
81921
  capScope: "system",
@@ -82458,41 +82175,6 @@ Object.freeze({
82458
82175
  access: "view",
82459
82176
  role: "admin"
82460
82177
  },
82461
- "oidcConnections.connectionFormSchema": {
82462
- capName: "oidc-connections",
82463
- capScope: "system",
82464
- addonId: null,
82465
- access: "view",
82466
- role: "admin"
82467
- },
82468
- "oidcConnections.createConnection": {
82469
- capName: "oidc-connections",
82470
- capScope: "system",
82471
- addonId: null,
82472
- access: "create",
82473
- role: "admin"
82474
- },
82475
- "oidcConnections.deleteConnection": {
82476
- capName: "oidc-connections",
82477
- capScope: "system",
82478
- addonId: null,
82479
- access: "delete",
82480
- role: "admin"
82481
- },
82482
- "oidcConnections.listConnections": {
82483
- capName: "oidc-connections",
82484
- capScope: "system",
82485
- addonId: null,
82486
- access: "view",
82487
- role: "admin"
82488
- },
82489
- "oidcConnections.updateConnection": {
82490
- capName: "oidc-connections",
82491
- capScope: "system",
82492
- addonId: null,
82493
- access: "create",
82494
- role: "admin"
82495
- },
82496
82178
  "osd.getStatus": {
82497
82179
  capName: "osd",
82498
82180
  capScope: "device",
@@ -85524,13 +85206,6 @@ Object.freeze({
85524
85206
  access: "delete",
85525
85207
  role: "admin"
85526
85208
  },
85527
- "storage.deleteLocation": {
85528
- capName: "storage",
85529
- capScope: "system",
85530
- addonId: null,
85531
- access: "delete",
85532
- role: "admin"
85533
- },
85534
85209
  "storage.endDownload": {
85535
85210
  capName: "storage",
85536
85211
  capScope: "system",
@@ -85587,13 +85262,6 @@ Object.freeze({
85587
85262
  access: "view",
85588
85263
  role: "admin"
85589
85264
  },
85590
- "storage.listProviders": {
85591
- capName: "storage",
85592
- capScope: "system",
85593
- addonId: null,
85594
- access: "view",
85595
- role: "admin"
85596
- },
85597
85265
  "storage.read": {
85598
85266
  capName: "storage",
85599
85267
  capScope: "system",
@@ -85615,27 +85283,6 @@ Object.freeze({
85615
85283
  access: "view",
85616
85284
  role: "admin"
85617
85285
  },
85618
- "storage.testConfig": {
85619
- capName: "storage",
85620
- capScope: "system",
85621
- addonId: null,
85622
- access: "view",
85623
- role: "admin"
85624
- },
85625
- "storage.testLocation": {
85626
- capName: "storage",
85627
- capScope: "system",
85628
- addonId: null,
85629
- access: "view",
85630
- role: "admin"
85631
- },
85632
- "storage.upsertLocation": {
85633
- capName: "storage",
85634
- capScope: "system",
85635
- addonId: null,
85636
- access: "create",
85637
- role: "admin"
85638
- },
85639
85286
  "storage.write": {
85640
85287
  capName: "storage",
85641
85288
  capScope: "system",
@@ -86630,20 +86277,6 @@ Object.freeze({
86630
86277
  access: "create",
86631
86278
  role: "admin"
86632
86279
  },
86633
- "trainingProvider.createEntry": {
86634
- capName: "training-provider",
86635
- capScope: "system",
86636
- addonId: null,
86637
- access: "create",
86638
- role: "admin"
86639
- },
86640
- "trainingProvider.deleteEntry": {
86641
- capName: "training-provider",
86642
- capScope: "system",
86643
- addonId: null,
86644
- access: "delete",
86645
- role: "admin"
86646
- },
86647
86280
  "trainingProvider.describe": {
86648
86281
  capName: "training-provider",
86649
86282
  capScope: "system",
@@ -86714,13 +86347,6 @@ Object.freeze({
86714
86347
  access: "create",
86715
86348
  role: "admin"
86716
86349
  },
86717
- "trainingProvider.updateEntry": {
86718
- capName: "training-provider",
86719
- capScope: "system",
86720
- addonId: null,
86721
- access: "create",
86722
- role: "admin"
86723
- },
86724
86350
  "trainingProvider.uploadDataset": {
86725
86351
  capName: "training-provider",
86726
86352
  capScope: "system",
@@ -86728,13 +86354,6 @@ Object.freeze({
86728
86354
  access: "create",
86729
86355
  role: "admin"
86730
86356
  },
86731
- "trainingProvider.validateCredentials": {
86732
- capName: "training-provider",
86733
- capScope: "system",
86734
- addonId: null,
86735
- access: "create",
86736
- role: "admin"
86737
- },
86738
86357
  "turnProvider.getTurnServers": {
86739
86358
  capName: "turn-provider",
86740
86359
  capScope: "system",