dsh-quay-bot 0.7.4 → 1.0.0

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.
Files changed (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +105 -28
  3. package/bin/doctor.mjs +148 -0
  4. package/botscreen/requirements-offline.txt +11 -0
  5. package/client.js +1 -2
  6. package/cordis.patch.yml +1 -1
  7. package/host/api.js +0 -4
  8. package/host/remote.js +2 -140
  9. package/host/screen.js +85 -21
  10. package/market/index.json +41 -0
  11. package/package.json +32 -13
  12. package/vendor/wheels/any/annotated_doc-0.0.7-py3-none-any.whl +0 -0
  13. package/vendor/wheels/any/annotated_types-0.8.0-py3-none-any.whl +0 -0
  14. package/vendor/wheels/any/anyio-4.16.0-py3-none-any.whl +0 -0
  15. package/vendor/wheels/any/certifi-2026.11.20-py3-none-any.whl +0 -0
  16. package/vendor/wheels/any/click-8.5.1-py3-none-any.whl +0 -0
  17. package/vendor/wheels/any/fastapi-0.165.0-py3-none-any.whl +0 -0
  18. package/vendor/wheels/any/h11-0.16.0-py3-none-any.whl +0 -0
  19. package/vendor/wheels/any/httpcore-1.0.9-py3-none-any.whl +0 -0
  20. package/vendor/wheels/any/httpx-0.29.0-py3-none-any.whl +0 -0
  21. package/vendor/wheels/any/idna-3.20-py3-none-any.whl +0 -0
  22. package/vendor/wheels/any/mss-10.2.0-py3-none-any.whl +0 -0
  23. package/vendor/wheels/any/opentelemetry_api-1.45.2-py3-none-any.whl +0 -0
  24. package/vendor/wheels/any/pydantic-2.14.4-py3-none-any.whl +0 -0
  25. package/vendor/wheels/any/python_multipart-0.0.34-py3-none-any.whl +0 -0
  26. package/vendor/wheels/any/python_xlib-0.33-py2.py3-none-any.whl +0 -0
  27. package/vendor/wheels/any/six-1.17.0-py2.py3-none-any.whl +0 -0
  28. package/vendor/wheels/any/starlette-1.10.0-py3-none-any.whl +0 -0
  29. package/vendor/wheels/any/typing_extensions-4.16.0-py3-none-any.whl +0 -0
  30. package/vendor/wheels/any/typing_inspection-0.4.5-py3-none-any.whl +0 -0
  31. package/vendor/wheels/any/uvicorn-0.54.0-py3-none-any.whl +0 -0
  32. package/vendor/wheels/linux-aarch64/pillow-12.2.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl +0 -0
  33. package/vendor/wheels/linux-aarch64/pydantic_core-2.50.5-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl +0 -0
  34. package/vendor/wheels/linux-aarch64/websockets-17.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl +0 -0
  35. package/vendor/wheels/linux-x86_64/pillow-12.2.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl +0 -0
  36. package/vendor/wheels/linux-x86_64/pydantic_core-2.50.5-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl +0 -0
  37. package/vendor/wheels/linux-x86_64/websockets-17.4-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl +0 -0
  38. package/botscreen/botscreen/__init__.py +0 -2
  39. package/botscreen/botscreen/__main__.py +0 -5
  40. package/botscreen/botscreen/artifacts.py +0 -388
  41. package/botscreen/botscreen/audit.py +0 -94
  42. package/botscreen/botscreen/cgroup.py +0 -293
  43. package/botscreen/botscreen/config.py +0 -320
  44. package/botscreen/botscreen/desktop/assets/chrome.png +0 -0
  45. package/botscreen/botscreen/desktop/assets/codex.png +0 -0
  46. package/botscreen/botscreen/desktop/assets/drive.png +0 -0
  47. package/botscreen/botscreen/desktop/assets/folder.png +0 -0
  48. package/botscreen/botscreen/desktop/assets/search.png +0 -0
  49. package/botscreen/botscreen/desktop/assets/terminal.png +0 -0
  50. package/botscreen/botscreen/desktop/assets/trash.png +0 -0
  51. package/botscreen/botscreen/desktop/assets/wallpaper.png +0 -0
  52. package/botscreen/botscreen/desktop.py +0 -244
  53. package/botscreen/botscreen/driver.py +0 -832
  54. package/botscreen/botscreen/gateway.py +0 -2089
  55. package/botscreen/botscreen/iconlayer.py +0 -841
  56. package/botscreen/botscreen/mcp_server.py +0 -435
  57. package/botscreen/botscreen/resources.py +0 -494
  58. package/botscreen/botscreen/screen.py +0 -1282
  59. package/botscreen/botscreen/session.py +0 -706
  60. package/botscreen/botscreen/state.py +0 -330
  61. package/botscreen/botscreen/streamer.py +0 -388
  62. package/remote/bin/dsh-remote.mjs +0 -418
  63. package/remote/package.json +0 -27
  64. package/remote/src/config.mjs +0 -183
  65. package/remote/src/crypto.mjs +0 -220
  66. package/remote/src/keys.mjs +0 -226
  67. package/remote/src/proxy.mjs +0 -1028
  68. package/remote/src/sessions.mjs +0 -163
  69. package/remote/src/shim.js +0 -838
  70. package/remote/src/supervisor.mjs +0 -207
  71. package/remote/src/tunnel.mjs +0 -489
  72. package/remote/src/upstream.mjs +0 -372
  73. package/remote/src/util.mjs +0 -139
  74. package/remote/src/ws.mjs +0 -313
  75. package/requirements.txt +0 -8
package/host/screen.js CHANGED
@@ -248,6 +248,17 @@ const AUTO_SYSTEM_PACKAGES = [
248
248
  'adwaita-icon-theme', 'fonts-noto-color-emoji', 'fonts-noto-cjk',
249
249
  ]
250
250
 
251
+ /**
252
+ * Binaries the bundled desktop actually launches. Probing every one of them (not just
253
+ * the X core) is what makes `npm i` alone sufficient: a host that already had `Xvfb`
254
+ * but no `tint2`/`picom`/`pcmanfm` would otherwise be skipped and boot a crippled shell.
255
+ */
256
+ const REQUIRED_BINS = [
257
+ 'Xvfb', 'xauth', 'xdotool', 'xclip', 'openbox',
258
+ 'tint2', 'picom', 'pcmanfm', 'xterm', 'xfwm4', 'xfdesktop4',
259
+ 'x11vnc', 'websockify', 'feh',
260
+ ]
261
+
251
262
  function hasPythonDepsSync(py) {
252
263
  if (_pyChecked.has(py)) return _pyChecked.get(py)
253
264
  try {
@@ -322,10 +333,7 @@ function ensureSystemDependencies(logger) {
322
333
  logger?.warn?.('botmode: system dependency auto-install disabled by BOTSCREEN_AUTO_INSTALL_DEPS=0')
323
334
  return
324
335
  }
325
- const requiredBins = [
326
- 'Xvfb', 'xauth', 'xdotool', 'xclip', 'openbox',
327
- ]
328
- const missingBins = requiredBins.filter(name =>
336
+ const missingBins = REQUIRED_BINS.filter(name =>
329
337
  !runQuiet('sh', ['-c', `command -v ${name} >/dev/null 2>&1`], { timeout: 10_000 }),
330
338
  )
331
339
  if (!missingBins.length) return
@@ -333,20 +341,38 @@ function ensureSystemDependencies(logger) {
333
341
  logger?.warn?.(`botmode: missing BotScreen system components (${missingBins.join(', ')}); install them manually`)
334
342
  return
335
343
  }
336
- const sudo = runQuiet('sh', ['-c', 'command -v sudo >/dev/null 2>&1 && sudo -n true'], { timeout: 10_000 })
337
- ? ['sudo', '-n']
338
- : []
339
- logger?.info?.(`botmode: installing BotScreen system components: ${missingBins.join(', ')}`)
340
- if (!runQuiet('apt-get', ['update', '-qq'], { timeout: 300_000 })) {
341
- throw new Error('apt-get update 失败,无法自动安装 BotScreen 系统依赖')
344
+ const isRoot = typeof process.getuid === 'function' && process.getuid() === 0
345
+ const sudo = isRoot
346
+ ? []
347
+ : (runQuiet('sh', ['-c', 'command -v sudo >/dev/null 2>&1 && sudo -n true'], { timeout: 10_000 }) ? ['sudo', '-n'] : null)
348
+ if (sudo === null) {
349
+ logger?.warn?.(
350
+ `botmode: missing BotScreen system components (${missingBins.join(', ')}); `
351
+ + `no passwordless sudo. Run once: sudo apt-get install -y --no-install-recommends ${AUTO_SYSTEM_PACKAGES.join(' ')}`,
352
+ )
353
+ return
342
354
  }
355
+ logger?.info?.(`botmode: installing BotScreen system components: ${missingBins.join(', ')}`)
343
356
  const env = { ...process.env, DEBIAN_FRONTEND: 'noninteractive' }
344
- const installCmd = sudo.length ? sudo[0] : 'apt-get'
345
- const installArgs = sudo.length
346
- ? [...sudo.slice(1), 'apt-get', 'install', '-y', '--no-install-recommends', ...AUTO_SYSTEM_PACKAGES]
347
- : ['install', '-y', '--no-install-recommends', ...AUTO_SYSTEM_PACKAGES]
348
- if (!runQuiet(installCmd, installArgs, { env, timeout: 900_000 })) {
349
- throw new Error('apt-get install 失败,无法自动安装 BotScreen 系统依赖')
357
+ const run = (args, timeout) => runQuiet(args[0], args.slice(1), { env, timeout })
358
+ const apt = (args, timeout) => (sudo.length
359
+ ? run([...sudo, 'apt-get', ...args], timeout)
360
+ : run(['apt-get', ...args], timeout))
361
+ if (!apt(['update', '-qq'], 300_000)) {
362
+ logger?.warn?.('botmode: apt-get update failed; BotScreen system components stay missing')
363
+ return
364
+ }
365
+ const okInstall = apt(['install', '-y', '--no-install-recommends', ...AUTO_SYSTEM_PACKAGES], 900_000)
366
+ const stillMissing = REQUIRED_BINS.filter(name =>
367
+ !runQuiet('sh', ['-c', `command -v ${name} >/dev/null 2>&1`], { timeout: 10_000 }),
368
+ )
369
+ if (!okInstall || stillMissing.length) {
370
+ logger?.warn?.(
371
+ `botmode: BotScreen system components still missing (${stillMissing.join(', ') || 'apt-get failed'}); `
372
+ + `run: sudo apt-get install -y --no-install-recommends ${AUTO_SYSTEM_PACKAGES.join(' ')}`,
373
+ )
374
+ } else {
375
+ logger?.info?.('botmode: BotScreen system components installed')
350
376
  }
351
377
  }
352
378
 
@@ -356,7 +382,7 @@ function findBotscreenRuntime({ botscreenRoot, pythonBin, logDir } = {}) {
356
382
  const candidates = [
357
383
  botscreenRoot,
358
384
  process.env.BOTSCREEN_ROOT,
359
- pluginRoot, // bundled inside @local/dsh-botmode
385
+ pluginRoot, // bundled inside dsh-quay-bot
360
386
  repoRoot,
361
387
  '/opt/botscreen',
362
388
  join(homedir(), 'Desktop', 'dsh- bot'),
@@ -406,10 +432,48 @@ function findBotscreenRuntime({ botscreenRoot, pythonBin, logDir } = {}) {
406
432
  return null
407
433
  }
408
434
 
409
- async function bootstrapVenv(runtime, logDir, logPath) {
435
+ /** Vendored wheel mirrors shipped inside the bundle: `vendor/wheels/any` + one per CPU arch. */
436
+ function offlineWheelDirs(pluginRoot) {
437
+ const base = join(pluginRoot, 'vendor', 'wheels')
438
+ const archDir = process.arch === 'arm64'
439
+ ? 'linux-aarch64'
440
+ : (process.arch === 'x64' ? 'linux-x86_64' : '')
441
+ const dirs = [join(base, 'any'), archDir ? join(base, archDir) : ''].filter(d => d && existsSync(d))
442
+ return dirs
443
+ }
444
+
445
+ /**
446
+ * Install the gateway's Python deps with zero user interaction:
447
+ * 1. offline from the bundle's vendored wheels (matches CPython 3.12 x86_64/arm64), else
448
+ * 2. online from PyPI as a fallback for other interpreters.
449
+ * The offline set omits optional accelerators (uvloop/httptools/watchfiles); uvicorn falls
450
+ * back to pure-Python h11 automatically, and the live `import` probe stays satisfied.
451
+ */
452
+ async function installPythonDeps(python, root, pluginRoot, logger) {
453
+ const env = { ...process.env, PIP_DISABLE_PIP_VERSION_CHECK: '1' }
454
+ const offlineReq = join(root, 'botscreen', 'requirements-offline.txt')
455
+ const wheelDirs = offlineWheelDirs(pluginRoot)
456
+ if (wheelDirs.length && existsSync(offlineReq)) {
457
+ const args = ['-m', 'pip', 'install', '-q', '--no-index', '--disable-pip-version-check']
458
+ for (const dir of wheelDirs) args.push('--find-links', dir)
459
+ args.push('-r', offlineReq)
460
+ try {
461
+ await execFileAsync(python, args, { env, timeout: 600_000 })
462
+ logger?.info?.('botmode: BotScreen Python deps installed from bundled wheels (offline)')
463
+ return 'bundled'
464
+ } catch (error) {
465
+ logger?.warn?.(`botmode: bundled wheel set did not satisfy ${python} (${String(error?.message || error).slice(0, 200)}); falling back to PyPI`)
466
+ }
467
+ }
468
+ const reqFile = join(root, 'botscreen', 'requirements.txt')
469
+ await execFileAsync(python, ['-m', 'pip', 'install', '-q', '--disable-pip-version-check', '-r', reqFile], { env, timeout: 600_000 })
470
+ logger?.info?.('botmode: BotScreen Python deps installed from PyPI')
471
+ return 'pypi'
472
+ }
473
+
474
+ async function bootstrapVenv(runtime, logDir, logPath, logger) {
410
475
  const venvDir = resolve(dirname(runtime.python), '..')
411
476
  const pluginRoot = resolve(__dirname, '..')
412
- const reqFile = join(runtime.root, 'botscreen', 'requirements.txt')
413
477
  const invalidVenv = !isUsableVenv(runtime.python)
414
478
  if (!invalidVenv) {
415
479
  // Nothing to do: keep the existing interpreter and its pip as-is.
@@ -420,7 +484,7 @@ async function bootstrapVenv(runtime, logDir, logPath) {
420
484
  await execFileAsync('python3', ['-m', 'venv', '--without-pip', venvDir], { timeout: 60_000 })
421
485
  }
422
486
  await ensurePipInVenv(runtime.python, pluginRoot)
423
- await execFileAsync(runtime.python, ['-m', 'pip', 'install', '-q', '-r', reqFile], { timeout: 300_000 })
487
+ await installPythonDeps(runtime.python, runtime.root, pluginRoot, logger)
424
488
  _pyChecked.delete(runtime.python)
425
489
  return runtime.python
426
490
  }
@@ -700,7 +764,7 @@ export class ScreenBridge {
700
764
  if (runtime.needsBootstrap) {
701
765
  try {
702
766
  this.logger?.info?.(`botmode: bootstrapping embedded BotScreen Python venv at ${logBase}`)
703
- await bootstrapVenv(runtime, logBase, logPath)
767
+ await bootstrapVenv(runtime, logBase, logPath, this.logger)
704
768
  } catch (err) {
705
769
  if (logFd !== null) {
706
770
  try { closeSync(logFd) } catch (_e) { /* ignore */ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "format": 1,
3
+ "title": {
4
+ "en": "Quay Bot",
5
+ "zh": "Quay Bot 团队模式"
6
+ },
7
+ "description": {
8
+ "en": "Bot mode for DeepSeek Harness with a bundled virtual desktop: isolated Bot personas, Group Rooms, Routines, team memory hub and screenshot/click/type screen tools — no separate dependency setup.",
9
+ "zh": "带内置虚拟桌面的 DeepSeek Harness 团队模式:独立 Bot 人格、Group Room、Routine、团队记忆库与截图/点击/输入工具,安装即用,无需另行安装依赖。"
10
+ },
11
+ "metadata": {
12
+ "updated": 1795812636
13
+ },
14
+ "plugins": [
15
+ {
16
+ "name": "dsh-quay-bot",
17
+ "title": {
18
+ "en": "Quay Bot",
19
+ "zh": "Quay Bot 团队模式"
20
+ },
21
+ "description": {
22
+ "en": "Bot mode for DSH: Bots, Group Rooms, Routines, memory hub, and a bundled BotScreen X desktop streamed into the Web UI. Python and system deps self-bootstrap on first boot.",
23
+ "zh": "DSH 的 Bot 团队模式:Bot、群聊房间、定时例程、记忆库,以及随包自带并自举的 BotScreen 虚拟 X 桌面(可截图/点击/输入)。"
24
+ },
25
+ "icon": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCIgd2lkdGg9IjY0IiBoZWlnaHQ9IjY0IiByb2xlPSJpbWciIGFyaWEtbGFiZWw9IkJvdCBtb2RlIj4KICA8ZGVmcz4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0iYm0iIHgxPSIwIiB5MT0iMCIgeDI9IjEiIHkyPSIxIj4KICAgICAgPHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjNGQ2YmZlIi8+CiAgICAgIDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzdhYTJmZiIvPgogICAgPC9saW5lYXJHcmFkaWVudD4KICA8L2RlZnM+CiAgPHJlY3QgeD0iNiIgeT0iMTAiIHdpZHRoPSI1MiIgaGVpZ2h0PSI0NCIgcng9IjE0IiBmaWxsPSJ1cmwoI2JtKSIvPgogIDxyZWN0IHg9IjE1IiB5PSIyMiIgd2lkdGg9IjM0IiBoZWlnaHQ9IjIyIiByeD0iOCIgZmlsbD0iI2ZmZmZmZiIgb3BhY2l0eT0iMC45MiIvPgogIDxjaXJjbGUgY3g9IjI1IiBjeT0iMzMiIHI9IjQiIGZpbGw9IiMyYjNhN2EiLz4KICA8Y2lyY2xlIGN4PSIzOSIgY3k9IjMzIiByPSI0IiBmaWxsPSIjMmIzYTdhIi8+CiAgPHJlY3QgeD0iMjkiIHk9IjQiIHdpZHRoPSI2IiBoZWlnaHQ9IjkiIHJ4PSIzIiBmaWxsPSIjNGQ2YmZlIi8+CiAgPGNpcmNsZSBjeD0iMzIiIGN5PSI0IiByPSIzLjUiIGZpbGw9IiM0ZDZiZmUiLz4KPC9zdmc+Cg==",
26
+ "author": "kdczyz",
27
+ "versions": [
28
+ {
29
+ "version": "1.0.0",
30
+ "publishTimestamp": 1795812636,
31
+ "source": {
32
+ "type": "npm"
33
+ },
34
+ "engines": {
35
+ "dsh": ">=0.2.2-rc.3"
36
+ }
37
+ }
38
+ ]
39
+ }
40
+ ]
41
+ }
package/package.json CHANGED
@@ -1,39 +1,59 @@
1
1
  {
2
2
  "name": "dsh-quay-bot",
3
- "version": "0.7.4",
3
+ "version": "1.0.0",
4
+ "description": "Bot mode for DeepSeek Harness: isolated Bot personas, loop-guarded teammate messaging, Hermes-style Group Rooms, persistent Routines, a pluggable Team Memory Hub, and a bundled BotScreen virtual desktop — installs and runs with no separate dependency setup.",
5
+ "author": "kdczyz",
6
+ "keywords": [
7
+ "dsh",
8
+ "dsh-plugin",
9
+ "dsh-bundle",
10
+ "deepseek-harness",
11
+ "dsh-botmode",
12
+ "botmode",
13
+ "botscreen",
14
+ "bot",
15
+ "multi-agent",
16
+ "group-room",
17
+ "agent-team",
18
+ "virtual-desktop",
19
+ "vnc"
20
+ ],
4
21
  "type": "module",
22
+ "license": "MIT",
5
23
  "engines": {
6
- "node": ">=22.5.0"
24
+ "node": ">=22.13.0",
25
+ "dsh": ">=0.2.2-rc.3"
7
26
  },
8
27
  "scripts": {
9
- "test": "node test/host.test.mjs && node test/screen.test.mjs && node test/avatar.test.mjs && node test/artifacts.test.mjs && node test/routines.test.mjs && node test/isolation.test.mjs && node test/governance-channels.test.mjs && node test/qr.test.mjs && node test/remote.test.mjs && node --test remote/test/*.test.mjs"
28
+ "test": "node test/host.test.mjs && node test/screen.test.mjs && node test/avatar.test.mjs && node test/artifacts.test.mjs && node test/routines.test.mjs && node test/qr.test.mjs && node test/remote.test.mjs",
29
+ "doctor": "node bin/doctor.mjs"
30
+ },
31
+ "bin": {
32
+ "dsh-quay-bot": "bin/doctor.mjs"
10
33
  },
11
- "description": "Bot mode for DeepSeek Harness: isolated Bot personas, loop-guarded teammate messaging, Hermes-style Group Rooms, persistent Routines and a pluggable Team Memory Hub (built-in memory_tencentdb).",
12
34
  "exports": {
13
35
  ".": "./index.js",
14
36
  "./client": "./client.js",
15
37
  "./locale/*.json": "./locale/*.json",
16
- "./icon": "./icon.svg"
38
+ "./icon": "./icon.svg",
39
+ "./package.json": "./package.json"
17
40
  },
18
41
  "files": [
19
42
  "index.js",
20
43
  "client.js",
21
44
  "avatar/**/*",
45
+ "bin/**/*",
22
46
  "botscreen/**/*",
23
47
  "builtin-skills/**/*",
24
- "remote/bin/**/*",
25
- "remote/src/**/*",
26
- "remote/package.json",
27
48
  "vendor/**/*",
28
49
  "host/**/*.js",
29
- "host/**/*.mjs",
30
50
  "host/**/*.json",
31
51
  "cordis.patch.yml",
32
52
  "locale/*.json",
53
+ "market/index.json",
33
54
  "docs",
34
55
  "icon.svg",
35
- "README.md",
36
- "requirements.txt"
56
+ "README.md"
37
57
  ],
38
58
  "dsh": {
39
59
  "bundle": {
@@ -50,6 +70,5 @@
50
70
  "@deepseek-ai/dsh-api-session-controller"
51
71
  ]
52
72
  }
53
- },
54
- "license": "MIT"
73
+ }
55
74
  }
@@ -1,2 +0,0 @@
1
- """BotScreen — 多 Bot Linux 虚拟屏调度系统。"""
2
- __version__ = "1.0.0"
@@ -1,5 +0,0 @@
1
- """python -m botscreen 启动网关。"""
2
- from .gateway import main
3
-
4
- if __name__ == "__main__":
5
- main()