dsh-dot-life 0.10.3 → 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 +9 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-dot-life",
3
- "version": "0.10.3",
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
@@ -89,8 +89,8 @@ const SL_QQ_PIN = {
89
89
  // The VM desktop's X display, as ":N": the one the VNC server shows (that is what the 虚拟机 tab and
90
90
  // the QR screenshot see), else any live X server, else :99. Not "first socket in /tmp/.X11-unix":
91
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]+$/) { print $i; exit } }'); ` +
93
- String.raw`[ -n "$D" ] || D=$(ps -eo args | awk '$1 ~ /(^|\/)X[A-Za-z]*$/ { for (i = 2; i <= NF; i++) if ($i ~ /^:[0-9]+$/) { print $i; exit } }'); ` + 'D="${D:-:99}"';
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}"';
94
94
  // "[s]" keeps pgrep/pkill from matching their own shell, as "[o]pt" does for QQ.
95
95
  const SL_PGREP = '[s]nowluma/index.mjs';
96
96
 
@@ -516,7 +516,7 @@ export function apply(ctx, config = {}, deps = {}) {
516
516
  // One account, one desktop client: NapCat and SnowLuma's QQ are both "the computer"; never both.
517
517
  // Always its own shell call: pkill -f matches whole command lines, and a start script names the QQ
518
518
  // path it launches, so a script that kills and then starts would kill itself first.
519
- 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`;
520
520
  /** The GUI QQ on the VM desktop, then SnowLuma hooking it (as root: no setcap needed for ptrace). */
521
521
  const snowlumaStartScript = () => [
522
522
  `cd ${VM_HOME}; export HOME=${VM_HOME}`,
@@ -538,7 +538,12 @@ export function apply(ctx, config = {}, deps = {}) {
538
538
  if (!(await qq.running())) {
539
539
  if (sl()) {
540
540
  await vmShell(KILL_ALL);
541
- 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
+ }
542
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; }
543
548
  audit({ kind: 'snowluma-started' });
544
549
  logger.info('SnowLuma started (QQ on the computer desktop; log in by QR there)');