@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.
@@ -5987,7 +5987,7 @@ var ZodIssueCode = {
5987
5987
  var ZodFirstPartyTypeKind;
5988
5988
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5989
5989
  //#endregion
5990
- //#region ../types/dist/sleep-CmjWurK5.mjs
5990
+ //#region ../types/dist/sleep-D7ZKm4nb.mjs
5991
5991
  /**
5992
5992
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5993
5993
  * window to float samples (D455).
@@ -6696,10 +6696,33 @@ function integrationRowsApiOver(api) {
6696
6696
  };
6697
6697
  }
6698
6698
  var PREFIX$1 = "records/";
6699
+ /**
6700
+ * Cross-realm brand. An addon bundles its own copy of this module (D15) while
6701
+ * `ctx.records` is the HOST's door, so an error thrown by the host is an
6702
+ * instance of the host's classes, not of the addon's. The brand plus the code
6703
+ * make `instanceof` answer by identity of the failure, not of the copy.
6704
+ */
6705
+ var RECORDS_ERROR_BRAND = Symbol.for("camstack.records-error");
6706
+ function carriesBrand(value) {
6707
+ return typeof value === "object" && value !== null && Reflect.get(value, RECORDS_ERROR_BRAND) === true;
6708
+ }
6699
6709
  /** The base of every records failure. `detail` is the human part of the message. */
6700
6710
  var RecordsError = class extends Error {
6711
+ /** The code a subclass stands for; the base stands for every code. */
6712
+ static code = void 0;
6713
+ /**
6714
+ * `instanceof` across copies of this module: any branded error is a
6715
+ * `RecordsError`, and is an instance of a subclass only when its code is the
6716
+ * subclass's code. Same-copy answers are unchanged.
6717
+ */
6718
+ static [Symbol.hasInstance](value) {
6719
+ if (Function.prototype[Symbol.hasInstance].call(this, value)) return true;
6720
+ if (!carriesBrand(value)) return false;
6721
+ return this.code === void 0 || value.code === this.code;
6722
+ }
6701
6723
  code;
6702
6724
  detail;
6725
+ [RECORDS_ERROR_BRAND] = true;
6703
6726
  constructor(code, detail) {
6704
6727
  super(`${PREFIX$1}${code}: ${detail}`);
6705
6728
  this.name = "RecordsError";
@@ -6708,29 +6731,33 @@ var RecordsError = class extends Error {
6708
6731
  }
6709
6732
  };
6710
6733
  /** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
6711
- var RevConflictError = class extends RecordsError {
6734
+ var RevConflictError = class RevConflictError extends RecordsError {
6735
+ static code = "rev-conflict";
6712
6736
  constructor(detail) {
6713
- super("rev-conflict", detail);
6737
+ super(RevConflictError.code, detail);
6714
6738
  this.name = "RevConflictError";
6715
6739
  }
6716
6740
  };
6717
6741
  /** The keychain could not store or serve a value: explicit, never an empty string. */
6718
- var RecordSecretUnavailableError = class extends RecordsError {
6742
+ var RecordSecretUnavailableError = class RecordSecretUnavailableError extends RecordsError {
6743
+ static code = "secret-unavailable";
6719
6744
  constructor(detail) {
6720
- super("secret-unavailable", detail);
6745
+ super(RecordSecretUnavailableError.code, detail);
6721
6746
  this.name = "RecordSecretUnavailableError";
6722
6747
  }
6723
6748
  };
6724
- var InvalidRecordError = class extends RecordsError {
6749
+ var InvalidRecordError = class InvalidRecordError extends RecordsError {
6750
+ static code = "invalid-record";
6725
6751
  constructor(detail) {
6726
- super("invalid-record", detail);
6752
+ super(InvalidRecordError.code, detail);
6727
6753
  this.name = "InvalidRecordError";
6728
6754
  }
6729
6755
  };
6730
6756
  /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
6731
- var DeclarationRefusedError = class extends RecordsError {
6757
+ var DeclarationRefusedError = class DeclarationRefusedError extends RecordsError {
6758
+ static code = "declaration-refused";
6732
6759
  constructor(detail) {
6733
- super("declaration-refused", detail);
6760
+ super(DeclarationRefusedError.code, detail);
6734
6761
  this.name = "DeclarationRefusedError";
6735
6762
  }
6736
6763
  };
@@ -9525,271 +9552,6 @@ function normalizeAddonInitResult(result) {
9525
9552
  if (Array.isArray(result)) return { providers: result };
9526
9553
  return result;
9527
9554
  }
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
9555
  object({
9794
9556
  field: string().min(1),
9795
9557
  on: literal("advance")
@@ -9878,6 +9640,271 @@ function optionalMethod(input, output, options) {
9878
9640
  providerOptional: true
9879
9641
  };
9880
9642
  }
9643
+ function defOf(schema) {
9644
+ const zodBag = Reflect.get(schema, "_zod");
9645
+ if (typeof zodBag !== "object" || zodBag === null) return {};
9646
+ const def = Reflect.get(zodBag, "def");
9647
+ if (typeof def !== "object" || def === null) return {};
9648
+ return def;
9649
+ }
9650
+ function declaredHere(schema) {
9651
+ return globalRegistry.get(schema)?.secret === true;
9652
+ }
9653
+ /** Wrapper kinds whose `innerType` is the field itself. */
9654
+ var WRAPPERS = new Set([
9655
+ "optional",
9656
+ "nullable",
9657
+ "default",
9658
+ "prefault",
9659
+ "catch",
9660
+ "readonly",
9661
+ "nonoptional"
9662
+ ]);
9663
+ /**
9664
+ * The schema layers that make up ONE field: the schema itself and every
9665
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
9666
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
9667
+ * `.transform` on `in`).
9668
+ */
9669
+ function layersOf(schema) {
9670
+ const out = [];
9671
+ const queue = [schema];
9672
+ while (queue.length > 0) {
9673
+ const s = queue.shift();
9674
+ if (!s || out.includes(s)) continue;
9675
+ out.push(s);
9676
+ const def = defOf(s);
9677
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
9678
+ if (def.type === "pipe") {
9679
+ if (def.in) queue.push(def.in);
9680
+ if (def.out) queue.push(def.out);
9681
+ }
9682
+ }
9683
+ return out;
9684
+ }
9685
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
9686
+ function isZodSecret(schema) {
9687
+ return layersOf(schema).some(declaredHere);
9688
+ }
9689
+ /**
9690
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
9691
+ * element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
9692
+ * map" (`applianceSecrets{}`). A declared
9693
+ * object or array is reported as one path and not descended into — everything
9694
+ * under it is secret.
9695
+ */
9696
+ function collectZodSecretPaths(schema, prefix = "") {
9697
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
9698
+ const paths = [];
9699
+ for (const layer of layersOf(schema)) {
9700
+ const def = defOf(layer);
9701
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
9702
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
9703
+ else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
9704
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
9705
+ else if (def.type === "intersection") {
9706
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
9707
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
9708
+ }
9709
+ }
9710
+ return [...new Set(paths)];
9711
+ }
9712
+ /**
9713
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
9714
+ * Zod row schema that describes it, and the helper that turns the two into the
9715
+ * JSON the engine stores.
9716
+ *
9717
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
9718
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
9719
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
9720
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
9721
+ * never a field name (D879).
9722
+ */
9723
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
9724
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
9725
+ var RecordIndexSchema = object({
9726
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
9727
+ fields: array(RecordFieldPathSchema).min(1).max(4),
9728
+ unique: boolean().optional()
9729
+ }).strict();
9730
+ var RecordRetentionSchema = union([
9731
+ object({
9732
+ ttlMs: number().int().positive(),
9733
+ from: _enum(["at", "write"])
9734
+ }).strict(),
9735
+ object({
9736
+ maxRows: number().int().positive().optional(),
9737
+ maxRowsPerDevice: number().int().positive().optional()
9738
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
9739
+ object({
9740
+ owner: string().min(1),
9741
+ reason: string().min(1)
9742
+ }).strict(),
9743
+ object({ none: string().min(1) }).strict()
9744
+ ]);
9745
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
9746
+ var EntryDescriptorSchema = object({
9747
+ title: string().min(1),
9748
+ /** The record body field shown as the entry's name. */
9749
+ nameField: string().min(1),
9750
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
9751
+ fields: record(string(), unknown())
9752
+ }).strict();
9753
+ /** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
9754
+ var RecordKindDeclarationSchema = object({
9755
+ database: _enum(RECORD_DATABASES).default("settings"),
9756
+ class: _enum(RECORD_CLASSES),
9757
+ writeTrigger: string().min(1),
9758
+ device: _enum([
9759
+ "required",
9760
+ "optional",
9761
+ "none"
9762
+ ]).default("none"),
9763
+ at: _enum(["required", "none"]).default("none"),
9764
+ indexes: array(RecordIndexSchema).max(8).default([]),
9765
+ retention: RecordRetentionSchema,
9766
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
9767
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
9768
+ /** Derived from the Zod schema; never written by hand. */
9769
+ secretPaths: array(string().min(1)).default([]),
9770
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
9771
+ secretArrayKeys: record(string(), string()).default({}),
9772
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
9773
+ transactFamily: string().min(1).optional(),
9774
+ entry: EntryDescriptorSchema.optional()
9775
+ }).strict();
9776
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
9777
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
9778
+ /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
9779
+ function assertValidDeclaration(name, decl) {
9780
+ const refuse = (why) => {
9781
+ throw new DeclarationRefusedError(`kind "${name}": ${why}`);
9782
+ };
9783
+ if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
9784
+ const seen = /* @__PURE__ */ new Set();
9785
+ for (const index of decl.indexes) {
9786
+ if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
9787
+ seen.add(index.name);
9788
+ }
9789
+ const { retention } = decl;
9790
+ const hasSecrets = decl.secretPaths.length > 0;
9791
+ if ("ttlMs" in retention) {
9792
+ if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
9793
+ if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
9794
+ }
9795
+ if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
9796
+ if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
9797
+ if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
9798
+ if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
9799
+ const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
9800
+ 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)`);
9801
+ }
9802
+ if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
9803
+ 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`);
9804
+ }
9805
+ function bodyFieldsOf(schema) {
9806
+ return { ...toJSONSchema(schema, {
9807
+ unrepresentable: "any",
9808
+ io: "input"
9809
+ }) };
9810
+ }
9811
+ function isRecordLike(value) {
9812
+ return typeof value === "object" && value !== null && !Array.isArray(value);
9813
+ }
9814
+ /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
9815
+ function hasNameField(json, field) {
9816
+ const branches = json["oneOf"] ?? json["anyOf"];
9817
+ if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
9818
+ const properties = json["properties"];
9819
+ return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
9820
+ }
9821
+ /**
9822
+ * Declare the kinds of a package. The keys are the kind names. The result is
9823
+ * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
9824
+ * types its handle from.
9825
+ */
9826
+ function defineRecordKinds(specs) {
9827
+ const out = {};
9828
+ for (const [name, spec] of Object.entries(specs)) {
9829
+ const secretPaths = collectZodSecretPaths(spec.schema);
9830
+ const nameField = spec.entry?.nameField ?? "name";
9831
+ const fields = bodyFieldsOf(spec.schema);
9832
+ if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
9833
+ const parsed = RecordKindDeclarationSchema.parse({
9834
+ database: spec.database,
9835
+ class: spec.class,
9836
+ writeTrigger: spec.writeTrigger,
9837
+ device: spec.device,
9838
+ at: spec.at,
9839
+ indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
9840
+ retention: spec.retention,
9841
+ deviceRemoval: spec.deviceRemoval,
9842
+ maxDataBytes: spec.maxDataBytes,
9843
+ secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
9844
+ secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
9845
+ transactFamily: spec.transactFamily,
9846
+ entry: spec.entry === void 0 ? void 0 : {
9847
+ title: spec.entry.title,
9848
+ nameField,
9849
+ fields
9850
+ }
9851
+ });
9852
+ assertValidDeclaration(name, parsed);
9853
+ out[name] = {
9854
+ name,
9855
+ schema: spec.schema,
9856
+ declaration: parsed
9857
+ };
9858
+ }
9859
+ return out;
9860
+ }
9861
+ /**
9862
+ * Declare one entry kind. An entry is configuration: never trimmed by the
9863
+ * engine, never aged, belonging to no device.
9864
+ */
9865
+ function defineEntryKind(name, spec) {
9866
+ const defined = defineRecordKinds({ [name]: {
9867
+ schema: spec.schema,
9868
+ class: "config",
9869
+ writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
9870
+ retention: { none: "an entry goes only when the operator deletes it" },
9871
+ ...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
9872
+ ...spec.database === void 0 ? {} : { database: spec.database },
9873
+ ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
9874
+ ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
9875
+ ...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
9876
+ entry: {
9877
+ title: spec.title,
9878
+ ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
9879
+ }
9880
+ } })[name];
9881
+ if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
9882
+ return defined;
9883
+ }
9884
+ /**
9885
+ * The share-view scope kinds a share-link token can carry. The hub mints
9886
+ * and validates them (`ShareViewGrantSchema` builds its
9887
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
9888
+ */
9889
+ var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
9890
+ /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
9891
+ var PeerBytesTicketSchema = object({
9892
+ /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
9893
+ url: string().min(1),
9894
+ /**
9895
+ * The HOST node this URL means something on — the hub or a named agent,
9896
+ * never a runner. {@link AddonPeerBytes.open} compares it to its own and
9897
+ * refuses `cross-node` by name when they differ, without dialling.
9898
+ */
9899
+ hostNodeId: string().min(1),
9900
+ expiresAtMs: number().int().nonnegative(),
9901
+ /**
9902
+ * What the producer DECLARED the body to be, when it knows — `null` when it
9903
+ * does not. Never `0` for unknown (D393): a consumer sizing a bound off this
9904
+ * must be able to tell "the producer did not say" from "the body is empty".
9905
+ */
9906
+ declaredBytes: number().int().nonnegative().nullable()
9907
+ });
9881
9908
  var READING_QUANTITIES = [
9882
9909
  "temperature",
9883
9910
  "pressure",
@@ -10478,7 +10505,6 @@ var CAP_NAMES = Object.freeze([
10478
10505
  "climate-control",
10479
10506
  "color",
10480
10507
  "composer",
10481
- "connection-test",
10482
10508
  "connectivity",
10483
10509
  "consumables",
10484
10510
  "contact",
@@ -12498,8 +12524,7 @@ Object.freeze({
12498
12524
  "offerArtifact": 3e5,
12499
12525
  "readResult": 3e5,
12500
12526
  "submitJob": 18e5,
12501
- "uploadDataset": 72e5,
12502
- "validateCredentials": 3e4
12527
+ "uploadDataset": 72e5
12503
12528
  }
12504
12529
  });
12505
12530
  object({
@@ -13971,6 +13996,432 @@ function buildCapturingReply(envelope) {
13971
13996
  };
13972
13997
  return wrapper;
13973
13998
  }
13999
+ /**
14000
+ * notification-output — canonical, capability-gated notification delivery.
14001
+ *
14002
+ * Apprise-derived model (see
14003
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14004
+ * callers emit ONE canonical `Notification`; each provider declares a
14005
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
14006
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14007
+ * message to what the kind supports — callers never special-case a service.
14008
+ *
14009
+ * DESIGN DECISIONS (locked):
14010
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14011
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
14012
+ * cap. Rationale: the admin UI needs one uniform surface across the
14013
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14014
+ * alternative would fork the UI per addon and cannot host the
14015
+ * discovery→adopt flow.
14016
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14017
+ * the generated cap-mount auto-`concatCollection`-fans them across every
14018
+ * registered provider (notifiers addon + HA addon) so one catalog is
14019
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14020
+ * `addonId` the generated collection router extracts from the call input.
14021
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14022
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14023
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
14024
+ * base64 fallback needed.
14025
+ *
14026
+ * TODO (deferred, closed-set change — separate decision): add
14027
+ * `providerKind: 'notify'` so notification providers surface on the unified
14028
+ * admin "Integrations" page.
14029
+ */
14030
+ /**
14031
+ * Zentik-derived typed-media enum — the superset across every kind. Each
14032
+ * adapter picks what it supports and the degrade engine filters the rest.
14033
+ */
14034
+ var AttachmentMediaTypeSchema = _enum([
14035
+ "image",
14036
+ "video",
14037
+ "gif",
14038
+ "audio",
14039
+ "icon"
14040
+ ]);
14041
+ /**
14042
+ * A single attachment. Exactly one of `url` (remote source, most adapters
14043
+ * prefer this) or `bytes` (inline source; required for Pushover-style
14044
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
14045
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
14046
+ */
14047
+ var AttachmentSchema = object({
14048
+ mediaType: AttachmentMediaTypeSchema,
14049
+ url: string().optional(),
14050
+ bytes: _instanceof(Uint8Array).optional(),
14051
+ mime: string().optional(),
14052
+ name: string().optional()
14053
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14054
+ var NotificationFormatSchema = _enum([
14055
+ "text",
14056
+ "markdown",
14057
+ "html"
14058
+ ]);
14059
+ /**
14060
+ * The CLOSED icon vocabulary an action button may use.
14061
+ *
14062
+ * A closed set, not a free string, and that is the whole point: an arbitrary
14063
+ * icon name is one that ntfy renders, zentik silently drops, and nobody
14064
+ * notices — the same class of gap as a zone vocabulary nothing produced
14065
+ * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
14066
+ * declares `actionIcons: false` and the degrade engine strips the field.
14067
+ *
14068
+ * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
14069
+ * renderer's icon set; "acknowledge" survives an adapter that draws it
14070
+ * differently.
14071
+ *
14072
+ * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
14073
+ *
14074
+ * These names are for US. **No adapter may forward one verbatim.** Each maps
14075
+ * the whole set onto its own renderer's vocabulary through a
14076
+ * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
14077
+ * fallback, so adding a member here fails every adapter's build until someone
14078
+ * decides its glyph, which is the only place that decision can be made
14079
+ * honestly.
14080
+ *
14081
+ * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
14082
+ * `disarm` straight through; iOS feeds that string to
14083
+ * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
14084
+ * and every snooze and alarm button arrived BLANK. A pass-through is not a
14085
+ * mapping, and "the field is documented" is not "the value renders".
14086
+ *
14087
+ * Adding a member is TRAIN-BOUND. The enum lives in the published
14088
+ * `@camstack/server` closure and the cap seam validates against the HUB's copy,
14089
+ * so an addon that emits a token the running hub does not know does not lose an
14090
+ * icon — its whole `send` fails Zod validation and the notification never
14091
+ * arrives. Never emit a new token from an addon before the train carrying it.
14092
+ */
14093
+ var NotificationActionIconSchema = _enum([
14094
+ "acknowledge",
14095
+ "dismiss",
14096
+ "silence",
14097
+ "snooze",
14098
+ "view",
14099
+ "play",
14100
+ "open",
14101
+ "close",
14102
+ "lock",
14103
+ "unlock",
14104
+ "arm",
14105
+ "arm-home",
14106
+ "arm-away",
14107
+ "arm-night",
14108
+ "disarm",
14109
+ "light",
14110
+ "alert",
14111
+ "camera"
14112
+ ]);
14113
+ /** A single tap-through action button. */
14114
+ var NotificationActionSchema = object({
14115
+ id: string(),
14116
+ label: string(),
14117
+ url: string().optional(),
14118
+ /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
14119
+ icon: NotificationActionIconSchema.optional(),
14120
+ /**
14121
+ * Renders in a warning style where the notifier supports it.
14122
+ *
14123
+ * A HINT, never a gate. The callback's authority is its token and nothing
14124
+ * else — see `notification-center/action-token.ts` for what that does and
14125
+ * does not buy.
14126
+ */
14127
+ destructive: boolean().optional(),
14128
+ /**
14129
+ * How the tap should REACH the url.
14130
+ *
14131
+ * `navigate` (absent, and every button authored before this field) opens it:
14132
+ * the phone leaves the notification and shows whatever the callback returns.
14133
+ * That is right for a button whose answer the operator wants to read.
14134
+ *
14135
+ * `background` fires it as a POST and stays put. It exists for the buttons
14136
+ * whose whole point is not to interrupt — "silence this for 30 minutes" is
14137
+ * an answer to the notification, and being thrown into a browser tab to
14138
+ * confirm it costs more attention than the notification did. A backend that
14139
+ * cannot do a background call renders it as an ordinary link (the adapters
14140
+ * fall back rather than dropping the button), so this is a preference, never
14141
+ * a requirement.
14142
+ */
14143
+ mode: _enum(["navigate", "background"]).optional()
14144
+ });
14145
+ /** A delivery parameter value: what a notifier declared it takes. */
14146
+ var DeliveryParamValueSchema = union([
14147
+ string(),
14148
+ number(),
14149
+ boolean()
14150
+ ]);
14151
+ /**
14152
+ * One extra delivery parameter a notifier KIND declares (D938). A rule that
14153
+ * addresses a target of that kind may set it; a kind that declares nothing is
14154
+ * never handed one. The admin UI derives its control from this descriptor —
14155
+ * no editor knows a service by name.
14156
+ *
14157
+ * Optional fields are `.optional()`, never `.default()` (a Zod default does not
14158
+ * run on the addon cap path).
14159
+ */
14160
+ var DeliveryParamSchema = object({
14161
+ key: string().min(1),
14162
+ label: string(),
14163
+ /** i18n key of the label, resolved by the declaring addon's namespace. */
14164
+ labelKey: string().optional(),
14165
+ type: _enum([
14166
+ "enum",
14167
+ "number",
14168
+ "boolean",
14169
+ "string"
14170
+ ]),
14171
+ /** `enum` only: the closed set of accepted values. */
14172
+ options: array(object({
14173
+ value: string(),
14174
+ label: string()
14175
+ })).optional(),
14176
+ /** `number` only. */
14177
+ min: number().optional(),
14178
+ max: number().optional(),
14179
+ /** What the notifier does when the rule sets nothing; shown as the placeholder. */
14180
+ default: DeliveryParamValueSchema.optional()
14181
+ });
14182
+ /**
14183
+ * The canonical notification. `body` is the only hard field (Apprise model).
14184
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14185
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14186
+ * the adapter maps this ordinal onto its native level. `level?` is an
14187
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
14188
+ * `priority` for that one target.
14189
+ */
14190
+ var NotificationSchema = object({
14191
+ body: string(),
14192
+ title: string().optional(),
14193
+ format: NotificationFormatSchema.default("text"),
14194
+ priority: number().int().min(1).max(5).default(3),
14195
+ level: string().optional(),
14196
+ attachments: array(AttachmentSchema).optional(),
14197
+ clickUrl: string().optional(),
14198
+ actions: array(NotificationActionSchema).optional(),
14199
+ sound: string().optional(),
14200
+ ttl: number().optional(),
14201
+ tag: string().optional(),
14202
+ deviceId: number().optional(),
14203
+ eventId: string().optional(),
14204
+ metadata: record(string(), unknown()).optional(),
14205
+ /**
14206
+ * Values for the parameters the target's kind DECLARES in
14207
+ * {@link TargetKindSchema} `deliveryParams`. Already validated against the
14208
+ * declaration by the sender; a notifier reads only the keys it declared.
14209
+ */
14210
+ delivery: record(string(), DeliveryParamValueSchema).optional()
14211
+ });
14212
+ /** One declared native severity/priority level for a kind. */
14213
+ var TargetKindLevelSchema = object({
14214
+ id: string(),
14215
+ label: string(),
14216
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14217
+ ordinal: number().int().min(1).max(5).nullable(),
14218
+ flags: object({
14219
+ critical: boolean().optional(),
14220
+ silent: boolean().optional(),
14221
+ noPush: boolean().optional()
14222
+ }).optional(),
14223
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14224
+ requires: array(string()).optional(),
14225
+ description: string().optional()
14226
+ });
14227
+ /** The full capability block consulted before dispatch. */
14228
+ var TargetKindCapsSchema = object({
14229
+ attachments: object({
14230
+ mediaTypes: array(AttachmentMediaTypeSchema),
14231
+ mode: _enum([
14232
+ "url",
14233
+ "bytes",
14234
+ "both"
14235
+ ]),
14236
+ max: number().int().nonnegative(),
14237
+ maxBytes: number().int().positive().optional()
14238
+ }),
14239
+ /** Max action buttons (0 = none). */
14240
+ actions: number().int().nonnegative(),
14241
+ /**
14242
+ * Whether this kind renders a per-action ICON.
14243
+ *
14244
+ * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
14245
+ * run on the addon cap path — three production failures in one day taught
14246
+ * this repo that once. Absent is read as false by the degrade engine, which
14247
+ * is the safe direction: an icon that is not rendered costs nothing, an icon
14248
+ * assumed and dropped costs the operator's trust in the field.
14249
+ */
14250
+ actionIcons: boolean().optional(),
14251
+ levels: array(TargetKindLevelSchema),
14252
+ format: array(NotificationFormatSchema),
14253
+ clickUrl: boolean(),
14254
+ sound: boolean(),
14255
+ ttl: boolean(),
14256
+ bodyMaxLen: number().int().positive()
14257
+ });
14258
+ /**
14259
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14260
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14261
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14262
+ * the union is large and not meant for runtime validation here; the exported
14263
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14264
+ */
14265
+ var ConfigSchemaPassthrough$4 = unknown();
14266
+ var TargetKindSchema = object({
14267
+ kind: string(),
14268
+ label: string(),
14269
+ icon: string(),
14270
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
14271
+ addonId: string(),
14272
+ /**
14273
+ * URL of the kind's bundled BRAND icon, served by the providing addon over
14274
+ * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
14275
+ * when the addon bundles no icon for that kind — the client then falls back
14276
+ * to a neutral glyph rather than rendering the raw `icon` NAME as text.
14277
+ *
14278
+ * Root-relative on purpose: it resolves against whatever origin serves a web
14279
+ * client, and a native client joins it onto its own hub base.
14280
+ *
14281
+ * DECLARED here deliberately. It used to travel as an undeclared passthrough
14282
+ * field that survived only because the runtime cap-router forwards provider
14283
+ * output verbatim — so every consumer had to re-declare it by hand to stop
14284
+ * its own Zod parse from stripping it, and the whole arrangement would have
14285
+ * broken silently the moment output validation was tightened anywhere.
14286
+ */
14287
+ iconUrl: string().optional(),
14288
+ /**
14289
+ * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
14290
+ *
14291
+ * The server knows this and therefore says it, because the client cannot
14292
+ * safely guess: a React-Native client renders SVG and raster through two
14293
+ * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
14294
+ * not decode SVG on iOS/Android), so without this it silently fell back to a
14295
+ * placeholder glyph for every vector icon while the web build looked fine.
14296
+ *
14297
+ * Absent when {@link iconUrl} is absent, or for a legacy provider that has
14298
+ * not been updated — a client that cannot determine the type should prefer
14299
+ * its raster path, which is the safe default for an unknown image.
14300
+ */
14301
+ iconMediaType: string().optional(),
14302
+ configSchema: ConfigSchemaPassthrough$4,
14303
+ /**
14304
+ * The config keys that decide WHERE this kind's secrets are sent (server,
14305
+ * base URL, instance, chat, recipient). A save that changes any of them
14306
+ * while leaving a secret redacted is refused by the provider (D634), so an
14307
+ * editor uses this to ask for the secret on exactly those edits instead of
14308
+ * on every edit.
14309
+ *
14310
+ * Optional: absent from a provider that holds no secret (the Home Assistant
14311
+ * kinds) and from a provider older than this field — an editor that finds
14312
+ * it absent must assume ANY edit may need the secret.
14313
+ */
14314
+ destinationKeys: array(string()).optional(),
14315
+ supportsDiscovery: boolean(),
14316
+ /**
14317
+ * Extra delivery parameters a rule may set for a target of this kind (D938).
14318
+ * Absent = none; the rule editor then offers nothing.
14319
+ */
14320
+ deliveryParams: array(DeliveryParamSchema).optional(),
14321
+ caps: TargetKindCapsSchema
14322
+ });
14323
+ /**
14324
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
14325
+ * (return a presence marker only) when serving `listTargets` — never
14326
+ * round-trip a stored secret to the UI.
14327
+ */
14328
+ var TargetSchema = object({
14329
+ id: string(),
14330
+ name: string(),
14331
+ kind: string(),
14332
+ addonId: string(),
14333
+ enabled: boolean(),
14334
+ config: record(string(), unknown())
14335
+ });
14336
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
14337
+ var DiscoveredTargetSchema = object({
14338
+ kind: string(),
14339
+ suggestedName: string(),
14340
+ config: record(string(), unknown())
14341
+ });
14342
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
14343
+ var RenderedAsSchema = object({
14344
+ level: string(),
14345
+ format: NotificationFormatSchema,
14346
+ attachmentsSent: number().int().nonnegative(),
14347
+ actionsSent: number().int().nonnegative(),
14348
+ truncated: boolean(),
14349
+ dropped: array(string())
14350
+ });
14351
+ var SendResultSchema = object({
14352
+ success: boolean(),
14353
+ error: string().optional(),
14354
+ renderedAs: RenderedAsSchema.optional()
14355
+ });
14356
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
14357
+ var TestResultSchema = SendResultSchema;
14358
+ /**
14359
+ * Pre-save credential probe against a partial (unsaved) target config.
14360
+ * `resolvedUrl` never includes secrets (token stripped from path).
14361
+ */
14362
+ var ProbeTargetConfigResultSchema = object({
14363
+ ok: boolean(),
14364
+ resolvedUrl: string(),
14365
+ httpStatus: number().int().optional(),
14366
+ stateInstance: string().optional(),
14367
+ error: string().optional()
14368
+ });
14369
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
14370
+ kind: string(),
14371
+ config: record(string(), unknown()).optional(),
14372
+ /**
14373
+ * When editing / duplicating, the blank password field never round-trips
14374
+ * the stored token. Pass the source target id so the provider can restore
14375
+ * secrets server-side before dialling (same merge as upsert).
14376
+ */
14377
+ targetId: string().optional()
14378
+ }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
14379
+ kind: string(),
14380
+ config: record(string(), unknown()),
14381
+ /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
14382
+ targetId: string().optional()
14383
+ }), ProbeTargetConfigResultSchema, {
14384
+ kind: "mutation",
14385
+ auth: "admin"
14386
+ }), method(object({
14387
+ targetId: string(),
14388
+ notification: NotificationSchema
14389
+ }), SendResultSchema, {
14390
+ kind: "mutation",
14391
+ auth: "admin"
14392
+ }), method(object({
14393
+ targetId: string(),
14394
+ sample: NotificationSchema.optional()
14395
+ }), TestResultSchema, {
14396
+ kind: "mutation",
14397
+ auth: "admin"
14398
+ }), method(object({
14399
+ target: TargetSchema,
14400
+ /**
14401
+ * Duplicate flow: create a NEW target id while copying secrets from an
14402
+ * existing row. The UI never holds the stored token; blank / redacted
14403
+ * password fields are restored from this source (D634 still applies if
14404
+ * destinations diverge without a re-typed secret).
14405
+ */
14406
+ cloneSecretsFrom: string().optional()
14407
+ }), TargetSchema, {
14408
+ kind: "mutation",
14409
+ auth: "admin"
14410
+ }), method(object({ targetId: string() }), _void(), {
14411
+ kind: "mutation",
14412
+ auth: "admin"
14413
+ }), method(object({
14414
+ targetId: string(),
14415
+ enabled: boolean()
14416
+ }), _void(), {
14417
+ kind: "mutation",
14418
+ auth: "admin"
14419
+ });
14420
+ looseObject({
14421
+ name: string().min(1),
14422
+ enabled: boolean().optional()
14423
+ });
14424
+ TargetSchema.omit({ id: true });
13974
14425
  var EncodeProfileSchema = object({
13975
14426
  video: object({
13976
14427
  codec: _enum([
@@ -22358,7 +22809,6 @@ var SYSTEM_CAP_VOCABULARY = {
22358
22809
  "calendar-source": system(INTERNAL),
22359
22810
  calendars: system("calendars feed schedules and conditions, not device actions"),
22360
22811
  composer: system("device composition — an authoring tool, not an action"),
22361
- "connection-test": system(INTERNAL),
22362
22812
  "core-blocks": system(INTERNAL),
22363
22813
  "custom-model-registry": system(ML),
22364
22814
  "data-store-provider": system(INTERNAL),
@@ -44275,427 +44725,6 @@ var UnitWarningSchema = object({
44275
44725
  assumedUnit: string(),
44276
44726
  message: string()
44277
44727
  });
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
44728
  function errorText(err) {
44700
44729
  return err instanceof Error ? err.message : String(err);
44701
44730
  }
@@ -48659,37 +48688,6 @@ method(object({
48659
48688
  kind: "mutation",
48660
48689
  auth: "admin"
48661
48690
  }), 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
48691
  object({
48694
48692
  /** True when the upstream system considers the entity connected. */
48695
48693
  connected: boolean(),
@@ -54612,10 +54610,9 @@ var AvailableIntegrationTypeSchema = object({
54612
54610
  * locations" checkbox. Provider-declared in the addon manifest. */
54613
54611
  supportsLocationImport: boolean(),
54614
54612
  /**
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.
54613
+ * True when this integration's instances declare a Test (`integration-instances.describe().canTest`,
54614
+ * D1016). An integration that cannot be tested must say so up front rather than offering a
54615
+ * button that always answers the same nonsense.
54619
54616
  */
54620
54617
  canTest: boolean(),
54621
54618
  existingInstances: array(object({
@@ -54669,7 +54666,9 @@ var CreateIntegrationInputSchema = object({
54669
54666
  info: record(string(), unknown()).optional(),
54670
54667
  /** `stableId` of the discovery candidate the form was seeded from (D984). */
54671
54668
  originStableId: string().optional(),
54672
- settings: record(string(), unknown()).optional()
54669
+ settings: record(string(), unknown()).optional(),
54670
+ /** The instance kind being created, for a provider with several; omitted = its only testable kind. */
54671
+ kind: string().min(1).optional()
54673
54672
  });
54674
54673
  var UpdateIntegrationInputSchema = object({
54675
54674
  id: string(),
@@ -54695,13 +54694,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
54695
54694
  }), method(object({ id: string() }), DeleteIntegrationResultSchema, {
54696
54695
  kind: "mutation",
54697
54696
  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
- });
54697
+ }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" });
54705
54698
  /**
54706
54699
  * `integration-instances` - the connection of an addon that holds ONE or SEVERAL
54707
54700
  * (an account, a relay, a destination) as typed records (D985, D986). The addon's
@@ -62944,13 +62937,6 @@ var AddBrokerInputSchema = object({
62944
62937
  });
62945
62938
  var AddBrokerResultSchema = object({ id: string() });
62946
62939
  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
62940
  var StartEmbeddedInputSchema = object({
62955
62941
  port: number().int().min(1).max(65535).default(1883),
62956
62942
  /** Allow anonymous connect (no username/password). Default: false. */
@@ -62973,9 +62959,6 @@ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnection
62973
62959
  }), method(IdInputSchema, _void(), {
62974
62960
  kind: "mutation",
62975
62961
  auth: "admin"
62976
- }), method(IdInputSchema, TestResultSchema$1, {
62977
- kind: "mutation",
62978
- auth: "admin"
62979
62962
  }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, {
62980
62963
  kind: "mutation",
62981
62964
  auth: "admin"
@@ -74622,7 +74605,7 @@ var TrainingProviderTypeSchema = object({
74622
74605
  label: string(),
74623
74606
  /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
74624
74607
  iconAsset: string(),
74625
- /** Owning `training-provider` addon — collection selector for createEntry. */
74608
+ /** Owning `training-provider` addon. */
74626
74609
  addonId: string(),
74627
74610
  /**
74628
74611
  * Fields for one entry of this type (credentials + defaults). Absent on a
@@ -74667,36 +74650,6 @@ var TrainingProviderDescriptorSchema = object({
74667
74650
  */
74668
74651
  formValues: record(string(), unknown()).optional()
74669
74652
  });
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
74653
  var ProviderJobStateSchema = _enum([
74701
74654
  "pending",
74702
74655
  "starting",
@@ -74744,22 +74697,6 @@ var TrainingLogLineSchema = object({
74744
74697
  text: string()
74745
74698
  });
74746
74699
  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
74700
  entryId: string().min(1),
74764
74701
  gpuType: string(),
74765
74702
  region: string(),
@@ -78145,20 +78082,6 @@ Object.freeze({
78145
78082
  access: "view",
78146
78083
  role: "admin"
78147
78084
  },
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
78085
  "connectivity.getStatus": {
78163
78086
  capName: "connectivity",
78164
78087
  capScope: "device",
@@ -80525,13 +80448,6 @@ Object.freeze({
80525
80448
  access: "view",
80526
80449
  role: "admin"
80527
80450
  },
80528
- "integrations.testConnection": {
80529
- capName: "integrations",
80530
- capScope: "system",
80531
- addonId: null,
80532
- access: "create",
80533
- role: "admin"
80534
- },
80535
80451
  "integrations.update": {
80536
80452
  capName: "integrations",
80537
80453
  capScope: "system",
@@ -81764,13 +81680,6 @@ Object.freeze({
81764
81680
  access: "create",
81765
81681
  role: "admin"
81766
81682
  },
81767
- "mqttBroker.testConnection": {
81768
- capName: "mqtt-broker",
81769
- capScope: "system",
81770
- addonId: null,
81771
- access: "create",
81772
- role: "admin"
81773
- },
81774
81683
  "nativeObjectDetection.getOptions": {
81775
81684
  capName: "native-object-detection",
81776
81685
  capScope: "device",
@@ -86601,20 +86510,6 @@ Object.freeze({
86601
86510
  access: "create",
86602
86511
  role: "admin"
86603
86512
  },
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
86513
  "trainingProvider.describe": {
86619
86514
  capName: "training-provider",
86620
86515
  capScope: "system",
@@ -86685,13 +86580,6 @@ Object.freeze({
86685
86580
  access: "create",
86686
86581
  role: "admin"
86687
86582
  },
86688
- "trainingProvider.updateEntry": {
86689
- capName: "training-provider",
86690
- capScope: "system",
86691
- addonId: null,
86692
- access: "create",
86693
- role: "admin"
86694
- },
86695
86583
  "trainingProvider.uploadDataset": {
86696
86584
  capName: "training-provider",
86697
86585
  capScope: "system",
@@ -86699,13 +86587,6 @@ Object.freeze({
86699
86587
  access: "create",
86700
86588
  role: "admin"
86701
86589
  },
86702
- "trainingProvider.validateCredentials": {
86703
- capName: "training-provider",
86704
- capScope: "system",
86705
- addonId: null,
86706
- access: "create",
86707
- role: "admin"
86708
- },
86709
86590
  "turnProvider.getTurnServers": {
86710
86591
  capName: "turn-provider",
86711
86592
  capScope: "system",