@burdenoff/fe-libs 2026.1115.13 → 2026.1116.2

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.
Files changed (57) hide show
  1. package/dist/shared/assistant/history/useHistoryRowControls.d.ts +16 -0
  2. package/dist/shared/assistant/history/useHistoryRowControls.js +38 -14
  3. package/dist/shared/assistant/i18nManifest.d.ts +9 -0
  4. package/dist/shared/assistant/i18nManifest.js +9 -0
  5. package/dist/shared/assistant/index.d.ts +2 -0
  6. package/dist/shared/assistant/ui/AIAssistantPanel.d.ts +16 -0
  7. package/dist/shared/assistant/ui/AIAssistantPanel.js +247 -223
  8. package/dist/shared/assistant/ui/AssistantChatArea.js +1355 -1347
  9. package/dist/shared/assistant/ui/AssistantOverlay.d.ts +6 -0
  10. package/dist/shared/assistant/ui/AssistantOverlay.js +4 -2
  11. package/dist/shared/assistant/ui/AssistantPageHost.d.ts +14 -1
  12. package/dist/shared/assistant/ui/AssistantPageHost.js +32 -19
  13. package/dist/shared/assistant/ui/AssistantRenameConversationDialog.d.ts +33 -0
  14. package/dist/shared/assistant/ui/AssistantRenameConversationDialog.js +70 -0
  15. package/dist/shared/assistant/ui/assistantPageBar.d.ts +33 -0
  16. package/dist/shared/assistant/ui/assistantPageBar.js +53 -0
  17. package/dist/shared/assistant/ui/assistantPageLayout.d.ts +20 -0
  18. package/dist/shared/assistant/ui/assistantPageLayout.js +10 -2
  19. package/dist/shared/assistant/ui/assistantPageStart.d.ts +17 -0
  20. package/dist/shared/assistant/ui/assistantPageStart.js +7 -4
  21. package/dist/shared/assistant/ui/compact/AssistantConversationMenu.d.ts +30 -0
  22. package/dist/shared/assistant/ui/compact/AssistantConversationMenu.js +174 -53
  23. package/dist/shared/assistant/ui/compact/AssistantPageBar.d.ts +19 -0
  24. package/dist/shared/assistant/ui/compact/AssistantPageBar.js +24 -19
  25. package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts +2 -0
  26. package/dist/shared/assistant/ui/composer/AssistantComposer.js +347 -340
  27. package/dist/shared/assistant/ui/composer/AssistantDictation.d.ts +5 -0
  28. package/dist/shared/assistant/ui/composer/AssistantDictation.js +41 -40
  29. package/dist/shared/assistant/ui/composer/pageBoxClass.d.ts +28 -1
  30. package/dist/shared/assistant/ui/composer/pageBoxClass.js +17 -1
  31. package/dist/shared/assistant/ui/conversationDeleteDialog.d.ts +14 -4
  32. package/dist/shared/assistant/ui/conversationDeleteDialog.js +7 -6
  33. package/dist/shared/assistant/ui/voice/AssistantVoiceSessionButton.js +1 -1
  34. package/dist/shared/assistant/ui/voice/LiveWaveform.js +1 -1
  35. package/dist/shared/events/index.d.ts +7 -2
  36. package/dist/shared/events/sinks/OtelBrowserSink.d.ts +5 -0
  37. package/dist/shared/events/sinks/WebVitalsSink.d.ts +25 -0
  38. package/dist/shared/events/sinks/WebVitalsSink.js +51 -0
  39. package/dist/shared/events/sinks/index.d.ts +3 -0
  40. package/dist/shared/events/sinks/index.js +2 -1
  41. package/dist/shared/index.d.ts +1 -0
  42. package/dist/shared/providers/AppShellProvider.d.ts +16 -0
  43. package/dist/shared/providers/AppShellProvider.js +291 -292
  44. package/dist/shared/providers/shell/ObservabilityProvider.d.ts +6 -6
  45. package/dist/shared/rum/context.d.ts +24 -0
  46. package/dist/shared/rum/context.js +40 -0
  47. package/dist/shared/rum/index.d.ts +14 -0
  48. package/dist/shared/rum/mount.d.ts +12 -0
  49. package/dist/shared/rum/mount.js +5 -0
  50. package/dist/shared/rum/reporter.d.ts +22 -0
  51. package/dist/shared/rum/reporter.js +166 -0
  52. package/dist/shared/rum/types.d.ts +56 -0
  53. package/dist/shared-assistant.js +256 -254
  54. package/dist/shared-events.js +29 -28
  55. package/dist/shared.js +78 -74
  56. package/dist/ui/glass-card.d.ts +1 -1
  57. package/package.json +1 -1
@@ -29,12 +29,12 @@ export interface ObservabilityProviderProps {
29
29
  * browser, so these values are NOT retrievable off-device and this provider
30
30
  * alone does NOT constitute real-user monitoring.
31
31
  *
32
- * The transport that CAN ship these off-device is the event-bus path:
33
- * AppShellProvider -> ShellTelemetryEmitter (perf.* events) -> OtelBrowserSink,
34
- * which POSTs to VITE_OTEL_HTTP_ENDPOINT. That sink only mounts when the
35
- * endpoint is configured; as of 2026-07-16 it is provisioned for no product,
36
- * so the fleet has no field CWV data. Tracked as the RUM-sink follow-up
37
- * (see atheletebridge-specs/business/status/PERFORMANCE_REPORT.md).
32
+ * The transport that ships these off-device is the event-bus path
33
+ * (BOFF-3914): AppShellProvider -> ShellTelemetryEmitter (perf.* events) ->
34
+ * WebVitalsSink, which sends them to the global gateway's `reportWebVitals`
35
+ * mutation; global-activity-svc records them as Prometheus histograms in AMP.
36
+ * The older OtelBrowserSink / VITE_OTEL_HTTP_ENDPOINT path is deprecated and
37
+ * provisioned for no product. This provider stays a dev console aid.
38
38
  *
39
39
  * OFF-DEVICE ERRORS (BOFF-10705): a shell that passes `reporters` (for example
40
40
  * `createRybbitCrashReporter`) additionally ships every captured error off the
@@ -0,0 +1,24 @@
1
+ import { RumDevice } from './types';
2
+ /**
3
+ * Coarse device class:
4
+ * - `navigator.userAgentData.mobile === true` is a phone;
5
+ * - a coarse (touch) primary pointer is a phone below 768px and a tablet otherwise;
6
+ * - a fine primary pointer is a desktop;
7
+ * - with no pointer information, the viewport decides (<768 phone, <1024 tablet).
8
+ */
9
+ export declare function deviceClass(): RumDevice;
10
+ /**
11
+ * Landing section for a pathname: the first segment of the masked route, for
12
+ * example `/workflows`, or `/` for the root. A segment the server would not
13
+ * accept (an id, a slug with capitals, anything long) becomes `/:other` here,
14
+ * so it never leaves the device; the server collapses it to `other`.
15
+ */
16
+ export declare function rumSection(pathname: string): string;
17
+ /**
18
+ * Whether this browser may send RUM reports: not when the analytics consent
19
+ * choice is `denied`, Global Privacy Control is on, or Do Not Track is on. A
20
+ * choice that was never made means "send" (open owner decision, BOFF-3914).
21
+ * When the consent choice cannot be read at all (storage blocked), nothing is
22
+ * sent.
23
+ */
24
+ export declare function canReportRum(): boolean;
@@ -0,0 +1,40 @@
1
+ import { readAnalyticsConsentChoice as e } from "../events/sinks/RybbitSink.js";
2
+ import { maskRoute as t } from "../events/sinks/telemetryScrub.js";
3
+ // src/shared/rum/context.ts
4
+ function n() {
5
+ if (typeof window > "u" || typeof navigator > "u") return "desktop";
6
+ if (navigator.userAgentData?.mobile === !0) return "mobile";
7
+ let e = typeof window.innerWidth == "number" ? window.innerWidth : 1024, t = r();
8
+ return t === "coarse" ? e < 768 ? "mobile" : "tablet" : t === "fine" ? "desktop" : e < 768 ? "mobile" : e < 1024 ? "tablet" : "desktop";
9
+ }
10
+ function r() {
11
+ if (typeof window.matchMedia != "function") return null;
12
+ try {
13
+ if (window.matchMedia("(pointer: coarse)").matches) return "coarse";
14
+ if (window.matchMedia("(pointer: fine)").matches) return "fine";
15
+ } catch {
16
+ return null;
17
+ }
18
+ return null;
19
+ }
20
+ var i = /^[a-z][a-z0-9-]{0,31}$/;
21
+ function a(e) {
22
+ let n = t(e).split("/").find((e) => e.length > 0);
23
+ return n ? i.test(n) ? `/${n}` : "/:other" : "/";
24
+ }
25
+ function o() {
26
+ return navigator.globalPrivacyControl === !0;
27
+ }
28
+ function s() {
29
+ let e = window;
30
+ return navigator.doNotTrack === "1" || e.doNotTrack === "1";
31
+ }
32
+ function c() {
33
+ if (typeof window > "u" || typeof navigator > "u" || o() || s()) return !1;
34
+ try {
35
+ return e() !== "denied";
36
+ } catch {
37
+ return !1;
38
+ }
39
+ }
40
+ export { c as canReportRum, n as deviceClass, a as rumSection };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Browser real-user monitoring: Core Web Vitals to the global gateway's
3
+ * `reportWebVitals` / `reportPublicWebVitals` mutations (BOFF-3914), recorded
4
+ * by global-activity-svc as Prometheus histograms in AMP.
5
+ *
6
+ * Framework-free; the React mount point is `WebVitalsSink`.
7
+ *
8
+ * @module @burdenoff/fe-libs/shared/rum
9
+ */
10
+ export { canReportRum, deviceClass, rumSection } from './context';
11
+ export { shouldMountWebVitalsSink } from './mount';
12
+ export type { RumMountConfig } from './mount';
13
+ export { createRumReporter, DEFAULT_RUM_SAMPLE_RATES, MAX_RUM_BODY_BYTES, MAX_RUM_REPORTS, REPORT_PUBLIC_WEB_VITALS_DOCUMENT, REPORT_WEB_VITALS_DOCUMENT, resolveRumSampleRate, toRumNavigationType, } from './reporter';
14
+ export type { CreateRumReporterOptions, RumConfig, RumDevice, RumMetric, RumReporter, } from './types';
@@ -0,0 +1,12 @@
1
+ import { RumConfig } from './types';
2
+ /** The parts of `AppShellObservabilityConfig` that decide whether RUM runs. */
3
+ export interface RumMountConfig {
4
+ enabled?: boolean;
5
+ appEnv?: 'dev' | 'alpha' | 'prod';
6
+ rum?: RumConfig;
7
+ }
8
+ /**
9
+ * BOFF-3914: WebVitalsSink mounts when observability and RUM are not switched
10
+ * off and the shell is not running in the `dev` app environment.
11
+ */
12
+ export declare function shouldMountWebVitalsSink(config: RumMountConfig): boolean;
@@ -0,0 +1,5 @@
1
+ // src/shared/rum/mount.ts
2
+ function e(e) {
3
+ return e.enabled !== !1 && e.rum?.enabled !== !1 && e.appEnv !== "dev";
4
+ }
5
+ export { e as shouldMountWebVitalsSink };
@@ -0,0 +1,22 @@
1
+ import { CreateRumReporterOptions, RumReporter } from './types';
2
+ /** Signed-in mutation (`@rbac(scopeType: "self")` on the global gateway). */
3
+ export declare const REPORT_WEB_VITALS_DOCUMENT = "mutation ReportWebVitals($input: ReportWebVitalsInput!) { reportWebVitals(input: $input) { accepted dropped sampleRate } }";
4
+ /** Signed-out mutation (public; dropped server-side unless RUM_ANON_ENABLED). */
5
+ export declare const REPORT_PUBLIC_WEB_VITALS_DOCUMENT = "mutation ReportPublicWebVitals($input: ReportWebVitalsInput!) { reportPublicWebVitals(input: $input) { accepted dropped sampleRate } }";
6
+ /** Reports per page load. */
7
+ export declare const MAX_RUM_REPORTS = 3;
8
+ /** Request bodies at or above this size are not sent. */
9
+ export declare const MAX_RUM_BODY_BYTES = 2048;
10
+ /**
11
+ * Per-product client pre-sample rates. Empty: every product reports every page
12
+ * load until traffic says otherwise. `RumConfig.sampleRate` wins over this map.
13
+ */
14
+ export declare const DEFAULT_RUM_SAMPLE_RATES: Readonly<Record<string, number>>;
15
+ /** The client pre-sample rate for a product, clamped to [0, 1]. */
16
+ export declare function resolveRumSampleRate(product: string, configured?: number): number;
17
+ type GraphqlNavigationType = 'NAVIGATE' | 'RELOAD' | 'BACK_FORWARD' | 'BACK_FORWARD_CACHE' | 'PRERENDER' | 'RESTORE';
18
+ /** web-vitals `navigationType` -> GraphQL `WebVitalNavigationType`; unknown values are `NAVIGATE`. */
19
+ export declare function toRumNavigationType(navigationType: string): GraphqlNavigationType;
20
+ /** Creates the reporter for the current page load. */
21
+ export declare function createRumReporter(opts: CreateRumReporterOptions): RumReporter;
22
+ export {};
@@ -0,0 +1,166 @@
1
+ import { canReportRum as e, deviceClass as t, rumSection as n } from "./context.js";
2
+ // src/shared/rum/reporter.ts
3
+ var r = "mutation ReportWebVitals($input: ReportWebVitalsInput!) { reportWebVitals(input: $input) { accepted dropped sampleRate } }", i = "mutation ReportPublicWebVitals($input: ReportWebVitalsInput!) { reportPublicWebVitals(input: $input) { accepted dropped sampleRate } }", a = 3, o = 2048, s = Object.freeze({});
4
+ function c(e, t) {
5
+ return l(t ?? s[e] ?? 1);
6
+ }
7
+ function l(e) {
8
+ return Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : 0;
9
+ }
10
+ var u = Object.freeze({
11
+ navigate: "NAVIGATE",
12
+ reload: "RELOAD",
13
+ "back-forward": "BACK_FORWARD",
14
+ "back-forward-cache": "BACK_FORWARD_CACHE",
15
+ prerender: "PRERENDER",
16
+ restore: "RESTORE"
17
+ });
18
+ function d(e) {
19
+ return u[e] ?? "NAVIGATE";
20
+ }
21
+ var f = Object.freeze({
22
+ mobile: "MOBILE",
23
+ tablet: "TABLET",
24
+ desktop: "DESKTOP"
25
+ }), p = [
26
+ "ttfb",
27
+ "fcp",
28
+ "lcp"
29
+ ], m = ["inp", "cls"], h = /* @__PURE__ */ new Set(["UNAUTHENTICATED", "FORBIDDEN"]);
30
+ function g(e) {
31
+ return typeof e == "object" && !!e;
32
+ }
33
+ function _(a) {
34
+ let o = a.section ?? n(C()), s = a.device ?? t(), c = Math.random() < l(a.sampleRate), u = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), _ = null, y = 0, x = 1, T = !c, E = !1, D = () => {
35
+ typeof document < "u" && document.visibilityState === "hidden" && M();
36
+ }, O = () => M();
37
+ !T && typeof window < "u" && (typeof document < "u" && document.addEventListener("visibilitychange", D), window.addEventListener("pagehide", O));
38
+ function k() {
39
+ typeof window < "u" && (typeof document < "u" && document.removeEventListener("visibilitychange", D), window.removeEventListener("pagehide", O));
40
+ }
41
+ function A() {
42
+ T = !0, k();
43
+ }
44
+ function j() {
45
+ let e = [];
46
+ if (y === 0) for (let t of p) {
47
+ let n = u.get(t);
48
+ n !== void 0 && !h.has(t) && e.push(v(t, n));
49
+ }
50
+ for (let t of m) {
51
+ let n = u.get(t);
52
+ if (n === void 0) continue;
53
+ let r = h.get(t);
54
+ (r === void 0 || n > r) && e.push(v(t, n));
55
+ }
56
+ return e;
57
+ }
58
+ function M() {
59
+ if (T || E || y >= 3 || !e()) return;
60
+ let t = j();
61
+ if (t.length === 0 || y > 0 && x < 1 && Math.random() >= x) return;
62
+ let n = a.getAccessToken() || null;
63
+ if (!n && !a.anon) return;
64
+ let c = n ? "reportWebVitals" : "reportPublicWebVitals", l = JSON.stringify({
65
+ operationName: n ? "ReportWebVitals" : "ReportPublicWebVitals",
66
+ query: n ? r : i,
67
+ variables: { input: {
68
+ product: a.product,
69
+ section: o,
70
+ device: f[s],
71
+ navigationType: d(_ ?? "navigate"),
72
+ samples: t
73
+ } }
74
+ });
75
+ if (w(l) >= 2048) return;
76
+ y += 1;
77
+ for (let e of t) {
78
+ let t = b(e.metric);
79
+ h.set(t, u.get(t) ?? e.value);
80
+ }
81
+ let p = {
82
+ "content-type": "application/json",
83
+ "x-product-slug": a.product
84
+ };
85
+ n && (p.authorization = `Bearer ${n}`);
86
+ let m;
87
+ try {
88
+ m = fetch(`${a.endpoint}?op=rum`, {
89
+ method: "POST",
90
+ keepalive: !0,
91
+ credentials: "include",
92
+ headers: p,
93
+ body: l
94
+ });
95
+ } catch {
96
+ return;
97
+ }
98
+ m.then(N(c)).catch(() => void 0);
99
+ }
100
+ function N(e) {
101
+ return async (t) => {
102
+ if (t.status === 401 || t.status === 403) {
103
+ A();
104
+ return;
105
+ }
106
+ if (!t.ok) return;
107
+ let n = await t.json().catch(() => null);
108
+ if (!g(n)) return;
109
+ if (n.errors?.some((e) => S(e.extensions?.code))) {
110
+ A();
111
+ return;
112
+ }
113
+ let r = n.data?.[e]?.sampleRate;
114
+ typeof r == "number" && Number.isFinite(r) && (x = l(r), x === 0 && A());
115
+ };
116
+ }
117
+ return {
118
+ record(e, t, n) {
119
+ if (!(T || E) && !(!Number.isFinite(t) || t < 0)) {
120
+ if (_ === null) _ = n;
121
+ else if (n !== _) return;
122
+ u.set(e, t);
123
+ }
124
+ },
125
+ dispose() {
126
+ E = !0, k();
127
+ }
128
+ };
129
+ }
130
+ function v(e, t) {
131
+ return {
132
+ metric: y(e),
133
+ value: x(e, t)
134
+ };
135
+ }
136
+ function y(e) {
137
+ switch (e) {
138
+ case "lcp": return "LCP";
139
+ case "inp": return "INP";
140
+ case "cls": return "CLS";
141
+ case "ttfb": return "TTFB";
142
+ case "fcp": return "FCP";
143
+ }
144
+ }
145
+ function b(e) {
146
+ switch (e) {
147
+ case "LCP": return "lcp";
148
+ case "INP": return "inp";
149
+ case "CLS": return "cls";
150
+ case "TTFB": return "ttfb";
151
+ case "FCP": return "fcp";
152
+ }
153
+ }
154
+ function x(e, t) {
155
+ return e === "cls" ? Math.round(t * 1e4) / 1e4 : Math.round(t * 10) / 10;
156
+ }
157
+ function S(e) {
158
+ return typeof e == "string" && h.has(e);
159
+ }
160
+ function C() {
161
+ return typeof location > "u" ? "/" : location.pathname;
162
+ }
163
+ function w(e) {
164
+ return new TextEncoder().encode(e).length;
165
+ }
166
+ export { s as DEFAULT_RUM_SAMPLE_RATES, o as MAX_RUM_BODY_BYTES, a as MAX_RUM_REPORTS, i as REPORT_PUBLIC_WEB_VITALS_DOCUMENT, r as REPORT_WEB_VITALS_DOCUMENT, _ as createRumReporter, c as resolveRumSampleRate, d as toRumNavigationType };
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Real-user monitoring (RUM) types for browser Core Web Vitals (BOFF-3914).
3
+ *
4
+ * @module @burdenoff/fe-libs/shared/rum
5
+ */
6
+ /** Coarse device class, derived in the browser. The server never parses the user agent. */
7
+ export type RumDevice = 'mobile' | 'tablet' | 'desktop';
8
+ /** The web-vitals metrics the reporter sends. */
9
+ export type RumMetric = 'lcp' | 'inp' | 'cls' | 'ttfb' | 'fcp';
10
+ /**
11
+ * Per-shell RUM configuration (`AppShellObservabilityConfig.rum`). Every field is
12
+ * optional; a shell does not need to pass anything.
13
+ */
14
+ export interface RumConfig {
15
+ /** Default true. `false` keeps the WebVitalsSink unmounted. */
16
+ enabled?: boolean;
17
+ /**
18
+ * Default true: signed-out pages report through `reportPublicWebVitals`. The
19
+ * server's `RUM_ANON_ENABLED` kill switch still decides whether they are kept.
20
+ */
21
+ anon?: boolean;
22
+ /**
23
+ * Client pre-sample rate in [0, 1], decided once per page load. Default 1;
24
+ * `DEFAULT_RUM_SAMPLE_RATES[product]` applies when this is not set.
25
+ */
26
+ sampleRate?: number;
27
+ /**
28
+ * Full URL of the global GraphQL endpoint. Default: the endpoint the shell's
29
+ * own global gateway client talks to.
30
+ */
31
+ endpoint?: string;
32
+ }
33
+ /** A RUM reporter for one page load. */
34
+ export interface RumReporter {
35
+ /** Record (or update) one metric value. `navigationType` is the web-vitals navigation type. */
36
+ record(metric: RumMetric, value: number, navigationType: string): void;
37
+ /** Remove the page lifecycle listeners. Nothing is sent after this. */
38
+ dispose(): void;
39
+ }
40
+ /** Options for {@link createRumReporter}. */
41
+ export interface CreateRumReporterOptions {
42
+ /** Product slug (canonical spelling, e.g. `botmanor`). */
43
+ product: string;
44
+ /** Full URL of the global GraphQL endpoint. */
45
+ endpoint: string;
46
+ /** The same access-token accessor the shell's global gateway client uses. */
47
+ getAccessToken: () => string | null | undefined;
48
+ /** Client pre-sample rate in [0, 1], decided once when the reporter is created. */
49
+ sampleRate: number;
50
+ /** Whether signed-out pages may report through `reportPublicWebVitals`. */
51
+ anon: boolean;
52
+ /** Landing section. Default: `rumSection(location.pathname)` at creation. */
53
+ section?: string;
54
+ /** Device class. Default: `deviceClass()` at creation. */
55
+ device?: RumDevice;
56
+ }