@camstack/addon-export-google 0.1.128 → 0.1.130

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.
@@ -78,7 +78,7 @@ function createApiDeviceGateway(deps) {
78
78
  };
79
79
  }
80
80
  //#endregion
81
- //#region ../types/dist/event-category-BmPm98n0.mjs
81
+ //#region ../types/dist/event-category-78tcBemo.mjs
82
82
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
83
83
  EventCategory["SystemBoot"] = "system.boot";
84
84
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -199,6 +199,23 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
199
199
  */
200
200
  EventCategory["AddonLoadRecovered"] = "addon.load-recovered";
201
201
  /**
202
+ * An addon is RUNNING although its installed package is below what the
203
+ * running server requires (`camstack.requires.addons` of the server, or the
204
+ * addon's own `requires.server`). Raised once per streak by the unsupported-
205
+ * addon tracker, on the hub and on agents; AlertCenter turns it into one
206
+ * operator alert per node and package. The addon is never held back for it.
207
+ *
208
+ * Payload: `{ packageName, addonId, nodeId, installedVersion, requiredMinimum, serverVersion, unmet }`.
209
+ */
210
+ EventCategory["AddonUnsupportedVersion"] = "addon.unsupported-version";
211
+ /**
212
+ * The package of an {@link AddonUnsupportedVersion} alert reached a supported
213
+ * version, or is no longer installed on the node. AlertCenter dismisses the matching alert.
214
+ *
215
+ * Payload: `{ packageName, addonId, nodeId }`.
216
+ */
217
+ EventCategory["AddonUnsupportedResolved"] = "addon.unsupported-resolved";
218
+ /**
202
219
  * Monitor scheduled the next retry for a failed addon. Transient —
203
220
  * surfaced to the UI for live-updating the "next retry in Ns"
204
221
  * countdown on the Addons page row, NOT persisted as an alert.
@@ -309,7 +326,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
309
326
  EventCategory["ProcessRestarted"] = "process.restarted";
310
327
  /**
311
328
  * The SET of storage locations changed — one was created, edited, enabled,
312
- * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
329
+ * disabled or deleted through the location instances or the forced-delete action.
313
330
  *
314
331
  * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
315
332
  * it must also converge on its own periodic path, because a dropped event
@@ -6060,7 +6077,7 @@ var ZodIssueCode = {
6060
6077
  var ZodFirstPartyTypeKind;
6061
6078
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6062
6079
  //#endregion
6063
- //#region ../types/dist/sleep-CmjWurK5.mjs
6080
+ //#region ../types/dist/sleep-AEnTN3b4.mjs
6064
6081
  /**
6065
6082
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6066
6083
  * window to float samples (D455).
@@ -6769,10 +6786,33 @@ function integrationRowsApiOver(api) {
6769
6786
  };
6770
6787
  }
6771
6788
  var PREFIX$1 = "records/";
6789
+ /**
6790
+ * Cross-realm brand. An addon bundles its own copy of this module (D15) while
6791
+ * `ctx.records` is the HOST's door, so an error thrown by the host is an
6792
+ * instance of the host's classes, not of the addon's. The brand plus the code
6793
+ * make `instanceof` answer by identity of the failure, not of the copy.
6794
+ */
6795
+ var RECORDS_ERROR_BRAND = Symbol.for("camstack.records-error");
6796
+ function carriesBrand(value) {
6797
+ return typeof value === "object" && value !== null && Reflect.get(value, RECORDS_ERROR_BRAND) === true;
6798
+ }
6772
6799
  /** The base of every records failure. `detail` is the human part of the message. */
6773
6800
  var RecordsError = class extends Error {
6801
+ /** The code a subclass stands for; the base stands for every code. */
6802
+ static code = void 0;
6803
+ /**
6804
+ * `instanceof` across copies of this module: any branded error is a
6805
+ * `RecordsError`, and is an instance of a subclass only when its code is the
6806
+ * subclass's code. Same-copy answers are unchanged.
6807
+ */
6808
+ static [Symbol.hasInstance](value) {
6809
+ if (Function.prototype[Symbol.hasInstance].call(this, value)) return true;
6810
+ if (!carriesBrand(value)) return false;
6811
+ return this.code === void 0 || value.code === this.code;
6812
+ }
6774
6813
  code;
6775
6814
  detail;
6815
+ [RECORDS_ERROR_BRAND] = true;
6776
6816
  constructor(code, detail) {
6777
6817
  super(`${PREFIX$1}${code}: ${detail}`);
6778
6818
  this.name = "RecordsError";
@@ -6781,29 +6821,33 @@ var RecordsError = class extends Error {
6781
6821
  }
6782
6822
  };
6783
6823
  /** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
6784
- var RevConflictError = class extends RecordsError {
6824
+ var RevConflictError = class RevConflictError extends RecordsError {
6825
+ static code = "rev-conflict";
6785
6826
  constructor(detail) {
6786
- super("rev-conflict", detail);
6827
+ super(RevConflictError.code, detail);
6787
6828
  this.name = "RevConflictError";
6788
6829
  }
6789
6830
  };
6790
6831
  /** The keychain could not store or serve a value: explicit, never an empty string. */
6791
- var RecordSecretUnavailableError = class extends RecordsError {
6832
+ var RecordSecretUnavailableError = class RecordSecretUnavailableError extends RecordsError {
6833
+ static code = "secret-unavailable";
6792
6834
  constructor(detail) {
6793
- super("secret-unavailable", detail);
6835
+ super(RecordSecretUnavailableError.code, detail);
6794
6836
  this.name = "RecordSecretUnavailableError";
6795
6837
  }
6796
6838
  };
6797
- var InvalidRecordError = class extends RecordsError {
6839
+ var InvalidRecordError = class InvalidRecordError extends RecordsError {
6840
+ static code = "invalid-record";
6798
6841
  constructor(detail) {
6799
- super("invalid-record", detail);
6842
+ super(InvalidRecordError.code, detail);
6800
6843
  this.name = "InvalidRecordError";
6801
6844
  }
6802
6845
  };
6803
6846
  /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
6804
- var DeclarationRefusedError = class extends RecordsError {
6847
+ var DeclarationRefusedError = class DeclarationRefusedError extends RecordsError {
6848
+ static code = "declaration-refused";
6805
6849
  constructor(detail) {
6806
- super("declaration-refused", detail);
6850
+ super(DeclarationRefusedError.code, detail);
6807
6851
  this.name = "DeclarationRefusedError";
6808
6852
  }
6809
6853
  };
@@ -7281,17 +7325,35 @@ var RecordIntegrationInstances = class {
7281
7325
  ...kind !== void 0 ? { kind } : {}
7282
7326
  });
7283
7327
  if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
7328
+ const initial = this.hooks.initialBody(name, kind);
7329
+ const patch = this.patchOf(values ?? {});
7330
+ if (Object.keys(patch).length > 0) Object.assign(patch, await this.hooks.validateWrite?.({
7331
+ kind,
7332
+ body: {
7333
+ ...initial,
7334
+ ...patch
7335
+ }
7336
+ }));
7284
7337
  await this.handle.put({
7285
7338
  id: minted,
7286
- data: this.hooks.initialBody(name, kind)
7339
+ data: initial
7287
7340
  }, { ifRev: 0 });
7288
- const patch = this.patchOf(values ?? {});
7289
7341
  if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
7290
7342
  await this.hooks.onChanged?.(minted, "created");
7291
7343
  return { id: minted };
7292
7344
  };
7293
7345
  updateInstance = async ({ id, name, values }) => {
7294
7346
  const patch = this.patchOf(values);
7347
+ if (this.hooks.validateWrite !== void 0 && Object.keys(patch).length > 0) {
7348
+ const stored = await this.handle.get(id);
7349
+ if (stored !== null) Object.assign(patch, await this.hooks.validateWrite({
7350
+ kind: void 0,
7351
+ body: {
7352
+ ...stored.data,
7353
+ ...patch
7354
+ }
7355
+ }));
7356
+ }
7295
7357
  if (name !== void 0) patch[this.nameField] = name;
7296
7358
  await this.handle.patch(id, patch);
7297
7359
  await this.hooks.onChanged?.(id, "updated");
@@ -9598,271 +9660,6 @@ function normalizeAddonInitResult(result) {
9598
9660
  if (Array.isArray(result)) return { providers: result };
9599
9661
  return result;
9600
9662
  }
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
9663
  object({
9867
9664
  field: string().min(1),
9868
9665
  on: literal("advance")
@@ -9951,6 +9748,271 @@ function optionalMethod(input, output, options) {
9951
9748
  providerOptional: true
9952
9749
  };
9953
9750
  }
9751
+ function defOf(schema) {
9752
+ const zodBag = Reflect.get(schema, "_zod");
9753
+ if (typeof zodBag !== "object" || zodBag === null) return {};
9754
+ const def = Reflect.get(zodBag, "def");
9755
+ if (typeof def !== "object" || def === null) return {};
9756
+ return def;
9757
+ }
9758
+ function declaredHere(schema) {
9759
+ return globalRegistry.get(schema)?.secret === true;
9760
+ }
9761
+ /** Wrapper kinds whose `innerType` is the field itself. */
9762
+ var WRAPPERS = new Set([
9763
+ "optional",
9764
+ "nullable",
9765
+ "default",
9766
+ "prefault",
9767
+ "catch",
9768
+ "readonly",
9769
+ "nonoptional"
9770
+ ]);
9771
+ /**
9772
+ * The schema layers that make up ONE field: the schema itself and every
9773
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
9774
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
9775
+ * `.transform` on `in`).
9776
+ */
9777
+ function layersOf(schema) {
9778
+ const out = [];
9779
+ const queue = [schema];
9780
+ while (queue.length > 0) {
9781
+ const s = queue.shift();
9782
+ if (!s || out.includes(s)) continue;
9783
+ out.push(s);
9784
+ const def = defOf(s);
9785
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
9786
+ if (def.type === "pipe") {
9787
+ if (def.in) queue.push(def.in);
9788
+ if (def.out) queue.push(def.out);
9789
+ }
9790
+ }
9791
+ return out;
9792
+ }
9793
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
9794
+ function isZodSecret(schema) {
9795
+ return layersOf(schema).some(declaredHere);
9796
+ }
9797
+ /**
9798
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
9799
+ * element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
9800
+ * map" (`applianceSecrets{}`). A declared
9801
+ * object or array is reported as one path and not descended into — everything
9802
+ * under it is secret.
9803
+ */
9804
+ function collectZodSecretPaths(schema, prefix = "") {
9805
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
9806
+ const paths = [];
9807
+ for (const layer of layersOf(schema)) {
9808
+ const def = defOf(layer);
9809
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
9810
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
9811
+ else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
9812
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
9813
+ else if (def.type === "intersection") {
9814
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
9815
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
9816
+ }
9817
+ }
9818
+ return [...new Set(paths)];
9819
+ }
9820
+ /**
9821
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
9822
+ * Zod row schema that describes it, and the helper that turns the two into the
9823
+ * JSON the engine stores.
9824
+ *
9825
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
9826
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
9827
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
9828
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
9829
+ * never a field name (D879).
9830
+ */
9831
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
9832
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
9833
+ var RecordIndexSchema = object({
9834
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
9835
+ fields: array(RecordFieldPathSchema).min(1).max(4),
9836
+ unique: boolean().optional()
9837
+ }).strict();
9838
+ var RecordRetentionSchema = union([
9839
+ object({
9840
+ ttlMs: number().int().positive(),
9841
+ from: _enum(["at", "write"])
9842
+ }).strict(),
9843
+ object({
9844
+ maxRows: number().int().positive().optional(),
9845
+ maxRowsPerDevice: number().int().positive().optional()
9846
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
9847
+ object({
9848
+ owner: string().min(1),
9849
+ reason: string().min(1)
9850
+ }).strict(),
9851
+ object({ none: string().min(1) }).strict()
9852
+ ]);
9853
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
9854
+ var EntryDescriptorSchema = object({
9855
+ title: string().min(1),
9856
+ /** The record body field shown as the entry's name. */
9857
+ nameField: string().min(1),
9858
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
9859
+ fields: record(string(), unknown())
9860
+ }).strict();
9861
+ /** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
9862
+ var RecordKindDeclarationSchema = object({
9863
+ database: _enum(RECORD_DATABASES).default("settings"),
9864
+ class: _enum(RECORD_CLASSES),
9865
+ writeTrigger: string().min(1),
9866
+ device: _enum([
9867
+ "required",
9868
+ "optional",
9869
+ "none"
9870
+ ]).default("none"),
9871
+ at: _enum(["required", "none"]).default("none"),
9872
+ indexes: array(RecordIndexSchema).max(8).default([]),
9873
+ retention: RecordRetentionSchema,
9874
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
9875
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
9876
+ /** Derived from the Zod schema; never written by hand. */
9877
+ secretPaths: array(string().min(1)).default([]),
9878
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
9879
+ secretArrayKeys: record(string(), string()).default({}),
9880
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
9881
+ transactFamily: string().min(1).optional(),
9882
+ entry: EntryDescriptorSchema.optional()
9883
+ }).strict();
9884
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
9885
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
9886
+ /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
9887
+ function assertValidDeclaration(name, decl) {
9888
+ const refuse = (why) => {
9889
+ throw new DeclarationRefusedError(`kind "${name}": ${why}`);
9890
+ };
9891
+ if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
9892
+ const seen = /* @__PURE__ */ new Set();
9893
+ for (const index of decl.indexes) {
9894
+ if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
9895
+ seen.add(index.name);
9896
+ }
9897
+ const { retention } = decl;
9898
+ const hasSecrets = decl.secretPaths.length > 0;
9899
+ if ("ttlMs" in retention) {
9900
+ if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
9901
+ if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
9902
+ }
9903
+ if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
9904
+ if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
9905
+ if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
9906
+ if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
9907
+ const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
9908
+ 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)`);
9909
+ }
9910
+ if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
9911
+ 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`);
9912
+ }
9913
+ function bodyFieldsOf(schema) {
9914
+ return { ...toJSONSchema(schema, {
9915
+ unrepresentable: "any",
9916
+ io: "input"
9917
+ }) };
9918
+ }
9919
+ function isRecordLike(value) {
9920
+ return typeof value === "object" && value !== null && !Array.isArray(value);
9921
+ }
9922
+ /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
9923
+ function hasNameField(json, field) {
9924
+ const branches = json["oneOf"] ?? json["anyOf"];
9925
+ if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
9926
+ const properties = json["properties"];
9927
+ return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
9928
+ }
9929
+ /**
9930
+ * Declare the kinds of a package. The keys are the kind names. The result is
9931
+ * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
9932
+ * types its handle from.
9933
+ */
9934
+ function defineRecordKinds(specs) {
9935
+ const out = {};
9936
+ for (const [name, spec] of Object.entries(specs)) {
9937
+ const secretPaths = collectZodSecretPaths(spec.schema);
9938
+ const nameField = spec.entry?.nameField ?? "name";
9939
+ const fields = bodyFieldsOf(spec.schema);
9940
+ if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
9941
+ const parsed = RecordKindDeclarationSchema.parse({
9942
+ database: spec.database,
9943
+ class: spec.class,
9944
+ writeTrigger: spec.writeTrigger,
9945
+ device: spec.device,
9946
+ at: spec.at,
9947
+ indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
9948
+ retention: spec.retention,
9949
+ deviceRemoval: spec.deviceRemoval,
9950
+ maxDataBytes: spec.maxDataBytes,
9951
+ secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
9952
+ secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
9953
+ transactFamily: spec.transactFamily,
9954
+ entry: spec.entry === void 0 ? void 0 : {
9955
+ title: spec.entry.title,
9956
+ nameField,
9957
+ fields
9958
+ }
9959
+ });
9960
+ assertValidDeclaration(name, parsed);
9961
+ out[name] = {
9962
+ name,
9963
+ schema: spec.schema,
9964
+ declaration: parsed
9965
+ };
9966
+ }
9967
+ return out;
9968
+ }
9969
+ /**
9970
+ * Declare one entry kind. An entry is configuration: never trimmed by the
9971
+ * engine, never aged, belonging to no device.
9972
+ */
9973
+ function defineEntryKind(name, spec) {
9974
+ const defined = defineRecordKinds({ [name]: {
9975
+ schema: spec.schema,
9976
+ class: "config",
9977
+ writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
9978
+ retention: { none: "an entry goes only when the operator deletes it" },
9979
+ ...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
9980
+ ...spec.database === void 0 ? {} : { database: spec.database },
9981
+ ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
9982
+ ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
9983
+ ...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
9984
+ entry: {
9985
+ title: spec.title,
9986
+ ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
9987
+ }
9988
+ } })[name];
9989
+ if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
9990
+ return defined;
9991
+ }
9992
+ /**
9993
+ * The share-view scope kinds a share-link token can carry. The hub mints
9994
+ * and validates them (`ShareViewGrantSchema` builds its
9995
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
9996
+ */
9997
+ var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
9998
+ /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
9999
+ var PeerBytesTicketSchema = object({
10000
+ /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
10001
+ url: string().min(1),
10002
+ /**
10003
+ * The HOST node this URL means something on — the hub or a named agent,
10004
+ * never a runner. {@link AddonPeerBytes.open} compares it to its own and
10005
+ * refuses `cross-node` by name when they differ, without dialling.
10006
+ */
10007
+ hostNodeId: string().min(1),
10008
+ expiresAtMs: number().int().nonnegative(),
10009
+ /**
10010
+ * What the producer DECLARED the body to be, when it knows — `null` when it
10011
+ * does not. Never `0` for unknown (D393): a consumer sizing a bound off this
10012
+ * must be able to tell "the producer did not say" from "the body is empty".
10013
+ */
10014
+ declaredBytes: number().int().nonnegative().nullable()
10015
+ });
9954
10016
  var READING_QUANTITIES = [
9955
10017
  "temperature",
9956
10018
  "pressure",
@@ -10529,7 +10591,6 @@ var CAP_NAMES = Object.freeze([
10529
10591
  "climate-control",
10530
10592
  "color",
10531
10593
  "composer",
10532
- "connection-test",
10533
10594
  "connectivity",
10534
10595
  "consumables",
10535
10596
  "contact",
@@ -10619,7 +10680,6 @@ var CAP_NAMES = Object.freeze([
10619
10680
  "notifier",
10620
10681
  "numeric-sensor",
10621
10682
  "oauth-integration",
10622
- "oidc-connections",
10623
10683
  "osd",
10624
10684
  "osd-manager",
10625
10685
  "pet-feeder",
@@ -12511,8 +12571,7 @@ Object.freeze({
12511
12571
  "device-provider": { "reloadDevice": 18e4 },
12512
12572
  "llm": {
12513
12573
  "generate": 6e5,
12514
- "generateVision": 6e5,
12515
- "testProfile": 6e5
12574
+ "generateVision": 6e5
12516
12575
  },
12517
12576
  "llm-runtime": {
12518
12577
  "complete": 6e5,
@@ -12549,8 +12608,7 @@ Object.freeze({
12549
12608
  "offerArtifact": 3e5,
12550
12609
  "readResult": 3e5,
12551
12610
  "submitJob": 18e5,
12552
- "uploadDataset": 72e5,
12553
- "validateCredentials": 3e4
12611
+ "uploadDataset": 72e5
12554
12612
  }
12555
12613
  });
12556
12614
  object({
@@ -14022,6 +14080,414 @@ function buildCapturingReply(envelope) {
14022
14080
  };
14023
14081
  return wrapper;
14024
14082
  }
14083
+ /**
14084
+ * notification-output — canonical, capability-gated notification delivery.
14085
+ *
14086
+ * Apprise-derived model (see
14087
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14088
+ * callers emit ONE canonical `Notification`; each provider declares a
14089
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
14090
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14091
+ * message to what the kind supports — callers never special-case a service.
14092
+ *
14093
+ * DESIGN DECISIONS (locked):
14094
+ * - A target is an INSTANCE of this function cap (epic #440, step 6): the
14095
+ * providers serve their targets as `integration-instances` records, one
14096
+ * record kind per target kind, and the admin lists, adds, edits, switches
14097
+ * and deletes them through that cap. This cap keeps what an instance cannot
14098
+ * say: the kind catalogue (`listTargetKinds`: capabilities, delivery
14099
+ * parameters, brand icon), dispatch (`send`, `testTarget`) and the form
14100
+ * helpers (`discoverTargets`, `probeTargetConfig`).
14101
+ * - `listTargetKinds` / `discoverTargets` return arrays → the generated
14102
+ * cap-mount auto-`concatCollection`-fans them across every registered
14103
+ * provider so one catalog is routable. `send` / `testTarget` /
14104
+ * `probeTargetConfig` route to ONE provider by the `addonId` the generated
14105
+ * collection router extracts from the call input.
14106
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14107
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14108
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
14109
+ * base64 fallback needed.
14110
+ *
14111
+ * TODO (deferred, closed-set change — separate decision): add
14112
+ * `providerKind: 'notify'` so notification providers surface on the unified
14113
+ * admin "Integrations" page.
14114
+ */
14115
+ /**
14116
+ * Zentik-derived typed-media enum — the superset across every kind. Each
14117
+ * adapter picks what it supports and the degrade engine filters the rest.
14118
+ */
14119
+ var AttachmentMediaTypeSchema = _enum([
14120
+ "image",
14121
+ "video",
14122
+ "gif",
14123
+ "audio",
14124
+ "icon"
14125
+ ]);
14126
+ /**
14127
+ * A single attachment. Exactly one of `url` (remote source, most adapters
14128
+ * prefer this) or `bytes` (inline source; required for Pushover-style
14129
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
14130
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
14131
+ */
14132
+ var AttachmentSchema = object({
14133
+ mediaType: AttachmentMediaTypeSchema,
14134
+ url: string().optional(),
14135
+ bytes: _instanceof(Uint8Array).optional(),
14136
+ mime: string().optional(),
14137
+ name: string().optional()
14138
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14139
+ var NotificationFormatSchema = _enum([
14140
+ "text",
14141
+ "markdown",
14142
+ "html"
14143
+ ]);
14144
+ /**
14145
+ * The CLOSED icon vocabulary an action button may use.
14146
+ *
14147
+ * A closed set, not a free string, and that is the whole point: an arbitrary
14148
+ * icon name is one that ntfy renders, zentik silently drops, and nobody
14149
+ * notices — the same class of gap as a zone vocabulary nothing produced
14150
+ * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
14151
+ * declares `actionIcons: false` and the degrade engine strips the field.
14152
+ *
14153
+ * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
14154
+ * renderer's icon set; "acknowledge" survives an adapter that draws it
14155
+ * differently.
14156
+ *
14157
+ * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
14158
+ *
14159
+ * These names are for US. **No adapter may forward one verbatim.** Each maps
14160
+ * the whole set onto its own renderer's vocabulary through a
14161
+ * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
14162
+ * fallback, so adding a member here fails every adapter's build until someone
14163
+ * decides its glyph, which is the only place that decision can be made
14164
+ * honestly.
14165
+ *
14166
+ * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
14167
+ * `disarm` straight through; iOS feeds that string to
14168
+ * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
14169
+ * and every snooze and alarm button arrived BLANK. A pass-through is not a
14170
+ * mapping, and "the field is documented" is not "the value renders".
14171
+ *
14172
+ * Adding a member is TRAIN-BOUND. The enum lives in the published
14173
+ * `@camstack/server` closure and the cap seam validates against the HUB's copy,
14174
+ * so an addon that emits a token the running hub does not know does not lose an
14175
+ * icon — its whole `send` fails Zod validation and the notification never
14176
+ * arrives. Never emit a new token from an addon before the train carrying it.
14177
+ */
14178
+ var NotificationActionIconSchema = _enum([
14179
+ "acknowledge",
14180
+ "dismiss",
14181
+ "silence",
14182
+ "snooze",
14183
+ "view",
14184
+ "play",
14185
+ "open",
14186
+ "close",
14187
+ "lock",
14188
+ "unlock",
14189
+ "arm",
14190
+ "arm-home",
14191
+ "arm-away",
14192
+ "arm-night",
14193
+ "disarm",
14194
+ "light",
14195
+ "alert",
14196
+ "camera"
14197
+ ]);
14198
+ /** A single tap-through action button. */
14199
+ var NotificationActionSchema = object({
14200
+ id: string(),
14201
+ label: string(),
14202
+ url: string().optional(),
14203
+ /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
14204
+ icon: NotificationActionIconSchema.optional(),
14205
+ /**
14206
+ * Renders in a warning style where the notifier supports it.
14207
+ *
14208
+ * A HINT, never a gate. The callback's authority is its token and nothing
14209
+ * else — see `notification-center/action-token.ts` for what that does and
14210
+ * does not buy.
14211
+ */
14212
+ destructive: boolean().optional(),
14213
+ /**
14214
+ * How the tap should REACH the url.
14215
+ *
14216
+ * `navigate` (absent, and every button authored before this field) opens it:
14217
+ * the phone leaves the notification and shows whatever the callback returns.
14218
+ * That is right for a button whose answer the operator wants to read.
14219
+ *
14220
+ * `background` fires it as a POST and stays put. It exists for the buttons
14221
+ * whose whole point is not to interrupt — "silence this for 30 minutes" is
14222
+ * an answer to the notification, and being thrown into a browser tab to
14223
+ * confirm it costs more attention than the notification did. A backend that
14224
+ * cannot do a background call renders it as an ordinary link (the adapters
14225
+ * fall back rather than dropping the button), so this is a preference, never
14226
+ * a requirement.
14227
+ */
14228
+ mode: _enum(["navigate", "background"]).optional()
14229
+ });
14230
+ /** A delivery parameter value: what a notifier declared it takes. */
14231
+ var DeliveryParamValueSchema = union([
14232
+ string(),
14233
+ number(),
14234
+ boolean()
14235
+ ]);
14236
+ /**
14237
+ * One extra delivery parameter a notifier KIND declares (D938). A rule that
14238
+ * addresses a target of that kind may set it; a kind that declares nothing is
14239
+ * never handed one. The admin UI derives its control from this descriptor —
14240
+ * no editor knows a service by name.
14241
+ *
14242
+ * Optional fields are `.optional()`, never `.default()` (a Zod default does not
14243
+ * run on the addon cap path).
14244
+ */
14245
+ var DeliveryParamSchema = object({
14246
+ key: string().min(1),
14247
+ label: string(),
14248
+ /** i18n key of the label, resolved by the declaring addon's namespace. */
14249
+ labelKey: string().optional(),
14250
+ type: _enum([
14251
+ "enum",
14252
+ "number",
14253
+ "boolean",
14254
+ "string"
14255
+ ]),
14256
+ /** `enum` only: the closed set of accepted values. */
14257
+ options: array(object({
14258
+ value: string(),
14259
+ label: string()
14260
+ })).optional(),
14261
+ /** `number` only. */
14262
+ min: number().optional(),
14263
+ max: number().optional(),
14264
+ /** What the notifier does when the rule sets nothing; shown as the placeholder. */
14265
+ default: DeliveryParamValueSchema.optional()
14266
+ });
14267
+ /**
14268
+ * The canonical notification. `body` is the only hard field (Apprise model).
14269
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14270
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14271
+ * the adapter maps this ordinal onto its native level. `level?` is an
14272
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
14273
+ * `priority` for that one target.
14274
+ */
14275
+ var NotificationSchema = object({
14276
+ body: string(),
14277
+ title: string().optional(),
14278
+ format: NotificationFormatSchema.default("text"),
14279
+ priority: number().int().min(1).max(5).default(3),
14280
+ level: string().optional(),
14281
+ attachments: array(AttachmentSchema).optional(),
14282
+ clickUrl: string().optional(),
14283
+ actions: array(NotificationActionSchema).optional(),
14284
+ sound: string().optional(),
14285
+ ttl: number().optional(),
14286
+ tag: string().optional(),
14287
+ deviceId: number().optional(),
14288
+ eventId: string().optional(),
14289
+ metadata: record(string(), unknown()).optional(),
14290
+ /**
14291
+ * Values for the parameters the target's kind DECLARES in
14292
+ * {@link TargetKindSchema} `deliveryParams`. Already validated against the
14293
+ * declaration by the sender; a notifier reads only the keys it declared.
14294
+ */
14295
+ delivery: record(string(), DeliveryParamValueSchema).optional()
14296
+ });
14297
+ /** One declared native severity/priority level for a kind. */
14298
+ var TargetKindLevelSchema = object({
14299
+ id: string(),
14300
+ label: string(),
14301
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14302
+ ordinal: number().int().min(1).max(5).nullable(),
14303
+ flags: object({
14304
+ critical: boolean().optional(),
14305
+ silent: boolean().optional(),
14306
+ noPush: boolean().optional()
14307
+ }).optional(),
14308
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14309
+ requires: array(string()).optional(),
14310
+ description: string().optional()
14311
+ });
14312
+ /** The full capability block consulted before dispatch. */
14313
+ var TargetKindCapsSchema = object({
14314
+ attachments: object({
14315
+ mediaTypes: array(AttachmentMediaTypeSchema),
14316
+ mode: _enum([
14317
+ "url",
14318
+ "bytes",
14319
+ "both"
14320
+ ]),
14321
+ max: number().int().nonnegative(),
14322
+ maxBytes: number().int().positive().optional()
14323
+ }),
14324
+ /** Max action buttons (0 = none). */
14325
+ actions: number().int().nonnegative(),
14326
+ /**
14327
+ * Whether this kind renders a per-action ICON.
14328
+ *
14329
+ * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
14330
+ * run on the addon cap path — three production failures in one day taught
14331
+ * this repo that once. Absent is read as false by the degrade engine, which
14332
+ * is the safe direction: an icon that is not rendered costs nothing, an icon
14333
+ * assumed and dropped costs the operator's trust in the field.
14334
+ */
14335
+ actionIcons: boolean().optional(),
14336
+ levels: array(TargetKindLevelSchema),
14337
+ format: array(NotificationFormatSchema),
14338
+ clickUrl: boolean(),
14339
+ sound: boolean(),
14340
+ ttl: boolean(),
14341
+ bodyMaxLen: number().int().positive()
14342
+ });
14343
+ /**
14344
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14345
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14346
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14347
+ * the union is large and not meant for runtime validation here; the exported
14348
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14349
+ */
14350
+ var ConfigSchemaPassthrough$3 = unknown();
14351
+ var TargetKindSchema = object({
14352
+ kind: string(),
14353
+ label: string(),
14354
+ icon: string(),
14355
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
14356
+ addonId: string(),
14357
+ /**
14358
+ * URL of the kind's bundled BRAND icon, served by the providing addon over
14359
+ * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
14360
+ * when the addon bundles no icon for that kind — the client then falls back
14361
+ * to a neutral glyph rather than rendering the raw `icon` NAME as text.
14362
+ *
14363
+ * Root-relative on purpose: it resolves against whatever origin serves a web
14364
+ * client, and a native client joins it onto its own hub base.
14365
+ *
14366
+ * DECLARED here deliberately. It used to travel as an undeclared passthrough
14367
+ * field that survived only because the runtime cap-router forwards provider
14368
+ * output verbatim — so every consumer had to re-declare it by hand to stop
14369
+ * its own Zod parse from stripping it, and the whole arrangement would have
14370
+ * broken silently the moment output validation was tightened anywhere.
14371
+ */
14372
+ iconUrl: string().optional(),
14373
+ /**
14374
+ * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
14375
+ *
14376
+ * The server knows this and therefore says it, because the client cannot
14377
+ * safely guess: a React-Native client renders SVG and raster through two
14378
+ * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
14379
+ * not decode SVG on iOS/Android), so without this it silently fell back to a
14380
+ * placeholder glyph for every vector icon while the web build looked fine.
14381
+ *
14382
+ * Absent when {@link iconUrl} is absent, or for a legacy provider that has
14383
+ * not been updated — a client that cannot determine the type should prefer
14384
+ * its raster path, which is the safe default for an unknown image.
14385
+ */
14386
+ iconMediaType: string().optional(),
14387
+ configSchema: ConfigSchemaPassthrough$3,
14388
+ /**
14389
+ * The config keys that decide WHERE this kind's secrets are sent (server,
14390
+ * base URL, instance, chat, recipient). A save that changes any of them
14391
+ * while leaving a secret redacted is refused by the provider (D634), so an
14392
+ * editor uses this to ask for the secret on exactly those edits instead of
14393
+ * on every edit.
14394
+ *
14395
+ * Optional: absent from a provider that holds no secret (the Home Assistant
14396
+ * kinds) and from a provider older than this field — an editor that finds
14397
+ * it absent must assume ANY edit may need the secret.
14398
+ */
14399
+ destinationKeys: array(string()).optional(),
14400
+ supportsDiscovery: boolean(),
14401
+ /**
14402
+ * Extra delivery parameters a rule may set for a target of this kind (D938).
14403
+ * Absent = none; the rule editor then offers nothing.
14404
+ */
14405
+ deliveryParams: array(DeliveryParamSchema).optional(),
14406
+ caps: TargetKindCapsSchema
14407
+ });
14408
+ /**
14409
+ * A target as a provider's own code sees it (the notification-center bridge, the
14410
+ * send path): the flat record body split into the name, the switch and the
14411
+ * kind's fields. `config` holds secrets; a reader that serves it to a client
14412
+ * REDACTS secret fields (a presence marker only) — never round-trip a stored
14413
+ * secret to the UI.
14414
+ */
14415
+ var TargetSchema = object({
14416
+ id: string(),
14417
+ name: string(),
14418
+ kind: string(),
14419
+ addonId: string(),
14420
+ enabled: boolean(),
14421
+ config: record(string(), unknown())
14422
+ });
14423
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
14424
+ var DiscoveredTargetSchema = object({
14425
+ kind: string(),
14426
+ suggestedName: string(),
14427
+ config: record(string(), unknown())
14428
+ });
14429
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
14430
+ var RenderedAsSchema = object({
14431
+ level: string(),
14432
+ format: NotificationFormatSchema,
14433
+ attachmentsSent: number().int().nonnegative(),
14434
+ actionsSent: number().int().nonnegative(),
14435
+ truncated: boolean(),
14436
+ dropped: array(string())
14437
+ });
14438
+ var SendResultSchema = object({
14439
+ success: boolean(),
14440
+ error: string().optional(),
14441
+ renderedAs: RenderedAsSchema.optional()
14442
+ });
14443
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
14444
+ var TestResultSchema = SendResultSchema;
14445
+ /**
14446
+ * Pre-save credential probe against a partial (unsaved) target config.
14447
+ * `resolvedUrl` never includes secrets (token stripped from path).
14448
+ */
14449
+ var ProbeTargetConfigResultSchema = object({
14450
+ ok: boolean(),
14451
+ resolvedUrl: string(),
14452
+ httpStatus: number().int().optional(),
14453
+ stateInstance: string().optional(),
14454
+ error: string().optional()
14455
+ });
14456
+ method(object({}), array(TargetKindSchema)), method(object({
14457
+ kind: string(),
14458
+ config: record(string(), unknown()).optional(),
14459
+ /**
14460
+ * When editing / duplicating, the blank password field never round-trips
14461
+ * the stored token. Pass the source target id so the provider can restore
14462
+ * secrets server-side before dialling.
14463
+ */
14464
+ targetId: string().optional()
14465
+ }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
14466
+ kind: string(),
14467
+ config: record(string(), unknown()),
14468
+ /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
14469
+ targetId: string().optional()
14470
+ }), ProbeTargetConfigResultSchema, {
14471
+ kind: "mutation",
14472
+ auth: "admin"
14473
+ }), method(object({
14474
+ targetId: string(),
14475
+ notification: NotificationSchema
14476
+ }), SendResultSchema, {
14477
+ kind: "mutation",
14478
+ auth: "admin"
14479
+ }), method(object({
14480
+ targetId: string(),
14481
+ sample: NotificationSchema.optional()
14482
+ }), TestResultSchema, {
14483
+ kind: "mutation",
14484
+ auth: "admin"
14485
+ });
14486
+ looseObject({
14487
+ name: string().min(1),
14488
+ enabled: boolean().optional()
14489
+ });
14490
+ TargetSchema.omit({ id: true });
14025
14491
  var EncodeProfileSchema = object({
14026
14492
  video: object({
14027
14493
  codec: _enum([
@@ -22246,7 +22712,6 @@ var SYSTEM_CAP_VOCABULARY = {
22246
22712
  "calendar-source": system(INTERNAL),
22247
22713
  calendars: system("calendars feed schedules and conditions, not device actions"),
22248
22714
  composer: system("device composition — an authoring tool, not an action"),
22249
- "connection-test": system(INTERNAL),
22250
22715
  "core-blocks": system(INTERNAL),
22251
22716
  "custom-model-registry": system(ML),
22252
22717
  "data-store-provider": system(INTERNAL),
@@ -22291,7 +22756,6 @@ var SYSTEM_CAP_VOCABULARY = {
22291
22756
  "notification-output": system("notification delivery — reached through notifier devices and rules"),
22292
22757
  "notification-rules": system("notification rules — authored on their own page"),
22293
22758
  "oauth-integration": system(IDENTITY),
22294
- "oidc-connections": system(IDENTITY),
22295
22759
  "osd-manager": system(PIPELINE),
22296
22760
  "pipeline-executor": system(PIPELINE),
22297
22761
  "pipeline-orchestrator": system(PIPELINE),
@@ -44163,427 +44627,6 @@ var UnitWarningSchema = object({
44163
44627
  assumedUnit: string(),
44164
44628
  message: string()
44165
44629
  });
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
44630
  function errorText(err) {
44588
44631
  return err instanceof Error ? err.message : String(err);
44589
44632
  }
@@ -48547,37 +48590,6 @@ method(object({
48547
48590
  kind: "mutation",
48548
48591
  auth: "admin"
48549
48592
  }), 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
48593
  object({
48582
48594
  /** True when the upstream system considers the entity connected. */
48583
48595
  connected: boolean(),
@@ -54480,10 +54492,9 @@ var AvailableIntegrationTypeSchema = object({
54480
54492
  * locations" checkbox. Provider-declared in the addon manifest. */
54481
54493
  supportsLocationImport: boolean(),
54482
54494
  /**
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.
54495
+ * True when this integration's instances declare a Test (`integration-instances.describe().canTest`,
54496
+ * D1016). An integration that cannot be tested must say so up front rather than offering a
54497
+ * button that always answers the same nonsense.
54487
54498
  */
54488
54499
  canTest: boolean(),
54489
54500
  existingInstances: array(object({
@@ -54537,7 +54548,9 @@ var CreateIntegrationInputSchema = object({
54537
54548
  info: record(string(), unknown()).optional(),
54538
54549
  /** `stableId` of the discovery candidate the form was seeded from (D984). */
54539
54550
  originStableId: string().optional(),
54540
- settings: record(string(), unknown()).optional()
54551
+ settings: record(string(), unknown()).optional(),
54552
+ /** The instance kind being created, for a provider with several; omitted = its only testable kind. */
54553
+ kind: string().min(1).optional()
54541
54554
  });
54542
54555
  var UpdateIntegrationInputSchema = object({
54543
54556
  id: string(),
@@ -54563,13 +54576,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
54563
54576
  }), method(object({ id: string() }), DeleteIntegrationResultSchema, {
54564
54577
  kind: "mutation",
54565
54578
  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
- });
54579
+ }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" });
54573
54580
  /**
54574
54581
  * `integration-instances` - the connection of an addon that holds ONE or SEVERAL
54575
54582
  * (an account, a relay, a destination) as typed records (D985, D986). The addon's
@@ -54589,7 +54596,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
54589
54596
  * or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
54590
54597
  * clears it.
54591
54598
  */
54592
- var ConfigSchemaPassthrough$3 = custom();
54599
+ var ConfigSchemaPassthrough$2 = custom();
54593
54600
  var IntegrationInstanceIdSchema = string().min(1);
54594
54601
  var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
54595
54602
  /**
@@ -54635,7 +54642,16 @@ var IntegrationInstanceKindSchema = object({
54635
54642
  /** Relative hub path to start an interactive account link of an instance of this kind. */
54636
54643
  connectPath: string().min(1).optional(),
54637
54644
  /** Relative hub path to disconnect that account. */
54638
- disconnectPath: string().min(1).optional()
54645
+ disconnectPath: string().min(1).optional(),
54646
+ /**
54647
+ * Parts of the edit dialog the flat form cannot draw (a node picker, a model source), named by a
54648
+ * GENERIC widget id the client maps to a component; a client that knows none of them shows none.
54649
+ * `connection` widgets write connection values, `model` widgets own the model choice.
54650
+ */
54651
+ widgets: array(object({
54652
+ id: string().min(1),
54653
+ placement: _enum(["connection", "model"])
54654
+ })).optional()
54639
54655
  });
54640
54656
  /**
54641
54657
  * How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
@@ -54740,7 +54756,7 @@ var integrationInstancesCapability = {
54740
54756
  id: IntegrationInstanceIdSchema.nullable(),
54741
54757
  /** The kind of the create form (`id: null`) of a provider with several. */
54742
54758
  kind: string().min(1).optional()
54743
- }), ConfigSchemaPassthrough$3, { auth: "admin" }),
54759
+ }), ConfigSchemaPassthrough$2, { auth: "admin" }),
54744
54760
  listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
54745
54761
  getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
54746
54762
  /**
@@ -55691,12 +55707,12 @@ var LlmModelInfoSchema = object({
55691
55707
  });
55692
55708
  /**
55693
55709
  * The provider-specific part of a profile, validated by the provider that owns
55694
- * the kind (`upsertProfile` refuses what it does not accept). A field its
55710
+ * the kind (saving an instance refuses what it does not accept). A field its
55695
55711
  * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
55696
55712
  * keychain, never in the row, and reads back as the redaction marker.
55697
55713
  */
55698
55714
  var LlmProviderConfigSchema = record(string(), unknown());
55699
- var LlmProfileSchema = object({
55715
+ object({
55700
55716
  id: string(),
55701
55717
  name: string(),
55702
55718
  /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
@@ -55790,8 +55806,8 @@ var LlmProviderWidgetSchema = object({
55790
55806
  /** ConfigUISchema tree passed through untyped on the wire (the
55791
55807
  * notification-output `ConfigSchemaPassthrough` precedent at
55792
55808
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
55793
- var ConfigSchemaPassthrough$2 = unknown();
55794
- var LlmProfileKindDescriptorSchema = object({
55809
+ var ConfigSchemaPassthrough$1 = unknown();
55810
+ object({
55795
55811
  kind: LlmProfileKindSchema,
55796
55812
  label: string(),
55797
55813
  /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
@@ -55799,9 +55815,9 @@ var LlmProfileKindDescriptorSchema = object({
55799
55815
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
55800
55816
  addonId: string(),
55801
55817
  /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
55802
- connectionSchema: ConfigSchemaPassthrough$2,
55818
+ connectionSchema: ConfigSchemaPassthrough$1,
55803
55819
  /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
55804
- advancedSchema: ConfigSchemaPassthrough$2.optional(),
55820
+ advancedSchema: ConfigSchemaPassthrough$1.optional(),
55805
55821
  /** The kind's defaults; a model from `listModels` may override any of them. */
55806
55822
  features: LlmModelFeaturesSchema,
55807
55823
  /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
@@ -55930,20 +55946,7 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
55930
55946
  }), method(object({
55931
55947
  addonId: string().optional(),
55932
55948
  requestId: string()
55933
- }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
55934
- kind: "mutation",
55935
- auth: "admin"
55936
- }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
55937
- kind: "mutation",
55938
- auth: "admin"
55939
- }), method(ProfileRefInputSchema, _void(), {
55940
- kind: "mutation",
55941
- auth: "admin"
55942
- }), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
55943
- kind: "mutation",
55944
- auth: "admin",
55945
- timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
55946
- }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
55949
+ }), _void(), { kind: "mutation" }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
55947
55950
  kind: "mutation",
55948
55951
  auth: "admin"
55949
55952
  }), method(object({}), array(LlmDefaultSchema)), method(object({
@@ -56938,20 +56941,7 @@ method(_void(), MeshStatusSchema), method(object({
56938
56941
  /** Optional hostname override the host should advertise once joined. */
56939
56942
  hostname: string().optional() }), object({
56940
56943
  /** Authentication URL the operator should open in a browser. */
56941
- loginUrl: string() }), { kind: "mutation" }), method(_void(), object({ left: literal(true) }), { kind: "mutation" }), method(_void(), object({ loggedOut: literal(true) }), { kind: "mutation" }), method(_void(), object({ peers: array(MeshPeerSchema).readonly() })), method(object({
56942
- /** Optional auth key — when provided, probes the key validity
56943
- * against the provider's API. Omit when already joined to
56944
- * just ping the daemon. */
56945
- authKey: string().optional() }), object({
56946
- ok: boolean(),
56947
- /** Provider-side identifier resolved by the probe (tailnet
56948
- * name for Tailscale, network id for ZeroTier, etc.). */
56949
- tenant: string().optional(),
56950
- /** Daemon binary version, when reachable. */
56951
- daemonVersion: string().optional(),
56952
- /** Human-readable error when `ok: false`. */
56953
- error: string().optional()
56954
- }), { kind: "mutation" });
56944
+ loginUrl: string() }), { kind: "mutation" }), method(_void(), object({ left: literal(true) }), { kind: "mutation" }), method(_void(), object({ loggedOut: literal(true) }), { kind: "mutation" }), method(_void(), object({ peers: array(MeshPeerSchema).readonly() }));
56955
56945
  object({
56956
56946
  value: number().nullable().meta(readingMeta("device", { label: "Total" })),
56957
56947
  lastFetchedAt: number()
@@ -62812,13 +62802,6 @@ var AddBrokerInputSchema = object({
62812
62802
  });
62813
62803
  var AddBrokerResultSchema = object({ id: string() });
62814
62804
  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
62805
  var StartEmbeddedInputSchema = object({
62823
62806
  port: number().int().min(1).max(65535).default(1883),
62824
62807
  /** Allow anonymous connect (no username/password). Default: false. */
@@ -62841,9 +62824,6 @@ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnection
62841
62824
  }), method(IdInputSchema, _void(), {
62842
62825
  kind: "mutation",
62843
62826
  auth: "admin"
62844
- }), method(IdInputSchema, TestResultSchema$1, {
62845
- kind: "mutation",
62846
- auth: "admin"
62847
62827
  }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, {
62848
62828
  kind: "mutation",
62849
62829
  auth: "admin"
@@ -66635,61 +66615,6 @@ var oauthIntegrationCapability = {
66635
66615
  getDescriptor: method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" }) }
66636
66616
  };
66637
66617
  /**
66638
- * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
66639
- *
66640
- * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
66641
- * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
66642
- * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
66643
- * immutable after create.
66644
- */
66645
- var ConfigSchemaPassthrough$1 = unknown();
66646
- var OidcConnectionSchema = object({
66647
- id: string().min(1),
66648
- displayName: string(),
66649
- icon: string(),
66650
- issuerUrl: string(),
66651
- clientId: string(),
66652
- /** Client id + secret present — never the secret value. */
66653
- configured: boolean(),
66654
- /**
66655
- * Values for the connection form schema. `clientSecret` is a keychain
66656
- * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
66657
- */
66658
- formValues: record(string(), unknown()).optional()
66659
- });
66660
- /**
66661
- * Patch one connection. Omitted or empty `clientSecret` keeps the stored
66662
- * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
66663
- */
66664
- var OidcConnectionUpdateInputSchema = object({
66665
- id: string().min(1),
66666
- displayName: string().min(1),
66667
- icon: string().optional(),
66668
- issuerUrl: string().optional(),
66669
- clientId: string().optional(),
66670
- clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
66671
- redirectUri: string().optional(),
66672
- scopes: string().optional(),
66673
- usernameClaim: _enum([
66674
- "preferred_username",
66675
- "email",
66676
- "sub"
66677
- ]).optional()
66678
- });
66679
- method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
66680
- id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
66681
- displayName: string().min(1)
66682
- }), object({ id: string() }), {
66683
- kind: "mutation",
66684
- auth: "admin"
66685
- }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
66686
- kind: "mutation",
66687
- auth: "admin"
66688
- }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
66689
- kind: "mutation",
66690
- auth: "admin"
66691
- });
66692
- /**
66693
66618
  * Generic on-screen-display (video overlay) cap. Each camera exposes
66694
66619
  * a firmware-defined list of overlays (channel name, timestamp,
66695
66620
  * watermark, logo, …); the cap models them as a homogeneous array of
@@ -72862,21 +72787,6 @@ method(object({
72862
72787
  */
72863
72788
  ttlSec: union([number().int().positive(), literal("never")]).optional()
72864
72789
  }), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
72865
- var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
72866
- providerId: string().min(1),
72867
- displayName: string().min(1),
72868
- configSchema: unknown(),
72869
- nodeLocal: boolean(),
72870
- shouldSaveDiskSpace: literal(true),
72871
- minFreePercent: number().min(0).max(100)
72872
- }), object({
72873
- providerId: string().min(1),
72874
- displayName: string().min(1),
72875
- configSchema: unknown(),
72876
- nodeLocal: boolean(),
72877
- shouldSaveDiskSpace: literal(false),
72878
- minFreePercent: literal(null)
72879
- })]);
72880
72790
  method(object({
72881
72791
  location: StorageLocationRefSchema,
72882
72792
  relativePath: string()
@@ -72938,42 +72848,7 @@ method(object({
72938
72848
  }), _instanceof(Uint8Array), { auth: "admin" }), method(object({ downloadId: string() }), _void(), {
72939
72849
  kind: "mutation",
72940
72850
  auth: "admin"
72941
- }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(StorageLocationSchema.omit({
72942
- createdAt: true,
72943
- updatedAt: true
72944
- }), StorageLocationSchema, {
72945
- kind: "mutation",
72946
- auth: "admin"
72947
- }), method(object({
72948
- id: string(),
72949
- force: boolean().optional()
72950
- }), _void(), {
72951
- kind: "mutation",
72952
- auth: "admin"
72953
- }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
72954
- ok: boolean(),
72955
- error: string().optional()
72956
- }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
72957
- providerId: string(),
72958
- /**
72959
- * The location this config is an UNSAVED edit of, when there is one.
72960
- *
72961
- * `listLocations` replaces every declared secret with the redaction
72962
- * sentinel, so the edit modal's form state holds the sentinel for any
72963
- * credential the operator did not retype — and posting that here
72964
- * without a way to resolve it makes the provider try to authenticate
72965
- * as `__camstack_redacted__` and report the operator's own working
72966
- * password as wrong. Given this id, the orchestrator restores each
72967
- * sentinel from the stored config (same rule as `upsertLocation`)
72968
- * before dispatching. Omitted by the "Add location" wizard, where
72969
- * every value was typed just now and nothing is stored yet.
72970
- */
72971
- locationId: string().optional(),
72972
- config: record(string(), unknown())
72973
- }), object({
72974
- ok: boolean(),
72975
- error: string().optional()
72976
- }), { auth: "admin" });
72851
+ }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(_void(), array(StorageDrainProgressSchema).readonly());
72977
72852
  /** One table of the settings database. */
72978
72853
  var StorageTableSchema = object({
72979
72854
  /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
@@ -74478,7 +74353,7 @@ var TrainingProviderTypeSchema = object({
74478
74353
  label: string(),
74479
74354
  /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
74480
74355
  iconAsset: string(),
74481
- /** Owning `training-provider` addon — collection selector for createEntry. */
74356
+ /** Owning `training-provider` addon. */
74482
74357
  addonId: string(),
74483
74358
  /**
74484
74359
  * Fields for one entry of this type (credentials + defaults). Absent on a
@@ -74523,36 +74398,6 @@ var TrainingProviderDescriptorSchema = object({
74523
74398
  */
74524
74399
  formValues: record(string(), unknown()).optional()
74525
74400
  });
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
74401
  var ProviderJobStateSchema = _enum([
74557
74402
  "pending",
74558
74403
  "starting",
@@ -74600,22 +74445,6 @@ var TrainingLogLineSchema = object({
74600
74445
  text: string()
74601
74446
  });
74602
74447
  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
74448
  entryId: string().min(1),
74620
74449
  gpuType: string(),
74621
74450
  region: string(),
@@ -78001,20 +77830,6 @@ Object.freeze({
78001
77830
  access: "view",
78002
77831
  role: "admin"
78003
77832
  },
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
77833
  "connectivity.getStatus": {
78019
77834
  capName: "connectivity",
78020
77835
  capScope: "device",
@@ -80381,13 +80196,6 @@ Object.freeze({
80381
80196
  access: "view",
80382
80197
  role: "admin"
80383
80198
  },
80384
- "integrations.testConnection": {
80385
- capName: "integrations",
80386
- capScope: "system",
80387
- addonId: null,
80388
- access: "create",
80389
- role: "admin"
80390
- },
80391
80199
  "integrations.update": {
80392
80200
  capName: "integrations",
80393
80201
  capScope: "system",
@@ -80640,13 +80448,6 @@ Object.freeze({
80640
80448
  access: "delete",
80641
80449
  role: "admin"
80642
80450
  },
80643
- "llm.deleteProfile": {
80644
- capName: "llm",
80645
- capScope: "system",
80646
- addonId: null,
80647
- access: "delete",
80648
- role: "admin"
80649
- },
80650
80451
  "llm.generate": {
80651
80452
  capName: "llm",
80652
80453
  capScope: "system",
@@ -80710,20 +80511,6 @@ Object.freeze({
80710
80511
  access: "view",
80711
80512
  role: "admin"
80712
80513
  },
80713
- "llm.listProfileKinds": {
80714
- capName: "llm",
80715
- capScope: "system",
80716
- addonId: null,
80717
- access: "view",
80718
- role: "admin"
80719
- },
80720
- "llm.listProfiles": {
80721
- capName: "llm",
80722
- capScope: "system",
80723
- addonId: null,
80724
- access: "view",
80725
- role: "admin"
80726
- },
80727
80514
  "llm.listRuntimeNodes": {
80728
80515
  capName: "llm",
80729
80516
  capScope: "system",
@@ -80731,13 +80518,6 @@ Object.freeze({
80731
80518
  access: "view",
80732
80519
  role: "admin"
80733
80520
  },
80734
- "llm.migrateRawSecrets": {
80735
- capName: "llm",
80736
- capScope: "system",
80737
- addonId: null,
80738
- access: "create",
80739
- role: "admin"
80740
- },
80741
80521
  "llm.resolveModelRef": {
80742
80522
  capName: "llm",
80743
80523
  capScope: "system",
@@ -80766,20 +80546,6 @@ Object.freeze({
80766
80546
  access: "create",
80767
80547
  role: "admin"
80768
80548
  },
80769
- "llm.testProfile": {
80770
- capName: "llm",
80771
- capScope: "system",
80772
- addonId: null,
80773
- access: "create",
80774
- role: "admin"
80775
- },
80776
- "llm.upsertProfile": {
80777
- capName: "llm",
80778
- capScope: "system",
80779
- addonId: null,
80780
- access: "create",
80781
- role: "admin"
80782
- },
80783
80549
  "llmRuntime.appleAvailability": {
80784
80550
  capName: "llm-runtime",
80785
80551
  capScope: "system",
@@ -81284,13 +81050,6 @@ Object.freeze({
81284
81050
  access: "create",
81285
81051
  role: "admin"
81286
81052
  },
81287
- "meshNetwork.testConnection": {
81288
- capName: "mesh-network",
81289
- capScope: "system",
81290
- addonId: null,
81291
- access: "create",
81292
- role: "admin"
81293
- },
81294
81053
  "meter.getStatus": {
81295
81054
  capName: "meter",
81296
81055
  capScope: "device",
@@ -81620,13 +81379,6 @@ Object.freeze({
81620
81379
  access: "create",
81621
81380
  role: "admin"
81622
81381
  },
81623
- "mqttBroker.testConnection": {
81624
- capName: "mqtt-broker",
81625
- capScope: "system",
81626
- addonId: null,
81627
- access: "create",
81628
- role: "admin"
81629
- },
81630
81382
  "nativeObjectDetection.getOptions": {
81631
81383
  capName: "native-object-detection",
81632
81384
  capScope: "device",
@@ -81956,13 +81708,6 @@ Object.freeze({
81956
81708
  access: "create",
81957
81709
  role: "admin"
81958
81710
  },
81959
- "notificationOutput.deleteTarget": {
81960
- capName: "notification-output",
81961
- capScope: "system",
81962
- addonId: null,
81963
- access: "delete",
81964
- role: "admin"
81965
- },
81966
81711
  "notificationOutput.discoverTargets": {
81967
81712
  capName: "notification-output",
81968
81713
  capScope: "system",
@@ -81970,13 +81715,6 @@ Object.freeze({
81970
81715
  access: "view",
81971
81716
  role: "admin"
81972
81717
  },
81973
- "notificationOutput.getTarget": {
81974
- capName: "notification-output",
81975
- capScope: "system",
81976
- addonId: null,
81977
- access: "view",
81978
- role: "admin"
81979
- },
81980
81718
  "notificationOutput.listTargetKinds": {
81981
81719
  capName: "notification-output",
81982
81720
  capScope: "system",
@@ -81984,13 +81722,6 @@ Object.freeze({
81984
81722
  access: "view",
81985
81723
  role: "admin"
81986
81724
  },
81987
- "notificationOutput.listTargets": {
81988
- capName: "notification-output",
81989
- capScope: "system",
81990
- addonId: null,
81991
- access: "view",
81992
- role: "admin"
81993
- },
81994
81725
  "notificationOutput.probeTargetConfig": {
81995
81726
  capName: "notification-output",
81996
81727
  capScope: "system",
@@ -82005,13 +81736,6 @@ Object.freeze({
82005
81736
  access: "create",
82006
81737
  role: "admin"
82007
81738
  },
82008
- "notificationOutput.setTargetEnabled": {
82009
- capName: "notification-output",
82010
- capScope: "system",
82011
- addonId: null,
82012
- access: "create",
82013
- role: "admin"
82014
- },
82015
81739
  "notificationOutput.testTarget": {
82016
81740
  capName: "notification-output",
82017
81741
  capScope: "system",
@@ -82019,13 +81743,6 @@ Object.freeze({
82019
81743
  access: "create",
82020
81744
  role: "admin"
82021
81745
  },
82022
- "notificationOutput.upsertTarget": {
82023
- capName: "notification-output",
82024
- capScope: "system",
82025
- addonId: null,
82026
- access: "create",
82027
- role: "admin"
82028
- },
82029
81746
  "notificationRules.activateAlarmProfile": {
82030
81747
  capName: "notification-rules",
82031
81748
  capScope: "system",
@@ -82285,41 +82002,6 @@ Object.freeze({
82285
82002
  access: "view",
82286
82003
  role: "admin"
82287
82004
  },
82288
- "oidcConnections.connectionFormSchema": {
82289
- capName: "oidc-connections",
82290
- capScope: "system",
82291
- addonId: null,
82292
- access: "view",
82293
- role: "admin"
82294
- },
82295
- "oidcConnections.createConnection": {
82296
- capName: "oidc-connections",
82297
- capScope: "system",
82298
- addonId: null,
82299
- access: "create",
82300
- role: "admin"
82301
- },
82302
- "oidcConnections.deleteConnection": {
82303
- capName: "oidc-connections",
82304
- capScope: "system",
82305
- addonId: null,
82306
- access: "delete",
82307
- role: "admin"
82308
- },
82309
- "oidcConnections.listConnections": {
82310
- capName: "oidc-connections",
82311
- capScope: "system",
82312
- addonId: null,
82313
- access: "view",
82314
- role: "admin"
82315
- },
82316
- "oidcConnections.updateConnection": {
82317
- capName: "oidc-connections",
82318
- capScope: "system",
82319
- addonId: null,
82320
- access: "create",
82321
- role: "admin"
82322
- },
82323
82005
  "osd.getStatus": {
82324
82006
  capName: "osd",
82325
82007
  capScope: "device",
@@ -85351,13 +85033,6 @@ Object.freeze({
85351
85033
  access: "delete",
85352
85034
  role: "admin"
85353
85035
  },
85354
- "storage.deleteLocation": {
85355
- capName: "storage",
85356
- capScope: "system",
85357
- addonId: null,
85358
- access: "delete",
85359
- role: "admin"
85360
- },
85361
85036
  "storage.endDownload": {
85362
85037
  capName: "storage",
85363
85038
  capScope: "system",
@@ -85414,13 +85089,6 @@ Object.freeze({
85414
85089
  access: "view",
85415
85090
  role: "admin"
85416
85091
  },
85417
- "storage.listProviders": {
85418
- capName: "storage",
85419
- capScope: "system",
85420
- addonId: null,
85421
- access: "view",
85422
- role: "admin"
85423
- },
85424
85092
  "storage.read": {
85425
85093
  capName: "storage",
85426
85094
  capScope: "system",
@@ -85442,27 +85110,6 @@ Object.freeze({
85442
85110
  access: "view",
85443
85111
  role: "admin"
85444
85112
  },
85445
- "storage.testConfig": {
85446
- capName: "storage",
85447
- capScope: "system",
85448
- addonId: null,
85449
- access: "view",
85450
- role: "admin"
85451
- },
85452
- "storage.testLocation": {
85453
- capName: "storage",
85454
- capScope: "system",
85455
- addonId: null,
85456
- access: "view",
85457
- role: "admin"
85458
- },
85459
- "storage.upsertLocation": {
85460
- capName: "storage",
85461
- capScope: "system",
85462
- addonId: null,
85463
- access: "create",
85464
- role: "admin"
85465
- },
85466
85113
  "storage.write": {
85467
85114
  capName: "storage",
85468
85115
  capScope: "system",
@@ -86457,20 +86104,6 @@ Object.freeze({
86457
86104
  access: "create",
86458
86105
  role: "admin"
86459
86106
  },
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
86107
  "trainingProvider.describe": {
86475
86108
  capName: "training-provider",
86476
86109
  capScope: "system",
@@ -86541,13 +86174,6 @@ Object.freeze({
86541
86174
  access: "create",
86542
86175
  role: "admin"
86543
86176
  },
86544
- "trainingProvider.updateEntry": {
86545
- capName: "training-provider",
86546
- capScope: "system",
86547
- addonId: null,
86548
- access: "create",
86549
- role: "admin"
86550
- },
86551
86177
  "trainingProvider.uploadDataset": {
86552
86178
  capName: "training-provider",
86553
86179
  capScope: "system",
@@ -86555,13 +86181,6 @@ Object.freeze({
86555
86181
  access: "create",
86556
86182
  role: "admin"
86557
86183
  },
86558
- "trainingProvider.validateCredentials": {
86559
- capName: "training-provider",
86560
- capScope: "system",
86561
- addonId: null,
86562
- access: "create",
86563
- role: "admin"
86564
- },
86565
86184
  "turnProvider.getTurnServers": {
86566
86185
  capName: "turn-provider",
86567
86186
  capScope: "system",