@camstack/addon-pipeline-orchestrator 1.2.663 → 1.2.665
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/_stub.js +246 -246
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-CbbVC-1B.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-B7k80ISv.mjs} +3 -3
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DfqFDwlL.mjs +26 -0
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DxiHs-74.mjs +26 -0
- package/dist/{hostInit-BQJRnhiE.mjs → hostInit-Bk7YaEnm.mjs} +3 -3
- package/dist/index.js +1357 -1277
- package/dist/index.mjs +1357 -1277
- package/dist/remoteEntry.js +1 -1
- package/package.json +2 -2
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-r0TW-BbW.mjs +0 -26
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DkP-6xmg.mjs +0 -26
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { createHash, randomUUID } from "node:crypto";
|
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
//#region ../types/dist/event-category-
|
|
5
|
+
//#region ../types/dist/event-category-78tcBemo.mjs
|
|
6
6
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
7
7
|
EventCategory["SystemBoot"] = "system.boot";
|
|
8
8
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -123,6 +123,23 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
123
123
|
*/
|
|
124
124
|
EventCategory["AddonLoadRecovered"] = "addon.load-recovered";
|
|
125
125
|
/**
|
|
126
|
+
* An addon is RUNNING although its installed package is below what the
|
|
127
|
+
* running server requires (`camstack.requires.addons` of the server, or the
|
|
128
|
+
* addon's own `requires.server`). Raised once per streak by the unsupported-
|
|
129
|
+
* addon tracker, on the hub and on agents; AlertCenter turns it into one
|
|
130
|
+
* operator alert per node and package. The addon is never held back for it.
|
|
131
|
+
*
|
|
132
|
+
* Payload: `{ packageName, addonId, nodeId, installedVersion, requiredMinimum, serverVersion, unmet }`.
|
|
133
|
+
*/
|
|
134
|
+
EventCategory["AddonUnsupportedVersion"] = "addon.unsupported-version";
|
|
135
|
+
/**
|
|
136
|
+
* The package of an {@link AddonUnsupportedVersion} alert reached a supported
|
|
137
|
+
* version, or is no longer installed on the node. AlertCenter dismisses the matching alert.
|
|
138
|
+
*
|
|
139
|
+
* Payload: `{ packageName, addonId, nodeId }`.
|
|
140
|
+
*/
|
|
141
|
+
EventCategory["AddonUnsupportedResolved"] = "addon.unsupported-resolved";
|
|
142
|
+
/**
|
|
126
143
|
* Monitor scheduled the next retry for a failed addon. Transient —
|
|
127
144
|
* surfaced to the UI for live-updating the "next retry in Ns"
|
|
128
145
|
* countdown on the Addons page row, NOT persisted as an alert.
|
|
@@ -233,7 +250,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
233
250
|
EventCategory["ProcessRestarted"] = "process.restarted";
|
|
234
251
|
/**
|
|
235
252
|
* The SET of storage locations changed — one was created, edited, enabled,
|
|
236
|
-
* disabled or deleted through
|
|
253
|
+
* disabled or deleted through the location instances or the forced-delete action.
|
|
237
254
|
*
|
|
238
255
|
* Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
|
|
239
256
|
* it must also converge on its own periodic path, because a dropped event
|
|
@@ -5984,7 +6001,7 @@ var ZodIssueCode = {
|
|
|
5984
6001
|
var ZodFirstPartyTypeKind;
|
|
5985
6002
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5986
6003
|
//#endregion
|
|
5987
|
-
//#region ../types/dist/sleep-
|
|
6004
|
+
//#region ../types/dist/sleep-CQP-REJp.mjs
|
|
5988
6005
|
/**
|
|
5989
6006
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5990
6007
|
* window to float samples (D455).
|
|
@@ -6341,6 +6358,59 @@ Object.fromEntries([
|
|
|
6341
6358
|
function isValuelessField(field) {
|
|
6342
6359
|
return field.type === "separator" || field.type === "info" || field.type === "qr-code" || field.type === "button" || field.type === "object-array" || field.type === "widget" || field.type === "addon-action-button" || field.type === "device-action-button" || field.type === "account-sign-in" || field.type === "secret-presence";
|
|
6343
6360
|
}
|
|
6361
|
+
/**
|
|
6362
|
+
* Base collector: flatten a hydrated `ConfigUISchemaWithValues` into
|
|
6363
|
+
* `key → { value, default }`, recursing through `group` and `sub-tabs`
|
|
6364
|
+
* layout fields. Keeping `value` and `default` SEPARATE (rather than
|
|
6365
|
+
* pre-resolving) lets callers both read the effective value AND detect
|
|
6366
|
+
* overrides (`value` differs from `default`). Structural over `unknown`;
|
|
6367
|
+
* malformed input yields an empty map, never throws.
|
|
6368
|
+
*/
|
|
6369
|
+
function collectHydratedFieldEntries(schema) {
|
|
6370
|
+
const out = /* @__PURE__ */ new Map();
|
|
6371
|
+
if (typeof schema !== "object" || schema === null) return out;
|
|
6372
|
+
const sections = schema.sections;
|
|
6373
|
+
if (!Array.isArray(sections)) return out;
|
|
6374
|
+
for (const section of sections) if (typeof section === "object" && section !== null) collectFieldEntriesInto(section.fields, out);
|
|
6375
|
+
return out;
|
|
6376
|
+
}
|
|
6377
|
+
/** Recursive field walker for {@link collectHydratedFieldEntries}. */
|
|
6378
|
+
function collectFieldEntriesInto(fields, into) {
|
|
6379
|
+
if (!Array.isArray(fields)) return;
|
|
6380
|
+
for (const field of fields) {
|
|
6381
|
+
if (typeof field !== "object" || field === null) continue;
|
|
6382
|
+
const type = field.type;
|
|
6383
|
+
if (type === "group") {
|
|
6384
|
+
collectFieldEntriesInto(field.fields, into);
|
|
6385
|
+
continue;
|
|
6386
|
+
}
|
|
6387
|
+
if (type === "sub-tabs") {
|
|
6388
|
+
const tabs = field.tabs;
|
|
6389
|
+
if (Array.isArray(tabs)) {
|
|
6390
|
+
for (const tab of tabs) if (typeof tab === "object" && tab !== null) collectFieldEntriesInto(tab.fields, into);
|
|
6391
|
+
}
|
|
6392
|
+
continue;
|
|
6393
|
+
}
|
|
6394
|
+
const key = field.key;
|
|
6395
|
+
if (typeof key !== "string" || key.length === 0) continue;
|
|
6396
|
+
if (!("value" in field)) continue;
|
|
6397
|
+
into.set(key, {
|
|
6398
|
+
value: field.value,
|
|
6399
|
+
default: field.default
|
|
6400
|
+
});
|
|
6401
|
+
}
|
|
6402
|
+
}
|
|
6403
|
+
/**
|
|
6404
|
+
* Flatten a hydrated settings payload into `key → EFFECTIVE value`
|
|
6405
|
+
* (`value ?? default`). The read-side inverse of `hydrateSchema` for the
|
|
6406
|
+
* common "just give me the resolved values" case. Built on
|
|
6407
|
+
* {@link collectHydratedFieldEntries}.
|
|
6408
|
+
*/
|
|
6409
|
+
function collectHydratedFieldValues(schema) {
|
|
6410
|
+
const out = /* @__PURE__ */ new Map();
|
|
6411
|
+
for (const [key, entry] of collectHydratedFieldEntries(schema)) out.set(key, entry.value ?? entry.default);
|
|
6412
|
+
return out;
|
|
6413
|
+
}
|
|
6344
6414
|
function hydrateSchema(schema, values, options = {}) {
|
|
6345
6415
|
return {
|
|
6346
6416
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
@@ -6677,6 +6747,344 @@ async function runAddonMigrations(host, migrations, logger, options = {}) {
|
|
|
6677
6747
|
blockOwner
|
|
6678
6748
|
};
|
|
6679
6749
|
}
|
|
6750
|
+
/** The record calls the one-switch migration makes, over the migration API. */
|
|
6751
|
+
function switchRecordsOverMigrationApi(api) {
|
|
6752
|
+
return { kind: (definition) => {
|
|
6753
|
+
const handle = api.records.kind(definition);
|
|
6754
|
+
return {
|
|
6755
|
+
get: (id) => handle.get({ id }),
|
|
6756
|
+
put: (input, opts) => handle.put({
|
|
6757
|
+
...input,
|
|
6758
|
+
...opts?.ifRev === void 0 ? {} : { ifRev: opts.ifRev }
|
|
6759
|
+
}),
|
|
6760
|
+
patch: (id, partial) => handle.patch({
|
|
6761
|
+
id,
|
|
6762
|
+
partial
|
|
6763
|
+
})
|
|
6764
|
+
};
|
|
6765
|
+
} };
|
|
6766
|
+
}
|
|
6767
|
+
function integrationRowsApiOver(api) {
|
|
6768
|
+
return {
|
|
6769
|
+
list: async () => (await api.integrations.list({})).integrations,
|
|
6770
|
+
readLegacyIntegrationRows: (input) => api.legacyRows.read(input),
|
|
6771
|
+
clearLegacyIntegrationRows: (input) => api.legacyRows.clear(input)
|
|
6772
|
+
};
|
|
6773
|
+
}
|
|
6774
|
+
var PREFIX = "records/";
|
|
6775
|
+
/**
|
|
6776
|
+
* Cross-realm brand. An addon bundles its own copy of this module (D15) while
|
|
6777
|
+
* `ctx.records` is the HOST's door, so an error thrown by the host is an
|
|
6778
|
+
* instance of the host's classes, not of the addon's. The brand plus the code
|
|
6779
|
+
* make `instanceof` answer by identity of the failure, not of the copy.
|
|
6780
|
+
*/
|
|
6781
|
+
var RECORDS_ERROR_BRAND = Symbol.for("camstack.records-error");
|
|
6782
|
+
function carriesBrand(value) {
|
|
6783
|
+
return typeof value === "object" && value !== null && Reflect.get(value, RECORDS_ERROR_BRAND) === true;
|
|
6784
|
+
}
|
|
6785
|
+
/** The base of every records failure. `detail` is the human part of the message. */
|
|
6786
|
+
var RecordsError = class extends Error {
|
|
6787
|
+
/** The code a subclass stands for; the base stands for every code. */
|
|
6788
|
+
static code = void 0;
|
|
6789
|
+
/**
|
|
6790
|
+
* `instanceof` across copies of this module: any branded error is a
|
|
6791
|
+
* `RecordsError`, and is an instance of a subclass only when its code is the
|
|
6792
|
+
* subclass's code. Same-copy answers are unchanged.
|
|
6793
|
+
*/
|
|
6794
|
+
static [Symbol.hasInstance](value) {
|
|
6795
|
+
if (Function.prototype[Symbol.hasInstance].call(this, value)) return true;
|
|
6796
|
+
if (!carriesBrand(value)) return false;
|
|
6797
|
+
return this.code === void 0 || value.code === this.code;
|
|
6798
|
+
}
|
|
6799
|
+
code;
|
|
6800
|
+
detail;
|
|
6801
|
+
[RECORDS_ERROR_BRAND] = true;
|
|
6802
|
+
constructor(code, detail) {
|
|
6803
|
+
super(`${PREFIX}${code}: ${detail}`);
|
|
6804
|
+
this.name = "RecordsError";
|
|
6805
|
+
this.code = code;
|
|
6806
|
+
this.detail = detail;
|
|
6807
|
+
}
|
|
6808
|
+
};
|
|
6809
|
+
var InvalidRecordError = class InvalidRecordError extends RecordsError {
|
|
6810
|
+
static code = "invalid-record";
|
|
6811
|
+
constructor(detail) {
|
|
6812
|
+
super(InvalidRecordError.code, detail);
|
|
6813
|
+
this.name = "InvalidRecordError";
|
|
6814
|
+
}
|
|
6815
|
+
};
|
|
6816
|
+
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
6817
|
+
var DeclarationRefusedError = class DeclarationRefusedError extends RecordsError {
|
|
6818
|
+
static code = "declaration-refused";
|
|
6819
|
+
constructor(detail) {
|
|
6820
|
+
super(DeclarationRefusedError.code, detail);
|
|
6821
|
+
this.name = "DeclarationRefusedError";
|
|
6822
|
+
}
|
|
6823
|
+
};
|
|
6824
|
+
object({
|
|
6825
|
+
cap: string().min(1),
|
|
6826
|
+
kind: string().min(1).optional()
|
|
6827
|
+
});
|
|
6828
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
6829
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6830
|
+
function globalSecretScope() {
|
|
6831
|
+
return GLOBAL_SCOPE;
|
|
6832
|
+
}
|
|
6833
|
+
function encodeSegment(value) {
|
|
6834
|
+
return encodeURIComponent(value);
|
|
6835
|
+
}
|
|
6836
|
+
function decodeSegment(value) {
|
|
6837
|
+
try {
|
|
6838
|
+
return decodeURIComponent(value);
|
|
6839
|
+
} catch {
|
|
6840
|
+
return null;
|
|
6841
|
+
}
|
|
6842
|
+
}
|
|
6843
|
+
/**
|
|
6844
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
6845
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6846
|
+
* `providers[authentik].clientSecret`.
|
|
6847
|
+
*/
|
|
6848
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6849
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6850
|
+
}
|
|
6851
|
+
function parseScope(segments) {
|
|
6852
|
+
switch (segments[0]) {
|
|
6853
|
+
case "global": return {
|
|
6854
|
+
scope: GLOBAL_SCOPE,
|
|
6855
|
+
used: 1
|
|
6856
|
+
};
|
|
6857
|
+
case "node": {
|
|
6858
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6859
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6860
|
+
scope: {
|
|
6861
|
+
kind: "node",
|
|
6862
|
+
nodeId
|
|
6863
|
+
},
|
|
6864
|
+
used: 2
|
|
6865
|
+
};
|
|
6866
|
+
}
|
|
6867
|
+
case "device": {
|
|
6868
|
+
const raw = segments[1];
|
|
6869
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6870
|
+
return {
|
|
6871
|
+
scope: {
|
|
6872
|
+
kind: "device",
|
|
6873
|
+
deviceId: Number(raw)
|
|
6874
|
+
},
|
|
6875
|
+
used: 2
|
|
6876
|
+
};
|
|
6877
|
+
}
|
|
6878
|
+
case "integration": {
|
|
6879
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6880
|
+
return id === null || id.length === 0 ? null : {
|
|
6881
|
+
scope: {
|
|
6882
|
+
kind: "integration",
|
|
6883
|
+
integrationId: id
|
|
6884
|
+
},
|
|
6885
|
+
used: 2
|
|
6886
|
+
};
|
|
6887
|
+
}
|
|
6888
|
+
case "row": {
|
|
6889
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6890
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6891
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6892
|
+
return {
|
|
6893
|
+
scope: {
|
|
6894
|
+
kind: "row",
|
|
6895
|
+
collection,
|
|
6896
|
+
rowId
|
|
6897
|
+
},
|
|
6898
|
+
used: 3
|
|
6899
|
+
};
|
|
6900
|
+
}
|
|
6901
|
+
default: return null;
|
|
6902
|
+
}
|
|
6903
|
+
}
|
|
6904
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6905
|
+
function parseSecretRef(ref) {
|
|
6906
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6907
|
+
const segments = ref.slice(9).split("/");
|
|
6908
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6909
|
+
if (owner === null || owner.length === 0) return null;
|
|
6910
|
+
const parsed = parseScope(segments.slice(1));
|
|
6911
|
+
if (parsed === null) return null;
|
|
6912
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6913
|
+
if (fieldPath.length === 0) return null;
|
|
6914
|
+
return {
|
|
6915
|
+
owner,
|
|
6916
|
+
scope: parsed.scope,
|
|
6917
|
+
fieldPath
|
|
6918
|
+
};
|
|
6919
|
+
}
|
|
6920
|
+
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
6921
|
+
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
6922
|
+
var RECORD_DATABASES = ["settings", "events"];
|
|
6923
|
+
/** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
|
|
6924
|
+
var RECORD_CLASSES = [
|
|
6925
|
+
"config",
|
|
6926
|
+
"ledger",
|
|
6927
|
+
"audit",
|
|
6928
|
+
"mirror",
|
|
6929
|
+
"ephemeral"
|
|
6930
|
+
];
|
|
6931
|
+
var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
6932
|
+
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
6933
|
+
var RECORD_BATCH_MAX = 1e3;
|
|
6934
|
+
var RECORD_QUERY_MAX = 1e3;
|
|
6935
|
+
/** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
|
|
6936
|
+
var RECORD_SETTINGS_MAX_ROWS = 5e4;
|
|
6937
|
+
/**
|
|
6938
|
+
* Secret fields of a record, addressed the way a Zod schema declares them
|
|
6939
|
+
* (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
|
|
6940
|
+
* (`auth.accessToken`, `headers[].value`).
|
|
6941
|
+
*
|
|
6942
|
+
* `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
|
|
6943
|
+
* names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
|
|
6944
|
+
* key releases exactly that key's secret.
|
|
6945
|
+
*
|
|
6946
|
+
* Array elements are matched by a DECLARED id key (`secretArrayKeys`:
|
|
6947
|
+
* `{ headers: 'name' }`), never by index, so reordering a list keeps every
|
|
6948
|
+
* keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
|
|
6949
|
+
* leaf names its element: `headers[X-Api].value`.
|
|
6950
|
+
*
|
|
6951
|
+
* Pure and browser-safe. Nothing here mutates: every transform returns a new value.
|
|
6952
|
+
*/
|
|
6953
|
+
/** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
|
|
6954
|
+
function parseSecretPath(path) {
|
|
6955
|
+
if (path.length === 0) throw new InvalidRecordError("an empty secret path");
|
|
6956
|
+
return path.split(".").map((raw) => {
|
|
6957
|
+
const each = raw.endsWith("[]");
|
|
6958
|
+
const map = raw.endsWith("{}");
|
|
6959
|
+
const key = each || map ? raw.slice(0, -2) : raw;
|
|
6960
|
+
if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
|
|
6961
|
+
return {
|
|
6962
|
+
key,
|
|
6963
|
+
each,
|
|
6964
|
+
map
|
|
6965
|
+
};
|
|
6966
|
+
});
|
|
6967
|
+
}
|
|
6968
|
+
/** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
|
|
6969
|
+
function secretArrayPrefixes(path) {
|
|
6970
|
+
const segments = parseSecretPath(path);
|
|
6971
|
+
const prefixes = [];
|
|
6972
|
+
const walked = [];
|
|
6973
|
+
for (const segment of segments) {
|
|
6974
|
+
walked.push(segment.key);
|
|
6975
|
+
if (segment.each) prefixes.push(walked.join("."));
|
|
6976
|
+
}
|
|
6977
|
+
return prefixes;
|
|
6978
|
+
}
|
|
6979
|
+
/** The body key of the switch; only {@link RecordIntegrationInstances.setInstanceEnabled} writes it. */
|
|
6980
|
+
var SWITCH_KEY = "enabled";
|
|
6981
|
+
/**
|
|
6982
|
+
* The one-switch migration (epic #440, step 3). An integration's on/off state used to live in the
|
|
6983
|
+
* registry's `enabled` column for a device addon; it now lives only in the instance record's
|
|
6984
|
+
* body (`enabled`, D1007 superseded). This moves a registry `enabled = false` into the body, once.
|
|
6985
|
+
*
|
|
6986
|
+
* For every registry row of the addon that is OFF:
|
|
6987
|
+
* - no record under its id: the record is created from `initialBody(name)` with `enabled: false`
|
|
6988
|
+
* (a default integration that never had settings, Reolink's among them);
|
|
6989
|
+
* - a record whose body states no `enabled`: `enabled: false` is written into it;
|
|
6990
|
+
* - a record that already states `enabled` (either way) is the newer truth and is left alone.
|
|
6991
|
+
* A row that is ON writes nothing: an absent field reads as on. A rerun finds every off row with
|
|
6992
|
+
* a stated switch and does nothing, so nothing switched off comes back on and nothing switched on
|
|
6993
|
+
* goes off. The registry column itself is neither read afterwards nor written; its drop is step 5.
|
|
6994
|
+
*
|
|
6995
|
+
* It runs in the addon process, BEFORE the addon registers its `integration-instances` provider,
|
|
6996
|
+
* which is also why `integrations.list` still answers the stored column at that point.
|
|
6997
|
+
*/
|
|
6998
|
+
function registrySwitchToBodyId(addonId, date) {
|
|
6999
|
+
return `${addonId}/${date}-registry-switch-to-body`;
|
|
7000
|
+
}
|
|
7001
|
+
async function moveRegistrySwitchToBody(ports, spec) {
|
|
7002
|
+
const rows = await ports.listIntegrations(spec.addonId);
|
|
7003
|
+
let created = 0;
|
|
7004
|
+
let switched = 0;
|
|
7005
|
+
let kept = 0;
|
|
7006
|
+
for (const row of rows) {
|
|
7007
|
+
if (row.enabled) continue;
|
|
7008
|
+
const body = await ports.readBody(row.id);
|
|
7009
|
+
if (body === null) {
|
|
7010
|
+
if (await ports.createRecord(row.id, {
|
|
7011
|
+
...spec.initialBody(row.name),
|
|
7012
|
+
["enabled"]: false
|
|
7013
|
+
}) === "created") created += 1;
|
|
7014
|
+
else kept += 1;
|
|
7015
|
+
continue;
|
|
7016
|
+
}
|
|
7017
|
+
if ("enabled" in body) {
|
|
7018
|
+
kept += 1;
|
|
7019
|
+
continue;
|
|
7020
|
+
}
|
|
7021
|
+
await ports.switchOff(row.id);
|
|
7022
|
+
switched += 1;
|
|
7023
|
+
}
|
|
7024
|
+
const summary = {
|
|
7025
|
+
integrations: rows.length,
|
|
7026
|
+
off: rows.filter((r) => !r.enabled).length,
|
|
7027
|
+
created,
|
|
7028
|
+
switched,
|
|
7029
|
+
kept
|
|
7030
|
+
};
|
|
7031
|
+
return created === 0 && switched === 0 ? {
|
|
7032
|
+
outcome: "already-done",
|
|
7033
|
+
summary
|
|
7034
|
+
} : {
|
|
7035
|
+
outcome: "done",
|
|
7036
|
+
summary
|
|
7037
|
+
};
|
|
7038
|
+
}
|
|
7039
|
+
/** A migration entry: an addon states its kind and how a new body starts, nothing else. */
|
|
7040
|
+
function registrySwitchToBodyMigration(spec) {
|
|
7041
|
+
return {
|
|
7042
|
+
meta: {
|
|
7043
|
+
id: registrySwitchToBodyId(spec.addonId, spec.date),
|
|
7044
|
+
owner: spec.addonId,
|
|
7045
|
+
level: "addon-state",
|
|
7046
|
+
seq: spec.seq,
|
|
7047
|
+
dependsOn: [],
|
|
7048
|
+
store: "settings",
|
|
7049
|
+
scope: "cluster",
|
|
7050
|
+
onFailure: "block-owner",
|
|
7051
|
+
bodyKind: "procedure",
|
|
7052
|
+
description: "Move the registry enabled flag of every switched-off integration into its instance record body, creating the record when there is none",
|
|
7053
|
+
fixtureMark: "enabled"
|
|
7054
|
+
},
|
|
7055
|
+
procedure: (ports) => moveRegistrySwitchToBody(ports, {
|
|
7056
|
+
addonId: spec.addonId,
|
|
7057
|
+
initialBody: spec.initialBody
|
|
7058
|
+
})
|
|
7059
|
+
};
|
|
7060
|
+
}
|
|
7061
|
+
/** The hub and records sides of {@link registrySwitchToBodyMigration}. */
|
|
7062
|
+
function registrySwitchPortsOver(deps) {
|
|
7063
|
+
const handle = deps.records.kind({
|
|
7064
|
+
name: deps.kind.name,
|
|
7065
|
+
declaration: deps.kind.declaration,
|
|
7066
|
+
schema: record(string(), unknown())
|
|
7067
|
+
});
|
|
7068
|
+
return {
|
|
7069
|
+
listIntegrations: async (addonId) => (await deps.api.list()).filter((i) => i.addonId === addonId).map((i) => ({
|
|
7070
|
+
id: i.id,
|
|
7071
|
+
name: i.name,
|
|
7072
|
+
enabled: i.enabled !== false
|
|
7073
|
+
})),
|
|
7074
|
+
readBody: async (id) => (await handle.get(id))?.data ?? null,
|
|
7075
|
+
createRecord: async (id, body) => {
|
|
7076
|
+
if (await handle.get(id) !== null) return "exists";
|
|
7077
|
+
await handle.put({
|
|
7078
|
+
id,
|
|
7079
|
+
data: body
|
|
7080
|
+
}, { ifRev: 0 });
|
|
7081
|
+
return "created";
|
|
7082
|
+
},
|
|
7083
|
+
switchOff: async (id) => {
|
|
7084
|
+
await handle.patch(id, { [SWITCH_KEY]: false });
|
|
7085
|
+
}
|
|
7086
|
+
};
|
|
7087
|
+
}
|
|
6680
7088
|
/**
|
|
6681
7089
|
* Build a {@link DurableState} over a single store key. Transport-agnostic:
|
|
6682
7090
|
* `read`/`write` are the addon-store or device-store accessors. The whole
|
|
@@ -6808,96 +7216,19 @@ var SCOPED_SETTINGS_SCOPES = [
|
|
|
6808
7216
|
"device-defaults",
|
|
6809
7217
|
"node"
|
|
6810
7218
|
];
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
-
|
|
7219
|
+
/** The one refusal of a key a scope did not declare. */
|
|
7220
|
+
function assertDeclaredKeys(keys, declared) {
|
|
7221
|
+
const undeclared = keys.filter((key) => !declared.has(key));
|
|
7222
|
+
if (undeclared.length > 0) throw new Error(`scoped settings: [${undeclared.join(", ")}] not declared for this scope (declared: [${[...declared].join(", ")}])`);
|
|
6815
7223
|
}
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
}
|
|
6819
|
-
function decodeSegment(value) {
|
|
6820
|
-
try {
|
|
6821
|
-
return decodeURIComponent(value);
|
|
6822
|
-
} catch {
|
|
6823
|
-
return null;
|
|
6824
|
-
}
|
|
6825
|
-
}
|
|
6826
|
-
/**
|
|
6827
|
-
* The field path of a value inside an array item, addressed by the item's id:
|
|
6828
|
-
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6829
|
-
* `providers[authentik].clientSecret`.
|
|
6830
|
-
*/
|
|
6831
|
-
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6832
|
-
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6833
|
-
}
|
|
6834
|
-
function parseScope(segments) {
|
|
6835
|
-
switch (segments[0]) {
|
|
6836
|
-
case "global": return {
|
|
6837
|
-
scope: GLOBAL_SCOPE,
|
|
6838
|
-
used: 1
|
|
6839
|
-
};
|
|
6840
|
-
case "node": {
|
|
6841
|
-
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6842
|
-
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6843
|
-
scope: {
|
|
6844
|
-
kind: "node",
|
|
6845
|
-
nodeId
|
|
6846
|
-
},
|
|
6847
|
-
used: 2
|
|
6848
|
-
};
|
|
6849
|
-
}
|
|
6850
|
-
case "device": {
|
|
6851
|
-
const raw = segments[1];
|
|
6852
|
-
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6853
|
-
return {
|
|
6854
|
-
scope: {
|
|
6855
|
-
kind: "device",
|
|
6856
|
-
deviceId: Number(raw)
|
|
6857
|
-
},
|
|
6858
|
-
used: 2
|
|
6859
|
-
};
|
|
6860
|
-
}
|
|
6861
|
-
case "integration": {
|
|
6862
|
-
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6863
|
-
return id === null || id.length === 0 ? null : {
|
|
6864
|
-
scope: {
|
|
6865
|
-
kind: "integration",
|
|
6866
|
-
integrationId: id
|
|
6867
|
-
},
|
|
6868
|
-
used: 2
|
|
6869
|
-
};
|
|
6870
|
-
}
|
|
6871
|
-
case "row": {
|
|
6872
|
-
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6873
|
-
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6874
|
-
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6875
|
-
return {
|
|
6876
|
-
scope: {
|
|
6877
|
-
kind: "row",
|
|
6878
|
-
collection,
|
|
6879
|
-
rowId
|
|
6880
|
-
},
|
|
6881
|
-
used: 3
|
|
6882
|
-
};
|
|
6883
|
-
}
|
|
6884
|
-
default: return null;
|
|
6885
|
-
}
|
|
6886
|
-
}
|
|
6887
|
-
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6888
|
-
function parseSecretRef(ref) {
|
|
6889
|
-
if (!ref.startsWith("secret://")) return null;
|
|
6890
|
-
const segments = ref.slice(9).split("/");
|
|
6891
|
-
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6892
|
-
if (owner === null || owner.length === 0) return null;
|
|
6893
|
-
const parsed = parseScope(segments.slice(1));
|
|
6894
|
-
if (parsed === null) return null;
|
|
6895
|
-
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6896
|
-
if (fieldPath.length === 0) return null;
|
|
7224
|
+
/** Build the handle over an addon's scoped read, write and unset. */
|
|
7225
|
+
function createScopedSettings(deps) {
|
|
6897
7226
|
return {
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
7227
|
+
async get() {
|
|
7228
|
+
return deps.schema.parse(await deps.read());
|
|
7229
|
+
},
|
|
7230
|
+
patch: (patch) => deps.write(Object.fromEntries(Object.entries(patch))),
|
|
7231
|
+
unset: (keys) => deps.unset(keys)
|
|
6901
7232
|
};
|
|
6902
7233
|
}
|
|
6903
7234
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
@@ -6910,7 +7241,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6910
7241
|
}
|
|
6911
7242
|
};
|
|
6912
7243
|
var KEEP = { kind: "keep" };
|
|
6913
|
-
function isRecord$
|
|
7244
|
+
function isRecord$4(value) {
|
|
6914
7245
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6915
7246
|
}
|
|
6916
7247
|
function defaultMintId() {
|
|
@@ -6923,7 +7254,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6923
7254
|
return out;
|
|
6924
7255
|
}
|
|
6925
7256
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6926
|
-
else if (isRecord$
|
|
7257
|
+
else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6927
7258
|
return out;
|
|
6928
7259
|
}
|
|
6929
7260
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6978,7 +7309,7 @@ function rowId(row, idKey) {
|
|
|
6978
7309
|
return null;
|
|
6979
7310
|
}
|
|
6980
7311
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6981
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$
|
|
7312
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
|
|
6982
7313
|
if (!Array.isArray(incoming)) {
|
|
6983
7314
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6984
7315
|
return {
|
|
@@ -6994,7 +7325,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6994
7325
|
const kept = /* @__PURE__ */ new Set();
|
|
6995
7326
|
const rows = [];
|
|
6996
7327
|
for (const row of incoming) {
|
|
6997
|
-
if (!isRecord$
|
|
7328
|
+
if (!isRecord$4(row)) {
|
|
6998
7329
|
rows.push(row);
|
|
6999
7330
|
continue;
|
|
7000
7331
|
}
|
|
@@ -7019,7 +7350,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
7019
7350
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
7020
7351
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
7021
7352
|
case "object": {
|
|
7022
|
-
if (!isRecord$
|
|
7353
|
+
if (!isRecord$4(incoming)) {
|
|
7023
7354
|
if (incoming === void 0) return KEEP;
|
|
7024
7355
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
7025
7356
|
return {
|
|
@@ -7027,7 +7358,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
7027
7358
|
value: incoming
|
|
7028
7359
|
};
|
|
7029
7360
|
}
|
|
7030
|
-
const storedObj = isRecord$
|
|
7361
|
+
const storedObj = isRecord$4(stored) ? stored : {};
|
|
7031
7362
|
return {
|
|
7032
7363
|
kind: "value",
|
|
7033
7364
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -7150,7 +7481,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
|
7150
7481
|
value: items
|
|
7151
7482
|
};
|
|
7152
7483
|
}
|
|
7153
|
-
if (isRecord$
|
|
7484
|
+
if (isRecord$4(v)) {
|
|
7154
7485
|
const out = {};
|
|
7155
7486
|
for (const [k, child] of Object.entries(v)) {
|
|
7156
7487
|
const s = substitute(child);
|
|
@@ -7182,7 +7513,7 @@ var SecretOverwriteRefusedError = class extends Error {
|
|
|
7182
7513
|
this.name = "SecretOverwriteRefusedError";
|
|
7183
7514
|
}
|
|
7184
7515
|
};
|
|
7185
|
-
function isRecord$
|
|
7516
|
+
function isRecord$3(value) {
|
|
7186
7517
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7187
7518
|
}
|
|
7188
7519
|
function resolvedValue(pass, marker) {
|
|
@@ -7211,7 +7542,7 @@ function inArray(pass, incoming, stored) {
|
|
|
7211
7542
|
return incoming.map((item, index) => {
|
|
7212
7543
|
const twin = stored[index];
|
|
7213
7544
|
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
7214
|
-
if (isRecord$
|
|
7545
|
+
if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
|
|
7215
7546
|
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
7216
7547
|
return item;
|
|
7217
7548
|
});
|
|
@@ -7222,7 +7553,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
7222
7553
|
const twin = stored[key];
|
|
7223
7554
|
if (isSecretMarker(twin)) {
|
|
7224
7555
|
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
7225
|
-
} else if (isRecord$
|
|
7556
|
+
} else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
7226
7557
|
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
7227
7558
|
}
|
|
7228
7559
|
return out;
|
|
@@ -7230,7 +7561,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
7230
7561
|
async function walk(pass, incoming, stored) {
|
|
7231
7562
|
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
7232
7563
|
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
7233
|
-
if (!isRecord$
|
|
7564
|
+
if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
|
|
7234
7565
|
const out = { ...incoming };
|
|
7235
7566
|
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
7236
7567
|
return out;
|
|
@@ -7261,7 +7592,7 @@ async function restoreUnchangedSecrets(input) {
|
|
|
7261
7592
|
function isJsonEqual(a, b) {
|
|
7262
7593
|
if (Object.is(a, b)) return true;
|
|
7263
7594
|
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
7264
|
-
if (isRecord$
|
|
7595
|
+
if (isRecord$3(a) && isRecord$3(b)) {
|
|
7265
7596
|
const keys = Object.keys(a);
|
|
7266
7597
|
if (keys.length !== Object.keys(b).length) return false;
|
|
7267
7598
|
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
@@ -7285,7 +7616,7 @@ function markerKeysOf(blob, owner) {
|
|
|
7285
7616
|
}
|
|
7286
7617
|
function nodeFromStored(value, owner) {
|
|
7287
7618
|
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
7288
|
-
if (!isRecord$
|
|
7619
|
+
if (!isRecord$3(value)) return null;
|
|
7289
7620
|
const children = /* @__PURE__ */ new Map();
|
|
7290
7621
|
for (const [key, child] of Object.entries(value)) {
|
|
7291
7622
|
const node = nodeFromStored(child, owner);
|
|
@@ -7475,7 +7806,16 @@ function createHandle(raw, opts) {
|
|
|
7475
7806
|
return blob;
|
|
7476
7807
|
}
|
|
7477
7808
|
},
|
|
7478
|
-
writeAddonStore: writeAddon
|
|
7809
|
+
writeAddonStore: writeAddon,
|
|
7810
|
+
removeClearedKeys: (keys) => serialize("addon", async () => {
|
|
7811
|
+
const stored = await readStoredAddonBlob(raw);
|
|
7812
|
+
index.seen("addon", stored);
|
|
7813
|
+
const removable = keys.filter((key) => collectSecretMarkerRefs(stored[key]).length === 0);
|
|
7814
|
+
if (removable.length === 0) return;
|
|
7815
|
+
const patch = Object.fromEntries(removable.map((key) => [key, void 0]));
|
|
7816
|
+
await raw.writeAddonStore(patch);
|
|
7817
|
+
index.wrote("addon", patch);
|
|
7818
|
+
})
|
|
7479
7819
|
};
|
|
7480
7820
|
}
|
|
7481
7821
|
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
@@ -7782,13 +8122,48 @@ var BaseAddon = class {
|
|
|
7782
8122
|
if (api === void 0) throw new Error(`${this.ctx.id}: the migration API is not available on this context`);
|
|
7783
8123
|
return this.runBound(sets.flatMap((set) => set.bind(api)), options);
|
|
7784
8124
|
}
|
|
7785
|
-
|
|
8125
|
+
/**
|
|
8126
|
+
* A device addon states its instance kind once, before its migrations run, and the one-switch
|
|
8127
|
+
* migration (registry `enabled` to the instance body, epic #440 step 3) joins whatever
|
|
8128
|
+
* catalogue the addon runs, in the SAME declaration (the engine replaces an owner's catalogue
|
|
8129
|
+
* on every declare).
|
|
8130
|
+
*/
|
|
8131
|
+
declareRegistrySwitch(spec) {
|
|
8132
|
+
this.registrySwitchSpec = spec;
|
|
8133
|
+
}
|
|
8134
|
+
registrySwitchSpec = null;
|
|
8135
|
+
registrySwitchBound() {
|
|
8136
|
+
const spec = this.registrySwitchSpec;
|
|
8137
|
+
if (spec === null) return [];
|
|
8138
|
+
const api = this.ctx.migrationApi;
|
|
8139
|
+
if (api === void 0) {
|
|
8140
|
+
this.ctx.logger.warn("the registry switch migration is skipped: the migration API is not available on this context");
|
|
8141
|
+
return [];
|
|
8142
|
+
}
|
|
8143
|
+
return migrationSet([registrySwitchToBodyMigration({
|
|
8144
|
+
addonId: this.ctx.id,
|
|
8145
|
+
date: "2026-11-06",
|
|
8146
|
+
seq: 1e3,
|
|
8147
|
+
initialBody: spec.initialBody
|
|
8148
|
+
})], (a) => registrySwitchPortsOver({
|
|
8149
|
+
api: integrationRowsApiOver(a),
|
|
8150
|
+
records: switchRecordsOverMigrationApi(a),
|
|
8151
|
+
kind: spec.kind
|
|
8152
|
+
})).bind(api);
|
|
8153
|
+
}
|
|
8154
|
+
async runBound(declared, options) {
|
|
8155
|
+
const added = this.registrySwitchBound();
|
|
8156
|
+
const migrations = [...declared, ...added];
|
|
8157
|
+
const phased = options?.only === void 0 || added.length === 0 ? options : {
|
|
8158
|
+
...options,
|
|
8159
|
+
only: [...options.only, ...added.map((m) => m.meta.id)]
|
|
8160
|
+
};
|
|
7786
8161
|
const api = this.ctx.api.migrations;
|
|
7787
8162
|
const report = await runAddonMigrations({
|
|
7788
8163
|
declareOwner: (input) => api.declareOwner.mutate(input),
|
|
7789
8164
|
startMigration: (input) => api.startMigration.mutate(input),
|
|
7790
8165
|
finishMigration: (input) => api.finishMigration.mutate(input)
|
|
7791
|
-
}, migrations, this.ctx.logger,
|
|
8166
|
+
}, migrations, this.ctx.logger, phased);
|
|
7792
8167
|
if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
|
|
7793
8168
|
return report;
|
|
7794
8169
|
}
|
|
@@ -7985,6 +8360,151 @@ var BaseAddon = class {
|
|
|
7985
8360
|
}
|
|
7986
8361
|
}
|
|
7987
8362
|
/**
|
|
8363
|
+
* Hook: values layered over the stored ones when the FORM of one scope is served
|
|
8364
|
+
* ({@link getScopedSettings}) — a preview that derives dependent options without writing.
|
|
8365
|
+
* Never applied to {@link ScopedSettings.get} or to a write. `null` ⇒ no overlay.
|
|
8366
|
+
*/
|
|
8367
|
+
async scopedSettingsOverlay(_scope, _cap, _nodeId) {
|
|
8368
|
+
return null;
|
|
8369
|
+
}
|
|
8370
|
+
/**
|
|
8371
|
+
* Hook: a write of one scope changed stored values (not called when the store reports no change,
|
|
8372
|
+
* e.g. the write-back of a stored secret). `keys` are the bare field keys of the write, node keys included.
|
|
8373
|
+
*/
|
|
8374
|
+
async onScopedSettingsChanged(_scope, _cap, _keys) {}
|
|
8375
|
+
/** Typed handle over the CLUSTER settings `cap` declares (`clusterSettingsSchema`). */
|
|
8376
|
+
clusterSettings(cap, schema) {
|
|
8377
|
+
return this.scopedHandle("cluster", cap, schema);
|
|
8378
|
+
}
|
|
8379
|
+
/** Typed handle over the fleet defaults of the per-device settings `cap` declares. */
|
|
8380
|
+
deviceDefaults(cap, schema) {
|
|
8381
|
+
return this.scopedHandle("device-defaults", cap, schema);
|
|
8382
|
+
}
|
|
8383
|
+
/**
|
|
8384
|
+
* Typed handle over the settings `cap` owns PER NODE. `nodeId` omitted ⇒ the local node. A node
|
|
8385
|
+
* with no row yields the schema defaults — never a bare-key fallback.
|
|
8386
|
+
*/
|
|
8387
|
+
nodeSettings(cap, schema, nodeId) {
|
|
8388
|
+
return this.scopedHandle("node", cap, schema, nodeId);
|
|
8389
|
+
}
|
|
8390
|
+
/**
|
|
8391
|
+
* {@link state} for a value that is kept per node: stored under `<key>@<nodeId>`, and the
|
|
8392
|
+
* settings store carries `nodeId` in the row data (D986 §1), so a forgotten node's rows go in one
|
|
8393
|
+
* central delete. `nodeId` omitted ⇒ the local node.
|
|
8394
|
+
*/
|
|
8395
|
+
nodeState(key, schema, fallback, nodeId) {
|
|
8396
|
+
this._declaredStateKeys.add(key);
|
|
8397
|
+
return createDurableState({
|
|
8398
|
+
key: nodeScopedKey(key, nodeId ?? this._ctx?.kernel?.localNodeId ?? ""),
|
|
8399
|
+
schema,
|
|
8400
|
+
fallback,
|
|
8401
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
8402
|
+
write: async (patch) => {
|
|
8403
|
+
await this._ctx?.settings?.writeAddonStore(patch);
|
|
8404
|
+
},
|
|
8405
|
+
onParseError: (k, e) => this._ctx?.logger?.warn?.(`durable-state: stored "${k}" failed validation — using fallback`, { meta: {
|
|
8406
|
+
addonId: this._ctx?.id,
|
|
8407
|
+
key: k,
|
|
8408
|
+
error: String(e)
|
|
8409
|
+
} })
|
|
8410
|
+
});
|
|
8411
|
+
}
|
|
8412
|
+
/** The loaded schema `cap` declares for `scope`, or `null`. */
|
|
8413
|
+
async declaredScopedSchema(scope, cap) {
|
|
8414
|
+
await this.loadScopedSchemas(cap);
|
|
8415
|
+
return this.loadedScopedSchemas(cap).find((entry) => entry.scope === scope)?.schema ?? null;
|
|
8416
|
+
}
|
|
8417
|
+
async requireScopedSchema(scope, cap) {
|
|
8418
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
8419
|
+
if (schema === null) throw new Error(`${this.constructor.name}: cap "${cap}" declares no ${scope} settings`);
|
|
8420
|
+
return schema;
|
|
8421
|
+
}
|
|
8422
|
+
scopedKeys(schema) {
|
|
8423
|
+
return new Set(schema.sections.flatMap((section) => collectValueFieldKeys(section.fields)));
|
|
8424
|
+
}
|
|
8425
|
+
/** `store` narrowed to the keys `schema` declares. */
|
|
8426
|
+
narrowToScope(store, schema) {
|
|
8427
|
+
const keys = this.scopedKeys(schema);
|
|
8428
|
+
return Object.fromEntries(Object.entries(store).filter(([key]) => keys.has(key)));
|
|
8429
|
+
}
|
|
8430
|
+
scopedHandle(scope, cap, schema, nodeId) {
|
|
8431
|
+
return createScopedSettings({
|
|
8432
|
+
schema,
|
|
8433
|
+
read: async () => {
|
|
8434
|
+
const declared = await this.requireScopedSchema(scope, cap);
|
|
8435
|
+
const stored = this.narrowToScope(await this.resolveGlobalStore(nodeId, cap), declared);
|
|
8436
|
+
const effective = collectHydratedFieldValues(hydrateSchema(declared, stored));
|
|
8437
|
+
return {
|
|
8438
|
+
...Object.fromEntries([...effective].filter(([, value]) => value !== void 0)),
|
|
8439
|
+
...stored
|
|
8440
|
+
};
|
|
8441
|
+
},
|
|
8442
|
+
write: (patch) => this.writeScoped(scope, cap, patch, nodeId),
|
|
8443
|
+
unset: (keys) => this.unsetScoped(scope, cap, keys, nodeId)
|
|
8444
|
+
});
|
|
8445
|
+
}
|
|
8446
|
+
/** The one write path of the scoped API: declared keys only, then the global patch. */
|
|
8447
|
+
async writeScoped(scope, cap, patch, nodeId) {
|
|
8448
|
+
assertDeclaredKeys(Object.keys(patch), this.scopedKeys(await this.requireScopedSchema(scope, cap)));
|
|
8449
|
+
if (await this.applyGlobalPatch(patch, scope === "node" ? nodeId : void 0, cap)) await this.onScopedSettingsChanged(scope, cap, Object.keys(patch));
|
|
8450
|
+
}
|
|
8451
|
+
/**
|
|
8452
|
+
* Remove declared keys of one scope. A secret goes through {@link clearSecrets} — its keychain
|
|
8453
|
+
* value is released exactly as there — and the emptied row is then removed; every other key is
|
|
8454
|
+
* removed by an `undefined` patch (which a secret transform would read as "keep").
|
|
8455
|
+
*/
|
|
8456
|
+
async unsetScoped(scope, cap, keys, nodeId) {
|
|
8457
|
+
assertDeclaredKeys(keys, this.scopedKeys(await this.requireScopedSchema(scope, cap)));
|
|
8458
|
+
const target = scope === "node" ? nodeId : void 0;
|
|
8459
|
+
const tree = this.addonSecretTree();
|
|
8460
|
+
const secretKeys = keys.filter((key) => tree.has(key));
|
|
8461
|
+
const plainKeys = keys.filter((key) => !tree.has(key));
|
|
8462
|
+
let changed = false;
|
|
8463
|
+
if (plainKeys.length > 0) {
|
|
8464
|
+
const patch = Object.fromEntries(plainKeys.map((key) => [key, void 0]));
|
|
8465
|
+
changed = await this.applyGlobalPatch(patch, target, cap) || changed;
|
|
8466
|
+
}
|
|
8467
|
+
if (secretKeys.length > 0) {
|
|
8468
|
+
await this.clearSecretKeys(secretKeys, target, cap);
|
|
8469
|
+
const node = normalizeNodeId(target ?? this._ctx?.kernel?.localNodeId);
|
|
8470
|
+
const rows = secretKeys.map((key) => scope === "node" ? nodeScopedKey(key, node) : key);
|
|
8471
|
+
if (this._secretSettings !== null) await this._secretSettings.removeClearedKeys(rows);
|
|
8472
|
+
else await this._ctx?.settings?.writeAddonStore(Object.fromEntries(rows.map((row) => [row, void 0])));
|
|
8473
|
+
changed = true;
|
|
8474
|
+
}
|
|
8475
|
+
if (changed) await this.onScopedSettingsChanged(scope, cap, [...keys]);
|
|
8476
|
+
}
|
|
8477
|
+
/**
|
|
8478
|
+
* The hydrated form of one scope of one capability's settings (any
|
|
8479
|
+
* {@link scopedSettingsOverlay} applied), or `null` when the capability declares nothing there.
|
|
8480
|
+
*/
|
|
8481
|
+
async getScopedSettings(scope, cap, nodeId) {
|
|
8482
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
8483
|
+
if (schema === null) return null;
|
|
8484
|
+
const stored = this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema);
|
|
8485
|
+
const overlay = await this.scopedSettingsOverlay(scope, cap, nodeId);
|
|
8486
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(stored, overlay) : stored, { inlineSecretsAsViews: true });
|
|
8487
|
+
}
|
|
8488
|
+
/** The OPERATOR's write of declared keys of one scope (D787 secret semantics). */
|
|
8489
|
+
async updateScopedSettings(scope, cap, patch, nodeId) {
|
|
8490
|
+
this._operatorWriteDepth++;
|
|
8491
|
+
try {
|
|
8492
|
+
await this.writeScoped(scope, cap, patch, nodeId);
|
|
8493
|
+
} finally {
|
|
8494
|
+
this._operatorWriteDepth--;
|
|
8495
|
+
}
|
|
8496
|
+
}
|
|
8497
|
+
/**
|
|
8498
|
+
* The effective values (`stored ?? default`) of one scope, a secret as its `set` view — never
|
|
8499
|
+
* its value. `null` when the capability declares nothing for the scope.
|
|
8500
|
+
*/
|
|
8501
|
+
async readScopedValues(scope, cap, nodeId) {
|
|
8502
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
8503
|
+
if (schema === null) return null;
|
|
8504
|
+
const form = hydrateSchema(schema, this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema), { inlineSecretsAsViews: true });
|
|
8505
|
+
return Object.fromEntries([...collectHydratedFieldValues(form)].filter(([, value]) => value !== void 0));
|
|
8506
|
+
}
|
|
8507
|
+
/**
|
|
7988
8508
|
* What the create wizard and the integration edit page render for one instance: the addon's
|
|
7989
8509
|
* per-instance schema when it declares one, else its global schema (what they always showed).
|
|
7990
8510
|
*/
|
|
@@ -8136,6 +8656,9 @@ var BaseAddon = class {
|
|
|
8136
8656
|
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
8137
8657
|
*/
|
|
8138
8658
|
async clearSecrets(keys, nodeId) {
|
|
8659
|
+
await this.clearSecretKeys(keys, nodeId);
|
|
8660
|
+
}
|
|
8661
|
+
async clearSecretKeys(keys, nodeId, cap) {
|
|
8139
8662
|
const tree = this.addonSecretTree();
|
|
8140
8663
|
const keychain = this._ctx?.secrets !== void 0;
|
|
8141
8664
|
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
@@ -8148,25 +8671,27 @@ var BaseAddon = class {
|
|
|
8148
8671
|
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
8149
8672
|
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
8150
8673
|
}
|
|
8151
|
-
await this.applyGlobalPatch(patch, nodeId);
|
|
8674
|
+
await this.applyGlobalPatch(patch, nodeId, cap);
|
|
8152
8675
|
}
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8676
|
+
/** Resolves `true` when the write changed stored values. */
|
|
8677
|
+
async applyGlobalPatch(barePatch, nodeId, cap) {
|
|
8678
|
+
await this.loadScopedSchemas(cap);
|
|
8679
|
+
const keys = this.perNodeKeys(cap);
|
|
8156
8680
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
8157
8681
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
8158
8682
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
8159
8683
|
const handle = this._secretSettings;
|
|
8160
8684
|
if (handle !== null) {
|
|
8161
8685
|
const { changed } = await handle.writeAddonStore(scoped);
|
|
8162
|
-
if (!changed) return;
|
|
8686
|
+
if (!changed) return false;
|
|
8163
8687
|
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
8164
|
-
if (target !== localNode) return;
|
|
8688
|
+
if (target !== localNode) return true;
|
|
8165
8689
|
await this.resolveConfig();
|
|
8166
8690
|
await this.onConfigChanged();
|
|
8167
8691
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
8168
8692
|
const legacy = this.globalSettingsSchema();
|
|
8169
8693
|
this.maybeAutoRestart(Object.keys(barePatch), [...legacy === null ? [] : [legacy], ...this.loadedScopedSchemas().map((entry) => entry.schema)]);
|
|
8694
|
+
return true;
|
|
8170
8695
|
}
|
|
8171
8696
|
/**
|
|
8172
8697
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -8861,114 +9386,94 @@ function normalizeAddonInitResult(result) {
|
|
|
8861
9386
|
if (Array.isArray(result)) return { providers: result };
|
|
8862
9387
|
return result;
|
|
8863
9388
|
}
|
|
8864
|
-
|
|
8865
|
-
|
|
8866
|
-
|
|
8867
|
-
|
|
8868
|
-
detail;
|
|
8869
|
-
constructor(code, detail) {
|
|
8870
|
-
super(`${PREFIX}${code}: ${detail}`);
|
|
8871
|
-
this.name = "RecordsError";
|
|
8872
|
-
this.code = code;
|
|
8873
|
-
this.detail = detail;
|
|
8874
|
-
}
|
|
8875
|
-
};
|
|
8876
|
-
var InvalidRecordError = class extends RecordsError {
|
|
8877
|
-
constructor(detail) {
|
|
8878
|
-
super("invalid-record", detail);
|
|
8879
|
-
this.name = "InvalidRecordError";
|
|
8880
|
-
}
|
|
8881
|
-
};
|
|
8882
|
-
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
8883
|
-
var DeclarationRefusedError = class extends RecordsError {
|
|
8884
|
-
constructor(detail) {
|
|
8885
|
-
super("declaration-refused", detail);
|
|
8886
|
-
this.name = "DeclarationRefusedError";
|
|
8887
|
-
}
|
|
8888
|
-
};
|
|
8889
|
-
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
8890
|
-
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
8891
|
-
var RECORD_DATABASES = ["settings", "events"];
|
|
8892
|
-
/** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
|
|
8893
|
-
var RECORD_CLASSES = [
|
|
8894
|
-
"config",
|
|
8895
|
-
"ledger",
|
|
8896
|
-
"audit",
|
|
8897
|
-
"mirror",
|
|
8898
|
-
"ephemeral"
|
|
8899
|
-
];
|
|
8900
|
-
var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
8901
|
-
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
8902
|
-
var RECORD_BATCH_MAX = 1e3;
|
|
8903
|
-
var RECORD_QUERY_MAX = 1e3;
|
|
8904
|
-
/** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
|
|
8905
|
-
var RECORD_SETTINGS_MAX_ROWS = 5e4;
|
|
9389
|
+
object({
|
|
9390
|
+
field: string().min(1),
|
|
9391
|
+
on: literal("advance")
|
|
9392
|
+
});
|
|
8906
9393
|
/**
|
|
8907
|
-
*
|
|
8908
|
-
* (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
|
|
8909
|
-
* (`auth.accessToken`, `headers[].value`).
|
|
8910
|
-
*
|
|
8911
|
-
* `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
|
|
8912
|
-
* names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
|
|
8913
|
-
* key releases exactly that key's secret.
|
|
9394
|
+
* Output schema shared by the contribution + live methods.
|
|
8914
9395
|
*
|
|
8915
|
-
*
|
|
8916
|
-
*
|
|
8917
|
-
*
|
|
8918
|
-
*
|
|
9396
|
+
* Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
|
|
9397
|
+
* tabs[]) without importing from `../interfaces/config-ui.js` — a
|
|
9398
|
+
* concrete-but-lenient Zod object keeps tRPC output inference happy
|
|
9399
|
+
* (using `z.unknown()` here collapses unrelated router branches to
|
|
9400
|
+
* `unknown` when the generator re-inlines the huge AppRouter type).
|
|
8919
9401
|
*
|
|
8920
|
-
*
|
|
9402
|
+
* `.passthrough()` on sections/fields accepts whatever FormBuilder
|
|
9403
|
+
* extensions the caller adds (showWhen, displayScale, …) without
|
|
9404
|
+
* rebuilding every time a new field kind is introduced.
|
|
8921
9405
|
*/
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
9406
|
+
var ContributionSectionSchema = object({
|
|
9407
|
+
id: string(),
|
|
9408
|
+
title: string(),
|
|
9409
|
+
description: string().optional(),
|
|
9410
|
+
style: _enum(["card", "accordion"]).optional(),
|
|
9411
|
+
defaultCollapsed: boolean().optional(),
|
|
9412
|
+
columns: union([
|
|
9413
|
+
literal(1),
|
|
9414
|
+
literal(2),
|
|
9415
|
+
literal(3),
|
|
9416
|
+
literal(4)
|
|
9417
|
+
]).optional(),
|
|
9418
|
+
tab: string().optional(),
|
|
9419
|
+
location: _enum([
|
|
9420
|
+
"settings",
|
|
9421
|
+
"top-tab",
|
|
9422
|
+
"hero"
|
|
9423
|
+
]).optional(),
|
|
9424
|
+
order: number().optional(),
|
|
9425
|
+
fields: array(any())
|
|
9426
|
+
});
|
|
9427
|
+
object({
|
|
9428
|
+
tabs: array(object({
|
|
9429
|
+
id: string(),
|
|
9430
|
+
label: string(),
|
|
9431
|
+
icon: string(),
|
|
9432
|
+
order: number().optional()
|
|
9433
|
+
})).optional(),
|
|
9434
|
+
sections: array(ContributionSectionSchema)
|
|
9435
|
+
}).nullable();
|
|
9436
|
+
object({ deviceId: number() }), object({ deviceId: number() }), object({
|
|
9437
|
+
deviceId: number(),
|
|
9438
|
+
patch: record(string(), unknown())
|
|
9439
|
+
}), object({ success: literal(true) });
|
|
9440
|
+
object({ deviceId: number() }), unknown().nullable();
|
|
9441
|
+
function method(input, output, options) {
|
|
9442
|
+
return {
|
|
9443
|
+
input,
|
|
9444
|
+
output,
|
|
9445
|
+
kind: options?.kind ?? "query",
|
|
9446
|
+
...options?.auth !== void 0 ? { auth: options.auth } : {},
|
|
9447
|
+
...options?.access !== void 0 ? { access: options.access } : {},
|
|
9448
|
+
...options?.role !== void 0 ? { role: options.role } : {},
|
|
9449
|
+
...options?.caller !== void 0 ? { caller: options.caller } : {},
|
|
9450
|
+
timeoutMs: options?.timeoutMs
|
|
9451
|
+
};
|
|
8936
9452
|
}
|
|
8937
|
-
/**
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
9453
|
+
/**
|
|
9454
|
+
* A wrapper/system-only method: served exclusively by the cap's system-level
|
|
9455
|
+
* provider (`InferProvider`), and OPTIONAL on `InferNativeProvider` so per-device
|
|
9456
|
+
* driver natives don't stub out a wrapper concern (e.g. a cross-device cache
|
|
9457
|
+
* overview). The `systemOnly: true` literal is what `InferNativeProvider` keys on.
|
|
9458
|
+
*/
|
|
9459
|
+
function systemMethod(input, output, options) {
|
|
9460
|
+
return {
|
|
9461
|
+
...method(input, output, options),
|
|
9462
|
+
systemOnly: true
|
|
9463
|
+
};
|
|
8947
9464
|
}
|
|
8948
9465
|
/**
|
|
8949
|
-
*
|
|
8950
|
-
*
|
|
8951
|
-
*
|
|
9466
|
+
* A method a SOURCE of a collection cap may legitimately not serve — OPTIONAL
|
|
9467
|
+
* on `InferProvider`. The `providerOptional: true` literal is what
|
|
9468
|
+
* `InferProvider` keys on; see {@link CapabilityMethodSchema.providerOptional}
|
|
9469
|
+
* for when this is the honest answer and when it is a soft stub.
|
|
8952
9470
|
*/
|
|
8953
|
-
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
* The HOST node this URL means something on — the hub or a named agent,
|
|
8960
|
-
* never a runner. {@link AddonPeerBytes.open} compares it to its own and
|
|
8961
|
-
* refuses `cross-node` by name when they differ, without dialling.
|
|
8962
|
-
*/
|
|
8963
|
-
hostNodeId: string().min(1),
|
|
8964
|
-
expiresAtMs: number().int().nonnegative(),
|
|
8965
|
-
/**
|
|
8966
|
-
* What the producer DECLARED the body to be, when it knows — `null` when it
|
|
8967
|
-
* does not. Never `0` for unknown (D393): a consumer sizing a bound off this
|
|
8968
|
-
* must be able to tell "the producer did not say" from "the body is empty".
|
|
8969
|
-
*/
|
|
8970
|
-
declaredBytes: number().int().nonnegative().nullable()
|
|
8971
|
-
});
|
|
9471
|
+
function optionalMethod(input, output, options) {
|
|
9472
|
+
return {
|
|
9473
|
+
...method(input, output, options),
|
|
9474
|
+
providerOptional: true
|
|
9475
|
+
};
|
|
9476
|
+
}
|
|
8972
9477
|
function defOf(schema) {
|
|
8973
9478
|
const zodBag = Reflect.get(schema, "_zod");
|
|
8974
9479
|
if (typeof zodBag !== "object" || zodBag === null) return {};
|
|
@@ -9188,107 +9693,29 @@ function defineRecordKinds(specs) {
|
|
|
9188
9693
|
return out;
|
|
9189
9694
|
}
|
|
9190
9695
|
/**
|
|
9191
|
-
*
|
|
9192
|
-
*
|
|
9193
|
-
*
|
|
9194
|
-
* through the `record-entries` capability with password fields derived from
|
|
9195
|
-
* the schema (`.meta({ secret: true })`).
|
|
9196
|
-
*/
|
|
9197
|
-
/** The body of a plain entry: a name and the fields the kind adds. */
|
|
9198
|
-
function entryBody(shape) {
|
|
9199
|
-
return object({
|
|
9200
|
-
name: string().min(1),
|
|
9201
|
-
...shape
|
|
9202
|
-
});
|
|
9203
|
-
}
|
|
9204
|
-
object({
|
|
9205
|
-
field: string().min(1),
|
|
9206
|
-
on: literal("advance")
|
|
9207
|
-
});
|
|
9208
|
-
/**
|
|
9209
|
-
* Output schema shared by the contribution + live methods.
|
|
9210
|
-
*
|
|
9211
|
-
* Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
|
|
9212
|
-
* tabs[]) without importing from `../interfaces/config-ui.js` — a
|
|
9213
|
-
* concrete-but-lenient Zod object keeps tRPC output inference happy
|
|
9214
|
-
* (using `z.unknown()` here collapses unrelated router branches to
|
|
9215
|
-
* `unknown` when the generator re-inlines the huge AppRouter type).
|
|
9216
|
-
*
|
|
9217
|
-
* `.passthrough()` on sections/fields accepts whatever FormBuilder
|
|
9218
|
-
* extensions the caller adds (showWhen, displayScale, …) without
|
|
9219
|
-
* rebuilding every time a new field kind is introduced.
|
|
9696
|
+
* The share-view scope kinds a share-link token can carry. The hub mints
|
|
9697
|
+
* and validates them (`ShareViewGrantSchema` builds its
|
|
9698
|
+
* enum from this list); a data plane names the kinds it ACCEPTS in `share`.
|
|
9220
9699
|
*/
|
|
9221
|
-
var
|
|
9222
|
-
|
|
9223
|
-
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
|
|
9228
|
-
|
|
9229
|
-
|
|
9230
|
-
|
|
9231
|
-
|
|
9232
|
-
|
|
9233
|
-
|
|
9234
|
-
|
|
9235
|
-
|
|
9236
|
-
|
|
9237
|
-
|
|
9238
|
-
|
|
9239
|
-
order: number().optional(),
|
|
9240
|
-
fields: array(any())
|
|
9700
|
+
var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
|
|
9701
|
+
/** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
|
|
9702
|
+
var PeerBytesTicketSchema = object({
|
|
9703
|
+
/** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
|
|
9704
|
+
url: string().min(1),
|
|
9705
|
+
/**
|
|
9706
|
+
* The HOST node this URL means something on — the hub or a named agent,
|
|
9707
|
+
* never a runner. {@link AddonPeerBytes.open} compares it to its own and
|
|
9708
|
+
* refuses `cross-node` by name when they differ, without dialling.
|
|
9709
|
+
*/
|
|
9710
|
+
hostNodeId: string().min(1),
|
|
9711
|
+
expiresAtMs: number().int().nonnegative(),
|
|
9712
|
+
/**
|
|
9713
|
+
* What the producer DECLARED the body to be, when it knows — `null` when it
|
|
9714
|
+
* does not. Never `0` for unknown (D393): a consumer sizing a bound off this
|
|
9715
|
+
* must be able to tell "the producer did not say" from "the body is empty".
|
|
9716
|
+
*/
|
|
9717
|
+
declaredBytes: number().int().nonnegative().nullable()
|
|
9241
9718
|
});
|
|
9242
|
-
object({
|
|
9243
|
-
tabs: array(object({
|
|
9244
|
-
id: string(),
|
|
9245
|
-
label: string(),
|
|
9246
|
-
icon: string(),
|
|
9247
|
-
order: number().optional()
|
|
9248
|
-
})).optional(),
|
|
9249
|
-
sections: array(ContributionSectionSchema)
|
|
9250
|
-
}).nullable();
|
|
9251
|
-
object({ deviceId: number() }), object({ deviceId: number() }), object({
|
|
9252
|
-
deviceId: number(),
|
|
9253
|
-
patch: record(string(), unknown())
|
|
9254
|
-
}), object({ success: literal(true) });
|
|
9255
|
-
object({ deviceId: number() }), unknown().nullable();
|
|
9256
|
-
function method(input, output, options) {
|
|
9257
|
-
return {
|
|
9258
|
-
input,
|
|
9259
|
-
output,
|
|
9260
|
-
kind: options?.kind ?? "query",
|
|
9261
|
-
...options?.auth !== void 0 ? { auth: options.auth } : {},
|
|
9262
|
-
...options?.access !== void 0 ? { access: options.access } : {},
|
|
9263
|
-
...options?.role !== void 0 ? { role: options.role } : {},
|
|
9264
|
-
...options?.caller !== void 0 ? { caller: options.caller } : {},
|
|
9265
|
-
timeoutMs: options?.timeoutMs
|
|
9266
|
-
};
|
|
9267
|
-
}
|
|
9268
|
-
/**
|
|
9269
|
-
* A wrapper/system-only method: served exclusively by the cap's system-level
|
|
9270
|
-
* provider (`InferProvider`), and OPTIONAL on `InferNativeProvider` so per-device
|
|
9271
|
-
* driver natives don't stub out a wrapper concern (e.g. a cross-device cache
|
|
9272
|
-
* overview). The `systemOnly: true` literal is what `InferNativeProvider` keys on.
|
|
9273
|
-
*/
|
|
9274
|
-
function systemMethod(input, output, options) {
|
|
9275
|
-
return {
|
|
9276
|
-
...method(input, output, options),
|
|
9277
|
-
systemOnly: true
|
|
9278
|
-
};
|
|
9279
|
-
}
|
|
9280
|
-
/**
|
|
9281
|
-
* A method a SOURCE of a collection cap may legitimately not serve — OPTIONAL
|
|
9282
|
-
* on `InferProvider`. The `providerOptional: true` literal is what
|
|
9283
|
-
* `InferProvider` keys on; see {@link CapabilityMethodSchema.providerOptional}
|
|
9284
|
-
* for when this is the honest answer and when it is a soft stub.
|
|
9285
|
-
*/
|
|
9286
|
-
function optionalMethod(input, output, options) {
|
|
9287
|
-
return {
|
|
9288
|
-
...method(input, output, options),
|
|
9289
|
-
providerOptional: true
|
|
9290
|
-
};
|
|
9291
|
-
}
|
|
9292
9719
|
var READING_QUANTITIES = [
|
|
9293
9720
|
"temperature",
|
|
9294
9721
|
"pressure",
|
|
@@ -10423,7 +10850,6 @@ var CAP_NAMES = Object.freeze([
|
|
|
10423
10850
|
"climate-control",
|
|
10424
10851
|
"color",
|
|
10425
10852
|
"composer",
|
|
10426
|
-
"connection-test",
|
|
10427
10853
|
"connectivity",
|
|
10428
10854
|
"consumables",
|
|
10429
10855
|
"contact",
|
|
@@ -10513,7 +10939,6 @@ var CAP_NAMES = Object.freeze([
|
|
|
10513
10939
|
"notifier",
|
|
10514
10940
|
"numeric-sensor",
|
|
10515
10941
|
"oauth-integration",
|
|
10516
|
-
"oidc-connections",
|
|
10517
10942
|
"osd",
|
|
10518
10943
|
"osd-manager",
|
|
10519
10944
|
"pet-feeder",
|
|
@@ -11570,6 +11995,10 @@ Object.freeze({
|
|
|
11570
11995
|
"all",
|
|
11571
11996
|
"one"
|
|
11572
11997
|
]
|
|
11998
|
+
},
|
|
11999
|
+
{
|
|
12000
|
+
"path": "positionUpdatedAt",
|
|
12001
|
+
"valueType": "number"
|
|
11573
12002
|
}
|
|
11574
12003
|
],
|
|
11575
12004
|
"meter": [{
|
|
@@ -11824,22 +12253,6 @@ Object.freeze({
|
|
|
11824
12253
|
"path": "pumpRunning",
|
|
11825
12254
|
"valueType": "boolean"
|
|
11826
12255
|
},
|
|
11827
|
-
{
|
|
11828
|
-
"path": "lastDrink",
|
|
11829
|
-
"valueType": "number"
|
|
11830
|
-
},
|
|
11831
|
-
{
|
|
11832
|
-
"path": "currentHourDrink",
|
|
11833
|
-
"valueType": "number"
|
|
11834
|
-
},
|
|
11835
|
-
{
|
|
11836
|
-
"path": "last24hDrink",
|
|
11837
|
-
"valueType": "number"
|
|
11838
|
-
},
|
|
11839
|
-
{
|
|
11840
|
-
"path": "todayDrink",
|
|
11841
|
-
"valueType": "number"
|
|
11842
|
-
},
|
|
11843
12256
|
{
|
|
11844
12257
|
"path": "error",
|
|
11845
12258
|
"valueType": "string"
|
|
@@ -12405,6 +12818,58 @@ Object.freeze({
|
|
|
12405
12818
|
}
|
|
12406
12819
|
]
|
|
12407
12820
|
});
|
|
12821
|
+
Object.freeze({
|
|
12822
|
+
"actions": { "run": 363e4 },
|
|
12823
|
+
"audio-analyzer": { "classify": 3e4 },
|
|
12824
|
+
"custom-model-registry": { "importModelBundle": 18e5 },
|
|
12825
|
+
"database-snapshot": { "writeSnapshot": 18e5 },
|
|
12826
|
+
"device-manager": {
|
|
12827
|
+
"migrateDevice": 72e4,
|
|
12828
|
+
"runDiscoverySweep": 12e4
|
|
12829
|
+
},
|
|
12830
|
+
"device-provider": { "reloadDevice": 18e4 },
|
|
12831
|
+
"llm": {
|
|
12832
|
+
"generate": 6e5,
|
|
12833
|
+
"generateVision": 6e5
|
|
12834
|
+
},
|
|
12835
|
+
"llm-runtime": {
|
|
12836
|
+
"complete": 6e5,
|
|
12837
|
+
"completeApple": 6e5,
|
|
12838
|
+
"ensureStarted": 6e5,
|
|
12839
|
+
"installModel": 36e5
|
|
12840
|
+
},
|
|
12841
|
+
"local-network": { "scanNetwork": 9e4 },
|
|
12842
|
+
"model-convert": { "convert": 6e5 },
|
|
12843
|
+
"pipeline-analytics": {
|
|
12844
|
+
"addRetrainFrameFromRecording": 6e4,
|
|
12845
|
+
"offerRetrainArchive": 12e4,
|
|
12846
|
+
"proposeRetrainAnnotationsWithLlm": 18e4,
|
|
12847
|
+
"resolveRetrainTrainingCorpus": 6e4,
|
|
12848
|
+
"writeRetrainArchive": 36e5
|
|
12849
|
+
},
|
|
12850
|
+
"server-management": { "applyServerUpdate": 96e4 },
|
|
12851
|
+
"terminal-session": { "pullOutput": 15e3 },
|
|
12852
|
+
"training": {
|
|
12853
|
+
"canaryResult": 12e4,
|
|
12854
|
+
"cancelJob": 12e4,
|
|
12855
|
+
"planJob": 6e4,
|
|
12856
|
+
"registerResult": 18e5,
|
|
12857
|
+
"rollbackCanary": 12e4,
|
|
12858
|
+
"startJob": 12e4,
|
|
12859
|
+
"startJobBatch": 12e4
|
|
12860
|
+
},
|
|
12861
|
+
"training-provider": {
|
|
12862
|
+
"cancelJob": 6e4,
|
|
12863
|
+
"cleanupJob": 3e5,
|
|
12864
|
+
"getJob": 6e4,
|
|
12865
|
+
"listJobEvents": 6e4,
|
|
12866
|
+
"listJobs": 12e4,
|
|
12867
|
+
"offerArtifact": 3e5,
|
|
12868
|
+
"readResult": 3e5,
|
|
12869
|
+
"submitJob": 18e5,
|
|
12870
|
+
"uploadDataset": 72e5
|
|
12871
|
+
}
|
|
12872
|
+
});
|
|
12408
12873
|
object({
|
|
12409
12874
|
code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
|
|
12410
12875
|
params: record(string(), union([string(), number()])).optional()
|
|
@@ -13949,10 +14414,414 @@ var IntegrationInstanceRefSchema = object({
|
|
|
13949
14414
|
]),
|
|
13950
14415
|
candidateStableId: string().optional()
|
|
13951
14416
|
});
|
|
13952
|
-
|
|
13953
|
-
|
|
13954
|
-
|
|
14417
|
+
/**
|
|
14418
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
14419
|
+
*
|
|
14420
|
+
* Apprise-derived model (see
|
|
14421
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
14422
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
14423
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
14424
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
14425
|
+
* message to what the kind supports — callers never special-case a service.
|
|
14426
|
+
*
|
|
14427
|
+
* DESIGN DECISIONS (locked):
|
|
14428
|
+
* - A target is an INSTANCE of this function cap (epic #440, step 6): the
|
|
14429
|
+
* providers serve their targets as `integration-instances` records, one
|
|
14430
|
+
* record kind per target kind, and the admin lists, adds, edits, switches
|
|
14431
|
+
* and deletes them through that cap. This cap keeps what an instance cannot
|
|
14432
|
+
* say: the kind catalogue (`listTargetKinds`: capabilities, delivery
|
|
14433
|
+
* parameters, brand icon), dispatch (`send`, `testTarget`) and the form
|
|
14434
|
+
* helpers (`discoverTargets`, `probeTargetConfig`).
|
|
14435
|
+
* - `listTargetKinds` / `discoverTargets` return arrays → the generated
|
|
14436
|
+
* cap-mount auto-`concatCollection`-fans them across every registered
|
|
14437
|
+
* provider so one catalog is routable. `send` / `testTarget` /
|
|
14438
|
+
* `probeTargetConfig` route to ONE provider by the `addonId` the generated
|
|
14439
|
+
* collection router extracts from the call input.
|
|
14440
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
14441
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
14442
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
14443
|
+
* base64 fallback needed.
|
|
14444
|
+
*
|
|
14445
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
14446
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
14447
|
+
* admin "Integrations" page.
|
|
14448
|
+
*/
|
|
14449
|
+
/**
|
|
14450
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
14451
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
14452
|
+
*/
|
|
14453
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
14454
|
+
"image",
|
|
14455
|
+
"video",
|
|
14456
|
+
"gif",
|
|
14457
|
+
"audio",
|
|
14458
|
+
"icon"
|
|
14459
|
+
]);
|
|
14460
|
+
/**
|
|
14461
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
14462
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
14463
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
14464
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
14465
|
+
*/
|
|
14466
|
+
var AttachmentSchema = object({
|
|
14467
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
14468
|
+
url: string().optional(),
|
|
14469
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
14470
|
+
mime: string().optional(),
|
|
14471
|
+
name: string().optional()
|
|
14472
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
14473
|
+
var NotificationFormatSchema = _enum([
|
|
14474
|
+
"text",
|
|
14475
|
+
"markdown",
|
|
14476
|
+
"html"
|
|
14477
|
+
]);
|
|
14478
|
+
/**
|
|
14479
|
+
* The CLOSED icon vocabulary an action button may use.
|
|
14480
|
+
*
|
|
14481
|
+
* A closed set, not a free string, and that is the whole point: an arbitrary
|
|
14482
|
+
* icon name is one that ntfy renders, zentik silently drops, and nobody
|
|
14483
|
+
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
14484
|
+
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
14485
|
+
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
14486
|
+
*
|
|
14487
|
+
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
14488
|
+
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
14489
|
+
* differently.
|
|
14490
|
+
*
|
|
14491
|
+
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
14492
|
+
*
|
|
14493
|
+
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
14494
|
+
* the whole set onto its own renderer's vocabulary through a
|
|
14495
|
+
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
14496
|
+
* fallback, so adding a member here fails every adapter's build until someone
|
|
14497
|
+
* decides its glyph, which is the only place that decision can be made
|
|
14498
|
+
* honestly.
|
|
14499
|
+
*
|
|
14500
|
+
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
14501
|
+
* `disarm` straight through; iOS feeds that string to
|
|
14502
|
+
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
14503
|
+
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
14504
|
+
* mapping, and "the field is documented" is not "the value renders".
|
|
14505
|
+
*
|
|
14506
|
+
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
14507
|
+
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
14508
|
+
* so an addon that emits a token the running hub does not know does not lose an
|
|
14509
|
+
* icon — its whole `send` fails Zod validation and the notification never
|
|
14510
|
+
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
14511
|
+
*/
|
|
14512
|
+
var NotificationActionIconSchema = _enum([
|
|
14513
|
+
"acknowledge",
|
|
14514
|
+
"dismiss",
|
|
14515
|
+
"silence",
|
|
14516
|
+
"snooze",
|
|
14517
|
+
"view",
|
|
14518
|
+
"play",
|
|
14519
|
+
"open",
|
|
14520
|
+
"close",
|
|
14521
|
+
"lock",
|
|
14522
|
+
"unlock",
|
|
14523
|
+
"arm",
|
|
14524
|
+
"arm-home",
|
|
14525
|
+
"arm-away",
|
|
14526
|
+
"arm-night",
|
|
14527
|
+
"disarm",
|
|
14528
|
+
"light",
|
|
14529
|
+
"alert",
|
|
14530
|
+
"camera"
|
|
14531
|
+
]);
|
|
14532
|
+
/** A single tap-through action button. */
|
|
14533
|
+
var NotificationActionSchema = object({
|
|
14534
|
+
id: string(),
|
|
14535
|
+
label: string(),
|
|
14536
|
+
url: string().optional(),
|
|
14537
|
+
/** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
|
|
14538
|
+
icon: NotificationActionIconSchema.optional(),
|
|
14539
|
+
/**
|
|
14540
|
+
* Renders in a warning style where the notifier supports it.
|
|
14541
|
+
*
|
|
14542
|
+
* A HINT, never a gate. The callback's authority is its token and nothing
|
|
14543
|
+
* else — see `notification-center/action-token.ts` for what that does and
|
|
14544
|
+
* does not buy.
|
|
14545
|
+
*/
|
|
14546
|
+
destructive: boolean().optional(),
|
|
14547
|
+
/**
|
|
14548
|
+
* How the tap should REACH the url.
|
|
14549
|
+
*
|
|
14550
|
+
* `navigate` (absent, and every button authored before this field) opens it:
|
|
14551
|
+
* the phone leaves the notification and shows whatever the callback returns.
|
|
14552
|
+
* That is right for a button whose answer the operator wants to read.
|
|
14553
|
+
*
|
|
14554
|
+
* `background` fires it as a POST and stays put. It exists for the buttons
|
|
14555
|
+
* whose whole point is not to interrupt — "silence this for 30 minutes" is
|
|
14556
|
+
* an answer to the notification, and being thrown into a browser tab to
|
|
14557
|
+
* confirm it costs more attention than the notification did. A backend that
|
|
14558
|
+
* cannot do a background call renders it as an ordinary link (the adapters
|
|
14559
|
+
* fall back rather than dropping the button), so this is a preference, never
|
|
14560
|
+
* a requirement.
|
|
14561
|
+
*/
|
|
14562
|
+
mode: _enum(["navigate", "background"]).optional()
|
|
14563
|
+
});
|
|
14564
|
+
/** A delivery parameter value: what a notifier declared it takes. */
|
|
14565
|
+
var DeliveryParamValueSchema = union([
|
|
14566
|
+
string(),
|
|
14567
|
+
number(),
|
|
14568
|
+
boolean()
|
|
14569
|
+
]);
|
|
14570
|
+
/**
|
|
14571
|
+
* One extra delivery parameter a notifier KIND declares (D938). A rule that
|
|
14572
|
+
* addresses a target of that kind may set it; a kind that declares nothing is
|
|
14573
|
+
* never handed one. The admin UI derives its control from this descriptor —
|
|
14574
|
+
* no editor knows a service by name.
|
|
14575
|
+
*
|
|
14576
|
+
* Optional fields are `.optional()`, never `.default()` (a Zod default does not
|
|
14577
|
+
* run on the addon cap path).
|
|
14578
|
+
*/
|
|
14579
|
+
var DeliveryParamSchema = object({
|
|
14580
|
+
key: string().min(1),
|
|
14581
|
+
label: string(),
|
|
14582
|
+
/** i18n key of the label, resolved by the declaring addon's namespace. */
|
|
14583
|
+
labelKey: string().optional(),
|
|
14584
|
+
type: _enum([
|
|
14585
|
+
"enum",
|
|
14586
|
+
"number",
|
|
14587
|
+
"boolean",
|
|
14588
|
+
"string"
|
|
14589
|
+
]),
|
|
14590
|
+
/** `enum` only: the closed set of accepted values. */
|
|
14591
|
+
options: array(object({
|
|
14592
|
+
value: string(),
|
|
14593
|
+
label: string()
|
|
14594
|
+
})).optional(),
|
|
14595
|
+
/** `number` only. */
|
|
14596
|
+
min: number().optional(),
|
|
14597
|
+
max: number().optional(),
|
|
14598
|
+
/** What the notifier does when the rule sets nothing; shown as the placeholder. */
|
|
14599
|
+
default: DeliveryParamValueSchema.optional()
|
|
14600
|
+
});
|
|
14601
|
+
/**
|
|
14602
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
14603
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
14604
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
14605
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
14606
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
14607
|
+
* `priority` for that one target.
|
|
14608
|
+
*/
|
|
14609
|
+
var NotificationSchema = object({
|
|
14610
|
+
body: string(),
|
|
14611
|
+
title: string().optional(),
|
|
14612
|
+
format: NotificationFormatSchema.default("text"),
|
|
14613
|
+
priority: number().int().min(1).max(5).default(3),
|
|
14614
|
+
level: string().optional(),
|
|
14615
|
+
attachments: array(AttachmentSchema).optional(),
|
|
14616
|
+
clickUrl: string().optional(),
|
|
14617
|
+
actions: array(NotificationActionSchema).optional(),
|
|
14618
|
+
sound: string().optional(),
|
|
14619
|
+
ttl: number().optional(),
|
|
14620
|
+
tag: string().optional(),
|
|
14621
|
+
deviceId: number().optional(),
|
|
14622
|
+
eventId: string().optional(),
|
|
14623
|
+
metadata: record(string(), unknown()).optional(),
|
|
14624
|
+
/**
|
|
14625
|
+
* Values for the parameters the target's kind DECLARES in
|
|
14626
|
+
* {@link TargetKindSchema} `deliveryParams`. Already validated against the
|
|
14627
|
+
* declaration by the sender; a notifier reads only the keys it declared.
|
|
14628
|
+
*/
|
|
14629
|
+
delivery: record(string(), DeliveryParamValueSchema).optional()
|
|
14630
|
+
});
|
|
14631
|
+
/** One declared native severity/priority level for a kind. */
|
|
14632
|
+
var TargetKindLevelSchema = object({
|
|
14633
|
+
id: string(),
|
|
14634
|
+
label: string(),
|
|
14635
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
14636
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
14637
|
+
flags: object({
|
|
14638
|
+
critical: boolean().optional(),
|
|
14639
|
+
silent: boolean().optional(),
|
|
14640
|
+
noPush: boolean().optional()
|
|
14641
|
+
}).optional(),
|
|
14642
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
14643
|
+
requires: array(string()).optional(),
|
|
14644
|
+
description: string().optional()
|
|
14645
|
+
});
|
|
14646
|
+
/** The full capability block consulted before dispatch. */
|
|
14647
|
+
var TargetKindCapsSchema = object({
|
|
14648
|
+
attachments: object({
|
|
14649
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
14650
|
+
mode: _enum([
|
|
14651
|
+
"url",
|
|
14652
|
+
"bytes",
|
|
14653
|
+
"both"
|
|
14654
|
+
]),
|
|
14655
|
+
max: number().int().nonnegative(),
|
|
14656
|
+
maxBytes: number().int().positive().optional()
|
|
14657
|
+
}),
|
|
14658
|
+
/** Max action buttons (0 = none). */
|
|
14659
|
+
actions: number().int().nonnegative(),
|
|
14660
|
+
/**
|
|
14661
|
+
* Whether this kind renders a per-action ICON.
|
|
14662
|
+
*
|
|
14663
|
+
* `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
|
|
14664
|
+
* run on the addon cap path — three production failures in one day taught
|
|
14665
|
+
* this repo that once. Absent is read as false by the degrade engine, which
|
|
14666
|
+
* is the safe direction: an icon that is not rendered costs nothing, an icon
|
|
14667
|
+
* assumed and dropped costs the operator's trust in the field.
|
|
14668
|
+
*/
|
|
14669
|
+
actionIcons: boolean().optional(),
|
|
14670
|
+
levels: array(TargetKindLevelSchema),
|
|
14671
|
+
format: array(NotificationFormatSchema),
|
|
14672
|
+
clickUrl: boolean(),
|
|
14673
|
+
sound: boolean(),
|
|
14674
|
+
ttl: boolean(),
|
|
14675
|
+
bodyMaxLen: number().int().positive()
|
|
14676
|
+
});
|
|
14677
|
+
/**
|
|
14678
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
14679
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
14680
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
14681
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
14682
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
14683
|
+
*/
|
|
14684
|
+
var ConfigSchemaPassthrough$3 = unknown();
|
|
14685
|
+
var TargetKindSchema = object({
|
|
14686
|
+
kind: string(),
|
|
14687
|
+
label: string(),
|
|
14688
|
+
icon: string(),
|
|
14689
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
14690
|
+
addonId: string(),
|
|
14691
|
+
/**
|
|
14692
|
+
* URL of the kind's bundled BRAND icon, served by the providing addon over
|
|
14693
|
+
* its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
|
|
14694
|
+
* when the addon bundles no icon for that kind — the client then falls back
|
|
14695
|
+
* to a neutral glyph rather than rendering the raw `icon` NAME as text.
|
|
14696
|
+
*
|
|
14697
|
+
* Root-relative on purpose: it resolves against whatever origin serves a web
|
|
14698
|
+
* client, and a native client joins it onto its own hub base.
|
|
14699
|
+
*
|
|
14700
|
+
* DECLARED here deliberately. It used to travel as an undeclared passthrough
|
|
14701
|
+
* field that survived only because the runtime cap-router forwards provider
|
|
14702
|
+
* output verbatim — so every consumer had to re-declare it by hand to stop
|
|
14703
|
+
* its own Zod parse from stripping it, and the whole arrangement would have
|
|
14704
|
+
* broken silently the moment output validation was tightened anywhere.
|
|
14705
|
+
*/
|
|
14706
|
+
iconUrl: string().optional(),
|
|
14707
|
+
/**
|
|
14708
|
+
* Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
|
|
14709
|
+
*
|
|
14710
|
+
* The server knows this and therefore says it, because the client cannot
|
|
14711
|
+
* safely guess: a React-Native client renders SVG and raster through two
|
|
14712
|
+
* DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
|
|
14713
|
+
* not decode SVG on iOS/Android), so without this it silently fell back to a
|
|
14714
|
+
* placeholder glyph for every vector icon while the web build looked fine.
|
|
14715
|
+
*
|
|
14716
|
+
* Absent when {@link iconUrl} is absent, or for a legacy provider that has
|
|
14717
|
+
* not been updated — a client that cannot determine the type should prefer
|
|
14718
|
+
* its raster path, which is the safe default for an unknown image.
|
|
14719
|
+
*/
|
|
14720
|
+
iconMediaType: string().optional(),
|
|
14721
|
+
configSchema: ConfigSchemaPassthrough$3,
|
|
14722
|
+
/**
|
|
14723
|
+
* The config keys that decide WHERE this kind's secrets are sent (server,
|
|
14724
|
+
* base URL, instance, chat, recipient). A save that changes any of them
|
|
14725
|
+
* while leaving a secret redacted is refused by the provider (D634), so an
|
|
14726
|
+
* editor uses this to ask for the secret on exactly those edits instead of
|
|
14727
|
+
* on every edit.
|
|
14728
|
+
*
|
|
14729
|
+
* Optional: absent from a provider that holds no secret (the Home Assistant
|
|
14730
|
+
* kinds) and from a provider older than this field — an editor that finds
|
|
14731
|
+
* it absent must assume ANY edit may need the secret.
|
|
14732
|
+
*/
|
|
14733
|
+
destinationKeys: array(string()).optional(),
|
|
14734
|
+
supportsDiscovery: boolean(),
|
|
14735
|
+
/**
|
|
14736
|
+
* Extra delivery parameters a rule may set for a target of this kind (D938).
|
|
14737
|
+
* Absent = none; the rule editor then offers nothing.
|
|
14738
|
+
*/
|
|
14739
|
+
deliveryParams: array(DeliveryParamSchema).optional(),
|
|
14740
|
+
caps: TargetKindCapsSchema
|
|
14741
|
+
});
|
|
14742
|
+
/**
|
|
14743
|
+
* A target as a provider's own code sees it (the notification-center bridge, the
|
|
14744
|
+
* send path): the flat record body split into the name, the switch and the
|
|
14745
|
+
* kind's fields. `config` holds secrets; a reader that serves it to a client
|
|
14746
|
+
* REDACTS secret fields (a presence marker only) — never round-trip a stored
|
|
14747
|
+
* secret to the UI.
|
|
14748
|
+
*/
|
|
14749
|
+
var TargetSchema = object({
|
|
14750
|
+
id: string(),
|
|
14751
|
+
name: string(),
|
|
14752
|
+
kind: string(),
|
|
14753
|
+
addonId: string(),
|
|
14754
|
+
enabled: boolean(),
|
|
14755
|
+
config: record(string(), unknown())
|
|
14756
|
+
});
|
|
14757
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
14758
|
+
var DiscoveredTargetSchema = object({
|
|
14759
|
+
kind: string(),
|
|
14760
|
+
suggestedName: string(),
|
|
14761
|
+
config: record(string(), unknown())
|
|
14762
|
+
});
|
|
14763
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
14764
|
+
var RenderedAsSchema = object({
|
|
14765
|
+
level: string(),
|
|
14766
|
+
format: NotificationFormatSchema,
|
|
14767
|
+
attachmentsSent: number().int().nonnegative(),
|
|
14768
|
+
actionsSent: number().int().nonnegative(),
|
|
14769
|
+
truncated: boolean(),
|
|
14770
|
+
dropped: array(string())
|
|
14771
|
+
});
|
|
14772
|
+
var SendResultSchema = object({
|
|
14773
|
+
success: boolean(),
|
|
14774
|
+
error: string().optional(),
|
|
14775
|
+
renderedAs: RenderedAsSchema.optional()
|
|
14776
|
+
});
|
|
14777
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
14778
|
+
var TestResultSchema = SendResultSchema;
|
|
14779
|
+
/**
|
|
14780
|
+
* Pre-save credential probe against a partial (unsaved) target config.
|
|
14781
|
+
* `resolvedUrl` never includes secrets (token stripped from path).
|
|
14782
|
+
*/
|
|
14783
|
+
var ProbeTargetConfigResultSchema = object({
|
|
14784
|
+
ok: boolean(),
|
|
14785
|
+
resolvedUrl: string(),
|
|
14786
|
+
httpStatus: number().int().optional(),
|
|
14787
|
+
stateInstance: string().optional(),
|
|
14788
|
+
error: string().optional()
|
|
14789
|
+
});
|
|
14790
|
+
method(object({}), array(TargetKindSchema)), method(object({
|
|
14791
|
+
kind: string(),
|
|
14792
|
+
config: record(string(), unknown()).optional(),
|
|
14793
|
+
/**
|
|
14794
|
+
* When editing / duplicating, the blank password field never round-trips
|
|
14795
|
+
* the stored token. Pass the source target id so the provider can restore
|
|
14796
|
+
* secrets server-side before dialling.
|
|
14797
|
+
*/
|
|
14798
|
+
targetId: string().optional()
|
|
14799
|
+
}), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
|
|
14800
|
+
kind: string(),
|
|
14801
|
+
config: record(string(), unknown()),
|
|
14802
|
+
/** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
|
|
14803
|
+
targetId: string().optional()
|
|
14804
|
+
}), ProbeTargetConfigResultSchema, {
|
|
14805
|
+
kind: "mutation",
|
|
14806
|
+
auth: "admin"
|
|
14807
|
+
}), method(object({
|
|
14808
|
+
targetId: string(),
|
|
14809
|
+
notification: NotificationSchema
|
|
14810
|
+
}), SendResultSchema, {
|
|
14811
|
+
kind: "mutation",
|
|
14812
|
+
auth: "admin"
|
|
14813
|
+
}), method(object({
|
|
14814
|
+
targetId: string(),
|
|
14815
|
+
sample: NotificationSchema.optional()
|
|
14816
|
+
}), TestResultSchema, {
|
|
14817
|
+
kind: "mutation",
|
|
14818
|
+
auth: "admin"
|
|
14819
|
+
});
|
|
14820
|
+
looseObject({
|
|
14821
|
+
name: string().min(1),
|
|
14822
|
+
enabled: boolean().optional()
|
|
13955
14823
|
});
|
|
14824
|
+
TargetSchema.omit({ id: true });
|
|
13956
14825
|
var EncodeProfileSchema = object({
|
|
13957
14826
|
video: object({
|
|
13958
14827
|
codec: _enum([
|
|
@@ -20449,31 +21318,21 @@ var APPLIANCE_CAP_VOCABULARY = {
|
|
|
20449
21318
|
"pet-fountain": {
|
|
20450
21319
|
scope: "device",
|
|
20451
21320
|
noun: t("Pet fountain", "Fontana per animali"),
|
|
20452
|
-
actions: [
|
|
20453
|
-
|
|
20454
|
-
|
|
20455
|
-
|
|
20456
|
-
|
|
20457
|
-
|
|
20458
|
-
|
|
20459
|
-
|
|
20460
|
-
|
|
20461
|
-
|
|
20462
|
-
|
|
20463
|
-
|
|
20464
|
-
|
|
20465
|
-
|
|
20466
|
-
|
|
20467
|
-
args: { on: false }
|
|
20468
|
-
},
|
|
20469
|
-
{
|
|
20470
|
-
id: "petFountain.resetDailyConsumption",
|
|
20471
|
-
method: "resetDailyConsumption",
|
|
20472
|
-
label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
|
|
20473
|
-
phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
|
|
20474
|
-
icon: "rotate-ccw"
|
|
20475
|
-
}
|
|
20476
|
-
],
|
|
21321
|
+
actions: [{
|
|
21322
|
+
id: "petFountain.pumpOn",
|
|
21323
|
+
method: "setPump",
|
|
21324
|
+
label: t("Pump on", "Pompa accesa"),
|
|
21325
|
+
phrase: t("Start the pump of {device}", "Avvia la pompa di {device}"),
|
|
21326
|
+
icon: "play",
|
|
21327
|
+
args: { on: true }
|
|
21328
|
+
}, {
|
|
21329
|
+
id: "petFountain.pumpOff",
|
|
21330
|
+
method: "setPump",
|
|
21331
|
+
label: t("Pump off", "Pompa spenta"),
|
|
21332
|
+
phrase: t("Stop the pump of {device}", "Ferma la pompa di {device}"),
|
|
21333
|
+
icon: "square",
|
|
21334
|
+
args: { on: false }
|
|
21335
|
+
}],
|
|
20477
21336
|
state: [{
|
|
20478
21337
|
kind: "boolean",
|
|
20479
21338
|
field: "empty",
|
|
@@ -22492,7 +23351,6 @@ var SYSTEM_CAP_VOCABULARY = {
|
|
|
22492
23351
|
"calendar-source": system(INTERNAL),
|
|
22493
23352
|
calendars: system("calendars feed schedules and conditions, not device actions"),
|
|
22494
23353
|
composer: system("device composition — an authoring tool, not an action"),
|
|
22495
|
-
"connection-test": system(INTERNAL),
|
|
22496
23354
|
"core-blocks": system(INTERNAL),
|
|
22497
23355
|
"custom-model-registry": system(ML),
|
|
22498
23356
|
"data-store-provider": system(INTERNAL),
|
|
@@ -22537,7 +23395,6 @@ var SYSTEM_CAP_VOCABULARY = {
|
|
|
22537
23395
|
"notification-output": system("notification delivery — reached through notifier devices and rules"),
|
|
22538
23396
|
"notification-rules": system("notification rules — authored on their own page"),
|
|
22539
23397
|
"oauth-integration": system(IDENTITY),
|
|
22540
|
-
"oidc-connections": system(IDENTITY),
|
|
22541
23398
|
"osd-manager": system(PIPELINE),
|
|
22542
23399
|
"pipeline-executor": system(PIPELINE),
|
|
22543
23400
|
"pipeline-orchestrator": system(PIPELINE),
|
|
@@ -44367,8 +45224,15 @@ var ActionInputSchema = object({
|
|
|
44367
45224
|
var ActionRunOriginSchema = object({
|
|
44368
45225
|
/** The automation block whose step started it. */
|
|
44369
45226
|
blockId: string().min(1).optional() });
|
|
44370
|
-
/**
|
|
44371
|
-
|
|
45227
|
+
/**
|
|
45228
|
+
* `started` = the caller did not ask to wait. `timed-out` = the run reached the
|
|
45229
|
+
* ceiling (`ACTION_RUN_MAX_MS`) and was stopped; it is never a `ran`.
|
|
45230
|
+
*/
|
|
45231
|
+
var ActionRunOutcomeSchema = union([
|
|
45232
|
+
AutomationRunOutcomeSchema,
|
|
45233
|
+
literal("started"),
|
|
45234
|
+
literal("timed-out")
|
|
45235
|
+
]);
|
|
44372
45236
|
var ActionRunResultSchema = object({
|
|
44373
45237
|
runId: string().min(1),
|
|
44374
45238
|
outcome: ActionRunOutcomeSchema,
|
|
@@ -44402,427 +45266,6 @@ var UnitWarningSchema = object({
|
|
|
44402
45266
|
assumedUnit: string(),
|
|
44403
45267
|
message: string()
|
|
44404
45268
|
});
|
|
44405
|
-
/**
|
|
44406
|
-
* notification-output — canonical, capability-gated notification delivery.
|
|
44407
|
-
*
|
|
44408
|
-
* Apprise-derived model (see
|
|
44409
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
44410
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
44411
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
44412
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
44413
|
-
* message to what the kind supports — callers never special-case a service.
|
|
44414
|
-
*
|
|
44415
|
-
* DESIGN DECISIONS (locked):
|
|
44416
|
-
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
44417
|
-
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
44418
|
-
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
44419
|
-
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
44420
|
-
* alternative would fork the UI per addon and cannot host the
|
|
44421
|
-
* discovery→adopt flow.
|
|
44422
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
44423
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
44424
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
44425
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
44426
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
44427
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
44428
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
44429
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
44430
|
-
* base64 fallback needed.
|
|
44431
|
-
*
|
|
44432
|
-
* TODO (deferred, closed-set change — separate decision): add
|
|
44433
|
-
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
44434
|
-
* admin "Integrations" page.
|
|
44435
|
-
*/
|
|
44436
|
-
/**
|
|
44437
|
-
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
44438
|
-
* adapter picks what it supports and the degrade engine filters the rest.
|
|
44439
|
-
*/
|
|
44440
|
-
var AttachmentMediaTypeSchema = _enum([
|
|
44441
|
-
"image",
|
|
44442
|
-
"video",
|
|
44443
|
-
"gif",
|
|
44444
|
-
"audio",
|
|
44445
|
-
"icon"
|
|
44446
|
-
]);
|
|
44447
|
-
/**
|
|
44448
|
-
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
44449
|
-
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
44450
|
-
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
44451
|
-
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
44452
|
-
*/
|
|
44453
|
-
var AttachmentSchema = object({
|
|
44454
|
-
mediaType: AttachmentMediaTypeSchema,
|
|
44455
|
-
url: string().optional(),
|
|
44456
|
-
bytes: _instanceof(Uint8Array).optional(),
|
|
44457
|
-
mime: string().optional(),
|
|
44458
|
-
name: string().optional()
|
|
44459
|
-
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
44460
|
-
var NotificationFormatSchema = _enum([
|
|
44461
|
-
"text",
|
|
44462
|
-
"markdown",
|
|
44463
|
-
"html"
|
|
44464
|
-
]);
|
|
44465
|
-
/**
|
|
44466
|
-
* The CLOSED icon vocabulary an action button may use.
|
|
44467
|
-
*
|
|
44468
|
-
* A closed set, not a free string, and that is the whole point: an arbitrary
|
|
44469
|
-
* icon name is one that ntfy renders, zentik silently drops, and nobody
|
|
44470
|
-
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
44471
|
-
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
44472
|
-
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
44473
|
-
*
|
|
44474
|
-
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
44475
|
-
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
44476
|
-
* differently.
|
|
44477
|
-
*
|
|
44478
|
-
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
44479
|
-
*
|
|
44480
|
-
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
44481
|
-
* the whole set onto its own renderer's vocabulary through a
|
|
44482
|
-
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
44483
|
-
* fallback, so adding a member here fails every adapter's build until someone
|
|
44484
|
-
* decides its glyph, which is the only place that decision can be made
|
|
44485
|
-
* honestly.
|
|
44486
|
-
*
|
|
44487
|
-
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
44488
|
-
* `disarm` straight through; iOS feeds that string to
|
|
44489
|
-
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
44490
|
-
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
44491
|
-
* mapping, and "the field is documented" is not "the value renders".
|
|
44492
|
-
*
|
|
44493
|
-
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
44494
|
-
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
44495
|
-
* so an addon that emits a token the running hub does not know does not lose an
|
|
44496
|
-
* icon — its whole `send` fails Zod validation and the notification never
|
|
44497
|
-
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
44498
|
-
*/
|
|
44499
|
-
var NotificationActionIconSchema = _enum([
|
|
44500
|
-
"acknowledge",
|
|
44501
|
-
"dismiss",
|
|
44502
|
-
"silence",
|
|
44503
|
-
"snooze",
|
|
44504
|
-
"view",
|
|
44505
|
-
"play",
|
|
44506
|
-
"open",
|
|
44507
|
-
"close",
|
|
44508
|
-
"lock",
|
|
44509
|
-
"unlock",
|
|
44510
|
-
"arm",
|
|
44511
|
-
"arm-home",
|
|
44512
|
-
"arm-away",
|
|
44513
|
-
"arm-night",
|
|
44514
|
-
"disarm",
|
|
44515
|
-
"light",
|
|
44516
|
-
"alert",
|
|
44517
|
-
"camera"
|
|
44518
|
-
]);
|
|
44519
|
-
/** A single tap-through action button. */
|
|
44520
|
-
var NotificationActionSchema = object({
|
|
44521
|
-
id: string(),
|
|
44522
|
-
label: string(),
|
|
44523
|
-
url: string().optional(),
|
|
44524
|
-
/** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
|
|
44525
|
-
icon: NotificationActionIconSchema.optional(),
|
|
44526
|
-
/**
|
|
44527
|
-
* Renders in a warning style where the notifier supports it.
|
|
44528
|
-
*
|
|
44529
|
-
* A HINT, never a gate. The callback's authority is its token and nothing
|
|
44530
|
-
* else — see `notification-center/action-token.ts` for what that does and
|
|
44531
|
-
* does not buy.
|
|
44532
|
-
*/
|
|
44533
|
-
destructive: boolean().optional(),
|
|
44534
|
-
/**
|
|
44535
|
-
* How the tap should REACH the url.
|
|
44536
|
-
*
|
|
44537
|
-
* `navigate` (absent, and every button authored before this field) opens it:
|
|
44538
|
-
* the phone leaves the notification and shows whatever the callback returns.
|
|
44539
|
-
* That is right for a button whose answer the operator wants to read.
|
|
44540
|
-
*
|
|
44541
|
-
* `background` fires it as a POST and stays put. It exists for the buttons
|
|
44542
|
-
* whose whole point is not to interrupt — "silence this for 30 minutes" is
|
|
44543
|
-
* an answer to the notification, and being thrown into a browser tab to
|
|
44544
|
-
* confirm it costs more attention than the notification did. A backend that
|
|
44545
|
-
* cannot do a background call renders it as an ordinary link (the adapters
|
|
44546
|
-
* fall back rather than dropping the button), so this is a preference, never
|
|
44547
|
-
* a requirement.
|
|
44548
|
-
*/
|
|
44549
|
-
mode: _enum(["navigate", "background"]).optional()
|
|
44550
|
-
});
|
|
44551
|
-
/** A delivery parameter value: what a notifier declared it takes. */
|
|
44552
|
-
var DeliveryParamValueSchema = union([
|
|
44553
|
-
string(),
|
|
44554
|
-
number(),
|
|
44555
|
-
boolean()
|
|
44556
|
-
]);
|
|
44557
|
-
/**
|
|
44558
|
-
* One extra delivery parameter a notifier KIND declares (D938). A rule that
|
|
44559
|
-
* addresses a target of that kind may set it; a kind that declares nothing is
|
|
44560
|
-
* never handed one. The admin UI derives its control from this descriptor —
|
|
44561
|
-
* no editor knows a service by name.
|
|
44562
|
-
*
|
|
44563
|
-
* Optional fields are `.optional()`, never `.default()` (a Zod default does not
|
|
44564
|
-
* run on the addon cap path).
|
|
44565
|
-
*/
|
|
44566
|
-
var DeliveryParamSchema = object({
|
|
44567
|
-
key: string().min(1),
|
|
44568
|
-
label: string(),
|
|
44569
|
-
/** i18n key of the label, resolved by the declaring addon's namespace. */
|
|
44570
|
-
labelKey: string().optional(),
|
|
44571
|
-
type: _enum([
|
|
44572
|
-
"enum",
|
|
44573
|
-
"number",
|
|
44574
|
-
"boolean",
|
|
44575
|
-
"string"
|
|
44576
|
-
]),
|
|
44577
|
-
/** `enum` only: the closed set of accepted values. */
|
|
44578
|
-
options: array(object({
|
|
44579
|
-
value: string(),
|
|
44580
|
-
label: string()
|
|
44581
|
-
})).optional(),
|
|
44582
|
-
/** `number` only. */
|
|
44583
|
-
min: number().optional(),
|
|
44584
|
-
max: number().optional(),
|
|
44585
|
-
/** What the notifier does when the rule sets nothing; shown as the placeholder. */
|
|
44586
|
-
default: DeliveryParamValueSchema.optional()
|
|
44587
|
-
});
|
|
44588
|
-
/**
|
|
44589
|
-
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
44590
|
-
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
44591
|
-
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
44592
|
-
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
44593
|
-
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
44594
|
-
* `priority` for that one target.
|
|
44595
|
-
*/
|
|
44596
|
-
var NotificationSchema = object({
|
|
44597
|
-
body: string(),
|
|
44598
|
-
title: string().optional(),
|
|
44599
|
-
format: NotificationFormatSchema.default("text"),
|
|
44600
|
-
priority: number().int().min(1).max(5).default(3),
|
|
44601
|
-
level: string().optional(),
|
|
44602
|
-
attachments: array(AttachmentSchema).optional(),
|
|
44603
|
-
clickUrl: string().optional(),
|
|
44604
|
-
actions: array(NotificationActionSchema).optional(),
|
|
44605
|
-
sound: string().optional(),
|
|
44606
|
-
ttl: number().optional(),
|
|
44607
|
-
tag: string().optional(),
|
|
44608
|
-
deviceId: number().optional(),
|
|
44609
|
-
eventId: string().optional(),
|
|
44610
|
-
metadata: record(string(), unknown()).optional(),
|
|
44611
|
-
/**
|
|
44612
|
-
* Values for the parameters the target's kind DECLARES in
|
|
44613
|
-
* {@link TargetKindSchema} `deliveryParams`. Already validated against the
|
|
44614
|
-
* declaration by the sender; a notifier reads only the keys it declared.
|
|
44615
|
-
*/
|
|
44616
|
-
delivery: record(string(), DeliveryParamValueSchema).optional()
|
|
44617
|
-
});
|
|
44618
|
-
/** One declared native severity/priority level for a kind. */
|
|
44619
|
-
var TargetKindLevelSchema = object({
|
|
44620
|
-
id: string(),
|
|
44621
|
-
label: string(),
|
|
44622
|
-
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
44623
|
-
ordinal: number().int().min(1).max(5).nullable(),
|
|
44624
|
-
flags: object({
|
|
44625
|
-
critical: boolean().optional(),
|
|
44626
|
-
silent: boolean().optional(),
|
|
44627
|
-
noPush: boolean().optional()
|
|
44628
|
-
}).optional(),
|
|
44629
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
44630
|
-
requires: array(string()).optional(),
|
|
44631
|
-
description: string().optional()
|
|
44632
|
-
});
|
|
44633
|
-
/** The full capability block consulted before dispatch. */
|
|
44634
|
-
var TargetKindCapsSchema = object({
|
|
44635
|
-
attachments: object({
|
|
44636
|
-
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
44637
|
-
mode: _enum([
|
|
44638
|
-
"url",
|
|
44639
|
-
"bytes",
|
|
44640
|
-
"both"
|
|
44641
|
-
]),
|
|
44642
|
-
max: number().int().nonnegative(),
|
|
44643
|
-
maxBytes: number().int().positive().optional()
|
|
44644
|
-
}),
|
|
44645
|
-
/** Max action buttons (0 = none). */
|
|
44646
|
-
actions: number().int().nonnegative(),
|
|
44647
|
-
/**
|
|
44648
|
-
* Whether this kind renders a per-action ICON.
|
|
44649
|
-
*
|
|
44650
|
-
* `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
|
|
44651
|
-
* run on the addon cap path — three production failures in one day taught
|
|
44652
|
-
* this repo that once. Absent is read as false by the degrade engine, which
|
|
44653
|
-
* is the safe direction: an icon that is not rendered costs nothing, an icon
|
|
44654
|
-
* assumed and dropped costs the operator's trust in the field.
|
|
44655
|
-
*/
|
|
44656
|
-
actionIcons: boolean().optional(),
|
|
44657
|
-
levels: array(TargetKindLevelSchema),
|
|
44658
|
-
format: array(NotificationFormatSchema),
|
|
44659
|
-
clickUrl: boolean(),
|
|
44660
|
-
sound: boolean(),
|
|
44661
|
-
ttl: boolean(),
|
|
44662
|
-
bodyMaxLen: number().int().positive()
|
|
44663
|
-
});
|
|
44664
|
-
/**
|
|
44665
|
-
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
44666
|
-
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
44667
|
-
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
44668
|
-
* the union is large and not meant for runtime validation here; the exported
|
|
44669
|
-
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
44670
|
-
*/
|
|
44671
|
-
var ConfigSchemaPassthrough$4 = unknown();
|
|
44672
|
-
var TargetKindSchema = object({
|
|
44673
|
-
kind: string(),
|
|
44674
|
-
label: string(),
|
|
44675
|
-
icon: string(),
|
|
44676
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
44677
|
-
addonId: string(),
|
|
44678
|
-
/**
|
|
44679
|
-
* URL of the kind's bundled BRAND icon, served by the providing addon over
|
|
44680
|
-
* its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
|
|
44681
|
-
* when the addon bundles no icon for that kind — the client then falls back
|
|
44682
|
-
* to a neutral glyph rather than rendering the raw `icon` NAME as text.
|
|
44683
|
-
*
|
|
44684
|
-
* Root-relative on purpose: it resolves against whatever origin serves a web
|
|
44685
|
-
* client, and a native client joins it onto its own hub base.
|
|
44686
|
-
*
|
|
44687
|
-
* DECLARED here deliberately. It used to travel as an undeclared passthrough
|
|
44688
|
-
* field that survived only because the runtime cap-router forwards provider
|
|
44689
|
-
* output verbatim — so every consumer had to re-declare it by hand to stop
|
|
44690
|
-
* its own Zod parse from stripping it, and the whole arrangement would have
|
|
44691
|
-
* broken silently the moment output validation was tightened anywhere.
|
|
44692
|
-
*/
|
|
44693
|
-
iconUrl: string().optional(),
|
|
44694
|
-
/**
|
|
44695
|
-
* Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
|
|
44696
|
-
*
|
|
44697
|
-
* The server knows this and therefore says it, because the client cannot
|
|
44698
|
-
* safely guess: a React-Native client renders SVG and raster through two
|
|
44699
|
-
* DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
|
|
44700
|
-
* not decode SVG on iOS/Android), so without this it silently fell back to a
|
|
44701
|
-
* placeholder glyph for every vector icon while the web build looked fine.
|
|
44702
|
-
*
|
|
44703
|
-
* Absent when {@link iconUrl} is absent, or for a legacy provider that has
|
|
44704
|
-
* not been updated — a client that cannot determine the type should prefer
|
|
44705
|
-
* its raster path, which is the safe default for an unknown image.
|
|
44706
|
-
*/
|
|
44707
|
-
iconMediaType: string().optional(),
|
|
44708
|
-
configSchema: ConfigSchemaPassthrough$4,
|
|
44709
|
-
/**
|
|
44710
|
-
* The config keys that decide WHERE this kind's secrets are sent (server,
|
|
44711
|
-
* base URL, instance, chat, recipient). A save that changes any of them
|
|
44712
|
-
* while leaving a secret redacted is refused by the provider (D634), so an
|
|
44713
|
-
* editor uses this to ask for the secret on exactly those edits instead of
|
|
44714
|
-
* on every edit.
|
|
44715
|
-
*
|
|
44716
|
-
* Optional: absent from a provider that holds no secret (the Home Assistant
|
|
44717
|
-
* kinds) and from a provider older than this field — an editor that finds
|
|
44718
|
-
* it absent must assume ANY edit may need the secret.
|
|
44719
|
-
*/
|
|
44720
|
-
destinationKeys: array(string()).optional(),
|
|
44721
|
-
supportsDiscovery: boolean(),
|
|
44722
|
-
/**
|
|
44723
|
-
* Extra delivery parameters a rule may set for a target of this kind (D938).
|
|
44724
|
-
* Absent = none; the rule editor then offers nothing.
|
|
44725
|
-
*/
|
|
44726
|
-
deliveryParams: array(DeliveryParamSchema).optional(),
|
|
44727
|
-
caps: TargetKindCapsSchema
|
|
44728
|
-
});
|
|
44729
|
-
/**
|
|
44730
|
-
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
44731
|
-
* (return a presence marker only) when serving `listTargets` — never
|
|
44732
|
-
* round-trip a stored secret to the UI.
|
|
44733
|
-
*/
|
|
44734
|
-
var TargetSchema = object({
|
|
44735
|
-
id: string(),
|
|
44736
|
-
name: string(),
|
|
44737
|
-
kind: string(),
|
|
44738
|
-
addonId: string(),
|
|
44739
|
-
enabled: boolean(),
|
|
44740
|
-
config: record(string(), unknown())
|
|
44741
|
-
});
|
|
44742
|
-
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
44743
|
-
var DiscoveredTargetSchema = object({
|
|
44744
|
-
kind: string(),
|
|
44745
|
-
suggestedName: string(),
|
|
44746
|
-
config: record(string(), unknown())
|
|
44747
|
-
});
|
|
44748
|
-
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
44749
|
-
var RenderedAsSchema = object({
|
|
44750
|
-
level: string(),
|
|
44751
|
-
format: NotificationFormatSchema,
|
|
44752
|
-
attachmentsSent: number().int().nonnegative(),
|
|
44753
|
-
actionsSent: number().int().nonnegative(),
|
|
44754
|
-
truncated: boolean(),
|
|
44755
|
-
dropped: array(string())
|
|
44756
|
-
});
|
|
44757
|
-
var SendResultSchema = object({
|
|
44758
|
-
success: boolean(),
|
|
44759
|
-
error: string().optional(),
|
|
44760
|
-
renderedAs: RenderedAsSchema.optional()
|
|
44761
|
-
});
|
|
44762
|
-
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
44763
|
-
var TestResultSchema = SendResultSchema;
|
|
44764
|
-
/**
|
|
44765
|
-
* Pre-save credential probe against a partial (unsaved) target config.
|
|
44766
|
-
* `resolvedUrl` never includes secrets (token stripped from path).
|
|
44767
|
-
*/
|
|
44768
|
-
var ProbeTargetConfigResultSchema = object({
|
|
44769
|
-
ok: boolean(),
|
|
44770
|
-
resolvedUrl: string(),
|
|
44771
|
-
httpStatus: number().int().optional(),
|
|
44772
|
-
stateInstance: string().optional(),
|
|
44773
|
-
error: string().optional()
|
|
44774
|
-
});
|
|
44775
|
-
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
|
|
44776
|
-
kind: string(),
|
|
44777
|
-
config: record(string(), unknown()).optional(),
|
|
44778
|
-
/**
|
|
44779
|
-
* When editing / duplicating, the blank password field never round-trips
|
|
44780
|
-
* the stored token. Pass the source target id so the provider can restore
|
|
44781
|
-
* secrets server-side before dialling (same merge as upsert).
|
|
44782
|
-
*/
|
|
44783
|
-
targetId: string().optional()
|
|
44784
|
-
}), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
|
|
44785
|
-
kind: string(),
|
|
44786
|
-
config: record(string(), unknown()),
|
|
44787
|
-
/** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
|
|
44788
|
-
targetId: string().optional()
|
|
44789
|
-
}), ProbeTargetConfigResultSchema, {
|
|
44790
|
-
kind: "mutation",
|
|
44791
|
-
auth: "admin"
|
|
44792
|
-
}), method(object({
|
|
44793
|
-
targetId: string(),
|
|
44794
|
-
notification: NotificationSchema
|
|
44795
|
-
}), SendResultSchema, {
|
|
44796
|
-
kind: "mutation",
|
|
44797
|
-
auth: "admin"
|
|
44798
|
-
}), method(object({
|
|
44799
|
-
targetId: string(),
|
|
44800
|
-
sample: NotificationSchema.optional()
|
|
44801
|
-
}), TestResultSchema, {
|
|
44802
|
-
kind: "mutation",
|
|
44803
|
-
auth: "admin"
|
|
44804
|
-
}), method(object({
|
|
44805
|
-
target: TargetSchema,
|
|
44806
|
-
/**
|
|
44807
|
-
* Duplicate flow: create a NEW target id while copying secrets from an
|
|
44808
|
-
* existing row. The UI never holds the stored token; blank / redacted
|
|
44809
|
-
* password fields are restored from this source (D634 still applies if
|
|
44810
|
-
* destinations diverge without a re-typed secret).
|
|
44811
|
-
*/
|
|
44812
|
-
cloneSecretsFrom: string().optional()
|
|
44813
|
-
}), TargetSchema, {
|
|
44814
|
-
kind: "mutation",
|
|
44815
|
-
auth: "admin"
|
|
44816
|
-
}), method(object({ targetId: string() }), _void(), {
|
|
44817
|
-
kind: "mutation",
|
|
44818
|
-
auth: "admin"
|
|
44819
|
-
}), method(object({
|
|
44820
|
-
targetId: string(),
|
|
44821
|
-
enabled: boolean()
|
|
44822
|
-
}), _void(), {
|
|
44823
|
-
kind: "mutation",
|
|
44824
|
-
auth: "admin"
|
|
44825
|
-
});
|
|
44826
45269
|
_enum([
|
|
44827
45270
|
"automation",
|
|
44828
45271
|
"action",
|
|
@@ -44890,6 +45333,8 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
|
|
|
44890
45333
|
kind: "mutation",
|
|
44891
45334
|
auth: "admin"
|
|
44892
45335
|
});
|
|
45336
|
+
/** `timeoutMs` of `actions.run`: a waited call outlives any legal run. */
|
|
45337
|
+
var ACTION_RUN_TIMEOUT_MS = 363e4;
|
|
44893
45338
|
/**
|
|
44894
45339
|
* actions — the ONE surface for runnable actions, for the UI and for
|
|
44895
45340
|
* automations. Provided by the core-blocks builtin on the hub.
|
|
@@ -44908,6 +45353,12 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
|
|
|
44908
45353
|
* An admin, and an in-process caller (an automation block), may run any action.
|
|
44909
45354
|
* Every refusal is typed (`[not-linked] …`) and logged.
|
|
44910
45355
|
*
|
|
45356
|
+
* **A run lasts at most `ACTION_RUN_MAX_MS` (60 min).** The provider stops a
|
|
45357
|
+
* run that reaches it and answers `timed-out` (never `ran`); an action whose
|
|
45358
|
+
* `wait` steps alone add up to more is refused at create/update
|
|
45359
|
+
* (`[invalid-steps]`). `run` declares a `timeoutMs` above that ceiling, so a
|
|
45360
|
+
* waited call (an automation step) is never cut by the 60 s transport default.
|
|
45361
|
+
*
|
|
44911
45362
|
* A second `run` of an action that is already running is REFUSED — traced and
|
|
44912
45363
|
* logged — never queued.
|
|
44913
45364
|
*/
|
|
@@ -44934,7 +45385,8 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
|
|
|
44934
45385
|
role: "viewer",
|
|
44935
45386
|
auth: "protected",
|
|
44936
45387
|
kind: "mutation",
|
|
44937
|
-
caller: "required"
|
|
45388
|
+
caller: "required",
|
|
45389
|
+
timeoutMs: ACTION_RUN_TIMEOUT_MS
|
|
44938
45390
|
}), method(ActionIdInput, _void(), {
|
|
44939
45391
|
kind: "mutation",
|
|
44940
45392
|
auth: "admin"
|
|
@@ -45084,6 +45536,8 @@ var SettingsSchemaWithValuesSchema = object({
|
|
|
45084
45536
|
});
|
|
45085
45537
|
/** Patch object — keys are field names, values are the new field values. */
|
|
45086
45538
|
var SettingsPatchSchema = record(string(), unknown());
|
|
45539
|
+
/** The scope of a scoped-settings call (D986): where the capability declared the values. */
|
|
45540
|
+
var ScopedSettingsScopeSchema = _enum(SCOPED_SETTINGS_SCOPES);
|
|
45087
45541
|
/** Standard success response for update operations. */
|
|
45088
45542
|
var SettingsUpdateResultSchema = object({ success: literal(true) });
|
|
45089
45543
|
method(object({
|
|
@@ -45099,6 +45553,25 @@ method(object({
|
|
|
45099
45553
|
kind: "mutation",
|
|
45100
45554
|
auth: "admin"
|
|
45101
45555
|
}), method(object({
|
|
45556
|
+
addonId: string(),
|
|
45557
|
+
cap: string(),
|
|
45558
|
+
scope: ScopedSettingsScopeSchema,
|
|
45559
|
+
nodeId: string().optional()
|
|
45560
|
+
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
45561
|
+
addonId: string(),
|
|
45562
|
+
cap: string(),
|
|
45563
|
+
scope: ScopedSettingsScopeSchema,
|
|
45564
|
+
nodeId: string().optional(),
|
|
45565
|
+
patch: SettingsPatchSchema
|
|
45566
|
+
}), SettingsUpdateResultSchema, {
|
|
45567
|
+
kind: "mutation",
|
|
45568
|
+
auth: "admin"
|
|
45569
|
+
}), method(object({
|
|
45570
|
+
addonId: string(),
|
|
45571
|
+
cap: string(),
|
|
45572
|
+
scope: ScopedSettingsScopeSchema,
|
|
45573
|
+
nodeId: string().optional()
|
|
45574
|
+
}), record(string(), unknown()).nullable()), method(object({
|
|
45102
45575
|
addonId: string(),
|
|
45103
45576
|
nodeId: string().optional()
|
|
45104
45577
|
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
@@ -48720,37 +49193,6 @@ method(object({
|
|
|
48720
49193
|
kind: "mutation",
|
|
48721
49194
|
auth: "admin"
|
|
48722
49195
|
}), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
|
|
48723
|
-
var ConnectionTestOutcomeSchema = discriminatedUnion("outcome", [
|
|
48724
|
-
object({
|
|
48725
|
-
outcome: literal("validated"),
|
|
48726
|
-
/** Round-trip of the sign-in, when the provider measured it. */
|
|
48727
|
-
latencyMs: number().nonnegative().optional(),
|
|
48728
|
-
/** Optional human detail worth showing next to the tick
|
|
48729
|
-
* ("3 devices visible on this account"). */
|
|
48730
|
-
detail: string().optional()
|
|
48731
|
-
}).strict(),
|
|
48732
|
-
object({
|
|
48733
|
-
outcome: literal("rejected"),
|
|
48734
|
-
error: string()
|
|
48735
|
-
}).strict(),
|
|
48736
|
-
object({
|
|
48737
|
-
outcome: literal("inconclusive"),
|
|
48738
|
-
error: string()
|
|
48739
|
-
}).strict()
|
|
48740
|
-
]);
|
|
48741
|
-
var ConnectionTestInputSchema = object({
|
|
48742
|
-
/** Candidate integration settings, exactly as the create form collected them. */
|
|
48743
|
-
settings: record(string(), unknown()) });
|
|
48744
|
-
/**
|
|
48745
|
-
* What the provider's test actually DOES, so the UI can say it in words before
|
|
48746
|
-
* the operator presses the button ("Signs in to the Dreo cloud"). Purely
|
|
48747
|
-
* descriptive — it never changes routing.
|
|
48748
|
-
*/
|
|
48749
|
-
var ConnectionTestDescriptorSchema = object({ label: string() });
|
|
48750
|
-
method(ConnectionTestInputSchema, ConnectionTestOutcomeSchema, {
|
|
48751
|
-
kind: "mutation",
|
|
48752
|
-
auth: "admin"
|
|
48753
|
-
}), method(_void(), ConnectionTestDescriptorSchema, { auth: "admin" });
|
|
48754
49196
|
object({
|
|
48755
49197
|
/** True when the upstream system considers the entity connected. */
|
|
48756
49198
|
connected: boolean(),
|
|
@@ -49008,6 +49450,9 @@ var MediaPlayerStatusSchema = object({
|
|
|
49008
49450
|
/** Repeat mode. Null when no repeat surface.
|
|
49009
49451
|
* Pair with `DeviceFeature.MediaPlayerRepeat`. */
|
|
49010
49452
|
repeat: MediaPlayerRepeatSchema.nullable(),
|
|
49453
|
+
/** Ms epoch when `position` was read from the device. Null when the driver
|
|
49454
|
+
* does not say; a UI that advances the position while playing counts from it. */
|
|
49455
|
+
positionUpdatedAt: number().nullable().default(null),
|
|
49011
49456
|
/** Ms epoch when the slice was last updated. */
|
|
49012
49457
|
lastChangedAt: number()
|
|
49013
49458
|
});
|
|
@@ -54819,6 +55264,7 @@ var IntegrationWithStateSchema = object({
|
|
|
54819
55264
|
id: string(),
|
|
54820
55265
|
addonId: string(),
|
|
54821
55266
|
name: string(),
|
|
55267
|
+
/** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
|
|
54822
55268
|
enabled: boolean(),
|
|
54823
55269
|
info: record(string(), unknown()).readonly(),
|
|
54824
55270
|
/** The discovery candidate this integration was set up from (D984). */
|
|
@@ -54831,6 +55277,7 @@ var IntegrationLiteSchema = object({
|
|
|
54831
55277
|
id: string(),
|
|
54832
55278
|
addonId: string(),
|
|
54833
55279
|
name: string(),
|
|
55280
|
+
/** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
|
|
54834
55281
|
enabled: boolean(),
|
|
54835
55282
|
info: record(string(), unknown()).readonly(),
|
|
54836
55283
|
/** The discovery candidate this integration was set up from (D984). */
|
|
@@ -54876,10 +55323,9 @@ var AvailableIntegrationTypeSchema = object({
|
|
|
54876
55323
|
* locations" checkbox. Provider-declared in the addon manifest. */
|
|
54877
55324
|
supportsLocationImport: boolean(),
|
|
54878
55325
|
/**
|
|
54879
|
-
* True when this integration
|
|
54880
|
-
*
|
|
54881
|
-
*
|
|
54882
|
-
* rather than offering a button that always answers the same nonsense.
|
|
55326
|
+
* True when this integration's instances declare a Test (`integration-instances.describe().canTest`,
|
|
55327
|
+
* D1016). An integration that cannot be tested must say so up front rather than offering a
|
|
55328
|
+
* button that always answers the same nonsense.
|
|
54883
55329
|
*/
|
|
54884
55330
|
canTest: boolean(),
|
|
54885
55331
|
existingInstances: array(object({
|
|
@@ -54930,15 +55376,21 @@ var TestConnectionResultSchema = object({
|
|
|
54930
55376
|
var CreateIntegrationInputSchema = object({
|
|
54931
55377
|
addonId: string(),
|
|
54932
55378
|
name: string(),
|
|
54933
|
-
enabled: boolean().optional(),
|
|
54934
55379
|
info: record(string(), unknown()).optional(),
|
|
54935
55380
|
/** `stableId` of the discovery candidate the form was seeded from (D984). */
|
|
54936
55381
|
originStableId: string().optional(),
|
|
54937
|
-
settings: record(string(), unknown()).optional()
|
|
55382
|
+
settings: record(string(), unknown()).optional(),
|
|
55383
|
+
/** The instance kind being created, for a provider with several; omitted = its only testable kind. */
|
|
55384
|
+
kind: string().min(1).optional()
|
|
54938
55385
|
});
|
|
54939
55386
|
var UpdateIntegrationInputSchema = object({
|
|
54940
55387
|
id: string(),
|
|
54941
55388
|
name: string().optional(),
|
|
55389
|
+
/**
|
|
55390
|
+
* Accepted for a FIXED builtin only (`info.fixed`: alarm panel, camera grid, core blocks,
|
|
55391
|
+
* terminal), which keeps no instance record: the registry flag is its one store. Any other
|
|
55392
|
+
* integration is switched through `integration-instances.setInstanceEnabled`.
|
|
55393
|
+
*/
|
|
54942
55394
|
enabled: boolean().optional(),
|
|
54943
55395
|
info: record(string(), unknown()).optional()
|
|
54944
55396
|
});
|
|
@@ -54955,13 +55407,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
54955
55407
|
}), method(object({ id: string() }), DeleteIntegrationResultSchema, {
|
|
54956
55408
|
kind: "mutation",
|
|
54957
55409
|
auth: "admin"
|
|
54958
|
-
}), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" })
|
|
54959
|
-
addonId: string(),
|
|
54960
|
-
settings: record(string(), unknown())
|
|
54961
|
-
}), TestConnectionResultSchema, {
|
|
54962
|
-
kind: "mutation",
|
|
54963
|
-
auth: "admin"
|
|
54964
|
-
});
|
|
55410
|
+
}), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" });
|
|
54965
55411
|
/**
|
|
54966
55412
|
* `integration-instances` - the connection of an addon that holds ONE or SEVERAL
|
|
54967
55413
|
* (an account, a relay, a destination) as typed records (D985, D986). The addon's
|
|
@@ -54981,12 +55427,12 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
54981
55427
|
* or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
|
|
54982
55428
|
* clears it.
|
|
54983
55429
|
*/
|
|
54984
|
-
var ConfigSchemaPassthrough$
|
|
55430
|
+
var ConfigSchemaPassthrough$2 = custom();
|
|
54985
55431
|
var IntegrationInstanceIdSchema = string().min(1);
|
|
54986
55432
|
var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
|
|
54987
55433
|
/**
|
|
54988
55434
|
* What the addon's instances ARE for the Integrations page (planning#416). `devices`: each
|
|
54989
|
-
* instance is an integration that brings devices (
|
|
55435
|
+
* instance is an integration that brings devices (its record body owns the on/off switch);
|
|
54990
55436
|
* `services`: a connection configured from the addon's own function page, never listed on
|
|
54991
55437
|
* Integrations.
|
|
54992
55438
|
* It is the same vocabulary as the manifest's `integrationRole`, which stays as an override.
|
|
@@ -55027,7 +55473,16 @@ var IntegrationInstanceKindSchema = object({
|
|
|
55027
55473
|
/** Relative hub path to start an interactive account link of an instance of this kind. */
|
|
55028
55474
|
connectPath: string().min(1).optional(),
|
|
55029
55475
|
/** Relative hub path to disconnect that account. */
|
|
55030
|
-
disconnectPath: string().min(1).optional()
|
|
55476
|
+
disconnectPath: string().min(1).optional(),
|
|
55477
|
+
/**
|
|
55478
|
+
* Parts of the edit dialog the flat form cannot draw (a node picker, a model source), named by a
|
|
55479
|
+
* GENERIC widget id the client maps to a component; a client that knows none of them shows none.
|
|
55480
|
+
* `connection` widgets write connection values, `model` widgets own the model choice.
|
|
55481
|
+
*/
|
|
55482
|
+
widgets: array(object({
|
|
55483
|
+
id: string().min(1),
|
|
55484
|
+
placement: _enum(["connection", "model"])
|
|
55485
|
+
})).optional()
|
|
55031
55486
|
});
|
|
55032
55487
|
/**
|
|
55033
55488
|
* How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
|
|
@@ -55103,8 +55558,8 @@ var IntegrationInstanceSchema = object({
|
|
|
55103
55558
|
configured: boolean(),
|
|
55104
55559
|
/**
|
|
55105
55560
|
* The instance's own on/off switch (D996), derived from the record body (`enabled !== false`,
|
|
55106
|
-
* so a row written before the field existed is on).
|
|
55107
|
-
*
|
|
55561
|
+
* so a row written before the field existed is on). The same for every role, `devices` included:
|
|
55562
|
+
* the body is the one store, `setInstanceEnabled` the one writer (epic #440, step 3).
|
|
55108
55563
|
*/
|
|
55109
55564
|
enabled: boolean().optional(),
|
|
55110
55565
|
/** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
|
|
@@ -55125,7 +55580,7 @@ method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }), method
|
|
|
55125
55580
|
id: IntegrationInstanceIdSchema.nullable(),
|
|
55126
55581
|
/** The kind of the create form (`id: null`) of a provider with several. */
|
|
55127
55582
|
kind: string().min(1).optional()
|
|
55128
|
-
}), ConfigSchemaPassthrough$
|
|
55583
|
+
}), ConfigSchemaPassthrough$2, { auth: "admin" }), method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }), method(object({
|
|
55129
55584
|
id: IntegrationInstanceIdSchema.optional(),
|
|
55130
55585
|
name: string().min(1),
|
|
55131
55586
|
kind: string().min(1).optional(),
|
|
@@ -56057,12 +56512,12 @@ var LlmModelInfoSchema = object({
|
|
|
56057
56512
|
});
|
|
56058
56513
|
/**
|
|
56059
56514
|
* The provider-specific part of a profile, validated by the provider that owns
|
|
56060
|
-
* the kind (
|
|
56515
|
+
* the kind (saving an instance refuses what it does not accept). A field its
|
|
56061
56516
|
* `connectionSchema` declares `type: 'password'` is a secret: it is held in the
|
|
56062
56517
|
* keychain, never in the row, and reads back as the redaction marker.
|
|
56063
56518
|
*/
|
|
56064
56519
|
var LlmProviderConfigSchema = record(string(), unknown());
|
|
56065
|
-
|
|
56520
|
+
object({
|
|
56066
56521
|
id: string(),
|
|
56067
56522
|
name: string(),
|
|
56068
56523
|
/** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
|
|
@@ -56156,8 +56611,8 @@ var LlmProviderWidgetSchema = object({
|
|
|
56156
56611
|
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
56157
56612
|
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
56158
56613
|
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
56159
|
-
var ConfigSchemaPassthrough$
|
|
56160
|
-
|
|
56614
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
56615
|
+
object({
|
|
56161
56616
|
kind: LlmProfileKindSchema,
|
|
56162
56617
|
label: string(),
|
|
56163
56618
|
/** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
|
|
@@ -56165,9 +56620,9 @@ var LlmProfileKindDescriptorSchema = object({
|
|
|
56165
56620
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
56166
56621
|
addonId: string(),
|
|
56167
56622
|
/** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
|
|
56168
|
-
connectionSchema: ConfigSchemaPassthrough$
|
|
56623
|
+
connectionSchema: ConfigSchemaPassthrough$1,
|
|
56169
56624
|
/** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
|
|
56170
|
-
advancedSchema: ConfigSchemaPassthrough$
|
|
56625
|
+
advancedSchema: ConfigSchemaPassthrough$1.optional(),
|
|
56171
56626
|
/** The kind's defaults; a model from `listModels` may override any of them. */
|
|
56172
56627
|
features: LlmModelFeaturesSchema,
|
|
56173
56628
|
/** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
|
|
@@ -56296,20 +56751,7 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
|
|
|
56296
56751
|
}), method(object({
|
|
56297
56752
|
addonId: string().optional(),
|
|
56298
56753
|
requestId: string()
|
|
56299
|
-
}), _void(), { kind: "mutation" }), method(
|
|
56300
|
-
kind: "mutation",
|
|
56301
|
-
auth: "admin"
|
|
56302
|
-
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
56303
|
-
kind: "mutation",
|
|
56304
|
-
auth: "admin"
|
|
56305
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
56306
|
-
kind: "mutation",
|
|
56307
|
-
auth: "admin"
|
|
56308
|
-
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
56309
|
-
kind: "mutation",
|
|
56310
|
-
auth: "admin",
|
|
56311
|
-
timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
|
|
56312
|
-
}), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
|
|
56754
|
+
}), _void(), { kind: "mutation" }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
|
|
56313
56755
|
kind: "mutation",
|
|
56314
56756
|
auth: "admin"
|
|
56315
56757
|
}), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
@@ -57304,20 +57746,7 @@ method(_void(), MeshStatusSchema), method(object({
|
|
|
57304
57746
|
/** Optional hostname override the host should advertise once joined. */
|
|
57305
57747
|
hostname: string().optional() }), object({
|
|
57306
57748
|
/** Authentication URL the operator should open in a browser. */
|
|
57307
|
-
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() }))
|
|
57308
|
-
/** Optional auth key — when provided, probes the key validity
|
|
57309
|
-
* against the provider's API. Omit when already joined to
|
|
57310
|
-
* just ping the daemon. */
|
|
57311
|
-
authKey: string().optional() }), object({
|
|
57312
|
-
ok: boolean(),
|
|
57313
|
-
/** Provider-side identifier resolved by the probe (tailnet
|
|
57314
|
-
* name for Tailscale, network id for ZeroTier, etc.). */
|
|
57315
|
-
tenant: string().optional(),
|
|
57316
|
-
/** Daemon binary version, when reachable. */
|
|
57317
|
-
daemonVersion: string().optional(),
|
|
57318
|
-
/** Human-readable error when `ok: false`. */
|
|
57319
|
-
error: string().optional()
|
|
57320
|
-
}), { kind: "mutation" });
|
|
57749
|
+
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() }));
|
|
57321
57750
|
object({
|
|
57322
57751
|
value: number().nullable().meta(readingMeta("device", { label: "Total" })),
|
|
57323
57752
|
lastFetchedAt: number()
|
|
@@ -57940,6 +58369,8 @@ var MigrationIntegrationSchema = object({
|
|
|
57940
58369
|
addonId: string(),
|
|
57941
58370
|
name: string(),
|
|
57942
58371
|
info: Rows,
|
|
58372
|
+
/** The registry's stored switch: read by the one-switch migration, nothing else. */
|
|
58373
|
+
enabled: boolean().optional(),
|
|
57943
58374
|
originStableId: string().optional()
|
|
57944
58375
|
});
|
|
57945
58376
|
var MigrationDeviceSchema = object({
|
|
@@ -63644,13 +64075,6 @@ var AddBrokerInputSchema = object({
|
|
|
63644
64075
|
});
|
|
63645
64076
|
var AddBrokerResultSchema = object({ id: string() });
|
|
63646
64077
|
var IdInputSchema = object({ id: string() });
|
|
63647
|
-
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
63648
|
-
ok: literal(true),
|
|
63649
|
-
latencyMs: number()
|
|
63650
|
-
}), object({
|
|
63651
|
-
ok: literal(false),
|
|
63652
|
-
error: string()
|
|
63653
|
-
})]);
|
|
63654
64078
|
var StartEmbeddedInputSchema = object({
|
|
63655
64079
|
port: number().int().min(1).max(65535).default(1883),
|
|
63656
64080
|
/** Allow anonymous connect (no username/password). Default: false. */
|
|
@@ -63673,9 +64097,6 @@ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnection
|
|
|
63673
64097
|
}), method(IdInputSchema, _void(), {
|
|
63674
64098
|
kind: "mutation",
|
|
63675
64099
|
auth: "admin"
|
|
63676
|
-
}), method(IdInputSchema, TestResultSchema$1, {
|
|
63677
|
-
kind: "mutation",
|
|
63678
|
-
auth: "admin"
|
|
63679
64100
|
}), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, {
|
|
63680
64101
|
kind: "mutation",
|
|
63681
64102
|
auth: "admin"
|
|
@@ -67461,61 +67882,6 @@ var OauthIntegrationDescriptorSchema = object({
|
|
|
67461
67882
|
});
|
|
67462
67883
|
method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
|
|
67463
67884
|
/**
|
|
67464
|
-
* `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
|
|
67465
|
-
*
|
|
67466
|
-
* One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
|
|
67467
|
-
* ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
|
|
67468
|
-
* Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
|
|
67469
|
-
* immutable after create.
|
|
67470
|
-
*/
|
|
67471
|
-
var ConfigSchemaPassthrough$1 = unknown();
|
|
67472
|
-
var OidcConnectionSchema = object({
|
|
67473
|
-
id: string().min(1),
|
|
67474
|
-
displayName: string(),
|
|
67475
|
-
icon: string(),
|
|
67476
|
-
issuerUrl: string(),
|
|
67477
|
-
clientId: string(),
|
|
67478
|
-
/** Client id + secret present — never the secret value. */
|
|
67479
|
-
configured: boolean(),
|
|
67480
|
-
/**
|
|
67481
|
-
* Values for the connection form schema. `clientSecret` is a keychain
|
|
67482
|
-
* {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
|
|
67483
|
-
*/
|
|
67484
|
-
formValues: record(string(), unknown()).optional()
|
|
67485
|
-
});
|
|
67486
|
-
/**
|
|
67487
|
-
* Patch one connection. Omitted or empty `clientSecret` keeps the stored
|
|
67488
|
-
* secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
|
|
67489
|
-
*/
|
|
67490
|
-
var OidcConnectionUpdateInputSchema = object({
|
|
67491
|
-
id: string().min(1),
|
|
67492
|
-
displayName: string().min(1),
|
|
67493
|
-
icon: string().optional(),
|
|
67494
|
-
issuerUrl: string().optional(),
|
|
67495
|
-
clientId: string().optional(),
|
|
67496
|
-
clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
|
|
67497
|
-
redirectUri: string().optional(),
|
|
67498
|
-
scopes: string().optional(),
|
|
67499
|
-
usernameClaim: _enum([
|
|
67500
|
-
"preferred_username",
|
|
67501
|
-
"email",
|
|
67502
|
-
"sub"
|
|
67503
|
-
]).optional()
|
|
67504
|
-
});
|
|
67505
|
-
method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
|
|
67506
|
-
id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
|
|
67507
|
-
displayName: string().min(1)
|
|
67508
|
-
}), object({ id: string() }), {
|
|
67509
|
-
kind: "mutation",
|
|
67510
|
-
auth: "admin"
|
|
67511
|
-
}), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
|
|
67512
|
-
kind: "mutation",
|
|
67513
|
-
auth: "admin"
|
|
67514
|
-
}), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
|
|
67515
|
-
kind: "mutation",
|
|
67516
|
-
auth: "admin"
|
|
67517
|
-
});
|
|
67518
|
-
/**
|
|
67519
67885
|
* Generic on-screen-display (video overlay) cap. Each camera exposes
|
|
67520
67886
|
* a firmware-defined list of overlays (channel name, timestamp,
|
|
67521
67887
|
* watermark, logo, …); the cap models them as a homogeneous array of
|
|
@@ -67936,14 +68302,6 @@ object({
|
|
|
67936
68302
|
empty: boolean().nullable(),
|
|
67937
68303
|
/** True while the pump is running. Null while unknown. */
|
|
67938
68304
|
pumpRunning: boolean().nullable(),
|
|
67939
|
-
/** Water drunk in the last drink, in litres. */
|
|
67940
|
-
lastDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
67941
|
-
/** Water drunk in the current hour, in litres. */
|
|
67942
|
-
currentHourDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
67943
|
-
/** Water drunk over the last 24 hours (rolling), in litres. */
|
|
67944
|
-
last24hDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
67945
|
-
/** Water drunk since local midnight, in litres. Null when the fountain has no such sensor. */
|
|
67946
|
-
todayDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
67947
68305
|
/** Decoded fault message. Null means healthy; a non-null string is an active fault. */
|
|
67948
68306
|
error: string().nullable(),
|
|
67949
68307
|
/** Ms epoch when the slice was last refreshed. */
|
|
@@ -67956,9 +68314,6 @@ DeviceType.PetFountain, method(object({
|
|
|
67956
68314
|
}), _void(), {
|
|
67957
68315
|
kind: "mutation",
|
|
67958
68316
|
auth: "protected"
|
|
67959
|
-
}), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
|
|
67960
|
-
kind: "mutation",
|
|
67961
|
-
auth: "protected"
|
|
67962
68317
|
});
|
|
67963
68318
|
/**
|
|
67964
68319
|
* The wire shapes of the Auto tune plan and apply (D745), used by the
|
|
@@ -74928,21 +75283,6 @@ method(object({
|
|
|
74928
75283
|
*/
|
|
74929
75284
|
ttlSec: union([number().int().positive(), literal("never")]).optional()
|
|
74930
75285
|
}), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
|
|
74931
|
-
var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
|
|
74932
|
-
providerId: string().min(1),
|
|
74933
|
-
displayName: string().min(1),
|
|
74934
|
-
configSchema: unknown(),
|
|
74935
|
-
nodeLocal: boolean(),
|
|
74936
|
-
shouldSaveDiskSpace: literal(true),
|
|
74937
|
-
minFreePercent: number().min(0).max(100)
|
|
74938
|
-
}), object({
|
|
74939
|
-
providerId: string().min(1),
|
|
74940
|
-
displayName: string().min(1),
|
|
74941
|
-
configSchema: unknown(),
|
|
74942
|
-
nodeLocal: boolean(),
|
|
74943
|
-
shouldSaveDiskSpace: literal(false),
|
|
74944
|
-
minFreePercent: literal(null)
|
|
74945
|
-
})]);
|
|
74946
75286
|
method(object({
|
|
74947
75287
|
location: StorageLocationRefSchema,
|
|
74948
75288
|
relativePath: string()
|
|
@@ -75004,42 +75344,7 @@ method(object({
|
|
|
75004
75344
|
}), _instanceof(Uint8Array), { auth: "admin" }), method(object({ downloadId: string() }), _void(), {
|
|
75005
75345
|
kind: "mutation",
|
|
75006
75346
|
auth: "admin"
|
|
75007
|
-
}), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(
|
|
75008
|
-
createdAt: true,
|
|
75009
|
-
updatedAt: true
|
|
75010
|
-
}), StorageLocationSchema, {
|
|
75011
|
-
kind: "mutation",
|
|
75012
|
-
auth: "admin"
|
|
75013
|
-
}), method(object({
|
|
75014
|
-
id: string(),
|
|
75015
|
-
force: boolean().optional()
|
|
75016
|
-
}), _void(), {
|
|
75017
|
-
kind: "mutation",
|
|
75018
|
-
auth: "admin"
|
|
75019
|
-
}), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
|
|
75020
|
-
ok: boolean(),
|
|
75021
|
-
error: string().optional()
|
|
75022
|
-
}), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
|
|
75023
|
-
providerId: string(),
|
|
75024
|
-
/**
|
|
75025
|
-
* The location this config is an UNSAVED edit of, when there is one.
|
|
75026
|
-
*
|
|
75027
|
-
* `listLocations` replaces every declared secret with the redaction
|
|
75028
|
-
* sentinel, so the edit modal's form state holds the sentinel for any
|
|
75029
|
-
* credential the operator did not retype — and posting that here
|
|
75030
|
-
* without a way to resolve it makes the provider try to authenticate
|
|
75031
|
-
* as `__camstack_redacted__` and report the operator's own working
|
|
75032
|
-
* password as wrong. Given this id, the orchestrator restores each
|
|
75033
|
-
* sentinel from the stored config (same rule as `upsertLocation`)
|
|
75034
|
-
* before dispatching. Omitted by the "Add location" wizard, where
|
|
75035
|
-
* every value was typed just now and nothing is stored yet.
|
|
75036
|
-
*/
|
|
75037
|
-
locationId: string().optional(),
|
|
75038
|
-
config: record(string(), unknown())
|
|
75039
|
-
}), object({
|
|
75040
|
-
ok: boolean(),
|
|
75041
|
-
error: string().optional()
|
|
75042
|
-
}), { auth: "admin" });
|
|
75347
|
+
}), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(_void(), array(StorageDrainProgressSchema).readonly());
|
|
75043
75348
|
/** One table of the settings database. */
|
|
75044
75349
|
var StorageTableSchema = object({
|
|
75045
75350
|
/** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
|
|
@@ -76537,7 +76842,7 @@ var TrainingProviderTypeSchema = object({
|
|
|
76537
76842
|
label: string(),
|
|
76538
76843
|
/** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
|
|
76539
76844
|
iconAsset: string(),
|
|
76540
|
-
/** Owning `training-provider` addon
|
|
76845
|
+
/** Owning `training-provider` addon. */
|
|
76541
76846
|
addonId: string(),
|
|
76542
76847
|
/**
|
|
76543
76848
|
* Fields for one entry of this type (credentials + defaults). Absent on a
|
|
@@ -76582,36 +76887,6 @@ var TrainingProviderDescriptorSchema = object({
|
|
|
76582
76887
|
*/
|
|
76583
76888
|
formValues: record(string(), unknown()).optional()
|
|
76584
76889
|
});
|
|
76585
|
-
/**
|
|
76586
|
-
* Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
|
|
76587
|
-
* An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
|
|
76588
|
-
* `{ $secretClear: true }` clears it.
|
|
76589
|
-
*/
|
|
76590
|
-
var TrainingProviderUpdateEntryInputSchema = object({
|
|
76591
|
-
entryId: string().min(1),
|
|
76592
|
-
name: string().min(1),
|
|
76593
|
-
tokenId: string().optional(),
|
|
76594
|
-
tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
|
|
76595
|
-
environment: string().optional(),
|
|
76596
|
-
gpuType: string().optional(),
|
|
76597
|
-
region: string().optional(),
|
|
76598
|
-
costCapUsd: number().nonnegative().optional(),
|
|
76599
|
-
maxRuntimeSec: number().int().positive().optional(),
|
|
76600
|
-
failedDatasetGraceHours: number().nonnegative().optional()
|
|
76601
|
-
});
|
|
76602
|
-
var TrainingCredentialCheckSchema = object({
|
|
76603
|
-
ok: boolean(),
|
|
76604
|
-
/** Workspace / account name, when the provider says. */
|
|
76605
|
-
account: string().optional(),
|
|
76606
|
-
reason: _enum([
|
|
76607
|
-
"missing",
|
|
76608
|
-
"invalid",
|
|
76609
|
-
"forbidden",
|
|
76610
|
-
"network",
|
|
76611
|
-
"quota"
|
|
76612
|
-
]).optional(),
|
|
76613
|
-
detail: string().optional()
|
|
76614
|
-
});
|
|
76615
76890
|
var ProviderJobStateSchema = _enum([
|
|
76616
76891
|
"pending",
|
|
76617
76892
|
"starting",
|
|
@@ -76659,22 +76934,6 @@ var TrainingLogLineSchema = object({
|
|
|
76659
76934
|
text: string()
|
|
76660
76935
|
});
|
|
76661
76936
|
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
|
|
76662
|
-
typeId: string().min(1),
|
|
76663
|
-
name: string().min(1)
|
|
76664
|
-
}), object({ entryId: string() }), {
|
|
76665
|
-
kind: "mutation",
|
|
76666
|
-
auth: "admin"
|
|
76667
|
-
}), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
|
|
76668
|
-
kind: "mutation",
|
|
76669
|
-
auth: "admin"
|
|
76670
|
-
}), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
|
|
76671
|
-
kind: "mutation",
|
|
76672
|
-
auth: "admin"
|
|
76673
|
-
}), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
|
|
76674
|
-
kind: "mutation",
|
|
76675
|
-
auth: "admin",
|
|
76676
|
-
timeoutMs: 3e4
|
|
76677
|
-
}), method(object({
|
|
76678
76937
|
entryId: string().min(1),
|
|
76679
76938
|
gpuType: string(),
|
|
76680
76939
|
region: string(),
|
|
@@ -79266,6 +79525,20 @@ Object.freeze({
|
|
|
79266
79525
|
access: "view",
|
|
79267
79526
|
role: "admin"
|
|
79268
79527
|
},
|
|
79528
|
+
"addonSettings.getScopedSettings": {
|
|
79529
|
+
capName: "addon-settings",
|
|
79530
|
+
capScope: "system",
|
|
79531
|
+
addonId: null,
|
|
79532
|
+
access: "view",
|
|
79533
|
+
role: "admin"
|
|
79534
|
+
},
|
|
79535
|
+
"addonSettings.readScopedValues": {
|
|
79536
|
+
capName: "addon-settings",
|
|
79537
|
+
capScope: "system",
|
|
79538
|
+
addonId: null,
|
|
79539
|
+
access: "view",
|
|
79540
|
+
role: "admin"
|
|
79541
|
+
},
|
|
79269
79542
|
"addonSettings.unsetStoredSettingsKeys": {
|
|
79270
79543
|
capName: "addon-settings",
|
|
79271
79544
|
capScope: "system",
|
|
@@ -79287,6 +79560,13 @@ Object.freeze({
|
|
|
79287
79560
|
access: "create",
|
|
79288
79561
|
role: "admin"
|
|
79289
79562
|
},
|
|
79563
|
+
"addonSettings.updateScopedSettings": {
|
|
79564
|
+
capName: "addon-settings",
|
|
79565
|
+
capScope: "system",
|
|
79566
|
+
addonId: null,
|
|
79567
|
+
access: "create",
|
|
79568
|
+
role: "admin"
|
|
79569
|
+
},
|
|
79290
79570
|
"addonWidgets.listWidgets": {
|
|
79291
79571
|
capName: "addon-widgets",
|
|
79292
79572
|
capScope: "system",
|
|
@@ -80120,20 +80400,6 @@ Object.freeze({
|
|
|
80120
80400
|
access: "view",
|
|
80121
80401
|
role: "admin"
|
|
80122
80402
|
},
|
|
80123
|
-
"connectionTest.describeTest": {
|
|
80124
|
-
capName: "connection-test",
|
|
80125
|
-
capScope: "system",
|
|
80126
|
-
addonId: null,
|
|
80127
|
-
access: "view",
|
|
80128
|
-
role: "admin"
|
|
80129
|
-
},
|
|
80130
|
-
"connectionTest.testSettings": {
|
|
80131
|
-
capName: "connection-test",
|
|
80132
|
-
capScope: "system",
|
|
80133
|
-
addonId: null,
|
|
80134
|
-
access: "create",
|
|
80135
|
-
role: "admin"
|
|
80136
|
-
},
|
|
80137
80403
|
"connectivity.getStatus": {
|
|
80138
80404
|
capName: "connectivity",
|
|
80139
80405
|
capScope: "device",
|
|
@@ -82500,13 +82766,6 @@ Object.freeze({
|
|
|
82500
82766
|
access: "view",
|
|
82501
82767
|
role: "admin"
|
|
82502
82768
|
},
|
|
82503
|
-
"integrations.testConnection": {
|
|
82504
|
-
capName: "integrations",
|
|
82505
|
-
capScope: "system",
|
|
82506
|
-
addonId: null,
|
|
82507
|
-
access: "create",
|
|
82508
|
-
role: "admin"
|
|
82509
|
-
},
|
|
82510
82769
|
"integrations.update": {
|
|
82511
82770
|
capName: "integrations",
|
|
82512
82771
|
capScope: "system",
|
|
@@ -82759,13 +83018,6 @@ Object.freeze({
|
|
|
82759
83018
|
access: "delete",
|
|
82760
83019
|
role: "admin"
|
|
82761
83020
|
},
|
|
82762
|
-
"llm.deleteProfile": {
|
|
82763
|
-
capName: "llm",
|
|
82764
|
-
capScope: "system",
|
|
82765
|
-
addonId: null,
|
|
82766
|
-
access: "delete",
|
|
82767
|
-
role: "admin"
|
|
82768
|
-
},
|
|
82769
83021
|
"llm.generate": {
|
|
82770
83022
|
capName: "llm",
|
|
82771
83023
|
capScope: "system",
|
|
@@ -82829,20 +83081,6 @@ Object.freeze({
|
|
|
82829
83081
|
access: "view",
|
|
82830
83082
|
role: "admin"
|
|
82831
83083
|
},
|
|
82832
|
-
"llm.listProfileKinds": {
|
|
82833
|
-
capName: "llm",
|
|
82834
|
-
capScope: "system",
|
|
82835
|
-
addonId: null,
|
|
82836
|
-
access: "view",
|
|
82837
|
-
role: "admin"
|
|
82838
|
-
},
|
|
82839
|
-
"llm.listProfiles": {
|
|
82840
|
-
capName: "llm",
|
|
82841
|
-
capScope: "system",
|
|
82842
|
-
addonId: null,
|
|
82843
|
-
access: "view",
|
|
82844
|
-
role: "admin"
|
|
82845
|
-
},
|
|
82846
83084
|
"llm.listRuntimeNodes": {
|
|
82847
83085
|
capName: "llm",
|
|
82848
83086
|
capScope: "system",
|
|
@@ -82850,13 +83088,6 @@ Object.freeze({
|
|
|
82850
83088
|
access: "view",
|
|
82851
83089
|
role: "admin"
|
|
82852
83090
|
},
|
|
82853
|
-
"llm.migrateRawSecrets": {
|
|
82854
|
-
capName: "llm",
|
|
82855
|
-
capScope: "system",
|
|
82856
|
-
addonId: null,
|
|
82857
|
-
access: "create",
|
|
82858
|
-
role: "admin"
|
|
82859
|
-
},
|
|
82860
83091
|
"llm.resolveModelRef": {
|
|
82861
83092
|
capName: "llm",
|
|
82862
83093
|
capScope: "system",
|
|
@@ -82885,20 +83116,6 @@ Object.freeze({
|
|
|
82885
83116
|
access: "create",
|
|
82886
83117
|
role: "admin"
|
|
82887
83118
|
},
|
|
82888
|
-
"llm.testProfile": {
|
|
82889
|
-
capName: "llm",
|
|
82890
|
-
capScope: "system",
|
|
82891
|
-
addonId: null,
|
|
82892
|
-
access: "create",
|
|
82893
|
-
role: "admin"
|
|
82894
|
-
},
|
|
82895
|
-
"llm.upsertProfile": {
|
|
82896
|
-
capName: "llm",
|
|
82897
|
-
capScope: "system",
|
|
82898
|
-
addonId: null,
|
|
82899
|
-
access: "create",
|
|
82900
|
-
role: "admin"
|
|
82901
|
-
},
|
|
82902
83119
|
"llmRuntime.appleAvailability": {
|
|
82903
83120
|
capName: "llm-runtime",
|
|
82904
83121
|
capScope: "system",
|
|
@@ -83403,13 +83620,6 @@ Object.freeze({
|
|
|
83403
83620
|
access: "create",
|
|
83404
83621
|
role: "admin"
|
|
83405
83622
|
},
|
|
83406
|
-
"meshNetwork.testConnection": {
|
|
83407
|
-
capName: "mesh-network",
|
|
83408
|
-
capScope: "system",
|
|
83409
|
-
addonId: null,
|
|
83410
|
-
access: "create",
|
|
83411
|
-
role: "admin"
|
|
83412
|
-
},
|
|
83413
83623
|
"meter.getStatus": {
|
|
83414
83624
|
capName: "meter",
|
|
83415
83625
|
capScope: "device",
|
|
@@ -83739,13 +83949,6 @@ Object.freeze({
|
|
|
83739
83949
|
access: "create",
|
|
83740
83950
|
role: "admin"
|
|
83741
83951
|
},
|
|
83742
|
-
"mqttBroker.testConnection": {
|
|
83743
|
-
capName: "mqtt-broker",
|
|
83744
|
-
capScope: "system",
|
|
83745
|
-
addonId: null,
|
|
83746
|
-
access: "create",
|
|
83747
|
-
role: "admin"
|
|
83748
|
-
},
|
|
83749
83952
|
"nativeObjectDetection.getOptions": {
|
|
83750
83953
|
capName: "native-object-detection",
|
|
83751
83954
|
capScope: "device",
|
|
@@ -84075,13 +84278,6 @@ Object.freeze({
|
|
|
84075
84278
|
access: "create",
|
|
84076
84279
|
role: "admin"
|
|
84077
84280
|
},
|
|
84078
|
-
"notificationOutput.deleteTarget": {
|
|
84079
|
-
capName: "notification-output",
|
|
84080
|
-
capScope: "system",
|
|
84081
|
-
addonId: null,
|
|
84082
|
-
access: "delete",
|
|
84083
|
-
role: "admin"
|
|
84084
|
-
},
|
|
84085
84281
|
"notificationOutput.discoverTargets": {
|
|
84086
84282
|
capName: "notification-output",
|
|
84087
84283
|
capScope: "system",
|
|
@@ -84089,13 +84285,6 @@ Object.freeze({
|
|
|
84089
84285
|
access: "view",
|
|
84090
84286
|
role: "admin"
|
|
84091
84287
|
},
|
|
84092
|
-
"notificationOutput.getTarget": {
|
|
84093
|
-
capName: "notification-output",
|
|
84094
|
-
capScope: "system",
|
|
84095
|
-
addonId: null,
|
|
84096
|
-
access: "view",
|
|
84097
|
-
role: "admin"
|
|
84098
|
-
},
|
|
84099
84288
|
"notificationOutput.listTargetKinds": {
|
|
84100
84289
|
capName: "notification-output",
|
|
84101
84290
|
capScope: "system",
|
|
@@ -84103,13 +84292,6 @@ Object.freeze({
|
|
|
84103
84292
|
access: "view",
|
|
84104
84293
|
role: "admin"
|
|
84105
84294
|
},
|
|
84106
|
-
"notificationOutput.listTargets": {
|
|
84107
|
-
capName: "notification-output",
|
|
84108
|
-
capScope: "system",
|
|
84109
|
-
addonId: null,
|
|
84110
|
-
access: "view",
|
|
84111
|
-
role: "admin"
|
|
84112
|
-
},
|
|
84113
84295
|
"notificationOutput.probeTargetConfig": {
|
|
84114
84296
|
capName: "notification-output",
|
|
84115
84297
|
capScope: "system",
|
|
@@ -84124,13 +84306,6 @@ Object.freeze({
|
|
|
84124
84306
|
access: "create",
|
|
84125
84307
|
role: "admin"
|
|
84126
84308
|
},
|
|
84127
|
-
"notificationOutput.setTargetEnabled": {
|
|
84128
|
-
capName: "notification-output",
|
|
84129
|
-
capScope: "system",
|
|
84130
|
-
addonId: null,
|
|
84131
|
-
access: "create",
|
|
84132
|
-
role: "admin"
|
|
84133
|
-
},
|
|
84134
84309
|
"notificationOutput.testTarget": {
|
|
84135
84310
|
capName: "notification-output",
|
|
84136
84311
|
capScope: "system",
|
|
@@ -84138,13 +84313,6 @@ Object.freeze({
|
|
|
84138
84313
|
access: "create",
|
|
84139
84314
|
role: "admin"
|
|
84140
84315
|
},
|
|
84141
|
-
"notificationOutput.upsertTarget": {
|
|
84142
|
-
capName: "notification-output",
|
|
84143
|
-
capScope: "system",
|
|
84144
|
-
addonId: null,
|
|
84145
|
-
access: "create",
|
|
84146
|
-
role: "admin"
|
|
84147
|
-
},
|
|
84148
84316
|
"notificationRules.activateAlarmProfile": {
|
|
84149
84317
|
capName: "notification-rules",
|
|
84150
84318
|
capScope: "system",
|
|
@@ -84404,41 +84572,6 @@ Object.freeze({
|
|
|
84404
84572
|
access: "view",
|
|
84405
84573
|
role: "admin"
|
|
84406
84574
|
},
|
|
84407
|
-
"oidcConnections.connectionFormSchema": {
|
|
84408
|
-
capName: "oidc-connections",
|
|
84409
|
-
capScope: "system",
|
|
84410
|
-
addonId: null,
|
|
84411
|
-
access: "view",
|
|
84412
|
-
role: "admin"
|
|
84413
|
-
},
|
|
84414
|
-
"oidcConnections.createConnection": {
|
|
84415
|
-
capName: "oidc-connections",
|
|
84416
|
-
capScope: "system",
|
|
84417
|
-
addonId: null,
|
|
84418
|
-
access: "create",
|
|
84419
|
-
role: "admin"
|
|
84420
|
-
},
|
|
84421
|
-
"oidcConnections.deleteConnection": {
|
|
84422
|
-
capName: "oidc-connections",
|
|
84423
|
-
capScope: "system",
|
|
84424
|
-
addonId: null,
|
|
84425
|
-
access: "delete",
|
|
84426
|
-
role: "admin"
|
|
84427
|
-
},
|
|
84428
|
-
"oidcConnections.listConnections": {
|
|
84429
|
-
capName: "oidc-connections",
|
|
84430
|
-
capScope: "system",
|
|
84431
|
-
addonId: null,
|
|
84432
|
-
access: "view",
|
|
84433
|
-
role: "admin"
|
|
84434
|
-
},
|
|
84435
|
-
"oidcConnections.updateConnection": {
|
|
84436
|
-
capName: "oidc-connections",
|
|
84437
|
-
capScope: "system",
|
|
84438
|
-
addonId: null,
|
|
84439
|
-
access: "create",
|
|
84440
|
-
role: "admin"
|
|
84441
|
-
},
|
|
84442
84575
|
"osd.getStatus": {
|
|
84443
84576
|
capName: "osd",
|
|
84444
84577
|
capScope: "device",
|
|
@@ -84621,13 +84754,6 @@ Object.freeze({
|
|
|
84621
84754
|
access: "view",
|
|
84622
84755
|
role: "viewer"
|
|
84623
84756
|
},
|
|
84624
|
-
"petFountain.resetDailyConsumption": {
|
|
84625
|
-
capName: "pet-fountain",
|
|
84626
|
-
capScope: "device",
|
|
84627
|
-
addonId: null,
|
|
84628
|
-
access: "delete",
|
|
84629
|
-
role: "viewer"
|
|
84630
|
-
},
|
|
84631
84757
|
"petFountain.setPump": {
|
|
84632
84758
|
capName: "pet-fountain",
|
|
84633
84759
|
capScope: "device",
|
|
@@ -87477,13 +87603,6 @@ Object.freeze({
|
|
|
87477
87603
|
access: "delete",
|
|
87478
87604
|
role: "admin"
|
|
87479
87605
|
},
|
|
87480
|
-
"storage.deleteLocation": {
|
|
87481
|
-
capName: "storage",
|
|
87482
|
-
capScope: "system",
|
|
87483
|
-
addonId: null,
|
|
87484
|
-
access: "delete",
|
|
87485
|
-
role: "admin"
|
|
87486
|
-
},
|
|
87487
87606
|
"storage.endDownload": {
|
|
87488
87607
|
capName: "storage",
|
|
87489
87608
|
capScope: "system",
|
|
@@ -87540,13 +87659,6 @@ Object.freeze({
|
|
|
87540
87659
|
access: "view",
|
|
87541
87660
|
role: "admin"
|
|
87542
87661
|
},
|
|
87543
|
-
"storage.listProviders": {
|
|
87544
|
-
capName: "storage",
|
|
87545
|
-
capScope: "system",
|
|
87546
|
-
addonId: null,
|
|
87547
|
-
access: "view",
|
|
87548
|
-
role: "admin"
|
|
87549
|
-
},
|
|
87550
87662
|
"storage.read": {
|
|
87551
87663
|
capName: "storage",
|
|
87552
87664
|
capScope: "system",
|
|
@@ -87568,27 +87680,6 @@ Object.freeze({
|
|
|
87568
87680
|
access: "view",
|
|
87569
87681
|
role: "admin"
|
|
87570
87682
|
},
|
|
87571
|
-
"storage.testConfig": {
|
|
87572
|
-
capName: "storage",
|
|
87573
|
-
capScope: "system",
|
|
87574
|
-
addonId: null,
|
|
87575
|
-
access: "view",
|
|
87576
|
-
role: "admin"
|
|
87577
|
-
},
|
|
87578
|
-
"storage.testLocation": {
|
|
87579
|
-
capName: "storage",
|
|
87580
|
-
capScope: "system",
|
|
87581
|
-
addonId: null,
|
|
87582
|
-
access: "view",
|
|
87583
|
-
role: "admin"
|
|
87584
|
-
},
|
|
87585
|
-
"storage.upsertLocation": {
|
|
87586
|
-
capName: "storage",
|
|
87587
|
-
capScope: "system",
|
|
87588
|
-
addonId: null,
|
|
87589
|
-
access: "create",
|
|
87590
|
-
role: "admin"
|
|
87591
|
-
},
|
|
87592
87683
|
"storage.write": {
|
|
87593
87684
|
capName: "storage",
|
|
87594
87685
|
capScope: "system",
|
|
@@ -88583,20 +88674,6 @@ Object.freeze({
|
|
|
88583
88674
|
access: "create",
|
|
88584
88675
|
role: "admin"
|
|
88585
88676
|
},
|
|
88586
|
-
"trainingProvider.createEntry": {
|
|
88587
|
-
capName: "training-provider",
|
|
88588
|
-
capScope: "system",
|
|
88589
|
-
addonId: null,
|
|
88590
|
-
access: "create",
|
|
88591
|
-
role: "admin"
|
|
88592
|
-
},
|
|
88593
|
-
"trainingProvider.deleteEntry": {
|
|
88594
|
-
capName: "training-provider",
|
|
88595
|
-
capScope: "system",
|
|
88596
|
-
addonId: null,
|
|
88597
|
-
access: "delete",
|
|
88598
|
-
role: "admin"
|
|
88599
|
-
},
|
|
88600
88677
|
"trainingProvider.describe": {
|
|
88601
88678
|
capName: "training-provider",
|
|
88602
88679
|
capScope: "system",
|
|
@@ -88667,13 +88744,6 @@ Object.freeze({
|
|
|
88667
88744
|
access: "create",
|
|
88668
88745
|
role: "admin"
|
|
88669
88746
|
},
|
|
88670
|
-
"trainingProvider.updateEntry": {
|
|
88671
|
-
capName: "training-provider",
|
|
88672
|
-
capScope: "system",
|
|
88673
|
-
addonId: null,
|
|
88674
|
-
access: "create",
|
|
88675
|
-
role: "admin"
|
|
88676
|
-
},
|
|
88677
88747
|
"trainingProvider.uploadDataset": {
|
|
88678
88748
|
capName: "training-provider",
|
|
88679
88749
|
capScope: "system",
|
|
@@ -88681,13 +88751,6 @@ Object.freeze({
|
|
|
88681
88751
|
access: "create",
|
|
88682
88752
|
role: "admin"
|
|
88683
88753
|
},
|
|
88684
|
-
"trainingProvider.validateCredentials": {
|
|
88685
|
-
capName: "training-provider",
|
|
88686
|
-
capScope: "system",
|
|
88687
|
-
addonId: null,
|
|
88688
|
-
access: "create",
|
|
88689
|
-
role: "admin"
|
|
88690
|
-
},
|
|
88691
88754
|
"turnProvider.getTurnServers": {
|
|
88692
88755
|
capName: "turn-provider",
|
|
88693
88756
|
capScope: "system",
|
|
@@ -91052,11 +91115,6 @@ Object.freeze({
|
|
|
91052
91115
|
form: "single",
|
|
91053
91116
|
optional: false
|
|
91054
91117
|
}],
|
|
91055
|
-
"petFountain.resetDailyConsumption": [{
|
|
91056
|
-
name: "deviceId",
|
|
91057
|
-
form: "single",
|
|
91058
|
-
optional: false
|
|
91059
|
-
}],
|
|
91060
91118
|
"petFountain.setPump": [{
|
|
91061
91119
|
name: "deviceId",
|
|
91062
91120
|
form: "single",
|
|
@@ -95132,7 +95190,6 @@ object({
|
|
|
95132
95190
|
delay: number().nonnegative().optional(),
|
|
95133
95191
|
commands: record(string(), unknown())
|
|
95134
95192
|
});
|
|
95135
|
-
entryBody({ brokerId: string() });
|
|
95136
95193
|
//#endregion
|
|
95137
95194
|
//#region src/migrations/drop-keys.ts
|
|
95138
95195
|
/** The canonical settings table: one row per key, id `<addonId>.<key>`. */
|
|
@@ -98384,7 +98441,7 @@ var LoadShedController = class LoadShedController {
|
|
|
98384
98441
|
return state?.pausedAt !== null && state?.pausedAt !== void 0;
|
|
98385
98442
|
}
|
|
98386
98443
|
/**
|
|
98387
|
-
* Mirrors the former inline block inside
|
|
98444
|
+
* Mirrors the former inline block inside the cluster-write follow-up: clear
|
|
98388
98445
|
* load-shed pauses so suspended cameras get re-evaluated with the new
|
|
98389
98446
|
* thresholds on the next dispatch cycle, then re-dispatch each of them.
|
|
98390
98447
|
*/
|
|
@@ -104227,9 +104284,12 @@ var DeviceConfigContributions = class {
|
|
|
104227
104284
|
constructor(deps) {
|
|
104228
104285
|
this.deps = deps;
|
|
104229
104286
|
}
|
|
104230
|
-
|
|
104287
|
+
/**
|
|
104288
|
+
* The side effects of a cluster settings write that already landed. Runs BEFORE
|
|
104289
|
+
* `applyRuntimeSettings`, so `topology.clusterRoles` still holds the previous roles here.
|
|
104290
|
+
*/
|
|
104291
|
+
async afterClusterSettingsWritten() {
|
|
104231
104292
|
const previousIngestNode = this.deps.topology.clusterRoles.ingestNode;
|
|
104232
|
-
await this.deps.baseUpdateGlobalSettings(patch);
|
|
104233
104293
|
const full = await this.deps.resolveGlobalStore();
|
|
104234
104294
|
this.deps.setGlobalSettings({ ...full });
|
|
104235
104295
|
this.deps.applyRuntimeSettings(full);
|
|
@@ -107861,7 +107921,7 @@ async function resetClusterRows(deps, isCustom) {
|
|
|
107861
107921
|
if (read.kind === "present") stored.set(key, read.value);
|
|
107862
107922
|
}
|
|
107863
107923
|
const { patch, cleared } = clusterRowsToReset((key) => stored.get(key), isCustom);
|
|
107864
|
-
if (cleared.length > 0) await deps.
|
|
107924
|
+
if (cleared.length > 0) await deps.patchClusterSettings({ ...patch });
|
|
107865
107925
|
return cleared;
|
|
107866
107926
|
}
|
|
107867
107927
|
function logResetPin(logger, pin, trigger) {
|
|
@@ -112665,7 +112725,6 @@ async function buildOrchestratorControllers(deps) {
|
|
|
112665
112725
|
deviceHasOnboardMotionCap: (deviceId) => deps.deviceHasOnboardMotionCap(deviceId),
|
|
112666
112726
|
deviceHasActivitySignalCap: (deviceId) => deps.deviceHasActivitySignalCap(deviceId),
|
|
112667
112727
|
deviceHasNativeObjectDetectionCap: (deviceId) => deps.deviceHasNativeObjectDetectionCap(deviceId),
|
|
112668
|
-
baseUpdateGlobalSettings: (patch) => deps.baseUpdateGlobalSettings(patch),
|
|
112669
112728
|
resolveGlobalStore: () => deps.resolveGlobalStore(),
|
|
112670
112729
|
setGlobalSettings: (settings) => {
|
|
112671
112730
|
globalSettings = settings;
|
|
@@ -115142,6 +115201,8 @@ function findStaleDevicePins(pins, nodes) {
|
|
|
115142
115201
|
* because nobody discovers it is missing until they need it.
|
|
115143
115202
|
*/
|
|
115144
115203
|
var customActions = pipelineOrchestratorActions;
|
|
115204
|
+
/** The cluster form is read and written key by key; the declared schema refuses any other key. */
|
|
115205
|
+
var CLUSTER_VALUES_SCHEMA = record(string(), unknown());
|
|
115145
115206
|
var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddon {
|
|
115146
115207
|
/** This node's Moleculer nodeId (from this.ctx.kernel.localNodeId). */
|
|
115147
115208
|
localNodeId = "hub";
|
|
@@ -115283,7 +115344,7 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
115283
115344
|
/**
|
|
115284
115345
|
* Device-details aggregator contributions (`getDeviceSettingsContribution`/
|
|
115285
115346
|
* `getDeviceLiveContribution`/`applyDeviceSettingsPatch`/
|
|
115286
|
-
* `
|
|
115347
|
+
* `afterClusterSettingsWritten`/`writeDeviceOrchestratorSettings`/
|
|
115287
115348
|
* `splitPipelinePatch`/`applyPipelinePatch`) — see
|
|
115288
115349
|
* `device-config-contributions.ts` (S11 Task 1 extraction, C13 remnant).
|
|
115289
115350
|
* Owns nothing durable (reads through injected closures); constructed in
|
|
@@ -115291,6 +115352,8 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
115291
115352
|
* exist. Stateless — no `dispose()`, just nulled at the end of `onShutdown`.
|
|
115292
115353
|
*/
|
|
115293
115354
|
deviceConfig = null;
|
|
115355
|
+
/** True while the removed-model pin sweep runs, so its own cluster writes never re-enter it. */
|
|
115356
|
+
pinResetRunning = false;
|
|
115294
115357
|
/**
|
|
115295
115358
|
* Read-only test-seam compat accessor — mirrors the pre-S9 `protected
|
|
115296
115359
|
* remoteHealthAttempts` field so `remote-health.spec.ts`'s subclass
|
|
@@ -115443,7 +115506,6 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
115443
115506
|
isIdleSessionCamera: (deviceId) => this.isIdleSessionCamera(deviceId),
|
|
115444
115507
|
deviceSettingsSchema: () => this.deviceSettingsSchema(),
|
|
115445
115508
|
resolveGlobalStore: () => this.resolveGlobalStore(),
|
|
115446
|
-
baseUpdateGlobalSettings: (patch) => super.updateGlobalSettings(patch),
|
|
115447
115509
|
watchCapability: (capNames, handlers) => this.watchCapability(capNames, handlers),
|
|
115448
115510
|
state: this.state.bind(this),
|
|
115449
115511
|
rebalance: (opts) => this.rebalance(opts),
|
|
@@ -117217,7 +117279,8 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
117217
117279
|
const auto = this.effectiveShares().current();
|
|
117218
117280
|
if (auto !== null) await this.setLoadBalancingShares(auto.weights);
|
|
117219
117281
|
}
|
|
117220
|
-
await this.
|
|
117282
|
+
await this.state(SHARE_SOURCE_SETTING_KEY, ShareSourceSchema, DEFAULT_SHARE_SOURCE).set(input.source);
|
|
117283
|
+
await this.afterClusterWrite([SHARE_SOURCE_SETTING_KEY]);
|
|
117221
117284
|
this.ctx.logger.info("load balancing: share source changed", { meta: {
|
|
117222
117285
|
from: previous,
|
|
117223
117286
|
to: input.source
|
|
@@ -117394,9 +117457,18 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
117394
117457
|
deviceSettingsSchema() {
|
|
117395
117458
|
return this.schema({ sections: buildDeviceSettingsSections({ runnerNodeIds: this.topology.collectRunnerNodeIds() }) });
|
|
117396
117459
|
}
|
|
117397
|
-
|
|
117398
|
-
|
|
117399
|
-
|
|
117460
|
+
/** The cluster form's stored values, written under their bare keys. */
|
|
117461
|
+
clusterStore() {
|
|
117462
|
+
return this.clusterSettings(PIPELINE_ORCHESTRATOR_ID, CLUSTER_VALUES_SCHEMA);
|
|
117463
|
+
}
|
|
117464
|
+
async onScopedSettingsChanged(scope, cap, keys) {
|
|
117465
|
+
if (scope !== "cluster" || cap !== "pipeline-orchestrator") return;
|
|
117466
|
+
await this.afterClusterWrite(keys);
|
|
117467
|
+
}
|
|
117468
|
+
async afterClusterWrite(keys) {
|
|
117469
|
+
if (this.deviceConfig === null) return;
|
|
117470
|
+
await this.deviceConfig.afterClusterSettingsWritten();
|
|
117471
|
+
if (CLUSTER_MODEL_SCOPED_STEPS.some((step) => keys.includes(clusterModelSettingKey(step.stepId))) && !this.pinResetRunning) await this.resetRemovedModelPins("cluster-row-write");
|
|
117400
117472
|
}
|
|
117401
117473
|
/**
|
|
117402
117474
|
* The ONE stored-pin reset (D725): drop every pin to a model deleted from
|
|
@@ -117420,6 +117492,14 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
117420
117492
|
});
|
|
117421
117493
|
}
|
|
117422
117494
|
async resetRemovedModelPins(trigger) {
|
|
117495
|
+
this.pinResetRunning = true;
|
|
117496
|
+
try {
|
|
117497
|
+
return await this.runRemovedModelPinReset(trigger);
|
|
117498
|
+
} finally {
|
|
117499
|
+
this.pinResetRunning = false;
|
|
117500
|
+
}
|
|
117501
|
+
}
|
|
117502
|
+
async runRemovedModelPinReset(trigger) {
|
|
117423
117503
|
return resetRemovedModelPins({
|
|
117424
117504
|
listCustomModels: async () => {
|
|
117425
117505
|
const api = this.ctx.api;
|
|
@@ -117428,7 +117508,7 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
117428
117508
|
},
|
|
117429
117509
|
resetStoredPins: (isCustom) => this.settingsStore.resetRemovedModelPins(isCustom),
|
|
117430
117510
|
readStoredGlobalKey: (key) => this.readStoredGlobalKey(key),
|
|
117431
|
-
|
|
117511
|
+
patchClusterSettings: (patch) => this.clusterStore().patch(patch),
|
|
117432
117512
|
redispatchNode: (nodeId) => this.placement.redispatchCamerasOnAgent(nodeId),
|
|
117433
117513
|
logger: this.ctx.logger
|
|
117434
117514
|
}, trigger);
|