@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.
@@ -74,7 +74,7 @@ function createApiDeviceGateway(deps) {
74
74
  };
75
75
  }
76
76
  //#endregion
77
- //#region ../types/dist/event-category-BmPm98n0.mjs
77
+ //#region ../types/dist/event-category-78tcBemo.mjs
78
78
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
79
79
  EventCategory["SystemBoot"] = "system.boot";
80
80
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -195,6 +195,23 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
195
195
  */
196
196
  EventCategory["AddonLoadRecovered"] = "addon.load-recovered";
197
197
  /**
198
+ * An addon is RUNNING although its installed package is below what the
199
+ * running server requires (`camstack.requires.addons` of the server, or the
200
+ * addon's own `requires.server`). Raised once per streak by the unsupported-
201
+ * addon tracker, on the hub and on agents; AlertCenter turns it into one
202
+ * operator alert per node and package. The addon is never held back for it.
203
+ *
204
+ * Payload: `{ packageName, addonId, nodeId, installedVersion, requiredMinimum, serverVersion, unmet }`.
205
+ */
206
+ EventCategory["AddonUnsupportedVersion"] = "addon.unsupported-version";
207
+ /**
208
+ * The package of an {@link AddonUnsupportedVersion} alert reached a supported
209
+ * version, or is no longer installed on the node. AlertCenter dismisses the matching alert.
210
+ *
211
+ * Payload: `{ packageName, addonId, nodeId }`.
212
+ */
213
+ EventCategory["AddonUnsupportedResolved"] = "addon.unsupported-resolved";
214
+ /**
198
215
  * Monitor scheduled the next retry for a failed addon. Transient —
199
216
  * surfaced to the UI for live-updating the "next retry in Ns"
200
217
  * countdown on the Addons page row, NOT persisted as an alert.
@@ -305,7 +322,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
305
322
  EventCategory["ProcessRestarted"] = "process.restarted";
306
323
  /**
307
324
  * The SET of storage locations changed — one was created, edited, enabled,
308
- * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
325
+ * disabled or deleted through the location instances or the forced-delete action.
309
326
  *
310
327
  * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
311
328
  * it must also converge on its own periodic path, because a dropped event
@@ -6056,7 +6073,7 @@ var ZodIssueCode = {
6056
6073
  var ZodFirstPartyTypeKind;
6057
6074
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6058
6075
  //#endregion
6059
- //#region ../types/dist/sleep-CmjWurK5.mjs
6076
+ //#region ../types/dist/sleep-AEnTN3b4.mjs
6060
6077
  /**
6061
6078
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6062
6079
  * window to float samples (D455).
@@ -6765,10 +6782,33 @@ function integrationRowsApiOver(api) {
6765
6782
  };
6766
6783
  }
6767
6784
  var PREFIX$1 = "records/";
6785
+ /**
6786
+ * Cross-realm brand. An addon bundles its own copy of this module (D15) while
6787
+ * `ctx.records` is the HOST's door, so an error thrown by the host is an
6788
+ * instance of the host's classes, not of the addon's. The brand plus the code
6789
+ * make `instanceof` answer by identity of the failure, not of the copy.
6790
+ */
6791
+ var RECORDS_ERROR_BRAND = Symbol.for("camstack.records-error");
6792
+ function carriesBrand(value) {
6793
+ return typeof value === "object" && value !== null && Reflect.get(value, RECORDS_ERROR_BRAND) === true;
6794
+ }
6768
6795
  /** The base of every records failure. `detail` is the human part of the message. */
6769
6796
  var RecordsError = class extends Error {
6797
+ /** The code a subclass stands for; the base stands for every code. */
6798
+ static code = void 0;
6799
+ /**
6800
+ * `instanceof` across copies of this module: any branded error is a
6801
+ * `RecordsError`, and is an instance of a subclass only when its code is the
6802
+ * subclass's code. Same-copy answers are unchanged.
6803
+ */
6804
+ static [Symbol.hasInstance](value) {
6805
+ if (Function.prototype[Symbol.hasInstance].call(this, value)) return true;
6806
+ if (!carriesBrand(value)) return false;
6807
+ return this.code === void 0 || value.code === this.code;
6808
+ }
6770
6809
  code;
6771
6810
  detail;
6811
+ [RECORDS_ERROR_BRAND] = true;
6772
6812
  constructor(code, detail) {
6773
6813
  super(`${PREFIX$1}${code}: ${detail}`);
6774
6814
  this.name = "RecordsError";
@@ -6777,29 +6817,33 @@ var RecordsError = class extends Error {
6777
6817
  }
6778
6818
  };
6779
6819
  /** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
6780
- var RevConflictError = class extends RecordsError {
6820
+ var RevConflictError = class RevConflictError extends RecordsError {
6821
+ static code = "rev-conflict";
6781
6822
  constructor(detail) {
6782
- super("rev-conflict", detail);
6823
+ super(RevConflictError.code, detail);
6783
6824
  this.name = "RevConflictError";
6784
6825
  }
6785
6826
  };
6786
6827
  /** The keychain could not store or serve a value: explicit, never an empty string. */
6787
- var RecordSecretUnavailableError = class extends RecordsError {
6828
+ var RecordSecretUnavailableError = class RecordSecretUnavailableError extends RecordsError {
6829
+ static code = "secret-unavailable";
6788
6830
  constructor(detail) {
6789
- super("secret-unavailable", detail);
6831
+ super(RecordSecretUnavailableError.code, detail);
6790
6832
  this.name = "RecordSecretUnavailableError";
6791
6833
  }
6792
6834
  };
6793
- var InvalidRecordError = class extends RecordsError {
6835
+ var InvalidRecordError = class InvalidRecordError extends RecordsError {
6836
+ static code = "invalid-record";
6794
6837
  constructor(detail) {
6795
- super("invalid-record", detail);
6838
+ super(InvalidRecordError.code, detail);
6796
6839
  this.name = "InvalidRecordError";
6797
6840
  }
6798
6841
  };
6799
6842
  /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
6800
- var DeclarationRefusedError = class extends RecordsError {
6843
+ var DeclarationRefusedError = class DeclarationRefusedError extends RecordsError {
6844
+ static code = "declaration-refused";
6801
6845
  constructor(detail) {
6802
- super("declaration-refused", detail);
6846
+ super(DeclarationRefusedError.code, detail);
6803
6847
  this.name = "DeclarationRefusedError";
6804
6848
  }
6805
6849
  };
@@ -7277,17 +7321,35 @@ var RecordIntegrationInstances = class {
7277
7321
  ...kind !== void 0 ? { kind } : {}
7278
7322
  });
7279
7323
  if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
7324
+ const initial = this.hooks.initialBody(name, kind);
7325
+ const patch = this.patchOf(values ?? {});
7326
+ if (Object.keys(patch).length > 0) Object.assign(patch, await this.hooks.validateWrite?.({
7327
+ kind,
7328
+ body: {
7329
+ ...initial,
7330
+ ...patch
7331
+ }
7332
+ }));
7280
7333
  await this.handle.put({
7281
7334
  id: minted,
7282
- data: this.hooks.initialBody(name, kind)
7335
+ data: initial
7283
7336
  }, { ifRev: 0 });
7284
- const patch = this.patchOf(values ?? {});
7285
7337
  if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
7286
7338
  await this.hooks.onChanged?.(minted, "created");
7287
7339
  return { id: minted };
7288
7340
  };
7289
7341
  updateInstance = async ({ id, name, values }) => {
7290
7342
  const patch = this.patchOf(values);
7343
+ if (this.hooks.validateWrite !== void 0 && Object.keys(patch).length > 0) {
7344
+ const stored = await this.handle.get(id);
7345
+ if (stored !== null) Object.assign(patch, await this.hooks.validateWrite({
7346
+ kind: void 0,
7347
+ body: {
7348
+ ...stored.data,
7349
+ ...patch
7350
+ }
7351
+ }));
7352
+ }
7291
7353
  if (name !== void 0) patch[this.nameField] = name;
7292
7354
  await this.handle.patch(id, patch);
7293
7355
  await this.hooks.onChanged?.(id, "updated");
@@ -9594,271 +9656,6 @@ function normalizeAddonInitResult(result) {
9594
9656
  if (Array.isArray(result)) return { providers: result };
9595
9657
  return result;
9596
9658
  }
9597
- /**
9598
- * The share-view scope kinds a share-link token can carry. The hub mints
9599
- * and validates them (`ShareViewGrantSchema` builds its
9600
- * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
9601
- */
9602
- var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
9603
- /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
9604
- var PeerBytesTicketSchema = object({
9605
- /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
9606
- url: string().min(1),
9607
- /**
9608
- * The HOST node this URL means something on — the hub or a named agent,
9609
- * never a runner. {@link AddonPeerBytes.open} compares it to its own and
9610
- * refuses `cross-node` by name when they differ, without dialling.
9611
- */
9612
- hostNodeId: string().min(1),
9613
- expiresAtMs: number().int().nonnegative(),
9614
- /**
9615
- * What the producer DECLARED the body to be, when it knows — `null` when it
9616
- * does not. Never `0` for unknown (D393): a consumer sizing a bound off this
9617
- * must be able to tell "the producer did not say" from "the body is empty".
9618
- */
9619
- declaredBytes: number().int().nonnegative().nullable()
9620
- });
9621
- function defOf(schema) {
9622
- const zodBag = Reflect.get(schema, "_zod");
9623
- if (typeof zodBag !== "object" || zodBag === null) return {};
9624
- const def = Reflect.get(zodBag, "def");
9625
- if (typeof def !== "object" || def === null) return {};
9626
- return def;
9627
- }
9628
- function declaredHere(schema) {
9629
- return globalRegistry.get(schema)?.secret === true;
9630
- }
9631
- /** Wrapper kinds whose `innerType` is the field itself. */
9632
- var WRAPPERS = new Set([
9633
- "optional",
9634
- "nullable",
9635
- "default",
9636
- "prefault",
9637
- "catch",
9638
- "readonly",
9639
- "nonoptional"
9640
- ]);
9641
- /**
9642
- * The schema layers that make up ONE field: the schema itself and every
9643
- * wrapper below it (optional / default / nullable / readonly / catch), plus
9644
- * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
9645
- * `.transform` on `in`).
9646
- */
9647
- function layersOf(schema) {
9648
- const out = [];
9649
- const queue = [schema];
9650
- while (queue.length > 0) {
9651
- const s = queue.shift();
9652
- if (!s || out.includes(s)) continue;
9653
- out.push(s);
9654
- const def = defOf(s);
9655
- if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
9656
- if (def.type === "pipe") {
9657
- if (def.in) queue.push(def.in);
9658
- if (def.out) queue.push(def.out);
9659
- }
9660
- }
9661
- return out;
9662
- }
9663
- /** True when any layer of this field declares `.meta({ secret: true })`. */
9664
- function isZodSecret(schema) {
9665
- return layersOf(schema).some(declaredHere);
9666
- }
9667
- /**
9668
- * Every declared secret path in a config schema: dotted keys, `[]` for "each
9669
- * element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
9670
- * map" (`applianceSecrets{}`). A declared
9671
- * object or array is reported as one path and not descended into — everything
9672
- * under it is secret.
9673
- */
9674
- function collectZodSecretPaths(schema, prefix = "") {
9675
- if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
9676
- const paths = [];
9677
- for (const layer of layersOf(schema)) {
9678
- const def = defOf(layer);
9679
- if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
9680
- else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
9681
- else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
9682
- else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
9683
- else if (def.type === "intersection") {
9684
- if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
9685
- if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
9686
- }
9687
- }
9688
- return [...new Set(paths)];
9689
- }
9690
- /**
9691
- * Record kinds (D881): the declaration an addon makes of one kind of fact, the
9692
- * Zod row schema that describes it, and the helper that turns the two into the
9693
- * JSON the engine stores.
9694
- *
9695
- * A kind is declared ONCE, next to the code that owns it, and the engine's
9696
- * reconciler creates its indexes - nothing creates DDL at runtime from a write.
9697
- * Everything the generic machinery needs (secret fields, the entry descriptor)
9698
- * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
9699
- * never a field name (D879).
9700
- */
9701
- /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
9702
- var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
9703
- var RecordIndexSchema = object({
9704
- name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
9705
- fields: array(RecordFieldPathSchema).min(1).max(4),
9706
- unique: boolean().optional()
9707
- }).strict();
9708
- var RecordRetentionSchema = union([
9709
- object({
9710
- ttlMs: number().int().positive(),
9711
- from: _enum(["at", "write"])
9712
- }).strict(),
9713
- object({
9714
- maxRows: number().int().positive().optional(),
9715
- maxRowsPerDevice: number().int().positive().optional()
9716
- }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
9717
- object({
9718
- owner: string().min(1),
9719
- reason: string().min(1)
9720
- }).strict(),
9721
- object({ none: string().min(1) }).strict()
9722
- ]);
9723
- /** The descriptor a generic entries UI reads (D881 "generic entries"). */
9724
- var EntryDescriptorSchema = object({
9725
- title: string().min(1),
9726
- /** The record body field shown as the entry's name. */
9727
- nameField: string().min(1),
9728
- /** JSON Schema of the entry body; `secret: true` marks a password field. */
9729
- fields: record(string(), unknown())
9730
- }).strict();
9731
- /** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
9732
- var RecordKindDeclarationSchema = object({
9733
- database: _enum(RECORD_DATABASES).default("settings"),
9734
- class: _enum(RECORD_CLASSES),
9735
- writeTrigger: string().min(1),
9736
- device: _enum([
9737
- "required",
9738
- "optional",
9739
- "none"
9740
- ]).default("none"),
9741
- at: _enum(["required", "none"]).default("none"),
9742
- indexes: array(RecordIndexSchema).max(8).default([]),
9743
- retention: RecordRetentionSchema,
9744
- deviceRemoval: _enum(["delete", "none"]).default("none"),
9745
- maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
9746
- /** Derived from the Zod schema; never written by hand. */
9747
- secretPaths: array(string().min(1)).default([]),
9748
- /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
9749
- secretArrayKeys: record(string(), string()).default({}),
9750
- /** Kinds that must agree through `transact` sit in one file under one family name. */
9751
- transactFamily: string().min(1).optional(),
9752
- entry: EntryDescriptorSchema.optional()
9753
- }).strict();
9754
- /** The kind names: lower-case, dash separated, short enough for an index name. */
9755
- var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
9756
- /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
9757
- function assertValidDeclaration(name, decl) {
9758
- const refuse = (why) => {
9759
- throw new DeclarationRefusedError(`kind "${name}": ${why}`);
9760
- };
9761
- if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
9762
- const seen = /* @__PURE__ */ new Set();
9763
- for (const index of decl.indexes) {
9764
- if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
9765
- seen.add(index.name);
9766
- }
9767
- const { retention } = decl;
9768
- const hasSecrets = decl.secretPaths.length > 0;
9769
- if ("ttlMs" in retention) {
9770
- if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
9771
- if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
9772
- }
9773
- if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
9774
- if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
9775
- if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
9776
- if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
9777
- const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
9778
- 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)`);
9779
- }
9780
- if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
9781
- 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`);
9782
- }
9783
- function bodyFieldsOf(schema) {
9784
- return { ...toJSONSchema(schema, {
9785
- unrepresentable: "any",
9786
- io: "input"
9787
- }) };
9788
- }
9789
- function isRecordLike(value) {
9790
- return typeof value === "object" && value !== null && !Array.isArray(value);
9791
- }
9792
- /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
9793
- function hasNameField(json, field) {
9794
- const branches = json["oneOf"] ?? json["anyOf"];
9795
- if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
9796
- const properties = json["properties"];
9797
- return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
9798
- }
9799
- /**
9800
- * Declare the kinds of a package. The keys are the kind names. The result is
9801
- * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
9802
- * types its handle from.
9803
- */
9804
- function defineRecordKinds(specs) {
9805
- const out = {};
9806
- for (const [name, spec] of Object.entries(specs)) {
9807
- const secretPaths = collectZodSecretPaths(spec.schema);
9808
- const nameField = spec.entry?.nameField ?? "name";
9809
- const fields = bodyFieldsOf(spec.schema);
9810
- if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
9811
- const parsed = RecordKindDeclarationSchema.parse({
9812
- database: spec.database,
9813
- class: spec.class,
9814
- writeTrigger: spec.writeTrigger,
9815
- device: spec.device,
9816
- at: spec.at,
9817
- indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
9818
- retention: spec.retention,
9819
- deviceRemoval: spec.deviceRemoval,
9820
- maxDataBytes: spec.maxDataBytes,
9821
- secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
9822
- secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
9823
- transactFamily: spec.transactFamily,
9824
- entry: spec.entry === void 0 ? void 0 : {
9825
- title: spec.entry.title,
9826
- nameField,
9827
- fields
9828
- }
9829
- });
9830
- assertValidDeclaration(name, parsed);
9831
- out[name] = {
9832
- name,
9833
- schema: spec.schema,
9834
- declaration: parsed
9835
- };
9836
- }
9837
- return out;
9838
- }
9839
- /**
9840
- * Declare one entry kind. An entry is configuration: never trimmed by the
9841
- * engine, never aged, belonging to no device.
9842
- */
9843
- function defineEntryKind(name, spec) {
9844
- const defined = defineRecordKinds({ [name]: {
9845
- schema: spec.schema,
9846
- class: "config",
9847
- writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
9848
- retention: { none: "an entry goes only when the operator deletes it" },
9849
- ...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
9850
- ...spec.database === void 0 ? {} : { database: spec.database },
9851
- ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
9852
- ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
9853
- ...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
9854
- entry: {
9855
- title: spec.title,
9856
- ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
9857
- }
9858
- } })[name];
9859
- if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
9860
- return defined;
9861
- }
9862
9659
  object({
9863
9660
  field: string().min(1),
9864
9661
  on: literal("advance")
@@ -9947,6 +9744,271 @@ function optionalMethod(input, output, options) {
9947
9744
  providerOptional: true
9948
9745
  };
9949
9746
  }
9747
+ function defOf(schema) {
9748
+ const zodBag = Reflect.get(schema, "_zod");
9749
+ if (typeof zodBag !== "object" || zodBag === null) return {};
9750
+ const def = Reflect.get(zodBag, "def");
9751
+ if (typeof def !== "object" || def === null) return {};
9752
+ return def;
9753
+ }
9754
+ function declaredHere(schema) {
9755
+ return globalRegistry.get(schema)?.secret === true;
9756
+ }
9757
+ /** Wrapper kinds whose `innerType` is the field itself. */
9758
+ var WRAPPERS = new Set([
9759
+ "optional",
9760
+ "nullable",
9761
+ "default",
9762
+ "prefault",
9763
+ "catch",
9764
+ "readonly",
9765
+ "nonoptional"
9766
+ ]);
9767
+ /**
9768
+ * The schema layers that make up ONE field: the schema itself and every
9769
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
9770
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
9771
+ * `.transform` on `in`).
9772
+ */
9773
+ function layersOf(schema) {
9774
+ const out = [];
9775
+ const queue = [schema];
9776
+ while (queue.length > 0) {
9777
+ const s = queue.shift();
9778
+ if (!s || out.includes(s)) continue;
9779
+ out.push(s);
9780
+ const def = defOf(s);
9781
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
9782
+ if (def.type === "pipe") {
9783
+ if (def.in) queue.push(def.in);
9784
+ if (def.out) queue.push(def.out);
9785
+ }
9786
+ }
9787
+ return out;
9788
+ }
9789
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
9790
+ function isZodSecret(schema) {
9791
+ return layersOf(schema).some(declaredHere);
9792
+ }
9793
+ /**
9794
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
9795
+ * element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
9796
+ * map" (`applianceSecrets{}`). A declared
9797
+ * object or array is reported as one path and not descended into — everything
9798
+ * under it is secret.
9799
+ */
9800
+ function collectZodSecretPaths(schema, prefix = "") {
9801
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
9802
+ const paths = [];
9803
+ for (const layer of layersOf(schema)) {
9804
+ const def = defOf(layer);
9805
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
9806
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
9807
+ else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
9808
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
9809
+ else if (def.type === "intersection") {
9810
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
9811
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
9812
+ }
9813
+ }
9814
+ return [...new Set(paths)];
9815
+ }
9816
+ /**
9817
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
9818
+ * Zod row schema that describes it, and the helper that turns the two into the
9819
+ * JSON the engine stores.
9820
+ *
9821
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
9822
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
9823
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
9824
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
9825
+ * never a field name (D879).
9826
+ */
9827
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
9828
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
9829
+ var RecordIndexSchema = object({
9830
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
9831
+ fields: array(RecordFieldPathSchema).min(1).max(4),
9832
+ unique: boolean().optional()
9833
+ }).strict();
9834
+ var RecordRetentionSchema = union([
9835
+ object({
9836
+ ttlMs: number().int().positive(),
9837
+ from: _enum(["at", "write"])
9838
+ }).strict(),
9839
+ object({
9840
+ maxRows: number().int().positive().optional(),
9841
+ maxRowsPerDevice: number().int().positive().optional()
9842
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
9843
+ object({
9844
+ owner: string().min(1),
9845
+ reason: string().min(1)
9846
+ }).strict(),
9847
+ object({ none: string().min(1) }).strict()
9848
+ ]);
9849
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
9850
+ var EntryDescriptorSchema = object({
9851
+ title: string().min(1),
9852
+ /** The record body field shown as the entry's name. */
9853
+ nameField: string().min(1),
9854
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
9855
+ fields: record(string(), unknown())
9856
+ }).strict();
9857
+ /** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
9858
+ var RecordKindDeclarationSchema = object({
9859
+ database: _enum(RECORD_DATABASES).default("settings"),
9860
+ class: _enum(RECORD_CLASSES),
9861
+ writeTrigger: string().min(1),
9862
+ device: _enum([
9863
+ "required",
9864
+ "optional",
9865
+ "none"
9866
+ ]).default("none"),
9867
+ at: _enum(["required", "none"]).default("none"),
9868
+ indexes: array(RecordIndexSchema).max(8).default([]),
9869
+ retention: RecordRetentionSchema,
9870
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
9871
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
9872
+ /** Derived from the Zod schema; never written by hand. */
9873
+ secretPaths: array(string().min(1)).default([]),
9874
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
9875
+ secretArrayKeys: record(string(), string()).default({}),
9876
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
9877
+ transactFamily: string().min(1).optional(),
9878
+ entry: EntryDescriptorSchema.optional()
9879
+ }).strict();
9880
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
9881
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
9882
+ /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
9883
+ function assertValidDeclaration(name, decl) {
9884
+ const refuse = (why) => {
9885
+ throw new DeclarationRefusedError(`kind "${name}": ${why}`);
9886
+ };
9887
+ if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
9888
+ const seen = /* @__PURE__ */ new Set();
9889
+ for (const index of decl.indexes) {
9890
+ if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
9891
+ seen.add(index.name);
9892
+ }
9893
+ const { retention } = decl;
9894
+ const hasSecrets = decl.secretPaths.length > 0;
9895
+ if ("ttlMs" in retention) {
9896
+ if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
9897
+ if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
9898
+ }
9899
+ if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
9900
+ if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
9901
+ if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
9902
+ if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
9903
+ const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
9904
+ 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)`);
9905
+ }
9906
+ if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
9907
+ 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`);
9908
+ }
9909
+ function bodyFieldsOf(schema) {
9910
+ return { ...toJSONSchema(schema, {
9911
+ unrepresentable: "any",
9912
+ io: "input"
9913
+ }) };
9914
+ }
9915
+ function isRecordLike(value) {
9916
+ return typeof value === "object" && value !== null && !Array.isArray(value);
9917
+ }
9918
+ /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
9919
+ function hasNameField(json, field) {
9920
+ const branches = json["oneOf"] ?? json["anyOf"];
9921
+ if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
9922
+ const properties = json["properties"];
9923
+ return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
9924
+ }
9925
+ /**
9926
+ * Declare the kinds of a package. The keys are the kind names. The result is
9927
+ * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
9928
+ * types its handle from.
9929
+ */
9930
+ function defineRecordKinds(specs) {
9931
+ const out = {};
9932
+ for (const [name, spec] of Object.entries(specs)) {
9933
+ const secretPaths = collectZodSecretPaths(spec.schema);
9934
+ const nameField = spec.entry?.nameField ?? "name";
9935
+ const fields = bodyFieldsOf(spec.schema);
9936
+ if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
9937
+ const parsed = RecordKindDeclarationSchema.parse({
9938
+ database: spec.database,
9939
+ class: spec.class,
9940
+ writeTrigger: spec.writeTrigger,
9941
+ device: spec.device,
9942
+ at: spec.at,
9943
+ indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
9944
+ retention: spec.retention,
9945
+ deviceRemoval: spec.deviceRemoval,
9946
+ maxDataBytes: spec.maxDataBytes,
9947
+ secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
9948
+ secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
9949
+ transactFamily: spec.transactFamily,
9950
+ entry: spec.entry === void 0 ? void 0 : {
9951
+ title: spec.entry.title,
9952
+ nameField,
9953
+ fields
9954
+ }
9955
+ });
9956
+ assertValidDeclaration(name, parsed);
9957
+ out[name] = {
9958
+ name,
9959
+ schema: spec.schema,
9960
+ declaration: parsed
9961
+ };
9962
+ }
9963
+ return out;
9964
+ }
9965
+ /**
9966
+ * Declare one entry kind. An entry is configuration: never trimmed by the
9967
+ * engine, never aged, belonging to no device.
9968
+ */
9969
+ function defineEntryKind(name, spec) {
9970
+ const defined = defineRecordKinds({ [name]: {
9971
+ schema: spec.schema,
9972
+ class: "config",
9973
+ writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
9974
+ retention: { none: "an entry goes only when the operator deletes it" },
9975
+ ...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
9976
+ ...spec.database === void 0 ? {} : { database: spec.database },
9977
+ ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
9978
+ ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
9979
+ ...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
9980
+ entry: {
9981
+ title: spec.title,
9982
+ ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
9983
+ }
9984
+ } })[name];
9985
+ if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
9986
+ return defined;
9987
+ }
9988
+ /**
9989
+ * The share-view scope kinds a share-link token can carry. The hub mints
9990
+ * and validates them (`ShareViewGrantSchema` builds its
9991
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
9992
+ */
9993
+ var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
9994
+ /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
9995
+ var PeerBytesTicketSchema = object({
9996
+ /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
9997
+ url: string().min(1),
9998
+ /**
9999
+ * The HOST node this URL means something on — the hub or a named agent,
10000
+ * never a runner. {@link AddonPeerBytes.open} compares it to its own and
10001
+ * refuses `cross-node` by name when they differ, without dialling.
10002
+ */
10003
+ hostNodeId: string().min(1),
10004
+ expiresAtMs: number().int().nonnegative(),
10005
+ /**
10006
+ * What the producer DECLARED the body to be, when it knows — `null` when it
10007
+ * does not. Never `0` for unknown (D393): a consumer sizing a bound off this
10008
+ * must be able to tell "the producer did not say" from "the body is empty".
10009
+ */
10010
+ declaredBytes: number().int().nonnegative().nullable()
10011
+ });
9950
10012
  var READING_QUANTITIES = [
9951
10013
  "temperature",
9952
10014
  "pressure",
@@ -10525,7 +10587,6 @@ var CAP_NAMES = Object.freeze([
10525
10587
  "climate-control",
10526
10588
  "color",
10527
10589
  "composer",
10528
- "connection-test",
10529
10590
  "connectivity",
10530
10591
  "consumables",
10531
10592
  "contact",
@@ -10615,7 +10676,6 @@ var CAP_NAMES = Object.freeze([
10615
10676
  "notifier",
10616
10677
  "numeric-sensor",
10617
10678
  "oauth-integration",
10618
- "oidc-connections",
10619
10679
  "osd",
10620
10680
  "osd-manager",
10621
10681
  "pet-feeder",
@@ -12507,8 +12567,7 @@ Object.freeze({
12507
12567
  "device-provider": { "reloadDevice": 18e4 },
12508
12568
  "llm": {
12509
12569
  "generate": 6e5,
12510
- "generateVision": 6e5,
12511
- "testProfile": 6e5
12570
+ "generateVision": 6e5
12512
12571
  },
12513
12572
  "llm-runtime": {
12514
12573
  "complete": 6e5,
@@ -12545,8 +12604,7 @@ Object.freeze({
12545
12604
  "offerArtifact": 3e5,
12546
12605
  "readResult": 3e5,
12547
12606
  "submitJob": 18e5,
12548
- "uploadDataset": 72e5,
12549
- "validateCredentials": 3e4
12607
+ "uploadDataset": 72e5
12550
12608
  }
12551
12609
  });
12552
12610
  object({
@@ -14018,6 +14076,414 @@ function buildCapturingReply(envelope) {
14018
14076
  };
14019
14077
  return wrapper;
14020
14078
  }
14079
+ /**
14080
+ * notification-output — canonical, capability-gated notification delivery.
14081
+ *
14082
+ * Apprise-derived model (see
14083
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14084
+ * callers emit ONE canonical `Notification`; each provider declares a
14085
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
14086
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14087
+ * message to what the kind supports — callers never special-case a service.
14088
+ *
14089
+ * DESIGN DECISIONS (locked):
14090
+ * - A target is an INSTANCE of this function cap (epic #440, step 6): the
14091
+ * providers serve their targets as `integration-instances` records, one
14092
+ * record kind per target kind, and the admin lists, adds, edits, switches
14093
+ * and deletes them through that cap. This cap keeps what an instance cannot
14094
+ * say: the kind catalogue (`listTargetKinds`: capabilities, delivery
14095
+ * parameters, brand icon), dispatch (`send`, `testTarget`) and the form
14096
+ * helpers (`discoverTargets`, `probeTargetConfig`).
14097
+ * - `listTargetKinds` / `discoverTargets` return arrays → the generated
14098
+ * cap-mount auto-`concatCollection`-fans them across every registered
14099
+ * provider so one catalog is routable. `send` / `testTarget` /
14100
+ * `probeTargetConfig` route to ONE provider by the `addonId` the generated
14101
+ * collection router extracts from the call input.
14102
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14103
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14104
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
14105
+ * base64 fallback needed.
14106
+ *
14107
+ * TODO (deferred, closed-set change — separate decision): add
14108
+ * `providerKind: 'notify'` so notification providers surface on the unified
14109
+ * admin "Integrations" page.
14110
+ */
14111
+ /**
14112
+ * Zentik-derived typed-media enum — the superset across every kind. Each
14113
+ * adapter picks what it supports and the degrade engine filters the rest.
14114
+ */
14115
+ var AttachmentMediaTypeSchema = _enum([
14116
+ "image",
14117
+ "video",
14118
+ "gif",
14119
+ "audio",
14120
+ "icon"
14121
+ ]);
14122
+ /**
14123
+ * A single attachment. Exactly one of `url` (remote source, most adapters
14124
+ * prefer this) or `bytes` (inline source; required for Pushover-style
14125
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
14126
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
14127
+ */
14128
+ var AttachmentSchema = object({
14129
+ mediaType: AttachmentMediaTypeSchema,
14130
+ url: string().optional(),
14131
+ bytes: _instanceof(Uint8Array).optional(),
14132
+ mime: string().optional(),
14133
+ name: string().optional()
14134
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14135
+ var NotificationFormatSchema = _enum([
14136
+ "text",
14137
+ "markdown",
14138
+ "html"
14139
+ ]);
14140
+ /**
14141
+ * The CLOSED icon vocabulary an action button may use.
14142
+ *
14143
+ * A closed set, not a free string, and that is the whole point: an arbitrary
14144
+ * icon name is one that ntfy renders, zentik silently drops, and nobody
14145
+ * notices — the same class of gap as a zone vocabulary nothing produced
14146
+ * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
14147
+ * declares `actionIcons: false` and the degrade engine strips the field.
14148
+ *
14149
+ * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
14150
+ * renderer's icon set; "acknowledge" survives an adapter that draws it
14151
+ * differently.
14152
+ *
14153
+ * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
14154
+ *
14155
+ * These names are for US. **No adapter may forward one verbatim.** Each maps
14156
+ * the whole set onto its own renderer's vocabulary through a
14157
+ * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
14158
+ * fallback, so adding a member here fails every adapter's build until someone
14159
+ * decides its glyph, which is the only place that decision can be made
14160
+ * honestly.
14161
+ *
14162
+ * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
14163
+ * `disarm` straight through; iOS feeds that string to
14164
+ * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
14165
+ * and every snooze and alarm button arrived BLANK. A pass-through is not a
14166
+ * mapping, and "the field is documented" is not "the value renders".
14167
+ *
14168
+ * Adding a member is TRAIN-BOUND. The enum lives in the published
14169
+ * `@camstack/server` closure and the cap seam validates against the HUB's copy,
14170
+ * so an addon that emits a token the running hub does not know does not lose an
14171
+ * icon — its whole `send` fails Zod validation and the notification never
14172
+ * arrives. Never emit a new token from an addon before the train carrying it.
14173
+ */
14174
+ var NotificationActionIconSchema = _enum([
14175
+ "acknowledge",
14176
+ "dismiss",
14177
+ "silence",
14178
+ "snooze",
14179
+ "view",
14180
+ "play",
14181
+ "open",
14182
+ "close",
14183
+ "lock",
14184
+ "unlock",
14185
+ "arm",
14186
+ "arm-home",
14187
+ "arm-away",
14188
+ "arm-night",
14189
+ "disarm",
14190
+ "light",
14191
+ "alert",
14192
+ "camera"
14193
+ ]);
14194
+ /** A single tap-through action button. */
14195
+ var NotificationActionSchema = object({
14196
+ id: string(),
14197
+ label: string(),
14198
+ url: string().optional(),
14199
+ /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
14200
+ icon: NotificationActionIconSchema.optional(),
14201
+ /**
14202
+ * Renders in a warning style where the notifier supports it.
14203
+ *
14204
+ * A HINT, never a gate. The callback's authority is its token and nothing
14205
+ * else — see `notification-center/action-token.ts` for what that does and
14206
+ * does not buy.
14207
+ */
14208
+ destructive: boolean().optional(),
14209
+ /**
14210
+ * How the tap should REACH the url.
14211
+ *
14212
+ * `navigate` (absent, and every button authored before this field) opens it:
14213
+ * the phone leaves the notification and shows whatever the callback returns.
14214
+ * That is right for a button whose answer the operator wants to read.
14215
+ *
14216
+ * `background` fires it as a POST and stays put. It exists for the buttons
14217
+ * whose whole point is not to interrupt — "silence this for 30 minutes" is
14218
+ * an answer to the notification, and being thrown into a browser tab to
14219
+ * confirm it costs more attention than the notification did. A backend that
14220
+ * cannot do a background call renders it as an ordinary link (the adapters
14221
+ * fall back rather than dropping the button), so this is a preference, never
14222
+ * a requirement.
14223
+ */
14224
+ mode: _enum(["navigate", "background"]).optional()
14225
+ });
14226
+ /** A delivery parameter value: what a notifier declared it takes. */
14227
+ var DeliveryParamValueSchema = union([
14228
+ string(),
14229
+ number(),
14230
+ boolean()
14231
+ ]);
14232
+ /**
14233
+ * One extra delivery parameter a notifier KIND declares (D938). A rule that
14234
+ * addresses a target of that kind may set it; a kind that declares nothing is
14235
+ * never handed one. The admin UI derives its control from this descriptor —
14236
+ * no editor knows a service by name.
14237
+ *
14238
+ * Optional fields are `.optional()`, never `.default()` (a Zod default does not
14239
+ * run on the addon cap path).
14240
+ */
14241
+ var DeliveryParamSchema = object({
14242
+ key: string().min(1),
14243
+ label: string(),
14244
+ /** i18n key of the label, resolved by the declaring addon's namespace. */
14245
+ labelKey: string().optional(),
14246
+ type: _enum([
14247
+ "enum",
14248
+ "number",
14249
+ "boolean",
14250
+ "string"
14251
+ ]),
14252
+ /** `enum` only: the closed set of accepted values. */
14253
+ options: array(object({
14254
+ value: string(),
14255
+ label: string()
14256
+ })).optional(),
14257
+ /** `number` only. */
14258
+ min: number().optional(),
14259
+ max: number().optional(),
14260
+ /** What the notifier does when the rule sets nothing; shown as the placeholder. */
14261
+ default: DeliveryParamValueSchema.optional()
14262
+ });
14263
+ /**
14264
+ * The canonical notification. `body` is the only hard field (Apprise model).
14265
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14266
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14267
+ * the adapter maps this ordinal onto its native level. `level?` is an
14268
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
14269
+ * `priority` for that one target.
14270
+ */
14271
+ var NotificationSchema = object({
14272
+ body: string(),
14273
+ title: string().optional(),
14274
+ format: NotificationFormatSchema.default("text"),
14275
+ priority: number().int().min(1).max(5).default(3),
14276
+ level: string().optional(),
14277
+ attachments: array(AttachmentSchema).optional(),
14278
+ clickUrl: string().optional(),
14279
+ actions: array(NotificationActionSchema).optional(),
14280
+ sound: string().optional(),
14281
+ ttl: number().optional(),
14282
+ tag: string().optional(),
14283
+ deviceId: number().optional(),
14284
+ eventId: string().optional(),
14285
+ metadata: record(string(), unknown()).optional(),
14286
+ /**
14287
+ * Values for the parameters the target's kind DECLARES in
14288
+ * {@link TargetKindSchema} `deliveryParams`. Already validated against the
14289
+ * declaration by the sender; a notifier reads only the keys it declared.
14290
+ */
14291
+ delivery: record(string(), DeliveryParamValueSchema).optional()
14292
+ });
14293
+ /** One declared native severity/priority level for a kind. */
14294
+ var TargetKindLevelSchema = object({
14295
+ id: string(),
14296
+ label: string(),
14297
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14298
+ ordinal: number().int().min(1).max(5).nullable(),
14299
+ flags: object({
14300
+ critical: boolean().optional(),
14301
+ silent: boolean().optional(),
14302
+ noPush: boolean().optional()
14303
+ }).optional(),
14304
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14305
+ requires: array(string()).optional(),
14306
+ description: string().optional()
14307
+ });
14308
+ /** The full capability block consulted before dispatch. */
14309
+ var TargetKindCapsSchema = object({
14310
+ attachments: object({
14311
+ mediaTypes: array(AttachmentMediaTypeSchema),
14312
+ mode: _enum([
14313
+ "url",
14314
+ "bytes",
14315
+ "both"
14316
+ ]),
14317
+ max: number().int().nonnegative(),
14318
+ maxBytes: number().int().positive().optional()
14319
+ }),
14320
+ /** Max action buttons (0 = none). */
14321
+ actions: number().int().nonnegative(),
14322
+ /**
14323
+ * Whether this kind renders a per-action ICON.
14324
+ *
14325
+ * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
14326
+ * run on the addon cap path — three production failures in one day taught
14327
+ * this repo that once. Absent is read as false by the degrade engine, which
14328
+ * is the safe direction: an icon that is not rendered costs nothing, an icon
14329
+ * assumed and dropped costs the operator's trust in the field.
14330
+ */
14331
+ actionIcons: boolean().optional(),
14332
+ levels: array(TargetKindLevelSchema),
14333
+ format: array(NotificationFormatSchema),
14334
+ clickUrl: boolean(),
14335
+ sound: boolean(),
14336
+ ttl: boolean(),
14337
+ bodyMaxLen: number().int().positive()
14338
+ });
14339
+ /**
14340
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14341
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14342
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14343
+ * the union is large and not meant for runtime validation here; the exported
14344
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14345
+ */
14346
+ var ConfigSchemaPassthrough$3 = unknown();
14347
+ var TargetKindSchema = object({
14348
+ kind: string(),
14349
+ label: string(),
14350
+ icon: string(),
14351
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
14352
+ addonId: string(),
14353
+ /**
14354
+ * URL of the kind's bundled BRAND icon, served by the providing addon over
14355
+ * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
14356
+ * when the addon bundles no icon for that kind — the client then falls back
14357
+ * to a neutral glyph rather than rendering the raw `icon` NAME as text.
14358
+ *
14359
+ * Root-relative on purpose: it resolves against whatever origin serves a web
14360
+ * client, and a native client joins it onto its own hub base.
14361
+ *
14362
+ * DECLARED here deliberately. It used to travel as an undeclared passthrough
14363
+ * field that survived only because the runtime cap-router forwards provider
14364
+ * output verbatim — so every consumer had to re-declare it by hand to stop
14365
+ * its own Zod parse from stripping it, and the whole arrangement would have
14366
+ * broken silently the moment output validation was tightened anywhere.
14367
+ */
14368
+ iconUrl: string().optional(),
14369
+ /**
14370
+ * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
14371
+ *
14372
+ * The server knows this and therefore says it, because the client cannot
14373
+ * safely guess: a React-Native client renders SVG and raster through two
14374
+ * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
14375
+ * not decode SVG on iOS/Android), so without this it silently fell back to a
14376
+ * placeholder glyph for every vector icon while the web build looked fine.
14377
+ *
14378
+ * Absent when {@link iconUrl} is absent, or for a legacy provider that has
14379
+ * not been updated — a client that cannot determine the type should prefer
14380
+ * its raster path, which is the safe default for an unknown image.
14381
+ */
14382
+ iconMediaType: string().optional(),
14383
+ configSchema: ConfigSchemaPassthrough$3,
14384
+ /**
14385
+ * The config keys that decide WHERE this kind's secrets are sent (server,
14386
+ * base URL, instance, chat, recipient). A save that changes any of them
14387
+ * while leaving a secret redacted is refused by the provider (D634), so an
14388
+ * editor uses this to ask for the secret on exactly those edits instead of
14389
+ * on every edit.
14390
+ *
14391
+ * Optional: absent from a provider that holds no secret (the Home Assistant
14392
+ * kinds) and from a provider older than this field — an editor that finds
14393
+ * it absent must assume ANY edit may need the secret.
14394
+ */
14395
+ destinationKeys: array(string()).optional(),
14396
+ supportsDiscovery: boolean(),
14397
+ /**
14398
+ * Extra delivery parameters a rule may set for a target of this kind (D938).
14399
+ * Absent = none; the rule editor then offers nothing.
14400
+ */
14401
+ deliveryParams: array(DeliveryParamSchema).optional(),
14402
+ caps: TargetKindCapsSchema
14403
+ });
14404
+ /**
14405
+ * A target as a provider's own code sees it (the notification-center bridge, the
14406
+ * send path): the flat record body split into the name, the switch and the
14407
+ * kind's fields. `config` holds secrets; a reader that serves it to a client
14408
+ * REDACTS secret fields (a presence marker only) — never round-trip a stored
14409
+ * secret to the UI.
14410
+ */
14411
+ var TargetSchema = object({
14412
+ id: string(),
14413
+ name: string(),
14414
+ kind: string(),
14415
+ addonId: string(),
14416
+ enabled: boolean(),
14417
+ config: record(string(), unknown())
14418
+ });
14419
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
14420
+ var DiscoveredTargetSchema = object({
14421
+ kind: string(),
14422
+ suggestedName: string(),
14423
+ config: record(string(), unknown())
14424
+ });
14425
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
14426
+ var RenderedAsSchema = object({
14427
+ level: string(),
14428
+ format: NotificationFormatSchema,
14429
+ attachmentsSent: number().int().nonnegative(),
14430
+ actionsSent: number().int().nonnegative(),
14431
+ truncated: boolean(),
14432
+ dropped: array(string())
14433
+ });
14434
+ var SendResultSchema = object({
14435
+ success: boolean(),
14436
+ error: string().optional(),
14437
+ renderedAs: RenderedAsSchema.optional()
14438
+ });
14439
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
14440
+ var TestResultSchema = SendResultSchema;
14441
+ /**
14442
+ * Pre-save credential probe against a partial (unsaved) target config.
14443
+ * `resolvedUrl` never includes secrets (token stripped from path).
14444
+ */
14445
+ var ProbeTargetConfigResultSchema = object({
14446
+ ok: boolean(),
14447
+ resolvedUrl: string(),
14448
+ httpStatus: number().int().optional(),
14449
+ stateInstance: string().optional(),
14450
+ error: string().optional()
14451
+ });
14452
+ method(object({}), array(TargetKindSchema)), method(object({
14453
+ kind: string(),
14454
+ config: record(string(), unknown()).optional(),
14455
+ /**
14456
+ * When editing / duplicating, the blank password field never round-trips
14457
+ * the stored token. Pass the source target id so the provider can restore
14458
+ * secrets server-side before dialling.
14459
+ */
14460
+ targetId: string().optional()
14461
+ }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
14462
+ kind: string(),
14463
+ config: record(string(), unknown()),
14464
+ /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
14465
+ targetId: string().optional()
14466
+ }), ProbeTargetConfigResultSchema, {
14467
+ kind: "mutation",
14468
+ auth: "admin"
14469
+ }), method(object({
14470
+ targetId: string(),
14471
+ notification: NotificationSchema
14472
+ }), SendResultSchema, {
14473
+ kind: "mutation",
14474
+ auth: "admin"
14475
+ }), method(object({
14476
+ targetId: string(),
14477
+ sample: NotificationSchema.optional()
14478
+ }), TestResultSchema, {
14479
+ kind: "mutation",
14480
+ auth: "admin"
14481
+ });
14482
+ looseObject({
14483
+ name: string().min(1),
14484
+ enabled: boolean().optional()
14485
+ });
14486
+ TargetSchema.omit({ id: true });
14021
14487
  var EncodeProfileSchema = object({
14022
14488
  video: object({
14023
14489
  codec: _enum([
@@ -22242,7 +22708,6 @@ var SYSTEM_CAP_VOCABULARY = {
22242
22708
  "calendar-source": system(INTERNAL),
22243
22709
  calendars: system("calendars feed schedules and conditions, not device actions"),
22244
22710
  composer: system("device composition — an authoring tool, not an action"),
22245
- "connection-test": system(INTERNAL),
22246
22711
  "core-blocks": system(INTERNAL),
22247
22712
  "custom-model-registry": system(ML),
22248
22713
  "data-store-provider": system(INTERNAL),
@@ -22287,7 +22752,6 @@ var SYSTEM_CAP_VOCABULARY = {
22287
22752
  "notification-output": system("notification delivery — reached through notifier devices and rules"),
22288
22753
  "notification-rules": system("notification rules — authored on their own page"),
22289
22754
  "oauth-integration": system(IDENTITY),
22290
- "oidc-connections": system(IDENTITY),
22291
22755
  "osd-manager": system(PIPELINE),
22292
22756
  "pipeline-executor": system(PIPELINE),
22293
22757
  "pipeline-orchestrator": system(PIPELINE),
@@ -44159,427 +44623,6 @@ var UnitWarningSchema = object({
44159
44623
  assumedUnit: string(),
44160
44624
  message: string()
44161
44625
  });
44162
- /**
44163
- * notification-output — canonical, capability-gated notification delivery.
44164
- *
44165
- * Apprise-derived model (see
44166
- * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
44167
- * callers emit ONE canonical `Notification`; each provider declares a
44168
- * per-kind capability descriptor (`TargetKind`), and the pure degrade
44169
- * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
44170
- * message to what the kind supports — callers never special-case a service.
44171
- *
44172
- * DESIGN DECISIONS (locked):
44173
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
44174
- * `setTargetEnabled`), each provider persisting via the `settings-store`
44175
- * cap. Rationale: the admin UI needs one uniform surface across the
44176
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
44177
- * alternative would fork the UI per addon and cannot host the
44178
- * discovery→adopt flow.
44179
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
44180
- * the generated cap-mount auto-`concatCollection`-fans them across every
44181
- * registered provider (notifiers addon + HA addon) so one catalog is
44182
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
44183
- * `addonId` the generated collection router extracts from the call input.
44184
- * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
44185
- * transformer) + UDS MsgPack both round-trip typed arrays — already used by
44186
- * `storage` / `storage-provider` / `recording` caps over the same path. No
44187
- * base64 fallback needed.
44188
- *
44189
- * TODO (deferred, closed-set change — separate decision): add
44190
- * `providerKind: 'notify'` so notification providers surface on the unified
44191
- * admin "Integrations" page.
44192
- */
44193
- /**
44194
- * Zentik-derived typed-media enum — the superset across every kind. Each
44195
- * adapter picks what it supports and the degrade engine filters the rest.
44196
- */
44197
- var AttachmentMediaTypeSchema = _enum([
44198
- "image",
44199
- "video",
44200
- "gif",
44201
- "audio",
44202
- "icon"
44203
- ]);
44204
- /**
44205
- * A single attachment. Exactly one of `url` (remote source, most adapters
44206
- * prefer this) or `bytes` (inline source; required for Pushover-style
44207
- * bytes-only kinds) MUST be present — the degrade engine expresses a
44208
- * url→bytes fetch as a `needsFetch` directive the adapter executes.
44209
- */
44210
- var AttachmentSchema = object({
44211
- mediaType: AttachmentMediaTypeSchema,
44212
- url: string().optional(),
44213
- bytes: _instanceof(Uint8Array).optional(),
44214
- mime: string().optional(),
44215
- name: string().optional()
44216
- }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
44217
- var NotificationFormatSchema = _enum([
44218
- "text",
44219
- "markdown",
44220
- "html"
44221
- ]);
44222
- /**
44223
- * The CLOSED icon vocabulary an action button may use.
44224
- *
44225
- * A closed set, not a free string, and that is the whole point: an arbitrary
44226
- * icon name is one that ntfy renders, zentik silently drops, and nobody
44227
- * notices — the same class of gap as a zone vocabulary nothing produced
44228
- * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
44229
- * declares `actionIcons: false` and the degrade engine strips the field.
44230
- *
44231
- * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
44232
- * renderer's icon set; "acknowledge" survives an adapter that draws it
44233
- * differently.
44234
- *
44235
- * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
44236
- *
44237
- * These names are for US. **No adapter may forward one verbatim.** Each maps
44238
- * the whole set onto its own renderer's vocabulary through a
44239
- * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
44240
- * fallback, so adding a member here fails every adapter's build until someone
44241
- * decides its glyph, which is the only place that decision can be made
44242
- * honestly.
44243
- *
44244
- * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
44245
- * `disarm` straight through; iOS feeds that string to
44246
- * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
44247
- * and every snooze and alarm button arrived BLANK. A pass-through is not a
44248
- * mapping, and "the field is documented" is not "the value renders".
44249
- *
44250
- * Adding a member is TRAIN-BOUND. The enum lives in the published
44251
- * `@camstack/server` closure and the cap seam validates against the HUB's copy,
44252
- * so an addon that emits a token the running hub does not know does not lose an
44253
- * icon — its whole `send` fails Zod validation and the notification never
44254
- * arrives. Never emit a new token from an addon before the train carrying it.
44255
- */
44256
- var NotificationActionIconSchema = _enum([
44257
- "acknowledge",
44258
- "dismiss",
44259
- "silence",
44260
- "snooze",
44261
- "view",
44262
- "play",
44263
- "open",
44264
- "close",
44265
- "lock",
44266
- "unlock",
44267
- "arm",
44268
- "arm-home",
44269
- "arm-away",
44270
- "arm-night",
44271
- "disarm",
44272
- "light",
44273
- "alert",
44274
- "camera"
44275
- ]);
44276
- /** A single tap-through action button. */
44277
- var NotificationActionSchema = object({
44278
- id: string(),
44279
- label: string(),
44280
- url: string().optional(),
44281
- /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
44282
- icon: NotificationActionIconSchema.optional(),
44283
- /**
44284
- * Renders in a warning style where the notifier supports it.
44285
- *
44286
- * A HINT, never a gate. The callback's authority is its token and nothing
44287
- * else — see `notification-center/action-token.ts` for what that does and
44288
- * does not buy.
44289
- */
44290
- destructive: boolean().optional(),
44291
- /**
44292
- * How the tap should REACH the url.
44293
- *
44294
- * `navigate` (absent, and every button authored before this field) opens it:
44295
- * the phone leaves the notification and shows whatever the callback returns.
44296
- * That is right for a button whose answer the operator wants to read.
44297
- *
44298
- * `background` fires it as a POST and stays put. It exists for the buttons
44299
- * whose whole point is not to interrupt — "silence this for 30 minutes" is
44300
- * an answer to the notification, and being thrown into a browser tab to
44301
- * confirm it costs more attention than the notification did. A backend that
44302
- * cannot do a background call renders it as an ordinary link (the adapters
44303
- * fall back rather than dropping the button), so this is a preference, never
44304
- * a requirement.
44305
- */
44306
- mode: _enum(["navigate", "background"]).optional()
44307
- });
44308
- /** A delivery parameter value: what a notifier declared it takes. */
44309
- var DeliveryParamValueSchema = union([
44310
- string(),
44311
- number(),
44312
- boolean()
44313
- ]);
44314
- /**
44315
- * One extra delivery parameter a notifier KIND declares (D938). A rule that
44316
- * addresses a target of that kind may set it; a kind that declares nothing is
44317
- * never handed one. The admin UI derives its control from this descriptor —
44318
- * no editor knows a service by name.
44319
- *
44320
- * Optional fields are `.optional()`, never `.default()` (a Zod default does not
44321
- * run on the addon cap path).
44322
- */
44323
- var DeliveryParamSchema = object({
44324
- key: string().min(1),
44325
- label: string(),
44326
- /** i18n key of the label, resolved by the declaring addon's namespace. */
44327
- labelKey: string().optional(),
44328
- type: _enum([
44329
- "enum",
44330
- "number",
44331
- "boolean",
44332
- "string"
44333
- ]),
44334
- /** `enum` only: the closed set of accepted values. */
44335
- options: array(object({
44336
- value: string(),
44337
- label: string()
44338
- })).optional(),
44339
- /** `number` only. */
44340
- min: number().optional(),
44341
- max: number().optional(),
44342
- /** What the notifier does when the rule sets nothing; shown as the placeholder. */
44343
- default: DeliveryParamValueSchema.optional()
44344
- });
44345
- /**
44346
- * The canonical notification. `body` is the only hard field (Apprise model).
44347
- * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
44348
- * NOT a fixed severity enum — each kind declares its own `caps.levels` and
44349
- * the adapter maps this ordinal onto its native level. `level?` is an
44350
- * optional kind-native level id (`emergency`, `silent`, …) that overrides
44351
- * `priority` for that one target.
44352
- */
44353
- var NotificationSchema = object({
44354
- body: string(),
44355
- title: string().optional(),
44356
- format: NotificationFormatSchema.default("text"),
44357
- priority: number().int().min(1).max(5).default(3),
44358
- level: string().optional(),
44359
- attachments: array(AttachmentSchema).optional(),
44360
- clickUrl: string().optional(),
44361
- actions: array(NotificationActionSchema).optional(),
44362
- sound: string().optional(),
44363
- ttl: number().optional(),
44364
- tag: string().optional(),
44365
- deviceId: number().optional(),
44366
- eventId: string().optional(),
44367
- metadata: record(string(), unknown()).optional(),
44368
- /**
44369
- * Values for the parameters the target's kind DECLARES in
44370
- * {@link TargetKindSchema} `deliveryParams`. Already validated against the
44371
- * declaration by the sender; a notifier reads only the keys it declared.
44372
- */
44373
- delivery: record(string(), DeliveryParamValueSchema).optional()
44374
- });
44375
- /** One declared native severity/priority level for a kind. */
44376
- var TargetKindLevelSchema = object({
44377
- id: string(),
44378
- label: string(),
44379
- /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
44380
- ordinal: number().int().min(1).max(5).nullable(),
44381
- flags: object({
44382
- critical: boolean().optional(),
44383
- silent: boolean().optional(),
44384
- noPush: boolean().optional()
44385
- }).optional(),
44386
- /** e.g. Pushover `emergency` requires `retry` / `expire`. */
44387
- requires: array(string()).optional(),
44388
- description: string().optional()
44389
- });
44390
- /** The full capability block consulted before dispatch. */
44391
- var TargetKindCapsSchema = object({
44392
- attachments: object({
44393
- mediaTypes: array(AttachmentMediaTypeSchema),
44394
- mode: _enum([
44395
- "url",
44396
- "bytes",
44397
- "both"
44398
- ]),
44399
- max: number().int().nonnegative(),
44400
- maxBytes: number().int().positive().optional()
44401
- }),
44402
- /** Max action buttons (0 = none). */
44403
- actions: number().int().nonnegative(),
44404
- /**
44405
- * Whether this kind renders a per-action ICON.
44406
- *
44407
- * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
44408
- * run on the addon cap path — three production failures in one day taught
44409
- * this repo that once. Absent is read as false by the degrade engine, which
44410
- * is the safe direction: an icon that is not rendered costs nothing, an icon
44411
- * assumed and dropped costs the operator's trust in the field.
44412
- */
44413
- actionIcons: boolean().optional(),
44414
- levels: array(TargetKindLevelSchema),
44415
- format: array(NotificationFormatSchema),
44416
- clickUrl: boolean(),
44417
- sound: boolean(),
44418
- ttl: boolean(),
44419
- bodyMaxLen: number().int().positive()
44420
- });
44421
- /**
44422
- * `configSchema` is a `ConfigUISchema` tree passed through to the admin
44423
- * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
44424
- * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
44425
- * the union is large and not meant for runtime validation here; the exported
44426
- * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
44427
- */
44428
- var ConfigSchemaPassthrough$4 = unknown();
44429
- var TargetKindSchema = object({
44430
- kind: string(),
44431
- label: string(),
44432
- icon: string(),
44433
- /** Stamped by each provider so the concat-fanned catalog stays routable. */
44434
- addonId: string(),
44435
- /**
44436
- * URL of the kind's bundled BRAND icon, served by the providing addon over
44437
- * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
44438
- * when the addon bundles no icon for that kind — the client then falls back
44439
- * to a neutral glyph rather than rendering the raw `icon` NAME as text.
44440
- *
44441
- * Root-relative on purpose: it resolves against whatever origin serves a web
44442
- * client, and a native client joins it onto its own hub base.
44443
- *
44444
- * DECLARED here deliberately. It used to travel as an undeclared passthrough
44445
- * field that survived only because the runtime cap-router forwards provider
44446
- * output verbatim — so every consumer had to re-declare it by hand to stop
44447
- * its own Zod parse from stripping it, and the whole arrangement would have
44448
- * broken silently the moment output validation was tightened anywhere.
44449
- */
44450
- iconUrl: string().optional(),
44451
- /**
44452
- * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
44453
- *
44454
- * The server knows this and therefore says it, because the client cannot
44455
- * safely guess: a React-Native client renders SVG and raster through two
44456
- * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
44457
- * not decode SVG on iOS/Android), so without this it silently fell back to a
44458
- * placeholder glyph for every vector icon while the web build looked fine.
44459
- *
44460
- * Absent when {@link iconUrl} is absent, or for a legacy provider that has
44461
- * not been updated — a client that cannot determine the type should prefer
44462
- * its raster path, which is the safe default for an unknown image.
44463
- */
44464
- iconMediaType: string().optional(),
44465
- configSchema: ConfigSchemaPassthrough$4,
44466
- /**
44467
- * The config keys that decide WHERE this kind's secrets are sent (server,
44468
- * base URL, instance, chat, recipient). A save that changes any of them
44469
- * while leaving a secret redacted is refused by the provider (D634), so an
44470
- * editor uses this to ask for the secret on exactly those edits instead of
44471
- * on every edit.
44472
- *
44473
- * Optional: absent from a provider that holds no secret (the Home Assistant
44474
- * kinds) and from a provider older than this field — an editor that finds
44475
- * it absent must assume ANY edit may need the secret.
44476
- */
44477
- destinationKeys: array(string()).optional(),
44478
- supportsDiscovery: boolean(),
44479
- /**
44480
- * Extra delivery parameters a rule may set for a target of this kind (D938).
44481
- * Absent = none; the rule editor then offers nothing.
44482
- */
44483
- deliveryParams: array(DeliveryParamSchema).optional(),
44484
- caps: TargetKindCapsSchema
44485
- });
44486
- /**
44487
- * A persisted target. `config` holds secrets; providers REDACT secret fields
44488
- * (return a presence marker only) when serving `listTargets` — never
44489
- * round-trip a stored secret to the UI.
44490
- */
44491
- var TargetSchema = object({
44492
- id: string(),
44493
- name: string(),
44494
- kind: string(),
44495
- addonId: string(),
44496
- enabled: boolean(),
44497
- config: record(string(), unknown())
44498
- });
44499
- /** A discovery-surfaced candidate (config is partial + non-secret). */
44500
- var DiscoveredTargetSchema = object({
44501
- kind: string(),
44502
- suggestedName: string(),
44503
- config: record(string(), unknown())
44504
- });
44505
- /** The degrade engine's report — what was resolved / dropped / degraded. */
44506
- var RenderedAsSchema = object({
44507
- level: string(),
44508
- format: NotificationFormatSchema,
44509
- attachmentsSent: number().int().nonnegative(),
44510
- actionsSent: number().int().nonnegative(),
44511
- truncated: boolean(),
44512
- dropped: array(string())
44513
- });
44514
- var SendResultSchema = object({
44515
- success: boolean(),
44516
- error: string().optional(),
44517
- renderedAs: RenderedAsSchema.optional()
44518
- });
44519
- /** Same shape as SendResult — kept as a distinct name for the test panel. */
44520
- var TestResultSchema = SendResultSchema;
44521
- /**
44522
- * Pre-save credential probe against a partial (unsaved) target config.
44523
- * `resolvedUrl` never includes secrets (token stripped from path).
44524
- */
44525
- var ProbeTargetConfigResultSchema = object({
44526
- ok: boolean(),
44527
- resolvedUrl: string(),
44528
- httpStatus: number().int().optional(),
44529
- stateInstance: string().optional(),
44530
- error: string().optional()
44531
- });
44532
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
44533
- kind: string(),
44534
- config: record(string(), unknown()).optional(),
44535
- /**
44536
- * When editing / duplicating, the blank password field never round-trips
44537
- * the stored token. Pass the source target id so the provider can restore
44538
- * secrets server-side before dialling (same merge as upsert).
44539
- */
44540
- targetId: string().optional()
44541
- }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
44542
- kind: string(),
44543
- config: record(string(), unknown()),
44544
- /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
44545
- targetId: string().optional()
44546
- }), ProbeTargetConfigResultSchema, {
44547
- kind: "mutation",
44548
- auth: "admin"
44549
- }), method(object({
44550
- targetId: string(),
44551
- notification: NotificationSchema
44552
- }), SendResultSchema, {
44553
- kind: "mutation",
44554
- auth: "admin"
44555
- }), method(object({
44556
- targetId: string(),
44557
- sample: NotificationSchema.optional()
44558
- }), TestResultSchema, {
44559
- kind: "mutation",
44560
- auth: "admin"
44561
- }), method(object({
44562
- target: TargetSchema,
44563
- /**
44564
- * Duplicate flow: create a NEW target id while copying secrets from an
44565
- * existing row. The UI never holds the stored token; blank / redacted
44566
- * password fields are restored from this source (D634 still applies if
44567
- * destinations diverge without a re-typed secret).
44568
- */
44569
- cloneSecretsFrom: string().optional()
44570
- }), TargetSchema, {
44571
- kind: "mutation",
44572
- auth: "admin"
44573
- }), method(object({ targetId: string() }), _void(), {
44574
- kind: "mutation",
44575
- auth: "admin"
44576
- }), method(object({
44577
- targetId: string(),
44578
- enabled: boolean()
44579
- }), _void(), {
44580
- kind: "mutation",
44581
- auth: "admin"
44582
- });
44583
44626
  function errorText(err) {
44584
44627
  return err instanceof Error ? err.message : String(err);
44585
44628
  }
@@ -48543,37 +48586,6 @@ method(object({
48543
48586
  kind: "mutation",
48544
48587
  auth: "admin"
48545
48588
  }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
48546
- var ConnectionTestOutcomeSchema = discriminatedUnion("outcome", [
48547
- object({
48548
- outcome: literal("validated"),
48549
- /** Round-trip of the sign-in, when the provider measured it. */
48550
- latencyMs: number().nonnegative().optional(),
48551
- /** Optional human detail worth showing next to the tick
48552
- * ("3 devices visible on this account"). */
48553
- detail: string().optional()
48554
- }).strict(),
48555
- object({
48556
- outcome: literal("rejected"),
48557
- error: string()
48558
- }).strict(),
48559
- object({
48560
- outcome: literal("inconclusive"),
48561
- error: string()
48562
- }).strict()
48563
- ]);
48564
- var ConnectionTestInputSchema = object({
48565
- /** Candidate integration settings, exactly as the create form collected them. */
48566
- settings: record(string(), unknown()) });
48567
- /**
48568
- * What the provider's test actually DOES, so the UI can say it in words before
48569
- * the operator presses the button ("Signs in to the Dreo cloud"). Purely
48570
- * descriptive — it never changes routing.
48571
- */
48572
- var ConnectionTestDescriptorSchema = object({ label: string() });
48573
- method(ConnectionTestInputSchema, ConnectionTestOutcomeSchema, {
48574
- kind: "mutation",
48575
- auth: "admin"
48576
- }), method(_void(), ConnectionTestDescriptorSchema, { auth: "admin" });
48577
48589
  object({
48578
48590
  /** True when the upstream system considers the entity connected. */
48579
48591
  connected: boolean(),
@@ -54476,10 +54488,9 @@ var AvailableIntegrationTypeSchema = object({
54476
54488
  * locations" checkbox. Provider-declared in the addon manifest. */
54477
54489
  supportsLocationImport: boolean(),
54478
54490
  /**
54479
- * True when this integration DECLARES a pre-creation test (the
54480
- * `connection-test` cap, or a broker whose settings it stores). Drives the
54481
- * Test button: an integration that cannot be tested must say so up front
54482
- * rather than offering a button that always answers the same nonsense.
54491
+ * True when this integration's instances declare a Test (`integration-instances.describe().canTest`,
54492
+ * D1016). An integration that cannot be tested must say so up front rather than offering a
54493
+ * button that always answers the same nonsense.
54483
54494
  */
54484
54495
  canTest: boolean(),
54485
54496
  existingInstances: array(object({
@@ -54533,7 +54544,9 @@ var CreateIntegrationInputSchema = object({
54533
54544
  info: record(string(), unknown()).optional(),
54534
54545
  /** `stableId` of the discovery candidate the form was seeded from (D984). */
54535
54546
  originStableId: string().optional(),
54536
- settings: record(string(), unknown()).optional()
54547
+ settings: record(string(), unknown()).optional(),
54548
+ /** The instance kind being created, for a provider with several; omitted = its only testable kind. */
54549
+ kind: string().min(1).optional()
54537
54550
  });
54538
54551
  var UpdateIntegrationInputSchema = object({
54539
54552
  id: string(),
@@ -54559,13 +54572,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
54559
54572
  }), method(object({ id: string() }), DeleteIntegrationResultSchema, {
54560
54573
  kind: "mutation",
54561
54574
  auth: "admin"
54562
- }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" }), method(object({
54563
- addonId: string(),
54564
- settings: record(string(), unknown())
54565
- }), TestConnectionResultSchema, {
54566
- kind: "mutation",
54567
- auth: "admin"
54568
- });
54575
+ }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" });
54569
54576
  /**
54570
54577
  * `integration-instances` - the connection of an addon that holds ONE or SEVERAL
54571
54578
  * (an account, a relay, a destination) as typed records (D985, D986). The addon's
@@ -54585,7 +54592,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
54585
54592
  * or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
54586
54593
  * clears it.
54587
54594
  */
54588
- var ConfigSchemaPassthrough$3 = custom();
54595
+ var ConfigSchemaPassthrough$2 = custom();
54589
54596
  var IntegrationInstanceIdSchema = string().min(1);
54590
54597
  var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
54591
54598
  /**
@@ -54631,7 +54638,16 @@ var IntegrationInstanceKindSchema = object({
54631
54638
  /** Relative hub path to start an interactive account link of an instance of this kind. */
54632
54639
  connectPath: string().min(1).optional(),
54633
54640
  /** Relative hub path to disconnect that account. */
54634
- disconnectPath: string().min(1).optional()
54641
+ disconnectPath: string().min(1).optional(),
54642
+ /**
54643
+ * Parts of the edit dialog the flat form cannot draw (a node picker, a model source), named by a
54644
+ * GENERIC widget id the client maps to a component; a client that knows none of them shows none.
54645
+ * `connection` widgets write connection values, `model` widgets own the model choice.
54646
+ */
54647
+ widgets: array(object({
54648
+ id: string().min(1),
54649
+ placement: _enum(["connection", "model"])
54650
+ })).optional()
54635
54651
  });
54636
54652
  /**
54637
54653
  * How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
@@ -54736,7 +54752,7 @@ var integrationInstancesCapability = {
54736
54752
  id: IntegrationInstanceIdSchema.nullable(),
54737
54753
  /** The kind of the create form (`id: null`) of a provider with several. */
54738
54754
  kind: string().min(1).optional()
54739
- }), ConfigSchemaPassthrough$3, { auth: "admin" }),
54755
+ }), ConfigSchemaPassthrough$2, { auth: "admin" }),
54740
54756
  listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
54741
54757
  getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
54742
54758
  /**
@@ -55687,12 +55703,12 @@ var LlmModelInfoSchema = object({
55687
55703
  });
55688
55704
  /**
55689
55705
  * The provider-specific part of a profile, validated by the provider that owns
55690
- * the kind (`upsertProfile` refuses what it does not accept). A field its
55706
+ * the kind (saving an instance refuses what it does not accept). A field its
55691
55707
  * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
55692
55708
  * keychain, never in the row, and reads back as the redaction marker.
55693
55709
  */
55694
55710
  var LlmProviderConfigSchema = record(string(), unknown());
55695
- var LlmProfileSchema = object({
55711
+ object({
55696
55712
  id: string(),
55697
55713
  name: string(),
55698
55714
  /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
@@ -55786,8 +55802,8 @@ var LlmProviderWidgetSchema = object({
55786
55802
  /** ConfigUISchema tree passed through untyped on the wire (the
55787
55803
  * notification-output `ConfigSchemaPassthrough` precedent at
55788
55804
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
55789
- var ConfigSchemaPassthrough$2 = unknown();
55790
- var LlmProfileKindDescriptorSchema = object({
55805
+ var ConfigSchemaPassthrough$1 = unknown();
55806
+ object({
55791
55807
  kind: LlmProfileKindSchema,
55792
55808
  label: string(),
55793
55809
  /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
@@ -55795,9 +55811,9 @@ var LlmProfileKindDescriptorSchema = object({
55795
55811
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
55796
55812
  addonId: string(),
55797
55813
  /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
55798
- connectionSchema: ConfigSchemaPassthrough$2,
55814
+ connectionSchema: ConfigSchemaPassthrough$1,
55799
55815
  /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
55800
- advancedSchema: ConfigSchemaPassthrough$2.optional(),
55816
+ advancedSchema: ConfigSchemaPassthrough$1.optional(),
55801
55817
  /** The kind's defaults; a model from `listModels` may override any of them. */
55802
55818
  features: LlmModelFeaturesSchema,
55803
55819
  /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
@@ -55926,20 +55942,7 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
55926
55942
  }), method(object({
55927
55943
  addonId: string().optional(),
55928
55944
  requestId: string()
55929
- }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
55930
- kind: "mutation",
55931
- auth: "admin"
55932
- }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
55933
- kind: "mutation",
55934
- auth: "admin"
55935
- }), method(ProfileRefInputSchema, _void(), {
55936
- kind: "mutation",
55937
- auth: "admin"
55938
- }), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
55939
- kind: "mutation",
55940
- auth: "admin",
55941
- timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
55942
- }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
55945
+ }), _void(), { kind: "mutation" }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
55943
55946
  kind: "mutation",
55944
55947
  auth: "admin"
55945
55948
  }), method(object({}), array(LlmDefaultSchema)), method(object({
@@ -56934,20 +56937,7 @@ method(_void(), MeshStatusSchema), method(object({
56934
56937
  /** Optional hostname override the host should advertise once joined. */
56935
56938
  hostname: string().optional() }), object({
56936
56939
  /** Authentication URL the operator should open in a browser. */
56937
- 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({
56938
- /** Optional auth key — when provided, probes the key validity
56939
- * against the provider's API. Omit when already joined to
56940
- * just ping the daemon. */
56941
- authKey: string().optional() }), object({
56942
- ok: boolean(),
56943
- /** Provider-side identifier resolved by the probe (tailnet
56944
- * name for Tailscale, network id for ZeroTier, etc.). */
56945
- tenant: string().optional(),
56946
- /** Daemon binary version, when reachable. */
56947
- daemonVersion: string().optional(),
56948
- /** Human-readable error when `ok: false`. */
56949
- error: string().optional()
56950
- }), { kind: "mutation" });
56940
+ 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() }));
56951
56941
  object({
56952
56942
  value: number().nullable().meta(readingMeta("device", { label: "Total" })),
56953
56943
  lastFetchedAt: number()
@@ -62808,13 +62798,6 @@ var AddBrokerInputSchema = object({
62808
62798
  });
62809
62799
  var AddBrokerResultSchema = object({ id: string() });
62810
62800
  var IdInputSchema = object({ id: string() });
62811
- var TestResultSchema$1 = discriminatedUnion("ok", [object({
62812
- ok: literal(true),
62813
- latencyMs: number()
62814
- }), object({
62815
- ok: literal(false),
62816
- error: string()
62817
- })]);
62818
62801
  var StartEmbeddedInputSchema = object({
62819
62802
  port: number().int().min(1).max(65535).default(1883),
62820
62803
  /** Allow anonymous connect (no username/password). Default: false. */
@@ -62837,9 +62820,6 @@ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnection
62837
62820
  }), method(IdInputSchema, _void(), {
62838
62821
  kind: "mutation",
62839
62822
  auth: "admin"
62840
- }), method(IdInputSchema, TestResultSchema$1, {
62841
- kind: "mutation",
62842
- auth: "admin"
62843
62823
  }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, {
62844
62824
  kind: "mutation",
62845
62825
  auth: "admin"
@@ -66631,61 +66611,6 @@ var oauthIntegrationCapability = {
66631
66611
  getDescriptor: method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" }) }
66632
66612
  };
66633
66613
  /**
66634
- * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
66635
- *
66636
- * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
66637
- * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
66638
- * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
66639
- * immutable after create.
66640
- */
66641
- var ConfigSchemaPassthrough$1 = unknown();
66642
- var OidcConnectionSchema = object({
66643
- id: string().min(1),
66644
- displayName: string(),
66645
- icon: string(),
66646
- issuerUrl: string(),
66647
- clientId: string(),
66648
- /** Client id + secret present — never the secret value. */
66649
- configured: boolean(),
66650
- /**
66651
- * Values for the connection form schema. `clientSecret` is a keychain
66652
- * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
66653
- */
66654
- formValues: record(string(), unknown()).optional()
66655
- });
66656
- /**
66657
- * Patch one connection. Omitted or empty `clientSecret` keeps the stored
66658
- * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
66659
- */
66660
- var OidcConnectionUpdateInputSchema = object({
66661
- id: string().min(1),
66662
- displayName: string().min(1),
66663
- icon: string().optional(),
66664
- issuerUrl: string().optional(),
66665
- clientId: string().optional(),
66666
- clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
66667
- redirectUri: string().optional(),
66668
- scopes: string().optional(),
66669
- usernameClaim: _enum([
66670
- "preferred_username",
66671
- "email",
66672
- "sub"
66673
- ]).optional()
66674
- });
66675
- method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
66676
- id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
66677
- displayName: string().min(1)
66678
- }), object({ id: string() }), {
66679
- kind: "mutation",
66680
- auth: "admin"
66681
- }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
66682
- kind: "mutation",
66683
- auth: "admin"
66684
- }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
66685
- kind: "mutation",
66686
- auth: "admin"
66687
- });
66688
- /**
66689
66614
  * Generic on-screen-display (video overlay) cap. Each camera exposes
66690
66615
  * a firmware-defined list of overlays (channel name, timestamp,
66691
66616
  * watermark, logo, …); the cap models them as a homogeneous array of
@@ -72858,21 +72783,6 @@ method(object({
72858
72783
  */
72859
72784
  ttlSec: union([number().int().positive(), literal("never")]).optional()
72860
72785
  }), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
72861
- var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
72862
- providerId: string().min(1),
72863
- displayName: string().min(1),
72864
- configSchema: unknown(),
72865
- nodeLocal: boolean(),
72866
- shouldSaveDiskSpace: literal(true),
72867
- minFreePercent: number().min(0).max(100)
72868
- }), object({
72869
- providerId: string().min(1),
72870
- displayName: string().min(1),
72871
- configSchema: unknown(),
72872
- nodeLocal: boolean(),
72873
- shouldSaveDiskSpace: literal(false),
72874
- minFreePercent: literal(null)
72875
- })]);
72876
72786
  method(object({
72877
72787
  location: StorageLocationRefSchema,
72878
72788
  relativePath: string()
@@ -72934,42 +72844,7 @@ method(object({
72934
72844
  }), _instanceof(Uint8Array), { auth: "admin" }), method(object({ downloadId: string() }), _void(), {
72935
72845
  kind: "mutation",
72936
72846
  auth: "admin"
72937
- }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(StorageLocationSchema.omit({
72938
- createdAt: true,
72939
- updatedAt: true
72940
- }), StorageLocationSchema, {
72941
- kind: "mutation",
72942
- auth: "admin"
72943
- }), method(object({
72944
- id: string(),
72945
- force: boolean().optional()
72946
- }), _void(), {
72947
- kind: "mutation",
72948
- auth: "admin"
72949
- }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
72950
- ok: boolean(),
72951
- error: string().optional()
72952
- }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
72953
- providerId: string(),
72954
- /**
72955
- * The location this config is an UNSAVED edit of, when there is one.
72956
- *
72957
- * `listLocations` replaces every declared secret with the redaction
72958
- * sentinel, so the edit modal's form state holds the sentinel for any
72959
- * credential the operator did not retype — and posting that here
72960
- * without a way to resolve it makes the provider try to authenticate
72961
- * as `__camstack_redacted__` and report the operator's own working
72962
- * password as wrong. Given this id, the orchestrator restores each
72963
- * sentinel from the stored config (same rule as `upsertLocation`)
72964
- * before dispatching. Omitted by the "Add location" wizard, where
72965
- * every value was typed just now and nothing is stored yet.
72966
- */
72967
- locationId: string().optional(),
72968
- config: record(string(), unknown())
72969
- }), object({
72970
- ok: boolean(),
72971
- error: string().optional()
72972
- }), { auth: "admin" });
72847
+ }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(_void(), array(StorageDrainProgressSchema).readonly());
72973
72848
  /** One table of the settings database. */
72974
72849
  var StorageTableSchema = object({
72975
72850
  /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
@@ -74474,7 +74349,7 @@ var TrainingProviderTypeSchema = object({
74474
74349
  label: string(),
74475
74350
  /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
74476
74351
  iconAsset: string(),
74477
- /** Owning `training-provider` addon — collection selector for createEntry. */
74352
+ /** Owning `training-provider` addon. */
74478
74353
  addonId: string(),
74479
74354
  /**
74480
74355
  * Fields for one entry of this type (credentials + defaults). Absent on a
@@ -74519,36 +74394,6 @@ var TrainingProviderDescriptorSchema = object({
74519
74394
  */
74520
74395
  formValues: record(string(), unknown()).optional()
74521
74396
  });
74522
- /**
74523
- * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
74524
- * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
74525
- * `{ $secretClear: true }` clears it.
74526
- */
74527
- var TrainingProviderUpdateEntryInputSchema = object({
74528
- entryId: string().min(1),
74529
- name: string().min(1),
74530
- tokenId: string().optional(),
74531
- tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
74532
- environment: string().optional(),
74533
- gpuType: string().optional(),
74534
- region: string().optional(),
74535
- costCapUsd: number().nonnegative().optional(),
74536
- maxRuntimeSec: number().int().positive().optional(),
74537
- failedDatasetGraceHours: number().nonnegative().optional()
74538
- });
74539
- var TrainingCredentialCheckSchema = object({
74540
- ok: boolean(),
74541
- /** Workspace / account name, when the provider says. */
74542
- account: string().optional(),
74543
- reason: _enum([
74544
- "missing",
74545
- "invalid",
74546
- "forbidden",
74547
- "network",
74548
- "quota"
74549
- ]).optional(),
74550
- detail: string().optional()
74551
- });
74552
74397
  var ProviderJobStateSchema = _enum([
74553
74398
  "pending",
74554
74399
  "starting",
@@ -74596,22 +74441,6 @@ var TrainingLogLineSchema = object({
74596
74441
  text: string()
74597
74442
  });
74598
74443
  method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
74599
- typeId: string().min(1),
74600
- name: string().min(1)
74601
- }), object({ entryId: string() }), {
74602
- kind: "mutation",
74603
- auth: "admin"
74604
- }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
74605
- kind: "mutation",
74606
- auth: "admin"
74607
- }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
74608
- kind: "mutation",
74609
- auth: "admin"
74610
- }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
74611
- kind: "mutation",
74612
- auth: "admin",
74613
- timeoutMs: 3e4
74614
- }), method(object({
74615
74444
  entryId: string().min(1),
74616
74445
  gpuType: string(),
74617
74446
  region: string(),
@@ -77997,20 +77826,6 @@ Object.freeze({
77997
77826
  access: "view",
77998
77827
  role: "admin"
77999
77828
  },
78000
- "connectionTest.describeTest": {
78001
- capName: "connection-test",
78002
- capScope: "system",
78003
- addonId: null,
78004
- access: "view",
78005
- role: "admin"
78006
- },
78007
- "connectionTest.testSettings": {
78008
- capName: "connection-test",
78009
- capScope: "system",
78010
- addonId: null,
78011
- access: "create",
78012
- role: "admin"
78013
- },
78014
77829
  "connectivity.getStatus": {
78015
77830
  capName: "connectivity",
78016
77831
  capScope: "device",
@@ -80377,13 +80192,6 @@ Object.freeze({
80377
80192
  access: "view",
80378
80193
  role: "admin"
80379
80194
  },
80380
- "integrations.testConnection": {
80381
- capName: "integrations",
80382
- capScope: "system",
80383
- addonId: null,
80384
- access: "create",
80385
- role: "admin"
80386
- },
80387
80195
  "integrations.update": {
80388
80196
  capName: "integrations",
80389
80197
  capScope: "system",
@@ -80636,13 +80444,6 @@ Object.freeze({
80636
80444
  access: "delete",
80637
80445
  role: "admin"
80638
80446
  },
80639
- "llm.deleteProfile": {
80640
- capName: "llm",
80641
- capScope: "system",
80642
- addonId: null,
80643
- access: "delete",
80644
- role: "admin"
80645
- },
80646
80447
  "llm.generate": {
80647
80448
  capName: "llm",
80648
80449
  capScope: "system",
@@ -80706,20 +80507,6 @@ Object.freeze({
80706
80507
  access: "view",
80707
80508
  role: "admin"
80708
80509
  },
80709
- "llm.listProfileKinds": {
80710
- capName: "llm",
80711
- capScope: "system",
80712
- addonId: null,
80713
- access: "view",
80714
- role: "admin"
80715
- },
80716
- "llm.listProfiles": {
80717
- capName: "llm",
80718
- capScope: "system",
80719
- addonId: null,
80720
- access: "view",
80721
- role: "admin"
80722
- },
80723
80510
  "llm.listRuntimeNodes": {
80724
80511
  capName: "llm",
80725
80512
  capScope: "system",
@@ -80727,13 +80514,6 @@ Object.freeze({
80727
80514
  access: "view",
80728
80515
  role: "admin"
80729
80516
  },
80730
- "llm.migrateRawSecrets": {
80731
- capName: "llm",
80732
- capScope: "system",
80733
- addonId: null,
80734
- access: "create",
80735
- role: "admin"
80736
- },
80737
80517
  "llm.resolveModelRef": {
80738
80518
  capName: "llm",
80739
80519
  capScope: "system",
@@ -80762,20 +80542,6 @@ Object.freeze({
80762
80542
  access: "create",
80763
80543
  role: "admin"
80764
80544
  },
80765
- "llm.testProfile": {
80766
- capName: "llm",
80767
- capScope: "system",
80768
- addonId: null,
80769
- access: "create",
80770
- role: "admin"
80771
- },
80772
- "llm.upsertProfile": {
80773
- capName: "llm",
80774
- capScope: "system",
80775
- addonId: null,
80776
- access: "create",
80777
- role: "admin"
80778
- },
80779
80545
  "llmRuntime.appleAvailability": {
80780
80546
  capName: "llm-runtime",
80781
80547
  capScope: "system",
@@ -81280,13 +81046,6 @@ Object.freeze({
81280
81046
  access: "create",
81281
81047
  role: "admin"
81282
81048
  },
81283
- "meshNetwork.testConnection": {
81284
- capName: "mesh-network",
81285
- capScope: "system",
81286
- addonId: null,
81287
- access: "create",
81288
- role: "admin"
81289
- },
81290
81049
  "meter.getStatus": {
81291
81050
  capName: "meter",
81292
81051
  capScope: "device",
@@ -81616,13 +81375,6 @@ Object.freeze({
81616
81375
  access: "create",
81617
81376
  role: "admin"
81618
81377
  },
81619
- "mqttBroker.testConnection": {
81620
- capName: "mqtt-broker",
81621
- capScope: "system",
81622
- addonId: null,
81623
- access: "create",
81624
- role: "admin"
81625
- },
81626
81378
  "nativeObjectDetection.getOptions": {
81627
81379
  capName: "native-object-detection",
81628
81380
  capScope: "device",
@@ -81952,13 +81704,6 @@ Object.freeze({
81952
81704
  access: "create",
81953
81705
  role: "admin"
81954
81706
  },
81955
- "notificationOutput.deleteTarget": {
81956
- capName: "notification-output",
81957
- capScope: "system",
81958
- addonId: null,
81959
- access: "delete",
81960
- role: "admin"
81961
- },
81962
81707
  "notificationOutput.discoverTargets": {
81963
81708
  capName: "notification-output",
81964
81709
  capScope: "system",
@@ -81966,13 +81711,6 @@ Object.freeze({
81966
81711
  access: "view",
81967
81712
  role: "admin"
81968
81713
  },
81969
- "notificationOutput.getTarget": {
81970
- capName: "notification-output",
81971
- capScope: "system",
81972
- addonId: null,
81973
- access: "view",
81974
- role: "admin"
81975
- },
81976
81714
  "notificationOutput.listTargetKinds": {
81977
81715
  capName: "notification-output",
81978
81716
  capScope: "system",
@@ -81980,13 +81718,6 @@ Object.freeze({
81980
81718
  access: "view",
81981
81719
  role: "admin"
81982
81720
  },
81983
- "notificationOutput.listTargets": {
81984
- capName: "notification-output",
81985
- capScope: "system",
81986
- addonId: null,
81987
- access: "view",
81988
- role: "admin"
81989
- },
81990
81721
  "notificationOutput.probeTargetConfig": {
81991
81722
  capName: "notification-output",
81992
81723
  capScope: "system",
@@ -82001,13 +81732,6 @@ Object.freeze({
82001
81732
  access: "create",
82002
81733
  role: "admin"
82003
81734
  },
82004
- "notificationOutput.setTargetEnabled": {
82005
- capName: "notification-output",
82006
- capScope: "system",
82007
- addonId: null,
82008
- access: "create",
82009
- role: "admin"
82010
- },
82011
81735
  "notificationOutput.testTarget": {
82012
81736
  capName: "notification-output",
82013
81737
  capScope: "system",
@@ -82015,13 +81739,6 @@ Object.freeze({
82015
81739
  access: "create",
82016
81740
  role: "admin"
82017
81741
  },
82018
- "notificationOutput.upsertTarget": {
82019
- capName: "notification-output",
82020
- capScope: "system",
82021
- addonId: null,
82022
- access: "create",
82023
- role: "admin"
82024
- },
82025
81742
  "notificationRules.activateAlarmProfile": {
82026
81743
  capName: "notification-rules",
82027
81744
  capScope: "system",
@@ -82281,41 +81998,6 @@ Object.freeze({
82281
81998
  access: "view",
82282
81999
  role: "admin"
82283
82000
  },
82284
- "oidcConnections.connectionFormSchema": {
82285
- capName: "oidc-connections",
82286
- capScope: "system",
82287
- addonId: null,
82288
- access: "view",
82289
- role: "admin"
82290
- },
82291
- "oidcConnections.createConnection": {
82292
- capName: "oidc-connections",
82293
- capScope: "system",
82294
- addonId: null,
82295
- access: "create",
82296
- role: "admin"
82297
- },
82298
- "oidcConnections.deleteConnection": {
82299
- capName: "oidc-connections",
82300
- capScope: "system",
82301
- addonId: null,
82302
- access: "delete",
82303
- role: "admin"
82304
- },
82305
- "oidcConnections.listConnections": {
82306
- capName: "oidc-connections",
82307
- capScope: "system",
82308
- addonId: null,
82309
- access: "view",
82310
- role: "admin"
82311
- },
82312
- "oidcConnections.updateConnection": {
82313
- capName: "oidc-connections",
82314
- capScope: "system",
82315
- addonId: null,
82316
- access: "create",
82317
- role: "admin"
82318
- },
82319
82001
  "osd.getStatus": {
82320
82002
  capName: "osd",
82321
82003
  capScope: "device",
@@ -85347,13 +85029,6 @@ Object.freeze({
85347
85029
  access: "delete",
85348
85030
  role: "admin"
85349
85031
  },
85350
- "storage.deleteLocation": {
85351
- capName: "storage",
85352
- capScope: "system",
85353
- addonId: null,
85354
- access: "delete",
85355
- role: "admin"
85356
- },
85357
85032
  "storage.endDownload": {
85358
85033
  capName: "storage",
85359
85034
  capScope: "system",
@@ -85410,13 +85085,6 @@ Object.freeze({
85410
85085
  access: "view",
85411
85086
  role: "admin"
85412
85087
  },
85413
- "storage.listProviders": {
85414
- capName: "storage",
85415
- capScope: "system",
85416
- addonId: null,
85417
- access: "view",
85418
- role: "admin"
85419
- },
85420
85088
  "storage.read": {
85421
85089
  capName: "storage",
85422
85090
  capScope: "system",
@@ -85438,27 +85106,6 @@ Object.freeze({
85438
85106
  access: "view",
85439
85107
  role: "admin"
85440
85108
  },
85441
- "storage.testConfig": {
85442
- capName: "storage",
85443
- capScope: "system",
85444
- addonId: null,
85445
- access: "view",
85446
- role: "admin"
85447
- },
85448
- "storage.testLocation": {
85449
- capName: "storage",
85450
- capScope: "system",
85451
- addonId: null,
85452
- access: "view",
85453
- role: "admin"
85454
- },
85455
- "storage.upsertLocation": {
85456
- capName: "storage",
85457
- capScope: "system",
85458
- addonId: null,
85459
- access: "create",
85460
- role: "admin"
85461
- },
85462
85109
  "storage.write": {
85463
85110
  capName: "storage",
85464
85111
  capScope: "system",
@@ -86453,20 +86100,6 @@ Object.freeze({
86453
86100
  access: "create",
86454
86101
  role: "admin"
86455
86102
  },
86456
- "trainingProvider.createEntry": {
86457
- capName: "training-provider",
86458
- capScope: "system",
86459
- addonId: null,
86460
- access: "create",
86461
- role: "admin"
86462
- },
86463
- "trainingProvider.deleteEntry": {
86464
- capName: "training-provider",
86465
- capScope: "system",
86466
- addonId: null,
86467
- access: "delete",
86468
- role: "admin"
86469
- },
86470
86103
  "trainingProvider.describe": {
86471
86104
  capName: "training-provider",
86472
86105
  capScope: "system",
@@ -86537,13 +86170,6 @@ Object.freeze({
86537
86170
  access: "create",
86538
86171
  role: "admin"
86539
86172
  },
86540
- "trainingProvider.updateEntry": {
86541
- capName: "training-provider",
86542
- capScope: "system",
86543
- addonId: null,
86544
- access: "create",
86545
- role: "admin"
86546
- },
86547
86173
  "trainingProvider.uploadDataset": {
86548
86174
  capName: "training-provider",
86549
86175
  capScope: "system",
@@ -86551,13 +86177,6 @@ Object.freeze({
86551
86177
  access: "create",
86552
86178
  role: "admin"
86553
86179
  },
86554
- "trainingProvider.validateCredentials": {
86555
- capName: "training-provider",
86556
- capScope: "system",
86557
- addonId: null,
86558
- access: "create",
86559
- role: "admin"
86560
- },
86561
86180
  "turnProvider.getTurnServers": {
86562
86181
  capName: "turn-provider",
86563
86182
  capScope: "system",