dsh-windows-notifier 0.0.0-stage → 1.0.1
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/cordis.patch.yml +10 -0
- package/docs/DETAIL.md +36 -0
- package/icon.svg +4 -0
- package/index.js +270 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +14 -4
- package/toast-activate.ps1 +15 -0
- package/toast-activate.vbs +11 -0
- package/README.md +0 -3
package/cordis.patch.yml
ADDED
package/docs/DETAIL.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Windows 任务完成通知
|
|
2
|
+
|
|
3
|
+
会话里 agent 做完一次请求、回到 idle 时,弹一条 Windows 通知(toast)提醒你回来查看;agent 通过 `ask_user_question` 向你提问时也弹一条提醒你回来作答。
|
|
4
|
+
|
|
5
|
+
## 工作原理
|
|
6
|
+
|
|
7
|
+
- **完成通知**:监听全局事件 `api-session/status`:agent 从 running 翻转为 idle 时触发(提问等待期间 agent 仍算 running,只有回合真正结束才触发)。
|
|
8
|
+
- **提问通知**:监听 `user-questions/request` waterfall(emit 时机),在正常转发给 answerer 之前(`next()`)弹通知,不改变提问流程。一次 `ask_user_question` 调用无论包含几个问题只弹一次通知;正文显示问题数量与第一个问题摘要。
|
|
9
|
+
- 插件激活时一次性注册 AUMID(开始菜单快捷方式 `DSH Notifier.lnk` + `System.AppUserModel.ID` COM 属性,这是 Windows 对非打包应用的唯一有效注册方式),快捷方式图标指向 DSH 的 `resources\tray.ico`,并注册 `dsh-windows-notify://` 协议把点击路由到激活脚本。快捷方式已存在时跳过,不重复执行;通知标题栏显示「DSH Notifier」(取自快捷方式名)。
|
|
10
|
+
- **点击激活**:toast 带 `activationType='protocol'`,点击通知主体激活协议 → wscript 无窗口启动激活脚本 → 脚本从注册表解析出 DSH 的 exe 路径并直接启动它(不走 `dsh://open` 协议——协议激活会回到激活脚本自身,DSH 未运行时形成无限进程递归)。DSH 已在运行时,新启动的实例会把窗口交给单实例机制聚焦。
|
|
11
|
+
- 每次通知 spawn 一个 `powershell.exe`(`-EncodedCommand`,UTF-16LE base64,中文不乱码),用 WinRT `ToastNotification` 弹原生通知并播放默认提示音。进程 `unref`,不阻塞 Harness。
|
|
12
|
+
- 零第三方依赖;非 Windows 平台自动降级为 no-op。
|
|
13
|
+
|
|
14
|
+
## 配置
|
|
15
|
+
|
|
16
|
+
在 profile 的 `cordis.patch.yml` 中本插件行的 `config` 里修改:
|
|
17
|
+
|
|
18
|
+
| 字段 | 默认值 | 说明 |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| `enabled` | `true` | 总开关 |
|
|
21
|
+
| `title` | `DSH 任务完成` | 完成通知的标题 |
|
|
22
|
+
| `bodyTemplate` | `{session} 回合已完成` | 完成通知正文,`{session}` 替换为会话标题(或 DSH),`{id}` 替换为短 id |
|
|
23
|
+
| `minRunMs` | `0` | 运行时长低于该值(毫秒)不弹完成通知,用来过滤秒回的短回合 |
|
|
24
|
+
| `notifyOnQuestion` | `true` | 是否弹提问通知 |
|
|
25
|
+
| `questionTitle` | `DSH 有问题问你` | 提问通知的标题 |
|
|
26
|
+
|
|
27
|
+
## 内存占用
|
|
28
|
+
|
|
29
|
+
插件在 DSH 进程内的常驻状态只有两个有界 Map(会话标题缓存上限 256 条、会话运行时长表随 idle/移除即清),会话移除时主动清理,不随运行时长增长;每次通知的 PowerShell 为 ~0.3 秒短命进程,跑完即释放,不常驻。
|
|
30
|
+
|
|
31
|
+
## 已知限制
|
|
32
|
+
|
|
33
|
+
- Windows「专注助手」或通知静默时段会吞掉 toast。
|
|
34
|
+
- 多个会话同时结束会各弹一条,Windows 可能将它们折叠。
|
|
35
|
+
- 会话标题取不到时(如标题服务尚未生成),通知正文用「DSH」代替,不显示原始会话 id。
|
|
36
|
+
- 点击通知要求 DSH 已安装桌面版(exe 存在);纯 CLI/web 版无法被唤起。
|
package/icon.svg
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host plugin: show a Windows toast notification when an agent finishes its
|
|
3
|
+
* turn and returns to idle. Listens to the global `api-session/status` event
|
|
4
|
+
* and spawns Windows PowerShell to render a WinRT toast; no third-party
|
|
5
|
+
* dependencies. Non-Windows platforms are a no-op.
|
|
6
|
+
* @module dsh-windows-notifier
|
|
7
|
+
*/
|
|
8
|
+
import { spawn } from 'node:child_process'
|
|
9
|
+
import { existsSync, statSync } from 'node:fs'
|
|
10
|
+
import { dirname, join } from 'node:path'
|
|
11
|
+
import { fileURLToPath } from 'node:url'
|
|
12
|
+
|
|
13
|
+
/** App name shown in the toast header; also the Start Menu shortcut name. */
|
|
14
|
+
const NOTIFIER_NAME = 'DSH Notifier'
|
|
15
|
+
|
|
16
|
+
/** AppUserModelId registered once so toast notifications have a valid source. */
|
|
17
|
+
const AUMID = 'DSHNotifier'
|
|
18
|
+
|
|
19
|
+
/** Protocol URI a toast click activates; routed through the activation script. */
|
|
20
|
+
const ACTIVATE_URI = 'dsh-windows-notify://open'
|
|
21
|
+
|
|
22
|
+
/** Bundle directory holding toast-activate.ps1 / .vbs. */
|
|
23
|
+
const BUNDLE_DIR = dirname(fileURLToPath(import.meta.url))
|
|
24
|
+
|
|
25
|
+
const DEFAULTS = {
|
|
26
|
+
enabled: true,
|
|
27
|
+
title: 'DSH 任务完成',
|
|
28
|
+
bodyTemplate: '{session} 回合已完成',
|
|
29
|
+
minRunMs: 0,
|
|
30
|
+
notifyOnQuestion: true,
|
|
31
|
+
questionTitle: 'DSH 有问题问你',
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Escape a value for a single-quoted PowerShell literal. */
|
|
35
|
+
function psSingleQuote(value) {
|
|
36
|
+
return String(value).replace(/'/g, "''")
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Escape XML text content. */
|
|
40
|
+
function xmlEscape(value) {
|
|
41
|
+
return String(value)
|
|
42
|
+
.replace(/&/g, '&')
|
|
43
|
+
.replace(/</g, '<')
|
|
44
|
+
.replace(/>/g, '>')
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Static PowerShell prefix; only the LoadXml line varies per notification. */
|
|
48
|
+
const POWERSHELL_PREFIX = [
|
|
49
|
+
"[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null",
|
|
50
|
+
"[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom, ContentType = WindowsRuntime] | Out-Null",
|
|
51
|
+
'$xml = New-Object Windows.Data.Xml.Dom.XmlDocument',
|
|
52
|
+
].join('\n')
|
|
53
|
+
|
|
54
|
+
/** Build the PowerShell script that shows one toast. */
|
|
55
|
+
function toastScript(title, body) {
|
|
56
|
+
const xml =
|
|
57
|
+
`<toast activationType='protocol' launch="${ACTIVATE_URI}" duration="long">` +
|
|
58
|
+
`<visual><binding template="ToastGeneric">` +
|
|
59
|
+
`<text>${xmlEscape(title)}</text>` +
|
|
60
|
+
`<text>${xmlEscape(body)}</text>` +
|
|
61
|
+
`</binding></visual>` +
|
|
62
|
+
`<audio src="ms-winsoundevent:Notification.Default"/></toast>`
|
|
63
|
+
return (
|
|
64
|
+
POWERSHELL_PREFIX +
|
|
65
|
+
`\n$xml.LoadXml('${psSingleQuote(xml)}')` +
|
|
66
|
+
"\n$toast = [Windows.UI.Notifications.ToastNotification]::new($xml)" +
|
|
67
|
+
`\n[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('${AUMID}').Show($toast)`
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Run one PowerShell script without keeping the Harness alive for it. */
|
|
72
|
+
function runPowerShell(script) {
|
|
73
|
+
if (process.platform !== 'win32') return
|
|
74
|
+
const encoded = Buffer.from(script, 'utf16le').toString('base64')
|
|
75
|
+
const child = spawn(
|
|
76
|
+
'powershell.exe',
|
|
77
|
+
['-NoProfile', '-ExecutionPolicy', 'Bypass', '-EncodedCommand', encoded],
|
|
78
|
+
{ windowsHide: true, stdio: 'ignore' },
|
|
79
|
+
)
|
|
80
|
+
child.unref()
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Stat a path without throwing. */
|
|
84
|
+
function statSyncSafe(p) {
|
|
85
|
+
try {
|
|
86
|
+
return statSync(p).isFile()
|
|
87
|
+
} catch {
|
|
88
|
+
return false
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* One-time activation setup, run when the plugin loads: registers the AUMID
|
|
94
|
+
* through a Start Menu shortcut (the only registration Windows honors for
|
|
95
|
+
* non-packaged apps), points the shortcut's icon at the DSH tray icon, and
|
|
96
|
+
* registers the dsh-windows-notify:// protocol that routes toast clicks to
|
|
97
|
+
* the activation script. A no-op on later runs once the shortcut exists.
|
|
98
|
+
*/
|
|
99
|
+
function ensureAumid() {
|
|
100
|
+
if (process.platform !== 'win32') return
|
|
101
|
+
const activatePs = join(BUNDLE_DIR, 'toast-activate.ps1')
|
|
102
|
+
const activateVbs = join(BUNDLE_DIR, 'toast-activate.vbs')
|
|
103
|
+
if (!statSyncSafe(activatePs) || !statSyncSafe(activateVbs)) return
|
|
104
|
+
|
|
105
|
+
const programsDir = join(process.env.APPDATA || '', 'Microsoft', 'Windows', 'Start Menu', 'Programs')
|
|
106
|
+
const lnkPath = join(programsDir, `${NOTIFIER_NAME}.lnk`)
|
|
107
|
+
// Remove shortcuts from earlier names so only the current one remains.
|
|
108
|
+
const oldLnkPaths = [
|
|
109
|
+
join(programsDir, 'dsh-windows-notify.lnk'),
|
|
110
|
+
join(programsDir, 'DeepSeek Harness.lnk'),
|
|
111
|
+
]
|
|
112
|
+
// Already registered on a previous run: skip the PowerShell spawn entirely.
|
|
113
|
+
if (existsSync(lnkPath)) return
|
|
114
|
+
|
|
115
|
+
const installDir = dirname(process.execPath || '')
|
|
116
|
+
const iconCandidates = [
|
|
117
|
+
join(installDir, 'resources', 'tray.ico'),
|
|
118
|
+
join(installDir, 'resources', 'icon.png'),
|
|
119
|
+
]
|
|
120
|
+
const iconUri = iconCandidates.find(statSyncSafe) || ''
|
|
121
|
+
|
|
122
|
+
const script = [
|
|
123
|
+
`$lnk = '${psSingleQuote(lnkPath)}'`,
|
|
124
|
+
...oldLnkPaths.map(p => `if (Test-Path -LiteralPath '${psSingleQuote(p)}') { Remove-Item -LiteralPath '${psSingleQuote(p)}' -Force }`),
|
|
125
|
+
`$ws = New-Object -ComObject WScript.Shell`,
|
|
126
|
+
`$sc = $ws.CreateShortcut($lnk)`,
|
|
127
|
+
`$sc.TargetPath = "$env:WINDIR\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"`,
|
|
128
|
+
`$sc.Arguments = '-NoProfile -WindowStyle Hidden -File "${psSingleQuote(activatePs)}"'`,
|
|
129
|
+
`$sc.WorkingDirectory = $env:WINDIR`,
|
|
130
|
+
iconUri ? `$sc.IconLocation = "${psSingleQuote(iconUri)}, 0"` : '',
|
|
131
|
+
`$sc.Save()`,
|
|
132
|
+
// Write System.AppUserModel.ID onto the shortcut via shell32 COM.
|
|
133
|
+
`Add-Type -TypeDefinition @'` + '\n' +
|
|
134
|
+
'using System;\n' +
|
|
135
|
+
'using System.Runtime.InteropServices;\n' +
|
|
136
|
+
'\n' +
|
|
137
|
+
'public static class DshNotifyAumid {\n' +
|
|
138
|
+
' [StructLayout(LayoutKind.Sequential, Pack = 4)]\n' +
|
|
139
|
+
' public struct PROPERTYKEY { public Guid fmtid; public uint pid; }\n' +
|
|
140
|
+
' [StructLayout(LayoutKind.Sequential)]\n' +
|
|
141
|
+
' public struct PROPVARIANT {\n' +
|
|
142
|
+
' public ushort vt;\n' +
|
|
143
|
+
' public ushort wReserved1, wReserved2, wReserved3;\n' +
|
|
144
|
+
' public IntPtr pValue;\n' +
|
|
145
|
+
' public IntPtr pValue2;\n' +
|
|
146
|
+
' }\n' +
|
|
147
|
+
' [ComImport, Guid("886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]\n' +
|
|
148
|
+
' public interface IPropertyStore {\n' +
|
|
149
|
+
' void GetCount(out uint cProps);\n' +
|
|
150
|
+
' void GetAt(uint iProp, out PROPERTYKEY pkey);\n' +
|
|
151
|
+
' void GetValue(ref PROPERTYKEY key, out PROPVARIANT pv);\n' +
|
|
152
|
+
' void SetValue(ref PROPERTYKEY key, ref PROPVARIANT pv);\n' +
|
|
153
|
+
' void Commit();\n' +
|
|
154
|
+
' }\n' +
|
|
155
|
+
' const ushort VT_LPWSTR = 31;\n' +
|
|
156
|
+
' const int GPS_READWRITE = 0x2;\n' +
|
|
157
|
+
' [DllImport("shell32.dll", CharSet = CharSet.Unicode)]\n' +
|
|
158
|
+
' static extern int SHGetPropertyStoreFromParsingName(string pszPath, IntPtr pbc, int flags, ref Guid riid, out IntPtr ppv);\n' +
|
|
159
|
+
' public static void Set(string lnkPath, string aumid) {\n' +
|
|
160
|
+
' Guid iid = new Guid("886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99");\n' +
|
|
161
|
+
' IntPtr ppv;\n' +
|
|
162
|
+
' int hr = SHGetPropertyStoreFromParsingName(lnkPath, IntPtr.Zero, GPS_READWRITE, ref iid, out ppv);\n' +
|
|
163
|
+
' if (hr != 0) throw new COMException("property store open failed 0x" + hr.ToString("X8"));\n' +
|
|
164
|
+
' IPropertyStore ps = (IPropertyStore)Marshal.GetObjectForIUnknown(ppv);\n' +
|
|
165
|
+
' PROPERTYKEY key = new PROPERTYKEY { fmtid = new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), pid = 5 };\n' +
|
|
166
|
+
' PROPVARIANT pv = new PROPVARIANT();\n' +
|
|
167
|
+
' pv.vt = VT_LPWSTR;\n' +
|
|
168
|
+
' pv.pValue = Marshal.StringToCoTaskMemUni(aumid);\n' +
|
|
169
|
+
' try {\n' +
|
|
170
|
+
' ps.SetValue(ref key, ref pv);\n' +
|
|
171
|
+
' ps.Commit();\n' +
|
|
172
|
+
' } finally {\n' +
|
|
173
|
+
' Marshal.FreeCoTaskMem(pv.pValue);\n' +
|
|
174
|
+
' Marshal.Release(ppv);\n' +
|
|
175
|
+
' }\n' +
|
|
176
|
+
' }\n' +
|
|
177
|
+
'}' + '\n' +
|
|
178
|
+
`'@ -ErrorAction Stop`,
|
|
179
|
+
`[DshNotifyAumid]::Set($lnk, '${AUMID}')`,
|
|
180
|
+
// Protocol registration: toast clicks route through wscript (no console flash).
|
|
181
|
+
`$proto = 'HKCU:\\Software\\Classes\\${ACTIVATE_URI.split('://')[0]}'`,
|
|
182
|
+
`if (-not (Test-Path $proto)) { New-Item -Path $proto -Force | Out-Null }`,
|
|
183
|
+
`New-ItemProperty -Path $proto -Name 'URL Protocol' -Value '' -PropertyType String | Out-Null`,
|
|
184
|
+
`New-Item -Path "$proto\\shell\\open\\command" -Force | Out-Null`,
|
|
185
|
+
`Set-ItemProperty -Path "$proto\\shell\\open\\command" -Name '(Default)' ` +
|
|
186
|
+
`-Value '"${psSingleQuote(join(process.env.WINDIR || '', 'System32', 'wscript.exe'))}" "${psSingleQuote(activateVbs)}" "%1"'`,
|
|
187
|
+
].filter(line => line !== '').join('\n')
|
|
188
|
+
|
|
189
|
+
runPowerShell(script)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function shortSession(sessionId) {
|
|
193
|
+
const value = String(sessionId)
|
|
194
|
+
return value.length > 12 ? value.slice(-8) : value
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Plugin entry: subscribe to session running-state changes and toast on idle.
|
|
199
|
+
* @param ctx - plugin root context.
|
|
200
|
+
* @param config - row config from cordis.patch.yml, merged over DEFAULTS.
|
|
201
|
+
* @returns cleanup that removes the event listener.
|
|
202
|
+
*/
|
|
203
|
+
export function apply(ctx, rawConfig) {
|
|
204
|
+
const config = { ...DEFAULTS, ...(rawConfig || {}) }
|
|
205
|
+
if (config.enabled === false) return () => {}
|
|
206
|
+
|
|
207
|
+
ensureAumid()
|
|
208
|
+
|
|
209
|
+
const startedAt = new Map()
|
|
210
|
+
const titles = new Map()
|
|
211
|
+
|
|
212
|
+
// Prune per-session state when a session leaves the live registry so the
|
|
213
|
+
// maps stay bounded to live sessions instead of growing for the uptime.
|
|
214
|
+
ctx.on('api-session/removed', sessionId => {
|
|
215
|
+
const key = String(sessionId)
|
|
216
|
+
titles.delete(key)
|
|
217
|
+
startedAt.delete(key)
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
ctx.on('api-session/added', summary => {
|
|
221
|
+
const id = summary && (summary.sessionId ?? summary.id)
|
|
222
|
+
if (typeof id !== 'string' || typeof summary.title !== 'string' || !summary.title) return
|
|
223
|
+
// Hard cap: even without removal events, the cache cannot grow past this.
|
|
224
|
+
if (titles.size >= 256) {
|
|
225
|
+
const oldest = titles.keys().next().value
|
|
226
|
+
if (oldest !== undefined) titles.delete(oldest)
|
|
227
|
+
}
|
|
228
|
+
titles.set(id, summary.title)
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
const dispose = ctx.on('api-session/status', (sessionId, running) => {
|
|
232
|
+
const key = String(sessionId)
|
|
233
|
+
if (running) {
|
|
234
|
+
startedAt.set(key, Date.now())
|
|
235
|
+
return
|
|
236
|
+
}
|
|
237
|
+
const beganAt = startedAt.get(key)
|
|
238
|
+
startedAt.delete(key)
|
|
239
|
+
if (beganAt === undefined) return
|
|
240
|
+
if (Date.now() - beganAt < (config.minRunMs || 0)) return
|
|
241
|
+
|
|
242
|
+
const session = titles.get(key) || 'DSH'
|
|
243
|
+
const body = String(config.bodyTemplate || '')
|
|
244
|
+
.replace('{session}', session)
|
|
245
|
+
.replace('{id}', shortSession(sessionId))
|
|
246
|
+
runPowerShell(toastScript(config.title || DEFAULTS.title, body))
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
if (config.notifyOnQuestion === false) return dispose
|
|
250
|
+
|
|
251
|
+
const disposeQuestions = ctx.on('user-questions/request', (req, next) => {
|
|
252
|
+
const questions = (req && req.questions) || []
|
|
253
|
+
const first = questions[0]
|
|
254
|
+
const text = first ? String(first.question || first.header || '') : ''
|
|
255
|
+
const agentId = req && req.agent ? String(req.agent.id) : ''
|
|
256
|
+
const session = agentId ? titles.get(agentId) : ''
|
|
257
|
+
const where = session || 'DSH'
|
|
258
|
+
const head = text.length > 40 ? `${text.slice(0, 40)}…` : text
|
|
259
|
+
const body = questions.length > 1
|
|
260
|
+
? `${where} 有 ${questions.length} 个问题等你拍板(第一个:${head || '见 GUI'})`
|
|
261
|
+
: head ? `${where}:${head}` : `${where} 需要你的回答`
|
|
262
|
+
runPowerShell(toastScript(config.questionTitle || DEFAULTS.questionTitle, body))
|
|
263
|
+
return next()
|
|
264
|
+
})
|
|
265
|
+
|
|
266
|
+
return () => {
|
|
267
|
+
dispose()
|
|
268
|
+
disposeQuestions()
|
|
269
|
+
}
|
|
270
|
+
}
|
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-windows-notifier",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./index.js",
|
|
7
|
+
"./locale/*.json": "./locale/*.json",
|
|
8
|
+
"./icon": "./icon.svg"
|
|
9
|
+
},
|
|
10
|
+
"files": ["index.js", "cordis.patch.yml", "locale/*.json", "docs", "icon.svg", "toast-activate.ps1", "toast-activate.vbs"],
|
|
11
|
+
"dsh": {
|
|
12
|
+
"bundle": {
|
|
13
|
+
"patch": "./cordis.patch.yml"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# toast-activate.ps1 — dsh-windows-notify 通知点击激活处理器
|
|
2
|
+
# 点击 Windows 通知时被调用:启动并聚焦 DSH 主窗口。
|
|
3
|
+
# 直接启动 DSH 可执行文件而不走 dsh://open 协议——协议激活会回到本脚本,
|
|
4
|
+
# DSH 未运行时形成无限进程递归(黑框闪烁且应用不启动)。
|
|
5
|
+
param([string]$Uri)
|
|
6
|
+
try {
|
|
7
|
+
# 从 DSH 自注册的协议命令里解析出应用 exe 路径。
|
|
8
|
+
$cmd = (Get-ItemProperty 'HKCU:\Software\Classes\dsh\shell\open\command' -ErrorAction SilentlyContinue).'(default)'
|
|
9
|
+
if ($cmd -match '"([^"]+DeepSeek Harness\.exe)"') {
|
|
10
|
+
Start-Process $matches[1]
|
|
11
|
+
} else {
|
|
12
|
+
Start-Process 'dsh://open'
|
|
13
|
+
}
|
|
14
|
+
} catch { }
|
|
15
|
+
exit 0
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
' toast-activate.vbs — dsh-windows-notify 激活启动器(无窗口)
|
|
2
|
+
' 由 dsh-windows-notify:// 协议命令调用,隐藏运行 toast-activate.ps1。
|
|
3
|
+
If WScript.Arguments.Count = 0 Then WScript.Quit
|
|
4
|
+
Dim fso, shell, scriptDir, psCmd, arg
|
|
5
|
+
Set fso = CreateObject("Scripting.FileSystemObject")
|
|
6
|
+
Set shell = CreateObject("WScript.Shell")
|
|
7
|
+
scriptDir = fso.GetParentFolderName(WScript.ScriptFullName)
|
|
8
|
+
arg = WScript.Arguments(0)
|
|
9
|
+
psCmd = "powershell.exe -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File """ & scriptDir & "\toast-activate.ps1"" """ & arg & """"
|
|
10
|
+
shell.Run psCmd, 0, False
|
|
11
|
+
WScript.Quit
|
package/README.md
DELETED