@dimina-kit/devtools 0.4.0-dev.20260828161241 → 0.4.0-dev.20260907055341
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 +52 -729
- package/dist/main/app/app.d.ts +27 -7
- package/dist/main/app/app.js +285 -681
- 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/menu-setup.d.ts +13 -0
- package/dist/main/app/menu-setup.js +49 -0
- 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 +178 -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 +10669 -9096
- package/dist/main/ipc/app.d.ts +4 -1
- package/dist/main/ipc/app.js +4 -3
- 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 +1 -0
- package/dist/main/ipc/index.js +1 -0
- package/dist/main/ipc/internal-devtools.d.ts +2 -1
- package/dist/main/ipc/internal-devtools.js +4 -3
- package/dist/main/ipc/popover.d.ts +4 -1
- package/dist/main/ipc/popover.js +25 -9
- package/dist/main/ipc/project-create.d.ts +2 -1
- package/dist/main/ipc/project-create.js +6 -5
- package/dist/main/ipc/project-fs.d.ts +3 -1
- package/dist/main/ipc/project-fs.js +17 -17
- package/dist/main/ipc/projects.d.ts +3 -3
- package/dist/main/ipc/projects.js +13 -12
- package/dist/main/ipc/session.d.ts +4 -1
- package/dist/main/ipc/session.js +16 -11
- package/dist/main/ipc/settings.d.ts +4 -1
- package/dist/main/ipc/settings.js +12 -19
- package/dist/main/ipc/simulator-module.d.ts +5 -0
- package/dist/main/ipc/simulator-module.js +9 -5
- package/dist/main/ipc/simulator.d.ts +4 -1
- package/dist/main/ipc/simulator.js +12 -18
- package/dist/main/ipc/tooltip.d.ts +2 -1
- package/dist/main/ipc/tooltip.js +8 -7
- package/dist/main/ipc/views.d.ts +4 -1
- package/dist/main/ipc/views.js +20 -9
- package/dist/main/runtime/devtools-backend-before-quit.harness.d.ts +2 -20
- package/dist/main/runtime/devtools-backend-before-quit.harness.js +14 -283
- package/dist/main/runtime/devtools-backend.js +14 -3
- 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/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/default-adapter.js +1 -1
- 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 +8 -1
- package/dist/main/services/fs-watch-sse.js +19 -5
- 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/target-manager.d.ts +71 -23
- package/dist/main/services/mcp/target-manager.js +269 -142
- 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 +29 -6
- package/dist/main/services/mcp/tools/project-tools.js +37 -25
- package/dist/main/services/module.d.ts +13 -5
- package/dist/main/services/notifications/renderer-notifier.d.ts +28 -4
- package/dist/main/services/notifications/renderer-notifier.js +15 -3
- package/dist/main/services/projects/local-provider.js +2 -0
- package/dist/main/services/projects/project-repository.d.ts +31 -1
- package/dist/main/services/projects/project-repository.js +144 -20
- package/dist/main/services/projects/types.d.ts +31 -8
- package/dist/main/services/safe-area/index.d.ts +19 -5
- package/dist/main/services/safe-area/index.js +38 -13
- package/dist/main/services/simulator/ui-extensions.d.ts +8 -0
- package/dist/main/services/simulator/ui-extensions.js +16 -6
- package/dist/main/services/simulator-storage/index.d.ts +12 -1
- package/dist/main/services/simulator-storage/index.js +22 -7
- 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/views/host-slot-port-channel.d.ts +20 -3
- package/dist/main/services/views/host-slot-port-channel.js +33 -5
- package/dist/main/services/views/managed-web-contents-view.js +21 -1
- package/dist/main/services/views/native-simulator-view.js +13 -16
- package/dist/main/services/views/overlay-panels-view.d.ts +13 -0
- package/dist/main/services/views/overlay-panels-view.js +31 -0
- package/dist/main/services/views/view-manager.d.ts +1 -1
- package/dist/main/services/views/view-manager.js +3 -0
- 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.js +75 -133
- 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 +27 -3
- package/dist/main/services/workbench-context.js +10 -5
- 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/workspace-compile-modes.d.ts +59 -0
- package/dist/main/services/workspace/workspace-compile-modes.js +93 -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 +4 -0
- package/dist/main/services/workspace/workspace-service.js +51 -84
- 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 +42 -36
- package/dist/main/utils/ipc-registry.js +117 -50
- package/dist/main/utils/sender-policy.d.ts +9 -0
- package/dist/main/utils/sender-policy.js +26 -3
- package/dist/main/utils/theme.d.ts +3 -2
- package/dist/main/utils/theme.js +3 -2
- 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/native-host/common/common.js +94 -73
- package/dist/native-host/render/render.js +4079 -3171
- package/dist/native-host/service/service.js +2 -2
- package/dist/preload/runtime/native-host.d.ts +4 -0
- package/dist/preload/runtime/temp-files.js +9 -2
- package/dist/preload/runtime/wait-for-slot-root.d.ts +7 -4
- package/dist/preload/runtime/wait-for-slot-root.js +36 -8
- package/dist/preload/windows/host-dialog-runtime.cjs +10 -3
- package/dist/preload/windows/host-dialog-runtime.cjs.map +2 -2
- package/dist/preload/windows/host-sidebar-runtime.cjs +10 -3
- package/dist/preload/windows/host-sidebar-runtime.cjs.map +2 -2
- package/dist/preload/windows/host-toolbar-runtime.cjs +10 -3
- package/dist/preload/windows/host-toolbar-runtime.cjs.map +2 -2
- package/dist/preload/windows/main.cjs +181 -4
- package/dist/preload/windows/main.cjs.map +4 -4
- package/dist/preload/windows/simulator.cjs +10 -0
- package/dist/preload/windows/simulator.cjs.map +2 -2
- package/dist/preload/windows/simulator.js +10 -0
- package/dist/render-host/pageFrame.html +1 -1
- package/dist/render-host/preload.cjs +16 -4
- 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-Bqi8hpdi.js → createLucideIcon-cZ9FlZZw.js} +2 -2
- 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-DKWdE1TK.js → dist-DIFlRMKe.js} +2 -2
- package/dist/renderer/assets/hostSidebarDefault-DRWh6OCt.js +2 -0
- package/dist/renderer/assets/index-CEL_XFge.js +2 -0
- package/dist/renderer/assets/{input-Ct3alvkq.js → input-CAObw95L.js} +2 -2
- 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-DGLHmmOq.js → jsx-runtime-DIw5wnYl.js} +1 -1
- 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-Bbjz75bP.js → projectCreateDialog-BmLqiYxn.js} +2 -2
- 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-B_-_YVbw.js → tooltip-D6AxXRk5.js} +2 -2
- package/dist/renderer/assets/types-Bh0hA7El.js +2 -0
- package/dist/renderer/assets/updateDialog-CwndJ0Bl.js +2 -0
- package/dist/renderer/assets/{utils-kfQov6Pa.js → utils-sEB5OZEQ.js} +2 -2
- 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-BLJ0wKsg.js +5 -0
- package/dist/renderer/assets/{workbenchSettings-CV4LVA9b.js → workbenchSettings-YD0Ctbm_.js} +3 -3
- package/dist/renderer/entries/device-picker/index.html +28 -0
- package/dist/renderer/entries/host-sidebar-default/index.html +6 -5
- package/dist/renderer/entries/main/index.html +16 -17
- package/dist/renderer/entries/popover/index.html +16 -10
- package/dist/renderer/entries/project-create-dialog/index.html +12 -12
- package/dist/renderer/entries/settings/index.html +10 -10
- package/dist/renderer/entries/tooltip/index.html +5 -5
- package/dist/renderer/entries/update-dialog/index.html +10 -10
- package/dist/renderer/entries/workbench/index.html +49 -0
- package/dist/renderer/entries/workbench-settings/index.html +12 -11
- package/dist/service-host/host-env-update.cjs +23 -0
- package/dist/service-host/preload.cjs +24 -49
- package/dist/service-host/service-message-queue.cjs +71 -0
- package/dist/service-host/sync-impls/system-info.js +31 -9
- 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/ipc-channels-overlays.d.ts +8 -2
- package/dist/shared/ipc-channels-overlays.js +19 -2
- package/dist/shared/ipc-channels.d.ts +5 -10
- package/dist/shared/ipc-channels.js +17 -14
- package/dist/shared/ipc-schemas.d.ts +76 -24
- package/dist/shared/ipc-schemas.js +55 -10
- package/dist/shared/project-window-types.d.ts +42 -0
- package/dist/shared/project-window-types.js +2 -0
- package/dist/shared/types.d.ts +43 -17
- package/dist/shared/view-ids.d.ts +1 -0
- package/dist/shared/view-ids.js +3 -1
- 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-pxnZZp10.js +431 -0
- package/dist/simulator/assets/simulator-Dwp7lnvu.js +10 -0
- package/dist/simulator/assets/simulator-mini-app-DFo7fhi5.js +2 -0
- package/dist/simulator/assets/simulator-ui-B2ddJB1R.js +2 -0
- package/dist/simulator/simulator.html +3 -3
- package/dist/simulator/temp-files.d.ts +6 -0
- package/dist/simulator/temp-files.js +46 -4
- package/dist/simulator/types.d.ts +7 -0
- package/dist/vscode-workbench/assets/__vite-browser-external-JIkWewFf.js +1 -0
- package/dist/vscode-workbench/assets/{dist-CMfmHflW.js → dist-CXG-u1VB.js} +3 -3
- package/dist/vscode-workbench/assets/{iconv-lite-umd-Bx8CgaZq.js → iconv-lite-umd-Dxx9Qyb4.js} +1 -1
- package/dist/vscode-workbench/assets/{index-CdG6YWhW.js → index-6VJMsaWj.js} +460 -460
- package/dist/vscode-workbench/assets/{jschardet-M0qgd2lN.js → jschardet-Ba3D16vt.js} +1 -1
- package/dist/vscode-workbench/index.html +1 -1
- package/package.json +11 -8
- package/dist/renderer/assets/button-D5Q2wkXq.js +0 -2
- package/dist/renderer/assets/constants-D7DfVqMp.js +0 -2
- package/dist/renderer/assets/constants-D8zsejFq.js +0 -2
- package/dist/renderer/assets/dialog-e1TecTOY.js +0 -46
- package/dist/renderer/assets/hostSidebarDefault-B3yLfy8j.js +0 -2
- package/dist/renderer/assets/index-CsPD68N_.js +0 -5
- package/dist/renderer/assets/ipc-channels-overlays-LsDzGAtV.js +0 -2
- package/dist/renderer/assets/jsx-runtime-2vXHouwr.css +0 -1
- package/dist/renderer/assets/popover-Dix5cm_b.js +0 -2
- package/dist/renderer/assets/project-api-k7Oq9iaq.js +0 -2
- package/dist/renderer/assets/select-acGb0AmJ.js +0 -2
- package/dist/renderer/assets/settings-CQrTMr43.js +0 -2
- package/dist/renderer/assets/settings-api-CrUQ9rYV.js +0 -2
- package/dist/renderer/assets/settings-tab-bar-Cw1kVIf2.js +0 -2
- package/dist/renderer/assets/types-CsEKtFyr.js +0 -2
- package/dist/renderer/assets/updateDialog-NsF8223A.js +0 -2
- package/dist/renderer/assets/view-api-CLn3rcQE.js +0 -2
- package/dist/simulator/assets/bridge-channels-zhsumfky.js +0 -2
- package/dist/simulator/assets/device-shell-CmtM1QxP.js +0 -2
- package/dist/simulator/assets/device-shell-iFZo1igL.css +0 -1
- package/dist/simulator/assets/simulator-CIobn3Mh.js +0 -10
- package/dist/simulator/assets/simulator-mini-app-CRe6n9br.js +0 -2
- package/dist/simulator/assets/simulator-ui-C_cP602X.js +0 -2
- package/dist/vscode-workbench/assets/__vite-browser-external-Bc1vizTf.js +0 -1
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* - `./target-manager.ts` dual-target CDP connection + reconnect
|
|
13
13
|
*/
|
|
14
14
|
export { startMcpServer } from './server.js';
|
|
15
|
+
export type { McpProjectHost, McpProjectTarget } from './tools/project-tools.js';
|
|
15
16
|
export { getMcpStatus, type McpRuntimeStatus } from './status.js';
|
|
16
|
-
export {
|
|
17
|
+
export { registerMcpWindow, setActiveMcpWindowResolver, noteActiveBridgeId, noteActiveMcpWindowChanged, activeMcpWindow, getNativeOverviewProvider, type McpWindowFacts, } from './target-manager.js';
|
|
18
|
+
export { createOpenForMcp, createTargetForMcp, type McpOpenedProject } from './opened-project.js';
|
|
17
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
*/
|
|
14
14
|
export { startMcpServer } from './server.js';
|
|
15
15
|
export { getMcpStatus } from './status.js';
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
export {
|
|
16
|
+
// Every project window owns its own native-host state and its own renderer, so
|
|
17
|
+
// each registers its facts and MCP resolves the active window on every use.
|
|
18
|
+
export { registerMcpWindow, setActiveMcpWindowResolver, noteActiveBridgeId, noteActiveMcpWindowChanged, activeMcpWindow, getNativeOverviewProvider, } from './target-manager.js';
|
|
19
|
+
export { createOpenForMcp, createTargetForMcp } from './opened-project.js';
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolving the project window an MCP call is aimed at.
|
|
3
|
+
*
|
|
4
|
+
* A project lives in its own window and every window keeps its own
|
|
5
|
+
* session-status store, so `project_open` can only report the truth if it
|
|
6
|
+
* awaits the store of the window it just opened. Reading the app-active
|
|
7
|
+
* window's store instead times out on a first open (that window never compiles
|
|
8
|
+
* this project) and can return another project's rebuild as this one's result.
|
|
9
|
+
* The other tools have no window of their own to point at, so they take the
|
|
10
|
+
* active one — once per call, as a whole.
|
|
11
|
+
*/
|
|
12
|
+
import type { SessionStatusStore } from '../workspace/session-status-store.js';
|
|
13
|
+
import type { McpProjectTarget } from './tools/project-tools.js';
|
|
14
|
+
/** The status surface `project_open` reports from: one window's own state. */
|
|
15
|
+
export interface McpProjectStatusSource {
|
|
16
|
+
workspace: {
|
|
17
|
+
getProjectPath(): string;
|
|
18
|
+
hasActiveSession(): boolean;
|
|
19
|
+
};
|
|
20
|
+
sessionStatus: SessionStatusStore;
|
|
21
|
+
}
|
|
22
|
+
export interface McpOpenedProject extends McpProjectStatusSource {
|
|
23
|
+
/**
|
|
24
|
+
* Generation guard for awaiting this open's compile. A window built by the
|
|
25
|
+
* open reports 0, so its empty store's initial 'idle' is not mistaken for a
|
|
26
|
+
* finished compile. A window that was already showing the project reports
|
|
27
|
+
* `undefined`: focusing it triggers no compile, so its current settled state
|
|
28
|
+
* IS the answer, and waiting for a newer one would hang.
|
|
29
|
+
*/
|
|
30
|
+
afterGeneration?: number;
|
|
31
|
+
}
|
|
32
|
+
interface OpenedWindow<W> {
|
|
33
|
+
window: W;
|
|
34
|
+
context: McpProjectStatusSource;
|
|
35
|
+
}
|
|
36
|
+
export interface OpenForMcpDeps<W> {
|
|
37
|
+
/** Open the project in its own window (or focus the one already showing it). */
|
|
38
|
+
open: (project: {
|
|
39
|
+
name?: string;
|
|
40
|
+
path: string;
|
|
41
|
+
}) => Promise<W>;
|
|
42
|
+
/** Every live project window, so the opened one can be matched by identity. */
|
|
43
|
+
list: () => OpenedWindow<W>[];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Build the `requestOpenInUi` the MCP project tools drive: open the project
|
|
47
|
+
* and hand back the window it landed in, together with the generation guard
|
|
48
|
+
* for awaiting that window's compile.
|
|
49
|
+
*/
|
|
50
|
+
export declare function createOpenForMcp<W>(deps: OpenForMcpDeps<W>): (project: {
|
|
51
|
+
name: string;
|
|
52
|
+
path: string;
|
|
53
|
+
}) => Promise<McpOpenedProject>;
|
|
54
|
+
/**
|
|
55
|
+
* The window-context fields an MCP project call reads. Structural, so this
|
|
56
|
+
* module stays independent of the workbench context that satisfies it.
|
|
57
|
+
*/
|
|
58
|
+
export interface McpTargetContext {
|
|
59
|
+
workspace: McpProjectTarget['workspace'];
|
|
60
|
+
sessionStatus: McpProjectTarget['sessionStatus'];
|
|
61
|
+
compileLogBuffer: McpProjectTarget['compileLogs'];
|
|
62
|
+
}
|
|
63
|
+
export interface TargetForMcpDeps<W, C extends McpTargetContext> {
|
|
64
|
+
/** Every live project window, so the active one can be matched by context. */
|
|
65
|
+
list: () => {
|
|
66
|
+
window: W;
|
|
67
|
+
context: C;
|
|
68
|
+
}[];
|
|
69
|
+
/** The context of the project window the user is working in. */
|
|
70
|
+
activeContext: () => C;
|
|
71
|
+
/** Take one window down the way a user-driven close does. */
|
|
72
|
+
close: (window: W) => void;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Build the `currentProject` the MCP project tools drive: resolve the project
|
|
76
|
+
* window the user is working in NOW and hand back every surface a tool call
|
|
77
|
+
* needs, all bound to that one window.
|
|
78
|
+
*
|
|
79
|
+
* Tool calls yield — `closeProject()` awaits a teardown, `waitForSettled()`
|
|
80
|
+
* awaits a compile — and the user can focus another project meanwhile.
|
|
81
|
+
* Re-resolving afterwards reports one project's compile as another's, or
|
|
82
|
+
* closes the window they just moved to while the window whose session was torn
|
|
83
|
+
* down stays on screen, empty. The active context can also be the project
|
|
84
|
+
* list, which owns no project window: closing then does nothing.
|
|
85
|
+
*/
|
|
86
|
+
export declare function createTargetForMcp<W, C extends McpTargetContext>(deps: TargetForMcpDeps<W, C>): () => McpProjectTarget;
|
|
87
|
+
export {};
|
|
88
|
+
//# sourceMappingURL=opened-project.d.ts.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolving the project window an MCP call is aimed at.
|
|
3
|
+
*
|
|
4
|
+
* A project lives in its own window and every window keeps its own
|
|
5
|
+
* session-status store, so `project_open` can only report the truth if it
|
|
6
|
+
* awaits the store of the window it just opened. Reading the app-active
|
|
7
|
+
* window's store instead times out on a first open (that window never compiles
|
|
8
|
+
* this project) and can return another project's rebuild as this one's result.
|
|
9
|
+
* The other tools have no window of their own to point at, so they take the
|
|
10
|
+
* active one — once per call, as a whole.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Build the `requestOpenInUi` the MCP project tools drive: open the project
|
|
14
|
+
* and hand back the window it landed in, together with the generation guard
|
|
15
|
+
* for awaiting that window's compile.
|
|
16
|
+
*/
|
|
17
|
+
export function createOpenForMcp(deps) {
|
|
18
|
+
return async (project) => {
|
|
19
|
+
// Sampled BEFORE the open: a window that already exists carries a previous
|
|
20
|
+
// compile's history, and only a state recorded after this point can be
|
|
21
|
+
// this open's result. Keyed by context identity, so a window rebuilt
|
|
22
|
+
// during the open is correctly seen as new.
|
|
23
|
+
const before = new Map(deps.list().map((w) => [w.context, w.context.sessionStatus.get().generation]));
|
|
24
|
+
const window = await deps.open(project);
|
|
25
|
+
const opened = deps.list().find((w) => w.window === window);
|
|
26
|
+
if (!opened)
|
|
27
|
+
throw new Error(`the window opened for ${project.path} is already gone`);
|
|
28
|
+
return {
|
|
29
|
+
workspace: opened.context.workspace,
|
|
30
|
+
sessionStatus: opened.context.sessionStatus,
|
|
31
|
+
afterGeneration: before.has(opened.context) ? undefined : 0,
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Build the `currentProject` the MCP project tools drive: resolve the project
|
|
37
|
+
* window the user is working in NOW and hand back every surface a tool call
|
|
38
|
+
* needs, all bound to that one window.
|
|
39
|
+
*
|
|
40
|
+
* Tool calls yield — `closeProject()` awaits a teardown, `waitForSettled()`
|
|
41
|
+
* awaits a compile — and the user can focus another project meanwhile.
|
|
42
|
+
* Re-resolving afterwards reports one project's compile as another's, or
|
|
43
|
+
* closes the window they just moved to while the window whose session was torn
|
|
44
|
+
* down stays on screen, empty. The active context can also be the project
|
|
45
|
+
* list, which owns no project window: closing then does nothing.
|
|
46
|
+
*/
|
|
47
|
+
export function createTargetForMcp(deps) {
|
|
48
|
+
return () => {
|
|
49
|
+
const context = deps.activeContext();
|
|
50
|
+
const owner = deps.list().find((w) => w.context === context);
|
|
51
|
+
return {
|
|
52
|
+
workspace: context.workspace,
|
|
53
|
+
sessionStatus: context.sessionStatus,
|
|
54
|
+
compileLogs: context.compileLogBuffer,
|
|
55
|
+
closeWindow: () => { if (owner)
|
|
56
|
+
deps.close(owner.window); },
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=opened-project.js.map
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* - rolling buffers of console log and network request events
|
|
11
11
|
*/
|
|
12
12
|
import CDP from 'chrome-remote-interface';
|
|
13
|
+
import { type TargetIdentityFacts } from './connection-owner.js';
|
|
14
|
+
export { selectSimulatorTarget, selectWorkbenchTarget } from './target-selection.js';
|
|
13
15
|
export type TargetKind = 'simulator' | 'workbench';
|
|
14
16
|
export interface ConsoleLogEntry {
|
|
15
17
|
level: string;
|
|
@@ -38,38 +40,84 @@ export type NativeOverviewProvider = () => Promise<NativeOverview>;
|
|
|
38
40
|
interface TargetState {
|
|
39
41
|
client: CDP.Client | null;
|
|
40
42
|
connected: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The window this live connection ACTUALLY reached — not the one it was
|
|
45
|
+
* aimed at, and null when the target names no project window (the project
|
|
46
|
+
* list). Read on every `getClient`, so a connection left behind by a window
|
|
47
|
+
* switch is refused instead of answering for the wrong project.
|
|
48
|
+
*/
|
|
49
|
+
owner: object | null;
|
|
41
50
|
timer: ReturnType<typeof setTimeout> | null;
|
|
42
51
|
consoleLogs: ConsoleLogEntry[];
|
|
43
52
|
networkRequests: NetworkRequestEntry[];
|
|
53
|
+
/**
|
|
54
|
+
* The owner these buffers were most recently cleared and populated for.
|
|
55
|
+
* Distinct from `owner`, which goes null the instant a target is lost: a
|
|
56
|
+
* reconnect that lands back on the same window (a transient CDP drop) must
|
|
57
|
+
* find its buffers intact, so what decides whether to clear is this record
|
|
58
|
+
* of the last owner they were published for, not the connection's current
|
|
59
|
+
* live/dead state.
|
|
60
|
+
*/
|
|
61
|
+
bufferOwner: object | null;
|
|
44
62
|
}
|
|
45
|
-
export declare function setCdpPort(port: number): void;
|
|
46
|
-
export declare function setNativeHost(enabled: boolean): void;
|
|
47
|
-
/**
|
|
48
|
-
* Update the active-page bridgeId so the `simulator` target follows the
|
|
49
|
-
* currently visible render guest. No-op when unchanged. When native-host is
|
|
50
|
-
* on and the simulator target is already connected, fire-and-forget a
|
|
51
|
-
* reconnect so MCP re-points at the new active page.
|
|
52
|
-
*/
|
|
53
|
-
export declare function setActiveBridgeId(id: string | null): void;
|
|
54
|
-
export declare function setNativeOverviewProvider(provider: NativeOverviewProvider | null): void;
|
|
55
|
-
export declare function getNativeOverviewProvider(): NativeOverviewProvider | null;
|
|
56
63
|
/**
|
|
57
|
-
*
|
|
64
|
+
* What MCP needs to know about ONE project window.
|
|
58
65
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* (pageFrame.html?...bridgeId=<id>), preferring the guest matching
|
|
64
|
-
* `activeBridgeId`, then any pageFrame guest, then degrading to the shell.
|
|
66
|
+
* Every project runs in its own window, so native-host mode, the visible
|
|
67
|
+
* render guest, the cross-process overview provider and the project identity
|
|
68
|
+
* are facts about a single window — never about the process. A window
|
|
69
|
+
* publishes its own record here and drops only that record when it closes.
|
|
65
70
|
*/
|
|
66
|
-
export
|
|
67
|
-
|
|
68
|
-
type?: string;
|
|
69
|
-
}>(targets: T[], opts: {
|
|
71
|
+
export interface McpWindowFacts extends TargetIdentityFacts {
|
|
72
|
+
/** The window runs the native-host runtime (mini-app pages live in nested render guests). */
|
|
70
73
|
nativeHost: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* The visible page's bridgeId, pushed from this window's bridge-router
|
|
76
|
+
* render events. `selectSimulatorTarget` prefers the guest matching it so
|
|
77
|
+
* MCP follows the active page across navigation/tab switches.
|
|
78
|
+
*/
|
|
71
79
|
activeBridgeId: string | null;
|
|
72
|
-
|
|
80
|
+
nativeOverviewProvider: NativeOverviewProvider | null;
|
|
81
|
+
/** Absolute path of the project this window opened with; never changes. */
|
|
82
|
+
projectPath: string;
|
|
83
|
+
/** appId of the project open in this window; null before its session exists. */
|
|
84
|
+
getAppId: () => string | null;
|
|
85
|
+
}
|
|
86
|
+
export interface McpWindowRegistration {
|
|
87
|
+
facts: McpWindowFacts;
|
|
88
|
+
dispose: () => void;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Point MCP at the window the user is working in. Assembled once by the app;
|
|
92
|
+
* `owner` is the opaque token a window registered itself under. Resolving to
|
|
93
|
+
* null means no project window is open, which is the answer MCP reports before
|
|
94
|
+
* the first project is opened.
|
|
95
|
+
*/
|
|
96
|
+
export declare function setActiveMcpWindowResolver(resolve: () => object | null): void;
|
|
97
|
+
export declare function registerMcpWindow(owner: object, facts: McpWindowFacts): McpWindowRegistration;
|
|
98
|
+
/** The facts of the project window MCP currently drives, or null when none is open. */
|
|
99
|
+
export declare function activeMcpWindow(): McpWindowFacts | null;
|
|
100
|
+
/**
|
|
101
|
+
* Record the render guest now visible in `owner`'s window. Re-points the live
|
|
102
|
+
* simulator connection only when that window is the one MCP drives — a
|
|
103
|
+
* navigation in a background project window must not steal the target.
|
|
104
|
+
*/
|
|
105
|
+
export declare function noteActiveBridgeId(owner: object, id: string | null): void;
|
|
106
|
+
/**
|
|
107
|
+
* The active project window changed. A connection that is already established
|
|
108
|
+
* was aimed at whichever window was active when it was made, and nothing
|
|
109
|
+
* re-read that afterwards — so without this the MCP tools keep reporting and
|
|
110
|
+
* driving the project the user has left. Only connections bound to a different
|
|
111
|
+
* window are re-aimed; the rest are left alone.
|
|
112
|
+
*
|
|
113
|
+
* Coalesced on purpose: clicking across windows produces a burst of these, and
|
|
114
|
+
* re-resolving once the burst settles means focus that returns to the window a
|
|
115
|
+
* connection already holds costs nothing.
|
|
116
|
+
*/
|
|
117
|
+
export declare function noteActiveMcpWindowChanged(): void;
|
|
118
|
+
export declare function setCdpPort(port: number): void;
|
|
119
|
+
/** The cross-process overview reader of the window MCP drives, if it has one. */
|
|
120
|
+
export declare function getNativeOverviewProvider(): NativeOverviewProvider | null;
|
|
73
121
|
export declare function getTargetState(kind: TargetKind): TargetState;
|
|
74
122
|
declare function listCdpTargets(): Promise<CDP.Target[]>;
|
|
75
123
|
export { listCdpTargets as listTargets };
|