@mushi-mushi/core 0.5.1 → 0.8.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
@@ -2,15 +2,18 @@ interface MushiConfig {
2
2
  projectId: string;
3
3
  apiKey: string;
4
4
  apiEndpoint?: string;
5
+ /** Opinionated defaults for common environments. Explicit config wins. */
6
+ preset?: MushiPreset;
5
7
  /**
6
8
  * Fetch non-secret widget/capture settings from the Mushi project at
7
9
  * startup. Defaults to true so console changes apply without rebuilding
8
10
  * host apps. Set false for fully static/offline deployments.
9
11
  */
10
- runtimeConfig?: boolean;
12
+ runtimeConfig?: boolean | 'auto';
11
13
  sentry?: MushiSentryConfig;
12
14
  widget?: MushiWidgetConfig;
13
15
  capture?: MushiCaptureConfig;
16
+ privacy?: MushiPrivacyConfig;
14
17
  proactive?: MushiProactiveConfig;
15
18
  preFilter?: MushiPreFilterConfig;
16
19
  integrations?: MushiIntegrationsConfig;
@@ -27,28 +30,99 @@ interface MushiSentryConfig {
27
30
  }
28
31
  interface MushiWidgetConfig {
29
32
  position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
33
+ /**
34
+ * Raw CSS anchors for app shells with bottom navs/chat composers/cookie
35
+ * banners. When set, these values win over `position` + numeric `inset`.
36
+ */
37
+ anchor?: MushiWidgetAnchor;
30
38
  theme?: 'auto' | 'light' | 'dark';
31
39
  triggerText?: string;
32
40
  expandedTitle?: string;
33
41
  mode?: 'simple' | 'conversational';
34
42
  locale?: string;
35
43
  zIndex?: number;
44
+ /**
45
+ * Controls how, or whether, the default trigger is injected.
46
+ * `auto` preserves the historical floating stamp button.
47
+ */
48
+ trigger?: 'auto' | 'edge-tab' | 'attach' | 'manual' | 'hidden';
49
+ /** CSS selector used when `trigger` is `attach`. */
50
+ attachToSelector?: string;
51
+ /**
52
+ * Per-edge trigger offset in pixels. `auto` clears the corresponding edge.
53
+ * Defaults to the historical 24px gutter plus safe-area insets.
54
+ */
55
+ inset?: MushiWidgetInset;
56
+ respectSafeArea?: boolean;
57
+ /** Hide the launcher while any matching element exists in the document. */
58
+ hideOnSelector?: string;
59
+ /** Hide the launcher on matching pathnames. Strings are substring matches. */
60
+ hideOnRoutes?: string[];
61
+ environments?: Partial<Record<'production' | 'staging' | 'development', 'always' | 'never' | 'manual'>>;
62
+ /** Opt-in smart trigger behavior; planned to become the default in a later minor. */
63
+ smartHide?: boolean | MushiWidgetSmartHideConfig;
64
+ draggable?: boolean;
65
+ /** Show the tiny "Powered by Mushi vX" footer inside the widget panel. */
66
+ brandFooter?: boolean;
67
+ /** How the widget should surface SDK freshness warnings. Defaults to auto. */
68
+ outdatedBanner?: 'auto' | 'banner' | 'console-only' | 'off';
69
+ }
70
+ interface MushiWidgetInset {
71
+ top?: number | 'auto';
72
+ right?: number | 'auto';
73
+ bottom?: number | 'auto';
74
+ left?: number | 'auto';
75
+ }
76
+ interface MushiWidgetAnchor {
77
+ top?: string;
78
+ right?: string;
79
+ bottom?: string;
80
+ left?: string;
81
+ }
82
+ type MushiPreset = 'production-calm' | 'beta-loud' | 'internal-debug' | 'manual-only';
83
+ interface MushiWidgetSmartHideConfig {
84
+ onMobile?: 'edge-tab' | 'hide' | false;
85
+ onScroll?: 'shrink' | 'hide' | false;
86
+ onIdleMs?: number;
36
87
  }
37
88
  interface MushiCaptureConfig {
38
89
  console?: boolean;
39
90
  network?: boolean;
91
+ /**
92
+ * URLs that should never be captured as host-app traffic. Strings are
93
+ * substring matches; RegExp values are tested against the fully resolved URL.
94
+ */
95
+ ignoreUrls?: MushiUrlMatcher[];
40
96
  performance?: boolean;
41
97
  screenshot?: 'on-report' | 'auto' | 'off';
42
98
  elementSelector?: boolean;
43
99
  replay?: 'sentry' | 'rrweb' | 'lite' | 'off';
44
100
  }
101
+ interface MushiPrivacyConfig {
102
+ /** DOM nodes to visually mask in screenshots before upload. */
103
+ maskSelectors?: string[];
104
+ /** DOM subtrees to remove from screenshots before upload. */
105
+ blockSelectors?: string[];
106
+ /** Let reporters remove an attached screenshot before submitting. Defaults to true. */
107
+ allowUserRemoveScreenshot?: boolean;
108
+ }
45
109
  interface MushiProactiveConfig {
46
110
  rageClick?: boolean;
47
111
  errorBoundary?: boolean;
48
112
  longTask?: boolean;
49
- apiCascade?: boolean;
113
+ apiCascade?: boolean | MushiApiCascadeConfig;
50
114
  cooldown?: MushiCooldownConfig;
51
115
  }
116
+ type MushiUrlMatcher = string | RegExp;
117
+ interface MushiApiCascadeConfig {
118
+ enabled?: boolean;
119
+ /**
120
+ * URLs ignored by the API cascade detector. The SDK always ignores its own
121
+ * gateway endpoints as well; this hook lets host apps exclude analytics,
122
+ * health probes, or third-party scripts that are noisy by design.
123
+ */
124
+ ignoreUrls?: MushiUrlMatcher[];
125
+ }
52
126
  interface MushiCooldownConfig {
53
127
  maxProactivePerSession?: number;
54
128
  dismissCooldownHours?: number;
@@ -135,6 +209,7 @@ interface MushiReport {
135
209
  consoleLogs?: MushiConsoleEntry[];
136
210
  networkLogs?: MushiNetworkEntry[];
137
211
  performanceMetrics?: MushiPerformanceMetrics;
212
+ timeline?: MushiTimelineEntry[];
138
213
  screenshotDataUrl?: string;
139
214
  selectedElement?: MushiSelectedElement;
140
215
  metadata?: Record<string, unknown>;
@@ -147,6 +222,10 @@ interface MushiReport {
147
222
  */
148
223
  fingerprintHash?: string;
149
224
  appVersion?: string;
225
+ /** SDK package that submitted the report, e.g. `@mushi-mushi/web`. */
226
+ sdkPackage?: string;
227
+ /** npm package version that submitted the report, e.g. `0.8.0`. */
228
+ sdkVersion?: string;
150
229
  proactiveTrigger?: string;
151
230
  sentryEventId?: string;
152
231
  sentryReplayId?: string;
@@ -216,11 +295,28 @@ interface MushiSelectedElement {
216
295
  height: number;
217
296
  };
218
297
  }
298
+ type MushiTimelineKind = 'route' | 'click' | 'request' | 'log' | 'screen';
299
+ interface MushiTimelineEntry {
300
+ ts: number;
301
+ kind: MushiTimelineKind;
302
+ payload: Record<string, unknown>;
303
+ }
219
304
  type MushiEventType = 'report:submitted' | 'report:queued' | 'report:sent' | 'report:failed' | 'widget:opened' | 'widget:closed' | 'proactive:triggered' | 'proactive:dismissed';
220
305
  type MushiEventHandler = (event: {
221
306
  type: MushiEventType;
222
307
  data?: unknown;
223
308
  }) => void;
309
+ interface MushiDiagnosticsResult {
310
+ apiEndpointReachable: boolean;
311
+ cspAllowsEndpoint: boolean;
312
+ widgetMounted: boolean;
313
+ shadowDomAvailable: boolean;
314
+ dialogSupported: boolean;
315
+ runtimeConfigLoaded: boolean;
316
+ captureScreenshotAvailable: boolean;
317
+ captureNetworkIntercepting: boolean;
318
+ sdkVersion: string;
319
+ }
224
320
  interface MushiSDKInstance {
225
321
  report(options?: {
226
322
  category?: MushiReportCategory;
@@ -232,11 +328,22 @@ interface MushiSDKInstance {
232
328
  name?: string;
233
329
  }): void;
234
330
  setMetadata(key: string, value: unknown): void;
331
+ setScreen(screen: {
332
+ name: string;
333
+ route?: string;
334
+ feature?: string;
335
+ }): void;
235
336
  isOpen(): boolean;
236
337
  open(): void;
338
+ openWith(category: MushiReportCategory): void;
339
+ show(): void;
340
+ hide(): void;
341
+ attachTo(selectorOrElement: string | Element, options?: MushiWidgetConfig): () => void;
342
+ setTrigger(trigger: NonNullable<MushiWidgetConfig['trigger']>): void;
237
343
  close(): void;
238
344
  destroy(): void;
239
345
  updateConfig(config: MushiRuntimeSdkConfig): void;
346
+ diagnose(): Promise<MushiDiagnosticsResult>;
240
347
  /**
241
348
  * Wave G4 — unified `captureEvent` API. Submits a bug report
242
349
  * programmatically without opening the widget. Useful for adapters
@@ -283,6 +390,16 @@ interface MushiApiClient {
283
390
  status: MushiReportStatus;
284
391
  }>>;
285
392
  getSdkConfig(): Promise<MushiApiResponse<MushiRuntimeSdkConfig>>;
393
+ getLatestSdkVersion(packageName: string): Promise<MushiApiResponse<MushiSdkVersionInfo>>;
394
+ listReporterReports(reporterToken: string): Promise<MushiApiResponse<{
395
+ reports: MushiReporterReport[];
396
+ }>>;
397
+ listReporterComments(reportId: string, reporterToken: string): Promise<MushiApiResponse<{
398
+ comments: MushiReporterComment[];
399
+ }>>;
400
+ replyToReporterReport(reportId: string, reporterToken: string, body: string): Promise<MushiApiResponse<{
401
+ comment: MushiReporterComment;
402
+ }>>;
286
403
  }
287
404
  interface MushiApiResponse<T> {
288
405
  ok: boolean;
@@ -302,6 +419,34 @@ interface MushiRuntimeSdkConfig {
302
419
  minDescriptionLength?: number;
303
420
  };
304
421
  }
422
+ interface MushiSdkVersionInfo {
423
+ package: string;
424
+ latest: string | null;
425
+ current?: string;
426
+ deprecated: boolean;
427
+ deprecationMessage?: string | null;
428
+ releasedAt?: string | null;
429
+ }
430
+ interface MushiReporterReport {
431
+ id: string;
432
+ status: string;
433
+ category: string;
434
+ severity?: string | null;
435
+ summary?: string | null;
436
+ description?: string | null;
437
+ created_at: string;
438
+ last_admin_reply_at?: string | null;
439
+ last_reporter_reply_at?: string | null;
440
+ unread_count?: number;
441
+ }
442
+ interface MushiReporterComment {
443
+ id: number;
444
+ author_kind: 'admin' | 'reporter';
445
+ author_name?: string | null;
446
+ body: string;
447
+ visible_to_reporter?: boolean;
448
+ created_at: string;
449
+ }
305
450
 
306
451
  interface ApiClientOptions {
307
452
  projectId: string;
@@ -315,6 +460,9 @@ interface ApiClientOptions {
315
460
  maxRetries?: number;
316
461
  }
317
462
  declare const DEFAULT_API_ENDPOINT = "https://dxptnwrhwsqckaftyymj.supabase.co/functions/v1/api";
463
+ declare const MUSHI_INTERNAL_HEADER = "X-Mushi-Internal";
464
+ declare const MUSHI_INTERNAL_INIT_MARKER = "__mushiInternal";
465
+ type MushiInternalRequestKind = 'sdk-config' | 'report-submit' | 'report-status' | 'reporter-poll' | 'diagnose';
318
466
  declare function createApiClient(options: ApiClientOptions): MushiApiClient;
319
467
 
320
468
  /**
@@ -506,4 +654,4 @@ declare function createLogger(options: LoggerOptions): Logger;
506
654
  */
507
655
  declare const noopLogger: Logger;
508
656
 
509
- export { type ApiClientOptions, DEFAULT_API_ENDPOINT, type LogEntry, type LogFormat, type LogLevel, type Logger, type LoggerOptions, type MushiApiClient, type MushiApiResponse, type MushiCaptureConfig, type MushiCaptureEventInput, type MushiConfig, type MushiConsoleEntry, type MushiCooldownConfig, type MushiEnvironment, type MushiEventHandler, type MushiEventType, type MushiIntegrationsConfig, type MushiNetworkEntry, type MushiOfflineConfig, type MushiOnDeviceClassifier, type MushiOnDeviceClassifierInput, type MushiOnDeviceClassifierResult, type MushiPerformanceMetrics, type MushiPreFilterConfig, type MushiProactiveConfig, type MushiRegion, type MushiReport, type MushiReportBuilder, type MushiReportCategory, type MushiReportStatus, type MushiRewardsConfig, type MushiRuntimeSdkConfig, type MushiSDKInstance, type MushiSelectedElement, type MushiSentryConfig, type MushiWidgetConfig, type OfflineQueue, type PiiScrubberConfig, type PreFilterResult, REGION_ENDPOINTS, type RateLimiter, type RateLimiterConfig, captureEnvironment, createApiClient, createLogger, createOfflineQueue, createPiiScrubber, createPreFilter, createRateLimiter, getDeviceFingerprintHash, getReporterToken, getSessionId, noopLogger, resolveRegionEndpoint, scrubPii };
657
+ export { type ApiClientOptions, DEFAULT_API_ENDPOINT, type LogEntry, type LogFormat, type LogLevel, type Logger, type LoggerOptions, MUSHI_INTERNAL_HEADER, MUSHI_INTERNAL_INIT_MARKER, type MushiApiCascadeConfig, type MushiApiClient, type MushiApiResponse, type MushiCaptureConfig, type MushiCaptureEventInput, type MushiConfig, type MushiConsoleEntry, type MushiCooldownConfig, type MushiDiagnosticsResult, type MushiEnvironment, type MushiEventHandler, type MushiEventType, type MushiIntegrationsConfig, type MushiInternalRequestKind, type MushiNetworkEntry, type MushiOfflineConfig, type MushiOnDeviceClassifier, type MushiOnDeviceClassifierInput, type MushiOnDeviceClassifierResult, type MushiPerformanceMetrics, type MushiPreFilterConfig, type MushiPreset, type MushiPrivacyConfig, type MushiProactiveConfig, type MushiRegion, type MushiReport, type MushiReportBuilder, type MushiReportCategory, type MushiReportStatus, type MushiReporterComment, type MushiReporterReport, type MushiRewardsConfig, type MushiRuntimeSdkConfig, type MushiSDKInstance, type MushiSdkVersionInfo, type MushiSelectedElement, type MushiSentryConfig, type MushiTimelineEntry, type MushiTimelineKind, type MushiUrlMatcher, type MushiWidgetAnchor, type MushiWidgetConfig, type OfflineQueue, type PiiScrubberConfig, type PreFilterResult, REGION_ENDPOINTS, type RateLimiter, type RateLimiterConfig, captureEnvironment, createApiClient, createLogger, createOfflineQueue, createPiiScrubber, createPreFilter, createRateLimiter, getDeviceFingerprintHash, getReporterToken, getSessionId, noopLogger, resolveRegionEndpoint, scrubPii };
package/dist/index.d.ts CHANGED
@@ -2,15 +2,18 @@ interface MushiConfig {
2
2
  projectId: string;
3
3
  apiKey: string;
4
4
  apiEndpoint?: string;
5
+ /** Opinionated defaults for common environments. Explicit config wins. */
6
+ preset?: MushiPreset;
5
7
  /**
6
8
  * Fetch non-secret widget/capture settings from the Mushi project at
7
9
  * startup. Defaults to true so console changes apply without rebuilding
8
10
  * host apps. Set false for fully static/offline deployments.
9
11
  */
10
- runtimeConfig?: boolean;
12
+ runtimeConfig?: boolean | 'auto';
11
13
  sentry?: MushiSentryConfig;
12
14
  widget?: MushiWidgetConfig;
13
15
  capture?: MushiCaptureConfig;
16
+ privacy?: MushiPrivacyConfig;
14
17
  proactive?: MushiProactiveConfig;
15
18
  preFilter?: MushiPreFilterConfig;
16
19
  integrations?: MushiIntegrationsConfig;
@@ -27,28 +30,99 @@ interface MushiSentryConfig {
27
30
  }
28
31
  interface MushiWidgetConfig {
29
32
  position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
33
+ /**
34
+ * Raw CSS anchors for app shells with bottom navs/chat composers/cookie
35
+ * banners. When set, these values win over `position` + numeric `inset`.
36
+ */
37
+ anchor?: MushiWidgetAnchor;
30
38
  theme?: 'auto' | 'light' | 'dark';
31
39
  triggerText?: string;
32
40
  expandedTitle?: string;
33
41
  mode?: 'simple' | 'conversational';
34
42
  locale?: string;
35
43
  zIndex?: number;
44
+ /**
45
+ * Controls how, or whether, the default trigger is injected.
46
+ * `auto` preserves the historical floating stamp button.
47
+ */
48
+ trigger?: 'auto' | 'edge-tab' | 'attach' | 'manual' | 'hidden';
49
+ /** CSS selector used when `trigger` is `attach`. */
50
+ attachToSelector?: string;
51
+ /**
52
+ * Per-edge trigger offset in pixels. `auto` clears the corresponding edge.
53
+ * Defaults to the historical 24px gutter plus safe-area insets.
54
+ */
55
+ inset?: MushiWidgetInset;
56
+ respectSafeArea?: boolean;
57
+ /** Hide the launcher while any matching element exists in the document. */
58
+ hideOnSelector?: string;
59
+ /** Hide the launcher on matching pathnames. Strings are substring matches. */
60
+ hideOnRoutes?: string[];
61
+ environments?: Partial<Record<'production' | 'staging' | 'development', 'always' | 'never' | 'manual'>>;
62
+ /** Opt-in smart trigger behavior; planned to become the default in a later minor. */
63
+ smartHide?: boolean | MushiWidgetSmartHideConfig;
64
+ draggable?: boolean;
65
+ /** Show the tiny "Powered by Mushi vX" footer inside the widget panel. */
66
+ brandFooter?: boolean;
67
+ /** How the widget should surface SDK freshness warnings. Defaults to auto. */
68
+ outdatedBanner?: 'auto' | 'banner' | 'console-only' | 'off';
69
+ }
70
+ interface MushiWidgetInset {
71
+ top?: number | 'auto';
72
+ right?: number | 'auto';
73
+ bottom?: number | 'auto';
74
+ left?: number | 'auto';
75
+ }
76
+ interface MushiWidgetAnchor {
77
+ top?: string;
78
+ right?: string;
79
+ bottom?: string;
80
+ left?: string;
81
+ }
82
+ type MushiPreset = 'production-calm' | 'beta-loud' | 'internal-debug' | 'manual-only';
83
+ interface MushiWidgetSmartHideConfig {
84
+ onMobile?: 'edge-tab' | 'hide' | false;
85
+ onScroll?: 'shrink' | 'hide' | false;
86
+ onIdleMs?: number;
36
87
  }
37
88
  interface MushiCaptureConfig {
38
89
  console?: boolean;
39
90
  network?: boolean;
91
+ /**
92
+ * URLs that should never be captured as host-app traffic. Strings are
93
+ * substring matches; RegExp values are tested against the fully resolved URL.
94
+ */
95
+ ignoreUrls?: MushiUrlMatcher[];
40
96
  performance?: boolean;
41
97
  screenshot?: 'on-report' | 'auto' | 'off';
42
98
  elementSelector?: boolean;
43
99
  replay?: 'sentry' | 'rrweb' | 'lite' | 'off';
44
100
  }
101
+ interface MushiPrivacyConfig {
102
+ /** DOM nodes to visually mask in screenshots before upload. */
103
+ maskSelectors?: string[];
104
+ /** DOM subtrees to remove from screenshots before upload. */
105
+ blockSelectors?: string[];
106
+ /** Let reporters remove an attached screenshot before submitting. Defaults to true. */
107
+ allowUserRemoveScreenshot?: boolean;
108
+ }
45
109
  interface MushiProactiveConfig {
46
110
  rageClick?: boolean;
47
111
  errorBoundary?: boolean;
48
112
  longTask?: boolean;
49
- apiCascade?: boolean;
113
+ apiCascade?: boolean | MushiApiCascadeConfig;
50
114
  cooldown?: MushiCooldownConfig;
51
115
  }
116
+ type MushiUrlMatcher = string | RegExp;
117
+ interface MushiApiCascadeConfig {
118
+ enabled?: boolean;
119
+ /**
120
+ * URLs ignored by the API cascade detector. The SDK always ignores its own
121
+ * gateway endpoints as well; this hook lets host apps exclude analytics,
122
+ * health probes, or third-party scripts that are noisy by design.
123
+ */
124
+ ignoreUrls?: MushiUrlMatcher[];
125
+ }
52
126
  interface MushiCooldownConfig {
53
127
  maxProactivePerSession?: number;
54
128
  dismissCooldownHours?: number;
@@ -135,6 +209,7 @@ interface MushiReport {
135
209
  consoleLogs?: MushiConsoleEntry[];
136
210
  networkLogs?: MushiNetworkEntry[];
137
211
  performanceMetrics?: MushiPerformanceMetrics;
212
+ timeline?: MushiTimelineEntry[];
138
213
  screenshotDataUrl?: string;
139
214
  selectedElement?: MushiSelectedElement;
140
215
  metadata?: Record<string, unknown>;
@@ -147,6 +222,10 @@ interface MushiReport {
147
222
  */
148
223
  fingerprintHash?: string;
149
224
  appVersion?: string;
225
+ /** SDK package that submitted the report, e.g. `@mushi-mushi/web`. */
226
+ sdkPackage?: string;
227
+ /** npm package version that submitted the report, e.g. `0.8.0`. */
228
+ sdkVersion?: string;
150
229
  proactiveTrigger?: string;
151
230
  sentryEventId?: string;
152
231
  sentryReplayId?: string;
@@ -216,11 +295,28 @@ interface MushiSelectedElement {
216
295
  height: number;
217
296
  };
218
297
  }
298
+ type MushiTimelineKind = 'route' | 'click' | 'request' | 'log' | 'screen';
299
+ interface MushiTimelineEntry {
300
+ ts: number;
301
+ kind: MushiTimelineKind;
302
+ payload: Record<string, unknown>;
303
+ }
219
304
  type MushiEventType = 'report:submitted' | 'report:queued' | 'report:sent' | 'report:failed' | 'widget:opened' | 'widget:closed' | 'proactive:triggered' | 'proactive:dismissed';
220
305
  type MushiEventHandler = (event: {
221
306
  type: MushiEventType;
222
307
  data?: unknown;
223
308
  }) => void;
309
+ interface MushiDiagnosticsResult {
310
+ apiEndpointReachable: boolean;
311
+ cspAllowsEndpoint: boolean;
312
+ widgetMounted: boolean;
313
+ shadowDomAvailable: boolean;
314
+ dialogSupported: boolean;
315
+ runtimeConfigLoaded: boolean;
316
+ captureScreenshotAvailable: boolean;
317
+ captureNetworkIntercepting: boolean;
318
+ sdkVersion: string;
319
+ }
224
320
  interface MushiSDKInstance {
225
321
  report(options?: {
226
322
  category?: MushiReportCategory;
@@ -232,11 +328,22 @@ interface MushiSDKInstance {
232
328
  name?: string;
233
329
  }): void;
234
330
  setMetadata(key: string, value: unknown): void;
331
+ setScreen(screen: {
332
+ name: string;
333
+ route?: string;
334
+ feature?: string;
335
+ }): void;
235
336
  isOpen(): boolean;
236
337
  open(): void;
338
+ openWith(category: MushiReportCategory): void;
339
+ show(): void;
340
+ hide(): void;
341
+ attachTo(selectorOrElement: string | Element, options?: MushiWidgetConfig): () => void;
342
+ setTrigger(trigger: NonNullable<MushiWidgetConfig['trigger']>): void;
237
343
  close(): void;
238
344
  destroy(): void;
239
345
  updateConfig(config: MushiRuntimeSdkConfig): void;
346
+ diagnose(): Promise<MushiDiagnosticsResult>;
240
347
  /**
241
348
  * Wave G4 — unified `captureEvent` API. Submits a bug report
242
349
  * programmatically without opening the widget. Useful for adapters
@@ -283,6 +390,16 @@ interface MushiApiClient {
283
390
  status: MushiReportStatus;
284
391
  }>>;
285
392
  getSdkConfig(): Promise<MushiApiResponse<MushiRuntimeSdkConfig>>;
393
+ getLatestSdkVersion(packageName: string): Promise<MushiApiResponse<MushiSdkVersionInfo>>;
394
+ listReporterReports(reporterToken: string): Promise<MushiApiResponse<{
395
+ reports: MushiReporterReport[];
396
+ }>>;
397
+ listReporterComments(reportId: string, reporterToken: string): Promise<MushiApiResponse<{
398
+ comments: MushiReporterComment[];
399
+ }>>;
400
+ replyToReporterReport(reportId: string, reporterToken: string, body: string): Promise<MushiApiResponse<{
401
+ comment: MushiReporterComment;
402
+ }>>;
286
403
  }
287
404
  interface MushiApiResponse<T> {
288
405
  ok: boolean;
@@ -302,6 +419,34 @@ interface MushiRuntimeSdkConfig {
302
419
  minDescriptionLength?: number;
303
420
  };
304
421
  }
422
+ interface MushiSdkVersionInfo {
423
+ package: string;
424
+ latest: string | null;
425
+ current?: string;
426
+ deprecated: boolean;
427
+ deprecationMessage?: string | null;
428
+ releasedAt?: string | null;
429
+ }
430
+ interface MushiReporterReport {
431
+ id: string;
432
+ status: string;
433
+ category: string;
434
+ severity?: string | null;
435
+ summary?: string | null;
436
+ description?: string | null;
437
+ created_at: string;
438
+ last_admin_reply_at?: string | null;
439
+ last_reporter_reply_at?: string | null;
440
+ unread_count?: number;
441
+ }
442
+ interface MushiReporterComment {
443
+ id: number;
444
+ author_kind: 'admin' | 'reporter';
445
+ author_name?: string | null;
446
+ body: string;
447
+ visible_to_reporter?: boolean;
448
+ created_at: string;
449
+ }
305
450
 
306
451
  interface ApiClientOptions {
307
452
  projectId: string;
@@ -315,6 +460,9 @@ interface ApiClientOptions {
315
460
  maxRetries?: number;
316
461
  }
317
462
  declare const DEFAULT_API_ENDPOINT = "https://dxptnwrhwsqckaftyymj.supabase.co/functions/v1/api";
463
+ declare const MUSHI_INTERNAL_HEADER = "X-Mushi-Internal";
464
+ declare const MUSHI_INTERNAL_INIT_MARKER = "__mushiInternal";
465
+ type MushiInternalRequestKind = 'sdk-config' | 'report-submit' | 'report-status' | 'reporter-poll' | 'diagnose';
318
466
  declare function createApiClient(options: ApiClientOptions): MushiApiClient;
319
467
 
320
468
  /**
@@ -506,4 +654,4 @@ declare function createLogger(options: LoggerOptions): Logger;
506
654
  */
507
655
  declare const noopLogger: Logger;
508
656
 
509
- export { type ApiClientOptions, DEFAULT_API_ENDPOINT, type LogEntry, type LogFormat, type LogLevel, type Logger, type LoggerOptions, type MushiApiClient, type MushiApiResponse, type MushiCaptureConfig, type MushiCaptureEventInput, type MushiConfig, type MushiConsoleEntry, type MushiCooldownConfig, type MushiEnvironment, type MushiEventHandler, type MushiEventType, type MushiIntegrationsConfig, type MushiNetworkEntry, type MushiOfflineConfig, type MushiOnDeviceClassifier, type MushiOnDeviceClassifierInput, type MushiOnDeviceClassifierResult, type MushiPerformanceMetrics, type MushiPreFilterConfig, type MushiProactiveConfig, type MushiRegion, type MushiReport, type MushiReportBuilder, type MushiReportCategory, type MushiReportStatus, type MushiRewardsConfig, type MushiRuntimeSdkConfig, type MushiSDKInstance, type MushiSelectedElement, type MushiSentryConfig, type MushiWidgetConfig, type OfflineQueue, type PiiScrubberConfig, type PreFilterResult, REGION_ENDPOINTS, type RateLimiter, type RateLimiterConfig, captureEnvironment, createApiClient, createLogger, createOfflineQueue, createPiiScrubber, createPreFilter, createRateLimiter, getDeviceFingerprintHash, getReporterToken, getSessionId, noopLogger, resolveRegionEndpoint, scrubPii };
657
+ export { type ApiClientOptions, DEFAULT_API_ENDPOINT, type LogEntry, type LogFormat, type LogLevel, type Logger, type LoggerOptions, MUSHI_INTERNAL_HEADER, MUSHI_INTERNAL_INIT_MARKER, type MushiApiCascadeConfig, type MushiApiClient, type MushiApiResponse, type MushiCaptureConfig, type MushiCaptureEventInput, type MushiConfig, type MushiConsoleEntry, type MushiCooldownConfig, type MushiDiagnosticsResult, type MushiEnvironment, type MushiEventHandler, type MushiEventType, type MushiIntegrationsConfig, type MushiInternalRequestKind, type MushiNetworkEntry, type MushiOfflineConfig, type MushiOnDeviceClassifier, type MushiOnDeviceClassifierInput, type MushiOnDeviceClassifierResult, type MushiPerformanceMetrics, type MushiPreFilterConfig, type MushiPreset, type MushiPrivacyConfig, type MushiProactiveConfig, type MushiRegion, type MushiReport, type MushiReportBuilder, type MushiReportCategory, type MushiReportStatus, type MushiReporterComment, type MushiReporterReport, type MushiRewardsConfig, type MushiRuntimeSdkConfig, type MushiSDKInstance, type MushiSdkVersionInfo, type MushiSelectedElement, type MushiSentryConfig, type MushiTimelineEntry, type MushiTimelineKind, type MushiUrlMatcher, type MushiWidgetAnchor, type MushiWidgetConfig, type OfflineQueue, type PiiScrubberConfig, type PreFilterResult, REGION_ENDPOINTS, type RateLimiter, type RateLimiterConfig, captureEnvironment, createApiClient, createLogger, createOfflineQueue, createPiiScrubber, createPreFilter, createRateLimiter, getDeviceFingerprintHash, getReporterToken, getSessionId, noopLogger, resolveRegionEndpoint, scrubPii };