@camstack/addon-export-alexa 1.2.185 → 1.2.186

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.
@@ -6016,7 +6016,7 @@ var ZodIssueCode = {
6016
6016
  var ZodFirstPartyTypeKind;
6017
6017
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6018
6018
  //#endregion
6019
- //#region ../types/dist/sleep-CmjWurK5.mjs
6019
+ //#region ../types/dist/sleep-D7ZKm4nb.mjs
6020
6020
  /**
6021
6021
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6022
6022
  * window to float samples (D455).
@@ -6725,10 +6725,33 @@ function integrationRowsApiOver(api) {
6725
6725
  };
6726
6726
  }
6727
6727
  var PREFIX$1 = "records/";
6728
+ /**
6729
+ * Cross-realm brand. An addon bundles its own copy of this module (D15) while
6730
+ * `ctx.records` is the HOST's door, so an error thrown by the host is an
6731
+ * instance of the host's classes, not of the addon's. The brand plus the code
6732
+ * make `instanceof` answer by identity of the failure, not of the copy.
6733
+ */
6734
+ var RECORDS_ERROR_BRAND = Symbol.for("camstack.records-error");
6735
+ function carriesBrand(value) {
6736
+ return typeof value === "object" && value !== null && Reflect.get(value, RECORDS_ERROR_BRAND) === true;
6737
+ }
6728
6738
  /** The base of every records failure. `detail` is the human part of the message. */
6729
6739
  var RecordsError = class extends Error {
6740
+ /** The code a subclass stands for; the base stands for every code. */
6741
+ static code = void 0;
6742
+ /**
6743
+ * `instanceof` across copies of this module: any branded error is a
6744
+ * `RecordsError`, and is an instance of a subclass only when its code is the
6745
+ * subclass's code. Same-copy answers are unchanged.
6746
+ */
6747
+ static [Symbol.hasInstance](value) {
6748
+ if (Function.prototype[Symbol.hasInstance].call(this, value)) return true;
6749
+ if (!carriesBrand(value)) return false;
6750
+ return this.code === void 0 || value.code === this.code;
6751
+ }
6730
6752
  code;
6731
6753
  detail;
6754
+ [RECORDS_ERROR_BRAND] = true;
6732
6755
  constructor(code, detail) {
6733
6756
  super(`${PREFIX$1}${code}: ${detail}`);
6734
6757
  this.name = "RecordsError";
@@ -6737,29 +6760,33 @@ var RecordsError = class extends Error {
6737
6760
  }
6738
6761
  };
6739
6762
  /** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
6740
- var RevConflictError = class extends RecordsError {
6763
+ var RevConflictError = class RevConflictError extends RecordsError {
6764
+ static code = "rev-conflict";
6741
6765
  constructor(detail) {
6742
- super("rev-conflict", detail);
6766
+ super(RevConflictError.code, detail);
6743
6767
  this.name = "RevConflictError";
6744
6768
  }
6745
6769
  };
6746
6770
  /** The keychain could not store or serve a value: explicit, never an empty string. */
6747
- var RecordSecretUnavailableError = class extends RecordsError {
6771
+ var RecordSecretUnavailableError = class RecordSecretUnavailableError extends RecordsError {
6772
+ static code = "secret-unavailable";
6748
6773
  constructor(detail) {
6749
- super("secret-unavailable", detail);
6774
+ super(RecordSecretUnavailableError.code, detail);
6750
6775
  this.name = "RecordSecretUnavailableError";
6751
6776
  }
6752
6777
  };
6753
- var InvalidRecordError = class extends RecordsError {
6778
+ var InvalidRecordError = class InvalidRecordError extends RecordsError {
6779
+ static code = "invalid-record";
6754
6780
  constructor(detail) {
6755
- super("invalid-record", detail);
6781
+ super(InvalidRecordError.code, detail);
6756
6782
  this.name = "InvalidRecordError";
6757
6783
  }
6758
6784
  };
6759
6785
  /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
6760
- var DeclarationRefusedError = class extends RecordsError {
6786
+ var DeclarationRefusedError = class DeclarationRefusedError extends RecordsError {
6787
+ static code = "declaration-refused";
6761
6788
  constructor(detail) {
6762
- super("declaration-refused", detail);
6789
+ super(DeclarationRefusedError.code, detail);
6763
6790
  this.name = "DeclarationRefusedError";
6764
6791
  }
6765
6792
  };
@@ -9554,271 +9581,6 @@ function normalizeAddonInitResult(result) {
9554
9581
  if (Array.isArray(result)) return { providers: result };
9555
9582
  return result;
9556
9583
  }
9557
- /**
9558
- * The share-view scope kinds a share-link token can carry. The hub mints
9559
- * and validates them (`ShareViewGrantSchema` builds its
9560
- * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
9561
- */
9562
- var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
9563
- /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
9564
- var PeerBytesTicketSchema = object({
9565
- /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
9566
- url: string().min(1),
9567
- /**
9568
- * The HOST node this URL means something on — the hub or a named agent,
9569
- * never a runner. {@link AddonPeerBytes.open} compares it to its own and
9570
- * refuses `cross-node` by name when they differ, without dialling.
9571
- */
9572
- hostNodeId: string().min(1),
9573
- expiresAtMs: number().int().nonnegative(),
9574
- /**
9575
- * What the producer DECLARED the body to be, when it knows — `null` when it
9576
- * does not. Never `0` for unknown (D393): a consumer sizing a bound off this
9577
- * must be able to tell "the producer did not say" from "the body is empty".
9578
- */
9579
- declaredBytes: number().int().nonnegative().nullable()
9580
- });
9581
- function defOf(schema) {
9582
- const zodBag = Reflect.get(schema, "_zod");
9583
- if (typeof zodBag !== "object" || zodBag === null) return {};
9584
- const def = Reflect.get(zodBag, "def");
9585
- if (typeof def !== "object" || def === null) return {};
9586
- return def;
9587
- }
9588
- function declaredHere(schema) {
9589
- return globalRegistry.get(schema)?.secret === true;
9590
- }
9591
- /** Wrapper kinds whose `innerType` is the field itself. */
9592
- var WRAPPERS = new Set([
9593
- "optional",
9594
- "nullable",
9595
- "default",
9596
- "prefault",
9597
- "catch",
9598
- "readonly",
9599
- "nonoptional"
9600
- ]);
9601
- /**
9602
- * The schema layers that make up ONE field: the schema itself and every
9603
- * wrapper below it (optional / default / nullable / readonly / catch), plus
9604
- * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
9605
- * `.transform` on `in`).
9606
- */
9607
- function layersOf(schema) {
9608
- const out = [];
9609
- const queue = [schema];
9610
- while (queue.length > 0) {
9611
- const s = queue.shift();
9612
- if (!s || out.includes(s)) continue;
9613
- out.push(s);
9614
- const def = defOf(s);
9615
- if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
9616
- if (def.type === "pipe") {
9617
- if (def.in) queue.push(def.in);
9618
- if (def.out) queue.push(def.out);
9619
- }
9620
- }
9621
- return out;
9622
- }
9623
- /** True when any layer of this field declares `.meta({ secret: true })`. */
9624
- function isZodSecret(schema) {
9625
- return layersOf(schema).some(declaredHere);
9626
- }
9627
- /**
9628
- * Every declared secret path in a config schema: dotted keys, `[]` for "each
9629
- * element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
9630
- * map" (`applianceSecrets{}`). A declared
9631
- * object or array is reported as one path and not descended into — everything
9632
- * under it is secret.
9633
- */
9634
- function collectZodSecretPaths(schema, prefix = "") {
9635
- if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
9636
- const paths = [];
9637
- for (const layer of layersOf(schema)) {
9638
- const def = defOf(layer);
9639
- if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
9640
- else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
9641
- else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
9642
- else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
9643
- else if (def.type === "intersection") {
9644
- if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
9645
- if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
9646
- }
9647
- }
9648
- return [...new Set(paths)];
9649
- }
9650
- /**
9651
- * Record kinds (D881): the declaration an addon makes of one kind of fact, the
9652
- * Zod row schema that describes it, and the helper that turns the two into the
9653
- * JSON the engine stores.
9654
- *
9655
- * A kind is declared ONCE, next to the code that owns it, and the engine's
9656
- * reconciler creates its indexes - nothing creates DDL at runtime from a write.
9657
- * Everything the generic machinery needs (secret fields, the entry descriptor)
9658
- * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
9659
- * never a field name (D879).
9660
- */
9661
- /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
9662
- var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
9663
- var RecordIndexSchema = object({
9664
- name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
9665
- fields: array(RecordFieldPathSchema).min(1).max(4),
9666
- unique: boolean().optional()
9667
- }).strict();
9668
- var RecordRetentionSchema = union([
9669
- object({
9670
- ttlMs: number().int().positive(),
9671
- from: _enum(["at", "write"])
9672
- }).strict(),
9673
- object({
9674
- maxRows: number().int().positive().optional(),
9675
- maxRowsPerDevice: number().int().positive().optional()
9676
- }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
9677
- object({
9678
- owner: string().min(1),
9679
- reason: string().min(1)
9680
- }).strict(),
9681
- object({ none: string().min(1) }).strict()
9682
- ]);
9683
- /** The descriptor a generic entries UI reads (D881 "generic entries"). */
9684
- var EntryDescriptorSchema = object({
9685
- title: string().min(1),
9686
- /** The record body field shown as the entry's name. */
9687
- nameField: string().min(1),
9688
- /** JSON Schema of the entry body; `secret: true` marks a password field. */
9689
- fields: record(string(), unknown())
9690
- }).strict();
9691
- /** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
9692
- var RecordKindDeclarationSchema = object({
9693
- database: _enum(RECORD_DATABASES).default("settings"),
9694
- class: _enum(RECORD_CLASSES),
9695
- writeTrigger: string().min(1),
9696
- device: _enum([
9697
- "required",
9698
- "optional",
9699
- "none"
9700
- ]).default("none"),
9701
- at: _enum(["required", "none"]).default("none"),
9702
- indexes: array(RecordIndexSchema).max(8).default([]),
9703
- retention: RecordRetentionSchema,
9704
- deviceRemoval: _enum(["delete", "none"]).default("none"),
9705
- maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
9706
- /** Derived from the Zod schema; never written by hand. */
9707
- secretPaths: array(string().min(1)).default([]),
9708
- /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
9709
- secretArrayKeys: record(string(), string()).default({}),
9710
- /** Kinds that must agree through `transact` sit in one file under one family name. */
9711
- transactFamily: string().min(1).optional(),
9712
- entry: EntryDescriptorSchema.optional()
9713
- }).strict();
9714
- /** The kind names: lower-case, dash separated, short enough for an index name. */
9715
- var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
9716
- /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
9717
- function assertValidDeclaration(name, decl) {
9718
- const refuse = (why) => {
9719
- throw new DeclarationRefusedError(`kind "${name}": ${why}`);
9720
- };
9721
- if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
9722
- const seen = /* @__PURE__ */ new Set();
9723
- for (const index of decl.indexes) {
9724
- if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
9725
- seen.add(index.name);
9726
- }
9727
- const { retention } = decl;
9728
- const hasSecrets = decl.secretPaths.length > 0;
9729
- if ("ttlMs" in retention) {
9730
- if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
9731
- if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
9732
- }
9733
- if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
9734
- if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
9735
- if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
9736
- if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
9737
- const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
9738
- if (decl.database === "settings" && bound > 5e4) refuse(`a row bound above ${RECORD_SETTINGS_MAX_ROWS} belongs in database: "events" (a big delete on the settings thread stalls every configuration read)`);
9739
- }
9740
- if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
9741
- for (const path of decl.secretPaths) for (const prefix of secretArrayPrefixes(path)) if (decl.secretArrayKeys[prefix] === void 0) refuse(`secret path "${path}" crosses the array "${prefix}": declare its id key in secretArrayKeys`);
9742
- }
9743
- function bodyFieldsOf(schema) {
9744
- return { ...toJSONSchema(schema, {
9745
- unrepresentable: "any",
9746
- io: "input"
9747
- }) };
9748
- }
9749
- function isRecordLike(value) {
9750
- return typeof value === "object" && value !== null && !Array.isArray(value);
9751
- }
9752
- /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
9753
- function hasNameField(json, field) {
9754
- const branches = json["oneOf"] ?? json["anyOf"];
9755
- if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
9756
- const properties = json["properties"];
9757
- return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
9758
- }
9759
- /**
9760
- * Declare the kinds of a package. The keys are the kind names. The result is
9761
- * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
9762
- * types its handle from.
9763
- */
9764
- function defineRecordKinds(specs) {
9765
- const out = {};
9766
- for (const [name, spec] of Object.entries(specs)) {
9767
- const secretPaths = collectZodSecretPaths(spec.schema);
9768
- const nameField = spec.entry?.nameField ?? "name";
9769
- const fields = bodyFieldsOf(spec.schema);
9770
- if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
9771
- const parsed = RecordKindDeclarationSchema.parse({
9772
- database: spec.database,
9773
- class: spec.class,
9774
- writeTrigger: spec.writeTrigger,
9775
- device: spec.device,
9776
- at: spec.at,
9777
- indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
9778
- retention: spec.retention,
9779
- deviceRemoval: spec.deviceRemoval,
9780
- maxDataBytes: spec.maxDataBytes,
9781
- secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
9782
- secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
9783
- transactFamily: spec.transactFamily,
9784
- entry: spec.entry === void 0 ? void 0 : {
9785
- title: spec.entry.title,
9786
- nameField,
9787
- fields
9788
- }
9789
- });
9790
- assertValidDeclaration(name, parsed);
9791
- out[name] = {
9792
- name,
9793
- schema: spec.schema,
9794
- declaration: parsed
9795
- };
9796
- }
9797
- return out;
9798
- }
9799
- /**
9800
- * Declare one entry kind. An entry is configuration: never trimmed by the
9801
- * engine, never aged, belonging to no device.
9802
- */
9803
- function defineEntryKind(name, spec) {
9804
- const defined = defineRecordKinds({ [name]: {
9805
- schema: spec.schema,
9806
- class: "config",
9807
- writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
9808
- retention: { none: "an entry goes only when the operator deletes it" },
9809
- ...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
9810
- ...spec.database === void 0 ? {} : { database: spec.database },
9811
- ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
9812
- ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
9813
- ...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
9814
- entry: {
9815
- title: spec.title,
9816
- ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
9817
- }
9818
- } })[name];
9819
- if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
9820
- return defined;
9821
- }
9822
9584
  object({
9823
9585
  field: string().min(1),
9824
9586
  on: literal("advance")
@@ -9907,6 +9669,271 @@ function optionalMethod(input, output, options) {
9907
9669
  providerOptional: true
9908
9670
  };
9909
9671
  }
9672
+ function defOf(schema) {
9673
+ const zodBag = Reflect.get(schema, "_zod");
9674
+ if (typeof zodBag !== "object" || zodBag === null) return {};
9675
+ const def = Reflect.get(zodBag, "def");
9676
+ if (typeof def !== "object" || def === null) return {};
9677
+ return def;
9678
+ }
9679
+ function declaredHere(schema) {
9680
+ return globalRegistry.get(schema)?.secret === true;
9681
+ }
9682
+ /** Wrapper kinds whose `innerType` is the field itself. */
9683
+ var WRAPPERS = new Set([
9684
+ "optional",
9685
+ "nullable",
9686
+ "default",
9687
+ "prefault",
9688
+ "catch",
9689
+ "readonly",
9690
+ "nonoptional"
9691
+ ]);
9692
+ /**
9693
+ * The schema layers that make up ONE field: the schema itself and every
9694
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
9695
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
9696
+ * `.transform` on `in`).
9697
+ */
9698
+ function layersOf(schema) {
9699
+ const out = [];
9700
+ const queue = [schema];
9701
+ while (queue.length > 0) {
9702
+ const s = queue.shift();
9703
+ if (!s || out.includes(s)) continue;
9704
+ out.push(s);
9705
+ const def = defOf(s);
9706
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
9707
+ if (def.type === "pipe") {
9708
+ if (def.in) queue.push(def.in);
9709
+ if (def.out) queue.push(def.out);
9710
+ }
9711
+ }
9712
+ return out;
9713
+ }
9714
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
9715
+ function isZodSecret(schema) {
9716
+ return layersOf(schema).some(declaredHere);
9717
+ }
9718
+ /**
9719
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
9720
+ * element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
9721
+ * map" (`applianceSecrets{}`). A declared
9722
+ * object or array is reported as one path and not descended into — everything
9723
+ * under it is secret.
9724
+ */
9725
+ function collectZodSecretPaths(schema, prefix = "") {
9726
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
9727
+ const paths = [];
9728
+ for (const layer of layersOf(schema)) {
9729
+ const def = defOf(layer);
9730
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
9731
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
9732
+ else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
9733
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
9734
+ else if (def.type === "intersection") {
9735
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
9736
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
9737
+ }
9738
+ }
9739
+ return [...new Set(paths)];
9740
+ }
9741
+ /**
9742
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
9743
+ * Zod row schema that describes it, and the helper that turns the two into the
9744
+ * JSON the engine stores.
9745
+ *
9746
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
9747
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
9748
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
9749
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
9750
+ * never a field name (D879).
9751
+ */
9752
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
9753
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
9754
+ var RecordIndexSchema = object({
9755
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
9756
+ fields: array(RecordFieldPathSchema).min(1).max(4),
9757
+ unique: boolean().optional()
9758
+ }).strict();
9759
+ var RecordRetentionSchema = union([
9760
+ object({
9761
+ ttlMs: number().int().positive(),
9762
+ from: _enum(["at", "write"])
9763
+ }).strict(),
9764
+ object({
9765
+ maxRows: number().int().positive().optional(),
9766
+ maxRowsPerDevice: number().int().positive().optional()
9767
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
9768
+ object({
9769
+ owner: string().min(1),
9770
+ reason: string().min(1)
9771
+ }).strict(),
9772
+ object({ none: string().min(1) }).strict()
9773
+ ]);
9774
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
9775
+ var EntryDescriptorSchema = object({
9776
+ title: string().min(1),
9777
+ /** The record body field shown as the entry's name. */
9778
+ nameField: string().min(1),
9779
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
9780
+ fields: record(string(), unknown())
9781
+ }).strict();
9782
+ /** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
9783
+ var RecordKindDeclarationSchema = object({
9784
+ database: _enum(RECORD_DATABASES).default("settings"),
9785
+ class: _enum(RECORD_CLASSES),
9786
+ writeTrigger: string().min(1),
9787
+ device: _enum([
9788
+ "required",
9789
+ "optional",
9790
+ "none"
9791
+ ]).default("none"),
9792
+ at: _enum(["required", "none"]).default("none"),
9793
+ indexes: array(RecordIndexSchema).max(8).default([]),
9794
+ retention: RecordRetentionSchema,
9795
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
9796
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
9797
+ /** Derived from the Zod schema; never written by hand. */
9798
+ secretPaths: array(string().min(1)).default([]),
9799
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
9800
+ secretArrayKeys: record(string(), string()).default({}),
9801
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
9802
+ transactFamily: string().min(1).optional(),
9803
+ entry: EntryDescriptorSchema.optional()
9804
+ }).strict();
9805
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
9806
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
9807
+ /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
9808
+ function assertValidDeclaration(name, decl) {
9809
+ const refuse = (why) => {
9810
+ throw new DeclarationRefusedError(`kind "${name}": ${why}`);
9811
+ };
9812
+ if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
9813
+ const seen = /* @__PURE__ */ new Set();
9814
+ for (const index of decl.indexes) {
9815
+ if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
9816
+ seen.add(index.name);
9817
+ }
9818
+ const { retention } = decl;
9819
+ const hasSecrets = decl.secretPaths.length > 0;
9820
+ if ("ttlMs" in retention) {
9821
+ if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
9822
+ if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
9823
+ }
9824
+ if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
9825
+ if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
9826
+ if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
9827
+ if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
9828
+ const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
9829
+ 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)`);
9830
+ }
9831
+ if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
9832
+ 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`);
9833
+ }
9834
+ function bodyFieldsOf(schema) {
9835
+ return { ...toJSONSchema(schema, {
9836
+ unrepresentable: "any",
9837
+ io: "input"
9838
+ }) };
9839
+ }
9840
+ function isRecordLike(value) {
9841
+ return typeof value === "object" && value !== null && !Array.isArray(value);
9842
+ }
9843
+ /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
9844
+ function hasNameField(json, field) {
9845
+ const branches = json["oneOf"] ?? json["anyOf"];
9846
+ if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
9847
+ const properties = json["properties"];
9848
+ return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
9849
+ }
9850
+ /**
9851
+ * Declare the kinds of a package. The keys are the kind names. The result is
9852
+ * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
9853
+ * types its handle from.
9854
+ */
9855
+ function defineRecordKinds(specs) {
9856
+ const out = {};
9857
+ for (const [name, spec] of Object.entries(specs)) {
9858
+ const secretPaths = collectZodSecretPaths(spec.schema);
9859
+ const nameField = spec.entry?.nameField ?? "name";
9860
+ const fields = bodyFieldsOf(spec.schema);
9861
+ if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
9862
+ const parsed = RecordKindDeclarationSchema.parse({
9863
+ database: spec.database,
9864
+ class: spec.class,
9865
+ writeTrigger: spec.writeTrigger,
9866
+ device: spec.device,
9867
+ at: spec.at,
9868
+ indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
9869
+ retention: spec.retention,
9870
+ deviceRemoval: spec.deviceRemoval,
9871
+ maxDataBytes: spec.maxDataBytes,
9872
+ secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
9873
+ secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
9874
+ transactFamily: spec.transactFamily,
9875
+ entry: spec.entry === void 0 ? void 0 : {
9876
+ title: spec.entry.title,
9877
+ nameField,
9878
+ fields
9879
+ }
9880
+ });
9881
+ assertValidDeclaration(name, parsed);
9882
+ out[name] = {
9883
+ name,
9884
+ schema: spec.schema,
9885
+ declaration: parsed
9886
+ };
9887
+ }
9888
+ return out;
9889
+ }
9890
+ /**
9891
+ * Declare one entry kind. An entry is configuration: never trimmed by the
9892
+ * engine, never aged, belonging to no device.
9893
+ */
9894
+ function defineEntryKind(name, spec) {
9895
+ const defined = defineRecordKinds({ [name]: {
9896
+ schema: spec.schema,
9897
+ class: "config",
9898
+ writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
9899
+ retention: { none: "an entry goes only when the operator deletes it" },
9900
+ ...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
9901
+ ...spec.database === void 0 ? {} : { database: spec.database },
9902
+ ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
9903
+ ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
9904
+ ...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
9905
+ entry: {
9906
+ title: spec.title,
9907
+ ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
9908
+ }
9909
+ } })[name];
9910
+ if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
9911
+ return defined;
9912
+ }
9913
+ /**
9914
+ * The share-view scope kinds a share-link token can carry. The hub mints
9915
+ * and validates them (`ShareViewGrantSchema` builds its
9916
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
9917
+ */
9918
+ var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
9919
+ /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
9920
+ var PeerBytesTicketSchema = object({
9921
+ /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
9922
+ url: string().min(1),
9923
+ /**
9924
+ * The HOST node this URL means something on — the hub or a named agent,
9925
+ * never a runner. {@link AddonPeerBytes.open} compares it to its own and
9926
+ * refuses `cross-node` by name when they differ, without dialling.
9927
+ */
9928
+ hostNodeId: string().min(1),
9929
+ expiresAtMs: number().int().nonnegative(),
9930
+ /**
9931
+ * What the producer DECLARED the body to be, when it knows — `null` when it
9932
+ * does not. Never `0` for unknown (D393): a consumer sizing a bound off this
9933
+ * must be able to tell "the producer did not say" from "the body is empty".
9934
+ */
9935
+ declaredBytes: number().int().nonnegative().nullable()
9936
+ });
9910
9937
  var READING_QUANTITIES = [
9911
9938
  "temperature",
9912
9939
  "pressure",
@@ -10507,7 +10534,6 @@ var CAP_NAMES = Object.freeze([
10507
10534
  "climate-control",
10508
10535
  "color",
10509
10536
  "composer",
10510
- "connection-test",
10511
10537
  "connectivity",
10512
10538
  "consumables",
10513
10539
  "contact",
@@ -12527,8 +12553,7 @@ Object.freeze({
12527
12553
  "offerArtifact": 3e5,
12528
12554
  "readResult": 3e5,
12529
12555
  "submitJob": 18e5,
12530
- "uploadDataset": 72e5,
12531
- "validateCredentials": 3e4
12556
+ "uploadDataset": 72e5
12532
12557
  }
12533
12558
  });
12534
12559
  object({
@@ -14000,6 +14025,432 @@ function buildCapturingReply(envelope) {
14000
14025
  };
14001
14026
  return wrapper;
14002
14027
  }
14028
+ /**
14029
+ * notification-output — canonical, capability-gated notification delivery.
14030
+ *
14031
+ * Apprise-derived model (see
14032
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14033
+ * callers emit ONE canonical `Notification`; each provider declares a
14034
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
14035
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14036
+ * message to what the kind supports — callers never special-case a service.
14037
+ *
14038
+ * DESIGN DECISIONS (locked):
14039
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14040
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
14041
+ * cap. Rationale: the admin UI needs one uniform surface across the
14042
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14043
+ * alternative would fork the UI per addon and cannot host the
14044
+ * discovery→adopt flow.
14045
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14046
+ * the generated cap-mount auto-`concatCollection`-fans them across every
14047
+ * registered provider (notifiers addon + HA addon) so one catalog is
14048
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14049
+ * `addonId` the generated collection router extracts from the call input.
14050
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14051
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14052
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
14053
+ * base64 fallback needed.
14054
+ *
14055
+ * TODO (deferred, closed-set change — separate decision): add
14056
+ * `providerKind: 'notify'` so notification providers surface on the unified
14057
+ * admin "Integrations" page.
14058
+ */
14059
+ /**
14060
+ * Zentik-derived typed-media enum — the superset across every kind. Each
14061
+ * adapter picks what it supports and the degrade engine filters the rest.
14062
+ */
14063
+ var AttachmentMediaTypeSchema = _enum([
14064
+ "image",
14065
+ "video",
14066
+ "gif",
14067
+ "audio",
14068
+ "icon"
14069
+ ]);
14070
+ /**
14071
+ * A single attachment. Exactly one of `url` (remote source, most adapters
14072
+ * prefer this) or `bytes` (inline source; required for Pushover-style
14073
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
14074
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
14075
+ */
14076
+ var AttachmentSchema = object({
14077
+ mediaType: AttachmentMediaTypeSchema,
14078
+ url: string().optional(),
14079
+ bytes: _instanceof(Uint8Array).optional(),
14080
+ mime: string().optional(),
14081
+ name: string().optional()
14082
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14083
+ var NotificationFormatSchema = _enum([
14084
+ "text",
14085
+ "markdown",
14086
+ "html"
14087
+ ]);
14088
+ /**
14089
+ * The CLOSED icon vocabulary an action button may use.
14090
+ *
14091
+ * A closed set, not a free string, and that is the whole point: an arbitrary
14092
+ * icon name is one that ntfy renders, zentik silently drops, and nobody
14093
+ * notices — the same class of gap as a zone vocabulary nothing produced
14094
+ * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
14095
+ * declares `actionIcons: false` and the degrade engine strips the field.
14096
+ *
14097
+ * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
14098
+ * renderer's icon set; "acknowledge" survives an adapter that draws it
14099
+ * differently.
14100
+ *
14101
+ * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
14102
+ *
14103
+ * These names are for US. **No adapter may forward one verbatim.** Each maps
14104
+ * the whole set onto its own renderer's vocabulary through a
14105
+ * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
14106
+ * fallback, so adding a member here fails every adapter's build until someone
14107
+ * decides its glyph, which is the only place that decision can be made
14108
+ * honestly.
14109
+ *
14110
+ * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
14111
+ * `disarm` straight through; iOS feeds that string to
14112
+ * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
14113
+ * and every snooze and alarm button arrived BLANK. A pass-through is not a
14114
+ * mapping, and "the field is documented" is not "the value renders".
14115
+ *
14116
+ * Adding a member is TRAIN-BOUND. The enum lives in the published
14117
+ * `@camstack/server` closure and the cap seam validates against the HUB's copy,
14118
+ * so an addon that emits a token the running hub does not know does not lose an
14119
+ * icon — its whole `send` fails Zod validation and the notification never
14120
+ * arrives. Never emit a new token from an addon before the train carrying it.
14121
+ */
14122
+ var NotificationActionIconSchema = _enum([
14123
+ "acknowledge",
14124
+ "dismiss",
14125
+ "silence",
14126
+ "snooze",
14127
+ "view",
14128
+ "play",
14129
+ "open",
14130
+ "close",
14131
+ "lock",
14132
+ "unlock",
14133
+ "arm",
14134
+ "arm-home",
14135
+ "arm-away",
14136
+ "arm-night",
14137
+ "disarm",
14138
+ "light",
14139
+ "alert",
14140
+ "camera"
14141
+ ]);
14142
+ /** A single tap-through action button. */
14143
+ var NotificationActionSchema = object({
14144
+ id: string(),
14145
+ label: string(),
14146
+ url: string().optional(),
14147
+ /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
14148
+ icon: NotificationActionIconSchema.optional(),
14149
+ /**
14150
+ * Renders in a warning style where the notifier supports it.
14151
+ *
14152
+ * A HINT, never a gate. The callback's authority is its token and nothing
14153
+ * else — see `notification-center/action-token.ts` for what that does and
14154
+ * does not buy.
14155
+ */
14156
+ destructive: boolean().optional(),
14157
+ /**
14158
+ * How the tap should REACH the url.
14159
+ *
14160
+ * `navigate` (absent, and every button authored before this field) opens it:
14161
+ * the phone leaves the notification and shows whatever the callback returns.
14162
+ * That is right for a button whose answer the operator wants to read.
14163
+ *
14164
+ * `background` fires it as a POST and stays put. It exists for the buttons
14165
+ * whose whole point is not to interrupt — "silence this for 30 minutes" is
14166
+ * an answer to the notification, and being thrown into a browser tab to
14167
+ * confirm it costs more attention than the notification did. A backend that
14168
+ * cannot do a background call renders it as an ordinary link (the adapters
14169
+ * fall back rather than dropping the button), so this is a preference, never
14170
+ * a requirement.
14171
+ */
14172
+ mode: _enum(["navigate", "background"]).optional()
14173
+ });
14174
+ /** A delivery parameter value: what a notifier declared it takes. */
14175
+ var DeliveryParamValueSchema = union([
14176
+ string(),
14177
+ number(),
14178
+ boolean()
14179
+ ]);
14180
+ /**
14181
+ * One extra delivery parameter a notifier KIND declares (D938). A rule that
14182
+ * addresses a target of that kind may set it; a kind that declares nothing is
14183
+ * never handed one. The admin UI derives its control from this descriptor —
14184
+ * no editor knows a service by name.
14185
+ *
14186
+ * Optional fields are `.optional()`, never `.default()` (a Zod default does not
14187
+ * run on the addon cap path).
14188
+ */
14189
+ var DeliveryParamSchema = object({
14190
+ key: string().min(1),
14191
+ label: string(),
14192
+ /** i18n key of the label, resolved by the declaring addon's namespace. */
14193
+ labelKey: string().optional(),
14194
+ type: _enum([
14195
+ "enum",
14196
+ "number",
14197
+ "boolean",
14198
+ "string"
14199
+ ]),
14200
+ /** `enum` only: the closed set of accepted values. */
14201
+ options: array(object({
14202
+ value: string(),
14203
+ label: string()
14204
+ })).optional(),
14205
+ /** `number` only. */
14206
+ min: number().optional(),
14207
+ max: number().optional(),
14208
+ /** What the notifier does when the rule sets nothing; shown as the placeholder. */
14209
+ default: DeliveryParamValueSchema.optional()
14210
+ });
14211
+ /**
14212
+ * The canonical notification. `body` is the only hard field (Apprise model).
14213
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14214
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14215
+ * the adapter maps this ordinal onto its native level. `level?` is an
14216
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
14217
+ * `priority` for that one target.
14218
+ */
14219
+ var NotificationSchema = object({
14220
+ body: string(),
14221
+ title: string().optional(),
14222
+ format: NotificationFormatSchema.default("text"),
14223
+ priority: number().int().min(1).max(5).default(3),
14224
+ level: string().optional(),
14225
+ attachments: array(AttachmentSchema).optional(),
14226
+ clickUrl: string().optional(),
14227
+ actions: array(NotificationActionSchema).optional(),
14228
+ sound: string().optional(),
14229
+ ttl: number().optional(),
14230
+ tag: string().optional(),
14231
+ deviceId: number().optional(),
14232
+ eventId: string().optional(),
14233
+ metadata: record(string(), unknown()).optional(),
14234
+ /**
14235
+ * Values for the parameters the target's kind DECLARES in
14236
+ * {@link TargetKindSchema} `deliveryParams`. Already validated against the
14237
+ * declaration by the sender; a notifier reads only the keys it declared.
14238
+ */
14239
+ delivery: record(string(), DeliveryParamValueSchema).optional()
14240
+ });
14241
+ /** One declared native severity/priority level for a kind. */
14242
+ var TargetKindLevelSchema = object({
14243
+ id: string(),
14244
+ label: string(),
14245
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14246
+ ordinal: number().int().min(1).max(5).nullable(),
14247
+ flags: object({
14248
+ critical: boolean().optional(),
14249
+ silent: boolean().optional(),
14250
+ noPush: boolean().optional()
14251
+ }).optional(),
14252
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14253
+ requires: array(string()).optional(),
14254
+ description: string().optional()
14255
+ });
14256
+ /** The full capability block consulted before dispatch. */
14257
+ var TargetKindCapsSchema = object({
14258
+ attachments: object({
14259
+ mediaTypes: array(AttachmentMediaTypeSchema),
14260
+ mode: _enum([
14261
+ "url",
14262
+ "bytes",
14263
+ "both"
14264
+ ]),
14265
+ max: number().int().nonnegative(),
14266
+ maxBytes: number().int().positive().optional()
14267
+ }),
14268
+ /** Max action buttons (0 = none). */
14269
+ actions: number().int().nonnegative(),
14270
+ /**
14271
+ * Whether this kind renders a per-action ICON.
14272
+ *
14273
+ * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
14274
+ * run on the addon cap path — three production failures in one day taught
14275
+ * this repo that once. Absent is read as false by the degrade engine, which
14276
+ * is the safe direction: an icon that is not rendered costs nothing, an icon
14277
+ * assumed and dropped costs the operator's trust in the field.
14278
+ */
14279
+ actionIcons: boolean().optional(),
14280
+ levels: array(TargetKindLevelSchema),
14281
+ format: array(NotificationFormatSchema),
14282
+ clickUrl: boolean(),
14283
+ sound: boolean(),
14284
+ ttl: boolean(),
14285
+ bodyMaxLen: number().int().positive()
14286
+ });
14287
+ /**
14288
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14289
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14290
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14291
+ * the union is large and not meant for runtime validation here; the exported
14292
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14293
+ */
14294
+ var ConfigSchemaPassthrough$4 = unknown();
14295
+ var TargetKindSchema = object({
14296
+ kind: string(),
14297
+ label: string(),
14298
+ icon: string(),
14299
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
14300
+ addonId: string(),
14301
+ /**
14302
+ * URL of the kind's bundled BRAND icon, served by the providing addon over
14303
+ * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
14304
+ * when the addon bundles no icon for that kind — the client then falls back
14305
+ * to a neutral glyph rather than rendering the raw `icon` NAME as text.
14306
+ *
14307
+ * Root-relative on purpose: it resolves against whatever origin serves a web
14308
+ * client, and a native client joins it onto its own hub base.
14309
+ *
14310
+ * DECLARED here deliberately. It used to travel as an undeclared passthrough
14311
+ * field that survived only because the runtime cap-router forwards provider
14312
+ * output verbatim — so every consumer had to re-declare it by hand to stop
14313
+ * its own Zod parse from stripping it, and the whole arrangement would have
14314
+ * broken silently the moment output validation was tightened anywhere.
14315
+ */
14316
+ iconUrl: string().optional(),
14317
+ /**
14318
+ * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
14319
+ *
14320
+ * The server knows this and therefore says it, because the client cannot
14321
+ * safely guess: a React-Native client renders SVG and raster through two
14322
+ * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
14323
+ * not decode SVG on iOS/Android), so without this it silently fell back to a
14324
+ * placeholder glyph for every vector icon while the web build looked fine.
14325
+ *
14326
+ * Absent when {@link iconUrl} is absent, or for a legacy provider that has
14327
+ * not been updated — a client that cannot determine the type should prefer
14328
+ * its raster path, which is the safe default for an unknown image.
14329
+ */
14330
+ iconMediaType: string().optional(),
14331
+ configSchema: ConfigSchemaPassthrough$4,
14332
+ /**
14333
+ * The config keys that decide WHERE this kind's secrets are sent (server,
14334
+ * base URL, instance, chat, recipient). A save that changes any of them
14335
+ * while leaving a secret redacted is refused by the provider (D634), so an
14336
+ * editor uses this to ask for the secret on exactly those edits instead of
14337
+ * on every edit.
14338
+ *
14339
+ * Optional: absent from a provider that holds no secret (the Home Assistant
14340
+ * kinds) and from a provider older than this field — an editor that finds
14341
+ * it absent must assume ANY edit may need the secret.
14342
+ */
14343
+ destinationKeys: array(string()).optional(),
14344
+ supportsDiscovery: boolean(),
14345
+ /**
14346
+ * Extra delivery parameters a rule may set for a target of this kind (D938).
14347
+ * Absent = none; the rule editor then offers nothing.
14348
+ */
14349
+ deliveryParams: array(DeliveryParamSchema).optional(),
14350
+ caps: TargetKindCapsSchema
14351
+ });
14352
+ /**
14353
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
14354
+ * (return a presence marker only) when serving `listTargets` — never
14355
+ * round-trip a stored secret to the UI.
14356
+ */
14357
+ var TargetSchema = object({
14358
+ id: string(),
14359
+ name: string(),
14360
+ kind: string(),
14361
+ addonId: string(),
14362
+ enabled: boolean(),
14363
+ config: record(string(), unknown())
14364
+ });
14365
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
14366
+ var DiscoveredTargetSchema = object({
14367
+ kind: string(),
14368
+ suggestedName: string(),
14369
+ config: record(string(), unknown())
14370
+ });
14371
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
14372
+ var RenderedAsSchema = object({
14373
+ level: string(),
14374
+ format: NotificationFormatSchema,
14375
+ attachmentsSent: number().int().nonnegative(),
14376
+ actionsSent: number().int().nonnegative(),
14377
+ truncated: boolean(),
14378
+ dropped: array(string())
14379
+ });
14380
+ var SendResultSchema = object({
14381
+ success: boolean(),
14382
+ error: string().optional(),
14383
+ renderedAs: RenderedAsSchema.optional()
14384
+ });
14385
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
14386
+ var TestResultSchema = SendResultSchema;
14387
+ /**
14388
+ * Pre-save credential probe against a partial (unsaved) target config.
14389
+ * `resolvedUrl` never includes secrets (token stripped from path).
14390
+ */
14391
+ var ProbeTargetConfigResultSchema = object({
14392
+ ok: boolean(),
14393
+ resolvedUrl: string(),
14394
+ httpStatus: number().int().optional(),
14395
+ stateInstance: string().optional(),
14396
+ error: string().optional()
14397
+ });
14398
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
14399
+ kind: string(),
14400
+ config: record(string(), unknown()).optional(),
14401
+ /**
14402
+ * When editing / duplicating, the blank password field never round-trips
14403
+ * the stored token. Pass the source target id so the provider can restore
14404
+ * secrets server-side before dialling (same merge as upsert).
14405
+ */
14406
+ targetId: string().optional()
14407
+ }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
14408
+ kind: string(),
14409
+ config: record(string(), unknown()),
14410
+ /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
14411
+ targetId: string().optional()
14412
+ }), ProbeTargetConfigResultSchema, {
14413
+ kind: "mutation",
14414
+ auth: "admin"
14415
+ }), method(object({
14416
+ targetId: string(),
14417
+ notification: NotificationSchema
14418
+ }), SendResultSchema, {
14419
+ kind: "mutation",
14420
+ auth: "admin"
14421
+ }), method(object({
14422
+ targetId: string(),
14423
+ sample: NotificationSchema.optional()
14424
+ }), TestResultSchema, {
14425
+ kind: "mutation",
14426
+ auth: "admin"
14427
+ }), method(object({
14428
+ target: TargetSchema,
14429
+ /**
14430
+ * Duplicate flow: create a NEW target id while copying secrets from an
14431
+ * existing row. The UI never holds the stored token; blank / redacted
14432
+ * password fields are restored from this source (D634 still applies if
14433
+ * destinations diverge without a re-typed secret).
14434
+ */
14435
+ cloneSecretsFrom: string().optional()
14436
+ }), TargetSchema, {
14437
+ kind: "mutation",
14438
+ auth: "admin"
14439
+ }), method(object({ targetId: string() }), _void(), {
14440
+ kind: "mutation",
14441
+ auth: "admin"
14442
+ }), method(object({
14443
+ targetId: string(),
14444
+ enabled: boolean()
14445
+ }), _void(), {
14446
+ kind: "mutation",
14447
+ auth: "admin"
14448
+ });
14449
+ looseObject({
14450
+ name: string().min(1),
14451
+ enabled: boolean().optional()
14452
+ });
14453
+ TargetSchema.omit({ id: true });
14003
14454
  var EncodeProfileSchema = object({
14004
14455
  video: object({
14005
14456
  codec: _enum([
@@ -22387,7 +22838,6 @@ var SYSTEM_CAP_VOCABULARY = {
22387
22838
  "calendar-source": system(INTERNAL),
22388
22839
  calendars: system("calendars feed schedules and conditions, not device actions"),
22389
22840
  composer: system("device composition — an authoring tool, not an action"),
22390
- "connection-test": system(INTERNAL),
22391
22841
  "core-blocks": system(INTERNAL),
22392
22842
  "custom-model-registry": system(ML),
22393
22843
  "data-store-provider": system(INTERNAL),
@@ -44304,427 +44754,6 @@ var UnitWarningSchema = object({
44304
44754
  assumedUnit: string(),
44305
44755
  message: string()
44306
44756
  });
44307
- /**
44308
- * notification-output — canonical, capability-gated notification delivery.
44309
- *
44310
- * Apprise-derived model (see
44311
- * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
44312
- * callers emit ONE canonical `Notification`; each provider declares a
44313
- * per-kind capability descriptor (`TargetKind`), and the pure degrade
44314
- * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
44315
- * message to what the kind supports — callers never special-case a service.
44316
- *
44317
- * DESIGN DECISIONS (locked):
44318
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
44319
- * `setTargetEnabled`), each provider persisting via the `settings-store`
44320
- * cap. Rationale: the admin UI needs one uniform surface across the
44321
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
44322
- * alternative would fork the UI per addon and cannot host the
44323
- * discovery→adopt flow.
44324
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
44325
- * the generated cap-mount auto-`concatCollection`-fans them across every
44326
- * registered provider (notifiers addon + HA addon) so one catalog is
44327
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
44328
- * `addonId` the generated collection router extracts from the call input.
44329
- * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
44330
- * transformer) + UDS MsgPack both round-trip typed arrays — already used by
44331
- * `storage` / `storage-provider` / `recording` caps over the same path. No
44332
- * base64 fallback needed.
44333
- *
44334
- * TODO (deferred, closed-set change — separate decision): add
44335
- * `providerKind: 'notify'` so notification providers surface on the unified
44336
- * admin "Integrations" page.
44337
- */
44338
- /**
44339
- * Zentik-derived typed-media enum — the superset across every kind. Each
44340
- * adapter picks what it supports and the degrade engine filters the rest.
44341
- */
44342
- var AttachmentMediaTypeSchema = _enum([
44343
- "image",
44344
- "video",
44345
- "gif",
44346
- "audio",
44347
- "icon"
44348
- ]);
44349
- /**
44350
- * A single attachment. Exactly one of `url` (remote source, most adapters
44351
- * prefer this) or `bytes` (inline source; required for Pushover-style
44352
- * bytes-only kinds) MUST be present — the degrade engine expresses a
44353
- * url→bytes fetch as a `needsFetch` directive the adapter executes.
44354
- */
44355
- var AttachmentSchema = object({
44356
- mediaType: AttachmentMediaTypeSchema,
44357
- url: string().optional(),
44358
- bytes: _instanceof(Uint8Array).optional(),
44359
- mime: string().optional(),
44360
- name: string().optional()
44361
- }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
44362
- var NotificationFormatSchema = _enum([
44363
- "text",
44364
- "markdown",
44365
- "html"
44366
- ]);
44367
- /**
44368
- * The CLOSED icon vocabulary an action button may use.
44369
- *
44370
- * A closed set, not a free string, and that is the whole point: an arbitrary
44371
- * icon name is one that ntfy renders, zentik silently drops, and nobody
44372
- * notices — the same class of gap as a zone vocabulary nothing produced
44373
- * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
44374
- * declares `actionIcons: false` and the degrade engine strips the field.
44375
- *
44376
- * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
44377
- * renderer's icon set; "acknowledge" survives an adapter that draws it
44378
- * differently.
44379
- *
44380
- * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
44381
- *
44382
- * These names are for US. **No adapter may forward one verbatim.** Each maps
44383
- * the whole set onto its own renderer's vocabulary through a
44384
- * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
44385
- * fallback, so adding a member here fails every adapter's build until someone
44386
- * decides its glyph, which is the only place that decision can be made
44387
- * honestly.
44388
- *
44389
- * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
44390
- * `disarm` straight through; iOS feeds that string to
44391
- * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
44392
- * and every snooze and alarm button arrived BLANK. A pass-through is not a
44393
- * mapping, and "the field is documented" is not "the value renders".
44394
- *
44395
- * Adding a member is TRAIN-BOUND. The enum lives in the published
44396
- * `@camstack/server` closure and the cap seam validates against the HUB's copy,
44397
- * so an addon that emits a token the running hub does not know does not lose an
44398
- * icon — its whole `send` fails Zod validation and the notification never
44399
- * arrives. Never emit a new token from an addon before the train carrying it.
44400
- */
44401
- var NotificationActionIconSchema = _enum([
44402
- "acknowledge",
44403
- "dismiss",
44404
- "silence",
44405
- "snooze",
44406
- "view",
44407
- "play",
44408
- "open",
44409
- "close",
44410
- "lock",
44411
- "unlock",
44412
- "arm",
44413
- "arm-home",
44414
- "arm-away",
44415
- "arm-night",
44416
- "disarm",
44417
- "light",
44418
- "alert",
44419
- "camera"
44420
- ]);
44421
- /** A single tap-through action button. */
44422
- var NotificationActionSchema = object({
44423
- id: string(),
44424
- label: string(),
44425
- url: string().optional(),
44426
- /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
44427
- icon: NotificationActionIconSchema.optional(),
44428
- /**
44429
- * Renders in a warning style where the notifier supports it.
44430
- *
44431
- * A HINT, never a gate. The callback's authority is its token and nothing
44432
- * else — see `notification-center/action-token.ts` for what that does and
44433
- * does not buy.
44434
- */
44435
- destructive: boolean().optional(),
44436
- /**
44437
- * How the tap should REACH the url.
44438
- *
44439
- * `navigate` (absent, and every button authored before this field) opens it:
44440
- * the phone leaves the notification and shows whatever the callback returns.
44441
- * That is right for a button whose answer the operator wants to read.
44442
- *
44443
- * `background` fires it as a POST and stays put. It exists for the buttons
44444
- * whose whole point is not to interrupt — "silence this for 30 minutes" is
44445
- * an answer to the notification, and being thrown into a browser tab to
44446
- * confirm it costs more attention than the notification did. A backend that
44447
- * cannot do a background call renders it as an ordinary link (the adapters
44448
- * fall back rather than dropping the button), so this is a preference, never
44449
- * a requirement.
44450
- */
44451
- mode: _enum(["navigate", "background"]).optional()
44452
- });
44453
- /** A delivery parameter value: what a notifier declared it takes. */
44454
- var DeliveryParamValueSchema = union([
44455
- string(),
44456
- number(),
44457
- boolean()
44458
- ]);
44459
- /**
44460
- * One extra delivery parameter a notifier KIND declares (D938). A rule that
44461
- * addresses a target of that kind may set it; a kind that declares nothing is
44462
- * never handed one. The admin UI derives its control from this descriptor —
44463
- * no editor knows a service by name.
44464
- *
44465
- * Optional fields are `.optional()`, never `.default()` (a Zod default does not
44466
- * run on the addon cap path).
44467
- */
44468
- var DeliveryParamSchema = object({
44469
- key: string().min(1),
44470
- label: string(),
44471
- /** i18n key of the label, resolved by the declaring addon's namespace. */
44472
- labelKey: string().optional(),
44473
- type: _enum([
44474
- "enum",
44475
- "number",
44476
- "boolean",
44477
- "string"
44478
- ]),
44479
- /** `enum` only: the closed set of accepted values. */
44480
- options: array(object({
44481
- value: string(),
44482
- label: string()
44483
- })).optional(),
44484
- /** `number` only. */
44485
- min: number().optional(),
44486
- max: number().optional(),
44487
- /** What the notifier does when the rule sets nothing; shown as the placeholder. */
44488
- default: DeliveryParamValueSchema.optional()
44489
- });
44490
- /**
44491
- * The canonical notification. `body` is the only hard field (Apprise model).
44492
- * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
44493
- * NOT a fixed severity enum — each kind declares its own `caps.levels` and
44494
- * the adapter maps this ordinal onto its native level. `level?` is an
44495
- * optional kind-native level id (`emergency`, `silent`, …) that overrides
44496
- * `priority` for that one target.
44497
- */
44498
- var NotificationSchema = object({
44499
- body: string(),
44500
- title: string().optional(),
44501
- format: NotificationFormatSchema.default("text"),
44502
- priority: number().int().min(1).max(5).default(3),
44503
- level: string().optional(),
44504
- attachments: array(AttachmentSchema).optional(),
44505
- clickUrl: string().optional(),
44506
- actions: array(NotificationActionSchema).optional(),
44507
- sound: string().optional(),
44508
- ttl: number().optional(),
44509
- tag: string().optional(),
44510
- deviceId: number().optional(),
44511
- eventId: string().optional(),
44512
- metadata: record(string(), unknown()).optional(),
44513
- /**
44514
- * Values for the parameters the target's kind DECLARES in
44515
- * {@link TargetKindSchema} `deliveryParams`. Already validated against the
44516
- * declaration by the sender; a notifier reads only the keys it declared.
44517
- */
44518
- delivery: record(string(), DeliveryParamValueSchema).optional()
44519
- });
44520
- /** One declared native severity/priority level for a kind. */
44521
- var TargetKindLevelSchema = object({
44522
- id: string(),
44523
- label: string(),
44524
- /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
44525
- ordinal: number().int().min(1).max(5).nullable(),
44526
- flags: object({
44527
- critical: boolean().optional(),
44528
- silent: boolean().optional(),
44529
- noPush: boolean().optional()
44530
- }).optional(),
44531
- /** e.g. Pushover `emergency` requires `retry` / `expire`. */
44532
- requires: array(string()).optional(),
44533
- description: string().optional()
44534
- });
44535
- /** The full capability block consulted before dispatch. */
44536
- var TargetKindCapsSchema = object({
44537
- attachments: object({
44538
- mediaTypes: array(AttachmentMediaTypeSchema),
44539
- mode: _enum([
44540
- "url",
44541
- "bytes",
44542
- "both"
44543
- ]),
44544
- max: number().int().nonnegative(),
44545
- maxBytes: number().int().positive().optional()
44546
- }),
44547
- /** Max action buttons (0 = none). */
44548
- actions: number().int().nonnegative(),
44549
- /**
44550
- * Whether this kind renders a per-action ICON.
44551
- *
44552
- * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
44553
- * run on the addon cap path — three production failures in one day taught
44554
- * this repo that once. Absent is read as false by the degrade engine, which
44555
- * is the safe direction: an icon that is not rendered costs nothing, an icon
44556
- * assumed and dropped costs the operator's trust in the field.
44557
- */
44558
- actionIcons: boolean().optional(),
44559
- levels: array(TargetKindLevelSchema),
44560
- format: array(NotificationFormatSchema),
44561
- clickUrl: boolean(),
44562
- sound: boolean(),
44563
- ttl: boolean(),
44564
- bodyMaxLen: number().int().positive()
44565
- });
44566
- /**
44567
- * `configSchema` is a `ConfigUISchema` tree passed through to the admin
44568
- * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
44569
- * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
44570
- * the union is large and not meant for runtime validation here; the exported
44571
- * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
44572
- */
44573
- var ConfigSchemaPassthrough$4 = unknown();
44574
- var TargetKindSchema = object({
44575
- kind: string(),
44576
- label: string(),
44577
- icon: string(),
44578
- /** Stamped by each provider so the concat-fanned catalog stays routable. */
44579
- addonId: string(),
44580
- /**
44581
- * URL of the kind's bundled BRAND icon, served by the providing addon over
44582
- * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
44583
- * when the addon bundles no icon for that kind — the client then falls back
44584
- * to a neutral glyph rather than rendering the raw `icon` NAME as text.
44585
- *
44586
- * Root-relative on purpose: it resolves against whatever origin serves a web
44587
- * client, and a native client joins it onto its own hub base.
44588
- *
44589
- * DECLARED here deliberately. It used to travel as an undeclared passthrough
44590
- * field that survived only because the runtime cap-router forwards provider
44591
- * output verbatim — so every consumer had to re-declare it by hand to stop
44592
- * its own Zod parse from stripping it, and the whole arrangement would have
44593
- * broken silently the moment output validation was tightened anywhere.
44594
- */
44595
- iconUrl: string().optional(),
44596
- /**
44597
- * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
44598
- *
44599
- * The server knows this and therefore says it, because the client cannot
44600
- * safely guess: a React-Native client renders SVG and raster through two
44601
- * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
44602
- * not decode SVG on iOS/Android), so without this it silently fell back to a
44603
- * placeholder glyph for every vector icon while the web build looked fine.
44604
- *
44605
- * Absent when {@link iconUrl} is absent, or for a legacy provider that has
44606
- * not been updated — a client that cannot determine the type should prefer
44607
- * its raster path, which is the safe default for an unknown image.
44608
- */
44609
- iconMediaType: string().optional(),
44610
- configSchema: ConfigSchemaPassthrough$4,
44611
- /**
44612
- * The config keys that decide WHERE this kind's secrets are sent (server,
44613
- * base URL, instance, chat, recipient). A save that changes any of them
44614
- * while leaving a secret redacted is refused by the provider (D634), so an
44615
- * editor uses this to ask for the secret on exactly those edits instead of
44616
- * on every edit.
44617
- *
44618
- * Optional: absent from a provider that holds no secret (the Home Assistant
44619
- * kinds) and from a provider older than this field — an editor that finds
44620
- * it absent must assume ANY edit may need the secret.
44621
- */
44622
- destinationKeys: array(string()).optional(),
44623
- supportsDiscovery: boolean(),
44624
- /**
44625
- * Extra delivery parameters a rule may set for a target of this kind (D938).
44626
- * Absent = none; the rule editor then offers nothing.
44627
- */
44628
- deliveryParams: array(DeliveryParamSchema).optional(),
44629
- caps: TargetKindCapsSchema
44630
- });
44631
- /**
44632
- * A persisted target. `config` holds secrets; providers REDACT secret fields
44633
- * (return a presence marker only) when serving `listTargets` — never
44634
- * round-trip a stored secret to the UI.
44635
- */
44636
- var TargetSchema = object({
44637
- id: string(),
44638
- name: string(),
44639
- kind: string(),
44640
- addonId: string(),
44641
- enabled: boolean(),
44642
- config: record(string(), unknown())
44643
- });
44644
- /** A discovery-surfaced candidate (config is partial + non-secret). */
44645
- var DiscoveredTargetSchema = object({
44646
- kind: string(),
44647
- suggestedName: string(),
44648
- config: record(string(), unknown())
44649
- });
44650
- /** The degrade engine's report — what was resolved / dropped / degraded. */
44651
- var RenderedAsSchema = object({
44652
- level: string(),
44653
- format: NotificationFormatSchema,
44654
- attachmentsSent: number().int().nonnegative(),
44655
- actionsSent: number().int().nonnegative(),
44656
- truncated: boolean(),
44657
- dropped: array(string())
44658
- });
44659
- var SendResultSchema = object({
44660
- success: boolean(),
44661
- error: string().optional(),
44662
- renderedAs: RenderedAsSchema.optional()
44663
- });
44664
- /** Same shape as SendResult — kept as a distinct name for the test panel. */
44665
- var TestResultSchema = SendResultSchema;
44666
- /**
44667
- * Pre-save credential probe against a partial (unsaved) target config.
44668
- * `resolvedUrl` never includes secrets (token stripped from path).
44669
- */
44670
- var ProbeTargetConfigResultSchema = object({
44671
- ok: boolean(),
44672
- resolvedUrl: string(),
44673
- httpStatus: number().int().optional(),
44674
- stateInstance: string().optional(),
44675
- error: string().optional()
44676
- });
44677
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
44678
- kind: string(),
44679
- config: record(string(), unknown()).optional(),
44680
- /**
44681
- * When editing / duplicating, the blank password field never round-trips
44682
- * the stored token. Pass the source target id so the provider can restore
44683
- * secrets server-side before dialling (same merge as upsert).
44684
- */
44685
- targetId: string().optional()
44686
- }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
44687
- kind: string(),
44688
- config: record(string(), unknown()),
44689
- /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
44690
- targetId: string().optional()
44691
- }), ProbeTargetConfigResultSchema, {
44692
- kind: "mutation",
44693
- auth: "admin"
44694
- }), method(object({
44695
- targetId: string(),
44696
- notification: NotificationSchema
44697
- }), SendResultSchema, {
44698
- kind: "mutation",
44699
- auth: "admin"
44700
- }), method(object({
44701
- targetId: string(),
44702
- sample: NotificationSchema.optional()
44703
- }), TestResultSchema, {
44704
- kind: "mutation",
44705
- auth: "admin"
44706
- }), method(object({
44707
- target: TargetSchema,
44708
- /**
44709
- * Duplicate flow: create a NEW target id while copying secrets from an
44710
- * existing row. The UI never holds the stored token; blank / redacted
44711
- * password fields are restored from this source (D634 still applies if
44712
- * destinations diverge without a re-typed secret).
44713
- */
44714
- cloneSecretsFrom: string().optional()
44715
- }), TargetSchema, {
44716
- kind: "mutation",
44717
- auth: "admin"
44718
- }), method(object({ targetId: string() }), _void(), {
44719
- kind: "mutation",
44720
- auth: "admin"
44721
- }), method(object({
44722
- targetId: string(),
44723
- enabled: boolean()
44724
- }), _void(), {
44725
- kind: "mutation",
44726
- auth: "admin"
44727
- });
44728
44757
  function errorText(err) {
44729
44758
  return err instanceof Error ? err.message : String(err);
44730
44759
  }
@@ -48688,37 +48717,6 @@ method(object({
48688
48717
  kind: "mutation",
48689
48718
  auth: "admin"
48690
48719
  }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
48691
- var ConnectionTestOutcomeSchema = discriminatedUnion("outcome", [
48692
- object({
48693
- outcome: literal("validated"),
48694
- /** Round-trip of the sign-in, when the provider measured it. */
48695
- latencyMs: number().nonnegative().optional(),
48696
- /** Optional human detail worth showing next to the tick
48697
- * ("3 devices visible on this account"). */
48698
- detail: string().optional()
48699
- }).strict(),
48700
- object({
48701
- outcome: literal("rejected"),
48702
- error: string()
48703
- }).strict(),
48704
- object({
48705
- outcome: literal("inconclusive"),
48706
- error: string()
48707
- }).strict()
48708
- ]);
48709
- var ConnectionTestInputSchema = object({
48710
- /** Candidate integration settings, exactly as the create form collected them. */
48711
- settings: record(string(), unknown()) });
48712
- /**
48713
- * What the provider's test actually DOES, so the UI can say it in words before
48714
- * the operator presses the button ("Signs in to the Dreo cloud"). Purely
48715
- * descriptive — it never changes routing.
48716
- */
48717
- var ConnectionTestDescriptorSchema = object({ label: string() });
48718
- method(ConnectionTestInputSchema, ConnectionTestOutcomeSchema, {
48719
- kind: "mutation",
48720
- auth: "admin"
48721
- }), method(_void(), ConnectionTestDescriptorSchema, { auth: "admin" });
48722
48720
  object({
48723
48721
  /** True when the upstream system considers the entity connected. */
48724
48722
  connected: boolean(),
@@ -54641,10 +54639,9 @@ var AvailableIntegrationTypeSchema = object({
54641
54639
  * locations" checkbox. Provider-declared in the addon manifest. */
54642
54640
  supportsLocationImport: boolean(),
54643
54641
  /**
54644
- * True when this integration DECLARES a pre-creation test (the
54645
- * `connection-test` cap, or a broker whose settings it stores). Drives the
54646
- * Test button: an integration that cannot be tested must say so up front
54647
- * rather than offering a button that always answers the same nonsense.
54642
+ * True when this integration's instances declare a Test (`integration-instances.describe().canTest`,
54643
+ * D1016). An integration that cannot be tested must say so up front rather than offering a
54644
+ * button that always answers the same nonsense.
54648
54645
  */
54649
54646
  canTest: boolean(),
54650
54647
  existingInstances: array(object({
@@ -54698,7 +54695,9 @@ var CreateIntegrationInputSchema = object({
54698
54695
  info: record(string(), unknown()).optional(),
54699
54696
  /** `stableId` of the discovery candidate the form was seeded from (D984). */
54700
54697
  originStableId: string().optional(),
54701
- settings: record(string(), unknown()).optional()
54698
+ settings: record(string(), unknown()).optional(),
54699
+ /** The instance kind being created, for a provider with several; omitted = its only testable kind. */
54700
+ kind: string().min(1).optional()
54702
54701
  });
54703
54702
  var UpdateIntegrationInputSchema = object({
54704
54703
  id: string(),
@@ -54724,13 +54723,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
54724
54723
  }), method(object({ id: string() }), DeleteIntegrationResultSchema, {
54725
54724
  kind: "mutation",
54726
54725
  auth: "admin"
54727
- }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" }), method(object({
54728
- addonId: string(),
54729
- settings: record(string(), unknown())
54730
- }), TestConnectionResultSchema, {
54731
- kind: "mutation",
54732
- auth: "admin"
54733
- });
54726
+ }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" });
54734
54727
  /**
54735
54728
  * `integration-instances` - the connection of an addon that holds ONE or SEVERAL
54736
54729
  * (an account, a relay, a destination) as typed records (D985, D986). The addon's
@@ -62973,13 +62966,6 @@ var AddBrokerInputSchema = object({
62973
62966
  });
62974
62967
  var AddBrokerResultSchema = object({ id: string() });
62975
62968
  var IdInputSchema = object({ id: string() });
62976
- var TestResultSchema$1 = discriminatedUnion("ok", [object({
62977
- ok: literal(true),
62978
- latencyMs: number()
62979
- }), object({
62980
- ok: literal(false),
62981
- error: string()
62982
- })]);
62983
62969
  var StartEmbeddedInputSchema = object({
62984
62970
  port: number().int().min(1).max(65535).default(1883),
62985
62971
  /** Allow anonymous connect (no username/password). Default: false. */
@@ -63002,9 +62988,6 @@ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnection
63002
62988
  }), method(IdInputSchema, _void(), {
63003
62989
  kind: "mutation",
63004
62990
  auth: "admin"
63005
- }), method(IdInputSchema, TestResultSchema$1, {
63006
- kind: "mutation",
63007
- auth: "admin"
63008
62991
  }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, {
63009
62992
  kind: "mutation",
63010
62993
  auth: "admin"
@@ -74651,7 +74634,7 @@ var TrainingProviderTypeSchema = object({
74651
74634
  label: string(),
74652
74635
  /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
74653
74636
  iconAsset: string(),
74654
- /** Owning `training-provider` addon — collection selector for createEntry. */
74637
+ /** Owning `training-provider` addon. */
74655
74638
  addonId: string(),
74656
74639
  /**
74657
74640
  * Fields for one entry of this type (credentials + defaults). Absent on a
@@ -74696,36 +74679,6 @@ var TrainingProviderDescriptorSchema = object({
74696
74679
  */
74697
74680
  formValues: record(string(), unknown()).optional()
74698
74681
  });
74699
- /**
74700
- * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
74701
- * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
74702
- * `{ $secretClear: true }` clears it.
74703
- */
74704
- var TrainingProviderUpdateEntryInputSchema = object({
74705
- entryId: string().min(1),
74706
- name: string().min(1),
74707
- tokenId: string().optional(),
74708
- tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
74709
- environment: string().optional(),
74710
- gpuType: string().optional(),
74711
- region: string().optional(),
74712
- costCapUsd: number().nonnegative().optional(),
74713
- maxRuntimeSec: number().int().positive().optional(),
74714
- failedDatasetGraceHours: number().nonnegative().optional()
74715
- });
74716
- var TrainingCredentialCheckSchema = object({
74717
- ok: boolean(),
74718
- /** Workspace / account name, when the provider says. */
74719
- account: string().optional(),
74720
- reason: _enum([
74721
- "missing",
74722
- "invalid",
74723
- "forbidden",
74724
- "network",
74725
- "quota"
74726
- ]).optional(),
74727
- detail: string().optional()
74728
- });
74729
74682
  var ProviderJobStateSchema = _enum([
74730
74683
  "pending",
74731
74684
  "starting",
@@ -74773,22 +74726,6 @@ var TrainingLogLineSchema = object({
74773
74726
  text: string()
74774
74727
  });
74775
74728
  method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
74776
- typeId: string().min(1),
74777
- name: string().min(1)
74778
- }), object({ entryId: string() }), {
74779
- kind: "mutation",
74780
- auth: "admin"
74781
- }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
74782
- kind: "mutation",
74783
- auth: "admin"
74784
- }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
74785
- kind: "mutation",
74786
- auth: "admin"
74787
- }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
74788
- kind: "mutation",
74789
- auth: "admin",
74790
- timeoutMs: 3e4
74791
- }), method(object({
74792
74729
  entryId: string().min(1),
74793
74730
  gpuType: string(),
74794
74731
  region: string(),
@@ -78174,20 +78111,6 @@ Object.freeze({
78174
78111
  access: "view",
78175
78112
  role: "admin"
78176
78113
  },
78177
- "connectionTest.describeTest": {
78178
- capName: "connection-test",
78179
- capScope: "system",
78180
- addonId: null,
78181
- access: "view",
78182
- role: "admin"
78183
- },
78184
- "connectionTest.testSettings": {
78185
- capName: "connection-test",
78186
- capScope: "system",
78187
- addonId: null,
78188
- access: "create",
78189
- role: "admin"
78190
- },
78191
78114
  "connectivity.getStatus": {
78192
78115
  capName: "connectivity",
78193
78116
  capScope: "device",
@@ -80554,13 +80477,6 @@ Object.freeze({
80554
80477
  access: "view",
80555
80478
  role: "admin"
80556
80479
  },
80557
- "integrations.testConnection": {
80558
- capName: "integrations",
80559
- capScope: "system",
80560
- addonId: null,
80561
- access: "create",
80562
- role: "admin"
80563
- },
80564
80480
  "integrations.update": {
80565
80481
  capName: "integrations",
80566
80482
  capScope: "system",
@@ -81793,13 +81709,6 @@ Object.freeze({
81793
81709
  access: "create",
81794
81710
  role: "admin"
81795
81711
  },
81796
- "mqttBroker.testConnection": {
81797
- capName: "mqtt-broker",
81798
- capScope: "system",
81799
- addonId: null,
81800
- access: "create",
81801
- role: "admin"
81802
- },
81803
81712
  "nativeObjectDetection.getOptions": {
81804
81713
  capName: "native-object-detection",
81805
81714
  capScope: "device",
@@ -86630,20 +86539,6 @@ Object.freeze({
86630
86539
  access: "create",
86631
86540
  role: "admin"
86632
86541
  },
86633
- "trainingProvider.createEntry": {
86634
- capName: "training-provider",
86635
- capScope: "system",
86636
- addonId: null,
86637
- access: "create",
86638
- role: "admin"
86639
- },
86640
- "trainingProvider.deleteEntry": {
86641
- capName: "training-provider",
86642
- capScope: "system",
86643
- addonId: null,
86644
- access: "delete",
86645
- role: "admin"
86646
- },
86647
86542
  "trainingProvider.describe": {
86648
86543
  capName: "training-provider",
86649
86544
  capScope: "system",
@@ -86714,13 +86609,6 @@ Object.freeze({
86714
86609
  access: "create",
86715
86610
  role: "admin"
86716
86611
  },
86717
- "trainingProvider.updateEntry": {
86718
- capName: "training-provider",
86719
- capScope: "system",
86720
- addonId: null,
86721
- access: "create",
86722
- role: "admin"
86723
- },
86724
86612
  "trainingProvider.uploadDataset": {
86725
86613
  capName: "training-provider",
86726
86614
  capScope: "system",
@@ -86728,13 +86616,6 @@ Object.freeze({
86728
86616
  access: "create",
86729
86617
  role: "admin"
86730
86618
  },
86731
- "trainingProvider.validateCredentials": {
86732
- capName: "training-provider",
86733
- capScope: "system",
86734
- addonId: null,
86735
- access: "create",
86736
- role: "admin"
86737
- },
86738
86619
  "turnProvider.getTurnServers": {
86739
86620
  capName: "turn-provider",
86740
86621
  capScope: "system",