@dimina-kit/devtools 0.4.0-dev.20260803105710 → 0.4.0-dev.20260828092243

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 (208) hide show
  1. package/dist/main/api.d.ts +1 -1
  2. package/dist/main/app/app.js +66 -2
  3. package/dist/main/index.bundle.js +1454 -540
  4. package/dist/main/ipc/index.d.ts +3 -0
  5. package/dist/main/ipc/index.js +3 -0
  6. package/dist/main/ipc/popover.js +1 -1
  7. package/dist/main/ipc/project-create.d.ts +15 -0
  8. package/dist/main/ipc/project-create.js +26 -0
  9. package/dist/main/ipc/projects.d.ts +1 -1
  10. package/dist/main/ipc/projects.js +11 -0
  11. package/dist/main/ipc/session.js +11 -0
  12. package/dist/main/ipc/settings.js +2 -1
  13. package/dist/main/ipc/simulator-module.d.ts +4 -3
  14. package/dist/main/ipc/simulator-module.js +4 -5
  15. package/dist/main/ipc/tooltip.d.ts +13 -0
  16. package/dist/main/ipc/tooltip.js +28 -0
  17. package/dist/main/ipc/views.d.ts +15 -1
  18. package/dist/main/ipc/views.js +61 -4
  19. package/dist/main/runtime/miniapp-runtime.d.ts +87 -19
  20. package/dist/main/services/layout/index.d.ts +11 -0
  21. package/dist/main/services/layout/index.js +23 -0
  22. package/dist/main/services/network-forward/frontend-dispatch.js +2 -1
  23. package/dist/main/services/notifications/renderer-notifier.d.ts +32 -1
  24. package/dist/main/services/notifications/renderer-notifier.js +29 -1
  25. package/dist/main/services/projects/project-repository.d.ts +4 -1
  26. package/dist/main/services/projects/project-repository.js +63 -5
  27. package/dist/main/services/simulator-current-page/index.d.ts +5 -3
  28. package/dist/main/services/simulator-current-page/index.js +8 -1
  29. package/dist/main/services/update/update-manager.d.ts +17 -3
  30. package/dist/main/services/update/update-manager.js +25 -6
  31. package/dist/main/services/views/clear-console-filter.d.ts +44 -0
  32. package/dist/main/services/views/clear-console-filter.js +86 -0
  33. package/dist/main/services/views/console-filter-test-fixtures.d.ts +94 -0
  34. package/dist/main/services/views/console-filter-test-fixtures.js +82 -0
  35. package/dist/main/services/views/console-filter.d.ts +79 -130
  36. package/dist/main/services/views/console-filter.js +140 -183
  37. package/dist/main/services/views/devtools-tabs.d.ts +24 -4
  38. package/dist/main/services/views/devtools-tabs.js +40 -21
  39. package/dist/main/services/views/host-dialog-port-channel.d.ts +18 -0
  40. package/dist/main/services/views/host-dialog-port-channel.js +15 -0
  41. package/dist/main/services/views/host-dialog-session-runtime.d.ts +10 -0
  42. package/dist/main/services/views/host-dialog-session-runtime.js +17 -0
  43. package/dist/main/services/views/host-dialog-view.d.ts +95 -0
  44. package/dist/main/services/views/host-dialog-view.js +147 -0
  45. package/dist/main/services/views/host-sidebar-port-channel.d.ts +18 -0
  46. package/dist/main/services/views/host-sidebar-port-channel.js +15 -0
  47. package/dist/main/services/views/host-sidebar-session-runtime.d.ts +10 -0
  48. package/dist/main/services/views/host-sidebar-session-runtime.js +17 -0
  49. package/dist/main/services/views/host-sidebar-view.d.ts +59 -0
  50. package/dist/main/services/views/host-sidebar-view.js +44 -0
  51. package/dist/main/services/views/host-slot-port-channel.d.ts +107 -0
  52. package/dist/main/services/views/host-slot-port-channel.js +261 -0
  53. package/dist/main/services/views/host-slot-session-runtime.d.ts +40 -0
  54. package/dist/main/services/views/host-slot-session-runtime.js +50 -0
  55. package/dist/main/services/views/host-slot-view.d.ts +109 -0
  56. package/dist/main/services/views/host-slot-view.js +147 -0
  57. package/dist/main/services/views/host-toolbar-port-channel.d.ts +6 -91
  58. package/dist/main/services/views/host-toolbar-port-channel.js +10 -243
  59. package/dist/main/services/views/host-toolbar-session-runtime.d.ts +5 -30
  60. package/dist/main/services/views/host-toolbar-session-runtime.js +9 -47
  61. package/dist/main/services/views/host-toolbar-view.d.ts +34 -7
  62. package/dist/main/services/views/host-toolbar-view.js +30 -237
  63. package/dist/main/services/views/managed-web-contents-view.d.ts +48 -0
  64. package/dist/main/services/views/managed-web-contents-view.js +123 -0
  65. package/dist/main/services/views/native-simulator-devtools-host.js +64 -45
  66. package/dist/main/services/views/native-simulator-view.js +6 -24
  67. package/dist/main/services/views/native-view-tree.d.ts +25 -0
  68. package/dist/main/services/views/native-view-tree.js +69 -0
  69. package/dist/main/services/views/overlay-panels-view.d.ts +50 -4
  70. package/dist/main/services/views/overlay-panels-view.js +226 -108
  71. package/dist/main/services/views/placement-reconciler.d.ts +18 -18
  72. package/dist/main/services/views/placement-reconciler.js +91 -29
  73. package/dist/main/services/views/placement-test-driver.d.ts +27 -0
  74. package/dist/main/services/views/placement-test-driver.js +29 -0
  75. package/dist/main/services/views/view-manager-devtools-host-test-fixtures.js +3 -1
  76. package/dist/main/services/views/view-manager.d.ts +14 -86
  77. package/dist/main/services/views/view-manager.js +41 -4
  78. package/dist/main/services/views/workbench-view.js +27 -20
  79. package/dist/main/services/workbench-coi-server.d.ts +11 -0
  80. package/dist/main/services/workbench-coi-server.js +32 -0
  81. package/dist/main/services/workspace/rebuild-status.d.ts +21 -8
  82. package/dist/main/services/workspace/rebuild-status.js +24 -8
  83. package/dist/main/utils/paths.d.ts +4 -0
  84. package/dist/main/utils/paths.js +4 -0
  85. package/dist/main/utils/sender-policy.d.ts +1 -1
  86. package/dist/main/utils/sender-policy.js +16 -1
  87. package/dist/main/utils/theme.d.ts +7 -2
  88. package/dist/main/utils/theme.js +8 -3
  89. package/dist/native-host/common/common.js +65 -62
  90. package/dist/native-host/container/pageFrame.css +1 -1
  91. package/dist/native-host/render/render.js +3226 -2898
  92. package/dist/native-host/service/service.js +2 -2
  93. package/dist/preload/runtime/host-dialog-advertiser.d.ts +22 -0
  94. package/dist/preload/runtime/host-dialog-advertiser.js +37 -0
  95. package/dist/preload/runtime/host-dialog-port.d.ts +44 -0
  96. package/dist/preload/runtime/host-dialog-port.js +53 -0
  97. package/dist/preload/runtime/host-dialog-runtime.d.ts +28 -0
  98. package/dist/preload/runtime/host-dialog-runtime.js +36 -0
  99. package/dist/preload/runtime/host-sidebar-advertiser.d.ts +19 -0
  100. package/dist/preload/runtime/host-sidebar-advertiser.js +35 -0
  101. package/dist/preload/runtime/host-sidebar-port.d.ts +44 -0
  102. package/dist/preload/runtime/host-sidebar-port.js +53 -0
  103. package/dist/preload/runtime/host-sidebar-runtime.d.ts +28 -0
  104. package/dist/preload/runtime/host-sidebar-runtime.js +36 -0
  105. package/dist/preload/runtime/host-slot-port-bridge.d.ts +18 -0
  106. package/dist/preload/runtime/host-slot-port-bridge.js +112 -0
  107. package/dist/preload/runtime/host-toolbar-advertiser.d.ts +5 -13
  108. package/dist/preload/runtime/host-toolbar-advertiser.js +18 -38
  109. package/dist/preload/runtime/host-toolbar-port.d.ts +9 -0
  110. package/dist/preload/runtime/host-toolbar-port.js +11 -95
  111. package/dist/preload/runtime/wait-for-slot-root.d.ts +20 -0
  112. package/dist/preload/runtime/wait-for-slot-root.js +52 -0
  113. package/dist/preload/windows/host-dialog-runtime.cjs +353 -0
  114. package/dist/preload/windows/host-dialog-runtime.cjs.map +7 -0
  115. package/dist/preload/windows/host-dialog-runtime.d.ts +2 -0
  116. package/dist/preload/windows/host-dialog-runtime.js +13 -0
  117. package/dist/preload/windows/host-sidebar-runtime.cjs +354 -0
  118. package/dist/preload/windows/host-sidebar-runtime.cjs.map +7 -0
  119. package/dist/preload/windows/host-sidebar-runtime.d.ts +2 -0
  120. package/dist/preload/windows/host-sidebar-runtime.js +13 -0
  121. package/dist/preload/windows/host-toolbar-runtime.cjs +134 -51
  122. package/dist/preload/windows/host-toolbar-runtime.cjs.map +3 -3
  123. package/dist/preload/windows/main.cjs +3176 -14
  124. package/dist/preload/windows/main.cjs.map +4 -4
  125. package/dist/preload/windows/main.css +428 -0
  126. package/dist/preload/windows/main.css.map +7 -0
  127. package/dist/preload/windows/simulator.cjs +5 -2
  128. package/dist/preload/windows/simulator.cjs.map +2 -2
  129. package/dist/preload/windows/simulator.js +5 -2
  130. package/dist/renderer/assets/button-DsNqZm7o.js +2 -0
  131. package/dist/renderer/assets/constants-D7DfVqMp.js +2 -0
  132. package/dist/renderer/assets/constants-D8zsejFq.js +2 -0
  133. package/dist/renderer/assets/createLucideIcon-CYJeT1ji.js +2 -0
  134. package/dist/renderer/assets/dialog-pT4qWmka.js +46 -0
  135. package/dist/renderer/assets/dist-o70xmpc1.js +2 -0
  136. package/dist/renderer/assets/hostSidebarDefault-NvGZlE9O.js +2 -0
  137. package/dist/renderer/assets/index-zErhG3ta.js +5 -0
  138. package/dist/renderer/assets/input-4QxTXMZN.js +2 -0
  139. package/dist/renderer/assets/ipc-channels-overlays-Blr5TNoB.js +2 -0
  140. package/dist/renderer/assets/jsx-runtime-B-3rq1y5.css +1 -0
  141. package/dist/renderer/assets/jsx-runtime-CqVdW3eg.js +9 -0
  142. package/dist/renderer/assets/popover-CJiSWwuE.js +2 -0
  143. package/dist/renderer/assets/project-api-DZ1Zi6EC.js +2 -0
  144. package/dist/renderer/assets/projectCreateDialog-DMWNhw_1.js +2 -0
  145. package/dist/renderer/assets/select-C86pNcsu.js +2 -0
  146. package/dist/renderer/assets/settings-BoI8mLT1.js +2 -0
  147. package/dist/renderer/assets/settings-api-Bs_g4NHs.js +2 -0
  148. package/dist/renderer/assets/settings-tab-bar-DHLLygqv.js +2 -0
  149. package/dist/renderer/assets/tooltip-BhAyY0T4.js +2 -0
  150. package/dist/renderer/assets/types-YYjkvane.js +2 -0
  151. package/dist/renderer/assets/updateDialog-DPum3wx1.js +2 -0
  152. package/dist/renderer/assets/utils-kfQov6Pa.js +2 -0
  153. package/dist/renderer/assets/view-api-DFhb2R8-.js +2 -0
  154. package/dist/renderer/assets/workbenchSettings-DrajRQUk.js +8 -0
  155. package/dist/renderer/entries/host-sidebar-default/index.html +21 -0
  156. package/dist/renderer/entries/main/index.html +15 -7
  157. package/dist/renderer/entries/popover/index.html +10 -6
  158. package/dist/renderer/entries/project-create-dialog/index.html +27 -0
  159. package/dist/renderer/entries/settings/index.html +10 -5
  160. package/dist/renderer/entries/tooltip/index.html +21 -0
  161. package/dist/renderer/entries/update-dialog/index.html +25 -0
  162. package/dist/renderer/entries/workbench-settings/index.html +11 -5
  163. package/dist/service-host/preload.cjs +10 -0
  164. package/dist/service-host/sync-impls/menu-button-geometry.js +1 -0
  165. package/dist/shared/constants.d.ts +22 -0
  166. package/dist/shared/constants.js +22 -0
  167. package/dist/shared/ipc-channels-overlays.d.ts +156 -0
  168. package/dist/shared/ipc-channels-overlays.js +186 -0
  169. package/dist/shared/ipc-channels.d.ts +1 -67
  170. package/dist/shared/ipc-channels.js +9 -81
  171. package/dist/shared/ipc-schemas.d.ts +52 -0
  172. package/dist/shared/ipc-schemas.js +64 -0
  173. package/dist/shared/simulator-route.d.ts +8 -0
  174. package/dist/shared/simulator-route.js +15 -0
  175. package/dist/shared/types.d.ts +17 -0
  176. package/dist/shared/view-ids.d.ts +9 -0
  177. package/dist/shared/view-ids.js +21 -0
  178. package/dist/simulator/assets/device-shell-CmtM1QxP.js +2 -0
  179. package/dist/simulator/assets/device-shell-iFZo1igL.css +1 -0
  180. package/dist/simulator/assets/{simulator-COIE6R49.js → simulator-CIobn3Mh.js} +6 -6
  181. package/dist/simulator/assets/{simulator-mini-app-BLn7XV8e.js → simulator-mini-app-CRe6n9br.js} +2 -2
  182. package/dist/simulator/assets/simulator-ui-BupATgKo.css +1 -0
  183. package/dist/simulator/assets/simulator-ui-C_cP602X.js +2 -0
  184. package/dist/simulator/simulator.html +3 -2
  185. package/dist/vscode-workbench/assets/__vite-browser-external-Bc1vizTf.js +1 -0
  186. package/dist/vscode-workbench/assets/{dist-oHcwN53f.js → dist-CMfmHflW.js} +3 -3
  187. package/dist/vscode-workbench/assets/{iconv-lite-umd-CLMLpdGm.js → iconv-lite-umd-Bx8CgaZq.js} +1 -1
  188. package/dist/vscode-workbench/assets/{index-BE3UJdoH.js → index-CdG6YWhW.js} +436 -436
  189. package/dist/vscode-workbench/assets/{jschardet-BICW8PLJ.js → jschardet-M0qgd2lN.js} +1 -1
  190. package/dist/vscode-workbench/index.html +21 -1
  191. package/package.json +9 -8
  192. package/dist/main/services/views/destroy-child-view.d.ts +0 -9
  193. package/dist/main/services/views/destroy-child-view.js +0 -23
  194. package/dist/renderer/assets/constants-EAMiwL9_.js +0 -2
  195. package/dist/renderer/assets/index-BBg3YI5b.js +0 -49
  196. package/dist/renderer/assets/input-xdmfv-eH.js +0 -2
  197. package/dist/renderer/assets/ipc-transport-B3EpmfNS.js +0 -9
  198. package/dist/renderer/assets/ipc-transport-Blac3sOj.css +0 -1
  199. package/dist/renderer/assets/popover-B88e2hkg.js +0 -2
  200. package/dist/renderer/assets/select-CD9CJyhI.js +0 -2
  201. package/dist/renderer/assets/settings-44hf0QtO.js +0 -2
  202. package/dist/renderer/assets/settings-api-pJKPuP1M.js +0 -2
  203. package/dist/renderer/assets/workbenchSettings-DKD5U1Ql.js +0 -8
  204. package/dist/simulator/assets/device-shell-Cw7c-IkG.js +0 -2
  205. package/dist/simulator/assets/device-shell-DbC5ccs8.css +0 -1
  206. package/dist/simulator/assets/jsx-runtime-DkKmJyBb.js +0 -2
  207. package/dist/simulator/device-shell/menu-button-geometry.js +0 -18
  208. package/dist/vscode-workbench/assets/__vite-browser-external-BON7qP59.js +0 -1
@@ -1,136 +1,55 @@
1
1
  /**
2
- * Negative text-filter for the right-panel (user-facing) Console — hides
3
- * dimina framework internal log lines from the panel the mini-app author
4
- * watches (see console-forward/internal-log.ts for
5
- * the prefix judge this mirrors). The framework prints these via a plain
6
- * `console.log` call INSIDE the inspected service host itself; main has no
7
- * interception point for a native console line (see
8
- * console-forward/index.ts's header comment) the only lever available is
9
- * the front-end's OWN Console filter setting.
2
+ * Hides dimina framework internal log lines from the right-panel
3
+ * (user-facing) Console, WITHOUT occupying the panel's visible text-filter
4
+ * box (see console-forward/internal-log.ts for the prefix judge this
5
+ * mirrors). The framework prints these via a plain `console.log` call INSIDE
6
+ * the inspected service host itself; main has no interception point for a
7
+ * native console line (see console-forward/index.ts's header comment), so the
8
+ * lever has to live inside the front-end.
10
9
  *
11
- * ── Mechanism ────────────────────────────────────────────────────────────
12
- * The Console panel's text filter is a Global/Synced DevTools setting. On
13
- * Chromium ~146 (post-M125 kebab-case renaming) that means TWO things a
14
- * naive `localStorage['console.textFilter']` write gets both wrong:
15
- * 1. The real setting name is kebab-case: `console.text-filter`.
16
- * 2. Global/Synced settings are NOT backed by `window.localStorage` at
17
- * all they go through `InspectorFrontendHost.getPreferences`
18
- * (async-callback read) / `.setPreference(key, jsonValue)` (sync
19
- * write). Values are themselves JSON-stringified (e.g. `'"elements"'`
20
- * for a string preference) — never a `localStorage` entry.
21
- * (An earlier version of this comment cited `localStorage['panel-selectedTab']`
22
- * as a "proven working" precedent for the localStorage approach — that was
23
- * itself a misreading: the console-default tab selection actually works via
24
- * a LIVE `UI.ViewManager.instance().showView('console')` call, not a
25
- * persisted setting; see native-simulator-devtools-host.ts's console-default
26
- * injection, which has since dropped the dead localStorage line alongside
27
- * this fix.)
28
- *
29
- * ── Disk persistence: verified NOT to apply to this custom host ───────────
30
- * A dedicated isolated e2e (`e2e/_diagnose-inspector-frontend-host.spec.ts`,
31
- * clean `electronApp.close()` — not `kill -9`, which never lets Electron
32
- * flush prefs and would confound the result) confirms `setPreference`/
33
- * `getPreferences` DO round-trip correctly in-process (this function's
34
- * output was read back byte-for-byte via the real production code path),
35
- * but for THIS custom devtools:// front-end host (a plain BrowserWindow we
36
- * point at `devtools://` ourselves, not Electron's native
37
- * `webContents.openDevTools()`) nothing under `electron.devtools.preferences`
38
- * — not even `panel-selected-tab` — survives to the on-disk Preferences
39
- * file on a clean shutdown. That's fine for this function's purpose: every
40
- * fresh launch starts with `existing === undefined`, so the `isUnset` branch
41
- * always (re-)applies the default — exactly the desired "always filtered by
42
- * default" behavior. The self-healing "stale mark" branch below still
43
- * matters WITHIN a single running process (e.g. re-pointing the front-end at
44
- * a new service host mid-session), where `getPreferences` reflects whatever
45
- * was `setPreference`d earlier in that same process, including a real user
46
- * customization typed into the filter box.
47
- *
48
- * `setPreference` values are themselves JSON-stringified (matching the
49
- * `'"elements"'` shape observed above). A NEGATIVE filter (`-/regex/`) is
50
- * DevTools' own "hide lines matching" syntax (the same `-` prefix a user
51
- * types into the filter box themselves).
52
- *
53
- * Only overwrites when the user hasn't set their OWN filter — never clobber
54
- * a real choice with this default. Re-injected on every (re)point like
55
- * customizeDevtoolsTabs, so a service-host pool swap re-applies it.
56
- *
57
- * Self-healing default: a companion `…dimina-default` key marks the value WE
58
- * last wrote. If `console.text-filter` still equals that mark, it is our own
59
- * prior default going stale (e.g. this DEFAULT_INTERNAL_LOG_FILTER regex
60
- * changing between releases), not a real user choice — safe to overwrite. A
61
- * value that differs from the mark is the user's own customization and is
62
- * left untouched. Without this, "only write when unset" permanently freezes
63
- * whatever default first got written (real dev-machine finding: an older
64
- * build's regex, missing the `[视图] ` prefix, survived across rebuilds and
65
- * silently never updated).
10
+ * ── Why not the text-filter box ──────────────────────────────────────────
11
+ * Writing `-/^\[service\]/` into the Console's filter input does hide the
12
+ * lines, but the string then sits in the box the developer uses for their own
13
+ * filtering: it looks like something they typed, it silently comes back after
14
+ * every re-point (an empty box is indistinguishable from "never set", so
15
+ * clearing it just invites the next injection to rewrite it), and it consumes
16
+ * the one filter slot the panel offers. Driving the panel's own visibility
17
+ * judge instead leaves the box genuinely empty and under the developer's sole
18
+ * control.
66
19
  *
67
- * This covers the persisted setting a FRESH (not-yet-constructed) Console
68
- * panel would read at boot. It does NOT by itself update an
69
- * ALREADY-constructed Console panel's live filter box real-machine
70
- * evidence (empirical probe against the actual bundled Console panel, this
71
- * session) showed the panel's own async bootstrap (Settings storage wiring,
72
- * i18n, ActionRegistry, …) can still be constructing itself well after
73
- * `applyConsoleFilter`'s injection point (right after `openDevTools()`,
74
- * gated on `did-stop-loading` the top document finishing load, NOT the
75
- * front-end's own panel construction), so this preference write can land
76
- * before OR after the panel reads it, and a "before" write does nothing for
77
- * that already-visible filter box. `buildLiveConsoleFilterScript` below
78
- * closes that gap by driving the panel's live filter object directly, with a
79
- * bounded poll (no fixed delay — there is no public "Console panel
80
- * constructed" event to await, only a checkable condition) standing in for
81
- * the missing event this repo's own conventions call for.
82
- */
83
- /**
84
- * DevTools negative-filter regex hiding the dimina framework's internal-log
85
- * lines (see console-forward/internal-log.ts's prefix judge) that have NO
86
- * other interception point: SERVICE-layer entries (`^\[service\]`) are
87
- * captured directly by the native CDP `Runtime.consoleAPICalled` attach on
88
- * the service host (service-host/preload.cjs deliberately does not
89
- * monkeypatch `console.*` there — see its header comment — so there is no
90
- * main-owned code between the framework's call and the attached DevTools).
91
- * This front-end filter is genuinely the only lever available for that half.
92
- *
93
- * RENDER-layer framework noise (`[system]`) no longer needs this filter:
94
- * `console-forward/index.ts`'s `forwardRenderToServiceHost` now gates on
95
- * `isInternalLogMessage` and simply never injects those entries into the
96
- * service host's console at all — filtered at the source (main-owned code),
97
- * so they never reach the right panel regardless of what a user types into
98
- * this box. `-/…/ ` is DevTools' own "exclude" filter syntax.
99
- */
100
- export declare const DEFAULT_INTERNAL_LOG_FILTER = "-/^\\[service\\]/";
101
- /**
102
- * Build the `executeJavaScript` source that seeds the Console panel's
103
- * negative filter via `InspectorFrontendHost`, unless the user already set
104
- * one of their own (or our own prior default has been customized away from).
105
- */
106
- export declare function buildConsoleFilterScript(negativeFilter?: string): string;
107
- /**
108
- * Build the `executeJavaScript` source that drives the Console panel's LIVE
109
- * filter object directly — the fix for the gap `buildConsoleFilterScript`'s
110
- * persisted-preference write cannot close (see this module's header
111
- * comment). Empirically discovered live API (real-machine probe against the
112
- * actual bundled `devtools://` Console panel, this session — not a guess):
113
- * `Console.ConsoleView.instance().filter` exposes `textFilterUI` (the
114
- * visible input box — `.setValue(text)` updates what the user sees) and
115
- * `updateCurrentFilter()` / `onFilterChanged()` (re-parses the box's value
116
- * into the filter actually applied to messages, and re-applies it to
117
- * already-shown AND future messages). Verified end-to-end: after this
118
- * sequence, a fresh `[service]`-prefixed message logged afterward is
119
- * immediately hidden, matching the already-shown ones.
20
+ * ── Mechanism ────────────────────────────────────────────────────────────
21
+ * `Console.ConsoleView.instance().filter.currentFilter` is the ConsoleFilter
22
+ * object the panel consults for every message, through its prototype method
23
+ * `shouldBeVisible(viewMessage)`. Wrapping that PROTOTYPE method (not the
24
+ * instance) rejects internal-log lines ahead of the panel's normal logic:
25
+ * - `currentFilter` is not the only ConsoleFilter the panel judges with:
26
+ * `ConsoleFilter.clone()` returns `new ConsoleFilter(...)`, and the
27
+ * sidebar filters through those clones. They share the prototype, so one
28
+ * patch covers all of them and keeps covering them if the panel ever
29
+ * replaces `currentFilter` outright. (Editing the filter box does NOT
30
+ * replace it today: `ConsoleViewFilter` builds `currentFilter` once in its
31
+ * constructor and `updateCurrentFilter()` mutates that same instance's
32
+ * `parsedFilters` / `levelsMask` / `executionContext` in place.)
33
+ * - The wrapper delegates to the original for everything else, so a
34
+ * developer's own filter keeps working exactly as before this only ever
35
+ * subtracts internal-log lines.
36
+ * Verified end-to-end against the real bundled front-end
37
+ * (e2e/console-filter-live.spec.ts): filter box reads empty, a `[service]`
38
+ * line logged afterwards stays hidden, an ordinary business log stays visible.
120
39
  *
121
- * Same "don't clobber a real user choice" contract as
122
- * `buildConsoleFilterScript`, judged against the LIVE box value instead of a
123
- * persisted one: only applies when the box currently reads empty (unset) or
124
- * already equals this exact default (re-applying is a harmless no-op,
125
- * correctly handles a re-point re-running this script against a panel that
126
- * already has it applied).
40
+ * This patches only the realm of the wc it is injected into — the right-panel
41
+ * front-end. The standalone floating debug window is a separate front-end with
42
+ * its own realm, and its content arrives by a different route entirely
43
+ * (main-side CDP capture console-forward global-console-mirror, which is
44
+ * deliberately UNFILTERED), so framework internals stay fully visible there.
45
+ * That window is the escape hatch for anyone who needs to read them.
127
46
  *
47
+ * ── Timing ───────────────────────────────────────────────────────────────
128
48
  * `Console.ConsoleView` has no lifecycle EVENT marking "fully constructed" —
129
- * only the checkable condition of whether calling `.instance()` and reaching
130
- * into `.filter.textFilterUI` throws. Retries on a bounded interval (see
131
- * `LIVE_FILTER_POLL_MAX_ATTEMPTS`/`_INTERVAL_MS`) rather than a single fixed
132
- * delay, and stops immediately on either success or a detected user
133
- * customization — it does not keep polling once there is nothing left to do.
49
+ * only the checkable condition of whether `.instance()` and the reach into
50
+ * `.filter.currentFilter` throw. The injection therefore retries on a bounded
51
+ * interval (see `LIVE_FILTER_POLL_MAX_ATTEMPTS`/`_INTERVAL_MS`) rather than
52
+ * guessing a fixed delay, and stops as soon as the wrapper is installed.
134
53
  *
135
54
  * Every tick gates on the front-end bootstrap probe BEFORE touching
136
55
  * `ConsoleView.instance()`: an early construction transitively creates
@@ -138,8 +57,38 @@ export declare function buildConsoleFilterScript(negativeFilter?: string): strin
138
57
  * (`ensureFirst` conflict in MainImpl.#createAppUI) — see
139
58
  * frontend-bootstrap-gate.ts for the full mechanism. The main process
140
59
  * additionally holds this whole injection behind `whenFrontendBootstrapped`;
141
- * the in-realm probe is defense in depth for any other caller of this
142
- * script builder.
60
+ * the in-realm probe is defense in depth for any other caller.
61
+ */
62
+ /**
63
+ * First-arg prefix marking a dimina SERVICE-layer framework log. A line counts
64
+ * as internal when its text IS this tag or starts with the tag plus a space —
65
+ * the same shape console-forward/internal-log.ts requires of the first arg, so
66
+ * a business line like '[service]业务状态' stays visible on both sides.
67
+ * These entries are captured
68
+ * directly by the native CDP `Runtime.consoleAPICalled` attach on the service
69
+ * host (service-host/preload.cjs deliberately does not monkeypatch
70
+ * `console.*` there — see its header comment — so there is no main-owned code
71
+ * between the framework's call and the attached DevTools), which is why the
72
+ * front-end is the only place they can be hidden.
73
+ *
74
+ * RENDER-layer framework noise (`[system]`) needs nothing here:
75
+ * `console-forward/index.ts`'s `forwardRenderToServiceHost` gates on
76
+ * `isInternalLogMessage` and never injects those entries into the service
77
+ * host's console at all — filtered at the source, in main-owned code.
78
+ */
79
+ export declare const INTERNAL_LOG_HIDDEN_PREFIX = "[service]";
80
+ /** Marker property stamped on the patched prototype, so a re-point re-running
81
+ * this script wraps once rather than nesting a wrapper per injection. Also
82
+ * the signal e2e specs read to tell "wrapper installed" from "not yet". */
83
+ export declare const INTERNAL_LOG_WRAPPER_MARK = "__diminaInternalLogHidden";
84
+ /**
85
+ * Build the `executeJavaScript` source that installs the internal-log
86
+ * visibility wrapper described in this module's header comment.
87
+ *
88
+ * Failure is loud but non-fatal: a front-end whose ConsoleFilter prototype has
89
+ * no `shouldBeVisible` (a future Chromium reshuffle) warns once and gives up
90
+ * rather than retrying a structurally absent surface — the panel then simply
91
+ * shows framework lines, which is the pre-existing behavior, not a breakage.
143
92
  */
144
- export declare function buildLiveConsoleFilterScript(negativeFilter?: string): string;
93
+ export declare function buildInternalLogHideScript(hiddenPrefix?: string): string;
145
94
  //# sourceMappingURL=console-filter.d.ts.map
@@ -1,185 +1,108 @@
1
1
  /**
2
- * Negative text-filter for the right-panel (user-facing) Console — hides
3
- * dimina framework internal log lines from the panel the mini-app author
4
- * watches (see console-forward/internal-log.ts for
5
- * the prefix judge this mirrors). The framework prints these via a plain
6
- * `console.log` call INSIDE the inspected service host itself; main has no
7
- * interception point for a native console line (see
8
- * console-forward/index.ts's header comment) the only lever available is
9
- * the front-end's OWN Console filter setting.
2
+ * Hides dimina framework internal log lines from the right-panel
3
+ * (user-facing) Console, WITHOUT occupying the panel's visible text-filter
4
+ * box (see console-forward/internal-log.ts for the prefix judge this
5
+ * mirrors). The framework prints these via a plain `console.log` call INSIDE
6
+ * the inspected service host itself; main has no interception point for a
7
+ * native console line (see console-forward/index.ts's header comment), so the
8
+ * lever has to live inside the front-end.
10
9
  *
11
- * ── Mechanism ────────────────────────────────────────────────────────────
12
- * The Console panel's text filter is a Global/Synced DevTools setting. On
13
- * Chromium ~146 (post-M125 kebab-case renaming) that means TWO things a
14
- * naive `localStorage['console.textFilter']` write gets both wrong:
15
- * 1. The real setting name is kebab-case: `console.text-filter`.
16
- * 2. Global/Synced settings are NOT backed by `window.localStorage` at
17
- * all they go through `InspectorFrontendHost.getPreferences`
18
- * (async-callback read) / `.setPreference(key, jsonValue)` (sync
19
- * write). Values are themselves JSON-stringified (e.g. `'"elements"'`
20
- * for a string preference) — never a `localStorage` entry.
21
- * (An earlier version of this comment cited `localStorage['panel-selectedTab']`
22
- * as a "proven working" precedent for the localStorage approach — that was
23
- * itself a misreading: the console-default tab selection actually works via
24
- * a LIVE `UI.ViewManager.instance().showView('console')` call, not a
25
- * persisted setting; see native-simulator-devtools-host.ts's console-default
26
- * injection, which has since dropped the dead localStorage line alongside
27
- * this fix.)
28
- *
29
- * ── Disk persistence: verified NOT to apply to this custom host ───────────
30
- * A dedicated isolated e2e (`e2e/_diagnose-inspector-frontend-host.spec.ts`,
31
- * clean `electronApp.close()` — not `kill -9`, which never lets Electron
32
- * flush prefs and would confound the result) confirms `setPreference`/
33
- * `getPreferences` DO round-trip correctly in-process (this function's
34
- * output was read back byte-for-byte via the real production code path),
35
- * but for THIS custom devtools:// front-end host (a plain BrowserWindow we
36
- * point at `devtools://` ourselves, not Electron's native
37
- * `webContents.openDevTools()`) nothing under `electron.devtools.preferences`
38
- * — not even `panel-selected-tab` — survives to the on-disk Preferences
39
- * file on a clean shutdown. That's fine for this function's purpose: every
40
- * fresh launch starts with `existing === undefined`, so the `isUnset` branch
41
- * always (re-)applies the default — exactly the desired "always filtered by
42
- * default" behavior. The self-healing "stale mark" branch below still
43
- * matters WITHIN a single running process (e.g. re-pointing the front-end at
44
- * a new service host mid-session), where `getPreferences` reflects whatever
45
- * was `setPreference`d earlier in that same process, including a real user
46
- * customization typed into the filter box.
10
+ * ── Why not the text-filter box ──────────────────────────────────────────
11
+ * Writing `-/^\[service\]/` into the Console's filter input does hide the
12
+ * lines, but the string then sits in the box the developer uses for their own
13
+ * filtering: it looks like something they typed, it silently comes back after
14
+ * every re-point (an empty box is indistinguishable from "never set", so
15
+ * clearing it just invites the next injection to rewrite it), and it consumes
16
+ * the one filter slot the panel offers. Driving the panel's own visibility
17
+ * judge instead leaves the box genuinely empty and under the developer's sole
18
+ * control.
47
19
  *
48
- * `setPreference` values are themselves JSON-stringified (matching the
49
- * `'"elements"'` shape observed above). A NEGATIVE filter (`-/regex/`) is
50
- * DevTools' own "hide lines matching" syntax (the same `-` prefix a user
51
- * types into the filter box themselves).
20
+ * ── Mechanism ────────────────────────────────────────────────────────────
21
+ * `Console.ConsoleView.instance().filter.currentFilter` is the ConsoleFilter
22
+ * object the panel consults for every message, through its prototype method
23
+ * `shouldBeVisible(viewMessage)`. Wrapping that PROTOTYPE method (not the
24
+ * instance) rejects internal-log lines ahead of the panel's normal logic:
25
+ * - `currentFilter` is not the only ConsoleFilter the panel judges with:
26
+ * `ConsoleFilter.clone()` returns `new ConsoleFilter(...)`, and the
27
+ * sidebar filters through those clones. They share the prototype, so one
28
+ * patch covers all of them — and keeps covering them if the panel ever
29
+ * replaces `currentFilter` outright. (Editing the filter box does NOT
30
+ * replace it today: `ConsoleViewFilter` builds `currentFilter` once in its
31
+ * constructor and `updateCurrentFilter()` mutates that same instance's
32
+ * `parsedFilters` / `levelsMask` / `executionContext` in place.)
33
+ * - The wrapper delegates to the original for everything else, so a
34
+ * developer's own filter keeps working exactly as before — this only ever
35
+ * subtracts internal-log lines.
36
+ * Verified end-to-end against the real bundled front-end
37
+ * (e2e/console-filter-live.spec.ts): filter box reads empty, a `[service]`
38
+ * line logged afterwards stays hidden, an ordinary business log stays visible.
52
39
  *
53
- * Only overwrites when the user hasn't set their OWN filternever clobber
54
- * a real choice with this default. Re-injected on every (re)point like
55
- * customizeDevtoolsTabs, so a service-host pool swap re-applies it.
40
+ * This patches only the realm of the wc it is injected into the right-panel
41
+ * front-end. The standalone floating debug window is a separate front-end with
42
+ * its own realm, and its content arrives by a different route entirely
43
+ * (main-side CDP capture → console-forward → global-console-mirror, which is
44
+ * deliberately UNFILTERED), so framework internals stay fully visible there.
45
+ * That window is the escape hatch for anyone who needs to read them.
56
46
  *
57
- * Self-healing default: a companion `…dimina-default` key marks the value WE
58
- * last wrote. If `console.text-filter` still equals that mark, it is our own
59
- * prior default going stale (e.g. this DEFAULT_INTERNAL_LOG_FILTER regex
60
- * changing between releases), not a real user choice — safe to overwrite. A
61
- * value that differs from the mark is the user's own customization and is
62
- * left untouched. Without this, "only write when unset" permanently freezes
63
- * whatever default first got written (real dev-machine finding: an older
64
- * build's regex, missing the `[视图] ` prefix, survived across rebuilds and
65
- * silently never updated).
47
+ * ── Timing ───────────────────────────────────────────────────────────────
48
+ * `Console.ConsoleView` has no lifecycle EVENT marking "fully constructed"
49
+ * only the checkable condition of whether `.instance()` and the reach into
50
+ * `.filter.currentFilter` throw. The injection therefore retries on a bounded
51
+ * interval (see `LIVE_FILTER_POLL_MAX_ATTEMPTS`/`_INTERVAL_MS`) rather than
52
+ * guessing a fixed delay, and stops as soon as the wrapper is installed.
66
53
  *
67
- * This covers the persisted setting a FRESH (not-yet-constructed) Console
68
- * panel would read at boot. It does NOT by itself update an
69
- * ALREADY-constructed Console panel's live filter box real-machine
70
- * evidence (empirical probe against the actual bundled Console panel, this
71
- * session) showed the panel's own async bootstrap (Settings storage wiring,
72
- * i18n, ActionRegistry, …) can still be constructing itself well after
73
- * `applyConsoleFilter`'s injection point (right after `openDevTools()`,
74
- * gated on `did-stop-loading` — the top document finishing load, NOT the
75
- * front-end's own panel construction), so this preference write can land
76
- * before OR after the panel reads it, and a "before" write does nothing for
77
- * that already-visible filter box. `buildLiveConsoleFilterScript` below
78
- * closes that gap by driving the panel's live filter object directly, with a
79
- * bounded poll (no fixed delay — there is no public "Console panel
80
- * constructed" event to await, only a checkable condition) standing in for
81
- * the missing event this repo's own conventions call for.
54
+ * Every tick gates on the front-end bootstrap probe BEFORE touching
55
+ * `ConsoleView.instance()`: an early construction transitively creates
56
+ * IssuesManager and permanently kills the front-end's own bootstrap
57
+ * (`ensureFirst` conflict in MainImpl.#createAppUI) see
58
+ * frontend-bootstrap-gate.ts for the full mechanism. The main process
59
+ * additionally holds this whole injection behind `whenFrontendBootstrapped`;
60
+ * the in-realm probe is defense in depth for any other caller.
82
61
  */
83
62
  /**
84
- * DevTools negative-filter regex hiding the dimina framework's internal-log
85
- * lines (see console-forward/internal-log.ts's prefix judge) that have NO
86
- * other interception point: SERVICE-layer entries (`^\[service\]`) are
87
- * captured directly by the native CDP `Runtime.consoleAPICalled` attach on
88
- * the service host (service-host/preload.cjs deliberately does not
89
- * monkeypatch `console.*` there see its header comment so there is no
90
- * main-owned code between the framework's call and the attached DevTools).
91
- * This front-end filter is genuinely the only lever available for that half.
63
+ * First-arg prefix marking a dimina SERVICE-layer framework log. A line counts
64
+ * as internal when its text IS this tag or starts with the tag plus a space —
65
+ * the same shape console-forward/internal-log.ts requires of the first arg, so
66
+ * a business line like '[service]业务状态' stays visible on both sides.
67
+ * These entries are captured
68
+ * directly by the native CDP `Runtime.consoleAPICalled` attach on the service
69
+ * host (service-host/preload.cjs deliberately does not monkeypatch
70
+ * `console.*` there see its header comment so there is no main-owned code
71
+ * between the framework's call and the attached DevTools), which is why the
72
+ * front-end is the only place they can be hidden.
92
73
  *
93
- * RENDER-layer framework noise (`[system]`) no longer needs this filter:
94
- * `console-forward/index.ts`'s `forwardRenderToServiceHost` now gates on
95
- * `isInternalLogMessage` and simply never injects those entries into the
96
- * service host's console at all — filtered at the source (main-owned code),
97
- * so they never reach the right panel regardless of what a user types into
98
- * this box. `-/…/ ` is DevTools' own "exclude" filter syntax.
99
- */
100
- export const DEFAULT_INTERNAL_LOG_FILTER = '-/^\\[service\\]/';
101
- /**
102
- * Build the `executeJavaScript` source that seeds the Console panel's
103
- * negative filter via `InspectorFrontendHost`, unless the user already set
104
- * one of their own (or our own prior default has been customized away from).
74
+ * RENDER-layer framework noise (`[system]`) needs nothing here:
75
+ * `console-forward/index.ts`'s `forwardRenderToServiceHost` gates on
76
+ * `isInternalLogMessage` and never injects those entries into the service
77
+ * host's console at all — filtered at the source, in main-owned code.
105
78
  */
106
- export function buildConsoleFilterScript(negativeFilter = DEFAULT_INTERNAL_LOG_FILTER) {
107
- const keyJson = JSON.stringify('console.text-filter');
108
- const markKeyJson = JSON.stringify('console.text-filter.dimina-default');
109
- // The stored preference value is itself JSON-stringified (mirrors the
110
- // real host's own `'"elements"'`-shaped entries).
111
- const valueJsonLiteral = JSON.stringify(JSON.stringify(negativeFilter));
112
- return `(function(){try{
113
- var IFH = globalThis.InspectorFrontendHost;
114
- if (!IFH || typeof IFH.getPreferences !== 'function' || typeof IFH.setPreference !== 'function') return;
115
- IFH.getPreferences(function(prefs){
116
- try {
117
- var KEY = ${keyJson};
118
- var MARK_KEY = ${markKeyJson};
119
- var VALUE = ${valueJsonLiteral};
120
- var existing = prefs ? prefs[KEY] : undefined;
121
- var mark = prefs ? prefs[MARK_KEY] : undefined;
122
- var isUnset = existing === undefined || existing === null || existing === '' || existing === '""';
123
- var isOurStaleDefault = !isUnset && mark !== undefined && mark !== null && existing === mark;
124
- if (isUnset || isOurStaleDefault) {
125
- IFH.setPreference(KEY, VALUE);
126
- IFH.setPreference(MARK_KEY, VALUE);
127
- }
128
- } catch(_){}
129
- });
130
- }catch(_){}})()`;
131
- }
132
- // Bound on how long `buildLiveConsoleFilterScript`'s in-realm poll retries
133
- // before giving up — mirrors this module's other bounded waits (e.g.
134
- // internal-devtools-window's CLOSE_WATCHDOG_MS): wait for the real condition,
135
- // but never forever. `Console.ConsoleView` was observed (real-machine probe,
136
- // this session) fully constructible well within a few seconds of the
137
- // front-end's document settling; this leaves generous headroom.
79
+ export const INTERNAL_LOG_HIDDEN_PREFIX = '[service]';
80
+ /** Marker property stamped on the patched prototype, so a re-point re-running
81
+ * this script wraps once rather than nesting a wrapper per injection. Also
82
+ * the signal e2e specs read to tell "wrapper installed" from "not yet". */
83
+ export const INTERNAL_LOG_WRAPPER_MARK = '__diminaInternalLogHidden';
84
+ // Bound on how long the in-realm poll retries before giving up — mirrors this
85
+ // module's other bounded waits (e.g. internal-devtools-window's
86
+ // CLOSE_WATCHDOG_MS): wait for the real condition, but never forever.
138
87
  const LIVE_FILTER_POLL_MAX_ATTEMPTS = 100;
139
88
  const LIVE_FILTER_POLL_INTERVAL_MS = 100;
140
89
  /**
141
- * Build the `executeJavaScript` source that drives the Console panel's LIVE
142
- * filter object directly the fix for the gap `buildConsoleFilterScript`'s
143
- * persisted-preference write cannot close (see this module's header
144
- * comment). Empirically discovered live API (real-machine probe against the
145
- * actual bundled `devtools://` Console panel, this session — not a guess):
146
- * `Console.ConsoleView.instance().filter` exposes `textFilterUI` (the
147
- * visible input box — `.setValue(text)` updates what the user sees) and
148
- * `updateCurrentFilter()` / `onFilterChanged()` (re-parses the box's value
149
- * into the filter actually applied to messages, and re-applies it to
150
- * already-shown AND future messages). Verified end-to-end: after this
151
- * sequence, a fresh `[service]`-prefixed message logged afterward is
152
- * immediately hidden, matching the already-shown ones.
153
- *
154
- * Same "don't clobber a real user choice" contract as
155
- * `buildConsoleFilterScript`, judged against the LIVE box value instead of a
156
- * persisted one: only applies when the box currently reads empty (unset) or
157
- * already equals this exact default (re-applying is a harmless no-op,
158
- * correctly handles a re-point re-running this script against a panel that
159
- * already has it applied).
90
+ * Build the `executeJavaScript` source that installs the internal-log
91
+ * visibility wrapper described in this module's header comment.
160
92
  *
161
- * `Console.ConsoleView` has no lifecycle EVENT marking "fully constructed"
162
- * only the checkable condition of whether calling `.instance()` and reaching
163
- * into `.filter.textFilterUI` throws. Retries on a bounded interval (see
164
- * `LIVE_FILTER_POLL_MAX_ATTEMPTS`/`_INTERVAL_MS`) rather than a single fixed
165
- * delay, and stops immediately on either success or a detected user
166
- * customization — it does not keep polling once there is nothing left to do.
167
- *
168
- * Every tick gates on the front-end bootstrap probe BEFORE touching
169
- * `ConsoleView.instance()`: an early construction transitively creates
170
- * IssuesManager and permanently kills the front-end's own bootstrap
171
- * (`ensureFirst` conflict in MainImpl.#createAppUI) — see
172
- * frontend-bootstrap-gate.ts for the full mechanism. The main process
173
- * additionally holds this whole injection behind `whenFrontendBootstrapped`;
174
- * the in-realm probe is defense in depth for any other caller of this
175
- * script builder.
93
+ * Failure is loud but non-fatal: a front-end whose ConsoleFilter prototype has
94
+ * no `shouldBeVisible` (a future Chromium reshuffle) warns once and gives up
95
+ * rather than retrying a structurally absent surface the panel then simply
96
+ * shows framework lines, which is the pre-existing behavior, not a breakage.
176
97
  */
177
- export function buildLiveConsoleFilterScript(negativeFilter = DEFAULT_INTERNAL_LOG_FILTER) {
178
- const filterJson = JSON.stringify(negativeFilter);
98
+ export function buildInternalLogHideScript(hiddenPrefix = INTERNAL_LOG_HIDDEN_PREFIX) {
99
+ const prefixJson = JSON.stringify(hiddenPrefix);
100
+ const markJson = JSON.stringify(INTERNAL_LOG_WRAPPER_MARK);
179
101
  const maxAttempts = JSON.stringify(LIVE_FILTER_POLL_MAX_ATTEMPTS);
180
102
  const intervalMs = JSON.stringify(LIVE_FILTER_POLL_INTERVAL_MS);
181
103
  return `(function(){
182
- var VALUE = ${filterJson};
104
+ var PREFIX = ${prefixJson};
105
+ var MARK = ${markJson};
183
106
  var attempts = 0;
184
107
  function bootstrapReady() {
185
108
  try {
@@ -189,42 +112,76 @@ export function buildLiveConsoleFilterScript(negativeFilter = DEFAULT_INTERNAL_L
189
112
  return true;
190
113
  } catch (_) { return false; }
191
114
  }
115
+ function isInternalLog(viewMessage) {
116
+ try {
117
+ var msg = viewMessage && typeof viewMessage.consoleMessage === 'function' ? viewMessage.consoleMessage() : null;
118
+ var text = msg ? String(msg.messageText == null ? '' : msg.messageText) : '';
119
+ // Exact tag (the rest of the line is in later arguments), or the tag
120
+ // followed by a space — same shape as main's isInternalLogMessage. A
121
+ // bare prefix test would also swallow '[service]业务状态', an ordinary
122
+ // business log the panel must keep showing.
123
+ return text === PREFIX || text.indexOf(PREFIX + ' ') === 0;
124
+ } catch (_) { return false; }
125
+ }
192
126
  function tryApply() {
193
127
  attempts++;
194
128
  var scheduleRetry = attempts < ${maxAttempts};
129
+ // Distinguishes the two halves of this script when the tail throws:
130
+ // future messages are already handled once the wrapper is on the
131
+ // prototype, even if re-judging the rows already on screen keeps failing.
132
+ var wrapperInstalled = false;
195
133
  // In-realm bootstrap probe FIRST (defense in depth on top of the
196
134
  // main-process whenFrontendBootstrapped gate): touching
197
- // Console.ConsoleView.instance() before the front-end's own
198
- // MainImpl bootstrap completes constructs IssuesManager early and
199
- // permanently kills that bootstrap (ensureFirst conflict) — the probe
200
- // throws BEFORE constructing anything, so a not-ready tick costs
201
- // nothing and never touches ConsoleView.
135
+ // Console.ConsoleView.instance() before the front-end's own MainImpl
136
+ // bootstrap completes constructs IssuesManager early and permanently
137
+ // kills that bootstrap (ensureFirst conflict) — the probe throws BEFORE
138
+ // constructing anything, so a not-ready tick costs nothing.
202
139
  if (!bootstrapReady()) {
203
140
  if (scheduleRetry) { setTimeout(tryApply, ${intervalMs}); return; }
204
- console.warn('[console-filter] gave up applying the live Console filter after ' + attempts + ' attempts — the front-end bootstrap never completed');
141
+ console.warn('[console-filter] gave up hiding internal logs after ' + attempts + ' attempts — the front-end bootstrap never completed');
205
142
  return;
206
143
  }
207
144
  try {
208
145
  var ConsoleNS = globalThis.Console;
209
146
  var view = ConsoleNS && ConsoleNS.ConsoleView ? ConsoleNS.ConsoleView.instance() : null;
210
147
  var f = view ? view.filter : null;
211
- if (!f || !f.textFilterUI || typeof f.textFilterUI.setValue !== 'function' || typeof f.textFilterUI.value !== 'function') {
148
+ var currentFilter = f ? f.currentFilter : null;
149
+ if (!currentFilter) {
212
150
  if (scheduleRetry) { setTimeout(tryApply, ${intervalMs}); return; }
213
- console.warn('[console-filter] gave up applying the live Console filter after ' + attempts + ' attempts — Console.ConsoleView never became usable');
151
+ console.warn('[console-filter] gave up hiding internal logs after ' + attempts + ' attempts — Console.ConsoleView never became usable');
214
152
  return;
215
153
  }
216
- var current = f.textFilterUI.value();
217
- var isUnset = current === undefined || current === null || current === '';
218
- var isOurDefault = current === VALUE;
219
- if (isUnset || isOurDefault) {
220
- f.textFilterUI.setValue(VALUE);
221
- if (typeof f.updateCurrentFilter === 'function') f.updateCurrentFilter();
222
- if (typeof f.onFilterChanged === 'function') f.onFilterChanged();
154
+ // The prototype, NOT the instance: clone() mints further ConsoleFilters
155
+ // that judge the same messages, and they all share this one.
156
+ var proto = Object.getPrototypeOf(currentFilter);
157
+ if (!proto || typeof proto.shouldBeVisible !== 'function') {
158
+ console.warn('[console-filter] cannot hide internal logs — ConsoleFilter has no shouldBeVisible to wrap; framework log lines will show in the right panel');
159
+ return;
160
+ }
161
+ if (!proto[MARK]) {
162
+ var original = proto.shouldBeVisible;
163
+ proto.shouldBeVisible = function(viewMessage) {
164
+ if (isInternalLog(viewMessage)) return false;
165
+ return original.apply(this, arguments);
166
+ };
167
+ proto[MARK] = true;
168
+ }
169
+ wrapperInstalled = true;
170
+ // Re-run the panel's visibility pass so lines already on screen when
171
+ // the wrapper lands are re-judged, not just future ones.
172
+ if (view && typeof view.onFilterChanged === 'function') view.onFilterChanged();
173
+ } catch(err) {
174
+ if (scheduleRetry) { setTimeout(tryApply, ${intervalMs}); return; }
175
+ // Name which half survived: a wrapper that installed but could never
176
+ // refresh still hides everything logged from now on, and the panel is
177
+ // left holding the internal lines printed before it landed. Reporting
178
+ // that as plain "gave up" would send the next reader looking for a
179
+ // filter that is in fact working.
180
+ if (wrapperInstalled) {
181
+ console.warn('[console-filter] internal logs are hidden from here on, but the rows already on screen could not be re-judged:', err);
182
+ } else {
183
+ console.warn('[console-filter] gave up hiding internal logs after ' + attempts + ' attempts:', err);
223
184
  }
224
- // Either applied, or a real user customization was detected — both
225
- // are terminal: nothing left for a later retry to accomplish.
226
- } catch(_) {
227
- if (scheduleRetry) setTimeout(tryApply, ${intervalMs});
228
185
  }
229
186
  }
230
187
  tryApply();