@dimina-kit/devtools 0.4.0 → 0.5.0-dev.20260908120530
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -660
- package/dist/main/api.d.ts +2 -1
- package/dist/main/app/app.d.ts +41 -12
- package/dist/main/app/app.js +299 -514
- package/dist/main/app/bootstrap.d.ts +8 -5
- package/dist/main/app/bootstrap.js +15 -15
- package/dist/main/app/editor-view.d.ts +21 -0
- package/dist/main/app/editor-view.js +71 -0
- package/dist/main/app/global-mirrors.d.ts +23 -0
- package/dist/main/app/global-mirrors.js +37 -0
- package/dist/main/app/host-sidebar-default.d.ts +19 -0
- package/dist/main/app/host-sidebar-default.js +44 -0
- package/dist/main/app/lifecycle.d.ts +12 -1
- package/dist/main/app/lifecycle.js +27 -1
- package/dist/main/app/menu-setup.d.ts +13 -0
- package/dist/main/app/menu-setup.js +49 -0
- package/dist/main/app/native-overview.d.ts +1 -1
- package/dist/main/app/open-project-ipc.d.ts +13 -0
- package/dist/main/app/open-project-ipc.js +21 -0
- package/dist/main/app/project-list-surface.d.ts +31 -0
- package/dist/main/app/project-list-surface.js +20 -0
- package/dist/main/app/project-window.d.ts +36 -0
- package/dist/main/app/project-window.js +93 -0
- package/dist/main/app/servers.d.ts +17 -0
- package/dist/main/app/servers.js +60 -0
- package/dist/main/app/ui-extension-targets.d.ts +42 -0
- package/dist/main/app/ui-extension-targets.js +101 -0
- package/dist/main/app/window-close-reveal.harness.d.ts +34 -0
- package/dist/main/app/window-close-reveal.harness.js +65 -0
- package/dist/main/app/window-events.d.ts +15 -0
- package/dist/main/app/window-events.js +45 -0
- package/dist/main/app/window-runtime-services.d.ts +41 -0
- package/dist/main/app/window-runtime-services.js +197 -0
- package/dist/main/app/workbench-modules.d.ts +24 -0
- package/dist/main/app/workbench-modules.js +51 -0
- package/dist/main/app/workbench-window.d.ts +85 -0
- package/dist/main/app/workbench-window.js +310 -0
- package/dist/main/index.bundle.js +11712 -9986
- package/dist/main/index.js +49 -1
- package/dist/main/ipc/app-lifecycle.d.ts +1 -31
- package/dist/main/ipc/app-lifecycle.js +1 -53
- package/dist/main/ipc/app.d.ts +4 -1
- package/dist/main/ipc/app.js +4 -3
- package/dist/main/ipc/bridge-router.d.ts +19 -116
- package/dist/main/ipc/bridge-router.js +28 -2128
- package/dist/main/ipc/device-picker.d.ts +16 -0
- package/dist/main/ipc/device-picker.js +27 -0
- package/dist/main/ipc/index.d.ts +5 -0
- package/dist/main/ipc/index.js +5 -0
- package/dist/main/ipc/internal-devtools.d.ts +16 -0
- package/dist/main/ipc/internal-devtools.js +10 -0
- package/dist/main/ipc/page-scroll.d.ts +1 -13
- package/dist/main/ipc/page-scroll.js +1 -16
- package/dist/main/ipc/popover.d.ts +4 -1
- package/dist/main/ipc/popover.js +26 -19
- package/dist/main/ipc/project-create.d.ts +16 -0
- package/dist/main/ipc/project-create.js +27 -0
- package/dist/main/ipc/project-fs.d.ts +38 -3
- package/dist/main/ipc/project-fs.js +53 -22
- package/dist/main/ipc/projects.d.ts +3 -3
- package/dist/main/ipc/projects.js +47 -11
- package/dist/main/ipc/session-listener-bag.d.ts +1 -40
- package/dist/main/ipc/session-listener-bag.js +1 -39
- package/dist/main/ipc/session.d.ts +4 -1
- package/dist/main/ipc/session.js +26 -26
- package/dist/main/ipc/settings.d.ts +4 -1
- package/dist/main/ipc/settings.js +17 -19
- package/dist/main/ipc/simulator-module.d.ts +9 -3
- package/dist/main/ipc/simulator-module.js +13 -10
- package/dist/main/ipc/simulator.d.ts +4 -1
- package/dist/main/ipc/simulator.js +12 -18
- package/dist/main/ipc/tooltip.d.ts +14 -0
- package/dist/main/ipc/tooltip.js +29 -0
- package/dist/main/ipc/views.d.ts +19 -2
- package/dist/main/ipc/views.js +76 -8
- package/dist/main/runtime/devtools-backend-before-quit.harness.d.ts +43 -0
- package/dist/main/runtime/devtools-backend-before-quit.harness.js +87 -0
- package/dist/main/runtime/devtools-backend.js +60 -4
- package/dist/main/runtime/devtools-runtime-mock.harness.d.ts +21 -0
- package/dist/main/runtime/devtools-runtime-mock.harness.js +313 -0
- package/dist/main/runtime/miniapp-runtime.d.ts +91 -22
- package/dist/main/services/app-services.d.ts +62 -0
- package/dist/main/services/app-services.js +64 -0
- package/dist/main/services/automation/connection-target.d.ts +36 -0
- package/dist/main/services/automation/connection-target.js +29 -0
- package/dist/main/services/automation/console-bridge.d.ts +28 -0
- package/dist/main/services/automation/console-bridge.js +91 -0
- package/dist/main/services/automation/handlers/app.js +4 -4
- package/dist/main/services/automation/handlers/element.js +55 -21
- package/dist/main/services/automation/index.d.ts +12 -1
- package/dist/main/services/automation/index.js +54 -133
- package/dist/main/services/cdp-session/index.d.ts +87 -0
- package/dist/main/services/cdp-session/index.js +173 -0
- package/dist/main/services/compile-standby.js +4 -0
- package/dist/main/services/console-forward/cdp-inject.d.ts +18 -0
- package/dist/main/services/console-forward/cdp-inject.js +30 -0
- package/dist/main/services/console-forward/global-console-mirror.d.ts +33 -0
- package/dist/main/services/console-forward/global-console-mirror.js +71 -0
- package/dist/main/services/console-forward/global-diagnostics-mirror.d.ts +33 -0
- package/dist/main/services/console-forward/global-diagnostics-mirror.js +73 -0
- package/dist/main/services/console-forward/index.d.ts +1 -46
- package/dist/main/services/console-forward/index.js +1 -185
- package/dist/main/services/console-forward/internal-log.d.ts +2 -0
- package/dist/main/services/console-forward/internal-log.js +2 -0
- package/dist/main/services/console-forward/open-gated-relay.d.ts +67 -0
- package/dist/main/services/console-forward/open-gated-relay.js +55 -0
- package/dist/main/services/default-adapter.js +1 -1
- package/dist/main/services/diagnostics/index.d.ts +1 -48
- package/dist/main/services/diagnostics/index.js +1 -60
- package/dist/main/services/dimina-resource-server.d.ts +1 -6
- package/dist/main/services/dimina-resource-server.js +1 -98
- package/dist/main/services/elements-forward/index.d.ts +132 -15
- package/dist/main/services/elements-forward/index.js +155 -304
- package/dist/main/services/fs-bridge-protocol.d.ts +61 -0
- package/dist/main/services/fs-bridge-protocol.js +34 -0
- package/dist/main/services/fs-watch-sse.d.ts +40 -0
- package/dist/main/services/fs-watch-sse.js +113 -0
- package/dist/main/services/http-json.d.ts +9 -0
- package/dist/main/services/http-json.js +6 -0
- package/dist/main/services/layout/index.d.ts +11 -0
- package/dist/main/services/layout/index.js +23 -0
- package/dist/main/services/mcp/connection-owner.d.ts +38 -0
- package/dist/main/services/mcp/connection-owner.js +79 -0
- package/dist/main/services/mcp/index.d.ts +3 -1
- package/dist/main/services/mcp/index.js +4 -3
- package/dist/main/services/mcp/opened-project.d.ts +88 -0
- package/dist/main/services/mcp/opened-project.js +60 -0
- package/dist/main/services/mcp/server.d.ts +2 -1
- package/dist/main/services/mcp/server.js +29 -4
- package/dist/main/services/mcp/target-manager.d.ts +71 -23
- package/dist/main/services/mcp/target-manager.js +269 -138
- package/dist/main/services/mcp/target-selection.d.ts +47 -0
- package/dist/main/services/mcp/target-selection.js +71 -0
- package/dist/main/services/mcp/tools/context-tools.js +20 -5
- package/dist/main/services/mcp/tools/project-tools.d.ts +72 -0
- package/dist/main/services/mcp/tools/project-tools.js +133 -0
- package/dist/main/services/module.d.ts +13 -5
- package/dist/main/services/network-forward/body-cache.d.ts +72 -0
- package/dist/main/services/network-forward/body-cache.js +179 -0
- package/dist/main/services/network-forward/frontend-dispatch.d.ts +91 -0
- package/dist/main/services/network-forward/frontend-dispatch.js +148 -0
- package/dist/main/services/network-forward/global-body-gate.d.ts +46 -0
- package/dist/main/services/network-forward/global-body-gate.js +93 -0
- package/dist/main/services/network-forward/global-mirror-test-fixtures.d.ts +48 -0
- package/dist/main/services/network-forward/global-mirror-test-fixtures.js +96 -0
- package/dist/main/services/network-forward/http.d.ts +47 -0
- package/dist/main/services/network-forward/http.js +162 -0
- package/dist/main/services/network-forward/index.d.ts +135 -15
- package/dist/main/services/network-forward/index.js +854 -224
- package/dist/main/services/network-forward/request-ids.d.ts +5 -0
- package/dist/main/services/network-forward/request-ids.js +5 -0
- package/dist/main/services/network-forward/user-facing.d.ts +21 -0
- package/dist/main/services/network-forward/user-facing.js +50 -0
- package/dist/main/services/network-forward/websocket.d.ts +36 -0
- package/dist/main/services/network-forward/websocket.js +120 -0
- package/dist/main/services/notifications/renderer-notifier.d.ts +71 -9
- package/dist/main/services/notifications/renderer-notifier.js +45 -8
- package/dist/main/services/projects/create-project-service.js +19 -5
- package/dist/main/services/projects/local-provider.js +8 -4
- package/dist/main/services/projects/project-repository.d.ts +59 -7
- package/dist/main/services/projects/project-repository.js +285 -51
- package/dist/main/services/projects/types.d.ts +44 -34
- package/dist/main/services/render-inspect/index.d.ts +12 -2
- package/dist/main/services/render-inspect/index.js +21 -102
- package/dist/main/services/safe-area/index.d.ts +21 -6
- package/dist/main/services/safe-area/index.js +92 -46
- package/dist/main/services/service-host-pool/pool.d.ts +1 -196
- package/dist/main/services/service-host-pool/pool.js +1 -363
- package/dist/main/services/settings/index.d.ts +7 -1
- package/dist/main/services/settings/index.js +22 -2
- package/dist/main/services/simulator/custom-apis.d.ts +1 -42
- package/dist/main/services/simulator/custom-apis.js +1 -46
- package/dist/main/services/simulator/referer.d.ts +1 -9
- package/dist/main/services/simulator/referer.js +1 -19
- package/dist/main/services/simulator/ui-extensions.d.ts +21 -0
- package/dist/main/services/simulator/ui-extensions.js +176 -0
- package/dist/main/services/simulator-appdata/index.d.ts +6 -0
- package/dist/main/services/simulator-appdata/index.js +21 -2
- 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/simulator-storage/index.d.ts +34 -5
- package/dist/main/services/simulator-storage/index.js +73 -71
- package/dist/main/services/simulator-storage/service-storage-ops.d.ts +1 -39
- package/dist/main/services/simulator-storage/service-storage-ops.js +1 -66
- package/dist/main/services/simulator-storage/window-scope.d.ts +20 -0
- package/dist/main/services/simulator-storage/window-scope.js +20 -0
- package/dist/main/services/simulator-temp-files/disk.d.ts +1 -54
- package/dist/main/services/simulator-temp-files/disk.js +1 -237
- package/dist/main/services/simulator-temp-files/fs-channels.d.ts +1 -68
- package/dist/main/services/simulator-temp-files/fs-channels.js +1 -107
- package/dist/main/services/simulator-temp-files/index.d.ts +1 -32
- package/dist/main/services/simulator-temp-files/index.js +1 -181
- package/dist/main/services/simulator-temp-files/request-handler.d.ts +1 -29
- package/dist/main/services/simulator-temp-files/request-handler.js +1 -177
- package/dist/main/services/simulator-temp-files/resolver.d.ts +1 -21
- package/dist/main/services/simulator-temp-files/resolver.js +1 -21
- package/dist/main/services/simulator-temp-files/store.d.ts +1 -13
- package/dist/main/services/simulator-temp-files/store.js +1 -23
- package/dist/main/services/update/github-release-checker.js +22 -3
- package/dist/main/services/update/update-manager.d.ts +21 -4
- package/dist/main/services/update/update-manager.js +55 -11
- 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 +94 -0
- package/dist/main/services/views/console-filter.js +190 -0
- 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/frontend-bootstrap-gate.d.ts +59 -0
- package/dist/main/services/views/frontend-bootstrap-gate.js +117 -0
- 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 +124 -0
- package/dist/main/services/views/host-slot-port-channel.js +289 -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 +143 -0
- package/dist/main/services/views/miniapp-partition.d.ts +1 -89
- package/dist/main/services/views/miniapp-partition.js +1 -158
- package/dist/main/services/views/native-simulator-devtools-host.js +206 -68
- package/dist/main/services/views/native-simulator-view.d.ts +6 -0
- package/dist/main/services/views/native-simulator-view.js +47 -40
- 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 +63 -4
- package/dist/main/services/views/overlay-panels-view.js +257 -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/refresh-styles.d.ts +10 -0
- package/dist/main/services/views/refresh-styles.js +57 -0
- package/dist/main/services/views/simulator-session-policy.d.ts +1 -27
- package/dist/main/services/views/simulator-session-policy.js +1 -98
- package/dist/main/services/views/view-manager-devtools-host-test-fixtures.d.ts +76 -0
- package/dist/main/services/views/view-manager-devtools-host-test-fixtures.js +184 -0
- package/dist/main/services/views/view-manager.d.ts +69 -88
- package/dist/main/services/views/view-manager.js +62 -7
- package/dist/main/services/views/workbench-view.d.ts +2 -0
- package/dist/main/services/views/workbench-view.js +104 -17
- package/dist/main/services/window-contexts/context-router.d.ts +36 -0
- package/dist/main/services/window-contexts/context-router.js +55 -0
- package/dist/main/services/workbench-coi-host.d.ts +52 -0
- package/dist/main/services/workbench-coi-host.js +227 -0
- package/dist/main/services/workbench-coi-server.d.ts +11 -0
- package/dist/main/services/workbench-coi-server.js +126 -126
- package/dist/main/services/workbench-coi-shutdown.d.ts +40 -0
- package/dist/main/services/workbench-coi-shutdown.js +69 -0
- package/dist/main/services/workbench-coi-static.d.ts +23 -0
- package/dist/main/services/workbench-coi-static.js +87 -0
- package/dist/main/services/workbench-context.d.ts +88 -8
- package/dist/main/services/workbench-context.js +54 -6
- package/dist/main/services/workspace/compile-log-buffer.d.ts +40 -0
- package/dist/main/services/workspace/compile-log-buffer.js +41 -0
- package/dist/main/services/workspace/compile-mode-adapter.d.ts +18 -0
- package/dist/main/services/workspace/compile-mode-adapter.js +57 -0
- package/dist/main/services/workspace/compile-mode-store.d.ts +25 -0
- package/dist/main/services/workspace/compile-mode-store.js +71 -0
- package/dist/main/services/workspace/open-project-guards.d.ts +16 -0
- package/dist/main/services/workspace/open-project-guards.js +42 -0
- package/dist/main/services/workspace/rebuild-status.d.ts +37 -0
- package/dist/main/services/workspace/rebuild-status.js +36 -0
- package/dist/main/services/workspace/session-status-store.d.ts +47 -0
- package/dist/main/services/workspace/session-status-store.js +73 -0
- package/dist/main/services/workspace/status-tap.d.ts +20 -0
- package/dist/main/services/workspace/status-tap.js +32 -0
- package/dist/main/services/workspace/workspace-compile-modes.d.ts +59 -0
- package/dist/main/services/workspace/workspace-compile-modes.js +93 -0
- package/dist/main/services/workspace/workspace-lifecycle-race.testutil.d.ts +22 -0
- package/dist/main/services/workspace/workspace-lifecycle-race.testutil.js +62 -0
- package/dist/main/services/workspace/workspace-referer.d.ts +17 -0
- package/dist/main/services/workspace/workspace-referer.js +26 -0
- package/dist/main/services/workspace/workspace-service.d.ts +7 -5
- package/dist/main/services/workspace/workspace-service.js +96 -135
- package/dist/main/services/workspace/workspace-thumbnails.d.ts +22 -0
- package/dist/main/services/workspace/workspace-thumbnails.js +67 -0
- package/dist/main/utils/ipc-context-source.d.ts +40 -0
- package/dist/main/utils/ipc-context-source.js +23 -0
- package/dist/main/utils/ipc-registry.d.ts +46 -21
- package/dist/main/utils/ipc-registry.js +166 -76
- package/dist/main/utils/paths.d.ts +18 -0
- package/dist/main/utils/paths.js +18 -0
- package/dist/main/utils/sender-policy.d.ts +10 -1
- package/dist/main/utils/sender-policy.js +42 -4
- package/dist/main/utils/theme.d.ts +18 -8
- package/dist/main/utils/theme.js +19 -9
- package/dist/main/windows/internal-devtools-window/index.d.ts +66 -0
- package/dist/main/windows/internal-devtools-window/index.js +160 -0
- package/dist/main/windows/main-window/create.d.ts +16 -0
- package/dist/main/windows/main-window/create.js +19 -11
- package/dist/main/windows/main-window/events.d.ts +1 -1
- package/dist/main/windows/main-window/events.js +26 -13
- package/dist/main/windows/main-window/index.d.ts +1 -1
- package/dist/main/windows/main-window/index.js +1 -1
- package/dist/main/windows/service-host-window/create.d.ts +1 -92
- package/dist/main/windows/service-host-window/create.js +1 -154
- package/dist/native-host/common/common.js +173 -53
- package/dist/native-host/container/pageFrame.css +1 -1
- package/dist/native-host/render/render.js +8278 -3659
- package/dist/native-host/service/service.js +2 -2
- package/dist/preload/index.d.ts +2 -0
- package/dist/preload/index.js +1 -0
- package/dist/preload/instrumentation/app-data.d.ts +2 -2
- package/dist/preload/instrumentation/app-data.js +1 -1
- package/dist/preload/instrumentation/wxml.js +1 -1
- package/dist/preload/runtime/bridge.d.ts +3 -3
- package/dist/preload/runtime/bridge.js +2 -2
- package/dist/preload/runtime/clipboard.d.ts +6 -0
- package/dist/preload/runtime/clipboard.js +12 -0
- 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/native-host.d.ts +14 -0
- package/dist/preload/runtime/native-host.js +5 -8
- package/dist/preload/runtime/node-bindings.d.ts +18 -0
- package/dist/preload/runtime/node-bindings.js +44 -0
- package/dist/preload/runtime/temp-files.js +9 -2
- package/dist/preload/runtime/wait-for-slot-root.d.ts +23 -0
- package/dist/preload/runtime/wait-for-slot-root.js +80 -0
- package/dist/preload/shared/api-compat.js +63 -41
- package/dist/preload/windows/host-dialog-runtime.cjs +360 -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 +361 -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 +142 -52
- package/dist/preload/windows/host-toolbar-runtime.cjs.map +3 -3
- package/dist/preload/windows/main.cjs +4922 -1246
- 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 +376 -322
- package/dist/preload/windows/simulator.cjs.map +4 -4
- package/dist/preload/windows/simulator.js +376 -322
- package/dist/render-host/pageFrame.html +4 -4
- package/dist/render-host/preload.cjs +30 -0
- package/dist/render-host/render-inspect.js +184 -115
- package/dist/renderer/assets/button-CB2MWjHY.js +2 -0
- package/dist/renderer/assets/constants-CkoGPQTS.js +2 -0
- package/dist/renderer/assets/constants-zQZ2-y21.js +2 -0
- package/dist/renderer/assets/createLucideIcon-cZ9FlZZw.js +2 -0
- package/dist/renderer/assets/devicePicker-H2eIO4e1.js +2 -0
- package/dist/renderer/assets/dialog-pHzEA8Vx.js +46 -0
- package/dist/renderer/assets/dist-B5HADirS.js +2 -0
- package/dist/renderer/assets/dist-DIFlRMKe.js +2 -0
- package/dist/renderer/assets/hostSidebarDefault-DRWh6OCt.js +2 -0
- package/dist/renderer/assets/index-CEL_XFge.js +2 -0
- package/dist/renderer/assets/input-CAObw95L.js +2 -0
- package/dist/renderer/assets/ipc-channels-overlays-gIPUFnqc.js +2 -0
- package/dist/renderer/assets/jsx-runtime-DICEQH_0.css +1 -0
- package/dist/renderer/assets/jsx-runtime-DIw5wnYl.js +9 -0
- package/dist/renderer/assets/plus-BQ9u5EbL.js +2 -0
- package/dist/renderer/assets/popover-Cw7G2Ctp.js +2 -0
- package/dist/renderer/assets/presets-DMZOb9ay.js +2 -0
- package/dist/renderer/assets/project-api-YTOr_Yvo.js +2 -0
- package/dist/renderer/assets/projectCreateDialog-BmLqiYxn.js +2 -0
- package/dist/renderer/assets/search-BMvuYF48.js +2 -0
- package/dist/renderer/assets/select-nFP95TxM.js +2 -0
- package/dist/renderer/assets/settings-CnpVfSWt.js +2 -0
- package/dist/renderer/assets/settings-api-Ccsf-Nsj.js +2 -0
- package/dist/renderer/assets/settings-tab-bar-CAzrv32m.js +2 -0
- package/dist/renderer/assets/smartphone-Bb2GdIKy.js +2 -0
- package/dist/renderer/assets/tabs-CPKN3Mmq.js +2 -0
- package/dist/renderer/assets/tooltip-D6AxXRk5.js +2 -0
- package/dist/renderer/assets/types-Bh0hA7El.js +2 -0
- package/dist/renderer/assets/updateDialog-CwndJ0Bl.js +2 -0
- package/dist/renderer/assets/utils-sEB5OZEQ.js +2 -0
- package/dist/renderer/assets/view-api-B-2zPBR5.js +2 -0
- package/dist/renderer/assets/view-ids-BfaDVV5P.js +2 -0
- package/dist/renderer/assets/workbench-C0Jkdlps.js +5 -0
- package/dist/renderer/assets/workbenchSettings-YD0Ctbm_.js +8 -0
- package/dist/renderer/entries/device-picker/index.html +28 -0
- package/dist/renderer/entries/host-sidebar-default/index.html +22 -0
- package/dist/renderer/entries/main/index.html +16 -7
- package/dist/renderer/entries/popover/index.html +16 -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/index.html +49 -0
- package/dist/renderer/entries/workbench-settings/index.html +12 -5
- package/dist/service-host/appdata-set-data.cjs +39 -0
- package/dist/service-host/host-env-update.cjs +23 -0
- package/dist/service-host/preload.cjs +54 -48
- package/dist/service-host/service-message-queue.cjs +71 -0
- package/dist/service-host/sync-impls/menu-button-geometry.js +16 -5
- package/dist/service-host/sync-impls/menu-button.js +5 -3
- package/dist/service-host/sync-impls/system-info.js +31 -9
- package/dist/shared/bridge-channels.d.ts +1 -416
- package/dist/shared/bridge-channels.js +1 -89
- package/dist/shared/compile-mode-state.d.ts +73 -0
- package/dist/shared/compile-mode-state.js +100 -0
- package/dist/shared/compile-modes.d.ts +152 -0
- package/dist/shared/compile-modes.js +237 -0
- package/dist/shared/constants.d.ts +22 -0
- package/dist/shared/constants.js +22 -0
- package/dist/shared/dmb-resource-url.d.ts +2 -0
- package/dist/shared/dmb-resource-url.js +2 -0
- package/dist/shared/ipc-channels-overlays.d.ts +162 -0
- package/dist/shared/ipc-channels-overlays.js +203 -0
- package/dist/shared/ipc-channels.d.ts +24 -154
- package/dist/shared/ipc-channels.js +48 -96
- package/dist/shared/ipc-schemas.d.ts +143 -54
- package/dist/shared/ipc-schemas.js +137 -45
- package/dist/shared/node-bindings.d.ts +2 -0
- package/dist/shared/node-bindings.js +2 -0
- package/dist/shared/project-window-types.d.ts +42 -0
- package/dist/shared/project-window-types.js +2 -0
- package/dist/shared/simulator-route.d.ts +8 -0
- package/dist/shared/simulator-route.js +15 -0
- package/dist/shared/simulator-ui.d.ts +61 -0
- package/dist/shared/simulator-ui.js +12 -0
- package/dist/shared/types.d.ts +126 -41
- package/dist/shared/view-ids.d.ts +10 -0
- package/dist/shared/view-ids.js +23 -0
- package/dist/simulator/assets/bridge-channels-B3JAmRfl.js +2 -0
- package/dist/simulator/assets/device-shell-ATEhHV2_.css +1 -0
- package/dist/simulator/assets/device-shell-DucLepkm.js +431 -0
- package/dist/simulator/assets/simulator-B4rbcOVt.js +10 -0
- package/dist/simulator/assets/simulator-mini-app-DFo7fhi5.js +2 -0
- package/dist/simulator/assets/simulator-ui-BupATgKo.css +1 -0
- package/dist/simulator/assets/simulator-ui-i3GCc7YJ.js +2 -0
- package/dist/simulator/simulator.html +4 -3
- package/dist/simulator/temp-files.d.ts +35 -0
- package/dist/simulator/temp-files.js +121 -0
- package/dist/simulator/types.d.ts +50 -0
- package/dist/simulator/types.js +2 -0
- package/dist/vscode-workbench/assets/__vite-browser-external-JIkWewFf.js +1 -0
- package/dist/vscode-workbench/assets/{dist-TpGpmMGi.js → dist-CXG-u1VB.js} +3 -3
- package/dist/vscode-workbench/assets/fs-core-worker-urls-DZ1nod84.js +1 -0
- package/dist/vscode-workbench/assets/fs-core.worker-Bnmpp6fo.js +1 -0
- package/dist/vscode-workbench/assets/fs-query.worker-cZ-7Fjch.js +2 -0
- package/dist/vscode-workbench/assets/{iconv-lite-umd-C9tiCAJa.js → iconv-lite-umd-Dxx9Qyb4.js} +1 -1
- package/dist/vscode-workbench/assets/{index-DJ1HyMZ7.js → index-6VJMsaWj.js} +475 -475
- package/dist/vscode-workbench/assets/{jschardet-DE1jV513.js → jschardet-Ba3D16vt.js} +1 -1
- package/dist/vscode-workbench/index.html +21 -1
- package/package.json +23 -13
- 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/preload/instrumentation/wxml-extract.d.ts +0 -11
- package/dist/preload/instrumentation/wxml-extract.js +0 -382
- package/dist/preload/shared/sid-registry.d.ts +0 -11
- package/dist/preload/shared/sid-registry.js +0 -38
- package/dist/renderer/assets/constants-EAMiwL9_.js +0 -2
- package/dist/renderer/assets/index-BMqyDx71.js +0 -49
- package/dist/renderer/assets/input-CDAEwpBO.js +0 -2
- package/dist/renderer/assets/ipc-transport-B7eFOR68.css +0 -1
- package/dist/renderer/assets/ipc-transport-_G1k5V1p.js +0 -9
- package/dist/renderer/assets/popover-DEdjK14m.js +0 -2
- package/dist/renderer/assets/select-DpKPCh3y.js +0 -2
- package/dist/renderer/assets/settings-M5q2elUr.js +0 -2
- package/dist/renderer/assets/settings-api-CDlZoHiO.js +0 -2
- package/dist/renderer/assets/workbenchSettings-CT_H1WhV.js +0 -8
- package/dist/shared/appdata-accumulator.d.ts +0 -95
- package/dist/shared/appdata-accumulator.js +0 -218
- package/dist/shared/request-core.d.ts +0 -84
- package/dist/shared/request-core.js +0 -168
- package/dist/shared/simulator-api-metadata.d.ts +0 -26
- package/dist/shared/simulator-api-metadata.js +0 -59
- package/dist/shared/vpath.d.ts +0 -42
- package/dist/shared/vpath.js +0 -105
- package/dist/simulator/assets/bridge-channels-zhsumfky.js +0 -2
- package/dist/simulator/assets/device-shell-C-wcFq3Z.js +0 -2
- package/dist/simulator/assets/device-shell-CS1rqAQz.css +0 -1
- package/dist/simulator/assets/jsx-runtime-BDTY6fEq.js +0 -2
- package/dist/simulator/assets/simulator-DU3-fS3v.js +0 -10
- package/dist/simulator/assets/simulator-mini-app-DzfMfnVM.js +0 -2
- package/dist/simulator/device-shell/menu-button-geometry.js +0 -8
- package/dist/vscode-workbench/assets/__vite-browser-external-CXi6Kz9W.js +0 -1
|
@@ -1,27 +1,34 @@
|
|
|
1
1
|
import type { BrowserWindow } from 'electron';
|
|
2
|
+
import { type RuntimeContext, type RuntimeEvents } from '@dimina-kit/electron-runtime/main/runtime-context';
|
|
2
3
|
import type { CompilationAdapter, CustomFileTypes, WorkbenchConfig } from '../../shared/types.js';
|
|
3
4
|
import type { BridgeRouterHandle } from '../ipc/bridge-router.js';
|
|
4
5
|
import type { ConsoleForwarder } from './console-forward/index.js';
|
|
5
6
|
import type { DiagnosticsBus } from './diagnostics/index.js';
|
|
6
7
|
import type { NetworkForwarder } from './network-forward/index.js';
|
|
8
|
+
import type { InternalDevtoolsWindow } from '../windows/internal-devtools-window/index.js';
|
|
9
|
+
import { type CdpSessionBroker } from './cdp-session/index.js';
|
|
7
10
|
import type { AppDataTap } from './simulator-appdata/index.js';
|
|
8
11
|
import type { StorageApi } from './simulator-storage/index.js';
|
|
9
12
|
import type { SyncStorageChange } from '../../shared/ipc-channels.js';
|
|
10
13
|
import { DisposableRegistry, type ConnectionRegistry } from '@dimina-kit/electron-deck/main';
|
|
11
14
|
import type { SenderPolicy } from '../utils/ipc-registry.js';
|
|
15
|
+
import type { AppServices } from './app-services.js';
|
|
12
16
|
import { type RendererNotifier } from './notifications/renderer-notifier.js';
|
|
17
|
+
import { type CompileLogBuffer } from './workspace/compile-log-buffer.js';
|
|
18
|
+
import { type SessionStatusStore } from './workspace/session-status-store.js';
|
|
13
19
|
import { type ViewManager } from './views/view-manager.js';
|
|
14
20
|
import { type WindowService } from './window-service.js';
|
|
15
21
|
import { type WorkspaceService } from './workspace/workspace-service.js';
|
|
16
22
|
import { type SimulatorApiRegistry } from './simulator/custom-apis.js';
|
|
23
|
+
import { type SimulatorUiExtensionRegistry } from './simulator/ui-extensions.js';
|
|
17
24
|
import { sanitizeTemplates } from './projects/templates.js';
|
|
18
|
-
import type { ProjectsProvider, ProjectTemplate } from './projects/types.js';
|
|
19
|
-
import type { CustomCreateProjectDialogResult } from '../../shared/types.js';
|
|
25
|
+
import type { Project, ProjectsProvider, ProjectTemplate } from './projects/types.js';
|
|
26
|
+
import type { CustomCreateProjectDialogResult, CustomEditProjectDialogResult } from '../../shared/types.js';
|
|
20
27
|
/**
|
|
21
28
|
* Shared mutable state for the workbench application.
|
|
22
29
|
* Passed to each IPC module so they can read/write shared state without closures.
|
|
23
30
|
*/
|
|
24
|
-
export interface WorkbenchContext {
|
|
31
|
+
export interface WorkbenchContext extends RuntimeContext {
|
|
25
32
|
adapter: CompilationAdapter;
|
|
26
33
|
/** Absolute path to the preload script loaded into the simulator webview */
|
|
27
34
|
preloadPath: string;
|
|
@@ -45,6 +52,18 @@ export interface WorkbenchContext {
|
|
|
45
52
|
windows: WindowService;
|
|
46
53
|
/** Unified main → renderer event dispatcher */
|
|
47
54
|
notify: RendererNotifier;
|
|
55
|
+
/**
|
|
56
|
+
* Authoritative, queryable compile status of the active session. Fed by the
|
|
57
|
+
* notifier tap (every `notify.projectStatus` is recorded here first), read
|
|
58
|
+
* by MCP `project_status` / awaited by `project_open` / `project_wait_ready`.
|
|
59
|
+
*/
|
|
60
|
+
sessionStatus: SessionStatusStore;
|
|
61
|
+
/**
|
|
62
|
+
* Cursor-readable ring buffer over the compile log lines. Fed by the
|
|
63
|
+
* notifier tap (every `notify.compileLog` is appended here first), read
|
|
64
|
+
* incrementally by MCP `compile_logs`.
|
|
65
|
+
*/
|
|
66
|
+
compileLogBuffer: CompileLogBuffer;
|
|
48
67
|
/**
|
|
49
68
|
* Open (or re-focus) the standalone workbench-settings window. First-class
|
|
50
69
|
* member so contract holders (`MiniappRuntime` / `MenuContext`) can open
|
|
@@ -78,6 +97,17 @@ export interface WorkbenchContext {
|
|
|
78
97
|
parentWindow: BrowserWindow;
|
|
79
98
|
templates: ProjectTemplate[];
|
|
80
99
|
}) => Promise<CustomCreateProjectDialogResult>;
|
|
100
|
+
/**
|
|
101
|
+
* Optional host hook for the "编辑项目" dialog. When present, the
|
|
102
|
+
* `projects:openEditDialog` IPC runs it and wraps whatever it resolves to
|
|
103
|
+
* as `{ result }`; when absent, the IPC returns `null` and the renderer
|
|
104
|
+
* shows the built-in dialog. `project` comes from `workspace.listProjects`,
|
|
105
|
+
* not the renderer's IPC args.
|
|
106
|
+
*/
|
|
107
|
+
customEditProjectDialog?: (ctx: {
|
|
108
|
+
parentWindow: BrowserWindow;
|
|
109
|
+
project: Project;
|
|
110
|
+
}) => Promise<CustomEditProjectDialogResult>;
|
|
81
111
|
/**
|
|
82
112
|
* Host permission gate consulted by `workspace.openProject` BEFORE any side
|
|
83
113
|
* effect. Throwing vetoes the open (see `WorkbenchAppConfig.onBeforeOpenProject`).
|
|
@@ -91,6 +121,14 @@ export interface WorkbenchContext {
|
|
|
91
121
|
* lazily so it stays correct as windows/views come and go.
|
|
92
122
|
*/
|
|
93
123
|
senderPolicy: SenderPolicy;
|
|
124
|
+
/**
|
|
125
|
+
* The subset of `senderPolicy` this context structurally OWNS — its own
|
|
126
|
+
* window's renderer, its settings window and the overlay views mounted
|
|
127
|
+
* inside it. Excludes the app-wide trusted-window map, which no single
|
|
128
|
+
* context can claim. `createWindowContextRouter` uses it to decide which
|
|
129
|
+
* window a message actually came from.
|
|
130
|
+
*/
|
|
131
|
+
ownsSender: SenderPolicy;
|
|
94
132
|
/**
|
|
95
133
|
* Reference-counted map of `webContents.id` → live registration count for
|
|
96
134
|
* host-owned BrowserWindows registered as trusted senders via
|
|
@@ -99,16 +137,31 @@ export interface WorkbenchContext {
|
|
|
99
137
|
* single `closed` event, which zeroes the count outright) to un-trust it.
|
|
100
138
|
* Consulted by `createWorkbenchSenderPolicy` in addition to the static
|
|
101
139
|
* main-window / overlay checks.
|
|
140
|
+
*
|
|
141
|
+
* Supplied by {@link AppServices} when the caller has one: the host
|
|
142
|
+
* registers its window against the application, so the same map backs every
|
|
143
|
+
* context.
|
|
102
144
|
*/
|
|
103
145
|
trustedWindowSenderIds: Map<number, number>;
|
|
104
146
|
/**
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
147
|
+
* Registry of host-registered simulator custom APIs. Populated via
|
|
148
|
+
* `instance.registerSimulatorApi`; read by the simulator IPC handlers.
|
|
149
|
+
*
|
|
150
|
+
* Supplied by {@link AppServices} when the caller has one, and therefore
|
|
151
|
+
* registrations are shared across contexts. The invocation facade supplies
|
|
152
|
+
* THIS window's project path, independently of focus, without changing the
|
|
153
|
+
* app-owned handlers or their lifetime.
|
|
108
154
|
*/
|
|
109
155
|
simulatorApis: SimulatorApiRegistry;
|
|
156
|
+
/**
|
|
157
|
+
* Per-context downstream simulator UI extensions. It owns renderer bundle
|
|
158
|
+
* installation and follows the active native simulator WebContentsView.
|
|
159
|
+
*/
|
|
160
|
+
simulatorUiExtensions: SimulatorUiExtensionRegistry;
|
|
110
161
|
/** Aggregates dispose handlers for every IPC handler, listener, watcher, and CDP session registered by the workbench. */
|
|
111
162
|
registry: DisposableRegistry;
|
|
163
|
+
/** Runtime-domain events consumed by optional DevTools panels and renderer notifications. */
|
|
164
|
+
events: RuntimeEvents;
|
|
112
165
|
/**
|
|
113
166
|
* Per-webContents connection registry. Each trusted webContents (main window,
|
|
114
167
|
* overlay views, native simulator/render guests) is one `Connection` that
|
|
@@ -119,6 +172,14 @@ export interface WorkbenchContext {
|
|
|
119
172
|
* `own()`-ing their per-endpoint resources and observing `reset`/`closed`.
|
|
120
173
|
*/
|
|
121
174
|
connections: ConnectionRegistry;
|
|
175
|
+
/**
|
|
176
|
+
* Single owner of every render-guest `wc.debugger` (CDP) session: safe-area,
|
|
177
|
+
* elements-forward, render-inspect and network-forward all `acquire()` a
|
|
178
|
+
* lease from this instead of each hand-rolling their own attach/reuse/detach
|
|
179
|
+
* bookkeeping (see cdp-session/index.ts's design doc for why that duplication
|
|
180
|
+
* was a real bug, not just repetition).
|
|
181
|
+
*/
|
|
182
|
+
cdpSessionBroker: CdpSessionBroker;
|
|
122
183
|
/**
|
|
123
184
|
* Accessor over the bridge-router's private state, set by `installBridgeRouter`.
|
|
124
185
|
* Lets other main services (simulator-storage, automation, appdata) resolve
|
|
@@ -188,6 +249,15 @@ export interface WorkbenchContext {
|
|
|
188
249
|
* DevTools host exist. Undefined until bootstrap wires it.
|
|
189
250
|
*/
|
|
190
251
|
networkForward?: NetworkForwarder;
|
|
252
|
+
/**
|
|
253
|
+
* Controller for the standalone internal (app-wide) DevTools debug window
|
|
254
|
+
* — the independent floating CDP panel that debugs the whole Electron app
|
|
255
|
+
* (as opposed to the right-panel CDP, which inspects only the user's
|
|
256
|
+
* mini-program). Assembled in app bootstrap via
|
|
257
|
+
* `createInternalDevtoolsWindow(mainWindow)`; undefined only in contexts
|
|
258
|
+
* that skip that wiring (e.g. narrow test doubles).
|
|
259
|
+
*/
|
|
260
|
+
internalDevtoolsWindow?: InternalDevtoolsWindow;
|
|
191
261
|
}
|
|
192
262
|
/**
|
|
193
263
|
* Inputs for `createWorkbenchContext`. The scalar config fields it shares with
|
|
@@ -197,13 +267,21 @@ export interface WorkbenchContext {
|
|
|
197
267
|
* because their shapes intentionally differ from the config:
|
|
198
268
|
* - `preloadPath` / `rendererDir` are REQUIRED here (the caller resolves the
|
|
199
269
|
* defaults before constructing the context) but optional in the config;
|
|
200
|
-
* - `projectsProvider` / `projectTemplates` / `customCreateProjectDialog`
|
|
201
|
-
* the main-process types, not the structural
|
|
270
|
+
* - `projectsProvider` / `projectTemplates` / `customCreateProjectDialog` /
|
|
271
|
+
* `customEditProjectDialog` use the main-process types, not the structural
|
|
272
|
+
* mirrors in `shared/types`.
|
|
202
273
|
*/
|
|
203
274
|
export interface CreateContextOptions extends Pick<WorkbenchConfig, 'adapter' | 'apiNamespaces' | 'appName' | 'fileTypes'> {
|
|
204
275
|
mainWindow: BrowserWindow;
|
|
205
276
|
preloadPath: string;
|
|
206
277
|
rendererDir: string;
|
|
278
|
+
/**
|
|
279
|
+
* Services owned by the application rather than by this window. When
|
|
280
|
+
* present their instances are adopted instead of constructing per-context
|
|
281
|
+
* ones, so every window shares the host's single registration. Optional so
|
|
282
|
+
* focused unit tests can still build a stand-alone context.
|
|
283
|
+
*/
|
|
284
|
+
appServices?: AppServices;
|
|
207
285
|
brandingProvider?: WorkbenchContext['brandingProvider'];
|
|
208
286
|
/** Host-supplied project list backend. Defaults to LocalProjectsProvider. */
|
|
209
287
|
projectsProvider?: ProjectsProvider;
|
|
@@ -213,6 +291,8 @@ export interface CreateContextOptions extends Pick<WorkbenchConfig, 'adapter' |
|
|
|
213
291
|
builtinTemplates?: 'all' | 'none' | readonly string[];
|
|
214
292
|
/** Host-supplied "新建项目" dialog hook. */
|
|
215
293
|
customCreateProjectDialog?: WorkbenchContext['customCreateProjectDialog'];
|
|
294
|
+
/** Host-supplied "编辑项目" dialog hook. */
|
|
295
|
+
customEditProjectDialog?: WorkbenchContext['customEditProjectDialog'];
|
|
216
296
|
/** Host permission gate run before a project opens (throw to veto). */
|
|
217
297
|
onBeforeOpenProject?: WorkbenchContext['onBeforeOpenProject'];
|
|
218
298
|
}
|
|
@@ -1,18 +1,26 @@
|
|
|
1
|
+
import { createRuntimeEvents, } from '@dimina-kit/electron-runtime/main/runtime-context';
|
|
2
|
+
import { createCdpSessionBroker } from './cdp-session/index.js';
|
|
1
3
|
import { createConnectionRegistry, DisposableRegistry, } from '@dimina-kit/electron-deck/main';
|
|
2
|
-
import { createWorkbenchSenderPolicy } from '../utils/sender-policy.js';
|
|
4
|
+
import { createWorkbenchOwnedSenderCheck, createWorkbenchSenderPolicy, } from '../utils/sender-policy.js';
|
|
3
5
|
import { defaultAdapter } from './default-adapter.js';
|
|
4
6
|
import { createRendererNotifier, } from './notifications/renderer-notifier.js';
|
|
7
|
+
import { createCompileLogBuffer, } from './workspace/compile-log-buffer.js';
|
|
8
|
+
import { createSessionStatusStore, } from './workspace/session-status-store.js';
|
|
9
|
+
import { tapNotifierIntoStores } from './workspace/status-tap.js';
|
|
5
10
|
import { createViewManager } from './views/view-manager.js';
|
|
6
11
|
import { createWindowService } from './window-service.js';
|
|
7
12
|
import { openSettingsWindow } from '../windows/settings-window/index.js';
|
|
8
13
|
import { createWorkspaceService, } from './workspace/workspace-service.js';
|
|
9
14
|
import { createLocalProjectsProvider } from './projects/local-provider.js';
|
|
10
15
|
import { createSimulatorApiRegistry, } from './simulator/custom-apis.js';
|
|
16
|
+
import { createSimulatorUiExtensionRegistry, } from './simulator/ui-extensions.js';
|
|
11
17
|
import { resolveTemplates, sanitizeTemplates } from './projects/templates.js';
|
|
12
18
|
import { BUILTIN_TEMPLATES } from './projects/builtin-templates.js';
|
|
19
|
+
import { runtimeAssetPaths } from '../utils/paths.js';
|
|
13
20
|
export function createWorkbenchContext(opts) {
|
|
14
21
|
const ctx = {
|
|
15
22
|
adapter: opts.adapter ?? defaultAdapter,
|
|
23
|
+
assets: runtimeAssetPaths,
|
|
16
24
|
preloadPath: opts.preloadPath,
|
|
17
25
|
rendererDir: opts.rendererDir,
|
|
18
26
|
apiNamespaces: opts.apiNamespaces ?? [],
|
|
@@ -21,25 +29,65 @@ export function createWorkbenchContext(opts) {
|
|
|
21
29
|
brandingProvider: opts.brandingProvider,
|
|
22
30
|
};
|
|
23
31
|
ctx.registry = new DisposableRegistry();
|
|
32
|
+
ctx.events = createRuntimeEvents();
|
|
33
|
+
ctx.registry.add(ctx.events.on('session-status', (payload) => {
|
|
34
|
+
ctx.notify?.sessionRuntimeStatus(payload);
|
|
35
|
+
}));
|
|
36
|
+
ctx.registry.add(ctx.events.on('app-data-evict', ({ appId, bridgeId }) => {
|
|
37
|
+
ctx.appData?.evictBridge(appId, bridgeId);
|
|
38
|
+
}));
|
|
39
|
+
ctx.registry.add(ctx.events.on('app-data-message', ({ appId, message }) => {
|
|
40
|
+
ctx.appData?.onServiceToRender(appId, message);
|
|
41
|
+
}));
|
|
42
|
+
ctx.registry.add(ctx.events.on('storage-changed', ({ appId, change }) => {
|
|
43
|
+
ctx.onServiceStorageChanged?.(appId, change);
|
|
44
|
+
}));
|
|
45
|
+
ctx.registry.add(() => ctx.events.clear());
|
|
24
46
|
// Empty connection registry as a first-class context field. Connections are
|
|
25
47
|
// acquired by real wiring points (app bootstrap, view-manager endpoints),
|
|
26
48
|
// NOT here — the constructor stays side-effect-free so focused unit tests can
|
|
27
49
|
// build a context with a minimal mainWindow fake.
|
|
28
50
|
ctx.connections = createConnectionRegistry();
|
|
29
|
-
ctx.
|
|
30
|
-
ctx.
|
|
51
|
+
ctx.cdpSessionBroker = createCdpSessionBroker({ connections: ctx.connections });
|
|
52
|
+
ctx.registry.add(() => ctx.cdpSessionBroker.dispose());
|
|
53
|
+
ctx.trustedWindowSenderIds =
|
|
54
|
+
opts.appServices?.trustedWindowSenderIds ?? new Map();
|
|
55
|
+
const simulatorApis = opts.appServices?.simulatorApis ?? createSimulatorApiRegistry();
|
|
56
|
+
ctx.simulatorApis = {
|
|
57
|
+
...simulatorApis,
|
|
58
|
+
invoke: (name, params) => simulatorApis.invoke(name, params, {
|
|
59
|
+
projectPath: ctx.workspace.hasActiveSession() ? ctx.workspace.getProjectPath() : null,
|
|
60
|
+
}),
|
|
61
|
+
};
|
|
62
|
+
ctx.simulatorUiExtensions = createSimulatorUiExtensionRegistry();
|
|
63
|
+
ctx.registry.add(() => ctx.simulatorUiExtensions.clear());
|
|
31
64
|
ctx.windows = createWindowService(opts.mainWindow);
|
|
32
65
|
ctx.views = createViewManager(ctx);
|
|
33
|
-
|
|
66
|
+
// Full view teardown belongs to the CONTEXT's life, not a project's:
|
|
67
|
+
// closeProject only disposes project-scoped views, so this registration is
|
|
68
|
+
// the one place that releases the HOST-scoped toolbar (its view and the
|
|
69
|
+
// ref-counted session-runtime preload) when the app/context winds down.
|
|
70
|
+
ctx.registry.add(() => ctx.views.disposeAll());
|
|
71
|
+
ctx.sessionStatus = createSessionStatusStore();
|
|
72
|
+
ctx.compileLogBuffer = createCompileLogBuffer();
|
|
73
|
+
// Tap the notify gate: the two compile-state pushes land in the
|
|
74
|
+
// main-process authorities above BEFORE the renderer broadcast, so MCP
|
|
75
|
+
// reads and the renderer view derive from the same single site.
|
|
76
|
+
ctx.notify = tapNotifierIntoStores(createRendererNotifier(ctx), ctx.sessionStatus, ctx.compileLogBuffer);
|
|
34
77
|
// Lazy closure (not a bound snapshot): reads ctx.windows/notify/rendererDir
|
|
35
78
|
// at call time through the live context, which structurally satisfies the
|
|
36
79
|
// helper's narrow OpenSettingsWindowDeps.
|
|
37
80
|
ctx.openSettings = () => openSettingsWindow(ctx);
|
|
38
|
-
ctx.projectsProvider =
|
|
39
|
-
|
|
81
|
+
ctx.projectsProvider =
|
|
82
|
+
opts.appServices?.projectsProvider ?? opts.projectsProvider ?? createLocalProjectsProvider();
|
|
83
|
+
ctx.projectTemplates =
|
|
84
|
+
opts.appServices?.projectTemplates ??
|
|
85
|
+
resolveTemplates(BUILTIN_TEMPLATES, opts.projectTemplates ?? [], opts.builtinTemplates ?? 'all');
|
|
40
86
|
ctx.customCreateProjectDialog = opts.customCreateProjectDialog;
|
|
87
|
+
ctx.customEditProjectDialog = opts.customEditProjectDialog;
|
|
41
88
|
ctx.onBeforeOpenProject = opts.onBeforeOpenProject;
|
|
42
89
|
ctx.workspace = createWorkspaceService(ctx);
|
|
90
|
+
ctx.ownsSender = createWorkbenchOwnedSenderCheck(ctx);
|
|
43
91
|
ctx.senderPolicy = createWorkbenchSenderPolicy(ctx);
|
|
44
92
|
return ctx;
|
|
45
93
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ring buffer over the per-line dmcc compile log, readable by cursor.
|
|
3
|
+
*
|
|
4
|
+
* The renderer gets each line pushed (`notify.compileLog`); MCP clients pull
|
|
5
|
+
* incrementally instead: pass the previous read's `nextCursor` to receive
|
|
6
|
+
* only lines that arrived since. `seq` is monotonic for the buffer's whole
|
|
7
|
+
* lifetime — `clear()` (a fresh project open) drops the entries but never
|
|
8
|
+
* resets the counter, so a stale cursor from before the clear simply reads
|
|
9
|
+
* the new compile's lines instead of duplicating old ones.
|
|
10
|
+
*/
|
|
11
|
+
export interface CompileLogRecord {
|
|
12
|
+
/** Monotonic id (1-based); never reused, survives clear(). */
|
|
13
|
+
seq: number;
|
|
14
|
+
/** Main-process capture time of the line. */
|
|
15
|
+
at: number;
|
|
16
|
+
stream: 'stdout' | 'stderr';
|
|
17
|
+
text: string;
|
|
18
|
+
}
|
|
19
|
+
export interface CompileLogRead {
|
|
20
|
+
/** Oldest-first entries with seq > afterSeq (post stream-filter), capped at limit. */
|
|
21
|
+
entries: CompileLogRecord[];
|
|
22
|
+
/** Pass back as the next read's afterSeq; unchanged when nothing new matched. */
|
|
23
|
+
nextCursor: number;
|
|
24
|
+
}
|
|
25
|
+
export interface CompileLogBuffer {
|
|
26
|
+
append(entry: {
|
|
27
|
+
at: number;
|
|
28
|
+
stream: 'stdout' | 'stderr';
|
|
29
|
+
text: string;
|
|
30
|
+
}): void;
|
|
31
|
+
read(opts?: {
|
|
32
|
+
afterSeq?: number;
|
|
33
|
+
limit?: number;
|
|
34
|
+
stream?: 'stdout' | 'stderr';
|
|
35
|
+
}): CompileLogRead;
|
|
36
|
+
/** Drop all entries (fresh compile timeline); seq keeps growing. */
|
|
37
|
+
clear(): void;
|
|
38
|
+
}
|
|
39
|
+
export declare function createCompileLogBuffer(capacity?: number): CompileLogBuffer;
|
|
40
|
+
//# sourceMappingURL=compile-log-buffer.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ring buffer over the per-line dmcc compile log, readable by cursor.
|
|
3
|
+
*
|
|
4
|
+
* The renderer gets each line pushed (`notify.compileLog`); MCP clients pull
|
|
5
|
+
* incrementally instead: pass the previous read's `nextCursor` to receive
|
|
6
|
+
* only lines that arrived since. `seq` is monotonic for the buffer's whole
|
|
7
|
+
* lifetime — `clear()` (a fresh project open) drops the entries but never
|
|
8
|
+
* resets the counter, so a stale cursor from before the clear simply reads
|
|
9
|
+
* the new compile's lines instead of duplicating old ones.
|
|
10
|
+
*/
|
|
11
|
+
const DEFAULT_CAPACITY = 1000;
|
|
12
|
+
const DEFAULT_READ_LIMIT = 100;
|
|
13
|
+
export function createCompileLogBuffer(capacity = DEFAULT_CAPACITY) {
|
|
14
|
+
const entries = [];
|
|
15
|
+
let seq = 0;
|
|
16
|
+
return {
|
|
17
|
+
append(entry) {
|
|
18
|
+
entries.push({ seq: ++seq, ...entry });
|
|
19
|
+
if (entries.length > capacity)
|
|
20
|
+
entries.splice(0, entries.length - capacity);
|
|
21
|
+
},
|
|
22
|
+
read({ afterSeq = 0, limit = DEFAULT_READ_LIMIT, stream } = {}) {
|
|
23
|
+
const matched = [];
|
|
24
|
+
for (const entry of entries) {
|
|
25
|
+
if (entry.seq <= afterSeq)
|
|
26
|
+
continue;
|
|
27
|
+
if (stream && entry.stream !== stream)
|
|
28
|
+
continue;
|
|
29
|
+
matched.push(entry);
|
|
30
|
+
if (matched.length >= limit)
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
const last = matched[matched.length - 1];
|
|
34
|
+
return { entries: matched, nextCursor: last ? last.seq : afterSeq };
|
|
35
|
+
},
|
|
36
|
+
clear() {
|
|
37
|
+
entries.length = 0;
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=compile-log-buffer.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapts the compile-mode half of `ProjectsProvider` — where every method is
|
|
3
|
+
* optional — onto the four methods `WorkspaceService` always exposes.
|
|
4
|
+
*
|
|
5
|
+
* A host may implement the mode list, only the older single-config pair, or
|
|
6
|
+
* neither. Each direction degrades on its own so a partial host still gets the
|
|
7
|
+
* behavior it can support instead of an exception.
|
|
8
|
+
*/
|
|
9
|
+
import type { CompileConfig, CompileModes } from '../../../shared/types.js';
|
|
10
|
+
import type { ProjectsProvider } from '../projects/types.js';
|
|
11
|
+
export interface CompileModeAdapter {
|
|
12
|
+
getCompileConfig(projectPath: string): Promise<CompileConfig>;
|
|
13
|
+
saveCompileConfig(projectPath: string, config: CompileConfig): Promise<void>;
|
|
14
|
+
getCompileModes(projectPath: string): Promise<CompileModes>;
|
|
15
|
+
saveCompileModes(projectPath: string, modes: CompileModes): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export declare function createCompileModeAdapter(provider: ProjectsProvider): CompileModeAdapter;
|
|
18
|
+
//# sourceMappingURL=compile-mode-adapter.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapts the compile-mode half of `ProjectsProvider` — where every method is
|
|
3
|
+
* optional — onto the four methods `WorkspaceService` always exposes.
|
|
4
|
+
*
|
|
5
|
+
* A host may implement the mode list, only the older single-config pair, or
|
|
6
|
+
* neither. Each direction degrades on its own so a partial host still gets the
|
|
7
|
+
* behavior it can support instead of an exception.
|
|
8
|
+
*/
|
|
9
|
+
import { compileConfigToModes, emptyCompileModes, resolveCompileConfig, } from '../../../shared/compile-modes.js';
|
|
10
|
+
import { DEFAULT_COMPILE_CONFIG } from '../projects/types.js';
|
|
11
|
+
export function createCompileModeAdapter(provider) {
|
|
12
|
+
return {
|
|
13
|
+
// Prefer the host's own resolver: only it can substitute the project's
|
|
14
|
+
// entry page for 普通编译's empty start page. Deriving from the mode list
|
|
15
|
+
// is the fallback for hosts that implement modes but not this.
|
|
16
|
+
async getCompileConfig(projectPath) {
|
|
17
|
+
if (provider.getCompileConfig) {
|
|
18
|
+
return (await provider.getCompileConfig(projectPath));
|
|
19
|
+
}
|
|
20
|
+
if (provider.getCompileModes) {
|
|
21
|
+
return resolveCompileConfig(await provider.getCompileModes(projectPath));
|
|
22
|
+
}
|
|
23
|
+
return DEFAULT_COMPILE_CONFIG;
|
|
24
|
+
},
|
|
25
|
+
async saveCompileConfig(projectPath, config) {
|
|
26
|
+
if (provider.saveCompileConfig) {
|
|
27
|
+
await provider.saveCompileConfig(projectPath, config);
|
|
28
|
+
}
|
|
29
|
+
// No persistence when the host opts out; the renderer's edits then
|
|
30
|
+
// do not survive a reload, matching the documented contract.
|
|
31
|
+
},
|
|
32
|
+
// Mirror of saveCompileModes' degradation: a host still on the single
|
|
33
|
+
// config gets it projected into one selected mode, so its start page and
|
|
34
|
+
// params actually launch instead of being read as 普通编译 and dropped.
|
|
35
|
+
async getCompileModes(projectPath) {
|
|
36
|
+
if (provider.getCompileModes) {
|
|
37
|
+
return await provider.getCompileModes(projectPath);
|
|
38
|
+
}
|
|
39
|
+
if (provider.getCompileConfig) {
|
|
40
|
+
return compileConfigToModes((await provider.getCompileConfig(projectPath)));
|
|
41
|
+
}
|
|
42
|
+
return emptyCompileModes();
|
|
43
|
+
},
|
|
44
|
+
async saveCompileModes(projectPath, modes) {
|
|
45
|
+
if (provider.saveCompileModes) {
|
|
46
|
+
await provider.saveCompileModes(projectPath, modes);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
// Degrade for a host still on the single-config setter: the selection
|
|
50
|
+
// still takes effect, it just cannot store the named list.
|
|
51
|
+
if (provider.saveCompileConfig) {
|
|
52
|
+
await provider.saveCompileConfig(projectPath, resolveCompileConfig(modes));
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=compile-mode-adapter.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single owner of one open project's compile modes: the only thing allowed
|
|
3
|
+
* to read/write the persisted file and to advance the in-memory snapshot.
|
|
4
|
+
* `apply()` calls are serialized through a queue so two commands issued
|
|
5
|
+
* back-to-back never interleave their persists, and persist-before-adopt
|
|
6
|
+
* means a write that fails on disk is never visible in `get()` or broadcast
|
|
7
|
+
* to `onChange` listeners — memory never runs ahead of what's on disk.
|
|
8
|
+
*/
|
|
9
|
+
import { type CompileModeChange, type CompileModeCommand, type CompileModeSnapshot, type MintId } from '../../../shared/compile-mode-state.js';
|
|
10
|
+
import type { CompileModes } from '../../../shared/types.js';
|
|
11
|
+
export type { CompileModeChange, CompileModeSnapshot };
|
|
12
|
+
export interface CompileModeStore {
|
|
13
|
+
readonly projectPath: string;
|
|
14
|
+
get(): CompileModeSnapshot;
|
|
15
|
+
apply(command: CompileModeCommand): Promise<CompileModeChange>;
|
|
16
|
+
onChange(listener: (change: CompileModeChange) => void): () => void;
|
|
17
|
+
dispose(): void;
|
|
18
|
+
}
|
|
19
|
+
export declare function openCompileModeStore(input: {
|
|
20
|
+
projectPath: string;
|
|
21
|
+
load(): Promise<unknown>;
|
|
22
|
+
persist(stored: CompileModes): Promise<void>;
|
|
23
|
+
mintId?: MintId;
|
|
24
|
+
}): Promise<CompileModeStore>;
|
|
25
|
+
//# sourceMappingURL=compile-mode-store.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single owner of one open project's compile modes: the only thing allowed
|
|
3
|
+
* to read/write the persisted file and to advance the in-memory snapshot.
|
|
4
|
+
* `apply()` calls are serialized through a queue so two commands issued
|
|
5
|
+
* back-to-back never interleave their persists, and persist-before-adopt
|
|
6
|
+
* means a write that fails on disk is never visible in `get()` or broadcast
|
|
7
|
+
* to `onChange` listeners — memory never runs ahead of what's on disk.
|
|
8
|
+
*/
|
|
9
|
+
import { applyCompileModeCommand, stateFromStored, storedFromState, } from '../../../shared/compile-mode-state.js';
|
|
10
|
+
let nextIdCounter = 0;
|
|
11
|
+
function defaultMintId() {
|
|
12
|
+
nextIdCounter += 1;
|
|
13
|
+
return `compile-mode-${nextIdCounter}`;
|
|
14
|
+
}
|
|
15
|
+
export async function openCompileModeStore(input) {
|
|
16
|
+
const mintId = input.mintId ?? defaultMintId;
|
|
17
|
+
const raw = await input.load();
|
|
18
|
+
let revision = 0;
|
|
19
|
+
let state = stateFromStored(raw, mintId);
|
|
20
|
+
let disposed = false;
|
|
21
|
+
const listeners = new Set();
|
|
22
|
+
// Serializes apply() calls: each call chains onto this promise so the next
|
|
23
|
+
// command's persist only starts after the previous one has fully settled.
|
|
24
|
+
let queue = Promise.resolve();
|
|
25
|
+
function get() {
|
|
26
|
+
return { revision, state };
|
|
27
|
+
}
|
|
28
|
+
// Not `async` on purpose: an async function wrapping a returned promise
|
|
29
|
+
// adds an extra microtask hop before a caller's `.then` fires, which is
|
|
30
|
+
// enough to let the queue's OWN downstream continuation (chaining the next
|
|
31
|
+
// apply()) run ahead of a caller that is racing to inspect order — this
|
|
32
|
+
// function must return `run` itself so a caller's `.then` is attached
|
|
33
|
+
// directly to it, same as the queue's internal continuation.
|
|
34
|
+
function apply(command) {
|
|
35
|
+
if (disposed) {
|
|
36
|
+
return Promise.reject(new Error('compile-mode store disposed'));
|
|
37
|
+
}
|
|
38
|
+
const run = queue.then(() => runApply(command));
|
|
39
|
+
// Keep the queue alive even if this command rejects, so a later apply()
|
|
40
|
+
// still runs instead of being stuck behind a broken link forever.
|
|
41
|
+
queue = run.then(() => undefined, () => undefined);
|
|
42
|
+
return run;
|
|
43
|
+
}
|
|
44
|
+
async function runApply(command) {
|
|
45
|
+
if (disposed) {
|
|
46
|
+
throw new Error('compile-mode store disposed');
|
|
47
|
+
}
|
|
48
|
+
const result = applyCompileModeCommand(state, command, mintId);
|
|
49
|
+
if (result.state === state) {
|
|
50
|
+
// No-op: nothing to persist or broadcast.
|
|
51
|
+
return { revision, state, relaunch: false };
|
|
52
|
+
}
|
|
53
|
+
await input.persist(storedFromState(result.state));
|
|
54
|
+
state = result.state;
|
|
55
|
+
revision += 1;
|
|
56
|
+
const change = { revision, state, relaunch: result.relaunch };
|
|
57
|
+
for (const listener of listeners)
|
|
58
|
+
listener(change);
|
|
59
|
+
return change;
|
|
60
|
+
}
|
|
61
|
+
function onChange(listener) {
|
|
62
|
+
listeners.add(listener);
|
|
63
|
+
return () => listeners.delete(listener);
|
|
64
|
+
}
|
|
65
|
+
function dispose() {
|
|
66
|
+
disposed = true;
|
|
67
|
+
listeners.clear();
|
|
68
|
+
}
|
|
69
|
+
return { projectPath: input.projectPath, get, apply, onChange, dispose };
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=compile-mode-store.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ProjectSession } from '../../../shared/types.js';
|
|
2
|
+
import type { ProjectsProvider } from '../projects/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Run the provider's project-dir validation, folding a throwing/rejecting
|
|
5
|
+
* validator into the same dirError failure path as a returned error string —
|
|
6
|
+
* a broken validator is a failed validation, not a crashed open.
|
|
7
|
+
*/
|
|
8
|
+
export declare function validateProjectDirSafe(provider: ProjectsProvider, projectPath: string): Promise<string | null>;
|
|
9
|
+
/**
|
|
10
|
+
* Adapter-return boundary: a session without a string appId can't be driven by
|
|
11
|
+
* the renderer, so it must never become active. Close the live resources the
|
|
12
|
+
* adapter already spun up (best-effort) and return the error message; null when
|
|
13
|
+
* valid.
|
|
14
|
+
*/
|
|
15
|
+
export declare function rejectInvalidAppId(session: ProjectSession): Promise<string | null>;
|
|
16
|
+
//# sourceMappingURL=open-project-guards.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Run the provider's project-dir validation, folding a throwing/rejecting
|
|
4
|
+
* validator into the same dirError failure path as a returned error string —
|
|
5
|
+
* a broken validator is a failed validation, not a crashed open.
|
|
6
|
+
*/
|
|
7
|
+
export async function validateProjectDirSafe(provider, projectPath) {
|
|
8
|
+
try {
|
|
9
|
+
return provider.validateProjectDir
|
|
10
|
+
? await provider.validateProjectDir(projectPath)
|
|
11
|
+
: null;
|
|
12
|
+
}
|
|
13
|
+
catch (err) {
|
|
14
|
+
return err instanceof Error ? err.message : String(err);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Runtime guard for the adapter-return boundary: `session.appInfo` must carry a
|
|
19
|
+
* NON-EMPTY string `appId` (the renderer scopes IPC by it; the bridge's
|
|
20
|
+
* handleSpawn also rejects empty appIds, so accepting `''` would desync layers).
|
|
21
|
+
* Loose: extra fields pass through — only the contract-critical `appId` is enforced.
|
|
22
|
+
*/
|
|
23
|
+
const SessionAppInfoSchema = z.looseObject({ appId: z.string().min(1) });
|
|
24
|
+
/**
|
|
25
|
+
* Adapter-return boundary: a session without a string appId can't be driven by
|
|
26
|
+
* the renderer, so it must never become active. Close the live resources the
|
|
27
|
+
* adapter already spun up (best-effort) and return the error message; null when
|
|
28
|
+
* valid.
|
|
29
|
+
*/
|
|
30
|
+
export async function rejectInvalidAppId(session) {
|
|
31
|
+
if (SessionAppInfoSchema.safeParse(session.appInfo).success)
|
|
32
|
+
return null;
|
|
33
|
+
try {
|
|
34
|
+
await session.close();
|
|
35
|
+
}
|
|
36
|
+
catch (closeErr) {
|
|
37
|
+
console.warn('[workspace] closing appId-less adapter session failed (non-fatal):', closeErr);
|
|
38
|
+
}
|
|
39
|
+
return 'adapter returned session.appInfo without a string appId — '
|
|
40
|
+
+ 'the CompilationAdapter must supply appInfo.appId';
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=open-project-guards.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decide and emit the post-rebuild status for one completed rebuild.
|
|
3
|
+
*
|
|
4
|
+
* Explicit rebuild (`info.explicit` — the 重新编译 button, via
|
|
5
|
+
* `session.rebuild()`): the renderer's own relaunch drives a hard re-attach
|
|
6
|
+
* once the rebuild IPC resolves, and that re-attach is the run's ONLY
|
|
7
|
+
* reflection. Emitting `hotReload: true` here as well would race a soft
|
|
8
|
+
* reload against it — the two arrive through different channels with no
|
|
9
|
+
* ordering guarantee, so the soft reload can land AFTER the hard re-attach
|
|
10
|
+
* and drag the simulator back to the drifted page. The style fast path is a
|
|
11
|
+
* soft-update path too and is skipped for the same reason.
|
|
12
|
+
*
|
|
13
|
+
* Watcher rebuild (explicit absent/false) — style-only fast path: hot-swap the
|
|
14
|
+
* render-host stylesheets in place instead of respawning the DeviceShell —
|
|
15
|
+
* page stack / form state / scroll / focus survive (no jitter, no focus
|
|
16
|
+
* steal); `hotReload: false` keeps the renderer from bumping its reload token
|
|
17
|
+
* (the respawn signal). Falls through to the full reload when the swap can't
|
|
18
|
+
* run (no live render guest yet) so an edit is never dropped.
|
|
19
|
+
*
|
|
20
|
+
* `getProjectPages` never throws; empty pages are withheld so the renderer
|
|
21
|
+
* keeps its previous launch dropdown.
|
|
22
|
+
*/
|
|
23
|
+
export declare function reportRebuildStatus(info: {
|
|
24
|
+
styleOnly?: boolean;
|
|
25
|
+
explicit?: boolean;
|
|
26
|
+
} | undefined, deps: {
|
|
27
|
+
projectPath: string;
|
|
28
|
+
repo: {
|
|
29
|
+
getProjectPages: (p: string) => {
|
|
30
|
+
pages: string[];
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
autoReload: boolean;
|
|
34
|
+
refreshSimulatorStyles: () => boolean;
|
|
35
|
+
sendStatus: (status: string, message: string, hotReload?: boolean, pages?: string[]) => void;
|
|
36
|
+
}): void;
|
|
37
|
+
//# sourceMappingURL=rebuild-status.d.ts.map
|