@1outres/dsh-bot-connector-browser 0.0.0-stage → 0.3.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/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Bot browser connector",
4
+ "description": "Lets each bot drive the Google Chrome on its VM's desktop with Playwright MCP inside the VM — page snapshots, forms, screenshots — while a person watches the same Chrome in the Desktop panel. Needs the desktop connector; off until enabled per bot."
5
+ }
6
+ }
package/locale/ja.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "ボットのブラウザ コネクター",
4
+ "description": "各ボットが VM のデスクトップの Google Chrome を VM の中の Playwright MCP で操作できるようにします(ページのスナップショット、フォーム入力、スクリーンショット)。人は Desktop パネルで同じ Chrome を見られます。デスクトップ コネクターが必要で、ボットごとに有効にするまで使われません。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,6 +1,63 @@
1
1
  {
2
2
  "name": "@1outres/dsh-bot-connector-browser",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.3.1",
4
+ "description": "Gives each bot of DeepSeek Harness the Google Chrome on its VM's desktop as a browser it drives with Playwright MCP inside the VM (page snapshots, forms, screenshots), as a bot-core connector; a person sees the same Chrome in the Desktop panel.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/1outres/dsh-bots.git",
8
+ "directory": "packages/dsh-bot-connector-browser"
9
+ },
10
+ "type": "module",
11
+ "main": "lib/index.js",
12
+ "exports": {
13
+ ".": "./lib/index.js",
14
+ "./locale/*.json": "./locale/*.json",
15
+ "./icon": "./icon.svg",
16
+ "./package.json": "./package.json"
17
+ },
18
+ "files": [
19
+ "lib",
20
+ "src",
21
+ "vm",
22
+ "scripts",
23
+ "cordis.patch.yml",
24
+ "locale/*.json",
25
+ "icon.svg"
26
+ ],
27
+ "keywords": [
28
+ "dsh",
29
+ "dsh-plugin",
30
+ "bot",
31
+ "connector",
32
+ "browser",
33
+ "playwright",
34
+ "deepseek-harness"
35
+ ],
36
+ "license": "MIT",
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "engines": {
41
+ "dsh": "0.2.2-rc.5",
42
+ "node": ">=22"
43
+ },
44
+ "peerDependencies": {
45
+ "@1outres/dsh-bot-core": "^0.3.1",
46
+ "@deepseek-ai/cordis": "~4.1.0"
47
+ },
48
+ "devDependencies": {
49
+ "@1outres/dsh-bot-core": "0.3.1",
50
+ "@deepseek-ai/cordis": "~4.1.0",
51
+ "@playwright/mcp": "0.0.86"
52
+ },
53
+ "dsh": {
54
+ "bundle": {
55
+ "patch": [
56
+ "./cordis.patch.yml"
57
+ ]
58
+ }
59
+ },
60
+ "scripts": {
61
+ "generate": "node scripts/generate-tools.mjs"
62
+ }
6
63
  }
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Regenerates src/generated/playwright-mcp.json: the tools of the pinned
4
+ * Playwright MCP (vm/mcp/package.json) as its tools/list answers them with
5
+ * TOOL_ARGUMENTS, and vm/mcp/npm-shrinkwrap.json, the tree the bot's VM
6
+ * installs (a shrinkwrap, because pnpm pack leaves out package-lock.json).
7
+ * The connector's tools are made from that file, and its preparation
8
+ * refuses a VM whose server answers differently.
9
+ *
10
+ * Usage (after changing the version in vm/mcp/package.json and the
11
+ * devDependency): pnpm --filter @1outres/dsh-bot-connector-browser generate
12
+ */
13
+ import { execFileSync, spawn } from "node:child_process"
14
+ import { readFileSync, writeFileSync } from "node:fs"
15
+ import { createRequire } from "node:module"
16
+ import { dirname, join } from "node:path"
17
+ import { fileURLToPath } from "node:url"
18
+
19
+ /** The server's options that shape its tools: coordinate mouse and PDF tools, no page-made tools. */
20
+ const TOOL_ARGUMENTS = ["--caps", "vision,pdf", "--no-webmcp"]
21
+ const PACKAGE = "@playwright/mcp"
22
+
23
+ const root = fileURLToPath(new URL("..", import.meta.url))
24
+ const vmPackage = JSON.parse(readFileSync(`${root}vm/mcp/package.json`, "utf8"))
25
+ const version = vmPackage.dependencies[PACKAGE]
26
+ const require = createRequire(`${root}package.json`)
27
+ const packageJson = require.resolve(`${PACKAGE}/package.json`)
28
+ const installed = JSON.parse(readFileSync(packageJson, "utf8"))
29
+ if (installed.version !== version) {
30
+ throw new Error(`${PACKAGE} ${installed.version} is installed here, but vm/mcp pins ${version}`)
31
+ }
32
+
33
+ const npm = (args) => execFileSync("npm", args, { cwd: `${root}vm/mcp`, stdio: "inherit" })
34
+ npm(["install", "--package-lock-only", "--ignore-scripts", "--no-audit", "--no-fund"])
35
+ npm(["shrinkwrap", "--loglevel=error"])
36
+
37
+ const cli = join(dirname(packageJson), installed.bin["playwright-mcp"])
38
+ const server = spawn(process.execPath, [cli, ...TOOL_ARGUMENTS], {
39
+ stdio: ["pipe", "pipe", "inherit"],
40
+ })
41
+ const pending = new Map()
42
+ let buffer = ""
43
+ server.stdout.setEncoding("utf8")
44
+ server.stdout.on("data", (chunk) => {
45
+ buffer += chunk
46
+ for (let end = buffer.indexOf("\n"); end >= 0; end = buffer.indexOf("\n")) {
47
+ const message = JSON.parse(buffer.slice(0, end))
48
+ buffer = buffer.slice(end + 1)
49
+ const settle = pending.get(message.id)
50
+ if (settle === undefined) continue
51
+ pending.delete(message.id)
52
+ settle(message)
53
+ }
54
+ })
55
+ let ids = 0
56
+ const request = (method, params) =>
57
+ new Promise((resolve, reject) => {
58
+ const id = ++ids
59
+ pending.set(id, (message) =>
60
+ message.error === undefined
61
+ ? resolve(message.result)
62
+ : reject(new Error(message.error.message)),
63
+ )
64
+ server.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", id, method, params })}\n`)
65
+ })
66
+
67
+ const initialized = await request("initialize", {
68
+ protocolVersion: "2025-06-18",
69
+ capabilities: {},
70
+ clientInfo: { name: "dsh-bot-connector-browser-generator", version: "1" },
71
+ })
72
+ server.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized" })}\n`)
73
+ const { tools } = await request("tools/list", {})
74
+ server.kill()
75
+
76
+ const generated = {
77
+ package: PACKAGE,
78
+ version,
79
+ server: initialized.serverInfo,
80
+ arguments: TOOL_ARGUMENTS,
81
+ tools: tools.map(({ name, description, inputSchema, annotations }) => ({
82
+ name,
83
+ description,
84
+ inputSchema,
85
+ ...(annotations === undefined ? {} : { annotations }),
86
+ })),
87
+ }
88
+ writeFileSync(`${root}src/generated/playwright-mcp.json`, `${JSON.stringify(generated, null, 2)}\n`)
89
+ console.log(`${PACKAGE} ${version}: ${tools.length} tools`)