dsh-dot-life 0.10.2 → 0.10.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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/qq/qq.js +14 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-dot-life",
3
- "version": "0.10.2",
3
+ "version": "0.10.4",
4
4
  "description": "dot — a character who lives on her own phone, for DeepSeek Harness (dsh): an Android phone the plugin installs and runs, her own QQ, memory and a diary from real events, a life between conversations (幕间, after HDS-Interlude), an optional microVM computer with approval gates. One plugin, six components.",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-only",
package/src/qq/qq.js CHANGED
@@ -76,7 +76,8 @@ const SL_QQ_LOG = `${VM_HOME}/snowluma-qq.log`;
76
76
  const SL_HTTP_PORT = 3000;
77
77
  // The GUI QQ SnowLuma hooks is a clean system linuxqq at /opt/QQ — never NapCat's unpacked copy,
78
78
  // whose launcher is patched to load NapCat (two clients inside one QQ). The installer puts it there.
79
- const SL_QQ = 'QQ=/opt/QQ/qq';
79
+ // Spelled with an empty quote so a shell that names it does not itself match pgrep/pkill "[o]pt/QQ/qq".
80
+ const SL_QQ = 'QQ=/opt/Q""Q/qq';
80
81
  // The linuxqq build SnowLuma's own host installer pins (SnowLuma.Docker.Framework install.sh), with
81
82
  // its checksums: the hook tracks QQ's internals, so a known-good build rather than "latest".
82
83
  const SL_QQ_PIN = {
@@ -85,8 +86,11 @@ const SL_QQ_PIN = {
85
86
  mirror: 'https://github.com/Rodert/qq-versions/releases/download/qq-packages-20260813-1d08f1d4',
86
87
  sha256: { amd64: 'd085dd89397225061eb9f194308f688129818ed445777e97a4a0a16e13d7b0e8', arm64: '8796ccfd66acc025ef18db37185532d40bc8c58921e17da6d28c295acbcf8f92' },
87
88
  };
88
- // The VM desktop's X display (tigervnc), as ":N".
89
- const SL_DISPLAY = 'D=$(ls /tmp/.X11-unix/ 2>/dev/null | sed -n \'s/^X//p\' | head -1); D=":${D:-1}"';
89
+ // The VM desktop's X display, as ":N": the one the VNC server shows (that is what the 虚拟机 tab and
90
+ // the QR screenshot see), else any live X server, else :99. Not "first socket in /tmp/.X11-unix":
91
+ // NapCat's xvfb-run leaves sockets of dead servers there (:101, :102), and QQ exits on one of those.
92
+ const SL_DISPLAY = String.raw`D=$(ps -eo args | awk '$1 ~ /(^|\/)(Xvnc|Xtigervnc|x11vnc)$/ { for (i = 2; i <= NF; i++) if ($i ~ /^:[0-9]+(\.[0-9]+)?$/) { sub(/\.[0-9]+$/, "", $i); print $i; exit } }'); ` +
93
+ String.raw`[ -n "$D" ] || D=$(ps -eo args | awk '$1 ~ /(^|\/)X[A-Za-z]*$/ && !/ -auth / { for (i = 2; i <= NF; i++) if ($i ~ /^:[0-9]+(\.[0-9]+)?$/) { sub(/\.[0-9]+$/, "", $i); print $i; exit } }'); ` + 'D="${D:-:99}"';
90
94
  // "[s]" keeps pgrep/pkill from matching their own shell, as "[o]pt" does for QQ.
91
95
  const SL_PGREP = '[s]nowluma/index.mjs';
92
96
 
@@ -512,7 +516,7 @@ export function apply(ctx, config = {}, deps = {}) {
512
516
  // One account, one desktop client: NapCat and SnowLuma's QQ are both "the computer"; never both.
513
517
  // Always its own shell call: pkill -f matches whole command lines, and a start script names the QQ
514
518
  // path it launches, so a script that kills and then starts would kill itself first.
515
- const KILL_ALL = `pkill -f "${SL_PGREP}" || true; pkill -f "[o]pt/QQ/qq" || true; sleep 1`;
519
+ const KILL_ALL = `pkill -f "${SL_PGREP}" || true; pkill -f "[o]pt/QQ/qq" || true; pkill -f "^Xvfb .*xvfb-run" || true; sleep 1`;
516
520
  /** The GUI QQ on the VM desktop, then SnowLuma hooking it (as root: no setcap needed for ptrace). */
517
521
  const snowlumaStartScript = () => [
518
522
  `cd ${VM_HOME}; export HOME=${VM_HOME}`,
@@ -534,7 +538,12 @@ export function apply(ctx, config = {}, deps = {}) {
534
538
  if (!(await qq.running())) {
535
539
  if (sl()) {
536
540
  await vmShell(KILL_ALL);
537
- const out = String(await vmShell(snowlumaStartScript()));
541
+ let out = '';
542
+ try { out = String(await vmShell(snowlumaStartScript())); } catch (err) {
543
+ // msb exec sometimes reports failure after both launches went off; trust the processes, not the exit.
544
+ if (!(await qq.running())) throw err;
545
+ logger.warn(`SnowLuma start shell: ${err.message.split('\n')[0]} (QQ and SnowLuma are running)`);
546
+ }
538
547
  if (out.includes('ptrace-blocked')) { setState('error', 'the computer forbids ptrace (kernel.yama.ptrace_scope = 3); SnowLuma cannot hook QQ — use the napcat backend'); return false; }
539
548
  audit({ kind: 'snowluma-started' });
540
549
  logger.info('SnowLuma started (QQ on the computer desktop; log in by QR there)');