dsh-dot-life 0.10.1 → 0.10.2

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 +6 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-dot-life",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
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
@@ -510,18 +510,19 @@ export function apply(ctx, config = {}, deps = {}) {
510
510
  try { return (await vmShell(probe)).trim() === 'yes'; } catch { return false; }
511
511
  };
512
512
  // One account, one desktop client: NapCat and SnowLuma's QQ are both "the computer"; never both.
513
+ // Always its own shell call: pkill -f matches whole command lines, and a start script names the QQ
514
+ // path it launches, so a script that kills and then starts would kill itself first.
513
515
  const KILL_ALL = `pkill -f "${SL_PGREP}" || true; pkill -f "[o]pt/QQ/qq" || true; sleep 1`;
514
516
  /** The GUI QQ on the VM desktop, then SnowLuma hooking it (as root: no setcap needed for ptrace). */
515
517
  const snowlumaStartScript = () => [
516
518
  `cd ${VM_HOME}; export HOME=${VM_HOME}`,
517
519
  'ps=$(cat /proc/sys/kernel/yama/ptrace_scope 2>/dev/null || echo 0); [ "$ps" = 3 ] && { echo ptrace-blocked; exit 0; }',
518
520
  "grep -q 'qqpatch.gtimg.cn' /etc/hosts || echo '0.0.0.0 qqpatch.gtimg.cn' >> /etc/hosts",
519
- KILL_ALL,
520
521
  `${SL_QQ}; ${SL_DISPLAY}; export DISPLAY=$D`,
521
522
  `setsid nohup "$QQ" --no-sandbox --disable-gpu --disable-software-rasterizer --disable-gpu-compositing > ${SL_QQ_LOG} 2>&1 < /dev/null & disown`,
522
523
  'sleep 5',
523
524
  // By absolute path, so pgrep -f sees "snowluma/index.mjs"; spelled through $SL so this shell's own
524
- // command line does not match it (KILL_ALL above would otherwise kill the script running it).
525
+ // command line does not match it (a later KILL_ALL or running() probe sees only the real process).
525
526
  `SL=${SL_DIR}; cd "$SL" && setsid nohup node "$SL"/index.mjs >> ${SL_LOG} 2>&1 < /dev/null & disown`,
526
527
  'sleep 1; echo "started on $D"',
527
528
  ].join('\n');
@@ -532,12 +533,14 @@ export function apply(ctx, config = {}, deps = {}) {
532
533
  await qq.ensureRoute().catch((err) => logger.warn(`OneBot route: ${err.message}`));
533
534
  if (!(await qq.running())) {
534
535
  if (sl()) {
536
+ await vmShell(KILL_ALL);
535
537
  const out = String(await vmShell(snowlumaStartScript()));
536
538
  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; }
537
539
  audit({ kind: 'snowluma-started' });
538
540
  logger.info('SnowLuma started (QQ on the computer desktop; log in by QR there)');
539
541
  } else {
540
- await vmShell(`${KILL_ALL}; cd ${VM_HOME}; export HOME=${VM_HOME}; rm -f ${QR_FILE}; setsid nohup xvfb-run -a ${QQ_BIN} --no-sandbox -q ${cfg.qq} > ${LOG_FILE} 2>&1 < /dev/null & disown; sleep 1; echo started`);
542
+ await vmShell(KILL_ALL);
543
+ await vmShell(`cd ${VM_HOME}; export HOME=${VM_HOME}; rm -f ${QR_FILE}; setsid nohup xvfb-run -a ${QQ_BIN} --no-sandbox -q ${cfg.qq} > ${LOG_FILE} 2>&1 < /dev/null & disown; sleep 1; echo started`);
541
544
  audit({ kind: 'napcat-started', qq: cfg.qq });
542
545
  logger.info(`NapCat started for ${cfg.qq}`);
543
546
  }