wechat-clawbot 1.3.0 → 1.3.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.
@@ -0,0 +1,549 @@
1
+ /**
2
+ * The settings card's 电脑权限 row: which program the system holds the bot's
3
+ * file access against, whether that program has it, and two buttons that take
4
+ * the owner to where it is given.
5
+ *
6
+ * macOS does not judge DSH by itself. Every process DSH starts — the bot's
7
+ * shell commands too — is checked against DSH's "responsible" process: the
8
+ * app that started it (Terminal, iTerm, VS Code …, DSH Desktop, the menu-bar
9
+ * whale), or DSH's own node when nothing above it takes that role (node run
10
+ * by launchd as a job, or started through a helper that disclaims it). Without
11
+ * Full Disk Access the system asks about each protected folder in turn
12
+ * (Downloads, Desktop, Documents, the Photos library …) with a dialog on the
13
+ * Mac's screen, and the command waits for a click — with nobody at the Mac,
14
+ * until it times out. Full Disk Access for that one program answers them all.
15
+ * No program can give itself that access or ask for it in a dialog; the most
16
+ * it can do is open the pane and show the program in Finder, so the owner can
17
+ * drag it in. Those are the two buttons.
18
+ *
19
+ * Windows has nothing like it for desktop programs: DSH reads whatever the user
20
+ * can. What can get in the way there is Controlled folder access (ransomware
21
+ * protection, off unless turned on), which stops programs it does not trust
22
+ * from creating or changing files in Documents, Pictures …
23
+ */
24
+ import { execFile } from "node:child_process";
25
+ import fs from "node:fs";
26
+ import os from "node:os";
27
+ import path from "node:path";
28
+ import { logger } from "./ilink/util/logger.js";
29
+ import { cardRequestAllowed, localRequest } from "./secretary.js";
30
+ export const PERMISSIONS_PATH = "/plugins/clawbot/permissions";
31
+ export const PERMISSIONS_SETTINGS_PATH = "/plugins/clawbot/permissions/open-settings";
32
+ export const PERMISSIONS_REVEAL_PATH = "/plugins/clawbot/permissions/reveal";
33
+ export const runProgram = (cmd, args, timeoutMs = 5000, env) => new Promise((resolve) => {
34
+ try {
35
+ const child = execFile(cmd, args, { timeout: timeoutMs, maxBuffer: 16 * 1024 * 1024, windowsHide: true, ...(env !== undefined ? { env } : {}) }, (err, stdout, stderr) => {
36
+ const code = err === null ? 0 : typeof err.code === "number" ? err.code : -1;
37
+ resolve({ code, stdout: String(stdout ?? ""), stderr: String(stderr ?? "") });
38
+ });
39
+ // Nothing is ever written to it, and an open stdin can keep a program (Windows PowerShell) waiting for more.
40
+ child.stdin?.end();
41
+ }
42
+ catch (err) {
43
+ // execFile throws instead of calling back for some bad arguments.
44
+ resolve({ code: -1, stdout: "", stderr: String(err) });
45
+ }
46
+ });
47
+ /** DSH's own program, the way the system names it (symlinks resolved: Homebrew's bin/node is a link into its Cellar). */
48
+ export function ownProgram() {
49
+ try {
50
+ return fs.realpathSync(process.execPath);
51
+ }
52
+ catch {
53
+ return process.execPath;
54
+ }
55
+ }
56
+ /** The app a program belongs to: the OUTERMOST bundle, so an app's helpers (Code Helper.app …) count as the app. */
57
+ export function appBundleOf(program) {
58
+ const at = program.indexOf(".app/");
59
+ if (at > 0)
60
+ return program.slice(0, at + 4);
61
+ return program.endsWith(".app") ? program : undefined;
62
+ }
63
+ /**
64
+ * Asks macOS itself. The kernel keeps a responsible process for every process,
65
+ * and the privacy checks go by it; libquarantine reads it out without any
66
+ * privileges: responsibility_get_responsible_for_pid(pid, &rpid, &uniqueid,
67
+ * &len, path). The path stays once that process has exited — rpid then reads
68
+ * as the process itself, and the system still holds the access to what the
69
+ * path names. Node cannot call C, so the system's own Ruby does it through
70
+ * Fiddle: /usr/bin/ruby is the real interpreter, not a stub that would offer to
71
+ * install the Command Line Tools (/usr/bin/python3 is one).
72
+ *
73
+ * The call writes the whole path whatever len says (only 0 is refused —
74
+ * measured on macOS 27), so the buffer has to stay at least MAXPATHLEN (1024);
75
+ * 4096 is the most a process path can be.
76
+ */
77
+ const RESPONSIBLE_RB = [
78
+ `f = Fiddle::Function.new(Fiddle::Handle::DEFAULT["responsibility_get_responsible_for_pid"],`,
79
+ ` [Fiddle::TYPE_INT, Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP], Fiddle::TYPE_INT)`,
80
+ `rpid = Fiddle::Pointer.malloc(8); uid = Fiddle::Pointer.malloc(8); len = Fiddle::Pointer.malloc(8); path = Fiddle::Pointer.malloc(4096)`,
81
+ `rpid[0, 8] = "\\0" * 8; uid[0, 8] = "\\0" * 8; len[0, 8] = [4096].pack("Q"); path[0, 4096] = "\\0" * 4096`,
82
+ `exit 2 unless f.call(Integer(ARGV[0]), rpid, uid, len, path) == 0`,
83
+ `print rpid[0, 4].unpack1("l"), "\\t", path.to_s`,
84
+ ].join("\n");
85
+ /** What the Ruby above prints: `<responsible pid>\t<its program>`. */
86
+ export function parseResponsible(out) {
87
+ const m = /^(\d+)\t(\/[^\0]*)$/.exec(out);
88
+ return m && Number(m[1]) > 0 ? { pid: Number(m[1]), path: m[2] } : undefined;
89
+ }
90
+ /**
91
+ * DSH's environment without the owner's Ruby settings. A shell set up for a
92
+ * newer Ruby hands DSH options the system's Ruby 2.6 refuses to start with
93
+ * (RUBYOPT=-W:no-deprecated, --yjit) or that print ahead of the answer (-v),
94
+ * and RUBYLIB can put another fiddle in front of the system's.
95
+ */
96
+ export function rubyEnvironment(env = process.env) {
97
+ const clean = { ...env };
98
+ delete clean.RUBYOPT;
99
+ delete clean.RUBYLIB;
100
+ return clean;
101
+ }
102
+ /** `why` hears what went wrong when there is no answer: the reason the walk is used instead. */
103
+ export async function askResponsible(run, self, why) {
104
+ const r = await run("/usr/bin/ruby", ["--disable=gems,rubyopt", "-rfiddle", "-e", RESPONSIBLE_RB, String(self)], 5000, rubyEnvironment());
105
+ const answer = r.code === 0 ? parseResponsible(r.stdout) : undefined;
106
+ if (answer === undefined) {
107
+ const said = (r.code === 0 ? r.stdout : r.stderr).trim().split("\n")[0].slice(0, 160);
108
+ why?.(`${r.code === 0 ? "unexpected answer" : `exit ${r.code}`}${said !== "" ? `: ${said}` : ""}`);
109
+ }
110
+ return answer;
111
+ }
112
+ /** The system's answer as the card names it: the app whose program it is, or the program itself. */
113
+ export function fromResponsible(program) {
114
+ const app = appBundleOf(program);
115
+ return app !== undefined ? { kind: "app", path: app } : { kind: "program", path: program };
116
+ }
117
+ /** `ps -axo pid=,ppid=,comm=`. On macOS `comm` is argv[0] — usually the full path (spaces and all), a bare `node` when run through `#!/usr/bin/env node`. */
118
+ export function parseProcessTable(text) {
119
+ const table = new Map();
120
+ for (const line of text.split("\n")) {
121
+ const m = /^\s*(\d+)\s+(\d+)\s+(.+?)\s*$/.exec(line);
122
+ if (m)
123
+ table.set(Number(m[1]), { pid: Number(m[1]), ppid: Number(m[2]), command: m[3] });
124
+ }
125
+ return table;
126
+ }
127
+ /** PIDs launchd runs as this user's jobs (`launchctl list`): LaunchAgents, and each app LaunchServices opened. */
128
+ export function parseLaunchdJobs(text) {
129
+ const pids = new Set();
130
+ for (const line of text.split("\n")) {
131
+ const m = /^(\d+)\s/.exec(line);
132
+ if (m)
133
+ pids.add(Number(m[1]));
134
+ }
135
+ return pids;
136
+ }
137
+ /** The system's own programs, which hand nothing down: node under a `zsh -c` job is its own (measured on macOS 27). */
138
+ const SYSTEM_PROGRAM = /^\/(?:bin|sbin|usr\/bin|usr\/sbin|usr\/libexec|System)\//;
139
+ /**
140
+ * Walk up from DSH to what started it, when the system could not be asked.
141
+ * Right for the usual cases, a guess for the rest — the system's answer is
142
+ * the one to trust (askResponsible).
143
+ *
144
+ * The first app on the way up (Terminal above the shell above `dsh web`, DSH
145
+ * Desktop above its host) is taken for it; DSH's own program is not looked at
146
+ * — node run from inside some app's bundle, typed into Terminal, is still
147
+ * Terminal's. Reaching launchd without an app: a launchd job running DSH (or a
148
+ * shell that runs DSH) leaves the access with DSH's own program; anything else
149
+ * cannot be told from here (tmux, screen, SSH, a restarted DSH, a starter that
150
+ * has exited).
151
+ */
152
+ export function findLauncher(table, self, jobs, own = ownProgram()) {
153
+ const seen = new Set();
154
+ let pid = self;
155
+ for (;;) {
156
+ const proc = table.get(pid);
157
+ if (proc === undefined || seen.has(pid))
158
+ return { kind: "unknown", reason: "进程表里找不到 DSH 的上级" };
159
+ seen.add(pid);
160
+ if (pid !== self) {
161
+ const app = appBundleOf(proc.command);
162
+ if (app !== undefined)
163
+ return { kind: "app", path: app };
164
+ }
165
+ if (proc.ppid <= 1) {
166
+ if (!jobs.has(pid)) {
167
+ return { kind: "unknown", reason: "往上找不到 App,也不是 launchd 直接运行的:可能在 tmux、screen 或 SSH 里,DSH 重启过,或启动它的程序已经退出" };
168
+ }
169
+ // argv[0] is no path to go by for a program run through `#!/usr/bin/env node`.
170
+ if (pid === self || SYSTEM_PROGRAM.test(proc.command))
171
+ return { kind: "program", path: own };
172
+ return proc.command.startsWith("/")
173
+ ? { kind: "program", path: proc.command }
174
+ : { kind: "unknown", reason: `launchd 运行的「${proc.command}」找不到完整路径` };
175
+ }
176
+ pid = proc.ppid;
177
+ }
178
+ }
179
+ /**
180
+ * Who signed a program, from what `codesign -dv --verbose=2` prints (on
181
+ * stderr). What matters is whether the system will know the next version as
182
+ * the same program: ad-hoc and unsigned ones are known by their exact bytes,
183
+ * so every update loses the access.
184
+ */
185
+ export function parseSigning(text) {
186
+ if (/code object is not signed/i.test(text))
187
+ return "unsigned";
188
+ if (/^Signature=adhoc$/im.test(text))
189
+ return "adhoc";
190
+ // The system's own programs (macOS 27 calls the authority "macOS Software Signing"), and the App Store's.
191
+ if (/^Platform identifier=/m.test(text) || /^Authority=(macOS Software Signing|Software Signing|Apple Mac OS Application Signing)$/m.test(text)) {
192
+ return "apple";
193
+ }
194
+ if (/^Authority=(Developer ID Application|Apple Development|Apple Distribution|Mac Developer|3rd Party Mac Developer Application):/m.test(text)) {
195
+ return "developer";
196
+ }
197
+ if (/^Authority=/m.test(text))
198
+ return "local";
199
+ return "unknown";
200
+ }
201
+ async function plistValue(file, key, run) {
202
+ const r = await run("/usr/bin/plutil", ["-extract", key, "raw", "-o", "-", file]);
203
+ const value = r.stdout.trim();
204
+ return r.code === 0 && value !== "" ? value : undefined;
205
+ }
206
+ async function plistJson(file, run) {
207
+ if (!fs.existsSync(file))
208
+ return undefined;
209
+ const r = await run("/usr/bin/plutil", ["-convert", "json", "-o", "-", file]);
210
+ if (r.code !== 0)
211
+ return undefined;
212
+ try {
213
+ const value = JSON.parse(r.stdout);
214
+ return value !== null && typeof value === "object" ? value : undefined;
215
+ }
216
+ catch {
217
+ return undefined;
218
+ }
219
+ }
220
+ const CHINESE = ["zh_CN", "zh-Hans", "zh_Hans", "zh-CN", "zh"];
221
+ /** The app's Chinese name, from its localization table (newer system apps) or its lproj strings. */
222
+ async function chineseName(app, run) {
223
+ const resources = path.join(app, "Contents/Resources");
224
+ const pick = (table) => {
225
+ const name = table?.CFBundleDisplayName ?? table?.CFBundleName;
226
+ return typeof name === "string" && name.trim() !== "" ? name.trim() : undefined;
227
+ };
228
+ const loctable = await plistJson(path.join(resources, "InfoPlist.loctable"), run);
229
+ for (const lang of CHINESE) {
230
+ const name = pick(loctable?.[lang]);
231
+ if (name !== undefined)
232
+ return name;
233
+ }
234
+ for (const lang of CHINESE) {
235
+ const name = pick(await plistJson(path.join(resources, `${lang}.lproj/InfoPlist.strings`), run));
236
+ if (name !== undefined)
237
+ return name;
238
+ }
239
+ return undefined;
240
+ }
241
+ /**
242
+ * Folders whose files only open once the owner allows it in a dialog, the way
243
+ * the system's own folder checks go (see fullDiskProbes): Desktop, Documents,
244
+ * Downloads, iCloud Drive, the Photos library under Pictures, and other disks.
245
+ */
246
+ export function inGuardedFolder(file, home = os.homedir()) {
247
+ const guarded = ["Desktop", "Documents", "Downloads", "Library/Mobile Documents", "Pictures"].map((dir) => path.join(home, dir));
248
+ return [...guarded, "/Volumes"].some((dir) => file === dir || file.startsWith(`${dir}/`));
249
+ }
250
+ export async function describeLauncher(found, run, via = "walk", own = ownProgram()) {
251
+ if (found.kind === "unknown")
252
+ return found;
253
+ // A starter kept in one of those (an app built in a Documents folder, run from Downloads) is named by its
254
+ // file name: reading it could put a dialog on the Mac's screen as DSH starts, with nobody there.
255
+ if (inGuardedFolder(found.path)) {
256
+ const file = path.basename(found.path);
257
+ return found.kind === "app"
258
+ ? { kind: "app", path: found.path, name: path.basename(file, ".app"), file, signing: "unknown", dsh: /DSHWhale|DeepSeek Harness/i.test(file), via }
259
+ : { kind: "program", path: found.path, name: file, signing: "unknown", own: found.path === own, via };
260
+ }
261
+ if (found.kind === "program") {
262
+ let real = found.path;
263
+ try {
264
+ real = fs.realpathSync(found.path);
265
+ }
266
+ catch { /* keep what was found */ }
267
+ const signing = parseSigning((await run("/usr/bin/codesign", ["-dv", "--verbose=2", real])).stderr);
268
+ return { kind: "program", path: real, name: path.basename(real), signing, own: real === own, via };
269
+ }
270
+ const plist = path.join(found.path, "Contents/Info.plist");
271
+ const bundleId = await plistValue(plist, "CFBundleIdentifier", run);
272
+ const name = (await plistValue(plist, "CFBundleDisplayName", run))
273
+ ?? (await plistValue(plist, "CFBundleName", run))
274
+ ?? path.basename(found.path, ".app");
275
+ const localName = await chineseName(found.path, run);
276
+ const signing = parseSigning((await run("/usr/bin/codesign", ["-dv", "--verbose=2", found.path])).stderr);
277
+ const dsh = /dsh-whale|deepseek/i.test(bundleId ?? "") || /DeepSeek Harness|DSHWhale/i.test(name);
278
+ return {
279
+ kind: "app", path: found.path, name,
280
+ ...(localName !== undefined && localName !== name ? { localName } : {}),
281
+ file: path.basename(found.path),
282
+ ...(bundleId !== undefined ? { bundleId } : {}),
283
+ signing, dsh, via,
284
+ };
285
+ }
286
+ const LAUNCHER = Symbol.for("clawbot.permissions.launcher");
287
+ const slots = globalThis;
288
+ /**
289
+ * Who DSH's access is held against. Asked of the system first; read off the
290
+ * process tree when that fails. Found once per DSH process and kept on
291
+ * globalThis, so the plugin's in-place reloads keep it too: the system's
292
+ * answer cannot change while the process lives. The walk can lose its answer
293
+ * (quit and reopen the whale and DSH carries on under launchd, its starter no
294
+ * longer above it), so the plugin also asks as it starts, and asks again only
295
+ * while the answer is unknown.
296
+ */
297
+ export function detectLauncher(run = runProgram, self = process.pid) {
298
+ let slot = slots[LAUNCHER];
299
+ if (slot === undefined || slot.pid !== self)
300
+ slot = slots[LAUNCHER] = { pid: self };
301
+ if (slot.info !== undefined && slot.info.kind !== "unknown")
302
+ return Promise.resolve(slot.info);
303
+ if (slot.pending !== undefined)
304
+ return slot.pending;
305
+ const current = slot;
306
+ current.pending = (async () => {
307
+ try {
308
+ const responsible = await askResponsible(run, self, (reason) => {
309
+ if (current.toldWhy === true)
310
+ return;
311
+ current.toldWhy = true;
312
+ logger.info(`permissions: could not ask macOS who DSH's file access is held against (${reason}); reading the process tree instead`);
313
+ });
314
+ let info;
315
+ if (responsible !== undefined) {
316
+ info = await describeLauncher(fromResponsible(responsible.path), run, "system");
317
+ }
318
+ else {
319
+ const [ps, jobs] = await Promise.all([
320
+ // In a UTF-8 locale: in the C locale ps prints a non-ASCII path (a renamed app, a Chinese folder) as escapes.
321
+ run("/usr/bin/env", ["LC_ALL=en_US.UTF-8", "/bin/ps", "-axo", "pid=,ppid=,comm="]),
322
+ run("/bin/launchctl", ["list"]),
323
+ ]);
324
+ info = await describeLauncher(findLauncher(parseProcessTable(ps.stdout), self, parseLaunchdJobs(jobs.stdout)), run, "walk");
325
+ }
326
+ current.info = info;
327
+ return info;
328
+ }
329
+ finally {
330
+ current.pending = undefined;
331
+ }
332
+ })();
333
+ return current.pending;
334
+ }
335
+ /**
336
+ * Folders only Full Disk Access opens, none of which ever brings up a dialog:
337
+ * without the access they answer "Operation not permitted" and that is all.
338
+ * (Downloads, Desktop, Documents and the Photos library are the opposite —
339
+ * touching one is what puts the dialog on screen — so they are never probed.)
340
+ * The first that answers decides. The system TCC folder is there on every
341
+ * macOS with Full Disk Access (10.14 on); the rest are spares.
342
+ */
343
+ export function fullDiskProbes(home = os.homedir()) {
344
+ return [
345
+ "/Library/Application Support/com.apple.TCC",
346
+ path.join(home, "Library/Safari"),
347
+ path.join(home, "Library/Mail"),
348
+ path.join(home, "Library/Messages"),
349
+ ];
350
+ }
351
+ /** Through a new process DSH starts — the way the bot's commands reach files. */
352
+ export async function probeFullDisk(run = runProgram, dirs = fullDiskProbes()) {
353
+ for (const dir of dirs) {
354
+ const r = await run("/bin/ls", [dir]);
355
+ if (r.code === 0)
356
+ return "granted";
357
+ if (/operation not permitted/i.test(r.stderr))
358
+ return "denied";
359
+ }
360
+ return "unknown";
361
+ }
362
+ /** In DSH's own process — the way its file tools (read, glob, grep) reach files. EPERM is the system's refusal; EACCES is only file modes. */
363
+ export function probeFullDiskHere(dirs = fullDiskProbes()) {
364
+ for (const dir of dirs) {
365
+ try {
366
+ fs.readdirSync(dir);
367
+ return "granted";
368
+ }
369
+ catch (err) {
370
+ if (err.code === "EPERM")
371
+ return "denied";
372
+ }
373
+ }
374
+ return "unknown";
375
+ }
376
+ /** The page of System Settings with the Full Disk Access list. System Settings (macOS 13, Darwin 22) names it by its extension. */
377
+ export function fullDiskSettingsUrl(release = os.release()) {
378
+ return Number(release.split(".")[0]) >= 22
379
+ ? "x-apple.systempreferences:com.apple.settings.PrivacySecurity.extension?Privacy_AllFiles"
380
+ : "x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles";
381
+ }
382
+ /**
383
+ * `(Get-MpPreference).EnableControlledFolderAccess`: 1 blocks writes into the
384
+ * protected folders, 2 only records them; 3 and 4 are about raw disk sectors,
385
+ * not folders.
386
+ */
387
+ export function parseFolderGuard(out) {
388
+ const value = out.trim().toLowerCase();
389
+ if (value === "1" || value === "enabled")
390
+ return "on";
391
+ if (value === "2" || value === "auditmode")
392
+ return "audit";
393
+ if (["0", "3", "4", "disabled", "blockdiskmodificationonly", "auditdiskmodificationonly"].includes(value))
394
+ return "off";
395
+ return "unknown";
396
+ }
397
+ /** By full path: a bare name is looked for in DSH's working folder first. */
398
+ function windowsProgram(...parts) {
399
+ return path.win32.join(process.env.SystemRoot || "C:\\Windows", "System32", ...parts);
400
+ }
401
+ /**
402
+ * The setting, and whether Microsoft Defender enforces it: Controlled folder
403
+ * access works only while Defender is the active antivirus (running mode
404
+ * Normal) with real-time protection on. Another antivirus switches Defender
405
+ * off, and the setting keeps reading 1. One line each, `key=value`, so a stray
406
+ * warning line changes nothing.
407
+ */
408
+ const FOLDER_GUARD_PS = "$p = Get-MpPreference; $s = $null; try { $s = Get-MpComputerStatus -ErrorAction Stop } catch {}; "
409
+ + "\"cfa=$($p.EnableControlledFolderAccess)\"; \"mode=$($s.AMRunningMode)\"; \"rtp=$($s.RealTimeProtectionEnabled)\"";
410
+ export function parseDefender(out) {
411
+ const value = (key) => {
412
+ const m = new RegExp(`^${key}=(.*)$`, "m").exec(out.replace(/\r/g, ""));
413
+ return m ? m[1].trim() : "";
414
+ };
415
+ const guard = parseFolderGuard(value("cfa"));
416
+ if (guard !== "on" && guard !== "audit")
417
+ return guard;
418
+ // Not answered (Get-MpComputerStatus failed): the setting is all there is to go by.
419
+ const mode = value("mode");
420
+ const rtp = value("rtp");
421
+ if ((mode !== "" && mode.toLowerCase() !== "normal") || rtp.toLowerCase() === "false")
422
+ return "off";
423
+ return guard;
424
+ }
425
+ let folderGuard;
426
+ let folderGuardPending;
427
+ /** Asked of Windows Security at most every five minutes, one PowerShell at a time: it takes a second or two to start. */
428
+ export function readFolderGuard(run = runProgram, now = Date.now()) {
429
+ if (folderGuard !== undefined && now - folderGuard.at < 300_000)
430
+ return Promise.resolve(folderGuard.value);
431
+ if (folderGuardPending !== undefined)
432
+ return folderGuardPending;
433
+ folderGuardPending = (async () => {
434
+ try {
435
+ const r = await run(windowsProgram("WindowsPowerShell", "v1.0", "powershell.exe"), [
436
+ "-NoLogo", "-NoProfile", "-NonInteractive", "-Command", FOLDER_GUARD_PS,
437
+ ], 20_000);
438
+ const value = r.code === 0 ? parseDefender(r.stdout) : "unknown";
439
+ folderGuard = { at: now, value };
440
+ return value;
441
+ }
442
+ finally {
443
+ folderGuardPending = undefined;
444
+ }
445
+ })();
446
+ return folderGuardPending;
447
+ }
448
+ /** For tests: forget who started DSH and what Windows Security said. */
449
+ export function resetPermissionCaches() {
450
+ slots[LAUNCHER] = undefined;
451
+ folderGuard = undefined;
452
+ folderGuardPending = undefined;
453
+ }
454
+ // ---------------------------------------------------------------- routes
455
+ let lastAccess;
456
+ export async function permissionStatus(run = runProgram, platform = process.platform) {
457
+ if (platform === "darwin") {
458
+ const [launcher, fullDisk] = await Promise.all([detectLauncher(run), probeFullDisk(run)]);
459
+ if (fullDisk !== lastAccess) {
460
+ lastAccess = fullDisk;
461
+ const who = launcher.kind === "unknown" ? `starter unknown: ${launcher.reason}` : `${launcher.path}, ${launcher.via === "system" ? "asked macOS" : "from the process tree"}`;
462
+ logger.info(`permissions: full disk access ${fullDisk} (${who})`);
463
+ }
464
+ // `own`: what to add when the starter is unknown and DSH may hold the access itself.
465
+ return { ok: true, platform, launcher, fullDisk, fullDiskHere: probeFullDiskHere(), own: ownProgram() };
466
+ }
467
+ if (platform === "win32") {
468
+ return { ok: true, platform, folderGuard: await readFolderGuard(run), program: process.execPath };
469
+ }
470
+ return { ok: true, platform };
471
+ }
472
+ function reply(res, status, body) {
473
+ res.writeHead(status, { "content-type": "application/json; charset=utf-8", "cache-control": "no-store" });
474
+ res.end(JSON.stringify(body));
475
+ }
476
+ /** GET /plugins/clawbot/permissions — this machine's page only: it names programs and paths. */
477
+ export async function handlePermissionStatus(req, res, run = runProgram, platform = process.platform) {
478
+ if ((req.method ?? "GET") !== "GET")
479
+ return reply(res, 405, { ok: false, message: "use GET" });
480
+ // Which system DSH runs on is all a page elsewhere hears: enough to leave out a row that computer does not have.
481
+ if (!localRequest(req))
482
+ return reply(res, 403, { ok: false, message: "只接受本机设置卡片的请求", platform });
483
+ try {
484
+ reply(res, 200, await permissionStatus(run, platform));
485
+ }
486
+ catch (err) {
487
+ reply(res, 500, { ok: false, message: String(err).slice(0, 200) });
488
+ }
489
+ }
490
+ /**
491
+ * POST …/open-settings and …/reveal — the card's buttons. They open things on
492
+ * the computer DSH runs on, for the card's own request only
493
+ * (cardRequestAllowed). What is shown in Finder is what this process found by
494
+ * itself, never a path from the request.
495
+ */
496
+ export async function handlePermissionAction(what, req, res, run = runProgram, platform = process.platform) {
497
+ if ((req.method ?? "GET") !== "POST")
498
+ return reply(res, 405, { ok: false, message: "use POST" });
499
+ if (!cardRequestAllowed(req))
500
+ return reply(res, 403, { ok: false, message: "只接受设置卡片发来的请求" });
501
+ try {
502
+ let cmd;
503
+ let args;
504
+ if (platform === "darwin" && what === "settings") {
505
+ cmd = "/usr/bin/open";
506
+ args = [fullDiskSettingsUrl()];
507
+ }
508
+ else if (platform === "darwin") {
509
+ const launcher = await detectLauncher(run);
510
+ if (launcher.kind === "unknown") {
511
+ return reply(res, 409, { ok: false, message: `没认出是哪个程序启动了 DSH(${launcher.reason})` });
512
+ }
513
+ cmd = "/usr/bin/open";
514
+ args = ["-R", launcher.path];
515
+ }
516
+ else if (platform === "win32" && what === "settings") {
517
+ // Windows Security's 勒索软件防护 page, where the allowed apps are. /d: no AutoRun from the registry.
518
+ cmd = process.env.ComSpec || windowsProgram("cmd.exe");
519
+ args = ["/d", "/c", "start", "", "windowsdefender://ransomwareprotection/"];
520
+ }
521
+ else {
522
+ return reply(res, 404, { ok: false, message: "这台电脑上没有要打开的" });
523
+ }
524
+ const r = await run(cmd, args, 10_000);
525
+ if (r.code !== 0) {
526
+ return reply(res, 500, { ok: false, message: `没打开:${(r.stderr.trim() || `exit ${r.code}`).slice(0, 160)}` });
527
+ }
528
+ logger.info(`permissions: ${what === "settings" ? "opened the settings page" : "showed DSH's starter in Finder"} (settings card)`);
529
+ reply(res, 200, { ok: true });
530
+ }
531
+ catch (err) {
532
+ reply(res, 500, { ok: false, message: `没打开:${String(err).slice(0, 160)}` });
533
+ }
534
+ }
535
+ export function registerPermissionRoutes(ctx) {
536
+ ctx.inject(["webServer"], (scoped) => {
537
+ const server = scoped.webServer;
538
+ scoped.effect(() => server.register({ kind: "exact", path: PERMISSIONS_PATH, handler: (req, res) => handlePermissionStatus(req, res) }), "clawbot: permissions status route");
539
+ scoped.effect(() => server.register({ kind: "exact", path: PERMISSIONS_SETTINGS_PATH, handler: (req, res) => handlePermissionAction("settings", req, res) }), "clawbot: permissions settings route");
540
+ scoped.effect(() => server.register({ kind: "exact", path: PERMISSIONS_REVEAL_PATH, handler: (req, res) => handlePermissionAction("reveal", req, res) }), "clawbot: permissions reveal route");
541
+ });
542
+ // Now, while whatever started DSH is still running above it, should the system not answer (see detectLauncher).
543
+ if (process.platform === "darwin") {
544
+ void detectLauncher()
545
+ .then((info) => logger.info(`permissions: DSH's file access is held against ${info.kind === "unknown" ? `(unknown: ${info.reason})` : `${info.path} (${info.via === "system" ? "asked macOS" : "from the process tree"})`}`))
546
+ .catch((err) => logger.warn(`permissions: could not tell who started DSH: ${String(err).slice(0, 200)}`));
547
+ }
548
+ }
549
+ //# sourceMappingURL=permissions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permissions.js","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAElE,MAAM,CAAC,MAAM,gBAAgB,GAAG,8BAA8B,CAAC;AAC/D,MAAM,CAAC,MAAM,yBAAyB,GAAG,4CAA4C,CAAC;AACtF,MAAM,CAAC,MAAM,uBAAuB,GAAG,qCAAqC,CAAC;AAQ7E,MAAM,CAAC,MAAM,UAAU,GAAW,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,EAAE,GAAG,EAAE,EAAE,CACrE,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;IACtB,IAAI,CAAC;QACH,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AI,EAAE,OAAO,EAAE,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,sBAAsB,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,EAC1I,mCAAmC,CACpC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,gHAAgH;IAChH,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAClC,KAAK,cAAc,EAAE;aAClB,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,kDAAkD,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,uBAAuB,GAAG,EAAE,CAAC,CAAC;aAC5N,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,gDAAgD,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9G,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wechat-clawbot",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Connect DeepSeek Harness to WeChat via the official WeChat ClawBot (Tencent iLink) bridge — a DSH plugin bundle.",
5
5
  "icon": "assets/icon.svg",
6
6
  "keywords": [
@@ -23,14 +23,14 @@
23
23
  },
24
24
  "type": "module",
25
25
  "main": "lib/index.js",
26
- "types": "lib/types/index.d.ts",
26
+ "types": "lib/index.d.ts",
27
27
  "exports": {
28
28
  ".": {
29
- "types": "./lib/types/index.d.ts",
29
+ "types": "./lib/index.d.ts",
30
30
  "default": "./lib/index.js"
31
31
  },
32
32
  "./cli": {
33
- "types": "./lib/types/cli.d.ts",
33
+ "types": "./lib/cli.d.ts",
34
34
  "default": "./lib/cli.js"
35
35
  },
36
36
  "./cordis.patch.yml": "./cordis.patch.yml",
@@ -69,8 +69,7 @@
69
69
  "client": {
70
70
  "platform": "web",
71
71
  "inject": [
72
- "slots",
73
- "settingsScope"
72
+ "slots"
74
73
  ]
75
74
  }
76
75
  },