@ada-mcp/mcp-server 0.1.12 → 0.1.14
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 +10 -10
- package/dist/cli.cjs +227 -139
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,27 +8,27 @@ ADA MCP server package that supports:
|
|
|
8
8
|
|
|
9
9
|
## 标准安装(Cursor / MCP)
|
|
10
10
|
|
|
11
|
-
请使用 **`@ada-mcp/launcher@0.1.
|
|
11
|
+
请使用 **`@ada-mcp/launcher@0.1.11`** 拉起本包(见 [launcher README](../ada-mcp-launcher/README.md)):
|
|
12
12
|
|
|
13
13
|
```json
|
|
14
14
|
{
|
|
15
15
|
"mcpServers": {
|
|
16
16
|
"ada-mcp": {
|
|
17
17
|
"command": "pnpm",
|
|
18
|
-
"args": ["dlx", "@ada-mcp/launcher@0.1.
|
|
18
|
+
"args": ["dlx", "@ada-mcp/launcher@0.1.11"]
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
本包版本:**`@ada-mcp/mcp-server@0.1.
|
|
24
|
+
本包版本:**`@ada-mcp/mcp-server@0.1.14`**(由 launcher 默认拉取;依赖锁定 `playwright@1.59.1`)。
|
|
25
25
|
|
|
26
26
|
直接调试本包(无 launcher 拉包前测速):
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
pnpm dlx @ada-mcp/mcp-server@0.1.
|
|
29
|
+
pnpm dlx @ada-mcp/mcp-server@0.1.14
|
|
30
30
|
# npx 等价:
|
|
31
|
-
npx -y @ada-mcp/mcp-server@0.1.
|
|
31
|
+
npx -y @ada-mcp/mcp-server@0.1.14
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
## 启动时自动安装依赖(默认仅 Playwright)
|
|
@@ -83,27 +83,27 @@ npx -y @ada-mcp/mcp-server@0.1.10
|
|
|
83
83
|
在标准 `args` 后追加,例如安装全部依赖:
|
|
84
84
|
|
|
85
85
|
```json
|
|
86
|
-
"args": ["dlx", "@ada-mcp/launcher@0.1.
|
|
86
|
+
"args": ["dlx", "@ada-mcp/launcher@0.1.11", "--install-deps=all"]
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
## Cursor MCP 配置
|
|
90
90
|
|
|
91
|
-
**pnpm(推荐)**:`pnpm` + `dlx @ada-mcp/launcher@0.1.
|
|
91
|
+
**pnpm(推荐)**:`pnpm` + `dlx @ada-mcp/launcher@0.1.11`
|
|
92
92
|
|
|
93
|
-
**npx 等价**(`launcher@0.1.7+`):`npx` + `-y @ada-mcp/launcher@0.1.
|
|
93
|
+
**npx 等价**(`launcher@0.1.7+`):`npx` + `-y @ada-mcp/launcher@0.1.11`(内层同样 `npx -y` mcp-server,测速逻辑与 pnpm 一致)
|
|
94
94
|
|
|
95
95
|
```json
|
|
96
96
|
{
|
|
97
97
|
"mcpServers": {
|
|
98
98
|
"ada-mcp": {
|
|
99
99
|
"command": "npx",
|
|
100
|
-
"args": ["-y", "@ada-mcp/launcher@0.1.
|
|
100
|
+
"args": ["-y", "@ada-mcp/launcher@0.1.11"]
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
Windows 若找不到 `pnpm`,可将 `command` 改为 `pnpm.cmd` 绝对路径;无 pnpm 时只能直接 `npx -y @ada-mcp/mcp-server@0.1.
|
|
106
|
+
Windows 若找不到 `pnpm`,可将 `command` 改为 `pnpm.cmd` 绝对路径;无 pnpm 时只能直接 `npx -y @ada-mcp/mcp-server@0.1.14`(无 launcher 拉包测速)。
|
|
107
107
|
|
|
108
108
|
## Remote mode
|
|
109
109
|
|
package/dist/cli.cjs
CHANGED
|
@@ -2728,16 +2728,16 @@ var init_src = __esm({
|
|
|
2728
2728
|
}
|
|
2729
2729
|
});
|
|
2730
2730
|
|
|
2731
|
-
// ../ada-agent/
|
|
2731
|
+
// ../ada-agent/src/bundled-config.generated.ts
|
|
2732
2732
|
var bundledDefaultConfigYaml;
|
|
2733
2733
|
var init_bundled_config_generated = __esm({
|
|
2734
|
-
"../ada-agent/
|
|
2734
|
+
"../ada-agent/src/bundled-config.generated.ts"() {
|
|
2735
2735
|
"use strict";
|
|
2736
2736
|
bundledDefaultConfigYaml = 'agent:\r\n id: "ada-agent-local"\r\n mode: "foreground"\r\n setupOnFirstRun: true\r\n\r\nbootstrapUI:\r\n enabled: true\r\n mode: "auto" # auto | cli | gui\r\n host: "127.0.0.1"\r\n port: 17650\r\n autoOpenBrowser: true\r\n sessionTtlSec: 600\r\n secretsProvider: "auto" # auto | keychain | credman | file\r\n native:\r\n enabled: false\r\n command: "" # e.g. ./bootstrap-ui / .\\bootstrap-ui.exe\r\n args: []\r\n timeoutMs: 120000\r\n fallbackToWeb: true\r\n\r\ntransport:\r\n mode: "auto"\r\n streamProtocol: "websocket"\r\n requestPath: "/api/v1/execute"\r\n healthPath: "/health"\r\n streamPath: "/ws"\r\n requestTimeoutMs: 15000\r\n\r\ngraphics:\r\n enabled: false\r\n fallbackOnSemanticFailure: false\r\n minConfidence: 0.8\r\n\r\nmonitoring:\r\n enabled: false\r\n platforms: ["web", "android", "ios", "harmony"] # \u53EF\u9009\u5B50\u96C6\r\n sampleEvery: 1 # \u6BCF N \u6761\u64CD\u4F5C\u91C7\u6837\u4E00\u6B21\uFF0C1 \u8868\u793A\u5168\u91CF\r\n outputDir: "artifacts/monitoring"\r\n onFailureOnly: false # true \u65F6\u4EC5\u5931\u8D25\u64CD\u4F5C\u6293\u56FE\uFF0C\u6027\u80FD\u66F4\u4F18\r\n groupBySession: true # \u6309 sessionId/requestId \u5206\u5C42\u5F52\u6863\r\n nonBlocking: true # true \u65F6\u76D1\u63A7\u5F02\u6B65\u6267\u884C\uFF0C\u4E0D\u963B\u585E\u4E3B\u94FE\u8DEF\r\n resolution:\r\n maxWidth: 1280\r\n maxHeight: 720\r\n keepAspectRatio: true # \u4FDD\u6301\u6BD4\u4F8B\uFF0C\u907F\u514D\u76D1\u63A7\u56FE\u50CF\u53D8\u5F62\r\n\r\nqueue:\r\n inboxDir: "tasks/inbox"\r\n processedDir: "tasks/processed"\r\n failedDir: "tasks/failed"\r\n pollIntervalMs: 3000\r\n maxFileRetryAttempts: 2\r\n\r\ndependencies:\r\n autoInstallOnStart: true\r\n playwrightBrowser: "chromium" # chromium | firefox | webkit | all\r\n playwrightInstallTargets: ["chromium"] # chromium | chrome | msedge | firefox | webkit | all\r\n playwrightDownloadHost: "https://cdn.playwright.dev"\r\n # \u56FD\u5185 npm \u955C\u50CF\uFF08\u6309\u4F18\u5148\u7EA7\uFF1Binstall-deps \u542F\u52A8\u65F6\u6D4B\u901F\u9009\u6700\u5FEB\uFF0C\u65E0\u9700\u7528\u6237\u914D\u7F6E\uFF09\r\n npmRegistryCandidates:\r\n - "https://registry.npmmirror.com" # \u963F\u91CC\u4E91 / npmmirror\uFF08\u63A8\u8350\uFF09\r\n - "https://mirrors.cloud.tencent.com/npm" # \u817E\u8BAF\u4E91\r\n - "https://repo.huaweicloud.com/repository/npm" # \u534E\u4E3A\u4E91\r\n - "https://registry.npmjs.org" # \u5B98\u65B9\u515C\u5E95\r\n playwrightHostCandidates:\r\n - "https://cdn.playwright.dev"\r\n - "https://playwright.azureedge.net"\r\n - "https://npmmirror.com/mirrors/playwright"\r\n - "https://cdn.npmmirror.com/binaries/playwright"\r\n # \u539F\u751F WebDriver\uFF08geckodriver / chromedriver\uFF09\u7EDF\u4E00\u653E\u5728\u9879\u76EE dirver \u76EE\u5F55\r\n nativeDriversDir: "dirver"\r\n geckodriverVersion: "latest" # \u5982 0.36.0\uFF1Binstall-deps --only=selenium \u65F6\u4E0B\u8F7D\u5230\u6B64\u76EE\u5F55\r\n chromedriverVersion: "latest" # \u5982 137\u3001135\u3001match-chrome\uFF08\u5339\u914D\u672C\u673A Chrome \u4E3B\u7248\u672C\uFF09\r\n\r\nappium:\r\n serverUrl: "http://127.0.0.1:4723"\r\n requiredDrivers: ["uiautomator2", "xcuitest", "harmonyos"]\r\n';
|
|
2737
2737
|
}
|
|
2738
2738
|
});
|
|
2739
2739
|
|
|
2740
|
-
// ../ada-agent/
|
|
2740
|
+
// ../ada-agent/src/config.ts
|
|
2741
2741
|
function mergeConfig(base, overrides) {
|
|
2742
2742
|
return {
|
|
2743
2743
|
...base,
|
|
@@ -2803,10 +2803,9 @@ function maskToken(token) {
|
|
|
2803
2803
|
}
|
|
2804
2804
|
var import_promises2, import_node_path2, DEFAULT_CONFIG_RELATIVE, LOCAL_DATA_DIR, EFFECTIVE_CONFIG_FILE, defaultConfig;
|
|
2805
2805
|
var init_config = __esm({
|
|
2806
|
-
"../ada-agent/
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
import_node_path2 = __toESM(require("node:path"), 1);
|
|
2806
|
+
"../ada-agent/src/config.ts"() {
|
|
2807
|
+
import_promises2 = __toESM(require("node:fs/promises"));
|
|
2808
|
+
import_node_path2 = __toESM(require("node:path"));
|
|
2810
2809
|
init_js_yaml();
|
|
2811
2810
|
init_src();
|
|
2812
2811
|
init_bundled_config_generated();
|
|
@@ -2898,7 +2897,7 @@ var init_config = __esm({
|
|
|
2898
2897
|
}
|
|
2899
2898
|
});
|
|
2900
2899
|
|
|
2901
|
-
// ../ada-agent/
|
|
2900
|
+
// ../ada-agent/src/secrets.ts
|
|
2902
2901
|
function resolveProvider(provider) {
|
|
2903
2902
|
if (provider === "keychain" || provider === "credman") {
|
|
2904
2903
|
return "file";
|
|
@@ -2930,23 +2929,21 @@ async function loadSecret(provider, cwd = process.cwd()) {
|
|
|
2930
2929
|
}
|
|
2931
2930
|
var import_promises3, import_node_path3, SECRET_FILE;
|
|
2932
2931
|
var init_secrets = __esm({
|
|
2933
|
-
"../ada-agent/
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
import_node_path3 = __toESM(require("node:path"), 1);
|
|
2932
|
+
"../ada-agent/src/secrets.ts"() {
|
|
2933
|
+
import_promises3 = __toESM(require("node:fs/promises"));
|
|
2934
|
+
import_node_path3 = __toESM(require("node:path"));
|
|
2937
2935
|
init_config();
|
|
2938
2936
|
SECRET_FILE = "secrets.json";
|
|
2939
2937
|
}
|
|
2940
2938
|
});
|
|
2941
2939
|
|
|
2942
|
-
// ../ada-agent/
|
|
2940
|
+
// ../ada-agent/src/logger.ts
|
|
2943
2941
|
function log(level, payload) {
|
|
2944
2942
|
baseLog(level, payload);
|
|
2945
2943
|
}
|
|
2946
2944
|
var baseLog;
|
|
2947
2945
|
var init_logger = __esm({
|
|
2948
|
-
"../ada-agent/
|
|
2949
|
-
"use strict";
|
|
2946
|
+
"../ada-agent/src/logger.ts"() {
|
|
2950
2947
|
init_src();
|
|
2951
2948
|
baseLog = createJsonLogger("ada-agent");
|
|
2952
2949
|
}
|
|
@@ -3471,7 +3468,7 @@ var init_src2 = __esm({
|
|
|
3471
3468
|
}
|
|
3472
3469
|
});
|
|
3473
3470
|
|
|
3474
|
-
// ../ada-agent/
|
|
3471
|
+
// ../ada-agent/src/dependency-installer.ts
|
|
3475
3472
|
function shouldUseShell(command) {
|
|
3476
3473
|
if (process.platform !== "win32") {
|
|
3477
3474
|
return false;
|
|
@@ -3673,13 +3670,19 @@ async function ensureNodeEnvironmentForInstall(onLogLine) {
|
|
|
3673
3670
|
const nodeMajor = majorOf(nodeVersion.stdout);
|
|
3674
3671
|
onLogLine?.(`[deps] Node \u7248\u672C\u68C0\u6D4B\uFF1A\u7CFB\u7EDF=${nodeVersion.stdout}\uFF0C\u5185\u7F6E=${runtimeNode}`);
|
|
3675
3672
|
if (runtimeMajor !== null && nodeMajor !== null && nodeMajor > runtimeMajor) {
|
|
3676
|
-
onLogLine?.(
|
|
3673
|
+
onLogLine?.(
|
|
3674
|
+
`[deps][warn] \u7CFB\u7EDF Node.js \u4E3B\u7248\u672C\uFF08${nodeMajor}\uFF09\u9AD8\u4E8E\u5185\u7F6E\u4E3B\u7248\u672C\uFF08${runtimeMajor}\uFF09\u3002\u5B89\u88C5\u5C06\u7EE7\u7EED\uFF0C\u8FD0\u884C\u65F6\u4EE5\u5185\u7F6E Node \u4E3A\u51C6\u3002`
|
|
3675
|
+
);
|
|
3677
3676
|
}
|
|
3678
3677
|
if (nodeMajor === null || nodeMajor < requiredNodeMajor) {
|
|
3679
|
-
onLogLine?.(
|
|
3678
|
+
onLogLine?.(
|
|
3679
|
+
`[deps][warn] \u7CFB\u7EDF Node.js \u7248\u672C\u4E3A ${nodeVersion.stdout}\uFF08\u5EFA\u8BAE >= ${requiredNodeMajor}\uFF09\uFF0C\u7EE7\u7EED\u5C1D\u8BD5\u5B89\u88C5\u3002`
|
|
3680
|
+
);
|
|
3680
3681
|
}
|
|
3681
3682
|
} else {
|
|
3682
|
-
onLogLine?.(
|
|
3683
|
+
onLogLine?.(
|
|
3684
|
+
`[deps][warn] \u672A\u4ECE PATH \u68C0\u6D4B\u5230 node\uFF0C\u5F53\u524D\u8FD0\u884C\u65F6 Node.js=${runtimeNode}\uFF08\u53EF\u6267\u884C\u7A0B\u5E8F\u5185\u7F6E\uFF09\uFF0C\u7EE7\u7EED\u5C1D\u8BD5\u5B89\u88C5\u3002`
|
|
3685
|
+
);
|
|
3683
3686
|
}
|
|
3684
3687
|
const npmVersion = await runCommandCapture("npm", ["-v"]);
|
|
3685
3688
|
if (npmVersion.code !== 0) {
|
|
@@ -3690,7 +3693,9 @@ ${npmVersion.stderr || npmVersion.stdout}`.trim());
|
|
|
3690
3693
|
}
|
|
3691
3694
|
const npmMajor = majorOf(npmVersion.stdout);
|
|
3692
3695
|
if (npmMajor === null || npmMajor < requiredNpmMajor) {
|
|
3693
|
-
onLogLine?.(
|
|
3696
|
+
onLogLine?.(
|
|
3697
|
+
`[deps][warn] \u7CFB\u7EDF npm \u7248\u672C\u4E3A ${npmVersion.stdout}\uFF08\u5EFA\u8BAE >= ${requiredNpmMajor}\uFF09\uFF0C\u7EE7\u7EED\u5C1D\u8BD5\u5B89\u88C5\u3002`
|
|
3698
|
+
);
|
|
3694
3699
|
}
|
|
3695
3700
|
}
|
|
3696
3701
|
function appiumDriverPackageName(driver) {
|
|
@@ -3814,18 +3819,19 @@ async function detectBestRegistry(config, baseProxy) {
|
|
|
3814
3819
|
return cached;
|
|
3815
3820
|
}
|
|
3816
3821
|
progress("registry.probe.start", { candidates });
|
|
3817
|
-
const probeResults = await Promise.all(
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3822
|
+
const probeResults = await Promise.all(
|
|
3823
|
+
candidates.map(async (candidate) => {
|
|
3824
|
+
progress("registry.probe.try", { candidate });
|
|
3825
|
+
const latency = await probeRegistryLatency(candidate);
|
|
3826
|
+
progress("registry.probe.result", { candidate, latencyMs: latency });
|
|
3827
|
+
return { candidate, latency };
|
|
3828
|
+
})
|
|
3829
|
+
);
|
|
3823
3830
|
let best = candidates[0] ?? normalizeRegistryUrl(baseProxy);
|
|
3824
3831
|
let bestLatency = Number.POSITIVE_INFINITY;
|
|
3825
3832
|
let bestPriority = Number.POSITIVE_INFINITY;
|
|
3826
3833
|
for (const { candidate, latency } of probeResults) {
|
|
3827
|
-
if (latency === null)
|
|
3828
|
-
continue;
|
|
3834
|
+
if (latency === null) continue;
|
|
3829
3835
|
const priority = registryPriorityIndex(candidates, candidate);
|
|
3830
3836
|
if (latency < bestLatency || latency === bestLatency && priority < bestPriority) {
|
|
3831
3837
|
best = candidate;
|
|
@@ -3910,20 +3916,22 @@ async function rankPlaywrightHosts(config) {
|
|
|
3910
3916
|
const candidates = playwrightHostCandidates(config);
|
|
3911
3917
|
const browserVersion = resolveChromiumBrowserVersion();
|
|
3912
3918
|
progress("playwright.host.probe.start", { candidates, browserVersion: browserVersion || void 0 });
|
|
3913
|
-
const probeResults = await Promise.all(
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3919
|
+
const probeResults = await Promise.all(
|
|
3920
|
+
candidates.map(async (candidate) => {
|
|
3921
|
+
progress("playwright.host.probe.try", { candidate });
|
|
3922
|
+
const artifactLatency = browserVersion ? await probePlaywrightBrowserArtifact(candidate, browserVersion) : null;
|
|
3923
|
+
const rootLatency = await probePlaywrightHostLatency(candidate);
|
|
3924
|
+
const latency = artifactLatency ?? rootLatency;
|
|
3925
|
+
const artifactOk = artifactLatency !== null;
|
|
3926
|
+
progress("playwright.host.probe.result", {
|
|
3927
|
+
candidate,
|
|
3928
|
+
latencyMs: latency,
|
|
3929
|
+
artifactOk,
|
|
3930
|
+
browserVersion: browserVersion || void 0
|
|
3931
|
+
});
|
|
3932
|
+
return { candidate, latency, artifactOk, priority: playwrightHostPriorityIndex(candidates, candidate) };
|
|
3933
|
+
})
|
|
3934
|
+
);
|
|
3927
3935
|
const reachable = probeResults.filter((x) => x.latency !== null);
|
|
3928
3936
|
const withArtifact = reachable.filter((x) => x.artifactOk);
|
|
3929
3937
|
const pool = withArtifact.length > 0 ? withArtifact : reachable;
|
|
@@ -3948,7 +3956,9 @@ async function runInstallWithPriority(config, packages, onLogLine) {
|
|
|
3948
3956
|
const npmProxy = await detectBestRegistry(config, npmProxyRegistry());
|
|
3949
3957
|
const pnpmProxy = await detectBestRegistry(config, pnpmProxyRegistry());
|
|
3950
3958
|
progress("packages.install.start", { packages, npmProxy, pnpmProxy });
|
|
3951
|
-
onLogLine?.(
|
|
3959
|
+
onLogLine?.(
|
|
3960
|
+
`[deps] \u5728\u7EBF\u5B89\u88C5\u5305: ${packages.join(" ")} (registry \u63A2\u6D4B: npm=${npmProxy}, pnpm=${pnpmProxy}\uFF1B\u987A\u5E8F: pnpm -> pnpm-proxy -> npm -> npm-proxy)`
|
|
3961
|
+
);
|
|
3952
3962
|
const strategies = [
|
|
3953
3963
|
{
|
|
3954
3964
|
name: "pnpm",
|
|
@@ -3995,7 +4005,9 @@ async function runInstallWithPriority(config, packages, onLogLine) {
|
|
|
3995
4005
|
});
|
|
3996
4006
|
}
|
|
3997
4007
|
}
|
|
3998
|
-
throw new Error(
|
|
4008
|
+
throw new Error(
|
|
4009
|
+
`Dependency install failed after all strategies: ${lastError instanceof Error ? lastError.message : String(lastError)}`
|
|
4010
|
+
);
|
|
3999
4011
|
}
|
|
4000
4012
|
async function runAppiumDriverInstallWithPriority(config, driver, onLogLine) {
|
|
4001
4013
|
const npmProxy = await detectBestRegistry(config, npmProxyRegistry());
|
|
@@ -4054,7 +4066,9 @@ async function runAppiumDriverInstallWithPriority(config, driver, onLogLine) {
|
|
|
4054
4066
|
}
|
|
4055
4067
|
}
|
|
4056
4068
|
}
|
|
4057
|
-
throw new Error(
|
|
4069
|
+
throw new Error(
|
|
4070
|
+
`Appium driver install failed after all strategies (${driver}): ${lastError instanceof Error ? lastError.message : String(lastError)}`
|
|
4071
|
+
);
|
|
4058
4072
|
}
|
|
4059
4073
|
async function verifyPlaywrightSelfTest(onLogLine) {
|
|
4060
4074
|
onLogLine?.("[playwright] \u81EA\u68C0\uFF1A\u542F\u52A8 Chromium \u7A7A\u767D\u9875");
|
|
@@ -4073,7 +4087,9 @@ async function installPlaywrightBrowser(config, onLogLine, options) {
|
|
|
4073
4087
|
const rawTargets = playwrightInstallTargets(config);
|
|
4074
4088
|
const targets = expandPlaywrightInstallTargets(rawTargets);
|
|
4075
4089
|
if (rawTargets.length > 0 && targets.length > rawTargets.length) {
|
|
4076
|
-
onLogLine?.(
|
|
4090
|
+
onLogLine?.(
|
|
4091
|
+
"[playwright] \u914D\u7F6E\u4EC5\u542B chrome/msedge \u901A\u9053\uFF0C\u5DF2\u81EA\u52A8\u52A0\u5165 chromium\uFF08\u81EA\u68C0\u9700 Playwright \u5185\u7F6E\u6D4F\u89C8\u5668\uFF09"
|
|
4092
|
+
);
|
|
4077
4093
|
}
|
|
4078
4094
|
progress("playwright.browser.install.start", { targets: targets.length > 0 ? targets : ["all"] });
|
|
4079
4095
|
onLogLine?.("[playwright] \u5F00\u59CB\u5728\u7EBF\u5B89\u88C5\u6D4F\u89C8\u5668");
|
|
@@ -4094,7 +4110,9 @@ async function installPlaywrightBrowser(config, onLogLine, options) {
|
|
|
4094
4110
|
if (i > 0) {
|
|
4095
4111
|
onLogLine?.(`[playwright] \u4E0A\u4E00\u955C\u50CF\u5931\u8D25\uFF0C\u6539\u8BD5 ${host}`);
|
|
4096
4112
|
}
|
|
4097
|
-
onLogLine?.(
|
|
4113
|
+
onLogLine?.(
|
|
4114
|
+
`[playwright] \u4F7F\u7528\u5185\u7F6E playwright@${version} CLI\uFF0C\u955C\u50CF ${host}\uFF0C\u76EE\u6807: ${targets.length ? targets.join(",") : "all"}${options?.force ? " (--force)" : ""}`
|
|
4115
|
+
);
|
|
4098
4116
|
try {
|
|
4099
4117
|
await runCommand2(command, installArgs, {
|
|
4100
4118
|
env: { PLAYWRIGHT_DOWNLOAD_HOST: host },
|
|
@@ -4208,7 +4226,10 @@ function configWithPlaywrightTargets(config, targets) {
|
|
|
4208
4226
|
}
|
|
4209
4227
|
async function ensureSeleniumNativeDrivers(config, options, onLogLine) {
|
|
4210
4228
|
const root = await resolveWorkspaceRoot2(process.cwd());
|
|
4211
|
-
const driversDir = import_node_path5.default.resolve(
|
|
4229
|
+
const driversDir = import_node_path5.default.resolve(
|
|
4230
|
+
root,
|
|
4231
|
+
options?.nativeDriversDir ?? config.dependencies.nativeDriversDir ?? "dirver"
|
|
4232
|
+
);
|
|
4212
4233
|
const seleniumWebdriverInstalled = hasPackage("selenium-webdriver");
|
|
4213
4234
|
if (seleniumWebdriverInstalled) {
|
|
4214
4235
|
onLogLine?.("[selenium] npm \u5305 selenium-webdriver \u5DF2\u5B89\u88C5");
|
|
@@ -4219,9 +4240,13 @@ async function ensureSeleniumNativeDrivers(config, options, onLogLine) {
|
|
|
4219
4240
|
const chromeVer = options?.chromedriverVersion ?? config.dependencies.chromedriverVersion ?? "latest";
|
|
4220
4241
|
try {
|
|
4221
4242
|
const catalog = await listChromedriverCfTVersions();
|
|
4222
|
-
onLogLine?.(
|
|
4243
|
+
onLogLine?.(
|
|
4244
|
+
`[selenium] \u53EF\u9009 chromedriver \u4E3B\u7248\u672C\uFF08chrome-for-testing\uFF09: ${catalog.slice(0, 12).map((x) => x.major).join(", ")}${catalog.length > 12 ? "\u2026" : ""}`
|
|
4245
|
+
);
|
|
4223
4246
|
} catch (error) {
|
|
4224
|
-
onLogLine?.(
|
|
4247
|
+
onLogLine?.(
|
|
4248
|
+
`[selenium] \u65E0\u6CD5\u62C9\u53D6 chromedriver \u7248\u672C\u5217\u8868: ${error instanceof Error ? error.message : String(error)}`
|
|
4249
|
+
);
|
|
4225
4250
|
}
|
|
4226
4251
|
const resolved = await ensureNativeWebDrivers({
|
|
4227
4252
|
workspaceRoot: root,
|
|
@@ -4240,27 +4265,82 @@ async function ensureSeleniumNativeDrivers(config, options, onLogLine) {
|
|
|
4240
4265
|
chromedriverPath: resolved.chromedriverPath
|
|
4241
4266
|
};
|
|
4242
4267
|
}
|
|
4243
|
-
|
|
4268
|
+
function installScopeNeedsMobileEnv(only) {
|
|
4269
|
+
return only === "all" || only === "appium" || only === "drivers" || only === "mobile" || only === "android" || only === "ios" || only === "harmony";
|
|
4270
|
+
}
|
|
4271
|
+
async function pathIsExistingDirectory(dirPath) {
|
|
4272
|
+
try {
|
|
4273
|
+
const stat = await import_promises5.default.stat(dirPath);
|
|
4274
|
+
return stat.isDirectory();
|
|
4275
|
+
} catch {
|
|
4276
|
+
return false;
|
|
4277
|
+
}
|
|
4278
|
+
}
|
|
4279
|
+
async function prepareInstallHomes(onLogLine, options) {
|
|
4244
4280
|
const root = await resolveWorkspaceRoot2(process.cwd());
|
|
4245
|
-
const projectAndroidHome = import_node_path5.default.join(root, "
|
|
4246
|
-
const projectAppiumHome = import_node_path5.default.join(root, "
|
|
4281
|
+
const projectAndroidHome = import_node_path5.default.join(root, "ANDROID_HOME");
|
|
4282
|
+
const projectAppiumHome = import_node_path5.default.join(root, "APPIUM_HOME");
|
|
4247
4283
|
const envAndroid = (process.env.ANDROID_HOME ?? process.env.ANDROID_SDK_ROOT ?? "").trim();
|
|
4248
4284
|
const envAppium = (process.env.APPIUM_HOME ?? "").trim();
|
|
4249
|
-
const
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4285
|
+
const requireMobile = options?.requireMobileEnv === true;
|
|
4286
|
+
let androidFromSystem = false;
|
|
4287
|
+
let appiumFromSystem = false;
|
|
4288
|
+
let androidHome = projectAndroidHome;
|
|
4289
|
+
let appiumHome = projectAppiumHome;
|
|
4290
|
+
if (envAndroid) {
|
|
4291
|
+
if (await pathIsExistingDirectory(envAndroid)) {
|
|
4292
|
+
androidFromSystem = true;
|
|
4293
|
+
androidHome = envAndroid;
|
|
4294
|
+
onLogLine?.(`[deps] \u4F7F\u7528\u7CFB\u7EDF\u73AF\u5883\u53D8\u91CF ANDROID_HOME=${envAndroid}`);
|
|
4295
|
+
} else {
|
|
4296
|
+
onLogLine?.(`[deps][warn] \u7CFB\u7EDF ANDROID_HOME / ANDROID_SDK_ROOT \u6307\u5411\u7684\u76EE\u5F55\u4E0D\u5B58\u5728: ${envAndroid}`);
|
|
4297
|
+
onLogLine?.(`[deps][warn] \u8BF7\u4FEE\u6B63\u7CFB\u7EDF\u73AF\u5883\u53D8\u91CF\uFF0C\u6216\u5220\u9664\u9519\u8BEF\u914D\u7F6E\u540E\u91CD\u8BD5\u3002`);
|
|
4298
|
+
onLogLine?.(`[deps] \u5B89\u88C5\u8FC7\u7A0B\u5C06\u4F7F\u7528\u9879\u76EE\u9ED8\u8BA4\u76EE\u5F55: ${projectAndroidHome}`);
|
|
4299
|
+
}
|
|
4300
|
+
} else {
|
|
4301
|
+
onLogLine?.("[deps][warn] \u672A\u68C0\u6D4B\u5230\u7CFB\u7EDF\u73AF\u5883\u53D8\u91CF ANDROID_HOME \u6216 ANDROID_SDK_ROOT\u3002");
|
|
4302
|
+
onLogLine?.(
|
|
4303
|
+
"[deps][warn] \u8BF7\u5728\u7CFB\u7EDF/\u7EC8\u7AEF\u914D\u7F6E ANDROID_HOME\uFF08\u6307\u5411 Android SDK \u6839\u76EE\u5F55\uFF0C\u4E14\u5305\u542B platform-tools\uFF09\u3002"
|
|
4304
|
+
);
|
|
4305
|
+
onLogLine?.(`[deps] \u5B89\u88C5\u8FC7\u7A0B\u5C06\u4F7F\u7528\u9879\u76EE\u9ED8\u8BA4\u76EE\u5F55: ${projectAndroidHome}`);
|
|
4306
|
+
}
|
|
4307
|
+
if (envAppium) {
|
|
4308
|
+
if (await pathIsExistingDirectory(envAppium)) {
|
|
4309
|
+
appiumFromSystem = true;
|
|
4310
|
+
appiumHome = envAppium;
|
|
4311
|
+
onLogLine?.(`[deps] \u4F7F\u7528\u7CFB\u7EDF\u73AF\u5883\u53D8\u91CF APPIUM_HOME=${envAppium}`);
|
|
4312
|
+
} else {
|
|
4313
|
+
onLogLine?.(`[deps][warn] \u7CFB\u7EDF APPIUM_HOME \u6307\u5411\u7684\u76EE\u5F55\u4E0D\u5B58\u5728: ${envAppium}`);
|
|
4314
|
+
onLogLine?.(`[deps][warn] \u8BF7\u4FEE\u6B63\u7CFB\u7EDF\u73AF\u5883\u53D8\u91CF\uFF0C\u6216\u5220\u9664\u9519\u8BEF\u914D\u7F6E\u540E\u91CD\u8BD5\u3002`);
|
|
4315
|
+
onLogLine?.(`[deps] \u5B89\u88C5\u8FC7\u7A0B\u5C06\u4F7F\u7528\u9879\u76EE\u9ED8\u8BA4\u76EE\u5F55: ${projectAppiumHome}`);
|
|
4316
|
+
}
|
|
4317
|
+
} else {
|
|
4318
|
+
onLogLine?.("[deps][warn] \u672A\u68C0\u6D4B\u5230\u7CFB\u7EDF\u73AF\u5883\u53D8\u91CF APPIUM_HOME\u3002");
|
|
4319
|
+
onLogLine?.("[deps][warn] \u8BF7\u5728\u7CFB\u7EDF/\u7EC8\u7AEF\u914D\u7F6E APPIUM_HOME\uFF08Appium \u9A71\u52A8\u4E0E\u6269\u5C55\u7684\u5B89\u88C5\u76EE\u5F55\uFF09\u3002");
|
|
4320
|
+
onLogLine?.(`[deps] \u5B89\u88C5\u8FC7\u7A0B\u5C06\u4F7F\u7528\u9879\u76EE\u9ED8\u8BA4\u76EE\u5F55: ${projectAppiumHome}`);
|
|
4321
|
+
}
|
|
4322
|
+
if (requireMobile && !androidFromSystem && !appiumFromSystem) {
|
|
4323
|
+
onLogLine?.(
|
|
4324
|
+
"[deps][warn] \u5F53\u524D\u5B89\u88C5\u5305\u542B Appium/\u79FB\u52A8\u7AEF\u80FD\u529B\uFF0C\u5EFA\u8BAE\u5728\u5B8C\u6210 install-deps \u524D\u914D\u7F6E\u7CFB\u7EDF ANDROID_HOME \u4E0E APPIUM_HOME\u3002"
|
|
4325
|
+
);
|
|
4326
|
+
}
|
|
4327
|
+
await import_promises5.default.mkdir(projectAndroidHome, { recursive: true });
|
|
4328
|
+
await import_promises5.default.mkdir(projectAppiumHome, { recursive: true });
|
|
4329
|
+
if (androidHome !== projectAndroidHome) {
|
|
4330
|
+
await import_promises5.default.mkdir(androidHome, { recursive: true }).catch(() => void 0);
|
|
4331
|
+
}
|
|
4332
|
+
if (appiumHome !== projectAppiumHome) {
|
|
4333
|
+
await import_promises5.default.mkdir(appiumHome, { recursive: true }).catch(() => void 0);
|
|
4334
|
+
}
|
|
4255
4335
|
process.env.ANDROID_HOME = androidHome;
|
|
4256
4336
|
process.env.ANDROID_SDK_ROOT = androidHome;
|
|
4257
4337
|
process.env.APPIUM_HOME = appiumHome;
|
|
4258
|
-
onLogLine?.(`[deps] \u73AF\u5883\u76EE\u5F55: ANDROID_HOME=${androidHome} APPIUM_HOME=${appiumHome}`
|
|
4338
|
+
onLogLine?.(`[deps] \u73AF\u5883\u76EE\u5F55: ANDROID_HOME=${androidHome} APPIUM_HOME=${appiumHome}`);
|
|
4259
4339
|
return {
|
|
4260
4340
|
androidHome,
|
|
4261
4341
|
appiumHome,
|
|
4262
|
-
|
|
4263
|
-
|
|
4342
|
+
androidFromSystem,
|
|
4343
|
+
appiumFromSystem
|
|
4264
4344
|
};
|
|
4265
4345
|
}
|
|
4266
4346
|
function resolveRequestedDrivers(config, only) {
|
|
@@ -4303,14 +4383,16 @@ async function ensureDriverDependencies(config, options) {
|
|
|
4303
4383
|
const pwOverride = filterPlaywrightTargetsOverride(options?.playwrightInstallTargetsOverride);
|
|
4304
4384
|
const configForPlaywright = pwOverride?.length ? configWithPlaywrightTargets(config, pwOverride) : config;
|
|
4305
4385
|
const state = await loadInstallState();
|
|
4306
|
-
const
|
|
4386
|
+
const needPlaywright = only === "all" || only === "playwright";
|
|
4387
|
+
const needSelenium = only === "all" || only === "selenium";
|
|
4388
|
+
const needAppium = only === "all" || only === "appium" || only === "drivers" || only === "mobile" || only === "android" || only === "ios" || only === "harmony";
|
|
4389
|
+
const homes = await prepareInstallHomes(onLogLine, {
|
|
4390
|
+
requireMobileEnv: installScopeNeedsMobileEnv(only)
|
|
4391
|
+
});
|
|
4307
4392
|
progress("deps.ensure.start");
|
|
4308
4393
|
onLogLine?.("[deps] \u5F00\u59CB\u68C0\u6D4B / \u5B89\u88C5\u4F9D\u8D56\u2026");
|
|
4309
4394
|
await ensureNodeEnvironmentForInstall(onLogLine);
|
|
4310
4395
|
const missing = [];
|
|
4311
|
-
const needPlaywright = only === "all" || only === "playwright";
|
|
4312
|
-
const needSelenium = only === "all" || only === "selenium";
|
|
4313
|
-
const needAppium = only === "all" || only === "appium" || only === "drivers" || only === "mobile" || only === "android" || only === "ios" || only === "harmony";
|
|
4314
4396
|
const requestedDrivers = options?.appiumRequiredDriversOverride !== void 0 ? normalizeAppiumDriverTokens(options.appiumRequiredDriversOverride) : resolveRequestedDrivers(config, only);
|
|
4315
4397
|
const needDrivers = requestedDrivers.length > 0;
|
|
4316
4398
|
const installedPackages = [];
|
|
@@ -4356,7 +4438,9 @@ async function ensureDriverDependencies(config, options) {
|
|
|
4356
4438
|
}
|
|
4357
4439
|
});
|
|
4358
4440
|
if (force) {
|
|
4359
|
-
onLogLine?.(
|
|
4441
|
+
onLogLine?.(
|
|
4442
|
+
userRequestedBrowserTargets ? "[playwright] --force\uFF1A\u91CD\u65B0\u5B89\u88C5\u5F53\u524D\u52FE\u9009\u7684\u6D4F\u89C8\u5668\u901A\u9053" : "[playwright] --force\uFF1A\u6309\u914D\u7F6E\u6587\u4EF6\u4E2D\u7684\u76EE\u6807\u91CD\u65B0\u5B89\u88C5\u6D4F\u89C8\u5668"
|
|
4443
|
+
);
|
|
4360
4444
|
}
|
|
4361
4445
|
await installPlaywrightBrowser(configForPlaywright, onLogLine, {
|
|
4362
4446
|
force: force || reinstallForTargets || !launchOk
|
|
@@ -4428,7 +4512,10 @@ async function ensureDriverDependencies(config, options) {
|
|
|
4428
4512
|
let availableChromedriverMajors;
|
|
4429
4513
|
if (needSelenium) {
|
|
4430
4514
|
const root = await resolveWorkspaceRoot2(process.cwd());
|
|
4431
|
-
nativeDriversDir = import_node_path5.default.resolve(
|
|
4515
|
+
nativeDriversDir = import_node_path5.default.resolve(
|
|
4516
|
+
root,
|
|
4517
|
+
options?.nativeDriversDir ?? config.dependencies.nativeDriversDir ?? "dirver"
|
|
4518
|
+
);
|
|
4432
4519
|
availableChromedriverMajors = await listLocalChromedriverVersions(nativeDriversDir);
|
|
4433
4520
|
const resolved = await resolveNativeDrivers({
|
|
4434
4521
|
workspaceRoot: root,
|
|
@@ -4503,13 +4590,12 @@ async function getDependencyHealth(config) {
|
|
|
4503
4590
|
}
|
|
4504
4591
|
var import_node_module, import_node_fs, import_node_child_process2, import_promises5, import_node_path5, require2, DEFAULT_NPM_REGISTRY_CANDIDATES, detectedBestRegistryByKey, PROGRESS_STEPS, DEFAULT_PLAYWRIGHT_HOST_CANDIDATES, PLAYWRIGHT_HOST_FALLBACK, PW_INSTALL_TARGETS;
|
|
4505
4592
|
var init_dependency_installer = __esm({
|
|
4506
|
-
"../ada-agent/
|
|
4507
|
-
"use strict";
|
|
4593
|
+
"../ada-agent/src/dependency-installer.ts"() {
|
|
4508
4594
|
import_node_module = require("node:module");
|
|
4509
4595
|
import_node_fs = require("node:fs");
|
|
4510
4596
|
import_node_child_process2 = require("node:child_process");
|
|
4511
|
-
import_promises5 = __toESM(require("node:fs/promises")
|
|
4512
|
-
import_node_path5 = __toESM(require("node:path")
|
|
4597
|
+
import_promises5 = __toESM(require("node:fs/promises"));
|
|
4598
|
+
import_node_path5 = __toESM(require("node:path"));
|
|
4513
4599
|
init_logger();
|
|
4514
4600
|
init_config();
|
|
4515
4601
|
init_src2();
|
|
@@ -4780,7 +4866,7 @@ var init_src4 = __esm({
|
|
|
4780
4866
|
}
|
|
4781
4867
|
});
|
|
4782
4868
|
|
|
4783
|
-
// ../ada-agent/
|
|
4869
|
+
// ../ada-agent/src/plugin-registry.ts
|
|
4784
4870
|
function buildPluginHost() {
|
|
4785
4871
|
const host = new PluginHost();
|
|
4786
4872
|
registerRuntimePlugins(host);
|
|
@@ -4791,13 +4877,12 @@ function listBuiltInPluginManifests() {
|
|
|
4791
4877
|
return registerRuntimePlugins(host);
|
|
4792
4878
|
}
|
|
4793
4879
|
var init_plugin_registry = __esm({
|
|
4794
|
-
"../ada-agent/
|
|
4795
|
-
"use strict";
|
|
4880
|
+
"../ada-agent/src/plugin-registry.ts"() {
|
|
4796
4881
|
init_src4();
|
|
4797
4882
|
}
|
|
4798
4883
|
});
|
|
4799
4884
|
|
|
4800
|
-
// ../ada-agent/
|
|
4885
|
+
// ../ada-agent/src/doctor.ts
|
|
4801
4886
|
async function dirExists2(dirPath) {
|
|
4802
4887
|
try {
|
|
4803
4888
|
const stat = await import_promises6.default.stat(dirPath);
|
|
@@ -4974,11 +5059,10 @@ async function checkAppiumServer(serverUrl) {
|
|
|
4974
5059
|
}
|
|
4975
5060
|
var import_promises6, import_node_net, import_node_path7, import_node_url, import_node_child_process3;
|
|
4976
5061
|
var init_doctor = __esm({
|
|
4977
|
-
"../ada-agent/
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
import_node_path7 = __toESM(require("node:path"), 1);
|
|
5062
|
+
"../ada-agent/src/doctor.ts"() {
|
|
5063
|
+
import_promises6 = __toESM(require("node:fs/promises"));
|
|
5064
|
+
import_node_net = __toESM(require("node:net"));
|
|
5065
|
+
import_node_path7 = __toESM(require("node:path"));
|
|
4982
5066
|
import_node_url = require("node:url");
|
|
4983
5067
|
import_node_child_process3 = require("node:child_process");
|
|
4984
5068
|
init_dependency_installer();
|
|
@@ -4987,7 +5071,7 @@ var init_doctor = __esm({
|
|
|
4987
5071
|
}
|
|
4988
5072
|
});
|
|
4989
5073
|
|
|
4990
|
-
// ../ada-agent/
|
|
5074
|
+
// ../ada-agent/src/setup-cli.ts
|
|
4991
5075
|
function parseTags(raw) {
|
|
4992
5076
|
return raw.split(",").map((s) => s.trim()).filter(Boolean);
|
|
4993
5077
|
}
|
|
@@ -5001,7 +5085,9 @@ async function runSetupCli() {
|
|
|
5001
5085
|
const rl = import_promises7.default.createInterface({ input: import_node_process.stdin, output: import_node_process.stdout });
|
|
5002
5086
|
try {
|
|
5003
5087
|
console.log("[ADA-AGENT] setup wizard (CLI mode)");
|
|
5004
|
-
const serverUrl = ensureServerUrl(
|
|
5088
|
+
const serverUrl = ensureServerUrl(
|
|
5089
|
+
(await rl.question("Server URL (e.g. https://ada-control.example.com): ")).trim()
|
|
5090
|
+
);
|
|
5005
5091
|
const tenant = (await rl.question("Tenant [default]: ")).trim() || "default";
|
|
5006
5092
|
const environment = (await rl.question("Environment [prod]: ")).trim() || "prod";
|
|
5007
5093
|
const authTypeInput = (await rl.question("Auth type [token/device_code] (default token): ")).trim();
|
|
@@ -5030,14 +5116,13 @@ async function runSetupCli() {
|
|
|
5030
5116
|
}
|
|
5031
5117
|
var import_promises7, import_node_process;
|
|
5032
5118
|
var init_setup_cli = __esm({
|
|
5033
|
-
"../ada-agent/
|
|
5034
|
-
|
|
5035
|
-
import_promises7 = __toESM(require("node:readline/promises"), 1);
|
|
5119
|
+
"../ada-agent/src/setup-cli.ts"() {
|
|
5120
|
+
import_promises7 = __toESM(require("node:readline/promises"));
|
|
5036
5121
|
import_node_process = require("node:process");
|
|
5037
5122
|
}
|
|
5038
5123
|
});
|
|
5039
5124
|
|
|
5040
|
-
// ../ada-agent/
|
|
5125
|
+
// ../ada-agent/src/setup-native.ts
|
|
5041
5126
|
function normalizeOutput(raw) {
|
|
5042
5127
|
const parsed = JSON.parse(raw);
|
|
5043
5128
|
if (!parsed.serverUrl || !parsed.tenant || !parsed.environment) {
|
|
@@ -5100,13 +5185,12 @@ async function runSetupNative(config) {
|
|
|
5100
5185
|
}
|
|
5101
5186
|
var import_node_child_process4;
|
|
5102
5187
|
var init_setup_native = __esm({
|
|
5103
|
-
"../ada-agent/
|
|
5104
|
-
"use strict";
|
|
5188
|
+
"../ada-agent/src/setup-native.ts"() {
|
|
5105
5189
|
import_node_child_process4 = require("node:child_process");
|
|
5106
5190
|
}
|
|
5107
5191
|
});
|
|
5108
5192
|
|
|
5109
|
-
// ../ada-agent/
|
|
5193
|
+
// ../ada-agent/src/setup-state.ts
|
|
5110
5194
|
function normalizePlaywrightTargets(raw) {
|
|
5111
5195
|
const list = (raw ?? []).map((x) => String(x).toLowerCase().trim()).filter((x) => PW_TARGET.has(x));
|
|
5112
5196
|
if (list.includes("all")) {
|
|
@@ -5174,8 +5258,7 @@ async function persistAgentSetup(config, input2) {
|
|
|
5174
5258
|
}
|
|
5175
5259
|
var PW_TARGET;
|
|
5176
5260
|
var init_setup_state = __esm({
|
|
5177
|
-
"../ada-agent/
|
|
5178
|
-
"use strict";
|
|
5261
|
+
"../ada-agent/src/setup-state.ts"() {
|
|
5179
5262
|
init_config();
|
|
5180
5263
|
init_secrets();
|
|
5181
5264
|
PW_TARGET = /* @__PURE__ */ new Set([
|
|
@@ -5189,7 +5272,7 @@ var init_setup_state = __esm({
|
|
|
5189
5272
|
}
|
|
5190
5273
|
});
|
|
5191
5274
|
|
|
5192
|
-
// ../ada-agent/
|
|
5275
|
+
// ../ada-agent/src/bootstrap-ui.ts
|
|
5193
5276
|
function parseDependencyInstallScope(value) {
|
|
5194
5277
|
if (value === "all" || value === "playwright" || value === "mobile" || value === "android" || value === "ios" || value === "harmony" || value === "appium" || value === "drivers") {
|
|
5195
5278
|
return value;
|
|
@@ -5575,7 +5658,10 @@ async function runSetupUi(config) {
|
|
|
5575
5658
|
try {
|
|
5576
5659
|
saved = await persistAgentSetup(config, payload);
|
|
5577
5660
|
} catch (error) {
|
|
5578
|
-
abortSetup(
|
|
5661
|
+
abortSetup(
|
|
5662
|
+
500,
|
|
5663
|
+
error instanceof Error ? error.message : String(error)
|
|
5664
|
+
);
|
|
5579
5665
|
return;
|
|
5580
5666
|
}
|
|
5581
5667
|
res.writeHead(200, {
|
|
@@ -5682,9 +5768,8 @@ async function openBrowser(url) {
|
|
|
5682
5768
|
}
|
|
5683
5769
|
var import_node_http, import_node_crypto, import_node_url2;
|
|
5684
5770
|
var init_bootstrap_ui = __esm({
|
|
5685
|
-
"../ada-agent/
|
|
5686
|
-
|
|
5687
|
-
import_node_http = __toESM(require("node:http"), 1);
|
|
5771
|
+
"../ada-agent/src/bootstrap-ui.ts"() {
|
|
5772
|
+
import_node_http = __toESM(require("node:http"));
|
|
5688
5773
|
import_node_crypto = require("node:crypto");
|
|
5689
5774
|
import_node_url2 = require("node:url");
|
|
5690
5775
|
init_setup_state();
|
|
@@ -5888,7 +5973,7 @@ var init_src6 = __esm({
|
|
|
5888
5973
|
}
|
|
5889
5974
|
});
|
|
5890
5975
|
|
|
5891
|
-
// ../ada-agent/
|
|
5976
|
+
// ../ada-agent/src/transport-client.ts
|
|
5892
5977
|
function joinUrl(base, suffix) {
|
|
5893
5978
|
const normalizedBase = base.replace(/\/$/, "");
|
|
5894
5979
|
if (!suffix.startsWith("/")) {
|
|
@@ -5986,14 +6071,11 @@ async function createRuntimeTransport(config, secret) {
|
|
|
5986
6071
|
}
|
|
5987
6072
|
var TransportExecutor;
|
|
5988
6073
|
var init_transport_client = __esm({
|
|
5989
|
-
"../ada-agent/
|
|
5990
|
-
"use strict";
|
|
6074
|
+
"../ada-agent/src/transport-client.ts"() {
|
|
5991
6075
|
init_src5();
|
|
5992
6076
|
init_src6();
|
|
5993
6077
|
init_logger();
|
|
5994
6078
|
TransportExecutor = class {
|
|
5995
|
-
transport;
|
|
5996
|
-
mode;
|
|
5997
6079
|
constructor(transport, mode) {
|
|
5998
6080
|
this.transport = transport;
|
|
5999
6081
|
this.mode = mode;
|
|
@@ -6024,7 +6106,7 @@ var init_transport_client = __esm({
|
|
|
6024
6106
|
}
|
|
6025
6107
|
});
|
|
6026
6108
|
|
|
6027
|
-
// ../ada-agent/
|
|
6109
|
+
// ../ada-agent/src/task-loader.ts
|
|
6028
6110
|
function isObject3(value) {
|
|
6029
6111
|
return typeof value === "object" && value !== null;
|
|
6030
6112
|
}
|
|
@@ -6064,9 +6146,8 @@ async function loadTaskFile(filePath) {
|
|
|
6064
6146
|
}
|
|
6065
6147
|
var import_promises8, allowedCommands;
|
|
6066
6148
|
var init_task_loader = __esm({
|
|
6067
|
-
"../ada-agent/
|
|
6068
|
-
|
|
6069
|
-
import_promises8 = __toESM(require("node:fs/promises"), 1);
|
|
6149
|
+
"../ada-agent/src/task-loader.ts"() {
|
|
6150
|
+
import_promises8 = __toESM(require("node:fs/promises"));
|
|
6070
6151
|
allowedCommands = /* @__PURE__ */ new Set([
|
|
6071
6152
|
"click",
|
|
6072
6153
|
"type",
|
|
@@ -6347,7 +6428,7 @@ var init_src7 = __esm({
|
|
|
6347
6428
|
}
|
|
6348
6429
|
});
|
|
6349
6430
|
|
|
6350
|
-
// ../ada-agent/
|
|
6431
|
+
// ../ada-agent/src/monitoring.ts
|
|
6351
6432
|
function shouldMonitorCommand(command, config, index) {
|
|
6352
6433
|
if (!config.monitoring.enabled) {
|
|
6353
6434
|
return false;
|
|
@@ -6440,7 +6521,7 @@ async function captureOperationMonitor(command, result, index, context) {
|
|
|
6440
6521
|
}
|
|
6441
6522
|
var import_promises9, import_node_path8, import_jimp;
|
|
6442
6523
|
var init_monitoring = __esm({
|
|
6443
|
-
"../ada-agent/
|
|
6524
|
+
"../ada-agent/src/monitoring.ts"() {
|
|
6444
6525
|
"use strict";
|
|
6445
6526
|
import_promises9 = __toESM(require("node:fs/promises"), 1);
|
|
6446
6527
|
import_node_path8 = __toESM(require("node:path"), 1);
|
|
@@ -6449,7 +6530,7 @@ var init_monitoring = __esm({
|
|
|
6449
6530
|
}
|
|
6450
6531
|
});
|
|
6451
6532
|
|
|
6452
|
-
// ../ada-agent/
|
|
6533
|
+
// ../ada-agent/src/runtime.ts
|
|
6453
6534
|
async function runTaskset(commands, options = {}) {
|
|
6454
6535
|
const executor = new TaskExecutor(buildPluginHost());
|
|
6455
6536
|
const results = [];
|
|
@@ -6466,12 +6547,14 @@ async function runTaskset(commands, options = {}) {
|
|
|
6466
6547
|
executeLocal
|
|
6467
6548
|
});
|
|
6468
6549
|
if (options.config.monitoring.nonBlocking) {
|
|
6469
|
-
monitorJobs.push(
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6550
|
+
monitorJobs.push(
|
|
6551
|
+
monitorJob.catch((error) => {
|
|
6552
|
+
log("warn", {
|
|
6553
|
+
event: "monitor.capture.unhandled",
|
|
6554
|
+
details: { requestId: cmd.requestId, message: error instanceof Error ? error.message : String(error) }
|
|
6555
|
+
});
|
|
6556
|
+
})
|
|
6557
|
+
);
|
|
6475
6558
|
} else {
|
|
6476
6559
|
await monitorJob;
|
|
6477
6560
|
}
|
|
@@ -6483,22 +6566,25 @@ async function runTaskset(commands, options = {}) {
|
|
|
6483
6566
|
return results;
|
|
6484
6567
|
}
|
|
6485
6568
|
async function runDemoTaskset(options = {}) {
|
|
6486
|
-
await runTaskset(
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6569
|
+
await runTaskset(
|
|
6570
|
+
[
|
|
6571
|
+
{
|
|
6572
|
+
requestId: "req-web-1",
|
|
6573
|
+
sessionId: "session-web",
|
|
6574
|
+
platform: "web",
|
|
6575
|
+
command: "click",
|
|
6576
|
+
payload: { locator: { testId: "login-btn" } }
|
|
6577
|
+
},
|
|
6578
|
+
{
|
|
6579
|
+
requestId: "req-ios-1",
|
|
6580
|
+
sessionId: "session-ios",
|
|
6581
|
+
platform: "ios",
|
|
6582
|
+
command: "swipe",
|
|
6583
|
+
payload: { from: [0.5, 0.8], to: [0.5, 0.2] }
|
|
6584
|
+
}
|
|
6585
|
+
],
|
|
6586
|
+
options
|
|
6587
|
+
);
|
|
6502
6588
|
}
|
|
6503
6589
|
async function runForegroundLoop(skipDemo = false, options = {}) {
|
|
6504
6590
|
log("info", { event: "agent.runtime.ready", details: { mode: "foreground" } });
|
|
@@ -6508,8 +6594,7 @@ async function runForegroundLoop(skipDemo = false, options = {}) {
|
|
|
6508
6594
|
await runDemoTaskset(options);
|
|
6509
6595
|
}
|
|
6510
6596
|
var init_runtime = __esm({
|
|
6511
|
-
"../ada-agent/
|
|
6512
|
-
"use strict";
|
|
6597
|
+
"../ada-agent/src/runtime.ts"() {
|
|
6513
6598
|
init_src7();
|
|
6514
6599
|
init_plugin_registry();
|
|
6515
6600
|
init_logger();
|
|
@@ -6517,7 +6602,7 @@ var init_runtime = __esm({
|
|
|
6517
6602
|
}
|
|
6518
6603
|
});
|
|
6519
6604
|
|
|
6520
|
-
// ../ada-agent/
|
|
6605
|
+
// ../ada-agent/src/queue-runner.ts
|
|
6521
6606
|
async function ensureDirs(config) {
|
|
6522
6607
|
await import_promises10.default.mkdir(config.queue.inboxDir, { recursive: true });
|
|
6523
6608
|
await import_promises10.default.mkdir(config.queue.processedDir, { recursive: true });
|
|
@@ -6612,10 +6697,9 @@ async function watchQueue(config, shouldStop, options = {}) {
|
|
|
6612
6697
|
}
|
|
6613
6698
|
var import_promises10, import_node_path9;
|
|
6614
6699
|
var init_queue_runner = __esm({
|
|
6615
|
-
"../ada-agent/
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
import_node_path9 = __toESM(require("node:path"), 1);
|
|
6700
|
+
"../ada-agent/src/queue-runner.ts"() {
|
|
6701
|
+
import_promises10 = __toESM(require("node:fs/promises"));
|
|
6702
|
+
import_node_path9 = __toESM(require("node:path"));
|
|
6619
6703
|
init_task_loader();
|
|
6620
6704
|
init_runtime();
|
|
6621
6705
|
init_logger();
|
|
@@ -7092,10 +7176,13 @@ function resolveAndroidSdkRoot() {
|
|
|
7092
7176
|
});
|
|
7093
7177
|
const adbPath = (adbLookup.stdout ?? "").split(/\r?\n/).map((line) => line.trim()).find(Boolean);
|
|
7094
7178
|
const adbSdkRoot = adbPath ? import_node_path14.default.dirname(import_node_path14.default.dirname(adbPath)) : null;
|
|
7179
|
+
const workspaceRoot = process.cwd();
|
|
7180
|
+
const projectAndroidHome = import_node_path14.default.join(workspaceRoot, "ANDROID_HOME");
|
|
7095
7181
|
const candidates = [
|
|
7096
7182
|
process.env.ANDROID_SDK_ROOT,
|
|
7097
7183
|
process.env.ANDROID_HOME,
|
|
7098
7184
|
persisted.androidHome,
|
|
7185
|
+
(0, import_node_fs5.existsSync)(projectAndroidHome) ? projectAndroidHome : null,
|
|
7099
7186
|
adbSdkRoot,
|
|
7100
7187
|
process.env.LOCALAPPDATA ? import_node_path14.default.join(process.env.LOCALAPPDATA, "Android", "Sdk") : null,
|
|
7101
7188
|
process.env.USERPROFILE ? import_node_path14.default.join(process.env.USERPROFILE, "AppData", "Local", "Android", "Sdk") : null
|
|
@@ -7128,10 +7215,11 @@ function hasAppiumDriver(homeDir, driverName) {
|
|
|
7128
7215
|
}
|
|
7129
7216
|
function resolveAppiumHome(platform) {
|
|
7130
7217
|
const persisted = loadPersistedHomes();
|
|
7218
|
+
const projectAppiumHome = import_node_path14.default.join(process.cwd(), "APPIUM_HOME");
|
|
7131
7219
|
const candidates = [
|
|
7132
7220
|
process.env.APPIUM_HOME,
|
|
7133
7221
|
persisted.appiumHome,
|
|
7134
|
-
|
|
7222
|
+
(0, import_node_fs5.existsSync)(projectAppiumHome) ? projectAppiumHome : null,
|
|
7135
7223
|
process.env.USERPROFILE,
|
|
7136
7224
|
process.env.USERPROFILE ? import_node_path14.default.join(process.env.USERPROFILE, ".appium") : null
|
|
7137
7225
|
].map((v) => typeof v === "string" ? v.trim() : "").filter(Boolean);
|