@solidnative-dev/devtools 0.0.0-stage → 0.1.0-alpha.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 (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +266 -2
  3. package/dist/causal-solid.d.ts +30 -0
  4. package/dist/causal-solid.d.ts.map +1 -0
  5. package/dist/causal-solid.js +1108 -0
  6. package/dist/causal-solid.js.map +1 -0
  7. package/dist/index.d.ts +46 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +220 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/network-service-development.d.ts +6 -0
  12. package/dist/network-service-development.d.ts.map +1 -0
  13. package/dist/network-service-development.js +12 -0
  14. package/dist/network-service-development.js.map +1 -0
  15. package/dist/network-service.d.ts +13 -0
  16. package/dist/network-service.d.ts.map +1 -0
  17. package/dist/network-service.js +37 -0
  18. package/dist/network-service.js.map +1 -0
  19. package/dist/network.d.ts +57 -0
  20. package/dist/network.d.ts.map +1 -0
  21. package/dist/network.js +353 -0
  22. package/dist/network.js.map +1 -0
  23. package/dist/react-native.d.ts +27 -0
  24. package/dist/react-native.d.ts.map +1 -0
  25. package/dist/react-native.js +111 -0
  26. package/dist/react-native.js.map +1 -0
  27. package/dist/root-development.d.ts +5 -0
  28. package/dist/root-development.d.ts.map +1 -0
  29. package/dist/root-development.js +86 -0
  30. package/dist/root-development.js.map +1 -0
  31. package/dist/root.d.ts +48 -0
  32. package/dist/root.d.ts.map +1 -0
  33. package/dist/root.js +8 -0
  34. package/dist/root.js.map +1 -0
  35. package/dist/solid-diagnostics-development.d.ts +30 -0
  36. package/dist/solid-diagnostics-development.d.ts.map +1 -0
  37. package/dist/solid-diagnostics-development.js +166 -0
  38. package/dist/solid-diagnostics-development.js.map +1 -0
  39. package/dist/solid-diagnostics.d.ts +15 -0
  40. package/dist/solid-diagnostics.d.ts.map +1 -0
  41. package/dist/solid-diagnostics.js +20 -0
  42. package/dist/solid-diagnostics.js.map +1 -0
  43. package/dist/solid.d.ts +32 -0
  44. package/dist/solid.d.ts.map +1 -0
  45. package/dist/solid.js +563 -0
  46. package/dist/solid.js.map +1 -0
  47. package/dist/tree-solid.d.ts +106 -0
  48. package/dist/tree-solid.d.ts.map +1 -0
  49. package/dist/tree-solid.js +1117 -0
  50. package/dist/tree-solid.js.map +1 -0
  51. package/package.json +66 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Solid Native contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,267 @@
1
- # Temporary Holding Version
1
+ # `@solidnative-dev/devtools`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ This package provides Solid Native's local, development-only error channel and
4
+ native recovery overlay. It imports no React component and performs no network
5
+ or file I/O.
6
+
7
+ ```tsx
8
+ import {
9
+ createDevelopmentErrorController,
10
+ createDevelopmentErrorHandler,
11
+ } from "@solidnative-dev/devtools";
12
+ import { installReactNativeDevelopmentErrorBridge } from "@solidnative-dev/devtools/react-native";
13
+ import { DevelopmentErrorOverlay } from "@solidnative-dev/devtools/solid";
14
+
15
+ const errors = createDevelopmentErrorController();
16
+ const reportNativeError = createDevelopmentErrorHandler(errors, "native");
17
+ const runtimeErrors = installReactNativeDevelopmentErrorBridge(errors);
18
+
19
+ startNativeApplication(
20
+ () => (
21
+ <DevelopmentErrorOverlay controller={errors}>
22
+ <App onNativeError={reportNativeError} />
23
+ </DevelopmentErrorOverlay>
24
+ ),
25
+ options,
26
+ );
27
+
28
+ // During development-client teardown:
29
+ runtimeErrors.remove();
30
+ ```
31
+
32
+ `DevelopmentErrorOverlay` catches errors from its Solid subtree and renders a
33
+ native `View`/`Text`/`ScrollView`/`Pressable` recovery surface. `Retry` resets
34
+ Solid's `Errored` boundary. Errors explicitly sent to the controller replace
35
+ the subtree until dismissed, so promise rejections and adapter `onError` paths
36
+ can share the same experience without a process-global hook.
37
+
38
+ The optional `react-native` entry point installs one narrow global bridge over
39
+ React Native's existing `ErrorUtils` guard. Non-fatal guarded runtime errors are
40
+ owned by the Solid overlay by default; fatal errors are always forwarded to the
41
+ previous platform handler. Removal is idempotent and restores the predecessor
42
+ only while the bridge still owns the global slot. Set `forwardNonFatal: true`
43
+ when the React Native handler should also receive recoverable errors.
44
+
45
+ A synchronous `onDismiss` observer may repair a tracked source before retry.
46
+ The overlay waits through that native event flush and calls Solid's explicit
47
+ reset only if the fallback remains mounted, preventing two recovery paths from
48
+ reusing a reclaimed native node.
49
+
50
+ The controller retains at most 20 distinct reports by default and at most 50
51
+ when configured. Consecutive equivalent reports are coalesced, messages and
52
+ stacks are bounded, snapshots are immutable, hostile getters are isolated, and
53
+ subscriber failures cannot replace the application error. The channel is
54
+ process-local and does not upload diagnostics.
55
+
56
+ This overlay is not a platform fatal-error screen. Generated shells use Fabric
57
+ Host's dependency-free native fallback when the host, JSI binding, or initial
58
+ surface cannot start. They also install the runtime's preceding fatal handler,
59
+ so this package's deliberate forwarding hands fatal Hermes errors to the
60
+ native shell; terminal Fabric commit failures enter the same boundary directly.
61
+ The shell stops the live Fabric surface and shows generic Release UI instead of
62
+ trying to recover a potentially corrupted tree. React Native 0.88's
63
+ unhandled-rejection tracker has no reversible global registration surface, so
64
+ promise paths still use an explicit handler. Source-map symbolication is also
65
+ separate; the overlay deliberately shows only the bounded stack it receives.
66
+
67
+ The resident causal inspector, explicit-report dismiss path, guarded Hermes
68
+ runtime path, and Solid render-error retry path all pass on a tethered physical
69
+ Android device. The proof opens the inspector, switches to causal groups,
70
+ filters by an exact opaque operation ID, selects the matching group and commit,
71
+ walks to its retained cause, traverses both back levels, clears and closes the
72
+ trace, and then exercises all three recovery paths. It also verifies the
73
+ accessibility tree, single recovered subtree, wrapper-free Metro source
74
+ boundary, global-handler restoration, Activity survival, process teardown, and
75
+ package removal.
76
+
77
+ Error messages and stacks can contain credentials or user data. Keep this
78
+ package in development entry points and do not treat its retained history as a
79
+ privacy-safe telemetry payload.
80
+
81
+ Generated applications can instead use the build-aware root:
82
+
83
+ ```tsx
84
+ import { DevelopmentRoot } from "@solidnative-dev/devtools/root";
85
+
86
+ startNativeApplication(
87
+ () => (
88
+ <DevelopmentRoot>
89
+ <App />
90
+ </DevelopmentRoot>
91
+ ),
92
+ options,
93
+ );
94
+ ```
95
+
96
+ `createSolidNativeMetroResolver` maps that entry point to the full overlay and
97
+ runtime bridge only when Metro's `dev` flag is true. Production resolution is a
98
+ pass-through component whose JavaScript imports none of the controller,
99
+ overlay, core-component, or React Native bridge implementation.
100
+
101
+ The optional network inspector instruments Solid Native's explicit transport
102
+ instead of patching `fetch` or `XMLHttpRequest`:
103
+
104
+ ```ts
105
+ import { createDevelopmentNetworkInspector } from "@solidnative-dev/devtools/network";
106
+ import { createReactNativeNetworkService } from "@solidnative-dev/networking/react-native";
107
+
108
+ const requests = createDevelopmentNetworkInspector({
109
+ captureRequestTargets: true,
110
+ });
111
+ const network = requests.instrument(createReactNativeNetworkService());
112
+ ```
113
+
114
+ It retains a bounded local history of method, platform, status, timing, chunk
115
+ counts, byte progress, and low-cardinality failure class. Target capture is
116
+ off by default; when enabled it keeps only URL origin and path. Headers, bodies,
117
+ response text, query strings, fragments, error messages, and stacks are never
118
+ retained. When every history slot contains an active request, inspection drops
119
+ new records without blocking application traffic and exposes the count through
120
+ `droppedCount()`.
121
+
122
+ `DevelopmentNetworkPanel` from `@solidnative-dev/devtools/solid` adds an opt-in
123
+ on-device viewer over that history. Its compact badge shows retained and active
124
+ counts; opening it lists the newest bounded request metadata and clearing it
125
+ does not cancel application requests. The wrapped application subtree keeps its
126
+ native identity while the panel opens, updates, clears, and closes.
127
+ The application, badge, and overlay slots have stable Fabric ownership. Closing
128
+ discards the detached panel tree, and reopening creates fresh native nodes
129
+ instead of attempting to reinsert nodes Fabric has reclaimed. The physical
130
+ Android development proof opens and closes both network and causal panels twice
131
+ before exercising the rest of the overlay.
132
+
133
+ The build-aware root accepts the same inspector without changing its production
134
+ behavior:
135
+
136
+ ```tsx
137
+ <DevelopmentRoot networkInspector={requests}>
138
+ <App network={network} />
139
+ </DevelopmentRoot>
140
+ ```
141
+
142
+ Metro's production root ignores the development-only inspector prop and still
143
+ returns only its children; the compiled shim has no runtime imports.
144
+
145
+ The same development root can host a bounded causal timeline:
146
+
147
+ ```tsx
148
+ import {
149
+ createCausalTelemetry,
150
+ createCausalTimeline,
151
+ } from "@solidnative-dev/observability";
152
+ import { createDevelopmentSolidDiagnosticsController } from "@solidnative-dev/devtools/solid-diagnostics";
153
+
154
+ const causalTimeline = createCausalTimeline({ capacity: 2_000 });
155
+ const telemetry = createCausalTelemetry({ sink: causalTimeline.sink });
156
+ const solidDiagnostics = createDevelopmentSolidDiagnosticsController();
157
+
158
+ <DevelopmentRoot
159
+ causalTimeline={causalTimeline}
160
+ solidDiagnostics={solidDiagnostics}
161
+ >
162
+ <App />
163
+ </DevelopmentRoot>;
164
+ ```
165
+
166
+ `DevelopmentCausalPanel` from `@solidnative-dev/devtools/solid` adds a resident
167
+ native trace viewer. It lists a bounded newest-first operation snapshot and can
168
+ drill into the selected operation's retained transitive causes, effects, and
169
+ evicted cause count. Retained cause/effect rows are selectable, so the developer
170
+ can walk the causal graph in either direction without returning to the root
171
+ list. A bounded case-insensitive filter searches only operation names and IDs;
172
+ it never reads or renders application attributes. It exposes operation names,
173
+ IDs, status, duration, and graph shape, but no application attribute values.
174
+ Selectable rows include the opaque operation ID in their accessibility name,
175
+ which keeps repeated low-cardinality operation names individually addressable.
176
+ The explicit Groups mode summarizes weakly connected retained operations by
177
+ fixed operation-name sequence, activity/outcome counts, duration, and opaque
178
+ group ID. Selecting a group opens its bounded operation list before drilling
179
+ into the same cause/effect explorer. A group ID is the earliest retained
180
+ operation ID for local navigation, not a distributed trace ID, and shared
181
+ unresolved cause IDs keep related retained branches together without rendering
182
+ attribute values.
183
+
184
+ `@solidnative-dev/devtools/solid-diagnostics` is a separate one-shot capture
185
+ controller shared by desktop tooling and the on-device causal inspector. Metro
186
+ substitutes its Solid development implementation only in development bundles;
187
+ the exported production shim is inert. A session owns RC3 attribution
188
+ exclusively, drains scheduled work on end, retains at most 256 newest
189
+ diagnostics, and hands all raw records to the observability package's
190
+ privacy-bounded normalizer. The controller itself opens no socket and uploads
191
+ nothing.
192
+
193
+ When `solidDiagnostics` is present, open **Trace** and press **Capture Solid**.
194
+ The panel closes while the app is exercised and the badge changes to **Stop
195
+ Solid**. Stopping reopens the panel with named Solid rerun totals correlated to
196
+ same-window native-output → commit → mount → frame chains. This is a validated
197
+ static-name/window correlation, not an exact per-rerun join. It renders neither
198
+ reactive values nor diagnostic cause names, and an active panel-owned session
199
+ is disposed automatically if the root unmounts.
200
+
201
+ Pass `snapshotTree: () => root.snapshotTree()` (and optionally
202
+ `measureTreeNode: (handle) => root.measureNodeByHandle(handle)`) to
203
+ `DevelopmentCausalPanel` or `DevelopmentRoot` to add the on-device **Live UI
204
+ Tree Inspector** with visual screen-bounds highlighting inside the same
205
+ **Trace** overlay (or use `DevelopmentTreePanel` standalone when no causal
206
+ timeline is attached):
207
+
208
+ ```tsx
209
+ <DevelopmentRoot
210
+ causalTimeline={causalTimeline}
211
+ solidDiagnostics={solidDiagnostics}
212
+ snapshotTree={() =>
213
+ application?.root.disposed ? undefined : application?.root.snapshotTree()
214
+ }
215
+ measureTreeNode={(handle) =>
216
+ application?.root.disposed
217
+ ? undefined
218
+ : application?.root.measureNodeByHandle(handle)
219
+ }
220
+ >
221
+ <App />
222
+ </DevelopmentRoot>
223
+ ```
224
+
225
+ The UI tree inspector validates every snapshot through
226
+ `@solidnative-dev/observability`'s `parseTreeDebugSnapshot` and remains strictly
227
+ value-free: it renders component names, node handles, closed-enum accessibility
228
+ roles, prop/event key names, text character lengths (with content omitted), and
229
+ static `CausalOwner`/`CausalComputation` annotations, while never reading or
230
+ displaying rendered text, prop values, labels, or user input. Opening the
231
+ panel captures the snapshot before the overlay mounts so DevTools nodes do not
232
+ pollute the initial tree. From any selected UI node, developers can inspect
233
+ parent/child nodes, visually highlight its live Fabric screen bounds on the
234
+ running application (or a text node's parent element) without emitting causal
235
+ measure telemetry, and jump straight to retained causal operations linked by
236
+ `target.node`, `owner.name`, or `computation.name`—and jump back from a
237
+ selected causal operation to its `Linked UI nodes`.
238
+
239
+ Snapshots refresh only when the panel opens or the developer presses
240
+ `Refresh`. This is a correctness boundary: rendering the inspector creates
241
+ Fabric telemetry of its own, so a view subscribed live to that same timeline
242
+ would continuously cause itself. The application subtree keeps its native
243
+ identity while the panel opens, filters, navigates, clears, and closes. The
244
+ controlled native filter also retains its own identity across keystrokes so an
245
+ active keyboard/focus session is not interrupted. Metro's production root
246
+ ignores the timeline prop, and the generated Release entry does not allocate a
247
+ timeline.
248
+
249
+ For one source path in both build modes, use the second Metro-selected helper:
250
+
251
+ ```tsx
252
+ import { createInspectableNetworkService } from "@solidnative-dev/devtools/network-service";
253
+ import { createReactNativeNetworkService } from "@solidnative-dev/networking/react-native";
254
+
255
+ const network = createInspectableNetworkService(
256
+ createReactNativeNetworkService(),
257
+ { captureRequestTargets: true },
258
+ );
259
+
260
+ <DevelopmentRoot networkInspector={network.inspector}>
261
+ <App network={network.service} />
262
+ </DevelopmentRoot>;
263
+ ```
264
+
265
+ Development bundles resolve the helper to the recorder and panel-compatible
266
+ inspector. Production bundles validate the inputs, return the exact original
267
+ `NetworkService`, set `inspector` to `undefined`, and load none of the recorder.
@@ -0,0 +1,30 @@
1
+ import { type CausalTimeline } from "@solidnative-dev/observability";
2
+ import { type Element as SolidElement } from "solid-js";
3
+ import type { DevelopmentSolidDiagnosticsController } from "./solid-diagnostics.js";
4
+ import { type DevelopmentTreeMeasureProvider, type DevelopmentTreeSnapshotProvider } from "./tree-solid.js";
5
+ export declare const DEVELOPMENT_CAUSAL_PANEL_DEFAULT_VISIBLE_OPERATIONS = 40;
6
+ export declare const DEVELOPMENT_CAUSAL_PANEL_MAX_VISIBLE_OPERATIONS = 100;
7
+ export declare const DEVELOPMENT_CAUSAL_PANEL_MAX_SEARCH_LENGTH = 128;
8
+ export declare const DEVELOPMENT_CAUSAL_PANEL_GROUP_NAME_LIMIT = 6;
9
+ export interface DevelopmentCausalPanelProps {
10
+ readonly timeline: CausalTimeline;
11
+ /** Adds a manual Solid attribution capture to the causal inspector. */
12
+ readonly solidDiagnostics?: DevelopmentSolidDiagnosticsController;
13
+ /** Captures a bounded, value-free snapshot of the mounted UI tree on open/refresh. */
14
+ readonly snapshotTree?: DevelopmentTreeSnapshotProvider | undefined;
15
+ /** Measures a mounted element node by handle to highlight its live screen bounds. */
16
+ readonly measureTreeNode?: DevelopmentTreeMeasureProvider | undefined;
17
+ readonly children: SolidElement;
18
+ readonly initiallyOpen?: boolean;
19
+ readonly maxVisibleOperations?: number;
20
+ readonly maxVisibleTreeNodes?: number;
21
+ /** Lets a development root place multiple inspector badges without overlap. */
22
+ readonly badgeBottom?: number;
23
+ }
24
+ /**
25
+ * Adds an on-device, manually refreshed causal graph inspector. Refresh is
26
+ * explicit because rendering the inspector itself creates Fabric telemetry;
27
+ * subscribing the view to its own timeline would form a feedback loop.
28
+ */
29
+ export declare function DevelopmentCausalPanel(props: DevelopmentCausalPanelProps): SolidElement;
30
+ //# sourceMappingURL=causal-solid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"causal-solid.d.ts","sourceRoot":"","sources":["../src/causal-solid.ts"],"names":[],"mappings":"AAQA,OAAO,EAKL,KAAK,cAAc,EAQpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAIL,KAAK,OAAO,IAAI,YAAY,EAC7B,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAeL,KAAK,8BAA8B,EACnC,KAAK,+BAA+B,EAGrC,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,mDAAmD,KAAK,CAAC;AACtE,eAAO,MAAM,+CAA+C,MAAM,CAAC;AACnE,eAAO,MAAM,0CAA0C,MAAM,CAAC;AAC9D,eAAO,MAAM,yCAAyC,IAAI,CAAC;AAE3D,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,uEAAuE;IACvE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,qCAAqC,CAAC;IAClE,sFAAsF;IACtF,QAAQ,CAAC,YAAY,CAAC,EAAE,+BAA+B,GAAG,SAAS,CAAC;IACpE,qFAAqF;IACrF,QAAQ,CAAC,eAAe,CAAC,EAAE,8BAA8B,GAAG,SAAS,CAAC;IACtE,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC,+EAA+E;IAC/E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AA8aD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,2BAA2B,GACjC,YAAY,CAo1Bd"}