@farmslot/adapter-rn 0.15.0 → 0.17.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +48 -10
  3. package/bridge-runtime/bridge-core.cjs +1481 -0
  4. package/bridge-runtime/console-forwarder.cjs +485 -0
  5. package/bridge-runtime/lib/bridge-errors.cjs +108 -0
  6. package/bridge-runtime/lib/cdp-eval.cjs +118 -0
  7. package/bridge-runtime/lib/config.cjs +68 -0
  8. package/bridge-runtime/lib/console-format.cjs +54 -0
  9. package/bridge-runtime/lib/devtools-proxy.cjs +169 -0
  10. package/bridge-runtime/lib/issue-capture.cjs +86 -0
  11. package/bridge-runtime/lib/match-bridge-target.cjs +89 -0
  12. package/bridge-runtime/lib/target-discovery.cjs +436 -0
  13. package/bridge-runtime/lib/ws-client.cjs +119 -0
  14. package/dist/cli.js +1 -1
  15. package/dist/cli.js.map +1 -1
  16. package/dist/devices.d.ts +16 -0
  17. package/dist/devices.d.ts.map +1 -0
  18. package/dist/devices.js +131 -0
  19. package/dist/devices.js.map +1 -0
  20. package/dist/doctor.js +1 -1
  21. package/dist/doctor.js.map +1 -1
  22. package/dist/fingerprint-baseline.d.ts +8 -0
  23. package/dist/fingerprint-baseline.d.ts.map +1 -0
  24. package/dist/fingerprint-baseline.js +68 -0
  25. package/dist/fingerprint-baseline.js.map +1 -0
  26. package/dist/frame-metrics.d.ts +26 -0
  27. package/dist/frame-metrics.d.ts.map +1 -0
  28. package/dist/frame-metrics.js +134 -0
  29. package/dist/frame-metrics.js.map +1 -0
  30. package/dist/index.d.ts +7 -0
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +6 -0
  33. package/dist/index.js.map +1 -1
  34. package/dist/metro-env.d.ts +11 -0
  35. package/dist/metro-env.d.ts.map +1 -0
  36. package/dist/metro-env.js +29 -0
  37. package/dist/metro-env.js.map +1 -0
  38. package/dist/source-freshness.d.ts +11 -0
  39. package/dist/source-freshness.d.ts.map +1 -0
  40. package/dist/source-freshness.js +98 -0
  41. package/dist/source-freshness.js.map +1 -0
  42. package/dist/tool-paths.d.ts +13 -0
  43. package/dist/tool-paths.d.ts.map +1 -0
  44. package/dist/tool-paths.js +125 -0
  45. package/dist/tool-paths.js.map +1 -0
  46. package/dist/video-recorder.d.ts +7 -0
  47. package/dist/video-recorder.d.ts.map +1 -0
  48. package/dist/video-recorder.js +250 -0
  49. package/dist/video-recorder.js.map +1 -0
  50. package/metro/coalesce-metro-log.cjs +28 -0
  51. package/metro/launch-metro.cjs +84 -0
  52. package/metro/metro-config.cjs +92 -0
  53. package/metro/metro-log-generation.cjs +116 -0
  54. package/package.json +27 -7
package/CHANGELOG.md CHANGED
@@ -6,6 +6,20 @@ All notable changes to `@farmslot/adapter-rn` (published as `@farmslot/expo-reci
6
6
 
7
7
  - Active-development baseline; add user-facing changes here before release or package publication.
8
8
 
9
+ ## 0.17.0 - 2026-10-05
10
+
11
+ - Add `bridge-runtime/bridge-core.cjs`, the generic Hermes CDP bridge CLI moved from mm-harness. `runBridgeCli(config)` runs the built-in commands (navigation, eval, UI gestures and input, scrolling and scroll-transition timing, Sentry debug, HUD steps, profiler, in-app issues, network capture), target selection over the CDP broker or a direct connection, the debugger-slot lock and typed errors. The host supplies its own commands, route table, recovery hints, help lines, perf markers and readiness check; a host command that reuses a built-in name throws at startup. The iOS and Android key and tap fallbacks read `RECIPE_RN_IDB_PATH` / `RECIPE_RN_ADB_PATH`.
12
+ - Publish with protocol 0.34.0 and recipe-runner 0.24.0.
13
+
14
+ ## 0.16.0 - 2026-10-05
15
+
16
+ - Add the generic React Native runtime, moved from mm-harness:
17
+ - **Bridge runtime:** the Hermes CDP libraries in `bridge-runtime/lib/*.cjs` (target discovery, ws client, devtools proxy, eval, error codes, port config, console format, in-app issue buffer snippets) and `bridge-runtime/console-forwarder.cjs`.
18
+ - **Metro:** the config wrapper, detached launcher and log helpers in `metro/*.cjs`.
19
+ - **From the index:** adb/idb discovery (`resolveMobileToolPath`, overridable with `RECIPE_RN_ADB_PATH`/`RECIPE_RN_IDB_PATH`), `listConnectedDevices`, the Android and iOS-simulator video recorders, `summarizeFrames`, and Metro-env and source fingerprints with recorded baselines. The project supplies the input lists and marker paths. Hosts set `RECIPE_RN_EXPLICIT_PLATFORM` and `RECIPE_RN_METRO_*` for the bridge and the Metro wrapper.
20
+ - `--help` and `doctor` now print "Farmslot React Native adapter" (they still said "Farmslot Expo Recipe").
21
+ - Publish with protocol 0.34.0 and recipe-runner 0.24.0.
22
+
9
23
  ## 0.15.0 - 2026-10-05
10
24
 
11
25
  - **Breaking:** renamed from `@farmslot/expo-recipe`, with no alias package. The bin is now `farmslot-adapter-rn` (was `farmslot-expo-recipe`), and `init` writes `recipe:*` scripts that call it. Run provenance and the bundled recipe source report `@farmslot/adapter-rn`. `runExpoRecipeCli` and `EXPO_RECIPE_PACKAGE_VERSIONS` are now `runAdapterRnCli` and `ADAPTER_RN_PACKAGE_VERSIONS`. Expo-specific APIs (`installExpoRecipeScaffold`, `runExpoRecipeDoctor`, `runExpoRecipeDocument`, …) keep their names.
package/README.md CHANGED
@@ -6,15 +6,21 @@ Public docs: <https://farmslot.io/docs/guides/adapter-rn>
6
6
 
7
7
  ## Source layout
8
8
 
9
- | Path | Owns |
10
- | ------------------ | ------------------------------------------------------------- |
11
- | `bin/` | Published `farmslot-adapter-rn` executable shim. |
12
- | `src/cli.ts` | Init command parsing and CLI entrypoint. |
13
- | `src/scaffold.ts` | File-copy and package-script scaffolding. |
14
- | `src/doctor.ts` | Project integration checks. |
15
- | `src/runner.ts` | Expo smoke runner wiring built on `@farmslot/recipe-runner`. |
16
- | `src/redaction.ts` | Output redaction helpers for generated artifacts. |
17
- | `templates/` | Versionless project scaffold copied into consuming Expo apps. |
9
+ | Path | Owns |
10
+ | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
11
+ | `bin/` | Published `farmslot-adapter-rn` executable shim. |
12
+ | `src/cli.ts` | Init command parsing and CLI entrypoint. |
13
+ | `src/scaffold.ts` | File-copy and package-script scaffolding. |
14
+ | `src/doctor.ts` | Project integration checks. |
15
+ | `src/runner.ts` | Expo smoke runner wiring built on `@farmslot/recipe-runner`. |
16
+ | `src/redaction.ts` | Output redaction helpers for generated artifacts. |
17
+ | `templates/` | Versionless project scaffold copied into consuming Expo apps. |
18
+ | `bridge-runtime/` | Hermes CDP bridge libraries (`lib/*.cjs`) and the console forwarder. |
19
+ | `bridge-runtime/bridge-core.cjs` | Generic bridge CLI (`runBridgeCli`); a host preset adds its commands, routes and recovery hints. |
20
+ | `metro/` | Metro config wrapper, detached launcher and log generation/coalescing helpers. |
21
+ | `src/tool-paths.ts`, `src/devices.ts` | adb/idb discovery (`RECIPE_RN_ADB_PATH`/`RECIPE_RN_IDB_PATH`) and connected-device listing. |
22
+ | `src/video-recorder.ts`, `src/frame-metrics.ts` | Device video recorders and frame-timing summaries. |
23
+ | `src/metro-env.ts`, `src/source-freshness.ts`, `src/fingerprint-baseline.ts` | Bundle-input fingerprints with recorded baselines; the project supplies the inputs. |
18
24
 
19
25
  ## Relationship to the harness
20
26
 
@@ -22,7 +28,39 @@ Public docs: <https://farmslot.io/docs/guides/adapter-rn>
22
28
 
23
29
  - `@farmslot/protocol` owns Recipe Protocol v1 schemas, action names, and validation.
24
30
  - `@farmslot/recipe-runner` owns the generic runner, official core actions, UI actions, and CDP/React Native transports.
25
- - `@farmslot/adapter-rn` only adds Expo-friendly scaffolding: package scripts, a default recipe, optional dev-only React Native bridge/HUD files, and integration checks.
31
+ - `@farmslot/adapter-rn` adds Expo-friendly scaffolding (package scripts, a default recipe, optional dev-only React Native bridge/HUD files, integration checks) and the generic React Native runtime a harness drives: the Hermes bridge libraries, Metro helpers, device tools, recorders and freshness fingerprints. Product commands, routes and env names stay in the host harness.
32
+
33
+ ### Bridge CLI preset
34
+
35
+ A host's bridge script is a preset over `runBridgeCli`:
36
+
37
+ ```js
38
+ // my-app/bridge-runtime/cdp-bridge.cjs
39
+ const { runBridgeCli } = require('@farmslot/adapter-rn/bridge-runtime/bridge-core.cjs');
40
+ const { cdpEval } = require('@farmslot/adapter-rn/bridge-runtime/lib/cdp-eval.cjs');
41
+
42
+ runBridgeCli({
43
+ appLabel: 'My App',
44
+ routes: { aliases: { Home: 'HomeView' }, nestedParents: { SettingsDetail: 'Settings' } },
45
+ teachingByErrorCode: { NO_TARGET: 'Next: open the app on the device.' },
46
+ commands: {
47
+ // `status` also gets the core's `status-selected` (the pinned target only).
48
+ // Handlers get (client, args, { deviceName, platform, runtimeIdentity }).
49
+ async status(client, _args, { deviceName } = {}) {
50
+ return { route: await cdpEval(client, 'globalThis.__AGENTIC__?.getRoute?.()'), deviceName };
51
+ },
52
+ },
53
+ commandDocs: { status: { help: ' status App status' } },
54
+ // measure-scroll-transition: console lines starting with a prefix carry a JSON event.
55
+ perfMarkerPrefixes: ['[MyAppPerf] '],
56
+ // Evaluated only when a measure-scroll-transition request sets requireWalletReady: true;
57
+ // it must return { ready, observedAtMs }, and the measurement refuses unless ready is true.
58
+ readyExpression:
59
+ '({ ready: Boolean(globalThis.__AGENTIC__?.getRoute?.()), observedAtMs: performance.now() })',
60
+ });
61
+ ```
62
+
63
+ The built-in commands use the app's dev-only `globalThis.__AGENTIC__` bridge where present (`platform`, `getRoute`, `getState`, `navigate`, `canGoBack`, `goBack`, `pressTestId`, `pressText`, `queryUiTarget`, `setInput`, `scrollView`, `scrollIntoView`, and `showStep`/`hideStep` for the HUD). A host command that reuses a built-in name, or `status-selected`, throws at startup.
26
64
 
27
65
  Do not add project-specific actions such as wallet, perps, or meetings to this package. Those belong in the app or a project-specific runner/manifest that extends the official harness actions. Generic whole-run video proof stays in the shared harness capability surface.
28
66