@camstack/addon-post-analysis 1.2.33 → 1.2.34

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.
@@ -9515,6 +9515,276 @@ var MaskGridDimsSchema = object({
9515
9515
  height: number()
9516
9516
  });
9517
9517
  /**
9518
+ * notification-output — canonical, capability-gated notification delivery.
9519
+ *
9520
+ * Apprise-derived model (see
9521
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
9522
+ * callers emit ONE canonical `Notification`; each provider declares a
9523
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
9524
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
9525
+ * message to what the kind supports — callers never special-case a service.
9526
+ *
9527
+ * DESIGN DECISIONS (locked):
9528
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
9529
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
9530
+ * cap. Rationale: the admin UI needs one uniform surface across the
9531
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
9532
+ * alternative would fork the UI per addon and cannot host the
9533
+ * discovery→adopt flow.
9534
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
9535
+ * the generated cap-mount auto-`concatCollection`-fans them across every
9536
+ * registered provider (notifiers addon + HA addon) so one catalog is
9537
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
9538
+ * `addonId` the generated collection router extracts from the call input.
9539
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
9540
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
9541
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
9542
+ * base64 fallback needed.
9543
+ *
9544
+ * TODO (deferred, closed-set change — separate decision): add
9545
+ * `providerKind: 'notify'` so notification providers surface on the unified
9546
+ * admin "Integrations" page.
9547
+ */
9548
+ /**
9549
+ * Zentik-derived typed-media enum — the superset across every kind. Each
9550
+ * adapter picks what it supports and the degrade engine filters the rest.
9551
+ */
9552
+ var AttachmentMediaTypeSchema = _enum([
9553
+ "image",
9554
+ "video",
9555
+ "gif",
9556
+ "audio",
9557
+ "icon"
9558
+ ]);
9559
+ /**
9560
+ * A single attachment. Exactly one of `url` (remote source, most adapters
9561
+ * prefer this) or `bytes` (inline source; required for Pushover-style
9562
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
9563
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
9564
+ */
9565
+ var AttachmentSchema = object({
9566
+ mediaType: AttachmentMediaTypeSchema,
9567
+ url: string().optional(),
9568
+ bytes: _instanceof(Uint8Array).optional(),
9569
+ mime: string().optional(),
9570
+ name: string().optional()
9571
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
9572
+ var NotificationFormatSchema = _enum([
9573
+ "text",
9574
+ "markdown",
9575
+ "html"
9576
+ ]);
9577
+ /**
9578
+ * The CLOSED icon vocabulary an action button may use.
9579
+ *
9580
+ * A closed set, not a free string, and that is the whole point: an arbitrary
9581
+ * icon name is one that ntfy renders, zentik silently drops, and nobody
9582
+ * notices — the same class of gap as a zone vocabulary nothing produced
9583
+ * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
9584
+ * declares `actionIcons: false` and the degrade engine strips the field.
9585
+ *
9586
+ * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
9587
+ * renderer's icon set; "acknowledge" survives an adapter that draws it
9588
+ * differently.
9589
+ */
9590
+ var NotificationActionIconSchema = _enum([
9591
+ "acknowledge",
9592
+ "dismiss",
9593
+ "silence",
9594
+ "view",
9595
+ "play",
9596
+ "open",
9597
+ "close",
9598
+ "lock",
9599
+ "unlock",
9600
+ "arm",
9601
+ "disarm",
9602
+ "light",
9603
+ "alert"
9604
+ ]);
9605
+ /** A single tap-through action button. */
9606
+ var NotificationActionSchema = object({
9607
+ id: string(),
9608
+ label: string(),
9609
+ url: string().optional(),
9610
+ /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
9611
+ icon: NotificationActionIconSchema.optional(),
9612
+ /**
9613
+ * Renders in a warning style where the notifier supports it.
9614
+ *
9615
+ * A HINT, never a gate. The callback's authority is its token and nothing
9616
+ * else — see `notification-center/action-token.ts` for what that does and
9617
+ * does not buy.
9618
+ */
9619
+ destructive: boolean().optional()
9620
+ });
9621
+ /**
9622
+ * The canonical notification. `body` is the only hard field (Apprise model).
9623
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
9624
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
9625
+ * the adapter maps this ordinal onto its native level. `level?` is an
9626
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
9627
+ * `priority` for that one target.
9628
+ */
9629
+ var NotificationSchema = object({
9630
+ body: string(),
9631
+ title: string().optional(),
9632
+ format: NotificationFormatSchema.default("text"),
9633
+ priority: number().int().min(1).max(5).default(3),
9634
+ level: string().optional(),
9635
+ attachments: array(AttachmentSchema).optional(),
9636
+ clickUrl: string().optional(),
9637
+ actions: array(NotificationActionSchema).optional(),
9638
+ sound: string().optional(),
9639
+ ttl: number().optional(),
9640
+ tag: string().optional(),
9641
+ deviceId: number().optional(),
9642
+ eventId: string().optional(),
9643
+ metadata: record(string(), unknown()).optional()
9644
+ });
9645
+ /** One declared native severity/priority level for a kind. */
9646
+ var TargetKindLevelSchema = object({
9647
+ id: string(),
9648
+ label: string(),
9649
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
9650
+ ordinal: number().int().min(1).max(5).nullable(),
9651
+ flags: object({
9652
+ critical: boolean().optional(),
9653
+ silent: boolean().optional(),
9654
+ noPush: boolean().optional()
9655
+ }).optional(),
9656
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
9657
+ requires: array(string()).optional(),
9658
+ description: string().optional()
9659
+ });
9660
+ /** The full capability block consulted before dispatch. */
9661
+ var TargetKindCapsSchema = object({
9662
+ attachments: object({
9663
+ mediaTypes: array(AttachmentMediaTypeSchema),
9664
+ mode: _enum([
9665
+ "url",
9666
+ "bytes",
9667
+ "both"
9668
+ ]),
9669
+ max: number().int().nonnegative(),
9670
+ maxBytes: number().int().positive().optional()
9671
+ }),
9672
+ /** Max action buttons (0 = none). */
9673
+ actions: number().int().nonnegative(),
9674
+ /**
9675
+ * Whether this kind renders a per-action ICON.
9676
+ *
9677
+ * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
9678
+ * run on the addon cap path — three production failures in one day taught
9679
+ * this repo that once. Absent is read as false by the degrade engine, which
9680
+ * is the safe direction: an icon that is not rendered costs nothing, an icon
9681
+ * assumed and dropped costs the operator's trust in the field.
9682
+ */
9683
+ actionIcons: boolean().optional(),
9684
+ levels: array(TargetKindLevelSchema),
9685
+ format: array(NotificationFormatSchema),
9686
+ clickUrl: boolean(),
9687
+ sound: boolean(),
9688
+ ttl: boolean(),
9689
+ bodyMaxLen: number().int().positive()
9690
+ });
9691
+ /**
9692
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
9693
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
9694
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
9695
+ * the union is large and not meant for runtime validation here; the exported
9696
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
9697
+ */
9698
+ var ConfigSchemaPassthrough$1 = unknown();
9699
+ var TargetKindSchema = object({
9700
+ kind: string(),
9701
+ label: string(),
9702
+ icon: string(),
9703
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
9704
+ addonId: string(),
9705
+ /**
9706
+ * URL of the kind's bundled BRAND icon, served by the providing addon over
9707
+ * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
9708
+ * when the addon bundles no icon for that kind — the client then falls back
9709
+ * to a neutral glyph rather than rendering the raw `icon` NAME as text.
9710
+ *
9711
+ * Root-relative on purpose: it resolves against whatever origin serves a web
9712
+ * client, and a native client joins it onto its own hub base.
9713
+ *
9714
+ * DECLARED here deliberately. It used to travel as an undeclared passthrough
9715
+ * field that survived only because the runtime cap-router forwards provider
9716
+ * output verbatim — so every consumer had to re-declare it by hand to stop
9717
+ * its own Zod parse from stripping it, and the whole arrangement would have
9718
+ * broken silently the moment output validation was tightened anywhere.
9719
+ */
9720
+ iconUrl: string().optional(),
9721
+ /**
9722
+ * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
9723
+ *
9724
+ * The server knows this and therefore says it, because the client cannot
9725
+ * safely guess: a React-Native client renders SVG and raster through two
9726
+ * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
9727
+ * not decode SVG on iOS/Android), so without this it silently fell back to a
9728
+ * placeholder glyph for every vector icon while the web build looked fine.
9729
+ *
9730
+ * Absent when {@link iconUrl} is absent, or for a legacy provider that has
9731
+ * not been updated — a client that cannot determine the type should prefer
9732
+ * its raster path, which is the safe default for an unknown image.
9733
+ */
9734
+ iconMediaType: string().optional(),
9735
+ configSchema: ConfigSchemaPassthrough$1,
9736
+ supportsDiscovery: boolean(),
9737
+ caps: TargetKindCapsSchema
9738
+ });
9739
+ /**
9740
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
9741
+ * (return a presence marker only) when serving `listTargets` — never
9742
+ * round-trip a stored secret to the UI.
9743
+ */
9744
+ var TargetSchema = object({
9745
+ id: string(),
9746
+ name: string(),
9747
+ kind: string(),
9748
+ addonId: string(),
9749
+ enabled: boolean(),
9750
+ config: record(string(), unknown())
9751
+ });
9752
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
9753
+ var DiscoveredTargetSchema = object({
9754
+ kind: string(),
9755
+ suggestedName: string(),
9756
+ config: record(string(), unknown())
9757
+ });
9758
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
9759
+ var RenderedAsSchema = object({
9760
+ level: string(),
9761
+ format: NotificationFormatSchema,
9762
+ attachmentsSent: number().int().nonnegative(),
9763
+ actionsSent: number().int().nonnegative(),
9764
+ truncated: boolean(),
9765
+ dropped: array(string())
9766
+ });
9767
+ var SendResultSchema = object({
9768
+ success: boolean(),
9769
+ error: string().optional(),
9770
+ renderedAs: RenderedAsSchema.optional()
9771
+ });
9772
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
9773
+ var TestResultSchema = SendResultSchema;
9774
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
9775
+ kind: string(),
9776
+ config: record(string(), unknown()).optional()
9777
+ }), array(DiscoveredTargetSchema)), method(object({
9778
+ targetId: string(),
9779
+ notification: NotificationSchema
9780
+ }), SendResultSchema, { kind: "mutation" }), method(object({
9781
+ targetId: string(),
9782
+ sample: NotificationSchema.optional()
9783
+ }), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
9784
+ targetId: string(),
9785
+ enabled: boolean()
9786
+ }), _void(), { kind: "mutation" });
9787
+ /**
9518
9788
  * notification-rules — the Notification Center rule surface (P1 core).
9519
9789
  *
9520
9790
  * Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
@@ -9684,6 +9954,41 @@ var NcRuleActionSchema = discriminatedUnion("kind", [object({
9684
9954
  args: record(string(), unknown()).optional()
9685
9955
  })]);
9686
9956
  /**
9957
+ * A named, ordered run of steps with its own throttle.
9958
+ *
9959
+ * `minDelaySec` exists because a noisy rule otherwise hammers a physical
9960
+ * actuator — the rule's own cooldown governs NOTIFICATIONS, which is a
9961
+ * different budget from "how often may this gate actually open".
9962
+ */
9963
+ var NcRuleActionSequenceSchema = object({
9964
+ name: string().min(1).max(120),
9965
+ enabled: boolean(),
9966
+ minDelaySec: number().int().min(0).max(86400).optional(),
9967
+ actions: array(NcRuleActionSchema).min(1)
9968
+ });
9969
+ /**
9970
+ * One button carried by the notification, running a named sequence on tap.
9971
+ *
9972
+ * **Read this before adding a button that does something physical.** The tap
9973
+ * arrives over a link that travelled through third-party infrastructure — ntfy,
9974
+ * a push relay, whatever forwarded the message — and the callback's ONLY
9975
+ * authority is the token in that link: single-use, short-lived, bound to this
9976
+ * one action of this one notification. It does not identify who tapped.
9977
+ * Whoever holds the notification can run the button, once, inside the window.
9978
+ * That is the operator's explicit choice (2026-08-05), and `destructive` is a
9979
+ * rendering hint, not a second gate. [D47](decisions/adr-0047.md).
9980
+ */
9981
+ var NcRuleNotificationButtonSchema = object({
9982
+ /** Stable id — travels in the callback and identifies the button in logs. */
9983
+ id: string().min(1).max(64),
9984
+ label: string().min(1).max(40),
9985
+ /** Name of a sequence in `onTrigger`. The dispatcher drops a button whose
9986
+ * sequence does not exist rather than minting a token for nothing. */
9987
+ sequence: string().min(1).max(120),
9988
+ icon: NotificationActionIconSchema.optional(),
9989
+ destructive: boolean().optional()
9990
+ });
9991
+ /**
9687
9992
  * Sequences a rule runs, by hook point.
9688
9993
  *
9689
9994
  * ONLY `onTrigger` is here, deliberately. The reference also has activation /
@@ -9691,14 +9996,26 @@ var NcRuleActionSchema = discriminatedUnion("kind", [object({
9691
9996
  * repo's expensive failure mode is declaring a surface nothing produces, so a
9692
9997
  * hook appears here in the same change that produces its edge, never before.
9693
9998
  */
9694
- var NcRuleActionsSchema = object({
9695
- /** Runs when the rule MATCHES. */
9696
- onTrigger: array(object({
9697
- name: string().min(1).max(120),
9698
- enabled: boolean(),
9699
- minDelaySec: number().int().min(0).max(86400).optional(),
9700
- actions: array(NcRuleActionSchema).min(1)
9701
- })).optional() });
9999
+ var NcRuleActionsSchema = object({
10000
+ /** Runs when the rule MATCHES. */
10001
+ onTrigger: array(NcRuleActionSequenceSchema).optional(),
10002
+ /**
10003
+ * Buttons the NOTIFICATION carries, each running one of this rule's
10004
+ * sequences when tapped.
10005
+ *
10006
+ * Deliberately a REFERENCE to a sequence rather than a second place to
10007
+ * author steps. A button that could define its own actions would be a
10008
+ * parallel actuation vocabulary — the executor's device-scope check, the
10009
+ * stop-at-first-failure rule and the per-sequence throttle all live on
10010
+ * sequences, and a second authoring surface would drift from every one of
10011
+ * them.
10012
+ *
10013
+ * A sequence reachable ONLY by a button simply appears in `onTrigger` with
10014
+ * `enabled: false`: it is then authored, throttled and validated like the
10015
+ * rest, and nothing runs it automatically.
10016
+ */
10017
+ buttons: array(NcRuleNotificationButtonSchema).max(8).optional()
10018
+ });
9702
10019
  var NcConditionsSchema = object({
9703
10020
  /** Gate on ANOTHER device's current state (the alarm armed, a switch on). */
9704
10021
  deviceState: object({
@@ -20023,14 +20340,14 @@ var LlmProfileSchema = object({
20023
20340
  /** ConfigUISchema tree passed through untyped on the wire (the
20024
20341
  * notification-output `ConfigSchemaPassthrough` precedent at
20025
20342
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
20026
- var ConfigSchemaPassthrough$1 = unknown();
20343
+ var ConfigSchemaPassthrough = unknown();
20027
20344
  var LlmProfileKindDescriptorSchema = object({
20028
20345
  kind: LlmProfileKindSchema,
20029
20346
  label: string(),
20030
20347
  icon: string(),
20031
20348
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
20032
20349
  addonId: string(),
20033
- configSchema: ConfigSchemaPassthrough$1
20350
+ configSchema: ConfigSchemaPassthrough
20034
20351
  });
20035
20352
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
20036
20353
  var LlmDefaultSchema = object({
@@ -20561,228 +20878,6 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
20561
20878
  });
20562
20879
  method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
20563
20880
  /**
20564
- * notification-output — canonical, capability-gated notification delivery.
20565
- *
20566
- * Apprise-derived model (see
20567
- * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
20568
- * callers emit ONE canonical `Notification`; each provider declares a
20569
- * per-kind capability descriptor (`TargetKind`), and the pure degrade
20570
- * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
20571
- * message to what the kind supports — callers never special-case a service.
20572
- *
20573
- * DESIGN DECISIONS (locked):
20574
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
20575
- * `setTargetEnabled`), each provider persisting via the `settings-store`
20576
- * cap. Rationale: the admin UI needs one uniform surface across the
20577
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
20578
- * alternative would fork the UI per addon and cannot host the
20579
- * discovery→adopt flow.
20580
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
20581
- * the generated cap-mount auto-`concatCollection`-fans them across every
20582
- * registered provider (notifiers addon + HA addon) so one catalog is
20583
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
20584
- * `addonId` the generated collection router extracts from the call input.
20585
- * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
20586
- * transformer) + UDS MsgPack both round-trip typed arrays — already used by
20587
- * `storage` / `storage-provider` / `recording` caps over the same path. No
20588
- * base64 fallback needed.
20589
- *
20590
- * TODO (deferred, closed-set change — separate decision): add
20591
- * `providerKind: 'notify'` so notification providers surface on the unified
20592
- * admin "Integrations" page.
20593
- */
20594
- /**
20595
- * Zentik-derived typed-media enum — the superset across every kind. Each
20596
- * adapter picks what it supports and the degrade engine filters the rest.
20597
- */
20598
- var AttachmentMediaTypeSchema = _enum([
20599
- "image",
20600
- "video",
20601
- "gif",
20602
- "audio",
20603
- "icon"
20604
- ]);
20605
- /**
20606
- * A single attachment. Exactly one of `url` (remote source, most adapters
20607
- * prefer this) or `bytes` (inline source; required for Pushover-style
20608
- * bytes-only kinds) MUST be present — the degrade engine expresses a
20609
- * url→bytes fetch as a `needsFetch` directive the adapter executes.
20610
- */
20611
- var AttachmentSchema = object({
20612
- mediaType: AttachmentMediaTypeSchema,
20613
- url: string().optional(),
20614
- bytes: _instanceof(Uint8Array).optional(),
20615
- mime: string().optional(),
20616
- name: string().optional()
20617
- }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
20618
- var NotificationFormatSchema = _enum([
20619
- "text",
20620
- "markdown",
20621
- "html"
20622
- ]);
20623
- /** A single tap-through action button. */
20624
- var NotificationActionSchema = object({
20625
- id: string(),
20626
- label: string(),
20627
- url: string().optional()
20628
- });
20629
- /**
20630
- * The canonical notification. `body` is the only hard field (Apprise model).
20631
- * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
20632
- * NOT a fixed severity enum — each kind declares its own `caps.levels` and
20633
- * the adapter maps this ordinal onto its native level. `level?` is an
20634
- * optional kind-native level id (`emergency`, `silent`, …) that overrides
20635
- * `priority` for that one target.
20636
- */
20637
- var NotificationSchema = object({
20638
- body: string(),
20639
- title: string().optional(),
20640
- format: NotificationFormatSchema.default("text"),
20641
- priority: number().int().min(1).max(5).default(3),
20642
- level: string().optional(),
20643
- attachments: array(AttachmentSchema).optional(),
20644
- clickUrl: string().optional(),
20645
- actions: array(NotificationActionSchema).optional(),
20646
- sound: string().optional(),
20647
- ttl: number().optional(),
20648
- tag: string().optional(),
20649
- deviceId: number().optional(),
20650
- eventId: string().optional(),
20651
- metadata: record(string(), unknown()).optional()
20652
- });
20653
- /** One declared native severity/priority level for a kind. */
20654
- var TargetKindLevelSchema = object({
20655
- id: string(),
20656
- label: string(),
20657
- /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
20658
- ordinal: number().int().min(1).max(5).nullable(),
20659
- flags: object({
20660
- critical: boolean().optional(),
20661
- silent: boolean().optional(),
20662
- noPush: boolean().optional()
20663
- }).optional(),
20664
- /** e.g. Pushover `emergency` requires `retry` / `expire`. */
20665
- requires: array(string()).optional(),
20666
- description: string().optional()
20667
- });
20668
- /** The full capability block consulted before dispatch. */
20669
- var TargetKindCapsSchema = object({
20670
- attachments: object({
20671
- mediaTypes: array(AttachmentMediaTypeSchema),
20672
- mode: _enum([
20673
- "url",
20674
- "bytes",
20675
- "both"
20676
- ]),
20677
- max: number().int().nonnegative(),
20678
- maxBytes: number().int().positive().optional()
20679
- }),
20680
- /** Max action buttons (0 = none). */
20681
- actions: number().int().nonnegative(),
20682
- levels: array(TargetKindLevelSchema),
20683
- format: array(NotificationFormatSchema),
20684
- clickUrl: boolean(),
20685
- sound: boolean(),
20686
- ttl: boolean(),
20687
- bodyMaxLen: number().int().positive()
20688
- });
20689
- /**
20690
- * `configSchema` is a `ConfigUISchema` tree passed through to the admin
20691
- * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
20692
- * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
20693
- * the union is large and not meant for runtime validation here; the exported
20694
- * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
20695
- */
20696
- var ConfigSchemaPassthrough = unknown();
20697
- var TargetKindSchema = object({
20698
- kind: string(),
20699
- label: string(),
20700
- icon: string(),
20701
- /** Stamped by each provider so the concat-fanned catalog stays routable. */
20702
- addonId: string(),
20703
- /**
20704
- * URL of the kind's bundled BRAND icon, served by the providing addon over
20705
- * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
20706
- * when the addon bundles no icon for that kind — the client then falls back
20707
- * to a neutral glyph rather than rendering the raw `icon` NAME as text.
20708
- *
20709
- * Root-relative on purpose: it resolves against whatever origin serves a web
20710
- * client, and a native client joins it onto its own hub base.
20711
- *
20712
- * DECLARED here deliberately. It used to travel as an undeclared passthrough
20713
- * field that survived only because the runtime cap-router forwards provider
20714
- * output verbatim — so every consumer had to re-declare it by hand to stop
20715
- * its own Zod parse from stripping it, and the whole arrangement would have
20716
- * broken silently the moment output validation was tightened anywhere.
20717
- */
20718
- iconUrl: string().optional(),
20719
- /**
20720
- * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
20721
- *
20722
- * The server knows this and therefore says it, because the client cannot
20723
- * safely guess: a React-Native client renders SVG and raster through two
20724
- * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
20725
- * not decode SVG on iOS/Android), so without this it silently fell back to a
20726
- * placeholder glyph for every vector icon while the web build looked fine.
20727
- *
20728
- * Absent when {@link iconUrl} is absent, or for a legacy provider that has
20729
- * not been updated — a client that cannot determine the type should prefer
20730
- * its raster path, which is the safe default for an unknown image.
20731
- */
20732
- iconMediaType: string().optional(),
20733
- configSchema: ConfigSchemaPassthrough,
20734
- supportsDiscovery: boolean(),
20735
- caps: TargetKindCapsSchema
20736
- });
20737
- /**
20738
- * A persisted target. `config` holds secrets; providers REDACT secret fields
20739
- * (return a presence marker only) when serving `listTargets` — never
20740
- * round-trip a stored secret to the UI.
20741
- */
20742
- var TargetSchema = object({
20743
- id: string(),
20744
- name: string(),
20745
- kind: string(),
20746
- addonId: string(),
20747
- enabled: boolean(),
20748
- config: record(string(), unknown())
20749
- });
20750
- /** A discovery-surfaced candidate (config is partial + non-secret). */
20751
- var DiscoveredTargetSchema = object({
20752
- kind: string(),
20753
- suggestedName: string(),
20754
- config: record(string(), unknown())
20755
- });
20756
- /** The degrade engine's report — what was resolved / dropped / degraded. */
20757
- var RenderedAsSchema = object({
20758
- level: string(),
20759
- format: NotificationFormatSchema,
20760
- attachmentsSent: number().int().nonnegative(),
20761
- actionsSent: number().int().nonnegative(),
20762
- truncated: boolean(),
20763
- dropped: array(string())
20764
- });
20765
- var SendResultSchema = object({
20766
- success: boolean(),
20767
- error: string().optional(),
20768
- renderedAs: RenderedAsSchema.optional()
20769
- });
20770
- /** Same shape as SendResult — kept as a distinct name for the test panel. */
20771
- var TestResultSchema = SendResultSchema;
20772
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
20773
- kind: string(),
20774
- config: record(string(), unknown()).optional()
20775
- }), array(DiscoveredTargetSchema)), method(object({
20776
- targetId: string(),
20777
- notification: NotificationSchema
20778
- }), SendResultSchema, { kind: "mutation" }), method(object({
20779
- targetId: string(),
20780
- sample: NotificationSchema.optional()
20781
- }), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
20782
- targetId: string(),
20783
- enabled: boolean()
20784
- }), _void(), { kind: "mutation" });
20785
- /**
20786
20881
  * core-blocks — user-authored TypeScript, stored in the kernel and executed in
20787
20882
  * its own process.
20788
20883
  *