@dimina-kit/devtools 0.4.0 → 0.5.0-dev.20260908120530

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 (507) hide show
  1. package/README.md +51 -660
  2. package/dist/main/api.d.ts +2 -1
  3. package/dist/main/app/app.d.ts +41 -12
  4. package/dist/main/app/app.js +299 -514
  5. package/dist/main/app/bootstrap.d.ts +8 -5
  6. package/dist/main/app/bootstrap.js +15 -15
  7. package/dist/main/app/editor-view.d.ts +21 -0
  8. package/dist/main/app/editor-view.js +71 -0
  9. package/dist/main/app/global-mirrors.d.ts +23 -0
  10. package/dist/main/app/global-mirrors.js +37 -0
  11. package/dist/main/app/host-sidebar-default.d.ts +19 -0
  12. package/dist/main/app/host-sidebar-default.js +44 -0
  13. package/dist/main/app/lifecycle.d.ts +12 -1
  14. package/dist/main/app/lifecycle.js +27 -1
  15. package/dist/main/app/menu-setup.d.ts +13 -0
  16. package/dist/main/app/menu-setup.js +49 -0
  17. package/dist/main/app/native-overview.d.ts +1 -1
  18. package/dist/main/app/open-project-ipc.d.ts +13 -0
  19. package/dist/main/app/open-project-ipc.js +21 -0
  20. package/dist/main/app/project-list-surface.d.ts +31 -0
  21. package/dist/main/app/project-list-surface.js +20 -0
  22. package/dist/main/app/project-window.d.ts +36 -0
  23. package/dist/main/app/project-window.js +93 -0
  24. package/dist/main/app/servers.d.ts +17 -0
  25. package/dist/main/app/servers.js +60 -0
  26. package/dist/main/app/ui-extension-targets.d.ts +42 -0
  27. package/dist/main/app/ui-extension-targets.js +101 -0
  28. package/dist/main/app/window-close-reveal.harness.d.ts +34 -0
  29. package/dist/main/app/window-close-reveal.harness.js +65 -0
  30. package/dist/main/app/window-events.d.ts +15 -0
  31. package/dist/main/app/window-events.js +45 -0
  32. package/dist/main/app/window-runtime-services.d.ts +41 -0
  33. package/dist/main/app/window-runtime-services.js +197 -0
  34. package/dist/main/app/workbench-modules.d.ts +24 -0
  35. package/dist/main/app/workbench-modules.js +51 -0
  36. package/dist/main/app/workbench-window.d.ts +85 -0
  37. package/dist/main/app/workbench-window.js +310 -0
  38. package/dist/main/index.bundle.js +11712 -9986
  39. package/dist/main/index.js +49 -1
  40. package/dist/main/ipc/app-lifecycle.d.ts +1 -31
  41. package/dist/main/ipc/app-lifecycle.js +1 -53
  42. package/dist/main/ipc/app.d.ts +4 -1
  43. package/dist/main/ipc/app.js +4 -3
  44. package/dist/main/ipc/bridge-router.d.ts +19 -116
  45. package/dist/main/ipc/bridge-router.js +28 -2128
  46. package/dist/main/ipc/device-picker.d.ts +16 -0
  47. package/dist/main/ipc/device-picker.js +27 -0
  48. package/dist/main/ipc/index.d.ts +5 -0
  49. package/dist/main/ipc/index.js +5 -0
  50. package/dist/main/ipc/internal-devtools.d.ts +16 -0
  51. package/dist/main/ipc/internal-devtools.js +10 -0
  52. package/dist/main/ipc/page-scroll.d.ts +1 -13
  53. package/dist/main/ipc/page-scroll.js +1 -16
  54. package/dist/main/ipc/popover.d.ts +4 -1
  55. package/dist/main/ipc/popover.js +26 -19
  56. package/dist/main/ipc/project-create.d.ts +16 -0
  57. package/dist/main/ipc/project-create.js +27 -0
  58. package/dist/main/ipc/project-fs.d.ts +38 -3
  59. package/dist/main/ipc/project-fs.js +53 -22
  60. package/dist/main/ipc/projects.d.ts +3 -3
  61. package/dist/main/ipc/projects.js +47 -11
  62. package/dist/main/ipc/session-listener-bag.d.ts +1 -40
  63. package/dist/main/ipc/session-listener-bag.js +1 -39
  64. package/dist/main/ipc/session.d.ts +4 -1
  65. package/dist/main/ipc/session.js +26 -26
  66. package/dist/main/ipc/settings.d.ts +4 -1
  67. package/dist/main/ipc/settings.js +17 -19
  68. package/dist/main/ipc/simulator-module.d.ts +9 -3
  69. package/dist/main/ipc/simulator-module.js +13 -10
  70. package/dist/main/ipc/simulator.d.ts +4 -1
  71. package/dist/main/ipc/simulator.js +12 -18
  72. package/dist/main/ipc/tooltip.d.ts +14 -0
  73. package/dist/main/ipc/tooltip.js +29 -0
  74. package/dist/main/ipc/views.d.ts +19 -2
  75. package/dist/main/ipc/views.js +76 -8
  76. package/dist/main/runtime/devtools-backend-before-quit.harness.d.ts +43 -0
  77. package/dist/main/runtime/devtools-backend-before-quit.harness.js +87 -0
  78. package/dist/main/runtime/devtools-backend.js +60 -4
  79. package/dist/main/runtime/devtools-runtime-mock.harness.d.ts +21 -0
  80. package/dist/main/runtime/devtools-runtime-mock.harness.js +313 -0
  81. package/dist/main/runtime/miniapp-runtime.d.ts +91 -22
  82. package/dist/main/services/app-services.d.ts +62 -0
  83. package/dist/main/services/app-services.js +64 -0
  84. package/dist/main/services/automation/connection-target.d.ts +36 -0
  85. package/dist/main/services/automation/connection-target.js +29 -0
  86. package/dist/main/services/automation/console-bridge.d.ts +28 -0
  87. package/dist/main/services/automation/console-bridge.js +91 -0
  88. package/dist/main/services/automation/handlers/app.js +4 -4
  89. package/dist/main/services/automation/handlers/element.js +55 -21
  90. package/dist/main/services/automation/index.d.ts +12 -1
  91. package/dist/main/services/automation/index.js +54 -133
  92. package/dist/main/services/cdp-session/index.d.ts +87 -0
  93. package/dist/main/services/cdp-session/index.js +173 -0
  94. package/dist/main/services/compile-standby.js +4 -0
  95. package/dist/main/services/console-forward/cdp-inject.d.ts +18 -0
  96. package/dist/main/services/console-forward/cdp-inject.js +30 -0
  97. package/dist/main/services/console-forward/global-console-mirror.d.ts +33 -0
  98. package/dist/main/services/console-forward/global-console-mirror.js +71 -0
  99. package/dist/main/services/console-forward/global-diagnostics-mirror.d.ts +33 -0
  100. package/dist/main/services/console-forward/global-diagnostics-mirror.js +73 -0
  101. package/dist/main/services/console-forward/index.d.ts +1 -46
  102. package/dist/main/services/console-forward/index.js +1 -185
  103. package/dist/main/services/console-forward/internal-log.d.ts +2 -0
  104. package/dist/main/services/console-forward/internal-log.js +2 -0
  105. package/dist/main/services/console-forward/open-gated-relay.d.ts +67 -0
  106. package/dist/main/services/console-forward/open-gated-relay.js +55 -0
  107. package/dist/main/services/default-adapter.js +1 -1
  108. package/dist/main/services/diagnostics/index.d.ts +1 -48
  109. package/dist/main/services/diagnostics/index.js +1 -60
  110. package/dist/main/services/dimina-resource-server.d.ts +1 -6
  111. package/dist/main/services/dimina-resource-server.js +1 -98
  112. package/dist/main/services/elements-forward/index.d.ts +132 -15
  113. package/dist/main/services/elements-forward/index.js +155 -304
  114. package/dist/main/services/fs-bridge-protocol.d.ts +61 -0
  115. package/dist/main/services/fs-bridge-protocol.js +34 -0
  116. package/dist/main/services/fs-watch-sse.d.ts +40 -0
  117. package/dist/main/services/fs-watch-sse.js +113 -0
  118. package/dist/main/services/http-json.d.ts +9 -0
  119. package/dist/main/services/http-json.js +6 -0
  120. package/dist/main/services/layout/index.d.ts +11 -0
  121. package/dist/main/services/layout/index.js +23 -0
  122. package/dist/main/services/mcp/connection-owner.d.ts +38 -0
  123. package/dist/main/services/mcp/connection-owner.js +79 -0
  124. package/dist/main/services/mcp/index.d.ts +3 -1
  125. package/dist/main/services/mcp/index.js +4 -3
  126. package/dist/main/services/mcp/opened-project.d.ts +88 -0
  127. package/dist/main/services/mcp/opened-project.js +60 -0
  128. package/dist/main/services/mcp/server.d.ts +2 -1
  129. package/dist/main/services/mcp/server.js +29 -4
  130. package/dist/main/services/mcp/target-manager.d.ts +71 -23
  131. package/dist/main/services/mcp/target-manager.js +269 -138
  132. package/dist/main/services/mcp/target-selection.d.ts +47 -0
  133. package/dist/main/services/mcp/target-selection.js +71 -0
  134. package/dist/main/services/mcp/tools/context-tools.js +20 -5
  135. package/dist/main/services/mcp/tools/project-tools.d.ts +72 -0
  136. package/dist/main/services/mcp/tools/project-tools.js +133 -0
  137. package/dist/main/services/module.d.ts +13 -5
  138. package/dist/main/services/network-forward/body-cache.d.ts +72 -0
  139. package/dist/main/services/network-forward/body-cache.js +179 -0
  140. package/dist/main/services/network-forward/frontend-dispatch.d.ts +91 -0
  141. package/dist/main/services/network-forward/frontend-dispatch.js +148 -0
  142. package/dist/main/services/network-forward/global-body-gate.d.ts +46 -0
  143. package/dist/main/services/network-forward/global-body-gate.js +93 -0
  144. package/dist/main/services/network-forward/global-mirror-test-fixtures.d.ts +48 -0
  145. package/dist/main/services/network-forward/global-mirror-test-fixtures.js +96 -0
  146. package/dist/main/services/network-forward/http.d.ts +47 -0
  147. package/dist/main/services/network-forward/http.js +162 -0
  148. package/dist/main/services/network-forward/index.d.ts +135 -15
  149. package/dist/main/services/network-forward/index.js +854 -224
  150. package/dist/main/services/network-forward/request-ids.d.ts +5 -0
  151. package/dist/main/services/network-forward/request-ids.js +5 -0
  152. package/dist/main/services/network-forward/user-facing.d.ts +21 -0
  153. package/dist/main/services/network-forward/user-facing.js +50 -0
  154. package/dist/main/services/network-forward/websocket.d.ts +36 -0
  155. package/dist/main/services/network-forward/websocket.js +120 -0
  156. package/dist/main/services/notifications/renderer-notifier.d.ts +71 -9
  157. package/dist/main/services/notifications/renderer-notifier.js +45 -8
  158. package/dist/main/services/projects/create-project-service.js +19 -5
  159. package/dist/main/services/projects/local-provider.js +8 -4
  160. package/dist/main/services/projects/project-repository.d.ts +59 -7
  161. package/dist/main/services/projects/project-repository.js +285 -51
  162. package/dist/main/services/projects/types.d.ts +44 -34
  163. package/dist/main/services/render-inspect/index.d.ts +12 -2
  164. package/dist/main/services/render-inspect/index.js +21 -102
  165. package/dist/main/services/safe-area/index.d.ts +21 -6
  166. package/dist/main/services/safe-area/index.js +92 -46
  167. package/dist/main/services/service-host-pool/pool.d.ts +1 -196
  168. package/dist/main/services/service-host-pool/pool.js +1 -363
  169. package/dist/main/services/settings/index.d.ts +7 -1
  170. package/dist/main/services/settings/index.js +22 -2
  171. package/dist/main/services/simulator/custom-apis.d.ts +1 -42
  172. package/dist/main/services/simulator/custom-apis.js +1 -46
  173. package/dist/main/services/simulator/referer.d.ts +1 -9
  174. package/dist/main/services/simulator/referer.js +1 -19
  175. package/dist/main/services/simulator/ui-extensions.d.ts +21 -0
  176. package/dist/main/services/simulator/ui-extensions.js +176 -0
  177. package/dist/main/services/simulator-appdata/index.d.ts +6 -0
  178. package/dist/main/services/simulator-appdata/index.js +21 -2
  179. package/dist/main/services/simulator-current-page/index.d.ts +5 -3
  180. package/dist/main/services/simulator-current-page/index.js +8 -1
  181. package/dist/main/services/simulator-storage/index.d.ts +34 -5
  182. package/dist/main/services/simulator-storage/index.js +73 -71
  183. package/dist/main/services/simulator-storage/service-storage-ops.d.ts +1 -39
  184. package/dist/main/services/simulator-storage/service-storage-ops.js +1 -66
  185. package/dist/main/services/simulator-storage/window-scope.d.ts +20 -0
  186. package/dist/main/services/simulator-storage/window-scope.js +20 -0
  187. package/dist/main/services/simulator-temp-files/disk.d.ts +1 -54
  188. package/dist/main/services/simulator-temp-files/disk.js +1 -237
  189. package/dist/main/services/simulator-temp-files/fs-channels.d.ts +1 -68
  190. package/dist/main/services/simulator-temp-files/fs-channels.js +1 -107
  191. package/dist/main/services/simulator-temp-files/index.d.ts +1 -32
  192. package/dist/main/services/simulator-temp-files/index.js +1 -181
  193. package/dist/main/services/simulator-temp-files/request-handler.d.ts +1 -29
  194. package/dist/main/services/simulator-temp-files/request-handler.js +1 -177
  195. package/dist/main/services/simulator-temp-files/resolver.d.ts +1 -21
  196. package/dist/main/services/simulator-temp-files/resolver.js +1 -21
  197. package/dist/main/services/simulator-temp-files/store.d.ts +1 -13
  198. package/dist/main/services/simulator-temp-files/store.js +1 -23
  199. package/dist/main/services/update/github-release-checker.js +22 -3
  200. package/dist/main/services/update/update-manager.d.ts +21 -4
  201. package/dist/main/services/update/update-manager.js +55 -11
  202. package/dist/main/services/views/clear-console-filter.d.ts +44 -0
  203. package/dist/main/services/views/clear-console-filter.js +86 -0
  204. package/dist/main/services/views/console-filter-test-fixtures.d.ts +94 -0
  205. package/dist/main/services/views/console-filter-test-fixtures.js +82 -0
  206. package/dist/main/services/views/console-filter.d.ts +94 -0
  207. package/dist/main/services/views/console-filter.js +190 -0
  208. package/dist/main/services/views/devtools-tabs.d.ts +24 -4
  209. package/dist/main/services/views/devtools-tabs.js +40 -21
  210. package/dist/main/services/views/frontend-bootstrap-gate.d.ts +59 -0
  211. package/dist/main/services/views/frontend-bootstrap-gate.js +117 -0
  212. package/dist/main/services/views/host-dialog-port-channel.d.ts +18 -0
  213. package/dist/main/services/views/host-dialog-port-channel.js +15 -0
  214. package/dist/main/services/views/host-dialog-session-runtime.d.ts +10 -0
  215. package/dist/main/services/views/host-dialog-session-runtime.js +17 -0
  216. package/dist/main/services/views/host-dialog-view.d.ts +95 -0
  217. package/dist/main/services/views/host-dialog-view.js +147 -0
  218. package/dist/main/services/views/host-sidebar-port-channel.d.ts +18 -0
  219. package/dist/main/services/views/host-sidebar-port-channel.js +15 -0
  220. package/dist/main/services/views/host-sidebar-session-runtime.d.ts +10 -0
  221. package/dist/main/services/views/host-sidebar-session-runtime.js +17 -0
  222. package/dist/main/services/views/host-sidebar-view.d.ts +59 -0
  223. package/dist/main/services/views/host-sidebar-view.js +44 -0
  224. package/dist/main/services/views/host-slot-port-channel.d.ts +124 -0
  225. package/dist/main/services/views/host-slot-port-channel.js +289 -0
  226. package/dist/main/services/views/host-slot-session-runtime.d.ts +40 -0
  227. package/dist/main/services/views/host-slot-session-runtime.js +50 -0
  228. package/dist/main/services/views/host-slot-view.d.ts +109 -0
  229. package/dist/main/services/views/host-slot-view.js +147 -0
  230. package/dist/main/services/views/host-toolbar-port-channel.d.ts +6 -91
  231. package/dist/main/services/views/host-toolbar-port-channel.js +10 -243
  232. package/dist/main/services/views/host-toolbar-session-runtime.d.ts +5 -30
  233. package/dist/main/services/views/host-toolbar-session-runtime.js +9 -47
  234. package/dist/main/services/views/host-toolbar-view.d.ts +34 -7
  235. package/dist/main/services/views/host-toolbar-view.js +30 -237
  236. package/dist/main/services/views/managed-web-contents-view.d.ts +48 -0
  237. package/dist/main/services/views/managed-web-contents-view.js +143 -0
  238. package/dist/main/services/views/miniapp-partition.d.ts +1 -89
  239. package/dist/main/services/views/miniapp-partition.js +1 -158
  240. package/dist/main/services/views/native-simulator-devtools-host.js +206 -68
  241. package/dist/main/services/views/native-simulator-view.d.ts +6 -0
  242. package/dist/main/services/views/native-simulator-view.js +47 -40
  243. package/dist/main/services/views/native-view-tree.d.ts +25 -0
  244. package/dist/main/services/views/native-view-tree.js +69 -0
  245. package/dist/main/services/views/overlay-panels-view.d.ts +63 -4
  246. package/dist/main/services/views/overlay-panels-view.js +257 -108
  247. package/dist/main/services/views/placement-reconciler.d.ts +18 -18
  248. package/dist/main/services/views/placement-reconciler.js +91 -29
  249. package/dist/main/services/views/placement-test-driver.d.ts +27 -0
  250. package/dist/main/services/views/placement-test-driver.js +29 -0
  251. package/dist/main/services/views/refresh-styles.d.ts +10 -0
  252. package/dist/main/services/views/refresh-styles.js +57 -0
  253. package/dist/main/services/views/simulator-session-policy.d.ts +1 -27
  254. package/dist/main/services/views/simulator-session-policy.js +1 -98
  255. package/dist/main/services/views/view-manager-devtools-host-test-fixtures.d.ts +76 -0
  256. package/dist/main/services/views/view-manager-devtools-host-test-fixtures.js +184 -0
  257. package/dist/main/services/views/view-manager.d.ts +69 -88
  258. package/dist/main/services/views/view-manager.js +62 -7
  259. package/dist/main/services/views/workbench-view.d.ts +2 -0
  260. package/dist/main/services/views/workbench-view.js +104 -17
  261. package/dist/main/services/window-contexts/context-router.d.ts +36 -0
  262. package/dist/main/services/window-contexts/context-router.js +55 -0
  263. package/dist/main/services/workbench-coi-host.d.ts +52 -0
  264. package/dist/main/services/workbench-coi-host.js +227 -0
  265. package/dist/main/services/workbench-coi-server.d.ts +11 -0
  266. package/dist/main/services/workbench-coi-server.js +126 -126
  267. package/dist/main/services/workbench-coi-shutdown.d.ts +40 -0
  268. package/dist/main/services/workbench-coi-shutdown.js +69 -0
  269. package/dist/main/services/workbench-coi-static.d.ts +23 -0
  270. package/dist/main/services/workbench-coi-static.js +87 -0
  271. package/dist/main/services/workbench-context.d.ts +88 -8
  272. package/dist/main/services/workbench-context.js +54 -6
  273. package/dist/main/services/workspace/compile-log-buffer.d.ts +40 -0
  274. package/dist/main/services/workspace/compile-log-buffer.js +41 -0
  275. package/dist/main/services/workspace/compile-mode-adapter.d.ts +18 -0
  276. package/dist/main/services/workspace/compile-mode-adapter.js +57 -0
  277. package/dist/main/services/workspace/compile-mode-store.d.ts +25 -0
  278. package/dist/main/services/workspace/compile-mode-store.js +71 -0
  279. package/dist/main/services/workspace/open-project-guards.d.ts +16 -0
  280. package/dist/main/services/workspace/open-project-guards.js +42 -0
  281. package/dist/main/services/workspace/rebuild-status.d.ts +37 -0
  282. package/dist/main/services/workspace/rebuild-status.js +36 -0
  283. package/dist/main/services/workspace/session-status-store.d.ts +47 -0
  284. package/dist/main/services/workspace/session-status-store.js +73 -0
  285. package/dist/main/services/workspace/status-tap.d.ts +20 -0
  286. package/dist/main/services/workspace/status-tap.js +32 -0
  287. package/dist/main/services/workspace/workspace-compile-modes.d.ts +59 -0
  288. package/dist/main/services/workspace/workspace-compile-modes.js +93 -0
  289. package/dist/main/services/workspace/workspace-lifecycle-race.testutil.d.ts +22 -0
  290. package/dist/main/services/workspace/workspace-lifecycle-race.testutil.js +62 -0
  291. package/dist/main/services/workspace/workspace-referer.d.ts +17 -0
  292. package/dist/main/services/workspace/workspace-referer.js +26 -0
  293. package/dist/main/services/workspace/workspace-service.d.ts +7 -5
  294. package/dist/main/services/workspace/workspace-service.js +96 -135
  295. package/dist/main/services/workspace/workspace-thumbnails.d.ts +22 -0
  296. package/dist/main/services/workspace/workspace-thumbnails.js +67 -0
  297. package/dist/main/utils/ipc-context-source.d.ts +40 -0
  298. package/dist/main/utils/ipc-context-source.js +23 -0
  299. package/dist/main/utils/ipc-registry.d.ts +46 -21
  300. package/dist/main/utils/ipc-registry.js +166 -76
  301. package/dist/main/utils/paths.d.ts +18 -0
  302. package/dist/main/utils/paths.js +18 -0
  303. package/dist/main/utils/sender-policy.d.ts +10 -1
  304. package/dist/main/utils/sender-policy.js +42 -4
  305. package/dist/main/utils/theme.d.ts +18 -8
  306. package/dist/main/utils/theme.js +19 -9
  307. package/dist/main/windows/internal-devtools-window/index.d.ts +66 -0
  308. package/dist/main/windows/internal-devtools-window/index.js +160 -0
  309. package/dist/main/windows/main-window/create.d.ts +16 -0
  310. package/dist/main/windows/main-window/create.js +19 -11
  311. package/dist/main/windows/main-window/events.d.ts +1 -1
  312. package/dist/main/windows/main-window/events.js +26 -13
  313. package/dist/main/windows/main-window/index.d.ts +1 -1
  314. package/dist/main/windows/main-window/index.js +1 -1
  315. package/dist/main/windows/service-host-window/create.d.ts +1 -92
  316. package/dist/main/windows/service-host-window/create.js +1 -154
  317. package/dist/native-host/common/common.js +173 -53
  318. package/dist/native-host/container/pageFrame.css +1 -1
  319. package/dist/native-host/render/render.js +8278 -3659
  320. package/dist/native-host/service/service.js +2 -2
  321. package/dist/preload/index.d.ts +2 -0
  322. package/dist/preload/index.js +1 -0
  323. package/dist/preload/instrumentation/app-data.d.ts +2 -2
  324. package/dist/preload/instrumentation/app-data.js +1 -1
  325. package/dist/preload/instrumentation/wxml.js +1 -1
  326. package/dist/preload/runtime/bridge.d.ts +3 -3
  327. package/dist/preload/runtime/bridge.js +2 -2
  328. package/dist/preload/runtime/clipboard.d.ts +6 -0
  329. package/dist/preload/runtime/clipboard.js +12 -0
  330. package/dist/preload/runtime/host-dialog-advertiser.d.ts +22 -0
  331. package/dist/preload/runtime/host-dialog-advertiser.js +37 -0
  332. package/dist/preload/runtime/host-dialog-port.d.ts +44 -0
  333. package/dist/preload/runtime/host-dialog-port.js +53 -0
  334. package/dist/preload/runtime/host-dialog-runtime.d.ts +28 -0
  335. package/dist/preload/runtime/host-dialog-runtime.js +36 -0
  336. package/dist/preload/runtime/host-sidebar-advertiser.d.ts +19 -0
  337. package/dist/preload/runtime/host-sidebar-advertiser.js +35 -0
  338. package/dist/preload/runtime/host-sidebar-port.d.ts +44 -0
  339. package/dist/preload/runtime/host-sidebar-port.js +53 -0
  340. package/dist/preload/runtime/host-sidebar-runtime.d.ts +28 -0
  341. package/dist/preload/runtime/host-sidebar-runtime.js +36 -0
  342. package/dist/preload/runtime/host-slot-port-bridge.d.ts +18 -0
  343. package/dist/preload/runtime/host-slot-port-bridge.js +112 -0
  344. package/dist/preload/runtime/host-toolbar-advertiser.d.ts +5 -13
  345. package/dist/preload/runtime/host-toolbar-advertiser.js +18 -38
  346. package/dist/preload/runtime/host-toolbar-port.d.ts +9 -0
  347. package/dist/preload/runtime/host-toolbar-port.js +11 -95
  348. package/dist/preload/runtime/native-host.d.ts +14 -0
  349. package/dist/preload/runtime/native-host.js +5 -8
  350. package/dist/preload/runtime/node-bindings.d.ts +18 -0
  351. package/dist/preload/runtime/node-bindings.js +44 -0
  352. package/dist/preload/runtime/temp-files.js +9 -2
  353. package/dist/preload/runtime/wait-for-slot-root.d.ts +23 -0
  354. package/dist/preload/runtime/wait-for-slot-root.js +80 -0
  355. package/dist/preload/shared/api-compat.js +63 -41
  356. package/dist/preload/windows/host-dialog-runtime.cjs +360 -0
  357. package/dist/preload/windows/host-dialog-runtime.cjs.map +7 -0
  358. package/dist/preload/windows/host-dialog-runtime.d.ts +2 -0
  359. package/dist/preload/windows/host-dialog-runtime.js +13 -0
  360. package/dist/preload/windows/host-sidebar-runtime.cjs +361 -0
  361. package/dist/preload/windows/host-sidebar-runtime.cjs.map +7 -0
  362. package/dist/preload/windows/host-sidebar-runtime.d.ts +2 -0
  363. package/dist/preload/windows/host-sidebar-runtime.js +13 -0
  364. package/dist/preload/windows/host-toolbar-runtime.cjs +142 -52
  365. package/dist/preload/windows/host-toolbar-runtime.cjs.map +3 -3
  366. package/dist/preload/windows/main.cjs +4922 -1246
  367. package/dist/preload/windows/main.cjs.map +4 -4
  368. package/dist/preload/windows/main.css +428 -0
  369. package/dist/preload/windows/main.css.map +7 -0
  370. package/dist/preload/windows/simulator.cjs +376 -322
  371. package/dist/preload/windows/simulator.cjs.map +4 -4
  372. package/dist/preload/windows/simulator.js +376 -322
  373. package/dist/render-host/pageFrame.html +4 -4
  374. package/dist/render-host/preload.cjs +30 -0
  375. package/dist/render-host/render-inspect.js +184 -115
  376. package/dist/renderer/assets/button-CB2MWjHY.js +2 -0
  377. package/dist/renderer/assets/constants-CkoGPQTS.js +2 -0
  378. package/dist/renderer/assets/constants-zQZ2-y21.js +2 -0
  379. package/dist/renderer/assets/createLucideIcon-cZ9FlZZw.js +2 -0
  380. package/dist/renderer/assets/devicePicker-H2eIO4e1.js +2 -0
  381. package/dist/renderer/assets/dialog-pHzEA8Vx.js +46 -0
  382. package/dist/renderer/assets/dist-B5HADirS.js +2 -0
  383. package/dist/renderer/assets/dist-DIFlRMKe.js +2 -0
  384. package/dist/renderer/assets/hostSidebarDefault-DRWh6OCt.js +2 -0
  385. package/dist/renderer/assets/index-CEL_XFge.js +2 -0
  386. package/dist/renderer/assets/input-CAObw95L.js +2 -0
  387. package/dist/renderer/assets/ipc-channels-overlays-gIPUFnqc.js +2 -0
  388. package/dist/renderer/assets/jsx-runtime-DICEQH_0.css +1 -0
  389. package/dist/renderer/assets/jsx-runtime-DIw5wnYl.js +9 -0
  390. package/dist/renderer/assets/plus-BQ9u5EbL.js +2 -0
  391. package/dist/renderer/assets/popover-Cw7G2Ctp.js +2 -0
  392. package/dist/renderer/assets/presets-DMZOb9ay.js +2 -0
  393. package/dist/renderer/assets/project-api-YTOr_Yvo.js +2 -0
  394. package/dist/renderer/assets/projectCreateDialog-BmLqiYxn.js +2 -0
  395. package/dist/renderer/assets/search-BMvuYF48.js +2 -0
  396. package/dist/renderer/assets/select-nFP95TxM.js +2 -0
  397. package/dist/renderer/assets/settings-CnpVfSWt.js +2 -0
  398. package/dist/renderer/assets/settings-api-Ccsf-Nsj.js +2 -0
  399. package/dist/renderer/assets/settings-tab-bar-CAzrv32m.js +2 -0
  400. package/dist/renderer/assets/smartphone-Bb2GdIKy.js +2 -0
  401. package/dist/renderer/assets/tabs-CPKN3Mmq.js +2 -0
  402. package/dist/renderer/assets/tooltip-D6AxXRk5.js +2 -0
  403. package/dist/renderer/assets/types-Bh0hA7El.js +2 -0
  404. package/dist/renderer/assets/updateDialog-CwndJ0Bl.js +2 -0
  405. package/dist/renderer/assets/utils-sEB5OZEQ.js +2 -0
  406. package/dist/renderer/assets/view-api-B-2zPBR5.js +2 -0
  407. package/dist/renderer/assets/view-ids-BfaDVV5P.js +2 -0
  408. package/dist/renderer/assets/workbench-C0Jkdlps.js +5 -0
  409. package/dist/renderer/assets/workbenchSettings-YD0Ctbm_.js +8 -0
  410. package/dist/renderer/entries/device-picker/index.html +28 -0
  411. package/dist/renderer/entries/host-sidebar-default/index.html +22 -0
  412. package/dist/renderer/entries/main/index.html +16 -7
  413. package/dist/renderer/entries/popover/index.html +16 -6
  414. package/dist/renderer/entries/project-create-dialog/index.html +27 -0
  415. package/dist/renderer/entries/settings/index.html +10 -5
  416. package/dist/renderer/entries/tooltip/index.html +21 -0
  417. package/dist/renderer/entries/update-dialog/index.html +25 -0
  418. package/dist/renderer/entries/workbench/index.html +49 -0
  419. package/dist/renderer/entries/workbench-settings/index.html +12 -5
  420. package/dist/service-host/appdata-set-data.cjs +39 -0
  421. package/dist/service-host/host-env-update.cjs +23 -0
  422. package/dist/service-host/preload.cjs +54 -48
  423. package/dist/service-host/service-message-queue.cjs +71 -0
  424. package/dist/service-host/sync-impls/menu-button-geometry.js +16 -5
  425. package/dist/service-host/sync-impls/menu-button.js +5 -3
  426. package/dist/service-host/sync-impls/system-info.js +31 -9
  427. package/dist/shared/bridge-channels.d.ts +1 -416
  428. package/dist/shared/bridge-channels.js +1 -89
  429. package/dist/shared/compile-mode-state.d.ts +73 -0
  430. package/dist/shared/compile-mode-state.js +100 -0
  431. package/dist/shared/compile-modes.d.ts +152 -0
  432. package/dist/shared/compile-modes.js +237 -0
  433. package/dist/shared/constants.d.ts +22 -0
  434. package/dist/shared/constants.js +22 -0
  435. package/dist/shared/dmb-resource-url.d.ts +2 -0
  436. package/dist/shared/dmb-resource-url.js +2 -0
  437. package/dist/shared/ipc-channels-overlays.d.ts +162 -0
  438. package/dist/shared/ipc-channels-overlays.js +203 -0
  439. package/dist/shared/ipc-channels.d.ts +24 -154
  440. package/dist/shared/ipc-channels.js +48 -96
  441. package/dist/shared/ipc-schemas.d.ts +143 -54
  442. package/dist/shared/ipc-schemas.js +137 -45
  443. package/dist/shared/node-bindings.d.ts +2 -0
  444. package/dist/shared/node-bindings.js +2 -0
  445. package/dist/shared/project-window-types.d.ts +42 -0
  446. package/dist/shared/project-window-types.js +2 -0
  447. package/dist/shared/simulator-route.d.ts +8 -0
  448. package/dist/shared/simulator-route.js +15 -0
  449. package/dist/shared/simulator-ui.d.ts +61 -0
  450. package/dist/shared/simulator-ui.js +12 -0
  451. package/dist/shared/types.d.ts +126 -41
  452. package/dist/shared/view-ids.d.ts +10 -0
  453. package/dist/shared/view-ids.js +23 -0
  454. package/dist/simulator/assets/bridge-channels-B3JAmRfl.js +2 -0
  455. package/dist/simulator/assets/device-shell-ATEhHV2_.css +1 -0
  456. package/dist/simulator/assets/device-shell-DucLepkm.js +431 -0
  457. package/dist/simulator/assets/simulator-B4rbcOVt.js +10 -0
  458. package/dist/simulator/assets/simulator-mini-app-DFo7fhi5.js +2 -0
  459. package/dist/simulator/assets/simulator-ui-BupATgKo.css +1 -0
  460. package/dist/simulator/assets/simulator-ui-i3GCc7YJ.js +2 -0
  461. package/dist/simulator/simulator.html +4 -3
  462. package/dist/simulator/temp-files.d.ts +35 -0
  463. package/dist/simulator/temp-files.js +121 -0
  464. package/dist/simulator/types.d.ts +50 -0
  465. package/dist/simulator/types.js +2 -0
  466. package/dist/vscode-workbench/assets/__vite-browser-external-JIkWewFf.js +1 -0
  467. package/dist/vscode-workbench/assets/{dist-TpGpmMGi.js → dist-CXG-u1VB.js} +3 -3
  468. package/dist/vscode-workbench/assets/fs-core-worker-urls-DZ1nod84.js +1 -0
  469. package/dist/vscode-workbench/assets/fs-core.worker-Bnmpp6fo.js +1 -0
  470. package/dist/vscode-workbench/assets/fs-query.worker-cZ-7Fjch.js +2 -0
  471. package/dist/vscode-workbench/assets/{iconv-lite-umd-C9tiCAJa.js → iconv-lite-umd-Dxx9Qyb4.js} +1 -1
  472. package/dist/vscode-workbench/assets/{index-DJ1HyMZ7.js → index-6VJMsaWj.js} +475 -475
  473. package/dist/vscode-workbench/assets/{jschardet-DE1jV513.js → jschardet-Ba3D16vt.js} +1 -1
  474. package/dist/vscode-workbench/index.html +21 -1
  475. package/package.json +23 -13
  476. package/dist/main/services/views/destroy-child-view.d.ts +0 -9
  477. package/dist/main/services/views/destroy-child-view.js +0 -23
  478. package/dist/preload/instrumentation/wxml-extract.d.ts +0 -11
  479. package/dist/preload/instrumentation/wxml-extract.js +0 -382
  480. package/dist/preload/shared/sid-registry.d.ts +0 -11
  481. package/dist/preload/shared/sid-registry.js +0 -38
  482. package/dist/renderer/assets/constants-EAMiwL9_.js +0 -2
  483. package/dist/renderer/assets/index-BMqyDx71.js +0 -49
  484. package/dist/renderer/assets/input-CDAEwpBO.js +0 -2
  485. package/dist/renderer/assets/ipc-transport-B7eFOR68.css +0 -1
  486. package/dist/renderer/assets/ipc-transport-_G1k5V1p.js +0 -9
  487. package/dist/renderer/assets/popover-DEdjK14m.js +0 -2
  488. package/dist/renderer/assets/select-DpKPCh3y.js +0 -2
  489. package/dist/renderer/assets/settings-M5q2elUr.js +0 -2
  490. package/dist/renderer/assets/settings-api-CDlZoHiO.js +0 -2
  491. package/dist/renderer/assets/workbenchSettings-CT_H1WhV.js +0 -8
  492. package/dist/shared/appdata-accumulator.d.ts +0 -95
  493. package/dist/shared/appdata-accumulator.js +0 -218
  494. package/dist/shared/request-core.d.ts +0 -84
  495. package/dist/shared/request-core.js +0 -168
  496. package/dist/shared/simulator-api-metadata.d.ts +0 -26
  497. package/dist/shared/simulator-api-metadata.js +0 -59
  498. package/dist/shared/vpath.d.ts +0 -42
  499. package/dist/shared/vpath.js +0 -105
  500. package/dist/simulator/assets/bridge-channels-zhsumfky.js +0 -2
  501. package/dist/simulator/assets/device-shell-C-wcFq3Z.js +0 -2
  502. package/dist/simulator/assets/device-shell-CS1rqAQz.css +0 -1
  503. package/dist/simulator/assets/jsx-runtime-BDTY6fEq.js +0 -2
  504. package/dist/simulator/assets/simulator-DU3-fS3v.js +0 -10
  505. package/dist/simulator/assets/simulator-mini-app-DzfMfnVM.js +0 -2
  506. package/dist/simulator/device-shell/menu-button-geometry.js +0 -8
  507. package/dist/vscode-workbench/assets/__vite-browser-external-CXi6Kz9W.js +0 -1
@@ -1,159 +1,2 @@
1
- /**
2
- * Per-project session partition for the native-host miniapp runtime (P0 debt).
3
- *
4
- * Historically every project's miniapp webContents — the simulator content
5
- * WebContentsView, its nested render-host `<webview>` guests, AND the
6
- * service-host window — shared ONE hard-coded `persist:simulator` Electron
7
- * session. Cookies / localStorage / cache / IndexedDB written by project A were
8
- * visible to (and clobbered by) project B; two projects open at once cross-
9
- * contaminate and "clear storage" on one nukes the other.
10
- *
11
- * The fix derives a STABLE per-project partition from the project identity:
12
- * the miniapp `appId` (which flows in via the simulator URL `?appId=` and the
13
- * spawn path's `appId`) PLUS the project path. appId alone is insufficient —
14
- * it comes from the project manifest, so two DIFFERENT project paths can declare
15
- * the SAME appId and would otherwise share a partition; folding the path in
16
- * isolates them. Same project (same appId + path) → same partition (storage
17
- * survives a relaunch); different projects → different partitions (no cross-
18
- * contamination). The shape mirrors the IDE state of the art (WeChat's static
19
- * partition, ByteDance's `persist:miniapp-<id>` dynamic partition).
20
- *
21
- * The protocol handlers (`difile://`, `dmb-resource`) and webRequest policies
22
- * (referer / CORS) that the simulator runtime needs were installed once on the
23
- * single `persist:simulator` session. With per-project partitions those have to
24
- * be (re)applied to EACH project session the first time it is used. The setup
25
- * sites register a partition-agnostic configurator here; `configureMiniappSession`
26
- * runs every registered configurator exactly once per partition.
27
- *
28
- * Partition CLEANUP (reclaiming on-disk `persist:` data) is intentionally NOT
29
- * done here — leaving the data on disk is the whole point of a `persist:`
30
- * partition (cache/storage survives a relaunch). That is a separate concern.
31
- *
32
- * MIGRATION (intentional one-time reset): folding the project path into the key
33
- * means a project that previously ran on the appId-only `persist:miniapp-<appId>`
34
- * now runs on `persist:miniapp-<appId>-p<hash>` and starts with empty
35
- * cookies/localStorage/cache. Old data is NOT migrated — a best-effort copy
36
- * could carry already-cross-contaminated state into the newly isolated space,
37
- * which defeats the isolation. The reset is accepted as a one-time cost.
38
- */
39
- import * as electron from 'electron';
40
- /** The legacy single-session partition. Still used by the pre-warm pool (which
41
- * is intentionally NOT isolation-aware — see `serviceHostSpec`) and as the
42
- * fallback when a project key cannot be derived. */
43
- export const SHARED_MINIAPP_PARTITION = 'persist:simulator';
44
- const PARTITION_PREFIX = 'persist:miniapp-';
45
- /**
46
- * Derive a stable, filesystem-safe partition key from a project `appId`.
47
- *
48
- * `appId` is the project identity (e.g. a `wxapp…` id). We pass through the
49
- * characters Electron is happy to put in a session partition / on-disk folder
50
- * name (`[A-Za-z0-9_-]`) verbatim so the common case is human-legible, and fold
51
- * anything else into a short deterministic hash suffix so two appIds that differ
52
- * only in stripped characters never collide. The same `appId` always yields the
53
- * same key (so storage survives a relaunch); different `appId`s yield different
54
- * keys.
55
- */
56
- export function miniappPartitionKey(appId, projectPath) {
57
- const safe = appId.replace(/[^A-Za-z0-9_-]/g, '');
58
- // Folding may have dropped distinguishing characters; if the input was not
59
- // already fully safe, append a deterministic hash of the RAW appId so two
60
- // distinct appIds can never alias onto the same key.
61
- const base = safe === appId && safe.length > 0
62
- ? safe
63
- : safe.length > 0
64
- ? `${safe}-${djb2(appId).toString(36)}`
65
- : djb2(appId).toString(36);
66
- // `appId` comes from the project manifest, not the path — two DIFFERENT
67
- // project paths can declare the SAME appId. Fold the project path into the key
68
- // so those projects get isolated partitions (no storage/cache cross-talk),
69
- // while the same path always yields the same suffix (a relaunch reuses its
70
- // storage). Path characters aren't partition-safe, so always hash. Omitting
71
- // projectPath preserves the legacy appId-only key (pre-warm pool / callers
72
- // that have no project identity).
73
- if (!projectPath)
74
- return base;
75
- return `${base}-p${djb2(projectPath).toString(36)}`;
76
- }
77
- /**
78
- * The Electron session partition for a project. Returns the SHARED partition
79
- * when `appId` is empty/unknown (so the runtime still has a session to load on,
80
- * matching the legacy behavior) and a `persist:miniapp-<key>` partition
81
- * otherwise.
82
- */
83
- export function miniappPartition(appId, projectPath) {
84
- if (!appId)
85
- return SHARED_MINIAPP_PARTITION;
86
- return `${PARTITION_PREFIX}${miniappPartitionKey(appId, projectPath)}`;
87
- }
88
- /** Small, stable string hash (djb2). Not cryptographic — only needs to be
89
- * deterministic and collision-resistant enough to disambiguate appIds. */
90
- function djb2(input) {
91
- let h = 5381;
92
- for (let i = 0; i < input.length; i++) {
93
- h = ((h << 5) + h + input.charCodeAt(i)) >>> 0;
94
- }
95
- return h;
96
- }
97
- const configurators = new Set();
98
- const configuredPartitions = new Set();
99
- /**
100
- * Register a configurator that runs against every miniapp partition session.
101
- * Already-configured partitions are (re)configured immediately so registration
102
- * order does not matter. Returns a disposer that unregisters the configurator
103
- * (it does not undo work already applied to live sessions).
104
- */
105
- export function registerMiniappSessionConfigurator(fn) {
106
- configurators.add(fn);
107
- for (const partition of configuredPartitions) {
108
- try {
109
- fn(electron.session.fromPartition(partition), partition);
110
- }
111
- catch (err) {
112
- console.warn('[miniapp-partition] configurator failed for', partition, err);
113
- }
114
- }
115
- return () => {
116
- configurators.delete(fn);
117
- };
118
- }
119
- /**
120
- * Ensure a partition's session has every registered configurator applied. Safe
121
- * to call repeatedly per partition (idempotent — each partition is configured
122
- * once). Call this before loading project content on `partition`.
123
- *
124
- * Returns `null` when there is nothing to configure (no configurator registered)
125
- * so the partition derivation stays independent of any live Electron session —
126
- * the partition is a constructor-time fact, not a side effect of touching the
127
- * session API. Setup sites register configurators at app boot; in unit tests
128
- * that mock `electron` without a `session` export this short-circuits cleanly.
129
- */
130
- export function configureMiniappSession(partition) {
131
- // Record that this partition should be configured even if no configurator is
132
- // registered YET — a later `registerMiniappSessionConfigurator` back-fills it.
133
- const alreadyConfigured = configuredPartitions.has(partition);
134
- configuredPartitions.add(partition);
135
- if (configurators.size === 0)
136
- return null;
137
- const sess = electron.session.fromPartition(partition);
138
- if (alreadyConfigured)
139
- return sess;
140
- for (const fn of configurators) {
141
- try {
142
- fn(sess, partition);
143
- }
144
- catch (err) {
145
- console.warn('[miniapp-partition] configurator failed for', partition, err);
146
- }
147
- }
148
- return sess;
149
- }
150
- /**
151
- * Test-only: drop the configurator + configured-partition bookkeeping so each
152
- * test starts from a clean slate. (Module-level state otherwise leaks across
153
- * unit tests that mock `electron`.)
154
- */
155
- export function __resetMiniappSessionConfigForTests() {
156
- configurators.clear();
157
- configuredPartitions.clear();
158
- }
1
+ export * from '@dimina-kit/electron-runtime/main/miniapp-partition';
159
2
  //# sourceMappingURL=miniapp-partition.js.map
@@ -1,11 +1,13 @@
1
- import { WebContentsView } from 'electron';
1
+ import { WebContentsView, webContents as electronWebContents } from 'electron';
2
2
  import { buildDevtoolsProjectSourceLinksScript, decodeOpenInEditorUrl, projectSourceContextFromServiceHostUrl, } from '../../../shared/open-in-editor.js';
3
- import { buildCustomizeTabsScript } from './devtools-tabs.js';
3
+ import { buildCustomizeTabsScript, buildDevtoolsSoftMenuScript } from './devtools-tabs.js';
4
+ import { buildInternalLogHideScript } from './console-filter.js';
5
+ import { buildClearConsoleFilterScript } from './clear-console-filter.js';
6
+ import { whenFrontendBootstrapped } from './frontend-bootstrap-gate.js';
4
7
  import { installElementsForward } from '../elements-forward/index.js';
5
8
  import { installServiceConsoleForward } from '../service-console/index.js';
6
9
  import { VIEW_ID } from '../../../shared/view-ids.js';
7
10
  import { resolveProjectEditorTarget } from './resolve-project-editor-target.js';
8
- import { destroyChildView } from './destroy-child-view.js';
9
11
  import { createLoadDeferredInjector } from './inject-when-ready.js';
10
12
  // `webContents.executeJavaScript()` registers a transient `did-stop-loading`
11
13
  // listener on the target wc whenever that wc is still loading (Electron's
@@ -37,7 +39,6 @@ export function createDevtoolsHost(ctx, reconciler, deps) {
37
39
  // The right-panel Chrome DevTools front-end HOST WebContentsView. Created by
38
40
  // rebuildDevtoolsHostView; positioned by the renderer's simulatorDevtools anchor.
39
41
  let simulatorView = null;
40
- let simulatorViewAdded = false;
41
42
  // The webContents the right-panel Chrome DevTools front-end currently inspects.
42
43
  // We point it at the SERVICE HOST (logic layer) — the hidden BrowserWindow
43
44
  // where the mini-app's page code runs (`console.log`, `wx.request`,
@@ -54,6 +55,7 @@ export function createDevtoolsHost(ctx, reconciler, deps) {
54
55
  // (`rebuildDevtoolsHostView`) rather than target it again.
55
56
  let devtoolsHostUsed = false;
56
57
  let unsubscribeNativeRenderEvents = null;
58
+ let unsubscribeNativeServiceHostReady = null;
57
59
  // Disposer for the Elements-forward feature (routes the front-end's Elements
58
60
  // CDP traffic at the active render guest). Installed in
59
61
  // `attach`, stopped on detach / host destroyed.
@@ -64,6 +66,14 @@ export function createDevtoolsHost(ctx, reconciler, deps) {
64
66
  let stopServiceConsole = null;
65
67
  let nativeDevtoolsRetryTimer = null;
66
68
  let nativeDevtoolsRetryToken = 0;
69
+ // When the NEXT host build happens it is a FRESH PROJECT OPEN, so the stale
70
+ // Console filter (DevTools' own persisted localStorage setting, possibly
71
+ // leftover from the old filter-box implementation) must be cleared once.
72
+ // Armed by `attach()` (the project-open path) and disarmed by every re-point,
73
+ // so a service-host pool swap (hot-reload respawn) rebuilds the host WITHOUT
74
+ // wiping a filter the developer typed during the session. See
75
+ // clear-console-filter.ts.
76
+ let clearFilterOnNextHostBuild = false;
67
77
  // Front-end injects re-fire on EVERY re-point; while the host is loading each
68
78
  // raw executeJavaScript would queue one did-stop-loading waiter per call.
69
79
  // The deferred injector keeps one hook per (wc, kind) with latest-wins.
@@ -106,6 +116,13 @@ export function createDevtoolsHost(ctx, reconciler, deps) {
106
116
  catch { /* ignore */ }
107
117
  unsubscribeNativeRenderEvents = null;
108
118
  }
119
+ if (unsubscribeNativeServiceHostReady) {
120
+ try {
121
+ unsubscribeNativeServiceHostReady();
122
+ }
123
+ catch { /* ignore */ }
124
+ unsubscribeNativeServiceHostReady = null;
125
+ }
109
126
  closeNativeDevtoolsSource();
110
127
  }
111
128
  function injectOpenResourceHandler(serviceWc, devtoolsWc) {
@@ -158,6 +175,37 @@ export function createDevtoolsHost(ctx, reconciler, deps) {
158
175
  }
159
176
  catch { /* wc surface incomplete / torn down; degrade silently */ }
160
177
  }
178
+ // User-facing Console de-noise: hide dimina
179
+ // framework internal log lines from THIS right-panel Console — the
180
+ // standalone internal DevTools window (native-only, wired elsewhere) shows
181
+ // them unfiltered. Re-applied on every re-point, same policy as
182
+ // customizeDevtoolsTabs (the injected script wraps once and is idempotent
183
+ // across re-points). Drives the panel's own visibility judge rather than
184
+ // its text-filter box, so the developer's filter input stays empty and
185
+ // entirely theirs — see console-filter.ts's header comment.
186
+ // Bootstrap-gated: the live script touches `Console.ConsoleView.instance()`,
187
+ // which — fired before the front-end's own bootstrap completes —
188
+ // constructs IssuesManager early and permanently kills that bootstrap (see
189
+ // frontend-bootstrap-gate.ts). Gate resolving false = degrade silently,
190
+ // this module's standing convention.
191
+ function applyConsoleFilter(devtoolsWc) {
192
+ try {
193
+ if (devtoolsWc.isDestroyed())
194
+ return;
195
+ const inject = () => {
196
+ void whenFrontendBootstrapped(devtoolsWc).then((ready) => {
197
+ if (!ready || devtoolsWc.isDestroyed())
198
+ return;
199
+ try {
200
+ void devtoolsWc.executeJavaScript(buildInternalLogHideScript()).catch(() => { });
201
+ }
202
+ catch { /* wc torn down mid-call */ }
203
+ });
204
+ };
205
+ injectWhenReady(devtoolsWc, 'console-filter', inject);
206
+ }
207
+ catch { /* wc surface incomplete / torn down; degrade silently */ }
208
+ }
161
209
  function wireOpenInEditor(serviceWc, devtoolsWc) {
162
210
  // Inject the front-end handler on every (re)attach — the DevTools front-end
163
211
  // wc is recreated per simulatorView, so a fresh host needs the handler set.
@@ -211,6 +259,9 @@ export function createDevtoolsHost(ctx, reconciler, deps) {
211
259
  function pointNativeDevtoolsAtServiceWc(next) {
212
260
  if (!simulatorView || simulatorView.webContents.isDestroyed())
213
261
  return true;
262
+ // Any host rebuild triggered from a re-point is a service-host swap, NOT a
263
+ // fresh project open — the stale Console filter must survive it.
264
+ clearFilterOnNextHostBuild = false;
214
265
  if (nativeDevtoolsSourceWc?.id === next.id && !nativeDevtoolsSourceWc.isDestroyed()) {
215
266
  return true;
216
267
  }
@@ -246,6 +297,9 @@ export function createDevtoolsHost(ctx, reconciler, deps) {
246
297
  // Re-applied on every re-point so a service-host pool swap (fresh
247
298
  // openDevTools) re-asserts the custom tab bar.
248
299
  customizeDevtoolsTabs(simulatorView.webContents);
300
+ // De-noise the user-facing Console: hide
301
+ // dimina framework internal log lines from THIS panel by default.
302
+ applyConsoleFilter(simulatorView.webContents);
249
303
  // Capture service-layer console via CDP (NOT a preload monkeypatch, which
250
304
  // would clobber native source attribution) and feed it to the console
251
305
  // fan-out (automation `App.logAdded`). Bound to THIS service wc; replaced
@@ -286,8 +340,25 @@ export function createDevtoolsHost(ctx, reconciler, deps) {
286
340
  return false;
287
341
  return pointNativeDevtoolsAtServiceWc(wc);
288
342
  }
289
- function scheduleNativeDevtoolsFollow(appId, attempt = 0) {
290
- if (attempt >= 20)
343
+ // Bound on how long the FALLBACK poll (below) keeps retrying before giving
344
+ // up a pure safety valve, not the real mechanism. The real mechanism is
345
+ // `onNativeServiceHostReady` (an event, not a poll): it fires the moment
346
+ // `ctx.bridge.getServiceWc` is GUARANTEED to resolve, so this fallback only
347
+ // exists for the residual gap where `followNativeDevtoolsServiceHost` runs
348
+ // from a render event that races ahead of that event somehow. A fixed short
349
+ // attempt count here (originally 20×50ms = 1s) was the actual production
350
+ // bug this module was fixed for: under real machine load,
351
+ // `ctx.bridge.getServiceWc(appId)` can take longer than 1s to resolve, and
352
+ // once the fixed budget ran out the right-panel DevTools attach was
353
+ // silently, permanently lost for the rest of that session (confirmed via
354
+ // real reproduction + timing instrumentation). Bounded by WALL-CLOCK time
355
+ // (generous — normal resolution is well under a second) rather than a
356
+ // small attempt count, since the fallback's whole job is to outlast a slow
357
+ // machine, not a slow algorithm.
358
+ const NATIVE_DEVTOOLS_FALLBACK_POLL_MAX_MS = 60_000;
359
+ const NATIVE_DEVTOOLS_FALLBACK_POLL_INTERVAL_MS = 50;
360
+ function scheduleNativeDevtoolsFollow(appId, startedAt = Date.now()) {
361
+ if (Date.now() - startedAt >= NATIVE_DEVTOOLS_FALLBACK_POLL_MAX_MS)
291
362
  return;
292
363
  if (!ctx.bridge?.isNativeHost())
293
364
  return;
@@ -300,8 +371,8 @@ export function createDevtoolsHost(ctx, reconciler, deps) {
300
371
  return;
301
372
  if (pointNativeDevtoolsAtActiveServiceHost(appId))
302
373
  return;
303
- scheduleNativeDevtoolsFollow(appId, attempt + 1);
304
- }, 50);
374
+ scheduleNativeDevtoolsFollow(appId, startedAt);
375
+ }, NATIVE_DEVTOOLS_FALLBACK_POLL_INTERVAL_MS);
305
376
  }
306
377
  function followNativeDevtoolsServiceHost(appId) {
307
378
  clearNativeDevtoolsRetry();
@@ -309,10 +380,53 @@ export function createDevtoolsHost(ctx, reconciler, deps) {
309
380
  return;
310
381
  scheduleNativeDevtoolsFollow(appId);
311
382
  }
383
+ // The real mechanism: fires the moment a service host's `service.html`
384
+ // did-finish-load's, i.e. the exact instant `serviceWcId` is guaranteed
385
+ // resolvable — no polling, no race against a fixed retry budget. Resolves
386
+ // the wc DIRECTLY via the id the event carries (never re-resolving through
387
+ // `getServiceWc(appId)`, which during same-app respawn overlap returns the
388
+ // newest session, not necessarily the one that fired this event), then
389
+ // validates the event against that same authority before acting — see the
390
+ // generation gate below.
391
+ function onNativeServiceHostReady(event) {
392
+ if (!ctx.bridge?.isNativeHost())
393
+ return;
394
+ if (!simulatorView || simulatorView.webContents.isDestroyed())
395
+ return;
396
+ const wc = electronWebContents.fromId(event.serviceWcId);
397
+ if (!wc || wc.isDestroyed())
398
+ return;
399
+ // Generation gate: `getServiceWc` resolves the NEWEST live session
400
+ // (bridge-router's findAppSessionByAppId is last-inserted-wins), so an
401
+ // event it CONTRADICTS is a superseded session's late-arriving ready —
402
+ // repointing there would resurrect a dying host (the newer session's own
403
+ // ready does/did the real repoint). An authority that cannot resolve at
404
+ // all fails OPEN: the event is the only signal available, and dropping
405
+ // it would strand the attach on nothing. Fail-open cannot stick to a
406
+ // dying wc in practice — the direct emit is same-tick with bootServiceHost
407
+ // (session still registered), the catch-up path re-validates the session
408
+ // before delivering, and even a hypothetical miss just makes point()
409
+ // return false into the wall-clock-bounded fallback.
410
+ const current = ctx.bridge.getServiceWc(event.appId);
411
+ if (current && current.id !== event.serviceWcId)
412
+ return;
413
+ // Only a SUCCESSFUL repoint may retire the standing fallback poll — a
414
+ // failed attempt (service wc torn down mid-point is the common race)
415
+ // must leave/re-arm it, or this very event cancels the retry that would
416
+ // have eventually attached.
417
+ if (pointNativeDevtoolsAtServiceWc(wc)) {
418
+ clearNativeDevtoolsRetry();
419
+ return;
420
+ }
421
+ scheduleNativeDevtoolsFollow(event.appId);
422
+ }
312
423
  // Render-side activity (a page DOM mounting / the visible page changing)
313
424
  // always follows a spawn or respawn, by which point the service window exists
314
425
  // (and may have been swapped by the pool). Re-resolve + re-point the DevTools
315
- // at the now-current service host on every such event.
426
+ // at the now-current service host on every such event. Belt-and-suspenders
427
+ // alongside `onNativeServiceHostReady` — by the time a render event fires,
428
+ // the service host that produced it is definitionally already resolvable,
429
+ // so this path should normally resolve immediately (no fallback poll needed).
316
430
  function onNativeRenderEvent(event) {
317
431
  if (event.kind !== 'activePage' && event.kind !== 'domReady')
318
432
  return;
@@ -326,32 +440,53 @@ export function createDevtoolsHost(ctx, reconciler, deps) {
326
440
  // service-host pool swap must repoint onto a fresh host, not reuse the
327
441
  // already-navigated one).
328
442
  function rebuildDevtoolsHostView() {
329
- // Destroy old simulatorView to prevent WebContentsView leak
443
+ // Destroy the previous host through the native-tree owner before replacing it.
330
444
  if (simulatorView) {
331
- removeSimulatorDevtoolsView();
332
- try {
333
- if (!simulatorView.webContents.isDestroyed()) {
334
- simulatorView.webContents.close();
335
- }
336
- }
337
- catch { /* ignore */ }
445
+ reconciler.destroyView(VIEW_ID.simulatorDevtools, simulatorView);
338
446
  simulatorView = null;
339
447
  }
340
448
  simulatorView = new WebContentsView();
341
449
  // Default DevTools to Console panel (Chrome DevTools defaults to Elements).
342
450
  // The DevTools UI lives inside closed shadow roots, so a light-DOM
343
451
  // querySelector('[role="tab"]') cannot reach the tab bar to click it.
344
- // Instead drive the front-end's own view manager: the bundled DevTools
345
- // exposes `UI.ViewManager.instance().showView(id)` on `globalThis.UI`
346
- // once the front-end has finished bootstrapping. We poll for it and
347
- // request the `console` view, and also persist the choice via the
348
- // `panel-selectedTab` localStorage key so subsequent reloads honor it.
452
+ // Instead drive the front-end's own view manager via `globalThis.EUI`
453
+ // (the bundle's real exposure of the ui/legacy namespace) NOT
454
+ // `globalThis.UI`, which never exists on this front-end build (same
455
+ // finding devtools-tabs.ts records; an earlier `UI.…`-polling version of
456
+ // this script was dead code and the panel silently defaulted to
457
+ // Elements). Gated on frontend bootstrap: `ViewManager.instance()` is a
458
+ // singleton construction, only safe after the front-end's own MainImpl
459
+ // finished wiring (see frontend-bootstrap-gate.ts). (A persisted
460
+ // `panel-selected-tab` preference write is NOT an alternative mechanism —
461
+ // this custom devtools:// host persists nothing to disk; see
462
+ // console-filter.ts's header.)
349
463
  const devtoolsWc = simulatorView.webContents;
350
464
  // The boot-time burst of `executeJavaScript()` injects on this host wc (tab
351
465
  // customization / console default / Elements+Network forwarding below) each
352
466
  // queue a pending `did-stop-loading` waiter while the front-end is still
353
467
  // loading (see raiseExecuteJavaScriptListenerCeiling).
354
468
  raiseExecuteJavaScriptListenerCeiling(devtoolsWc);
469
+ // The embedded Chrome DevTools front-end renders its context menus ONLY
470
+ // when the host reports “hosted mode” (page-rendered soft menus — the
471
+ // VS Code / Web-embedding path). Electron's own devtools:// host injection
472
+ // leaves `isHostedMode()` false and does not handle
473
+ // `showContextMenuAtPoint()` for a SELF-BUILT WebContentsView, so
474
+ // right-click menus (复制为 cURL / Copy / …) never appear — the front-end
475
+ // asks the host for a menu and nobody answers. Force hosted mode so the
476
+ // front-end draws its native page menus itself. Re-injected on every
477
+ // The embedded DevTools front-end asks the host for its context menus via
478
+ // `showContextMenuAtPoint()` (Electron leaves it unhandled on a self-built
479
+ // WCV), so right-click menus never appear. Force page-rendered soft menus
480
+ // via a narrow ContextMenu#show patch (NOT the host-wide isHostedMode()
481
+ // flag — that one breaks the front-end's target data flow, emptying the
482
+ // Console/Network panels). Needs the front-end bootstrap for EUI to exist.
483
+ injectWhenReady(devtoolsWc, 'soft-menu', () => {
484
+ void whenFrontendBootstrapped(devtoolsWc).then((ready) => {
485
+ if (!ready || devtoolsWc.isDestroyed())
486
+ return;
487
+ devtoolsWc.executeJavaScript(buildDevtoolsSoftMenuScript()).catch(() => { });
488
+ });
489
+ });
355
490
  // Hand the network forwarder THIS front-end host wc — it injects the
356
491
  // simulator WCV's Network.* CDP events into `window.DevToolsAPI.dispatchMessage`
357
492
  // here so the native Network tab renders them (falls back to the service-host
@@ -377,7 +512,18 @@ export function createDevtoolsHost(ctx, reconciler, deps) {
377
512
  // instance (its reconcile loop never gets to install the hook, so Elements
378
513
  // falls back to the natively-inspected service host). Stop only this wc's own
379
514
  // forward, and clear the module pointer only while it still points here.
380
- const thisForward = installElementsForward({ devtoolsWc, bridge: ctx.bridge, connections: ctx.connections });
515
+ const thisForward = installElementsForward({
516
+ devtoolsWc,
517
+ bridge: ctx.bridge,
518
+ connections: ctx.connections,
519
+ // Shared session broker (see cdp-session/index.ts) — undefined falls
520
+ // back to a private instance owned by this call.
521
+ broker: ctx.cdpSessionBroker,
522
+ // Body/post-data lookups for the virtual requestIds the network
523
+ // forwarder injects — answered from its prefetch cache when the
524
+ // front-end's Response tab round-trips Network.getResponseBody.
525
+ network: ctx.networkForward?.bodies,
526
+ });
381
527
  stopElementsForward = thisForward;
382
528
  devtoolsWc.once('destroyed', () => {
383
529
  try {
@@ -389,27 +535,39 @@ export function createDevtoolsHost(ctx, reconciler, deps) {
389
535
  });
390
536
  }
391
537
  injectWhenReady(devtoolsWc, 'console-default', () => {
392
- devtoolsWc.executeJavaScript(`
393
- (function() {
394
- try { localStorage.setItem('panel-selectedTab', '"console"') } catch {}
395
- let tries = 0
396
- const timer = setInterval(() => {
397
- tries++
538
+ void whenFrontendBootstrapped(devtoolsWc).then((ready) => {
539
+ if (!ready || devtoolsWc.isDestroyed())
540
+ return;
541
+ devtoolsWc.executeJavaScript(`
542
+ (function() {
398
543
  try {
399
- const UI = globalThis.UI
400
- const vm = UI && UI.ViewManager && typeof UI.ViewManager.instance === 'function'
401
- ? UI.ViewManager.instance()
544
+ var EUI = globalThis.EUI
545
+ var vm = EUI && EUI.ViewManager && EUI.ViewManager.ViewManager
546
+ && typeof EUI.ViewManager.ViewManager.instance === 'function'
547
+ ? EUI.ViewManager.ViewManager.instance()
402
548
  : null
403
- if (vm && typeof vm.showView === 'function') {
404
- vm.showView('console')
405
- clearInterval(timer)
406
- return
407
- }
408
- } catch {}
409
- if (tries > 80) clearInterval(timer)
410
- }, 50)
411
- })()
412
- `).catch(() => { });
549
+ if (vm && typeof vm.showView === 'function') void vm.showView('console')
550
+ } catch (_) {}
551
+ })()
552
+ `).catch(() => { });
553
+ });
554
+ });
555
+ // Clear the stale Console filter box on a FRESH project open only (armed by
556
+ // attach(), disarmed by re-points — see clearFilterOnNextHostBuild). The
557
+ // value is captured at build time so a later swap cannot re-arm/clear this
558
+ // host; bootstrap-gated the same way as the console-default inject above.
559
+ const clearStaleFilter = clearFilterOnNextHostBuild;
560
+ injectWhenReady(devtoolsWc, 'clear-console-filter', () => {
561
+ if (!clearStaleFilter)
562
+ return;
563
+ void whenFrontendBootstrapped(devtoolsWc).then((ready) => {
564
+ if (!ready || devtoolsWc.isDestroyed())
565
+ return;
566
+ try {
567
+ void devtoolsWc.executeJavaScript(buildClearConsoleFilterScript()).catch(() => { });
568
+ }
569
+ catch { /* wc torn down mid-call */ }
570
+ });
413
571
  });
414
572
  // Anchor-only mount: the renderer's published rect is the SOLE authority.
415
573
  // If a non-zero rect was already published (it can land before this attach
@@ -425,39 +583,20 @@ export function createDevtoolsHost(ctx, reconciler, deps) {
425
583
  devtoolsHostUsed = false;
426
584
  }
427
585
  function attachNativeSimulatorDevtoolsHost() {
586
+ // This host build is a FRESH PROJECT OPEN: clear the stale Console filter
587
+ // once (see clearFilterOnNextHostBuild / clear-console-filter.ts). A later
588
+ // re-point (service-host pool swap) disarms it before ITS rebuild.
589
+ clearFilterOnNextHostBuild = true;
428
590
  stopFollowingNativeServiceHost();
429
591
  rebuildDevtoolsHostView();
430
592
  if (ctx.bridge?.isNativeHost()) {
431
593
  unsubscribeNativeRenderEvents = ctx.bridge.onRenderEvent(onNativeRenderEvent);
594
+ unsubscribeNativeServiceHostReady = ctx.bridge.onServiceHostReady(onNativeServiceHostReady);
432
595
  followNativeDevtoolsServiceHost();
433
596
  }
434
597
  }
435
- // Remove (but do not destroy) the DevTools overlay from the contentView.
436
- // Internal teardown helper for re-attach; user-facing visibility is the
437
- // anchor 0×0 single path (`setSimulatorDevtoolsBounds`).
438
- function removeSimulatorDevtoolsView() {
439
- if (simulatorView && simulatorViewAdded) {
440
- try {
441
- ctx.windows.mainWindow.contentView.removeChildView(simulatorView);
442
- }
443
- catch (e) {
444
- console.error('[workbench] removeSimulatorDevtoolsView error', e);
445
- }
446
- simulatorViewAdded = false;
447
- }
448
- // The instance is being replaced/destroyed — forget its reconciled mount
449
- // state so the next rebuilt host is treated as a fresh attach. Without this,
450
- // the level-triggered reconciler still records `simulatorDevtools` as
451
- // `attached` (the manual removeChildView above bypasses it), so it never
452
- // emits the `attach` op for the rebuilt view and the new host is never
453
- // addChildView'd — embedded but invisible. Mirrors the hostToolbar /
454
- // simulator instance-replacement handling (ensureHostToolbarView /
455
- // tearDownNativeSimulatorView).
456
- reconciler.forgetActual(VIEW_ID.simulatorDevtools);
457
- }
458
598
  reconciler.registerView(VIEW_ID.simulatorDevtools, {
459
599
  getView: () => simulatorView,
460
- setAdded: (added) => { simulatorViewAdded = added; },
461
600
  gateHidden: () => !simulatorView,
462
601
  });
463
602
  return {
@@ -475,9 +614,8 @@ export function createDevtoolsHost(ctx, reconciler, deps) {
475
614
  stopElementsForward = null;
476
615
  },
477
616
  destroyHostView: () => {
478
- destroyChildView(ctx.windows.mainWindow, simulatorView);
617
+ reconciler.destroyView(VIEW_ID.simulatorDevtools, simulatorView);
479
618
  simulatorView = null;
480
- simulatorViewAdded = false;
481
619
  },
482
620
  };
483
621
  }
@@ -15,6 +15,12 @@ import type { ViewManagerContext } from './view-manager.js';
15
15
  export interface NativeSimulatorView {
16
16
  attachNativeSimulator(simulatorUrl: string, simWidth: number): Promise<void>;
17
17
  softReloadNativeSimulator(simulatorUrl: string): boolean;
18
+ /**
19
+ * Hot-swap stylesheets in every live render-host guest WITHOUT respawning the
20
+ * shell (page stack / form state / focus survive). Returns false when no live
21
+ * guest exists, so the caller falls back to a full reload.
22
+ */
23
+ refreshSimulatorStyles(): boolean;
18
24
  detachSimulator(): void;
19
25
  getSimulatorWebContentsId(): number | null;
20
26
  getSimulatorWebContents(): WebContents | null;