@camstack/addon-provider-homeassistant 1.2.11 → 1.2.12
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/dist/addon.js +828 -287
- package/dist/addon.mjs +828 -287
- package/package.json +1 -1
package/dist/addon.mjs
CHANGED
|
@@ -9466,8 +9466,11 @@ function prepareNotification(caps, n) {
|
|
|
9466
9466
|
});
|
|
9467
9467
|
}
|
|
9468
9468
|
const inActions = n.actions ?? [];
|
|
9469
|
-
const
|
|
9470
|
-
if (inActions.length >
|
|
9469
|
+
const kept = inActions.slice(0, Math.max(0, caps.actions));
|
|
9470
|
+
if (inActions.length > kept.length) dropped.push("actions");
|
|
9471
|
+
const iconsSupported = caps.actionIcons === true;
|
|
9472
|
+
if (!iconsSupported && kept.some((a) => a.icon !== void 0)) dropped.push("actionIcons");
|
|
9473
|
+
const actions = iconsSupported ? kept : kept.map(({ icon: _icon, ...rest }) => rest);
|
|
9471
9474
|
let clickUrl = null;
|
|
9472
9475
|
if (n.clickUrl !== void 0) if (caps.clickUrl) clickUrl = n.clickUrl;
|
|
9473
9476
|
else dropped.push("clickUrl");
|
|
@@ -9566,6 +9569,290 @@ var MaskGridDimsSchema = object({
|
|
|
9566
9569
|
height: number()
|
|
9567
9570
|
});
|
|
9568
9571
|
/**
|
|
9572
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
9573
|
+
*
|
|
9574
|
+
* Apprise-derived model (see
|
|
9575
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
9576
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
9577
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
9578
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
9579
|
+
* message to what the kind supports — callers never special-case a service.
|
|
9580
|
+
*
|
|
9581
|
+
* DESIGN DECISIONS (locked):
|
|
9582
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
9583
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
9584
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
9585
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
9586
|
+
* alternative would fork the UI per addon and cannot host the
|
|
9587
|
+
* discovery→adopt flow.
|
|
9588
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
9589
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
9590
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
9591
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
9592
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
9593
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
9594
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
9595
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
9596
|
+
* base64 fallback needed.
|
|
9597
|
+
*
|
|
9598
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
9599
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
9600
|
+
* admin "Integrations" page.
|
|
9601
|
+
*/
|
|
9602
|
+
/**
|
|
9603
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
9604
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
9605
|
+
*/
|
|
9606
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
9607
|
+
"image",
|
|
9608
|
+
"video",
|
|
9609
|
+
"gif",
|
|
9610
|
+
"audio",
|
|
9611
|
+
"icon"
|
|
9612
|
+
]);
|
|
9613
|
+
/**
|
|
9614
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
9615
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
9616
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
9617
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
9618
|
+
*/
|
|
9619
|
+
var AttachmentSchema = object({
|
|
9620
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
9621
|
+
url: string().optional(),
|
|
9622
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
9623
|
+
mime: string().optional(),
|
|
9624
|
+
name: string().optional()
|
|
9625
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
9626
|
+
var NotificationFormatSchema = _enum([
|
|
9627
|
+
"text",
|
|
9628
|
+
"markdown",
|
|
9629
|
+
"html"
|
|
9630
|
+
]);
|
|
9631
|
+
/**
|
|
9632
|
+
* The CLOSED icon vocabulary an action button may use.
|
|
9633
|
+
*
|
|
9634
|
+
* A closed set, not a free string, and that is the whole point: an arbitrary
|
|
9635
|
+
* icon name is one that ntfy renders, zentik silently drops, and nobody
|
|
9636
|
+
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
9637
|
+
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
9638
|
+
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
9639
|
+
*
|
|
9640
|
+
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
9641
|
+
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
9642
|
+
* differently.
|
|
9643
|
+
*/
|
|
9644
|
+
var NotificationActionIconSchema = _enum([
|
|
9645
|
+
"acknowledge",
|
|
9646
|
+
"dismiss",
|
|
9647
|
+
"silence",
|
|
9648
|
+
"view",
|
|
9649
|
+
"play",
|
|
9650
|
+
"open",
|
|
9651
|
+
"close",
|
|
9652
|
+
"lock",
|
|
9653
|
+
"unlock",
|
|
9654
|
+
"arm",
|
|
9655
|
+
"disarm",
|
|
9656
|
+
"light",
|
|
9657
|
+
"alert"
|
|
9658
|
+
]);
|
|
9659
|
+
/** A single tap-through action button. */
|
|
9660
|
+
var NotificationActionSchema = object({
|
|
9661
|
+
id: string(),
|
|
9662
|
+
label: string(),
|
|
9663
|
+
url: string().optional(),
|
|
9664
|
+
/** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
|
|
9665
|
+
icon: NotificationActionIconSchema.optional(),
|
|
9666
|
+
/**
|
|
9667
|
+
* Renders in a warning style where the notifier supports it.
|
|
9668
|
+
*
|
|
9669
|
+
* A HINT, never a gate. The callback's authority is its token and nothing
|
|
9670
|
+
* else — see `notification-center/action-token.ts` for what that does and
|
|
9671
|
+
* does not buy.
|
|
9672
|
+
*/
|
|
9673
|
+
destructive: boolean().optional()
|
|
9674
|
+
});
|
|
9675
|
+
/**
|
|
9676
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
9677
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
9678
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
9679
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
9680
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
9681
|
+
* `priority` for that one target.
|
|
9682
|
+
*/
|
|
9683
|
+
var NotificationSchema = object({
|
|
9684
|
+
body: string(),
|
|
9685
|
+
title: string().optional(),
|
|
9686
|
+
format: NotificationFormatSchema.default("text"),
|
|
9687
|
+
priority: number().int().min(1).max(5).default(3),
|
|
9688
|
+
level: string().optional(),
|
|
9689
|
+
attachments: array(AttachmentSchema).optional(),
|
|
9690
|
+
clickUrl: string().optional(),
|
|
9691
|
+
actions: array(NotificationActionSchema).optional(),
|
|
9692
|
+
sound: string().optional(),
|
|
9693
|
+
ttl: number().optional(),
|
|
9694
|
+
tag: string().optional(),
|
|
9695
|
+
deviceId: number().optional(),
|
|
9696
|
+
eventId: string().optional(),
|
|
9697
|
+
metadata: record(string(), unknown()).optional()
|
|
9698
|
+
});
|
|
9699
|
+
/** One declared native severity/priority level for a kind. */
|
|
9700
|
+
var TargetKindLevelSchema = object({
|
|
9701
|
+
id: string(),
|
|
9702
|
+
label: string(),
|
|
9703
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
9704
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
9705
|
+
flags: object({
|
|
9706
|
+
critical: boolean().optional(),
|
|
9707
|
+
silent: boolean().optional(),
|
|
9708
|
+
noPush: boolean().optional()
|
|
9709
|
+
}).optional(),
|
|
9710
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
9711
|
+
requires: array(string()).optional(),
|
|
9712
|
+
description: string().optional()
|
|
9713
|
+
});
|
|
9714
|
+
/** The full capability block consulted before dispatch. */
|
|
9715
|
+
var TargetKindCapsSchema = object({
|
|
9716
|
+
attachments: object({
|
|
9717
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
9718
|
+
mode: _enum([
|
|
9719
|
+
"url",
|
|
9720
|
+
"bytes",
|
|
9721
|
+
"both"
|
|
9722
|
+
]),
|
|
9723
|
+
max: number().int().nonnegative(),
|
|
9724
|
+
maxBytes: number().int().positive().optional()
|
|
9725
|
+
}),
|
|
9726
|
+
/** Max action buttons (0 = none). */
|
|
9727
|
+
actions: number().int().nonnegative(),
|
|
9728
|
+
/**
|
|
9729
|
+
* Whether this kind renders a per-action ICON.
|
|
9730
|
+
*
|
|
9731
|
+
* `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
|
|
9732
|
+
* run on the addon cap path — three production failures in one day taught
|
|
9733
|
+
* this repo that once. Absent is read as false by the degrade engine, which
|
|
9734
|
+
* is the safe direction: an icon that is not rendered costs nothing, an icon
|
|
9735
|
+
* assumed and dropped costs the operator's trust in the field.
|
|
9736
|
+
*/
|
|
9737
|
+
actionIcons: boolean().optional(),
|
|
9738
|
+
levels: array(TargetKindLevelSchema),
|
|
9739
|
+
format: array(NotificationFormatSchema),
|
|
9740
|
+
clickUrl: boolean(),
|
|
9741
|
+
sound: boolean(),
|
|
9742
|
+
ttl: boolean(),
|
|
9743
|
+
bodyMaxLen: number().int().positive()
|
|
9744
|
+
});
|
|
9745
|
+
/**
|
|
9746
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
9747
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
9748
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
9749
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
9750
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
9751
|
+
*/
|
|
9752
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
9753
|
+
var TargetKindSchema = object({
|
|
9754
|
+
kind: string(),
|
|
9755
|
+
label: string(),
|
|
9756
|
+
icon: string(),
|
|
9757
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
9758
|
+
addonId: string(),
|
|
9759
|
+
/**
|
|
9760
|
+
* URL of the kind's bundled BRAND icon, served by the providing addon over
|
|
9761
|
+
* its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
|
|
9762
|
+
* when the addon bundles no icon for that kind — the client then falls back
|
|
9763
|
+
* to a neutral glyph rather than rendering the raw `icon` NAME as text.
|
|
9764
|
+
*
|
|
9765
|
+
* Root-relative on purpose: it resolves against whatever origin serves a web
|
|
9766
|
+
* client, and a native client joins it onto its own hub base.
|
|
9767
|
+
*
|
|
9768
|
+
* DECLARED here deliberately. It used to travel as an undeclared passthrough
|
|
9769
|
+
* field that survived only because the runtime cap-router forwards provider
|
|
9770
|
+
* output verbatim — so every consumer had to re-declare it by hand to stop
|
|
9771
|
+
* its own Zod parse from stripping it, and the whole arrangement would have
|
|
9772
|
+
* broken silently the moment output validation was tightened anywhere.
|
|
9773
|
+
*/
|
|
9774
|
+
iconUrl: string().optional(),
|
|
9775
|
+
/**
|
|
9776
|
+
* Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
|
|
9777
|
+
*
|
|
9778
|
+
* The server knows this and therefore says it, because the client cannot
|
|
9779
|
+
* safely guess: a React-Native client renders SVG and raster through two
|
|
9780
|
+
* DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
|
|
9781
|
+
* not decode SVG on iOS/Android), so without this it silently fell back to a
|
|
9782
|
+
* placeholder glyph for every vector icon while the web build looked fine.
|
|
9783
|
+
*
|
|
9784
|
+
* Absent when {@link iconUrl} is absent, or for a legacy provider that has
|
|
9785
|
+
* not been updated — a client that cannot determine the type should prefer
|
|
9786
|
+
* its raster path, which is the safe default for an unknown image.
|
|
9787
|
+
*/
|
|
9788
|
+
iconMediaType: string().optional(),
|
|
9789
|
+
configSchema: ConfigSchemaPassthrough$1,
|
|
9790
|
+
supportsDiscovery: boolean(),
|
|
9791
|
+
caps: TargetKindCapsSchema
|
|
9792
|
+
});
|
|
9793
|
+
/**
|
|
9794
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
9795
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
9796
|
+
* round-trip a stored secret to the UI.
|
|
9797
|
+
*/
|
|
9798
|
+
var TargetSchema = object({
|
|
9799
|
+
id: string(),
|
|
9800
|
+
name: string(),
|
|
9801
|
+
kind: string(),
|
|
9802
|
+
addonId: string(),
|
|
9803
|
+
enabled: boolean(),
|
|
9804
|
+
config: record(string(), unknown())
|
|
9805
|
+
});
|
|
9806
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
9807
|
+
var DiscoveredTargetSchema = object({
|
|
9808
|
+
kind: string(),
|
|
9809
|
+
suggestedName: string(),
|
|
9810
|
+
config: record(string(), unknown())
|
|
9811
|
+
});
|
|
9812
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
9813
|
+
var RenderedAsSchema = object({
|
|
9814
|
+
level: string(),
|
|
9815
|
+
format: NotificationFormatSchema,
|
|
9816
|
+
attachmentsSent: number().int().nonnegative(),
|
|
9817
|
+
actionsSent: number().int().nonnegative(),
|
|
9818
|
+
truncated: boolean(),
|
|
9819
|
+
dropped: array(string())
|
|
9820
|
+
});
|
|
9821
|
+
var SendResultSchema = object({
|
|
9822
|
+
success: boolean(),
|
|
9823
|
+
error: string().optional(),
|
|
9824
|
+
renderedAs: RenderedAsSchema.optional()
|
|
9825
|
+
});
|
|
9826
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
9827
|
+
var TestResultSchema = SendResultSchema;
|
|
9828
|
+
var notificationOutputCapability = {
|
|
9829
|
+
name: "notification-output",
|
|
9830
|
+
scope: "system",
|
|
9831
|
+
mode: "collection",
|
|
9832
|
+
methods: {
|
|
9833
|
+
listTargetKinds: method(object({}), array(TargetKindSchema)),
|
|
9834
|
+
listTargets: method(object({}), array(TargetSchema)),
|
|
9835
|
+
discoverTargets: method(object({
|
|
9836
|
+
kind: string(),
|
|
9837
|
+
config: record(string(), unknown()).optional()
|
|
9838
|
+
}), array(DiscoveredTargetSchema)),
|
|
9839
|
+
send: method(object({
|
|
9840
|
+
targetId: string(),
|
|
9841
|
+
notification: NotificationSchema
|
|
9842
|
+
}), SendResultSchema, { kind: "mutation" }),
|
|
9843
|
+
testTarget: method(object({
|
|
9844
|
+
targetId: string(),
|
|
9845
|
+
sample: NotificationSchema.optional()
|
|
9846
|
+
}), TestResultSchema, { kind: "mutation" }),
|
|
9847
|
+
upsertTarget: method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }),
|
|
9848
|
+
deleteTarget: method(object({ targetId: string() }), _void(), { kind: "mutation" }),
|
|
9849
|
+
setTargetEnabled: method(object({
|
|
9850
|
+
targetId: string(),
|
|
9851
|
+
enabled: boolean()
|
|
9852
|
+
}), _void(), { kind: "mutation" })
|
|
9853
|
+
}
|
|
9854
|
+
};
|
|
9855
|
+
/**
|
|
9569
9856
|
* notification-rules — the Notification Center rule surface (P1 core).
|
|
9570
9857
|
*
|
|
9571
9858
|
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
@@ -9695,7 +9982,115 @@ var NcZoneConditionSchema = object({
|
|
|
9695
9982
|
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
9696
9983
|
* membership lists are OR within the list (spec §2.3).
|
|
9697
9984
|
*/
|
|
9985
|
+
/**
|
|
9986
|
+
* What a rule may actuate.
|
|
9987
|
+
*
|
|
9988
|
+
* **No hand-maintained allowlist** (operator decision, and the right one — a
|
|
9989
|
+
* written list of methods is a third parallel map to keep aligned, and this
|
|
9990
|
+
* repo has paid for those). The boundary instead comes from a property the
|
|
9991
|
+
* capabilities already carry: an action may target only a **device-scoped**
|
|
9992
|
+
* capability method.
|
|
9993
|
+
*
|
|
9994
|
+
* That is not decoration. A rule can be authored by a NON-ADMIN — personal
|
|
9995
|
+
* rules are a supported flow — and the executor runs with the addon's
|
|
9996
|
+
* privileges, so an unbounded action is an arbitrary RPC channel with a
|
|
9997
|
+
* privilege escalation attached. Restricting to device scope excludes the
|
|
9998
|
+
* system caps (`device-manager.removeDevice` and friends) by construction,
|
|
9999
|
+
* costs nothing to maintain, and cannot rot: a cap that stops being
|
|
10000
|
+
* device-scoped stops being actuatable in the same change.
|
|
10001
|
+
*
|
|
10002
|
+
* The executor enforces it; {@link NcRuleActionSchema} carries the intent.
|
|
10003
|
+
*/
|
|
10004
|
+
/**
|
|
10005
|
+
* One step of a sequence.
|
|
10006
|
+
*
|
|
10007
|
+
* `wait` is a first-class step rather than a property of the next action: it is
|
|
10008
|
+
* what makes a sequence a SEQUENCE and not a list — "unlock, wait 5s, open"
|
|
10009
|
+
* cannot be expressed otherwise.
|
|
10010
|
+
*/
|
|
10011
|
+
var NcRuleActionSchema = discriminatedUnion("kind", [object({
|
|
10012
|
+
kind: literal("wait"),
|
|
10013
|
+
seconds: number().min(0).max(300)
|
|
10014
|
+
}), object({
|
|
10015
|
+
kind: literal("cap"),
|
|
10016
|
+
deviceId: number().int(),
|
|
10017
|
+
/** Capability name, e.g. `alarm-panel`. */
|
|
10018
|
+
cap: string().min(1),
|
|
10019
|
+
/** Method on it. The executor refuses a non-device-scoped cap. */
|
|
10020
|
+
method: string().min(1),
|
|
10021
|
+
/** Method arguments, minus `deviceId` (the executor injects it). */
|
|
10022
|
+
args: record(string(), unknown()).optional()
|
|
10023
|
+
})]);
|
|
10024
|
+
/**
|
|
10025
|
+
* A named, ordered run of steps with its own throttle.
|
|
10026
|
+
*
|
|
10027
|
+
* `minDelaySec` exists because a noisy rule otherwise hammers a physical
|
|
10028
|
+
* actuator — the rule's own cooldown governs NOTIFICATIONS, which is a
|
|
10029
|
+
* different budget from "how often may this gate actually open".
|
|
10030
|
+
*/
|
|
10031
|
+
var NcRuleActionSequenceSchema = object({
|
|
10032
|
+
name: string().min(1).max(120),
|
|
10033
|
+
enabled: boolean(),
|
|
10034
|
+
minDelaySec: number().int().min(0).max(86400).optional(),
|
|
10035
|
+
actions: array(NcRuleActionSchema).min(1)
|
|
10036
|
+
});
|
|
10037
|
+
/**
|
|
10038
|
+
* One button carried by the notification, running a named sequence on tap.
|
|
10039
|
+
*
|
|
10040
|
+
* **Read this before adding a button that does something physical.** The tap
|
|
10041
|
+
* arrives over a link that travelled through third-party infrastructure — ntfy,
|
|
10042
|
+
* a push relay, whatever forwarded the message — and the callback's ONLY
|
|
10043
|
+
* authority is the token in that link: single-use, short-lived, bound to this
|
|
10044
|
+
* one action of this one notification. It does not identify who tapped.
|
|
10045
|
+
* Whoever holds the notification can run the button, once, inside the window.
|
|
10046
|
+
* That is the operator's explicit choice (2026-08-05), and `destructive` is a
|
|
10047
|
+
* rendering hint, not a second gate. [D47](decisions/adr-0047.md).
|
|
10048
|
+
*/
|
|
10049
|
+
var NcRuleNotificationButtonSchema = object({
|
|
10050
|
+
/** Stable id — travels in the callback and identifies the button in logs. */
|
|
10051
|
+
id: string().min(1).max(64),
|
|
10052
|
+
label: string().min(1).max(40),
|
|
10053
|
+
/** Name of a sequence in `onTrigger`. The dispatcher drops a button whose
|
|
10054
|
+
* sequence does not exist rather than minting a token for nothing. */
|
|
10055
|
+
sequence: string().min(1).max(120),
|
|
10056
|
+
icon: NotificationActionIconSchema.optional(),
|
|
10057
|
+
destructive: boolean().optional()
|
|
10058
|
+
});
|
|
10059
|
+
/**
|
|
10060
|
+
* Sequences a rule runs, by hook point.
|
|
10061
|
+
*
|
|
10062
|
+
* ONLY `onTrigger` is here, deliberately. The reference also has activation /
|
|
10063
|
+
* deactivation / reset / post-generation hooks, and they are wanted — but this
|
|
10064
|
+
* repo's expensive failure mode is declaring a surface nothing produces, so a
|
|
10065
|
+
* hook appears here in the same change that produces its edge, never before.
|
|
10066
|
+
*/
|
|
10067
|
+
var NcRuleActionsSchema = object({
|
|
10068
|
+
/** Runs when the rule MATCHES. */
|
|
10069
|
+
onTrigger: array(NcRuleActionSequenceSchema).optional(),
|
|
10070
|
+
/**
|
|
10071
|
+
* Buttons the NOTIFICATION carries, each running one of this rule's
|
|
10072
|
+
* sequences when tapped.
|
|
10073
|
+
*
|
|
10074
|
+
* Deliberately a REFERENCE to a sequence rather than a second place to
|
|
10075
|
+
* author steps. A button that could define its own actions would be a
|
|
10076
|
+
* parallel actuation vocabulary — the executor's device-scope check, the
|
|
10077
|
+
* stop-at-first-failure rule and the per-sequence throttle all live on
|
|
10078
|
+
* sequences, and a second authoring surface would drift from every one of
|
|
10079
|
+
* them.
|
|
10080
|
+
*
|
|
10081
|
+
* A sequence reachable ONLY by a button simply appears in `onTrigger` with
|
|
10082
|
+
* `enabled: false`: it is then authored, throttled and validated like the
|
|
10083
|
+
* rest, and nothing runs it automatically.
|
|
10084
|
+
*/
|
|
10085
|
+
buttons: array(NcRuleNotificationButtonSchema).max(8).optional()
|
|
10086
|
+
});
|
|
9698
10087
|
var NcConditionsSchema = object({
|
|
10088
|
+
/** Gate on ANOTHER device's current state (the alarm armed, a switch on). */
|
|
10089
|
+
deviceState: object({
|
|
10090
|
+
deviceId: number().int(),
|
|
10091
|
+
/** Any of these matches. */
|
|
10092
|
+
states: array(string().min(1)).min(1)
|
|
10093
|
+
}).optional(),
|
|
9699
10094
|
/** Device scope — absent = all devices. */
|
|
9700
10095
|
devices: array(number()).optional(),
|
|
9701
10096
|
/** Detector class names (any overlap with the record's class set). */
|
|
@@ -9896,6 +10291,14 @@ var NcMediaPolicySchema = object({
|
|
|
9896
10291
|
clipPreRollSec: number().int().min(0).max(30).optional(),
|
|
9897
10292
|
clipPostRollSec: number().int().min(0).max(30).optional(),
|
|
9898
10293
|
/**
|
|
10294
|
+
* Playback rate of the attached gif / clip. Absent = 2x.
|
|
10295
|
+
*
|
|
10296
|
+
* A notification clip is GLANCED at on a lock screen, not watched: at real
|
|
10297
|
+
* time an eight-second passage is eight seconds of the recipient's attention
|
|
10298
|
+
* and twice the bytes. 1 is real time for the operator who wants it.
|
|
10299
|
+
*/
|
|
10300
|
+
clipSpeed: number().min(1).max(8).optional(),
|
|
10301
|
+
/**
|
|
9899
10302
|
* Which stream profile the footage is cut from. Absent = the CHEAPEST
|
|
9900
10303
|
* assigned profile: a notification is watched on a phone, so the 4K
|
|
9901
10304
|
* rendition would burn CPU to produce a file the client downscales anyway.
|
|
@@ -9967,7 +10370,30 @@ var NcRuleInputSchema = object({
|
|
|
9967
10370
|
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
9968
10371
|
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
9969
10372
|
*/
|
|
9970
|
-
ownerUserId: string().optional()
|
|
10373
|
+
ownerUserId: string().optional(),
|
|
10374
|
+
/**
|
|
10375
|
+
* May a non-admin snooze this rule for EVERYONE, not just themselves?
|
|
10376
|
+
*
|
|
10377
|
+
* A snooze is personal by default — it silences the person who set it. This
|
|
10378
|
+
* opts THIS rule into the "the gardener is here all afternoon" case, where
|
|
10379
|
+
* silencing the camera for the whole household is legitimate. It silences
|
|
10380
|
+
* other people, so it is off unless a rule deliberately allows it.
|
|
10381
|
+
*
|
|
10382
|
+
* `.optional()`, deliberately NOT `.default()`: a Zod default does not run on
|
|
10383
|
+
* the addon cap path (three production failures in one day), so absent is
|
|
10384
|
+
* read as `false` by {@link canSetGlobal} in the engine. Admins are not bound
|
|
10385
|
+
* by this flag — see the scope rules on that function.
|
|
10386
|
+
*/
|
|
10387
|
+
snoozeAllowGlobal: boolean().optional(),
|
|
10388
|
+
/**
|
|
10389
|
+
* Devices this rule ACTUATES — arm the alarm, open a gate, turn on a light.
|
|
10390
|
+
*
|
|
10391
|
+
* This is what makes the rule set the alarm's trigger set without the alarm
|
|
10392
|
+
* being a special case: arming is
|
|
10393
|
+
* `{ cap: 'alarm-panel', method: 'arm', args: { mode: 'away' } }`, the same
|
|
10394
|
+
* shape as every other actuation.
|
|
10395
|
+
*/
|
|
10396
|
+
actions: NcRuleActionsSchema.optional()
|
|
9971
10397
|
});
|
|
9972
10398
|
/**
|
|
9973
10399
|
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
@@ -10038,7 +10464,8 @@ var NcConditionDescriptorSchema = object({
|
|
|
10038
10464
|
"packagePhase",
|
|
10039
10465
|
"crossingSelect",
|
|
10040
10466
|
"polygonDraw",
|
|
10041
|
-
"occupancy"
|
|
10467
|
+
"occupancy",
|
|
10468
|
+
"deviceState"
|
|
10042
10469
|
]),
|
|
10043
10470
|
operator: _enum([
|
|
10044
10471
|
"in",
|
|
@@ -10052,7 +10479,28 @@ var NcConditionDescriptorSchema = object({
|
|
|
10052
10479
|
/** Which delivery kinds the condition applies to. */
|
|
10053
10480
|
appliesTo: array(NcDeliverySchema),
|
|
10054
10481
|
phase: string(),
|
|
10055
|
-
description: string().optional()
|
|
10482
|
+
description: string().optional(),
|
|
10483
|
+
/**
|
|
10484
|
+
* The CHOICES for a single-choice widget (`sourceSelect`, `crossingSelect`,
|
|
10485
|
+
* `packagePhase`, …), served with the descriptor.
|
|
10486
|
+
*
|
|
10487
|
+
* Before this the descriptor said which widget to render and not what to put
|
|
10488
|
+
* in it, so every option list lived in three places: this file's enums, the
|
|
10489
|
+
* admin's `NC_*_OPTIONS` and the viewer's `NC_*_VALUES`. That triple mirror
|
|
10490
|
+
* is the drift that emptied the viewer's rule editor on 2026-08-04 — the app
|
|
10491
|
+
* mirrors the cap by hand, so it is only ever as current as its last build.
|
|
10492
|
+
*
|
|
10493
|
+
* With the options on the wire, a condition of an EXISTING `valueType` costs
|
|
10494
|
+
* zero client changes. Clients keep a local fallback for an older hub that
|
|
10495
|
+
* does not send them; absent here is "use your own list", not "no choices".
|
|
10496
|
+
*/
|
|
10497
|
+
options: array(object({
|
|
10498
|
+
/** Written to the rule verbatim. `''` means the ABSENT state. */
|
|
10499
|
+
value: string(),
|
|
10500
|
+
label: string(),
|
|
10501
|
+
/** What THIS choice matches — shown one at a time, under the control. */
|
|
10502
|
+
hint: string().optional()
|
|
10503
|
+
})).readonly().optional()
|
|
10056
10504
|
});
|
|
10057
10505
|
/**
|
|
10058
10506
|
* The delivery lifecycle status of a history row — a straight read of the
|
|
@@ -10137,6 +10585,74 @@ var NcHistoryFilterSchema = object({
|
|
|
10137
10585
|
until: number().optional(),
|
|
10138
10586
|
limit: number().int().min(1).max(500).default(100)
|
|
10139
10587
|
});
|
|
10588
|
+
/**
|
|
10589
|
+
* What a snooze covers. Broader scopes win when several overlap, so one window
|
|
10590
|
+
* leaves ONE digest rather than a rule snooze and a whole-feed snooze both
|
|
10591
|
+
* summarising the same silence.
|
|
10592
|
+
*/
|
|
10593
|
+
var NcSnoozeScopeSchema = _enum([
|
|
10594
|
+
"rule",
|
|
10595
|
+
"device",
|
|
10596
|
+
"all"
|
|
10597
|
+
]);
|
|
10598
|
+
/**
|
|
10599
|
+
* Client-authored snooze. The server stamps `userId`, `startedAt` and
|
|
10600
|
+
* `expiresAt` — a DURATION is sent rather than an instant so a client with a
|
|
10601
|
+
* skewed clock cannot author a window that is already over, or never ends.
|
|
10602
|
+
*/
|
|
10603
|
+
var NcSnoozeInputSchema = object({
|
|
10604
|
+
scope: NcSnoozeScopeSchema,
|
|
10605
|
+
/** Required when `scope: 'rule'` — a scoped snooze with no id matches
|
|
10606
|
+
* NOTHING rather than degrading to "everything". */
|
|
10607
|
+
ruleId: string().optional(),
|
|
10608
|
+
/** Required when `scope: 'device'`. */
|
|
10609
|
+
deviceId: number().int().optional(),
|
|
10610
|
+
durationMinutes: number().int().min(1).max(1440),
|
|
10611
|
+
/**
|
|
10612
|
+
* Silence this for EVERY recipient, not just the caller. Permission is
|
|
10613
|
+
* checked server-side (the rule's `snoozeAllowGlobal`, or admin for the
|
|
10614
|
+
* broader scopes). Absent = personal.
|
|
10615
|
+
*/
|
|
10616
|
+
global: boolean().optional(),
|
|
10617
|
+
/**
|
|
10618
|
+
* Deliver a summary of what was suppressed when the window ends. Absent =
|
|
10619
|
+
* ON: someone silencing a nuisance camera wants it off, someone silencing a
|
|
10620
|
+
* SECURITY camera wants to know what they missed, and choosing "off" for
|
|
10621
|
+
* everybody is how a snooze becomes an outage. Resolved to a concrete
|
|
10622
|
+
* boolean by the server at create time — never left to a Zod default, which
|
|
10623
|
+
* does not run on the addon cap path.
|
|
10624
|
+
*/
|
|
10625
|
+
summary: boolean().optional()
|
|
10626
|
+
});
|
|
10627
|
+
/** A persisted snooze window. */
|
|
10628
|
+
var NcSnoozeSchema = object({
|
|
10629
|
+
id: string(),
|
|
10630
|
+
/** Who set it. Also who it silences, unless `global`. */
|
|
10631
|
+
userId: string(),
|
|
10632
|
+
scope: NcSnoozeScopeSchema,
|
|
10633
|
+
ruleId: string().optional(),
|
|
10634
|
+
deviceId: number().int().optional(),
|
|
10635
|
+
startedAt: number(),
|
|
10636
|
+
/** Exclusive: at exactly this instant the snooze is over. Expiry is a
|
|
10637
|
+
* COMPARISON, not a job — no sweeper can leave the operator silenced. */
|
|
10638
|
+
expiresAt: number(),
|
|
10639
|
+
global: boolean(),
|
|
10640
|
+
summary: boolean(),
|
|
10641
|
+
/** When the end-of-window digest went out. Absent = not sent (yet, or the
|
|
10642
|
+
* window has not closed, or `summary` is false). */
|
|
10643
|
+
digestSentAt: number().optional()
|
|
10644
|
+
});
|
|
10645
|
+
object({
|
|
10646
|
+
snoozeId: string(),
|
|
10647
|
+
targetId: string(),
|
|
10648
|
+
ruleId: string(),
|
|
10649
|
+
ruleName: string(),
|
|
10650
|
+
deviceId: number().int(),
|
|
10651
|
+
/** How many notifications this snooze hid for that pair. */
|
|
10652
|
+
count: number().int(),
|
|
10653
|
+
firstAt: number(),
|
|
10654
|
+
lastAt: number()
|
|
10655
|
+
});
|
|
10140
10656
|
method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), method(object({ ruleId: string() }), object({ rule: NcRuleSchema.nullable() }), { auth: "admin" }), method(object({ rule: NcRuleInputSchema }), object({ rule: NcRuleSchema }), {
|
|
10141
10657
|
kind: "mutation",
|
|
10142
10658
|
auth: "admin",
|
|
@@ -10166,7 +10682,13 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
10166
10682
|
}), method(object({}), object({
|
|
10167
10683
|
catalog: array(NcConditionDescriptorSchema),
|
|
10168
10684
|
taxonomy: NcTaxonomySchema.optional()
|
|
10169
|
-
})), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" })
|
|
10685
|
+
})), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }), method(object({}), object({ snoozes: array(NcSnoozeSchema) }), { caller: "required" }), method(object({ snooze: NcSnoozeInputSchema }), object({ snooze: NcSnoozeSchema }), {
|
|
10686
|
+
kind: "mutation",
|
|
10687
|
+
caller: "required"
|
|
10688
|
+
}), method(object({ snoozeId: string() }), object({ success: literal(true) }), {
|
|
10689
|
+
kind: "mutation",
|
|
10690
|
+
caller: "required"
|
|
10691
|
+
});
|
|
10170
10692
|
/**
|
|
10171
10693
|
* TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
|
|
10172
10694
|
*
|
|
@@ -11186,7 +11708,15 @@ method(object({
|
|
|
11186
11708
|
format: _enum(["gif", "mp4"]).default("gif"),
|
|
11187
11709
|
maxWidth: number().int().min(120).max(1920).default(480),
|
|
11188
11710
|
/** GIF only — MP4 keeps the source cadence. */
|
|
11189
|
-
fps: number().int().min(1).max(15).default(5)
|
|
11711
|
+
fps: number().int().min(1).max(15).default(5),
|
|
11712
|
+
/**
|
|
11713
|
+
* Playback rate. A notification clip is GLANCED at on a lock screen,
|
|
11714
|
+
* not watched, so 2x is the default: the recipient sees the whole
|
|
11715
|
+
* passage in half the time and the GIF is half the bytes. `1` is real
|
|
11716
|
+
* time. Applies to MP4 as well — the operator set a speed, not a GIF
|
|
11717
|
+
* speed.
|
|
11718
|
+
*/
|
|
11719
|
+
speed: number().min(1).max(8).default(2)
|
|
11190
11720
|
}), object({
|
|
11191
11721
|
base64: string(),
|
|
11192
11722
|
mime: string(),
|
|
@@ -19423,7 +19953,20 @@ method(object({
|
|
|
19423
19953
|
}), _void(), {
|
|
19424
19954
|
kind: "mutation",
|
|
19425
19955
|
auth: "admin"
|
|
19426
|
-
}), method(object({ addonId: string() }), array(SavedDeviceRowSchema)), method(object({
|
|
19956
|
+
}), method(object({ addonId: string() }), array(SavedDeviceRowSchema)), method(object({
|
|
19957
|
+
addonId: string().optional(),
|
|
19958
|
+
/**
|
|
19959
|
+
* `slim` omits `config` (returned `{}`), `metadata` (null) and the
|
|
19960
|
+
* `sourceInfo` derived from config — and skips the per-device settings
|
|
19961
|
+
* read that produces them. Everything identifying a device (id, name,
|
|
19962
|
+
* type, online, features, isCamera, parent/link ids) is unchanged.
|
|
19963
|
+
* Do not use it for dispatch routing, which needs `sourceInfo`.
|
|
19964
|
+
*/
|
|
19965
|
+
projection: _enum(["full", "slim"]).optional(),
|
|
19966
|
+
/** Return only camera devices. Filtering server-side instead of
|
|
19967
|
+
* shipping 293 rows to find 12. */
|
|
19968
|
+
isCamera: boolean().optional()
|
|
19969
|
+
}), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
|
|
19427
19970
|
mode: DeviceLinkModeSchema,
|
|
19428
19971
|
devices: array(LinkedDeviceSchema)
|
|
19429
19972
|
})), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
|
|
@@ -19862,14 +20405,14 @@ var LlmProfileSchema = object({
|
|
|
19862
20405
|
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
19863
20406
|
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
19864
20407
|
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
19865
|
-
var ConfigSchemaPassthrough
|
|
20408
|
+
var ConfigSchemaPassthrough = unknown();
|
|
19866
20409
|
var LlmProfileKindDescriptorSchema = object({
|
|
19867
20410
|
kind: LlmProfileKindSchema,
|
|
19868
20411
|
label: string(),
|
|
19869
20412
|
icon: string(),
|
|
19870
20413
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
19871
20414
|
addonId: string(),
|
|
19872
|
-
configSchema: ConfigSchemaPassthrough
|
|
20415
|
+
configSchema: ConfigSchemaPassthrough
|
|
19873
20416
|
});
|
|
19874
20417
|
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
19875
20418
|
var LlmDefaultSchema = object({
|
|
@@ -20359,282 +20902,143 @@ var StartEmbeddedInputSchema = object({
|
|
|
20359
20902
|
});
|
|
20360
20903
|
var StartEmbeddedResultSchema = object({
|
|
20361
20904
|
id: string(),
|
|
20362
|
-
url: string()
|
|
20363
|
-
});
|
|
20364
|
-
var StatusSchema = object({
|
|
20365
|
-
brokerCount: number(),
|
|
20366
|
-
embeddedRunning: boolean()
|
|
20367
|
-
});
|
|
20368
|
-
method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema), method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(_void(), StatusSchema);
|
|
20369
|
-
var NetworkEndpointSchema = object({
|
|
20370
|
-
url: string(),
|
|
20371
|
-
hostname: string(),
|
|
20372
|
-
port: number(),
|
|
20373
|
-
protocol: _enum(["http", "https"])
|
|
20374
|
-
});
|
|
20375
|
-
var NetworkAccessStatusSchema = object({
|
|
20376
|
-
connected: boolean(),
|
|
20377
|
-
endpoint: NetworkEndpointSchema.nullable(),
|
|
20378
|
-
error: string().optional()
|
|
20379
|
-
});
|
|
20380
|
-
/**
|
|
20381
|
-
* Optional, richer endpoint shape returned by providers that expose
|
|
20382
|
-
* MORE than one ingress concurrently (Tailscale Ingress with mixed
|
|
20383
|
-
* serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
|
|
20384
|
-
* the originating provider config (mode + sourcePort) so the
|
|
20385
|
-
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
20386
|
-
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
20387
|
-
*/
|
|
20388
|
-
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
20389
|
-
/**
|
|
20390
|
-
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
20391
|
-
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
20392
|
-
*/
|
|
20393
|
-
id: string(),
|
|
20394
|
-
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
20395
|
-
label: string(),
|
|
20396
|
-
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
20397
|
-
mode: string().optional(),
|
|
20398
|
-
/** Originating local port the ingress fronts (informational). */
|
|
20399
|
-
sourcePort: number().optional()
|
|
20400
|
-
});
|
|
20401
|
-
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
20402
|
-
/**
|
|
20403
|
-
* notification-output — canonical, capability-gated notification delivery.
|
|
20404
|
-
*
|
|
20405
|
-
* Apprise-derived model (see
|
|
20406
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
20407
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
20408
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
20409
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
20410
|
-
* message to what the kind supports — callers never special-case a service.
|
|
20411
|
-
*
|
|
20412
|
-
* DESIGN DECISIONS (locked):
|
|
20413
|
-
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
20414
|
-
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
20415
|
-
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
20416
|
-
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
20417
|
-
* alternative would fork the UI per addon and cannot host the
|
|
20418
|
-
* discovery→adopt flow.
|
|
20419
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
20420
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
20421
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
20422
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
20423
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
20424
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
20425
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
20426
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
20427
|
-
* base64 fallback needed.
|
|
20428
|
-
*
|
|
20429
|
-
* TODO (deferred, closed-set change — separate decision): add
|
|
20430
|
-
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
20431
|
-
* admin "Integrations" page.
|
|
20432
|
-
*/
|
|
20433
|
-
/**
|
|
20434
|
-
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
20435
|
-
* adapter picks what it supports and the degrade engine filters the rest.
|
|
20436
|
-
*/
|
|
20437
|
-
var AttachmentMediaTypeSchema = _enum([
|
|
20438
|
-
"image",
|
|
20439
|
-
"video",
|
|
20440
|
-
"gif",
|
|
20441
|
-
"audio",
|
|
20442
|
-
"icon"
|
|
20443
|
-
]);
|
|
20444
|
-
/**
|
|
20445
|
-
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
20446
|
-
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
20447
|
-
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
20448
|
-
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
20449
|
-
*/
|
|
20450
|
-
var AttachmentSchema = object({
|
|
20451
|
-
mediaType: AttachmentMediaTypeSchema,
|
|
20452
|
-
url: string().optional(),
|
|
20453
|
-
bytes: _instanceof(Uint8Array).optional(),
|
|
20454
|
-
mime: string().optional(),
|
|
20455
|
-
name: string().optional()
|
|
20456
|
-
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
20457
|
-
var NotificationFormatSchema = _enum([
|
|
20458
|
-
"text",
|
|
20459
|
-
"markdown",
|
|
20460
|
-
"html"
|
|
20461
|
-
]);
|
|
20462
|
-
/** A single tap-through action button. */
|
|
20463
|
-
var NotificationActionSchema = object({
|
|
20464
|
-
id: string(),
|
|
20465
|
-
label: string(),
|
|
20466
|
-
url: string().optional()
|
|
20467
|
-
});
|
|
20468
|
-
/**
|
|
20469
|
-
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
20470
|
-
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
20471
|
-
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
20472
|
-
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
20473
|
-
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
20474
|
-
* `priority` for that one target.
|
|
20475
|
-
*/
|
|
20476
|
-
var NotificationSchema = object({
|
|
20477
|
-
body: string(),
|
|
20478
|
-
title: string().optional(),
|
|
20479
|
-
format: NotificationFormatSchema.default("text"),
|
|
20480
|
-
priority: number().int().min(1).max(5).default(3),
|
|
20481
|
-
level: string().optional(),
|
|
20482
|
-
attachments: array(AttachmentSchema).optional(),
|
|
20483
|
-
clickUrl: string().optional(),
|
|
20484
|
-
actions: array(NotificationActionSchema).optional(),
|
|
20485
|
-
sound: string().optional(),
|
|
20486
|
-
ttl: number().optional(),
|
|
20487
|
-
tag: string().optional(),
|
|
20488
|
-
deviceId: number().optional(),
|
|
20489
|
-
eventId: string().optional(),
|
|
20490
|
-
metadata: record(string(), unknown()).optional()
|
|
20491
|
-
});
|
|
20492
|
-
/** One declared native severity/priority level for a kind. */
|
|
20493
|
-
var TargetKindLevelSchema = object({
|
|
20494
|
-
id: string(),
|
|
20495
|
-
label: string(),
|
|
20496
|
-
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
20497
|
-
ordinal: number().int().min(1).max(5).nullable(),
|
|
20498
|
-
flags: object({
|
|
20499
|
-
critical: boolean().optional(),
|
|
20500
|
-
silent: boolean().optional(),
|
|
20501
|
-
noPush: boolean().optional()
|
|
20502
|
-
}).optional(),
|
|
20503
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
20504
|
-
requires: array(string()).optional(),
|
|
20505
|
-
description: string().optional()
|
|
20905
|
+
url: string()
|
|
20506
20906
|
});
|
|
20507
|
-
|
|
20508
|
-
|
|
20509
|
-
|
|
20510
|
-
|
|
20511
|
-
|
|
20512
|
-
|
|
20513
|
-
|
|
20514
|
-
|
|
20515
|
-
|
|
20516
|
-
|
|
20517
|
-
|
|
20518
|
-
|
|
20519
|
-
|
|
20520
|
-
|
|
20521
|
-
|
|
20522
|
-
format: array(NotificationFormatSchema),
|
|
20523
|
-
clickUrl: boolean(),
|
|
20524
|
-
sound: boolean(),
|
|
20525
|
-
ttl: boolean(),
|
|
20526
|
-
bodyMaxLen: number().int().positive()
|
|
20907
|
+
var StatusSchema = object({
|
|
20908
|
+
brokerCount: number(),
|
|
20909
|
+
embeddedRunning: boolean()
|
|
20910
|
+
});
|
|
20911
|
+
method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema), method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(_void(), StatusSchema);
|
|
20912
|
+
var NetworkEndpointSchema = object({
|
|
20913
|
+
url: string(),
|
|
20914
|
+
hostname: string(),
|
|
20915
|
+
port: number(),
|
|
20916
|
+
protocol: _enum(["http", "https"])
|
|
20917
|
+
});
|
|
20918
|
+
var NetworkAccessStatusSchema = object({
|
|
20919
|
+
connected: boolean(),
|
|
20920
|
+
endpoint: NetworkEndpointSchema.nullable(),
|
|
20921
|
+
error: string().optional()
|
|
20527
20922
|
});
|
|
20528
20923
|
/**
|
|
20529
|
-
*
|
|
20530
|
-
*
|
|
20531
|
-
*
|
|
20532
|
-
* the
|
|
20533
|
-
*
|
|
20924
|
+
* Optional, richer endpoint shape returned by providers that expose
|
|
20925
|
+
* MORE than one ingress concurrently (Tailscale Ingress with mixed
|
|
20926
|
+
* serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
|
|
20927
|
+
* the originating provider config (mode + sourcePort) so the
|
|
20928
|
+
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
20929
|
+
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
20534
20930
|
*/
|
|
20535
|
-
var
|
|
20536
|
-
var TargetKindSchema = object({
|
|
20537
|
-
kind: string(),
|
|
20538
|
-
label: string(),
|
|
20539
|
-
icon: string(),
|
|
20540
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
20541
|
-
addonId: string(),
|
|
20542
|
-
/**
|
|
20543
|
-
* URL of the kind's bundled BRAND icon, served by the providing addon over
|
|
20544
|
-
* its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
|
|
20545
|
-
* when the addon bundles no icon for that kind — the client then falls back
|
|
20546
|
-
* to a neutral glyph rather than rendering the raw `icon` NAME as text.
|
|
20547
|
-
*
|
|
20548
|
-
* Root-relative on purpose: it resolves against whatever origin serves a web
|
|
20549
|
-
* client, and a native client joins it onto its own hub base.
|
|
20550
|
-
*
|
|
20551
|
-
* DECLARED here deliberately. It used to travel as an undeclared passthrough
|
|
20552
|
-
* field that survived only because the runtime cap-router forwards provider
|
|
20553
|
-
* output verbatim — so every consumer had to re-declare it by hand to stop
|
|
20554
|
-
* its own Zod parse from stripping it, and the whole arrangement would have
|
|
20555
|
-
* broken silently the moment output validation was tightened anywhere.
|
|
20556
|
-
*/
|
|
20557
|
-
iconUrl: string().optional(),
|
|
20931
|
+
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
20558
20932
|
/**
|
|
20559
|
-
*
|
|
20560
|
-
*
|
|
20561
|
-
* The server knows this and therefore says it, because the client cannot
|
|
20562
|
-
* safely guess: a React-Native client renders SVG and raster through two
|
|
20563
|
-
* DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
|
|
20564
|
-
* not decode SVG on iOS/Android), so without this it silently fell back to a
|
|
20565
|
-
* placeholder glyph for every vector icon while the web build looked fine.
|
|
20566
|
-
*
|
|
20567
|
-
* Absent when {@link iconUrl} is absent, or for a legacy provider that has
|
|
20568
|
-
* not been updated — a client that cannot determine the type should prefer
|
|
20569
|
-
* its raster path, which is the safe default for an unknown image.
|
|
20933
|
+
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
20934
|
+
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
20570
20935
|
*/
|
|
20571
|
-
|
|
20572
|
-
|
|
20573
|
-
|
|
20574
|
-
|
|
20936
|
+
id: string(),
|
|
20937
|
+
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
20938
|
+
label: string(),
|
|
20939
|
+
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
20940
|
+
mode: string().optional(),
|
|
20941
|
+
/** Originating local port the ingress fronts (informational). */
|
|
20942
|
+
sourcePort: number().optional()
|
|
20575
20943
|
});
|
|
20944
|
+
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
20576
20945
|
/**
|
|
20577
|
-
*
|
|
20578
|
-
*
|
|
20579
|
-
*
|
|
20580
|
-
|
|
20581
|
-
|
|
20582
|
-
|
|
20583
|
-
|
|
20584
|
-
|
|
20585
|
-
|
|
20946
|
+
* core-blocks — user-authored TypeScript, stored in the kernel and executed in
|
|
20947
|
+
* its own process.
|
|
20948
|
+
*
|
|
20949
|
+
* Spec: `docs/superpowers/specs/2026-08-04-core-blocks-and-synthetic-devices-design.md`.
|
|
20950
|
+
*
|
|
20951
|
+
* The first use is **owning devices without being a device provider**: a block
|
|
20952
|
+
* declares devices under a system or custom integration and drives their state,
|
|
20953
|
+
* with the same `ctx` an addon gets. Automations come later; nothing here
|
|
20954
|
+
* models a trigger.
|
|
20955
|
+
*
|
|
20956
|
+
* **Stated plainly, because it does not change by being true:** a block has an
|
|
20957
|
+
* addon's powers — devices, storage, the event bus, `ctx.api`. It is a plugin
|
|
20958
|
+
* with no review step. What makes that survivable is not a sandbox, it is
|
|
20959
|
+
* PROCESS ISOLATION: one process per block, supervised by `CrashSupervisor`,
|
|
20960
|
+
* so a block that throws or never returns is marked `failed` and visible
|
|
20961
|
+
* instead of taking the hub with it (D6). Every method here is admin-only, and
|
|
20962
|
+
* must stay so.
|
|
20963
|
+
*/
|
|
20964
|
+
/** Where a block runs. The operator chooses — a block driving a device on an
|
|
20965
|
+
* agent is the reason placement is not fixed to the hub. */
|
|
20966
|
+
var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
|
|
20967
|
+
/** What a block's process is doing. Mirrors the addon runner's own lifecycle so
|
|
20968
|
+
* a failing block reads the same way a failing addon does. */
|
|
20969
|
+
var CoreBlockStatusSchema = _enum([
|
|
20970
|
+
"stopped",
|
|
20971
|
+
"starting",
|
|
20972
|
+
"running",
|
|
20973
|
+
"failed"
|
|
20974
|
+
]);
|
|
20975
|
+
/** Client-authored fields. */
|
|
20976
|
+
var CoreBlockInputSchema = object({
|
|
20977
|
+
name: string().min(1).max(120),
|
|
20978
|
+
/** TypeScript source. Compiled server-side before it is ever stored — a
|
|
20979
|
+
* block that does not compile is a fork failure the operator would meet
|
|
20980
|
+
* minutes later, in a log, instead of in the editor. */
|
|
20981
|
+
code: string().max(2e5),
|
|
20586
20982
|
enabled: boolean(),
|
|
20587
|
-
|
|
20588
|
-
|
|
20589
|
-
|
|
20590
|
-
|
|
20591
|
-
|
|
20592
|
-
|
|
20593
|
-
config: record(string(), unknown())
|
|
20983
|
+
placement: CoreBlockPlacementSchema,
|
|
20984
|
+
/**
|
|
20985
|
+
* Integration the block's devices hang from. Absent = the system integration
|
|
20986
|
+
* blocks share. A block may declare its own instead.
|
|
20987
|
+
*/
|
|
20988
|
+
integrationId: string().optional()
|
|
20594
20989
|
});
|
|
20595
|
-
/**
|
|
20596
|
-
var
|
|
20597
|
-
|
|
20598
|
-
|
|
20599
|
-
|
|
20600
|
-
|
|
20601
|
-
|
|
20602
|
-
|
|
20990
|
+
/** A stored block. */
|
|
20991
|
+
var CoreBlockSchema = CoreBlockInputSchema.extend({
|
|
20992
|
+
id: string(),
|
|
20993
|
+
createdAt: number(),
|
|
20994
|
+
updatedAt: number(),
|
|
20995
|
+
/** Server-stamped author. */
|
|
20996
|
+
createdBy: string(),
|
|
20997
|
+
status: CoreBlockStatusSchema,
|
|
20998
|
+
/**
|
|
20999
|
+
* Why the block is not running, when it is not. The operator's ONLY window
|
|
21000
|
+
* into a block that failed at load — a block that is silently absent is the
|
|
21001
|
+
* failure mode this whole feature has to avoid.
|
|
21002
|
+
*/
|
|
21003
|
+
lastError: string().optional(),
|
|
21004
|
+
/** Ms epoch of the last state change. */
|
|
21005
|
+
lastChangedAt: number()
|
|
20603
21006
|
});
|
|
20604
|
-
|
|
20605
|
-
|
|
21007
|
+
/** What a compile attempt produced. */
|
|
21008
|
+
var CoreBlockCompileResultSchema = object({
|
|
21009
|
+
ok: boolean(),
|
|
21010
|
+
/** Present when `ok` is false — the first error, in the author's words. */
|
|
20606
21011
|
error: string().optional(),
|
|
20607
|
-
|
|
21012
|
+
line: number().optional(),
|
|
21013
|
+
column: number().optional()
|
|
20608
21014
|
});
|
|
20609
|
-
|
|
20610
|
-
|
|
20611
|
-
|
|
20612
|
-
|
|
20613
|
-
|
|
20614
|
-
|
|
20615
|
-
|
|
20616
|
-
|
|
20617
|
-
|
|
20618
|
-
|
|
20619
|
-
|
|
20620
|
-
|
|
20621
|
-
|
|
20622
|
-
|
|
20623
|
-
|
|
20624
|
-
|
|
20625
|
-
|
|
20626
|
-
|
|
20627
|
-
|
|
20628
|
-
|
|
20629
|
-
|
|
20630
|
-
|
|
20631
|
-
|
|
20632
|
-
|
|
20633
|
-
|
|
20634
|
-
|
|
20635
|
-
|
|
20636
|
-
}
|
|
20637
|
-
};
|
|
21015
|
+
method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }), method(object({ blockId: string() }), object({ block: CoreBlockSchema.nullable() }), { auth: "admin" }), method(object({ block: CoreBlockInputSchema }), object({ block: CoreBlockSchema }), {
|
|
21016
|
+
kind: "mutation",
|
|
21017
|
+
auth: "admin",
|
|
21018
|
+
caller: "required"
|
|
21019
|
+
}), method(object({
|
|
21020
|
+
blockId: string(),
|
|
21021
|
+
block: CoreBlockInputSchema.partial()
|
|
21022
|
+
}), object({ block: CoreBlockSchema }), {
|
|
21023
|
+
kind: "mutation",
|
|
21024
|
+
auth: "admin",
|
|
21025
|
+
caller: "required"
|
|
21026
|
+
}), method(object({ blockId: string() }), object({ success: literal(true) }), {
|
|
21027
|
+
kind: "mutation",
|
|
21028
|
+
auth: "admin"
|
|
21029
|
+
}), method(object({
|
|
21030
|
+
blockId: string(),
|
|
21031
|
+
enabled: boolean()
|
|
21032
|
+
}), object({ block: CoreBlockSchema }), {
|
|
21033
|
+
kind: "mutation",
|
|
21034
|
+
auth: "admin"
|
|
21035
|
+
}), method(object({ code: string() }), CoreBlockCompileResultSchema, {
|
|
21036
|
+
kind: "mutation",
|
|
21037
|
+
auth: "admin"
|
|
21038
|
+
}), method(object({}), object({ libs: array(object({
|
|
21039
|
+
filePath: string(),
|
|
21040
|
+
content: string()
|
|
21041
|
+
})) }), { auth: "admin" });
|
|
20638
21042
|
/**
|
|
20639
21043
|
* Zod schemas for persisted record types.
|
|
20640
21044
|
*
|
|
@@ -20882,6 +21286,11 @@ var EventKindDescriptorSchema = object({
|
|
|
20882
21286
|
deviceId: number()
|
|
20883
21287
|
})
|
|
20884
21288
|
});
|
|
21289
|
+
/** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
|
|
21290
|
+
var EventKindsForDeviceSchema = object({
|
|
21291
|
+
deviceId: number(),
|
|
21292
|
+
kinds: array(EventKindDescriptorSchema).readonly()
|
|
21293
|
+
});
|
|
20885
21294
|
var SensorEventSchema = object({
|
|
20886
21295
|
id: string(),
|
|
20887
21296
|
/** The CAMERA the event is attributed to (a sensor linked to N cameras
|
|
@@ -21138,6 +21547,19 @@ var MediaFileSchema = object({
|
|
|
21138
21547
|
sizeBytes: number(),
|
|
21139
21548
|
timestamp: number()
|
|
21140
21549
|
});
|
|
21550
|
+
/**
|
|
21551
|
+
* One media row WITHOUT its bytes.
|
|
21552
|
+
*
|
|
21553
|
+
* A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
|
|
21554
|
+
* 140 s track), and a client that renders tiles from the media data plane needs
|
|
21555
|
+
* to know only WHAT EXISTS — the bytes then arrive per tile, lazily, over HTTP
|
|
21556
|
+
* with an immutable cache, instead of all at once inside a tRPC response that
|
|
21557
|
+
* blocks the whole view.
|
|
21558
|
+
*
|
|
21559
|
+
* `sizeBytes` is carried because it is what lets a client decide between the
|
|
21560
|
+
* stored blob and a `?variant=thumb` rendering without fetching either.
|
|
21561
|
+
*/
|
|
21562
|
+
var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
|
|
21141
21563
|
var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
|
|
21142
21564
|
var MAX_EVENT_QUERY_LIMIT = 5e3;
|
|
21143
21565
|
var DeviceEventQueryInput = object({
|
|
@@ -21287,7 +21709,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
21287
21709
|
}), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(object({ deviceId: number() }), _void(), {
|
|
21288
21710
|
kind: "mutation",
|
|
21289
21711
|
auth: "admin"
|
|
21290
|
-
}), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()), method(object({
|
|
21712
|
+
}), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()), method(object({ deviceIds: array(number()).min(1).max(200) }), array(EventKindsForDeviceSchema).readonly()), method(object({
|
|
21291
21713
|
deviceId: number(),
|
|
21292
21714
|
since: number().optional(),
|
|
21293
21715
|
until: number().optional(),
|
|
@@ -21361,7 +21783,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
21361
21783
|
}), array(MediaFileSchema).readonly()), method(object({
|
|
21362
21784
|
trackId: string(),
|
|
21363
21785
|
kinds: array(MediaFileKindEnum).optional()
|
|
21364
|
-
}), array(MediaFileSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), object({
|
|
21786
|
+
}), array(MediaFileSchema).readonly()), method(object({ trackId: string() }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), object({
|
|
21365
21787
|
deviceId: number(),
|
|
21366
21788
|
timestamp: number(),
|
|
21367
21789
|
frameWidth: number(),
|
|
@@ -26040,6 +26462,54 @@ Object.freeze({
|
|
|
26040
26462
|
addonId: null,
|
|
26041
26463
|
access: "create"
|
|
26042
26464
|
},
|
|
26465
|
+
"coreBlocks.compile": {
|
|
26466
|
+
capName: "core-blocks",
|
|
26467
|
+
capScope: "system",
|
|
26468
|
+
addonId: null,
|
|
26469
|
+
access: "create"
|
|
26470
|
+
},
|
|
26471
|
+
"coreBlocks.create": {
|
|
26472
|
+
capName: "core-blocks",
|
|
26473
|
+
capScope: "system",
|
|
26474
|
+
addonId: null,
|
|
26475
|
+
access: "create"
|
|
26476
|
+
},
|
|
26477
|
+
"coreBlocks.delete": {
|
|
26478
|
+
capName: "core-blocks",
|
|
26479
|
+
capScope: "system",
|
|
26480
|
+
addonId: null,
|
|
26481
|
+
access: "delete"
|
|
26482
|
+
},
|
|
26483
|
+
"coreBlocks.get": {
|
|
26484
|
+
capName: "core-blocks",
|
|
26485
|
+
capScope: "system",
|
|
26486
|
+
addonId: null,
|
|
26487
|
+
access: "view"
|
|
26488
|
+
},
|
|
26489
|
+
"coreBlocks.getTypeDefs": {
|
|
26490
|
+
capName: "core-blocks",
|
|
26491
|
+
capScope: "system",
|
|
26492
|
+
addonId: null,
|
|
26493
|
+
access: "view"
|
|
26494
|
+
},
|
|
26495
|
+
"coreBlocks.list": {
|
|
26496
|
+
capName: "core-blocks",
|
|
26497
|
+
capScope: "system",
|
|
26498
|
+
addonId: null,
|
|
26499
|
+
access: "view"
|
|
26500
|
+
},
|
|
26501
|
+
"coreBlocks.setEnabled": {
|
|
26502
|
+
capName: "core-blocks",
|
|
26503
|
+
capScope: "system",
|
|
26504
|
+
addonId: null,
|
|
26505
|
+
access: "create"
|
|
26506
|
+
},
|
|
26507
|
+
"coreBlocks.update": {
|
|
26508
|
+
capName: "core-blocks",
|
|
26509
|
+
capScope: "system",
|
|
26510
|
+
addonId: null,
|
|
26511
|
+
access: "create"
|
|
26512
|
+
},
|
|
26043
26513
|
"cover.close": {
|
|
26044
26514
|
capName: "cover",
|
|
26045
26515
|
capScope: "device",
|
|
@@ -27948,12 +28418,24 @@ Object.freeze({
|
|
|
27948
28418
|
addonId: null,
|
|
27949
28419
|
access: "create"
|
|
27950
28420
|
},
|
|
28421
|
+
"notificationRules.cancelSnooze": {
|
|
28422
|
+
capName: "notification-rules",
|
|
28423
|
+
capScope: "system",
|
|
28424
|
+
addonId: null,
|
|
28425
|
+
access: "create"
|
|
28426
|
+
},
|
|
27951
28427
|
"notificationRules.createRule": {
|
|
27952
28428
|
capName: "notification-rules",
|
|
27953
28429
|
capScope: "system",
|
|
27954
28430
|
addonId: null,
|
|
27955
28431
|
access: "create"
|
|
27956
28432
|
},
|
|
28433
|
+
"notificationRules.createSnooze": {
|
|
28434
|
+
capName: "notification-rules",
|
|
28435
|
+
capScope: "system",
|
|
28436
|
+
addonId: null,
|
|
28437
|
+
access: "create"
|
|
28438
|
+
},
|
|
27957
28439
|
"notificationRules.deleteRule": {
|
|
27958
28440
|
capName: "notification-rules",
|
|
27959
28441
|
capScope: "system",
|
|
@@ -27984,6 +28466,12 @@ Object.freeze({
|
|
|
27984
28466
|
addonId: null,
|
|
27985
28467
|
access: "view"
|
|
27986
28468
|
},
|
|
28469
|
+
"notificationRules.listSnoozes": {
|
|
28470
|
+
capName: "notification-rules",
|
|
28471
|
+
capScope: "system",
|
|
28472
|
+
addonId: null,
|
|
28473
|
+
access: "view"
|
|
28474
|
+
},
|
|
27987
28475
|
"notificationRules.setRuleEnabled": {
|
|
27988
28476
|
capName: "notification-rules",
|
|
27989
28477
|
capScope: "system",
|
|
@@ -28188,6 +28676,12 @@ Object.freeze({
|
|
|
28188
28676
|
addonId: null,
|
|
28189
28677
|
access: "view"
|
|
28190
28678
|
},
|
|
28679
|
+
"pipelineAnalytics.listEventKindsBatch": {
|
|
28680
|
+
capName: "pipeline-analytics",
|
|
28681
|
+
capScope: "device",
|
|
28682
|
+
addonId: null,
|
|
28683
|
+
access: "view"
|
|
28684
|
+
},
|
|
28191
28685
|
"pipelineAnalytics.listOpsLog": {
|
|
28192
28686
|
capName: "pipeline-analytics",
|
|
28193
28687
|
capScope: "device",
|
|
@@ -28200,6 +28694,12 @@ Object.freeze({
|
|
|
28200
28694
|
addonId: null,
|
|
28201
28695
|
access: "view"
|
|
28202
28696
|
},
|
|
28697
|
+
"pipelineAnalytics.listTrackMedia": {
|
|
28698
|
+
capName: "pipeline-analytics",
|
|
28699
|
+
capScope: "device",
|
|
28700
|
+
addonId: null,
|
|
28701
|
+
access: "view"
|
|
28702
|
+
},
|
|
28203
28703
|
"pipelineAnalytics.listTracks": {
|
|
28204
28704
|
capName: "pipeline-analytics",
|
|
28205
28705
|
capScope: "device",
|
|
@@ -30670,11 +31170,18 @@ var HaBaseChildDevice = class HaBaseChildDevice extends BaseDevice {
|
|
|
30670
31170
|
async onActivate() {
|
|
30671
31171
|
await super.onActivate();
|
|
30672
31172
|
await this.refreshFeatures();
|
|
30673
|
-
await this.subscribeBrokerEntity()
|
|
30674
|
-
|
|
31173
|
+
if (await this.subscribeBrokerEntity()) {
|
|
31174
|
+
this.deviceLogger.info("HA entity ready", { meta: {
|
|
31175
|
+
entityId: this.entityId,
|
|
31176
|
+
type: this.ctx.deviceMeta.type,
|
|
31177
|
+
...this.features.length > 0 ? { features: [...this.features] } : {}
|
|
31178
|
+
} });
|
|
31179
|
+
return;
|
|
31180
|
+
}
|
|
31181
|
+
this.deviceLogger.warn("HA entity registered but NOT subscribed — it will receive nothing", { meta: {
|
|
30675
31182
|
entityId: this.entityId,
|
|
30676
|
-
|
|
30677
|
-
|
|
31183
|
+
brokerId: this.brokerId,
|
|
31184
|
+
type: this.ctx.deviceMeta.type
|
|
30678
31185
|
} });
|
|
30679
31186
|
}
|
|
30680
31187
|
async removeDevice() {
|
|
@@ -30778,6 +31285,8 @@ var HaBaseChildDevice = class HaBaseChildDevice extends BaseDevice {
|
|
|
30778
31285
|
* already-attached handler and `handleStatePush` fires with the real
|
|
30779
31286
|
* current state (seeding the cap-state slice at construction time).
|
|
30780
31287
|
*/
|
|
31288
|
+
/** True when the entity is genuinely subscribed. The caller uses it to
|
|
31289
|
+
* decide whether "ready" is an honest thing to log. */
|
|
30781
31290
|
async subscribeBrokerEntity() {
|
|
30782
31291
|
try {
|
|
30783
31292
|
const result = await this.ctx.api.broker.subscribe.mutate({
|
|
@@ -30785,12 +31294,14 @@ var HaBaseChildDevice = class HaBaseChildDevice extends BaseDevice {
|
|
|
30785
31294
|
filter: { entityIds: [this.entityId] }
|
|
30786
31295
|
});
|
|
30787
31296
|
this.brokerSubscriptionId = result.subscriptionId;
|
|
31297
|
+
return true;
|
|
30788
31298
|
} catch (err) {
|
|
30789
31299
|
this.deviceLogger.warn("ha-child failed to register broker subscription", { meta: {
|
|
30790
31300
|
entityId: this.entityId,
|
|
30791
31301
|
brokerId: this.brokerId,
|
|
30792
31302
|
error: errMsg(err)
|
|
30793
31303
|
} });
|
|
31304
|
+
return false;
|
|
30794
31305
|
}
|
|
30795
31306
|
}
|
|
30796
31307
|
attachEventBusListener() {
|
|
@@ -36814,6 +37325,7 @@ function homeassistantTargetKind(addonId) {
|
|
|
36814
37325
|
max: 1
|
|
36815
37326
|
},
|
|
36816
37327
|
actions: 3,
|
|
37328
|
+
actionIcons: true,
|
|
36817
37329
|
levels: [
|
|
36818
37330
|
{
|
|
36819
37331
|
id: "default",
|
|
@@ -36869,6 +37381,21 @@ function applyLevel(data, level) {
|
|
|
36869
37381
|
}
|
|
36870
37382
|
data["push"] = push;
|
|
36871
37383
|
}
|
|
37384
|
+
var HA_ACTION_ICONS = {
|
|
37385
|
+
acknowledge: "mdi:check",
|
|
37386
|
+
dismiss: "mdi:close",
|
|
37387
|
+
silence: "mdi:bell-off",
|
|
37388
|
+
view: "mdi:eye",
|
|
37389
|
+
play: "mdi:play",
|
|
37390
|
+
open: "mdi:door-open",
|
|
37391
|
+
close: "mdi:door-closed",
|
|
37392
|
+
lock: "mdi:lock",
|
|
37393
|
+
unlock: "mdi:lock-open",
|
|
37394
|
+
arm: "mdi:shield-check",
|
|
37395
|
+
disarm: "mdi:shield-off",
|
|
37396
|
+
light: "mdi:lightbulb",
|
|
37397
|
+
alert: "mdi:alert"
|
|
37398
|
+
};
|
|
36872
37399
|
/**
|
|
36873
37400
|
* Build the `notify.<service>` `service_data` from a prepared (degraded)
|
|
36874
37401
|
* notification. PURE — no WS, unit-testable in isolation.
|
|
@@ -36885,7 +37412,8 @@ function buildNotifyServiceData(prepared) {
|
|
|
36885
37412
|
if (prepared.actions.length > 0) data["actions"] = prepared.actions.map((a) => ({
|
|
36886
37413
|
action: a.id,
|
|
36887
37414
|
title: a.label,
|
|
36888
|
-
...a.url !== void 0 ? { uri: a.url } : {}
|
|
37415
|
+
...a.url !== void 0 ? { uri: a.url } : {},
|
|
37416
|
+
...a.icon !== void 0 ? { icon: HA_ACTION_ICONS[a.icon] } : {}
|
|
36889
37417
|
}));
|
|
36890
37418
|
if (prepared.clickUrl !== null) {
|
|
36891
37419
|
data["url"] = prepared.clickUrl;
|
|
@@ -37229,6 +37757,19 @@ async function reconcileBroker(brokerId, deps) {
|
|
|
37229
37757
|
* whose integration no longer exists should be cleaned up. Brokers with no
|
|
37230
37758
|
* integrationId were created manually and are never auto-removed.
|
|
37231
37759
|
*/
|
|
37760
|
+
/**
|
|
37761
|
+
* Brokers whose spawning integration is gone.
|
|
37762
|
+
*
|
|
37763
|
+
* **The caller REPORTS these; it does not delete them.** This function used to
|
|
37764
|
+
* drive a delete, and on 2026-08-05 that erased the operator's Home Assistant
|
|
37765
|
+
* broker — host and token — when `integrations.list` returned an empty array
|
|
37766
|
+
* during a hub restart: nothing "survived", so everything was an orphan. A
|
|
37767
|
+
* broker cannot be rebuilt from an integration record, so the loss was
|
|
37768
|
+
* permanent and the doorbell simply stopped existing.
|
|
37769
|
+
*
|
|
37770
|
+
* Kept as a pure query because naming an orphan is useful; acting on one
|
|
37771
|
+
* automatically is not.
|
|
37772
|
+
*/
|
|
37232
37773
|
function computeBrokerCleanup(brokers, survivingIntegrationIds) {
|
|
37233
37774
|
return brokers.filter((b) => b.integrationId !== void 0 && !survivingIntegrationIds.has(b.integrationId)).map((b) => b.id);
|
|
37234
37775
|
}
|
|
@@ -37816,15 +38357,15 @@ var HaProviderAddon = class HaProviderAddon extends BaseDeviceProvider {
|
|
|
37816
38357
|
}
|
|
37817
38358
|
const linkedBrokers = linkBrokersToIntegrations(this.config.brokers, integrationsWithBrokerId);
|
|
37818
38359
|
if (linkedBrokers.some((b, i) => b !== this.config.brokers[i])) await this.updateGlobalSettings({ brokers: linkedBrokers });
|
|
37819
|
-
const
|
|
37820
|
-
if (toRemove.length === 0) return;
|
|
37821
|
-
for (const id of toRemove) await this.requireRegistry().removeEntry(id);
|
|
37822
|
-
const nextBrokers = this.config.brokers.filter((b) => !toRemove.includes(b.id));
|
|
37823
|
-
await this.updateGlobalSettings({ brokers: nextBrokers });
|
|
38360
|
+
const orphans = computeBrokerCleanup(this.config.brokers, survivingIntegrationIds);
|
|
37824
38361
|
this.ctx.logger.info("integration→broker reconcile", { meta: {
|
|
37825
|
-
brokerCount:
|
|
38362
|
+
brokerCount: this.config.brokers.length,
|
|
37826
38363
|
integrationCount: haIntegrations.length,
|
|
37827
|
-
|
|
38364
|
+
orphans: orphans.length
|
|
38365
|
+
} });
|
|
38366
|
+
if (orphans.length > 0) this.ctx.logger.warn("broker entries have no surviving integration — KEPT", { meta: {
|
|
38367
|
+
brokerIds: orphans,
|
|
38368
|
+
integrationCount: haIntegrations.length
|
|
37828
38369
|
} });
|
|
37829
38370
|
} catch (err) {
|
|
37830
38371
|
this.ctx.logger.warn("integration→broker reconcile failed", { meta: { error: errMsg(err) } });
|