@camstack/addon-provider-reolink 1.2.231 → 1.2.232

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.
package/dist/addon.js CHANGED
@@ -106677,7 +106677,7 @@ var ZodIssueCode = {
106677
106677
  var ZodFirstPartyTypeKind;
106678
106678
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
106679
106679
  //#endregion
106680
- //#region ../types/dist/sleep-CmjWurK5.mjs
106680
+ //#region ../types/dist/sleep-D7ZKm4nb.mjs
106681
106681
  /**
106682
106682
  * The audio chunk plane's byte format, and the ONE expansion from a coded
106683
106683
  * window to float samples (D455).
@@ -107386,10 +107386,33 @@ function integrationRowsApiOver(api) {
107386
107386
  };
107387
107387
  }
107388
107388
  var PREFIX = "records/";
107389
+ /**
107390
+ * Cross-realm brand. An addon bundles its own copy of this module (D15) while
107391
+ * `ctx.records` is the HOST's door, so an error thrown by the host is an
107392
+ * instance of the host's classes, not of the addon's. The brand plus the code
107393
+ * make `instanceof` answer by identity of the failure, not of the copy.
107394
+ */
107395
+ var RECORDS_ERROR_BRAND = Symbol.for("camstack.records-error");
107396
+ function carriesBrand(value) {
107397
+ return typeof value === "object" && value !== null && Reflect.get(value, RECORDS_ERROR_BRAND) === true;
107398
+ }
107389
107399
  /** The base of every records failure. `detail` is the human part of the message. */
107390
107400
  var RecordsError = class extends Error {
107401
+ /** The code a subclass stands for; the base stands for every code. */
107402
+ static code = void 0;
107403
+ /**
107404
+ * `instanceof` across copies of this module: any branded error is a
107405
+ * `RecordsError`, and is an instance of a subclass only when its code is the
107406
+ * subclass's code. Same-copy answers are unchanged.
107407
+ */
107408
+ static [Symbol.hasInstance](value) {
107409
+ if (Function.prototype[Symbol.hasInstance].call(this, value)) return true;
107410
+ if (!carriesBrand(value)) return false;
107411
+ return this.code === void 0 || value.code === this.code;
107412
+ }
107391
107413
  code;
107392
107414
  detail;
107415
+ [RECORDS_ERROR_BRAND] = true;
107393
107416
  constructor(code, detail) {
107394
107417
  super(`${PREFIX}${code}: ${detail}`);
107395
107418
  this.name = "RecordsError";
@@ -107398,29 +107421,33 @@ var RecordsError = class extends Error {
107398
107421
  }
107399
107422
  };
107400
107423
  /** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
107401
- var RevConflictError = class extends RecordsError {
107424
+ var RevConflictError = class RevConflictError extends RecordsError {
107425
+ static code = "rev-conflict";
107402
107426
  constructor(detail) {
107403
- super("rev-conflict", detail);
107427
+ super(RevConflictError.code, detail);
107404
107428
  this.name = "RevConflictError";
107405
107429
  }
107406
107430
  };
107407
107431
  /** The keychain could not store or serve a value: explicit, never an empty string. */
107408
- var RecordSecretUnavailableError = class extends RecordsError {
107432
+ var RecordSecretUnavailableError = class RecordSecretUnavailableError extends RecordsError {
107433
+ static code = "secret-unavailable";
107409
107434
  constructor(detail) {
107410
- super("secret-unavailable", detail);
107435
+ super(RecordSecretUnavailableError.code, detail);
107411
107436
  this.name = "RecordSecretUnavailableError";
107412
107437
  }
107413
107438
  };
107414
- var InvalidRecordError = class extends RecordsError {
107439
+ var InvalidRecordError = class InvalidRecordError extends RecordsError {
107440
+ static code = "invalid-record";
107415
107441
  constructor(detail) {
107416
- super("invalid-record", detail);
107442
+ super(InvalidRecordError.code, detail);
107417
107443
  this.name = "InvalidRecordError";
107418
107444
  }
107419
107445
  };
107420
107446
  /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
107421
- var DeclarationRefusedError = class extends RecordsError {
107447
+ var DeclarationRefusedError = class DeclarationRefusedError extends RecordsError {
107448
+ static code = "declaration-refused";
107422
107449
  constructor(detail) {
107423
- super("declaration-refused", detail);
107450
+ super(DeclarationRefusedError.code, detail);
107424
107451
  this.name = "DeclarationRefusedError";
107425
107452
  }
107426
107453
  };
@@ -110231,286 +110258,6 @@ function normalizeAddonInitResult(result) {
110231
110258
  if (Array.isArray(result)) return { providers: result };
110232
110259
  return result;
110233
110260
  }
110234
- /**
110235
- * The share-view scope kinds a share-link token can carry. The hub mints
110236
- * and validates them (`ShareViewGrantSchema` builds its
110237
- * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
110238
- */
110239
- var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
110240
- /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
110241
- var PeerBytesTicketSchema = object({
110242
- /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
110243
- url: string().min(1),
110244
- /**
110245
- * The HOST node this URL means something on — the hub or a named agent,
110246
- * never a runner. {@link AddonPeerBytes.open} compares it to its own and
110247
- * refuses `cross-node` by name when they differ, without dialling.
110248
- */
110249
- hostNodeId: string().min(1),
110250
- expiresAtMs: number().int().nonnegative(),
110251
- /**
110252
- * What the producer DECLARED the body to be, when it knows — `null` when it
110253
- * does not. Never `0` for unknown (D393): a consumer sizing a bound off this
110254
- * must be able to tell "the producer did not say" from "the body is empty".
110255
- */
110256
- declaredBytes: number().int().nonnegative().nullable()
110257
- });
110258
- function defOf(schema) {
110259
- const zodBag = Reflect.get(schema, "_zod");
110260
- if (typeof zodBag !== "object" || zodBag === null) return {};
110261
- const def = Reflect.get(zodBag, "def");
110262
- if (typeof def !== "object" || def === null) return {};
110263
- return def;
110264
- }
110265
- function declaredHere(schema) {
110266
- return globalRegistry.get(schema)?.secret === true;
110267
- }
110268
- /** Wrapper kinds whose `innerType` is the field itself. */
110269
- var WRAPPERS = new Set([
110270
- "optional",
110271
- "nullable",
110272
- "default",
110273
- "prefault",
110274
- "catch",
110275
- "readonly",
110276
- "nonoptional"
110277
- ]);
110278
- /**
110279
- * The schema layers that make up ONE field: the schema itself and every
110280
- * wrapper below it (optional / default / nullable / readonly / catch), plus
110281
- * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
110282
- * `.transform` on `in`).
110283
- */
110284
- function layersOf(schema) {
110285
- const out = [];
110286
- const queue = [schema];
110287
- while (queue.length > 0) {
110288
- const s = queue.shift();
110289
- if (!s || out.includes(s)) continue;
110290
- out.push(s);
110291
- const def = defOf(s);
110292
- if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
110293
- if (def.type === "pipe") {
110294
- if (def.in) queue.push(def.in);
110295
- if (def.out) queue.push(def.out);
110296
- }
110297
- }
110298
- return out;
110299
- }
110300
- /** True when any layer of this field declares `.meta({ secret: true })`. */
110301
- function isZodSecret(schema) {
110302
- return layersOf(schema).some(declaredHere);
110303
- }
110304
- /**
110305
- * Every declared secret path in a config schema: dotted keys, `[]` for "each
110306
- * element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
110307
- * map" (`applianceSecrets{}`). A declared
110308
- * object or array is reported as one path and not descended into — everything
110309
- * under it is secret.
110310
- */
110311
- function collectZodSecretPaths(schema, prefix = "") {
110312
- if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
110313
- const paths = [];
110314
- for (const layer of layersOf(schema)) {
110315
- const def = defOf(layer);
110316
- if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
110317
- else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
110318
- else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
110319
- else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
110320
- else if (def.type === "intersection") {
110321
- if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
110322
- if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
110323
- }
110324
- }
110325
- return [...new Set(paths)];
110326
- }
110327
- /**
110328
- * Record kinds (D881): the declaration an addon makes of one kind of fact, the
110329
- * Zod row schema that describes it, and the helper that turns the two into the
110330
- * JSON the engine stores.
110331
- *
110332
- * A kind is declared ONCE, next to the code that owns it, and the engine's
110333
- * reconciler creates its indexes - nothing creates DDL at runtime from a write.
110334
- * Everything the generic machinery needs (secret fields, the entry descriptor)
110335
- * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
110336
- * never a field name (D879).
110337
- */
110338
- /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
110339
- var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
110340
- var RecordIndexSchema = object({
110341
- name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
110342
- fields: array(RecordFieldPathSchema).min(1).max(4),
110343
- unique: boolean().optional()
110344
- }).strict();
110345
- var RecordRetentionSchema = union([
110346
- object({
110347
- ttlMs: number().int().positive(),
110348
- from: _enum(["at", "write"])
110349
- }).strict(),
110350
- object({
110351
- maxRows: number().int().positive().optional(),
110352
- maxRowsPerDevice: number().int().positive().optional()
110353
- }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
110354
- object({
110355
- owner: string().min(1),
110356
- reason: string().min(1)
110357
- }).strict(),
110358
- object({ none: string().min(1) }).strict()
110359
- ]);
110360
- /** The descriptor a generic entries UI reads (D881 "generic entries"). */
110361
- var EntryDescriptorSchema = object({
110362
- title: string().min(1),
110363
- /** The record body field shown as the entry's name. */
110364
- nameField: string().min(1),
110365
- /** JSON Schema of the entry body; `secret: true` marks a password field. */
110366
- fields: record(string(), unknown())
110367
- }).strict();
110368
- /** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
110369
- var RecordKindDeclarationSchema = object({
110370
- database: _enum(RECORD_DATABASES).default("settings"),
110371
- class: _enum(RECORD_CLASSES),
110372
- writeTrigger: string().min(1),
110373
- device: _enum([
110374
- "required",
110375
- "optional",
110376
- "none"
110377
- ]).default("none"),
110378
- at: _enum(["required", "none"]).default("none"),
110379
- indexes: array(RecordIndexSchema).max(8).default([]),
110380
- retention: RecordRetentionSchema,
110381
- deviceRemoval: _enum(["delete", "none"]).default("none"),
110382
- maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
110383
- /** Derived from the Zod schema; never written by hand. */
110384
- secretPaths: array(string().min(1)).default([]),
110385
- /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
110386
- secretArrayKeys: record(string(), string()).default({}),
110387
- /** Kinds that must agree through `transact` sit in one file under one family name. */
110388
- transactFamily: string().min(1).optional(),
110389
- entry: EntryDescriptorSchema.optional()
110390
- }).strict();
110391
- /** The kind names: lower-case, dash separated, short enough for an index name. */
110392
- var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
110393
- /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
110394
- function assertValidDeclaration(name, decl) {
110395
- const refuse = (why) => {
110396
- throw new DeclarationRefusedError(`kind "${name}": ${why}`);
110397
- };
110398
- if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
110399
- const seen = /* @__PURE__ */ new Set();
110400
- for (const index of decl.indexes) {
110401
- if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
110402
- seen.add(index.name);
110403
- }
110404
- const { retention } = decl;
110405
- const hasSecrets = decl.secretPaths.length > 0;
110406
- if ("ttlMs" in retention) {
110407
- if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
110408
- if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
110409
- }
110410
- if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
110411
- if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
110412
- if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
110413
- if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
110414
- const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
110415
- 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)`);
110416
- }
110417
- if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
110418
- 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`);
110419
- }
110420
- function bodyFieldsOf(schema) {
110421
- return { ...toJSONSchema(schema, {
110422
- unrepresentable: "any",
110423
- io: "input"
110424
- }) };
110425
- }
110426
- function isRecordLike(value) {
110427
- return typeof value === "object" && value !== null && !Array.isArray(value);
110428
- }
110429
- /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
110430
- function hasNameField(json, field) {
110431
- const branches = json["oneOf"] ?? json["anyOf"];
110432
- if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
110433
- const properties = json["properties"];
110434
- return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
110435
- }
110436
- /**
110437
- * Declare the kinds of a package. The keys are the kind names. The result is
110438
- * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
110439
- * types its handle from.
110440
- */
110441
- function defineRecordKinds(specs) {
110442
- const out = {};
110443
- for (const [name, spec] of Object.entries(specs)) {
110444
- const secretPaths = collectZodSecretPaths(spec.schema);
110445
- const nameField = spec.entry?.nameField ?? "name";
110446
- const fields = bodyFieldsOf(spec.schema);
110447
- if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
110448
- const parsed = RecordKindDeclarationSchema.parse({
110449
- database: spec.database,
110450
- class: spec.class,
110451
- writeTrigger: spec.writeTrigger,
110452
- device: spec.device,
110453
- at: spec.at,
110454
- indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
110455
- retention: spec.retention,
110456
- deviceRemoval: spec.deviceRemoval,
110457
- maxDataBytes: spec.maxDataBytes,
110458
- secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
110459
- secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
110460
- transactFamily: spec.transactFamily,
110461
- entry: spec.entry === void 0 ? void 0 : {
110462
- title: spec.entry.title,
110463
- nameField,
110464
- fields
110465
- }
110466
- });
110467
- assertValidDeclaration(name, parsed);
110468
- out[name] = {
110469
- name,
110470
- schema: spec.schema,
110471
- declaration: parsed
110472
- };
110473
- }
110474
- return out;
110475
- }
110476
- /**
110477
- * Entry kinds (D881): every list of user-created entries (notification
110478
- * targets, brokers, LLM profiles) is ONE record kind with an id, a name and a
110479
- * kind-specific body, and the admin UI lists/adds/edits/deletes all of them
110480
- * through the `record-entries` capability with password fields derived from
110481
- * the schema (`.meta({ secret: true })`).
110482
- */
110483
- /** The body of a plain entry: a name and the fields the kind adds. */
110484
- function entryBody(shape) {
110485
- return object({
110486
- name: string().min(1),
110487
- enabled: boolean().optional(),
110488
- ...shape
110489
- });
110490
- }
110491
- /**
110492
- * Declare one entry kind. An entry is configuration: never trimmed by the
110493
- * engine, never aged, belonging to no device.
110494
- */
110495
- function defineEntryKind(name, spec) {
110496
- const defined = defineRecordKinds({ [name]: {
110497
- schema: spec.schema,
110498
- class: "config",
110499
- writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
110500
- retention: { none: "an entry goes only when the operator deletes it" },
110501
- ...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
110502
- ...spec.database === void 0 ? {} : { database: spec.database },
110503
- ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
110504
- ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
110505
- ...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
110506
- entry: {
110507
- title: spec.title,
110508
- ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
110509
- }
110510
- } })[name];
110511
- if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
110512
- return defined;
110513
- }
110514
110261
  object({
110515
110262
  field: string().min(1),
110516
110263
  on: literal("advance")
@@ -110603,6 +110350,286 @@ function optionalMethod(input, output, options) {
110603
110350
  function event(data) {
110604
110351
  return { data };
110605
110352
  }
110353
+ function defOf(schema) {
110354
+ const zodBag = Reflect.get(schema, "_zod");
110355
+ if (typeof zodBag !== "object" || zodBag === null) return {};
110356
+ const def = Reflect.get(zodBag, "def");
110357
+ if (typeof def !== "object" || def === null) return {};
110358
+ return def;
110359
+ }
110360
+ function declaredHere(schema) {
110361
+ return globalRegistry.get(schema)?.secret === true;
110362
+ }
110363
+ /** Wrapper kinds whose `innerType` is the field itself. */
110364
+ var WRAPPERS = new Set([
110365
+ "optional",
110366
+ "nullable",
110367
+ "default",
110368
+ "prefault",
110369
+ "catch",
110370
+ "readonly",
110371
+ "nonoptional"
110372
+ ]);
110373
+ /**
110374
+ * The schema layers that make up ONE field: the schema itself and every
110375
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
110376
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
110377
+ * `.transform` on `in`).
110378
+ */
110379
+ function layersOf(schema) {
110380
+ const out = [];
110381
+ const queue = [schema];
110382
+ while (queue.length > 0) {
110383
+ const s = queue.shift();
110384
+ if (!s || out.includes(s)) continue;
110385
+ out.push(s);
110386
+ const def = defOf(s);
110387
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
110388
+ if (def.type === "pipe") {
110389
+ if (def.in) queue.push(def.in);
110390
+ if (def.out) queue.push(def.out);
110391
+ }
110392
+ }
110393
+ return out;
110394
+ }
110395
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
110396
+ function isZodSecret(schema) {
110397
+ return layersOf(schema).some(declaredHere);
110398
+ }
110399
+ /**
110400
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
110401
+ * element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
110402
+ * map" (`applianceSecrets{}`). A declared
110403
+ * object or array is reported as one path and not descended into — everything
110404
+ * under it is secret.
110405
+ */
110406
+ function collectZodSecretPaths(schema, prefix = "") {
110407
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
110408
+ const paths = [];
110409
+ for (const layer of layersOf(schema)) {
110410
+ const def = defOf(layer);
110411
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
110412
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
110413
+ else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
110414
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
110415
+ else if (def.type === "intersection") {
110416
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
110417
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
110418
+ }
110419
+ }
110420
+ return [...new Set(paths)];
110421
+ }
110422
+ /**
110423
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
110424
+ * Zod row schema that describes it, and the helper that turns the two into the
110425
+ * JSON the engine stores.
110426
+ *
110427
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
110428
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
110429
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
110430
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
110431
+ * never a field name (D879).
110432
+ */
110433
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
110434
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
110435
+ var RecordIndexSchema = object({
110436
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
110437
+ fields: array(RecordFieldPathSchema).min(1).max(4),
110438
+ unique: boolean().optional()
110439
+ }).strict();
110440
+ var RecordRetentionSchema = union([
110441
+ object({
110442
+ ttlMs: number().int().positive(),
110443
+ from: _enum(["at", "write"])
110444
+ }).strict(),
110445
+ object({
110446
+ maxRows: number().int().positive().optional(),
110447
+ maxRowsPerDevice: number().int().positive().optional()
110448
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
110449
+ object({
110450
+ owner: string().min(1),
110451
+ reason: string().min(1)
110452
+ }).strict(),
110453
+ object({ none: string().min(1) }).strict()
110454
+ ]);
110455
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
110456
+ var EntryDescriptorSchema = object({
110457
+ title: string().min(1),
110458
+ /** The record body field shown as the entry's name. */
110459
+ nameField: string().min(1),
110460
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
110461
+ fields: record(string(), unknown())
110462
+ }).strict();
110463
+ /** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
110464
+ var RecordKindDeclarationSchema = object({
110465
+ database: _enum(RECORD_DATABASES).default("settings"),
110466
+ class: _enum(RECORD_CLASSES),
110467
+ writeTrigger: string().min(1),
110468
+ device: _enum([
110469
+ "required",
110470
+ "optional",
110471
+ "none"
110472
+ ]).default("none"),
110473
+ at: _enum(["required", "none"]).default("none"),
110474
+ indexes: array(RecordIndexSchema).max(8).default([]),
110475
+ retention: RecordRetentionSchema,
110476
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
110477
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
110478
+ /** Derived from the Zod schema; never written by hand. */
110479
+ secretPaths: array(string().min(1)).default([]),
110480
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
110481
+ secretArrayKeys: record(string(), string()).default({}),
110482
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
110483
+ transactFamily: string().min(1).optional(),
110484
+ entry: EntryDescriptorSchema.optional()
110485
+ }).strict();
110486
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
110487
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
110488
+ /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
110489
+ function assertValidDeclaration(name, decl) {
110490
+ const refuse = (why) => {
110491
+ throw new DeclarationRefusedError(`kind "${name}": ${why}`);
110492
+ };
110493
+ if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
110494
+ const seen = /* @__PURE__ */ new Set();
110495
+ for (const index of decl.indexes) {
110496
+ if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
110497
+ seen.add(index.name);
110498
+ }
110499
+ const { retention } = decl;
110500
+ const hasSecrets = decl.secretPaths.length > 0;
110501
+ if ("ttlMs" in retention) {
110502
+ if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
110503
+ if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
110504
+ }
110505
+ if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
110506
+ if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
110507
+ if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
110508
+ if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
110509
+ const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
110510
+ 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)`);
110511
+ }
110512
+ if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
110513
+ 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`);
110514
+ }
110515
+ function bodyFieldsOf(schema) {
110516
+ return { ...toJSONSchema(schema, {
110517
+ unrepresentable: "any",
110518
+ io: "input"
110519
+ }) };
110520
+ }
110521
+ function isRecordLike(value) {
110522
+ return typeof value === "object" && value !== null && !Array.isArray(value);
110523
+ }
110524
+ /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
110525
+ function hasNameField(json, field) {
110526
+ const branches = json["oneOf"] ?? json["anyOf"];
110527
+ if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
110528
+ const properties = json["properties"];
110529
+ return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
110530
+ }
110531
+ /**
110532
+ * Declare the kinds of a package. The keys are the kind names. The result is
110533
+ * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
110534
+ * types its handle from.
110535
+ */
110536
+ function defineRecordKinds(specs) {
110537
+ const out = {};
110538
+ for (const [name, spec] of Object.entries(specs)) {
110539
+ const secretPaths = collectZodSecretPaths(spec.schema);
110540
+ const nameField = spec.entry?.nameField ?? "name";
110541
+ const fields = bodyFieldsOf(spec.schema);
110542
+ if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
110543
+ const parsed = RecordKindDeclarationSchema.parse({
110544
+ database: spec.database,
110545
+ class: spec.class,
110546
+ writeTrigger: spec.writeTrigger,
110547
+ device: spec.device,
110548
+ at: spec.at,
110549
+ indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
110550
+ retention: spec.retention,
110551
+ deviceRemoval: spec.deviceRemoval,
110552
+ maxDataBytes: spec.maxDataBytes,
110553
+ secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
110554
+ secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
110555
+ transactFamily: spec.transactFamily,
110556
+ entry: spec.entry === void 0 ? void 0 : {
110557
+ title: spec.entry.title,
110558
+ nameField,
110559
+ fields
110560
+ }
110561
+ });
110562
+ assertValidDeclaration(name, parsed);
110563
+ out[name] = {
110564
+ name,
110565
+ schema: spec.schema,
110566
+ declaration: parsed
110567
+ };
110568
+ }
110569
+ return out;
110570
+ }
110571
+ /**
110572
+ * Entry kinds (D881): every list of user-created entries (notification
110573
+ * targets, brokers, LLM profiles) is ONE record kind with an id, a name and a
110574
+ * kind-specific body, and the admin UI lists/adds/edits/deletes all of them
110575
+ * through the `record-entries` capability with password fields derived from
110576
+ * the schema (`.meta({ secret: true })`).
110577
+ */
110578
+ /** The body of a plain entry: a name and the fields the kind adds. */
110579
+ function entryBody(shape) {
110580
+ return object({
110581
+ name: string().min(1),
110582
+ enabled: boolean().optional(),
110583
+ ...shape
110584
+ });
110585
+ }
110586
+ /**
110587
+ * Declare one entry kind. An entry is configuration: never trimmed by the
110588
+ * engine, never aged, belonging to no device.
110589
+ */
110590
+ function defineEntryKind(name, spec) {
110591
+ const defined = defineRecordKinds({ [name]: {
110592
+ schema: spec.schema,
110593
+ class: "config",
110594
+ writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
110595
+ retention: { none: "an entry goes only when the operator deletes it" },
110596
+ ...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
110597
+ ...spec.database === void 0 ? {} : { database: spec.database },
110598
+ ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
110599
+ ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
110600
+ ...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
110601
+ entry: {
110602
+ title: spec.title,
110603
+ ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
110604
+ }
110605
+ } })[name];
110606
+ if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
110607
+ return defined;
110608
+ }
110609
+ /**
110610
+ * The share-view scope kinds a share-link token can carry. The hub mints
110611
+ * and validates them (`ShareViewGrantSchema` builds its
110612
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
110613
+ */
110614
+ var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
110615
+ /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
110616
+ var PeerBytesTicketSchema = object({
110617
+ /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
110618
+ url: string().min(1),
110619
+ /**
110620
+ * The HOST node this URL means something on — the hub or a named agent,
110621
+ * never a runner. {@link AddonPeerBytes.open} compares it to its own and
110622
+ * refuses `cross-node` by name when they differ, without dialling.
110623
+ */
110624
+ hostNodeId: string().min(1),
110625
+ expiresAtMs: number().int().nonnegative(),
110626
+ /**
110627
+ * What the producer DECLARED the body to be, when it knows — `null` when it
110628
+ * does not. Never `0` for unknown (D393): a consumer sizing a bound off this
110629
+ * must be able to tell "the producer did not say" from "the body is empty".
110630
+ */
110631
+ declaredBytes: number().int().nonnegative().nullable()
110632
+ });
110606
110633
  var READING_QUANTITIES = [
110607
110634
  "temperature",
110608
110635
  "pressure",
@@ -111290,7 +111317,6 @@ var CAP_NAMES = Object.freeze([
111290
111317
  "climate-control",
111291
111318
  "color",
111292
111319
  "composer",
111293
- "connection-test",
111294
111320
  "connectivity",
111295
111321
  "consumables",
111296
111322
  "contact",
@@ -113310,8 +113336,7 @@ Object.freeze({
113310
113336
  "offerArtifact": 3e5,
113311
113337
  "readResult": 3e5,
113312
113338
  "submitJob": 18e5,
113313
- "uploadDataset": 72e5,
113314
- "validateCredentials": 3e4
113339
+ "uploadDataset": 72e5
113315
113340
  }
113316
113341
  });
113317
113342
  object({
@@ -114725,6 +114750,432 @@ var IntegrationInstanceRefSchema = object({
114725
114750
  ]),
114726
114751
  candidateStableId: string().optional()
114727
114752
  });
114753
+ /**
114754
+ * notification-output — canonical, capability-gated notification delivery.
114755
+ *
114756
+ * Apprise-derived model (see
114757
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
114758
+ * callers emit ONE canonical `Notification`; each provider declares a
114759
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
114760
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
114761
+ * message to what the kind supports — callers never special-case a service.
114762
+ *
114763
+ * DESIGN DECISIONS (locked):
114764
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
114765
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
114766
+ * cap. Rationale: the admin UI needs one uniform surface across the
114767
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
114768
+ * alternative would fork the UI per addon and cannot host the
114769
+ * discovery→adopt flow.
114770
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
114771
+ * the generated cap-mount auto-`concatCollection`-fans them across every
114772
+ * registered provider (notifiers addon + HA addon) so one catalog is
114773
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
114774
+ * `addonId` the generated collection router extracts from the call input.
114775
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
114776
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
114777
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
114778
+ * base64 fallback needed.
114779
+ *
114780
+ * TODO (deferred, closed-set change — separate decision): add
114781
+ * `providerKind: 'notify'` so notification providers surface on the unified
114782
+ * admin "Integrations" page.
114783
+ */
114784
+ /**
114785
+ * Zentik-derived typed-media enum — the superset across every kind. Each
114786
+ * adapter picks what it supports and the degrade engine filters the rest.
114787
+ */
114788
+ var AttachmentMediaTypeSchema = _enum([
114789
+ "image",
114790
+ "video",
114791
+ "gif",
114792
+ "audio",
114793
+ "icon"
114794
+ ]);
114795
+ /**
114796
+ * A single attachment. Exactly one of `url` (remote source, most adapters
114797
+ * prefer this) or `bytes` (inline source; required for Pushover-style
114798
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
114799
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
114800
+ */
114801
+ var AttachmentSchema = object({
114802
+ mediaType: AttachmentMediaTypeSchema,
114803
+ url: string().optional(),
114804
+ bytes: _instanceof(Uint8Array).optional(),
114805
+ mime: string().optional(),
114806
+ name: string().optional()
114807
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
114808
+ var NotificationFormatSchema = _enum([
114809
+ "text",
114810
+ "markdown",
114811
+ "html"
114812
+ ]);
114813
+ /**
114814
+ * The CLOSED icon vocabulary an action button may use.
114815
+ *
114816
+ * A closed set, not a free string, and that is the whole point: an arbitrary
114817
+ * icon name is one that ntfy renders, zentik silently drops, and nobody
114818
+ * notices — the same class of gap as a zone vocabulary nothing produced
114819
+ * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
114820
+ * declares `actionIcons: false` and the degrade engine strips the field.
114821
+ *
114822
+ * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
114823
+ * renderer's icon set; "acknowledge" survives an adapter that draws it
114824
+ * differently.
114825
+ *
114826
+ * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
114827
+ *
114828
+ * These names are for US. **No adapter may forward one verbatim.** Each maps
114829
+ * the whole set onto its own renderer's vocabulary through a
114830
+ * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
114831
+ * fallback, so adding a member here fails every adapter's build until someone
114832
+ * decides its glyph, which is the only place that decision can be made
114833
+ * honestly.
114834
+ *
114835
+ * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
114836
+ * `disarm` straight through; iOS feeds that string to
114837
+ * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
114838
+ * and every snooze and alarm button arrived BLANK. A pass-through is not a
114839
+ * mapping, and "the field is documented" is not "the value renders".
114840
+ *
114841
+ * Adding a member is TRAIN-BOUND. The enum lives in the published
114842
+ * `@camstack/server` closure and the cap seam validates against the HUB's copy,
114843
+ * so an addon that emits a token the running hub does not know does not lose an
114844
+ * icon — its whole `send` fails Zod validation and the notification never
114845
+ * arrives. Never emit a new token from an addon before the train carrying it.
114846
+ */
114847
+ var NotificationActionIconSchema = _enum([
114848
+ "acknowledge",
114849
+ "dismiss",
114850
+ "silence",
114851
+ "snooze",
114852
+ "view",
114853
+ "play",
114854
+ "open",
114855
+ "close",
114856
+ "lock",
114857
+ "unlock",
114858
+ "arm",
114859
+ "arm-home",
114860
+ "arm-away",
114861
+ "arm-night",
114862
+ "disarm",
114863
+ "light",
114864
+ "alert",
114865
+ "camera"
114866
+ ]);
114867
+ /** A single tap-through action button. */
114868
+ var NotificationActionSchema = object({
114869
+ id: string(),
114870
+ label: string(),
114871
+ url: string().optional(),
114872
+ /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
114873
+ icon: NotificationActionIconSchema.optional(),
114874
+ /**
114875
+ * Renders in a warning style where the notifier supports it.
114876
+ *
114877
+ * A HINT, never a gate. The callback's authority is its token and nothing
114878
+ * else — see `notification-center/action-token.ts` for what that does and
114879
+ * does not buy.
114880
+ */
114881
+ destructive: boolean().optional(),
114882
+ /**
114883
+ * How the tap should REACH the url.
114884
+ *
114885
+ * `navigate` (absent, and every button authored before this field) opens it:
114886
+ * the phone leaves the notification and shows whatever the callback returns.
114887
+ * That is right for a button whose answer the operator wants to read.
114888
+ *
114889
+ * `background` fires it as a POST and stays put. It exists for the buttons
114890
+ * whose whole point is not to interrupt — "silence this for 30 minutes" is
114891
+ * an answer to the notification, and being thrown into a browser tab to
114892
+ * confirm it costs more attention than the notification did. A backend that
114893
+ * cannot do a background call renders it as an ordinary link (the adapters
114894
+ * fall back rather than dropping the button), so this is a preference, never
114895
+ * a requirement.
114896
+ */
114897
+ mode: _enum(["navigate", "background"]).optional()
114898
+ });
114899
+ /** A delivery parameter value: what a notifier declared it takes. */
114900
+ var DeliveryParamValueSchema = union([
114901
+ string(),
114902
+ number(),
114903
+ boolean()
114904
+ ]);
114905
+ /**
114906
+ * One extra delivery parameter a notifier KIND declares (D938). A rule that
114907
+ * addresses a target of that kind may set it; a kind that declares nothing is
114908
+ * never handed one. The admin UI derives its control from this descriptor —
114909
+ * no editor knows a service by name.
114910
+ *
114911
+ * Optional fields are `.optional()`, never `.default()` (a Zod default does not
114912
+ * run on the addon cap path).
114913
+ */
114914
+ var DeliveryParamSchema = object({
114915
+ key: string().min(1),
114916
+ label: string(),
114917
+ /** i18n key of the label, resolved by the declaring addon's namespace. */
114918
+ labelKey: string().optional(),
114919
+ type: _enum([
114920
+ "enum",
114921
+ "number",
114922
+ "boolean",
114923
+ "string"
114924
+ ]),
114925
+ /** `enum` only: the closed set of accepted values. */
114926
+ options: array(object({
114927
+ value: string(),
114928
+ label: string()
114929
+ })).optional(),
114930
+ /** `number` only. */
114931
+ min: number().optional(),
114932
+ max: number().optional(),
114933
+ /** What the notifier does when the rule sets nothing; shown as the placeholder. */
114934
+ default: DeliveryParamValueSchema.optional()
114935
+ });
114936
+ /**
114937
+ * The canonical notification. `body` is the only hard field (Apprise model).
114938
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
114939
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
114940
+ * the adapter maps this ordinal onto its native level. `level?` is an
114941
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
114942
+ * `priority` for that one target.
114943
+ */
114944
+ var NotificationSchema = object({
114945
+ body: string(),
114946
+ title: string().optional(),
114947
+ format: NotificationFormatSchema.default("text"),
114948
+ priority: number().int().min(1).max(5).default(3),
114949
+ level: string().optional(),
114950
+ attachments: array(AttachmentSchema).optional(),
114951
+ clickUrl: string().optional(),
114952
+ actions: array(NotificationActionSchema).optional(),
114953
+ sound: string().optional(),
114954
+ ttl: number().optional(),
114955
+ tag: string().optional(),
114956
+ deviceId: number().optional(),
114957
+ eventId: string().optional(),
114958
+ metadata: record(string(), unknown()).optional(),
114959
+ /**
114960
+ * Values for the parameters the target's kind DECLARES in
114961
+ * {@link TargetKindSchema} `deliveryParams`. Already validated against the
114962
+ * declaration by the sender; a notifier reads only the keys it declared.
114963
+ */
114964
+ delivery: record(string(), DeliveryParamValueSchema).optional()
114965
+ });
114966
+ /** One declared native severity/priority level for a kind. */
114967
+ var TargetKindLevelSchema = object({
114968
+ id: string(),
114969
+ label: string(),
114970
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
114971
+ ordinal: number().int().min(1).max(5).nullable(),
114972
+ flags: object({
114973
+ critical: boolean().optional(),
114974
+ silent: boolean().optional(),
114975
+ noPush: boolean().optional()
114976
+ }).optional(),
114977
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
114978
+ requires: array(string()).optional(),
114979
+ description: string().optional()
114980
+ });
114981
+ /** The full capability block consulted before dispatch. */
114982
+ var TargetKindCapsSchema = object({
114983
+ attachments: object({
114984
+ mediaTypes: array(AttachmentMediaTypeSchema),
114985
+ mode: _enum([
114986
+ "url",
114987
+ "bytes",
114988
+ "both"
114989
+ ]),
114990
+ max: number().int().nonnegative(),
114991
+ maxBytes: number().int().positive().optional()
114992
+ }),
114993
+ /** Max action buttons (0 = none). */
114994
+ actions: number().int().nonnegative(),
114995
+ /**
114996
+ * Whether this kind renders a per-action ICON.
114997
+ *
114998
+ * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
114999
+ * run on the addon cap path — three production failures in one day taught
115000
+ * this repo that once. Absent is read as false by the degrade engine, which
115001
+ * is the safe direction: an icon that is not rendered costs nothing, an icon
115002
+ * assumed and dropped costs the operator's trust in the field.
115003
+ */
115004
+ actionIcons: boolean().optional(),
115005
+ levels: array(TargetKindLevelSchema),
115006
+ format: array(NotificationFormatSchema),
115007
+ clickUrl: boolean(),
115008
+ sound: boolean(),
115009
+ ttl: boolean(),
115010
+ bodyMaxLen: number().int().positive()
115011
+ });
115012
+ /**
115013
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
115014
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
115015
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
115016
+ * the union is large and not meant for runtime validation here; the exported
115017
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
115018
+ */
115019
+ var ConfigSchemaPassthrough$4 = unknown();
115020
+ var TargetKindSchema = object({
115021
+ kind: string(),
115022
+ label: string(),
115023
+ icon: string(),
115024
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
115025
+ addonId: string(),
115026
+ /**
115027
+ * URL of the kind's bundled BRAND icon, served by the providing addon over
115028
+ * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
115029
+ * when the addon bundles no icon for that kind — the client then falls back
115030
+ * to a neutral glyph rather than rendering the raw `icon` NAME as text.
115031
+ *
115032
+ * Root-relative on purpose: it resolves against whatever origin serves a web
115033
+ * client, and a native client joins it onto its own hub base.
115034
+ *
115035
+ * DECLARED here deliberately. It used to travel as an undeclared passthrough
115036
+ * field that survived only because the runtime cap-router forwards provider
115037
+ * output verbatim — so every consumer had to re-declare it by hand to stop
115038
+ * its own Zod parse from stripping it, and the whole arrangement would have
115039
+ * broken silently the moment output validation was tightened anywhere.
115040
+ */
115041
+ iconUrl: string().optional(),
115042
+ /**
115043
+ * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
115044
+ *
115045
+ * The server knows this and therefore says it, because the client cannot
115046
+ * safely guess: a React-Native client renders SVG and raster through two
115047
+ * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
115048
+ * not decode SVG on iOS/Android), so without this it silently fell back to a
115049
+ * placeholder glyph for every vector icon while the web build looked fine.
115050
+ *
115051
+ * Absent when {@link iconUrl} is absent, or for a legacy provider that has
115052
+ * not been updated — a client that cannot determine the type should prefer
115053
+ * its raster path, which is the safe default for an unknown image.
115054
+ */
115055
+ iconMediaType: string().optional(),
115056
+ configSchema: ConfigSchemaPassthrough$4,
115057
+ /**
115058
+ * The config keys that decide WHERE this kind's secrets are sent (server,
115059
+ * base URL, instance, chat, recipient). A save that changes any of them
115060
+ * while leaving a secret redacted is refused by the provider (D634), so an
115061
+ * editor uses this to ask for the secret on exactly those edits instead of
115062
+ * on every edit.
115063
+ *
115064
+ * Optional: absent from a provider that holds no secret (the Home Assistant
115065
+ * kinds) and from a provider older than this field — an editor that finds
115066
+ * it absent must assume ANY edit may need the secret.
115067
+ */
115068
+ destinationKeys: array(string()).optional(),
115069
+ supportsDiscovery: boolean(),
115070
+ /**
115071
+ * Extra delivery parameters a rule may set for a target of this kind (D938).
115072
+ * Absent = none; the rule editor then offers nothing.
115073
+ */
115074
+ deliveryParams: array(DeliveryParamSchema).optional(),
115075
+ caps: TargetKindCapsSchema
115076
+ });
115077
+ /**
115078
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
115079
+ * (return a presence marker only) when serving `listTargets` — never
115080
+ * round-trip a stored secret to the UI.
115081
+ */
115082
+ var TargetSchema = object({
115083
+ id: string(),
115084
+ name: string(),
115085
+ kind: string(),
115086
+ addonId: string(),
115087
+ enabled: boolean(),
115088
+ config: record(string(), unknown())
115089
+ });
115090
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
115091
+ var DiscoveredTargetSchema = object({
115092
+ kind: string(),
115093
+ suggestedName: string(),
115094
+ config: record(string(), unknown())
115095
+ });
115096
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
115097
+ var RenderedAsSchema = object({
115098
+ level: string(),
115099
+ format: NotificationFormatSchema,
115100
+ attachmentsSent: number().int().nonnegative(),
115101
+ actionsSent: number().int().nonnegative(),
115102
+ truncated: boolean(),
115103
+ dropped: array(string())
115104
+ });
115105
+ var SendResultSchema = object({
115106
+ success: boolean(),
115107
+ error: string().optional(),
115108
+ renderedAs: RenderedAsSchema.optional()
115109
+ });
115110
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
115111
+ var TestResultSchema = SendResultSchema;
115112
+ /**
115113
+ * Pre-save credential probe against a partial (unsaved) target config.
115114
+ * `resolvedUrl` never includes secrets (token stripped from path).
115115
+ */
115116
+ var ProbeTargetConfigResultSchema = object({
115117
+ ok: boolean(),
115118
+ resolvedUrl: string(),
115119
+ httpStatus: number().int().optional(),
115120
+ stateInstance: string().optional(),
115121
+ error: string().optional()
115122
+ });
115123
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
115124
+ kind: string(),
115125
+ config: record(string(), unknown()).optional(),
115126
+ /**
115127
+ * When editing / duplicating, the blank password field never round-trips
115128
+ * the stored token. Pass the source target id so the provider can restore
115129
+ * secrets server-side before dialling (same merge as upsert).
115130
+ */
115131
+ targetId: string().optional()
115132
+ }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
115133
+ kind: string(),
115134
+ config: record(string(), unknown()),
115135
+ /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
115136
+ targetId: string().optional()
115137
+ }), ProbeTargetConfigResultSchema, {
115138
+ kind: "mutation",
115139
+ auth: "admin"
115140
+ }), method(object({
115141
+ targetId: string(),
115142
+ notification: NotificationSchema
115143
+ }), SendResultSchema, {
115144
+ kind: "mutation",
115145
+ auth: "admin"
115146
+ }), method(object({
115147
+ targetId: string(),
115148
+ sample: NotificationSchema.optional()
115149
+ }), TestResultSchema, {
115150
+ kind: "mutation",
115151
+ auth: "admin"
115152
+ }), method(object({
115153
+ target: TargetSchema,
115154
+ /**
115155
+ * Duplicate flow: create a NEW target id while copying secrets from an
115156
+ * existing row. The UI never holds the stored token; blank / redacted
115157
+ * password fields are restored from this source (D634 still applies if
115158
+ * destinations diverge without a re-typed secret).
115159
+ */
115160
+ cloneSecretsFrom: string().optional()
115161
+ }), TargetSchema, {
115162
+ kind: "mutation",
115163
+ auth: "admin"
115164
+ }), method(object({ targetId: string() }), _void(), {
115165
+ kind: "mutation",
115166
+ auth: "admin"
115167
+ }), method(object({
115168
+ targetId: string(),
115169
+ enabled: boolean()
115170
+ }), _void(), {
115171
+ kind: "mutation",
115172
+ auth: "admin"
115173
+ });
115174
+ looseObject({
115175
+ name: string().min(1),
115176
+ enabled: boolean().optional()
115177
+ });
115178
+ TargetSchema.omit({ id: true });
114728
115179
  var EncodeProfileSchema = object({
114729
115180
  video: object({
114730
115181
  codec: _enum([
@@ -123822,7 +124273,6 @@ var SYSTEM_CAP_VOCABULARY = {
123822
124273
  "calendar-source": system(INTERNAL),
123823
124274
  calendars: system("calendars feed schedules and conditions, not device actions"),
123824
124275
  composer: system("device composition — an authoring tool, not an action"),
123825
- "connection-test": system(INTERNAL),
123826
124276
  "core-blocks": system(INTERNAL),
123827
124277
  "custom-model-registry": system(ML),
123828
124278
  "data-store-provider": system(INTERNAL),
@@ -145799,427 +146249,6 @@ var UnitWarningSchema = object({
145799
146249
  assumedUnit: string(),
145800
146250
  message: string()
145801
146251
  });
145802
- /**
145803
- * notification-output — canonical, capability-gated notification delivery.
145804
- *
145805
- * Apprise-derived model (see
145806
- * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
145807
- * callers emit ONE canonical `Notification`; each provider declares a
145808
- * per-kind capability descriptor (`TargetKind`), and the pure degrade
145809
- * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
145810
- * message to what the kind supports — callers never special-case a service.
145811
- *
145812
- * DESIGN DECISIONS (locked):
145813
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
145814
- * `setTargetEnabled`), each provider persisting via the `settings-store`
145815
- * cap. Rationale: the admin UI needs one uniform surface across the
145816
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
145817
- * alternative would fork the UI per addon and cannot host the
145818
- * discovery→adopt flow.
145819
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
145820
- * the generated cap-mount auto-`concatCollection`-fans them across every
145821
- * registered provider (notifiers addon + HA addon) so one catalog is
145822
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
145823
- * `addonId` the generated collection router extracts from the call input.
145824
- * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
145825
- * transformer) + UDS MsgPack both round-trip typed arrays — already used by
145826
- * `storage` / `storage-provider` / `recording` caps over the same path. No
145827
- * base64 fallback needed.
145828
- *
145829
- * TODO (deferred, closed-set change — separate decision): add
145830
- * `providerKind: 'notify'` so notification providers surface on the unified
145831
- * admin "Integrations" page.
145832
- */
145833
- /**
145834
- * Zentik-derived typed-media enum — the superset across every kind. Each
145835
- * adapter picks what it supports and the degrade engine filters the rest.
145836
- */
145837
- var AttachmentMediaTypeSchema = _enum([
145838
- "image",
145839
- "video",
145840
- "gif",
145841
- "audio",
145842
- "icon"
145843
- ]);
145844
- /**
145845
- * A single attachment. Exactly one of `url` (remote source, most adapters
145846
- * prefer this) or `bytes` (inline source; required for Pushover-style
145847
- * bytes-only kinds) MUST be present — the degrade engine expresses a
145848
- * url→bytes fetch as a `needsFetch` directive the adapter executes.
145849
- */
145850
- var AttachmentSchema = object({
145851
- mediaType: AttachmentMediaTypeSchema,
145852
- url: string().optional(),
145853
- bytes: _instanceof(Uint8Array).optional(),
145854
- mime: string().optional(),
145855
- name: string().optional()
145856
- }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
145857
- var NotificationFormatSchema = _enum([
145858
- "text",
145859
- "markdown",
145860
- "html"
145861
- ]);
145862
- /**
145863
- * The CLOSED icon vocabulary an action button may use.
145864
- *
145865
- * A closed set, not a free string, and that is the whole point: an arbitrary
145866
- * icon name is one that ntfy renders, zentik silently drops, and nobody
145867
- * notices — the same class of gap as a zone vocabulary nothing produced
145868
- * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
145869
- * declares `actionIcons: false` and the degrade engine strips the field.
145870
- *
145871
- * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
145872
- * renderer's icon set; "acknowledge" survives an adapter that draws it
145873
- * differently.
145874
- *
145875
- * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
145876
- *
145877
- * These names are for US. **No adapter may forward one verbatim.** Each maps
145878
- * the whole set onto its own renderer's vocabulary through a
145879
- * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
145880
- * fallback, so adding a member here fails every adapter's build until someone
145881
- * decides its glyph, which is the only place that decision can be made
145882
- * honestly.
145883
- *
145884
- * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
145885
- * `disarm` straight through; iOS feeds that string to
145886
- * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
145887
- * and every snooze and alarm button arrived BLANK. A pass-through is not a
145888
- * mapping, and "the field is documented" is not "the value renders".
145889
- *
145890
- * Adding a member is TRAIN-BOUND. The enum lives in the published
145891
- * `@camstack/server` closure and the cap seam validates against the HUB's copy,
145892
- * so an addon that emits a token the running hub does not know does not lose an
145893
- * icon — its whole `send` fails Zod validation and the notification never
145894
- * arrives. Never emit a new token from an addon before the train carrying it.
145895
- */
145896
- var NotificationActionIconSchema = _enum([
145897
- "acknowledge",
145898
- "dismiss",
145899
- "silence",
145900
- "snooze",
145901
- "view",
145902
- "play",
145903
- "open",
145904
- "close",
145905
- "lock",
145906
- "unlock",
145907
- "arm",
145908
- "arm-home",
145909
- "arm-away",
145910
- "arm-night",
145911
- "disarm",
145912
- "light",
145913
- "alert",
145914
- "camera"
145915
- ]);
145916
- /** A single tap-through action button. */
145917
- var NotificationActionSchema = object({
145918
- id: string(),
145919
- label: string(),
145920
- url: string().optional(),
145921
- /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
145922
- icon: NotificationActionIconSchema.optional(),
145923
- /**
145924
- * Renders in a warning style where the notifier supports it.
145925
- *
145926
- * A HINT, never a gate. The callback's authority is its token and nothing
145927
- * else — see `notification-center/action-token.ts` for what that does and
145928
- * does not buy.
145929
- */
145930
- destructive: boolean().optional(),
145931
- /**
145932
- * How the tap should REACH the url.
145933
- *
145934
- * `navigate` (absent, and every button authored before this field) opens it:
145935
- * the phone leaves the notification and shows whatever the callback returns.
145936
- * That is right for a button whose answer the operator wants to read.
145937
- *
145938
- * `background` fires it as a POST and stays put. It exists for the buttons
145939
- * whose whole point is not to interrupt — "silence this for 30 minutes" is
145940
- * an answer to the notification, and being thrown into a browser tab to
145941
- * confirm it costs more attention than the notification did. A backend that
145942
- * cannot do a background call renders it as an ordinary link (the adapters
145943
- * fall back rather than dropping the button), so this is a preference, never
145944
- * a requirement.
145945
- */
145946
- mode: _enum(["navigate", "background"]).optional()
145947
- });
145948
- /** A delivery parameter value: what a notifier declared it takes. */
145949
- var DeliveryParamValueSchema = union([
145950
- string(),
145951
- number(),
145952
- boolean()
145953
- ]);
145954
- /**
145955
- * One extra delivery parameter a notifier KIND declares (D938). A rule that
145956
- * addresses a target of that kind may set it; a kind that declares nothing is
145957
- * never handed one. The admin UI derives its control from this descriptor —
145958
- * no editor knows a service by name.
145959
- *
145960
- * Optional fields are `.optional()`, never `.default()` (a Zod default does not
145961
- * run on the addon cap path).
145962
- */
145963
- var DeliveryParamSchema = object({
145964
- key: string().min(1),
145965
- label: string(),
145966
- /** i18n key of the label, resolved by the declaring addon's namespace. */
145967
- labelKey: string().optional(),
145968
- type: _enum([
145969
- "enum",
145970
- "number",
145971
- "boolean",
145972
- "string"
145973
- ]),
145974
- /** `enum` only: the closed set of accepted values. */
145975
- options: array(object({
145976
- value: string(),
145977
- label: string()
145978
- })).optional(),
145979
- /** `number` only. */
145980
- min: number().optional(),
145981
- max: number().optional(),
145982
- /** What the notifier does when the rule sets nothing; shown as the placeholder. */
145983
- default: DeliveryParamValueSchema.optional()
145984
- });
145985
- /**
145986
- * The canonical notification. `body` is the only hard field (Apprise model).
145987
- * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
145988
- * NOT a fixed severity enum — each kind declares its own `caps.levels` and
145989
- * the adapter maps this ordinal onto its native level. `level?` is an
145990
- * optional kind-native level id (`emergency`, `silent`, …) that overrides
145991
- * `priority` for that one target.
145992
- */
145993
- var NotificationSchema = object({
145994
- body: string(),
145995
- title: string().optional(),
145996
- format: NotificationFormatSchema.default("text"),
145997
- priority: number().int().min(1).max(5).default(3),
145998
- level: string().optional(),
145999
- attachments: array(AttachmentSchema).optional(),
146000
- clickUrl: string().optional(),
146001
- actions: array(NotificationActionSchema).optional(),
146002
- sound: string().optional(),
146003
- ttl: number().optional(),
146004
- tag: string().optional(),
146005
- deviceId: number().optional(),
146006
- eventId: string().optional(),
146007
- metadata: record(string(), unknown()).optional(),
146008
- /**
146009
- * Values for the parameters the target's kind DECLARES in
146010
- * {@link TargetKindSchema} `deliveryParams`. Already validated against the
146011
- * declaration by the sender; a notifier reads only the keys it declared.
146012
- */
146013
- delivery: record(string(), DeliveryParamValueSchema).optional()
146014
- });
146015
- /** One declared native severity/priority level for a kind. */
146016
- var TargetKindLevelSchema = object({
146017
- id: string(),
146018
- label: string(),
146019
- /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
146020
- ordinal: number().int().min(1).max(5).nullable(),
146021
- flags: object({
146022
- critical: boolean().optional(),
146023
- silent: boolean().optional(),
146024
- noPush: boolean().optional()
146025
- }).optional(),
146026
- /** e.g. Pushover `emergency` requires `retry` / `expire`. */
146027
- requires: array(string()).optional(),
146028
- description: string().optional()
146029
- });
146030
- /** The full capability block consulted before dispatch. */
146031
- var TargetKindCapsSchema = object({
146032
- attachments: object({
146033
- mediaTypes: array(AttachmentMediaTypeSchema),
146034
- mode: _enum([
146035
- "url",
146036
- "bytes",
146037
- "both"
146038
- ]),
146039
- max: number().int().nonnegative(),
146040
- maxBytes: number().int().positive().optional()
146041
- }),
146042
- /** Max action buttons (0 = none). */
146043
- actions: number().int().nonnegative(),
146044
- /**
146045
- * Whether this kind renders a per-action ICON.
146046
- *
146047
- * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
146048
- * run on the addon cap path — three production failures in one day taught
146049
- * this repo that once. Absent is read as false by the degrade engine, which
146050
- * is the safe direction: an icon that is not rendered costs nothing, an icon
146051
- * assumed and dropped costs the operator's trust in the field.
146052
- */
146053
- actionIcons: boolean().optional(),
146054
- levels: array(TargetKindLevelSchema),
146055
- format: array(NotificationFormatSchema),
146056
- clickUrl: boolean(),
146057
- sound: boolean(),
146058
- ttl: boolean(),
146059
- bodyMaxLen: number().int().positive()
146060
- });
146061
- /**
146062
- * `configSchema` is a `ConfigUISchema` tree passed through to the admin
146063
- * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
146064
- * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
146065
- * the union is large and not meant for runtime validation here; the exported
146066
- * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
146067
- */
146068
- var ConfigSchemaPassthrough$4 = unknown();
146069
- var TargetKindSchema = object({
146070
- kind: string(),
146071
- label: string(),
146072
- icon: string(),
146073
- /** Stamped by each provider so the concat-fanned catalog stays routable. */
146074
- addonId: string(),
146075
- /**
146076
- * URL of the kind's bundled BRAND icon, served by the providing addon over
146077
- * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
146078
- * when the addon bundles no icon for that kind — the client then falls back
146079
- * to a neutral glyph rather than rendering the raw `icon` NAME as text.
146080
- *
146081
- * Root-relative on purpose: it resolves against whatever origin serves a web
146082
- * client, and a native client joins it onto its own hub base.
146083
- *
146084
- * DECLARED here deliberately. It used to travel as an undeclared passthrough
146085
- * field that survived only because the runtime cap-router forwards provider
146086
- * output verbatim — so every consumer had to re-declare it by hand to stop
146087
- * its own Zod parse from stripping it, and the whole arrangement would have
146088
- * broken silently the moment output validation was tightened anywhere.
146089
- */
146090
- iconUrl: string().optional(),
146091
- /**
146092
- * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
146093
- *
146094
- * The server knows this and therefore says it, because the client cannot
146095
- * safely guess: a React-Native client renders SVG and raster through two
146096
- * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
146097
- * not decode SVG on iOS/Android), so without this it silently fell back to a
146098
- * placeholder glyph for every vector icon while the web build looked fine.
146099
- *
146100
- * Absent when {@link iconUrl} is absent, or for a legacy provider that has
146101
- * not been updated — a client that cannot determine the type should prefer
146102
- * its raster path, which is the safe default for an unknown image.
146103
- */
146104
- iconMediaType: string().optional(),
146105
- configSchema: ConfigSchemaPassthrough$4,
146106
- /**
146107
- * The config keys that decide WHERE this kind's secrets are sent (server,
146108
- * base URL, instance, chat, recipient). A save that changes any of them
146109
- * while leaving a secret redacted is refused by the provider (D634), so an
146110
- * editor uses this to ask for the secret on exactly those edits instead of
146111
- * on every edit.
146112
- *
146113
- * Optional: absent from a provider that holds no secret (the Home Assistant
146114
- * kinds) and from a provider older than this field — an editor that finds
146115
- * it absent must assume ANY edit may need the secret.
146116
- */
146117
- destinationKeys: array(string()).optional(),
146118
- supportsDiscovery: boolean(),
146119
- /**
146120
- * Extra delivery parameters a rule may set for a target of this kind (D938).
146121
- * Absent = none; the rule editor then offers nothing.
146122
- */
146123
- deliveryParams: array(DeliveryParamSchema).optional(),
146124
- caps: TargetKindCapsSchema
146125
- });
146126
- /**
146127
- * A persisted target. `config` holds secrets; providers REDACT secret fields
146128
- * (return a presence marker only) when serving `listTargets` — never
146129
- * round-trip a stored secret to the UI.
146130
- */
146131
- var TargetSchema = object({
146132
- id: string(),
146133
- name: string(),
146134
- kind: string(),
146135
- addonId: string(),
146136
- enabled: boolean(),
146137
- config: record(string(), unknown())
146138
- });
146139
- /** A discovery-surfaced candidate (config is partial + non-secret). */
146140
- var DiscoveredTargetSchema = object({
146141
- kind: string(),
146142
- suggestedName: string(),
146143
- config: record(string(), unknown())
146144
- });
146145
- /** The degrade engine's report — what was resolved / dropped / degraded. */
146146
- var RenderedAsSchema = object({
146147
- level: string(),
146148
- format: NotificationFormatSchema,
146149
- attachmentsSent: number().int().nonnegative(),
146150
- actionsSent: number().int().nonnegative(),
146151
- truncated: boolean(),
146152
- dropped: array(string())
146153
- });
146154
- var SendResultSchema = object({
146155
- success: boolean(),
146156
- error: string().optional(),
146157
- renderedAs: RenderedAsSchema.optional()
146158
- });
146159
- /** Same shape as SendResult — kept as a distinct name for the test panel. */
146160
- var TestResultSchema = SendResultSchema;
146161
- /**
146162
- * Pre-save credential probe against a partial (unsaved) target config.
146163
- * `resolvedUrl` never includes secrets (token stripped from path).
146164
- */
146165
- var ProbeTargetConfigResultSchema = object({
146166
- ok: boolean(),
146167
- resolvedUrl: string(),
146168
- httpStatus: number().int().optional(),
146169
- stateInstance: string().optional(),
146170
- error: string().optional()
146171
- });
146172
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
146173
- kind: string(),
146174
- config: record(string(), unknown()).optional(),
146175
- /**
146176
- * When editing / duplicating, the blank password field never round-trips
146177
- * the stored token. Pass the source target id so the provider can restore
146178
- * secrets server-side before dialling (same merge as upsert).
146179
- */
146180
- targetId: string().optional()
146181
- }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
146182
- kind: string(),
146183
- config: record(string(), unknown()),
146184
- /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
146185
- targetId: string().optional()
146186
- }), ProbeTargetConfigResultSchema, {
146187
- kind: "mutation",
146188
- auth: "admin"
146189
- }), method(object({
146190
- targetId: string(),
146191
- notification: NotificationSchema
146192
- }), SendResultSchema, {
146193
- kind: "mutation",
146194
- auth: "admin"
146195
- }), method(object({
146196
- targetId: string(),
146197
- sample: NotificationSchema.optional()
146198
- }), TestResultSchema, {
146199
- kind: "mutation",
146200
- auth: "admin"
146201
- }), method(object({
146202
- target: TargetSchema,
146203
- /**
146204
- * Duplicate flow: create a NEW target id while copying secrets from an
146205
- * existing row. The UI never holds the stored token; blank / redacted
146206
- * password fields are restored from this source (D634 still applies if
146207
- * destinations diverge without a re-typed secret).
146208
- */
146209
- cloneSecretsFrom: string().optional()
146210
- }), TargetSchema, {
146211
- kind: "mutation",
146212
- auth: "admin"
146213
- }), method(object({ targetId: string() }), _void(), {
146214
- kind: "mutation",
146215
- auth: "admin"
146216
- }), method(object({
146217
- targetId: string(),
146218
- enabled: boolean()
146219
- }), _void(), {
146220
- kind: "mutation",
146221
- auth: "admin"
146222
- });
146223
146252
  _enum([
146224
146253
  "automation",
146225
146254
  "action",
@@ -150759,37 +150788,6 @@ method(object({
150759
150788
  kind: "mutation",
150760
150789
  auth: "admin"
150761
150790
  }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
150762
- var ConnectionTestOutcomeSchema = discriminatedUnion("outcome", [
150763
- object({
150764
- outcome: literal("validated"),
150765
- /** Round-trip of the sign-in, when the provider measured it. */
150766
- latencyMs: number().nonnegative().optional(),
150767
- /** Optional human detail worth showing next to the tick
150768
- * ("3 devices visible on this account"). */
150769
- detail: string().optional()
150770
- }).strict(),
150771
- object({
150772
- outcome: literal("rejected"),
150773
- error: string()
150774
- }).strict(),
150775
- object({
150776
- outcome: literal("inconclusive"),
150777
- error: string()
150778
- }).strict()
150779
- ]);
150780
- var ConnectionTestInputSchema = object({
150781
- /** Candidate integration settings, exactly as the create form collected them. */
150782
- settings: record(string(), unknown()) });
150783
- /**
150784
- * What the provider's test actually DOES, so the UI can say it in words before
150785
- * the operator presses the button ("Signs in to the Dreo cloud"). Purely
150786
- * descriptive — it never changes routing.
150787
- */
150788
- var ConnectionTestDescriptorSchema = object({ label: string() });
150789
- method(ConnectionTestInputSchema, ConnectionTestOutcomeSchema, {
150790
- kind: "mutation",
150791
- auth: "admin"
150792
- }), method(_void(), ConnectionTestDescriptorSchema, { auth: "admin" });
150793
150791
  /**
150794
150792
  * Upstream-system connectivity sensor — distinct from `device-status`,
150795
150793
  * which is the kernel-managed online/offline flag for the device's
@@ -157996,10 +157994,9 @@ var AvailableIntegrationTypeSchema = object({
157996
157994
  * locations" checkbox. Provider-declared in the addon manifest. */
157997
157995
  supportsLocationImport: boolean(),
157998
157996
  /**
157999
- * True when this integration DECLARES a pre-creation test (the
158000
- * `connection-test` cap, or a broker whose settings it stores). Drives the
158001
- * Test button: an integration that cannot be tested must say so up front
158002
- * rather than offering a button that always answers the same nonsense.
157997
+ * True when this integration's instances declare a Test (`integration-instances.describe().canTest`,
157998
+ * D1016). An integration that cannot be tested must say so up front rather than offering a
157999
+ * button that always answers the same nonsense.
158003
158000
  */
158004
158001
  canTest: boolean(),
158005
158002
  existingInstances: array(object({
@@ -158053,7 +158050,9 @@ var CreateIntegrationInputSchema = object({
158053
158050
  info: record(string(), unknown()).optional(),
158054
158051
  /** `stableId` of the discovery candidate the form was seeded from (D984). */
158055
158052
  originStableId: string().optional(),
158056
- settings: record(string(), unknown()).optional()
158053
+ settings: record(string(), unknown()).optional(),
158054
+ /** The instance kind being created, for a provider with several; omitted = its only testable kind. */
158055
+ kind: string().min(1).optional()
158057
158056
  });
158058
158057
  var UpdateIntegrationInputSchema = object({
158059
158058
  id: string(),
@@ -158079,13 +158078,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
158079
158078
  }), method(object({ id: string() }), DeleteIntegrationResultSchema, {
158080
158079
  kind: "mutation",
158081
158080
  auth: "admin"
158082
- }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" }), method(object({
158083
- addonId: string(),
158084
- settings: record(string(), unknown())
158085
- }), TestConnectionResultSchema, {
158086
- kind: "mutation",
158087
- auth: "admin"
158088
- });
158081
+ }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" });
158089
158082
  /**
158090
158083
  * `integration-instances` - the connection of an addon that holds ONE or SEVERAL
158091
158084
  * (an account, a relay, a destination) as typed records (D985, D986). The addon's
@@ -166849,13 +166842,6 @@ var AddBrokerInputSchema = object({
166849
166842
  });
166850
166843
  var AddBrokerResultSchema = object({ id: string() });
166851
166844
  var IdInputSchema = object({ id: string() });
166852
- var TestResultSchema$1 = discriminatedUnion("ok", [object({
166853
- ok: literal(true),
166854
- latencyMs: number()
166855
- }), object({
166856
- ok: literal(false),
166857
- error: string()
166858
- })]);
166859
166845
  var StartEmbeddedInputSchema = object({
166860
166846
  port: number().int().min(1).max(65535).default(1883),
166861
166847
  /** Allow anonymous connect (no username/password). Default: false. */
@@ -166878,9 +166864,6 @@ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnection
166878
166864
  }), method(IdInputSchema, _void(), {
166879
166865
  kind: "mutation",
166880
166866
  auth: "admin"
166881
- }), method(IdInputSchema, TestResultSchema$1, {
166882
- kind: "mutation",
166883
- auth: "admin"
166884
166867
  }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, {
166885
166868
  kind: "mutation",
166886
166869
  auth: "admin"
@@ -180717,7 +180700,7 @@ var TrainingProviderTypeSchema = object({
180717
180700
  label: string(),
180718
180701
  /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
180719
180702
  iconAsset: string(),
180720
- /** Owning `training-provider` addon — collection selector for createEntry. */
180703
+ /** Owning `training-provider` addon. */
180721
180704
  addonId: string(),
180722
180705
  /**
180723
180706
  * Fields for one entry of this type (credentials + defaults). Absent on a
@@ -180762,36 +180745,6 @@ var TrainingProviderDescriptorSchema = object({
180762
180745
  */
180763
180746
  formValues: record(string(), unknown()).optional()
180764
180747
  });
180765
- /**
180766
- * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
180767
- * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
180768
- * `{ $secretClear: true }` clears it.
180769
- */
180770
- var TrainingProviderUpdateEntryInputSchema = object({
180771
- entryId: string().min(1),
180772
- name: string().min(1),
180773
- tokenId: string().optional(),
180774
- tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
180775
- environment: string().optional(),
180776
- gpuType: string().optional(),
180777
- region: string().optional(),
180778
- costCapUsd: number().nonnegative().optional(),
180779
- maxRuntimeSec: number().int().positive().optional(),
180780
- failedDatasetGraceHours: number().nonnegative().optional()
180781
- });
180782
- var TrainingCredentialCheckSchema = object({
180783
- ok: boolean(),
180784
- /** Workspace / account name, when the provider says. */
180785
- account: string().optional(),
180786
- reason: _enum([
180787
- "missing",
180788
- "invalid",
180789
- "forbidden",
180790
- "network",
180791
- "quota"
180792
- ]).optional(),
180793
- detail: string().optional()
180794
- });
180795
180748
  var ProviderJobStateSchema = _enum([
180796
180749
  "pending",
180797
180750
  "starting",
@@ -180839,22 +180792,6 @@ var TrainingLogLineSchema = object({
180839
180792
  text: string()
180840
180793
  });
180841
180794
  method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
180842
- typeId: string().min(1),
180843
- name: string().min(1)
180844
- }), object({ entryId: string() }), {
180845
- kind: "mutation",
180846
- auth: "admin"
180847
- }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
180848
- kind: "mutation",
180849
- auth: "admin"
180850
- }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
180851
- kind: "mutation",
180852
- auth: "admin"
180853
- }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
180854
- kind: "mutation",
180855
- auth: "admin",
180856
- timeoutMs: 3e4
180857
- }), method(object({
180858
180795
  entryId: string().min(1),
180859
180796
  gpuType: string(),
180860
180797
  region: string(),
@@ -186818,20 +186755,6 @@ Object.freeze({
186818
186755
  access: "view",
186819
186756
  role: "admin"
186820
186757
  },
186821
- "connectionTest.describeTest": {
186822
- capName: "connection-test",
186823
- capScope: "system",
186824
- addonId: null,
186825
- access: "view",
186826
- role: "admin"
186827
- },
186828
- "connectionTest.testSettings": {
186829
- capName: "connection-test",
186830
- capScope: "system",
186831
- addonId: null,
186832
- access: "create",
186833
- role: "admin"
186834
- },
186835
186758
  "connectivity.getStatus": {
186836
186759
  capName: "connectivity",
186837
186760
  capScope: "device",
@@ -189198,13 +189121,6 @@ Object.freeze({
189198
189121
  access: "view",
189199
189122
  role: "admin"
189200
189123
  },
189201
- "integrations.testConnection": {
189202
- capName: "integrations",
189203
- capScope: "system",
189204
- addonId: null,
189205
- access: "create",
189206
- role: "admin"
189207
- },
189208
189124
  "integrations.update": {
189209
189125
  capName: "integrations",
189210
189126
  capScope: "system",
@@ -190437,13 +190353,6 @@ Object.freeze({
190437
190353
  access: "create",
190438
190354
  role: "admin"
190439
190355
  },
190440
- "mqttBroker.testConnection": {
190441
- capName: "mqtt-broker",
190442
- capScope: "system",
190443
- addonId: null,
190444
- access: "create",
190445
- role: "admin"
190446
- },
190447
190356
  "nativeObjectDetection.getOptions": {
190448
190357
  capName: "native-object-detection",
190449
190358
  capScope: "device",
@@ -195274,20 +195183,6 @@ Object.freeze({
195274
195183
  access: "create",
195275
195184
  role: "admin"
195276
195185
  },
195277
- "trainingProvider.createEntry": {
195278
- capName: "training-provider",
195279
- capScope: "system",
195280
- addonId: null,
195281
- access: "create",
195282
- role: "admin"
195283
- },
195284
- "trainingProvider.deleteEntry": {
195285
- capName: "training-provider",
195286
- capScope: "system",
195287
- addonId: null,
195288
- access: "delete",
195289
- role: "admin"
195290
- },
195291
195186
  "trainingProvider.describe": {
195292
195187
  capName: "training-provider",
195293
195188
  capScope: "system",
@@ -195358,13 +195253,6 @@ Object.freeze({
195358
195253
  access: "create",
195359
195254
  role: "admin"
195360
195255
  },
195361
- "trainingProvider.updateEntry": {
195362
- capName: "training-provider",
195363
- capScope: "system",
195364
- addonId: null,
195365
- access: "create",
195366
- role: "admin"
195367
- },
195368
195256
  "trainingProvider.uploadDataset": {
195369
195257
  capName: "training-provider",
195370
195258
  capScope: "system",
@@ -195372,13 +195260,6 @@ Object.freeze({
195372
195260
  access: "create",
195373
195261
  role: "admin"
195374
195262
  },
195375
- "trainingProvider.validateCredentials": {
195376
- capName: "training-provider",
195377
- capScope: "system",
195378
- addonId: null,
195379
- access: "create",
195380
- role: "admin"
195381
- },
195382
195263
  "turnProvider.getTurnServers": {
195383
195264
  capName: "turn-provider",
195384
195265
  capScope: "system",