dsh-quay-bot 1.0.2 → 1.0.4

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 (59) hide show
  1. package/README.md +28 -105
  2. package/botscreen/requirements.txt +1 -1
  3. package/client.js +3 -2
  4. package/cordis.patch.yml +1 -1
  5. package/host/api.js +4 -0
  6. package/host/remote.js +285 -8
  7. package/host/screen.js +22 -86
  8. package/package.json +35 -32
  9. package/remote/bin/dsh-remote.mjs +435 -0
  10. package/remote/package.json +27 -0
  11. package/remote/src/config.mjs +183 -0
  12. package/remote/src/crypto.mjs +220 -0
  13. package/remote/src/keys.mjs +226 -0
  14. package/remote/src/proxy.mjs +1028 -0
  15. package/remote/src/sessions.mjs +163 -0
  16. package/remote/src/shim.js +838 -0
  17. package/remote/src/supervisor.mjs +207 -0
  18. package/remote/src/tunnel.mjs +533 -0
  19. package/remote/src/upstream.mjs +403 -0
  20. package/remote/src/util.mjs +149 -0
  21. package/remote/src/ws.mjs +313 -0
  22. package/LICENSE +0 -21
  23. package/avatar/build.mjs +0 -81
  24. package/avatar/gallery/droid.json +0 -14
  25. package/avatar/gallery/ghost.json +0 -14
  26. package/avatar/gallery/grok-pod.json +0 -14
  27. package/avatar/gallery/guardian.json +0 -14
  28. package/avatar/gallery/mecha.json +0 -14
  29. package/avatar/gallery/mochi.json +0 -14
  30. package/avatar/gallery/neko.json +0 -14
  31. package/avatar/gallery/orbiter.json +0 -14
  32. package/avatar/gallery/relay.json +0 -14
  33. package/avatar/gallery/spark.json +0 -14
  34. package/avatar/src/bot/clay.ts +0 -135
  35. package/avatar/src/bot/effects.ts +0 -100
  36. package/avatar/src/bot/grok-bot.ts +0 -626
  37. package/avatar/src/bot/index.ts +0 -15
  38. package/avatar/src/bot/palettes.ts +0 -62
  39. package/avatar/src/bot/ring.ts +0 -219
  40. package/avatar/src/bot/scheduler.ts +0 -239
  41. package/avatar/src/bot/shapes.ts +0 -277
  42. package/avatar/src/bot/spring.ts +0 -196
  43. package/avatar/src/core/color.ts +0 -92
  44. package/avatar/src/core/eyes.ts +0 -297
  45. package/avatar/src/core/field.ts +0 -482
  46. package/avatar/src/core/frame.ts +0 -655
  47. package/avatar/src/core/fx.ts +0 -375
  48. package/avatar/src/core/index.ts +0 -49
  49. package/avatar/src/core/paint.ts +0 -331
  50. package/avatar/src/core/path.ts +0 -495
  51. package/avatar/src/core/pose.ts +0 -581
  52. package/avatar/src/core/svg.ts +0 -98
  53. package/avatar/src/core/types.ts +0 -153
  54. package/avatar/src/core/validate.ts +0 -296
  55. package/avatar/src/core/volume.ts +0 -681
  56. package/avatar/src/entry.ts +0 -260
  57. package/bin/doctor.mjs +0 -148
  58. package/botscreen/requirements-offline.txt +0 -11
  59. package/market/index.json +0 -41
package/host/screen.js CHANGED
@@ -26,7 +26,7 @@ const LOCAL_HOSTS = new Set(['127.0.0.1', 'localhost', '::1', '[::1]'])
26
26
  const __dirname = dirname(fileURLToPath(import.meta.url))
27
27
  // Keep in sync with botscreen/requirements.txt. Checking every runtime import avoids
28
28
  // half-bootstrapped environments where the gateway process starts but immediately exits.
29
- const PY_DEPS_CHECK = 'import fastapi, uvicorn, multipart, PIL, Xlib, websockets, httpx, mss'
29
+ const PY_DEPS_CHECK = 'import fastapi, uvicorn, multipart, pydantic, PIL, Xlib, websockets, httpx'
30
30
  const _pyChecked = new Map()
31
31
 
32
32
  let _lastLocalCpuSample = null
@@ -248,17 +248,6 @@ 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
-
262
251
  function hasPythonDepsSync(py) {
263
252
  if (_pyChecked.has(py)) return _pyChecked.get(py)
264
253
  try {
@@ -333,7 +322,10 @@ function ensureSystemDependencies(logger) {
333
322
  logger?.warn?.('botmode: system dependency auto-install disabled by BOTSCREEN_AUTO_INSTALL_DEPS=0')
334
323
  return
335
324
  }
336
- const missingBins = REQUIRED_BINS.filter(name =>
325
+ const requiredBins = [
326
+ 'Xvfb', 'xauth', 'xdotool', 'xclip', 'openbox',
327
+ ]
328
+ const missingBins = requiredBins.filter(name =>
337
329
  !runQuiet('sh', ['-c', `command -v ${name} >/dev/null 2>&1`], { timeout: 10_000 }),
338
330
  )
339
331
  if (!missingBins.length) return
@@ -341,38 +333,20 @@ function ensureSystemDependencies(logger) {
341
333
  logger?.warn?.(`botmode: missing BotScreen system components (${missingBins.join(', ')}); install them manually`)
342
334
  return
343
335
  }
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
354
- }
336
+ const sudo = runQuiet('sh', ['-c', 'command -v sudo >/dev/null 2>&1 && sudo -n true'], { timeout: 10_000 })
337
+ ? ['sudo', '-n']
338
+ : []
355
339
  logger?.info?.(`botmode: installing BotScreen system components: ${missingBins.join(', ')}`)
356
- const env = { ...process.env, DEBIAN_FRONTEND: 'noninteractive' }
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
340
+ if (!runQuiet('apt-get', ['update', '-qq'], { timeout: 300_000 })) {
341
+ throw new Error('apt-get update 失败,无法自动安装 BotScreen 系统依赖')
364
342
  }
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')
343
+ 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 系统依赖')
376
350
  }
377
351
  }
378
352
 
@@ -382,7 +356,7 @@ function findBotscreenRuntime({ botscreenRoot, pythonBin, logDir } = {}) {
382
356
  const candidates = [
383
357
  botscreenRoot,
384
358
  process.env.BOTSCREEN_ROOT,
385
- pluginRoot, // bundled inside dsh-quay-bot
359
+ pluginRoot, // bundled inside @local/dsh-botmode
386
360
  repoRoot,
387
361
  '/opt/botscreen',
388
362
  join(homedir(), 'Desktop', 'dsh- bot'),
@@ -432,48 +406,10 @@ function findBotscreenRuntime({ botscreenRoot, pythonBin, logDir } = {}) {
432
406
  return null
433
407
  }
434
408
 
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) {
409
+ async function bootstrapVenv(runtime, logDir, logPath) {
475
410
  const venvDir = resolve(dirname(runtime.python), '..')
476
411
  const pluginRoot = resolve(__dirname, '..')
412
+ const reqFile = join(runtime.root, 'botscreen', 'requirements.txt')
477
413
  const invalidVenv = !isUsableVenv(runtime.python)
478
414
  if (!invalidVenv) {
479
415
  // Nothing to do: keep the existing interpreter and its pip as-is.
@@ -484,7 +420,7 @@ async function bootstrapVenv(runtime, logDir, logPath, logger) {
484
420
  await execFileAsync('python3', ['-m', 'venv', '--without-pip', venvDir], { timeout: 60_000 })
485
421
  }
486
422
  await ensurePipInVenv(runtime.python, pluginRoot)
487
- await installPythonDeps(runtime.python, runtime.root, pluginRoot, logger)
423
+ await execFileAsync(runtime.python, ['-m', 'pip', 'install', '-q', '-r', reqFile], { timeout: 300_000 })
488
424
  _pyChecked.delete(runtime.python)
489
425
  return runtime.python
490
426
  }
@@ -764,7 +700,7 @@ export class ScreenBridge {
764
700
  if (runtime.needsBootstrap) {
765
701
  try {
766
702
  this.logger?.info?.(`botmode: bootstrapping embedded BotScreen Python venv at ${logBase}`)
767
- await bootstrapVenv(runtime, logBase, logPath, this.logger)
703
+ await bootstrapVenv(runtime, logBase, logPath)
768
704
  } catch (err) {
769
705
  if (logFd !== null) {
770
706
  try { closeSync(logFd) } catch (_e) { /* ignore */ }
package/package.json CHANGED
@@ -1,36 +1,14 @@
1
1
  {
2
2
  "name": "dsh-quay-bot",
3
- "version": "1.0.2",
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
- ],
3
+ "version": "1.0.4",
21
4
  "type": "module",
22
- "license": "MIT",
23
5
  "engines": {
24
- "node": ">=22.13.0",
25
- "dsh": ">=0.2.2-rc.3"
6
+ "node": ">=22.5.0"
26
7
  },
27
8
  "scripts": {
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"
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"
33
10
  },
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).",
34
12
  "exports": {
35
13
  ".": "./index.js",
36
14
  "./client": "./client.js",
@@ -41,19 +19,25 @@
41
19
  "files": [
42
20
  "index.js",
43
21
  "client.js",
44
- "avatar/**/*",
45
- "bin/**/*",
22
+ "avatar/catalog.json",
23
+ "avatar/dist/avatar-engine.js",
24
+ "avatar/LICENSE",
46
25
  "botscreen/**/*",
26
+ "!botscreen/**/__pycache__/**",
27
+ "!botscreen/**/*.pyc",
47
28
  "builtin-skills/**/*",
29
+ "remote/bin/**/*",
30
+ "remote/src/**/*",
31
+ "remote/package.json",
32
+ "vendor/**/*",
48
33
  "host/**/*.js",
34
+ "host/**/*.mjs",
49
35
  "host/**/*.json",
50
36
  "cordis.patch.yml",
51
37
  "locale/*.json",
52
- "market/index.json",
53
38
  "docs",
54
39
  "icon.svg",
55
- "README.md",
56
- "vendor/pip/*.whl"
40
+ "README.md"
57
41
  ],
58
42
  "dsh": {
59
43
  "bundle": {
@@ -70,5 +54,24 @@
70
54
  "@deepseek-ai/dsh-api-session-controller"
71
55
  ]
72
56
  }
73
- }
57
+ },
58
+ "license": "MIT",
59
+ "author": "kdczyz",
60
+ "repository": {
61
+ "type": "git",
62
+ "url": "git+https://github.com/kdczyz/dsh-bot.git",
63
+ "directory": "packages/dsh-botmode"
64
+ },
65
+ "homepage": "https://github.com/kdczyz/dsh-bot#readme",
66
+ "keywords": [
67
+ "dsh",
68
+ "dsh-plugin",
69
+ "dsh-bundle",
70
+ "deepseek-harness",
71
+ "dsh-botmode",
72
+ "botmode",
73
+ "botscreen",
74
+ "dsh-remote",
75
+ "multi-agent"
76
+ ]
74
77
  }