@syntrologie/adapt-viz 2.55.1 → 2.56.0

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.
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  __privateAdd,
3
- __privateMethod
4
- } from "./chunk-NOUFNU2O.js";
3
+ __privateMethod,
4
+ external_exports
5
+ } from "./chunk-XT6BDXYH.js";
5
6
 
6
7
  // ../../../node_modules/@lit/context/lib/create-context.js
7
8
  function n(n2) {
@@ -11,6 +12,234 @@ function n(n2) {
11
12
  // ../../sdk-contracts/dist/canvas-context.js
12
13
  var canvasRuntimeContext = n("syntrologie:canvas-runtime");
13
14
 
15
+ // ../../sdk-contracts/dist/telemetry-events.js
16
+ var entry = (e2) => e2;
17
+ var TELEMETRY_EVENTS = {
18
+ // --- intervention metrics (April 2026) — wire names unchanged, all plan-scope
19
+ syntro_config_served: entry({
20
+ subject: "config",
21
+ verb: "served",
22
+ scope: "plan",
23
+ props: ["tiles", "actions"]
24
+ }),
25
+ syntro_intervention_seen: entry({
26
+ subject: "intervention",
27
+ verb: "seen",
28
+ scope: "plan",
29
+ props: ["intervention_id", "intervention_kind"]
30
+ }),
31
+ syntro_intervention_triggered: entry({
32
+ subject: "intervention",
33
+ verb: "triggered",
34
+ scope: "plan",
35
+ props: ["intervention_id", "intervention_kind"]
36
+ }),
37
+ syntro_intervention_interacted: entry({
38
+ subject: "intervention",
39
+ verb: "interacted",
40
+ scope: "plan",
41
+ props: ["intervention_id", "intervention_kind", "interaction_type"]
42
+ }),
43
+ // --- concierge (FEAT-1789150184) ---------------------------------------
44
+ syntro_concierge_opened: entry({
45
+ subject: "concierge",
46
+ verb: "opened",
47
+ scope: "open",
48
+ props: ["trigger", "page_path"]
49
+ // trigger: ConciergeOpenTrigger
50
+ }),
51
+ syntro_concierge_closed: entry({
52
+ subject: "concierge",
53
+ verb: "closed",
54
+ scope: "open",
55
+ props: ["duration_ms", "reason", "messages_sent", "tiles_dismissed", "pages_viewed"]
56
+ // reason: ConciergeCloseReason
57
+ }),
58
+ /**
59
+ * The shopper asked to leave the canvas by a link. Emitted on intent, before
60
+ * the host answers, so refused or denied opens are counted too (parity with
61
+ * syntro_concierge_closed reason navigation).
62
+ *
63
+ * On a merchant's own page a link tap closes the canvas, and
64
+ * `syntro_concierge_closed { reason: 'navigation' }` is the row that
65
+ * records it. Inside a chat app's card the frame is sandboxed: the canvas
66
+ * cannot navigate, does not close, and asks the host to open the link
67
+ * instead, so that close row never fires. This is its counterpart, and it
68
+ * carries the same `reason` so one query covers both surfaces.
69
+ */
70
+ syntro_link_opened: entry({
71
+ subject: "link",
72
+ verb: "opened",
73
+ scope: "open",
74
+ props: ["kind", "reason"]
75
+ // kind: LinkOpenKind, reason: ConciergeCloseReason
76
+ }),
77
+ /**
78
+ * A store's product page opened inside a chat-app card instead of leaving
79
+ * through the host (the card's product view). `product` is the store's
80
+ * handle, never the display name; a rail switch is a new open. Its
81
+ * counterpart when the shopper goes back to the conversation's picks is
82
+ * syntro_product_view_closed.
83
+ *
84
+ * Plan scope, like the card's own syntro_card_lifecycle_seen: an inline
85
+ * card holds an open scope only while the host has it fullscreen, and a
86
+ * view opened from a tile fires before the host answers that request (or
87
+ * after it refused), so an open-scope row here would be dropped. The core
88
+ * still stamps surface and open_id whenever an open is live.
89
+ */
90
+ syntro_product_view_opened: entry({
91
+ subject: "product_view",
92
+ verb: "opened",
93
+ scope: "plan",
94
+ props: ["product", "from"]
95
+ // from: ProductViewOpenSource
96
+ }),
97
+ syntro_product_view_closed: entry({
98
+ subject: "product_view",
99
+ verb: "closed",
100
+ scope: "plan",
101
+ props: ["product"]
102
+ }),
103
+ syntro_deck_paged: entry({
104
+ subject: "deck",
105
+ verb: "paged",
106
+ scope: "open",
107
+ props: ["from_index", "to_index", "method"]
108
+ // method: DeckPageMethod
109
+ }),
110
+ syntro_tile_dismissed: entry({
111
+ subject: "tile",
112
+ verb: "dismissed",
113
+ scope: "open",
114
+ props: ["tile_id", "tile_kind", "visible_ms"]
115
+ }),
116
+ // A tile's own data load finished: the network wait between the concierge
117
+ // mounting a tile and the shopper seeing its content (BUG-1784767817 was a
118
+ // 30 s reviews hang here). `outcome` is 'ok' | 'error'; `requested` is how
119
+ // many items the tile asked for, `received` how many came back.
120
+ syntro_tile_data_received: entry({
121
+ subject: "tile_data",
122
+ verb: "received",
123
+ scope: "open",
124
+ props: ["tile_id", "tile_kind", "total_ms", "outcome", "requested", "received"]
125
+ }),
126
+ // The three chat atoms are OPEN-scope: they carry `surface` / `open_id` and
127
+ // only make sense inside a concierge open. An INLINE chat bar (no concierge)
128
+ // still dispatches them on every turn, and the core drops each one and
129
+ // increments the `telemetry_dropped` health counter. That is EXPECTED on an
130
+ // inline-chat host page, not a bug — `telemetry_dropped` there mixes "real
131
+ // defect" with "inline chat has no open scope", so do not alert on it alone.
132
+ syntro_chat_message_sent: entry({
133
+ subject: "chat_message",
134
+ verb: "sent",
135
+ scope: "open",
136
+ props: ["turn", "chars", "via"]
137
+ // via: ChatSendVia
138
+ }),
139
+ syntro_chat_reply_received: entry({
140
+ subject: "chat_reply",
141
+ verb: "received",
142
+ scope: "open",
143
+ // mount_tools: the mount_* tool name of every mount this reply fired, in order (two product cards appear twice).
144
+ props: ["turn", "ttft_ms", "total_ms", "mounts", "cards", "mount_tools"]
145
+ }),
146
+ syntro_chat_interrupted: entry({
147
+ subject: "chat",
148
+ verb: "interrupted",
149
+ scope: "open",
150
+ props: ["turn", "after_ms"]
151
+ }),
152
+ syntro_chat_maximize_toggled: entry({
153
+ subject: "chat_maximize",
154
+ verb: "toggled",
155
+ scope: "open",
156
+ props: ["maximized"]
157
+ }),
158
+ syntro_chat_takeover_triggered: entry({
159
+ subject: "chat_takeover",
160
+ verb: "triggered",
161
+ scope: "open",
162
+ props: ["turn"]
163
+ }),
164
+ // --- search takeover (2026-09-17) ---------------------------------------
165
+ // All plan-scope: the search interceptor fires before any concierge open
166
+ // exists. No prop here ever carries query text (SEE the contract test's
167
+ // no-text-prop rule) — classification/signal_hits are the interceptor's
168
+ // own derived signals, never the string itself.
169
+ syntro_search_sent: entry({
170
+ subject: "search",
171
+ verb: "sent",
172
+ scope: "plan",
173
+ props: ["classification", "word_count", "signal_hits", "entry_point", "platform"]
174
+ // classification: SearchClassification, entry_point: SearchEntryPoint
175
+ }),
176
+ // `ms_to_skeleton` is intentionally the only timing prop: it is always
177
+ // knowable the instant the surface mounts. `ms_to_first_content` is NOT
178
+ // declared here (revision 1 defect) because a surface that never painted
179
+ // content still fires this event, and a required prop it cannot supply
180
+ // would make TelemetryCore.emit drop exactly the row worth measuring.
181
+ syntro_search_surface_seen: entry({
182
+ subject: "search_surface",
183
+ verb: "seen",
184
+ scope: "plan",
185
+ props: ["variant", "classification", "result_count", "ms_to_skeleton"]
186
+ // variant: SearchVariant, classification: SearchClassification
187
+ }),
188
+ syntro_search_result_tapped: entry({
189
+ subject: "search_result",
190
+ verb: "tapped",
191
+ scope: "plan",
192
+ props: ["variant", "region_id", "module", "position"]
193
+ // variant: SearchVariant
194
+ }),
195
+ syntro_search_followup_sent: entry({
196
+ subject: "search_followup",
197
+ verb: "sent",
198
+ scope: "plan",
199
+ props: ["delta_kind", "variant"]
200
+ // delta_kind: SearchDeltaKind, variant: SearchVariant
201
+ }),
202
+ // Declares `ms_since_boot` (not a "since surface mounted" timing prop) so a
203
+ // not-ready fallback the takeover never rendered is still measurable —
204
+ // revision 1 emitted nothing on this path.
205
+ syntro_search_native_served: entry({
206
+ subject: "search_native",
207
+ verb: "served",
208
+ scope: "plan",
209
+ props: ["reason", "platform", "ms_since_boot"]
210
+ // reason: SearchFallbackReason
211
+ }),
212
+ syntro_search_takeover_dismissed: entry({
213
+ subject: "search_takeover",
214
+ verb: "dismissed",
215
+ scope: "plan",
216
+ props: ["variant", "reason"]
217
+ // variant: SearchVariant, reason: SearchDismissReason
218
+ }),
219
+ // --- chat-app card lifecycle (2026-09-24) --------------------------------
220
+ // One row per stage a card reached, from `reportCardStage` in
221
+ // card-lifecycle.ts. Plan scope: most stages happen before a config is
222
+ // served and none happen inside a concierge open. `stage` is a
223
+ // CardLifecycleStage; `since_shell_ms` is the card shell's own clock, so a
224
+ // card's rows order themselves from the first byte of the page. The same
225
+ // stages reach the connector through the shell's beacon, which is the only
226
+ // record of a card whose SDK never booted.
227
+ syntro_card_lifecycle_seen: entry({
228
+ subject: "card_lifecycle",
229
+ verb: "seen",
230
+ scope: "plan",
231
+ props: ["stage", "since_shell_ms"]
232
+ // stage: CardLifecycleStage
233
+ })
234
+ };
235
+ var TELEMETRY_EVENT_NAMES = Object.keys(TELEMETRY_EVENTS);
236
+
237
+ // ../../sdk-contracts/dist/card-lifecycle.js
238
+ var MCP_APP_SURFACE_ATTRIBUTES = Object.freeze({
239
+ surface_type: "mcp-app",
240
+ surface: "personal_agent"
241
+ });
242
+
14
243
  // ../../sdk-contracts/dist/detector-events.js
15
244
  var DETECTOR_EVENT_NAMES = [
16
245
  "ui.hover",
@@ -415,27 +644,26 @@ function normalizeRoute(path) {
415
644
  }
416
645
 
417
646
  // ../../sdk-contracts/dist/schemas.js
418
- import { z } from "zod";
419
647
  var NO_CSS_BREAKOUT_PATTERN = /^[^{}]*$/;
420
- var AnchorIdZ = z.object({
421
- selector: z.string().regex(NO_CSS_BREAKOUT_PATTERN, {
648
+ var AnchorIdZ = external_exports.object({
649
+ selector: external_exports.string().regex(NO_CSS_BREAKOUT_PATTERN, {
422
650
  message: 'selector must not contain "{" or "}" \u2014 not valid CSS selector syntax, and content:hideBySelector injects this value directly into a <style> element where these characters would break out of the generated rule.'
423
651
  }).describe("CSS selector for the target element"),
424
- route: z.union([z.string(), z.array(z.string())]).superRefine((value, ctx) => {
652
+ route: external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]).superRefine((value, ctx) => {
425
653
  for (const route of Array.isArray(value) ? value : [value]) {
426
654
  let canonical;
427
655
  try {
428
656
  canonical = normalizeRoute(route);
429
657
  } catch (err) {
430
658
  ctx.addIssue({
431
- code: z.ZodIssueCode.custom,
659
+ code: external_exports.ZodIssueCode.custom,
432
660
  message: `route must be an absolute path starting with "/" (got ${JSON.stringify(route)}): ${err instanceof Error ? err.message : String(err)}`
433
661
  });
434
662
  continue;
435
663
  }
436
664
  if (canonical !== route) {
437
665
  ctx.addIssue({
438
- code: z.ZodIssueCode.custom,
666
+ code: external_exports.ZodIssueCode.custom,
439
667
  message: `route ${JSON.stringify(route)} is not canonical \u2014 use ${JSON.stringify(canonical)} (this must match what the backend's RouteCanonicalityCheck accepts)`
440
668
  });
441
669
  }
@@ -443,10 +671,10 @@ var AnchorIdZ = z.object({
443
671
  }).describe("URL path(s) where this element exists")
444
672
  }).strict().describe("DOM element target. selector = CSS selector, route = URL path(s) where the element exists.");
445
673
  var AuthoringFieldsZ = {
446
- id: z.string().optional().describe('Stable action identifier (e.g. "act_3db6a14d2ab0").'),
447
- title: z.string().max(200).optional().describe("Authoring-only: short label shown on the action plan dashboard. Stripped before serving to the runtime SDK."),
448
- description: z.string().max(1e3).optional().describe("Authoring-only: one-sentence explanation of what this action does and why. Stripped before serving to the runtime SDK."),
449
- validation: z.array(z.string().max(500)).max(10).optional().describe("Authoring-only: ordered steps a reviewer can follow to trigger this action and visually confirm it works. Each entry is one step. Stripped before serving to the runtime SDK.")
674
+ id: external_exports.string().optional().describe('Stable action identifier (e.g. "act_3db6a14d2ab0").'),
675
+ title: external_exports.string().max(200).optional().describe("Authoring-only: short label shown on the action plan dashboard. Stripped before serving to the runtime SDK."),
676
+ description: external_exports.string().max(1e3).optional().describe("Authoring-only: one-sentence explanation of what this action does and why. Stripped before serving to the runtime SDK."),
677
+ validation: external_exports.array(external_exports.string().max(500)).max(10).optional().describe("Authoring-only: ordered steps a reviewer can follow to trigger this action and visually confirm it works. Each entry is one step. Stripped before serving to the runtime SDK.")
450
678
  };
451
679
  var COUNTABLE_EVENTS = [
452
680
  // User interactions (from PostHog autocapture normalization)
@@ -466,80 +694,80 @@ var COUNTABLE_EVENTS = [
466
694
  "nav.page_view",
467
695
  "nav.page_leave"
468
696
  ];
469
- var CountableEventZ = z.enum(COUNTABLE_EVENTS).describe("Event name to count. ui.* = user interactions and behavioral detectors (hesitate, rage_click, scroll_thrash, focus_bounce, idle, hover); nav.* = page navigation.");
697
+ var CountableEventZ = external_exports.enum(COUNTABLE_EVENTS).describe("Event name to count. ui.* = user interactions and behavioral detectors (hesitate, rage_click, scroll_thrash, focus_bounce, idle, hover); nav.* = page navigation.");
470
698
  var SESSION_METRIC_KEYS = ["time_on_page", "page_views", "scroll_depth"];
471
- var SessionMetricKeyZ = z.enum(SESSION_METRIC_KEYS).describe("Session metric key. time_on_page = seconds on current page, page_views = pages visited this session, scroll_depth = 0-100 percentage.");
472
- var PageUrlConditionZ = z.object({
473
- type: z.literal("page_url"),
474
- url: z.string().describe('URL path to match (e.g. "/pricing", "/dashboard")')
699
+ var SessionMetricKeyZ = external_exports.enum(SESSION_METRIC_KEYS).describe("Session metric key. time_on_page = seconds on current page, page_views = pages visited this session, scroll_depth = 0-100 percentage.");
700
+ var PageUrlConditionZ = external_exports.object({
701
+ type: external_exports.literal("page_url"),
702
+ url: external_exports.string().describe('URL path to match (e.g. "/pricing", "/dashboard")')
475
703
  }).describe('Fires when the current page URL matches. Use for page-specific actions. Example: {"type": "page_url", "url": "/pricing"}');
476
- var RouteConditionZ = z.object({
477
- type: z.literal("route"),
478
- routeId: z.string().describe("Named route ID from the route filter")
704
+ var RouteConditionZ = external_exports.object({
705
+ type: external_exports.literal("route"),
706
+ routeId: external_exports.string().describe("Named route ID from the route filter")
479
707
  }).describe("Fires when the current route matches a named route ID.");
480
- var AnchorVisibleConditionZ = z.object({
481
- type: z.literal("anchor_visible"),
482
- anchorId: z.string().describe("CSS selector of the anchor element"),
483
- state: z.enum(["visible", "present", "absent"]).describe('"visible" = in viewport, "present" = in DOM, "absent" = not in DOM')
708
+ var AnchorVisibleConditionZ = external_exports.object({
709
+ type: external_exports.literal("anchor_visible"),
710
+ anchorId: external_exports.string().describe("CSS selector of the anchor element"),
711
+ state: external_exports.enum(["visible", "present", "absent"]).describe('"visible" = in viewport, "present" = in DOM, "absent" = not in DOM')
484
712
  }).describe(`Fires based on a DOM element's visibility state. Example: {"type": "anchor_visible", "anchorId": "#cta-button", "state": "visible"}`);
485
- var EventOccurredConditionZ = z.object({
486
- type: z.literal("event_occurred"),
487
- eventName: z.string().describe('Event name (e.g. "ui.click", "$pageview")'),
488
- withinMs: z.number().optional().describe("Time window in ms. Omit = any time this session.")
713
+ var EventOccurredConditionZ = external_exports.object({
714
+ type: external_exports.literal("event_occurred"),
715
+ eventName: external_exports.string().describe('Event name (e.g. "ui.click", "$pageview")'),
716
+ withinMs: external_exports.number().optional().describe("Time window in ms. Omit = any time this session.")
489
717
  }).describe('Fires when a specific event has occurred during this session. Example: {"type": "event_occurred", "eventName": "ui.click", "withinMs": 5000}');
490
- var StateEqualsConditionZ = z.object({
491
- type: z.literal("state_equals"),
492
- key: z.string().describe("Key in the SDK persistent state store (localStorage). Only valid for keys the host app explicitly sets via syntro.state.set()."),
493
- value: z.unknown().describe("Expected value to match against")
718
+ var StateEqualsConditionZ = external_exports.object({
719
+ type: external_exports.literal("state_equals"),
720
+ key: external_exports.string().describe("Key in the SDK persistent state store (localStorage). Only valid for keys the host app explicitly sets via syntro.state.set()."),
721
+ value: external_exports.unknown().describe("Expected value to match against")
494
722
  }).describe("Checks the SDK persistent state store (localStorage). ONLY for host-app state set via syntro.state.set() \u2014 NOT for user attributes like region, device, or UTM params (those are handled by segment targeting). Do NOT use this for targeting. If you do not know the valid state keys, do not use this condition type.");
495
- var ViewportConditionZ = z.object({
496
- type: z.literal("viewport"),
497
- minWidth: z.number().optional().describe("Minimum viewport width in pixels"),
498
- maxWidth: z.number().optional().describe("Maximum viewport width in pixels"),
499
- minHeight: z.number().optional().describe("Minimum viewport height in pixels"),
500
- maxHeight: z.number().optional().describe("Maximum viewport height in pixels")
723
+ var ViewportConditionZ = external_exports.object({
724
+ type: external_exports.literal("viewport"),
725
+ minWidth: external_exports.number().optional().describe("Minimum viewport width in pixels"),
726
+ maxWidth: external_exports.number().optional().describe("Maximum viewport width in pixels"),
727
+ minHeight: external_exports.number().optional().describe("Minimum viewport height in pixels"),
728
+ maxHeight: external_exports.number().optional().describe("Maximum viewport height in pixels")
501
729
  }).describe('Fires based on viewport (screen) size. Use for responsive behavior. Example: {"type": "viewport", "minWidth": 768} \u2014 fires on tablet and larger.');
502
- var SessionMetricConditionZ = z.object({
503
- type: z.literal("session_metric"),
730
+ var SessionMetricConditionZ = external_exports.object({
731
+ type: external_exports.literal("session_metric"),
504
732
  key: SessionMetricKeyZ,
505
- operator: z.enum(["gte", "lte", "eq", "gt", "lt"]),
506
- threshold: z.number().describe("Numeric threshold to compare against")
733
+ operator: external_exports.enum(["gte", "lte", "eq", "gt", "lt"]),
734
+ threshold: external_exports.number().describe("Numeric threshold to compare against")
507
735
  }).describe('Fires when a session metric crosses a threshold. Valid keys: "time_on_page" (seconds), "page_views" (count), "scroll_depth" (0-100). Example: {"type": "session_metric", "key": "time_on_page", "operator": "gte", "threshold": 30}');
508
- var DismissedConditionZ = z.object({
509
- type: z.literal("dismissed"),
510
- key: z.string().describe("Dismissal key (usually a tile or action ID)"),
511
- inverted: z.boolean().optional().describe("When true, fires if NOT dismissed (default behavior)")
736
+ var DismissedConditionZ = external_exports.object({
737
+ type: external_exports.literal("dismissed"),
738
+ key: external_exports.string().describe("Dismissal key (usually a tile or action ID)"),
739
+ inverted: external_exports.boolean().optional().describe("When true, fires if NOT dismissed (default behavior)")
512
740
  }).describe("Checks if an item has been dismissed by the user. Use with inverted: true to show only if not dismissed.");
513
- var CooldownActiveConditionZ = z.object({
514
- type: z.literal("cooldown_active"),
515
- key: z.string().describe("Cooldown key"),
516
- inverted: z.boolean().optional().describe("When true, fires if cooldown is NOT active")
741
+ var CooldownActiveConditionZ = external_exports.object({
742
+ type: external_exports.literal("cooldown_active"),
743
+ key: external_exports.string().describe("Cooldown key"),
744
+ inverted: external_exports.boolean().optional().describe("When true, fires if cooldown is NOT active")
517
745
  }).describe("Checks if a cooldown timer is currently active. Use to prevent showing the same intervention too frequently.");
518
- var FrequencyLimitConditionZ = z.object({
519
- type: z.literal("frequency_limit"),
520
- key: z.string().describe("Frequency counter key"),
521
- limit: z.number().describe("Maximum allowed count"),
522
- inverted: z.boolean().optional().describe("When true, fires if limit NOT reached")
746
+ var FrequencyLimitConditionZ = external_exports.object({
747
+ type: external_exports.literal("frequency_limit"),
748
+ key: external_exports.string().describe("Frequency counter key"),
749
+ limit: external_exports.number().describe("Maximum allowed count"),
750
+ inverted: external_exports.boolean().optional().describe("When true, fires if limit NOT reached")
523
751
  }).describe("Checks if a frequency limit has been reached. Use to cap how many times an action fires per session.");
524
- var MatchOpZ = z.object({
525
- equals: z.union([z.string(), z.number(), z.boolean()]).optional(),
526
- contains: z.string().optional()
752
+ var MatchOpZ = external_exports.object({
753
+ equals: external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()]).optional(),
754
+ contains: external_exports.string().optional()
527
755
  }).refine((operator) => Number(operator.equals !== void 0) + Number(operator.contains !== void 0) === 1, {
528
756
  message: "Exactly one of equals or contains must be specified."
529
757
  }).describe("Match operator for counter filters. Exactly one of equals or contains must be specified.");
530
- var CounterDefZ = z.object({
531
- events: z.array(CountableEventZ).min(1).describe("Event names to count. Use values from the countable events enum."),
532
- match: z.record(z.string(), MatchOpZ).optional().describe("Property filters. Keys are event prop names or element-chain fields (tag_name, $el_text, attr__*). All entries AND together.")
758
+ var CounterDefZ = external_exports.object({
759
+ events: external_exports.array(CountableEventZ).min(1).describe("Event names to count. Use values from the countable events enum."),
760
+ match: external_exports.record(external_exports.string(), MatchOpZ).optional().describe("Property filters. Keys are event prop names or element-chain fields (tag_name, $el_text, attr__*). All entries AND together.")
533
761
  }).describe("Defines what events to count. Registered as an accumulator predicate at config-load time.");
534
- var EventCountConditionZ = z.object({
535
- type: z.literal("event_count"),
536
- key: z.string().describe("Unique key for this counter (used for accumulator registration)"),
537
- operator: z.enum(["gte", "lte", "eq", "gt", "lt"]),
538
- count: z.number().int().min(0).describe("Target count threshold"),
539
- withinMs: z.number().positive().optional().describe("Time window in ms. Omit = count across entire session."),
762
+ var EventCountConditionZ = external_exports.object({
763
+ type: external_exports.literal("event_count"),
764
+ key: external_exports.string().describe("Unique key for this counter (used for accumulator registration)"),
765
+ operator: external_exports.enum(["gte", "lte", "eq", "gt", "lt"]),
766
+ count: external_exports.number().int().min(0).describe("Target count threshold"),
767
+ withinMs: external_exports.number().positive().optional().describe("Time window in ms. Omit = count across entire session."),
540
768
  counter: CounterDefZ.optional().describe("Inline counter definition. Defines what events to count.")
541
769
  }).describe('Fires when accumulated event count crosses a threshold. Most powerful trigger type. Example: {"type": "event_count", "key": "pricing-clicks", "operator": "gte", "count": 3, "counter": {"events": ["ui.click"], "match": {"attr__data-cta": {"contains": "pricing"}}}}');
542
- var ConditionZ = z.discriminatedUnion("type", [
770
+ var ConditionZ = external_exports.discriminatedUnion("type", [
543
771
  PageUrlConditionZ,
544
772
  RouteConditionZ,
545
773
  AnchorVisibleConditionZ,
@@ -552,150 +780,54 @@ var ConditionZ = z.discriminatedUnion("type", [
552
780
  FrequencyLimitConditionZ,
553
781
  EventCountConditionZ
554
782
  ]);
555
- var RuleZ = z.object({
556
- conditions: z.array(ConditionZ).describe("Array of conditions \u2014 ALL must match (AND logic) for this rule to fire."),
557
- value: z.unknown().describe("Value returned when all conditions match. For triggerWhen: true = fire the action.")
783
+ var RuleZ = external_exports.object({
784
+ conditions: external_exports.array(ConditionZ).describe("Array of conditions \u2014 ALL must match (AND logic) for this rule to fire."),
785
+ value: external_exports.unknown().describe("Value returned when all conditions match. For triggerWhen: true = fire the action.")
558
786
  }).describe("A single rule. ALL conditions must match (AND logic). Rules in a strategy are evaluated top-to-bottom \u2014 first rule where all conditions match wins and returns its value.");
559
- var RuleStrategyZ = z.object({
560
- type: z.literal("rules"),
561
- rules: z.array(RuleZ).describe("Ordered list of rules. Evaluated top-to-bottom \u2014 first match wins."),
562
- default: z.unknown().describe("Fallback value when no rule matches. For triggerWhen: false = do not fire by default.")
787
+ var RuleStrategyZ = external_exports.object({
788
+ type: external_exports.literal("rules"),
789
+ rules: external_exports.array(RuleZ).describe("Ordered list of rules. Evaluated top-to-bottom \u2014 first match wins."),
790
+ default: external_exports.unknown().describe("Fallback value when no rule matches. For triggerWhen: false = do not fire by default.")
563
791
  }).describe("Rule-based strategy. Evaluates rules top-to-bottom. First rule where ALL conditions match returns its value. If no rule matches, returns default. For triggerWhen: set value=true on matching rules, default=false.");
564
- var ScoreStrategyZ = z.object({
565
- type: z.literal("score"),
566
- field: z.string(),
567
- threshold: z.number(),
568
- above: z.unknown(),
569
- below: z.unknown()
792
+ var ScoreStrategyZ = external_exports.object({
793
+ type: external_exports.literal("score"),
794
+ field: external_exports.string(),
795
+ threshold: external_exports.number(),
796
+ above: external_exports.unknown(),
797
+ below: external_exports.unknown()
570
798
  }).describe("Score-based strategy. Compares a field value against a threshold.");
571
- var ModelStrategyZ = z.object({
572
- type: z.literal("model"),
573
- modelId: z.string(),
574
- inputs: z.array(z.string()),
575
- outputMapping: z.record(z.string(), z.unknown()),
576
- default: z.unknown()
799
+ var ModelStrategyZ = external_exports.object({
800
+ type: external_exports.literal("model"),
801
+ modelId: external_exports.string(),
802
+ inputs: external_exports.array(external_exports.string()),
803
+ outputMapping: external_exports.record(external_exports.string(), external_exports.unknown()),
804
+ default: external_exports.unknown()
577
805
  }).describe("ML model strategy. Sends inputs to a model and maps outputs.");
578
- var ExternalStrategyZ = z.object({
579
- type: z.literal("external"),
580
- endpoint: z.string(),
581
- method: z.enum(["GET", "POST"]).optional(),
582
- default: z.unknown(),
583
- timeoutMs: z.number().optional()
806
+ var ExternalStrategyZ = external_exports.object({
807
+ type: external_exports.literal("external"),
808
+ endpoint: external_exports.string(),
809
+ method: external_exports.enum(["GET", "POST"]).optional(),
810
+ default: external_exports.unknown(),
811
+ timeoutMs: external_exports.number().optional()
584
812
  }).describe("External API strategy. Calls an endpoint to determine the value.");
585
- var DecisionStrategyZ = z.discriminatedUnion("type", [
813
+ var DecisionStrategyZ = external_exports.discriminatedUnion("type", [
586
814
  RuleStrategyZ,
587
815
  ScoreStrategyZ,
588
816
  ModelStrategyZ,
589
817
  ExternalStrategyZ
590
818
  ]);
591
819
  var TriggerWhenZ = DecisionStrategyZ.nullable().optional();
592
- var EventScopeZ = z.object({
593
- events: z.array(z.string()),
594
- urlContains: z.string().optional(),
595
- props: z.record(z.union([z.string(), z.number(), z.boolean()])).optional()
820
+ var EventScopeZ = external_exports.object({
821
+ events: external_exports.array(external_exports.string()),
822
+ urlContains: external_exports.string().optional(),
823
+ props: external_exports.record(external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()])).optional()
596
824
  });
597
- var NotifyZ = z.object({
598
- title: z.string().optional().describe("Notification title"),
599
- body: z.string().optional().describe("Notification body text"),
600
- icon: z.string().optional().describe("Notification icon (emoji or URL)")
825
+ var NotifyZ = external_exports.object({
826
+ title: external_exports.string().optional().describe("Notification title"),
827
+ body: external_exports.string().optional().describe("Notification body text"),
828
+ icon: external_exports.string().optional().describe("Notification icon (emoji or URL)")
601
829
  }).describe("Optional toast notification shown when this action triggers.").nullable().optional();
602
830
 
603
- // ../../sdk-contracts/dist/telemetry-events.js
604
- var entry = (e2) => e2;
605
- var TELEMETRY_EVENTS = {
606
- // --- intervention metrics (April 2026) — wire names unchanged, all plan-scope
607
- syntro_config_served: entry({
608
- subject: "config",
609
- verb: "served",
610
- scope: "plan",
611
- props: ["tiles", "actions"]
612
- }),
613
- syntro_intervention_seen: entry({
614
- subject: "intervention",
615
- verb: "seen",
616
- scope: "plan",
617
- props: ["intervention_id", "intervention_kind"]
618
- }),
619
- syntro_intervention_triggered: entry({
620
- subject: "intervention",
621
- verb: "triggered",
622
- scope: "plan",
623
- props: ["intervention_id", "intervention_kind"]
624
- }),
625
- syntro_intervention_interacted: entry({
626
- subject: "intervention",
627
- verb: "interacted",
628
- scope: "plan",
629
- props: ["intervention_id", "intervention_kind", "interaction_type"]
630
- }),
631
- // --- concierge (FEAT-1789150184) ---------------------------------------
632
- syntro_concierge_opened: entry({
633
- subject: "concierge",
634
- verb: "opened",
635
- scope: "open",
636
- props: ["trigger", "page_path"]
637
- // trigger: ConciergeOpenTrigger
638
- }),
639
- syntro_concierge_closed: entry({
640
- subject: "concierge",
641
- verb: "closed",
642
- scope: "open",
643
- props: ["duration_ms", "reason", "messages_sent", "tiles_dismissed", "pages_viewed"]
644
- // reason: ConciergeCloseReason
645
- }),
646
- syntro_deck_paged: entry({
647
- subject: "deck",
648
- verb: "paged",
649
- scope: "open",
650
- props: ["from_index", "to_index", "method"]
651
- // method: DeckPageMethod
652
- }),
653
- syntro_tile_dismissed: entry({
654
- subject: "tile",
655
- verb: "dismissed",
656
- scope: "open",
657
- props: ["tile_id", "tile_kind", "visible_ms"]
658
- }),
659
- // The three chat atoms are OPEN-scope: they carry `surface` / `open_id` and
660
- // only make sense inside a concierge open. An INLINE chat bar (no concierge)
661
- // still dispatches them on every turn, and the core drops each one and
662
- // increments the `telemetry_dropped` health counter. That is EXPECTED on an
663
- // inline-chat host page, not a bug — `telemetry_dropped` there mixes "real
664
- // defect" with "inline chat has no open scope", so do not alert on it alone.
665
- syntro_chat_message_sent: entry({
666
- subject: "chat_message",
667
- verb: "sent",
668
- scope: "open",
669
- props: ["turn", "chars", "via"]
670
- // via: ChatSendVia
671
- }),
672
- syntro_chat_reply_received: entry({
673
- subject: "chat_reply",
674
- verb: "received",
675
- scope: "open",
676
- props: ["turn", "ttft_ms", "total_ms", "mounts", "cards"]
677
- }),
678
- syntro_chat_interrupted: entry({
679
- subject: "chat",
680
- verb: "interrupted",
681
- scope: "open",
682
- props: ["turn", "after_ms"]
683
- }),
684
- syntro_chat_maximize_toggled: entry({
685
- subject: "chat_maximize",
686
- verb: "toggled",
687
- scope: "open",
688
- props: ["maximized"]
689
- }),
690
- syntro_chat_takeover_triggered: entry({
691
- subject: "chat_takeover",
692
- verb: "triggered",
693
- scope: "open",
694
- props: ["turn"]
695
- })
696
- };
697
- var TELEMETRY_EVENT_NAMES = Object.keys(TELEMETRY_EVENTS);
698
-
699
831
  // src/ChartWidgetLit.ts
700
832
  import { html, LitElement } from "lit";
701
833
 
@@ -855,6 +987,14 @@ var ChartWidgetLit = class extends LitElement {
855
987
  super(...arguments);
856
988
  __privateAdd(this, _ChartWidgetLit_instances);
857
989
  this.chartProps = void 0;
990
+ /**
991
+ * Resolves when the most recent chart render has finished, including the
992
+ * dynamic vega-embed import and the embed call for non-table layouts.
993
+ * Lit's `updateComplete` resolves before that async work does, so anything
994
+ * that needs the drawn chart (tests, size reporting) awaits this instead
995
+ * of guessing with a timer.
996
+ */
997
+ this.renderComplete = Promise.resolve();
858
998
  }
859
999
  // Render into light DOM so the parent shadow root's CSS variables flow through.
860
1000
  createRenderRoot() {
@@ -862,7 +1002,8 @@ var ChartWidgetLit = class extends LitElement {
862
1002
  }
863
1003
  async updated(changed) {
864
1004
  if (changed.has("chartProps")) {
865
- await __privateMethod(this, _ChartWidgetLit_instances, renderChart_fn).call(this);
1005
+ this.renderComplete = __privateMethod(this, _ChartWidgetLit_instances, renderChart_fn).call(this);
1006
+ await this.renderComplete;
866
1007
  }
867
1008
  }
868
1009
  render() {
@@ -1098,4 +1239,4 @@ export {
1098
1239
  * SPDX-License-Identifier: BSD-3-Clause
1099
1240
  *)
1100
1241
  */
1101
- //# sourceMappingURL=chunk-UICGUOWK.js.map
1242
+ //# sourceMappingURL=chunk-UEOF7SEV.js.map