@xcanwin/manyoyo 5.4.12 → 5.5.2
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 +3 -3
- package/bin/manyoyo.js +38 -1
- package/docker/manyoyo.Dockerfile +21 -22
- package/lib/plugin/playwright.js +26 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ AI Agent CLI 往往需要:
|
|
|
53
53
|
```bash
|
|
54
54
|
npm install -g @xcanwin/manyoyo
|
|
55
55
|
podman pull ubuntu:24.04 # 仅 Podman 需要
|
|
56
|
-
manyoyo build --iv 1.
|
|
56
|
+
manyoyo build --iv 1.9.0-common
|
|
57
57
|
manyoyo init all
|
|
58
58
|
manyoyo run -r claude
|
|
59
59
|
```
|
|
@@ -137,10 +137,10 @@ manyoyo config command
|
|
|
137
137
|
|
|
138
138
|
```bash
|
|
139
139
|
# common 版本
|
|
140
|
-
manyoyo build --iv 1.
|
|
140
|
+
manyoyo build --iv 1.9.0-common
|
|
141
141
|
|
|
142
142
|
# full 版本
|
|
143
|
-
manyoyo build --iv 1.
|
|
143
|
+
manyoyo build --iv 1.9.0-full
|
|
144
144
|
|
|
145
145
|
# 自定义工具集
|
|
146
146
|
manyoyo build --iba TOOL=go,codex,java,gemini
|
package/bin/manyoyo.js
CHANGED
|
@@ -570,6 +570,42 @@ function addEnvFile(envFile) {
|
|
|
570
570
|
return addEnvFileTo(CONTAINER_ENVS, envFile);
|
|
571
571
|
}
|
|
572
572
|
|
|
573
|
+
function expandHomeAliasPath(filePath) {
|
|
574
|
+
const text = String(filePath || '').trim();
|
|
575
|
+
const homeDir = process.env.HOME || os.homedir();
|
|
576
|
+
|
|
577
|
+
if (text === '~') {
|
|
578
|
+
return homeDir;
|
|
579
|
+
}
|
|
580
|
+
if (text.startsWith('~/')) {
|
|
581
|
+
return path.join(homeDir, text.slice(2));
|
|
582
|
+
}
|
|
583
|
+
if (text === '$HOME') {
|
|
584
|
+
return homeDir;
|
|
585
|
+
}
|
|
586
|
+
if (text.startsWith('$HOME/')) {
|
|
587
|
+
return path.join(homeDir, text.slice('$HOME/'.length));
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
return text;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
function normalizeVolume(volume) {
|
|
594
|
+
const text = String(volume || '').trim();
|
|
595
|
+
if (!text.startsWith('~') && !text.startsWith('$HOME')) {
|
|
596
|
+
return text;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
const separatorIndex = text.indexOf(':');
|
|
600
|
+
if (separatorIndex === -1) {
|
|
601
|
+
return expandHomeAliasPath(text);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
const hostPath = text.slice(0, separatorIndex);
|
|
605
|
+
const rest = text.slice(separatorIndex);
|
|
606
|
+
return `${expandHomeAliasPath(hostPath)}${rest}`;
|
|
607
|
+
}
|
|
608
|
+
|
|
573
609
|
function hasEnvKey(targetEnvs, key) {
|
|
574
610
|
for (let i = 0; i < targetEnvs.length; i += 2) {
|
|
575
611
|
if (targetEnvs[i] !== '--env') {
|
|
@@ -1380,7 +1416,8 @@ Notes:
|
|
|
1380
1416
|
|
|
1381
1417
|
applyPlaywrightCliSessionIntegration(config, runConfig);
|
|
1382
1418
|
|
|
1383
|
-
const volumeList = mergeArrayConfig(config.volumes, runConfig.volumes, options.volume)
|
|
1419
|
+
const volumeList = mergeArrayConfig(config.volumes, runConfig.volumes, options.volume)
|
|
1420
|
+
.map(normalizeVolume);
|
|
1384
1421
|
volumeList.forEach(v => addVolume(v));
|
|
1385
1422
|
|
|
1386
1423
|
const portList = mergeArrayConfig(config.ports, runConfig.ports, options.port);
|
|
@@ -203,31 +203,33 @@ RUN <<EOX
|
|
|
203
203
|
;; esac
|
|
204
204
|
|
|
205
205
|
# 安装 Playwright CLI skills(不在镜像构建阶段下载浏览器)
|
|
206
|
-
PLAYWRIGHT_CLI_VERSION=$(node -p "const pkg = require('/tmp/manyoyo-package.json'); const value = String(pkg.playwrightCliVersion || '').trim(); if (!value) { throw new Error('package.json.playwrightCliVersion is required'); } value")
|
|
207
|
-
npm install -g "@playwright/cli@${PLAYWRIGHT_CLI_VERSION}"
|
|
208
206
|
PLAYWRIGHT_CLI_INSTALL_DIR=/tmp/playwright-cli-install
|
|
209
|
-
mkdir -p "$
|
|
207
|
+
mkdir -p "$PLAYWRIGHT_CLI_INSTALL_DIR/.playwright"
|
|
210
208
|
echo '{"browser":{"browserName":"chromium","launchOptions":{"channel":"chromium"}}}' > "${PLAYWRIGHT_CLI_INSTALL_DIR}/.playwright/cli.config.json"
|
|
211
|
-
cd "$
|
|
209
|
+
cd "$PLAYWRIGHT_CLI_INSTALL_DIR"
|
|
210
|
+
PLAYWRIGHT_CLI_VERSION=$(node -p "const pkg = require('/tmp/manyoyo-package.json'); const value = String(pkg.playwrightCliVersion || '').trim(); if (!value) { throw new Error('package.json.playwrightCliVersion is required'); } value")
|
|
211
|
+
npm install -g "@playwright/cli@${PLAYWRIGHT_CLI_VERSION}"
|
|
212
212
|
playwright-cli --config="${PLAYWRIGHT_CLI_INSTALL_DIR}/.playwright/cli.config.json" install --skills
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
213
|
+
PLAYWRIGHT_CLI_SKILL_SOURCE="$PLAYWRIGHT_CLI_INSTALL_DIR/.claude/skills/playwright-cli"
|
|
214
|
+
for target in ~/.claude/skills/playwright-cli ~/.codex/skills/playwright-cli ~/.gemini/skills/playwright-cli; do
|
|
215
|
+
mkdir -p "$target"
|
|
216
|
+
cp -R "$PLAYWRIGHT_CLI_SKILL_SOURCE/." "$target/"
|
|
217
|
+
done
|
|
218
|
+
cd "$OLDPWD"
|
|
219
|
+
rm -rf "$PLAYWRIGHT_CLI_INSTALL_DIR"
|
|
219
220
|
|
|
220
221
|
# 清理
|
|
221
222
|
npm cache clean --force
|
|
222
223
|
rm -f /tmp/manyoyo-package.json
|
|
223
|
-
rm -rf /tmp/* /var/tmp/* /var/log/apt /var/log/*.log /var/lib/apt/lists/* ~/.npm ~/go/pkg/mod/cache
|
|
224
|
+
rm -rf /tmp/* /var/tmp/* /var/log/apt /var/log/*.log /var/lib/apt/lists/* ~/.npm ~/.cache/node-gyp ~/.claude/plugins/cache ~/go/pkg/mod/cache
|
|
225
|
+
rm -f /var/log/dpkg.log /var/log/bootstrap.log /var/lib/dpkg/status-old /var/cache/debconf/templates.dat-old
|
|
224
226
|
EOX
|
|
225
227
|
|
|
226
228
|
COPY ./docker/res/playwright/playwright-cli-wrapper.sh /usr/local/bin/playwright-cli
|
|
227
229
|
RUN chmod +x /usr/local/bin/playwright-cli
|
|
228
230
|
|
|
229
|
-
# 从 cache-stage 复制 JDT LSP
|
|
230
|
-
COPY --from=cache-stage /opt/jdtls /
|
|
231
|
+
# 从 cache-stage 复制 JDT LSP 到最终位置,避免中转层残留
|
|
232
|
+
COPY --from=cache-stage /opt/jdtls /root/.local/share/jdtls
|
|
231
233
|
|
|
232
234
|
RUN <<EOX
|
|
233
235
|
# 安装 java
|
|
@@ -236,19 +238,16 @@ RUN <<EOX
|
|
|
236
238
|
apt-get install -y --no-install-recommends openjdk-21-jdk maven
|
|
237
239
|
|
|
238
240
|
# 配置 LSP服务(java)
|
|
239
|
-
mkdir -p ~/.local/share/
|
|
240
|
-
cp -a /tmp/jdtls-cache ~/.local/share/jdtls
|
|
241
241
|
ln -sf ~/.local/share/jdtls/bin/jdtls /usr/local/bin/jdtls
|
|
242
242
|
|
|
243
243
|
# 清理
|
|
244
244
|
apt-get clean
|
|
245
245
|
rm -rf /tmp/* /var/tmp/* /var/log/apt /var/log/*.log /var/lib/apt/lists/* ~/.npm ~/go/pkg/mod/cache
|
|
246
246
|
;; esac
|
|
247
|
-
rm -rf /tmp/jdtls-cache
|
|
248
247
|
EOX
|
|
249
248
|
|
|
250
|
-
# 从 cache-stage 复制 gopls
|
|
251
|
-
COPY --from=cache-stage /opt/gopls /
|
|
249
|
+
# 从 cache-stage 复制 gopls 到最终位置,避免中转层残留
|
|
250
|
+
COPY --from=cache-stage /opt/gopls /usr/local/share/manyoyo-gopls
|
|
252
251
|
|
|
253
252
|
RUN <<EOX
|
|
254
253
|
# 安装 go
|
|
@@ -258,21 +257,21 @@ RUN <<EOX
|
|
|
258
257
|
go env -w GOPROXY=https://mirrors.tencent.com/go
|
|
259
258
|
|
|
260
259
|
# 安装 LSP服务(go)
|
|
261
|
-
if [ -f /
|
|
260
|
+
if [ -f /usr/local/share/manyoyo-gopls/gopls ] && [ ! -f /usr/local/share/manyoyo-gopls/.no-cache ]; then
|
|
262
261
|
# 使用缓存
|
|
263
|
-
|
|
264
|
-
|
|
262
|
+
chmod +x /usr/local/share/manyoyo-gopls/gopls
|
|
263
|
+
ln -sf /usr/local/share/manyoyo-gopls/gopls /usr/local/bin/gopls
|
|
265
264
|
else
|
|
266
265
|
# 下载编译
|
|
267
266
|
go install golang.org/x/tools/gopls@latest
|
|
268
267
|
ln -sf ~/go/bin/gopls /usr/local/bin/gopls
|
|
268
|
+
rm -rf /usr/local/share/manyoyo-gopls
|
|
269
269
|
fi
|
|
270
270
|
# 清理
|
|
271
271
|
apt-get clean
|
|
272
272
|
go clean -modcache -cache
|
|
273
273
|
rm -rf /tmp/* /var/tmp/* /var/log/apt /var/log/*.log /var/lib/apt/lists/* ~/.npm ~/go/pkg/mod/cache
|
|
274
274
|
;; esac
|
|
275
|
-
rm -rf /tmp/gopls-cache
|
|
276
275
|
EOX
|
|
277
276
|
|
|
278
277
|
# 配置 supervisor
|
package/lib/plugin/playwright.js
CHANGED
|
@@ -291,6 +291,7 @@ class PlaywrightPlugin {
|
|
|
291
291
|
const homeDir = os.homedir();
|
|
292
292
|
const pluginRootDir = path.join(homeDir, '.manyoyo', 'plugin', 'playwright');
|
|
293
293
|
const defaultConfig = {
|
|
294
|
+
homeDir,
|
|
294
295
|
runtime: 'mixed',
|
|
295
296
|
enabledScenes: [...SCENE_ORDER],
|
|
296
297
|
cliSessionScene: 'cli-host-headless',
|
|
@@ -391,11 +392,16 @@ class PlaywrightPlugin {
|
|
|
391
392
|
return;
|
|
392
393
|
}
|
|
393
394
|
this.writeStdout('[tip] 如果希望容器内 manyoyo run 自动附着到当前 CLI 宿主场景,请在 ~/.manyoyo/manyoyo.json 中设置:');
|
|
395
|
+
this.writeStdout('{');
|
|
396
|
+
this.writeStdout(' "volumes": [');
|
|
397
|
+
this.writeStdout(' "~/.manyoyo/.cache/ms-playwright:/root/.cache/ms-playwright"');
|
|
398
|
+
this.writeStdout(' ],');
|
|
394
399
|
this.writeStdout(' "plugins": {');
|
|
395
400
|
this.writeStdout(' "playwright": {');
|
|
396
401
|
this.writeStdout(' "cliSessionScene": "cli-host-headed"');
|
|
397
402
|
this.writeStdout(' }');
|
|
398
403
|
this.writeStdout(' }');
|
|
404
|
+
this.writeStdout('}');
|
|
399
405
|
}
|
|
400
406
|
|
|
401
407
|
randomAlnum(length = 16) {
|
|
@@ -624,11 +630,22 @@ class PlaywrightPlugin {
|
|
|
624
630
|
}
|
|
625
631
|
|
|
626
632
|
extensionDirPath() {
|
|
627
|
-
return path.join(
|
|
633
|
+
return path.join(this.config.homeDir, '.manyoyo', 'plugin', 'playwright', 'extensions');
|
|
628
634
|
}
|
|
629
635
|
|
|
630
636
|
extensionTmpDirPath() {
|
|
631
|
-
return path.join(
|
|
637
|
+
return path.join(this.config.homeDir, '.manyoyo', 'plugin', 'playwright', 'tmp-crx');
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
cliBrowserCacheDirPath() {
|
|
641
|
+
return path.join(this.config.homeDir, '.manyoyo', '.cache', 'ms-playwright');
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
ensureCliHostHeadedCacheDir(sceneName) {
|
|
645
|
+
if (sceneName !== 'cli-host-headed') {
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
fs.mkdirSync(this.cliBrowserCacheDirPath(), { recursive: true });
|
|
632
649
|
}
|
|
633
650
|
|
|
634
651
|
resolveTargets(sceneName = 'all') {
|
|
@@ -1223,6 +1240,7 @@ class PlaywrightPlugin {
|
|
|
1223
1240
|
|
|
1224
1241
|
async startHost(sceneName, options = {}) {
|
|
1225
1242
|
try {
|
|
1243
|
+
this.ensureCliHostHeadedCacheDir(sceneName);
|
|
1226
1244
|
this.ensureHostScenePrerequisites(sceneName);
|
|
1227
1245
|
} catch (error) {
|
|
1228
1246
|
this.writeStderr(`[up] ${sceneName} failed: ${error.message || String(error)}`);
|
|
@@ -1567,11 +1585,12 @@ class PlaywrightPlugin {
|
|
|
1567
1585
|
'cd "$PLAYWRIGHT_CLI_INSTALL_DIR"',
|
|
1568
1586
|
`npm install -g @playwright/cli@${PLAYWRIGHT_CLI_VERSION}`,
|
|
1569
1587
|
'playwright-cli install --skills',
|
|
1570
|
-
'
|
|
1571
|
-
'
|
|
1572
|
-
'
|
|
1573
|
-
'cp -R "$
|
|
1574
|
-
'
|
|
1588
|
+
'PLAYWRIGHT_CLI_SKILL_SOURCE="$PLAYWRIGHT_CLI_INSTALL_DIR/.claude/skills/playwright-cli"',
|
|
1589
|
+
'for target in ~/.claude/skills/playwright-cli ~/.codex/skills/playwright-cli ~/.gemini/skills/playwright-cli; do',
|
|
1590
|
+
' mkdir -p "$target"',
|
|
1591
|
+
' cp -R "$PLAYWRIGHT_CLI_SKILL_SOURCE/." "$target/"',
|
|
1592
|
+
'done',
|
|
1593
|
+
'cd "$OLDPWD"',
|
|
1575
1594
|
'rm -rf "$PLAYWRIGHT_CLI_INSTALL_DIR"'
|
|
1576
1595
|
];
|
|
1577
1596
|
this.writeStdout(lines.join('\n'));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xcanwin/manyoyo",
|
|
3
|
-
"version": "5.
|
|
4
|
-
"imageVersion": "1.
|
|
3
|
+
"version": "5.5.2",
|
|
4
|
+
"imageVersion": "1.9.0-common",
|
|
5
5
|
"playwrightCliVersion": "0.1.1",
|
|
6
6
|
"description": "AI Agent CLI Security Sandbox for Docker and Podman",
|
|
7
7
|
"keywords": [
|