@pointylab/dsh 0.4.3 → 0.4.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.
- package/README.md +1 -1
- package/package.json +1 -1
- package/pet/app/main.js +33 -1
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ DSH「插件管理」里删掉 @pointylab/dsh,或者:
|
|
|
44
44
|
dsh plugin --profile desktop remove @pointylab/dsh
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
卸载后关掉 DSH,Pointy 退出时会把自己的运行时、设置和扩展配对信息(`%USERPROFILE%\.pointy`、`%APPDATA%\pointy`)一起删掉。如果是在 DSH 没开的时候用命令行卸载的,Pointy 没机会清理,这两个文件夹要手动删。
|
|
48
48
|
|
|
49
49
|
---
|
|
50
50
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pointylab/dsh",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Pointy for DeepSeek Harness: shake the mouse, point at anything on screen and ask DSH about it",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": ["dsh-plugin", "deepseek-harness", "pointy"],
|
package/pet/app/main.js
CHANGED
|
@@ -11,7 +11,8 @@ const { startShakeDetector } = require('./shake')
|
|
|
11
11
|
const { pickNative, restoreCursor } = require('./uipick')
|
|
12
12
|
|
|
13
13
|
const PORT = Number(process.env.POINTY_PORT) || 47321
|
|
14
|
-
|
|
14
|
+
// POINTY_HOME 只给测试用(卸载清理的测试不能碰真的 ~/.pointy)
|
|
15
|
+
const TOKEN_DIR = process.env.POINTY_HOME || path.join(os.homedir(), '.pointy')
|
|
15
16
|
const TOKEN_FILE = path.join(TOKEN_DIR, 'token')
|
|
16
17
|
const SETTINGS_FILE = path.join(TOKEN_DIR, 'settings.json')
|
|
17
18
|
// 旧版插件按它拉起Pointy;现在插件自带Pointy,这个文件启动时删掉
|
|
@@ -1249,4 +1250,35 @@ app.on('will-quit', () => {
|
|
|
1249
1250
|
restoreCursor()
|
|
1250
1251
|
globalShortcut.unregisterAll()
|
|
1251
1252
|
stopSelectionHelper()
|
|
1253
|
+
if (MANAGED && (!TEST_HIDDEN || process.env.POINTY_TEST_UNINSTALL === '1') && pluginUninstalled()) cleanUpAfterUninstall()
|
|
1252
1254
|
})
|
|
1255
|
+
|
|
1256
|
+
// ---------- 插件被卸载后清理自己 ----------
|
|
1257
|
+
// Pointy 从插件目录里的 pet/ 运行。DSH 卸载插件时(pnpm remove)删掉了包根目录的 package.json、src、lib,
|
|
1258
|
+
// pet/ 因为 Pointy 还开着、koffi.node 被占着删不干净。等 DSH 退出、Pointy 跟着退出时,看到包已经没了,
|
|
1259
|
+
// 就把运行时、设置和插件残留一起删掉。DSH 没开时用命令行卸载的话 Pointy 不在运行,这条路走不到。
|
|
1260
|
+
const PLUGIN_ROOT = path.resolve(__dirname, '..', '..')
|
|
1261
|
+
|
|
1262
|
+
function pluginUninstalled() {
|
|
1263
|
+
// 只在确实是从 node_modules/@pointylab/dsh 里跑的时候才判断,开发版不碰
|
|
1264
|
+
if (!/[\\/]node_modules[\\/]@pointylab[\\/]dsh$/i.test(PLUGIN_ROOT)) return false
|
|
1265
|
+
return !fs.existsSync(path.join(PLUGIN_ROOT, 'package.json'))
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
function cleanUpAfterUninstall() {
|
|
1269
|
+
const targets = [TOKEN_DIR, app.getPath('userData'), PLUGIN_ROOT].filter((p) => fs.existsSync(p))
|
|
1270
|
+
logError('uninstall', `plugin removed; cleaning ${targets.join(', ')}`)
|
|
1271
|
+
// Pointy 和它的子进程退干净(exe 和 koffi.node 解锁)后再删;最多等 30 秒
|
|
1272
|
+
const quote = (p) => `'${p.replace(/'/g, "''")}'`
|
|
1273
|
+
const script = [
|
|
1274
|
+
`$exe = ${quote(process.execPath)}`,
|
|
1275
|
+
'$t0 = Get-Date',
|
|
1276
|
+
'while ((Get-Process | Where-Object { $_.Path -eq $exe }) -and ((Get-Date) - $t0).TotalSeconds -lt 30) { Start-Sleep -Milliseconds 500 }',
|
|
1277
|
+
...targets.map((p) => `Remove-Item -LiteralPath ${quote(p)} -Recurse -Force -ErrorAction SilentlyContinue`),
|
|
1278
|
+
].join('\n')
|
|
1279
|
+
const encoded = Buffer.from(script, 'utf16le').toString('base64')
|
|
1280
|
+
try {
|
|
1281
|
+
// 经 cmd 的 start 起:直接 spawn 的控制台子进程会跟着 Pointy 退出被关掉(实测),start 出来的那个能活下来
|
|
1282
|
+
require('node:child_process').spawn('cmd.exe', ['/d', '/c', 'start', '""', '/min', 'powershell.exe', '-NoProfile', '-NonInteractive', '-WindowStyle', 'Hidden', '-EncodedCommand', encoded], { detached: true, stdio: 'ignore', windowsHide: true }).unref()
|
|
1283
|
+
} catch (err) { logError('uninstall', err) }
|
|
1284
|
+
}
|