@mushi-mushi/web 1.25.0 → 1.27.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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,6 @@
1
- import { MushiConfig, MushiSDKInstance, MushiDiagnosticsResult, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiAssistantReply, MushiWidgetConfig, MushiLeaderboardEntry, MushiCrossAppReport, MushiTesterReputation, MushiConsoleEntry, MushiNetworkEntry, MushiUrlMatcher, MushiTracePropagationConfig, MushiPrivacyConfig, MushiPerformanceMetrics, MushiSelectedElement, MushiTimelineEntry, MushiApiCascadeConfig } from '@mushi-mushi/core';
1
+ import { MushiConfig, MushiSDKInstance, MushiDiagnosticsResult, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiAssistantReply, MushiWidgetConfig, MushiLeaderboardEntry, MushiCrossAppReport, MushiTesterReputation, MushiApiCascadeConfig } from '@mushi-mushi/core';
2
2
  export { MushiApiCascadeConfig, MushiConfig, MushiConsoleEntry, MushiDiagnosticsResult, MushiEnvironment, MushiEventHandler, MushiEventType, MushiNetworkEntry, MushiPerformanceMetrics, MushiReport, MushiReportCategory, MushiSDKInstance, MushiTimelineEntry, MushiTimelineKind, MushiUrlMatcher, MushiWidgetConfig } from '@mushi-mushi/core';
3
+ export { C as ConsoleCapture, E as ElementSelector, N as NetworkCapture, P as PerformanceCapture, S as ScreenshotCapture, T as TimelineCapture, c as createConsoleCapture, a as createElementSelector, b as createNetworkCapture, d as createPerformanceCapture, e as createScreenshotCapture, f as createTimelineCapture } from './timeline-BuqAn2FH.cjs';
3
4
  export { MushiLocale, getAvailableLocales, getLocale } from './i18n/index.cjs';
4
5
 
5
6
  declare class Mushi {
@@ -61,6 +62,16 @@ interface WidgetSubmitOutcome {
61
62
  * optimistic copy ("queued offline, we'll send it when you're back")
62
63
  * versus the confirmed copy ("received — track at #abc12345"). */
63
64
  queuedOffline?: boolean;
65
+ /**
66
+ * Distinguishes why a submit did not confirm immediately. Lets the
67
+ * receipt tell the truth instead of always saying "queued offline":
68
+ * - offline: navigator says offline, will flush on reconnect
69
+ * - retrying: transient network/5xx — queued for automatic retry
70
+ * - rate_limited: 429 — user should wait before sending more
71
+ * - quota: 403 entitlement/quota — will not succeed on retry
72
+ * - permanent: validation / payload too large — dropped, not queued
73
+ */
74
+ failureKind?: 'offline' | 'retrying' | 'rate_limited' | 'quota' | 'permanent';
64
75
  /** The report went through but its screenshot had to be shed (couldn't
65
76
  * compress under the wire budget, or the server said PAYLOAD_TOO_LARGE).
66
77
  * The success receipt says so instead of implying the image landed. */
@@ -123,6 +134,9 @@ declare class MushiWidget {
123
134
  private readonly sdkVersion;
124
135
  private host;
125
136
  private shadow;
137
+ /** Re-inject styles when OS light/dark flips while theme=auto|inherit. */
138
+ private colorSchemeMq;
139
+ private onColorSchemeChange;
126
140
  private config;
127
141
  private callbacks;
128
142
  private locale;
@@ -221,6 +235,7 @@ declare class MushiWidget {
221
235
  * Drives a different success copy so the user knows the report
222
236
  * hasn't actually reached the console yet. */
223
237
  private lastSubmitQueuedOffline;
238
+ private lastSubmitFailureKind;
224
239
  private lastSubmitScreenshotDropped;
225
240
  /** Whether the user has clicked ✕ on the header banner this session. */
226
241
  private bannerDismissed;
@@ -281,6 +296,12 @@ declare class MushiWidget {
281
296
  openAssistantTab(): void;
282
297
  /** Send one assistant turn and re-render as the reply streams back. */
283
298
  sendAssistantMessage(message: string): Promise<void>;
299
+ /** Persist Ask turns for same-tab reload survival (UX only). */
300
+ private persistAssistantSession;
301
+ /** Clear Ask transcript (e.g. host reset). Keeps Ask login-free. */
302
+ clearAssistantTranscript(): void;
303
+ /** Escape hatch from Ask → report category picker (no login required). */
304
+ private openReportFromAssistant;
284
305
  /**
285
306
  * Briefly highlight the trigger button (a soft pulse + tooltip) without
286
307
  * opening the full reporter panel. Use for first-session welcome nudges
@@ -351,6 +372,9 @@ declare class MushiWidget {
351
372
  setCrossAppReports(reports: MushiCrossAppReport[] | null, loading?: boolean): void;
352
373
  setTesterReputation(rep: MushiTesterReputation | null): void;
353
374
  destroy(): void;
375
+ /** Live-restyle when OS prefers-color-scheme changes (theme auto/inherit only). */
376
+ private bindColorSchemeListener;
377
+ private unbindColorSchemeListener;
354
378
  /**
355
379
  * Apply the SDK-owned pass-through layout to the host element so it is
356
380
  * always zero-sized and click/touch-transparent. Only the shadow-root
@@ -494,66 +518,21 @@ declare class MushiWidget {
494
518
  recorderOpenMyReports(): void;
495
519
  }
496
520
 
497
- interface ConsoleCapture {
498
- getEntries(): MushiConsoleEntry[];
499
- clear(): void;
500
- destroy(): void;
501
- }
502
- declare function createConsoleCapture(): ConsoleCapture;
503
-
504
- interface NetworkCapture {
505
- getEntries(): MushiNetworkEntry[];
506
- clear(): void;
507
- updateOptions(options: NetworkCaptureOptions): void;
508
- destroy(): void;
509
- }
510
- interface NetworkCaptureOptions {
511
- apiEndpoint?: string;
512
- ignoreUrls?: MushiUrlMatcher[];
513
- tracePropagation?: MushiTracePropagationConfig;
514
- sessionId?: string;
515
- }
516
- declare function createNetworkCapture(options?: NetworkCaptureOptions): NetworkCapture;
517
-
518
- interface ScreenshotCapture {
519
- take(): Promise<string | null>;
520
- updateOptions(options: ScreenshotCaptureOptions): void;
521
- }
522
- interface ScreenshotCaptureOptions {
523
- privacy?: MushiPrivacyConfig;
524
- /** Callback invoked when capture fails (taint, security policy, etc.). */
525
- onFailed?: (reason: 'taint' | 'error') => void;
526
- }
527
- declare function createScreenshotCapture(options?: ScreenshotCaptureOptions): ScreenshotCapture;
528
-
529
- interface PerformanceCapture {
530
- getMetrics(): MushiPerformanceMetrics;
531
- destroy(): void;
532
- }
533
- declare function createPerformanceCapture(): PerformanceCapture;
534
-
535
- interface ElementSelector {
536
- activate(): Promise<MushiSelectedElement | null>;
537
- deactivate(): void;
538
- isActive(): boolean;
539
- }
540
- declare function createElementSelector(): ElementSelector;
541
-
542
- interface TimelineCapture {
543
- setScreen(screen: {
544
- name: string;
545
- route?: string;
546
- feature?: string;
547
- }): void;
548
- getEntries(input?: {
549
- consoleLogs?: MushiConsoleEntry[] | null;
550
- networkLogs?: MushiNetworkEntry[] | null;
551
- }): MushiTimelineEntry[];
552
- clear(): void;
553
- destroy(): void;
554
- }
555
- declare function createTimelineCapture(): TimelineCapture;
556
-
521
+ /**
522
+ * FILE: packages/web/src/build-widget-theme.ts
523
+ * PURPOSE: Resolve Shadow-DOM CSS variables from @mushi-mushi/core tokens.
524
+ *
525
+ * All widget hex literals live here (or in core/design-tokens.ts) so
526
+ * packages/web/src/styles.ts stays a template-only stylesheet and
527
+ * scripts/check-design-tokens.mjs can enforce the single-source rule.
528
+ *
529
+ * hexToRgbTriplet — converts a 6-char validated hex string to a bare
530
+ * "R,G,B" triplet used as rgba() channels in styles.ts template literals:
531
+ * rgba(${accentRgb}, 0.4) — respects host accent overrides
532
+ * rgba(${shadowInk}, 0.35) — correct ink in both light and dark modes
533
+ * Called only on hex values that already passed safeWidgetHex(), so the
534
+ * regex-based extraction is always well-defined on valid 6-char inputs.
535
+ */
557
536
  interface WidgetThemeVars {
558
537
  isDark: boolean;
559
538
  paper: string;
@@ -568,6 +547,18 @@ interface WidgetThemeVars {
568
547
  widgetAccentWash: string;
569
548
  widgetAccentInk: string;
570
549
  widgetAccentShadow: string;
550
+ /**
551
+ * Bare R,G,B triplet for the resolved accent colour (e.g. "224,60,44").
552
+ * Use in template literals: `rgba(${accentRgb}, 0.5)`. This lets host
553
+ * accent overrides and dark-mode variants cascade automatically into
554
+ * every rgba() call — bypassing the hex guard which only rejects #hex.
555
+ */
556
+ accentRgb: string;
557
+ /**
558
+ * Bare R,G,B triplet for drop shadows: "0,0,0" in dark mode, "14,13,11"
559
+ * in light. Prevents light-ink halos from showing on dark paper surfaces.
560
+ */
561
+ shadowInk: string;
571
562
  ok: string;
572
563
  danger: string;
573
564
  onAccent: string;
@@ -696,4 +687,4 @@ interface ProactiveTriggerCleanup {
696
687
  }
697
688
  declare function setupProactiveTriggers(callbacks: ProactiveTriggerCallbacks, config?: ProactiveTriggerConfig): ProactiveTriggerCleanup;
698
689
 
699
- export { type ConsoleCapture, type ElementSelector, Mushi, MushiWidget, type NetworkCapture, type PerformanceCapture, type ProactiveConfig, type ProactiveManager, type ProactiveTriggerCallbacks, type ProactiveTriggerCleanup, type ScreenshotCapture, type TimelineCapture, type WidgetThemeVars, createConsoleCapture, createElementSelector, createNetworkCapture, createPerformanceCapture, createProactiveManager, createScreenshotCapture, createTimelineCapture, getWidgetPreviewTokens, getWidgetThemeVars, setupProactiveTriggers };
690
+ export { Mushi, MushiWidget, type ProactiveConfig, type ProactiveManager, type ProactiveTriggerCallbacks, type ProactiveTriggerCleanup, type WidgetThemeVars, createProactiveManager, getWidgetPreviewTokens, getWidgetThemeVars, setupProactiveTriggers };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { MushiConfig, MushiSDKInstance, MushiDiagnosticsResult, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiAssistantReply, MushiWidgetConfig, MushiLeaderboardEntry, MushiCrossAppReport, MushiTesterReputation, MushiConsoleEntry, MushiNetworkEntry, MushiUrlMatcher, MushiTracePropagationConfig, MushiPrivacyConfig, MushiPerformanceMetrics, MushiSelectedElement, MushiTimelineEntry, MushiApiCascadeConfig } from '@mushi-mushi/core';
1
+ import { MushiConfig, MushiSDKInstance, MushiDiagnosticsResult, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiAssistantReply, MushiWidgetConfig, MushiLeaderboardEntry, MushiCrossAppReport, MushiTesterReputation, MushiApiCascadeConfig } from '@mushi-mushi/core';
2
2
  export { MushiApiCascadeConfig, MushiConfig, MushiConsoleEntry, MushiDiagnosticsResult, MushiEnvironment, MushiEventHandler, MushiEventType, MushiNetworkEntry, MushiPerformanceMetrics, MushiReport, MushiReportCategory, MushiSDKInstance, MushiTimelineEntry, MushiTimelineKind, MushiUrlMatcher, MushiWidgetConfig } from '@mushi-mushi/core';
3
+ export { C as ConsoleCapture, E as ElementSelector, N as NetworkCapture, P as PerformanceCapture, S as ScreenshotCapture, T as TimelineCapture, c as createConsoleCapture, a as createElementSelector, b as createNetworkCapture, d as createPerformanceCapture, e as createScreenshotCapture, f as createTimelineCapture } from './timeline-BuqAn2FH.js';
3
4
  export { MushiLocale, getAvailableLocales, getLocale } from './i18n/index.js';
4
5
 
5
6
  declare class Mushi {
@@ -61,6 +62,16 @@ interface WidgetSubmitOutcome {
61
62
  * optimistic copy ("queued offline, we'll send it when you're back")
62
63
  * versus the confirmed copy ("received — track at #abc12345"). */
63
64
  queuedOffline?: boolean;
65
+ /**
66
+ * Distinguishes why a submit did not confirm immediately. Lets the
67
+ * receipt tell the truth instead of always saying "queued offline":
68
+ * - offline: navigator says offline, will flush on reconnect
69
+ * - retrying: transient network/5xx — queued for automatic retry
70
+ * - rate_limited: 429 — user should wait before sending more
71
+ * - quota: 403 entitlement/quota — will not succeed on retry
72
+ * - permanent: validation / payload too large — dropped, not queued
73
+ */
74
+ failureKind?: 'offline' | 'retrying' | 'rate_limited' | 'quota' | 'permanent';
64
75
  /** The report went through but its screenshot had to be shed (couldn't
65
76
  * compress under the wire budget, or the server said PAYLOAD_TOO_LARGE).
66
77
  * The success receipt says so instead of implying the image landed. */
@@ -123,6 +134,9 @@ declare class MushiWidget {
123
134
  private readonly sdkVersion;
124
135
  private host;
125
136
  private shadow;
137
+ /** Re-inject styles when OS light/dark flips while theme=auto|inherit. */
138
+ private colorSchemeMq;
139
+ private onColorSchemeChange;
126
140
  private config;
127
141
  private callbacks;
128
142
  private locale;
@@ -221,6 +235,7 @@ declare class MushiWidget {
221
235
  * Drives a different success copy so the user knows the report
222
236
  * hasn't actually reached the console yet. */
223
237
  private lastSubmitQueuedOffline;
238
+ private lastSubmitFailureKind;
224
239
  private lastSubmitScreenshotDropped;
225
240
  /** Whether the user has clicked ✕ on the header banner this session. */
226
241
  private bannerDismissed;
@@ -281,6 +296,12 @@ declare class MushiWidget {
281
296
  openAssistantTab(): void;
282
297
  /** Send one assistant turn and re-render as the reply streams back. */
283
298
  sendAssistantMessage(message: string): Promise<void>;
299
+ /** Persist Ask turns for same-tab reload survival (UX only). */
300
+ private persistAssistantSession;
301
+ /** Clear Ask transcript (e.g. host reset). Keeps Ask login-free. */
302
+ clearAssistantTranscript(): void;
303
+ /** Escape hatch from Ask → report category picker (no login required). */
304
+ private openReportFromAssistant;
284
305
  /**
285
306
  * Briefly highlight the trigger button (a soft pulse + tooltip) without
286
307
  * opening the full reporter panel. Use for first-session welcome nudges
@@ -351,6 +372,9 @@ declare class MushiWidget {
351
372
  setCrossAppReports(reports: MushiCrossAppReport[] | null, loading?: boolean): void;
352
373
  setTesterReputation(rep: MushiTesterReputation | null): void;
353
374
  destroy(): void;
375
+ /** Live-restyle when OS prefers-color-scheme changes (theme auto/inherit only). */
376
+ private bindColorSchemeListener;
377
+ private unbindColorSchemeListener;
354
378
  /**
355
379
  * Apply the SDK-owned pass-through layout to the host element so it is
356
380
  * always zero-sized and click/touch-transparent. Only the shadow-root
@@ -494,66 +518,21 @@ declare class MushiWidget {
494
518
  recorderOpenMyReports(): void;
495
519
  }
496
520
 
497
- interface ConsoleCapture {
498
- getEntries(): MushiConsoleEntry[];
499
- clear(): void;
500
- destroy(): void;
501
- }
502
- declare function createConsoleCapture(): ConsoleCapture;
503
-
504
- interface NetworkCapture {
505
- getEntries(): MushiNetworkEntry[];
506
- clear(): void;
507
- updateOptions(options: NetworkCaptureOptions): void;
508
- destroy(): void;
509
- }
510
- interface NetworkCaptureOptions {
511
- apiEndpoint?: string;
512
- ignoreUrls?: MushiUrlMatcher[];
513
- tracePropagation?: MushiTracePropagationConfig;
514
- sessionId?: string;
515
- }
516
- declare function createNetworkCapture(options?: NetworkCaptureOptions): NetworkCapture;
517
-
518
- interface ScreenshotCapture {
519
- take(): Promise<string | null>;
520
- updateOptions(options: ScreenshotCaptureOptions): void;
521
- }
522
- interface ScreenshotCaptureOptions {
523
- privacy?: MushiPrivacyConfig;
524
- /** Callback invoked when capture fails (taint, security policy, etc.). */
525
- onFailed?: (reason: 'taint' | 'error') => void;
526
- }
527
- declare function createScreenshotCapture(options?: ScreenshotCaptureOptions): ScreenshotCapture;
528
-
529
- interface PerformanceCapture {
530
- getMetrics(): MushiPerformanceMetrics;
531
- destroy(): void;
532
- }
533
- declare function createPerformanceCapture(): PerformanceCapture;
534
-
535
- interface ElementSelector {
536
- activate(): Promise<MushiSelectedElement | null>;
537
- deactivate(): void;
538
- isActive(): boolean;
539
- }
540
- declare function createElementSelector(): ElementSelector;
541
-
542
- interface TimelineCapture {
543
- setScreen(screen: {
544
- name: string;
545
- route?: string;
546
- feature?: string;
547
- }): void;
548
- getEntries(input?: {
549
- consoleLogs?: MushiConsoleEntry[] | null;
550
- networkLogs?: MushiNetworkEntry[] | null;
551
- }): MushiTimelineEntry[];
552
- clear(): void;
553
- destroy(): void;
554
- }
555
- declare function createTimelineCapture(): TimelineCapture;
556
-
521
+ /**
522
+ * FILE: packages/web/src/build-widget-theme.ts
523
+ * PURPOSE: Resolve Shadow-DOM CSS variables from @mushi-mushi/core tokens.
524
+ *
525
+ * All widget hex literals live here (or in core/design-tokens.ts) so
526
+ * packages/web/src/styles.ts stays a template-only stylesheet and
527
+ * scripts/check-design-tokens.mjs can enforce the single-source rule.
528
+ *
529
+ * hexToRgbTriplet — converts a 6-char validated hex string to a bare
530
+ * "R,G,B" triplet used as rgba() channels in styles.ts template literals:
531
+ * rgba(${accentRgb}, 0.4) — respects host accent overrides
532
+ * rgba(${shadowInk}, 0.35) — correct ink in both light and dark modes
533
+ * Called only on hex values that already passed safeWidgetHex(), so the
534
+ * regex-based extraction is always well-defined on valid 6-char inputs.
535
+ */
557
536
  interface WidgetThemeVars {
558
537
  isDark: boolean;
559
538
  paper: string;
@@ -568,6 +547,18 @@ interface WidgetThemeVars {
568
547
  widgetAccentWash: string;
569
548
  widgetAccentInk: string;
570
549
  widgetAccentShadow: string;
550
+ /**
551
+ * Bare R,G,B triplet for the resolved accent colour (e.g. "224,60,44").
552
+ * Use in template literals: `rgba(${accentRgb}, 0.5)`. This lets host
553
+ * accent overrides and dark-mode variants cascade automatically into
554
+ * every rgba() call — bypassing the hex guard which only rejects #hex.
555
+ */
556
+ accentRgb: string;
557
+ /**
558
+ * Bare R,G,B triplet for drop shadows: "0,0,0" in dark mode, "14,13,11"
559
+ * in light. Prevents light-ink halos from showing on dark paper surfaces.
560
+ */
561
+ shadowInk: string;
571
562
  ok: string;
572
563
  danger: string;
573
564
  onAccent: string;
@@ -696,4 +687,4 @@ interface ProactiveTriggerCleanup {
696
687
  }
697
688
  declare function setupProactiveTriggers(callbacks: ProactiveTriggerCallbacks, config?: ProactiveTriggerConfig): ProactiveTriggerCleanup;
698
689
 
699
- export { type ConsoleCapture, type ElementSelector, Mushi, MushiWidget, type NetworkCapture, type PerformanceCapture, type ProactiveConfig, type ProactiveManager, type ProactiveTriggerCallbacks, type ProactiveTriggerCleanup, type ScreenshotCapture, type TimelineCapture, type WidgetThemeVars, createConsoleCapture, createElementSelector, createNetworkCapture, createPerformanceCapture, createProactiveManager, createScreenshotCapture, createTimelineCapture, getWidgetPreviewTokens, getWidgetThemeVars, setupProactiveTriggers };
690
+ export { Mushi, MushiWidget, type ProactiveConfig, type ProactiveManager, type ProactiveTriggerCallbacks, type ProactiveTriggerCleanup, type WidgetThemeVars, createProactiveManager, getWidgetPreviewTokens, getWidgetThemeVars, setupProactiveTriggers };