@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.
@@ -5,7 +5,7 @@ import "node:fs";
5
5
  import "node:path";
6
6
  import "node:child_process";
7
7
  import "node:zlib";
8
- //#region ../types/dist/event-category-BmPm98n0.mjs
8
+ //#region ../types/dist/event-category-78tcBemo.mjs
9
9
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
10
10
  EventCategory["SystemBoot"] = "system.boot";
11
11
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -126,6 +126,23 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
126
126
  */
127
127
  EventCategory["AddonLoadRecovered"] = "addon.load-recovered";
128
128
  /**
129
+ * An addon is RUNNING although its installed package is below what the
130
+ * running server requires (`camstack.requires.addons` of the server, or the
131
+ * addon's own `requires.server`). Raised once per streak by the unsupported-
132
+ * addon tracker, on the hub and on agents; AlertCenter turns it into one
133
+ * operator alert per node and package. The addon is never held back for it.
134
+ *
135
+ * Payload: `{ packageName, addonId, nodeId, installedVersion, requiredMinimum, serverVersion, unmet }`.
136
+ */
137
+ EventCategory["AddonUnsupportedVersion"] = "addon.unsupported-version";
138
+ /**
139
+ * The package of an {@link AddonUnsupportedVersion} alert reached a supported
140
+ * version, or is no longer installed on the node. AlertCenter dismisses the matching alert.
141
+ *
142
+ * Payload: `{ packageName, addonId, nodeId }`.
143
+ */
144
+ EventCategory["AddonUnsupportedResolved"] = "addon.unsupported-resolved";
145
+ /**
129
146
  * Monitor scheduled the next retry for a failed addon. Transient —
130
147
  * surfaced to the UI for live-updating the "next retry in Ns"
131
148
  * countdown on the Addons page row, NOT persisted as an alert.
@@ -236,7 +253,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
236
253
  EventCategory["ProcessRestarted"] = "process.restarted";
237
254
  /**
238
255
  * The SET of storage locations changed — one was created, edited, enabled,
239
- * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
256
+ * disabled or deleted through the location instances or the forced-delete action.
240
257
  *
241
258
  * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
242
259
  * it must also converge on its own periodic path, because a dropped event
@@ -5987,7 +6004,7 @@ var ZodIssueCode = {
5987
6004
  var ZodFirstPartyTypeKind;
5988
6005
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5989
6006
  //#endregion
5990
- //#region ../types/dist/sleep-CmjWurK5.mjs
6007
+ //#region ../types/dist/sleep-AEnTN3b4.mjs
5991
6008
  /**
5992
6009
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5993
6010
  * window to float samples (D455).
@@ -6696,10 +6713,33 @@ function integrationRowsApiOver(api) {
6696
6713
  };
6697
6714
  }
6698
6715
  var PREFIX$1 = "records/";
6716
+ /**
6717
+ * Cross-realm brand. An addon bundles its own copy of this module (D15) while
6718
+ * `ctx.records` is the HOST's door, so an error thrown by the host is an
6719
+ * instance of the host's classes, not of the addon's. The brand plus the code
6720
+ * make `instanceof` answer by identity of the failure, not of the copy.
6721
+ */
6722
+ var RECORDS_ERROR_BRAND = Symbol.for("camstack.records-error");
6723
+ function carriesBrand(value) {
6724
+ return typeof value === "object" && value !== null && Reflect.get(value, RECORDS_ERROR_BRAND) === true;
6725
+ }
6699
6726
  /** The base of every records failure. `detail` is the human part of the message. */
6700
6727
  var RecordsError = class extends Error {
6728
+ /** The code a subclass stands for; the base stands for every code. */
6729
+ static code = void 0;
6730
+ /**
6731
+ * `instanceof` across copies of this module: any branded error is a
6732
+ * `RecordsError`, and is an instance of a subclass only when its code is the
6733
+ * subclass's code. Same-copy answers are unchanged.
6734
+ */
6735
+ static [Symbol.hasInstance](value) {
6736
+ if (Function.prototype[Symbol.hasInstance].call(this, value)) return true;
6737
+ if (!carriesBrand(value)) return false;
6738
+ return this.code === void 0 || value.code === this.code;
6739
+ }
6701
6740
  code;
6702
6741
  detail;
6742
+ [RECORDS_ERROR_BRAND] = true;
6703
6743
  constructor(code, detail) {
6704
6744
  super(`${PREFIX$1}${code}: ${detail}`);
6705
6745
  this.name = "RecordsError";
@@ -6708,29 +6748,33 @@ var RecordsError = class extends Error {
6708
6748
  }
6709
6749
  };
6710
6750
  /** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
6711
- var RevConflictError = class extends RecordsError {
6751
+ var RevConflictError = class RevConflictError extends RecordsError {
6752
+ static code = "rev-conflict";
6712
6753
  constructor(detail) {
6713
- super("rev-conflict", detail);
6754
+ super(RevConflictError.code, detail);
6714
6755
  this.name = "RevConflictError";
6715
6756
  }
6716
6757
  };
6717
6758
  /** The keychain could not store or serve a value: explicit, never an empty string. */
6718
- var RecordSecretUnavailableError = class extends RecordsError {
6759
+ var RecordSecretUnavailableError = class RecordSecretUnavailableError extends RecordsError {
6760
+ static code = "secret-unavailable";
6719
6761
  constructor(detail) {
6720
- super("secret-unavailable", detail);
6762
+ super(RecordSecretUnavailableError.code, detail);
6721
6763
  this.name = "RecordSecretUnavailableError";
6722
6764
  }
6723
6765
  };
6724
- var InvalidRecordError = class extends RecordsError {
6766
+ var InvalidRecordError = class InvalidRecordError extends RecordsError {
6767
+ static code = "invalid-record";
6725
6768
  constructor(detail) {
6726
- super("invalid-record", detail);
6769
+ super(InvalidRecordError.code, detail);
6727
6770
  this.name = "InvalidRecordError";
6728
6771
  }
6729
6772
  };
6730
6773
  /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
6731
- var DeclarationRefusedError = class extends RecordsError {
6774
+ var DeclarationRefusedError = class DeclarationRefusedError extends RecordsError {
6775
+ static code = "declaration-refused";
6732
6776
  constructor(detail) {
6733
- super("declaration-refused", detail);
6777
+ super(DeclarationRefusedError.code, detail);
6734
6778
  this.name = "DeclarationRefusedError";
6735
6779
  }
6736
6780
  };
@@ -7208,17 +7252,35 @@ var RecordIntegrationInstances = class {
7208
7252
  ...kind !== void 0 ? { kind } : {}
7209
7253
  });
7210
7254
  if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
7255
+ const initial = this.hooks.initialBody(name, kind);
7256
+ const patch = this.patchOf(values ?? {});
7257
+ if (Object.keys(patch).length > 0) Object.assign(patch, await this.hooks.validateWrite?.({
7258
+ kind,
7259
+ body: {
7260
+ ...initial,
7261
+ ...patch
7262
+ }
7263
+ }));
7211
7264
  await this.handle.put({
7212
7265
  id: minted,
7213
- data: this.hooks.initialBody(name, kind)
7266
+ data: initial
7214
7267
  }, { ifRev: 0 });
7215
- const patch = this.patchOf(values ?? {});
7216
7268
  if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
7217
7269
  await this.hooks.onChanged?.(minted, "created");
7218
7270
  return { id: minted };
7219
7271
  };
7220
7272
  updateInstance = async ({ id, name, values }) => {
7221
7273
  const patch = this.patchOf(values);
7274
+ if (this.hooks.validateWrite !== void 0 && Object.keys(patch).length > 0) {
7275
+ const stored = await this.handle.get(id);
7276
+ if (stored !== null) Object.assign(patch, await this.hooks.validateWrite({
7277
+ kind: void 0,
7278
+ body: {
7279
+ ...stored.data,
7280
+ ...patch
7281
+ }
7282
+ }));
7283
+ }
7222
7284
  if (name !== void 0) patch[this.nameField] = name;
7223
7285
  await this.handle.patch(id, patch);
7224
7286
  await this.hooks.onChanged?.(id, "updated");
@@ -9525,271 +9587,6 @@ function normalizeAddonInitResult(result) {
9525
9587
  if (Array.isArray(result)) return { providers: result };
9526
9588
  return result;
9527
9589
  }
9528
- /**
9529
- * The share-view scope kinds a share-link token can carry. The hub mints
9530
- * and validates them (`ShareViewGrantSchema` builds its
9531
- * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
9532
- */
9533
- var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
9534
- /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
9535
- var PeerBytesTicketSchema = object({
9536
- /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
9537
- url: string().min(1),
9538
- /**
9539
- * The HOST node this URL means something on — the hub or a named agent,
9540
- * never a runner. {@link AddonPeerBytes.open} compares it to its own and
9541
- * refuses `cross-node` by name when they differ, without dialling.
9542
- */
9543
- hostNodeId: string().min(1),
9544
- expiresAtMs: number().int().nonnegative(),
9545
- /**
9546
- * What the producer DECLARED the body to be, when it knows — `null` when it
9547
- * does not. Never `0` for unknown (D393): a consumer sizing a bound off this
9548
- * must be able to tell "the producer did not say" from "the body is empty".
9549
- */
9550
- declaredBytes: number().int().nonnegative().nullable()
9551
- });
9552
- function defOf(schema) {
9553
- const zodBag = Reflect.get(schema, "_zod");
9554
- if (typeof zodBag !== "object" || zodBag === null) return {};
9555
- const def = Reflect.get(zodBag, "def");
9556
- if (typeof def !== "object" || def === null) return {};
9557
- return def;
9558
- }
9559
- function declaredHere(schema) {
9560
- return globalRegistry.get(schema)?.secret === true;
9561
- }
9562
- /** Wrapper kinds whose `innerType` is the field itself. */
9563
- var WRAPPERS = new Set([
9564
- "optional",
9565
- "nullable",
9566
- "default",
9567
- "prefault",
9568
- "catch",
9569
- "readonly",
9570
- "nonoptional"
9571
- ]);
9572
- /**
9573
- * The schema layers that make up ONE field: the schema itself and every
9574
- * wrapper below it (optional / default / nullable / readonly / catch), plus
9575
- * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
9576
- * `.transform` on `in`).
9577
- */
9578
- function layersOf(schema) {
9579
- const out = [];
9580
- const queue = [schema];
9581
- while (queue.length > 0) {
9582
- const s = queue.shift();
9583
- if (!s || out.includes(s)) continue;
9584
- out.push(s);
9585
- const def = defOf(s);
9586
- if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
9587
- if (def.type === "pipe") {
9588
- if (def.in) queue.push(def.in);
9589
- if (def.out) queue.push(def.out);
9590
- }
9591
- }
9592
- return out;
9593
- }
9594
- /** True when any layer of this field declares `.meta({ secret: true })`. */
9595
- function isZodSecret(schema) {
9596
- return layersOf(schema).some(declaredHere);
9597
- }
9598
- /**
9599
- * Every declared secret path in a config schema: dotted keys, `[]` for "each
9600
- * element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
9601
- * map" (`applianceSecrets{}`). A declared
9602
- * object or array is reported as one path and not descended into — everything
9603
- * under it is secret.
9604
- */
9605
- function collectZodSecretPaths(schema, prefix = "") {
9606
- if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
9607
- const paths = [];
9608
- for (const layer of layersOf(schema)) {
9609
- const def = defOf(layer);
9610
- if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
9611
- else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
9612
- else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
9613
- else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
9614
- else if (def.type === "intersection") {
9615
- if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
9616
- if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
9617
- }
9618
- }
9619
- return [...new Set(paths)];
9620
- }
9621
- /**
9622
- * Record kinds (D881): the declaration an addon makes of one kind of fact, the
9623
- * Zod row schema that describes it, and the helper that turns the two into the
9624
- * JSON the engine stores.
9625
- *
9626
- * A kind is declared ONCE, next to the code that owns it, and the engine's
9627
- * reconciler creates its indexes - nothing creates DDL at runtime from a write.
9628
- * Everything the generic machinery needs (secret fields, the entry descriptor)
9629
- * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
9630
- * never a field name (D879).
9631
- */
9632
- /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
9633
- var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
9634
- var RecordIndexSchema = object({
9635
- name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
9636
- fields: array(RecordFieldPathSchema).min(1).max(4),
9637
- unique: boolean().optional()
9638
- }).strict();
9639
- var RecordRetentionSchema = union([
9640
- object({
9641
- ttlMs: number().int().positive(),
9642
- from: _enum(["at", "write"])
9643
- }).strict(),
9644
- object({
9645
- maxRows: number().int().positive().optional(),
9646
- maxRowsPerDevice: number().int().positive().optional()
9647
- }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
9648
- object({
9649
- owner: string().min(1),
9650
- reason: string().min(1)
9651
- }).strict(),
9652
- object({ none: string().min(1) }).strict()
9653
- ]);
9654
- /** The descriptor a generic entries UI reads (D881 "generic entries"). */
9655
- var EntryDescriptorSchema = object({
9656
- title: string().min(1),
9657
- /** The record body field shown as the entry's name. */
9658
- nameField: string().min(1),
9659
- /** JSON Schema of the entry body; `secret: true` marks a password field. */
9660
- fields: record(string(), unknown())
9661
- }).strict();
9662
- /** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
9663
- var RecordKindDeclarationSchema = object({
9664
- database: _enum(RECORD_DATABASES).default("settings"),
9665
- class: _enum(RECORD_CLASSES),
9666
- writeTrigger: string().min(1),
9667
- device: _enum([
9668
- "required",
9669
- "optional",
9670
- "none"
9671
- ]).default("none"),
9672
- at: _enum(["required", "none"]).default("none"),
9673
- indexes: array(RecordIndexSchema).max(8).default([]),
9674
- retention: RecordRetentionSchema,
9675
- deviceRemoval: _enum(["delete", "none"]).default("none"),
9676
- maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
9677
- /** Derived from the Zod schema; never written by hand. */
9678
- secretPaths: array(string().min(1)).default([]),
9679
- /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
9680
- secretArrayKeys: record(string(), string()).default({}),
9681
- /** Kinds that must agree through `transact` sit in one file under one family name. */
9682
- transactFamily: string().min(1).optional(),
9683
- entry: EntryDescriptorSchema.optional()
9684
- }).strict();
9685
- /** The kind names: lower-case, dash separated, short enough for an index name. */
9686
- var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
9687
- /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
9688
- function assertValidDeclaration(name, decl) {
9689
- const refuse = (why) => {
9690
- throw new DeclarationRefusedError(`kind "${name}": ${why}`);
9691
- };
9692
- if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
9693
- const seen = /* @__PURE__ */ new Set();
9694
- for (const index of decl.indexes) {
9695
- if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
9696
- seen.add(index.name);
9697
- }
9698
- const { retention } = decl;
9699
- const hasSecrets = decl.secretPaths.length > 0;
9700
- if ("ttlMs" in retention) {
9701
- if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
9702
- if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
9703
- }
9704
- if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
9705
- if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
9706
- if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
9707
- if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
9708
- const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
9709
- 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)`);
9710
- }
9711
- if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
9712
- 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`);
9713
- }
9714
- function bodyFieldsOf(schema) {
9715
- return { ...toJSONSchema(schema, {
9716
- unrepresentable: "any",
9717
- io: "input"
9718
- }) };
9719
- }
9720
- function isRecordLike(value) {
9721
- return typeof value === "object" && value !== null && !Array.isArray(value);
9722
- }
9723
- /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
9724
- function hasNameField(json, field) {
9725
- const branches = json["oneOf"] ?? json["anyOf"];
9726
- if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
9727
- const properties = json["properties"];
9728
- return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
9729
- }
9730
- /**
9731
- * Declare the kinds of a package. The keys are the kind names. The result is
9732
- * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
9733
- * types its handle from.
9734
- */
9735
- function defineRecordKinds(specs) {
9736
- const out = {};
9737
- for (const [name, spec] of Object.entries(specs)) {
9738
- const secretPaths = collectZodSecretPaths(spec.schema);
9739
- const nameField = spec.entry?.nameField ?? "name";
9740
- const fields = bodyFieldsOf(spec.schema);
9741
- if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
9742
- const parsed = RecordKindDeclarationSchema.parse({
9743
- database: spec.database,
9744
- class: spec.class,
9745
- writeTrigger: spec.writeTrigger,
9746
- device: spec.device,
9747
- at: spec.at,
9748
- indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
9749
- retention: spec.retention,
9750
- deviceRemoval: spec.deviceRemoval,
9751
- maxDataBytes: spec.maxDataBytes,
9752
- secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
9753
- secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
9754
- transactFamily: spec.transactFamily,
9755
- entry: spec.entry === void 0 ? void 0 : {
9756
- title: spec.entry.title,
9757
- nameField,
9758
- fields
9759
- }
9760
- });
9761
- assertValidDeclaration(name, parsed);
9762
- out[name] = {
9763
- name,
9764
- schema: spec.schema,
9765
- declaration: parsed
9766
- };
9767
- }
9768
- return out;
9769
- }
9770
- /**
9771
- * Declare one entry kind. An entry is configuration: never trimmed by the
9772
- * engine, never aged, belonging to no device.
9773
- */
9774
- function defineEntryKind(name, spec) {
9775
- const defined = defineRecordKinds({ [name]: {
9776
- schema: spec.schema,
9777
- class: "config",
9778
- writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
9779
- retention: { none: "an entry goes only when the operator deletes it" },
9780
- ...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
9781
- ...spec.database === void 0 ? {} : { database: spec.database },
9782
- ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
9783
- ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
9784
- ...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
9785
- entry: {
9786
- title: spec.title,
9787
- ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
9788
- }
9789
- } })[name];
9790
- if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
9791
- return defined;
9792
- }
9793
9590
  object({
9794
9591
  field: string().min(1),
9795
9592
  on: literal("advance")
@@ -9878,6 +9675,271 @@ function optionalMethod(input, output, options) {
9878
9675
  providerOptional: true
9879
9676
  };
9880
9677
  }
9678
+ function defOf(schema) {
9679
+ const zodBag = Reflect.get(schema, "_zod");
9680
+ if (typeof zodBag !== "object" || zodBag === null) return {};
9681
+ const def = Reflect.get(zodBag, "def");
9682
+ if (typeof def !== "object" || def === null) return {};
9683
+ return def;
9684
+ }
9685
+ function declaredHere(schema) {
9686
+ return globalRegistry.get(schema)?.secret === true;
9687
+ }
9688
+ /** Wrapper kinds whose `innerType` is the field itself. */
9689
+ var WRAPPERS = new Set([
9690
+ "optional",
9691
+ "nullable",
9692
+ "default",
9693
+ "prefault",
9694
+ "catch",
9695
+ "readonly",
9696
+ "nonoptional"
9697
+ ]);
9698
+ /**
9699
+ * The schema layers that make up ONE field: the schema itself and every
9700
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
9701
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
9702
+ * `.transform` on `in`).
9703
+ */
9704
+ function layersOf(schema) {
9705
+ const out = [];
9706
+ const queue = [schema];
9707
+ while (queue.length > 0) {
9708
+ const s = queue.shift();
9709
+ if (!s || out.includes(s)) continue;
9710
+ out.push(s);
9711
+ const def = defOf(s);
9712
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
9713
+ if (def.type === "pipe") {
9714
+ if (def.in) queue.push(def.in);
9715
+ if (def.out) queue.push(def.out);
9716
+ }
9717
+ }
9718
+ return out;
9719
+ }
9720
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
9721
+ function isZodSecret(schema) {
9722
+ return layersOf(schema).some(declaredHere);
9723
+ }
9724
+ /**
9725
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
9726
+ * element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
9727
+ * map" (`applianceSecrets{}`). A declared
9728
+ * object or array is reported as one path and not descended into — everything
9729
+ * under it is secret.
9730
+ */
9731
+ function collectZodSecretPaths(schema, prefix = "") {
9732
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
9733
+ const paths = [];
9734
+ for (const layer of layersOf(schema)) {
9735
+ const def = defOf(layer);
9736
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
9737
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
9738
+ else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
9739
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
9740
+ else if (def.type === "intersection") {
9741
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
9742
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
9743
+ }
9744
+ }
9745
+ return [...new Set(paths)];
9746
+ }
9747
+ /**
9748
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
9749
+ * Zod row schema that describes it, and the helper that turns the two into the
9750
+ * JSON the engine stores.
9751
+ *
9752
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
9753
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
9754
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
9755
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
9756
+ * never a field name (D879).
9757
+ */
9758
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
9759
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
9760
+ var RecordIndexSchema = object({
9761
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
9762
+ fields: array(RecordFieldPathSchema).min(1).max(4),
9763
+ unique: boolean().optional()
9764
+ }).strict();
9765
+ var RecordRetentionSchema = union([
9766
+ object({
9767
+ ttlMs: number().int().positive(),
9768
+ from: _enum(["at", "write"])
9769
+ }).strict(),
9770
+ object({
9771
+ maxRows: number().int().positive().optional(),
9772
+ maxRowsPerDevice: number().int().positive().optional()
9773
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
9774
+ object({
9775
+ owner: string().min(1),
9776
+ reason: string().min(1)
9777
+ }).strict(),
9778
+ object({ none: string().min(1) }).strict()
9779
+ ]);
9780
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
9781
+ var EntryDescriptorSchema = object({
9782
+ title: string().min(1),
9783
+ /** The record body field shown as the entry's name. */
9784
+ nameField: string().min(1),
9785
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
9786
+ fields: record(string(), unknown())
9787
+ }).strict();
9788
+ /** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
9789
+ var RecordKindDeclarationSchema = object({
9790
+ database: _enum(RECORD_DATABASES).default("settings"),
9791
+ class: _enum(RECORD_CLASSES),
9792
+ writeTrigger: string().min(1),
9793
+ device: _enum([
9794
+ "required",
9795
+ "optional",
9796
+ "none"
9797
+ ]).default("none"),
9798
+ at: _enum(["required", "none"]).default("none"),
9799
+ indexes: array(RecordIndexSchema).max(8).default([]),
9800
+ retention: RecordRetentionSchema,
9801
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
9802
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
9803
+ /** Derived from the Zod schema; never written by hand. */
9804
+ secretPaths: array(string().min(1)).default([]),
9805
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
9806
+ secretArrayKeys: record(string(), string()).default({}),
9807
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
9808
+ transactFamily: string().min(1).optional(),
9809
+ entry: EntryDescriptorSchema.optional()
9810
+ }).strict();
9811
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
9812
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
9813
+ /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
9814
+ function assertValidDeclaration(name, decl) {
9815
+ const refuse = (why) => {
9816
+ throw new DeclarationRefusedError(`kind "${name}": ${why}`);
9817
+ };
9818
+ if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
9819
+ const seen = /* @__PURE__ */ new Set();
9820
+ for (const index of decl.indexes) {
9821
+ if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
9822
+ seen.add(index.name);
9823
+ }
9824
+ const { retention } = decl;
9825
+ const hasSecrets = decl.secretPaths.length > 0;
9826
+ if ("ttlMs" in retention) {
9827
+ if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
9828
+ if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
9829
+ }
9830
+ if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
9831
+ if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
9832
+ if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
9833
+ if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
9834
+ const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
9835
+ 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)`);
9836
+ }
9837
+ if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
9838
+ 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`);
9839
+ }
9840
+ function bodyFieldsOf(schema) {
9841
+ return { ...toJSONSchema(schema, {
9842
+ unrepresentable: "any",
9843
+ io: "input"
9844
+ }) };
9845
+ }
9846
+ function isRecordLike(value) {
9847
+ return typeof value === "object" && value !== null && !Array.isArray(value);
9848
+ }
9849
+ /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
9850
+ function hasNameField(json, field) {
9851
+ const branches = json["oneOf"] ?? json["anyOf"];
9852
+ if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
9853
+ const properties = json["properties"];
9854
+ return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
9855
+ }
9856
+ /**
9857
+ * Declare the kinds of a package. The keys are the kind names. The result is
9858
+ * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
9859
+ * types its handle from.
9860
+ */
9861
+ function defineRecordKinds(specs) {
9862
+ const out = {};
9863
+ for (const [name, spec] of Object.entries(specs)) {
9864
+ const secretPaths = collectZodSecretPaths(spec.schema);
9865
+ const nameField = spec.entry?.nameField ?? "name";
9866
+ const fields = bodyFieldsOf(spec.schema);
9867
+ if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
9868
+ const parsed = RecordKindDeclarationSchema.parse({
9869
+ database: spec.database,
9870
+ class: spec.class,
9871
+ writeTrigger: spec.writeTrigger,
9872
+ device: spec.device,
9873
+ at: spec.at,
9874
+ indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
9875
+ retention: spec.retention,
9876
+ deviceRemoval: spec.deviceRemoval,
9877
+ maxDataBytes: spec.maxDataBytes,
9878
+ secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
9879
+ secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
9880
+ transactFamily: spec.transactFamily,
9881
+ entry: spec.entry === void 0 ? void 0 : {
9882
+ title: spec.entry.title,
9883
+ nameField,
9884
+ fields
9885
+ }
9886
+ });
9887
+ assertValidDeclaration(name, parsed);
9888
+ out[name] = {
9889
+ name,
9890
+ schema: spec.schema,
9891
+ declaration: parsed
9892
+ };
9893
+ }
9894
+ return out;
9895
+ }
9896
+ /**
9897
+ * Declare one entry kind. An entry is configuration: never trimmed by the
9898
+ * engine, never aged, belonging to no device.
9899
+ */
9900
+ function defineEntryKind(name, spec) {
9901
+ const defined = defineRecordKinds({ [name]: {
9902
+ schema: spec.schema,
9903
+ class: "config",
9904
+ writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
9905
+ retention: { none: "an entry goes only when the operator deletes it" },
9906
+ ...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
9907
+ ...spec.database === void 0 ? {} : { database: spec.database },
9908
+ ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
9909
+ ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
9910
+ ...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
9911
+ entry: {
9912
+ title: spec.title,
9913
+ ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
9914
+ }
9915
+ } })[name];
9916
+ if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
9917
+ return defined;
9918
+ }
9919
+ /**
9920
+ * The share-view scope kinds a share-link token can carry. The hub mints
9921
+ * and validates them (`ShareViewGrantSchema` builds its
9922
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
9923
+ */
9924
+ var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
9925
+ /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
9926
+ var PeerBytesTicketSchema = object({
9927
+ /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
9928
+ url: string().min(1),
9929
+ /**
9930
+ * The HOST node this URL means something on — the hub or a named agent,
9931
+ * never a runner. {@link AddonPeerBytes.open} compares it to its own and
9932
+ * refuses `cross-node` by name when they differ, without dialling.
9933
+ */
9934
+ hostNodeId: string().min(1),
9935
+ expiresAtMs: number().int().nonnegative(),
9936
+ /**
9937
+ * What the producer DECLARED the body to be, when it knows — `null` when it
9938
+ * does not. Never `0` for unknown (D393): a consumer sizing a bound off this
9939
+ * must be able to tell "the producer did not say" from "the body is empty".
9940
+ */
9941
+ declaredBytes: number().int().nonnegative().nullable()
9942
+ });
9881
9943
  var READING_QUANTITIES = [
9882
9944
  "temperature",
9883
9945
  "pressure",
@@ -10478,7 +10540,6 @@ var CAP_NAMES = Object.freeze([
10478
10540
  "climate-control",
10479
10541
  "color",
10480
10542
  "composer",
10481
- "connection-test",
10482
10543
  "connectivity",
10483
10544
  "consumables",
10484
10545
  "contact",
@@ -10568,7 +10629,6 @@ var CAP_NAMES = Object.freeze([
10568
10629
  "notifier",
10569
10630
  "numeric-sensor",
10570
10631
  "oauth-integration",
10571
- "oidc-connections",
10572
10632
  "osd",
10573
10633
  "osd-manager",
10574
10634
  "pet-feeder",
@@ -12460,8 +12520,7 @@ Object.freeze({
12460
12520
  "device-provider": { "reloadDevice": 18e4 },
12461
12521
  "llm": {
12462
12522
  "generate": 6e5,
12463
- "generateVision": 6e5,
12464
- "testProfile": 6e5
12523
+ "generateVision": 6e5
12465
12524
  },
12466
12525
  "llm-runtime": {
12467
12526
  "complete": 6e5,
@@ -12498,8 +12557,7 @@ Object.freeze({
12498
12557
  "offerArtifact": 3e5,
12499
12558
  "readResult": 3e5,
12500
12559
  "submitJob": 18e5,
12501
- "uploadDataset": 72e5,
12502
- "validateCredentials": 3e4
12560
+ "uploadDataset": 72e5
12503
12561
  }
12504
12562
  });
12505
12563
  object({
@@ -13971,6 +14029,414 @@ function buildCapturingReply(envelope) {
13971
14029
  };
13972
14030
  return wrapper;
13973
14031
  }
14032
+ /**
14033
+ * notification-output — canonical, capability-gated notification delivery.
14034
+ *
14035
+ * Apprise-derived model (see
14036
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14037
+ * callers emit ONE canonical `Notification`; each provider declares a
14038
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
14039
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14040
+ * message to what the kind supports — callers never special-case a service.
14041
+ *
14042
+ * DESIGN DECISIONS (locked):
14043
+ * - A target is an INSTANCE of this function cap (epic #440, step 6): the
14044
+ * providers serve their targets as `integration-instances` records, one
14045
+ * record kind per target kind, and the admin lists, adds, edits, switches
14046
+ * and deletes them through that cap. This cap keeps what an instance cannot
14047
+ * say: the kind catalogue (`listTargetKinds`: capabilities, delivery
14048
+ * parameters, brand icon), dispatch (`send`, `testTarget`) and the form
14049
+ * helpers (`discoverTargets`, `probeTargetConfig`).
14050
+ * - `listTargetKinds` / `discoverTargets` return arrays → the generated
14051
+ * cap-mount auto-`concatCollection`-fans them across every registered
14052
+ * provider so one catalog is routable. `send` / `testTarget` /
14053
+ * `probeTargetConfig` route to ONE provider by the `addonId` the generated
14054
+ * collection router extracts from the call input.
14055
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14056
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14057
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
14058
+ * base64 fallback needed.
14059
+ *
14060
+ * TODO (deferred, closed-set change — separate decision): add
14061
+ * `providerKind: 'notify'` so notification providers surface on the unified
14062
+ * admin "Integrations" page.
14063
+ */
14064
+ /**
14065
+ * Zentik-derived typed-media enum — the superset across every kind. Each
14066
+ * adapter picks what it supports and the degrade engine filters the rest.
14067
+ */
14068
+ var AttachmentMediaTypeSchema = _enum([
14069
+ "image",
14070
+ "video",
14071
+ "gif",
14072
+ "audio",
14073
+ "icon"
14074
+ ]);
14075
+ /**
14076
+ * A single attachment. Exactly one of `url` (remote source, most adapters
14077
+ * prefer this) or `bytes` (inline source; required for Pushover-style
14078
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
14079
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
14080
+ */
14081
+ var AttachmentSchema = object({
14082
+ mediaType: AttachmentMediaTypeSchema,
14083
+ url: string().optional(),
14084
+ bytes: _instanceof(Uint8Array).optional(),
14085
+ mime: string().optional(),
14086
+ name: string().optional()
14087
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14088
+ var NotificationFormatSchema = _enum([
14089
+ "text",
14090
+ "markdown",
14091
+ "html"
14092
+ ]);
14093
+ /**
14094
+ * The CLOSED icon vocabulary an action button may use.
14095
+ *
14096
+ * A closed set, not a free string, and that is the whole point: an arbitrary
14097
+ * icon name is one that ntfy renders, zentik silently drops, and nobody
14098
+ * notices — the same class of gap as a zone vocabulary nothing produced
14099
+ * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
14100
+ * declares `actionIcons: false` and the degrade engine strips the field.
14101
+ *
14102
+ * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
14103
+ * renderer's icon set; "acknowledge" survives an adapter that draws it
14104
+ * differently.
14105
+ *
14106
+ * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
14107
+ *
14108
+ * These names are for US. **No adapter may forward one verbatim.** Each maps
14109
+ * the whole set onto its own renderer's vocabulary through a
14110
+ * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
14111
+ * fallback, so adding a member here fails every adapter's build until someone
14112
+ * decides its glyph, which is the only place that decision can be made
14113
+ * honestly.
14114
+ *
14115
+ * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
14116
+ * `disarm` straight through; iOS feeds that string to
14117
+ * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
14118
+ * and every snooze and alarm button arrived BLANK. A pass-through is not a
14119
+ * mapping, and "the field is documented" is not "the value renders".
14120
+ *
14121
+ * Adding a member is TRAIN-BOUND. The enum lives in the published
14122
+ * `@camstack/server` closure and the cap seam validates against the HUB's copy,
14123
+ * so an addon that emits a token the running hub does not know does not lose an
14124
+ * icon — its whole `send` fails Zod validation and the notification never
14125
+ * arrives. Never emit a new token from an addon before the train carrying it.
14126
+ */
14127
+ var NotificationActionIconSchema = _enum([
14128
+ "acknowledge",
14129
+ "dismiss",
14130
+ "silence",
14131
+ "snooze",
14132
+ "view",
14133
+ "play",
14134
+ "open",
14135
+ "close",
14136
+ "lock",
14137
+ "unlock",
14138
+ "arm",
14139
+ "arm-home",
14140
+ "arm-away",
14141
+ "arm-night",
14142
+ "disarm",
14143
+ "light",
14144
+ "alert",
14145
+ "camera"
14146
+ ]);
14147
+ /** A single tap-through action button. */
14148
+ var NotificationActionSchema = object({
14149
+ id: string(),
14150
+ label: string(),
14151
+ url: string().optional(),
14152
+ /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
14153
+ icon: NotificationActionIconSchema.optional(),
14154
+ /**
14155
+ * Renders in a warning style where the notifier supports it.
14156
+ *
14157
+ * A HINT, never a gate. The callback's authority is its token and nothing
14158
+ * else — see `notification-center/action-token.ts` for what that does and
14159
+ * does not buy.
14160
+ */
14161
+ destructive: boolean().optional(),
14162
+ /**
14163
+ * How the tap should REACH the url.
14164
+ *
14165
+ * `navigate` (absent, and every button authored before this field) opens it:
14166
+ * the phone leaves the notification and shows whatever the callback returns.
14167
+ * That is right for a button whose answer the operator wants to read.
14168
+ *
14169
+ * `background` fires it as a POST and stays put. It exists for the buttons
14170
+ * whose whole point is not to interrupt — "silence this for 30 minutes" is
14171
+ * an answer to the notification, and being thrown into a browser tab to
14172
+ * confirm it costs more attention than the notification did. A backend that
14173
+ * cannot do a background call renders it as an ordinary link (the adapters
14174
+ * fall back rather than dropping the button), so this is a preference, never
14175
+ * a requirement.
14176
+ */
14177
+ mode: _enum(["navigate", "background"]).optional()
14178
+ });
14179
+ /** A delivery parameter value: what a notifier declared it takes. */
14180
+ var DeliveryParamValueSchema = union([
14181
+ string(),
14182
+ number(),
14183
+ boolean()
14184
+ ]);
14185
+ /**
14186
+ * One extra delivery parameter a notifier KIND declares (D938). A rule that
14187
+ * addresses a target of that kind may set it; a kind that declares nothing is
14188
+ * never handed one. The admin UI derives its control from this descriptor —
14189
+ * no editor knows a service by name.
14190
+ *
14191
+ * Optional fields are `.optional()`, never `.default()` (a Zod default does not
14192
+ * run on the addon cap path).
14193
+ */
14194
+ var DeliveryParamSchema = object({
14195
+ key: string().min(1),
14196
+ label: string(),
14197
+ /** i18n key of the label, resolved by the declaring addon's namespace. */
14198
+ labelKey: string().optional(),
14199
+ type: _enum([
14200
+ "enum",
14201
+ "number",
14202
+ "boolean",
14203
+ "string"
14204
+ ]),
14205
+ /** `enum` only: the closed set of accepted values. */
14206
+ options: array(object({
14207
+ value: string(),
14208
+ label: string()
14209
+ })).optional(),
14210
+ /** `number` only. */
14211
+ min: number().optional(),
14212
+ max: number().optional(),
14213
+ /** What the notifier does when the rule sets nothing; shown as the placeholder. */
14214
+ default: DeliveryParamValueSchema.optional()
14215
+ });
14216
+ /**
14217
+ * The canonical notification. `body` is the only hard field (Apprise model).
14218
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14219
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14220
+ * the adapter maps this ordinal onto its native level. `level?` is an
14221
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
14222
+ * `priority` for that one target.
14223
+ */
14224
+ var NotificationSchema = object({
14225
+ body: string(),
14226
+ title: string().optional(),
14227
+ format: NotificationFormatSchema.default("text"),
14228
+ priority: number().int().min(1).max(5).default(3),
14229
+ level: string().optional(),
14230
+ attachments: array(AttachmentSchema).optional(),
14231
+ clickUrl: string().optional(),
14232
+ actions: array(NotificationActionSchema).optional(),
14233
+ sound: string().optional(),
14234
+ ttl: number().optional(),
14235
+ tag: string().optional(),
14236
+ deviceId: number().optional(),
14237
+ eventId: string().optional(),
14238
+ metadata: record(string(), unknown()).optional(),
14239
+ /**
14240
+ * Values for the parameters the target's kind DECLARES in
14241
+ * {@link TargetKindSchema} `deliveryParams`. Already validated against the
14242
+ * declaration by the sender; a notifier reads only the keys it declared.
14243
+ */
14244
+ delivery: record(string(), DeliveryParamValueSchema).optional()
14245
+ });
14246
+ /** One declared native severity/priority level for a kind. */
14247
+ var TargetKindLevelSchema = object({
14248
+ id: string(),
14249
+ label: string(),
14250
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14251
+ ordinal: number().int().min(1).max(5).nullable(),
14252
+ flags: object({
14253
+ critical: boolean().optional(),
14254
+ silent: boolean().optional(),
14255
+ noPush: boolean().optional()
14256
+ }).optional(),
14257
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14258
+ requires: array(string()).optional(),
14259
+ description: string().optional()
14260
+ });
14261
+ /** The full capability block consulted before dispatch. */
14262
+ var TargetKindCapsSchema = object({
14263
+ attachments: object({
14264
+ mediaTypes: array(AttachmentMediaTypeSchema),
14265
+ mode: _enum([
14266
+ "url",
14267
+ "bytes",
14268
+ "both"
14269
+ ]),
14270
+ max: number().int().nonnegative(),
14271
+ maxBytes: number().int().positive().optional()
14272
+ }),
14273
+ /** Max action buttons (0 = none). */
14274
+ actions: number().int().nonnegative(),
14275
+ /**
14276
+ * Whether this kind renders a per-action ICON.
14277
+ *
14278
+ * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
14279
+ * run on the addon cap path — three production failures in one day taught
14280
+ * this repo that once. Absent is read as false by the degrade engine, which
14281
+ * is the safe direction: an icon that is not rendered costs nothing, an icon
14282
+ * assumed and dropped costs the operator's trust in the field.
14283
+ */
14284
+ actionIcons: boolean().optional(),
14285
+ levels: array(TargetKindLevelSchema),
14286
+ format: array(NotificationFormatSchema),
14287
+ clickUrl: boolean(),
14288
+ sound: boolean(),
14289
+ ttl: boolean(),
14290
+ bodyMaxLen: number().int().positive()
14291
+ });
14292
+ /**
14293
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14294
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14295
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14296
+ * the union is large and not meant for runtime validation here; the exported
14297
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14298
+ */
14299
+ var ConfigSchemaPassthrough$3 = unknown();
14300
+ var TargetKindSchema = object({
14301
+ kind: string(),
14302
+ label: string(),
14303
+ icon: string(),
14304
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
14305
+ addonId: string(),
14306
+ /**
14307
+ * URL of the kind's bundled BRAND icon, served by the providing addon over
14308
+ * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
14309
+ * when the addon bundles no icon for that kind — the client then falls back
14310
+ * to a neutral glyph rather than rendering the raw `icon` NAME as text.
14311
+ *
14312
+ * Root-relative on purpose: it resolves against whatever origin serves a web
14313
+ * client, and a native client joins it onto its own hub base.
14314
+ *
14315
+ * DECLARED here deliberately. It used to travel as an undeclared passthrough
14316
+ * field that survived only because the runtime cap-router forwards provider
14317
+ * output verbatim — so every consumer had to re-declare it by hand to stop
14318
+ * its own Zod parse from stripping it, and the whole arrangement would have
14319
+ * broken silently the moment output validation was tightened anywhere.
14320
+ */
14321
+ iconUrl: string().optional(),
14322
+ /**
14323
+ * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
14324
+ *
14325
+ * The server knows this and therefore says it, because the client cannot
14326
+ * safely guess: a React-Native client renders SVG and raster through two
14327
+ * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
14328
+ * not decode SVG on iOS/Android), so without this it silently fell back to a
14329
+ * placeholder glyph for every vector icon while the web build looked fine.
14330
+ *
14331
+ * Absent when {@link iconUrl} is absent, or for a legacy provider that has
14332
+ * not been updated — a client that cannot determine the type should prefer
14333
+ * its raster path, which is the safe default for an unknown image.
14334
+ */
14335
+ iconMediaType: string().optional(),
14336
+ configSchema: ConfigSchemaPassthrough$3,
14337
+ /**
14338
+ * The config keys that decide WHERE this kind's secrets are sent (server,
14339
+ * base URL, instance, chat, recipient). A save that changes any of them
14340
+ * while leaving a secret redacted is refused by the provider (D634), so an
14341
+ * editor uses this to ask for the secret on exactly those edits instead of
14342
+ * on every edit.
14343
+ *
14344
+ * Optional: absent from a provider that holds no secret (the Home Assistant
14345
+ * kinds) and from a provider older than this field — an editor that finds
14346
+ * it absent must assume ANY edit may need the secret.
14347
+ */
14348
+ destinationKeys: array(string()).optional(),
14349
+ supportsDiscovery: boolean(),
14350
+ /**
14351
+ * Extra delivery parameters a rule may set for a target of this kind (D938).
14352
+ * Absent = none; the rule editor then offers nothing.
14353
+ */
14354
+ deliveryParams: array(DeliveryParamSchema).optional(),
14355
+ caps: TargetKindCapsSchema
14356
+ });
14357
+ /**
14358
+ * A target as a provider's own code sees it (the notification-center bridge, the
14359
+ * send path): the flat record body split into the name, the switch and the
14360
+ * kind's fields. `config` holds secrets; a reader that serves it to a client
14361
+ * REDACTS secret fields (a presence marker only) — never round-trip a stored
14362
+ * secret to the UI.
14363
+ */
14364
+ var TargetSchema = object({
14365
+ id: string(),
14366
+ name: string(),
14367
+ kind: string(),
14368
+ addonId: string(),
14369
+ enabled: boolean(),
14370
+ config: record(string(), unknown())
14371
+ });
14372
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
14373
+ var DiscoveredTargetSchema = object({
14374
+ kind: string(),
14375
+ suggestedName: string(),
14376
+ config: record(string(), unknown())
14377
+ });
14378
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
14379
+ var RenderedAsSchema = object({
14380
+ level: string(),
14381
+ format: NotificationFormatSchema,
14382
+ attachmentsSent: number().int().nonnegative(),
14383
+ actionsSent: number().int().nonnegative(),
14384
+ truncated: boolean(),
14385
+ dropped: array(string())
14386
+ });
14387
+ var SendResultSchema = object({
14388
+ success: boolean(),
14389
+ error: string().optional(),
14390
+ renderedAs: RenderedAsSchema.optional()
14391
+ });
14392
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
14393
+ var TestResultSchema = SendResultSchema;
14394
+ /**
14395
+ * Pre-save credential probe against a partial (unsaved) target config.
14396
+ * `resolvedUrl` never includes secrets (token stripped from path).
14397
+ */
14398
+ var ProbeTargetConfigResultSchema = object({
14399
+ ok: boolean(),
14400
+ resolvedUrl: string(),
14401
+ httpStatus: number().int().optional(),
14402
+ stateInstance: string().optional(),
14403
+ error: string().optional()
14404
+ });
14405
+ method(object({}), array(TargetKindSchema)), method(object({
14406
+ kind: string(),
14407
+ config: record(string(), unknown()).optional(),
14408
+ /**
14409
+ * When editing / duplicating, the blank password field never round-trips
14410
+ * the stored token. Pass the source target id so the provider can restore
14411
+ * secrets server-side before dialling.
14412
+ */
14413
+ targetId: string().optional()
14414
+ }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
14415
+ kind: string(),
14416
+ config: record(string(), unknown()),
14417
+ /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
14418
+ targetId: string().optional()
14419
+ }), ProbeTargetConfigResultSchema, {
14420
+ kind: "mutation",
14421
+ auth: "admin"
14422
+ }), method(object({
14423
+ targetId: string(),
14424
+ notification: NotificationSchema
14425
+ }), SendResultSchema, {
14426
+ kind: "mutation",
14427
+ auth: "admin"
14428
+ }), method(object({
14429
+ targetId: string(),
14430
+ sample: NotificationSchema.optional()
14431
+ }), TestResultSchema, {
14432
+ kind: "mutation",
14433
+ auth: "admin"
14434
+ });
14435
+ looseObject({
14436
+ name: string().min(1),
14437
+ enabled: boolean().optional()
14438
+ });
14439
+ TargetSchema.omit({ id: true });
13974
14440
  var EncodeProfileSchema = object({
13975
14441
  video: object({
13976
14442
  codec: _enum([
@@ -22358,7 +22824,6 @@ var SYSTEM_CAP_VOCABULARY = {
22358
22824
  "calendar-source": system(INTERNAL),
22359
22825
  calendars: system("calendars feed schedules and conditions, not device actions"),
22360
22826
  composer: system("device composition — an authoring tool, not an action"),
22361
- "connection-test": system(INTERNAL),
22362
22827
  "core-blocks": system(INTERNAL),
22363
22828
  "custom-model-registry": system(ML),
22364
22829
  "data-store-provider": system(INTERNAL),
@@ -22403,7 +22868,6 @@ var SYSTEM_CAP_VOCABULARY = {
22403
22868
  "notification-output": system("notification delivery — reached through notifier devices and rules"),
22404
22869
  "notification-rules": system("notification rules — authored on their own page"),
22405
22870
  "oauth-integration": system(IDENTITY),
22406
- "oidc-connections": system(IDENTITY),
22407
22871
  "osd-manager": system(PIPELINE),
22408
22872
  "pipeline-executor": system(PIPELINE),
22409
22873
  "pipeline-orchestrator": system(PIPELINE),
@@ -44275,427 +44739,6 @@ var UnitWarningSchema = object({
44275
44739
  assumedUnit: string(),
44276
44740
  message: string()
44277
44741
  });
44278
- /**
44279
- * notification-output — canonical, capability-gated notification delivery.
44280
- *
44281
- * Apprise-derived model (see
44282
- * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
44283
- * callers emit ONE canonical `Notification`; each provider declares a
44284
- * per-kind capability descriptor (`TargetKind`), and the pure degrade
44285
- * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
44286
- * message to what the kind supports — callers never special-case a service.
44287
- *
44288
- * DESIGN DECISIONS (locked):
44289
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
44290
- * `setTargetEnabled`), each provider persisting via the `settings-store`
44291
- * cap. Rationale: the admin UI needs one uniform surface across the
44292
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
44293
- * alternative would fork the UI per addon and cannot host the
44294
- * discovery→adopt flow.
44295
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
44296
- * the generated cap-mount auto-`concatCollection`-fans them across every
44297
- * registered provider (notifiers addon + HA addon) so one catalog is
44298
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
44299
- * `addonId` the generated collection router extracts from the call input.
44300
- * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
44301
- * transformer) + UDS MsgPack both round-trip typed arrays — already used by
44302
- * `storage` / `storage-provider` / `recording` caps over the same path. No
44303
- * base64 fallback needed.
44304
- *
44305
- * TODO (deferred, closed-set change — separate decision): add
44306
- * `providerKind: 'notify'` so notification providers surface on the unified
44307
- * admin "Integrations" page.
44308
- */
44309
- /**
44310
- * Zentik-derived typed-media enum — the superset across every kind. Each
44311
- * adapter picks what it supports and the degrade engine filters the rest.
44312
- */
44313
- var AttachmentMediaTypeSchema = _enum([
44314
- "image",
44315
- "video",
44316
- "gif",
44317
- "audio",
44318
- "icon"
44319
- ]);
44320
- /**
44321
- * A single attachment. Exactly one of `url` (remote source, most adapters
44322
- * prefer this) or `bytes` (inline source; required for Pushover-style
44323
- * bytes-only kinds) MUST be present — the degrade engine expresses a
44324
- * url→bytes fetch as a `needsFetch` directive the adapter executes.
44325
- */
44326
- var AttachmentSchema = object({
44327
- mediaType: AttachmentMediaTypeSchema,
44328
- url: string().optional(),
44329
- bytes: _instanceof(Uint8Array).optional(),
44330
- mime: string().optional(),
44331
- name: string().optional()
44332
- }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
44333
- var NotificationFormatSchema = _enum([
44334
- "text",
44335
- "markdown",
44336
- "html"
44337
- ]);
44338
- /**
44339
- * The CLOSED icon vocabulary an action button may use.
44340
- *
44341
- * A closed set, not a free string, and that is the whole point: an arbitrary
44342
- * icon name is one that ntfy renders, zentik silently drops, and nobody
44343
- * notices — the same class of gap as a zone vocabulary nothing produced
44344
- * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
44345
- * declares `actionIcons: false` and the degrade engine strips the field.
44346
- *
44347
- * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
44348
- * renderer's icon set; "acknowledge" survives an adapter that draws it
44349
- * differently.
44350
- *
44351
- * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
44352
- *
44353
- * These names are for US. **No adapter may forward one verbatim.** Each maps
44354
- * the whole set onto its own renderer's vocabulary through a
44355
- * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
44356
- * fallback, so adding a member here fails every adapter's build until someone
44357
- * decides its glyph, which is the only place that decision can be made
44358
- * honestly.
44359
- *
44360
- * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
44361
- * `disarm` straight through; iOS feeds that string to
44362
- * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
44363
- * and every snooze and alarm button arrived BLANK. A pass-through is not a
44364
- * mapping, and "the field is documented" is not "the value renders".
44365
- *
44366
- * Adding a member is TRAIN-BOUND. The enum lives in the published
44367
- * `@camstack/server` closure and the cap seam validates against the HUB's copy,
44368
- * so an addon that emits a token the running hub does not know does not lose an
44369
- * icon — its whole `send` fails Zod validation and the notification never
44370
- * arrives. Never emit a new token from an addon before the train carrying it.
44371
- */
44372
- var NotificationActionIconSchema = _enum([
44373
- "acknowledge",
44374
- "dismiss",
44375
- "silence",
44376
- "snooze",
44377
- "view",
44378
- "play",
44379
- "open",
44380
- "close",
44381
- "lock",
44382
- "unlock",
44383
- "arm",
44384
- "arm-home",
44385
- "arm-away",
44386
- "arm-night",
44387
- "disarm",
44388
- "light",
44389
- "alert",
44390
- "camera"
44391
- ]);
44392
- /** A single tap-through action button. */
44393
- var NotificationActionSchema = object({
44394
- id: string(),
44395
- label: string(),
44396
- url: string().optional(),
44397
- /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
44398
- icon: NotificationActionIconSchema.optional(),
44399
- /**
44400
- * Renders in a warning style where the notifier supports it.
44401
- *
44402
- * A HINT, never a gate. The callback's authority is its token and nothing
44403
- * else — see `notification-center/action-token.ts` for what that does and
44404
- * does not buy.
44405
- */
44406
- destructive: boolean().optional(),
44407
- /**
44408
- * How the tap should REACH the url.
44409
- *
44410
- * `navigate` (absent, and every button authored before this field) opens it:
44411
- * the phone leaves the notification and shows whatever the callback returns.
44412
- * That is right for a button whose answer the operator wants to read.
44413
- *
44414
- * `background` fires it as a POST and stays put. It exists for the buttons
44415
- * whose whole point is not to interrupt — "silence this for 30 minutes" is
44416
- * an answer to the notification, and being thrown into a browser tab to
44417
- * confirm it costs more attention than the notification did. A backend that
44418
- * cannot do a background call renders it as an ordinary link (the adapters
44419
- * fall back rather than dropping the button), so this is a preference, never
44420
- * a requirement.
44421
- */
44422
- mode: _enum(["navigate", "background"]).optional()
44423
- });
44424
- /** A delivery parameter value: what a notifier declared it takes. */
44425
- var DeliveryParamValueSchema = union([
44426
- string(),
44427
- number(),
44428
- boolean()
44429
- ]);
44430
- /**
44431
- * One extra delivery parameter a notifier KIND declares (D938). A rule that
44432
- * addresses a target of that kind may set it; a kind that declares nothing is
44433
- * never handed one. The admin UI derives its control from this descriptor —
44434
- * no editor knows a service by name.
44435
- *
44436
- * Optional fields are `.optional()`, never `.default()` (a Zod default does not
44437
- * run on the addon cap path).
44438
- */
44439
- var DeliveryParamSchema = object({
44440
- key: string().min(1),
44441
- label: string(),
44442
- /** i18n key of the label, resolved by the declaring addon's namespace. */
44443
- labelKey: string().optional(),
44444
- type: _enum([
44445
- "enum",
44446
- "number",
44447
- "boolean",
44448
- "string"
44449
- ]),
44450
- /** `enum` only: the closed set of accepted values. */
44451
- options: array(object({
44452
- value: string(),
44453
- label: string()
44454
- })).optional(),
44455
- /** `number` only. */
44456
- min: number().optional(),
44457
- max: number().optional(),
44458
- /** What the notifier does when the rule sets nothing; shown as the placeholder. */
44459
- default: DeliveryParamValueSchema.optional()
44460
- });
44461
- /**
44462
- * The canonical notification. `body` is the only hard field (Apprise model).
44463
- * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
44464
- * NOT a fixed severity enum — each kind declares its own `caps.levels` and
44465
- * the adapter maps this ordinal onto its native level. `level?` is an
44466
- * optional kind-native level id (`emergency`, `silent`, …) that overrides
44467
- * `priority` for that one target.
44468
- */
44469
- var NotificationSchema = object({
44470
- body: string(),
44471
- title: string().optional(),
44472
- format: NotificationFormatSchema.default("text"),
44473
- priority: number().int().min(1).max(5).default(3),
44474
- level: string().optional(),
44475
- attachments: array(AttachmentSchema).optional(),
44476
- clickUrl: string().optional(),
44477
- actions: array(NotificationActionSchema).optional(),
44478
- sound: string().optional(),
44479
- ttl: number().optional(),
44480
- tag: string().optional(),
44481
- deviceId: number().optional(),
44482
- eventId: string().optional(),
44483
- metadata: record(string(), unknown()).optional(),
44484
- /**
44485
- * Values for the parameters the target's kind DECLARES in
44486
- * {@link TargetKindSchema} `deliveryParams`. Already validated against the
44487
- * declaration by the sender; a notifier reads only the keys it declared.
44488
- */
44489
- delivery: record(string(), DeliveryParamValueSchema).optional()
44490
- });
44491
- /** One declared native severity/priority level for a kind. */
44492
- var TargetKindLevelSchema = object({
44493
- id: string(),
44494
- label: string(),
44495
- /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
44496
- ordinal: number().int().min(1).max(5).nullable(),
44497
- flags: object({
44498
- critical: boolean().optional(),
44499
- silent: boolean().optional(),
44500
- noPush: boolean().optional()
44501
- }).optional(),
44502
- /** e.g. Pushover `emergency` requires `retry` / `expire`. */
44503
- requires: array(string()).optional(),
44504
- description: string().optional()
44505
- });
44506
- /** The full capability block consulted before dispatch. */
44507
- var TargetKindCapsSchema = object({
44508
- attachments: object({
44509
- mediaTypes: array(AttachmentMediaTypeSchema),
44510
- mode: _enum([
44511
- "url",
44512
- "bytes",
44513
- "both"
44514
- ]),
44515
- max: number().int().nonnegative(),
44516
- maxBytes: number().int().positive().optional()
44517
- }),
44518
- /** Max action buttons (0 = none). */
44519
- actions: number().int().nonnegative(),
44520
- /**
44521
- * Whether this kind renders a per-action ICON.
44522
- *
44523
- * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
44524
- * run on the addon cap path — three production failures in one day taught
44525
- * this repo that once. Absent is read as false by the degrade engine, which
44526
- * is the safe direction: an icon that is not rendered costs nothing, an icon
44527
- * assumed and dropped costs the operator's trust in the field.
44528
- */
44529
- actionIcons: boolean().optional(),
44530
- levels: array(TargetKindLevelSchema),
44531
- format: array(NotificationFormatSchema),
44532
- clickUrl: boolean(),
44533
- sound: boolean(),
44534
- ttl: boolean(),
44535
- bodyMaxLen: number().int().positive()
44536
- });
44537
- /**
44538
- * `configSchema` is a `ConfigUISchema` tree passed through to the admin
44539
- * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
44540
- * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
44541
- * the union is large and not meant for runtime validation here; the exported
44542
- * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
44543
- */
44544
- var ConfigSchemaPassthrough$4 = unknown();
44545
- var TargetKindSchema = object({
44546
- kind: string(),
44547
- label: string(),
44548
- icon: string(),
44549
- /** Stamped by each provider so the concat-fanned catalog stays routable. */
44550
- addonId: string(),
44551
- /**
44552
- * URL of the kind's bundled BRAND icon, served by the providing addon over
44553
- * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
44554
- * when the addon bundles no icon for that kind — the client then falls back
44555
- * to a neutral glyph rather than rendering the raw `icon` NAME as text.
44556
- *
44557
- * Root-relative on purpose: it resolves against whatever origin serves a web
44558
- * client, and a native client joins it onto its own hub base.
44559
- *
44560
- * DECLARED here deliberately. It used to travel as an undeclared passthrough
44561
- * field that survived only because the runtime cap-router forwards provider
44562
- * output verbatim — so every consumer had to re-declare it by hand to stop
44563
- * its own Zod parse from stripping it, and the whole arrangement would have
44564
- * broken silently the moment output validation was tightened anywhere.
44565
- */
44566
- iconUrl: string().optional(),
44567
- /**
44568
- * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
44569
- *
44570
- * The server knows this and therefore says it, because the client cannot
44571
- * safely guess: a React-Native client renders SVG and raster through two
44572
- * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
44573
- * not decode SVG on iOS/Android), so without this it silently fell back to a
44574
- * placeholder glyph for every vector icon while the web build looked fine.
44575
- *
44576
- * Absent when {@link iconUrl} is absent, or for a legacy provider that has
44577
- * not been updated — a client that cannot determine the type should prefer
44578
- * its raster path, which is the safe default for an unknown image.
44579
- */
44580
- iconMediaType: string().optional(),
44581
- configSchema: ConfigSchemaPassthrough$4,
44582
- /**
44583
- * The config keys that decide WHERE this kind's secrets are sent (server,
44584
- * base URL, instance, chat, recipient). A save that changes any of them
44585
- * while leaving a secret redacted is refused by the provider (D634), so an
44586
- * editor uses this to ask for the secret on exactly those edits instead of
44587
- * on every edit.
44588
- *
44589
- * Optional: absent from a provider that holds no secret (the Home Assistant
44590
- * kinds) and from a provider older than this field — an editor that finds
44591
- * it absent must assume ANY edit may need the secret.
44592
- */
44593
- destinationKeys: array(string()).optional(),
44594
- supportsDiscovery: boolean(),
44595
- /**
44596
- * Extra delivery parameters a rule may set for a target of this kind (D938).
44597
- * Absent = none; the rule editor then offers nothing.
44598
- */
44599
- deliveryParams: array(DeliveryParamSchema).optional(),
44600
- caps: TargetKindCapsSchema
44601
- });
44602
- /**
44603
- * A persisted target. `config` holds secrets; providers REDACT secret fields
44604
- * (return a presence marker only) when serving `listTargets` — never
44605
- * round-trip a stored secret to the UI.
44606
- */
44607
- var TargetSchema = object({
44608
- id: string(),
44609
- name: string(),
44610
- kind: string(),
44611
- addonId: string(),
44612
- enabled: boolean(),
44613
- config: record(string(), unknown())
44614
- });
44615
- /** A discovery-surfaced candidate (config is partial + non-secret). */
44616
- var DiscoveredTargetSchema = object({
44617
- kind: string(),
44618
- suggestedName: string(),
44619
- config: record(string(), unknown())
44620
- });
44621
- /** The degrade engine's report — what was resolved / dropped / degraded. */
44622
- var RenderedAsSchema = object({
44623
- level: string(),
44624
- format: NotificationFormatSchema,
44625
- attachmentsSent: number().int().nonnegative(),
44626
- actionsSent: number().int().nonnegative(),
44627
- truncated: boolean(),
44628
- dropped: array(string())
44629
- });
44630
- var SendResultSchema = object({
44631
- success: boolean(),
44632
- error: string().optional(),
44633
- renderedAs: RenderedAsSchema.optional()
44634
- });
44635
- /** Same shape as SendResult — kept as a distinct name for the test panel. */
44636
- var TestResultSchema = SendResultSchema;
44637
- /**
44638
- * Pre-save credential probe against a partial (unsaved) target config.
44639
- * `resolvedUrl` never includes secrets (token stripped from path).
44640
- */
44641
- var ProbeTargetConfigResultSchema = object({
44642
- ok: boolean(),
44643
- resolvedUrl: string(),
44644
- httpStatus: number().int().optional(),
44645
- stateInstance: string().optional(),
44646
- error: string().optional()
44647
- });
44648
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
44649
- kind: string(),
44650
- config: record(string(), unknown()).optional(),
44651
- /**
44652
- * When editing / duplicating, the blank password field never round-trips
44653
- * the stored token. Pass the source target id so the provider can restore
44654
- * secrets server-side before dialling (same merge as upsert).
44655
- */
44656
- targetId: string().optional()
44657
- }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
44658
- kind: string(),
44659
- config: record(string(), unknown()),
44660
- /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
44661
- targetId: string().optional()
44662
- }), ProbeTargetConfigResultSchema, {
44663
- kind: "mutation",
44664
- auth: "admin"
44665
- }), method(object({
44666
- targetId: string(),
44667
- notification: NotificationSchema
44668
- }), SendResultSchema, {
44669
- kind: "mutation",
44670
- auth: "admin"
44671
- }), method(object({
44672
- targetId: string(),
44673
- sample: NotificationSchema.optional()
44674
- }), TestResultSchema, {
44675
- kind: "mutation",
44676
- auth: "admin"
44677
- }), method(object({
44678
- target: TargetSchema,
44679
- /**
44680
- * Duplicate flow: create a NEW target id while copying secrets from an
44681
- * existing row. The UI never holds the stored token; blank / redacted
44682
- * password fields are restored from this source (D634 still applies if
44683
- * destinations diverge without a re-typed secret).
44684
- */
44685
- cloneSecretsFrom: string().optional()
44686
- }), TargetSchema, {
44687
- kind: "mutation",
44688
- auth: "admin"
44689
- }), method(object({ targetId: string() }), _void(), {
44690
- kind: "mutation",
44691
- auth: "admin"
44692
- }), method(object({
44693
- targetId: string(),
44694
- enabled: boolean()
44695
- }), _void(), {
44696
- kind: "mutation",
44697
- auth: "admin"
44698
- });
44699
44742
  function errorText(err) {
44700
44743
  return err instanceof Error ? err.message : String(err);
44701
44744
  }
@@ -48659,37 +48702,6 @@ method(object({
48659
48702
  kind: "mutation",
48660
48703
  auth: "admin"
48661
48704
  }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
48662
- var ConnectionTestOutcomeSchema = discriminatedUnion("outcome", [
48663
- object({
48664
- outcome: literal("validated"),
48665
- /** Round-trip of the sign-in, when the provider measured it. */
48666
- latencyMs: number().nonnegative().optional(),
48667
- /** Optional human detail worth showing next to the tick
48668
- * ("3 devices visible on this account"). */
48669
- detail: string().optional()
48670
- }).strict(),
48671
- object({
48672
- outcome: literal("rejected"),
48673
- error: string()
48674
- }).strict(),
48675
- object({
48676
- outcome: literal("inconclusive"),
48677
- error: string()
48678
- }).strict()
48679
- ]);
48680
- var ConnectionTestInputSchema = object({
48681
- /** Candidate integration settings, exactly as the create form collected them. */
48682
- settings: record(string(), unknown()) });
48683
- /**
48684
- * What the provider's test actually DOES, so the UI can say it in words before
48685
- * the operator presses the button ("Signs in to the Dreo cloud"). Purely
48686
- * descriptive — it never changes routing.
48687
- */
48688
- var ConnectionTestDescriptorSchema = object({ label: string() });
48689
- method(ConnectionTestInputSchema, ConnectionTestOutcomeSchema, {
48690
- kind: "mutation",
48691
- auth: "admin"
48692
- }), method(_void(), ConnectionTestDescriptorSchema, { auth: "admin" });
48693
48705
  object({
48694
48706
  /** True when the upstream system considers the entity connected. */
48695
48707
  connected: boolean(),
@@ -54612,10 +54624,9 @@ var AvailableIntegrationTypeSchema = object({
54612
54624
  * locations" checkbox. Provider-declared in the addon manifest. */
54613
54625
  supportsLocationImport: boolean(),
54614
54626
  /**
54615
- * True when this integration DECLARES a pre-creation test (the
54616
- * `connection-test` cap, or a broker whose settings it stores). Drives the
54617
- * Test button: an integration that cannot be tested must say so up front
54618
- * rather than offering a button that always answers the same nonsense.
54627
+ * True when this integration's instances declare a Test (`integration-instances.describe().canTest`,
54628
+ * D1016). An integration that cannot be tested must say so up front rather than offering a
54629
+ * button that always answers the same nonsense.
54619
54630
  */
54620
54631
  canTest: boolean(),
54621
54632
  existingInstances: array(object({
@@ -54669,7 +54680,9 @@ var CreateIntegrationInputSchema = object({
54669
54680
  info: record(string(), unknown()).optional(),
54670
54681
  /** `stableId` of the discovery candidate the form was seeded from (D984). */
54671
54682
  originStableId: string().optional(),
54672
- settings: record(string(), unknown()).optional()
54683
+ settings: record(string(), unknown()).optional(),
54684
+ /** The instance kind being created, for a provider with several; omitted = its only testable kind. */
54685
+ kind: string().min(1).optional()
54673
54686
  });
54674
54687
  var UpdateIntegrationInputSchema = object({
54675
54688
  id: string(),
@@ -54695,13 +54708,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
54695
54708
  }), method(object({ id: string() }), DeleteIntegrationResultSchema, {
54696
54709
  kind: "mutation",
54697
54710
  auth: "admin"
54698
- }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" }), method(object({
54699
- addonId: string(),
54700
- settings: record(string(), unknown())
54701
- }), TestConnectionResultSchema, {
54702
- kind: "mutation",
54703
- auth: "admin"
54704
- });
54711
+ }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" });
54705
54712
  /**
54706
54713
  * `integration-instances` - the connection of an addon that holds ONE or SEVERAL
54707
54714
  * (an account, a relay, a destination) as typed records (D985, D986). The addon's
@@ -54721,7 +54728,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
54721
54728
  * or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
54722
54729
  * clears it.
54723
54730
  */
54724
- var ConfigSchemaPassthrough$3 = custom();
54731
+ var ConfigSchemaPassthrough$2 = custom();
54725
54732
  var IntegrationInstanceIdSchema = string().min(1);
54726
54733
  var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
54727
54734
  /**
@@ -54767,7 +54774,16 @@ var IntegrationInstanceKindSchema = object({
54767
54774
  /** Relative hub path to start an interactive account link of an instance of this kind. */
54768
54775
  connectPath: string().min(1).optional(),
54769
54776
  /** Relative hub path to disconnect that account. */
54770
- disconnectPath: string().min(1).optional()
54777
+ disconnectPath: string().min(1).optional(),
54778
+ /**
54779
+ * Parts of the edit dialog the flat form cannot draw (a node picker, a model source), named by a
54780
+ * GENERIC widget id the client maps to a component; a client that knows none of them shows none.
54781
+ * `connection` widgets write connection values, `model` widgets own the model choice.
54782
+ */
54783
+ widgets: array(object({
54784
+ id: string().min(1),
54785
+ placement: _enum(["connection", "model"])
54786
+ })).optional()
54771
54787
  });
54772
54788
  /**
54773
54789
  * How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
@@ -54872,7 +54888,7 @@ var integrationInstancesCapability = {
54872
54888
  id: IntegrationInstanceIdSchema.nullable(),
54873
54889
  /** The kind of the create form (`id: null`) of a provider with several. */
54874
54890
  kind: string().min(1).optional()
54875
- }), ConfigSchemaPassthrough$3, { auth: "admin" }),
54891
+ }), ConfigSchemaPassthrough$2, { auth: "admin" }),
54876
54892
  listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
54877
54893
  getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
54878
54894
  /**
@@ -55823,12 +55839,12 @@ var LlmModelInfoSchema = object({
55823
55839
  });
55824
55840
  /**
55825
55841
  * The provider-specific part of a profile, validated by the provider that owns
55826
- * the kind (`upsertProfile` refuses what it does not accept). A field its
55842
+ * the kind (saving an instance refuses what it does not accept). A field its
55827
55843
  * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
55828
55844
  * keychain, never in the row, and reads back as the redaction marker.
55829
55845
  */
55830
55846
  var LlmProviderConfigSchema = record(string(), unknown());
55831
- var LlmProfileSchema = object({
55847
+ object({
55832
55848
  id: string(),
55833
55849
  name: string(),
55834
55850
  /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
@@ -55922,8 +55938,8 @@ var LlmProviderWidgetSchema = object({
55922
55938
  /** ConfigUISchema tree passed through untyped on the wire (the
55923
55939
  * notification-output `ConfigSchemaPassthrough` precedent at
55924
55940
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
55925
- var ConfigSchemaPassthrough$2 = unknown();
55926
- var LlmProfileKindDescriptorSchema = object({
55941
+ var ConfigSchemaPassthrough$1 = unknown();
55942
+ object({
55927
55943
  kind: LlmProfileKindSchema,
55928
55944
  label: string(),
55929
55945
  /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
@@ -55931,9 +55947,9 @@ var LlmProfileKindDescriptorSchema = object({
55931
55947
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
55932
55948
  addonId: string(),
55933
55949
  /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
55934
- connectionSchema: ConfigSchemaPassthrough$2,
55950
+ connectionSchema: ConfigSchemaPassthrough$1,
55935
55951
  /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
55936
- advancedSchema: ConfigSchemaPassthrough$2.optional(),
55952
+ advancedSchema: ConfigSchemaPassthrough$1.optional(),
55937
55953
  /** The kind's defaults; a model from `listModels` may override any of them. */
55938
55954
  features: LlmModelFeaturesSchema,
55939
55955
  /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
@@ -56062,20 +56078,7 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
56062
56078
  }), method(object({
56063
56079
  addonId: string().optional(),
56064
56080
  requestId: string()
56065
- }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
56066
- kind: "mutation",
56067
- auth: "admin"
56068
- }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
56069
- kind: "mutation",
56070
- auth: "admin"
56071
- }), method(ProfileRefInputSchema, _void(), {
56072
- kind: "mutation",
56073
- auth: "admin"
56074
- }), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
56075
- kind: "mutation",
56076
- auth: "admin",
56077
- timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
56078
- }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
56081
+ }), _void(), { kind: "mutation" }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
56079
56082
  kind: "mutation",
56080
56083
  auth: "admin"
56081
56084
  }), method(object({}), array(LlmDefaultSchema)), method(object({
@@ -57070,20 +57073,7 @@ method(_void(), MeshStatusSchema), method(object({
57070
57073
  /** Optional hostname override the host should advertise once joined. */
57071
57074
  hostname: string().optional() }), object({
57072
57075
  /** Authentication URL the operator should open in a browser. */
57073
- 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({
57074
- /** Optional auth key — when provided, probes the key validity
57075
- * against the provider's API. Omit when already joined to
57076
- * just ping the daemon. */
57077
- authKey: string().optional() }), object({
57078
- ok: boolean(),
57079
- /** Provider-side identifier resolved by the probe (tailnet
57080
- * name for Tailscale, network id for ZeroTier, etc.). */
57081
- tenant: string().optional(),
57082
- /** Daemon binary version, when reachable. */
57083
- daemonVersion: string().optional(),
57084
- /** Human-readable error when `ok: false`. */
57085
- error: string().optional()
57086
- }), { kind: "mutation" });
57076
+ 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() }));
57087
57077
  object({
57088
57078
  value: number().nullable().meta(readingMeta("device", { label: "Total" })),
57089
57079
  lastFetchedAt: number()
@@ -62944,13 +62934,6 @@ var AddBrokerInputSchema = object({
62944
62934
  });
62945
62935
  var AddBrokerResultSchema = object({ id: string() });
62946
62936
  var IdInputSchema = object({ id: string() });
62947
- var TestResultSchema$1 = discriminatedUnion("ok", [object({
62948
- ok: literal(true),
62949
- latencyMs: number()
62950
- }), object({
62951
- ok: literal(false),
62952
- error: string()
62953
- })]);
62954
62937
  var StartEmbeddedInputSchema = object({
62955
62938
  port: number().int().min(1).max(65535).default(1883),
62956
62939
  /** Allow anonymous connect (no username/password). Default: false. */
@@ -62973,9 +62956,6 @@ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnection
62973
62956
  }), method(IdInputSchema, _void(), {
62974
62957
  kind: "mutation",
62975
62958
  auth: "admin"
62976
- }), method(IdInputSchema, TestResultSchema$1, {
62977
- kind: "mutation",
62978
- auth: "admin"
62979
62959
  }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, {
62980
62960
  kind: "mutation",
62981
62961
  auth: "admin"
@@ -66767,61 +66747,6 @@ var oauthIntegrationCapability = {
66767
66747
  getDescriptor: method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" }) }
66768
66748
  };
66769
66749
  /**
66770
- * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
66771
- *
66772
- * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
66773
- * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
66774
- * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
66775
- * immutable after create.
66776
- */
66777
- var ConfigSchemaPassthrough$1 = unknown();
66778
- var OidcConnectionSchema = object({
66779
- id: string().min(1),
66780
- displayName: string(),
66781
- icon: string(),
66782
- issuerUrl: string(),
66783
- clientId: string(),
66784
- /** Client id + secret present — never the secret value. */
66785
- configured: boolean(),
66786
- /**
66787
- * Values for the connection form schema. `clientSecret` is a keychain
66788
- * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
66789
- */
66790
- formValues: record(string(), unknown()).optional()
66791
- });
66792
- /**
66793
- * Patch one connection. Omitted or empty `clientSecret` keeps the stored
66794
- * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
66795
- */
66796
- var OidcConnectionUpdateInputSchema = object({
66797
- id: string().min(1),
66798
- displayName: string().min(1),
66799
- icon: string().optional(),
66800
- issuerUrl: string().optional(),
66801
- clientId: string().optional(),
66802
- clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
66803
- redirectUri: string().optional(),
66804
- scopes: string().optional(),
66805
- usernameClaim: _enum([
66806
- "preferred_username",
66807
- "email",
66808
- "sub"
66809
- ]).optional()
66810
- });
66811
- method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
66812
- id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
66813
- displayName: string().min(1)
66814
- }), object({ id: string() }), {
66815
- kind: "mutation",
66816
- auth: "admin"
66817
- }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
66818
- kind: "mutation",
66819
- auth: "admin"
66820
- }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
66821
- kind: "mutation",
66822
- auth: "admin"
66823
- });
66824
- /**
66825
66750
  * Generic on-screen-display (video overlay) cap. Each camera exposes
66826
66751
  * a firmware-defined list of overlays (channel name, timestamp,
66827
66752
  * watermark, logo, …); the cap models them as a homogeneous array of
@@ -72994,21 +72919,6 @@ method(object({
72994
72919
  */
72995
72920
  ttlSec: union([number().int().positive(), literal("never")]).optional()
72996
72921
  }), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
72997
- var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
72998
- providerId: string().min(1),
72999
- displayName: string().min(1),
73000
- configSchema: unknown(),
73001
- nodeLocal: boolean(),
73002
- shouldSaveDiskSpace: literal(true),
73003
- minFreePercent: number().min(0).max(100)
73004
- }), object({
73005
- providerId: string().min(1),
73006
- displayName: string().min(1),
73007
- configSchema: unknown(),
73008
- nodeLocal: boolean(),
73009
- shouldSaveDiskSpace: literal(false),
73010
- minFreePercent: literal(null)
73011
- })]);
73012
72922
  method(object({
73013
72923
  location: StorageLocationRefSchema,
73014
72924
  relativePath: string()
@@ -73070,42 +72980,7 @@ method(object({
73070
72980
  }), _instanceof(Uint8Array), { auth: "admin" }), method(object({ downloadId: string() }), _void(), {
73071
72981
  kind: "mutation",
73072
72982
  auth: "admin"
73073
- }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(StorageLocationSchema.omit({
73074
- createdAt: true,
73075
- updatedAt: true
73076
- }), StorageLocationSchema, {
73077
- kind: "mutation",
73078
- auth: "admin"
73079
- }), method(object({
73080
- id: string(),
73081
- force: boolean().optional()
73082
- }), _void(), {
73083
- kind: "mutation",
73084
- auth: "admin"
73085
- }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
73086
- ok: boolean(),
73087
- error: string().optional()
73088
- }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
73089
- providerId: string(),
73090
- /**
73091
- * The location this config is an UNSAVED edit of, when there is one.
73092
- *
73093
- * `listLocations` replaces every declared secret with the redaction
73094
- * sentinel, so the edit modal's form state holds the sentinel for any
73095
- * credential the operator did not retype — and posting that here
73096
- * without a way to resolve it makes the provider try to authenticate
73097
- * as `__camstack_redacted__` and report the operator's own working
73098
- * password as wrong. Given this id, the orchestrator restores each
73099
- * sentinel from the stored config (same rule as `upsertLocation`)
73100
- * before dispatching. Omitted by the "Add location" wizard, where
73101
- * every value was typed just now and nothing is stored yet.
73102
- */
73103
- locationId: string().optional(),
73104
- config: record(string(), unknown())
73105
- }), object({
73106
- ok: boolean(),
73107
- error: string().optional()
73108
- }), { auth: "admin" });
72983
+ }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(_void(), array(StorageDrainProgressSchema).readonly());
73109
72984
  /** One table of the settings database. */
73110
72985
  var StorageTableSchema = object({
73111
72986
  /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
@@ -74622,7 +74497,7 @@ var TrainingProviderTypeSchema = object({
74622
74497
  label: string(),
74623
74498
  /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
74624
74499
  iconAsset: string(),
74625
- /** Owning `training-provider` addon — collection selector for createEntry. */
74500
+ /** Owning `training-provider` addon. */
74626
74501
  addonId: string(),
74627
74502
  /**
74628
74503
  * Fields for one entry of this type (credentials + defaults). Absent on a
@@ -74667,36 +74542,6 @@ var TrainingProviderDescriptorSchema = object({
74667
74542
  */
74668
74543
  formValues: record(string(), unknown()).optional()
74669
74544
  });
74670
- /**
74671
- * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
74672
- * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
74673
- * `{ $secretClear: true }` clears it.
74674
- */
74675
- var TrainingProviderUpdateEntryInputSchema = object({
74676
- entryId: string().min(1),
74677
- name: string().min(1),
74678
- tokenId: string().optional(),
74679
- tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
74680
- environment: string().optional(),
74681
- gpuType: string().optional(),
74682
- region: string().optional(),
74683
- costCapUsd: number().nonnegative().optional(),
74684
- maxRuntimeSec: number().int().positive().optional(),
74685
- failedDatasetGraceHours: number().nonnegative().optional()
74686
- });
74687
- var TrainingCredentialCheckSchema = object({
74688
- ok: boolean(),
74689
- /** Workspace / account name, when the provider says. */
74690
- account: string().optional(),
74691
- reason: _enum([
74692
- "missing",
74693
- "invalid",
74694
- "forbidden",
74695
- "network",
74696
- "quota"
74697
- ]).optional(),
74698
- detail: string().optional()
74699
- });
74700
74545
  var ProviderJobStateSchema = _enum([
74701
74546
  "pending",
74702
74547
  "starting",
@@ -74744,22 +74589,6 @@ var TrainingLogLineSchema = object({
74744
74589
  text: string()
74745
74590
  });
74746
74591
  method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
74747
- typeId: string().min(1),
74748
- name: string().min(1)
74749
- }), object({ entryId: string() }), {
74750
- kind: "mutation",
74751
- auth: "admin"
74752
- }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
74753
- kind: "mutation",
74754
- auth: "admin"
74755
- }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
74756
- kind: "mutation",
74757
- auth: "admin"
74758
- }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
74759
- kind: "mutation",
74760
- auth: "admin",
74761
- timeoutMs: 3e4
74762
- }), method(object({
74763
74592
  entryId: string().min(1),
74764
74593
  gpuType: string(),
74765
74594
  region: string(),
@@ -78145,20 +77974,6 @@ Object.freeze({
78145
77974
  access: "view",
78146
77975
  role: "admin"
78147
77976
  },
78148
- "connectionTest.describeTest": {
78149
- capName: "connection-test",
78150
- capScope: "system",
78151
- addonId: null,
78152
- access: "view",
78153
- role: "admin"
78154
- },
78155
- "connectionTest.testSettings": {
78156
- capName: "connection-test",
78157
- capScope: "system",
78158
- addonId: null,
78159
- access: "create",
78160
- role: "admin"
78161
- },
78162
77977
  "connectivity.getStatus": {
78163
77978
  capName: "connectivity",
78164
77979
  capScope: "device",
@@ -80525,13 +80340,6 @@ Object.freeze({
80525
80340
  access: "view",
80526
80341
  role: "admin"
80527
80342
  },
80528
- "integrations.testConnection": {
80529
- capName: "integrations",
80530
- capScope: "system",
80531
- addonId: null,
80532
- access: "create",
80533
- role: "admin"
80534
- },
80535
80343
  "integrations.update": {
80536
80344
  capName: "integrations",
80537
80345
  capScope: "system",
@@ -80784,13 +80592,6 @@ Object.freeze({
80784
80592
  access: "delete",
80785
80593
  role: "admin"
80786
80594
  },
80787
- "llm.deleteProfile": {
80788
- capName: "llm",
80789
- capScope: "system",
80790
- addonId: null,
80791
- access: "delete",
80792
- role: "admin"
80793
- },
80794
80595
  "llm.generate": {
80795
80596
  capName: "llm",
80796
80597
  capScope: "system",
@@ -80854,20 +80655,6 @@ Object.freeze({
80854
80655
  access: "view",
80855
80656
  role: "admin"
80856
80657
  },
80857
- "llm.listProfileKinds": {
80858
- capName: "llm",
80859
- capScope: "system",
80860
- addonId: null,
80861
- access: "view",
80862
- role: "admin"
80863
- },
80864
- "llm.listProfiles": {
80865
- capName: "llm",
80866
- capScope: "system",
80867
- addonId: null,
80868
- access: "view",
80869
- role: "admin"
80870
- },
80871
80658
  "llm.listRuntimeNodes": {
80872
80659
  capName: "llm",
80873
80660
  capScope: "system",
@@ -80875,13 +80662,6 @@ Object.freeze({
80875
80662
  access: "view",
80876
80663
  role: "admin"
80877
80664
  },
80878
- "llm.migrateRawSecrets": {
80879
- capName: "llm",
80880
- capScope: "system",
80881
- addonId: null,
80882
- access: "create",
80883
- role: "admin"
80884
- },
80885
80665
  "llm.resolveModelRef": {
80886
80666
  capName: "llm",
80887
80667
  capScope: "system",
@@ -80910,20 +80690,6 @@ Object.freeze({
80910
80690
  access: "create",
80911
80691
  role: "admin"
80912
80692
  },
80913
- "llm.testProfile": {
80914
- capName: "llm",
80915
- capScope: "system",
80916
- addonId: null,
80917
- access: "create",
80918
- role: "admin"
80919
- },
80920
- "llm.upsertProfile": {
80921
- capName: "llm",
80922
- capScope: "system",
80923
- addonId: null,
80924
- access: "create",
80925
- role: "admin"
80926
- },
80927
80693
  "llmRuntime.appleAvailability": {
80928
80694
  capName: "llm-runtime",
80929
80695
  capScope: "system",
@@ -81428,13 +81194,6 @@ Object.freeze({
81428
81194
  access: "create",
81429
81195
  role: "admin"
81430
81196
  },
81431
- "meshNetwork.testConnection": {
81432
- capName: "mesh-network",
81433
- capScope: "system",
81434
- addonId: null,
81435
- access: "create",
81436
- role: "admin"
81437
- },
81438
81197
  "meter.getStatus": {
81439
81198
  capName: "meter",
81440
81199
  capScope: "device",
@@ -81764,13 +81523,6 @@ Object.freeze({
81764
81523
  access: "create",
81765
81524
  role: "admin"
81766
81525
  },
81767
- "mqttBroker.testConnection": {
81768
- capName: "mqtt-broker",
81769
- capScope: "system",
81770
- addonId: null,
81771
- access: "create",
81772
- role: "admin"
81773
- },
81774
81526
  "nativeObjectDetection.getOptions": {
81775
81527
  capName: "native-object-detection",
81776
81528
  capScope: "device",
@@ -82100,13 +81852,6 @@ Object.freeze({
82100
81852
  access: "create",
82101
81853
  role: "admin"
82102
81854
  },
82103
- "notificationOutput.deleteTarget": {
82104
- capName: "notification-output",
82105
- capScope: "system",
82106
- addonId: null,
82107
- access: "delete",
82108
- role: "admin"
82109
- },
82110
81855
  "notificationOutput.discoverTargets": {
82111
81856
  capName: "notification-output",
82112
81857
  capScope: "system",
@@ -82114,13 +81859,6 @@ Object.freeze({
82114
81859
  access: "view",
82115
81860
  role: "admin"
82116
81861
  },
82117
- "notificationOutput.getTarget": {
82118
- capName: "notification-output",
82119
- capScope: "system",
82120
- addonId: null,
82121
- access: "view",
82122
- role: "admin"
82123
- },
82124
81862
  "notificationOutput.listTargetKinds": {
82125
81863
  capName: "notification-output",
82126
81864
  capScope: "system",
@@ -82128,13 +81866,6 @@ Object.freeze({
82128
81866
  access: "view",
82129
81867
  role: "admin"
82130
81868
  },
82131
- "notificationOutput.listTargets": {
82132
- capName: "notification-output",
82133
- capScope: "system",
82134
- addonId: null,
82135
- access: "view",
82136
- role: "admin"
82137
- },
82138
81869
  "notificationOutput.probeTargetConfig": {
82139
81870
  capName: "notification-output",
82140
81871
  capScope: "system",
@@ -82149,13 +81880,6 @@ Object.freeze({
82149
81880
  access: "create",
82150
81881
  role: "admin"
82151
81882
  },
82152
- "notificationOutput.setTargetEnabled": {
82153
- capName: "notification-output",
82154
- capScope: "system",
82155
- addonId: null,
82156
- access: "create",
82157
- role: "admin"
82158
- },
82159
81883
  "notificationOutput.testTarget": {
82160
81884
  capName: "notification-output",
82161
81885
  capScope: "system",
@@ -82163,13 +81887,6 @@ Object.freeze({
82163
81887
  access: "create",
82164
81888
  role: "admin"
82165
81889
  },
82166
- "notificationOutput.upsertTarget": {
82167
- capName: "notification-output",
82168
- capScope: "system",
82169
- addonId: null,
82170
- access: "create",
82171
- role: "admin"
82172
- },
82173
81890
  "notificationRules.activateAlarmProfile": {
82174
81891
  capName: "notification-rules",
82175
81892
  capScope: "system",
@@ -82429,41 +82146,6 @@ Object.freeze({
82429
82146
  access: "view",
82430
82147
  role: "admin"
82431
82148
  },
82432
- "oidcConnections.connectionFormSchema": {
82433
- capName: "oidc-connections",
82434
- capScope: "system",
82435
- addonId: null,
82436
- access: "view",
82437
- role: "admin"
82438
- },
82439
- "oidcConnections.createConnection": {
82440
- capName: "oidc-connections",
82441
- capScope: "system",
82442
- addonId: null,
82443
- access: "create",
82444
- role: "admin"
82445
- },
82446
- "oidcConnections.deleteConnection": {
82447
- capName: "oidc-connections",
82448
- capScope: "system",
82449
- addonId: null,
82450
- access: "delete",
82451
- role: "admin"
82452
- },
82453
- "oidcConnections.listConnections": {
82454
- capName: "oidc-connections",
82455
- capScope: "system",
82456
- addonId: null,
82457
- access: "view",
82458
- role: "admin"
82459
- },
82460
- "oidcConnections.updateConnection": {
82461
- capName: "oidc-connections",
82462
- capScope: "system",
82463
- addonId: null,
82464
- access: "create",
82465
- role: "admin"
82466
- },
82467
82149
  "osd.getStatus": {
82468
82150
  capName: "osd",
82469
82151
  capScope: "device",
@@ -85495,13 +85177,6 @@ Object.freeze({
85495
85177
  access: "delete",
85496
85178
  role: "admin"
85497
85179
  },
85498
- "storage.deleteLocation": {
85499
- capName: "storage",
85500
- capScope: "system",
85501
- addonId: null,
85502
- access: "delete",
85503
- role: "admin"
85504
- },
85505
85180
  "storage.endDownload": {
85506
85181
  capName: "storage",
85507
85182
  capScope: "system",
@@ -85558,13 +85233,6 @@ Object.freeze({
85558
85233
  access: "view",
85559
85234
  role: "admin"
85560
85235
  },
85561
- "storage.listProviders": {
85562
- capName: "storage",
85563
- capScope: "system",
85564
- addonId: null,
85565
- access: "view",
85566
- role: "admin"
85567
- },
85568
85236
  "storage.read": {
85569
85237
  capName: "storage",
85570
85238
  capScope: "system",
@@ -85586,27 +85254,6 @@ Object.freeze({
85586
85254
  access: "view",
85587
85255
  role: "admin"
85588
85256
  },
85589
- "storage.testConfig": {
85590
- capName: "storage",
85591
- capScope: "system",
85592
- addonId: null,
85593
- access: "view",
85594
- role: "admin"
85595
- },
85596
- "storage.testLocation": {
85597
- capName: "storage",
85598
- capScope: "system",
85599
- addonId: null,
85600
- access: "view",
85601
- role: "admin"
85602
- },
85603
- "storage.upsertLocation": {
85604
- capName: "storage",
85605
- capScope: "system",
85606
- addonId: null,
85607
- access: "create",
85608
- role: "admin"
85609
- },
85610
85257
  "storage.write": {
85611
85258
  capName: "storage",
85612
85259
  capScope: "system",
@@ -86601,20 +86248,6 @@ Object.freeze({
86601
86248
  access: "create",
86602
86249
  role: "admin"
86603
86250
  },
86604
- "trainingProvider.createEntry": {
86605
- capName: "training-provider",
86606
- capScope: "system",
86607
- addonId: null,
86608
- access: "create",
86609
- role: "admin"
86610
- },
86611
- "trainingProvider.deleteEntry": {
86612
- capName: "training-provider",
86613
- capScope: "system",
86614
- addonId: null,
86615
- access: "delete",
86616
- role: "admin"
86617
- },
86618
86251
  "trainingProvider.describe": {
86619
86252
  capName: "training-provider",
86620
86253
  capScope: "system",
@@ -86685,13 +86318,6 @@ Object.freeze({
86685
86318
  access: "create",
86686
86319
  role: "admin"
86687
86320
  },
86688
- "trainingProvider.updateEntry": {
86689
- capName: "training-provider",
86690
- capScope: "system",
86691
- addonId: null,
86692
- access: "create",
86693
- role: "admin"
86694
- },
86695
86321
  "trainingProvider.uploadDataset": {
86696
86322
  capName: "training-provider",
86697
86323
  capScope: "system",
@@ -86699,13 +86325,6 @@ Object.freeze({
86699
86325
  access: "create",
86700
86326
  role: "admin"
86701
86327
  },
86702
- "trainingProvider.validateCredentials": {
86703
- capName: "training-provider",
86704
- capScope: "system",
86705
- addonId: null,
86706
- access: "create",
86707
- role: "admin"
86708
- },
86709
86328
  "turnProvider.getTurnServers": {
86710
86329
  capName: "turn-provider",
86711
86330
  capScope: "system",