@camstack/addon-export-google 0.1.128 → 0.1.129

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.
@@ -6060,7 +6060,7 @@ var ZodIssueCode = {
6060
6060
  var ZodFirstPartyTypeKind;
6061
6061
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6062
6062
  //#endregion
6063
- //#region ../types/dist/sleep-CmjWurK5.mjs
6063
+ //#region ../types/dist/sleep-D7ZKm4nb.mjs
6064
6064
  /**
6065
6065
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6066
6066
  * window to float samples (D455).
@@ -6769,10 +6769,33 @@ function integrationRowsApiOver(api) {
6769
6769
  };
6770
6770
  }
6771
6771
  var PREFIX$1 = "records/";
6772
+ /**
6773
+ * Cross-realm brand. An addon bundles its own copy of this module (D15) while
6774
+ * `ctx.records` is the HOST's door, so an error thrown by the host is an
6775
+ * instance of the host's classes, not of the addon's. The brand plus the code
6776
+ * make `instanceof` answer by identity of the failure, not of the copy.
6777
+ */
6778
+ var RECORDS_ERROR_BRAND = Symbol.for("camstack.records-error");
6779
+ function carriesBrand(value) {
6780
+ return typeof value === "object" && value !== null && Reflect.get(value, RECORDS_ERROR_BRAND) === true;
6781
+ }
6772
6782
  /** The base of every records failure. `detail` is the human part of the message. */
6773
6783
  var RecordsError = class extends Error {
6784
+ /** The code a subclass stands for; the base stands for every code. */
6785
+ static code = void 0;
6786
+ /**
6787
+ * `instanceof` across copies of this module: any branded error is a
6788
+ * `RecordsError`, and is an instance of a subclass only when its code is the
6789
+ * subclass's code. Same-copy answers are unchanged.
6790
+ */
6791
+ static [Symbol.hasInstance](value) {
6792
+ if (Function.prototype[Symbol.hasInstance].call(this, value)) return true;
6793
+ if (!carriesBrand(value)) return false;
6794
+ return this.code === void 0 || value.code === this.code;
6795
+ }
6774
6796
  code;
6775
6797
  detail;
6798
+ [RECORDS_ERROR_BRAND] = true;
6776
6799
  constructor(code, detail) {
6777
6800
  super(`${PREFIX$1}${code}: ${detail}`);
6778
6801
  this.name = "RecordsError";
@@ -6781,29 +6804,33 @@ var RecordsError = class extends Error {
6781
6804
  }
6782
6805
  };
6783
6806
  /** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
6784
- var RevConflictError = class extends RecordsError {
6807
+ var RevConflictError = class RevConflictError extends RecordsError {
6808
+ static code = "rev-conflict";
6785
6809
  constructor(detail) {
6786
- super("rev-conflict", detail);
6810
+ super(RevConflictError.code, detail);
6787
6811
  this.name = "RevConflictError";
6788
6812
  }
6789
6813
  };
6790
6814
  /** The keychain could not store or serve a value: explicit, never an empty string. */
6791
- var RecordSecretUnavailableError = class extends RecordsError {
6815
+ var RecordSecretUnavailableError = class RecordSecretUnavailableError extends RecordsError {
6816
+ static code = "secret-unavailable";
6792
6817
  constructor(detail) {
6793
- super("secret-unavailable", detail);
6818
+ super(RecordSecretUnavailableError.code, detail);
6794
6819
  this.name = "RecordSecretUnavailableError";
6795
6820
  }
6796
6821
  };
6797
- var InvalidRecordError = class extends RecordsError {
6822
+ var InvalidRecordError = class InvalidRecordError extends RecordsError {
6823
+ static code = "invalid-record";
6798
6824
  constructor(detail) {
6799
- super("invalid-record", detail);
6825
+ super(InvalidRecordError.code, detail);
6800
6826
  this.name = "InvalidRecordError";
6801
6827
  }
6802
6828
  };
6803
6829
  /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
6804
- var DeclarationRefusedError = class extends RecordsError {
6830
+ var DeclarationRefusedError = class DeclarationRefusedError extends RecordsError {
6831
+ static code = "declaration-refused";
6805
6832
  constructor(detail) {
6806
- super("declaration-refused", detail);
6833
+ super(DeclarationRefusedError.code, detail);
6807
6834
  this.name = "DeclarationRefusedError";
6808
6835
  }
6809
6836
  };
@@ -9598,271 +9625,6 @@ function normalizeAddonInitResult(result) {
9598
9625
  if (Array.isArray(result)) return { providers: result };
9599
9626
  return result;
9600
9627
  }
9601
- /**
9602
- * The share-view scope kinds a share-link token can carry. The hub mints
9603
- * and validates them (`ShareViewGrantSchema` builds its
9604
- * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
9605
- */
9606
- var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
9607
- /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
9608
- var PeerBytesTicketSchema = object({
9609
- /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
9610
- url: string().min(1),
9611
- /**
9612
- * The HOST node this URL means something on — the hub or a named agent,
9613
- * never a runner. {@link AddonPeerBytes.open} compares it to its own and
9614
- * refuses `cross-node` by name when they differ, without dialling.
9615
- */
9616
- hostNodeId: string().min(1),
9617
- expiresAtMs: number().int().nonnegative(),
9618
- /**
9619
- * What the producer DECLARED the body to be, when it knows — `null` when it
9620
- * does not. Never `0` for unknown (D393): a consumer sizing a bound off this
9621
- * must be able to tell "the producer did not say" from "the body is empty".
9622
- */
9623
- declaredBytes: number().int().nonnegative().nullable()
9624
- });
9625
- function defOf(schema) {
9626
- const zodBag = Reflect.get(schema, "_zod");
9627
- if (typeof zodBag !== "object" || zodBag === null) return {};
9628
- const def = Reflect.get(zodBag, "def");
9629
- if (typeof def !== "object" || def === null) return {};
9630
- return def;
9631
- }
9632
- function declaredHere(schema) {
9633
- return globalRegistry.get(schema)?.secret === true;
9634
- }
9635
- /** Wrapper kinds whose `innerType` is the field itself. */
9636
- var WRAPPERS = new Set([
9637
- "optional",
9638
- "nullable",
9639
- "default",
9640
- "prefault",
9641
- "catch",
9642
- "readonly",
9643
- "nonoptional"
9644
- ]);
9645
- /**
9646
- * The schema layers that make up ONE field: the schema itself and every
9647
- * wrapper below it (optional / default / nullable / readonly / catch), plus
9648
- * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
9649
- * `.transform` on `in`).
9650
- */
9651
- function layersOf(schema) {
9652
- const out = [];
9653
- const queue = [schema];
9654
- while (queue.length > 0) {
9655
- const s = queue.shift();
9656
- if (!s || out.includes(s)) continue;
9657
- out.push(s);
9658
- const def = defOf(s);
9659
- if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
9660
- if (def.type === "pipe") {
9661
- if (def.in) queue.push(def.in);
9662
- if (def.out) queue.push(def.out);
9663
- }
9664
- }
9665
- return out;
9666
- }
9667
- /** True when any layer of this field declares `.meta({ secret: true })`. */
9668
- function isZodSecret(schema) {
9669
- return layersOf(schema).some(declaredHere);
9670
- }
9671
- /**
9672
- * Every declared secret path in a config schema: dotted keys, `[]` for "each
9673
- * element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
9674
- * map" (`applianceSecrets{}`). A declared
9675
- * object or array is reported as one path and not descended into — everything
9676
- * under it is secret.
9677
- */
9678
- function collectZodSecretPaths(schema, prefix = "") {
9679
- if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
9680
- const paths = [];
9681
- for (const layer of layersOf(schema)) {
9682
- const def = defOf(layer);
9683
- if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
9684
- else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
9685
- else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
9686
- else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
9687
- else if (def.type === "intersection") {
9688
- if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
9689
- if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
9690
- }
9691
- }
9692
- return [...new Set(paths)];
9693
- }
9694
- /**
9695
- * Record kinds (D881): the declaration an addon makes of one kind of fact, the
9696
- * Zod row schema that describes it, and the helper that turns the two into the
9697
- * JSON the engine stores.
9698
- *
9699
- * A kind is declared ONCE, next to the code that owns it, and the engine's
9700
- * reconciler creates its indexes - nothing creates DDL at runtime from a write.
9701
- * Everything the generic machinery needs (secret fields, the entry descriptor)
9702
- * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
9703
- * never a field name (D879).
9704
- */
9705
- /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
9706
- var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
9707
- var RecordIndexSchema = object({
9708
- name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
9709
- fields: array(RecordFieldPathSchema).min(1).max(4),
9710
- unique: boolean().optional()
9711
- }).strict();
9712
- var RecordRetentionSchema = union([
9713
- object({
9714
- ttlMs: number().int().positive(),
9715
- from: _enum(["at", "write"])
9716
- }).strict(),
9717
- object({
9718
- maxRows: number().int().positive().optional(),
9719
- maxRowsPerDevice: number().int().positive().optional()
9720
- }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
9721
- object({
9722
- owner: string().min(1),
9723
- reason: string().min(1)
9724
- }).strict(),
9725
- object({ none: string().min(1) }).strict()
9726
- ]);
9727
- /** The descriptor a generic entries UI reads (D881 "generic entries"). */
9728
- var EntryDescriptorSchema = object({
9729
- title: string().min(1),
9730
- /** The record body field shown as the entry's name. */
9731
- nameField: string().min(1),
9732
- /** JSON Schema of the entry body; `secret: true` marks a password field. */
9733
- fields: record(string(), unknown())
9734
- }).strict();
9735
- /** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
9736
- var RecordKindDeclarationSchema = object({
9737
- database: _enum(RECORD_DATABASES).default("settings"),
9738
- class: _enum(RECORD_CLASSES),
9739
- writeTrigger: string().min(1),
9740
- device: _enum([
9741
- "required",
9742
- "optional",
9743
- "none"
9744
- ]).default("none"),
9745
- at: _enum(["required", "none"]).default("none"),
9746
- indexes: array(RecordIndexSchema).max(8).default([]),
9747
- retention: RecordRetentionSchema,
9748
- deviceRemoval: _enum(["delete", "none"]).default("none"),
9749
- maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
9750
- /** Derived from the Zod schema; never written by hand. */
9751
- secretPaths: array(string().min(1)).default([]),
9752
- /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
9753
- secretArrayKeys: record(string(), string()).default({}),
9754
- /** Kinds that must agree through `transact` sit in one file under one family name. */
9755
- transactFamily: string().min(1).optional(),
9756
- entry: EntryDescriptorSchema.optional()
9757
- }).strict();
9758
- /** The kind names: lower-case, dash separated, short enough for an index name. */
9759
- var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
9760
- /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
9761
- function assertValidDeclaration(name, decl) {
9762
- const refuse = (why) => {
9763
- throw new DeclarationRefusedError(`kind "${name}": ${why}`);
9764
- };
9765
- if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
9766
- const seen = /* @__PURE__ */ new Set();
9767
- for (const index of decl.indexes) {
9768
- if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
9769
- seen.add(index.name);
9770
- }
9771
- const { retention } = decl;
9772
- const hasSecrets = decl.secretPaths.length > 0;
9773
- if ("ttlMs" in retention) {
9774
- if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
9775
- if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
9776
- }
9777
- if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
9778
- if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
9779
- if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
9780
- if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
9781
- const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
9782
- 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)`);
9783
- }
9784
- if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
9785
- 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`);
9786
- }
9787
- function bodyFieldsOf(schema) {
9788
- return { ...toJSONSchema(schema, {
9789
- unrepresentable: "any",
9790
- io: "input"
9791
- }) };
9792
- }
9793
- function isRecordLike(value) {
9794
- return typeof value === "object" && value !== null && !Array.isArray(value);
9795
- }
9796
- /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
9797
- function hasNameField(json, field) {
9798
- const branches = json["oneOf"] ?? json["anyOf"];
9799
- if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
9800
- const properties = json["properties"];
9801
- return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
9802
- }
9803
- /**
9804
- * Declare the kinds of a package. The keys are the kind names. The result is
9805
- * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
9806
- * types its handle from.
9807
- */
9808
- function defineRecordKinds(specs) {
9809
- const out = {};
9810
- for (const [name, spec] of Object.entries(specs)) {
9811
- const secretPaths = collectZodSecretPaths(spec.schema);
9812
- const nameField = spec.entry?.nameField ?? "name";
9813
- const fields = bodyFieldsOf(spec.schema);
9814
- if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
9815
- const parsed = RecordKindDeclarationSchema.parse({
9816
- database: spec.database,
9817
- class: spec.class,
9818
- writeTrigger: spec.writeTrigger,
9819
- device: spec.device,
9820
- at: spec.at,
9821
- indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
9822
- retention: spec.retention,
9823
- deviceRemoval: spec.deviceRemoval,
9824
- maxDataBytes: spec.maxDataBytes,
9825
- secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
9826
- secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
9827
- transactFamily: spec.transactFamily,
9828
- entry: spec.entry === void 0 ? void 0 : {
9829
- title: spec.entry.title,
9830
- nameField,
9831
- fields
9832
- }
9833
- });
9834
- assertValidDeclaration(name, parsed);
9835
- out[name] = {
9836
- name,
9837
- schema: spec.schema,
9838
- declaration: parsed
9839
- };
9840
- }
9841
- return out;
9842
- }
9843
- /**
9844
- * Declare one entry kind. An entry is configuration: never trimmed by the
9845
- * engine, never aged, belonging to no device.
9846
- */
9847
- function defineEntryKind(name, spec) {
9848
- const defined = defineRecordKinds({ [name]: {
9849
- schema: spec.schema,
9850
- class: "config",
9851
- writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
9852
- retention: { none: "an entry goes only when the operator deletes it" },
9853
- ...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
9854
- ...spec.database === void 0 ? {} : { database: spec.database },
9855
- ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
9856
- ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
9857
- ...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
9858
- entry: {
9859
- title: spec.title,
9860
- ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
9861
- }
9862
- } })[name];
9863
- if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
9864
- return defined;
9865
- }
9866
9628
  object({
9867
9629
  field: string().min(1),
9868
9630
  on: literal("advance")
@@ -9951,6 +9713,271 @@ function optionalMethod(input, output, options) {
9951
9713
  providerOptional: true
9952
9714
  };
9953
9715
  }
9716
+ function defOf(schema) {
9717
+ const zodBag = Reflect.get(schema, "_zod");
9718
+ if (typeof zodBag !== "object" || zodBag === null) return {};
9719
+ const def = Reflect.get(zodBag, "def");
9720
+ if (typeof def !== "object" || def === null) return {};
9721
+ return def;
9722
+ }
9723
+ function declaredHere(schema) {
9724
+ return globalRegistry.get(schema)?.secret === true;
9725
+ }
9726
+ /** Wrapper kinds whose `innerType` is the field itself. */
9727
+ var WRAPPERS = new Set([
9728
+ "optional",
9729
+ "nullable",
9730
+ "default",
9731
+ "prefault",
9732
+ "catch",
9733
+ "readonly",
9734
+ "nonoptional"
9735
+ ]);
9736
+ /**
9737
+ * The schema layers that make up ONE field: the schema itself and every
9738
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
9739
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
9740
+ * `.transform` on `in`).
9741
+ */
9742
+ function layersOf(schema) {
9743
+ const out = [];
9744
+ const queue = [schema];
9745
+ while (queue.length > 0) {
9746
+ const s = queue.shift();
9747
+ if (!s || out.includes(s)) continue;
9748
+ out.push(s);
9749
+ const def = defOf(s);
9750
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
9751
+ if (def.type === "pipe") {
9752
+ if (def.in) queue.push(def.in);
9753
+ if (def.out) queue.push(def.out);
9754
+ }
9755
+ }
9756
+ return out;
9757
+ }
9758
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
9759
+ function isZodSecret(schema) {
9760
+ return layersOf(schema).some(declaredHere);
9761
+ }
9762
+ /**
9763
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
9764
+ * element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
9765
+ * map" (`applianceSecrets{}`). A declared
9766
+ * object or array is reported as one path and not descended into — everything
9767
+ * under it is secret.
9768
+ */
9769
+ function collectZodSecretPaths(schema, prefix = "") {
9770
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
9771
+ const paths = [];
9772
+ for (const layer of layersOf(schema)) {
9773
+ const def = defOf(layer);
9774
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
9775
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
9776
+ else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
9777
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
9778
+ else if (def.type === "intersection") {
9779
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
9780
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
9781
+ }
9782
+ }
9783
+ return [...new Set(paths)];
9784
+ }
9785
+ /**
9786
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
9787
+ * Zod row schema that describes it, and the helper that turns the two into the
9788
+ * JSON the engine stores.
9789
+ *
9790
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
9791
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
9792
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
9793
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
9794
+ * never a field name (D879).
9795
+ */
9796
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
9797
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
9798
+ var RecordIndexSchema = object({
9799
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
9800
+ fields: array(RecordFieldPathSchema).min(1).max(4),
9801
+ unique: boolean().optional()
9802
+ }).strict();
9803
+ var RecordRetentionSchema = union([
9804
+ object({
9805
+ ttlMs: number().int().positive(),
9806
+ from: _enum(["at", "write"])
9807
+ }).strict(),
9808
+ object({
9809
+ maxRows: number().int().positive().optional(),
9810
+ maxRowsPerDevice: number().int().positive().optional()
9811
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
9812
+ object({
9813
+ owner: string().min(1),
9814
+ reason: string().min(1)
9815
+ }).strict(),
9816
+ object({ none: string().min(1) }).strict()
9817
+ ]);
9818
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
9819
+ var EntryDescriptorSchema = object({
9820
+ title: string().min(1),
9821
+ /** The record body field shown as the entry's name. */
9822
+ nameField: string().min(1),
9823
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
9824
+ fields: record(string(), unknown())
9825
+ }).strict();
9826
+ /** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
9827
+ var RecordKindDeclarationSchema = object({
9828
+ database: _enum(RECORD_DATABASES).default("settings"),
9829
+ class: _enum(RECORD_CLASSES),
9830
+ writeTrigger: string().min(1),
9831
+ device: _enum([
9832
+ "required",
9833
+ "optional",
9834
+ "none"
9835
+ ]).default("none"),
9836
+ at: _enum(["required", "none"]).default("none"),
9837
+ indexes: array(RecordIndexSchema).max(8).default([]),
9838
+ retention: RecordRetentionSchema,
9839
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
9840
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
9841
+ /** Derived from the Zod schema; never written by hand. */
9842
+ secretPaths: array(string().min(1)).default([]),
9843
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
9844
+ secretArrayKeys: record(string(), string()).default({}),
9845
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
9846
+ transactFamily: string().min(1).optional(),
9847
+ entry: EntryDescriptorSchema.optional()
9848
+ }).strict();
9849
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
9850
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
9851
+ /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
9852
+ function assertValidDeclaration(name, decl) {
9853
+ const refuse = (why) => {
9854
+ throw new DeclarationRefusedError(`kind "${name}": ${why}`);
9855
+ };
9856
+ if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
9857
+ const seen = /* @__PURE__ */ new Set();
9858
+ for (const index of decl.indexes) {
9859
+ if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
9860
+ seen.add(index.name);
9861
+ }
9862
+ const { retention } = decl;
9863
+ const hasSecrets = decl.secretPaths.length > 0;
9864
+ if ("ttlMs" in retention) {
9865
+ if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
9866
+ if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
9867
+ }
9868
+ if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
9869
+ if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
9870
+ if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
9871
+ if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
9872
+ const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
9873
+ 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)`);
9874
+ }
9875
+ if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
9876
+ 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`);
9877
+ }
9878
+ function bodyFieldsOf(schema) {
9879
+ return { ...toJSONSchema(schema, {
9880
+ unrepresentable: "any",
9881
+ io: "input"
9882
+ }) };
9883
+ }
9884
+ function isRecordLike(value) {
9885
+ return typeof value === "object" && value !== null && !Array.isArray(value);
9886
+ }
9887
+ /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
9888
+ function hasNameField(json, field) {
9889
+ const branches = json["oneOf"] ?? json["anyOf"];
9890
+ if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
9891
+ const properties = json["properties"];
9892
+ return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
9893
+ }
9894
+ /**
9895
+ * Declare the kinds of a package. The keys are the kind names. The result is
9896
+ * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
9897
+ * types its handle from.
9898
+ */
9899
+ function defineRecordKinds(specs) {
9900
+ const out = {};
9901
+ for (const [name, spec] of Object.entries(specs)) {
9902
+ const secretPaths = collectZodSecretPaths(spec.schema);
9903
+ const nameField = spec.entry?.nameField ?? "name";
9904
+ const fields = bodyFieldsOf(spec.schema);
9905
+ if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
9906
+ const parsed = RecordKindDeclarationSchema.parse({
9907
+ database: spec.database,
9908
+ class: spec.class,
9909
+ writeTrigger: spec.writeTrigger,
9910
+ device: spec.device,
9911
+ at: spec.at,
9912
+ indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
9913
+ retention: spec.retention,
9914
+ deviceRemoval: spec.deviceRemoval,
9915
+ maxDataBytes: spec.maxDataBytes,
9916
+ secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
9917
+ secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
9918
+ transactFamily: spec.transactFamily,
9919
+ entry: spec.entry === void 0 ? void 0 : {
9920
+ title: spec.entry.title,
9921
+ nameField,
9922
+ fields
9923
+ }
9924
+ });
9925
+ assertValidDeclaration(name, parsed);
9926
+ out[name] = {
9927
+ name,
9928
+ schema: spec.schema,
9929
+ declaration: parsed
9930
+ };
9931
+ }
9932
+ return out;
9933
+ }
9934
+ /**
9935
+ * Declare one entry kind. An entry is configuration: never trimmed by the
9936
+ * engine, never aged, belonging to no device.
9937
+ */
9938
+ function defineEntryKind(name, spec) {
9939
+ const defined = defineRecordKinds({ [name]: {
9940
+ schema: spec.schema,
9941
+ class: "config",
9942
+ writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
9943
+ retention: { none: "an entry goes only when the operator deletes it" },
9944
+ ...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
9945
+ ...spec.database === void 0 ? {} : { database: spec.database },
9946
+ ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
9947
+ ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
9948
+ ...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
9949
+ entry: {
9950
+ title: spec.title,
9951
+ ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
9952
+ }
9953
+ } })[name];
9954
+ if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
9955
+ return defined;
9956
+ }
9957
+ /**
9958
+ * The share-view scope kinds a share-link token can carry. The hub mints
9959
+ * and validates them (`ShareViewGrantSchema` builds its
9960
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
9961
+ */
9962
+ var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
9963
+ /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
9964
+ var PeerBytesTicketSchema = object({
9965
+ /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
9966
+ url: string().min(1),
9967
+ /**
9968
+ * The HOST node this URL means something on — the hub or a named agent,
9969
+ * never a runner. {@link AddonPeerBytes.open} compares it to its own and
9970
+ * refuses `cross-node` by name when they differ, without dialling.
9971
+ */
9972
+ hostNodeId: string().min(1),
9973
+ expiresAtMs: number().int().nonnegative(),
9974
+ /**
9975
+ * What the producer DECLARED the body to be, when it knows — `null` when it
9976
+ * does not. Never `0` for unknown (D393): a consumer sizing a bound off this
9977
+ * must be able to tell "the producer did not say" from "the body is empty".
9978
+ */
9979
+ declaredBytes: number().int().nonnegative().nullable()
9980
+ });
9954
9981
  var READING_QUANTITIES = [
9955
9982
  "temperature",
9956
9983
  "pressure",
@@ -10529,7 +10556,6 @@ var CAP_NAMES = Object.freeze([
10529
10556
  "climate-control",
10530
10557
  "color",
10531
10558
  "composer",
10532
- "connection-test",
10533
10559
  "connectivity",
10534
10560
  "consumables",
10535
10561
  "contact",
@@ -12549,8 +12575,7 @@ Object.freeze({
12549
12575
  "offerArtifact": 3e5,
12550
12576
  "readResult": 3e5,
12551
12577
  "submitJob": 18e5,
12552
- "uploadDataset": 72e5,
12553
- "validateCredentials": 3e4
12578
+ "uploadDataset": 72e5
12554
12579
  }
12555
12580
  });
12556
12581
  object({
@@ -14022,6 +14047,432 @@ function buildCapturingReply(envelope) {
14022
14047
  };
14023
14048
  return wrapper;
14024
14049
  }
14050
+ /**
14051
+ * notification-output — canonical, capability-gated notification delivery.
14052
+ *
14053
+ * Apprise-derived model (see
14054
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14055
+ * callers emit ONE canonical `Notification`; each provider declares a
14056
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
14057
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14058
+ * message to what the kind supports — callers never special-case a service.
14059
+ *
14060
+ * DESIGN DECISIONS (locked):
14061
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14062
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
14063
+ * cap. Rationale: the admin UI needs one uniform surface across the
14064
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14065
+ * alternative would fork the UI per addon and cannot host the
14066
+ * discovery→adopt flow.
14067
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14068
+ * the generated cap-mount auto-`concatCollection`-fans them across every
14069
+ * registered provider (notifiers addon + HA addon) so one catalog is
14070
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14071
+ * `addonId` the generated collection router extracts from the call input.
14072
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14073
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14074
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
14075
+ * base64 fallback needed.
14076
+ *
14077
+ * TODO (deferred, closed-set change — separate decision): add
14078
+ * `providerKind: 'notify'` so notification providers surface on the unified
14079
+ * admin "Integrations" page.
14080
+ */
14081
+ /**
14082
+ * Zentik-derived typed-media enum — the superset across every kind. Each
14083
+ * adapter picks what it supports and the degrade engine filters the rest.
14084
+ */
14085
+ var AttachmentMediaTypeSchema = _enum([
14086
+ "image",
14087
+ "video",
14088
+ "gif",
14089
+ "audio",
14090
+ "icon"
14091
+ ]);
14092
+ /**
14093
+ * A single attachment. Exactly one of `url` (remote source, most adapters
14094
+ * prefer this) or `bytes` (inline source; required for Pushover-style
14095
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
14096
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
14097
+ */
14098
+ var AttachmentSchema = object({
14099
+ mediaType: AttachmentMediaTypeSchema,
14100
+ url: string().optional(),
14101
+ bytes: _instanceof(Uint8Array).optional(),
14102
+ mime: string().optional(),
14103
+ name: string().optional()
14104
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14105
+ var NotificationFormatSchema = _enum([
14106
+ "text",
14107
+ "markdown",
14108
+ "html"
14109
+ ]);
14110
+ /**
14111
+ * The CLOSED icon vocabulary an action button may use.
14112
+ *
14113
+ * A closed set, not a free string, and that is the whole point: an arbitrary
14114
+ * icon name is one that ntfy renders, zentik silently drops, and nobody
14115
+ * notices — the same class of gap as a zone vocabulary nothing produced
14116
+ * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
14117
+ * declares `actionIcons: false` and the degrade engine strips the field.
14118
+ *
14119
+ * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
14120
+ * renderer's icon set; "acknowledge" survives an adapter that draws it
14121
+ * differently.
14122
+ *
14123
+ * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
14124
+ *
14125
+ * These names are for US. **No adapter may forward one verbatim.** Each maps
14126
+ * the whole set onto its own renderer's vocabulary through a
14127
+ * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
14128
+ * fallback, so adding a member here fails every adapter's build until someone
14129
+ * decides its glyph, which is the only place that decision can be made
14130
+ * honestly.
14131
+ *
14132
+ * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
14133
+ * `disarm` straight through; iOS feeds that string to
14134
+ * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
14135
+ * and every snooze and alarm button arrived BLANK. A pass-through is not a
14136
+ * mapping, and "the field is documented" is not "the value renders".
14137
+ *
14138
+ * Adding a member is TRAIN-BOUND. The enum lives in the published
14139
+ * `@camstack/server` closure and the cap seam validates against the HUB's copy,
14140
+ * so an addon that emits a token the running hub does not know does not lose an
14141
+ * icon — its whole `send` fails Zod validation and the notification never
14142
+ * arrives. Never emit a new token from an addon before the train carrying it.
14143
+ */
14144
+ var NotificationActionIconSchema = _enum([
14145
+ "acknowledge",
14146
+ "dismiss",
14147
+ "silence",
14148
+ "snooze",
14149
+ "view",
14150
+ "play",
14151
+ "open",
14152
+ "close",
14153
+ "lock",
14154
+ "unlock",
14155
+ "arm",
14156
+ "arm-home",
14157
+ "arm-away",
14158
+ "arm-night",
14159
+ "disarm",
14160
+ "light",
14161
+ "alert",
14162
+ "camera"
14163
+ ]);
14164
+ /** A single tap-through action button. */
14165
+ var NotificationActionSchema = object({
14166
+ id: string(),
14167
+ label: string(),
14168
+ url: string().optional(),
14169
+ /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
14170
+ icon: NotificationActionIconSchema.optional(),
14171
+ /**
14172
+ * Renders in a warning style where the notifier supports it.
14173
+ *
14174
+ * A HINT, never a gate. The callback's authority is its token and nothing
14175
+ * else — see `notification-center/action-token.ts` for what that does and
14176
+ * does not buy.
14177
+ */
14178
+ destructive: boolean().optional(),
14179
+ /**
14180
+ * How the tap should REACH the url.
14181
+ *
14182
+ * `navigate` (absent, and every button authored before this field) opens it:
14183
+ * the phone leaves the notification and shows whatever the callback returns.
14184
+ * That is right for a button whose answer the operator wants to read.
14185
+ *
14186
+ * `background` fires it as a POST and stays put. It exists for the buttons
14187
+ * whose whole point is not to interrupt — "silence this for 30 minutes" is
14188
+ * an answer to the notification, and being thrown into a browser tab to
14189
+ * confirm it costs more attention than the notification did. A backend that
14190
+ * cannot do a background call renders it as an ordinary link (the adapters
14191
+ * fall back rather than dropping the button), so this is a preference, never
14192
+ * a requirement.
14193
+ */
14194
+ mode: _enum(["navigate", "background"]).optional()
14195
+ });
14196
+ /** A delivery parameter value: what a notifier declared it takes. */
14197
+ var DeliveryParamValueSchema = union([
14198
+ string(),
14199
+ number(),
14200
+ boolean()
14201
+ ]);
14202
+ /**
14203
+ * One extra delivery parameter a notifier KIND declares (D938). A rule that
14204
+ * addresses a target of that kind may set it; a kind that declares nothing is
14205
+ * never handed one. The admin UI derives its control from this descriptor —
14206
+ * no editor knows a service by name.
14207
+ *
14208
+ * Optional fields are `.optional()`, never `.default()` (a Zod default does not
14209
+ * run on the addon cap path).
14210
+ */
14211
+ var DeliveryParamSchema = object({
14212
+ key: string().min(1),
14213
+ label: string(),
14214
+ /** i18n key of the label, resolved by the declaring addon's namespace. */
14215
+ labelKey: string().optional(),
14216
+ type: _enum([
14217
+ "enum",
14218
+ "number",
14219
+ "boolean",
14220
+ "string"
14221
+ ]),
14222
+ /** `enum` only: the closed set of accepted values. */
14223
+ options: array(object({
14224
+ value: string(),
14225
+ label: string()
14226
+ })).optional(),
14227
+ /** `number` only. */
14228
+ min: number().optional(),
14229
+ max: number().optional(),
14230
+ /** What the notifier does when the rule sets nothing; shown as the placeholder. */
14231
+ default: DeliveryParamValueSchema.optional()
14232
+ });
14233
+ /**
14234
+ * The canonical notification. `body` is the only hard field (Apprise model).
14235
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14236
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14237
+ * the adapter maps this ordinal onto its native level. `level?` is an
14238
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
14239
+ * `priority` for that one target.
14240
+ */
14241
+ var NotificationSchema = object({
14242
+ body: string(),
14243
+ title: string().optional(),
14244
+ format: NotificationFormatSchema.default("text"),
14245
+ priority: number().int().min(1).max(5).default(3),
14246
+ level: string().optional(),
14247
+ attachments: array(AttachmentSchema).optional(),
14248
+ clickUrl: string().optional(),
14249
+ actions: array(NotificationActionSchema).optional(),
14250
+ sound: string().optional(),
14251
+ ttl: number().optional(),
14252
+ tag: string().optional(),
14253
+ deviceId: number().optional(),
14254
+ eventId: string().optional(),
14255
+ metadata: record(string(), unknown()).optional(),
14256
+ /**
14257
+ * Values for the parameters the target's kind DECLARES in
14258
+ * {@link TargetKindSchema} `deliveryParams`. Already validated against the
14259
+ * declaration by the sender; a notifier reads only the keys it declared.
14260
+ */
14261
+ delivery: record(string(), DeliveryParamValueSchema).optional()
14262
+ });
14263
+ /** One declared native severity/priority level for a kind. */
14264
+ var TargetKindLevelSchema = object({
14265
+ id: string(),
14266
+ label: string(),
14267
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14268
+ ordinal: number().int().min(1).max(5).nullable(),
14269
+ flags: object({
14270
+ critical: boolean().optional(),
14271
+ silent: boolean().optional(),
14272
+ noPush: boolean().optional()
14273
+ }).optional(),
14274
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14275
+ requires: array(string()).optional(),
14276
+ description: string().optional()
14277
+ });
14278
+ /** The full capability block consulted before dispatch. */
14279
+ var TargetKindCapsSchema = object({
14280
+ attachments: object({
14281
+ mediaTypes: array(AttachmentMediaTypeSchema),
14282
+ mode: _enum([
14283
+ "url",
14284
+ "bytes",
14285
+ "both"
14286
+ ]),
14287
+ max: number().int().nonnegative(),
14288
+ maxBytes: number().int().positive().optional()
14289
+ }),
14290
+ /** Max action buttons (0 = none). */
14291
+ actions: number().int().nonnegative(),
14292
+ /**
14293
+ * Whether this kind renders a per-action ICON.
14294
+ *
14295
+ * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
14296
+ * run on the addon cap path — three production failures in one day taught
14297
+ * this repo that once. Absent is read as false by the degrade engine, which
14298
+ * is the safe direction: an icon that is not rendered costs nothing, an icon
14299
+ * assumed and dropped costs the operator's trust in the field.
14300
+ */
14301
+ actionIcons: boolean().optional(),
14302
+ levels: array(TargetKindLevelSchema),
14303
+ format: array(NotificationFormatSchema),
14304
+ clickUrl: boolean(),
14305
+ sound: boolean(),
14306
+ ttl: boolean(),
14307
+ bodyMaxLen: number().int().positive()
14308
+ });
14309
+ /**
14310
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14311
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14312
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14313
+ * the union is large and not meant for runtime validation here; the exported
14314
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14315
+ */
14316
+ var ConfigSchemaPassthrough$4 = unknown();
14317
+ var TargetKindSchema = object({
14318
+ kind: string(),
14319
+ label: string(),
14320
+ icon: string(),
14321
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
14322
+ addonId: string(),
14323
+ /**
14324
+ * URL of the kind's bundled BRAND icon, served by the providing addon over
14325
+ * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
14326
+ * when the addon bundles no icon for that kind — the client then falls back
14327
+ * to a neutral glyph rather than rendering the raw `icon` NAME as text.
14328
+ *
14329
+ * Root-relative on purpose: it resolves against whatever origin serves a web
14330
+ * client, and a native client joins it onto its own hub base.
14331
+ *
14332
+ * DECLARED here deliberately. It used to travel as an undeclared passthrough
14333
+ * field that survived only because the runtime cap-router forwards provider
14334
+ * output verbatim — so every consumer had to re-declare it by hand to stop
14335
+ * its own Zod parse from stripping it, and the whole arrangement would have
14336
+ * broken silently the moment output validation was tightened anywhere.
14337
+ */
14338
+ iconUrl: string().optional(),
14339
+ /**
14340
+ * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
14341
+ *
14342
+ * The server knows this and therefore says it, because the client cannot
14343
+ * safely guess: a React-Native client renders SVG and raster through two
14344
+ * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
14345
+ * not decode SVG on iOS/Android), so without this it silently fell back to a
14346
+ * placeholder glyph for every vector icon while the web build looked fine.
14347
+ *
14348
+ * Absent when {@link iconUrl} is absent, or for a legacy provider that has
14349
+ * not been updated — a client that cannot determine the type should prefer
14350
+ * its raster path, which is the safe default for an unknown image.
14351
+ */
14352
+ iconMediaType: string().optional(),
14353
+ configSchema: ConfigSchemaPassthrough$4,
14354
+ /**
14355
+ * The config keys that decide WHERE this kind's secrets are sent (server,
14356
+ * base URL, instance, chat, recipient). A save that changes any of them
14357
+ * while leaving a secret redacted is refused by the provider (D634), so an
14358
+ * editor uses this to ask for the secret on exactly those edits instead of
14359
+ * on every edit.
14360
+ *
14361
+ * Optional: absent from a provider that holds no secret (the Home Assistant
14362
+ * kinds) and from a provider older than this field — an editor that finds
14363
+ * it absent must assume ANY edit may need the secret.
14364
+ */
14365
+ destinationKeys: array(string()).optional(),
14366
+ supportsDiscovery: boolean(),
14367
+ /**
14368
+ * Extra delivery parameters a rule may set for a target of this kind (D938).
14369
+ * Absent = none; the rule editor then offers nothing.
14370
+ */
14371
+ deliveryParams: array(DeliveryParamSchema).optional(),
14372
+ caps: TargetKindCapsSchema
14373
+ });
14374
+ /**
14375
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
14376
+ * (return a presence marker only) when serving `listTargets` — never
14377
+ * round-trip a stored secret to the UI.
14378
+ */
14379
+ var TargetSchema = object({
14380
+ id: string(),
14381
+ name: string(),
14382
+ kind: string(),
14383
+ addonId: string(),
14384
+ enabled: boolean(),
14385
+ config: record(string(), unknown())
14386
+ });
14387
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
14388
+ var DiscoveredTargetSchema = object({
14389
+ kind: string(),
14390
+ suggestedName: string(),
14391
+ config: record(string(), unknown())
14392
+ });
14393
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
14394
+ var RenderedAsSchema = object({
14395
+ level: string(),
14396
+ format: NotificationFormatSchema,
14397
+ attachmentsSent: number().int().nonnegative(),
14398
+ actionsSent: number().int().nonnegative(),
14399
+ truncated: boolean(),
14400
+ dropped: array(string())
14401
+ });
14402
+ var SendResultSchema = object({
14403
+ success: boolean(),
14404
+ error: string().optional(),
14405
+ renderedAs: RenderedAsSchema.optional()
14406
+ });
14407
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
14408
+ var TestResultSchema = SendResultSchema;
14409
+ /**
14410
+ * Pre-save credential probe against a partial (unsaved) target config.
14411
+ * `resolvedUrl` never includes secrets (token stripped from path).
14412
+ */
14413
+ var ProbeTargetConfigResultSchema = object({
14414
+ ok: boolean(),
14415
+ resolvedUrl: string(),
14416
+ httpStatus: number().int().optional(),
14417
+ stateInstance: string().optional(),
14418
+ error: string().optional()
14419
+ });
14420
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
14421
+ kind: string(),
14422
+ config: record(string(), unknown()).optional(),
14423
+ /**
14424
+ * When editing / duplicating, the blank password field never round-trips
14425
+ * the stored token. Pass the source target id so the provider can restore
14426
+ * secrets server-side before dialling (same merge as upsert).
14427
+ */
14428
+ targetId: string().optional()
14429
+ }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
14430
+ kind: string(),
14431
+ config: record(string(), unknown()),
14432
+ /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
14433
+ targetId: string().optional()
14434
+ }), ProbeTargetConfigResultSchema, {
14435
+ kind: "mutation",
14436
+ auth: "admin"
14437
+ }), method(object({
14438
+ targetId: string(),
14439
+ notification: NotificationSchema
14440
+ }), SendResultSchema, {
14441
+ kind: "mutation",
14442
+ auth: "admin"
14443
+ }), method(object({
14444
+ targetId: string(),
14445
+ sample: NotificationSchema.optional()
14446
+ }), TestResultSchema, {
14447
+ kind: "mutation",
14448
+ auth: "admin"
14449
+ }), method(object({
14450
+ target: TargetSchema,
14451
+ /**
14452
+ * Duplicate flow: create a NEW target id while copying secrets from an
14453
+ * existing row. The UI never holds the stored token; blank / redacted
14454
+ * password fields are restored from this source (D634 still applies if
14455
+ * destinations diverge without a re-typed secret).
14456
+ */
14457
+ cloneSecretsFrom: string().optional()
14458
+ }), TargetSchema, {
14459
+ kind: "mutation",
14460
+ auth: "admin"
14461
+ }), method(object({ targetId: string() }), _void(), {
14462
+ kind: "mutation",
14463
+ auth: "admin"
14464
+ }), method(object({
14465
+ targetId: string(),
14466
+ enabled: boolean()
14467
+ }), _void(), {
14468
+ kind: "mutation",
14469
+ auth: "admin"
14470
+ });
14471
+ looseObject({
14472
+ name: string().min(1),
14473
+ enabled: boolean().optional()
14474
+ });
14475
+ TargetSchema.omit({ id: true });
14025
14476
  var EncodeProfileSchema = object({
14026
14477
  video: object({
14027
14478
  codec: _enum([
@@ -22246,7 +22697,6 @@ var SYSTEM_CAP_VOCABULARY = {
22246
22697
  "calendar-source": system(INTERNAL),
22247
22698
  calendars: system("calendars feed schedules and conditions, not device actions"),
22248
22699
  composer: system("device composition — an authoring tool, not an action"),
22249
- "connection-test": system(INTERNAL),
22250
22700
  "core-blocks": system(INTERNAL),
22251
22701
  "custom-model-registry": system(ML),
22252
22702
  "data-store-provider": system(INTERNAL),
@@ -44163,427 +44613,6 @@ var UnitWarningSchema = object({
44163
44613
  assumedUnit: string(),
44164
44614
  message: string()
44165
44615
  });
44166
- /**
44167
- * notification-output — canonical, capability-gated notification delivery.
44168
- *
44169
- * Apprise-derived model (see
44170
- * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
44171
- * callers emit ONE canonical `Notification`; each provider declares a
44172
- * per-kind capability descriptor (`TargetKind`), and the pure degrade
44173
- * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
44174
- * message to what the kind supports — callers never special-case a service.
44175
- *
44176
- * DESIGN DECISIONS (locked):
44177
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
44178
- * `setTargetEnabled`), each provider persisting via the `settings-store`
44179
- * cap. Rationale: the admin UI needs one uniform surface across the
44180
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
44181
- * alternative would fork the UI per addon and cannot host the
44182
- * discovery→adopt flow.
44183
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
44184
- * the generated cap-mount auto-`concatCollection`-fans them across every
44185
- * registered provider (notifiers addon + HA addon) so one catalog is
44186
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
44187
- * `addonId` the generated collection router extracts from the call input.
44188
- * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
44189
- * transformer) + UDS MsgPack both round-trip typed arrays — already used by
44190
- * `storage` / `storage-provider` / `recording` caps over the same path. No
44191
- * base64 fallback needed.
44192
- *
44193
- * TODO (deferred, closed-set change — separate decision): add
44194
- * `providerKind: 'notify'` so notification providers surface on the unified
44195
- * admin "Integrations" page.
44196
- */
44197
- /**
44198
- * Zentik-derived typed-media enum — the superset across every kind. Each
44199
- * adapter picks what it supports and the degrade engine filters the rest.
44200
- */
44201
- var AttachmentMediaTypeSchema = _enum([
44202
- "image",
44203
- "video",
44204
- "gif",
44205
- "audio",
44206
- "icon"
44207
- ]);
44208
- /**
44209
- * A single attachment. Exactly one of `url` (remote source, most adapters
44210
- * prefer this) or `bytes` (inline source; required for Pushover-style
44211
- * bytes-only kinds) MUST be present — the degrade engine expresses a
44212
- * url→bytes fetch as a `needsFetch` directive the adapter executes.
44213
- */
44214
- var AttachmentSchema = object({
44215
- mediaType: AttachmentMediaTypeSchema,
44216
- url: string().optional(),
44217
- bytes: _instanceof(Uint8Array).optional(),
44218
- mime: string().optional(),
44219
- name: string().optional()
44220
- }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
44221
- var NotificationFormatSchema = _enum([
44222
- "text",
44223
- "markdown",
44224
- "html"
44225
- ]);
44226
- /**
44227
- * The CLOSED icon vocabulary an action button may use.
44228
- *
44229
- * A closed set, not a free string, and that is the whole point: an arbitrary
44230
- * icon name is one that ntfy renders, zentik silently drops, and nobody
44231
- * notices — the same class of gap as a zone vocabulary nothing produced
44232
- * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
44233
- * declares `actionIcons: false` and the degrade engine strips the field.
44234
- *
44235
- * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
44236
- * renderer's icon set; "acknowledge" survives an adapter that draws it
44237
- * differently.
44238
- *
44239
- * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
44240
- *
44241
- * These names are for US. **No adapter may forward one verbatim.** Each maps
44242
- * the whole set onto its own renderer's vocabulary through a
44243
- * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
44244
- * fallback, so adding a member here fails every adapter's build until someone
44245
- * decides its glyph, which is the only place that decision can be made
44246
- * honestly.
44247
- *
44248
- * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
44249
- * `disarm` straight through; iOS feeds that string to
44250
- * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
44251
- * and every snooze and alarm button arrived BLANK. A pass-through is not a
44252
- * mapping, and "the field is documented" is not "the value renders".
44253
- *
44254
- * Adding a member is TRAIN-BOUND. The enum lives in the published
44255
- * `@camstack/server` closure and the cap seam validates against the HUB's copy,
44256
- * so an addon that emits a token the running hub does not know does not lose an
44257
- * icon — its whole `send` fails Zod validation and the notification never
44258
- * arrives. Never emit a new token from an addon before the train carrying it.
44259
- */
44260
- var NotificationActionIconSchema = _enum([
44261
- "acknowledge",
44262
- "dismiss",
44263
- "silence",
44264
- "snooze",
44265
- "view",
44266
- "play",
44267
- "open",
44268
- "close",
44269
- "lock",
44270
- "unlock",
44271
- "arm",
44272
- "arm-home",
44273
- "arm-away",
44274
- "arm-night",
44275
- "disarm",
44276
- "light",
44277
- "alert",
44278
- "camera"
44279
- ]);
44280
- /** A single tap-through action button. */
44281
- var NotificationActionSchema = object({
44282
- id: string(),
44283
- label: string(),
44284
- url: string().optional(),
44285
- /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
44286
- icon: NotificationActionIconSchema.optional(),
44287
- /**
44288
- * Renders in a warning style where the notifier supports it.
44289
- *
44290
- * A HINT, never a gate. The callback's authority is its token and nothing
44291
- * else — see `notification-center/action-token.ts` for what that does and
44292
- * does not buy.
44293
- */
44294
- destructive: boolean().optional(),
44295
- /**
44296
- * How the tap should REACH the url.
44297
- *
44298
- * `navigate` (absent, and every button authored before this field) opens it:
44299
- * the phone leaves the notification and shows whatever the callback returns.
44300
- * That is right for a button whose answer the operator wants to read.
44301
- *
44302
- * `background` fires it as a POST and stays put. It exists for the buttons
44303
- * whose whole point is not to interrupt — "silence this for 30 minutes" is
44304
- * an answer to the notification, and being thrown into a browser tab to
44305
- * confirm it costs more attention than the notification did. A backend that
44306
- * cannot do a background call renders it as an ordinary link (the adapters
44307
- * fall back rather than dropping the button), so this is a preference, never
44308
- * a requirement.
44309
- */
44310
- mode: _enum(["navigate", "background"]).optional()
44311
- });
44312
- /** A delivery parameter value: what a notifier declared it takes. */
44313
- var DeliveryParamValueSchema = union([
44314
- string(),
44315
- number(),
44316
- boolean()
44317
- ]);
44318
- /**
44319
- * One extra delivery parameter a notifier KIND declares (D938). A rule that
44320
- * addresses a target of that kind may set it; a kind that declares nothing is
44321
- * never handed one. The admin UI derives its control from this descriptor —
44322
- * no editor knows a service by name.
44323
- *
44324
- * Optional fields are `.optional()`, never `.default()` (a Zod default does not
44325
- * run on the addon cap path).
44326
- */
44327
- var DeliveryParamSchema = object({
44328
- key: string().min(1),
44329
- label: string(),
44330
- /** i18n key of the label, resolved by the declaring addon's namespace. */
44331
- labelKey: string().optional(),
44332
- type: _enum([
44333
- "enum",
44334
- "number",
44335
- "boolean",
44336
- "string"
44337
- ]),
44338
- /** `enum` only: the closed set of accepted values. */
44339
- options: array(object({
44340
- value: string(),
44341
- label: string()
44342
- })).optional(),
44343
- /** `number` only. */
44344
- min: number().optional(),
44345
- max: number().optional(),
44346
- /** What the notifier does when the rule sets nothing; shown as the placeholder. */
44347
- default: DeliveryParamValueSchema.optional()
44348
- });
44349
- /**
44350
- * The canonical notification. `body` is the only hard field (Apprise model).
44351
- * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
44352
- * NOT a fixed severity enum — each kind declares its own `caps.levels` and
44353
- * the adapter maps this ordinal onto its native level. `level?` is an
44354
- * optional kind-native level id (`emergency`, `silent`, …) that overrides
44355
- * `priority` for that one target.
44356
- */
44357
- var NotificationSchema = object({
44358
- body: string(),
44359
- title: string().optional(),
44360
- format: NotificationFormatSchema.default("text"),
44361
- priority: number().int().min(1).max(5).default(3),
44362
- level: string().optional(),
44363
- attachments: array(AttachmentSchema).optional(),
44364
- clickUrl: string().optional(),
44365
- actions: array(NotificationActionSchema).optional(),
44366
- sound: string().optional(),
44367
- ttl: number().optional(),
44368
- tag: string().optional(),
44369
- deviceId: number().optional(),
44370
- eventId: string().optional(),
44371
- metadata: record(string(), unknown()).optional(),
44372
- /**
44373
- * Values for the parameters the target's kind DECLARES in
44374
- * {@link TargetKindSchema} `deliveryParams`. Already validated against the
44375
- * declaration by the sender; a notifier reads only the keys it declared.
44376
- */
44377
- delivery: record(string(), DeliveryParamValueSchema).optional()
44378
- });
44379
- /** One declared native severity/priority level for a kind. */
44380
- var TargetKindLevelSchema = object({
44381
- id: string(),
44382
- label: string(),
44383
- /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
44384
- ordinal: number().int().min(1).max(5).nullable(),
44385
- flags: object({
44386
- critical: boolean().optional(),
44387
- silent: boolean().optional(),
44388
- noPush: boolean().optional()
44389
- }).optional(),
44390
- /** e.g. Pushover `emergency` requires `retry` / `expire`. */
44391
- requires: array(string()).optional(),
44392
- description: string().optional()
44393
- });
44394
- /** The full capability block consulted before dispatch. */
44395
- var TargetKindCapsSchema = object({
44396
- attachments: object({
44397
- mediaTypes: array(AttachmentMediaTypeSchema),
44398
- mode: _enum([
44399
- "url",
44400
- "bytes",
44401
- "both"
44402
- ]),
44403
- max: number().int().nonnegative(),
44404
- maxBytes: number().int().positive().optional()
44405
- }),
44406
- /** Max action buttons (0 = none). */
44407
- actions: number().int().nonnegative(),
44408
- /**
44409
- * Whether this kind renders a per-action ICON.
44410
- *
44411
- * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
44412
- * run on the addon cap path — three production failures in one day taught
44413
- * this repo that once. Absent is read as false by the degrade engine, which
44414
- * is the safe direction: an icon that is not rendered costs nothing, an icon
44415
- * assumed and dropped costs the operator's trust in the field.
44416
- */
44417
- actionIcons: boolean().optional(),
44418
- levels: array(TargetKindLevelSchema),
44419
- format: array(NotificationFormatSchema),
44420
- clickUrl: boolean(),
44421
- sound: boolean(),
44422
- ttl: boolean(),
44423
- bodyMaxLen: number().int().positive()
44424
- });
44425
- /**
44426
- * `configSchema` is a `ConfigUISchema` tree passed through to the admin
44427
- * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
44428
- * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
44429
- * the union is large and not meant for runtime validation here; the exported
44430
- * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
44431
- */
44432
- var ConfigSchemaPassthrough$4 = unknown();
44433
- var TargetKindSchema = object({
44434
- kind: string(),
44435
- label: string(),
44436
- icon: string(),
44437
- /** Stamped by each provider so the concat-fanned catalog stays routable. */
44438
- addonId: string(),
44439
- /**
44440
- * URL of the kind's bundled BRAND icon, served by the providing addon over
44441
- * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
44442
- * when the addon bundles no icon for that kind — the client then falls back
44443
- * to a neutral glyph rather than rendering the raw `icon` NAME as text.
44444
- *
44445
- * Root-relative on purpose: it resolves against whatever origin serves a web
44446
- * client, and a native client joins it onto its own hub base.
44447
- *
44448
- * DECLARED here deliberately. It used to travel as an undeclared passthrough
44449
- * field that survived only because the runtime cap-router forwards provider
44450
- * output verbatim — so every consumer had to re-declare it by hand to stop
44451
- * its own Zod parse from stripping it, and the whole arrangement would have
44452
- * broken silently the moment output validation was tightened anywhere.
44453
- */
44454
- iconUrl: string().optional(),
44455
- /**
44456
- * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
44457
- *
44458
- * The server knows this and therefore says it, because the client cannot
44459
- * safely guess: a React-Native client renders SVG and raster through two
44460
- * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
44461
- * not decode SVG on iOS/Android), so without this it silently fell back to a
44462
- * placeholder glyph for every vector icon while the web build looked fine.
44463
- *
44464
- * Absent when {@link iconUrl} is absent, or for a legacy provider that has
44465
- * not been updated — a client that cannot determine the type should prefer
44466
- * its raster path, which is the safe default for an unknown image.
44467
- */
44468
- iconMediaType: string().optional(),
44469
- configSchema: ConfigSchemaPassthrough$4,
44470
- /**
44471
- * The config keys that decide WHERE this kind's secrets are sent (server,
44472
- * base URL, instance, chat, recipient). A save that changes any of them
44473
- * while leaving a secret redacted is refused by the provider (D634), so an
44474
- * editor uses this to ask for the secret on exactly those edits instead of
44475
- * on every edit.
44476
- *
44477
- * Optional: absent from a provider that holds no secret (the Home Assistant
44478
- * kinds) and from a provider older than this field — an editor that finds
44479
- * it absent must assume ANY edit may need the secret.
44480
- */
44481
- destinationKeys: array(string()).optional(),
44482
- supportsDiscovery: boolean(),
44483
- /**
44484
- * Extra delivery parameters a rule may set for a target of this kind (D938).
44485
- * Absent = none; the rule editor then offers nothing.
44486
- */
44487
- deliveryParams: array(DeliveryParamSchema).optional(),
44488
- caps: TargetKindCapsSchema
44489
- });
44490
- /**
44491
- * A persisted target. `config` holds secrets; providers REDACT secret fields
44492
- * (return a presence marker only) when serving `listTargets` — never
44493
- * round-trip a stored secret to the UI.
44494
- */
44495
- var TargetSchema = object({
44496
- id: string(),
44497
- name: string(),
44498
- kind: string(),
44499
- addonId: string(),
44500
- enabled: boolean(),
44501
- config: record(string(), unknown())
44502
- });
44503
- /** A discovery-surfaced candidate (config is partial + non-secret). */
44504
- var DiscoveredTargetSchema = object({
44505
- kind: string(),
44506
- suggestedName: string(),
44507
- config: record(string(), unknown())
44508
- });
44509
- /** The degrade engine's report — what was resolved / dropped / degraded. */
44510
- var RenderedAsSchema = object({
44511
- level: string(),
44512
- format: NotificationFormatSchema,
44513
- attachmentsSent: number().int().nonnegative(),
44514
- actionsSent: number().int().nonnegative(),
44515
- truncated: boolean(),
44516
- dropped: array(string())
44517
- });
44518
- var SendResultSchema = object({
44519
- success: boolean(),
44520
- error: string().optional(),
44521
- renderedAs: RenderedAsSchema.optional()
44522
- });
44523
- /** Same shape as SendResult — kept as a distinct name for the test panel. */
44524
- var TestResultSchema = SendResultSchema;
44525
- /**
44526
- * Pre-save credential probe against a partial (unsaved) target config.
44527
- * `resolvedUrl` never includes secrets (token stripped from path).
44528
- */
44529
- var ProbeTargetConfigResultSchema = object({
44530
- ok: boolean(),
44531
- resolvedUrl: string(),
44532
- httpStatus: number().int().optional(),
44533
- stateInstance: string().optional(),
44534
- error: string().optional()
44535
- });
44536
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
44537
- kind: string(),
44538
- config: record(string(), unknown()).optional(),
44539
- /**
44540
- * When editing / duplicating, the blank password field never round-trips
44541
- * the stored token. Pass the source target id so the provider can restore
44542
- * secrets server-side before dialling (same merge as upsert).
44543
- */
44544
- targetId: string().optional()
44545
- }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
44546
- kind: string(),
44547
- config: record(string(), unknown()),
44548
- /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
44549
- targetId: string().optional()
44550
- }), ProbeTargetConfigResultSchema, {
44551
- kind: "mutation",
44552
- auth: "admin"
44553
- }), method(object({
44554
- targetId: string(),
44555
- notification: NotificationSchema
44556
- }), SendResultSchema, {
44557
- kind: "mutation",
44558
- auth: "admin"
44559
- }), method(object({
44560
- targetId: string(),
44561
- sample: NotificationSchema.optional()
44562
- }), TestResultSchema, {
44563
- kind: "mutation",
44564
- auth: "admin"
44565
- }), method(object({
44566
- target: TargetSchema,
44567
- /**
44568
- * Duplicate flow: create a NEW target id while copying secrets from an
44569
- * existing row. The UI never holds the stored token; blank / redacted
44570
- * password fields are restored from this source (D634 still applies if
44571
- * destinations diverge without a re-typed secret).
44572
- */
44573
- cloneSecretsFrom: string().optional()
44574
- }), TargetSchema, {
44575
- kind: "mutation",
44576
- auth: "admin"
44577
- }), method(object({ targetId: string() }), _void(), {
44578
- kind: "mutation",
44579
- auth: "admin"
44580
- }), method(object({
44581
- targetId: string(),
44582
- enabled: boolean()
44583
- }), _void(), {
44584
- kind: "mutation",
44585
- auth: "admin"
44586
- });
44587
44616
  function errorText(err) {
44588
44617
  return err instanceof Error ? err.message : String(err);
44589
44618
  }
@@ -48547,37 +48576,6 @@ method(object({
48547
48576
  kind: "mutation",
48548
48577
  auth: "admin"
48549
48578
  }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
48550
- var ConnectionTestOutcomeSchema = discriminatedUnion("outcome", [
48551
- object({
48552
- outcome: literal("validated"),
48553
- /** Round-trip of the sign-in, when the provider measured it. */
48554
- latencyMs: number().nonnegative().optional(),
48555
- /** Optional human detail worth showing next to the tick
48556
- * ("3 devices visible on this account"). */
48557
- detail: string().optional()
48558
- }).strict(),
48559
- object({
48560
- outcome: literal("rejected"),
48561
- error: string()
48562
- }).strict(),
48563
- object({
48564
- outcome: literal("inconclusive"),
48565
- error: string()
48566
- }).strict()
48567
- ]);
48568
- var ConnectionTestInputSchema = object({
48569
- /** Candidate integration settings, exactly as the create form collected them. */
48570
- settings: record(string(), unknown()) });
48571
- /**
48572
- * What the provider's test actually DOES, so the UI can say it in words before
48573
- * the operator presses the button ("Signs in to the Dreo cloud"). Purely
48574
- * descriptive — it never changes routing.
48575
- */
48576
- var ConnectionTestDescriptorSchema = object({ label: string() });
48577
- method(ConnectionTestInputSchema, ConnectionTestOutcomeSchema, {
48578
- kind: "mutation",
48579
- auth: "admin"
48580
- }), method(_void(), ConnectionTestDescriptorSchema, { auth: "admin" });
48581
48579
  object({
48582
48580
  /** True when the upstream system considers the entity connected. */
48583
48581
  connected: boolean(),
@@ -54480,10 +54478,9 @@ var AvailableIntegrationTypeSchema = object({
54480
54478
  * locations" checkbox. Provider-declared in the addon manifest. */
54481
54479
  supportsLocationImport: boolean(),
54482
54480
  /**
54483
- * True when this integration DECLARES a pre-creation test (the
54484
- * `connection-test` cap, or a broker whose settings it stores). Drives the
54485
- * Test button: an integration that cannot be tested must say so up front
54486
- * rather than offering a button that always answers the same nonsense.
54481
+ * True when this integration's instances declare a Test (`integration-instances.describe().canTest`,
54482
+ * D1016). An integration that cannot be tested must say so up front rather than offering a
54483
+ * button that always answers the same nonsense.
54487
54484
  */
54488
54485
  canTest: boolean(),
54489
54486
  existingInstances: array(object({
@@ -54537,7 +54534,9 @@ var CreateIntegrationInputSchema = object({
54537
54534
  info: record(string(), unknown()).optional(),
54538
54535
  /** `stableId` of the discovery candidate the form was seeded from (D984). */
54539
54536
  originStableId: string().optional(),
54540
- settings: record(string(), unknown()).optional()
54537
+ settings: record(string(), unknown()).optional(),
54538
+ /** The instance kind being created, for a provider with several; omitted = its only testable kind. */
54539
+ kind: string().min(1).optional()
54541
54540
  });
54542
54541
  var UpdateIntegrationInputSchema = object({
54543
54542
  id: string(),
@@ -54563,13 +54562,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
54563
54562
  }), method(object({ id: string() }), DeleteIntegrationResultSchema, {
54564
54563
  kind: "mutation",
54565
54564
  auth: "admin"
54566
- }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" }), method(object({
54567
- addonId: string(),
54568
- settings: record(string(), unknown())
54569
- }), TestConnectionResultSchema, {
54570
- kind: "mutation",
54571
- auth: "admin"
54572
- });
54565
+ }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" });
54573
54566
  /**
54574
54567
  * `integration-instances` - the connection of an addon that holds ONE or SEVERAL
54575
54568
  * (an account, a relay, a destination) as typed records (D985, D986). The addon's
@@ -62812,13 +62805,6 @@ var AddBrokerInputSchema = object({
62812
62805
  });
62813
62806
  var AddBrokerResultSchema = object({ id: string() });
62814
62807
  var IdInputSchema = object({ id: string() });
62815
- var TestResultSchema$1 = discriminatedUnion("ok", [object({
62816
- ok: literal(true),
62817
- latencyMs: number()
62818
- }), object({
62819
- ok: literal(false),
62820
- error: string()
62821
- })]);
62822
62808
  var StartEmbeddedInputSchema = object({
62823
62809
  port: number().int().min(1).max(65535).default(1883),
62824
62810
  /** Allow anonymous connect (no username/password). Default: false. */
@@ -62841,9 +62827,6 @@ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnection
62841
62827
  }), method(IdInputSchema, _void(), {
62842
62828
  kind: "mutation",
62843
62829
  auth: "admin"
62844
- }), method(IdInputSchema, TestResultSchema$1, {
62845
- kind: "mutation",
62846
- auth: "admin"
62847
62830
  }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, {
62848
62831
  kind: "mutation",
62849
62832
  auth: "admin"
@@ -74478,7 +74461,7 @@ var TrainingProviderTypeSchema = object({
74478
74461
  label: string(),
74479
74462
  /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
74480
74463
  iconAsset: string(),
74481
- /** Owning `training-provider` addon — collection selector for createEntry. */
74464
+ /** Owning `training-provider` addon. */
74482
74465
  addonId: string(),
74483
74466
  /**
74484
74467
  * Fields for one entry of this type (credentials + defaults). Absent on a
@@ -74523,36 +74506,6 @@ var TrainingProviderDescriptorSchema = object({
74523
74506
  */
74524
74507
  formValues: record(string(), unknown()).optional()
74525
74508
  });
74526
- /**
74527
- * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
74528
- * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
74529
- * `{ $secretClear: true }` clears it.
74530
- */
74531
- var TrainingProviderUpdateEntryInputSchema = object({
74532
- entryId: string().min(1),
74533
- name: string().min(1),
74534
- tokenId: string().optional(),
74535
- tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
74536
- environment: string().optional(),
74537
- gpuType: string().optional(),
74538
- region: string().optional(),
74539
- costCapUsd: number().nonnegative().optional(),
74540
- maxRuntimeSec: number().int().positive().optional(),
74541
- failedDatasetGraceHours: number().nonnegative().optional()
74542
- });
74543
- var TrainingCredentialCheckSchema = object({
74544
- ok: boolean(),
74545
- /** Workspace / account name, when the provider says. */
74546
- account: string().optional(),
74547
- reason: _enum([
74548
- "missing",
74549
- "invalid",
74550
- "forbidden",
74551
- "network",
74552
- "quota"
74553
- ]).optional(),
74554
- detail: string().optional()
74555
- });
74556
74509
  var ProviderJobStateSchema = _enum([
74557
74510
  "pending",
74558
74511
  "starting",
@@ -74600,22 +74553,6 @@ var TrainingLogLineSchema = object({
74600
74553
  text: string()
74601
74554
  });
74602
74555
  method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
74603
- typeId: string().min(1),
74604
- name: string().min(1)
74605
- }), object({ entryId: string() }), {
74606
- kind: "mutation",
74607
- auth: "admin"
74608
- }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
74609
- kind: "mutation",
74610
- auth: "admin"
74611
- }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
74612
- kind: "mutation",
74613
- auth: "admin"
74614
- }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
74615
- kind: "mutation",
74616
- auth: "admin",
74617
- timeoutMs: 3e4
74618
- }), method(object({
74619
74556
  entryId: string().min(1),
74620
74557
  gpuType: string(),
74621
74558
  region: string(),
@@ -78001,20 +77938,6 @@ Object.freeze({
78001
77938
  access: "view",
78002
77939
  role: "admin"
78003
77940
  },
78004
- "connectionTest.describeTest": {
78005
- capName: "connection-test",
78006
- capScope: "system",
78007
- addonId: null,
78008
- access: "view",
78009
- role: "admin"
78010
- },
78011
- "connectionTest.testSettings": {
78012
- capName: "connection-test",
78013
- capScope: "system",
78014
- addonId: null,
78015
- access: "create",
78016
- role: "admin"
78017
- },
78018
77941
  "connectivity.getStatus": {
78019
77942
  capName: "connectivity",
78020
77943
  capScope: "device",
@@ -80381,13 +80304,6 @@ Object.freeze({
80381
80304
  access: "view",
80382
80305
  role: "admin"
80383
80306
  },
80384
- "integrations.testConnection": {
80385
- capName: "integrations",
80386
- capScope: "system",
80387
- addonId: null,
80388
- access: "create",
80389
- role: "admin"
80390
- },
80391
80307
  "integrations.update": {
80392
80308
  capName: "integrations",
80393
80309
  capScope: "system",
@@ -81620,13 +81536,6 @@ Object.freeze({
81620
81536
  access: "create",
81621
81537
  role: "admin"
81622
81538
  },
81623
- "mqttBroker.testConnection": {
81624
- capName: "mqtt-broker",
81625
- capScope: "system",
81626
- addonId: null,
81627
- access: "create",
81628
- role: "admin"
81629
- },
81630
81539
  "nativeObjectDetection.getOptions": {
81631
81540
  capName: "native-object-detection",
81632
81541
  capScope: "device",
@@ -86457,20 +86366,6 @@ Object.freeze({
86457
86366
  access: "create",
86458
86367
  role: "admin"
86459
86368
  },
86460
- "trainingProvider.createEntry": {
86461
- capName: "training-provider",
86462
- capScope: "system",
86463
- addonId: null,
86464
- access: "create",
86465
- role: "admin"
86466
- },
86467
- "trainingProvider.deleteEntry": {
86468
- capName: "training-provider",
86469
- capScope: "system",
86470
- addonId: null,
86471
- access: "delete",
86472
- role: "admin"
86473
- },
86474
86369
  "trainingProvider.describe": {
86475
86370
  capName: "training-provider",
86476
86371
  capScope: "system",
@@ -86541,13 +86436,6 @@ Object.freeze({
86541
86436
  access: "create",
86542
86437
  role: "admin"
86543
86438
  },
86544
- "trainingProvider.updateEntry": {
86545
- capName: "training-provider",
86546
- capScope: "system",
86547
- addonId: null,
86548
- access: "create",
86549
- role: "admin"
86550
- },
86551
86439
  "trainingProvider.uploadDataset": {
86552
86440
  capName: "training-provider",
86553
86441
  capScope: "system",
@@ -86555,13 +86443,6 @@ Object.freeze({
86555
86443
  access: "create",
86556
86444
  role: "admin"
86557
86445
  },
86558
- "trainingProvider.validateCredentials": {
86559
- capName: "training-provider",
86560
- capScope: "system",
86561
- addonId: null,
86562
- access: "create",
86563
- role: "admin"
86564
- },
86565
86446
  "turnProvider.getTurnServers": {
86566
86447
  capName: "turn-provider",
86567
86448
  capScope: "system",