@camstack/addon-export-hap 1.2.195 → 1.2.197
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/hap-export.addon.js +408 -372
- package/dist/hap-export.addon.mjs +408 -373
- package/package.json +2 -2
|
@@ -39,7 +39,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
39
39
|
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
40
40
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
41
41
|
//#endregion
|
|
42
|
-
//#region ../types/dist/event-category-
|
|
42
|
+
//#region ../types/dist/event-category-78tcBemo.mjs
|
|
43
43
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
44
44
|
EventCategory["SystemBoot"] = "system.boot";
|
|
45
45
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -160,6 +160,23 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
160
160
|
*/
|
|
161
161
|
EventCategory["AddonLoadRecovered"] = "addon.load-recovered";
|
|
162
162
|
/**
|
|
163
|
+
* An addon is RUNNING although its installed package is below what the
|
|
164
|
+
* running server requires (`camstack.requires.addons` of the server, or the
|
|
165
|
+
* addon's own `requires.server`). Raised once per streak by the unsupported-
|
|
166
|
+
* addon tracker, on the hub and on agents; AlertCenter turns it into one
|
|
167
|
+
* operator alert per node and package. The addon is never held back for it.
|
|
168
|
+
*
|
|
169
|
+
* Payload: `{ packageName, addonId, nodeId, installedVersion, requiredMinimum, serverVersion, unmet }`.
|
|
170
|
+
*/
|
|
171
|
+
EventCategory["AddonUnsupportedVersion"] = "addon.unsupported-version";
|
|
172
|
+
/**
|
|
173
|
+
* The package of an {@link AddonUnsupportedVersion} alert reached a supported
|
|
174
|
+
* version, or is no longer installed on the node. AlertCenter dismisses the matching alert.
|
|
175
|
+
*
|
|
176
|
+
* Payload: `{ packageName, addonId, nodeId }`.
|
|
177
|
+
*/
|
|
178
|
+
EventCategory["AddonUnsupportedResolved"] = "addon.unsupported-resolved";
|
|
179
|
+
/**
|
|
163
180
|
* Monitor scheduled the next retry for a failed addon. Transient —
|
|
164
181
|
* surfaced to the UI for live-updating the "next retry in Ns"
|
|
165
182
|
* countdown on the Addons page row, NOT persisted as an alert.
|
|
@@ -270,7 +287,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
270
287
|
EventCategory["ProcessRestarted"] = "process.restarted";
|
|
271
288
|
/**
|
|
272
289
|
* The SET of storage locations changed — one was created, edited, enabled,
|
|
273
|
-
* disabled or deleted through
|
|
290
|
+
* disabled or deleted through the location instances or the forced-delete action.
|
|
274
291
|
*
|
|
275
292
|
* Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
|
|
276
293
|
* it must also converge on its own periodic path, because a dropped event
|
|
@@ -6021,7 +6038,7 @@ var ZodIssueCode = {
|
|
|
6021
6038
|
var ZodFirstPartyTypeKind;
|
|
6022
6039
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6023
6040
|
//#endregion
|
|
6024
|
-
//#region ../types/dist/sleep-
|
|
6041
|
+
//#region ../types/dist/sleep-CQP-REJp.mjs
|
|
6025
6042
|
/**
|
|
6026
6043
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6027
6044
|
* window to float samples (D455).
|
|
@@ -6385,6 +6402,59 @@ Object.fromEntries([
|
|
|
6385
6402
|
function isValuelessField(field) {
|
|
6386
6403
|
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";
|
|
6387
6404
|
}
|
|
6405
|
+
/**
|
|
6406
|
+
* Base collector: flatten a hydrated `ConfigUISchemaWithValues` into
|
|
6407
|
+
* `key → { value, default }`, recursing through `group` and `sub-tabs`
|
|
6408
|
+
* layout fields. Keeping `value` and `default` SEPARATE (rather than
|
|
6409
|
+
* pre-resolving) lets callers both read the effective value AND detect
|
|
6410
|
+
* overrides (`value` differs from `default`). Structural over `unknown`;
|
|
6411
|
+
* malformed input yields an empty map, never throws.
|
|
6412
|
+
*/
|
|
6413
|
+
function collectHydratedFieldEntries(schema) {
|
|
6414
|
+
const out = /* @__PURE__ */ new Map();
|
|
6415
|
+
if (typeof schema !== "object" || schema === null) return out;
|
|
6416
|
+
const sections = schema.sections;
|
|
6417
|
+
if (!Array.isArray(sections)) return out;
|
|
6418
|
+
for (const section of sections) if (typeof section === "object" && section !== null) collectFieldEntriesInto(section.fields, out);
|
|
6419
|
+
return out;
|
|
6420
|
+
}
|
|
6421
|
+
/** Recursive field walker for {@link collectHydratedFieldEntries}. */
|
|
6422
|
+
function collectFieldEntriesInto(fields, into) {
|
|
6423
|
+
if (!Array.isArray(fields)) return;
|
|
6424
|
+
for (const field of fields) {
|
|
6425
|
+
if (typeof field !== "object" || field === null) continue;
|
|
6426
|
+
const type = field.type;
|
|
6427
|
+
if (type === "group") {
|
|
6428
|
+
collectFieldEntriesInto(field.fields, into);
|
|
6429
|
+
continue;
|
|
6430
|
+
}
|
|
6431
|
+
if (type === "sub-tabs") {
|
|
6432
|
+
const tabs = field.tabs;
|
|
6433
|
+
if (Array.isArray(tabs)) {
|
|
6434
|
+
for (const tab of tabs) if (typeof tab === "object" && tab !== null) collectFieldEntriesInto(tab.fields, into);
|
|
6435
|
+
}
|
|
6436
|
+
continue;
|
|
6437
|
+
}
|
|
6438
|
+
const key = field.key;
|
|
6439
|
+
if (typeof key !== "string" || key.length === 0) continue;
|
|
6440
|
+
if (!("value" in field)) continue;
|
|
6441
|
+
into.set(key, {
|
|
6442
|
+
value: field.value,
|
|
6443
|
+
default: field.default
|
|
6444
|
+
});
|
|
6445
|
+
}
|
|
6446
|
+
}
|
|
6447
|
+
/**
|
|
6448
|
+
* Flatten a hydrated settings payload into `key → EFFECTIVE value`
|
|
6449
|
+
* (`value ?? default`). The read-side inverse of `hydrateSchema` for the
|
|
6450
|
+
* common "just give me the resolved values" case. Built on
|
|
6451
|
+
* {@link collectHydratedFieldEntries}.
|
|
6452
|
+
*/
|
|
6453
|
+
function collectHydratedFieldValues(schema) {
|
|
6454
|
+
const out = /* @__PURE__ */ new Map();
|
|
6455
|
+
for (const [key, entry] of collectHydratedFieldEntries(schema)) out.set(key, entry.value ?? entry.default);
|
|
6456
|
+
return out;
|
|
6457
|
+
}
|
|
6388
6458
|
function hydrateSchema(schema, values, options = {}) {
|
|
6389
6459
|
return {
|
|
6390
6460
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
@@ -7269,17 +7339,35 @@ var RecordIntegrationInstances = class {
|
|
|
7269
7339
|
...kind !== void 0 ? { kind } : {}
|
|
7270
7340
|
});
|
|
7271
7341
|
if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
|
|
7342
|
+
const initial = this.hooks.initialBody(name, kind);
|
|
7343
|
+
const patch = this.patchOf(values ?? {});
|
|
7344
|
+
if (Object.keys(patch).length > 0) Object.assign(patch, await this.hooks.validateWrite?.({
|
|
7345
|
+
kind,
|
|
7346
|
+
body: {
|
|
7347
|
+
...initial,
|
|
7348
|
+
...patch
|
|
7349
|
+
}
|
|
7350
|
+
}));
|
|
7272
7351
|
await this.handle.put({
|
|
7273
7352
|
id: minted,
|
|
7274
|
-
data:
|
|
7353
|
+
data: initial
|
|
7275
7354
|
}, { ifRev: 0 });
|
|
7276
|
-
const patch = this.patchOf(values ?? {});
|
|
7277
7355
|
if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
|
|
7278
7356
|
await this.hooks.onChanged?.(minted, "created");
|
|
7279
7357
|
return { id: minted };
|
|
7280
7358
|
};
|
|
7281
7359
|
updateInstance = async ({ id, name, values }) => {
|
|
7282
7360
|
const patch = this.patchOf(values);
|
|
7361
|
+
if (this.hooks.validateWrite !== void 0 && Object.keys(patch).length > 0) {
|
|
7362
|
+
const stored = await this.handle.get(id);
|
|
7363
|
+
if (stored !== null) Object.assign(patch, await this.hooks.validateWrite({
|
|
7364
|
+
kind: void 0,
|
|
7365
|
+
body: {
|
|
7366
|
+
...stored.data,
|
|
7367
|
+
...patch
|
|
7368
|
+
}
|
|
7369
|
+
}));
|
|
7370
|
+
}
|
|
7283
7371
|
if (name !== void 0) patch[this.nameField] = name;
|
|
7284
7372
|
await this.handle.patch(id, patch);
|
|
7285
7373
|
await this.hooks.onChanged?.(id, "updated");
|
|
@@ -7590,6 +7678,21 @@ var SCOPED_SETTINGS_SCOPES = [
|
|
|
7590
7678
|
"device-defaults",
|
|
7591
7679
|
"node"
|
|
7592
7680
|
];
|
|
7681
|
+
/** The one refusal of a key a scope did not declare. */
|
|
7682
|
+
function assertDeclaredKeys(keys, declared) {
|
|
7683
|
+
const undeclared = keys.filter((key) => !declared.has(key));
|
|
7684
|
+
if (undeclared.length > 0) throw new Error(`scoped settings: [${undeclared.join(", ")}] not declared for this scope (declared: [${[...declared].join(", ")}])`);
|
|
7685
|
+
}
|
|
7686
|
+
/** Build the handle over an addon's scoped read, write and unset. */
|
|
7687
|
+
function createScopedSettings(deps) {
|
|
7688
|
+
return {
|
|
7689
|
+
async get() {
|
|
7690
|
+
return deps.schema.parse(await deps.read());
|
|
7691
|
+
},
|
|
7692
|
+
patch: (patch) => deps.write(Object.fromEntries(Object.entries(patch))),
|
|
7693
|
+
unset: (keys) => deps.unset(keys)
|
|
7694
|
+
};
|
|
7695
|
+
}
|
|
7593
7696
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
7594
7697
|
var KeychainWriteRefusedError = class extends Error {
|
|
7595
7698
|
fieldPath;
|
|
@@ -8165,7 +8268,16 @@ function createHandle(raw, opts) {
|
|
|
8165
8268
|
return blob;
|
|
8166
8269
|
}
|
|
8167
8270
|
},
|
|
8168
|
-
writeAddonStore: writeAddon
|
|
8271
|
+
writeAddonStore: writeAddon,
|
|
8272
|
+
removeClearedKeys: (keys) => serialize("addon", async () => {
|
|
8273
|
+
const stored = await readStoredAddonBlob(raw);
|
|
8274
|
+
index.seen("addon", stored);
|
|
8275
|
+
const removable = keys.filter((key) => collectSecretMarkerRefs(stored[key]).length === 0);
|
|
8276
|
+
if (removable.length === 0) return;
|
|
8277
|
+
const patch = Object.fromEntries(removable.map((key) => [key, void 0]));
|
|
8278
|
+
await raw.writeAddonStore(patch);
|
|
8279
|
+
index.wrote("addon", patch);
|
|
8280
|
+
})
|
|
8169
8281
|
};
|
|
8170
8282
|
}
|
|
8171
8283
|
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
@@ -8710,6 +8822,151 @@ var BaseAddon = class {
|
|
|
8710
8822
|
}
|
|
8711
8823
|
}
|
|
8712
8824
|
/**
|
|
8825
|
+
* Hook: values layered over the stored ones when the FORM of one scope is served
|
|
8826
|
+
* ({@link getScopedSettings}) — a preview that derives dependent options without writing.
|
|
8827
|
+
* Never applied to {@link ScopedSettings.get} or to a write. `null` ⇒ no overlay.
|
|
8828
|
+
*/
|
|
8829
|
+
async scopedSettingsOverlay(_scope, _cap, _nodeId) {
|
|
8830
|
+
return null;
|
|
8831
|
+
}
|
|
8832
|
+
/**
|
|
8833
|
+
* Hook: a write of one scope changed stored values (not called when the store reports no change,
|
|
8834
|
+
* e.g. the write-back of a stored secret). `keys` are the bare field keys of the write, node keys included.
|
|
8835
|
+
*/
|
|
8836
|
+
async onScopedSettingsChanged(_scope, _cap, _keys) {}
|
|
8837
|
+
/** Typed handle over the CLUSTER settings `cap` declares (`clusterSettingsSchema`). */
|
|
8838
|
+
clusterSettings(cap, schema) {
|
|
8839
|
+
return this.scopedHandle("cluster", cap, schema);
|
|
8840
|
+
}
|
|
8841
|
+
/** Typed handle over the fleet defaults of the per-device settings `cap` declares. */
|
|
8842
|
+
deviceDefaults(cap, schema) {
|
|
8843
|
+
return this.scopedHandle("device-defaults", cap, schema);
|
|
8844
|
+
}
|
|
8845
|
+
/**
|
|
8846
|
+
* Typed handle over the settings `cap` owns PER NODE. `nodeId` omitted ⇒ the local node. A node
|
|
8847
|
+
* with no row yields the schema defaults — never a bare-key fallback.
|
|
8848
|
+
*/
|
|
8849
|
+
nodeSettings(cap, schema, nodeId) {
|
|
8850
|
+
return this.scopedHandle("node", cap, schema, nodeId);
|
|
8851
|
+
}
|
|
8852
|
+
/**
|
|
8853
|
+
* {@link state} for a value that is kept per node: stored under `<key>@<nodeId>`, and the
|
|
8854
|
+
* settings store carries `nodeId` in the row data (D986 §1), so a forgotten node's rows go in one
|
|
8855
|
+
* central delete. `nodeId` omitted ⇒ the local node.
|
|
8856
|
+
*/
|
|
8857
|
+
nodeState(key, schema, fallback, nodeId) {
|
|
8858
|
+
this._declaredStateKeys.add(key);
|
|
8859
|
+
return createDurableState({
|
|
8860
|
+
key: nodeScopedKey(key, nodeId ?? this._ctx?.kernel?.localNodeId ?? ""),
|
|
8861
|
+
schema,
|
|
8862
|
+
fallback,
|
|
8863
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
8864
|
+
write: async (patch) => {
|
|
8865
|
+
await this._ctx?.settings?.writeAddonStore(patch);
|
|
8866
|
+
},
|
|
8867
|
+
onParseError: (k, e) => this._ctx?.logger?.warn?.(`durable-state: stored "${k}" failed validation — using fallback`, { meta: {
|
|
8868
|
+
addonId: this._ctx?.id,
|
|
8869
|
+
key: k,
|
|
8870
|
+
error: String(e)
|
|
8871
|
+
} })
|
|
8872
|
+
});
|
|
8873
|
+
}
|
|
8874
|
+
/** The loaded schema `cap` declares for `scope`, or `null`. */
|
|
8875
|
+
async declaredScopedSchema(scope, cap) {
|
|
8876
|
+
await this.loadScopedSchemas(cap);
|
|
8877
|
+
return this.loadedScopedSchemas(cap).find((entry) => entry.scope === scope)?.schema ?? null;
|
|
8878
|
+
}
|
|
8879
|
+
async requireScopedSchema(scope, cap) {
|
|
8880
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
8881
|
+
if (schema === null) throw new Error(`${this.constructor.name}: cap "${cap}" declares no ${scope} settings`);
|
|
8882
|
+
return schema;
|
|
8883
|
+
}
|
|
8884
|
+
scopedKeys(schema) {
|
|
8885
|
+
return new Set(schema.sections.flatMap((section) => collectValueFieldKeys(section.fields)));
|
|
8886
|
+
}
|
|
8887
|
+
/** `store` narrowed to the keys `schema` declares. */
|
|
8888
|
+
narrowToScope(store, schema) {
|
|
8889
|
+
const keys = this.scopedKeys(schema);
|
|
8890
|
+
return Object.fromEntries(Object.entries(store).filter(([key]) => keys.has(key)));
|
|
8891
|
+
}
|
|
8892
|
+
scopedHandle(scope, cap, schema, nodeId) {
|
|
8893
|
+
return createScopedSettings({
|
|
8894
|
+
schema,
|
|
8895
|
+
read: async () => {
|
|
8896
|
+
const declared = await this.requireScopedSchema(scope, cap);
|
|
8897
|
+
const stored = this.narrowToScope(await this.resolveGlobalStore(nodeId, cap), declared);
|
|
8898
|
+
const effective = collectHydratedFieldValues(hydrateSchema(declared, stored));
|
|
8899
|
+
return {
|
|
8900
|
+
...Object.fromEntries([...effective].filter(([, value]) => value !== void 0)),
|
|
8901
|
+
...stored
|
|
8902
|
+
};
|
|
8903
|
+
},
|
|
8904
|
+
write: (patch) => this.writeScoped(scope, cap, patch, nodeId),
|
|
8905
|
+
unset: (keys) => this.unsetScoped(scope, cap, keys, nodeId)
|
|
8906
|
+
});
|
|
8907
|
+
}
|
|
8908
|
+
/** The one write path of the scoped API: declared keys only, then the global patch. */
|
|
8909
|
+
async writeScoped(scope, cap, patch, nodeId) {
|
|
8910
|
+
assertDeclaredKeys(Object.keys(patch), this.scopedKeys(await this.requireScopedSchema(scope, cap)));
|
|
8911
|
+
if (await this.applyGlobalPatch(patch, scope === "node" ? nodeId : void 0, cap)) await this.onScopedSettingsChanged(scope, cap, Object.keys(patch));
|
|
8912
|
+
}
|
|
8913
|
+
/**
|
|
8914
|
+
* Remove declared keys of one scope. A secret goes through {@link clearSecrets} — its keychain
|
|
8915
|
+
* value is released exactly as there — and the emptied row is then removed; every other key is
|
|
8916
|
+
* removed by an `undefined` patch (which a secret transform would read as "keep").
|
|
8917
|
+
*/
|
|
8918
|
+
async unsetScoped(scope, cap, keys, nodeId) {
|
|
8919
|
+
assertDeclaredKeys(keys, this.scopedKeys(await this.requireScopedSchema(scope, cap)));
|
|
8920
|
+
const target = scope === "node" ? nodeId : void 0;
|
|
8921
|
+
const tree = this.addonSecretTree();
|
|
8922
|
+
const secretKeys = keys.filter((key) => tree.has(key));
|
|
8923
|
+
const plainKeys = keys.filter((key) => !tree.has(key));
|
|
8924
|
+
let changed = false;
|
|
8925
|
+
if (plainKeys.length > 0) {
|
|
8926
|
+
const patch = Object.fromEntries(plainKeys.map((key) => [key, void 0]));
|
|
8927
|
+
changed = await this.applyGlobalPatch(patch, target, cap) || changed;
|
|
8928
|
+
}
|
|
8929
|
+
if (secretKeys.length > 0) {
|
|
8930
|
+
await this.clearSecretKeys(secretKeys, target, cap);
|
|
8931
|
+
const node = normalizeNodeId(target ?? this._ctx?.kernel?.localNodeId);
|
|
8932
|
+
const rows = secretKeys.map((key) => scope === "node" ? nodeScopedKey(key, node) : key);
|
|
8933
|
+
if (this._secretSettings !== null) await this._secretSettings.removeClearedKeys(rows);
|
|
8934
|
+
else await this._ctx?.settings?.writeAddonStore(Object.fromEntries(rows.map((row) => [row, void 0])));
|
|
8935
|
+
changed = true;
|
|
8936
|
+
}
|
|
8937
|
+
if (changed) await this.onScopedSettingsChanged(scope, cap, [...keys]);
|
|
8938
|
+
}
|
|
8939
|
+
/**
|
|
8940
|
+
* The hydrated form of one scope of one capability's settings (any
|
|
8941
|
+
* {@link scopedSettingsOverlay} applied), or `null` when the capability declares nothing there.
|
|
8942
|
+
*/
|
|
8943
|
+
async getScopedSettings(scope, cap, nodeId) {
|
|
8944
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
8945
|
+
if (schema === null) return null;
|
|
8946
|
+
const stored = this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema);
|
|
8947
|
+
const overlay = await this.scopedSettingsOverlay(scope, cap, nodeId);
|
|
8948
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(stored, overlay) : stored, { inlineSecretsAsViews: true });
|
|
8949
|
+
}
|
|
8950
|
+
/** The OPERATOR's write of declared keys of one scope (D787 secret semantics). */
|
|
8951
|
+
async updateScopedSettings(scope, cap, patch, nodeId) {
|
|
8952
|
+
this._operatorWriteDepth++;
|
|
8953
|
+
try {
|
|
8954
|
+
await this.writeScoped(scope, cap, patch, nodeId);
|
|
8955
|
+
} finally {
|
|
8956
|
+
this._operatorWriteDepth--;
|
|
8957
|
+
}
|
|
8958
|
+
}
|
|
8959
|
+
/**
|
|
8960
|
+
* The effective values (`stored ?? default`) of one scope, a secret as its `set` view — never
|
|
8961
|
+
* its value. `null` when the capability declares nothing for the scope.
|
|
8962
|
+
*/
|
|
8963
|
+
async readScopedValues(scope, cap, nodeId) {
|
|
8964
|
+
const schema = await this.declaredScopedSchema(scope, cap);
|
|
8965
|
+
if (schema === null) return null;
|
|
8966
|
+
const form = hydrateSchema(schema, this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema), { inlineSecretsAsViews: true });
|
|
8967
|
+
return Object.fromEntries([...collectHydratedFieldValues(form)].filter(([, value]) => value !== void 0));
|
|
8968
|
+
}
|
|
8969
|
+
/**
|
|
8713
8970
|
* What the create wizard and the integration edit page render for one instance: the addon's
|
|
8714
8971
|
* per-instance schema when it declares one, else its global schema (what they always showed).
|
|
8715
8972
|
*/
|
|
@@ -8861,6 +9118,9 @@ var BaseAddon = class {
|
|
|
8861
9118
|
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
8862
9119
|
*/
|
|
8863
9120
|
async clearSecrets(keys, nodeId) {
|
|
9121
|
+
await this.clearSecretKeys(keys, nodeId);
|
|
9122
|
+
}
|
|
9123
|
+
async clearSecretKeys(keys, nodeId, cap) {
|
|
8864
9124
|
const tree = this.addonSecretTree();
|
|
8865
9125
|
const keychain = this._ctx?.secrets !== void 0;
|
|
8866
9126
|
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
@@ -8873,25 +9133,27 @@ var BaseAddon = class {
|
|
|
8873
9133
|
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
8874
9134
|
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
8875
9135
|
}
|
|
8876
|
-
await this.applyGlobalPatch(patch, nodeId);
|
|
9136
|
+
await this.applyGlobalPatch(patch, nodeId, cap);
|
|
8877
9137
|
}
|
|
8878
|
-
|
|
8879
|
-
|
|
8880
|
-
|
|
9138
|
+
/** Resolves `true` when the write changed stored values. */
|
|
9139
|
+
async applyGlobalPatch(barePatch, nodeId, cap) {
|
|
9140
|
+
await this.loadScopedSchemas(cap);
|
|
9141
|
+
const keys = this.perNodeKeys(cap);
|
|
8881
9142
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
8882
9143
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
8883
9144
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
8884
9145
|
const handle = this._secretSettings;
|
|
8885
9146
|
if (handle !== null) {
|
|
8886
9147
|
const { changed } = await handle.writeAddonStore(scoped);
|
|
8887
|
-
if (!changed) return;
|
|
9148
|
+
if (!changed) return false;
|
|
8888
9149
|
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
8889
|
-
if (target !== localNode) return;
|
|
9150
|
+
if (target !== localNode) return true;
|
|
8890
9151
|
await this.resolveConfig();
|
|
8891
9152
|
await this.onConfigChanged();
|
|
8892
9153
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
8893
9154
|
const legacy = this.globalSettingsSchema();
|
|
8894
9155
|
this.maybeAutoRestart(Object.keys(barePatch), [...legacy === null ? [] : [legacy], ...this.loadedScopedSchemas().map((entry) => entry.schema)]);
|
|
9156
|
+
return true;
|
|
8895
9157
|
}
|
|
8896
9158
|
/**
|
|
8897
9159
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -10687,7 +10949,6 @@ var CAP_NAMES = Object.freeze([
|
|
|
10687
10949
|
"notifier",
|
|
10688
10950
|
"numeric-sensor",
|
|
10689
10951
|
"oauth-integration",
|
|
10690
|
-
"oidc-connections",
|
|
10691
10952
|
"osd",
|
|
10692
10953
|
"osd-manager",
|
|
10693
10954
|
"pet-feeder",
|
|
@@ -12579,8 +12840,7 @@ Object.freeze({
|
|
|
12579
12840
|
"device-provider": { "reloadDevice": 18e4 },
|
|
12580
12841
|
"llm": {
|
|
12581
12842
|
"generate": 6e5,
|
|
12582
|
-
"generateVision": 6e5
|
|
12583
|
-
"testProfile": 6e5
|
|
12843
|
+
"generateVision": 6e5
|
|
12584
12844
|
},
|
|
12585
12845
|
"llm-runtime": {
|
|
12586
12846
|
"complete": 6e5,
|
|
@@ -14579,17 +14839,18 @@ var IntegrationInstanceRefSchema = object({
|
|
|
14579
14839
|
* message to what the kind supports — callers never special-case a service.
|
|
14580
14840
|
*
|
|
14581
14841
|
* DESIGN DECISIONS (locked):
|
|
14582
|
-
* -
|
|
14583
|
-
*
|
|
14584
|
-
*
|
|
14585
|
-
*
|
|
14586
|
-
*
|
|
14587
|
-
*
|
|
14588
|
-
*
|
|
14589
|
-
*
|
|
14590
|
-
*
|
|
14591
|
-
* routable. `send` / `testTarget` /
|
|
14592
|
-
* `
|
|
14842
|
+
* - A target is an INSTANCE of this function cap (epic #440, step 6): the
|
|
14843
|
+
* providers serve their targets as `integration-instances` records, one
|
|
14844
|
+
* record kind per target kind, and the admin lists, adds, edits, switches
|
|
14845
|
+
* and deletes them through that cap. This cap keeps what an instance cannot
|
|
14846
|
+
* say: the kind catalogue (`listTargetKinds`: capabilities, delivery
|
|
14847
|
+
* parameters, brand icon), dispatch (`send`, `testTarget`) and the form
|
|
14848
|
+
* helpers (`discoverTargets`, `probeTargetConfig`).
|
|
14849
|
+
* - `listTargetKinds` / `discoverTargets` return arrays → the generated
|
|
14850
|
+
* cap-mount auto-`concatCollection`-fans them across every registered
|
|
14851
|
+
* provider so one catalog is routable. `send` / `testTarget` /
|
|
14852
|
+
* `probeTargetConfig` route to ONE provider by the `addonId` the generated
|
|
14853
|
+
* collection router extracts from the call input.
|
|
14593
14854
|
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
14594
14855
|
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
14595
14856
|
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
@@ -14834,7 +15095,7 @@ var TargetKindCapsSchema = object({
|
|
|
14834
15095
|
* the union is large and not meant for runtime validation here; the exported
|
|
14835
15096
|
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
14836
15097
|
*/
|
|
14837
|
-
var ConfigSchemaPassthrough$
|
|
15098
|
+
var ConfigSchemaPassthrough$3 = unknown();
|
|
14838
15099
|
var TargetKindSchema = object({
|
|
14839
15100
|
kind: string(),
|
|
14840
15101
|
label: string(),
|
|
@@ -14871,7 +15132,7 @@ var TargetKindSchema = object({
|
|
|
14871
15132
|
* its raster path, which is the safe default for an unknown image.
|
|
14872
15133
|
*/
|
|
14873
15134
|
iconMediaType: string().optional(),
|
|
14874
|
-
configSchema: ConfigSchemaPassthrough$
|
|
15135
|
+
configSchema: ConfigSchemaPassthrough$3,
|
|
14875
15136
|
/**
|
|
14876
15137
|
* The config keys that decide WHERE this kind's secrets are sent (server,
|
|
14877
15138
|
* base URL, instance, chat, recipient). A save that changes any of them
|
|
@@ -14893,9 +15154,11 @@ var TargetKindSchema = object({
|
|
|
14893
15154
|
caps: TargetKindCapsSchema
|
|
14894
15155
|
});
|
|
14895
15156
|
/**
|
|
14896
|
-
* A
|
|
14897
|
-
*
|
|
14898
|
-
*
|
|
15157
|
+
* A target as a provider's own code sees it (the notification-center bridge, the
|
|
15158
|
+
* send path): the flat record body split into the name, the switch and the
|
|
15159
|
+
* kind's fields. `config` holds secrets; a reader that serves it to a client
|
|
15160
|
+
* REDACTS secret fields (a presence marker only) — never round-trip a stored
|
|
15161
|
+
* secret to the UI.
|
|
14899
15162
|
*/
|
|
14900
15163
|
var TargetSchema = object({
|
|
14901
15164
|
id: string(),
|
|
@@ -14938,13 +15201,13 @@ var ProbeTargetConfigResultSchema = object({
|
|
|
14938
15201
|
stateInstance: string().optional(),
|
|
14939
15202
|
error: string().optional()
|
|
14940
15203
|
});
|
|
14941
|
-
method(object({}), array(TargetKindSchema)), method(object({
|
|
15204
|
+
method(object({}), array(TargetKindSchema)), method(object({
|
|
14942
15205
|
kind: string(),
|
|
14943
15206
|
config: record(string(), unknown()).optional(),
|
|
14944
15207
|
/**
|
|
14945
15208
|
* When editing / duplicating, the blank password field never round-trips
|
|
14946
15209
|
* the stored token. Pass the source target id so the provider can restore
|
|
14947
|
-
* secrets server-side before dialling
|
|
15210
|
+
* secrets server-side before dialling.
|
|
14948
15211
|
*/
|
|
14949
15212
|
targetId: string().optional()
|
|
14950
15213
|
}), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
|
|
@@ -14967,27 +15230,6 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
|
|
|
14967
15230
|
}), TestResultSchema, {
|
|
14968
15231
|
kind: "mutation",
|
|
14969
15232
|
auth: "admin"
|
|
14970
|
-
}), method(object({
|
|
14971
|
-
target: TargetSchema,
|
|
14972
|
-
/**
|
|
14973
|
-
* Duplicate flow: create a NEW target id while copying secrets from an
|
|
14974
|
-
* existing row. The UI never holds the stored token; blank / redacted
|
|
14975
|
-
* password fields are restored from this source (D634 still applies if
|
|
14976
|
-
* destinations diverge without a re-typed secret).
|
|
14977
|
-
*/
|
|
14978
|
-
cloneSecretsFrom: string().optional()
|
|
14979
|
-
}), TargetSchema, {
|
|
14980
|
-
kind: "mutation",
|
|
14981
|
-
auth: "admin"
|
|
14982
|
-
}), method(object({ targetId: string() }), _void(), {
|
|
14983
|
-
kind: "mutation",
|
|
14984
|
-
auth: "admin"
|
|
14985
|
-
}), method(object({
|
|
14986
|
-
targetId: string(),
|
|
14987
|
-
enabled: boolean()
|
|
14988
|
-
}), _void(), {
|
|
14989
|
-
kind: "mutation",
|
|
14990
|
-
auth: "admin"
|
|
14991
15233
|
});
|
|
14992
15234
|
looseObject({
|
|
14993
15235
|
name: string().min(1),
|
|
@@ -23479,7 +23721,6 @@ var SYSTEM_CAP_VOCABULARY = {
|
|
|
23479
23721
|
"notification-output": system("notification delivery — reached through notifier devices and rules"),
|
|
23480
23722
|
"notification-rules": system("notification rules — authored on their own page"),
|
|
23481
23723
|
"oauth-integration": system(IDENTITY),
|
|
23482
|
-
"oidc-connections": system(IDENTITY),
|
|
23483
23724
|
"osd-manager": system(PIPELINE),
|
|
23484
23725
|
"pipeline-executor": system(PIPELINE),
|
|
23485
23726
|
"pipeline-orchestrator": system(PIPELINE),
|
|
@@ -45704,6 +45945,8 @@ var SettingsSchemaWithValuesSchema = object({
|
|
|
45704
45945
|
});
|
|
45705
45946
|
/** Patch object — keys are field names, values are the new field values. */
|
|
45706
45947
|
var SettingsPatchSchema = record(string(), unknown());
|
|
45948
|
+
/** The scope of a scoped-settings call (D986): where the capability declared the values. */
|
|
45949
|
+
var ScopedSettingsScopeSchema = _enum(SCOPED_SETTINGS_SCOPES);
|
|
45707
45950
|
/** Standard success response for update operations. */
|
|
45708
45951
|
var SettingsUpdateResultSchema = object({ success: literal(true) });
|
|
45709
45952
|
method(object({
|
|
@@ -45719,6 +45962,25 @@ method(object({
|
|
|
45719
45962
|
kind: "mutation",
|
|
45720
45963
|
auth: "admin"
|
|
45721
45964
|
}), method(object({
|
|
45965
|
+
addonId: string(),
|
|
45966
|
+
cap: string(),
|
|
45967
|
+
scope: ScopedSettingsScopeSchema,
|
|
45968
|
+
nodeId: string().optional()
|
|
45969
|
+
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
45970
|
+
addonId: string(),
|
|
45971
|
+
cap: string(),
|
|
45972
|
+
scope: ScopedSettingsScopeSchema,
|
|
45973
|
+
nodeId: string().optional(),
|
|
45974
|
+
patch: SettingsPatchSchema
|
|
45975
|
+
}), SettingsUpdateResultSchema, {
|
|
45976
|
+
kind: "mutation",
|
|
45977
|
+
auth: "admin"
|
|
45978
|
+
}), method(object({
|
|
45979
|
+
addonId: string(),
|
|
45980
|
+
cap: string(),
|
|
45981
|
+
scope: ScopedSettingsScopeSchema,
|
|
45982
|
+
nodeId: string().optional()
|
|
45983
|
+
}), record(string(), unknown()).nullable()), method(object({
|
|
45722
45984
|
addonId: string(),
|
|
45723
45985
|
nodeId: string().optional()
|
|
45724
45986
|
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
@@ -55381,7 +55643,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
55381
55643
|
* or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
|
|
55382
55644
|
* clears it.
|
|
55383
55645
|
*/
|
|
55384
|
-
var ConfigSchemaPassthrough$
|
|
55646
|
+
var ConfigSchemaPassthrough$2 = custom();
|
|
55385
55647
|
var IntegrationInstanceIdSchema = string().min(1);
|
|
55386
55648
|
var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
|
|
55387
55649
|
/**
|
|
@@ -55427,7 +55689,16 @@ var IntegrationInstanceKindSchema = object({
|
|
|
55427
55689
|
/** Relative hub path to start an interactive account link of an instance of this kind. */
|
|
55428
55690
|
connectPath: string().min(1).optional(),
|
|
55429
55691
|
/** Relative hub path to disconnect that account. */
|
|
55430
|
-
disconnectPath: string().min(1).optional()
|
|
55692
|
+
disconnectPath: string().min(1).optional(),
|
|
55693
|
+
/**
|
|
55694
|
+
* Parts of the edit dialog the flat form cannot draw (a node picker, a model source), named by a
|
|
55695
|
+
* GENERIC widget id the client maps to a component; a client that knows none of them shows none.
|
|
55696
|
+
* `connection` widgets write connection values, `model` widgets own the model choice.
|
|
55697
|
+
*/
|
|
55698
|
+
widgets: array(object({
|
|
55699
|
+
id: string().min(1),
|
|
55700
|
+
placement: _enum(["connection", "model"])
|
|
55701
|
+
})).optional()
|
|
55431
55702
|
});
|
|
55432
55703
|
/**
|
|
55433
55704
|
* How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
|
|
@@ -55532,7 +55803,7 @@ var integrationInstancesCapability = {
|
|
|
55532
55803
|
id: IntegrationInstanceIdSchema.nullable(),
|
|
55533
55804
|
/** The kind of the create form (`id: null`) of a provider with several. */
|
|
55534
55805
|
kind: string().min(1).optional()
|
|
55535
|
-
}), ConfigSchemaPassthrough$
|
|
55806
|
+
}), ConfigSchemaPassthrough$2, { auth: "admin" }),
|
|
55536
55807
|
listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
|
|
55537
55808
|
getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
|
|
55538
55809
|
/**
|
|
@@ -56483,12 +56754,12 @@ var LlmModelInfoSchema = object({
|
|
|
56483
56754
|
});
|
|
56484
56755
|
/**
|
|
56485
56756
|
* The provider-specific part of a profile, validated by the provider that owns
|
|
56486
|
-
* the kind (
|
|
56757
|
+
* the kind (saving an instance refuses what it does not accept). A field its
|
|
56487
56758
|
* `connectionSchema` declares `type: 'password'` is a secret: it is held in the
|
|
56488
56759
|
* keychain, never in the row, and reads back as the redaction marker.
|
|
56489
56760
|
*/
|
|
56490
56761
|
var LlmProviderConfigSchema = record(string(), unknown());
|
|
56491
|
-
|
|
56762
|
+
object({
|
|
56492
56763
|
id: string(),
|
|
56493
56764
|
name: string(),
|
|
56494
56765
|
/** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
|
|
@@ -56582,8 +56853,8 @@ var LlmProviderWidgetSchema = object({
|
|
|
56582
56853
|
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
56583
56854
|
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
56584
56855
|
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
56585
|
-
var ConfigSchemaPassthrough$
|
|
56586
|
-
|
|
56856
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
56857
|
+
object({
|
|
56587
56858
|
kind: LlmProfileKindSchema,
|
|
56588
56859
|
label: string(),
|
|
56589
56860
|
/** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
|
|
@@ -56591,9 +56862,9 @@ var LlmProfileKindDescriptorSchema = object({
|
|
|
56591
56862
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
56592
56863
|
addonId: string(),
|
|
56593
56864
|
/** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
|
|
56594
|
-
connectionSchema: ConfigSchemaPassthrough$
|
|
56865
|
+
connectionSchema: ConfigSchemaPassthrough$1,
|
|
56595
56866
|
/** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
|
|
56596
|
-
advancedSchema: ConfigSchemaPassthrough$
|
|
56867
|
+
advancedSchema: ConfigSchemaPassthrough$1.optional(),
|
|
56597
56868
|
/** The kind's defaults; a model from `listModels` may override any of them. */
|
|
56598
56869
|
features: LlmModelFeaturesSchema,
|
|
56599
56870
|
/** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
|
|
@@ -56722,20 +56993,7 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
|
|
|
56722
56993
|
}), method(object({
|
|
56723
56994
|
addonId: string().optional(),
|
|
56724
56995
|
requestId: string()
|
|
56725
|
-
}), _void(), { kind: "mutation" }), method(
|
|
56726
|
-
kind: "mutation",
|
|
56727
|
-
auth: "admin"
|
|
56728
|
-
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
56729
|
-
kind: "mutation",
|
|
56730
|
-
auth: "admin"
|
|
56731
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
56732
|
-
kind: "mutation",
|
|
56733
|
-
auth: "admin"
|
|
56734
|
-
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
56735
|
-
kind: "mutation",
|
|
56736
|
-
auth: "admin",
|
|
56737
|
-
timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
|
|
56738
|
-
}), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
|
|
56996
|
+
}), _void(), { kind: "mutation" }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
|
|
56739
56997
|
kind: "mutation",
|
|
56740
56998
|
auth: "admin"
|
|
56741
56999
|
}), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
@@ -57730,20 +57988,7 @@ method(_void(), MeshStatusSchema), method(object({
|
|
|
57730
57988
|
/** Optional hostname override the host should advertise once joined. */
|
|
57731
57989
|
hostname: string().optional() }), object({
|
|
57732
57990
|
/** Authentication URL the operator should open in a browser. */
|
|
57733
|
-
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() }))
|
|
57734
|
-
/** Optional auth key — when provided, probes the key validity
|
|
57735
|
-
* against the provider's API. Omit when already joined to
|
|
57736
|
-
* just ping the daemon. */
|
|
57737
|
-
authKey: string().optional() }), object({
|
|
57738
|
-
ok: boolean(),
|
|
57739
|
-
/** Provider-side identifier resolved by the probe (tailnet
|
|
57740
|
-
* name for Tailscale, network id for ZeroTier, etc.). */
|
|
57741
|
-
tenant: string().optional(),
|
|
57742
|
-
/** Daemon binary version, when reachable. */
|
|
57743
|
-
daemonVersion: string().optional(),
|
|
57744
|
-
/** Human-readable error when `ok: false`. */
|
|
57745
|
-
error: string().optional()
|
|
57746
|
-
}), { kind: "mutation" });
|
|
57991
|
+
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() }));
|
|
57747
57992
|
object({
|
|
57748
57993
|
value: number().nullable().meta(readingMeta("device", { label: "Total" })),
|
|
57749
57994
|
lastFetchedAt: number()
|
|
@@ -67401,61 +67646,6 @@ var OauthIntegrationDescriptorSchema = object({
|
|
|
67401
67646
|
});
|
|
67402
67647
|
method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
|
|
67403
67648
|
/**
|
|
67404
|
-
* `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
|
|
67405
|
-
*
|
|
67406
|
-
* One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
|
|
67407
|
-
* ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
|
|
67408
|
-
* Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
|
|
67409
|
-
* immutable after create.
|
|
67410
|
-
*/
|
|
67411
|
-
var ConfigSchemaPassthrough$1 = unknown();
|
|
67412
|
-
var OidcConnectionSchema = object({
|
|
67413
|
-
id: string().min(1),
|
|
67414
|
-
displayName: string(),
|
|
67415
|
-
icon: string(),
|
|
67416
|
-
issuerUrl: string(),
|
|
67417
|
-
clientId: string(),
|
|
67418
|
-
/** Client id + secret present — never the secret value. */
|
|
67419
|
-
configured: boolean(),
|
|
67420
|
-
/**
|
|
67421
|
-
* Values for the connection form schema. `clientSecret` is a keychain
|
|
67422
|
-
* {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
|
|
67423
|
-
*/
|
|
67424
|
-
formValues: record(string(), unknown()).optional()
|
|
67425
|
-
});
|
|
67426
|
-
/**
|
|
67427
|
-
* Patch one connection. Omitted or empty `clientSecret` keeps the stored
|
|
67428
|
-
* secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
|
|
67429
|
-
*/
|
|
67430
|
-
var OidcConnectionUpdateInputSchema = object({
|
|
67431
|
-
id: string().min(1),
|
|
67432
|
-
displayName: string().min(1),
|
|
67433
|
-
icon: string().optional(),
|
|
67434
|
-
issuerUrl: string().optional(),
|
|
67435
|
-
clientId: string().optional(),
|
|
67436
|
-
clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
|
|
67437
|
-
redirectUri: string().optional(),
|
|
67438
|
-
scopes: string().optional(),
|
|
67439
|
-
usernameClaim: _enum([
|
|
67440
|
-
"preferred_username",
|
|
67441
|
-
"email",
|
|
67442
|
-
"sub"
|
|
67443
|
-
]).optional()
|
|
67444
|
-
});
|
|
67445
|
-
method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
|
|
67446
|
-
id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
|
|
67447
|
-
displayName: string().min(1)
|
|
67448
|
-
}), object({ id: string() }), {
|
|
67449
|
-
kind: "mutation",
|
|
67450
|
-
auth: "admin"
|
|
67451
|
-
}), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
|
|
67452
|
-
kind: "mutation",
|
|
67453
|
-
auth: "admin"
|
|
67454
|
-
}), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
|
|
67455
|
-
kind: "mutation",
|
|
67456
|
-
auth: "admin"
|
|
67457
|
-
});
|
|
67458
|
-
/**
|
|
67459
67649
|
* Generic on-screen-display (video overlay) cap. Each camera exposes
|
|
67460
67650
|
* a firmware-defined list of overlays (channel name, timestamp,
|
|
67461
67651
|
* watermark, logo, …); the cap models them as a homogeneous array of
|
|
@@ -73830,21 +74020,6 @@ method(object({
|
|
|
73830
74020
|
*/
|
|
73831
74021
|
ttlSec: union([number().int().positive(), literal("never")]).optional()
|
|
73832
74022
|
}), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
|
|
73833
|
-
var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
|
|
73834
|
-
providerId: string().min(1),
|
|
73835
|
-
displayName: string().min(1),
|
|
73836
|
-
configSchema: unknown(),
|
|
73837
|
-
nodeLocal: boolean(),
|
|
73838
|
-
shouldSaveDiskSpace: literal(true),
|
|
73839
|
-
minFreePercent: number().min(0).max(100)
|
|
73840
|
-
}), object({
|
|
73841
|
-
providerId: string().min(1),
|
|
73842
|
-
displayName: string().min(1),
|
|
73843
|
-
configSchema: unknown(),
|
|
73844
|
-
nodeLocal: boolean(),
|
|
73845
|
-
shouldSaveDiskSpace: literal(false),
|
|
73846
|
-
minFreePercent: literal(null)
|
|
73847
|
-
})]);
|
|
73848
74023
|
method(object({
|
|
73849
74024
|
location: StorageLocationRefSchema,
|
|
73850
74025
|
relativePath: string()
|
|
@@ -73906,42 +74081,7 @@ method(object({
|
|
|
73906
74081
|
}), _instanceof(Uint8Array), { auth: "admin" }), method(object({ downloadId: string() }), _void(), {
|
|
73907
74082
|
kind: "mutation",
|
|
73908
74083
|
auth: "admin"
|
|
73909
|
-
}), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(
|
|
73910
|
-
createdAt: true,
|
|
73911
|
-
updatedAt: true
|
|
73912
|
-
}), StorageLocationSchema, {
|
|
73913
|
-
kind: "mutation",
|
|
73914
|
-
auth: "admin"
|
|
73915
|
-
}), method(object({
|
|
73916
|
-
id: string(),
|
|
73917
|
-
force: boolean().optional()
|
|
73918
|
-
}), _void(), {
|
|
73919
|
-
kind: "mutation",
|
|
73920
|
-
auth: "admin"
|
|
73921
|
-
}), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
|
|
73922
|
-
ok: boolean(),
|
|
73923
|
-
error: string().optional()
|
|
73924
|
-
}), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
|
|
73925
|
-
providerId: string(),
|
|
73926
|
-
/**
|
|
73927
|
-
* The location this config is an UNSAVED edit of, when there is one.
|
|
73928
|
-
*
|
|
73929
|
-
* `listLocations` replaces every declared secret with the redaction
|
|
73930
|
-
* sentinel, so the edit modal's form state holds the sentinel for any
|
|
73931
|
-
* credential the operator did not retype — and posting that here
|
|
73932
|
-
* without a way to resolve it makes the provider try to authenticate
|
|
73933
|
-
* as `__camstack_redacted__` and report the operator's own working
|
|
73934
|
-
* password as wrong. Given this id, the orchestrator restores each
|
|
73935
|
-
* sentinel from the stored config (same rule as `upsertLocation`)
|
|
73936
|
-
* before dispatching. Omitted by the "Add location" wizard, where
|
|
73937
|
-
* every value was typed just now and nothing is stored yet.
|
|
73938
|
-
*/
|
|
73939
|
-
locationId: string().optional(),
|
|
73940
|
-
config: record(string(), unknown())
|
|
73941
|
-
}), object({
|
|
73942
|
-
ok: boolean(),
|
|
73943
|
-
error: string().optional()
|
|
73944
|
-
}), { auth: "admin" });
|
|
74084
|
+
}), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(_void(), array(StorageDrainProgressSchema).readonly());
|
|
73945
74085
|
/** One table of the settings database. */
|
|
73946
74086
|
var StorageTableSchema = object({
|
|
73947
74087
|
/** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
|
|
@@ -78074,6 +78214,20 @@ Object.freeze({
|
|
|
78074
78214
|
access: "view",
|
|
78075
78215
|
role: "admin"
|
|
78076
78216
|
},
|
|
78217
|
+
"addonSettings.getScopedSettings": {
|
|
78218
|
+
capName: "addon-settings",
|
|
78219
|
+
capScope: "system",
|
|
78220
|
+
addonId: null,
|
|
78221
|
+
access: "view",
|
|
78222
|
+
role: "admin"
|
|
78223
|
+
},
|
|
78224
|
+
"addonSettings.readScopedValues": {
|
|
78225
|
+
capName: "addon-settings",
|
|
78226
|
+
capScope: "system",
|
|
78227
|
+
addonId: null,
|
|
78228
|
+
access: "view",
|
|
78229
|
+
role: "admin"
|
|
78230
|
+
},
|
|
78077
78231
|
"addonSettings.unsetStoredSettingsKeys": {
|
|
78078
78232
|
capName: "addon-settings",
|
|
78079
78233
|
capScope: "system",
|
|
@@ -78095,6 +78249,13 @@ Object.freeze({
|
|
|
78095
78249
|
access: "create",
|
|
78096
78250
|
role: "admin"
|
|
78097
78251
|
},
|
|
78252
|
+
"addonSettings.updateScopedSettings": {
|
|
78253
|
+
capName: "addon-settings",
|
|
78254
|
+
capScope: "system",
|
|
78255
|
+
addonId: null,
|
|
78256
|
+
access: "create",
|
|
78257
|
+
role: "admin"
|
|
78258
|
+
},
|
|
78098
78259
|
"addonWidgets.listWidgets": {
|
|
78099
78260
|
capName: "addon-widgets",
|
|
78100
78261
|
capScope: "system",
|
|
@@ -81546,13 +81707,6 @@ Object.freeze({
|
|
|
81546
81707
|
access: "delete",
|
|
81547
81708
|
role: "admin"
|
|
81548
81709
|
},
|
|
81549
|
-
"llm.deleteProfile": {
|
|
81550
|
-
capName: "llm",
|
|
81551
|
-
capScope: "system",
|
|
81552
|
-
addonId: null,
|
|
81553
|
-
access: "delete",
|
|
81554
|
-
role: "admin"
|
|
81555
|
-
},
|
|
81556
81710
|
"llm.generate": {
|
|
81557
81711
|
capName: "llm",
|
|
81558
81712
|
capScope: "system",
|
|
@@ -81616,20 +81770,6 @@ Object.freeze({
|
|
|
81616
81770
|
access: "view",
|
|
81617
81771
|
role: "admin"
|
|
81618
81772
|
},
|
|
81619
|
-
"llm.listProfileKinds": {
|
|
81620
|
-
capName: "llm",
|
|
81621
|
-
capScope: "system",
|
|
81622
|
-
addonId: null,
|
|
81623
|
-
access: "view",
|
|
81624
|
-
role: "admin"
|
|
81625
|
-
},
|
|
81626
|
-
"llm.listProfiles": {
|
|
81627
|
-
capName: "llm",
|
|
81628
|
-
capScope: "system",
|
|
81629
|
-
addonId: null,
|
|
81630
|
-
access: "view",
|
|
81631
|
-
role: "admin"
|
|
81632
|
-
},
|
|
81633
81773
|
"llm.listRuntimeNodes": {
|
|
81634
81774
|
capName: "llm",
|
|
81635
81775
|
capScope: "system",
|
|
@@ -81637,13 +81777,6 @@ Object.freeze({
|
|
|
81637
81777
|
access: "view",
|
|
81638
81778
|
role: "admin"
|
|
81639
81779
|
},
|
|
81640
|
-
"llm.migrateRawSecrets": {
|
|
81641
|
-
capName: "llm",
|
|
81642
|
-
capScope: "system",
|
|
81643
|
-
addonId: null,
|
|
81644
|
-
access: "create",
|
|
81645
|
-
role: "admin"
|
|
81646
|
-
},
|
|
81647
81780
|
"llm.resolveModelRef": {
|
|
81648
81781
|
capName: "llm",
|
|
81649
81782
|
capScope: "system",
|
|
@@ -81672,20 +81805,6 @@ Object.freeze({
|
|
|
81672
81805
|
access: "create",
|
|
81673
81806
|
role: "admin"
|
|
81674
81807
|
},
|
|
81675
|
-
"llm.testProfile": {
|
|
81676
|
-
capName: "llm",
|
|
81677
|
-
capScope: "system",
|
|
81678
|
-
addonId: null,
|
|
81679
|
-
access: "create",
|
|
81680
|
-
role: "admin"
|
|
81681
|
-
},
|
|
81682
|
-
"llm.upsertProfile": {
|
|
81683
|
-
capName: "llm",
|
|
81684
|
-
capScope: "system",
|
|
81685
|
-
addonId: null,
|
|
81686
|
-
access: "create",
|
|
81687
|
-
role: "admin"
|
|
81688
|
-
},
|
|
81689
81808
|
"llmRuntime.appleAvailability": {
|
|
81690
81809
|
capName: "llm-runtime",
|
|
81691
81810
|
capScope: "system",
|
|
@@ -82190,13 +82309,6 @@ Object.freeze({
|
|
|
82190
82309
|
access: "create",
|
|
82191
82310
|
role: "admin"
|
|
82192
82311
|
},
|
|
82193
|
-
"meshNetwork.testConnection": {
|
|
82194
|
-
capName: "mesh-network",
|
|
82195
|
-
capScope: "system",
|
|
82196
|
-
addonId: null,
|
|
82197
|
-
access: "create",
|
|
82198
|
-
role: "admin"
|
|
82199
|
-
},
|
|
82200
82312
|
"meter.getStatus": {
|
|
82201
82313
|
capName: "meter",
|
|
82202
82314
|
capScope: "device",
|
|
@@ -82855,13 +82967,6 @@ Object.freeze({
|
|
|
82855
82967
|
access: "create",
|
|
82856
82968
|
role: "admin"
|
|
82857
82969
|
},
|
|
82858
|
-
"notificationOutput.deleteTarget": {
|
|
82859
|
-
capName: "notification-output",
|
|
82860
|
-
capScope: "system",
|
|
82861
|
-
addonId: null,
|
|
82862
|
-
access: "delete",
|
|
82863
|
-
role: "admin"
|
|
82864
|
-
},
|
|
82865
82970
|
"notificationOutput.discoverTargets": {
|
|
82866
82971
|
capName: "notification-output",
|
|
82867
82972
|
capScope: "system",
|
|
@@ -82869,13 +82974,6 @@ Object.freeze({
|
|
|
82869
82974
|
access: "view",
|
|
82870
82975
|
role: "admin"
|
|
82871
82976
|
},
|
|
82872
|
-
"notificationOutput.getTarget": {
|
|
82873
|
-
capName: "notification-output",
|
|
82874
|
-
capScope: "system",
|
|
82875
|
-
addonId: null,
|
|
82876
|
-
access: "view",
|
|
82877
|
-
role: "admin"
|
|
82878
|
-
},
|
|
82879
82977
|
"notificationOutput.listTargetKinds": {
|
|
82880
82978
|
capName: "notification-output",
|
|
82881
82979
|
capScope: "system",
|
|
@@ -82883,13 +82981,6 @@ Object.freeze({
|
|
|
82883
82981
|
access: "view",
|
|
82884
82982
|
role: "admin"
|
|
82885
82983
|
},
|
|
82886
|
-
"notificationOutput.listTargets": {
|
|
82887
|
-
capName: "notification-output",
|
|
82888
|
-
capScope: "system",
|
|
82889
|
-
addonId: null,
|
|
82890
|
-
access: "view",
|
|
82891
|
-
role: "admin"
|
|
82892
|
-
},
|
|
82893
82984
|
"notificationOutput.probeTargetConfig": {
|
|
82894
82985
|
capName: "notification-output",
|
|
82895
82986
|
capScope: "system",
|
|
@@ -82904,13 +82995,6 @@ Object.freeze({
|
|
|
82904
82995
|
access: "create",
|
|
82905
82996
|
role: "admin"
|
|
82906
82997
|
},
|
|
82907
|
-
"notificationOutput.setTargetEnabled": {
|
|
82908
|
-
capName: "notification-output",
|
|
82909
|
-
capScope: "system",
|
|
82910
|
-
addonId: null,
|
|
82911
|
-
access: "create",
|
|
82912
|
-
role: "admin"
|
|
82913
|
-
},
|
|
82914
82998
|
"notificationOutput.testTarget": {
|
|
82915
82999
|
capName: "notification-output",
|
|
82916
83000
|
capScope: "system",
|
|
@@ -82918,13 +83002,6 @@ Object.freeze({
|
|
|
82918
83002
|
access: "create",
|
|
82919
83003
|
role: "admin"
|
|
82920
83004
|
},
|
|
82921
|
-
"notificationOutput.upsertTarget": {
|
|
82922
|
-
capName: "notification-output",
|
|
82923
|
-
capScope: "system",
|
|
82924
|
-
addonId: null,
|
|
82925
|
-
access: "create",
|
|
82926
|
-
role: "admin"
|
|
82927
|
-
},
|
|
82928
83005
|
"notificationRules.activateAlarmProfile": {
|
|
82929
83006
|
capName: "notification-rules",
|
|
82930
83007
|
capScope: "system",
|
|
@@ -83184,41 +83261,6 @@ Object.freeze({
|
|
|
83184
83261
|
access: "view",
|
|
83185
83262
|
role: "admin"
|
|
83186
83263
|
},
|
|
83187
|
-
"oidcConnections.connectionFormSchema": {
|
|
83188
|
-
capName: "oidc-connections",
|
|
83189
|
-
capScope: "system",
|
|
83190
|
-
addonId: null,
|
|
83191
|
-
access: "view",
|
|
83192
|
-
role: "admin"
|
|
83193
|
-
},
|
|
83194
|
-
"oidcConnections.createConnection": {
|
|
83195
|
-
capName: "oidc-connections",
|
|
83196
|
-
capScope: "system",
|
|
83197
|
-
addonId: null,
|
|
83198
|
-
access: "create",
|
|
83199
|
-
role: "admin"
|
|
83200
|
-
},
|
|
83201
|
-
"oidcConnections.deleteConnection": {
|
|
83202
|
-
capName: "oidc-connections",
|
|
83203
|
-
capScope: "system",
|
|
83204
|
-
addonId: null,
|
|
83205
|
-
access: "delete",
|
|
83206
|
-
role: "admin"
|
|
83207
|
-
},
|
|
83208
|
-
"oidcConnections.listConnections": {
|
|
83209
|
-
capName: "oidc-connections",
|
|
83210
|
-
capScope: "system",
|
|
83211
|
-
addonId: null,
|
|
83212
|
-
access: "view",
|
|
83213
|
-
role: "admin"
|
|
83214
|
-
},
|
|
83215
|
-
"oidcConnections.updateConnection": {
|
|
83216
|
-
capName: "oidc-connections",
|
|
83217
|
-
capScope: "system",
|
|
83218
|
-
addonId: null,
|
|
83219
|
-
access: "create",
|
|
83220
|
-
role: "admin"
|
|
83221
|
-
},
|
|
83222
83264
|
"osd.getStatus": {
|
|
83223
83265
|
capName: "osd",
|
|
83224
83266
|
capScope: "device",
|
|
@@ -86250,13 +86292,6 @@ Object.freeze({
|
|
|
86250
86292
|
access: "delete",
|
|
86251
86293
|
role: "admin"
|
|
86252
86294
|
},
|
|
86253
|
-
"storage.deleteLocation": {
|
|
86254
|
-
capName: "storage",
|
|
86255
|
-
capScope: "system",
|
|
86256
|
-
addonId: null,
|
|
86257
|
-
access: "delete",
|
|
86258
|
-
role: "admin"
|
|
86259
|
-
},
|
|
86260
86295
|
"storage.endDownload": {
|
|
86261
86296
|
capName: "storage",
|
|
86262
86297
|
capScope: "system",
|
|
@@ -86313,13 +86348,6 @@ Object.freeze({
|
|
|
86313
86348
|
access: "view",
|
|
86314
86349
|
role: "admin"
|
|
86315
86350
|
},
|
|
86316
|
-
"storage.listProviders": {
|
|
86317
|
-
capName: "storage",
|
|
86318
|
-
capScope: "system",
|
|
86319
|
-
addonId: null,
|
|
86320
|
-
access: "view",
|
|
86321
|
-
role: "admin"
|
|
86322
|
-
},
|
|
86323
86351
|
"storage.read": {
|
|
86324
86352
|
capName: "storage",
|
|
86325
86353
|
capScope: "system",
|
|
@@ -86341,27 +86369,6 @@ Object.freeze({
|
|
|
86341
86369
|
access: "view",
|
|
86342
86370
|
role: "admin"
|
|
86343
86371
|
},
|
|
86344
|
-
"storage.testConfig": {
|
|
86345
|
-
capName: "storage",
|
|
86346
|
-
capScope: "system",
|
|
86347
|
-
addonId: null,
|
|
86348
|
-
access: "view",
|
|
86349
|
-
role: "admin"
|
|
86350
|
-
},
|
|
86351
|
-
"storage.testLocation": {
|
|
86352
|
-
capName: "storage",
|
|
86353
|
-
capScope: "system",
|
|
86354
|
-
addonId: null,
|
|
86355
|
-
access: "view",
|
|
86356
|
-
role: "admin"
|
|
86357
|
-
},
|
|
86358
|
-
"storage.upsertLocation": {
|
|
86359
|
-
capName: "storage",
|
|
86360
|
-
capScope: "system",
|
|
86361
|
-
addonId: null,
|
|
86362
|
-
access: "create",
|
|
86363
|
-
role: "admin"
|
|
86364
|
-
},
|
|
86365
86372
|
"storage.write": {
|
|
86366
86373
|
capName: "storage",
|
|
86367
86374
|
capScope: "system",
|
|
@@ -159722,10 +159729,23 @@ var HAP_STREAM_PREFERENCE_OPTIONS = [
|
|
|
159722
159729
|
label: "Low"
|
|
159723
159730
|
}
|
|
159724
159731
|
];
|
|
159732
|
+
/** One device's advertised HAP state, persisted in the addon store. JSON-plain
|
|
159733
|
+
* mirror of `ExportTargetEntry` from `@camstack/types/node`. Keyed by
|
|
159734
|
+
* `String(deviceId)` in the `exportSyncState` store key. `externalIds` holds
|
|
159735
|
+
* the deterministic accessory UUID (diagnostic; rebuild uses the live mapper). */
|
|
159736
|
+
var ExportTargetEntrySchema = object({
|
|
159737
|
+
fingerprint: string(),
|
|
159738
|
+
externalIds: array(string())
|
|
159739
|
+
});
|
|
159740
|
+
/** Durable per-device export sync state — the Phase-C reconciler cache, kept under the
|
|
159741
|
+
* addon-store key `exportSyncState` (the key the addon always used).
|
|
159742
|
+
* Key = `String(deviceId)`, value = the device's export fingerprint at last
|
|
159743
|
+
* attach. Drives `diffExportTargets`: an unchanged restart hashes to the same
|
|
159744
|
+
* fingerprint → no rebuild. */
|
|
159745
|
+
var ExportSyncStateSchema = record(string(), ExportTargetEntrySchema);
|
|
159725
159746
|
var DEFAULT_CONFIG = {
|
|
159726
159747
|
interfaceName: "",
|
|
159727
|
-
clipRetentionDays: 14
|
|
159728
|
-
exportSyncState: {}
|
|
159748
|
+
clipRetentionDays: 14
|
|
159729
159749
|
};
|
|
159730
159750
|
var BANNED_PINCODES = new Set([
|
|
159731
159751
|
"000-00-000",
|
|
@@ -160044,7 +160064,7 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
160044
160064
|
await this.stopInstance(id);
|
|
160045
160065
|
for (const uuid of uuids) clearPairingFiles(uuid, this.ctx.logger);
|
|
160046
160066
|
await this.exposureHandle().delete(id);
|
|
160047
|
-
if (id === "export-hap") await this.
|
|
160067
|
+
if (id === "export-hap") await this.exportSyncState.set({});
|
|
160048
160068
|
this.ctx.logger.info("export-hap: bridge removed", { meta: { instanceId: id } });
|
|
160049
160069
|
}
|
|
160050
160070
|
/**
|
|
@@ -160416,9 +160436,11 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
160416
160436
|
return inst.accessoryUuidOf(inst.findEntry(deviceId)?.mapperKind ?? "camera", deviceId);
|
|
160417
160437
|
}
|
|
160418
160438
|
/** The reconcile cache of a bridge: the default one is persisted, the others live in memory (boot re-attach seeds them). */
|
|
160419
|
-
syncStateOf(inst) {
|
|
160420
|
-
return inst.id === "export-hap" ? syncStateFromJson(this.
|
|
160439
|
+
async syncStateOf(inst) {
|
|
160440
|
+
return inst.id === "export-hap" ? syncStateFromJson(await this.exportSyncState.get()) : inst.syncState;
|
|
160421
160441
|
}
|
|
160442
|
+
/** The persisted reconcile cache of the default bridge (store key `exportSyncState`). */
|
|
160443
|
+
exportSyncState = this.state("exportSyncState", ExportSyncStateSchema, {});
|
|
160422
160444
|
/**
|
|
160423
160445
|
* Export fingerprint of a device from its PERSISTED features + type
|
|
160424
160446
|
* (`canonicalDeviceFingerprint`). Returns `null` on a transient API error or
|
|
@@ -160444,7 +160466,7 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
160444
160466
|
deviceType: device.type,
|
|
160445
160467
|
features: device.features
|
|
160446
160468
|
});
|
|
160447
|
-
const persisted = this.syncStateOf(inst).get(deviceId)?.fingerprint;
|
|
160469
|
+
const persisted = (await this.syncStateOf(inst)).get(deviceId)?.fingerprint;
|
|
160448
160470
|
const withToken = withRecordabilityToken({
|
|
160449
160471
|
base: fresh,
|
|
160450
160472
|
token: await this.readRecordabilityToken(inst, deviceId, device.type),
|
|
@@ -160479,22 +160501,35 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
160479
160501
|
return null;
|
|
160480
160502
|
}
|
|
160481
160503
|
}
|
|
160504
|
+
/** Tail of the pending cache writes of each bridge: a read-modify-write of one bridge never overlaps another. */
|
|
160505
|
+
syncWrites = /* @__PURE__ */ new Map();
|
|
160506
|
+
/** Run one read-modify-write of a bridge's reconcile cache after the previous one finished. */
|
|
160507
|
+
serialisedSyncWrite(inst, write) {
|
|
160508
|
+
const next = (this.syncWrites.get(inst.id) ?? Promise.resolve()).then(write);
|
|
160509
|
+
this.syncWrites.set(inst.id, next.catch(() => void 0));
|
|
160510
|
+
return next;
|
|
160511
|
+
}
|
|
160482
160512
|
/** Persist a device's current export fingerprint into `exportSyncState`
|
|
160483
|
-
* (best-effort; called after a successful attach).
|
|
160484
|
-
|
|
160485
|
-
|
|
160486
|
-
|
|
160487
|
-
|
|
160488
|
-
|
|
160513
|
+
* (best-effort; called after a successful attach). Serialised per bridge, so two attaches
|
|
160514
|
+
* finishing together cannot each write back a cache that lacks the other's entry. */
|
|
160515
|
+
persistFingerprint(inst, deviceId, fingerprint) {
|
|
160516
|
+
return this.serialisedSyncWrite(inst, async () => {
|
|
160517
|
+
const state = await this.syncStateOf(inst);
|
|
160518
|
+
state.set(deviceId, {
|
|
160519
|
+
fingerprint,
|
|
160520
|
+
externalIds: [this.hapAccessoryUuid(inst, deviceId)]
|
|
160521
|
+
});
|
|
160522
|
+
if (inst.id === "export-hap") await this.exportSyncState.set(syncStateToJson(state));
|
|
160489
160523
|
});
|
|
160490
|
-
if (inst.id === "export-hap") await this.updateGlobalSettings({ exportSyncState: syncStateToJson(state) });
|
|
160491
160524
|
}
|
|
160492
|
-
/** Drop a device's `exportSyncState` entry (on unexpose). */
|
|
160493
|
-
|
|
160494
|
-
|
|
160495
|
-
|
|
160496
|
-
|
|
160497
|
-
|
|
160525
|
+
/** Drop a device's `exportSyncState` entry (on unexpose). Serialised with the writes above. */
|
|
160526
|
+
forgetFingerprint(inst, deviceId) {
|
|
160527
|
+
return this.serialisedSyncWrite(inst, async () => {
|
|
160528
|
+
const state = await this.syncStateOf(inst);
|
|
160529
|
+
if (!state.has(deviceId)) return;
|
|
160530
|
+
state.delete(deviceId);
|
|
160531
|
+
if (inst.id === "export-hap") await this.exportSyncState.set(syncStateToJson(state));
|
|
160532
|
+
});
|
|
160498
160533
|
}
|
|
160499
160534
|
/**
|
|
160500
160535
|
* Subscribe to a device-lifecycle event category and reconcile the exposed
|
|
@@ -160582,7 +160617,7 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
160582
160617
|
log.debug("export-hap: reconcile skipped — fingerprint unavailable (transient)");
|
|
160583
160618
|
return;
|
|
160584
160619
|
}
|
|
160585
|
-
const last = this.syncStateOf(inst).get(numericId);
|
|
160620
|
+
const last = (await this.syncStateOf(inst)).get(numericId);
|
|
160586
160621
|
if (last?.fingerprint === current) {
|
|
160587
160622
|
if (!inst.exposed.has(deviceId)) try {
|
|
160588
160623
|
await this.attachMapper(inst, entry);
|
|
@@ -161099,4 +161134,4 @@ function errMsg(err) {
|
|
|
161099
161134
|
return err instanceof Error ? err.message : String(err);
|
|
161100
161135
|
}
|
|
161101
161136
|
//#endregion
|
|
161102
|
-
export { DEFAULT_CLIP_RETENTION_DAYS, DEFAULT_DEVICE_SETTINGS, EXPORT_HAP_ADDON_ID, ExportHapAddon, ExportHapAddon as default, exportHapActions as a, describeHksvCamera, unpublishAccessory as i, initHapStorage as n, publishStandalone as r, resolveClipRetentionDays, resolveKeepHomekitClips, resolveMultiTierService, deriveUsername as t };
|
|
161137
|
+
export { DEFAULT_CLIP_RETENTION_DAYS, DEFAULT_DEVICE_SETTINGS, EXPORT_HAP_ADDON_ID, ExportHapAddon, ExportHapAddon as default, ExportSyncStateSchema, exportHapActions as a, describeHksvCamera, unpublishAccessory as i, initHapStorage as n, publishStandalone as r, resolveClipRetentionDays, resolveKeepHomekitClips, resolveMultiTierService, deriveUsername as t };
|