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