@dimina-kit/devtools 0.3.0 → 0.3.1-dev.20260515105504
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 +103 -41
- package/dist/main/api.d.ts +6 -2
- package/dist/main/api.js +5 -2
- package/dist/main/app/app.d.ts +1 -1
- package/dist/main/app/app.js +71 -36
- package/dist/main/app/launch.d.ts +2 -2
- package/dist/main/app/launch.js +6 -3
- package/dist/main/index.bundle.js +1134 -300
- package/dist/main/ipc/app.d.ts +2 -1
- package/dist/main/ipc/app.js +5 -4
- package/dist/main/ipc/index.d.ts +5 -4
- package/dist/main/ipc/index.js +5 -4
- package/dist/main/ipc/panels.d.ts +2 -1
- package/dist/main/ipc/panels.js +14 -9
- package/dist/main/ipc/popover.d.ts +4 -1
- package/dist/main/ipc/popover.js +15 -5
- package/dist/main/ipc/projects.d.ts +4 -1
- package/dist/main/ipc/projects.js +42 -5
- package/dist/main/ipc/session.d.ts +4 -1
- package/dist/main/ipc/session.js +26 -6
- package/dist/main/ipc/settings.d.ts +4 -1
- package/dist/main/ipc/settings.js +30 -17
- package/dist/main/ipc/simulator-module.d.ts +8 -0
- package/dist/main/ipc/simulator-module.js +19 -0
- package/dist/main/ipc/simulator.d.ts +2 -1
- package/dist/main/ipc/simulator.js +29 -15
- package/dist/main/ipc/toolbar.d.ts +2 -1
- package/dist/main/ipc/toolbar.js +3 -2
- package/dist/main/services/automation/index.js +88 -13
- package/dist/main/services/default-adapter.js +1 -3
- package/dist/main/services/mcp/server.d.ts +2 -1
- package/dist/main/services/mcp/server.js +5 -0
- package/dist/main/services/module.d.ts +18 -0
- package/dist/main/services/module.js +2 -0
- package/dist/main/services/notifications/renderer-notifier.d.ts +2 -0
- package/dist/main/services/projects/project-repository.d.ts +1 -0
- package/dist/main/services/projects/project-repository.js +3 -0
- package/dist/main/services/settings/index.d.ts +4 -0
- package/dist/main/services/settings/index.js +12 -1
- package/dist/main/services/simulator/custom-apis.d.ts +10 -0
- package/dist/main/services/simulator/custom-apis.js +26 -0
- package/dist/main/services/simulator/dir.d.ts +1 -1
- package/dist/main/services/simulator/dir.js +1 -4
- package/dist/main/services/simulator-storage/index.d.ts +22 -1
- package/dist/main/services/simulator-storage/index.js +390 -84
- package/dist/main/services/update/update-manager.d.ts +16 -1
- package/dist/main/services/update/update-manager.js +18 -15
- package/dist/main/services/views/view-manager.d.ts +4 -0
- package/dist/main/services/views/view-manager.js +33 -2
- package/dist/main/services/window-service.d.ts +24 -0
- package/dist/main/services/window-service.js +26 -0
- package/dist/main/services/workbench-context.d.ts +15 -0
- package/dist/main/services/workbench-context.js +6 -0
- package/dist/main/services/workspace/workspace-service.d.ts +1 -0
- package/dist/main/services/workspace/workspace-service.js +7 -3
- package/dist/main/simulator-apis.d.ts +23 -0
- package/dist/main/simulator-apis.js +24 -0
- package/dist/main/utils/disposable.d.ts +13 -0
- package/dist/main/utils/disposable.js +60 -0
- package/dist/main/utils/ipc-registry.d.ts +39 -0
- package/dist/main/utils/ipc-registry.js +109 -0
- package/dist/main/utils/ipc-schema.d.ts +28 -0
- package/dist/main/utils/ipc-schema.js +38 -0
- package/dist/main/utils/paths.d.ts +8 -0
- package/dist/main/utils/paths.js +33 -4
- package/dist/main/utils/sender-policy.d.ts +23 -0
- package/dist/main/utils/sender-policy.js +42 -0
- package/dist/main/windows/main-window/create.d.ts +6 -0
- package/dist/main/windows/main-window/create.js +65 -9
- package/dist/main/windows/main-window/events.d.ts +2 -1
- package/dist/main/windows/main-window/events.js +25 -2
- package/dist/main/windows/navigation-hardening.d.ts +24 -0
- package/dist/main/windows/navigation-hardening.js +55 -0
- package/dist/main/windows/settings-window/create.js +11 -1
- package/dist/preload/index.d.ts +17 -0
- package/dist/preload/index.js +17 -0
- package/dist/preload/instrumentation/app-data.js +178 -19
- package/dist/preload/instrumentation/wxml-extract.js +134 -3
- package/dist/preload/runtime/bridge.d.ts +3 -1
- package/dist/preload/runtime/bridge.js +55 -4
- package/dist/preload/runtime/custom-apis.d.ts +6 -0
- package/dist/preload/runtime/custom-apis.js +18 -0
- package/dist/preload/runtime/host.d.ts +1 -0
- package/dist/preload/runtime/host.js +13 -0
- package/dist/preload/shared/types.d.ts +2 -1
- package/dist/preload/windows/main.cjs +47 -0
- package/dist/preload/windows/main.cjs.map +7 -0
- package/dist/preload/windows/simulator.js +274 -25
- package/dist/renderer/assets/index-DW_0thr-.js +46 -0
- package/dist/renderer/assets/{input-VLotwer2.js → input-C5M5Wxn6.js} +2 -2
- package/dist/renderer/assets/{ipc-transport-COKIC6Ny.js → ipc-transport-CUsl-fS2.js} +6 -6
- package/dist/renderer/assets/ipc-transport-CltRuvhi.css +1 -0
- package/dist/renderer/assets/{popover-Dn0RwMLI.js → popover-BSBPVO0o.js} +2 -2
- package/dist/renderer/assets/{select-DzIsLaKX.js → select-B1tF3UAc.js} +2 -2
- package/dist/renderer/assets/{settings-CD-dacWB.js → settings-7w54H6p-.js} +2 -2
- package/dist/renderer/assets/settings-api-BjJalghB.js +2 -0
- package/dist/renderer/assets/workbenchSettings-q2_-nc8t.js +8 -0
- package/dist/renderer/entries/main/index.html +12 -5
- package/dist/renderer/entries/popover/index.html +7 -5
- package/dist/renderer/entries/settings/index.html +7 -5
- package/dist/renderer/entries/workbench-settings/index.html +6 -4
- package/dist/shared/ipc-channels.d.ts +45 -0
- package/dist/shared/ipc-channels.js +28 -0
- package/dist/shared/ipc-schemas.d.ts +113 -0
- package/dist/shared/ipc-schemas.js +128 -0
- package/dist/shared/types.d.ts +2 -0
- package/dist/simulator/assets/simulator-DL6kOCq-.js +9 -0
- package/dist/simulator/simulator.html +1 -1
- package/package.json +11 -27
- package/dist/preload/windows/main.d.ts +0 -6
- package/dist/preload/windows/main.js +0 -6
- package/dist/renderer/assets/index-D_HFRqZA.js +0 -46
- package/dist/renderer/assets/ipc-transport-6Gy3FXIL.css +0 -1
- package/dist/renderer/assets/settings-api-BV9MPckG.js +0 -2
- package/dist/renderer/assets/workbenchSettings-ClwgsvJL.js +0 -8
- package/dist/simulator/assets/simulator-C1eHXnuq.js +0 -9
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
* Tool registration lives in `./tool-registry` and `./tools/*`; this file
|
|
7
7
|
* only wires up transports and lifecycle.
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
import { type Disposable } from '../../utils/disposable.js';
|
|
10
|
+
export declare function startMcpServer(resolvedCdpPort: number, mcpPort: number): Disposable;
|
|
10
11
|
//# sourceMappingURL=server.d.ts.map
|
|
@@ -10,6 +10,7 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
|
10
10
|
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
|
|
11
11
|
import { createServer } from 'http';
|
|
12
12
|
import { createRequire } from 'node:module';
|
|
13
|
+
import { toDisposable } from '../../utils/disposable.js';
|
|
13
14
|
import { connectTarget, setCdpPort } from './target-manager.js';
|
|
14
15
|
import { registerCommonTargetTools } from './tool-registry.js';
|
|
15
16
|
import { registerContextTools } from './tools/context-tools.js';
|
|
@@ -72,5 +73,9 @@ export function startMcpServer(resolvedCdpPort, mcpPort) {
|
|
|
72
73
|
httpServer.listen(mcpPort, '127.0.0.1', () => {
|
|
73
74
|
console.log(`[MCP] SSE server listening on http://127.0.0.1:${mcpPort}/sse`);
|
|
74
75
|
});
|
|
76
|
+
return toDisposable(() => {
|
|
77
|
+
transports.clear();
|
|
78
|
+
httpServer.close();
|
|
79
|
+
});
|
|
75
80
|
}
|
|
76
81
|
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Disposable } from '../utils/disposable.js';
|
|
2
|
+
import type { WorkbenchContext } from './workbench-context.js';
|
|
3
|
+
/**
|
|
4
|
+
* A composable unit of workbench functionality.
|
|
5
|
+
*
|
|
6
|
+
* Built-in modules (projects, session, simulator, popover, settings) are
|
|
7
|
+
* implemented as `WorkbenchModule` values; hosts may also inject extra
|
|
8
|
+
* modules via `WorkbenchAppConfig.extraModules`.
|
|
9
|
+
*
|
|
10
|
+
* `setup` is invoked once during workbench bootstrap. The returned
|
|
11
|
+
* Disposable is added to `ctx.registry` so module teardown is symmetric
|
|
12
|
+
* with the rest of the workbench lifecycle.
|
|
13
|
+
*/
|
|
14
|
+
export interface WorkbenchModule {
|
|
15
|
+
/** Set up the module against ctx. Returns a Disposable owned by ctx.registry. */
|
|
16
|
+
setup(ctx: WorkbenchContext): Disposable;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -8,6 +8,8 @@ import type { ProjectSettings } from '../projects/project-repository.js';
|
|
|
8
8
|
export interface ProjectStatusPayload {
|
|
9
9
|
status: string;
|
|
10
10
|
message: string;
|
|
11
|
+
/** True when the status update is emitted by the file-watcher rebuild loop. */
|
|
12
|
+
hotReload?: boolean;
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
15
|
* Payload for the `settings:init` event sent into the embedded settings overlay
|
|
@@ -15,6 +15,7 @@ export interface ProjectSettings {
|
|
|
15
15
|
export type { CompileConfig } from '../../../shared/types.js';
|
|
16
16
|
export declare function listProjects(): Project[];
|
|
17
17
|
export declare function validateProjectDir(dirPath: string): string | null;
|
|
18
|
+
export declare function hasProject(dirPath: string): boolean;
|
|
18
19
|
export declare function addProject(dirPath: string): Project;
|
|
19
20
|
export declare function removeProject(dirPath: string): void;
|
|
20
21
|
export declare function updateLastOpened(dirPath: string): void;
|
|
@@ -46,6 +46,9 @@ export function validateProjectDir(dirPath) {
|
|
|
46
46
|
}
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
|
+
export function hasProject(dirPath) {
|
|
50
|
+
return load().some((p) => p.path === dirPath);
|
|
51
|
+
}
|
|
49
52
|
export function addProject(dirPath) {
|
|
50
53
|
const projects = load();
|
|
51
54
|
let name = path.basename(dirPath);
|
|
@@ -8,6 +8,10 @@ export interface WorkbenchSettings {
|
|
|
8
8
|
enabled: boolean;
|
|
9
9
|
port: number;
|
|
10
10
|
};
|
|
11
|
+
compile: {
|
|
12
|
+
/** Watch project files and auto-recompile on change. */
|
|
13
|
+
watch: boolean;
|
|
14
|
+
};
|
|
11
15
|
theme: ThemeSource;
|
|
12
16
|
}
|
|
13
17
|
export declare function loadWorkbenchSettings(): WorkbenchSettings;
|
|
@@ -10,6 +10,9 @@ const DEFAULTS = {
|
|
|
10
10
|
enabled: false,
|
|
11
11
|
port: 7789,
|
|
12
12
|
},
|
|
13
|
+
compile: {
|
|
14
|
+
watch: true,
|
|
15
|
+
},
|
|
13
16
|
theme: 'system',
|
|
14
17
|
};
|
|
15
18
|
function getSettingsFile() {
|
|
@@ -30,11 +33,19 @@ export function loadWorkbenchSettings() {
|
|
|
30
33
|
enabled: data.mcp?.enabled ?? DEFAULTS.mcp.enabled,
|
|
31
34
|
port: data.mcp?.port ?? DEFAULTS.mcp.port,
|
|
32
35
|
},
|
|
36
|
+
compile: {
|
|
37
|
+
watch: data.compile?.watch ?? DEFAULTS.compile.watch,
|
|
38
|
+
},
|
|
33
39
|
theme,
|
|
34
40
|
};
|
|
35
41
|
}
|
|
36
42
|
catch {
|
|
37
|
-
return {
|
|
43
|
+
return {
|
|
44
|
+
...DEFAULTS,
|
|
45
|
+
cdp: { ...DEFAULTS.cdp },
|
|
46
|
+
mcp: { ...DEFAULTS.mcp },
|
|
47
|
+
compile: { ...DEFAULTS.compile },
|
|
48
|
+
};
|
|
38
49
|
}
|
|
39
50
|
}
|
|
40
51
|
export function saveWorkbenchSettings(settings) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type SimulatorApiHandler = (params: unknown) => unknown | Promise<unknown>;
|
|
2
|
+
export interface SimulatorApiRegistry {
|
|
3
|
+
register(name: string, handler: SimulatorApiHandler): () => void;
|
|
4
|
+
list(): string[];
|
|
5
|
+
invoke(name: string, params: unknown): Promise<unknown>;
|
|
6
|
+
clear(): void;
|
|
7
|
+
}
|
|
8
|
+
export declare function createSimulatorApiRegistry(): SimulatorApiRegistry;
|
|
9
|
+
export declare const simulatorApiRegistry: SimulatorApiRegistry;
|
|
10
|
+
//# sourceMappingURL=custom-apis.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export function createSimulatorApiRegistry() {
|
|
2
|
+
const handlers = new Map();
|
|
3
|
+
return {
|
|
4
|
+
register(name, handler) {
|
|
5
|
+
handlers.set(name, handler);
|
|
6
|
+
return () => {
|
|
7
|
+
if (handlers.get(name) === handler)
|
|
8
|
+
handlers.delete(name);
|
|
9
|
+
};
|
|
10
|
+
},
|
|
11
|
+
list() {
|
|
12
|
+
return Array.from(handlers.keys());
|
|
13
|
+
},
|
|
14
|
+
async invoke(name, params) {
|
|
15
|
+
const handler = handlers.get(name);
|
|
16
|
+
if (!handler)
|
|
17
|
+
throw new Error(`Simulator API "${name}" is not registered`);
|
|
18
|
+
return await handler(params);
|
|
19
|
+
},
|
|
20
|
+
clear() {
|
|
21
|
+
handlers.clear();
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export const simulatorApiRegistry = createSimulatorApiRegistry();
|
|
26
|
+
//# sourceMappingURL=custom-apis.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { simulatorDir } from '../../utils/paths.js';
|
|
2
2
|
//# sourceMappingURL=dir.d.ts.map
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { fileURLToPath } from 'url';
|
|
3
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
4
|
-
export const simulatorDir = path.join(__dirname, '../../../simulator');
|
|
1
|
+
export { simulatorDir } from '../../utils/paths.js';
|
|
5
2
|
//# sourceMappingURL=dir.js.map
|
|
@@ -16,5 +16,26 @@
|
|
|
16
16
|
* events stop flowing until they close it.
|
|
17
17
|
*/
|
|
18
18
|
import { type WebContents } from 'electron';
|
|
19
|
-
|
|
19
|
+
import { type Disposable } from '../../utils/disposable.js';
|
|
20
|
+
import { type SenderPolicy } from '../../utils/ipc-registry.js';
|
|
21
|
+
export interface SimulatorStorageOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Sender gate applied to `SimulatorStorageChannel.GetSnapshot`.
|
|
24
|
+
* When provided, the IpcRegistry rejects invocations whose `event.sender`
|
|
25
|
+
* is not whitelisted (typically the workbench-wide policy that allows
|
|
26
|
+
* the main window renderer and overlay views only).
|
|
27
|
+
* Omitted in unit tests that mock the electron module.
|
|
28
|
+
*/
|
|
29
|
+
senderPolicy?: SenderPolicy;
|
|
30
|
+
/**
|
|
31
|
+
* Returns the appId of the currently-active project session, or null when
|
|
32
|
+
* no session is active. The simulator uses a fixed `persist:simulator`
|
|
33
|
+
* partition + simulator.html origin, so localStorage is shared across
|
|
34
|
+
* every project that has ever opened. The dimina runtime isolates writes
|
|
35
|
+
* with `${appId}_` prefixes; this callback lets the panel filter the
|
|
36
|
+
* CDP snapshot/event stream to the active appId.
|
|
37
|
+
*/
|
|
38
|
+
getActiveAppId: () => string | null;
|
|
39
|
+
}
|
|
40
|
+
export declare function setupSimulatorStorage(host: WebContents, options: SimulatorStorageOptions): Disposable;
|
|
20
41
|
//# sourceMappingURL=index.d.ts.map
|