@camstack/addon-provider-homematic 1.2.184 → 1.2.185
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 +2 -2
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_page-B5ZdVcAo.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_page-Cdu55gHq.mjs} +4 -4
- package/dist/_virtual_mf___mfe_internal__addon_provider_homematic_page__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-D0LApVbg.mjs +26 -0
- package/dist/addon-provider-homematic.css +1 -1
- package/dist/addon.js +819 -956
- package/dist/addon.mjs +819 -956
- package/dist/{hostInit-CE_cSCS1.mjs → hostInit-BTFBzWSC.mjs} +3 -3
- package/dist/remoteEntry.js +1 -1
- package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_provider_homematic_page__remoteEntry_js-C_ngZu53.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_provider_homematic_page__remoteEntry_js-DYzwyh0X.mjs} +1 -1
- package/package.json +3 -6
- package/dist/_virtual_mf___mfe_internal__addon_provider_homematic_page__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-TVA-pYMh.mjs +0 -26
package/dist/addon.mjs
CHANGED
|
@@ -5991,7 +5991,7 @@ var ZodIssueCode = {
|
|
|
5991
5991
|
var ZodFirstPartyTypeKind;
|
|
5992
5992
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5993
5993
|
//#endregion
|
|
5994
|
-
//#region ../types/dist/sleep-
|
|
5994
|
+
//#region ../types/dist/sleep-CdKka2ri.mjs
|
|
5995
5995
|
/**
|
|
5996
5996
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5997
5997
|
* window to float samples (D455).
|
|
@@ -9538,30 +9538,98 @@ function normalizeAddonInitResult(result) {
|
|
|
9538
9538
|
if (Array.isArray(result)) return { providers: result };
|
|
9539
9539
|
return result;
|
|
9540
9540
|
}
|
|
9541
|
+
object({
|
|
9542
|
+
field: string().min(1),
|
|
9543
|
+
on: literal("advance")
|
|
9544
|
+
});
|
|
9541
9545
|
/**
|
|
9542
|
-
*
|
|
9543
|
-
*
|
|
9544
|
-
*
|
|
9546
|
+
* Output schema shared by the contribution + live methods.
|
|
9547
|
+
*
|
|
9548
|
+
* Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
|
|
9549
|
+
* tabs[]) without importing from `../interfaces/config-ui.js` — a
|
|
9550
|
+
* concrete-but-lenient Zod object keeps tRPC output inference happy
|
|
9551
|
+
* (using `z.unknown()` here collapses unrelated router branches to
|
|
9552
|
+
* `unknown` when the generator re-inlines the huge AppRouter type).
|
|
9553
|
+
*
|
|
9554
|
+
* `.passthrough()` on sections/fields accepts whatever FormBuilder
|
|
9555
|
+
* extensions the caller adds (showWhen, displayScale, …) without
|
|
9556
|
+
* rebuilding every time a new field kind is introduced.
|
|
9545
9557
|
*/
|
|
9546
|
-
var
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
|
|
9563
|
-
|
|
9558
|
+
var ContributionSectionSchema = object({
|
|
9559
|
+
id: string(),
|
|
9560
|
+
title: string(),
|
|
9561
|
+
description: string().optional(),
|
|
9562
|
+
style: _enum(["card", "accordion"]).optional(),
|
|
9563
|
+
defaultCollapsed: boolean().optional(),
|
|
9564
|
+
columns: union([
|
|
9565
|
+
literal(1),
|
|
9566
|
+
literal(2),
|
|
9567
|
+
literal(3),
|
|
9568
|
+
literal(4)
|
|
9569
|
+
]).optional(),
|
|
9570
|
+
tab: string().optional(),
|
|
9571
|
+
location: _enum([
|
|
9572
|
+
"settings",
|
|
9573
|
+
"top-tab",
|
|
9574
|
+
"hero"
|
|
9575
|
+
]).optional(),
|
|
9576
|
+
order: number().optional(),
|
|
9577
|
+
fields: array(any())
|
|
9564
9578
|
});
|
|
9579
|
+
object({
|
|
9580
|
+
tabs: array(object({
|
|
9581
|
+
id: string(),
|
|
9582
|
+
label: string(),
|
|
9583
|
+
icon: string(),
|
|
9584
|
+
order: number().optional()
|
|
9585
|
+
})).optional(),
|
|
9586
|
+
sections: array(ContributionSectionSchema)
|
|
9587
|
+
}).nullable();
|
|
9588
|
+
object({ deviceId: number() }), object({ deviceId: number() }), object({
|
|
9589
|
+
deviceId: number(),
|
|
9590
|
+
patch: record(string(), unknown())
|
|
9591
|
+
}), object({ success: literal(true) });
|
|
9592
|
+
object({ deviceId: number() }), unknown().nullable();
|
|
9593
|
+
function method(input, output, options) {
|
|
9594
|
+
return {
|
|
9595
|
+
input,
|
|
9596
|
+
output,
|
|
9597
|
+
kind: options?.kind ?? "query",
|
|
9598
|
+
...options?.auth !== void 0 ? { auth: options.auth } : {},
|
|
9599
|
+
...options?.access !== void 0 ? { access: options.access } : {},
|
|
9600
|
+
...options?.role !== void 0 ? { role: options.role } : {},
|
|
9601
|
+
...options?.caller !== void 0 ? { caller: options.caller } : {},
|
|
9602
|
+
timeoutMs: options?.timeoutMs
|
|
9603
|
+
};
|
|
9604
|
+
}
|
|
9605
|
+
/**
|
|
9606
|
+
* A wrapper/system-only method: served exclusively by the cap's system-level
|
|
9607
|
+
* provider (`InferProvider`), and OPTIONAL on `InferNativeProvider` so per-device
|
|
9608
|
+
* driver natives don't stub out a wrapper concern (e.g. a cross-device cache
|
|
9609
|
+
* overview). The `systemOnly: true` literal is what `InferNativeProvider` keys on.
|
|
9610
|
+
*/
|
|
9611
|
+
function systemMethod(input, output, options) {
|
|
9612
|
+
return {
|
|
9613
|
+
...method(input, output, options),
|
|
9614
|
+
systemOnly: true
|
|
9615
|
+
};
|
|
9616
|
+
}
|
|
9617
|
+
/**
|
|
9618
|
+
* A method a SOURCE of a collection cap may legitimately not serve — OPTIONAL
|
|
9619
|
+
* on `InferProvider`. The `providerOptional: true` literal is what
|
|
9620
|
+
* `InferProvider` keys on; see {@link CapabilityMethodSchema.providerOptional}
|
|
9621
|
+
* for when this is the honest answer and when it is a soft stub.
|
|
9622
|
+
*/
|
|
9623
|
+
function optionalMethod(input, output, options) {
|
|
9624
|
+
return {
|
|
9625
|
+
...method(input, output, options),
|
|
9626
|
+
providerOptional: true
|
|
9627
|
+
};
|
|
9628
|
+
}
|
|
9629
|
+
/** Shorthand to define an event schema */
|
|
9630
|
+
function event(data) {
|
|
9631
|
+
return { data };
|
|
9632
|
+
}
|
|
9565
9633
|
function defOf(schema) {
|
|
9566
9634
|
const zodBag = Reflect.get(schema, "_zod");
|
|
9567
9635
|
if (typeof zodBag !== "object" || zodBag === null) return {};
|
|
@@ -9818,98 +9886,30 @@ function defineEntryKind(name, spec) {
|
|
|
9818
9886
|
if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
|
|
9819
9887
|
return defined;
|
|
9820
9888
|
}
|
|
9821
|
-
object({
|
|
9822
|
-
field: string().min(1),
|
|
9823
|
-
on: literal("advance")
|
|
9824
|
-
});
|
|
9825
9889
|
/**
|
|
9826
|
-
*
|
|
9827
|
-
*
|
|
9828
|
-
*
|
|
9829
|
-
* tabs[]) without importing from `../interfaces/config-ui.js` — a
|
|
9830
|
-
* concrete-but-lenient Zod object keeps tRPC output inference happy
|
|
9831
|
-
* (using `z.unknown()` here collapses unrelated router branches to
|
|
9832
|
-
* `unknown` when the generator re-inlines the huge AppRouter type).
|
|
9833
|
-
*
|
|
9834
|
-
* `.passthrough()` on sections/fields accepts whatever FormBuilder
|
|
9835
|
-
* extensions the caller adds (showWhen, displayScale, …) without
|
|
9836
|
-
* rebuilding every time a new field kind is introduced.
|
|
9890
|
+
* The share-view scope kinds a share-link token can carry. The hub mints
|
|
9891
|
+
* and validates them (`ShareViewGrantSchema` builds its
|
|
9892
|
+
* enum from this list); a data plane names the kinds it ACCEPTS in `share`.
|
|
9837
9893
|
*/
|
|
9838
|
-
var
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9855
|
-
|
|
9856
|
-
order: number().optional(),
|
|
9857
|
-
fields: array(any())
|
|
9894
|
+
var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
|
|
9895
|
+
/** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
|
|
9896
|
+
var PeerBytesTicketSchema = object({
|
|
9897
|
+
/** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
|
|
9898
|
+
url: string().min(1),
|
|
9899
|
+
/**
|
|
9900
|
+
* The HOST node this URL means something on — the hub or a named agent,
|
|
9901
|
+
* never a runner. {@link AddonPeerBytes.open} compares it to its own and
|
|
9902
|
+
* refuses `cross-node` by name when they differ, without dialling.
|
|
9903
|
+
*/
|
|
9904
|
+
hostNodeId: string().min(1),
|
|
9905
|
+
expiresAtMs: number().int().nonnegative(),
|
|
9906
|
+
/**
|
|
9907
|
+
* What the producer DECLARED the body to be, when it knows — `null` when it
|
|
9908
|
+
* does not. Never `0` for unknown (D393): a consumer sizing a bound off this
|
|
9909
|
+
* must be able to tell "the producer did not say" from "the body is empty".
|
|
9910
|
+
*/
|
|
9911
|
+
declaredBytes: number().int().nonnegative().nullable()
|
|
9858
9912
|
});
|
|
9859
|
-
object({
|
|
9860
|
-
tabs: array(object({
|
|
9861
|
-
id: string(),
|
|
9862
|
-
label: string(),
|
|
9863
|
-
icon: string(),
|
|
9864
|
-
order: number().optional()
|
|
9865
|
-
})).optional(),
|
|
9866
|
-
sections: array(ContributionSectionSchema)
|
|
9867
|
-
}).nullable();
|
|
9868
|
-
object({ deviceId: number() }), object({ deviceId: number() }), object({
|
|
9869
|
-
deviceId: number(),
|
|
9870
|
-
patch: record(string(), unknown())
|
|
9871
|
-
}), object({ success: literal(true) });
|
|
9872
|
-
object({ deviceId: number() }), unknown().nullable();
|
|
9873
|
-
function method(input, output, options) {
|
|
9874
|
-
return {
|
|
9875
|
-
input,
|
|
9876
|
-
output,
|
|
9877
|
-
kind: options?.kind ?? "query",
|
|
9878
|
-
...options?.auth !== void 0 ? { auth: options.auth } : {},
|
|
9879
|
-
...options?.access !== void 0 ? { access: options.access } : {},
|
|
9880
|
-
...options?.role !== void 0 ? { role: options.role } : {},
|
|
9881
|
-
...options?.caller !== void 0 ? { caller: options.caller } : {},
|
|
9882
|
-
timeoutMs: options?.timeoutMs
|
|
9883
|
-
};
|
|
9884
|
-
}
|
|
9885
|
-
/**
|
|
9886
|
-
* A wrapper/system-only method: served exclusively by the cap's system-level
|
|
9887
|
-
* provider (`InferProvider`), and OPTIONAL on `InferNativeProvider` so per-device
|
|
9888
|
-
* driver natives don't stub out a wrapper concern (e.g. a cross-device cache
|
|
9889
|
-
* overview). The `systemOnly: true` literal is what `InferNativeProvider` keys on.
|
|
9890
|
-
*/
|
|
9891
|
-
function systemMethod(input, output, options) {
|
|
9892
|
-
return {
|
|
9893
|
-
...method(input, output, options),
|
|
9894
|
-
systemOnly: true
|
|
9895
|
-
};
|
|
9896
|
-
}
|
|
9897
|
-
/**
|
|
9898
|
-
* A method a SOURCE of a collection cap may legitimately not serve — OPTIONAL
|
|
9899
|
-
* on `InferProvider`. The `providerOptional: true` literal is what
|
|
9900
|
-
* `InferProvider` keys on; see {@link CapabilityMethodSchema.providerOptional}
|
|
9901
|
-
* for when this is the honest answer and when it is a soft stub.
|
|
9902
|
-
*/
|
|
9903
|
-
function optionalMethod(input, output, options) {
|
|
9904
|
-
return {
|
|
9905
|
-
...method(input, output, options),
|
|
9906
|
-
providerOptional: true
|
|
9907
|
-
};
|
|
9908
|
-
}
|
|
9909
|
-
/** Shorthand to define an event schema */
|
|
9910
|
-
function event(data) {
|
|
9911
|
-
return { data };
|
|
9912
|
-
}
|
|
9913
9913
|
var READING_QUANTITIES = [
|
|
9914
9914
|
"temperature",
|
|
9915
9915
|
"pressure",
|
|
@@ -10527,7 +10527,6 @@ var CAP_NAMES = Object.freeze([
|
|
|
10527
10527
|
"climate-control",
|
|
10528
10528
|
"color",
|
|
10529
10529
|
"composer",
|
|
10530
|
-
"connection-test",
|
|
10531
10530
|
"connectivity",
|
|
10532
10531
|
"consumables",
|
|
10533
10532
|
"contact",
|
|
@@ -12547,8 +12546,7 @@ Object.freeze({
|
|
|
12547
12546
|
"offerArtifact": 3e5,
|
|
12548
12547
|
"readResult": 3e5,
|
|
12549
12548
|
"submitJob": 18e5,
|
|
12550
|
-
"uploadDataset": 72e5
|
|
12551
|
-
"validateCredentials": 3e4
|
|
12549
|
+
"uploadDataset": 72e5
|
|
12552
12550
|
}
|
|
12553
12551
|
});
|
|
12554
12552
|
object({
|
|
@@ -13903,6 +13901,432 @@ var IntegrationInstanceRefSchema = object({
|
|
|
13903
13901
|
]),
|
|
13904
13902
|
candidateStableId: string().optional()
|
|
13905
13903
|
});
|
|
13904
|
+
/**
|
|
13905
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
13906
|
+
*
|
|
13907
|
+
* Apprise-derived model (see
|
|
13908
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
13909
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
13910
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
13911
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
13912
|
+
* message to what the kind supports — callers never special-case a service.
|
|
13913
|
+
*
|
|
13914
|
+
* DESIGN DECISIONS (locked):
|
|
13915
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
13916
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
13917
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
13918
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
13919
|
+
* alternative would fork the UI per addon and cannot host the
|
|
13920
|
+
* discovery→adopt flow.
|
|
13921
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
13922
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
13923
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
13924
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
13925
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
13926
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
13927
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
13928
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
13929
|
+
* base64 fallback needed.
|
|
13930
|
+
*
|
|
13931
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
13932
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
13933
|
+
* admin "Integrations" page.
|
|
13934
|
+
*/
|
|
13935
|
+
/**
|
|
13936
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
13937
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
13938
|
+
*/
|
|
13939
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
13940
|
+
"image",
|
|
13941
|
+
"video",
|
|
13942
|
+
"gif",
|
|
13943
|
+
"audio",
|
|
13944
|
+
"icon"
|
|
13945
|
+
]);
|
|
13946
|
+
/**
|
|
13947
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
13948
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
13949
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
13950
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
13951
|
+
*/
|
|
13952
|
+
var AttachmentSchema = object({
|
|
13953
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
13954
|
+
url: string().optional(),
|
|
13955
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
13956
|
+
mime: string().optional(),
|
|
13957
|
+
name: string().optional()
|
|
13958
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
13959
|
+
var NotificationFormatSchema = _enum([
|
|
13960
|
+
"text",
|
|
13961
|
+
"markdown",
|
|
13962
|
+
"html"
|
|
13963
|
+
]);
|
|
13964
|
+
/**
|
|
13965
|
+
* The CLOSED icon vocabulary an action button may use.
|
|
13966
|
+
*
|
|
13967
|
+
* A closed set, not a free string, and that is the whole point: an arbitrary
|
|
13968
|
+
* icon name is one that ntfy renders, zentik silently drops, and nobody
|
|
13969
|
+
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
13970
|
+
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
13971
|
+
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
13972
|
+
*
|
|
13973
|
+
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
13974
|
+
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
13975
|
+
* differently.
|
|
13976
|
+
*
|
|
13977
|
+
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
13978
|
+
*
|
|
13979
|
+
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
13980
|
+
* the whole set onto its own renderer's vocabulary through a
|
|
13981
|
+
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
13982
|
+
* fallback, so adding a member here fails every adapter's build until someone
|
|
13983
|
+
* decides its glyph, which is the only place that decision can be made
|
|
13984
|
+
* honestly.
|
|
13985
|
+
*
|
|
13986
|
+
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
13987
|
+
* `disarm` straight through; iOS feeds that string to
|
|
13988
|
+
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
13989
|
+
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
13990
|
+
* mapping, and "the field is documented" is not "the value renders".
|
|
13991
|
+
*
|
|
13992
|
+
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
13993
|
+
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
13994
|
+
* so an addon that emits a token the running hub does not know does not lose an
|
|
13995
|
+
* icon — its whole `send` fails Zod validation and the notification never
|
|
13996
|
+
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
13997
|
+
*/
|
|
13998
|
+
var NotificationActionIconSchema = _enum([
|
|
13999
|
+
"acknowledge",
|
|
14000
|
+
"dismiss",
|
|
14001
|
+
"silence",
|
|
14002
|
+
"snooze",
|
|
14003
|
+
"view",
|
|
14004
|
+
"play",
|
|
14005
|
+
"open",
|
|
14006
|
+
"close",
|
|
14007
|
+
"lock",
|
|
14008
|
+
"unlock",
|
|
14009
|
+
"arm",
|
|
14010
|
+
"arm-home",
|
|
14011
|
+
"arm-away",
|
|
14012
|
+
"arm-night",
|
|
14013
|
+
"disarm",
|
|
14014
|
+
"light",
|
|
14015
|
+
"alert",
|
|
14016
|
+
"camera"
|
|
14017
|
+
]);
|
|
14018
|
+
/** A single tap-through action button. */
|
|
14019
|
+
var NotificationActionSchema = object({
|
|
14020
|
+
id: string(),
|
|
14021
|
+
label: string(),
|
|
14022
|
+
url: string().optional(),
|
|
14023
|
+
/** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
|
|
14024
|
+
icon: NotificationActionIconSchema.optional(),
|
|
14025
|
+
/**
|
|
14026
|
+
* Renders in a warning style where the notifier supports it.
|
|
14027
|
+
*
|
|
14028
|
+
* A HINT, never a gate. The callback's authority is its token and nothing
|
|
14029
|
+
* else — see `notification-center/action-token.ts` for what that does and
|
|
14030
|
+
* does not buy.
|
|
14031
|
+
*/
|
|
14032
|
+
destructive: boolean().optional(),
|
|
14033
|
+
/**
|
|
14034
|
+
* How the tap should REACH the url.
|
|
14035
|
+
*
|
|
14036
|
+
* `navigate` (absent, and every button authored before this field) opens it:
|
|
14037
|
+
* the phone leaves the notification and shows whatever the callback returns.
|
|
14038
|
+
* That is right for a button whose answer the operator wants to read.
|
|
14039
|
+
*
|
|
14040
|
+
* `background` fires it as a POST and stays put. It exists for the buttons
|
|
14041
|
+
* whose whole point is not to interrupt — "silence this for 30 minutes" is
|
|
14042
|
+
* an answer to the notification, and being thrown into a browser tab to
|
|
14043
|
+
* confirm it costs more attention than the notification did. A backend that
|
|
14044
|
+
* cannot do a background call renders it as an ordinary link (the adapters
|
|
14045
|
+
* fall back rather than dropping the button), so this is a preference, never
|
|
14046
|
+
* a requirement.
|
|
14047
|
+
*/
|
|
14048
|
+
mode: _enum(["navigate", "background"]).optional()
|
|
14049
|
+
});
|
|
14050
|
+
/** A delivery parameter value: what a notifier declared it takes. */
|
|
14051
|
+
var DeliveryParamValueSchema = union([
|
|
14052
|
+
string(),
|
|
14053
|
+
number(),
|
|
14054
|
+
boolean()
|
|
14055
|
+
]);
|
|
14056
|
+
/**
|
|
14057
|
+
* One extra delivery parameter a notifier KIND declares (D938). A rule that
|
|
14058
|
+
* addresses a target of that kind may set it; a kind that declares nothing is
|
|
14059
|
+
* never handed one. The admin UI derives its control from this descriptor —
|
|
14060
|
+
* no editor knows a service by name.
|
|
14061
|
+
*
|
|
14062
|
+
* Optional fields are `.optional()`, never `.default()` (a Zod default does not
|
|
14063
|
+
* run on the addon cap path).
|
|
14064
|
+
*/
|
|
14065
|
+
var DeliveryParamSchema = object({
|
|
14066
|
+
key: string().min(1),
|
|
14067
|
+
label: string(),
|
|
14068
|
+
/** i18n key of the label, resolved by the declaring addon's namespace. */
|
|
14069
|
+
labelKey: string().optional(),
|
|
14070
|
+
type: _enum([
|
|
14071
|
+
"enum",
|
|
14072
|
+
"number",
|
|
14073
|
+
"boolean",
|
|
14074
|
+
"string"
|
|
14075
|
+
]),
|
|
14076
|
+
/** `enum` only: the closed set of accepted values. */
|
|
14077
|
+
options: array(object({
|
|
14078
|
+
value: string(),
|
|
14079
|
+
label: string()
|
|
14080
|
+
})).optional(),
|
|
14081
|
+
/** `number` only. */
|
|
14082
|
+
min: number().optional(),
|
|
14083
|
+
max: number().optional(),
|
|
14084
|
+
/** What the notifier does when the rule sets nothing; shown as the placeholder. */
|
|
14085
|
+
default: DeliveryParamValueSchema.optional()
|
|
14086
|
+
});
|
|
14087
|
+
/**
|
|
14088
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
14089
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
14090
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
14091
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
14092
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
14093
|
+
* `priority` for that one target.
|
|
14094
|
+
*/
|
|
14095
|
+
var NotificationSchema = object({
|
|
14096
|
+
body: string(),
|
|
14097
|
+
title: string().optional(),
|
|
14098
|
+
format: NotificationFormatSchema.default("text"),
|
|
14099
|
+
priority: number().int().min(1).max(5).default(3),
|
|
14100
|
+
level: string().optional(),
|
|
14101
|
+
attachments: array(AttachmentSchema).optional(),
|
|
14102
|
+
clickUrl: string().optional(),
|
|
14103
|
+
actions: array(NotificationActionSchema).optional(),
|
|
14104
|
+
sound: string().optional(),
|
|
14105
|
+
ttl: number().optional(),
|
|
14106
|
+
tag: string().optional(),
|
|
14107
|
+
deviceId: number().optional(),
|
|
14108
|
+
eventId: string().optional(),
|
|
14109
|
+
metadata: record(string(), unknown()).optional(),
|
|
14110
|
+
/**
|
|
14111
|
+
* Values for the parameters the target's kind DECLARES in
|
|
14112
|
+
* {@link TargetKindSchema} `deliveryParams`. Already validated against the
|
|
14113
|
+
* declaration by the sender; a notifier reads only the keys it declared.
|
|
14114
|
+
*/
|
|
14115
|
+
delivery: record(string(), DeliveryParamValueSchema).optional()
|
|
14116
|
+
});
|
|
14117
|
+
/** One declared native severity/priority level for a kind. */
|
|
14118
|
+
var TargetKindLevelSchema = object({
|
|
14119
|
+
id: string(),
|
|
14120
|
+
label: string(),
|
|
14121
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
14122
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
14123
|
+
flags: object({
|
|
14124
|
+
critical: boolean().optional(),
|
|
14125
|
+
silent: boolean().optional(),
|
|
14126
|
+
noPush: boolean().optional()
|
|
14127
|
+
}).optional(),
|
|
14128
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
14129
|
+
requires: array(string()).optional(),
|
|
14130
|
+
description: string().optional()
|
|
14131
|
+
});
|
|
14132
|
+
/** The full capability block consulted before dispatch. */
|
|
14133
|
+
var TargetKindCapsSchema = object({
|
|
14134
|
+
attachments: object({
|
|
14135
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
14136
|
+
mode: _enum([
|
|
14137
|
+
"url",
|
|
14138
|
+
"bytes",
|
|
14139
|
+
"both"
|
|
14140
|
+
]),
|
|
14141
|
+
max: number().int().nonnegative(),
|
|
14142
|
+
maxBytes: number().int().positive().optional()
|
|
14143
|
+
}),
|
|
14144
|
+
/** Max action buttons (0 = none). */
|
|
14145
|
+
actions: number().int().nonnegative(),
|
|
14146
|
+
/**
|
|
14147
|
+
* Whether this kind renders a per-action ICON.
|
|
14148
|
+
*
|
|
14149
|
+
* `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
|
|
14150
|
+
* run on the addon cap path — three production failures in one day taught
|
|
14151
|
+
* this repo that once. Absent is read as false by the degrade engine, which
|
|
14152
|
+
* is the safe direction: an icon that is not rendered costs nothing, an icon
|
|
14153
|
+
* assumed and dropped costs the operator's trust in the field.
|
|
14154
|
+
*/
|
|
14155
|
+
actionIcons: boolean().optional(),
|
|
14156
|
+
levels: array(TargetKindLevelSchema),
|
|
14157
|
+
format: array(NotificationFormatSchema),
|
|
14158
|
+
clickUrl: boolean(),
|
|
14159
|
+
sound: boolean(),
|
|
14160
|
+
ttl: boolean(),
|
|
14161
|
+
bodyMaxLen: number().int().positive()
|
|
14162
|
+
});
|
|
14163
|
+
/**
|
|
14164
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
14165
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
14166
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
14167
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
14168
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
14169
|
+
*/
|
|
14170
|
+
var ConfigSchemaPassthrough$4 = unknown();
|
|
14171
|
+
var TargetKindSchema = object({
|
|
14172
|
+
kind: string(),
|
|
14173
|
+
label: string(),
|
|
14174
|
+
icon: string(),
|
|
14175
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
14176
|
+
addonId: string(),
|
|
14177
|
+
/**
|
|
14178
|
+
* URL of the kind's bundled BRAND icon, served by the providing addon over
|
|
14179
|
+
* its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
|
|
14180
|
+
* when the addon bundles no icon for that kind — the client then falls back
|
|
14181
|
+
* to a neutral glyph rather than rendering the raw `icon` NAME as text.
|
|
14182
|
+
*
|
|
14183
|
+
* Root-relative on purpose: it resolves against whatever origin serves a web
|
|
14184
|
+
* client, and a native client joins it onto its own hub base.
|
|
14185
|
+
*
|
|
14186
|
+
* DECLARED here deliberately. It used to travel as an undeclared passthrough
|
|
14187
|
+
* field that survived only because the runtime cap-router forwards provider
|
|
14188
|
+
* output verbatim — so every consumer had to re-declare it by hand to stop
|
|
14189
|
+
* its own Zod parse from stripping it, and the whole arrangement would have
|
|
14190
|
+
* broken silently the moment output validation was tightened anywhere.
|
|
14191
|
+
*/
|
|
14192
|
+
iconUrl: string().optional(),
|
|
14193
|
+
/**
|
|
14194
|
+
* Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
|
|
14195
|
+
*
|
|
14196
|
+
* The server knows this and therefore says it, because the client cannot
|
|
14197
|
+
* safely guess: a React-Native client renders SVG and raster through two
|
|
14198
|
+
* DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
|
|
14199
|
+
* not decode SVG on iOS/Android), so without this it silently fell back to a
|
|
14200
|
+
* placeholder glyph for every vector icon while the web build looked fine.
|
|
14201
|
+
*
|
|
14202
|
+
* Absent when {@link iconUrl} is absent, or for a legacy provider that has
|
|
14203
|
+
* not been updated — a client that cannot determine the type should prefer
|
|
14204
|
+
* its raster path, which is the safe default for an unknown image.
|
|
14205
|
+
*/
|
|
14206
|
+
iconMediaType: string().optional(),
|
|
14207
|
+
configSchema: ConfigSchemaPassthrough$4,
|
|
14208
|
+
/**
|
|
14209
|
+
* The config keys that decide WHERE this kind's secrets are sent (server,
|
|
14210
|
+
* base URL, instance, chat, recipient). A save that changes any of them
|
|
14211
|
+
* while leaving a secret redacted is refused by the provider (D634), so an
|
|
14212
|
+
* editor uses this to ask for the secret on exactly those edits instead of
|
|
14213
|
+
* on every edit.
|
|
14214
|
+
*
|
|
14215
|
+
* Optional: absent from a provider that holds no secret (the Home Assistant
|
|
14216
|
+
* kinds) and from a provider older than this field — an editor that finds
|
|
14217
|
+
* it absent must assume ANY edit may need the secret.
|
|
14218
|
+
*/
|
|
14219
|
+
destinationKeys: array(string()).optional(),
|
|
14220
|
+
supportsDiscovery: boolean(),
|
|
14221
|
+
/**
|
|
14222
|
+
* Extra delivery parameters a rule may set for a target of this kind (D938).
|
|
14223
|
+
* Absent = none; the rule editor then offers nothing.
|
|
14224
|
+
*/
|
|
14225
|
+
deliveryParams: array(DeliveryParamSchema).optional(),
|
|
14226
|
+
caps: TargetKindCapsSchema
|
|
14227
|
+
});
|
|
14228
|
+
/**
|
|
14229
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
14230
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
14231
|
+
* round-trip a stored secret to the UI.
|
|
14232
|
+
*/
|
|
14233
|
+
var TargetSchema = object({
|
|
14234
|
+
id: string(),
|
|
14235
|
+
name: string(),
|
|
14236
|
+
kind: string(),
|
|
14237
|
+
addonId: string(),
|
|
14238
|
+
enabled: boolean(),
|
|
14239
|
+
config: record(string(), unknown())
|
|
14240
|
+
});
|
|
14241
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
14242
|
+
var DiscoveredTargetSchema = object({
|
|
14243
|
+
kind: string(),
|
|
14244
|
+
suggestedName: string(),
|
|
14245
|
+
config: record(string(), unknown())
|
|
14246
|
+
});
|
|
14247
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
14248
|
+
var RenderedAsSchema = object({
|
|
14249
|
+
level: string(),
|
|
14250
|
+
format: NotificationFormatSchema,
|
|
14251
|
+
attachmentsSent: number().int().nonnegative(),
|
|
14252
|
+
actionsSent: number().int().nonnegative(),
|
|
14253
|
+
truncated: boolean(),
|
|
14254
|
+
dropped: array(string())
|
|
14255
|
+
});
|
|
14256
|
+
var SendResultSchema = object({
|
|
14257
|
+
success: boolean(),
|
|
14258
|
+
error: string().optional(),
|
|
14259
|
+
renderedAs: RenderedAsSchema.optional()
|
|
14260
|
+
});
|
|
14261
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
14262
|
+
var TestResultSchema = SendResultSchema;
|
|
14263
|
+
/**
|
|
14264
|
+
* Pre-save credential probe against a partial (unsaved) target config.
|
|
14265
|
+
* `resolvedUrl` never includes secrets (token stripped from path).
|
|
14266
|
+
*/
|
|
14267
|
+
var ProbeTargetConfigResultSchema = object({
|
|
14268
|
+
ok: boolean(),
|
|
14269
|
+
resolvedUrl: string(),
|
|
14270
|
+
httpStatus: number().int().optional(),
|
|
14271
|
+
stateInstance: string().optional(),
|
|
14272
|
+
error: string().optional()
|
|
14273
|
+
});
|
|
14274
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
|
|
14275
|
+
kind: string(),
|
|
14276
|
+
config: record(string(), unknown()).optional(),
|
|
14277
|
+
/**
|
|
14278
|
+
* When editing / duplicating, the blank password field never round-trips
|
|
14279
|
+
* the stored token. Pass the source target id so the provider can restore
|
|
14280
|
+
* secrets server-side before dialling (same merge as upsert).
|
|
14281
|
+
*/
|
|
14282
|
+
targetId: string().optional()
|
|
14283
|
+
}), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
|
|
14284
|
+
kind: string(),
|
|
14285
|
+
config: record(string(), unknown()),
|
|
14286
|
+
/** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
|
|
14287
|
+
targetId: string().optional()
|
|
14288
|
+
}), ProbeTargetConfigResultSchema, {
|
|
14289
|
+
kind: "mutation",
|
|
14290
|
+
auth: "admin"
|
|
14291
|
+
}), method(object({
|
|
14292
|
+
targetId: string(),
|
|
14293
|
+
notification: NotificationSchema
|
|
14294
|
+
}), SendResultSchema, {
|
|
14295
|
+
kind: "mutation",
|
|
14296
|
+
auth: "admin"
|
|
14297
|
+
}), method(object({
|
|
14298
|
+
targetId: string(),
|
|
14299
|
+
sample: NotificationSchema.optional()
|
|
14300
|
+
}), TestResultSchema, {
|
|
14301
|
+
kind: "mutation",
|
|
14302
|
+
auth: "admin"
|
|
14303
|
+
}), method(object({
|
|
14304
|
+
target: TargetSchema,
|
|
14305
|
+
/**
|
|
14306
|
+
* Duplicate flow: create a NEW target id while copying secrets from an
|
|
14307
|
+
* existing row. The UI never holds the stored token; blank / redacted
|
|
14308
|
+
* password fields are restored from this source (D634 still applies if
|
|
14309
|
+
* destinations diverge without a re-typed secret).
|
|
14310
|
+
*/
|
|
14311
|
+
cloneSecretsFrom: string().optional()
|
|
14312
|
+
}), TargetSchema, {
|
|
14313
|
+
kind: "mutation",
|
|
14314
|
+
auth: "admin"
|
|
14315
|
+
}), method(object({ targetId: string() }), _void(), {
|
|
14316
|
+
kind: "mutation",
|
|
14317
|
+
auth: "admin"
|
|
14318
|
+
}), method(object({
|
|
14319
|
+
targetId: string(),
|
|
14320
|
+
enabled: boolean()
|
|
14321
|
+
}), _void(), {
|
|
14322
|
+
kind: "mutation",
|
|
14323
|
+
auth: "admin"
|
|
14324
|
+
});
|
|
14325
|
+
looseObject({
|
|
14326
|
+
name: string().min(1),
|
|
14327
|
+
enabled: boolean().optional()
|
|
14328
|
+
});
|
|
14329
|
+
TargetSchema.omit({ id: true });
|
|
13906
14330
|
var EncodeProfileSchema = object({
|
|
13907
14331
|
video: object({
|
|
13908
14332
|
codec: _enum([
|
|
@@ -22263,7 +22687,6 @@ var SYSTEM_CAP_VOCABULARY = {
|
|
|
22263
22687
|
"calendar-source": system(INTERNAL),
|
|
22264
22688
|
calendars: system("calendars feed schedules and conditions, not device actions"),
|
|
22265
22689
|
composer: system("device composition — an authoring tool, not an action"),
|
|
22266
|
-
"connection-test": system(INTERNAL),
|
|
22267
22690
|
"core-blocks": system(INTERNAL),
|
|
22268
22691
|
"custom-model-registry": system(ML),
|
|
22269
22692
|
"data-store-provider": system(INTERNAL),
|
|
@@ -44109,636 +44532,215 @@ var AutomationStepTraceSchema = object({
|
|
|
44109
44532
|
startedAt: number().optional(),
|
|
44110
44533
|
endedAt: number().optional(),
|
|
44111
44534
|
/**
|
|
44112
|
-
* The parameters the step SENT, after `{{vars.x}}` substitution — what the
|
|
44113
|
-
* device was actually asked. Bounded like trigger `vars`; a secret parameter
|
|
44114
|
-
* is shown as {@link REDACTED_ARG}. Absent on traces written before it existed.
|
|
44115
|
-
*/
|
|
44116
|
-
args: record(string(), TraceValueSchema).optional(),
|
|
44117
|
-
/** `empty`: the target resolved to no device, so nothing was done — never silently `ok`. */
|
|
44118
|
-
outcome: _enum([
|
|
44119
|
-
"ok",
|
|
44120
|
-
"error",
|
|
44121
|
-
"not-run",
|
|
44122
|
-
"empty"
|
|
44123
|
-
]),
|
|
44124
|
-
message: string().optional()
|
|
44125
|
-
});
|
|
44126
|
-
var AutomationRunTraceSchema = object({
|
|
44127
|
-
runId: string().min(1),
|
|
44128
|
-
startedAt: number(),
|
|
44129
|
-
endedAt: number(),
|
|
44130
|
-
trigger: AutomationTriggerTraceSchema,
|
|
44131
|
-
conditions: array(AutomationConditionTraceNodeSchema),
|
|
44132
|
-
verdict: AutomationRunVerdictSchema.optional(),
|
|
44133
|
-
steps: array(AutomationStepTraceSchema),
|
|
44134
|
-
outcome: AutomationRunOutcomeSchema,
|
|
44135
|
-
/** How many identical consecutive skips this trace stands for (>= 1). */
|
|
44136
|
-
repeat: number().int().min(1),
|
|
44137
|
-
/** When the latest of those repeats happened. */
|
|
44138
|
-
lastAt: number(),
|
|
44139
|
-
/**
|
|
44140
|
-
* A scheduler point's own outcome (D983). `outcome` carries the closest
|
|
44141
|
-
* automation outcome so a reader that does not know schedulers still reads
|
|
44142
|
-
* the trace; this field says exactly what happened.
|
|
44143
|
-
*/
|
|
44144
|
-
scheduler: SchedulerOutcomeSchema.optional()
|
|
44145
|
-
});
|
|
44146
|
-
/**
|
|
44147
|
-
* What the hub's `runs` ledger holds for one owner (`automation:<blockId>` or
|
|
44148
|
-
* `action:<actionId>`): the cooldown stamp and the trace ring.
|
|
44149
|
-
*/
|
|
44150
|
-
var AutomationStateDocSchema = object({
|
|
44151
|
-
version: literal(1),
|
|
44152
|
-
lastRunStartedAt: number().nullable(),
|
|
44153
|
-
traces: array(AutomationRunTraceSchema)
|
|
44154
|
-
});
|
|
44155
|
-
/**
|
|
44156
|
-
* Actions — named, runnable things an operator (or an automation) can start,
|
|
44157
|
-
* declared as LIST ENTRIES, never as devices.
|
|
44158
|
-
*
|
|
44159
|
-
* An entry is either **internal** (a short list of cap/wait steps kept in the
|
|
44160
|
-
* hub's `actions` record kind) or declared by an addon through the
|
|
44161
|
-
* `action-source` collection (a Home Assistant script, a scene …). The one
|
|
44162
|
-
* surface the UI and automations talk to is the `actions` cap; it keeps no
|
|
44163
|
-
* catalog of its own (D3) — every `list` asks the providers live.
|
|
44164
|
-
*
|
|
44165
|
-
* This file is the data half: the entry schema, the variables an entry may
|
|
44166
|
-
* declare, and the pure resolution of the values a run was given. It holds no
|
|
44167
|
-
* runtime.
|
|
44168
|
-
*/
|
|
44169
|
-
/** What a variable's value is. `select` takes one of `options`. */
|
|
44170
|
-
var ActionVariableTypeSchema = _enum([
|
|
44171
|
-
"string",
|
|
44172
|
-
"number",
|
|
44173
|
-
"boolean",
|
|
44174
|
-
"select"
|
|
44175
|
-
]);
|
|
44176
|
-
var ACTION_VARIABLE_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
44177
|
-
var ActionVariableValueSchema = union([
|
|
44178
|
-
string(),
|
|
44179
|
-
number(),
|
|
44180
|
-
boolean()
|
|
44181
|
-
]);
|
|
44182
|
-
/**
|
|
44183
|
-
* One declared variable. Steps reference it as `{ $var: 'name' }` (the whole
|
|
44184
|
-
* value) or `{{vars.name}}` (inside a string) in their args.
|
|
44185
|
-
*/
|
|
44186
|
-
var ActionVariableSchema = object({
|
|
44187
|
-
name: string().regex(ACTION_VARIABLE_NAME_RE),
|
|
44188
|
-
label: string().min(1).max(120).optional(),
|
|
44189
|
-
type: ActionVariableTypeSchema,
|
|
44190
|
-
required: boolean().optional(),
|
|
44191
|
-
default: ActionVariableValueSchema.optional(),
|
|
44192
|
-
/** The allowed values of a `select`. */
|
|
44193
|
-
options: array(string().min(1)).min(1).optional()
|
|
44194
|
-
}).superRefine((v, ctx) => {
|
|
44195
|
-
if (v.type === "select" && v.options === void 0) ctx.addIssue({
|
|
44196
|
-
code: "custom",
|
|
44197
|
-
message: "a select variable needs options",
|
|
44198
|
-
path: ["options"]
|
|
44199
|
-
});
|
|
44200
|
-
if (v.default !== void 0 && variableValueError(v, v.default) !== null) ctx.addIssue({
|
|
44201
|
-
code: "custom",
|
|
44202
|
-
message: variableValueError(v, v.default) ?? "invalid default",
|
|
44203
|
-
path: ["default"]
|
|
44204
|
-
});
|
|
44205
|
-
});
|
|
44206
|
-
/** Why `value` is not a legal value for the variable, or null when it is. */
|
|
44207
|
-
function variableValueError(variable, value) {
|
|
44208
|
-
switch (variable.type) {
|
|
44209
|
-
case "string": return typeof value === "string" ? null : `variable "${variable.name}" must be a string`;
|
|
44210
|
-
case "number": return typeof value === "number" && Number.isFinite(value) ? null : `variable "${variable.name}" must be a number`;
|
|
44211
|
-
case "boolean": return typeof value === "boolean" ? null : `variable "${variable.name}" must be true or false`;
|
|
44212
|
-
case "select": return typeof value === "string" && (variable.options ?? []).includes(value) ? null : `variable "${variable.name}" must be one of ${(variable.options ?? []).join(", ")}`;
|
|
44213
|
-
}
|
|
44214
|
-
}
|
|
44215
|
-
var ActionSourceKindSchema = _enum(["internal", "addon"]);
|
|
44216
|
-
function isInternalActionId(actionId) {
|
|
44217
|
-
return actionId.startsWith("internal:") && actionId.length > 9;
|
|
44218
|
-
}
|
|
44219
|
-
/** The addon behind a `<addonId>:<localId>` id, or null for anything else (internal included). */
|
|
44220
|
-
function addonIdOfActionId(actionId) {
|
|
44221
|
-
if (isInternalActionId(actionId)) return null;
|
|
44222
|
-
const at = actionId.indexOf(":");
|
|
44223
|
-
return at > 0 && at < actionId.length - 1 ? actionId.slice(0, at) : null;
|
|
44224
|
-
}
|
|
44225
|
-
var ActionStatusSchema = object({
|
|
44226
|
-
isRunning: boolean(),
|
|
44227
|
-
/** Ms epoch the latest run STARTED; null when it never ran. */
|
|
44228
|
-
lastRunAt: number().nullable(),
|
|
44229
|
-
/** The latest run's failure; null on success or when it never ran. */
|
|
44230
|
-
lastError: string().nullable()
|
|
44231
|
-
});
|
|
44232
|
-
var ActionEntrySchema = object({
|
|
44233
|
-
/** `internal:<uuid>` or `<addonId>:<localId>`. */
|
|
44234
|
-
id: string().min(3),
|
|
44235
|
-
name: string().min(1).max(120),
|
|
44236
|
-
/** The addon that declared it; `core-blocks` for an internal one. */
|
|
44237
|
-
addonId: string().min(1),
|
|
44238
|
-
source: ActionSourceKindSchema,
|
|
44239
|
-
/** An addon-declared entry is edited where it was declared. */
|
|
44240
|
-
readOnly: boolean(),
|
|
44241
|
-
/** Internal only: cap and wait steps. No action-in-action, so no cycles. */
|
|
44242
|
-
steps: array(ActionStepSchema).min(1).max(50).optional(),
|
|
44243
|
-
variables: array(ActionVariableSchema).max(20).optional(),
|
|
44244
|
-
status: ActionStatusSchema
|
|
44245
|
-
}).superRefine((entry, ctx) => {
|
|
44246
|
-
if (entry.source === "internal") {
|
|
44247
|
-
if (!isInternalActionId(entry.id)) ctx.addIssue({
|
|
44248
|
-
code: "custom",
|
|
44249
|
-
message: "an internal action id is internal:<uuid>",
|
|
44250
|
-
path: ["id"]
|
|
44251
|
-
});
|
|
44252
|
-
return;
|
|
44253
|
-
}
|
|
44254
|
-
if (entry.steps !== void 0) ctx.addIssue({
|
|
44255
|
-
code: "custom",
|
|
44256
|
-
message: "only an internal action carries steps",
|
|
44257
|
-
path: ["steps"]
|
|
44258
|
-
});
|
|
44259
|
-
if (!entry.readOnly) ctx.addIssue({
|
|
44260
|
-
code: "custom",
|
|
44261
|
-
message: "an addon action is read-only here",
|
|
44262
|
-
path: ["readOnly"]
|
|
44263
|
-
});
|
|
44264
|
-
if (addonIdOfActionId(entry.id) === null) ctx.addIssue({
|
|
44265
|
-
code: "custom",
|
|
44266
|
-
message: "an addon action id is <addonId>:<localId>",
|
|
44267
|
-
path: ["id"]
|
|
44268
|
-
});
|
|
44269
|
-
});
|
|
44270
|
-
/** What an operator writes for an internal action. */
|
|
44271
|
-
var ActionInputSchema = object({
|
|
44272
|
-
name: string().min(1).max(120),
|
|
44273
|
-
steps: array(ActionStepSchema).min(1).max(50),
|
|
44274
|
-
variables: array(ActionVariableSchema).max(20).optional()
|
|
44275
|
-
});
|
|
44276
|
-
/** Who started a run. Absent = the operator pressed it. */
|
|
44277
|
-
var ActionRunOriginSchema = object({
|
|
44278
|
-
/** The automation block whose step started it. */
|
|
44279
|
-
blockId: string().min(1).optional() });
|
|
44280
|
-
/**
|
|
44281
|
-
* `started` = the caller did not ask to wait. `timed-out` = the run reached the
|
|
44282
|
-
* ceiling (`ACTION_RUN_MAX_MS`) and was stopped; it is never a `ran`.
|
|
44283
|
-
*/
|
|
44284
|
-
var ActionRunOutcomeSchema = union([
|
|
44285
|
-
AutomationRunOutcomeSchema,
|
|
44286
|
-
literal("started"),
|
|
44287
|
-
literal("timed-out")
|
|
44288
|
-
]);
|
|
44289
|
-
var ActionRunResultSchema = object({
|
|
44290
|
-
runId: string().min(1),
|
|
44291
|
-
outcome: ActionRunOutcomeSchema,
|
|
44292
|
-
/** Why it did not run, or what failed. */
|
|
44293
|
-
message: string().optional()
|
|
44294
|
-
});
|
|
44295
|
-
_enum([
|
|
44296
|
-
"not-found",
|
|
44297
|
-
"read-only",
|
|
44298
|
-
"invalid-variables",
|
|
44299
|
-
"invalid-steps",
|
|
44300
|
-
"not-linked",
|
|
44301
|
-
"busy"
|
|
44302
|
-
]);
|
|
44303
|
-
object({
|
|
44304
|
-
actionId: string(),
|
|
44305
|
-
runId: string(),
|
|
44306
|
-
isRunning: boolean(),
|
|
44307
|
-
/** Set when the run ended. */
|
|
44308
|
-
outcome: AutomationRunOutcomeSchema.optional(),
|
|
44309
|
-
lastRunAt: number().nullable(),
|
|
44310
|
-
lastError: string().nullable()
|
|
44311
|
-
});
|
|
44312
|
-
/** A bare number accepted as a base unit — the save succeeded, say so. */
|
|
44313
|
-
var UnitWarningSchema = object({
|
|
44314
|
-
/** Where in the saved record, e.g. `conditions.children.0` or `steps.2.args.grams`. */
|
|
44315
|
-
path: string(),
|
|
44316
|
-
deviceId: number().int().optional(),
|
|
44317
|
-
field: string(),
|
|
44318
|
-
value: number(),
|
|
44319
|
-
assumedUnit: string(),
|
|
44320
|
-
message: string()
|
|
44321
|
-
});
|
|
44322
|
-
/**
|
|
44323
|
-
* notification-output — canonical, capability-gated notification delivery.
|
|
44324
|
-
*
|
|
44325
|
-
* Apprise-derived model (see
|
|
44326
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
44327
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
44328
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
44329
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
44330
|
-
* message to what the kind supports — callers never special-case a service.
|
|
44331
|
-
*
|
|
44332
|
-
* DESIGN DECISIONS (locked):
|
|
44333
|
-
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
44334
|
-
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
44335
|
-
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
44336
|
-
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
44337
|
-
* alternative would fork the UI per addon and cannot host the
|
|
44338
|
-
* discovery→adopt flow.
|
|
44339
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
44340
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
44341
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
44342
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
44343
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
44344
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
44345
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
44346
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
44347
|
-
* base64 fallback needed.
|
|
44348
|
-
*
|
|
44349
|
-
* TODO (deferred, closed-set change — separate decision): add
|
|
44350
|
-
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
44351
|
-
* admin "Integrations" page.
|
|
44352
|
-
*/
|
|
44353
|
-
/**
|
|
44354
|
-
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
44355
|
-
* adapter picks what it supports and the degrade engine filters the rest.
|
|
44356
|
-
*/
|
|
44357
|
-
var AttachmentMediaTypeSchema = _enum([
|
|
44358
|
-
"image",
|
|
44359
|
-
"video",
|
|
44360
|
-
"gif",
|
|
44361
|
-
"audio",
|
|
44362
|
-
"icon"
|
|
44363
|
-
]);
|
|
44364
|
-
/**
|
|
44365
|
-
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
44366
|
-
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
44367
|
-
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
44368
|
-
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
44369
|
-
*/
|
|
44370
|
-
var AttachmentSchema = object({
|
|
44371
|
-
mediaType: AttachmentMediaTypeSchema,
|
|
44372
|
-
url: string().optional(),
|
|
44373
|
-
bytes: _instanceof(Uint8Array).optional(),
|
|
44374
|
-
mime: string().optional(),
|
|
44375
|
-
name: string().optional()
|
|
44376
|
-
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
44377
|
-
var NotificationFormatSchema = _enum([
|
|
44378
|
-
"text",
|
|
44379
|
-
"markdown",
|
|
44380
|
-
"html"
|
|
44381
|
-
]);
|
|
44382
|
-
/**
|
|
44383
|
-
* The CLOSED icon vocabulary an action button may use.
|
|
44384
|
-
*
|
|
44385
|
-
* A closed set, not a free string, and that is the whole point: an arbitrary
|
|
44386
|
-
* icon name is one that ntfy renders, zentik silently drops, and nobody
|
|
44387
|
-
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
44388
|
-
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
44389
|
-
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
44390
|
-
*
|
|
44391
|
-
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
44392
|
-
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
44393
|
-
* differently.
|
|
44394
|
-
*
|
|
44395
|
-
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
44396
|
-
*
|
|
44397
|
-
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
44398
|
-
* the whole set onto its own renderer's vocabulary through a
|
|
44399
|
-
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
44400
|
-
* fallback, so adding a member here fails every adapter's build until someone
|
|
44401
|
-
* decides its glyph, which is the only place that decision can be made
|
|
44402
|
-
* honestly.
|
|
44403
|
-
*
|
|
44404
|
-
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
44405
|
-
* `disarm` straight through; iOS feeds that string to
|
|
44406
|
-
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
44407
|
-
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
44408
|
-
* mapping, and "the field is documented" is not "the value renders".
|
|
44409
|
-
*
|
|
44410
|
-
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
44411
|
-
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
44412
|
-
* so an addon that emits a token the running hub does not know does not lose an
|
|
44413
|
-
* icon — its whole `send` fails Zod validation and the notification never
|
|
44414
|
-
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
44415
|
-
*/
|
|
44416
|
-
var NotificationActionIconSchema = _enum([
|
|
44417
|
-
"acknowledge",
|
|
44418
|
-
"dismiss",
|
|
44419
|
-
"silence",
|
|
44420
|
-
"snooze",
|
|
44421
|
-
"view",
|
|
44422
|
-
"play",
|
|
44423
|
-
"open",
|
|
44424
|
-
"close",
|
|
44425
|
-
"lock",
|
|
44426
|
-
"unlock",
|
|
44427
|
-
"arm",
|
|
44428
|
-
"arm-home",
|
|
44429
|
-
"arm-away",
|
|
44430
|
-
"arm-night",
|
|
44431
|
-
"disarm",
|
|
44432
|
-
"light",
|
|
44433
|
-
"alert",
|
|
44434
|
-
"camera"
|
|
44435
|
-
]);
|
|
44436
|
-
/** A single tap-through action button. */
|
|
44437
|
-
var NotificationActionSchema = object({
|
|
44438
|
-
id: string(),
|
|
44439
|
-
label: string(),
|
|
44440
|
-
url: string().optional(),
|
|
44441
|
-
/** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
|
|
44442
|
-
icon: NotificationActionIconSchema.optional(),
|
|
44443
|
-
/**
|
|
44444
|
-
* Renders in a warning style where the notifier supports it.
|
|
44445
|
-
*
|
|
44446
|
-
* A HINT, never a gate. The callback's authority is its token and nothing
|
|
44447
|
-
* else — see `notification-center/action-token.ts` for what that does and
|
|
44448
|
-
* does not buy.
|
|
44449
|
-
*/
|
|
44450
|
-
destructive: boolean().optional(),
|
|
44451
|
-
/**
|
|
44452
|
-
* How the tap should REACH the url.
|
|
44453
|
-
*
|
|
44454
|
-
* `navigate` (absent, and every button authored before this field) opens it:
|
|
44455
|
-
* the phone leaves the notification and shows whatever the callback returns.
|
|
44456
|
-
* That is right for a button whose answer the operator wants to read.
|
|
44457
|
-
*
|
|
44458
|
-
* `background` fires it as a POST and stays put. It exists for the buttons
|
|
44459
|
-
* whose whole point is not to interrupt — "silence this for 30 minutes" is
|
|
44460
|
-
* an answer to the notification, and being thrown into a browser tab to
|
|
44461
|
-
* confirm it costs more attention than the notification did. A backend that
|
|
44462
|
-
* cannot do a background call renders it as an ordinary link (the adapters
|
|
44463
|
-
* fall back rather than dropping the button), so this is a preference, never
|
|
44464
|
-
* a requirement.
|
|
44465
|
-
*/
|
|
44466
|
-
mode: _enum(["navigate", "background"]).optional()
|
|
44467
|
-
});
|
|
44468
|
-
/** A delivery parameter value: what a notifier declared it takes. */
|
|
44469
|
-
var DeliveryParamValueSchema = union([
|
|
44470
|
-
string(),
|
|
44471
|
-
number(),
|
|
44472
|
-
boolean()
|
|
44473
|
-
]);
|
|
44474
|
-
/**
|
|
44475
|
-
* One extra delivery parameter a notifier KIND declares (D938). A rule that
|
|
44476
|
-
* addresses a target of that kind may set it; a kind that declares nothing is
|
|
44477
|
-
* never handed one. The admin UI derives its control from this descriptor —
|
|
44478
|
-
* no editor knows a service by name.
|
|
44479
|
-
*
|
|
44480
|
-
* Optional fields are `.optional()`, never `.default()` (a Zod default does not
|
|
44481
|
-
* run on the addon cap path).
|
|
44482
|
-
*/
|
|
44483
|
-
var DeliveryParamSchema = object({
|
|
44484
|
-
key: string().min(1),
|
|
44485
|
-
label: string(),
|
|
44486
|
-
/** i18n key of the label, resolved by the declaring addon's namespace. */
|
|
44487
|
-
labelKey: string().optional(),
|
|
44488
|
-
type: _enum([
|
|
44489
|
-
"enum",
|
|
44490
|
-
"number",
|
|
44491
|
-
"boolean",
|
|
44492
|
-
"string"
|
|
44493
|
-
]),
|
|
44494
|
-
/** `enum` only: the closed set of accepted values. */
|
|
44495
|
-
options: array(object({
|
|
44496
|
-
value: string(),
|
|
44497
|
-
label: string()
|
|
44498
|
-
})).optional(),
|
|
44499
|
-
/** `number` only. */
|
|
44500
|
-
min: number().optional(),
|
|
44501
|
-
max: number().optional(),
|
|
44502
|
-
/** What the notifier does when the rule sets nothing; shown as the placeholder. */
|
|
44503
|
-
default: DeliveryParamValueSchema.optional()
|
|
44504
|
-
});
|
|
44505
|
-
/**
|
|
44506
|
-
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
44507
|
-
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
44508
|
-
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
44509
|
-
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
44510
|
-
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
44511
|
-
* `priority` for that one target.
|
|
44512
|
-
*/
|
|
44513
|
-
var NotificationSchema = object({
|
|
44514
|
-
body: string(),
|
|
44515
|
-
title: string().optional(),
|
|
44516
|
-
format: NotificationFormatSchema.default("text"),
|
|
44517
|
-
priority: number().int().min(1).max(5).default(3),
|
|
44518
|
-
level: string().optional(),
|
|
44519
|
-
attachments: array(AttachmentSchema).optional(),
|
|
44520
|
-
clickUrl: string().optional(),
|
|
44521
|
-
actions: array(NotificationActionSchema).optional(),
|
|
44522
|
-
sound: string().optional(),
|
|
44523
|
-
ttl: number().optional(),
|
|
44524
|
-
tag: string().optional(),
|
|
44525
|
-
deviceId: number().optional(),
|
|
44526
|
-
eventId: string().optional(),
|
|
44527
|
-
metadata: record(string(), unknown()).optional(),
|
|
44528
|
-
/**
|
|
44529
|
-
* Values for the parameters the target's kind DECLARES in
|
|
44530
|
-
* {@link TargetKindSchema} `deliveryParams`. Already validated against the
|
|
44531
|
-
* declaration by the sender; a notifier reads only the keys it declared.
|
|
44532
|
-
*/
|
|
44533
|
-
delivery: record(string(), DeliveryParamValueSchema).optional()
|
|
44534
|
-
});
|
|
44535
|
-
/** One declared native severity/priority level for a kind. */
|
|
44536
|
-
var TargetKindLevelSchema = object({
|
|
44537
|
-
id: string(),
|
|
44538
|
-
label: string(),
|
|
44539
|
-
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
44540
|
-
ordinal: number().int().min(1).max(5).nullable(),
|
|
44541
|
-
flags: object({
|
|
44542
|
-
critical: boolean().optional(),
|
|
44543
|
-
silent: boolean().optional(),
|
|
44544
|
-
noPush: boolean().optional()
|
|
44545
|
-
}).optional(),
|
|
44546
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
44547
|
-
requires: array(string()).optional(),
|
|
44548
|
-
description: string().optional()
|
|
44535
|
+
* The parameters the step SENT, after `{{vars.x}}` substitution — what the
|
|
44536
|
+
* device was actually asked. Bounded like trigger `vars`; a secret parameter
|
|
44537
|
+
* is shown as {@link REDACTED_ARG}. Absent on traces written before it existed.
|
|
44538
|
+
*/
|
|
44539
|
+
args: record(string(), TraceValueSchema).optional(),
|
|
44540
|
+
/** `empty`: the target resolved to no device, so nothing was done — never silently `ok`. */
|
|
44541
|
+
outcome: _enum([
|
|
44542
|
+
"ok",
|
|
44543
|
+
"error",
|
|
44544
|
+
"not-run",
|
|
44545
|
+
"empty"
|
|
44546
|
+
]),
|
|
44547
|
+
message: string().optional()
|
|
44549
44548
|
});
|
|
44550
|
-
|
|
44551
|
-
|
|
44552
|
-
|
|
44553
|
-
|
|
44554
|
-
|
|
44555
|
-
|
|
44556
|
-
|
|
44557
|
-
|
|
44558
|
-
|
|
44559
|
-
|
|
44560
|
-
|
|
44561
|
-
|
|
44562
|
-
|
|
44563
|
-
actions: number().int().nonnegative(),
|
|
44549
|
+
var AutomationRunTraceSchema = object({
|
|
44550
|
+
runId: string().min(1),
|
|
44551
|
+
startedAt: number(),
|
|
44552
|
+
endedAt: number(),
|
|
44553
|
+
trigger: AutomationTriggerTraceSchema,
|
|
44554
|
+
conditions: array(AutomationConditionTraceNodeSchema),
|
|
44555
|
+
verdict: AutomationRunVerdictSchema.optional(),
|
|
44556
|
+
steps: array(AutomationStepTraceSchema),
|
|
44557
|
+
outcome: AutomationRunOutcomeSchema,
|
|
44558
|
+
/** How many identical consecutive skips this trace stands for (>= 1). */
|
|
44559
|
+
repeat: number().int().min(1),
|
|
44560
|
+
/** When the latest of those repeats happened. */
|
|
44561
|
+
lastAt: number(),
|
|
44564
44562
|
/**
|
|
44565
|
-
*
|
|
44566
|
-
*
|
|
44567
|
-
*
|
|
44568
|
-
* run on the addon cap path — three production failures in one day taught
|
|
44569
|
-
* this repo that once. Absent is read as false by the degrade engine, which
|
|
44570
|
-
* is the safe direction: an icon that is not rendered costs nothing, an icon
|
|
44571
|
-
* assumed and dropped costs the operator's trust in the field.
|
|
44563
|
+
* A scheduler point's own outcome (D983). `outcome` carries the closest
|
|
44564
|
+
* automation outcome so a reader that does not know schedulers still reads
|
|
44565
|
+
* the trace; this field says exactly what happened.
|
|
44572
44566
|
*/
|
|
44573
|
-
|
|
44574
|
-
levels: array(TargetKindLevelSchema),
|
|
44575
|
-
format: array(NotificationFormatSchema),
|
|
44576
|
-
clickUrl: boolean(),
|
|
44577
|
-
sound: boolean(),
|
|
44578
|
-
ttl: boolean(),
|
|
44579
|
-
bodyMaxLen: number().int().positive()
|
|
44567
|
+
scheduler: SchedulerOutcomeSchema.optional()
|
|
44580
44568
|
});
|
|
44581
44569
|
/**
|
|
44582
|
-
*
|
|
44583
|
-
*
|
|
44584
|
-
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
44585
|
-
* the union is large and not meant for runtime validation here; the exported
|
|
44586
|
-
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
44570
|
+
* What the hub's `runs` ledger holds for one owner (`automation:<blockId>` or
|
|
44571
|
+
* `action:<actionId>`): the cooldown stamp and the trace ring.
|
|
44587
44572
|
*/
|
|
44588
|
-
var
|
|
44589
|
-
|
|
44590
|
-
|
|
44591
|
-
|
|
44592
|
-
icon: string(),
|
|
44593
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
44594
|
-
addonId: string(),
|
|
44595
|
-
/**
|
|
44596
|
-
* URL of the kind's bundled BRAND icon, served by the providing addon over
|
|
44597
|
-
* its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
|
|
44598
|
-
* when the addon bundles no icon for that kind — the client then falls back
|
|
44599
|
-
* to a neutral glyph rather than rendering the raw `icon` NAME as text.
|
|
44600
|
-
*
|
|
44601
|
-
* Root-relative on purpose: it resolves against whatever origin serves a web
|
|
44602
|
-
* client, and a native client joins it onto its own hub base.
|
|
44603
|
-
*
|
|
44604
|
-
* DECLARED here deliberately. It used to travel as an undeclared passthrough
|
|
44605
|
-
* field that survived only because the runtime cap-router forwards provider
|
|
44606
|
-
* output verbatim — so every consumer had to re-declare it by hand to stop
|
|
44607
|
-
* its own Zod parse from stripping it, and the whole arrangement would have
|
|
44608
|
-
* broken silently the moment output validation was tightened anywhere.
|
|
44609
|
-
*/
|
|
44610
|
-
iconUrl: string().optional(),
|
|
44611
|
-
/**
|
|
44612
|
-
* Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
|
|
44613
|
-
*
|
|
44614
|
-
* The server knows this and therefore says it, because the client cannot
|
|
44615
|
-
* safely guess: a React-Native client renders SVG and raster through two
|
|
44616
|
-
* DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
|
|
44617
|
-
* not decode SVG on iOS/Android), so without this it silently fell back to a
|
|
44618
|
-
* placeholder glyph for every vector icon while the web build looked fine.
|
|
44619
|
-
*
|
|
44620
|
-
* Absent when {@link iconUrl} is absent, or for a legacy provider that has
|
|
44621
|
-
* not been updated — a client that cannot determine the type should prefer
|
|
44622
|
-
* its raster path, which is the safe default for an unknown image.
|
|
44623
|
-
*/
|
|
44624
|
-
iconMediaType: string().optional(),
|
|
44625
|
-
configSchema: ConfigSchemaPassthrough$4,
|
|
44626
|
-
/**
|
|
44627
|
-
* The config keys that decide WHERE this kind's secrets are sent (server,
|
|
44628
|
-
* base URL, instance, chat, recipient). A save that changes any of them
|
|
44629
|
-
* while leaving a secret redacted is refused by the provider (D634), so an
|
|
44630
|
-
* editor uses this to ask for the secret on exactly those edits instead of
|
|
44631
|
-
* on every edit.
|
|
44632
|
-
*
|
|
44633
|
-
* Optional: absent from a provider that holds no secret (the Home Assistant
|
|
44634
|
-
* kinds) and from a provider older than this field — an editor that finds
|
|
44635
|
-
* it absent must assume ANY edit may need the secret.
|
|
44636
|
-
*/
|
|
44637
|
-
destinationKeys: array(string()).optional(),
|
|
44638
|
-
supportsDiscovery: boolean(),
|
|
44639
|
-
/**
|
|
44640
|
-
* Extra delivery parameters a rule may set for a target of this kind (D938).
|
|
44641
|
-
* Absent = none; the rule editor then offers nothing.
|
|
44642
|
-
*/
|
|
44643
|
-
deliveryParams: array(DeliveryParamSchema).optional(),
|
|
44644
|
-
caps: TargetKindCapsSchema
|
|
44573
|
+
var AutomationStateDocSchema = object({
|
|
44574
|
+
version: literal(1),
|
|
44575
|
+
lastRunStartedAt: number().nullable(),
|
|
44576
|
+
traces: array(AutomationRunTraceSchema)
|
|
44645
44577
|
});
|
|
44646
44578
|
/**
|
|
44647
|
-
*
|
|
44648
|
-
*
|
|
44649
|
-
*
|
|
44579
|
+
* Actions — named, runnable things an operator (or an automation) can start,
|
|
44580
|
+
* declared as LIST ENTRIES, never as devices.
|
|
44581
|
+
*
|
|
44582
|
+
* An entry is either **internal** (a short list of cap/wait steps kept in the
|
|
44583
|
+
* hub's `actions` record kind) or declared by an addon through the
|
|
44584
|
+
* `action-source` collection (a Home Assistant script, a scene …). The one
|
|
44585
|
+
* surface the UI and automations talk to is the `actions` cap; it keeps no
|
|
44586
|
+
* catalog of its own (D3) — every `list` asks the providers live.
|
|
44587
|
+
*
|
|
44588
|
+
* This file is the data half: the entry schema, the variables an entry may
|
|
44589
|
+
* declare, and the pure resolution of the values a run was given. It holds no
|
|
44590
|
+
* runtime.
|
|
44650
44591
|
*/
|
|
44651
|
-
|
|
44652
|
-
|
|
44653
|
-
|
|
44654
|
-
|
|
44655
|
-
|
|
44656
|
-
|
|
44657
|
-
|
|
44592
|
+
/** What a variable's value is. `select` takes one of `options`. */
|
|
44593
|
+
var ActionVariableTypeSchema = _enum([
|
|
44594
|
+
"string",
|
|
44595
|
+
"number",
|
|
44596
|
+
"boolean",
|
|
44597
|
+
"select"
|
|
44598
|
+
]);
|
|
44599
|
+
var ACTION_VARIABLE_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
44600
|
+
var ActionVariableValueSchema = union([
|
|
44601
|
+
string(),
|
|
44602
|
+
number(),
|
|
44603
|
+
boolean()
|
|
44604
|
+
]);
|
|
44605
|
+
/**
|
|
44606
|
+
* One declared variable. Steps reference it as `{ $var: 'name' }` (the whole
|
|
44607
|
+
* value) or `{{vars.name}}` (inside a string) in their args.
|
|
44608
|
+
*/
|
|
44609
|
+
var ActionVariableSchema = object({
|
|
44610
|
+
name: string().regex(ACTION_VARIABLE_NAME_RE),
|
|
44611
|
+
label: string().min(1).max(120).optional(),
|
|
44612
|
+
type: ActionVariableTypeSchema,
|
|
44613
|
+
required: boolean().optional(),
|
|
44614
|
+
default: ActionVariableValueSchema.optional(),
|
|
44615
|
+
/** The allowed values of a `select`. */
|
|
44616
|
+
options: array(string().min(1)).min(1).optional()
|
|
44617
|
+
}).superRefine((v, ctx) => {
|
|
44618
|
+
if (v.type === "select" && v.options === void 0) ctx.addIssue({
|
|
44619
|
+
code: "custom",
|
|
44620
|
+
message: "a select variable needs options",
|
|
44621
|
+
path: ["options"]
|
|
44622
|
+
});
|
|
44623
|
+
if (v.default !== void 0 && variableValueError(v, v.default) !== null) ctx.addIssue({
|
|
44624
|
+
code: "custom",
|
|
44625
|
+
message: variableValueError(v, v.default) ?? "invalid default",
|
|
44626
|
+
path: ["default"]
|
|
44627
|
+
});
|
|
44658
44628
|
});
|
|
44659
|
-
/**
|
|
44660
|
-
|
|
44661
|
-
|
|
44662
|
-
|
|
44663
|
-
|
|
44629
|
+
/** Why `value` is not a legal value for the variable, or null when it is. */
|
|
44630
|
+
function variableValueError(variable, value) {
|
|
44631
|
+
switch (variable.type) {
|
|
44632
|
+
case "string": return typeof value === "string" ? null : `variable "${variable.name}" must be a string`;
|
|
44633
|
+
case "number": return typeof value === "number" && Number.isFinite(value) ? null : `variable "${variable.name}" must be a number`;
|
|
44634
|
+
case "boolean": return typeof value === "boolean" ? null : `variable "${variable.name}" must be true or false`;
|
|
44635
|
+
case "select": return typeof value === "string" && (variable.options ?? []).includes(value) ? null : `variable "${variable.name}" must be one of ${(variable.options ?? []).join(", ")}`;
|
|
44636
|
+
}
|
|
44637
|
+
}
|
|
44638
|
+
var ActionSourceKindSchema = _enum(["internal", "addon"]);
|
|
44639
|
+
function isInternalActionId(actionId) {
|
|
44640
|
+
return actionId.startsWith("internal:") && actionId.length > 9;
|
|
44641
|
+
}
|
|
44642
|
+
/** The addon behind a `<addonId>:<localId>` id, or null for anything else (internal included). */
|
|
44643
|
+
function addonIdOfActionId(actionId) {
|
|
44644
|
+
if (isInternalActionId(actionId)) return null;
|
|
44645
|
+
const at = actionId.indexOf(":");
|
|
44646
|
+
return at > 0 && at < actionId.length - 1 ? actionId.slice(0, at) : null;
|
|
44647
|
+
}
|
|
44648
|
+
var ActionStatusSchema = object({
|
|
44649
|
+
isRunning: boolean(),
|
|
44650
|
+
/** Ms epoch the latest run STARTED; null when it never ran. */
|
|
44651
|
+
lastRunAt: number().nullable(),
|
|
44652
|
+
/** The latest run's failure; null on success or when it never ran. */
|
|
44653
|
+
lastError: string().nullable()
|
|
44664
44654
|
});
|
|
44665
|
-
|
|
44666
|
-
|
|
44667
|
-
|
|
44668
|
-
|
|
44669
|
-
|
|
44670
|
-
|
|
44671
|
-
|
|
44672
|
-
|
|
44655
|
+
var ActionEntrySchema = object({
|
|
44656
|
+
/** `internal:<uuid>` or `<addonId>:<localId>`. */
|
|
44657
|
+
id: string().min(3),
|
|
44658
|
+
name: string().min(1).max(120),
|
|
44659
|
+
/** The addon that declared it; `core-blocks` for an internal one. */
|
|
44660
|
+
addonId: string().min(1),
|
|
44661
|
+
source: ActionSourceKindSchema,
|
|
44662
|
+
/** An addon-declared entry is edited where it was declared. */
|
|
44663
|
+
readOnly: boolean(),
|
|
44664
|
+
/** Internal only: cap and wait steps. No action-in-action, so no cycles. */
|
|
44665
|
+
steps: array(ActionStepSchema).min(1).max(50).optional(),
|
|
44666
|
+
variables: array(ActionVariableSchema).max(20).optional(),
|
|
44667
|
+
status: ActionStatusSchema
|
|
44668
|
+
}).superRefine((entry, ctx) => {
|
|
44669
|
+
if (entry.source === "internal") {
|
|
44670
|
+
if (!isInternalActionId(entry.id)) ctx.addIssue({
|
|
44671
|
+
code: "custom",
|
|
44672
|
+
message: "an internal action id is internal:<uuid>",
|
|
44673
|
+
path: ["id"]
|
|
44674
|
+
});
|
|
44675
|
+
return;
|
|
44676
|
+
}
|
|
44677
|
+
if (entry.steps !== void 0) ctx.addIssue({
|
|
44678
|
+
code: "custom",
|
|
44679
|
+
message: "only an internal action carries steps",
|
|
44680
|
+
path: ["steps"]
|
|
44681
|
+
});
|
|
44682
|
+
if (!entry.readOnly) ctx.addIssue({
|
|
44683
|
+
code: "custom",
|
|
44684
|
+
message: "an addon action is read-only here",
|
|
44685
|
+
path: ["readOnly"]
|
|
44686
|
+
});
|
|
44687
|
+
if (addonIdOfActionId(entry.id) === null) ctx.addIssue({
|
|
44688
|
+
code: "custom",
|
|
44689
|
+
message: "an addon action id is <addonId>:<localId>",
|
|
44690
|
+
path: ["id"]
|
|
44691
|
+
});
|
|
44673
44692
|
});
|
|
44674
|
-
|
|
44675
|
-
|
|
44676
|
-
|
|
44677
|
-
|
|
44693
|
+
/** What an operator writes for an internal action. */
|
|
44694
|
+
var ActionInputSchema = object({
|
|
44695
|
+
name: string().min(1).max(120),
|
|
44696
|
+
steps: array(ActionStepSchema).min(1).max(50),
|
|
44697
|
+
variables: array(ActionVariableSchema).max(20).optional()
|
|
44678
44698
|
});
|
|
44679
|
-
/**
|
|
44680
|
-
var
|
|
44699
|
+
/** Who started a run. Absent = the operator pressed it. */
|
|
44700
|
+
var ActionRunOriginSchema = object({
|
|
44701
|
+
/** The automation block whose step started it. */
|
|
44702
|
+
blockId: string().min(1).optional() });
|
|
44681
44703
|
/**
|
|
44682
|
-
*
|
|
44683
|
-
* `
|
|
44704
|
+
* `started` = the caller did not ask to wait. `timed-out` = the run reached the
|
|
44705
|
+
* ceiling (`ACTION_RUN_MAX_MS`) and was stopped; it is never a `ran`.
|
|
44684
44706
|
*/
|
|
44685
|
-
var
|
|
44686
|
-
|
|
44687
|
-
|
|
44688
|
-
|
|
44689
|
-
|
|
44690
|
-
|
|
44707
|
+
var ActionRunOutcomeSchema = union([
|
|
44708
|
+
AutomationRunOutcomeSchema,
|
|
44709
|
+
literal("started"),
|
|
44710
|
+
literal("timed-out")
|
|
44711
|
+
]);
|
|
44712
|
+
var ActionRunResultSchema = object({
|
|
44713
|
+
runId: string().min(1),
|
|
44714
|
+
outcome: ActionRunOutcomeSchema,
|
|
44715
|
+
/** Why it did not run, or what failed. */
|
|
44716
|
+
message: string().optional()
|
|
44691
44717
|
});
|
|
44692
|
-
|
|
44693
|
-
|
|
44694
|
-
|
|
44695
|
-
|
|
44696
|
-
|
|
44697
|
-
|
|
44698
|
-
|
|
44699
|
-
|
|
44700
|
-
|
|
44701
|
-
|
|
44702
|
-
|
|
44703
|
-
|
|
44704
|
-
/**
|
|
44705
|
-
|
|
44706
|
-
|
|
44707
|
-
|
|
44708
|
-
|
|
44709
|
-
|
|
44710
|
-
|
|
44711
|
-
|
|
44712
|
-
|
|
44713
|
-
|
|
44714
|
-
|
|
44715
|
-
|
|
44716
|
-
|
|
44717
|
-
|
|
44718
|
-
}), TestResultSchema, {
|
|
44719
|
-
kind: "mutation",
|
|
44720
|
-
auth: "admin"
|
|
44721
|
-
}), method(object({
|
|
44722
|
-
target: TargetSchema,
|
|
44723
|
-
/**
|
|
44724
|
-
* Duplicate flow: create a NEW target id while copying secrets from an
|
|
44725
|
-
* existing row. The UI never holds the stored token; blank / redacted
|
|
44726
|
-
* password fields are restored from this source (D634 still applies if
|
|
44727
|
-
* destinations diverge without a re-typed secret).
|
|
44728
|
-
*/
|
|
44729
|
-
cloneSecretsFrom: string().optional()
|
|
44730
|
-
}), TargetSchema, {
|
|
44731
|
-
kind: "mutation",
|
|
44732
|
-
auth: "admin"
|
|
44733
|
-
}), method(object({ targetId: string() }), _void(), {
|
|
44734
|
-
kind: "mutation",
|
|
44735
|
-
auth: "admin"
|
|
44736
|
-
}), method(object({
|
|
44737
|
-
targetId: string(),
|
|
44738
|
-
enabled: boolean()
|
|
44739
|
-
}), _void(), {
|
|
44740
|
-
kind: "mutation",
|
|
44741
|
-
auth: "admin"
|
|
44718
|
+
_enum([
|
|
44719
|
+
"not-found",
|
|
44720
|
+
"read-only",
|
|
44721
|
+
"invalid-variables",
|
|
44722
|
+
"invalid-steps",
|
|
44723
|
+
"not-linked",
|
|
44724
|
+
"busy"
|
|
44725
|
+
]);
|
|
44726
|
+
object({
|
|
44727
|
+
actionId: string(),
|
|
44728
|
+
runId: string(),
|
|
44729
|
+
isRunning: boolean(),
|
|
44730
|
+
/** Set when the run ended. */
|
|
44731
|
+
outcome: AutomationRunOutcomeSchema.optional(),
|
|
44732
|
+
lastRunAt: number().nullable(),
|
|
44733
|
+
lastError: string().nullable()
|
|
44734
|
+
});
|
|
44735
|
+
/** A bare number accepted as a base unit — the save succeeded, say so. */
|
|
44736
|
+
var UnitWarningSchema = object({
|
|
44737
|
+
/** Where in the saved record, e.g. `conditions.children.0` or `steps.2.args.grams`. */
|
|
44738
|
+
path: string(),
|
|
44739
|
+
deviceId: number().int().optional(),
|
|
44740
|
+
field: string(),
|
|
44741
|
+
value: number(),
|
|
44742
|
+
assumedUnit: string(),
|
|
44743
|
+
message: string()
|
|
44742
44744
|
});
|
|
44743
44745
|
_enum([
|
|
44744
44746
|
"automation",
|
|
@@ -49279,45 +49281,6 @@ method(object({
|
|
|
49279
49281
|
kind: "mutation",
|
|
49280
49282
|
auth: "admin"
|
|
49281
49283
|
}), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
|
|
49282
|
-
var ConnectionTestOutcomeSchema = discriminatedUnion("outcome", [
|
|
49283
|
-
object({
|
|
49284
|
-
outcome: literal("validated"),
|
|
49285
|
-
/** Round-trip of the sign-in, when the provider measured it. */
|
|
49286
|
-
latencyMs: number().nonnegative().optional(),
|
|
49287
|
-
/** Optional human detail worth showing next to the tick
|
|
49288
|
-
* ("3 devices visible on this account"). */
|
|
49289
|
-
detail: string().optional()
|
|
49290
|
-
}).strict(),
|
|
49291
|
-
object({
|
|
49292
|
-
outcome: literal("rejected"),
|
|
49293
|
-
error: string()
|
|
49294
|
-
}).strict(),
|
|
49295
|
-
object({
|
|
49296
|
-
outcome: literal("inconclusive"),
|
|
49297
|
-
error: string()
|
|
49298
|
-
}).strict()
|
|
49299
|
-
]);
|
|
49300
|
-
var ConnectionTestInputSchema = object({
|
|
49301
|
-
/** Candidate integration settings, exactly as the create form collected them. */
|
|
49302
|
-
settings: record(string(), unknown()) });
|
|
49303
|
-
/**
|
|
49304
|
-
* What the provider's test actually DOES, so the UI can say it in words before
|
|
49305
|
-
* the operator presses the button ("Signs in to the Dreo cloud"). Purely
|
|
49306
|
-
* descriptive — it never changes routing.
|
|
49307
|
-
*/
|
|
49308
|
-
var ConnectionTestDescriptorSchema = object({ label: string() });
|
|
49309
|
-
var connectionTestCapability = {
|
|
49310
|
-
name: "connection-test",
|
|
49311
|
-
scope: "system",
|
|
49312
|
-
mode: "collection",
|
|
49313
|
-
methods: {
|
|
49314
|
-
testSettings: method(ConnectionTestInputSchema, ConnectionTestOutcomeSchema, {
|
|
49315
|
-
kind: "mutation",
|
|
49316
|
-
auth: "admin"
|
|
49317
|
-
}),
|
|
49318
|
-
describeTest: method(_void(), ConnectionTestDescriptorSchema, { auth: "admin" })
|
|
49319
|
-
}
|
|
49320
|
-
};
|
|
49321
49284
|
/**
|
|
49322
49285
|
* Upstream-system connectivity sensor — distinct from `device-status`,
|
|
49323
49286
|
* which is the kernel-managed online/offline flag for the device's
|
|
@@ -56492,10 +56455,9 @@ var AvailableIntegrationTypeSchema = object({
|
|
|
56492
56455
|
* locations" checkbox. Provider-declared in the addon manifest. */
|
|
56493
56456
|
supportsLocationImport: boolean(),
|
|
56494
56457
|
/**
|
|
56495
|
-
* True when this integration
|
|
56496
|
-
*
|
|
56497
|
-
*
|
|
56498
|
-
* rather than offering a button that always answers the same nonsense.
|
|
56458
|
+
* True when this integration's instances declare a Test (`integration-instances.describe().canTest`,
|
|
56459
|
+
* D1016). An integration that cannot be tested must say so up front rather than offering a
|
|
56460
|
+
* button that always answers the same nonsense.
|
|
56499
56461
|
*/
|
|
56500
56462
|
canTest: boolean(),
|
|
56501
56463
|
existingInstances: array(object({
|
|
@@ -56549,7 +56511,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
56549
56511
|
info: record(string(), unknown()).optional(),
|
|
56550
56512
|
/** `stableId` of the discovery candidate the form was seeded from (D984). */
|
|
56551
56513
|
originStableId: string().optional(),
|
|
56552
|
-
settings: record(string(), unknown()).optional()
|
|
56514
|
+
settings: record(string(), unknown()).optional(),
|
|
56515
|
+
/** The instance kind being created, for a provider with several; omitted = its only testable kind. */
|
|
56516
|
+
kind: string().min(1).optional()
|
|
56553
56517
|
});
|
|
56554
56518
|
var UpdateIntegrationInputSchema = object({
|
|
56555
56519
|
id: string(),
|
|
@@ -56575,13 +56539,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
56575
56539
|
}), method(object({ id: string() }), DeleteIntegrationResultSchema, {
|
|
56576
56540
|
kind: "mutation",
|
|
56577
56541
|
auth: "admin"
|
|
56578
|
-
}), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" })
|
|
56579
|
-
addonId: string(),
|
|
56580
|
-
settings: record(string(), unknown())
|
|
56581
|
-
}), TestConnectionResultSchema, {
|
|
56582
|
-
kind: "mutation",
|
|
56583
|
-
auth: "admin"
|
|
56584
|
-
});
|
|
56542
|
+
}), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" });
|
|
56585
56543
|
/**
|
|
56586
56544
|
* `integration-instances` - the connection of an addon that holds ONE or SEVERAL
|
|
56587
56545
|
* (an account, a relay, a destination) as typed records (D985, D986). The addon's
|
|
@@ -65324,13 +65282,6 @@ var AddBrokerInputSchema = object({
|
|
|
65324
65282
|
});
|
|
65325
65283
|
var AddBrokerResultSchema = object({ id: string() });
|
|
65326
65284
|
var IdInputSchema = object({ id: string() });
|
|
65327
|
-
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
65328
|
-
ok: literal(true),
|
|
65329
|
-
latencyMs: number()
|
|
65330
|
-
}), object({
|
|
65331
|
-
ok: literal(false),
|
|
65332
|
-
error: string()
|
|
65333
|
-
})]);
|
|
65334
65285
|
var StartEmbeddedInputSchema = object({
|
|
65335
65286
|
port: number().int().min(1).max(65535).default(1883),
|
|
65336
65287
|
/** Allow anonymous connect (no username/password). Default: false. */
|
|
@@ -65353,9 +65304,6 @@ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnection
|
|
|
65353
65304
|
}), method(IdInputSchema, _void(), {
|
|
65354
65305
|
kind: "mutation",
|
|
65355
65306
|
auth: "admin"
|
|
65356
|
-
}), method(IdInputSchema, TestResultSchema$1, {
|
|
65357
|
-
kind: "mutation",
|
|
65358
|
-
auth: "admin"
|
|
65359
65307
|
}), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, {
|
|
65360
65308
|
kind: "mutation",
|
|
65361
65309
|
auth: "admin"
|
|
@@ -78462,7 +78410,7 @@ var TrainingProviderTypeSchema = object({
|
|
|
78462
78410
|
label: string(),
|
|
78463
78411
|
/** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
|
|
78464
78412
|
iconAsset: string(),
|
|
78465
|
-
/** Owning `training-provider` addon
|
|
78413
|
+
/** Owning `training-provider` addon. */
|
|
78466
78414
|
addonId: string(),
|
|
78467
78415
|
/**
|
|
78468
78416
|
* Fields for one entry of this type (credentials + defaults). Absent on a
|
|
@@ -78507,36 +78455,6 @@ var TrainingProviderDescriptorSchema = object({
|
|
|
78507
78455
|
*/
|
|
78508
78456
|
formValues: record(string(), unknown()).optional()
|
|
78509
78457
|
});
|
|
78510
|
-
/**
|
|
78511
|
-
* Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
|
|
78512
|
-
* An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
|
|
78513
|
-
* `{ $secretClear: true }` clears it.
|
|
78514
|
-
*/
|
|
78515
|
-
var TrainingProviderUpdateEntryInputSchema = object({
|
|
78516
|
-
entryId: string().min(1),
|
|
78517
|
-
name: string().min(1),
|
|
78518
|
-
tokenId: string().optional(),
|
|
78519
|
-
tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
|
|
78520
|
-
environment: string().optional(),
|
|
78521
|
-
gpuType: string().optional(),
|
|
78522
|
-
region: string().optional(),
|
|
78523
|
-
costCapUsd: number().nonnegative().optional(),
|
|
78524
|
-
maxRuntimeSec: number().int().positive().optional(),
|
|
78525
|
-
failedDatasetGraceHours: number().nonnegative().optional()
|
|
78526
|
-
});
|
|
78527
|
-
var TrainingCredentialCheckSchema = object({
|
|
78528
|
-
ok: boolean(),
|
|
78529
|
-
/** Workspace / account name, when the provider says. */
|
|
78530
|
-
account: string().optional(),
|
|
78531
|
-
reason: _enum([
|
|
78532
|
-
"missing",
|
|
78533
|
-
"invalid",
|
|
78534
|
-
"forbidden",
|
|
78535
|
-
"network",
|
|
78536
|
-
"quota"
|
|
78537
|
-
]).optional(),
|
|
78538
|
-
detail: string().optional()
|
|
78539
|
-
});
|
|
78540
78458
|
var ProviderJobStateSchema = _enum([
|
|
78541
78459
|
"pending",
|
|
78542
78460
|
"starting",
|
|
@@ -78584,22 +78502,6 @@ var TrainingLogLineSchema = object({
|
|
|
78584
78502
|
text: string()
|
|
78585
78503
|
});
|
|
78586
78504
|
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
|
|
78587
|
-
typeId: string().min(1),
|
|
78588
|
-
name: string().min(1)
|
|
78589
|
-
}), object({ entryId: string() }), {
|
|
78590
|
-
kind: "mutation",
|
|
78591
|
-
auth: "admin"
|
|
78592
|
-
}), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
|
|
78593
|
-
kind: "mutation",
|
|
78594
|
-
auth: "admin"
|
|
78595
|
-
}), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
|
|
78596
|
-
kind: "mutation",
|
|
78597
|
-
auth: "admin"
|
|
78598
|
-
}), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
|
|
78599
|
-
kind: "mutation",
|
|
78600
|
-
auth: "admin",
|
|
78601
|
-
timeoutMs: 3e4
|
|
78602
|
-
}), method(object({
|
|
78603
78505
|
entryId: string().min(1),
|
|
78604
78506
|
gpuType: string(),
|
|
78605
78507
|
region: string(),
|
|
@@ -84052,20 +83954,6 @@ Object.freeze({
|
|
|
84052
83954
|
access: "view",
|
|
84053
83955
|
role: "admin"
|
|
84054
83956
|
},
|
|
84055
|
-
"connectionTest.describeTest": {
|
|
84056
|
-
capName: "connection-test",
|
|
84057
|
-
capScope: "system",
|
|
84058
|
-
addonId: null,
|
|
84059
|
-
access: "view",
|
|
84060
|
-
role: "admin"
|
|
84061
|
-
},
|
|
84062
|
-
"connectionTest.testSettings": {
|
|
84063
|
-
capName: "connection-test",
|
|
84064
|
-
capScope: "system",
|
|
84065
|
-
addonId: null,
|
|
84066
|
-
access: "create",
|
|
84067
|
-
role: "admin"
|
|
84068
|
-
},
|
|
84069
83957
|
"connectivity.getStatus": {
|
|
84070
83958
|
capName: "connectivity",
|
|
84071
83959
|
capScope: "device",
|
|
@@ -86432,13 +86320,6 @@ Object.freeze({
|
|
|
86432
86320
|
access: "view",
|
|
86433
86321
|
role: "admin"
|
|
86434
86322
|
},
|
|
86435
|
-
"integrations.testConnection": {
|
|
86436
|
-
capName: "integrations",
|
|
86437
|
-
capScope: "system",
|
|
86438
|
-
addonId: null,
|
|
86439
|
-
access: "create",
|
|
86440
|
-
role: "admin"
|
|
86441
|
-
},
|
|
86442
86323
|
"integrations.update": {
|
|
86443
86324
|
capName: "integrations",
|
|
86444
86325
|
capScope: "system",
|
|
@@ -87671,13 +87552,6 @@ Object.freeze({
|
|
|
87671
87552
|
access: "create",
|
|
87672
87553
|
role: "admin"
|
|
87673
87554
|
},
|
|
87674
|
-
"mqttBroker.testConnection": {
|
|
87675
|
-
capName: "mqtt-broker",
|
|
87676
|
-
capScope: "system",
|
|
87677
|
-
addonId: null,
|
|
87678
|
-
access: "create",
|
|
87679
|
-
role: "admin"
|
|
87680
|
-
},
|
|
87681
87555
|
"nativeObjectDetection.getOptions": {
|
|
87682
87556
|
capName: "native-object-detection",
|
|
87683
87557
|
capScope: "device",
|
|
@@ -92508,20 +92382,6 @@ Object.freeze({
|
|
|
92508
92382
|
access: "create",
|
|
92509
92383
|
role: "admin"
|
|
92510
92384
|
},
|
|
92511
|
-
"trainingProvider.createEntry": {
|
|
92512
|
-
capName: "training-provider",
|
|
92513
|
-
capScope: "system",
|
|
92514
|
-
addonId: null,
|
|
92515
|
-
access: "create",
|
|
92516
|
-
role: "admin"
|
|
92517
|
-
},
|
|
92518
|
-
"trainingProvider.deleteEntry": {
|
|
92519
|
-
capName: "training-provider",
|
|
92520
|
-
capScope: "system",
|
|
92521
|
-
addonId: null,
|
|
92522
|
-
access: "delete",
|
|
92523
|
-
role: "admin"
|
|
92524
|
-
},
|
|
92525
92385
|
"trainingProvider.describe": {
|
|
92526
92386
|
capName: "training-provider",
|
|
92527
92387
|
capScope: "system",
|
|
@@ -92592,13 +92452,6 @@ Object.freeze({
|
|
|
92592
92452
|
access: "create",
|
|
92593
92453
|
role: "admin"
|
|
92594
92454
|
},
|
|
92595
|
-
"trainingProvider.updateEntry": {
|
|
92596
|
-
capName: "training-provider",
|
|
92597
|
-
capScope: "system",
|
|
92598
|
-
addonId: null,
|
|
92599
|
-
access: "create",
|
|
92600
|
-
role: "admin"
|
|
92601
|
-
},
|
|
92602
92455
|
"trainingProvider.uploadDataset": {
|
|
92603
92456
|
capName: "training-provider",
|
|
92604
92457
|
capScope: "system",
|
|
@@ -92606,13 +92459,6 @@ Object.freeze({
|
|
|
92606
92459
|
access: "create",
|
|
92607
92460
|
role: "admin"
|
|
92608
92461
|
},
|
|
92609
|
-
"trainingProvider.validateCredentials": {
|
|
92610
|
-
capName: "training-provider",
|
|
92611
|
-
capScope: "system",
|
|
92612
|
-
addonId: null,
|
|
92613
|
-
access: "create",
|
|
92614
|
-
role: "admin"
|
|
92615
|
-
},
|
|
92616
92462
|
"turnProvider.getTurnServers": {
|
|
92617
92463
|
capName: "turn-provider",
|
|
92618
92464
|
capScope: "system",
|
|
@@ -122254,6 +122100,7 @@ function settingsReadOf(resolved) {
|
|
|
122254
122100
|
};
|
|
122255
122101
|
}
|
|
122256
122102
|
function buildHomematicInstances(records, deps) {
|
|
122103
|
+
const handle = records.kind(homematicConnectionsEntryKind);
|
|
122257
122104
|
return new RecordIntegrationInstances(records, homematicConnectionsEntryKind, {
|
|
122258
122105
|
description: {
|
|
122259
122106
|
role: "devices",
|
|
@@ -122263,12 +122110,33 @@ function buildHomematicInstances(records, deps) {
|
|
|
122263
122110
|
},
|
|
122264
122111
|
instanceMode: "multiple",
|
|
122265
122112
|
kind: "connection",
|
|
122266
|
-
canTest:
|
|
122113
|
+
canTest: true
|
|
122267
122114
|
},
|
|
122268
122115
|
formSchema: () => buildConnectionFormSchema(),
|
|
122269
122116
|
initialBody: (name) => ({ name }),
|
|
122270
122117
|
configured: (body) => (body.host ?? "").trim().length > 0,
|
|
122271
|
-
onChanged: () => deps.onChanged()
|
|
122118
|
+
onChanged: () => deps.onChanged(),
|
|
122119
|
+
test: async ({ id, values }) => {
|
|
122120
|
+
const stored = id === null ? null : (await handle.getResolved(id))?.data ?? null;
|
|
122121
|
+
const typed = values["password"];
|
|
122122
|
+
const password = typeof typed === "string" && typed !== "" && typed !== "__camstack_redacted__" ? typed : stored?.password ?? "";
|
|
122123
|
+
const outcome = await deps.tester.testSettings({ settings: {
|
|
122124
|
+
...stored === null ? {} : connectionSettingsOf(stored),
|
|
122125
|
+
...values,
|
|
122126
|
+
password
|
|
122127
|
+
} });
|
|
122128
|
+
if (outcome.outcome === "validated") return {
|
|
122129
|
+
success: true,
|
|
122130
|
+
status: "validated",
|
|
122131
|
+
...outcome.latencyMs !== void 0 ? { latencyMs: outcome.latencyMs } : {},
|
|
122132
|
+
...outcome.detail !== void 0 ? { detail: outcome.detail } : {}
|
|
122133
|
+
};
|
|
122134
|
+
return {
|
|
122135
|
+
success: false,
|
|
122136
|
+
status: outcome.outcome,
|
|
122137
|
+
error: outcome.error
|
|
122138
|
+
};
|
|
122139
|
+
}
|
|
122272
122140
|
});
|
|
122273
122141
|
}
|
|
122274
122142
|
/** The ONE reader of a CCU's connection: the integration's record, never the legacy rows. */
|
|
@@ -125610,7 +125478,6 @@ var HmClientRegistry = class {
|
|
|
125610
125478
|
};
|
|
125611
125479
|
//#endregion
|
|
125612
125480
|
//#region src/homematic-connection-test.ts
|
|
125613
|
-
var TEST_LABEL = "Asks each enabled XML-RPC interface of the CCU for its methods, and signs in to the WebUI when credentials are set";
|
|
125614
125481
|
/** How long one request to the CCU may take before the test gives up on it. */
|
|
125615
125482
|
var PROBE_TIMEOUT_MS = 5e3;
|
|
125616
125483
|
/** The ports the wrapped library binds each interface on (plain, TLS) and the path it serves. */
|
|
@@ -125764,65 +125631,62 @@ function describeSuccess(result) {
|
|
|
125764
125631
|
}
|
|
125765
125632
|
function buildHomematicConnectionTestProvider(deps) {
|
|
125766
125633
|
const { logger, probe = probeCcu } = deps;
|
|
125767
|
-
return {
|
|
125768
|
-
|
|
125769
|
-
|
|
125770
|
-
|
|
125771
|
-
|
|
125772
|
-
|
|
125773
|
-
|
|
125774
|
-
|
|
125775
|
-
|
|
125776
|
-
|
|
125777
|
-
|
|
125778
|
-
|
|
125779
|
-
|
|
125780
|
-
|
|
125781
|
-
|
|
125782
|
-
|
|
125634
|
+
return { testSettings: async ({ settings }) => {
|
|
125635
|
+
if (readHost(settings) === null) return {
|
|
125636
|
+
outcome: "rejected",
|
|
125637
|
+
error: "Enter the CCU host or IP address."
|
|
125638
|
+
};
|
|
125639
|
+
const connection = connectionFromSettings(settings);
|
|
125640
|
+
if (connection === null) return {
|
|
125641
|
+
outcome: "rejected",
|
|
125642
|
+
error: "Some of the connection settings are not valid."
|
|
125643
|
+
};
|
|
125644
|
+
const interfaces = enabledInterfaces(connection);
|
|
125645
|
+
if (interfaces.length === 0) return {
|
|
125646
|
+
outcome: "rejected",
|
|
125647
|
+
error: "Enable at least one interface."
|
|
125648
|
+
};
|
|
125649
|
+
const startedAt = Date.now();
|
|
125650
|
+
try {
|
|
125651
|
+
const result = await probe({
|
|
125652
|
+
host: connection.host,
|
|
125653
|
+
tls: connection.tls,
|
|
125654
|
+
username: connection.username,
|
|
125655
|
+
password: connection.password,
|
|
125656
|
+
interfaces
|
|
125657
|
+
});
|
|
125658
|
+
return {
|
|
125659
|
+
outcome: "validated",
|
|
125660
|
+
latencyMs: Date.now() - startedAt,
|
|
125661
|
+
detail: describeSuccess(result)
|
|
125783
125662
|
};
|
|
125784
|
-
|
|
125785
|
-
|
|
125786
|
-
|
|
125787
|
-
|
|
125788
|
-
|
|
125789
|
-
|
|
125790
|
-
|
|
125791
|
-
|
|
125792
|
-
|
|
125793
|
-
|
|
125794
|
-
|
|
125795
|
-
|
|
125796
|
-
|
|
125663
|
+
} catch (err) {
|
|
125664
|
+
const kind = err instanceof CcuProbeError ? err.kind : "other";
|
|
125665
|
+
logger.warn("Homematic connection test failed", { meta: {
|
|
125666
|
+
host: connection.host,
|
|
125667
|
+
kind,
|
|
125668
|
+
error: errMsg(err)
|
|
125669
|
+
} });
|
|
125670
|
+
switch (kind) {
|
|
125671
|
+
case "bad-credentials": return {
|
|
125672
|
+
outcome: "rejected",
|
|
125673
|
+
error: "The CCU refused the WebUI username or password."
|
|
125674
|
+
};
|
|
125675
|
+
case "not-a-ccu": return {
|
|
125676
|
+
outcome: "rejected",
|
|
125677
|
+
error: `${connection.host} did not answer as a CCU3 or RaspberryMatic. Check the address.`
|
|
125678
|
+
};
|
|
125679
|
+
case "unreachable": return {
|
|
125680
|
+
outcome: "inconclusive",
|
|
125681
|
+
error: `Could not reach the CCU at ${connection.host}: ${errMsg(err)}`
|
|
125682
|
+
};
|
|
125683
|
+
case "other": return {
|
|
125684
|
+
outcome: "inconclusive",
|
|
125685
|
+
error: `The CCU test did not finish: ${errMsg(err)}`
|
|
125797
125686
|
};
|
|
125798
|
-
} catch (err) {
|
|
125799
|
-
const kind = err instanceof CcuProbeError ? err.kind : "other";
|
|
125800
|
-
logger.warn("Homematic connection test failed", { meta: {
|
|
125801
|
-
host: connection.host,
|
|
125802
|
-
kind,
|
|
125803
|
-
error: errMsg(err)
|
|
125804
|
-
} });
|
|
125805
|
-
switch (kind) {
|
|
125806
|
-
case "bad-credentials": return {
|
|
125807
|
-
outcome: "rejected",
|
|
125808
|
-
error: "The CCU refused the WebUI username or password."
|
|
125809
|
-
};
|
|
125810
|
-
case "not-a-ccu": return {
|
|
125811
|
-
outcome: "rejected",
|
|
125812
|
-
error: `${connection.host} did not answer as a CCU3 or RaspberryMatic. Check the address.`
|
|
125813
|
-
};
|
|
125814
|
-
case "unreachable": return {
|
|
125815
|
-
outcome: "inconclusive",
|
|
125816
|
-
error: `Could not reach the CCU at ${connection.host}: ${errMsg(err)}`
|
|
125817
|
-
};
|
|
125818
|
-
case "other": return {
|
|
125819
|
-
outcome: "inconclusive",
|
|
125820
|
-
error: `The CCU test did not finish: ${errMsg(err)}`
|
|
125821
|
-
};
|
|
125822
|
-
}
|
|
125823
125687
|
}
|
|
125824
125688
|
}
|
|
125825
|
-
};
|
|
125689
|
+
} };
|
|
125826
125690
|
}
|
|
125827
125691
|
//#endregion
|
|
125828
125692
|
//#region src/homematic-integration-device-cascade.ts
|
|
@@ -125920,7 +125784,10 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
|
|
|
125920
125784
|
const records = this.ctx.records;
|
|
125921
125785
|
if (records === void 0) throw new Error("provider-homematic: ctx.records is required (hub-only addon)");
|
|
125922
125786
|
await records.declare(homematicRecordKinds);
|
|
125923
|
-
const instances = buildHomematicInstances(records, {
|
|
125787
|
+
const instances = buildHomematicInstances(records, {
|
|
125788
|
+
onChanged: () => this.reconcileIntegrations(),
|
|
125789
|
+
tester: this.buildConnectionTestProvider()
|
|
125790
|
+
});
|
|
125924
125791
|
this.instances = instances;
|
|
125925
125792
|
this.declareRegistrySwitch({
|
|
125926
125793
|
kind: homematicConnectionsEntryKind,
|
|
@@ -125959,10 +125826,6 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
|
|
|
125959
125826
|
capability: deviceAdoptionCapability,
|
|
125960
125827
|
provider: this.buildAdoptionProvider()
|
|
125961
125828
|
},
|
|
125962
|
-
{
|
|
125963
|
-
capability: connectionTestCapability,
|
|
125964
|
-
provider: this.buildConnectionTestProvider()
|
|
125965
|
-
},
|
|
125966
125829
|
{
|
|
125967
125830
|
capability: addonPagesSourceCapability,
|
|
125968
125831
|
provider: this.buildPagesProvider()
|