dsh-dot-life 0.10.0 → 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.
- package/package.json +1 -1
- package/src/qq/qq.js +10 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-dot-life",
|
|
3
|
-
"version": "0.10.
|
|
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
|
@@ -456,7 +456,10 @@ export function apply(ctx, config = {}, deps = {}) {
|
|
|
456
456
|
`if [ ! -x /opt/QQ/qq ]; then q="QQ_${SL_QQ_PIN.version}_\${qarch}_01.deb"; { curl -fSL --connect-timeout 15 --max-time 900 -o "/tmp/$q" "${SL_QQ_PIN.base}/$q" || curl -fSL --connect-timeout 15 --max-time 900 -o "/tmp/$q" "${(cfg.githubProxy || '')}${SL_QQ_PIN.mirror}/$q"; } || ${fail(3, 'cannot download Linux QQ')}; echo "$qsum /tmp/$q" | sha256sum -c - >/dev/null || ${fail(3, 'Linux QQ package checksum mismatch — not installing it')}; apt-get install -y -qq "/tmp/$q" >/dev/null || apt-get -f install -y -qq >/dev/null; rm -f "/tmp/$q"; fi`,
|
|
457
457
|
`[ -x /opt/QQ/qq ] || ${fail(3, 'Linux QQ did not install to /opt/QQ/qq')}`,
|
|
458
458
|
`tag=${JSON.stringify(cfg.snowlumaVersion)}`,
|
|
459
|
-
|
|
459
|
+
// The latest tag: the release page's redirect first (not rate-limited like the API, which
|
|
460
|
+
// answers 403 to busy shared IPs), then the API directly and through the mirrors.
|
|
461
|
+
'[ -n "$tag" ] || tag=$(curl -fsSIL -o /dev/null -w \'%{url_effective}\' --connect-timeout 15 --max-time 30 https://github.com/SnowLuma/SnowLuma/releases/latest | sed -n \'s#.*/releases/tag/##p\')',
|
|
462
|
+
`for pre in ${prefixes.map((p) => JSON.stringify(p)).join(' ')}; do [ -n "$tag" ] && break; tag=$(curl -fsSL --connect-timeout 15 --max-time 30 "\${pre}https://api.github.com/repos/SnowLuma/SnowLuma/releases/latest" | sed -n 's/.*"tag_name": *"\\([^"]*\\)".*/\\1/p' | head -1); done`,
|
|
460
463
|
`case "$tag" in ''|*[!A-Za-z0-9._-]*) ${fail(2, 'cannot resolve the latest SnowLuma release (set snowlumaVersion to pin one)')};; esac`,
|
|
461
464
|
'asset="https://github.com/SnowLuma/SnowLuma/releases/download/$tag/SnowLuma-$tag-linux-$arch-lite.tar.gz"; echo "SnowLuma $tag ($arch)"',
|
|
462
465
|
`{ ${fetch}; } || ${fail(2, 'cannot download SnowLuma from GitHub (direct or mirrors)')}`,
|
|
@@ -507,18 +510,19 @@ export function apply(ctx, config = {}, deps = {}) {
|
|
|
507
510
|
try { return (await vmShell(probe)).trim() === 'yes'; } catch { return false; }
|
|
508
511
|
};
|
|
509
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.
|
|
510
515
|
const KILL_ALL = `pkill -f "${SL_PGREP}" || true; pkill -f "[o]pt/QQ/qq" || true; sleep 1`;
|
|
511
516
|
/** The GUI QQ on the VM desktop, then SnowLuma hooking it (as root: no setcap needed for ptrace). */
|
|
512
517
|
const snowlumaStartScript = () => [
|
|
513
518
|
`cd ${VM_HOME}; export HOME=${VM_HOME}`,
|
|
514
519
|
'ps=$(cat /proc/sys/kernel/yama/ptrace_scope 2>/dev/null || echo 0); [ "$ps" = 3 ] && { echo ptrace-blocked; exit 0; }',
|
|
515
520
|
"grep -q 'qqpatch.gtimg.cn' /etc/hosts || echo '0.0.0.0 qqpatch.gtimg.cn' >> /etc/hosts",
|
|
516
|
-
KILL_ALL,
|
|
517
521
|
`${SL_QQ}; ${SL_DISPLAY}; export DISPLAY=$D`,
|
|
518
522
|
`setsid nohup "$QQ" --no-sandbox --disable-gpu --disable-software-rasterizer --disable-gpu-compositing > ${SL_QQ_LOG} 2>&1 < /dev/null & disown`,
|
|
519
523
|
'sleep 5',
|
|
520
524
|
// By absolute path, so pgrep -f sees "snowluma/index.mjs"; spelled through $SL so this shell's own
|
|
521
|
-
// command line does not match it (KILL_ALL
|
|
525
|
+
// command line does not match it (a later KILL_ALL or running() probe sees only the real process).
|
|
522
526
|
`SL=${SL_DIR}; cd "$SL" && setsid nohup node "$SL"/index.mjs >> ${SL_LOG} 2>&1 < /dev/null & disown`,
|
|
523
527
|
'sleep 1; echo "started on $D"',
|
|
524
528
|
].join('\n');
|
|
@@ -529,12 +533,14 @@ export function apply(ctx, config = {}, deps = {}) {
|
|
|
529
533
|
await qq.ensureRoute().catch((err) => logger.warn(`OneBot route: ${err.message}`));
|
|
530
534
|
if (!(await qq.running())) {
|
|
531
535
|
if (sl()) {
|
|
536
|
+
await vmShell(KILL_ALL);
|
|
532
537
|
const out = String(await vmShell(snowlumaStartScript()));
|
|
533
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; }
|
|
534
539
|
audit({ kind: 'snowluma-started' });
|
|
535
540
|
logger.info('SnowLuma started (QQ on the computer desktop; log in by QR there)');
|
|
536
541
|
} else {
|
|
537
|
-
await vmShell(
|
|
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`);
|
|
538
544
|
audit({ kind: 'napcat-started', qq: cfg.qq });
|
|
539
545
|
logger.info(`NapCat started for ${cfg.qq}`);
|
|
540
546
|
}
|