libretto 0.4.4 → 0.5.1
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 +106 -36
- package/dist/cli/cli.js +39 -113
- package/dist/cli/commands/ai.js +1 -1
- package/dist/cli/commands/browser.js +87 -60
- package/dist/cli/commands/execution.js +201 -88
- package/dist/cli/commands/init.js +30 -8
- package/dist/cli/commands/logs.js +5 -6
- package/dist/cli/commands/shared.js +30 -29
- package/dist/cli/commands/snapshot.js +26 -39
- package/dist/cli/core/ai-config.js +9 -2
- package/dist/cli/core/api-snapshot-analyzer.js +15 -5
- package/dist/cli/core/browser.js +141 -33
- package/dist/cli/core/context.js +7 -18
- package/dist/cli/core/session-telemetry.js +5 -2
- package/dist/cli/core/session.js +23 -10
- package/dist/cli/core/snapshot-analyzer.js +16 -33
- package/dist/cli/core/snapshot-api-config.js +2 -6
- package/dist/cli/core/telemetry.js +10 -2
- package/dist/cli/framework/simple-cli.js +45 -25
- package/dist/cli/router.js +14 -21
- package/dist/cli/workers/run-integration-runtime.js +26 -7
- package/dist/cli/workers/run-integration-worker-protocol.js +3 -1
- package/dist/cli/workers/run-integration-worker.js +1 -4
- package/dist/index.d.ts +1 -2
- package/dist/index.js +7 -10
- package/dist/runtime/download/download.js +5 -1
- package/dist/runtime/extract/extract.js +11 -2
- package/dist/runtime/network/network.js +8 -1
- package/dist/runtime/recovery/agent.js +6 -2
- package/dist/runtime/recovery/errors.js +3 -1
- package/dist/runtime/recovery/recovery.js +3 -1
- package/dist/shared/condense-dom/condense-dom.js +6 -13
- package/dist/shared/config/config.d.ts +1 -9
- package/dist/shared/config/config.js +0 -18
- package/dist/shared/config/index.d.ts +2 -1
- package/dist/shared/config/index.js +0 -10
- package/dist/shared/debug/pause.js +9 -3
- package/dist/shared/instrumentation/instrument.js +101 -5
- package/dist/shared/llm/ai-sdk-adapter.js +3 -1
- package/dist/shared/llm/client.js +3 -1
- package/dist/shared/logger/index.js +4 -1
- package/dist/shared/paths/paths.js +2 -1
- package/dist/shared/paths/repo-root.d.ts +3 -0
- package/dist/shared/paths/repo-root.js +24 -0
- package/dist/shared/run/api.js +3 -1
- package/dist/shared/run/browser.js +7 -2
- package/dist/shared/state/session-state.d.ts +2 -1
- package/dist/shared/state/session-state.js +5 -2
- package/dist/shared/visualization/ghost-cursor.js +19 -10
- package/dist/shared/visualization/highlight.js +9 -6
- package/dist/shared/workflow/workflow.d.ts +4 -5
- package/dist/shared/workflow/workflow.js +3 -5
- package/package.json +11 -8
- package/scripts/check-skills-sync.mjs +25 -0
- package/scripts/compare-eval-summary.mjs +47 -0
- package/scripts/postinstall.mjs +26 -17
- package/scripts/prepare-release.sh +97 -0
- package/scripts/skills-libretto.mjs +103 -0
- package/scripts/summarize-evals.mjs +135 -0
- package/scripts/sync-skills.mjs +12 -0
- package/skills/libretto/SKILL.md +130 -377
- package/skills/libretto/references/auth-profiles.md +30 -0
- package/skills/libretto/{code-generation-rules.md → references/code-generation-rules.md} +27 -42
- package/skills/libretto/references/configuration-file-reference.md +53 -0
- package/skills/libretto/references/pages-and-page-targeting.md +29 -0
- package/skills/libretto/references/site-security-review.md +143 -0
- package/src/cli/cli.ts +86 -0
- package/src/cli/commands/ai.ts +35 -0
- package/src/cli/commands/browser.ts +189 -0
- package/src/cli/commands/execution.ts +822 -0
- package/src/cli/commands/init.ts +350 -0
- package/src/cli/commands/logs.ts +128 -0
- package/src/cli/commands/shared.ts +69 -0
- package/src/cli/commands/snapshot.ts +312 -0
- package/src/cli/core/ai-config.ts +264 -0
- package/src/cli/core/api-snapshot-analyzer.ts +108 -0
- package/src/cli/core/browser.ts +976 -0
- package/src/cli/core/context.ts +127 -0
- package/src/cli/core/pause-signals.ts +35 -0
- package/src/cli/core/session-telemetry.ts +564 -0
- package/src/cli/core/session.ts +223 -0
- package/src/cli/core/snapshot-analyzer.ts +855 -0
- package/src/cli/core/snapshot-api-config.ts +231 -0
- package/src/cli/core/telemetry.ts +459 -0
- package/src/cli/framework/simple-cli.ts +1340 -0
- package/src/cli/index.ts +13 -0
- package/src/cli/router.ts +20 -0
- package/src/cli/workers/run-integration-runtime.ts +338 -0
- package/src/cli/workers/run-integration-worker-protocol.ts +16 -0
- package/src/cli/workers/run-integration-worker.ts +72 -0
- package/src/index.ts +127 -0
- package/src/runtime/download/download.ts +104 -0
- package/src/runtime/download/index.ts +7 -0
- package/src/runtime/extract/extract.ts +102 -0
- package/src/runtime/extract/index.ts +1 -0
- package/src/runtime/network/index.ts +5 -0
- package/src/runtime/network/network.ts +119 -0
- package/{dist/runtime/recovery/agent.cjs → src/runtime/recovery/agent.ts} +114 -76
- package/src/runtime/recovery/errors.ts +155 -0
- package/src/runtime/recovery/index.ts +7 -0
- package/src/runtime/recovery/recovery.ts +53 -0
- package/{dist/shared/condense-dom/condense-dom.cjs → src/shared/condense-dom/condense-dom.ts} +249 -124
- package/src/shared/config/config.ts +3 -0
- package/src/shared/config/index.ts +0 -0
- package/src/shared/debug/index.ts +1 -0
- package/src/shared/debug/pause.ts +91 -0
- package/src/shared/instrumentation/errors.ts +84 -0
- package/src/shared/instrumentation/index.ts +9 -0
- package/src/shared/instrumentation/instrument.ts +406 -0
- package/src/shared/llm/ai-sdk-adapter.ts +81 -0
- package/{dist/shared/llm/client.cjs → src/shared/llm/client.ts} +86 -80
- package/src/shared/llm/index.ts +3 -0
- package/src/shared/llm/types.ts +63 -0
- package/src/shared/logger/index.ts +13 -0
- package/src/shared/logger/logger.ts +358 -0
- package/src/shared/logger/sinks.ts +148 -0
- package/src/shared/paths/paths.ts +110 -0
- package/src/shared/paths/repo-root.ts +27 -0
- package/src/shared/run/api.ts +6 -0
- package/src/shared/run/browser.ts +107 -0
- package/src/shared/state/index.ts +11 -0
- package/src/shared/state/session-state.ts +77 -0
- package/src/shared/visualization/ghost-cursor.ts +213 -0
- package/src/shared/visualization/highlight.ts +149 -0
- package/src/shared/visualization/index.ts +18 -0
- package/src/shared/workflow/workflow.ts +36 -0
- package/dist/index.cjs +0 -144
- package/dist/index.d.cts +0 -21
- package/dist/runtime/download/download.cjs +0 -70
- package/dist/runtime/download/download.d.cts +0 -35
- package/dist/runtime/download/index.cjs +0 -30
- package/dist/runtime/download/index.d.cts +0 -3
- package/dist/runtime/extract/extract.cjs +0 -88
- package/dist/runtime/extract/extract.d.cts +0 -23
- package/dist/runtime/extract/index.cjs +0 -28
- package/dist/runtime/extract/index.d.cts +0 -5
- package/dist/runtime/network/index.cjs +0 -28
- package/dist/runtime/network/index.d.cts +0 -4
- package/dist/runtime/network/network.cjs +0 -91
- package/dist/runtime/network/network.d.cts +0 -28
- package/dist/runtime/recovery/agent.d.cts +0 -13
- package/dist/runtime/recovery/errors.cjs +0 -124
- package/dist/runtime/recovery/errors.d.cts +0 -31
- package/dist/runtime/recovery/index.cjs +0 -34
- package/dist/runtime/recovery/index.d.cts +0 -7
- package/dist/runtime/recovery/recovery.cjs +0 -55
- package/dist/runtime/recovery/recovery.d.cts +0 -12
- package/dist/shared/condense-dom/condense-dom.d.cts +0 -34
- package/dist/shared/config/config.cjs +0 -44
- package/dist/shared/config/config.d.cts +0 -10
- package/dist/shared/config/index.cjs +0 -32
- package/dist/shared/config/index.d.cts +0 -1
- package/dist/shared/debug/index.cjs +0 -28
- package/dist/shared/debug/index.d.cts +0 -1
- package/dist/shared/debug/pause.cjs +0 -86
- package/dist/shared/debug/pause.d.cts +0 -12
- package/dist/shared/instrumentation/errors.cjs +0 -81
- package/dist/shared/instrumentation/errors.d.cts +0 -12
- package/dist/shared/instrumentation/index.cjs +0 -35
- package/dist/shared/instrumentation/index.d.cts +0 -6
- package/dist/shared/instrumentation/instrument.cjs +0 -206
- package/dist/shared/instrumentation/instrument.d.cts +0 -32
- package/dist/shared/llm/ai-sdk-adapter.cjs +0 -71
- package/dist/shared/llm/ai-sdk-adapter.d.cts +0 -22
- package/dist/shared/llm/client.d.cts +0 -13
- package/dist/shared/llm/index.cjs +0 -31
- package/dist/shared/llm/index.d.cts +0 -5
- package/dist/shared/llm/types.cjs +0 -16
- package/dist/shared/llm/types.d.cts +0 -67
- package/dist/shared/logger/index.cjs +0 -37
- package/dist/shared/logger/index.d.cts +0 -2
- package/dist/shared/logger/logger.cjs +0 -232
- package/dist/shared/logger/logger.d.cts +0 -86
- package/dist/shared/logger/sinks.cjs +0 -160
- package/dist/shared/logger/sinks.d.cts +0 -9
- package/dist/shared/paths/paths.cjs +0 -104
- package/dist/shared/paths/paths.d.cts +0 -10
- package/dist/shared/run/api.cjs +0 -28
- package/dist/shared/run/api.d.cts +0 -2
- package/dist/shared/run/browser.cjs +0 -98
- package/dist/shared/run/browser.d.cts +0 -22
- package/dist/shared/state/index.cjs +0 -38
- package/dist/shared/state/index.d.cts +0 -2
- package/dist/shared/state/session-state.cjs +0 -92
- package/dist/shared/state/session-state.d.cts +0 -40
- package/dist/shared/visualization/ghost-cursor.cjs +0 -174
- package/dist/shared/visualization/ghost-cursor.d.cts +0 -37
- package/dist/shared/visualization/highlight.cjs +0 -134
- package/dist/shared/visualization/highlight.d.cts +0 -22
- package/dist/shared/visualization/index.cjs +0 -45
- package/dist/shared/visualization/index.d.cts +0 -3
- package/dist/shared/workflow/workflow.cjs +0 -47
- package/dist/shared/workflow/workflow.d.cts +0 -21
- package/skills/libretto/integration-approach-selection.md +0 -174
|
@@ -1,104 +0,0 @@
|
|
|
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 paths_exports = {};
|
|
20
|
-
__export(paths_exports, {
|
|
21
|
-
ensureLibrettoPauseSignalDir: () => ensureLibrettoPauseSignalDir,
|
|
22
|
-
ensureLibrettoRunnerLogDir: () => ensureLibrettoRunnerLogDir,
|
|
23
|
-
ensureLibrettoSessionStatePath: () => ensureLibrettoSessionStatePath,
|
|
24
|
-
getLibrettoPauseSignalDir: () => getLibrettoPauseSignalDir,
|
|
25
|
-
getLibrettoPausedSignalPath: () => getLibrettoPausedSignalPath,
|
|
26
|
-
getLibrettoResumeSignalPath: () => getLibrettoResumeSignalPath,
|
|
27
|
-
getPauseSignalPathForDir: () => getPauseSignalPathForDir,
|
|
28
|
-
getRunnerLogPathForDir: () => getRunnerLogPathForDir
|
|
29
|
-
});
|
|
30
|
-
module.exports = __toCommonJS(paths_exports);
|
|
31
|
-
var import_node_fs = require("node:fs");
|
|
32
|
-
var import_node_path = require("node:path");
|
|
33
|
-
const LIBRETTO_DIRNAME = ".libretto";
|
|
34
|
-
const LIBRETTO_SESSIONS_DIRNAME = "sessions";
|
|
35
|
-
const SESSION_STATE_FILENAME = "state.json";
|
|
36
|
-
const RUNNER_LOG_DIRNAME = "logs";
|
|
37
|
-
const RUNNER_LOG_FILENAME = "logs.jsonl";
|
|
38
|
-
const PAUSED_SIGNAL_SUFFIX = "paused";
|
|
39
|
-
const RESUME_SIGNAL_SUFFIX = "resume";
|
|
40
|
-
function getLibrettoRoot(cwd = process.cwd()) {
|
|
41
|
-
return (0, import_node_path.join)(cwd, LIBRETTO_DIRNAME);
|
|
42
|
-
}
|
|
43
|
-
function getLibrettoSessionsDir(cwd = process.cwd()) {
|
|
44
|
-
return (0, import_node_path.join)(getLibrettoRoot(cwd), LIBRETTO_SESSIONS_DIRNAME);
|
|
45
|
-
}
|
|
46
|
-
function getLibrettoSessionDir(sessionName, cwd = process.cwd()) {
|
|
47
|
-
return (0, import_node_path.join)(getLibrettoSessionsDir(cwd), sessionName);
|
|
48
|
-
}
|
|
49
|
-
function getLibrettoSessionStatePath(sessionName, cwd = process.cwd()) {
|
|
50
|
-
return (0, import_node_path.join)(getLibrettoSessionDir(sessionName, cwd), SESSION_STATE_FILENAME);
|
|
51
|
-
}
|
|
52
|
-
function getLibrettoPauseSignalDir(sessionName, cwd = process.cwd()) {
|
|
53
|
-
return getLibrettoSessionDir(sessionName, cwd);
|
|
54
|
-
}
|
|
55
|
-
function getLibrettoRunnerLogDir(sessionName, cwd = process.cwd()) {
|
|
56
|
-
return (0, import_node_path.join)(getLibrettoSessionDir(sessionName, cwd), RUNNER_LOG_DIRNAME);
|
|
57
|
-
}
|
|
58
|
-
function getRunnerLogPathForDir(logDir) {
|
|
59
|
-
return (0, import_node_path.join)(logDir, RUNNER_LOG_FILENAME);
|
|
60
|
-
}
|
|
61
|
-
function getPauseSignalPathForDir(signalDir, sessionName, signal) {
|
|
62
|
-
const suffix = signal === "paused" ? PAUSED_SIGNAL_SUFFIX : RESUME_SIGNAL_SUFFIX;
|
|
63
|
-
return (0, import_node_path.join)(signalDir, `${sessionName}.${suffix}`);
|
|
64
|
-
}
|
|
65
|
-
function getLibrettoPausedSignalPath(sessionName, cwd = process.cwd()) {
|
|
66
|
-
return getPauseSignalPathForDir(
|
|
67
|
-
getLibrettoPauseSignalDir(sessionName, cwd),
|
|
68
|
-
sessionName,
|
|
69
|
-
"paused"
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
function getLibrettoResumeSignalPath(sessionName, cwd = process.cwd()) {
|
|
73
|
-
return getPauseSignalPathForDir(
|
|
74
|
-
getLibrettoPauseSignalDir(sessionName, cwd),
|
|
75
|
-
sessionName,
|
|
76
|
-
"resume"
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
function ensureLibrettoSessionStatePath(sessionName, cwd = process.cwd()) {
|
|
80
|
-
const filePath = getLibrettoSessionStatePath(sessionName, cwd);
|
|
81
|
-
(0, import_node_fs.mkdirSync)((0, import_node_path.dirname)(filePath), { recursive: true });
|
|
82
|
-
return filePath;
|
|
83
|
-
}
|
|
84
|
-
function ensureLibrettoPauseSignalDir(sessionName, cwd = process.cwd()) {
|
|
85
|
-
const dir = getLibrettoPauseSignalDir(sessionName, cwd);
|
|
86
|
-
(0, import_node_fs.mkdirSync)(dir, { recursive: true });
|
|
87
|
-
return dir;
|
|
88
|
-
}
|
|
89
|
-
function ensureLibrettoRunnerLogDir(sessionName, cwd = process.cwd()) {
|
|
90
|
-
const dir = getLibrettoRunnerLogDir(sessionName, cwd);
|
|
91
|
-
(0, import_node_fs.mkdirSync)(dir, { recursive: true });
|
|
92
|
-
return dir;
|
|
93
|
-
}
|
|
94
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
95
|
-
0 && (module.exports = {
|
|
96
|
-
ensureLibrettoPauseSignalDir,
|
|
97
|
-
ensureLibrettoRunnerLogDir,
|
|
98
|
-
ensureLibrettoSessionStatePath,
|
|
99
|
-
getLibrettoPauseSignalDir,
|
|
100
|
-
getLibrettoPausedSignalPath,
|
|
101
|
-
getLibrettoResumeSignalPath,
|
|
102
|
-
getPauseSignalPathForDir,
|
|
103
|
-
getRunnerLogPathForDir
|
|
104
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
declare function getLibrettoPauseSignalDir(sessionName: string, cwd?: string): string;
|
|
2
|
-
declare function getRunnerLogPathForDir(logDir: string): string;
|
|
3
|
-
declare function getPauseSignalPathForDir(signalDir: string, sessionName: string, signal: "paused" | "resume"): string;
|
|
4
|
-
declare function getLibrettoPausedSignalPath(sessionName: string, cwd?: string): string;
|
|
5
|
-
declare function getLibrettoResumeSignalPath(sessionName: string, cwd?: string): string;
|
|
6
|
-
declare function ensureLibrettoSessionStatePath(sessionName: string, cwd?: string): string;
|
|
7
|
-
declare function ensureLibrettoPauseSignalDir(sessionName: string, cwd?: string): string;
|
|
8
|
-
declare function ensureLibrettoRunnerLogDir(sessionName: string, cwd?: string): string;
|
|
9
|
-
|
|
10
|
-
export { ensureLibrettoPauseSignalDir, ensureLibrettoRunnerLogDir, ensureLibrettoSessionStatePath, getLibrettoPauseSignalDir, getLibrettoPausedSignalPath, getLibrettoResumeSignalPath, getPauseSignalPathForDir, getRunnerLogPathForDir };
|
package/dist/shared/run/api.cjs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
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 api_exports = {};
|
|
20
|
-
__export(api_exports, {
|
|
21
|
-
launchBrowser: () => import_browser.launchBrowser
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(api_exports);
|
|
24
|
-
var import_browser = require("./browser.js");
|
|
25
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
-
0 && (module.exports = {
|
|
27
|
-
launchBrowser
|
|
28
|
-
});
|
|
@@ -1,98 +0,0 @@
|
|
|
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 browser_exports = {};
|
|
20
|
-
__export(browser_exports, {
|
|
21
|
-
launchBrowser: () => launchBrowser
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(browser_exports);
|
|
24
|
-
var import_playwright = require("playwright");
|
|
25
|
-
var import_node_net = require("node:net");
|
|
26
|
-
var import_node_fs = require("node:fs");
|
|
27
|
-
var import_paths = require("../paths/paths.js");
|
|
28
|
-
var import_session_state = require("../state/session-state.js");
|
|
29
|
-
async function pickFreePort() {
|
|
30
|
-
return await new Promise((resolve, reject) => {
|
|
31
|
-
const server = (0, import_node_net.createServer)();
|
|
32
|
-
server.unref();
|
|
33
|
-
server.on("error", reject);
|
|
34
|
-
server.listen(0, "127.0.0.1", () => {
|
|
35
|
-
const addr = server.address();
|
|
36
|
-
if (addr && typeof addr === "object") {
|
|
37
|
-
server.close(() => resolve(addr.port));
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
server.close(() => reject(new Error("Failed to resolve debug port")));
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
async function launchBrowser({
|
|
45
|
-
sessionName,
|
|
46
|
-
headless = false,
|
|
47
|
-
viewport = { width: 1366, height: 768 },
|
|
48
|
-
storageStatePath
|
|
49
|
-
}) {
|
|
50
|
-
const debugPort = await pickFreePort();
|
|
51
|
-
const browser = await import_playwright.chromium.launch({
|
|
52
|
-
headless,
|
|
53
|
-
args: [
|
|
54
|
-
"--disable-blink-features=AutomationControlled",
|
|
55
|
-
`--remote-debugging-port=${debugPort}`,
|
|
56
|
-
"--no-focus-on-check"
|
|
57
|
-
]
|
|
58
|
-
});
|
|
59
|
-
const context = await browser.newContext({
|
|
60
|
-
viewport,
|
|
61
|
-
...storageStatePath ? { storageState: storageStatePath } : {}
|
|
62
|
-
});
|
|
63
|
-
const page = await context.newPage();
|
|
64
|
-
page.setDefaultTimeout(3e4);
|
|
65
|
-
page.setDefaultNavigationTimeout(45e3);
|
|
66
|
-
const metadataPath = (0, import_paths.ensureLibrettoSessionStatePath)(sessionName);
|
|
67
|
-
const existingStateRaw = (0, import_node_fs.existsSync)(metadataPath) ? JSON.parse((0, import_node_fs.readFileSync)(metadataPath, "utf-8")) : void 0;
|
|
68
|
-
const parsedExistingState = import_session_state.SessionStateFileSchema.safeParse(existingStateRaw);
|
|
69
|
-
(0, import_node_fs.writeFileSync)(
|
|
70
|
-
metadataPath,
|
|
71
|
-
JSON.stringify(
|
|
72
|
-
{
|
|
73
|
-
version: parsedExistingState.success ? parsedExistingState.data.version : import_session_state.SESSION_STATE_VERSION,
|
|
74
|
-
session: sessionName,
|
|
75
|
-
port: debugPort,
|
|
76
|
-
pid: process.pid,
|
|
77
|
-
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
78
|
-
status: "active"
|
|
79
|
-
},
|
|
80
|
-
null,
|
|
81
|
-
2
|
|
82
|
-
)
|
|
83
|
-
);
|
|
84
|
-
return {
|
|
85
|
-
browser,
|
|
86
|
-
context,
|
|
87
|
-
page,
|
|
88
|
-
debugPort,
|
|
89
|
-
metadataPath,
|
|
90
|
-
close: async () => {
|
|
91
|
-
await browser.close();
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
96
|
-
0 && (module.exports = {
|
|
97
|
-
launchBrowser
|
|
98
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Browser, BrowserContext, Page } from 'playwright';
|
|
2
|
-
|
|
3
|
-
type LaunchBrowserArgs = {
|
|
4
|
-
sessionName: string;
|
|
5
|
-
headless?: boolean;
|
|
6
|
-
viewport?: {
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
};
|
|
10
|
-
storageStatePath?: string;
|
|
11
|
-
};
|
|
12
|
-
type BrowserSession = {
|
|
13
|
-
browser: Browser;
|
|
14
|
-
context: BrowserContext;
|
|
15
|
-
page: Page;
|
|
16
|
-
debugPort: number;
|
|
17
|
-
metadataPath: string;
|
|
18
|
-
close: () => Promise<void>;
|
|
19
|
-
};
|
|
20
|
-
declare function launchBrowser({ sessionName, headless, viewport, storageStatePath, }: LaunchBrowserArgs): Promise<BrowserSession>;
|
|
21
|
-
|
|
22
|
-
export { type BrowserSession, type LaunchBrowserArgs, launchBrowser };
|
|
@@ -1,38 +0,0 @@
|
|
|
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 state_exports = {};
|
|
20
|
-
__export(state_exports, {
|
|
21
|
-
SESSION_STATE_VERSION: () => import_session_state.SESSION_STATE_VERSION,
|
|
22
|
-
SessionStateFileSchema: () => import_session_state.SessionStateFileSchema,
|
|
23
|
-
SessionStatusSchema: () => import_session_state.SessionStatusSchema,
|
|
24
|
-
parseSessionStateContent: () => import_session_state.parseSessionStateContent,
|
|
25
|
-
parseSessionStateData: () => import_session_state.parseSessionStateData,
|
|
26
|
-
serializeSessionState: () => import_session_state.serializeSessionState
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(state_exports);
|
|
29
|
-
var import_session_state = require("./session-state.js");
|
|
30
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
-
0 && (module.exports = {
|
|
32
|
-
SESSION_STATE_VERSION,
|
|
33
|
-
SessionStateFileSchema,
|
|
34
|
-
SessionStatusSchema,
|
|
35
|
-
parseSessionStateContent,
|
|
36
|
-
parseSessionStateData,
|
|
37
|
-
serializeSessionState
|
|
38
|
-
});
|
|
@@ -1,92 +0,0 @@
|
|
|
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 session_state_exports = {};
|
|
20
|
-
__export(session_state_exports, {
|
|
21
|
-
SESSION_STATE_VERSION: () => SESSION_STATE_VERSION,
|
|
22
|
-
SessionStateFileSchema: () => SessionStateFileSchema,
|
|
23
|
-
SessionStatusSchema: () => SessionStatusSchema,
|
|
24
|
-
SessionViewportSchema: () => SessionViewportSchema,
|
|
25
|
-
parseSessionStateContent: () => parseSessionStateContent,
|
|
26
|
-
parseSessionStateData: () => parseSessionStateData,
|
|
27
|
-
serializeSessionState: () => serializeSessionState
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(session_state_exports);
|
|
30
|
-
var import_zod = require("zod");
|
|
31
|
-
const SESSION_STATE_VERSION = 1;
|
|
32
|
-
const SessionStatusSchema = import_zod.z.enum([
|
|
33
|
-
"active",
|
|
34
|
-
"paused",
|
|
35
|
-
"completed",
|
|
36
|
-
"failed",
|
|
37
|
-
"exited"
|
|
38
|
-
]);
|
|
39
|
-
const SessionViewportSchema = import_zod.z.object({
|
|
40
|
-
width: import_zod.z.number().int().min(1),
|
|
41
|
-
height: import_zod.z.number().int().min(1)
|
|
42
|
-
});
|
|
43
|
-
const SessionStateFileSchema = import_zod.z.object({
|
|
44
|
-
version: import_zod.z.literal(SESSION_STATE_VERSION),
|
|
45
|
-
port: import_zod.z.number().int().min(0).max(65535),
|
|
46
|
-
pid: import_zod.z.number().int(),
|
|
47
|
-
session: import_zod.z.string().min(1),
|
|
48
|
-
startedAt: import_zod.z.string().datetime({ offset: true }),
|
|
49
|
-
status: SessionStatusSchema.optional(),
|
|
50
|
-
viewport: SessionViewportSchema.optional()
|
|
51
|
-
});
|
|
52
|
-
function formatIssues(error) {
|
|
53
|
-
return error.issues.map((issue) => {
|
|
54
|
-
const path = issue.path.join(".") || "root";
|
|
55
|
-
return `${path}: ${issue.message}`;
|
|
56
|
-
}).join("; ");
|
|
57
|
-
}
|
|
58
|
-
function parseSessionStateData(rawState, source) {
|
|
59
|
-
const parsed = SessionStateFileSchema.safeParse(rawState);
|
|
60
|
-
if (!parsed.success) {
|
|
61
|
-
throw new Error(`Session state at ${source} is invalid: ${formatIssues(parsed.error)}`);
|
|
62
|
-
}
|
|
63
|
-
const { version: _version, ...state } = parsed.data;
|
|
64
|
-
return state;
|
|
65
|
-
}
|
|
66
|
-
function parseSessionStateContent(content, source) {
|
|
67
|
-
let rawState;
|
|
68
|
-
try {
|
|
69
|
-
rawState = JSON.parse(content);
|
|
70
|
-
} catch (error) {
|
|
71
|
-
throw new Error(
|
|
72
|
-
`Session state at ${source} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
return parseSessionStateData(rawState, source);
|
|
76
|
-
}
|
|
77
|
-
function serializeSessionState(state) {
|
|
78
|
-
return SessionStateFileSchema.parse({
|
|
79
|
-
version: SESSION_STATE_VERSION,
|
|
80
|
-
...state
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
84
|
-
0 && (module.exports = {
|
|
85
|
-
SESSION_STATE_VERSION,
|
|
86
|
-
SessionStateFileSchema,
|
|
87
|
-
SessionStatusSchema,
|
|
88
|
-
SessionViewportSchema,
|
|
89
|
-
parseSessionStateContent,
|
|
90
|
-
parseSessionStateData,
|
|
91
|
-
serializeSessionState
|
|
92
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
declare const SESSION_STATE_VERSION = 1;
|
|
4
|
-
declare const SessionStatusSchema: z.ZodEnum<{
|
|
5
|
-
active: "active";
|
|
6
|
-
paused: "paused";
|
|
7
|
-
completed: "completed";
|
|
8
|
-
failed: "failed";
|
|
9
|
-
exited: "exited";
|
|
10
|
-
}>;
|
|
11
|
-
declare const SessionViewportSchema: z.ZodObject<{
|
|
12
|
-
width: z.ZodNumber;
|
|
13
|
-
height: z.ZodNumber;
|
|
14
|
-
}, z.core.$strip>;
|
|
15
|
-
declare const SessionStateFileSchema: z.ZodObject<{
|
|
16
|
-
version: z.ZodLiteral<1>;
|
|
17
|
-
port: z.ZodNumber;
|
|
18
|
-
pid: z.ZodNumber;
|
|
19
|
-
session: z.ZodString;
|
|
20
|
-
startedAt: z.ZodString;
|
|
21
|
-
status: z.ZodOptional<z.ZodEnum<{
|
|
22
|
-
active: "active";
|
|
23
|
-
paused: "paused";
|
|
24
|
-
completed: "completed";
|
|
25
|
-
failed: "failed";
|
|
26
|
-
exited: "exited";
|
|
27
|
-
}>>;
|
|
28
|
-
viewport: z.ZodOptional<z.ZodObject<{
|
|
29
|
-
width: z.ZodNumber;
|
|
30
|
-
height: z.ZodNumber;
|
|
31
|
-
}, z.core.$strip>>;
|
|
32
|
-
}, z.core.$strip>;
|
|
33
|
-
type SessionStatus = z.infer<typeof SessionStatusSchema>;
|
|
34
|
-
type SessionStateFile = z.infer<typeof SessionStateFileSchema>;
|
|
35
|
-
type SessionState = Omit<SessionStateFile, "version">;
|
|
36
|
-
declare function parseSessionStateData(rawState: unknown, source: string): SessionState;
|
|
37
|
-
declare function parseSessionStateContent(content: string, source: string): SessionState;
|
|
38
|
-
declare function serializeSessionState(state: SessionState): SessionStateFile;
|
|
39
|
-
|
|
40
|
-
export { SESSION_STATE_VERSION, type SessionState, type SessionStateFile, SessionStateFileSchema, type SessionStatus, SessionStatusSchema, SessionViewportSchema, parseSessionStateContent, parseSessionStateData, serializeSessionState };
|
|
@@ -1,174 +0,0 @@
|
|
|
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 ghost_cursor_exports = {};
|
|
20
|
-
__export(ghost_cursor_exports, {
|
|
21
|
-
ensureGhostCursor: () => ensureGhostCursor,
|
|
22
|
-
getGhostCursorPosition: () => getGhostCursorPosition,
|
|
23
|
-
ghostClick: () => ghostClick,
|
|
24
|
-
hideGhostCursor: () => hideGhostCursor,
|
|
25
|
-
moveGhostCursor: () => moveGhostCursor,
|
|
26
|
-
moveGhostCursorWithDistance: () => moveGhostCursorWithDistance
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(ghost_cursor_exports);
|
|
29
|
-
const DEFAULTS = {
|
|
30
|
-
style: "minimal",
|
|
31
|
-
color: "rgba(255, 70, 70, 0.9)",
|
|
32
|
-
size: 20,
|
|
33
|
-
zIndex: 2147483646,
|
|
34
|
-
easing: "cubic-bezier(0.16, 1, 0.3, 1)",
|
|
35
|
-
minDurationMs: 100,
|
|
36
|
-
maxDurationMs: 600,
|
|
37
|
-
speedPxPerMs: 1.5
|
|
38
|
-
};
|
|
39
|
-
const CURSOR_ID = "__libretto_ghost_cursor__";
|
|
40
|
-
function buildCursorSvg(style, color, size) {
|
|
41
|
-
if (style === "dot") {
|
|
42
|
-
return `<div style="width:${size}px;height:${size}px;border-radius:50%;background:${color};"></div>`;
|
|
43
|
-
}
|
|
44
|
-
if (style === "screenstudio") {
|
|
45
|
-
return `<div style="width:${size * 1.4}px;height:${size * 1.4}px;border-radius:50%;background:${color};box-shadow:0 0 ${size * 0.6}px ${color};opacity:0.7;"></div>`;
|
|
46
|
-
}
|
|
47
|
-
return `<svg width="${size}" height="${size}" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
48
|
-
<path d="M5 3L19 12L12 13L9 20L5 3Z" fill="${color}" stroke="rgba(0,0,0,0.3)" stroke-width="1"/>
|
|
49
|
-
</svg>`;
|
|
50
|
-
}
|
|
51
|
-
function buildInitScript(opts) {
|
|
52
|
-
const svg = buildCursorSvg(opts.style, opts.color, opts.size);
|
|
53
|
-
return `
|
|
54
|
-
(function() {
|
|
55
|
-
if (document.getElementById("${CURSOR_ID}")) return;
|
|
56
|
-
var el = document.createElement("div");
|
|
57
|
-
el.id = "${CURSOR_ID}";
|
|
58
|
-
el.style.cssText = "position:fixed;top:0;left:0;z-index:${opts.zIndex};pointer-events:none;transform:translate3d(-100px,-100px,0);transition:none;will-change:transform,opacity;opacity:0;";
|
|
59
|
-
el.innerHTML = ${JSON.stringify(svg)};
|
|
60
|
-
document.documentElement.appendChild(el);
|
|
61
|
-
})();
|
|
62
|
-
`;
|
|
63
|
-
}
|
|
64
|
-
const installedPages = /* @__PURE__ */ new WeakSet();
|
|
65
|
-
async function ensureGhostCursor(page, options) {
|
|
66
|
-
const existingOpts = page.__librettoGhostCursorOpts;
|
|
67
|
-
const opts = { ...DEFAULTS, ...existingOpts ?? {}, ...options };
|
|
68
|
-
const initScript = buildInitScript(opts);
|
|
69
|
-
if (!installedPages.has(page)) {
|
|
70
|
-
installedPages.add(page);
|
|
71
|
-
await page.addInitScript({ content: initScript });
|
|
72
|
-
}
|
|
73
|
-
page.__librettoGhostCursorOpts = opts;
|
|
74
|
-
try {
|
|
75
|
-
await page.evaluate(new Function(initScript));
|
|
76
|
-
} catch {
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
async function moveGhostCursor(page, target) {
|
|
80
|
-
const opts = page.__librettoGhostCursorOpts ?? DEFAULTS;
|
|
81
|
-
const durationMs = target.durationMs ?? Math.min(
|
|
82
|
-
opts.maxDurationMs,
|
|
83
|
-
Math.max(opts.minDurationMs, 200)
|
|
84
|
-
// default ~200ms if no distance info
|
|
85
|
-
);
|
|
86
|
-
try {
|
|
87
|
-
await page.evaluate(
|
|
88
|
-
({ id, x, y, duration, easing }) => {
|
|
89
|
-
const el = document.getElementById(id);
|
|
90
|
-
if (!el) return;
|
|
91
|
-
el.style.opacity = "1";
|
|
92
|
-
el.style.transition = `transform ${duration}ms ${easing}`;
|
|
93
|
-
el.style.transform = `translate3d(${x}px, ${y}px, 0)`;
|
|
94
|
-
},
|
|
95
|
-
{ id: CURSOR_ID, x: target.x, y: target.y, duration: durationMs, easing: opts.easing }
|
|
96
|
-
);
|
|
97
|
-
await page.waitForTimeout(durationMs);
|
|
98
|
-
} catch {
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
async function moveGhostCursorWithDistance(page, from, to) {
|
|
102
|
-
const opts = page.__librettoGhostCursorOpts ?? DEFAULTS;
|
|
103
|
-
const dx = to.x - from.x;
|
|
104
|
-
const dy = to.y - from.y;
|
|
105
|
-
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
106
|
-
const durationMs = Math.min(
|
|
107
|
-
opts.maxDurationMs,
|
|
108
|
-
Math.max(opts.minDurationMs, distance / opts.speedPxPerMs)
|
|
109
|
-
);
|
|
110
|
-
await moveGhostCursor(page, { x: to.x, y: to.y, durationMs });
|
|
111
|
-
}
|
|
112
|
-
async function ghostClick(page, target) {
|
|
113
|
-
try {
|
|
114
|
-
await page.evaluate(
|
|
115
|
-
({ id, x, y }) => {
|
|
116
|
-
const el = document.getElementById(id);
|
|
117
|
-
if (!el) return;
|
|
118
|
-
el.style.transform = `translate3d(${x}px, ${y}px, 0) scale(0.93)`;
|
|
119
|
-
el.style.transition = "transform 80ms ease-out";
|
|
120
|
-
},
|
|
121
|
-
{ id: CURSOR_ID, x: target.x, y: target.y }
|
|
122
|
-
);
|
|
123
|
-
await page.waitForTimeout(100);
|
|
124
|
-
await page.evaluate(
|
|
125
|
-
({ id, x, y }) => {
|
|
126
|
-
const el = document.getElementById(id);
|
|
127
|
-
if (!el) return;
|
|
128
|
-
el.style.transform = `translate3d(${x}px, ${y}px, 0) scale(1)`;
|
|
129
|
-
el.style.transition = "transform 120ms ease-out";
|
|
130
|
-
},
|
|
131
|
-
{ id: CURSOR_ID, x: target.x, y: target.y }
|
|
132
|
-
);
|
|
133
|
-
await page.waitForTimeout(130);
|
|
134
|
-
} catch {
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
async function hideGhostCursor(page) {
|
|
138
|
-
try {
|
|
139
|
-
await page.evaluate(
|
|
140
|
-
({ id }) => {
|
|
141
|
-
const el = document.getElementById(id);
|
|
142
|
-
if (!el) return;
|
|
143
|
-
el.style.transition = "opacity 300ms ease-out";
|
|
144
|
-
el.style.opacity = "0";
|
|
145
|
-
},
|
|
146
|
-
{ id: CURSOR_ID }
|
|
147
|
-
);
|
|
148
|
-
} catch {
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
async function getGhostCursorPosition(page) {
|
|
152
|
-
try {
|
|
153
|
-
return await page.evaluate(({ id }) => {
|
|
154
|
-
const el = document.getElementById(id);
|
|
155
|
-
if (!el) return null;
|
|
156
|
-
const match = el.style.transform.match(
|
|
157
|
-
/translate3d\(\s*([\d.-]+)px\s*,\s*([\d.-]+)px/
|
|
158
|
-
);
|
|
159
|
-
if (!match) return null;
|
|
160
|
-
return { x: parseFloat(match[1]), y: parseFloat(match[2]) };
|
|
161
|
-
}, { id: CURSOR_ID });
|
|
162
|
-
} catch {
|
|
163
|
-
return null;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
167
|
-
0 && (module.exports = {
|
|
168
|
-
ensureGhostCursor,
|
|
169
|
-
getGhostCursorPosition,
|
|
170
|
-
ghostClick,
|
|
171
|
-
hideGhostCursor,
|
|
172
|
-
moveGhostCursor,
|
|
173
|
-
moveGhostCursorWithDistance
|
|
174
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Page } from 'playwright';
|
|
2
|
-
|
|
3
|
-
type GhostCursorStyle = "minimal" | "dot" | "screenstudio";
|
|
4
|
-
type GhostCursorOptions = {
|
|
5
|
-
style?: GhostCursorStyle;
|
|
6
|
-
color?: string;
|
|
7
|
-
size?: number;
|
|
8
|
-
zIndex?: number;
|
|
9
|
-
easing?: string;
|
|
10
|
-
minDurationMs?: number;
|
|
11
|
-
maxDurationMs?: number;
|
|
12
|
-
speedPxPerMs?: number;
|
|
13
|
-
};
|
|
14
|
-
declare function ensureGhostCursor(page: Page, options?: GhostCursorOptions): Promise<void>;
|
|
15
|
-
declare function moveGhostCursor(page: Page, target: {
|
|
16
|
-
x: number;
|
|
17
|
-
y: number;
|
|
18
|
-
durationMs?: number;
|
|
19
|
-
}): Promise<void>;
|
|
20
|
-
declare function moveGhostCursorWithDistance(page: Page, from: {
|
|
21
|
-
x: number;
|
|
22
|
-
y: number;
|
|
23
|
-
}, to: {
|
|
24
|
-
x: number;
|
|
25
|
-
y: number;
|
|
26
|
-
}): Promise<void>;
|
|
27
|
-
declare function ghostClick(page: Page, target: {
|
|
28
|
-
x: number;
|
|
29
|
-
y: number;
|
|
30
|
-
}): Promise<void>;
|
|
31
|
-
declare function hideGhostCursor(page: Page): Promise<void>;
|
|
32
|
-
declare function getGhostCursorPosition(page: Page): Promise<{
|
|
33
|
-
x: number;
|
|
34
|
-
y: number;
|
|
35
|
-
} | null>;
|
|
36
|
-
|
|
37
|
-
export { type GhostCursorOptions, type GhostCursorStyle, ensureGhostCursor, getGhostCursorPosition, ghostClick, hideGhostCursor, moveGhostCursor, moveGhostCursorWithDistance };
|