yaver-feedback-react-native 0.9.0 → 0.9.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 (65) hide show
  1. package/app.plugin.js +126 -9
  2. package/dist/BlackBox.js +9 -1
  3. package/dist/DeployPanel.js +65 -0
  4. package/dist/Discovery.js +13 -2
  5. package/dist/FeedbackModal.js +160 -6
  6. package/dist/P2PClient.d.ts +64 -1
  7. package/dist/P2PClient.js +222 -2
  8. package/dist/ShakeDetector.js +2 -0
  9. package/dist/YaverFeedback.d.ts +98 -0
  10. package/dist/YaverFeedback.js +509 -46
  11. package/dist/__tests__/BlackBox.relayPassword.test.d.ts +1 -0
  12. package/dist/__tests__/BlackBox.relayPassword.test.js +105 -0
  13. package/dist/__tests__/BlackBoxAutoStart.test.d.ts +1 -0
  14. package/dist/__tests__/BlackBoxAutoStart.test.js +91 -0
  15. package/dist/__tests__/BlackBoxAutoStartColdStart.test.d.ts +1 -0
  16. package/dist/__tests__/BlackBoxAutoStartColdStart.test.js +156 -0
  17. package/dist/__tests__/BrowserLaneIcon.test.d.ts +3 -0
  18. package/dist/__tests__/BrowserLaneIcon.test.js +80 -0
  19. package/dist/__tests__/P2PClient.test.js +2 -2
  20. package/dist/__tests__/ReportIdentity.test.d.ts +1 -0
  21. package/dist/__tests__/ReportIdentity.test.js +168 -0
  22. package/dist/__tests__/SDKToken.test.js +1 -1
  23. package/dist/__tests__/ShakeToggle.test.d.ts +1 -0
  24. package/dist/__tests__/ShakeToggle.test.js +121 -0
  25. package/dist/__tests__/pickTargetDevice.test.d.ts +1 -0
  26. package/dist/__tests__/pickTargetDevice.test.js +89 -0
  27. package/dist/__tests__/reloadActions.test.d.ts +1 -0
  28. package/dist/__tests__/reloadActions.test.js +129 -0
  29. package/dist/__tests__/reloadActionsParity.test.d.ts +1 -0
  30. package/dist/__tests__/reloadActionsParity.test.js +42 -0
  31. package/dist/__tests__/types.test.js +5 -5
  32. package/dist/_core/device.d.ts +19 -9
  33. package/dist/_core/device.js +20 -14
  34. package/dist/index.d.ts +4 -0
  35. package/dist/index.js +11 -1
  36. package/dist/reloadActions.d.ts +88 -0
  37. package/dist/reloadActions.js +200 -0
  38. package/dist/storeShots.d.ts +67 -0
  39. package/dist/storeShots.js +137 -0
  40. package/dist/types.d.ts +158 -1
  41. package/package.json +2 -2
  42. package/src/BlackBox.ts +10 -1
  43. package/src/DeployPanel.tsx +74 -0
  44. package/src/Discovery.ts +13 -2
  45. package/src/FeedbackModal.tsx +176 -14
  46. package/src/P2PClient.ts +235 -2
  47. package/src/ShakeDetector.ts +1 -0
  48. package/src/YaverFeedback.ts +498 -46
  49. package/src/__tests__/BlackBox.relayPassword.test.ts +129 -0
  50. package/src/__tests__/BlackBoxAutoStart.test.ts +111 -0
  51. package/src/__tests__/BlackBoxAutoStartColdStart.test.ts +191 -0
  52. package/src/__tests__/BrowserLaneIcon.test.ts +85 -0
  53. package/src/__tests__/P2PClient.test.ts +2 -2
  54. package/src/__tests__/ReportIdentity.test.ts +203 -0
  55. package/src/__tests__/SDKToken.test.ts +1 -1
  56. package/src/__tests__/ShakeToggle.test.ts +153 -0
  57. package/src/__tests__/pickTargetDevice.test.ts +101 -0
  58. package/src/__tests__/reloadActions.test.ts +171 -0
  59. package/src/__tests__/reloadActionsParity.test.ts +49 -0
  60. package/src/__tests__/types.test.ts +5 -5
  61. package/src/_core/device.ts +20 -14
  62. package/src/index.ts +21 -0
  63. package/src/reloadActions.ts +273 -0
  64. package/src/storeShots.ts +189 -0
  65. package/src/types.ts +164 -1
package/src/types.ts CHANGED
@@ -1,3 +1,7 @@
1
+ // Type-only: BlackBox.ts already imports from this module, so a value import
2
+ // would close a cycle. `import type` is erased at compile time.
3
+ import type { BlackBoxConfig } from './BlackBox';
4
+
1
5
  /**
2
6
  * Remote browser-style sign-in session for a coding-agent CLI on the
3
7
  * connected yaver host. Mirrors runnerBrowserAuthSession on the agent
@@ -122,9 +126,33 @@ export interface CapabilitySnapshot {
122
126
  targets: Record<string, CapabilityTargetReadiness>;
123
127
  }
124
128
 
129
+ /**
130
+ * Opt-in config for the overlay's "App Store screenshots" action and the
131
+ * `capture_store_shots` remote command. When set, the SDK can walk the
132
+ * app's routes on-device, screenshot each, and upload them to the agent
133
+ * (which runs the App Store Connect backend).
134
+ */
135
+ export interface StoreShotsConfig {
136
+ /** Ordered routes to visit + screenshot (e.g. ['/(tabs)/home', ...]). */
137
+ routes: string[];
138
+ /** Navigation handle: a react-navigation ref or expo-router `router`. */
139
+ navigationRef?: any;
140
+ /** Also set metadata + attempt submit-for-review after upload. */
141
+ submit?: boolean;
142
+ /** Optional per-route screenshot names (defaults to NN_<route>). */
143
+ screens?: string[];
144
+ }
145
+
125
146
  export interface FeedbackConfig {
126
147
  /** URL of the Yaver agent (e.g. "http://192.168.1.10:18080"). If omitted, auto-discovery is used. */
127
148
  agentUrl?: string;
149
+ /**
150
+ * Enables the overlay's "App Store screenshots" action + the
151
+ * `capture_store_shots` remote command. The host supplies the route
152
+ * list (and a navigation ref) once; the SDK captures the real running
153
+ * app — no simulator needed.
154
+ */
155
+ storeShots?: StoreShotsConfig;
128
156
  /**
129
157
  * Auth token for the Yaver agent. Optional in 0.5+: if omitted, the SDK
130
158
  * will hydrate one from AsyncStorage or show its in-app login screen
@@ -164,6 +192,39 @@ export interface FeedbackConfig {
164
192
  * If omitted with convexUrl, connects to the first online device.
165
193
  */
166
194
  preferredDeviceId?: string;
195
+ /**
196
+ * Identity of the app this SDK instance reports for. Both fields are
197
+ * resolved automatically from expo-constants / native modules when
198
+ * omitted, so most apps never set them.
199
+ *
200
+ * Set them when the ambient answer would be wrong — above all when the
201
+ * app's JS is pushed into Yaver's container as a Hermes guest. There the
202
+ * runtime IS Yaver: `expo-constants` and `SettingsManager` describe the
203
+ * host (`Yaver` / `io.yaver.mobile`), not the guest, so auto-resolution
204
+ * would file every report against Yaver's own repo and the fix task would
205
+ * edit the SDK instead of the app. Declaring identity here is the only
206
+ * answer that holds in both a standalone build and a guest bundle.
207
+ *
208
+ * `bundleId` is the key that actually routes: the agent matches it against
209
+ * each project's pbxproj / build.gradle / app.json. `projectName` is a
210
+ * fallback for platforms with no bundle id.
211
+ */
212
+ projectName?: string;
213
+ bundleId?: string;
214
+ /** Primary Yaver product surface for this app/package. */
215
+ surface?: YaverSurface;
216
+ /** All product surfaces this app/package owns. */
217
+ surfaces?: YaverSurface[];
218
+ /** Canonical development stack labels, e.g. react-native-expo, yaver-xml. */
219
+ stack?: string;
220
+ stacks?: string[];
221
+ /** Yaver preview/runtime targets that can exercise this app. */
222
+ testSurfaces?: string[];
223
+ feedbackSdk?: string;
224
+ feedbackTransport?: string;
225
+ voiceCapabilities?: string[];
226
+ sttProvider?: string;
227
+ ttsProvider?: string;
167
228
  /** How feedback collection is triggered */
168
229
  trigger?: 'shake' | 'floating-button' | 'manual';
169
230
  /**
@@ -204,6 +265,22 @@ export interface FeedbackConfig {
204
265
  * Calling `BlackBox.start()` manually is still safe — it's idempotent.
205
266
  */
206
267
  autoStartBlackBox?: boolean;
268
+ /**
269
+ * Config handed to BlackBox when the SDK auto-starts it.
270
+ *
271
+ * Without this there was no way to configure the flight recorder at all.
272
+ * The obvious move — and the one the README's own snippet makes — is:
273
+ *
274
+ * YaverFeedback.init({ trigger: 'shake' });
275
+ * BlackBox.start({ appName: 'my-app' });
276
+ *
277
+ * but that start() early-returns, because a zero-config init has no
278
+ * agentUrl yet (discovery resolves it asynchronously). The auto-start then
279
+ * fires ~500ms later once the agent and token exist and calls `start()`
280
+ * with NO arguments — so the host's config is silently dropped and appName
281
+ * is ''. Pass it here instead and the auto-start will honour it.
282
+ */
283
+ blackBox?: BlackBoxConfig;
207
284
  /**
208
285
  * Small tap-to-open icon that floats above the app so the user
209
286
  * doesn't have to shake every time they want to open feedback.
@@ -289,6 +366,26 @@ export interface FeedbackConfig {
289
366
  * Bugsnag, or any other error tracking tool.
290
367
  */
291
368
  maxCapturedErrors?: number;
369
+ /**
370
+ * Crash-aware reporting/fixing. Defaults to disabled.
371
+ *
372
+ * - enabled: records fatal errors into the SDK error buffer and enables
373
+ * explicit `YaverFeedback.reportCrash(error)`.
374
+ * - installGlobalHandler: opt-in only. Wraps React Native's global ErrorUtils
375
+ * handler without suppressing the existing handler. Leave false when Sentry,
376
+ * Crashlytics, Bugsnag, or another crash tool owns the global handler.
377
+ * - autoFix: after uploading a crash report, ask the connected Yaver agent to
378
+ * create a fix task. The normal BlackBox command stream can then deliver a
379
+ * reload/reload_bundle command after the agent rebuilds.
380
+ * - captureScreenshot: attach a best-effort screenshot to the crash report.
381
+ */
382
+ crashReporting?: {
383
+ enabled?: boolean;
384
+ installGlobalHandler?: boolean;
385
+ autoFix?: boolean;
386
+ captureScreenshot?: boolean;
387
+ metadata?: Record<string, unknown>;
388
+ };
292
389
  /**
293
390
  * Which platforms the Build button targets.
294
391
  * - 'ios' — build iOS only
@@ -404,9 +501,36 @@ export interface CapturedError {
404
501
 
405
502
  export interface FeedbackMetadata {
406
503
  timestamp: string;
407
- device: DeviceInfo;
504
+ /**
505
+ * Wire key is `deviceInfo`, matching the Flutter + web SDKs and the
506
+ * agent's `FeedbackReport.DeviceInfo` (`json:"deviceInfo"`). This was
507
+ * `device` until 0.9.2 — a key the agent never read, so the whole block
508
+ * (platform, model, and the app name the fix router needs) was silently
509
+ * dropped on every React Native report. The agent still accepts the old
510
+ * key so builds already in the field keep working.
511
+ */
512
+ deviceInfo: DeviceInfo;
408
513
  app: AppInfo;
514
+ /**
515
+ * Which of the host's projects this report is about. The agent resolves
516
+ * a feedback→fix task's working directory from this; without it the task
517
+ * falls back to whatever directory the agent happens to be sitting in.
518
+ * Populated automatically by `resolveReportIdentity()`.
519
+ */
520
+ project?: FeedbackProjectRef;
409
521
  userNote?: string;
522
+ reportKind?: 'feedback' | 'auto-report' | 'crash';
523
+ crash?: {
524
+ message: string;
525
+ isFatal: boolean;
526
+ source: 'manual' | 'global-handler';
527
+ autoFixRequested?: boolean;
528
+ };
529
+ twin?: {
530
+ sessionId?: string;
531
+ surface?: string;
532
+ artifactDir?: string;
533
+ };
410
534
  }
411
535
 
412
536
  export interface DeviceInfo {
@@ -415,6 +539,8 @@ export interface DeviceInfo {
415
539
  model: string;
416
540
  screenWidth: number;
417
541
  screenHeight: number;
542
+ /** Host app name. First key the agent's fix router checks. */
543
+ appName?: string;
418
544
  }
419
545
 
420
546
  export interface AppInfo {
@@ -423,6 +549,43 @@ export interface AppInfo {
423
549
  buildNumber?: string;
424
550
  }
425
551
 
552
+ /**
553
+ * Identifies the host project a report belongs to. Mirrors the web SDK's
554
+ * `FeedbackProjectRef` and the agent's `FeedbackProject`.
555
+ */
556
+ export interface FeedbackProjectRef {
557
+ appName?: string;
558
+ projectName?: string;
559
+ /**
560
+ * Bundle identifier / applicationId. The only unambiguous key: an app's
561
+ * display name ("Talos") does not match the agent's registry name for it
562
+ * ("talos / mobile"), and one repo can hold several mobile projects that
563
+ * all share a name prefix. The agent matches this against the project's
564
+ * pbxproj, build.gradle, and app.json.
565
+ */
566
+ bundleId?: string;
567
+ /**
568
+ * Deliberately never set by this SDK. The agent ignores client-supplied
569
+ * paths for feedback reports (an untrusted guest could otherwise point the
570
+ * fix task's CWD at ~/.ssh) and resolves the path server-side. Present only
571
+ * so the type matches the wire format the agent parses.
572
+ */
573
+ projectPath?: string;
574
+ surface?: YaverSurface;
575
+ surfaces?: YaverSurface[];
576
+ stack?: string;
577
+ stacks?: string[];
578
+ testSurfaces?: string[];
579
+ feedbackSdk?: string;
580
+ feedbackTransport?: string;
581
+ voiceCapabilities?: string[];
582
+ sttProvider?: string;
583
+ ttsProvider?: string;
584
+ releaseChannel?: 'production' | 'candidate' | 'development';
585
+ }
586
+
587
+ export type YaverSurface = 'web' | 'mobile' | 'backend' | 'watch' | 'tv' | 'car' | 'vision' | 'desktop' | 'cli';
588
+
426
589
  export interface TimelineEvent {
427
590
  type: 'screenshot' | 'audio' | 'video';
428
591
  path: string;