@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.
- package/dist/main/api.d.ts +1 -1
- package/dist/main/app/app.js +66 -2
- package/dist/main/index.bundle.js +1454 -540
- package/dist/main/ipc/index.d.ts +3 -0
- package/dist/main/ipc/index.js +3 -0
- package/dist/main/ipc/popover.js +1 -1
- package/dist/main/ipc/project-create.d.ts +15 -0
- package/dist/main/ipc/project-create.js +26 -0
- package/dist/main/ipc/projects.d.ts +1 -1
- package/dist/main/ipc/projects.js +11 -0
- package/dist/main/ipc/session.js +11 -0
- package/dist/main/ipc/settings.js +2 -1
- package/dist/main/ipc/simulator-module.d.ts +4 -3
- package/dist/main/ipc/simulator-module.js +4 -5
- package/dist/main/ipc/tooltip.d.ts +13 -0
- package/dist/main/ipc/tooltip.js +28 -0
- package/dist/main/ipc/views.d.ts +15 -1
- package/dist/main/ipc/views.js +61 -4
- package/dist/main/runtime/miniapp-runtime.d.ts +87 -19
- package/dist/main/services/layout/index.d.ts +11 -0
- package/dist/main/services/layout/index.js +23 -0
- package/dist/main/services/network-forward/frontend-dispatch.js +2 -1
- package/dist/main/services/notifications/renderer-notifier.d.ts +32 -1
- package/dist/main/services/notifications/renderer-notifier.js +29 -1
- package/dist/main/services/projects/project-repository.d.ts +4 -1
- package/dist/main/services/projects/project-repository.js +63 -5
- package/dist/main/services/simulator-current-page/index.d.ts +5 -3
- package/dist/main/services/simulator-current-page/index.js +8 -1
- package/dist/main/services/update/update-manager.d.ts +17 -3
- package/dist/main/services/update/update-manager.js +25 -6
- package/dist/main/services/views/clear-console-filter.d.ts +44 -0
- package/dist/main/services/views/clear-console-filter.js +86 -0
- package/dist/main/services/views/console-filter-test-fixtures.d.ts +94 -0
- package/dist/main/services/views/console-filter-test-fixtures.js +82 -0
- package/dist/main/services/views/console-filter.d.ts +79 -130
- package/dist/main/services/views/console-filter.js +140 -183
- package/dist/main/services/views/devtools-tabs.d.ts +24 -4
- package/dist/main/services/views/devtools-tabs.js +40 -21
- package/dist/main/services/views/host-dialog-port-channel.d.ts +18 -0
- package/dist/main/services/views/host-dialog-port-channel.js +15 -0
- package/dist/main/services/views/host-dialog-session-runtime.d.ts +10 -0
- package/dist/main/services/views/host-dialog-session-runtime.js +17 -0
- package/dist/main/services/views/host-dialog-view.d.ts +95 -0
- package/dist/main/services/views/host-dialog-view.js +147 -0
- package/dist/main/services/views/host-sidebar-port-channel.d.ts +18 -0
- package/dist/main/services/views/host-sidebar-port-channel.js +15 -0
- package/dist/main/services/views/host-sidebar-session-runtime.d.ts +10 -0
- package/dist/main/services/views/host-sidebar-session-runtime.js +17 -0
- package/dist/main/services/views/host-sidebar-view.d.ts +59 -0
- package/dist/main/services/views/host-sidebar-view.js +44 -0
- package/dist/main/services/views/host-slot-port-channel.d.ts +107 -0
- package/dist/main/services/views/host-slot-port-channel.js +261 -0
- package/dist/main/services/views/host-slot-session-runtime.d.ts +40 -0
- package/dist/main/services/views/host-slot-session-runtime.js +50 -0
- package/dist/main/services/views/host-slot-view.d.ts +109 -0
- package/dist/main/services/views/host-slot-view.js +147 -0
- package/dist/main/services/views/host-toolbar-port-channel.d.ts +6 -91
- package/dist/main/services/views/host-toolbar-port-channel.js +10 -243
- package/dist/main/services/views/host-toolbar-session-runtime.d.ts +5 -30
- package/dist/main/services/views/host-toolbar-session-runtime.js +9 -47
- package/dist/main/services/views/host-toolbar-view.d.ts +34 -7
- package/dist/main/services/views/host-toolbar-view.js +30 -237
- package/dist/main/services/views/managed-web-contents-view.d.ts +48 -0
- package/dist/main/services/views/managed-web-contents-view.js +123 -0
- package/dist/main/services/views/native-simulator-devtools-host.js +64 -45
- package/dist/main/services/views/native-simulator-view.js +6 -24
- package/dist/main/services/views/native-view-tree.d.ts +25 -0
- package/dist/main/services/views/native-view-tree.js +69 -0
- package/dist/main/services/views/overlay-panels-view.d.ts +50 -4
- package/dist/main/services/views/overlay-panels-view.js +226 -108
- package/dist/main/services/views/placement-reconciler.d.ts +18 -18
- package/dist/main/services/views/placement-reconciler.js +91 -29
- package/dist/main/services/views/placement-test-driver.d.ts +27 -0
- package/dist/main/services/views/placement-test-driver.js +29 -0
- package/dist/main/services/views/view-manager-devtools-host-test-fixtures.js +3 -1
- package/dist/main/services/views/view-manager.d.ts +14 -86
- package/dist/main/services/views/view-manager.js +41 -4
- package/dist/main/services/views/workbench-view.js +27 -20
- package/dist/main/services/workbench-coi-server.d.ts +11 -0
- package/dist/main/services/workbench-coi-server.js +32 -0
- package/dist/main/services/workspace/rebuild-status.d.ts +21 -8
- package/dist/main/services/workspace/rebuild-status.js +24 -8
- package/dist/main/utils/paths.d.ts +4 -0
- package/dist/main/utils/paths.js +4 -0
- package/dist/main/utils/sender-policy.d.ts +1 -1
- package/dist/main/utils/sender-policy.js +16 -1
- package/dist/main/utils/theme.d.ts +7 -2
- package/dist/main/utils/theme.js +8 -3
- package/dist/native-host/common/common.js +65 -62
- package/dist/native-host/container/pageFrame.css +1 -1
- package/dist/native-host/render/render.js +3226 -2898
- package/dist/native-host/service/service.js +2 -2
- package/dist/preload/runtime/host-dialog-advertiser.d.ts +22 -0
- package/dist/preload/runtime/host-dialog-advertiser.js +37 -0
- package/dist/preload/runtime/host-dialog-port.d.ts +44 -0
- package/dist/preload/runtime/host-dialog-port.js +53 -0
- package/dist/preload/runtime/host-dialog-runtime.d.ts +28 -0
- package/dist/preload/runtime/host-dialog-runtime.js +36 -0
- package/dist/preload/runtime/host-sidebar-advertiser.d.ts +19 -0
- package/dist/preload/runtime/host-sidebar-advertiser.js +35 -0
- package/dist/preload/runtime/host-sidebar-port.d.ts +44 -0
- package/dist/preload/runtime/host-sidebar-port.js +53 -0
- package/dist/preload/runtime/host-sidebar-runtime.d.ts +28 -0
- package/dist/preload/runtime/host-sidebar-runtime.js +36 -0
- package/dist/preload/runtime/host-slot-port-bridge.d.ts +18 -0
- package/dist/preload/runtime/host-slot-port-bridge.js +112 -0
- package/dist/preload/runtime/host-toolbar-advertiser.d.ts +5 -13
- package/dist/preload/runtime/host-toolbar-advertiser.js +18 -38
- package/dist/preload/runtime/host-toolbar-port.d.ts +9 -0
- package/dist/preload/runtime/host-toolbar-port.js +11 -95
- package/dist/preload/runtime/wait-for-slot-root.d.ts +20 -0
- package/dist/preload/runtime/wait-for-slot-root.js +52 -0
- package/dist/preload/windows/host-dialog-runtime.cjs +353 -0
- package/dist/preload/windows/host-dialog-runtime.cjs.map +7 -0
- package/dist/preload/windows/host-dialog-runtime.d.ts +2 -0
- package/dist/preload/windows/host-dialog-runtime.js +13 -0
- package/dist/preload/windows/host-sidebar-runtime.cjs +354 -0
- package/dist/preload/windows/host-sidebar-runtime.cjs.map +7 -0
- package/dist/preload/windows/host-sidebar-runtime.d.ts +2 -0
- package/dist/preload/windows/host-sidebar-runtime.js +13 -0
- package/dist/preload/windows/host-toolbar-runtime.cjs +134 -51
- package/dist/preload/windows/host-toolbar-runtime.cjs.map +3 -3
- package/dist/preload/windows/main.cjs +3176 -14
- package/dist/preload/windows/main.cjs.map +4 -4
- package/dist/preload/windows/main.css +428 -0
- package/dist/preload/windows/main.css.map +7 -0
- package/dist/preload/windows/simulator.cjs +5 -2
- package/dist/preload/windows/simulator.cjs.map +2 -2
- package/dist/preload/windows/simulator.js +5 -2
- package/dist/renderer/assets/button-DsNqZm7o.js +2 -0
- package/dist/renderer/assets/constants-D7DfVqMp.js +2 -0
- package/dist/renderer/assets/constants-D8zsejFq.js +2 -0
- package/dist/renderer/assets/createLucideIcon-CYJeT1ji.js +2 -0
- package/dist/renderer/assets/dialog-pT4qWmka.js +46 -0
- package/dist/renderer/assets/dist-o70xmpc1.js +2 -0
- package/dist/renderer/assets/hostSidebarDefault-NvGZlE9O.js +2 -0
- package/dist/renderer/assets/index-zErhG3ta.js +5 -0
- package/dist/renderer/assets/input-4QxTXMZN.js +2 -0
- package/dist/renderer/assets/ipc-channels-overlays-Blr5TNoB.js +2 -0
- package/dist/renderer/assets/jsx-runtime-B-3rq1y5.css +1 -0
- package/dist/renderer/assets/jsx-runtime-CqVdW3eg.js +9 -0
- package/dist/renderer/assets/popover-CJiSWwuE.js +2 -0
- package/dist/renderer/assets/project-api-DZ1Zi6EC.js +2 -0
- package/dist/renderer/assets/projectCreateDialog-DMWNhw_1.js +2 -0
- package/dist/renderer/assets/select-C86pNcsu.js +2 -0
- package/dist/renderer/assets/settings-BoI8mLT1.js +2 -0
- package/dist/renderer/assets/settings-api-Bs_g4NHs.js +2 -0
- package/dist/renderer/assets/settings-tab-bar-DHLLygqv.js +2 -0
- package/dist/renderer/assets/tooltip-BhAyY0T4.js +2 -0
- package/dist/renderer/assets/types-YYjkvane.js +2 -0
- package/dist/renderer/assets/updateDialog-DPum3wx1.js +2 -0
- package/dist/renderer/assets/utils-kfQov6Pa.js +2 -0
- package/dist/renderer/assets/view-api-DFhb2R8-.js +2 -0
- package/dist/renderer/assets/workbenchSettings-DrajRQUk.js +8 -0
- package/dist/renderer/entries/host-sidebar-default/index.html +21 -0
- package/dist/renderer/entries/main/index.html +15 -7
- package/dist/renderer/entries/popover/index.html +10 -6
- package/dist/renderer/entries/project-create-dialog/index.html +27 -0
- package/dist/renderer/entries/settings/index.html +10 -5
- package/dist/renderer/entries/tooltip/index.html +21 -0
- package/dist/renderer/entries/update-dialog/index.html +25 -0
- package/dist/renderer/entries/workbench-settings/index.html +11 -5
- package/dist/service-host/preload.cjs +10 -0
- package/dist/service-host/sync-impls/menu-button-geometry.js +1 -0
- package/dist/shared/constants.d.ts +22 -0
- package/dist/shared/constants.js +22 -0
- package/dist/shared/ipc-channels-overlays.d.ts +156 -0
- package/dist/shared/ipc-channels-overlays.js +186 -0
- package/dist/shared/ipc-channels.d.ts +1 -67
- package/dist/shared/ipc-channels.js +9 -81
- package/dist/shared/ipc-schemas.d.ts +52 -0
- package/dist/shared/ipc-schemas.js +64 -0
- package/dist/shared/simulator-route.d.ts +8 -0
- package/dist/shared/simulator-route.js +15 -0
- package/dist/shared/types.d.ts +17 -0
- package/dist/shared/view-ids.d.ts +9 -0
- package/dist/shared/view-ids.js +21 -0
- package/dist/simulator/assets/device-shell-CmtM1QxP.js +2 -0
- package/dist/simulator/assets/device-shell-iFZo1igL.css +1 -0
- package/dist/simulator/assets/{simulator-COIE6R49.js → simulator-CIobn3Mh.js} +6 -6
- package/dist/simulator/assets/{simulator-mini-app-BLn7XV8e.js → simulator-mini-app-CRe6n9br.js} +2 -2
- package/dist/simulator/assets/simulator-ui-BupATgKo.css +1 -0
- package/dist/simulator/assets/simulator-ui-C_cP602X.js +2 -0
- package/dist/simulator/simulator.html +3 -2
- package/dist/vscode-workbench/assets/__vite-browser-external-Bc1vizTf.js +1 -0
- package/dist/vscode-workbench/assets/{dist-oHcwN53f.js → dist-CMfmHflW.js} +3 -3
- package/dist/vscode-workbench/assets/{iconv-lite-umd-CLMLpdGm.js → iconv-lite-umd-Bx8CgaZq.js} +1 -1
- package/dist/vscode-workbench/assets/{index-BE3UJdoH.js → index-CdG6YWhW.js} +436 -436
- package/dist/vscode-workbench/assets/{jschardet-BICW8PLJ.js → jschardet-M0qgd2lN.js} +1 -1
- package/dist/vscode-workbench/index.html +21 -1
- package/package.json +9 -8
- package/dist/main/services/views/destroy-child-view.d.ts +0 -9
- package/dist/main/services/views/destroy-child-view.js +0 -23
- package/dist/renderer/assets/constants-EAMiwL9_.js +0 -2
- package/dist/renderer/assets/index-BBg3YI5b.js +0 -49
- package/dist/renderer/assets/input-xdmfv-eH.js +0 -2
- package/dist/renderer/assets/ipc-transport-B3EpmfNS.js +0 -9
- package/dist/renderer/assets/ipc-transport-Blac3sOj.css +0 -1
- package/dist/renderer/assets/popover-B88e2hkg.js +0 -2
- package/dist/renderer/assets/select-CD9CJyhI.js +0 -2
- package/dist/renderer/assets/settings-44hf0QtO.js +0 -2
- package/dist/renderer/assets/settings-api-pJKPuP1M.js +0 -2
- package/dist/renderer/assets/workbenchSettings-DKD5U1Ql.js +0 -8
- package/dist/simulator/assets/device-shell-Cw7c-IkG.js +0 -2
- package/dist/simulator/assets/device-shell-DbC5ccs8.css +0 -1
- package/dist/simulator/assets/jsx-runtime-DkKmJyBb.js +0 -2
- package/dist/simulator/device-shell/menu-button-geometry.js +0 -18
- package/dist/vscode-workbench/assets/__vite-browser-external-BON7qP59.js +0 -1
|
@@ -1,136 +1,55 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
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
|
-
* ──
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
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
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
*
|
|
85
|
-
*
|
|
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
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
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
|
|
130
|
-
*
|
|
131
|
-
* `LIVE_FILTER_POLL_MAX_ATTEMPTS`/`_INTERVAL_MS`) rather than
|
|
132
|
-
* delay, and stops
|
|
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
|
|
142
|
-
|
|
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
|
|
93
|
+
export declare function buildInternalLogHideScript(hiddenPrefix?: string): string;
|
|
145
94
|
//# sourceMappingURL=console-filter.d.ts.map
|
|
@@ -1,185 +1,108 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
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
|
-
* ──
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
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
|
-
*
|
|
49
|
-
* `
|
|
50
|
-
*
|
|
51
|
-
*
|
|
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
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
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
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
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
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
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
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
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]`)
|
|
94
|
-
* `console-forward/index.ts`'s `forwardRenderToServiceHost`
|
|
95
|
-
* `isInternalLogMessage` and
|
|
96
|
-
*
|
|
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
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
|
142
|
-
*
|
|
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
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
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
|
|
178
|
-
const
|
|
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
|
|
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
|
-
//
|
|
199
|
-
//
|
|
200
|
-
//
|
|
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
|
|
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
|
-
|
|
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
|
|
151
|
+
console.warn('[console-filter] gave up hiding internal logs after ' + attempts + ' attempts — Console.ConsoleView never became usable');
|
|
214
152
|
return;
|
|
215
153
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
var
|
|
219
|
-
if (
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
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();
|