@camstack/addon-pipeline-orchestrator 1.2.663 → 1.2.664
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 +6 -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-eCr2uk4a.mjs} +3 -3
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CSVAOMjE.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-Dguynk7E.mjs +26 -0
- package/dist/{hostInit-BQJRnhiE.mjs → hostInit-BMliBDra.mjs} +3 -3
- package/dist/index.js +1029 -961
- package/dist/index.mjs +1029 -961
- 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
|
@@ -5984,7 +5984,7 @@ var ZodIssueCode = {
|
|
|
5984
5984
|
var ZodFirstPartyTypeKind;
|
|
5985
5985
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5986
5986
|
//#endregion
|
|
5987
|
-
//#region ../types/dist/sleep-
|
|
5987
|
+
//#region ../types/dist/sleep-D7ZKm4nb.mjs
|
|
5988
5988
|
/**
|
|
5989
5989
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5990
5990
|
* window to float samples (D455).
|
|
@@ -6677,6 +6677,344 @@ async function runAddonMigrations(host, migrations, logger, options = {}) {
|
|
|
6677
6677
|
blockOwner
|
|
6678
6678
|
};
|
|
6679
6679
|
}
|
|
6680
|
+
/** The record calls the one-switch migration makes, over the migration API. */
|
|
6681
|
+
function switchRecordsOverMigrationApi(api) {
|
|
6682
|
+
return { kind: (definition) => {
|
|
6683
|
+
const handle = api.records.kind(definition);
|
|
6684
|
+
return {
|
|
6685
|
+
get: (id) => handle.get({ id }),
|
|
6686
|
+
put: (input, opts) => handle.put({
|
|
6687
|
+
...input,
|
|
6688
|
+
...opts?.ifRev === void 0 ? {} : { ifRev: opts.ifRev }
|
|
6689
|
+
}),
|
|
6690
|
+
patch: (id, partial) => handle.patch({
|
|
6691
|
+
id,
|
|
6692
|
+
partial
|
|
6693
|
+
})
|
|
6694
|
+
};
|
|
6695
|
+
} };
|
|
6696
|
+
}
|
|
6697
|
+
function integrationRowsApiOver(api) {
|
|
6698
|
+
return {
|
|
6699
|
+
list: async () => (await api.integrations.list({})).integrations,
|
|
6700
|
+
readLegacyIntegrationRows: (input) => api.legacyRows.read(input),
|
|
6701
|
+
clearLegacyIntegrationRows: (input) => api.legacyRows.clear(input)
|
|
6702
|
+
};
|
|
6703
|
+
}
|
|
6704
|
+
var PREFIX = "records/";
|
|
6705
|
+
/**
|
|
6706
|
+
* Cross-realm brand. An addon bundles its own copy of this module (D15) while
|
|
6707
|
+
* `ctx.records` is the HOST's door, so an error thrown by the host is an
|
|
6708
|
+
* instance of the host's classes, not of the addon's. The brand plus the code
|
|
6709
|
+
* make `instanceof` answer by identity of the failure, not of the copy.
|
|
6710
|
+
*/
|
|
6711
|
+
var RECORDS_ERROR_BRAND = Symbol.for("camstack.records-error");
|
|
6712
|
+
function carriesBrand(value) {
|
|
6713
|
+
return typeof value === "object" && value !== null && Reflect.get(value, RECORDS_ERROR_BRAND) === true;
|
|
6714
|
+
}
|
|
6715
|
+
/** The base of every records failure. `detail` is the human part of the message. */
|
|
6716
|
+
var RecordsError = class extends Error {
|
|
6717
|
+
/** The code a subclass stands for; the base stands for every code. */
|
|
6718
|
+
static code = void 0;
|
|
6719
|
+
/**
|
|
6720
|
+
* `instanceof` across copies of this module: any branded error is a
|
|
6721
|
+
* `RecordsError`, and is an instance of a subclass only when its code is the
|
|
6722
|
+
* subclass's code. Same-copy answers are unchanged.
|
|
6723
|
+
*/
|
|
6724
|
+
static [Symbol.hasInstance](value) {
|
|
6725
|
+
if (Function.prototype[Symbol.hasInstance].call(this, value)) return true;
|
|
6726
|
+
if (!carriesBrand(value)) return false;
|
|
6727
|
+
return this.code === void 0 || value.code === this.code;
|
|
6728
|
+
}
|
|
6729
|
+
code;
|
|
6730
|
+
detail;
|
|
6731
|
+
[RECORDS_ERROR_BRAND] = true;
|
|
6732
|
+
constructor(code, detail) {
|
|
6733
|
+
super(`${PREFIX}${code}: ${detail}`);
|
|
6734
|
+
this.name = "RecordsError";
|
|
6735
|
+
this.code = code;
|
|
6736
|
+
this.detail = detail;
|
|
6737
|
+
}
|
|
6738
|
+
};
|
|
6739
|
+
var InvalidRecordError = class InvalidRecordError extends RecordsError {
|
|
6740
|
+
static code = "invalid-record";
|
|
6741
|
+
constructor(detail) {
|
|
6742
|
+
super(InvalidRecordError.code, detail);
|
|
6743
|
+
this.name = "InvalidRecordError";
|
|
6744
|
+
}
|
|
6745
|
+
};
|
|
6746
|
+
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
6747
|
+
var DeclarationRefusedError = class DeclarationRefusedError extends RecordsError {
|
|
6748
|
+
static code = "declaration-refused";
|
|
6749
|
+
constructor(detail) {
|
|
6750
|
+
super(DeclarationRefusedError.code, detail);
|
|
6751
|
+
this.name = "DeclarationRefusedError";
|
|
6752
|
+
}
|
|
6753
|
+
};
|
|
6754
|
+
object({
|
|
6755
|
+
cap: string().min(1),
|
|
6756
|
+
kind: string().min(1).optional()
|
|
6757
|
+
});
|
|
6758
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
6759
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6760
|
+
function globalSecretScope() {
|
|
6761
|
+
return GLOBAL_SCOPE;
|
|
6762
|
+
}
|
|
6763
|
+
function encodeSegment(value) {
|
|
6764
|
+
return encodeURIComponent(value);
|
|
6765
|
+
}
|
|
6766
|
+
function decodeSegment(value) {
|
|
6767
|
+
try {
|
|
6768
|
+
return decodeURIComponent(value);
|
|
6769
|
+
} catch {
|
|
6770
|
+
return null;
|
|
6771
|
+
}
|
|
6772
|
+
}
|
|
6773
|
+
/**
|
|
6774
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
6775
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6776
|
+
* `providers[authentik].clientSecret`.
|
|
6777
|
+
*/
|
|
6778
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6779
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6780
|
+
}
|
|
6781
|
+
function parseScope(segments) {
|
|
6782
|
+
switch (segments[0]) {
|
|
6783
|
+
case "global": return {
|
|
6784
|
+
scope: GLOBAL_SCOPE,
|
|
6785
|
+
used: 1
|
|
6786
|
+
};
|
|
6787
|
+
case "node": {
|
|
6788
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6789
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6790
|
+
scope: {
|
|
6791
|
+
kind: "node",
|
|
6792
|
+
nodeId
|
|
6793
|
+
},
|
|
6794
|
+
used: 2
|
|
6795
|
+
};
|
|
6796
|
+
}
|
|
6797
|
+
case "device": {
|
|
6798
|
+
const raw = segments[1];
|
|
6799
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6800
|
+
return {
|
|
6801
|
+
scope: {
|
|
6802
|
+
kind: "device",
|
|
6803
|
+
deviceId: Number(raw)
|
|
6804
|
+
},
|
|
6805
|
+
used: 2
|
|
6806
|
+
};
|
|
6807
|
+
}
|
|
6808
|
+
case "integration": {
|
|
6809
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6810
|
+
return id === null || id.length === 0 ? null : {
|
|
6811
|
+
scope: {
|
|
6812
|
+
kind: "integration",
|
|
6813
|
+
integrationId: id
|
|
6814
|
+
},
|
|
6815
|
+
used: 2
|
|
6816
|
+
};
|
|
6817
|
+
}
|
|
6818
|
+
case "row": {
|
|
6819
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6820
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6821
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6822
|
+
return {
|
|
6823
|
+
scope: {
|
|
6824
|
+
kind: "row",
|
|
6825
|
+
collection,
|
|
6826
|
+
rowId
|
|
6827
|
+
},
|
|
6828
|
+
used: 3
|
|
6829
|
+
};
|
|
6830
|
+
}
|
|
6831
|
+
default: return null;
|
|
6832
|
+
}
|
|
6833
|
+
}
|
|
6834
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6835
|
+
function parseSecretRef(ref) {
|
|
6836
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6837
|
+
const segments = ref.slice(9).split("/");
|
|
6838
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6839
|
+
if (owner === null || owner.length === 0) return null;
|
|
6840
|
+
const parsed = parseScope(segments.slice(1));
|
|
6841
|
+
if (parsed === null) return null;
|
|
6842
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6843
|
+
if (fieldPath.length === 0) return null;
|
|
6844
|
+
return {
|
|
6845
|
+
owner,
|
|
6846
|
+
scope: parsed.scope,
|
|
6847
|
+
fieldPath
|
|
6848
|
+
};
|
|
6849
|
+
}
|
|
6850
|
+
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
6851
|
+
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
6852
|
+
var RECORD_DATABASES = ["settings", "events"];
|
|
6853
|
+
/** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
|
|
6854
|
+
var RECORD_CLASSES = [
|
|
6855
|
+
"config",
|
|
6856
|
+
"ledger",
|
|
6857
|
+
"audit",
|
|
6858
|
+
"mirror",
|
|
6859
|
+
"ephemeral"
|
|
6860
|
+
];
|
|
6861
|
+
var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
6862
|
+
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
6863
|
+
var RECORD_BATCH_MAX = 1e3;
|
|
6864
|
+
var RECORD_QUERY_MAX = 1e3;
|
|
6865
|
+
/** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
|
|
6866
|
+
var RECORD_SETTINGS_MAX_ROWS = 5e4;
|
|
6867
|
+
/**
|
|
6868
|
+
* Secret fields of a record, addressed the way a Zod schema declares them
|
|
6869
|
+
* (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
|
|
6870
|
+
* (`auth.accessToken`, `headers[].value`).
|
|
6871
|
+
*
|
|
6872
|
+
* `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
|
|
6873
|
+
* names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
|
|
6874
|
+
* key releases exactly that key's secret.
|
|
6875
|
+
*
|
|
6876
|
+
* Array elements are matched by a DECLARED id key (`secretArrayKeys`:
|
|
6877
|
+
* `{ headers: 'name' }`), never by index, so reordering a list keeps every
|
|
6878
|
+
* keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
|
|
6879
|
+
* leaf names its element: `headers[X-Api].value`.
|
|
6880
|
+
*
|
|
6881
|
+
* Pure and browser-safe. Nothing here mutates: every transform returns a new value.
|
|
6882
|
+
*/
|
|
6883
|
+
/** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
|
|
6884
|
+
function parseSecretPath(path) {
|
|
6885
|
+
if (path.length === 0) throw new InvalidRecordError("an empty secret path");
|
|
6886
|
+
return path.split(".").map((raw) => {
|
|
6887
|
+
const each = raw.endsWith("[]");
|
|
6888
|
+
const map = raw.endsWith("{}");
|
|
6889
|
+
const key = each || map ? raw.slice(0, -2) : raw;
|
|
6890
|
+
if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
|
|
6891
|
+
return {
|
|
6892
|
+
key,
|
|
6893
|
+
each,
|
|
6894
|
+
map
|
|
6895
|
+
};
|
|
6896
|
+
});
|
|
6897
|
+
}
|
|
6898
|
+
/** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
|
|
6899
|
+
function secretArrayPrefixes(path) {
|
|
6900
|
+
const segments = parseSecretPath(path);
|
|
6901
|
+
const prefixes = [];
|
|
6902
|
+
const walked = [];
|
|
6903
|
+
for (const segment of segments) {
|
|
6904
|
+
walked.push(segment.key);
|
|
6905
|
+
if (segment.each) prefixes.push(walked.join("."));
|
|
6906
|
+
}
|
|
6907
|
+
return prefixes;
|
|
6908
|
+
}
|
|
6909
|
+
/** The body key of the switch; only {@link RecordIntegrationInstances.setInstanceEnabled} writes it. */
|
|
6910
|
+
var SWITCH_KEY = "enabled";
|
|
6911
|
+
/**
|
|
6912
|
+
* The one-switch migration (epic #440, step 3). An integration's on/off state used to live in the
|
|
6913
|
+
* registry's `enabled` column for a device addon; it now lives only in the instance record's
|
|
6914
|
+
* body (`enabled`, D1007 superseded). This moves a registry `enabled = false` into the body, once.
|
|
6915
|
+
*
|
|
6916
|
+
* For every registry row of the addon that is OFF:
|
|
6917
|
+
* - no record under its id: the record is created from `initialBody(name)` with `enabled: false`
|
|
6918
|
+
* (a default integration that never had settings, Reolink's among them);
|
|
6919
|
+
* - a record whose body states no `enabled`: `enabled: false` is written into it;
|
|
6920
|
+
* - a record that already states `enabled` (either way) is the newer truth and is left alone.
|
|
6921
|
+
* A row that is ON writes nothing: an absent field reads as on. A rerun finds every off row with
|
|
6922
|
+
* a stated switch and does nothing, so nothing switched off comes back on and nothing switched on
|
|
6923
|
+
* goes off. The registry column itself is neither read afterwards nor written; its drop is step 5.
|
|
6924
|
+
*
|
|
6925
|
+
* It runs in the addon process, BEFORE the addon registers its `integration-instances` provider,
|
|
6926
|
+
* which is also why `integrations.list` still answers the stored column at that point.
|
|
6927
|
+
*/
|
|
6928
|
+
function registrySwitchToBodyId(addonId, date) {
|
|
6929
|
+
return `${addonId}/${date}-registry-switch-to-body`;
|
|
6930
|
+
}
|
|
6931
|
+
async function moveRegistrySwitchToBody(ports, spec) {
|
|
6932
|
+
const rows = await ports.listIntegrations(spec.addonId);
|
|
6933
|
+
let created = 0;
|
|
6934
|
+
let switched = 0;
|
|
6935
|
+
let kept = 0;
|
|
6936
|
+
for (const row of rows) {
|
|
6937
|
+
if (row.enabled) continue;
|
|
6938
|
+
const body = await ports.readBody(row.id);
|
|
6939
|
+
if (body === null) {
|
|
6940
|
+
if (await ports.createRecord(row.id, {
|
|
6941
|
+
...spec.initialBody(row.name),
|
|
6942
|
+
["enabled"]: false
|
|
6943
|
+
}) === "created") created += 1;
|
|
6944
|
+
else kept += 1;
|
|
6945
|
+
continue;
|
|
6946
|
+
}
|
|
6947
|
+
if ("enabled" in body) {
|
|
6948
|
+
kept += 1;
|
|
6949
|
+
continue;
|
|
6950
|
+
}
|
|
6951
|
+
await ports.switchOff(row.id);
|
|
6952
|
+
switched += 1;
|
|
6953
|
+
}
|
|
6954
|
+
const summary = {
|
|
6955
|
+
integrations: rows.length,
|
|
6956
|
+
off: rows.filter((r) => !r.enabled).length,
|
|
6957
|
+
created,
|
|
6958
|
+
switched,
|
|
6959
|
+
kept
|
|
6960
|
+
};
|
|
6961
|
+
return created === 0 && switched === 0 ? {
|
|
6962
|
+
outcome: "already-done",
|
|
6963
|
+
summary
|
|
6964
|
+
} : {
|
|
6965
|
+
outcome: "done",
|
|
6966
|
+
summary
|
|
6967
|
+
};
|
|
6968
|
+
}
|
|
6969
|
+
/** A migration entry: an addon states its kind and how a new body starts, nothing else. */
|
|
6970
|
+
function registrySwitchToBodyMigration(spec) {
|
|
6971
|
+
return {
|
|
6972
|
+
meta: {
|
|
6973
|
+
id: registrySwitchToBodyId(spec.addonId, spec.date),
|
|
6974
|
+
owner: spec.addonId,
|
|
6975
|
+
level: "addon-state",
|
|
6976
|
+
seq: spec.seq,
|
|
6977
|
+
dependsOn: [],
|
|
6978
|
+
store: "settings",
|
|
6979
|
+
scope: "cluster",
|
|
6980
|
+
onFailure: "block-owner",
|
|
6981
|
+
bodyKind: "procedure",
|
|
6982
|
+
description: "Move the registry enabled flag of every switched-off integration into its instance record body, creating the record when there is none",
|
|
6983
|
+
fixtureMark: "enabled"
|
|
6984
|
+
},
|
|
6985
|
+
procedure: (ports) => moveRegistrySwitchToBody(ports, {
|
|
6986
|
+
addonId: spec.addonId,
|
|
6987
|
+
initialBody: spec.initialBody
|
|
6988
|
+
})
|
|
6989
|
+
};
|
|
6990
|
+
}
|
|
6991
|
+
/** The hub and records sides of {@link registrySwitchToBodyMigration}. */
|
|
6992
|
+
function registrySwitchPortsOver(deps) {
|
|
6993
|
+
const handle = deps.records.kind({
|
|
6994
|
+
name: deps.kind.name,
|
|
6995
|
+
declaration: deps.kind.declaration,
|
|
6996
|
+
schema: record(string(), unknown())
|
|
6997
|
+
});
|
|
6998
|
+
return {
|
|
6999
|
+
listIntegrations: async (addonId) => (await deps.api.list()).filter((i) => i.addonId === addonId).map((i) => ({
|
|
7000
|
+
id: i.id,
|
|
7001
|
+
name: i.name,
|
|
7002
|
+
enabled: i.enabled !== false
|
|
7003
|
+
})),
|
|
7004
|
+
readBody: async (id) => (await handle.get(id))?.data ?? null,
|
|
7005
|
+
createRecord: async (id, body) => {
|
|
7006
|
+
if (await handle.get(id) !== null) return "exists";
|
|
7007
|
+
await handle.put({
|
|
7008
|
+
id,
|
|
7009
|
+
data: body
|
|
7010
|
+
}, { ifRev: 0 });
|
|
7011
|
+
return "created";
|
|
7012
|
+
},
|
|
7013
|
+
switchOff: async (id) => {
|
|
7014
|
+
await handle.patch(id, { [SWITCH_KEY]: false });
|
|
7015
|
+
}
|
|
7016
|
+
};
|
|
7017
|
+
}
|
|
6680
7018
|
/**
|
|
6681
7019
|
* Build a {@link DurableState} over a single store key. Transport-agnostic:
|
|
6682
7020
|
* `read`/`write` are the addon-store or device-store accessors. The whole
|
|
@@ -6808,98 +7146,6 @@ var SCOPED_SETTINGS_SCOPES = [
|
|
|
6808
7146
|
"device-defaults",
|
|
6809
7147
|
"node"
|
|
6810
7148
|
];
|
|
6811
|
-
var GLOBAL_SCOPE = { kind: "global" };
|
|
6812
|
-
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6813
|
-
function globalSecretScope() {
|
|
6814
|
-
return GLOBAL_SCOPE;
|
|
6815
|
-
}
|
|
6816
|
-
function encodeSegment(value) {
|
|
6817
|
-
return encodeURIComponent(value);
|
|
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;
|
|
6897
|
-
return {
|
|
6898
|
-
owner,
|
|
6899
|
-
scope: parsed.scope,
|
|
6900
|
-
fieldPath
|
|
6901
|
-
};
|
|
6902
|
-
}
|
|
6903
7149
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6904
7150
|
var KeychainWriteRefusedError = class extends Error {
|
|
6905
7151
|
fieldPath;
|
|
@@ -6910,7 +7156,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6910
7156
|
}
|
|
6911
7157
|
};
|
|
6912
7158
|
var KEEP = { kind: "keep" };
|
|
6913
|
-
function isRecord$
|
|
7159
|
+
function isRecord$4(value) {
|
|
6914
7160
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6915
7161
|
}
|
|
6916
7162
|
function defaultMintId() {
|
|
@@ -6923,7 +7169,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6923
7169
|
return out;
|
|
6924
7170
|
}
|
|
6925
7171
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6926
|
-
else if (isRecord$
|
|
7172
|
+
else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6927
7173
|
return out;
|
|
6928
7174
|
}
|
|
6929
7175
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6978,7 +7224,7 @@ function rowId(row, idKey) {
|
|
|
6978
7224
|
return null;
|
|
6979
7225
|
}
|
|
6980
7226
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6981
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$
|
|
7227
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
|
|
6982
7228
|
if (!Array.isArray(incoming)) {
|
|
6983
7229
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6984
7230
|
return {
|
|
@@ -6994,7 +7240,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6994
7240
|
const kept = /* @__PURE__ */ new Set();
|
|
6995
7241
|
const rows = [];
|
|
6996
7242
|
for (const row of incoming) {
|
|
6997
|
-
if (!isRecord$
|
|
7243
|
+
if (!isRecord$4(row)) {
|
|
6998
7244
|
rows.push(row);
|
|
6999
7245
|
continue;
|
|
7000
7246
|
}
|
|
@@ -7019,7 +7265,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
7019
7265
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
7020
7266
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
7021
7267
|
case "object": {
|
|
7022
|
-
if (!isRecord$
|
|
7268
|
+
if (!isRecord$4(incoming)) {
|
|
7023
7269
|
if (incoming === void 0) return KEEP;
|
|
7024
7270
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
7025
7271
|
return {
|
|
@@ -7027,7 +7273,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
7027
7273
|
value: incoming
|
|
7028
7274
|
};
|
|
7029
7275
|
}
|
|
7030
|
-
const storedObj = isRecord$
|
|
7276
|
+
const storedObj = isRecord$4(stored) ? stored : {};
|
|
7031
7277
|
return {
|
|
7032
7278
|
kind: "value",
|
|
7033
7279
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -7150,7 +7396,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
|
7150
7396
|
value: items
|
|
7151
7397
|
};
|
|
7152
7398
|
}
|
|
7153
|
-
if (isRecord$
|
|
7399
|
+
if (isRecord$4(v)) {
|
|
7154
7400
|
const out = {};
|
|
7155
7401
|
for (const [k, child] of Object.entries(v)) {
|
|
7156
7402
|
const s = substitute(child);
|
|
@@ -7182,7 +7428,7 @@ var SecretOverwriteRefusedError = class extends Error {
|
|
|
7182
7428
|
this.name = "SecretOverwriteRefusedError";
|
|
7183
7429
|
}
|
|
7184
7430
|
};
|
|
7185
|
-
function isRecord$
|
|
7431
|
+
function isRecord$3(value) {
|
|
7186
7432
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7187
7433
|
}
|
|
7188
7434
|
function resolvedValue(pass, marker) {
|
|
@@ -7211,7 +7457,7 @@ function inArray(pass, incoming, stored) {
|
|
|
7211
7457
|
return incoming.map((item, index) => {
|
|
7212
7458
|
const twin = stored[index];
|
|
7213
7459
|
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
7214
|
-
if (isRecord$
|
|
7460
|
+
if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
|
|
7215
7461
|
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
7216
7462
|
return item;
|
|
7217
7463
|
});
|
|
@@ -7222,7 +7468,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
7222
7468
|
const twin = stored[key];
|
|
7223
7469
|
if (isSecretMarker(twin)) {
|
|
7224
7470
|
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
7225
|
-
} else if (isRecord$
|
|
7471
|
+
} else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
7226
7472
|
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
7227
7473
|
}
|
|
7228
7474
|
return out;
|
|
@@ -7230,7 +7476,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
7230
7476
|
async function walk(pass, incoming, stored) {
|
|
7231
7477
|
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
7232
7478
|
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
7233
|
-
if (!isRecord$
|
|
7479
|
+
if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
|
|
7234
7480
|
const out = { ...incoming };
|
|
7235
7481
|
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
7236
7482
|
return out;
|
|
@@ -7261,7 +7507,7 @@ async function restoreUnchangedSecrets(input) {
|
|
|
7261
7507
|
function isJsonEqual(a, b) {
|
|
7262
7508
|
if (Object.is(a, b)) return true;
|
|
7263
7509
|
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
7264
|
-
if (isRecord$
|
|
7510
|
+
if (isRecord$3(a) && isRecord$3(b)) {
|
|
7265
7511
|
const keys = Object.keys(a);
|
|
7266
7512
|
if (keys.length !== Object.keys(b).length) return false;
|
|
7267
7513
|
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
@@ -7285,7 +7531,7 @@ function markerKeysOf(blob, owner) {
|
|
|
7285
7531
|
}
|
|
7286
7532
|
function nodeFromStored(value, owner) {
|
|
7287
7533
|
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
7288
|
-
if (!isRecord$
|
|
7534
|
+
if (!isRecord$3(value)) return null;
|
|
7289
7535
|
const children = /* @__PURE__ */ new Map();
|
|
7290
7536
|
for (const [key, child] of Object.entries(value)) {
|
|
7291
7537
|
const node = nodeFromStored(child, owner);
|
|
@@ -7782,13 +8028,48 @@ var BaseAddon = class {
|
|
|
7782
8028
|
if (api === void 0) throw new Error(`${this.ctx.id}: the migration API is not available on this context`);
|
|
7783
8029
|
return this.runBound(sets.flatMap((set) => set.bind(api)), options);
|
|
7784
8030
|
}
|
|
7785
|
-
|
|
8031
|
+
/**
|
|
8032
|
+
* A device addon states its instance kind once, before its migrations run, and the one-switch
|
|
8033
|
+
* migration (registry `enabled` to the instance body, epic #440 step 3) joins whatever
|
|
8034
|
+
* catalogue the addon runs, in the SAME declaration (the engine replaces an owner's catalogue
|
|
8035
|
+
* on every declare).
|
|
8036
|
+
*/
|
|
8037
|
+
declareRegistrySwitch(spec) {
|
|
8038
|
+
this.registrySwitchSpec = spec;
|
|
8039
|
+
}
|
|
8040
|
+
registrySwitchSpec = null;
|
|
8041
|
+
registrySwitchBound() {
|
|
8042
|
+
const spec = this.registrySwitchSpec;
|
|
8043
|
+
if (spec === null) return [];
|
|
8044
|
+
const api = this.ctx.migrationApi;
|
|
8045
|
+
if (api === void 0) {
|
|
8046
|
+
this.ctx.logger.warn("the registry switch migration is skipped: the migration API is not available on this context");
|
|
8047
|
+
return [];
|
|
8048
|
+
}
|
|
8049
|
+
return migrationSet([registrySwitchToBodyMigration({
|
|
8050
|
+
addonId: this.ctx.id,
|
|
8051
|
+
date: "2026-11-06",
|
|
8052
|
+
seq: 1e3,
|
|
8053
|
+
initialBody: spec.initialBody
|
|
8054
|
+
})], (a) => registrySwitchPortsOver({
|
|
8055
|
+
api: integrationRowsApiOver(a),
|
|
8056
|
+
records: switchRecordsOverMigrationApi(a),
|
|
8057
|
+
kind: spec.kind
|
|
8058
|
+
})).bind(api);
|
|
8059
|
+
}
|
|
8060
|
+
async runBound(declared, options) {
|
|
8061
|
+
const added = this.registrySwitchBound();
|
|
8062
|
+
const migrations = [...declared, ...added];
|
|
8063
|
+
const phased = options?.only === void 0 || added.length === 0 ? options : {
|
|
8064
|
+
...options,
|
|
8065
|
+
only: [...options.only, ...added.map((m) => m.meta.id)]
|
|
8066
|
+
};
|
|
7786
8067
|
const api = this.ctx.api.migrations;
|
|
7787
8068
|
const report = await runAddonMigrations({
|
|
7788
8069
|
declareOwner: (input) => api.declareOwner.mutate(input),
|
|
7789
8070
|
startMigration: (input) => api.startMigration.mutate(input),
|
|
7790
8071
|
finishMigration: (input) => api.finishMigration.mutate(input)
|
|
7791
|
-
}, migrations, this.ctx.logger,
|
|
8072
|
+
}, migrations, this.ctx.logger, phased);
|
|
7792
8073
|
if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
|
|
7793
8074
|
return report;
|
|
7794
8075
|
}
|
|
@@ -8861,114 +9142,94 @@ function normalizeAddonInitResult(result) {
|
|
|
8861
9142
|
if (Array.isArray(result)) return { providers: result };
|
|
8862
9143
|
return result;
|
|
8863
9144
|
}
|
|
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;
|
|
9145
|
+
object({
|
|
9146
|
+
field: string().min(1),
|
|
9147
|
+
on: literal("advance")
|
|
9148
|
+
});
|
|
8906
9149
|
/**
|
|
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.
|
|
9150
|
+
* Output schema shared by the contribution + live methods.
|
|
8914
9151
|
*
|
|
8915
|
-
*
|
|
8916
|
-
*
|
|
8917
|
-
*
|
|
8918
|
-
*
|
|
9152
|
+
* Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
|
|
9153
|
+
* tabs[]) without importing from `../interfaces/config-ui.js` — a
|
|
9154
|
+
* concrete-but-lenient Zod object keeps tRPC output inference happy
|
|
9155
|
+
* (using `z.unknown()` here collapses unrelated router branches to
|
|
9156
|
+
* `unknown` when the generator re-inlines the huge AppRouter type).
|
|
8919
9157
|
*
|
|
8920
|
-
*
|
|
9158
|
+
* `.passthrough()` on sections/fields accepts whatever FormBuilder
|
|
9159
|
+
* extensions the caller adds (showWhen, displayScale, …) without
|
|
9160
|
+
* rebuilding every time a new field kind is introduced.
|
|
8921
9161
|
*/
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
9162
|
+
var ContributionSectionSchema = object({
|
|
9163
|
+
id: string(),
|
|
9164
|
+
title: string(),
|
|
9165
|
+
description: string().optional(),
|
|
9166
|
+
style: _enum(["card", "accordion"]).optional(),
|
|
9167
|
+
defaultCollapsed: boolean().optional(),
|
|
9168
|
+
columns: union([
|
|
9169
|
+
literal(1),
|
|
9170
|
+
literal(2),
|
|
9171
|
+
literal(3),
|
|
9172
|
+
literal(4)
|
|
9173
|
+
]).optional(),
|
|
9174
|
+
tab: string().optional(),
|
|
9175
|
+
location: _enum([
|
|
9176
|
+
"settings",
|
|
9177
|
+
"top-tab",
|
|
9178
|
+
"hero"
|
|
9179
|
+
]).optional(),
|
|
9180
|
+
order: number().optional(),
|
|
9181
|
+
fields: array(any())
|
|
9182
|
+
});
|
|
9183
|
+
object({
|
|
9184
|
+
tabs: array(object({
|
|
9185
|
+
id: string(),
|
|
9186
|
+
label: string(),
|
|
9187
|
+
icon: string(),
|
|
9188
|
+
order: number().optional()
|
|
9189
|
+
})).optional(),
|
|
9190
|
+
sections: array(ContributionSectionSchema)
|
|
9191
|
+
}).nullable();
|
|
9192
|
+
object({ deviceId: number() }), object({ deviceId: number() }), object({
|
|
9193
|
+
deviceId: number(),
|
|
9194
|
+
patch: record(string(), unknown())
|
|
9195
|
+
}), object({ success: literal(true) });
|
|
9196
|
+
object({ deviceId: number() }), unknown().nullable();
|
|
9197
|
+
function method(input, output, options) {
|
|
9198
|
+
return {
|
|
9199
|
+
input,
|
|
9200
|
+
output,
|
|
9201
|
+
kind: options?.kind ?? "query",
|
|
9202
|
+
...options?.auth !== void 0 ? { auth: options.auth } : {},
|
|
9203
|
+
...options?.access !== void 0 ? { access: options.access } : {},
|
|
9204
|
+
...options?.role !== void 0 ? { role: options.role } : {},
|
|
9205
|
+
...options?.caller !== void 0 ? { caller: options.caller } : {},
|
|
9206
|
+
timeoutMs: options?.timeoutMs
|
|
9207
|
+
};
|
|
8936
9208
|
}
|
|
8937
|
-
/**
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
9209
|
+
/**
|
|
9210
|
+
* A wrapper/system-only method: served exclusively by the cap's system-level
|
|
9211
|
+
* provider (`InferProvider`), and OPTIONAL on `InferNativeProvider` so per-device
|
|
9212
|
+
* driver natives don't stub out a wrapper concern (e.g. a cross-device cache
|
|
9213
|
+
* overview). The `systemOnly: true` literal is what `InferNativeProvider` keys on.
|
|
9214
|
+
*/
|
|
9215
|
+
function systemMethod(input, output, options) {
|
|
9216
|
+
return {
|
|
9217
|
+
...method(input, output, options),
|
|
9218
|
+
systemOnly: true
|
|
9219
|
+
};
|
|
8947
9220
|
}
|
|
8948
9221
|
/**
|
|
8949
|
-
*
|
|
8950
|
-
*
|
|
8951
|
-
*
|
|
9222
|
+
* A method a SOURCE of a collection cap may legitimately not serve — OPTIONAL
|
|
9223
|
+
* on `InferProvider`. The `providerOptional: true` literal is what
|
|
9224
|
+
* `InferProvider` keys on; see {@link CapabilityMethodSchema.providerOptional}
|
|
9225
|
+
* for when this is the honest answer and when it is a soft stub.
|
|
8952
9226
|
*/
|
|
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
|
-
});
|
|
9227
|
+
function optionalMethod(input, output, options) {
|
|
9228
|
+
return {
|
|
9229
|
+
...method(input, output, options),
|
|
9230
|
+
providerOptional: true
|
|
9231
|
+
};
|
|
9232
|
+
}
|
|
8972
9233
|
function defOf(schema) {
|
|
8973
9234
|
const zodBag = Reflect.get(schema, "_zod");
|
|
8974
9235
|
if (typeof zodBag !== "object" || zodBag === null) return {};
|
|
@@ -9188,107 +9449,29 @@ function defineRecordKinds(specs) {
|
|
|
9188
9449
|
return out;
|
|
9189
9450
|
}
|
|
9190
9451
|
/**
|
|
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.
|
|
9452
|
+
* The share-view scope kinds a share-link token can carry. The hub mints
|
|
9453
|
+
* and validates them (`ShareViewGrantSchema` builds its
|
|
9454
|
+
* enum from this list); a data plane names the kinds it ACCEPTS in `share`.
|
|
9220
9455
|
*/
|
|
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())
|
|
9456
|
+
var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
|
|
9457
|
+
/** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
|
|
9458
|
+
var PeerBytesTicketSchema = object({
|
|
9459
|
+
/** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
|
|
9460
|
+
url: string().min(1),
|
|
9461
|
+
/**
|
|
9462
|
+
* The HOST node this URL means something on — the hub or a named agent,
|
|
9463
|
+
* never a runner. {@link AddonPeerBytes.open} compares it to its own and
|
|
9464
|
+
* refuses `cross-node` by name when they differ, without dialling.
|
|
9465
|
+
*/
|
|
9466
|
+
hostNodeId: string().min(1),
|
|
9467
|
+
expiresAtMs: number().int().nonnegative(),
|
|
9468
|
+
/**
|
|
9469
|
+
* What the producer DECLARED the body to be, when it knows — `null` when it
|
|
9470
|
+
* does not. Never `0` for unknown (D393): a consumer sizing a bound off this
|
|
9471
|
+
* must be able to tell "the producer did not say" from "the body is empty".
|
|
9472
|
+
*/
|
|
9473
|
+
declaredBytes: number().int().nonnegative().nullable()
|
|
9241
9474
|
});
|
|
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
9475
|
var READING_QUANTITIES = [
|
|
9293
9476
|
"temperature",
|
|
9294
9477
|
"pressure",
|
|
@@ -10423,7 +10606,6 @@ var CAP_NAMES = Object.freeze([
|
|
|
10423
10606
|
"climate-control",
|
|
10424
10607
|
"color",
|
|
10425
10608
|
"composer",
|
|
10426
|
-
"connection-test",
|
|
10427
10609
|
"connectivity",
|
|
10428
10610
|
"consumables",
|
|
10429
10611
|
"contact",
|
|
@@ -11570,6 +11752,10 @@ Object.freeze({
|
|
|
11570
11752
|
"all",
|
|
11571
11753
|
"one"
|
|
11572
11754
|
]
|
|
11755
|
+
},
|
|
11756
|
+
{
|
|
11757
|
+
"path": "positionUpdatedAt",
|
|
11758
|
+
"valueType": "number"
|
|
11573
11759
|
}
|
|
11574
11760
|
],
|
|
11575
11761
|
"meter": [{
|
|
@@ -11824,22 +12010,6 @@ Object.freeze({
|
|
|
11824
12010
|
"path": "pumpRunning",
|
|
11825
12011
|
"valueType": "boolean"
|
|
11826
12012
|
},
|
|
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
12013
|
{
|
|
11844
12014
|
"path": "error",
|
|
11845
12015
|
"valueType": "string"
|
|
@@ -12405,6 +12575,59 @@ Object.freeze({
|
|
|
12405
12575
|
}
|
|
12406
12576
|
]
|
|
12407
12577
|
});
|
|
12578
|
+
Object.freeze({
|
|
12579
|
+
"actions": { "run": 363e4 },
|
|
12580
|
+
"audio-analyzer": { "classify": 3e4 },
|
|
12581
|
+
"custom-model-registry": { "importModelBundle": 18e5 },
|
|
12582
|
+
"database-snapshot": { "writeSnapshot": 18e5 },
|
|
12583
|
+
"device-manager": {
|
|
12584
|
+
"migrateDevice": 72e4,
|
|
12585
|
+
"runDiscoverySweep": 12e4
|
|
12586
|
+
},
|
|
12587
|
+
"device-provider": { "reloadDevice": 18e4 },
|
|
12588
|
+
"llm": {
|
|
12589
|
+
"generate": 6e5,
|
|
12590
|
+
"generateVision": 6e5,
|
|
12591
|
+
"testProfile": 6e5
|
|
12592
|
+
},
|
|
12593
|
+
"llm-runtime": {
|
|
12594
|
+
"complete": 6e5,
|
|
12595
|
+
"completeApple": 6e5,
|
|
12596
|
+
"ensureStarted": 6e5,
|
|
12597
|
+
"installModel": 36e5
|
|
12598
|
+
},
|
|
12599
|
+
"local-network": { "scanNetwork": 9e4 },
|
|
12600
|
+
"model-convert": { "convert": 6e5 },
|
|
12601
|
+
"pipeline-analytics": {
|
|
12602
|
+
"addRetrainFrameFromRecording": 6e4,
|
|
12603
|
+
"offerRetrainArchive": 12e4,
|
|
12604
|
+
"proposeRetrainAnnotationsWithLlm": 18e4,
|
|
12605
|
+
"resolveRetrainTrainingCorpus": 6e4,
|
|
12606
|
+
"writeRetrainArchive": 36e5
|
|
12607
|
+
},
|
|
12608
|
+
"server-management": { "applyServerUpdate": 96e4 },
|
|
12609
|
+
"terminal-session": { "pullOutput": 15e3 },
|
|
12610
|
+
"training": {
|
|
12611
|
+
"canaryResult": 12e4,
|
|
12612
|
+
"cancelJob": 12e4,
|
|
12613
|
+
"planJob": 6e4,
|
|
12614
|
+
"registerResult": 18e5,
|
|
12615
|
+
"rollbackCanary": 12e4,
|
|
12616
|
+
"startJob": 12e4,
|
|
12617
|
+
"startJobBatch": 12e4
|
|
12618
|
+
},
|
|
12619
|
+
"training-provider": {
|
|
12620
|
+
"cancelJob": 6e4,
|
|
12621
|
+
"cleanupJob": 3e5,
|
|
12622
|
+
"getJob": 6e4,
|
|
12623
|
+
"listJobEvents": 6e4,
|
|
12624
|
+
"listJobs": 12e4,
|
|
12625
|
+
"offerArtifact": 3e5,
|
|
12626
|
+
"readResult": 3e5,
|
|
12627
|
+
"submitJob": 18e5,
|
|
12628
|
+
"uploadDataset": 72e5
|
|
12629
|
+
}
|
|
12630
|
+
});
|
|
12408
12631
|
object({
|
|
12409
12632
|
code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
|
|
12410
12633
|
params: record(string(), union([string(), number()])).optional()
|
|
@@ -13949,10 +14172,432 @@ var IntegrationInstanceRefSchema = object({
|
|
|
13949
14172
|
]),
|
|
13950
14173
|
candidateStableId: string().optional()
|
|
13951
14174
|
});
|
|
13952
|
-
|
|
13953
|
-
|
|
13954
|
-
|
|
14175
|
+
/**
|
|
14176
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
14177
|
+
*
|
|
14178
|
+
* Apprise-derived model (see
|
|
14179
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
14180
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
14181
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
14182
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
14183
|
+
* message to what the kind supports — callers never special-case a service.
|
|
14184
|
+
*
|
|
14185
|
+
* DESIGN DECISIONS (locked):
|
|
14186
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
14187
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
14188
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
14189
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
14190
|
+
* alternative would fork the UI per addon and cannot host the
|
|
14191
|
+
* discovery→adopt flow.
|
|
14192
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
14193
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
14194
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
14195
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
14196
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
14197
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
14198
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
14199
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
14200
|
+
* base64 fallback needed.
|
|
14201
|
+
*
|
|
14202
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
14203
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
14204
|
+
* admin "Integrations" page.
|
|
14205
|
+
*/
|
|
14206
|
+
/**
|
|
14207
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
14208
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
14209
|
+
*/
|
|
14210
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
14211
|
+
"image",
|
|
14212
|
+
"video",
|
|
14213
|
+
"gif",
|
|
14214
|
+
"audio",
|
|
14215
|
+
"icon"
|
|
14216
|
+
]);
|
|
14217
|
+
/**
|
|
14218
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
14219
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
14220
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
14221
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
14222
|
+
*/
|
|
14223
|
+
var AttachmentSchema = object({
|
|
14224
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
14225
|
+
url: string().optional(),
|
|
14226
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
14227
|
+
mime: string().optional(),
|
|
14228
|
+
name: string().optional()
|
|
14229
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
14230
|
+
var NotificationFormatSchema = _enum([
|
|
14231
|
+
"text",
|
|
14232
|
+
"markdown",
|
|
14233
|
+
"html"
|
|
14234
|
+
]);
|
|
14235
|
+
/**
|
|
14236
|
+
* The CLOSED icon vocabulary an action button may use.
|
|
14237
|
+
*
|
|
14238
|
+
* A closed set, not a free string, and that is the whole point: an arbitrary
|
|
14239
|
+
* icon name is one that ntfy renders, zentik silently drops, and nobody
|
|
14240
|
+
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
14241
|
+
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
14242
|
+
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
14243
|
+
*
|
|
14244
|
+
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
14245
|
+
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
14246
|
+
* differently.
|
|
14247
|
+
*
|
|
14248
|
+
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
14249
|
+
*
|
|
14250
|
+
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
14251
|
+
* the whole set onto its own renderer's vocabulary through a
|
|
14252
|
+
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
14253
|
+
* fallback, so adding a member here fails every adapter's build until someone
|
|
14254
|
+
* decides its glyph, which is the only place that decision can be made
|
|
14255
|
+
* honestly.
|
|
14256
|
+
*
|
|
14257
|
+
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
14258
|
+
* `disarm` straight through; iOS feeds that string to
|
|
14259
|
+
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
14260
|
+
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
14261
|
+
* mapping, and "the field is documented" is not "the value renders".
|
|
14262
|
+
*
|
|
14263
|
+
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
14264
|
+
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
14265
|
+
* so an addon that emits a token the running hub does not know does not lose an
|
|
14266
|
+
* icon — its whole `send` fails Zod validation and the notification never
|
|
14267
|
+
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
14268
|
+
*/
|
|
14269
|
+
var NotificationActionIconSchema = _enum([
|
|
14270
|
+
"acknowledge",
|
|
14271
|
+
"dismiss",
|
|
14272
|
+
"silence",
|
|
14273
|
+
"snooze",
|
|
14274
|
+
"view",
|
|
14275
|
+
"play",
|
|
14276
|
+
"open",
|
|
14277
|
+
"close",
|
|
14278
|
+
"lock",
|
|
14279
|
+
"unlock",
|
|
14280
|
+
"arm",
|
|
14281
|
+
"arm-home",
|
|
14282
|
+
"arm-away",
|
|
14283
|
+
"arm-night",
|
|
14284
|
+
"disarm",
|
|
14285
|
+
"light",
|
|
14286
|
+
"alert",
|
|
14287
|
+
"camera"
|
|
14288
|
+
]);
|
|
14289
|
+
/** A single tap-through action button. */
|
|
14290
|
+
var NotificationActionSchema = object({
|
|
14291
|
+
id: string(),
|
|
14292
|
+
label: string(),
|
|
14293
|
+
url: string().optional(),
|
|
14294
|
+
/** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
|
|
14295
|
+
icon: NotificationActionIconSchema.optional(),
|
|
14296
|
+
/**
|
|
14297
|
+
* Renders in a warning style where the notifier supports it.
|
|
14298
|
+
*
|
|
14299
|
+
* A HINT, never a gate. The callback's authority is its token and nothing
|
|
14300
|
+
* else — see `notification-center/action-token.ts` for what that does and
|
|
14301
|
+
* does not buy.
|
|
14302
|
+
*/
|
|
14303
|
+
destructive: boolean().optional(),
|
|
14304
|
+
/**
|
|
14305
|
+
* How the tap should REACH the url.
|
|
14306
|
+
*
|
|
14307
|
+
* `navigate` (absent, and every button authored before this field) opens it:
|
|
14308
|
+
* the phone leaves the notification and shows whatever the callback returns.
|
|
14309
|
+
* That is right for a button whose answer the operator wants to read.
|
|
14310
|
+
*
|
|
14311
|
+
* `background` fires it as a POST and stays put. It exists for the buttons
|
|
14312
|
+
* whose whole point is not to interrupt — "silence this for 30 minutes" is
|
|
14313
|
+
* an answer to the notification, and being thrown into a browser tab to
|
|
14314
|
+
* confirm it costs more attention than the notification did. A backend that
|
|
14315
|
+
* cannot do a background call renders it as an ordinary link (the adapters
|
|
14316
|
+
* fall back rather than dropping the button), so this is a preference, never
|
|
14317
|
+
* a requirement.
|
|
14318
|
+
*/
|
|
14319
|
+
mode: _enum(["navigate", "background"]).optional()
|
|
14320
|
+
});
|
|
14321
|
+
/** A delivery parameter value: what a notifier declared it takes. */
|
|
14322
|
+
var DeliveryParamValueSchema = union([
|
|
14323
|
+
string(),
|
|
14324
|
+
number(),
|
|
14325
|
+
boolean()
|
|
14326
|
+
]);
|
|
14327
|
+
/**
|
|
14328
|
+
* One extra delivery parameter a notifier KIND declares (D938). A rule that
|
|
14329
|
+
* addresses a target of that kind may set it; a kind that declares nothing is
|
|
14330
|
+
* never handed one. The admin UI derives its control from this descriptor —
|
|
14331
|
+
* no editor knows a service by name.
|
|
14332
|
+
*
|
|
14333
|
+
* Optional fields are `.optional()`, never `.default()` (a Zod default does not
|
|
14334
|
+
* run on the addon cap path).
|
|
14335
|
+
*/
|
|
14336
|
+
var DeliveryParamSchema = object({
|
|
14337
|
+
key: string().min(1),
|
|
14338
|
+
label: string(),
|
|
14339
|
+
/** i18n key of the label, resolved by the declaring addon's namespace. */
|
|
14340
|
+
labelKey: string().optional(),
|
|
14341
|
+
type: _enum([
|
|
14342
|
+
"enum",
|
|
14343
|
+
"number",
|
|
14344
|
+
"boolean",
|
|
14345
|
+
"string"
|
|
14346
|
+
]),
|
|
14347
|
+
/** `enum` only: the closed set of accepted values. */
|
|
14348
|
+
options: array(object({
|
|
14349
|
+
value: string(),
|
|
14350
|
+
label: string()
|
|
14351
|
+
})).optional(),
|
|
14352
|
+
/** `number` only. */
|
|
14353
|
+
min: number().optional(),
|
|
14354
|
+
max: number().optional(),
|
|
14355
|
+
/** What the notifier does when the rule sets nothing; shown as the placeholder. */
|
|
14356
|
+
default: DeliveryParamValueSchema.optional()
|
|
14357
|
+
});
|
|
14358
|
+
/**
|
|
14359
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
14360
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
14361
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
14362
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
14363
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
14364
|
+
* `priority` for that one target.
|
|
14365
|
+
*/
|
|
14366
|
+
var NotificationSchema = object({
|
|
14367
|
+
body: string(),
|
|
14368
|
+
title: string().optional(),
|
|
14369
|
+
format: NotificationFormatSchema.default("text"),
|
|
14370
|
+
priority: number().int().min(1).max(5).default(3),
|
|
14371
|
+
level: string().optional(),
|
|
14372
|
+
attachments: array(AttachmentSchema).optional(),
|
|
14373
|
+
clickUrl: string().optional(),
|
|
14374
|
+
actions: array(NotificationActionSchema).optional(),
|
|
14375
|
+
sound: string().optional(),
|
|
14376
|
+
ttl: number().optional(),
|
|
14377
|
+
tag: string().optional(),
|
|
14378
|
+
deviceId: number().optional(),
|
|
14379
|
+
eventId: string().optional(),
|
|
14380
|
+
metadata: record(string(), unknown()).optional(),
|
|
14381
|
+
/**
|
|
14382
|
+
* Values for the parameters the target's kind DECLARES in
|
|
14383
|
+
* {@link TargetKindSchema} `deliveryParams`. Already validated against the
|
|
14384
|
+
* declaration by the sender; a notifier reads only the keys it declared.
|
|
14385
|
+
*/
|
|
14386
|
+
delivery: record(string(), DeliveryParamValueSchema).optional()
|
|
14387
|
+
});
|
|
14388
|
+
/** One declared native severity/priority level for a kind. */
|
|
14389
|
+
var TargetKindLevelSchema = object({
|
|
14390
|
+
id: string(),
|
|
14391
|
+
label: string(),
|
|
14392
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
14393
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
14394
|
+
flags: object({
|
|
14395
|
+
critical: boolean().optional(),
|
|
14396
|
+
silent: boolean().optional(),
|
|
14397
|
+
noPush: boolean().optional()
|
|
14398
|
+
}).optional(),
|
|
14399
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
14400
|
+
requires: array(string()).optional(),
|
|
14401
|
+
description: string().optional()
|
|
14402
|
+
});
|
|
14403
|
+
/** The full capability block consulted before dispatch. */
|
|
14404
|
+
var TargetKindCapsSchema = object({
|
|
14405
|
+
attachments: object({
|
|
14406
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
14407
|
+
mode: _enum([
|
|
14408
|
+
"url",
|
|
14409
|
+
"bytes",
|
|
14410
|
+
"both"
|
|
14411
|
+
]),
|
|
14412
|
+
max: number().int().nonnegative(),
|
|
14413
|
+
maxBytes: number().int().positive().optional()
|
|
14414
|
+
}),
|
|
14415
|
+
/** Max action buttons (0 = none). */
|
|
14416
|
+
actions: number().int().nonnegative(),
|
|
14417
|
+
/**
|
|
14418
|
+
* Whether this kind renders a per-action ICON.
|
|
14419
|
+
*
|
|
14420
|
+
* `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
|
|
14421
|
+
* run on the addon cap path — three production failures in one day taught
|
|
14422
|
+
* this repo that once. Absent is read as false by the degrade engine, which
|
|
14423
|
+
* is the safe direction: an icon that is not rendered costs nothing, an icon
|
|
14424
|
+
* assumed and dropped costs the operator's trust in the field.
|
|
14425
|
+
*/
|
|
14426
|
+
actionIcons: boolean().optional(),
|
|
14427
|
+
levels: array(TargetKindLevelSchema),
|
|
14428
|
+
format: array(NotificationFormatSchema),
|
|
14429
|
+
clickUrl: boolean(),
|
|
14430
|
+
sound: boolean(),
|
|
14431
|
+
ttl: boolean(),
|
|
14432
|
+
bodyMaxLen: number().int().positive()
|
|
14433
|
+
});
|
|
14434
|
+
/**
|
|
14435
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
14436
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
14437
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
14438
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
14439
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
14440
|
+
*/
|
|
14441
|
+
var ConfigSchemaPassthrough$4 = unknown();
|
|
14442
|
+
var TargetKindSchema = object({
|
|
14443
|
+
kind: string(),
|
|
14444
|
+
label: string(),
|
|
14445
|
+
icon: string(),
|
|
14446
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
14447
|
+
addonId: string(),
|
|
14448
|
+
/**
|
|
14449
|
+
* URL of the kind's bundled BRAND icon, served by the providing addon over
|
|
14450
|
+
* its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
|
|
14451
|
+
* when the addon bundles no icon for that kind — the client then falls back
|
|
14452
|
+
* to a neutral glyph rather than rendering the raw `icon` NAME as text.
|
|
14453
|
+
*
|
|
14454
|
+
* Root-relative on purpose: it resolves against whatever origin serves a web
|
|
14455
|
+
* client, and a native client joins it onto its own hub base.
|
|
14456
|
+
*
|
|
14457
|
+
* DECLARED here deliberately. It used to travel as an undeclared passthrough
|
|
14458
|
+
* field that survived only because the runtime cap-router forwards provider
|
|
14459
|
+
* output verbatim — so every consumer had to re-declare it by hand to stop
|
|
14460
|
+
* its own Zod parse from stripping it, and the whole arrangement would have
|
|
14461
|
+
* broken silently the moment output validation was tightened anywhere.
|
|
14462
|
+
*/
|
|
14463
|
+
iconUrl: string().optional(),
|
|
14464
|
+
/**
|
|
14465
|
+
* Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
|
|
14466
|
+
*
|
|
14467
|
+
* The server knows this and therefore says it, because the client cannot
|
|
14468
|
+
* safely guess: a React-Native client renders SVG and raster through two
|
|
14469
|
+
* DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
|
|
14470
|
+
* not decode SVG on iOS/Android), so without this it silently fell back to a
|
|
14471
|
+
* placeholder glyph for every vector icon while the web build looked fine.
|
|
14472
|
+
*
|
|
14473
|
+
* Absent when {@link iconUrl} is absent, or for a legacy provider that has
|
|
14474
|
+
* not been updated — a client that cannot determine the type should prefer
|
|
14475
|
+
* its raster path, which is the safe default for an unknown image.
|
|
14476
|
+
*/
|
|
14477
|
+
iconMediaType: string().optional(),
|
|
14478
|
+
configSchema: ConfigSchemaPassthrough$4,
|
|
14479
|
+
/**
|
|
14480
|
+
* The config keys that decide WHERE this kind's secrets are sent (server,
|
|
14481
|
+
* base URL, instance, chat, recipient). A save that changes any of them
|
|
14482
|
+
* while leaving a secret redacted is refused by the provider (D634), so an
|
|
14483
|
+
* editor uses this to ask for the secret on exactly those edits instead of
|
|
14484
|
+
* on every edit.
|
|
14485
|
+
*
|
|
14486
|
+
* Optional: absent from a provider that holds no secret (the Home Assistant
|
|
14487
|
+
* kinds) and from a provider older than this field — an editor that finds
|
|
14488
|
+
* it absent must assume ANY edit may need the secret.
|
|
14489
|
+
*/
|
|
14490
|
+
destinationKeys: array(string()).optional(),
|
|
14491
|
+
supportsDiscovery: boolean(),
|
|
14492
|
+
/**
|
|
14493
|
+
* Extra delivery parameters a rule may set for a target of this kind (D938).
|
|
14494
|
+
* Absent = none; the rule editor then offers nothing.
|
|
14495
|
+
*/
|
|
14496
|
+
deliveryParams: array(DeliveryParamSchema).optional(),
|
|
14497
|
+
caps: TargetKindCapsSchema
|
|
14498
|
+
});
|
|
14499
|
+
/**
|
|
14500
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
14501
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
14502
|
+
* round-trip a stored secret to the UI.
|
|
14503
|
+
*/
|
|
14504
|
+
var TargetSchema = object({
|
|
14505
|
+
id: string(),
|
|
14506
|
+
name: string(),
|
|
14507
|
+
kind: string(),
|
|
14508
|
+
addonId: string(),
|
|
14509
|
+
enabled: boolean(),
|
|
14510
|
+
config: record(string(), unknown())
|
|
14511
|
+
});
|
|
14512
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
14513
|
+
var DiscoveredTargetSchema = object({
|
|
14514
|
+
kind: string(),
|
|
14515
|
+
suggestedName: string(),
|
|
14516
|
+
config: record(string(), unknown())
|
|
14517
|
+
});
|
|
14518
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
14519
|
+
var RenderedAsSchema = object({
|
|
14520
|
+
level: string(),
|
|
14521
|
+
format: NotificationFormatSchema,
|
|
14522
|
+
attachmentsSent: number().int().nonnegative(),
|
|
14523
|
+
actionsSent: number().int().nonnegative(),
|
|
14524
|
+
truncated: boolean(),
|
|
14525
|
+
dropped: array(string())
|
|
14526
|
+
});
|
|
14527
|
+
var SendResultSchema = object({
|
|
14528
|
+
success: boolean(),
|
|
14529
|
+
error: string().optional(),
|
|
14530
|
+
renderedAs: RenderedAsSchema.optional()
|
|
14531
|
+
});
|
|
14532
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
14533
|
+
var TestResultSchema = SendResultSchema;
|
|
14534
|
+
/**
|
|
14535
|
+
* Pre-save credential probe against a partial (unsaved) target config.
|
|
14536
|
+
* `resolvedUrl` never includes secrets (token stripped from path).
|
|
14537
|
+
*/
|
|
14538
|
+
var ProbeTargetConfigResultSchema = object({
|
|
14539
|
+
ok: boolean(),
|
|
14540
|
+
resolvedUrl: string(),
|
|
14541
|
+
httpStatus: number().int().optional(),
|
|
14542
|
+
stateInstance: string().optional(),
|
|
14543
|
+
error: string().optional()
|
|
14544
|
+
});
|
|
14545
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
|
|
14546
|
+
kind: string(),
|
|
14547
|
+
config: record(string(), unknown()).optional(),
|
|
14548
|
+
/**
|
|
14549
|
+
* When editing / duplicating, the blank password field never round-trips
|
|
14550
|
+
* the stored token. Pass the source target id so the provider can restore
|
|
14551
|
+
* secrets server-side before dialling (same merge as upsert).
|
|
14552
|
+
*/
|
|
14553
|
+
targetId: string().optional()
|
|
14554
|
+
}), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
|
|
14555
|
+
kind: string(),
|
|
14556
|
+
config: record(string(), unknown()),
|
|
14557
|
+
/** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
|
|
14558
|
+
targetId: string().optional()
|
|
14559
|
+
}), ProbeTargetConfigResultSchema, {
|
|
14560
|
+
kind: "mutation",
|
|
14561
|
+
auth: "admin"
|
|
14562
|
+
}), method(object({
|
|
14563
|
+
targetId: string(),
|
|
14564
|
+
notification: NotificationSchema
|
|
14565
|
+
}), SendResultSchema, {
|
|
14566
|
+
kind: "mutation",
|
|
14567
|
+
auth: "admin"
|
|
14568
|
+
}), method(object({
|
|
14569
|
+
targetId: string(),
|
|
14570
|
+
sample: NotificationSchema.optional()
|
|
14571
|
+
}), TestResultSchema, {
|
|
14572
|
+
kind: "mutation",
|
|
14573
|
+
auth: "admin"
|
|
14574
|
+
}), method(object({
|
|
14575
|
+
target: TargetSchema,
|
|
14576
|
+
/**
|
|
14577
|
+
* Duplicate flow: create a NEW target id while copying secrets from an
|
|
14578
|
+
* existing row. The UI never holds the stored token; blank / redacted
|
|
14579
|
+
* password fields are restored from this source (D634 still applies if
|
|
14580
|
+
* destinations diverge without a re-typed secret).
|
|
14581
|
+
*/
|
|
14582
|
+
cloneSecretsFrom: string().optional()
|
|
14583
|
+
}), TargetSchema, {
|
|
14584
|
+
kind: "mutation",
|
|
14585
|
+
auth: "admin"
|
|
14586
|
+
}), method(object({ targetId: string() }), _void(), {
|
|
14587
|
+
kind: "mutation",
|
|
14588
|
+
auth: "admin"
|
|
14589
|
+
}), method(object({
|
|
14590
|
+
targetId: string(),
|
|
14591
|
+
enabled: boolean()
|
|
14592
|
+
}), _void(), {
|
|
14593
|
+
kind: "mutation",
|
|
14594
|
+
auth: "admin"
|
|
14595
|
+
});
|
|
14596
|
+
looseObject({
|
|
14597
|
+
name: string().min(1),
|
|
14598
|
+
enabled: boolean().optional()
|
|
13955
14599
|
});
|
|
14600
|
+
TargetSchema.omit({ id: true });
|
|
13956
14601
|
var EncodeProfileSchema = object({
|
|
13957
14602
|
video: object({
|
|
13958
14603
|
codec: _enum([
|
|
@@ -20449,31 +21094,21 @@ var APPLIANCE_CAP_VOCABULARY = {
|
|
|
20449
21094
|
"pet-fountain": {
|
|
20450
21095
|
scope: "device",
|
|
20451
21096
|
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
|
-
],
|
|
21097
|
+
actions: [{
|
|
21098
|
+
id: "petFountain.pumpOn",
|
|
21099
|
+
method: "setPump",
|
|
21100
|
+
label: t("Pump on", "Pompa accesa"),
|
|
21101
|
+
phrase: t("Start the pump of {device}", "Avvia la pompa di {device}"),
|
|
21102
|
+
icon: "play",
|
|
21103
|
+
args: { on: true }
|
|
21104
|
+
}, {
|
|
21105
|
+
id: "petFountain.pumpOff",
|
|
21106
|
+
method: "setPump",
|
|
21107
|
+
label: t("Pump off", "Pompa spenta"),
|
|
21108
|
+
phrase: t("Stop the pump of {device}", "Ferma la pompa di {device}"),
|
|
21109
|
+
icon: "square",
|
|
21110
|
+
args: { on: false }
|
|
21111
|
+
}],
|
|
20477
21112
|
state: [{
|
|
20478
21113
|
kind: "boolean",
|
|
20479
21114
|
field: "empty",
|
|
@@ -22492,7 +23127,6 @@ var SYSTEM_CAP_VOCABULARY = {
|
|
|
22492
23127
|
"calendar-source": system(INTERNAL),
|
|
22493
23128
|
calendars: system("calendars feed schedules and conditions, not device actions"),
|
|
22494
23129
|
composer: system("device composition — an authoring tool, not an action"),
|
|
22495
|
-
"connection-test": system(INTERNAL),
|
|
22496
23130
|
"core-blocks": system(INTERNAL),
|
|
22497
23131
|
"custom-model-registry": system(ML),
|
|
22498
23132
|
"data-store-provider": system(INTERNAL),
|
|
@@ -44367,8 +45001,15 @@ var ActionInputSchema = object({
|
|
|
44367
45001
|
var ActionRunOriginSchema = object({
|
|
44368
45002
|
/** The automation block whose step started it. */
|
|
44369
45003
|
blockId: string().min(1).optional() });
|
|
44370
|
-
/**
|
|
44371
|
-
|
|
45004
|
+
/**
|
|
45005
|
+
* `started` = the caller did not ask to wait. `timed-out` = the run reached the
|
|
45006
|
+
* ceiling (`ACTION_RUN_MAX_MS`) and was stopped; it is never a `ran`.
|
|
45007
|
+
*/
|
|
45008
|
+
var ActionRunOutcomeSchema = union([
|
|
45009
|
+
AutomationRunOutcomeSchema,
|
|
45010
|
+
literal("started"),
|
|
45011
|
+
literal("timed-out")
|
|
45012
|
+
]);
|
|
44372
45013
|
var ActionRunResultSchema = object({
|
|
44373
45014
|
runId: string().min(1),
|
|
44374
45015
|
outcome: ActionRunOutcomeSchema,
|
|
@@ -44402,427 +45043,6 @@ var UnitWarningSchema = object({
|
|
|
44402
45043
|
assumedUnit: string(),
|
|
44403
45044
|
message: string()
|
|
44404
45045
|
});
|
|
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
45046
|
_enum([
|
|
44827
45047
|
"automation",
|
|
44828
45048
|
"action",
|
|
@@ -44890,6 +45110,8 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
|
|
|
44890
45110
|
kind: "mutation",
|
|
44891
45111
|
auth: "admin"
|
|
44892
45112
|
});
|
|
45113
|
+
/** `timeoutMs` of `actions.run`: a waited call outlives any legal run. */
|
|
45114
|
+
var ACTION_RUN_TIMEOUT_MS = 363e4;
|
|
44893
45115
|
/**
|
|
44894
45116
|
* actions — the ONE surface for runnable actions, for the UI and for
|
|
44895
45117
|
* automations. Provided by the core-blocks builtin on the hub.
|
|
@@ -44908,6 +45130,12 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
|
|
|
44908
45130
|
* An admin, and an in-process caller (an automation block), may run any action.
|
|
44909
45131
|
* Every refusal is typed (`[not-linked] …`) and logged.
|
|
44910
45132
|
*
|
|
45133
|
+
* **A run lasts at most `ACTION_RUN_MAX_MS` (60 min).** The provider stops a
|
|
45134
|
+
* run that reaches it and answers `timed-out` (never `ran`); an action whose
|
|
45135
|
+
* `wait` steps alone add up to more is refused at create/update
|
|
45136
|
+
* (`[invalid-steps]`). `run` declares a `timeoutMs` above that ceiling, so a
|
|
45137
|
+
* waited call (an automation step) is never cut by the 60 s transport default.
|
|
45138
|
+
*
|
|
44911
45139
|
* A second `run` of an action that is already running is REFUSED — traced and
|
|
44912
45140
|
* logged — never queued.
|
|
44913
45141
|
*/
|
|
@@ -44934,7 +45162,8 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
|
|
|
44934
45162
|
role: "viewer",
|
|
44935
45163
|
auth: "protected",
|
|
44936
45164
|
kind: "mutation",
|
|
44937
|
-
caller: "required"
|
|
45165
|
+
caller: "required",
|
|
45166
|
+
timeoutMs: ACTION_RUN_TIMEOUT_MS
|
|
44938
45167
|
}), method(ActionIdInput, _void(), {
|
|
44939
45168
|
kind: "mutation",
|
|
44940
45169
|
auth: "admin"
|
|
@@ -48720,37 +48949,6 @@ method(object({
|
|
|
48720
48949
|
kind: "mutation",
|
|
48721
48950
|
auth: "admin"
|
|
48722
48951
|
}), 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
48952
|
object({
|
|
48755
48953
|
/** True when the upstream system considers the entity connected. */
|
|
48756
48954
|
connected: boolean(),
|
|
@@ -49008,6 +49206,9 @@ var MediaPlayerStatusSchema = object({
|
|
|
49008
49206
|
/** Repeat mode. Null when no repeat surface.
|
|
49009
49207
|
* Pair with `DeviceFeature.MediaPlayerRepeat`. */
|
|
49010
49208
|
repeat: MediaPlayerRepeatSchema.nullable(),
|
|
49209
|
+
/** Ms epoch when `position` was read from the device. Null when the driver
|
|
49210
|
+
* does not say; a UI that advances the position while playing counts from it. */
|
|
49211
|
+
positionUpdatedAt: number().nullable().default(null),
|
|
49011
49212
|
/** Ms epoch when the slice was last updated. */
|
|
49012
49213
|
lastChangedAt: number()
|
|
49013
49214
|
});
|
|
@@ -54819,6 +55020,7 @@ var IntegrationWithStateSchema = object({
|
|
|
54819
55020
|
id: string(),
|
|
54820
55021
|
addonId: string(),
|
|
54821
55022
|
name: string(),
|
|
55023
|
+
/** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
|
|
54822
55024
|
enabled: boolean(),
|
|
54823
55025
|
info: record(string(), unknown()).readonly(),
|
|
54824
55026
|
/** The discovery candidate this integration was set up from (D984). */
|
|
@@ -54831,6 +55033,7 @@ var IntegrationLiteSchema = object({
|
|
|
54831
55033
|
id: string(),
|
|
54832
55034
|
addonId: string(),
|
|
54833
55035
|
name: string(),
|
|
55036
|
+
/** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
|
|
54834
55037
|
enabled: boolean(),
|
|
54835
55038
|
info: record(string(), unknown()).readonly(),
|
|
54836
55039
|
/** The discovery candidate this integration was set up from (D984). */
|
|
@@ -54876,10 +55079,9 @@ var AvailableIntegrationTypeSchema = object({
|
|
|
54876
55079
|
* locations" checkbox. Provider-declared in the addon manifest. */
|
|
54877
55080
|
supportsLocationImport: boolean(),
|
|
54878
55081
|
/**
|
|
54879
|
-
* True when this integration
|
|
54880
|
-
*
|
|
54881
|
-
*
|
|
54882
|
-
* rather than offering a button that always answers the same nonsense.
|
|
55082
|
+
* True when this integration's instances declare a Test (`integration-instances.describe().canTest`,
|
|
55083
|
+
* D1016). An integration that cannot be tested must say so up front rather than offering a
|
|
55084
|
+
* button that always answers the same nonsense.
|
|
54883
55085
|
*/
|
|
54884
55086
|
canTest: boolean(),
|
|
54885
55087
|
existingInstances: array(object({
|
|
@@ -54930,15 +55132,21 @@ var TestConnectionResultSchema = object({
|
|
|
54930
55132
|
var CreateIntegrationInputSchema = object({
|
|
54931
55133
|
addonId: string(),
|
|
54932
55134
|
name: string(),
|
|
54933
|
-
enabled: boolean().optional(),
|
|
54934
55135
|
info: record(string(), unknown()).optional(),
|
|
54935
55136
|
/** `stableId` of the discovery candidate the form was seeded from (D984). */
|
|
54936
55137
|
originStableId: string().optional(),
|
|
54937
|
-
settings: record(string(), unknown()).optional()
|
|
55138
|
+
settings: record(string(), unknown()).optional(),
|
|
55139
|
+
/** The instance kind being created, for a provider with several; omitted = its only testable kind. */
|
|
55140
|
+
kind: string().min(1).optional()
|
|
54938
55141
|
});
|
|
54939
55142
|
var UpdateIntegrationInputSchema = object({
|
|
54940
55143
|
id: string(),
|
|
54941
55144
|
name: string().optional(),
|
|
55145
|
+
/**
|
|
55146
|
+
* Accepted for a FIXED builtin only (`info.fixed`: alarm panel, camera grid, core blocks,
|
|
55147
|
+
* terminal), which keeps no instance record: the registry flag is its one store. Any other
|
|
55148
|
+
* integration is switched through `integration-instances.setInstanceEnabled`.
|
|
55149
|
+
*/
|
|
54942
55150
|
enabled: boolean().optional(),
|
|
54943
55151
|
info: record(string(), unknown()).optional()
|
|
54944
55152
|
});
|
|
@@ -54955,13 +55163,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
54955
55163
|
}), method(object({ id: string() }), DeleteIntegrationResultSchema, {
|
|
54956
55164
|
kind: "mutation",
|
|
54957
55165
|
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
|
-
});
|
|
55166
|
+
}), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" });
|
|
54965
55167
|
/**
|
|
54966
55168
|
* `integration-instances` - the connection of an addon that holds ONE or SEVERAL
|
|
54967
55169
|
* (an account, a relay, a destination) as typed records (D985, D986). The addon's
|
|
@@ -54986,7 +55188,7 @@ var IntegrationInstanceIdSchema = string().min(1);
|
|
|
54986
55188
|
var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
|
|
54987
55189
|
/**
|
|
54988
55190
|
* What the addon's instances ARE for the Integrations page (planning#416). `devices`: each
|
|
54989
|
-
* instance is an integration that brings devices (
|
|
55191
|
+
* instance is an integration that brings devices (its record body owns the on/off switch);
|
|
54990
55192
|
* `services`: a connection configured from the addon's own function page, never listed on
|
|
54991
55193
|
* Integrations.
|
|
54992
55194
|
* It is the same vocabulary as the manifest's `integrationRole`, which stays as an override.
|
|
@@ -55103,8 +55305,8 @@ var IntegrationInstanceSchema = object({
|
|
|
55103
55305
|
configured: boolean(),
|
|
55104
55306
|
/**
|
|
55105
55307
|
* 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
|
-
*
|
|
55308
|
+
* so a row written before the field existed is on). The same for every role, `devices` included:
|
|
55309
|
+
* the body is the one store, `setInstanceEnabled` the one writer (epic #440, step 3).
|
|
55108
55310
|
*/
|
|
55109
55311
|
enabled: boolean().optional(),
|
|
55110
55312
|
/** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
|
|
@@ -57940,6 +58142,8 @@ var MigrationIntegrationSchema = object({
|
|
|
57940
58142
|
addonId: string(),
|
|
57941
58143
|
name: string(),
|
|
57942
58144
|
info: Rows,
|
|
58145
|
+
/** The registry's stored switch: read by the one-switch migration, nothing else. */
|
|
58146
|
+
enabled: boolean().optional(),
|
|
57943
58147
|
originStableId: string().optional()
|
|
57944
58148
|
});
|
|
57945
58149
|
var MigrationDeviceSchema = object({
|
|
@@ -63644,13 +63848,6 @@ var AddBrokerInputSchema = object({
|
|
|
63644
63848
|
});
|
|
63645
63849
|
var AddBrokerResultSchema = object({ id: string() });
|
|
63646
63850
|
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
63851
|
var StartEmbeddedInputSchema = object({
|
|
63655
63852
|
port: number().int().min(1).max(65535).default(1883),
|
|
63656
63853
|
/** Allow anonymous connect (no username/password). Default: false. */
|
|
@@ -63673,9 +63870,6 @@ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnection
|
|
|
63673
63870
|
}), method(IdInputSchema, _void(), {
|
|
63674
63871
|
kind: "mutation",
|
|
63675
63872
|
auth: "admin"
|
|
63676
|
-
}), method(IdInputSchema, TestResultSchema$1, {
|
|
63677
|
-
kind: "mutation",
|
|
63678
|
-
auth: "admin"
|
|
63679
63873
|
}), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, {
|
|
63680
63874
|
kind: "mutation",
|
|
63681
63875
|
auth: "admin"
|
|
@@ -67936,14 +68130,6 @@ object({
|
|
|
67936
68130
|
empty: boolean().nullable(),
|
|
67937
68131
|
/** True while the pump is running. Null while unknown. */
|
|
67938
68132
|
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
68133
|
/** Decoded fault message. Null means healthy; a non-null string is an active fault. */
|
|
67948
68134
|
error: string().nullable(),
|
|
67949
68135
|
/** Ms epoch when the slice was last refreshed. */
|
|
@@ -67956,9 +68142,6 @@ DeviceType.PetFountain, method(object({
|
|
|
67956
68142
|
}), _void(), {
|
|
67957
68143
|
kind: "mutation",
|
|
67958
68144
|
auth: "protected"
|
|
67959
|
-
}), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
|
|
67960
|
-
kind: "mutation",
|
|
67961
|
-
auth: "protected"
|
|
67962
68145
|
});
|
|
67963
68146
|
/**
|
|
67964
68147
|
* The wire shapes of the Auto tune plan and apply (D745), used by the
|
|
@@ -76537,7 +76720,7 @@ var TrainingProviderTypeSchema = object({
|
|
|
76537
76720
|
label: string(),
|
|
76538
76721
|
/** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
|
|
76539
76722
|
iconAsset: string(),
|
|
76540
|
-
/** Owning `training-provider` addon
|
|
76723
|
+
/** Owning `training-provider` addon. */
|
|
76541
76724
|
addonId: string(),
|
|
76542
76725
|
/**
|
|
76543
76726
|
* Fields for one entry of this type (credentials + defaults). Absent on a
|
|
@@ -76582,36 +76765,6 @@ var TrainingProviderDescriptorSchema = object({
|
|
|
76582
76765
|
*/
|
|
76583
76766
|
formValues: record(string(), unknown()).optional()
|
|
76584
76767
|
});
|
|
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
76768
|
var ProviderJobStateSchema = _enum([
|
|
76616
76769
|
"pending",
|
|
76617
76770
|
"starting",
|
|
@@ -76659,22 +76812,6 @@ var TrainingLogLineSchema = object({
|
|
|
76659
76812
|
text: string()
|
|
76660
76813
|
});
|
|
76661
76814
|
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
76815
|
entryId: string().min(1),
|
|
76679
76816
|
gpuType: string(),
|
|
76680
76817
|
region: string(),
|
|
@@ -80120,20 +80257,6 @@ Object.freeze({
|
|
|
80120
80257
|
access: "view",
|
|
80121
80258
|
role: "admin"
|
|
80122
80259
|
},
|
|
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
80260
|
"connectivity.getStatus": {
|
|
80138
80261
|
capName: "connectivity",
|
|
80139
80262
|
capScope: "device",
|
|
@@ -82500,13 +82623,6 @@ Object.freeze({
|
|
|
82500
82623
|
access: "view",
|
|
82501
82624
|
role: "admin"
|
|
82502
82625
|
},
|
|
82503
|
-
"integrations.testConnection": {
|
|
82504
|
-
capName: "integrations",
|
|
82505
|
-
capScope: "system",
|
|
82506
|
-
addonId: null,
|
|
82507
|
-
access: "create",
|
|
82508
|
-
role: "admin"
|
|
82509
|
-
},
|
|
82510
82626
|
"integrations.update": {
|
|
82511
82627
|
capName: "integrations",
|
|
82512
82628
|
capScope: "system",
|
|
@@ -83739,13 +83855,6 @@ Object.freeze({
|
|
|
83739
83855
|
access: "create",
|
|
83740
83856
|
role: "admin"
|
|
83741
83857
|
},
|
|
83742
|
-
"mqttBroker.testConnection": {
|
|
83743
|
-
capName: "mqtt-broker",
|
|
83744
|
-
capScope: "system",
|
|
83745
|
-
addonId: null,
|
|
83746
|
-
access: "create",
|
|
83747
|
-
role: "admin"
|
|
83748
|
-
},
|
|
83749
83858
|
"nativeObjectDetection.getOptions": {
|
|
83750
83859
|
capName: "native-object-detection",
|
|
83751
83860
|
capScope: "device",
|
|
@@ -84621,13 +84730,6 @@ Object.freeze({
|
|
|
84621
84730
|
access: "view",
|
|
84622
84731
|
role: "viewer"
|
|
84623
84732
|
},
|
|
84624
|
-
"petFountain.resetDailyConsumption": {
|
|
84625
|
-
capName: "pet-fountain",
|
|
84626
|
-
capScope: "device",
|
|
84627
|
-
addonId: null,
|
|
84628
|
-
access: "delete",
|
|
84629
|
-
role: "viewer"
|
|
84630
|
-
},
|
|
84631
84733
|
"petFountain.setPump": {
|
|
84632
84734
|
capName: "pet-fountain",
|
|
84633
84735
|
capScope: "device",
|
|
@@ -88583,20 +88685,6 @@ Object.freeze({
|
|
|
88583
88685
|
access: "create",
|
|
88584
88686
|
role: "admin"
|
|
88585
88687
|
},
|
|
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
88688
|
"trainingProvider.describe": {
|
|
88601
88689
|
capName: "training-provider",
|
|
88602
88690
|
capScope: "system",
|
|
@@ -88667,13 +88755,6 @@ Object.freeze({
|
|
|
88667
88755
|
access: "create",
|
|
88668
88756
|
role: "admin"
|
|
88669
88757
|
},
|
|
88670
|
-
"trainingProvider.updateEntry": {
|
|
88671
|
-
capName: "training-provider",
|
|
88672
|
-
capScope: "system",
|
|
88673
|
-
addonId: null,
|
|
88674
|
-
access: "create",
|
|
88675
|
-
role: "admin"
|
|
88676
|
-
},
|
|
88677
88758
|
"trainingProvider.uploadDataset": {
|
|
88678
88759
|
capName: "training-provider",
|
|
88679
88760
|
capScope: "system",
|
|
@@ -88681,13 +88762,6 @@ Object.freeze({
|
|
|
88681
88762
|
access: "create",
|
|
88682
88763
|
role: "admin"
|
|
88683
88764
|
},
|
|
88684
|
-
"trainingProvider.validateCredentials": {
|
|
88685
|
-
capName: "training-provider",
|
|
88686
|
-
capScope: "system",
|
|
88687
|
-
addonId: null,
|
|
88688
|
-
access: "create",
|
|
88689
|
-
role: "admin"
|
|
88690
|
-
},
|
|
88691
88765
|
"turnProvider.getTurnServers": {
|
|
88692
88766
|
capName: "turn-provider",
|
|
88693
88767
|
capScope: "system",
|
|
@@ -91052,11 +91126,6 @@ Object.freeze({
|
|
|
91052
91126
|
form: "single",
|
|
91053
91127
|
optional: false
|
|
91054
91128
|
}],
|
|
91055
|
-
"petFountain.resetDailyConsumption": [{
|
|
91056
|
-
name: "deviceId",
|
|
91057
|
-
form: "single",
|
|
91058
|
-
optional: false
|
|
91059
|
-
}],
|
|
91060
91129
|
"petFountain.setPump": [{
|
|
91061
91130
|
name: "deviceId",
|
|
91062
91131
|
form: "single",
|
|
@@ -95132,7 +95201,6 @@ object({
|
|
|
95132
95201
|
delay: number().nonnegative().optional(),
|
|
95133
95202
|
commands: record(string(), unknown())
|
|
95134
95203
|
});
|
|
95135
|
-
entryBody({ brokerId: string() });
|
|
95136
95204
|
//#endregion
|
|
95137
95205
|
//#region src/migrations/drop-keys.ts
|
|
95138
95206
|
/** The canonical settings table: one row per key, id `<addonId>.<key>`. */
|