@rho-workspace/rho 0.5.3 → 0.5.4
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 +24 -5
- package/dist/capabilities.d.ts +27 -0
- package/dist/capabilities.js +73 -1
- package/dist/cli.js +150 -25
- package/dist/contract.generated.d.ts +112 -12
- package/dist/contracts/owners.generated.js +103 -8
- package/dist/conversation-presentation.d.ts +3 -1
- package/dist/conversation-presentation.js +16 -6
- package/dist/conversations.d.ts +10 -6
- package/dist/conversations.js +17 -13
- package/dist/installs.d.ts +11 -0
- package/dist/installs.js +179 -0
- package/dist/project-notes.js +2 -0
- package/dist/protocol.js +7 -5
- package/dist/screen-check-skill.d.ts +2 -0
- package/dist/screen-check-skill.js +39 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +50 -7
- package/dist/web/.vite/manifest.json +51 -51
- package/dist/web/assets/{choices-B-y2OYvE.js → choices-DU9kHlyQ.js} +1 -1
- package/dist/web/assets/{console-e1P5qYQ5.js → console-Dbdo-5oO.js} +1 -1
- package/dist/web/assets/{dist-Dd3iAGFy.js → dist-B2V0VDO0.js} +1 -1
- package/dist/web/assets/{dist-CH56yNDn.js → dist-BV3hWfn_.js} +1 -1
- package/dist/web/assets/{dist-CBM2oq6g.js → dist-CLNF2g-E.js} +1 -1
- package/dist/web/assets/{dist-DEorbOW0.js → dist-D25Vn17i.js} +1 -1
- package/dist/web/assets/{explore-in-muWXOGOY.js → explore-in-8Q5ftt-E.js} +1 -1
- package/dist/web/assets/{graph-CK-df5lh.js → graph-hS2kvHTI.js} +1 -1
- package/dist/web/assets/{index-BYuKpyoi.js → index-BHQIaDsx.js} +220 -121
- package/dist/web/assets/index-Cj1_iqyK.css +1 -0
- package/dist/web/assets/{notes-meaning-B3HFbh84.js → notes-meaning-DdPbtNzJ.js} +1 -1
- package/dist/web/assets/{overview-D1Ev2OC_.js → overview-BV6ZO5TO.js} +3 -3
- package/dist/web/assets/{preview-HbmQKUGY.js → preview-n5lOOdjN.js} +1 -1
- package/dist/web/assets/{review-BVh9jWMB.js → review-CmWou4Iv.js} +1 -1
- package/dist/web/assets/{skills-DPaEYkln.js → skills-Dy7n3L9d.js} +1 -1
- package/dist/web/assets/{skills-work-dvjfy_tu.js → skills-work-Cj0W6b-I.js} +1 -1
- package/dist/web/assets/{studio-process-BYm8mjRJ.js → studio-process-QOY_n2_8.js} +1 -1
- package/dist/web/assets/{timeline-events-CDZ7wiJX.js → timeline-events-DmX1BCh3.js} +1 -1
- package/dist/web/assets/{work-turns-BeCt303c.js → work-turns-Co0C71rJ.js} +1 -1
- package/dist/web/assets/{workspace-d5Hw_ClZ.js → workspace-BKFefRfJ.js} +2 -2
- package/dist/web/composition.json +73 -73
- package/dist/web/index.html +2 -2
- package/dist/web/renderer.json +1 -1
- package/docs/FRONTEND.md +30 -14
- package/docs/HEADLESS.md +59 -13
- package/example/pa14-qs/.rho/rho/conversations/c-67f77cfebaba2cea.json +1 -1
- package/example/pa14-qs/.rho/rho/conversations/c-91aa2e46b1ac1a6c.json +1 -1
- package/example/pa14-qs/.rho/rho/conversations/c-fa24dfd80dfe4bcb.json +1 -1
- package/node_modules/@hono/node-server/dist/index.js +11 -0
- package/node_modules/@hono/node-server/dist/index.mjs +11 -0
- package/node_modules/@hono/node-server/dist/listener.js +11 -0
- package/node_modules/@hono/node-server/dist/listener.mjs +11 -0
- package/node_modules/@hono/node-server/dist/request.js +11 -0
- package/node_modules/@hono/node-server/dist/request.mjs +11 -0
- package/node_modules/@hono/node-server/dist/server.js +11 -0
- package/node_modules/@hono/node-server/dist/server.mjs +11 -0
- package/node_modules/@hono/node-server/dist/vercel.js +11 -0
- package/node_modules/@hono/node-server/dist/vercel.mjs +11 -0
- package/node_modules/@hono/node-server/package.json +1 -1
- package/node_modules/@rho-workspace/plugin-agent/README.md +3 -1
- package/node_modules/@rho-workspace/plugin-agent/dist/acp-conversation.js +14 -3
- package/node_modules/@rho-workspace/plugin-agent/dist/conversation.d.ts +1 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/conversation.js +1 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/generic-acp.d.ts +11 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/generic-acp.js +7 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/mcp.js +5 -1
- package/node_modules/@rho-workspace/plugin-agent/package.json +1 -1
- package/node_modules/@rho-workspace/plugin-annotations/package.json +1 -1
- package/node_modules/@rho-workspace/plugin-documents/README.md +4 -0
- package/node_modules/@rho-workspace/plugin-documents/dist/index.d.ts +3 -0
- package/node_modules/@rho-workspace/plugin-documents/dist/index.js +1 -1
- package/node_modules/@rho-workspace/plugin-documents/package.json +1 -1
- package/node_modules/@rho-workspace/plugin-kernel/README.md +71 -10
- package/node_modules/@rho-workspace/plugin-kernel/dist/code.d.ts +2 -0
- package/node_modules/@rho-workspace/plugin-kernel/dist/code.js +4 -1
- package/node_modules/@rho-workspace/plugin-kernel/dist/contract.js +5 -0
- package/node_modules/@rho-workspace/plugin-kernel/dist/index.d.ts +7 -0
- package/node_modules/@rho-workspace/plugin-kernel/dist/index.js +55 -8
- package/node_modules/@rho-workspace/plugin-kernel/dist/lineage.d.ts +9 -6
- package/node_modules/@rho-workspace/plugin-kernel/dist/lineage.js +18 -41
- package/node_modules/@rho-workspace/plugin-kernel/dist/operations.js +5 -2
- package/node_modules/@rho-workspace/plugin-kernel/dist/script-flow.d.ts +39 -0
- package/node_modules/@rho-workspace/plugin-kernel/dist/script-flow.js +661 -0
- package/node_modules/@rho-workspace/plugin-kernel/dist/ui-base.d.ts +3 -0
- package/node_modules/@rho-workspace/plugin-kernel/dist/ui-base.js +10 -0
- package/node_modules/@rho-workspace/plugin-kernel/dist/ui-flow.d.ts +38 -4
- package/node_modules/@rho-workspace/plugin-kernel/dist/ui-flow.js +194 -97
- package/node_modules/@rho-workspace/plugin-kernel/dist/ui-notebook-work.js +1 -2
- package/node_modules/@rho-workspace/plugin-kernel/dist/ui-notebook.d.ts +10 -2
- package/node_modules/@rho-workspace/plugin-kernel/dist/ui-notebook.js +79 -18
- package/node_modules/@rho-workspace/plugin-kernel/dist/ui-styles.js +115 -45
- package/node_modules/@rho-workspace/plugin-kernel/dist/ui.d.ts +1 -1
- package/node_modules/@rho-workspace/plugin-kernel/dist/ui.js +1 -1
- package/node_modules/@rho-workspace/plugin-kernel/dist/value-graph.d.ts +63 -0
- package/node_modules/@rho-workspace/plugin-kernel/dist/value-graph.js +344 -0
- package/node_modules/@rho-workspace/plugin-kernel/package.json +1 -1
- package/node_modules/@rho-workspace/plugin-kernel/runners/runner.R +6 -3
- package/node_modules/@rho-workspace/plugin-kernel/runners/runner.py +6 -3
- package/node_modules/express-rate-limit/dist/index.cjs +1 -1
- package/node_modules/express-rate-limit/dist/index.mjs +1 -1
- package/node_modules/express-rate-limit/package.json +1 -1
- package/node_modules/ip-address/dist/ipv6.js +1 -1
- package/node_modules/ip-address/package.json +1 -1
- package/node_modules/playwright-core/LICENSE +202 -0
- package/node_modules/playwright-core/NOTICE +5 -0
- package/node_modules/playwright-core/ThirdPartyNotices.txt +13 -0
- package/node_modules/playwright-core/bin/install_media_pack.ps1 +5 -0
- package/node_modules/playwright-core/bin/install_webkit_wsl.ps1 +33 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh +42 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh +13 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1 +24 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh +42 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh +12 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1 +24 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh +48 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh +11 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1 +23 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh +48 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh +11 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1 +23 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh +48 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh +11 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1 +24 -0
- package/node_modules/playwright-core/browsers.json +52 -0
- package/node_modules/playwright-core/cli.js +22 -0
- package/node_modules/playwright-core/index.js +17 -0
- package/node_modules/playwright-core/index.mjs +28 -0
- package/node_modules/playwright-core/lib/bootstrap.js +149 -0
- package/node_modules/playwright-core/lib/coreBundle.js +78041 -0
- package/node_modules/playwright-core/lib/entry/cliDaemon.js +5 -0
- package/node_modules/playwright-core/lib/entry/dashboardApp.js +3 -0
- package/node_modules/playwright-core/lib/entry/mcp.js +10 -0
- package/node_modules/playwright-core/lib/entry/oopBrowserDownload.js +3 -0
- package/node_modules/playwright-core/lib/package.js +50 -0
- package/node_modules/playwright-core/lib/server/chromium/appIcon.png +0 -0
- package/node_modules/playwright-core/lib/server/electron/loader.js +123 -0
- package/node_modules/playwright-core/lib/serverRegistry.js +1939 -0
- package/node_modules/playwright-core/lib/serverRegistry.js.LICENSE +65 -0
- package/node_modules/playwright-core/lib/tools/cli-client/channelSessions.js +141 -0
- package/node_modules/playwright-core/lib/tools/cli-client/cli.js +7 -0
- package/node_modules/playwright-core/lib/tools/cli-client/help.json +808 -0
- package/node_modules/playwright-core/lib/tools/cli-client/minimist.js +128 -0
- package/node_modules/playwright-core/lib/tools/cli-client/output.js +352 -0
- package/node_modules/playwright-core/lib/tools/cli-client/program.js +422 -0
- package/node_modules/playwright-core/lib/tools/cli-client/registry.js +180 -0
- package/node_modules/playwright-core/lib/tools/cli-client/session.js +261 -0
- package/node_modules/playwright-core/lib/tools/dashboard/appIcon.png +0 -0
- package/node_modules/playwright-core/lib/tools/utils/extension.js +112 -0
- package/node_modules/playwright-core/lib/tools/utils/socketConnection.js +108 -0
- package/node_modules/playwright-core/lib/utilsBundle.js +86078 -0
- package/node_modules/playwright-core/lib/utilsBundle.js.LICENSE +1890 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/codeMirrorModule--QdMvsKi.css +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/codeMirrorModule-CQ8RZGBm.js +32 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/codicon-DCmgc-ay.ttf +0 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-1bWoP6pv.svg +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-beta-k3eOH_eK.svg +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-nightly-Cp5nfeDT.svg +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-AwgwcYie.css +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-hRvO4yU2.js +12 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/safari-na3_-uQk.svg +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/index.html +29 -0
- package/node_modules/playwright-core/lib/vite/dashboard/playwright-logo.svg +24 -0
- package/node_modules/playwright-core/lib/vite/htmlReport/index.html +16 -0
- package/node_modules/playwright-core/lib/vite/htmlReport/report.css +2 -0
- package/node_modules/playwright-core/lib/vite/htmlReport/report.js +32 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-DK72OMRi.js +32 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-BZpYJZ-P.css +1 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-Cn0mmDuv.js +129 -0
- package/node_modules/playwright-core/lib/vite/recorder/index.html +29 -0
- package/node_modules/playwright-core/lib/vite/recorder/playwright-logo.svg +9 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-BEB2e8M3.js +32 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-D-g2vrvf.js +184 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-B794rD2Z.js +7 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/defaultSettingsView.C8BeHuxd.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.html +44 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.oNry3Hjv.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/manifest.webmanifest +16 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/playwright-logo.svg +9 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.html +10 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js +4 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.CYwC_gH1.js +5 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.CyMfwkXJ.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +18 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
- package/node_modules/playwright-core/lib/webp_codec.LICENSE +173 -0
- package/node_modules/playwright-core/lib/webp_codec.wasm +0 -0
- package/node_modules/playwright-core/lib/xdg-open +1267 -0
- package/node_modules/playwright-core/package.json +34 -0
- package/package.json +10 -6
- package/protocol/index.json +17 -17
- package/protocol/operations/conversation.settings.check.json +147 -4
- package/protocol/operations/conversation.settings.read.json +145 -3
- package/protocol/operations/conversation.settings.update.json +166 -4
- package/protocol/operations/conversation.start.json +2 -1
- package/protocol/operations/kernel.interrupt.json +20 -0
- package/protocol/operations/kernel.read.json +30 -0
- package/protocol/operations/kernel.run.json +36 -1
- package/protocol/operations/kernel.stop.json +10 -0
- package/scripts/browser-checks.mjs +53 -0
- package/scripts/screen-check.mjs +193 -0
- package/vendor/composition.json +102 -102
- package/vendor/rho-workspace-plugin-agent-0.4.28.tgz +0 -0
- package/vendor/rho-workspace-plugin-annotations-0.5.2.tgz +0 -0
- package/vendor/rho-workspace-plugin-documents-0.4.11.tgz +0 -0
- package/vendor/rho-workspace-plugin-kernel-0.5.5.tgz +0 -0
- package/web/theme.css +17 -2
- package/dist/web/assets/index-DBd77u4a.css +0 -1
- package/vendor/rho-workspace-plugin-agent-0.4.27.tgz +0 -0
- package/vendor/rho-workspace-plugin-documents-0.4.10.tgz +0 -0
- package/vendor/rho-workspace-plugin-kernel-0.5.2.tgz +0 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var session_exports = {};
|
|
30
|
+
__export(session_exports, {
|
|
31
|
+
Session: () => Session
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(session_exports);
|
|
34
|
+
var import_child_process = require("child_process");
|
|
35
|
+
var import_fs = __toESM(require("fs"));
|
|
36
|
+
var import_net = __toESM(require("net"));
|
|
37
|
+
var import_os = __toESM(require("os"));
|
|
38
|
+
var import_path = __toESM(require("path"));
|
|
39
|
+
var import_package = require("../../package");
|
|
40
|
+
var import_socketConnection = require("../utils/socketConnection");
|
|
41
|
+
var import_registry = require("./registry");
|
|
42
|
+
class Session {
|
|
43
|
+
constructor(sessionFile) {
|
|
44
|
+
this.config = sessionFile.config;
|
|
45
|
+
this.name = this.config.name;
|
|
46
|
+
this._sessionFile = sessionFile;
|
|
47
|
+
}
|
|
48
|
+
isCompatible(clientInfo) {
|
|
49
|
+
return (0, import_socketConnection.compareSemver)(clientInfo.version, this.config.version) >= 0;
|
|
50
|
+
}
|
|
51
|
+
async run(clientInfo, args, options) {
|
|
52
|
+
if (!this.isCompatible(clientInfo))
|
|
53
|
+
throw new Error(`Client is v${clientInfo.version}, session '${this.name}' is v${this.config.version}. Run
|
|
54
|
+
|
|
55
|
+
playwright-cli${this.name !== "default" ? ` -s=${this.name}` : ""} open
|
|
56
|
+
|
|
57
|
+
to restart the browser session.`);
|
|
58
|
+
const { socket } = await this._connect();
|
|
59
|
+
if (!socket)
|
|
60
|
+
throw new Error(`Browser '${this.name}' is not open. Run
|
|
61
|
+
|
|
62
|
+
playwright-cli${this.name !== "default" ? ` -s=${this.name}` : ""} open
|
|
63
|
+
|
|
64
|
+
to start the browser session.`);
|
|
65
|
+
return await SocketConnectionClient.sendAndClose(socket, "run", { args, cwd: process.cwd(), raw: options?.raw, json: options?.json });
|
|
66
|
+
}
|
|
67
|
+
async stop() {
|
|
68
|
+
if (!await this.canConnect())
|
|
69
|
+
return { wasOpen: false };
|
|
70
|
+
await this._stopDaemon();
|
|
71
|
+
return { wasOpen: true };
|
|
72
|
+
}
|
|
73
|
+
async deleteData() {
|
|
74
|
+
await this.stop();
|
|
75
|
+
const dataDirs = await import_fs.default.promises.readdir(this._sessionFile.daemonDir).catch(() => []);
|
|
76
|
+
const matchingEntries = dataDirs.filter((file) => file === `${this.name}.session` || file.startsWith(`ud-${this.name}-`));
|
|
77
|
+
if (matchingEntries.length === 0)
|
|
78
|
+
return { existed: false, deletedUserDataDir: false };
|
|
79
|
+
let deletedUserDataDir = false;
|
|
80
|
+
for (const entry of matchingEntries) {
|
|
81
|
+
const userDataDir = import_path.default.resolve(this._sessionFile.daemonDir, entry);
|
|
82
|
+
for (let i = 0; i < 5; i++) {
|
|
83
|
+
try {
|
|
84
|
+
await import_fs.default.promises.rm(userDataDir, { recursive: true });
|
|
85
|
+
if (entry.startsWith("ud-"))
|
|
86
|
+
deletedUserDataDir = true;
|
|
87
|
+
break;
|
|
88
|
+
} catch (e) {
|
|
89
|
+
if (e.code === "ENOENT")
|
|
90
|
+
break;
|
|
91
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
92
|
+
if (i === 4)
|
|
93
|
+
throw e;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return { existed: true, deletedUserDataDir };
|
|
98
|
+
}
|
|
99
|
+
async _connect() {
|
|
100
|
+
return await new Promise((resolve) => {
|
|
101
|
+
const socket = import_net.default.createConnection(this.config.socketPath, () => {
|
|
102
|
+
resolve({ socket });
|
|
103
|
+
});
|
|
104
|
+
socket.on("error", (error) => {
|
|
105
|
+
if (import_os.default.platform() !== "win32")
|
|
106
|
+
void import_fs.default.promises.unlink(this.config.socketPath).catch(() => {
|
|
107
|
+
}).then(() => resolve({ error }));
|
|
108
|
+
else
|
|
109
|
+
resolve({ error });
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
async canConnect() {
|
|
114
|
+
const { socket } = await this._connect();
|
|
115
|
+
if (socket) {
|
|
116
|
+
socket.destroy();
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
static async startDaemon(clientInfo, cliArgs, mode) {
|
|
122
|
+
await import_fs.default.promises.mkdir(clientInfo.daemonProfilesDir, { recursive: true });
|
|
123
|
+
const cliPath = (0, import_package.libPath)("entry", "cliDaemon.js");
|
|
124
|
+
const sessionName = (0, import_registry.resolveSessionName)(cliArgs.session);
|
|
125
|
+
const errLog = import_path.default.join(clientInfo.daemonProfilesDir, sessionName + ".err");
|
|
126
|
+
const err = import_fs.default.openSync(errLog, "w");
|
|
127
|
+
const args = [
|
|
128
|
+
cliPath,
|
|
129
|
+
sessionName
|
|
130
|
+
];
|
|
131
|
+
if (cliArgs.headed)
|
|
132
|
+
args.push("--headed");
|
|
133
|
+
if (cliArgs.mobile)
|
|
134
|
+
args.push("--mobile");
|
|
135
|
+
if (cliArgs.device)
|
|
136
|
+
args.push(`--device=${cliArgs.device}`);
|
|
137
|
+
if (cliArgs.browser)
|
|
138
|
+
args.push(`--browser=${cliArgs.browser}`);
|
|
139
|
+
if (cliArgs.persistent)
|
|
140
|
+
args.push("--persistent");
|
|
141
|
+
if (cliArgs.profile)
|
|
142
|
+
args.push(`--profile=${cliArgs.profile}`);
|
|
143
|
+
if (cliArgs.config)
|
|
144
|
+
args.push(`--config=${cliArgs.config}`);
|
|
145
|
+
if (cliArgs["idle-timeout"] !== void 0)
|
|
146
|
+
args.push(`--idle-timeout=${cliArgs["idle-timeout"]}`);
|
|
147
|
+
if (cliArgs.extension)
|
|
148
|
+
args.push("--extension");
|
|
149
|
+
else if (cliArgs.cdp)
|
|
150
|
+
args.push(`--cdp=${cliArgs.cdp}`);
|
|
151
|
+
else if (cliArgs.endpoint)
|
|
152
|
+
args.push(`--endpoint=${cliArgs.endpoint}`);
|
|
153
|
+
const child = (0, import_child_process.spawn)(process.execPath, args, {
|
|
154
|
+
detached: true,
|
|
155
|
+
stdio: ["ignore", "pipe", err],
|
|
156
|
+
cwd: process.cwd(),
|
|
157
|
+
// Will be used as root.
|
|
158
|
+
windowsHide: true
|
|
159
|
+
});
|
|
160
|
+
let signalled = false;
|
|
161
|
+
const sigintHandler = () => {
|
|
162
|
+
signalled = true;
|
|
163
|
+
child.kill("SIGINT");
|
|
164
|
+
};
|
|
165
|
+
const sigtermHandler = () => {
|
|
166
|
+
signalled = true;
|
|
167
|
+
child.kill("SIGTERM");
|
|
168
|
+
};
|
|
169
|
+
process.on("SIGINT", sigintHandler);
|
|
170
|
+
process.on("SIGTERM", sigtermHandler);
|
|
171
|
+
let outLog = "";
|
|
172
|
+
const rejectWithPid = (reject, message) => reject(Object.assign(new Error(`Daemon pid=${child.pid}: ${message}`), { daemonPid: child.pid }));
|
|
173
|
+
await new Promise((resolve, reject) => {
|
|
174
|
+
child.stdout.on("data", (data) => {
|
|
175
|
+
outLog += data.toString();
|
|
176
|
+
if (outLog.includes("Daemon listening on"))
|
|
177
|
+
resolve();
|
|
178
|
+
});
|
|
179
|
+
child.on("close", (code) => {
|
|
180
|
+
if (!signalled) {
|
|
181
|
+
const errLogContent = import_fs.default.readFileSync(errLog, "utf-8");
|
|
182
|
+
rejectWithPid(reject, `Daemon process exited with code ${code}` + (outLog ? "\n" + outLog : "") + (errLogContent ? "\n" + errLogContent : ""));
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
process.off("SIGINT", sigintHandler);
|
|
187
|
+
process.off("SIGTERM", sigtermHandler);
|
|
188
|
+
child.stdout.destroy();
|
|
189
|
+
child.unref();
|
|
190
|
+
return { pid: child.pid, sessionName, endpoint: cliArgs.endpoint };
|
|
191
|
+
}
|
|
192
|
+
async _stopDaemon() {
|
|
193
|
+
const { socket } = await this._connect();
|
|
194
|
+
if (!socket)
|
|
195
|
+
return;
|
|
196
|
+
let error;
|
|
197
|
+
await SocketConnectionClient.sendAndClose(socket, "stop", {}).catch((e) => error = e);
|
|
198
|
+
if (error && !error?.message?.includes("Session closed"))
|
|
199
|
+
throw error;
|
|
200
|
+
}
|
|
201
|
+
async deleteSessionConfig() {
|
|
202
|
+
await import_fs.default.promises.rm(this._sessionFile.file).catch(() => {
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
class SocketConnectionClient {
|
|
207
|
+
constructor(socket) {
|
|
208
|
+
this._nextMessageId = 1;
|
|
209
|
+
this._callbacks = /* @__PURE__ */ new Map();
|
|
210
|
+
this._connection = new import_socketConnection.SocketConnection(socket);
|
|
211
|
+
this._connection.onmessage = (message) => this._onMessage(message);
|
|
212
|
+
this._connection.onclose = () => this._rejectCallbacks();
|
|
213
|
+
}
|
|
214
|
+
async send(method, params = {}) {
|
|
215
|
+
const messageId = this._nextMessageId++;
|
|
216
|
+
const message = {
|
|
217
|
+
id: messageId,
|
|
218
|
+
method,
|
|
219
|
+
params
|
|
220
|
+
};
|
|
221
|
+
const responsePromise = new Promise((resolve, reject) => {
|
|
222
|
+
this._callbacks.set(messageId, { resolve, reject, method, params });
|
|
223
|
+
});
|
|
224
|
+
const [result] = await Promise.all([responsePromise, this._connection.send(message)]);
|
|
225
|
+
return result;
|
|
226
|
+
}
|
|
227
|
+
static async sendAndClose(socket, method, params = {}) {
|
|
228
|
+
const connection = new SocketConnectionClient(socket);
|
|
229
|
+
try {
|
|
230
|
+
return await connection.send(method, params);
|
|
231
|
+
} finally {
|
|
232
|
+
connection.close();
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
close() {
|
|
236
|
+
this._connection.close();
|
|
237
|
+
}
|
|
238
|
+
_onMessage(object) {
|
|
239
|
+
if (object.id && this._callbacks.has(object.id)) {
|
|
240
|
+
const callback = this._callbacks.get(object.id);
|
|
241
|
+
this._callbacks.delete(object.id);
|
|
242
|
+
if (object.error)
|
|
243
|
+
callback.reject(new Error(object.error));
|
|
244
|
+
else
|
|
245
|
+
callback.resolve(object.result);
|
|
246
|
+
} else if (object.id) {
|
|
247
|
+
throw new Error(`Unexpected message id: ${object.id}`);
|
|
248
|
+
} else {
|
|
249
|
+
throw new Error(`Unexpected message without id: ${JSON.stringify(object)}`);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
_rejectCallbacks() {
|
|
253
|
+
for (const callback of this._callbacks.values())
|
|
254
|
+
callback.reject(new Error("Session closed"));
|
|
255
|
+
this._callbacks.clear();
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
259
|
+
0 && (module.exports = {
|
|
260
|
+
Session
|
|
261
|
+
});
|
|
Binary file
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var extension_exports = {};
|
|
30
|
+
__export(extension_exports, {
|
|
31
|
+
findPlaywrightExtensionProfile: () => findPlaywrightExtensionProfile,
|
|
32
|
+
isExtensionInstalledInProfile: () => isExtensionInstalledInProfile,
|
|
33
|
+
isPlaywrightExtensionInstalled: () => isPlaywrightExtensionInstalled,
|
|
34
|
+
playwrightExtensionId: () => playwrightExtensionId,
|
|
35
|
+
playwrightExtensionInstallUrl: () => playwrightExtensionInstallUrl
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(extension_exports);
|
|
38
|
+
var import_fs = __toESM(require("fs"));
|
|
39
|
+
var import_path = __toESM(require("path"));
|
|
40
|
+
const playwrightExtensionId = "mmlmfjhmonkocbjadbfplnigmagldckm";
|
|
41
|
+
const playwrightExtensionInstallUrl = `https://chromewebstore.google.com/detail/playwright-extension/${playwrightExtensionId}`;
|
|
42
|
+
async function findPlaywrightExtensionProfile(userDataDir) {
|
|
43
|
+
const profiles = await listProfileDirectories(userDataDir);
|
|
44
|
+
const lastUsed = await readLastUsedProfile(userDataDir);
|
|
45
|
+
const ordered = lastUsed && profiles.includes(lastUsed) ? [lastUsed, ...profiles.filter((profile) => profile !== lastUsed)] : profiles;
|
|
46
|
+
for (const profile of ordered) {
|
|
47
|
+
if (await isExtensionInstalledInProfile(import_path.default.join(userDataDir, profile)))
|
|
48
|
+
return profile;
|
|
49
|
+
}
|
|
50
|
+
return void 0;
|
|
51
|
+
}
|
|
52
|
+
async function listProfileDirectories(userDataDir) {
|
|
53
|
+
let entries;
|
|
54
|
+
try {
|
|
55
|
+
entries = await import_fs.default.promises.readdir(userDataDir);
|
|
56
|
+
} catch {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
const profiles = entries.filter((entry) => entry === "Default" || /^Profile \d+$/.test(entry));
|
|
60
|
+
profiles.sort((a, b) => profileRank(a) - profileRank(b));
|
|
61
|
+
return profiles;
|
|
62
|
+
}
|
|
63
|
+
function profileRank(profile) {
|
|
64
|
+
return profile === "Default" ? -1 : parseInt(profile.slice("Profile ".length), 10);
|
|
65
|
+
}
|
|
66
|
+
async function readLastUsedProfile(userDataDir) {
|
|
67
|
+
try {
|
|
68
|
+
const localState = JSON.parse(await import_fs.default.promises.readFile(import_path.default.join(userDataDir, "Local State"), "utf-8"));
|
|
69
|
+
const lastUsed = localState?.profile?.last_used;
|
|
70
|
+
return typeof lastUsed === "string" ? lastUsed : void 0;
|
|
71
|
+
} catch {
|
|
72
|
+
return void 0;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async function isPlaywrightExtensionInstalled(userDataDir) {
|
|
76
|
+
return await findPlaywrightExtensionProfile(userDataDir) !== void 0;
|
|
77
|
+
}
|
|
78
|
+
async function isExtensionInstalledInProfile(profileDir) {
|
|
79
|
+
if (await pathExists(import_path.default.join(profileDir, "Extensions", playwrightExtensionId)))
|
|
80
|
+
return true;
|
|
81
|
+
for (const fileName of ["Preferences", "Secure Preferences"]) {
|
|
82
|
+
if (await hasExtensionSettingsRecord(import_path.default.join(profileDir, fileName)))
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
async function hasExtensionSettingsRecord(prefsPath) {
|
|
88
|
+
let prefs;
|
|
89
|
+
try {
|
|
90
|
+
prefs = JSON.parse(await import_fs.default.promises.readFile(prefsPath, "utf-8"));
|
|
91
|
+
} catch {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
const record = prefs?.extensions?.settings?.[playwrightExtensionId];
|
|
95
|
+
return !!record && typeof record === "object" && Object.keys(record).length > 0;
|
|
96
|
+
}
|
|
97
|
+
async function pathExists(p) {
|
|
98
|
+
try {
|
|
99
|
+
await import_fs.default.promises.access(p);
|
|
100
|
+
return true;
|
|
101
|
+
} catch {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
106
|
+
0 && (module.exports = {
|
|
107
|
+
findPlaywrightExtensionProfile,
|
|
108
|
+
isExtensionInstalledInProfile,
|
|
109
|
+
isPlaywrightExtensionInstalled,
|
|
110
|
+
playwrightExtensionId,
|
|
111
|
+
playwrightExtensionInstallUrl
|
|
112
|
+
});
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var socketConnection_exports = {};
|
|
20
|
+
__export(socketConnection_exports, {
|
|
21
|
+
SocketConnection: () => SocketConnection,
|
|
22
|
+
compareSemver: () => compareSemver
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(socketConnection_exports);
|
|
25
|
+
class SocketConnection {
|
|
26
|
+
constructor(socket) {
|
|
27
|
+
this._pendingBuffers = [];
|
|
28
|
+
this._socket = socket;
|
|
29
|
+
socket.on("data", (buffer) => this._onData(buffer));
|
|
30
|
+
socket.on("close", () => {
|
|
31
|
+
this.onclose?.();
|
|
32
|
+
});
|
|
33
|
+
socket.on("error", (e) => console.error(`error: ${e.message}`));
|
|
34
|
+
}
|
|
35
|
+
async send(message) {
|
|
36
|
+
await new Promise((resolve, reject) => {
|
|
37
|
+
this._socket.write(`${JSON.stringify(message)}
|
|
38
|
+
`, (error) => {
|
|
39
|
+
if (error)
|
|
40
|
+
reject(error);
|
|
41
|
+
else
|
|
42
|
+
resolve(void 0);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
close() {
|
|
47
|
+
this._socket.destroy();
|
|
48
|
+
}
|
|
49
|
+
_onData(buffer) {
|
|
50
|
+
let end = buffer.indexOf("\n");
|
|
51
|
+
if (end === -1) {
|
|
52
|
+
this._pendingBuffers.push(buffer);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
this._pendingBuffers.push(buffer.slice(0, end));
|
|
56
|
+
const message = Buffer.concat(this._pendingBuffers).toString();
|
|
57
|
+
this._dispatchMessage(message);
|
|
58
|
+
let start = end + 1;
|
|
59
|
+
end = buffer.indexOf("\n", start);
|
|
60
|
+
while (end !== -1) {
|
|
61
|
+
const message2 = buffer.toString(void 0, start, end);
|
|
62
|
+
this._dispatchMessage(message2);
|
|
63
|
+
start = end + 1;
|
|
64
|
+
end = buffer.indexOf("\n", start);
|
|
65
|
+
}
|
|
66
|
+
this._pendingBuffers = [buffer.slice(start)];
|
|
67
|
+
}
|
|
68
|
+
_dispatchMessage(message) {
|
|
69
|
+
try {
|
|
70
|
+
this.onmessage?.(JSON.parse(message));
|
|
71
|
+
} catch (e) {
|
|
72
|
+
console.error("failed to dispatch message", e);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function compareSemver(a, b) {
|
|
77
|
+
const aBase = a.replace(/-.*$/, "");
|
|
78
|
+
const bBase = b.replace(/-.*$/, "");
|
|
79
|
+
const aParts = aBase.split(".").map(Number);
|
|
80
|
+
const bParts = bBase.split(".").map(Number);
|
|
81
|
+
for (let i = 0; i < 3; i++) {
|
|
82
|
+
if (aParts[i] > bParts[i])
|
|
83
|
+
return 1;
|
|
84
|
+
if (aParts[i] < bParts[i])
|
|
85
|
+
return -1;
|
|
86
|
+
}
|
|
87
|
+
const aTimestamp = parseSuffixTimestamp(a);
|
|
88
|
+
const bTimestamp = parseSuffixTimestamp(b);
|
|
89
|
+
if (aTimestamp > bTimestamp)
|
|
90
|
+
return 1;
|
|
91
|
+
if (aTimestamp < bTimestamp)
|
|
92
|
+
return -1;
|
|
93
|
+
return 0;
|
|
94
|
+
}
|
|
95
|
+
function parseSuffixTimestamp(version) {
|
|
96
|
+
const match = version.match(/^\d+\.\d+\.\d+-(?:alpha|beta)-(.+)$/);
|
|
97
|
+
if (!match)
|
|
98
|
+
return Infinity;
|
|
99
|
+
const suffix = match[1];
|
|
100
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(suffix))
|
|
101
|
+
return new Date(suffix).getTime();
|
|
102
|
+
return Number(suffix);
|
|
103
|
+
}
|
|
104
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
105
|
+
0 && (module.exports = {
|
|
106
|
+
SocketConnection,
|
|
107
|
+
compareSemver
|
|
108
|
+
});
|