dsh-reminder-notify 0.8.0 → 0.8.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/client.js CHANGED
@@ -16,12 +16,16 @@ window.__ModuleLoader__.load({
16
16
  const NS = 'dsh-reminder-notify'
17
17
  // 与 index.js 里 Host 注册的路由保持一致(同源 GET,返回 { dir, files, error? })。
18
18
  const AUDIO_ROUTE = '/dsh-reminder-notify/audio'
19
+ const CONFIG_ROUTE = '/dsh-reminder-notify/config'
19
20
  const AUDIO_KEYS = ['doneAudio', 'decideAudio', 'rawAudio']
20
21
 
21
22
  const zh = {
22
23
  title: '桌面提醒设置',
23
- intro: '调整弹窗停留时间、位置、提示音和卡片配色。改完点保存,插件会重启一次后生效。',
24
+ intro: '调整弹窗停留时间、位置、提示音和卡片配色。改完点保存,立刻生效,不用重启。',
24
25
  unavailable: '这个页面拿不到插件配置(可能是宿主版本较旧),请改用 cordis.patch.yml 修改。',
26
+ loading: '正在读取插件配置…',
27
+ loadFailed: '读取配置失败:',
28
+ retry: '重试',
25
29
  readonly: '当前配置由更高优先级的层覆盖,这里只能查看。',
26
30
  groupBasic: '基本',
27
31
  groupAudio: '提示音',
@@ -95,8 +99,11 @@ window.__ModuleLoader__.load({
95
99
 
96
100
  const en = {
97
101
  title: 'Desktop reminder settings',
98
- intro: 'Tune the popup duration, position, sounds and card colours. Saving restarts the plugin once.',
102
+ intro: 'Tune the popup duration, position, sounds and card colours. Saving applies immediately, no restart.',
99
103
  unavailable: 'This page cannot read the plugin config (older host). Edit cordis.patch.yml instead.',
104
+ loading: 'Reading the plugin config…',
105
+ loadFailed: 'Could not read the config: ',
106
+ retry: 'Retry',
100
107
  readonly: 'A higher-priority layer overrides this config; it is read-only here.',
101
108
  groupBasic: 'Basics',
102
109
  groupAudio: 'Sounds',
@@ -265,17 +272,50 @@ window.__ModuleLoader__.load({
265
272
 
266
273
  function ReminderConfigPanel(props) {
267
274
  const t = props.t
268
- const form = props.form
269
- const state = form && form.state ? form.state : undefined
270
- const values = (state && state.value) || {}
271
- const writable = !!(state && state.writable)
272
- const revision = state && state.revision
275
+ // 配置读写走插件自己注册的同源 HTTP 路由(Host 端用 configEditor 落盘),
276
+ // 不依赖宿主是否把 ConfigPageForm 传进槽位——那条链路在部分宿主版本里拿不到。
277
+ const [state, setState] = React.useState({ status: 'loading', values: {}, writable: true, error: null })
278
+ const [reload, setReload] = React.useState(0)
279
+ const values = state.values
280
+ const writable = state.writable !== false
273
281
  const [draft, setDraft] = React.useState(null)
274
282
  const [busy, setBusy] = React.useState(false)
275
283
  const [picking, setPicking] = React.useState(false)
276
284
  const [message, setMessage] = React.useState(null)
277
285
  const [audio, setAudio] = React.useState({ dir: '', files: [], error: null })
278
286
 
287
+ React.useEffect(() => {
288
+ if (typeof fetch !== 'function') {
289
+ setState({ status: 'error', values: {}, writable: false, error: 'fetch is unavailable' })
290
+ return undefined
291
+ }
292
+ let cancelled = false
293
+ Promise.resolve()
294
+ .then(() => fetch(CONFIG_ROUTE, { headers: { accept: 'application/json' } }))
295
+ .then((response) => {
296
+ const status = response ? response.status : 0
297
+ const body = response && typeof response.json === 'function' ? response.json() : Promise.resolve(null)
298
+ return Promise.resolve(body)
299
+ .catch(() => null)
300
+ .then((data) => {
301
+ if (response && response.ok && data && data.ok !== false) return data
302
+ const detail = data && data.error ? data.error : 'HTTP ' + status
303
+ throw new Error(detail)
304
+ })
305
+ })
306
+ .then((data) => {
307
+ if (cancelled) return
308
+ setState({ status: 'ready', values: (data && data.values) || {}, writable: (data && data.writable) !== false, error: null })
309
+ })
310
+ .catch((error) => {
311
+ if (cancelled) return
312
+ setState({ status: 'error', values: {}, writable: false, error: String((error && error.message) || error) })
313
+ })
314
+ return () => {
315
+ cancelled = true
316
+ }
317
+ }, [reload])
318
+
279
319
  // 音频候选:Host 端注册了只读路由 /dsh-reminder-notify/audio,页面同源 fetch 拿目录清单。
280
320
  // 拿不到(旧宿主 / 路由被拦)就静默降级成手填文件名,不打扰用户。
281
321
  const scanDir = (draft && typeof draft.audioDir === 'string' && draft.audioDir !== '' ? draft.audioDir : values.audioDir) || ''
@@ -306,8 +346,21 @@ window.__ModuleLoader__.load({
306
346
  return h('span', null, `${tr('summaryPrefix')}${tr(posKey)} · ${values.seconds === undefined ? 60 : values.seconds}${tr('secondsUnit')} · ${sound}`)
307
347
  }
308
348
 
309
- if (form === undefined || state === undefined) {
310
- return h('div', { className: 'drn-panel' }, h('div', { className: 'drn-hint' }, typeof t === 'function' ? t('unavailable') : 'unavailable'))
349
+ if (state.status === 'loading') {
350
+ return h('div', { className: 'drn-panel' }, h('div', { className: 'drn-hint' }, typeof t === 'function' ? t('loading') : 'loading…'))
351
+ }
352
+
353
+ if (state.status === 'error') {
354
+ return h(
355
+ 'div',
356
+ { className: 'drn-panel' },
357
+ h('div', { className: 'drn-hint error' }, (typeof t === 'function' ? t('loadFailed') : 'cannot read config: ') + (state.error || '')),
358
+ h(
359
+ 'div',
360
+ { className: 'drn-actions' },
361
+ h('button', { type: 'button', className: 'drn-btn', onClick: () => setReload(reload + 1) }, typeof t === 'function' ? t('retry') : 'Retry'),
362
+ ),
363
+ )
311
364
  }
312
365
 
313
366
  const effective = draft === null ? values : Object.assign({}, values, draft)
@@ -322,27 +375,41 @@ window.__ModuleLoader__.load({
322
375
  setDraft(Object.assign({}, draft || {}, { [key]: value }))
323
376
  }
324
377
 
325
- function changedOps() {
326
- const ops = []
378
+ function changedPatch() {
379
+ const patch = {}
327
380
  for (const field of FIELDS) {
328
381
  const current = effective[field.key]
329
382
  const saved = values[field.key]
330
383
  if (sameValue(current, saved)) continue
331
- ops.push({ op: 'set', path: [field.key], value: current === '' ? (field.kind === 'text' ? '' : current) : current })
384
+ patch[field.key] = current === undefined ? '' : current
332
385
  }
333
- return ops
386
+ return patch
334
387
  }
335
388
 
336
- const ops = changedOps()
337
- const dirty = ops.length > 0
389
+ const patch = changedPatch()
390
+ const dirty = Object.keys(patch).length > 0
338
391
 
339
392
  function save() {
340
393
  if (!dirty || busy) return
341
394
  setBusy(true)
342
395
  setMessage(null)
343
- Promise.resolve(form.mutate(ops, revision))
344
- .then(() => {
396
+ Promise.resolve()
397
+ .then(() =>
398
+ fetch(CONFIG_ROUTE, {
399
+ method: 'POST',
400
+ headers: { 'content-type': 'application/json', accept: 'application/json' },
401
+ body: JSON.stringify({ values: patch }),
402
+ }),
403
+ )
404
+ .then((response) =>
405
+ response && typeof response.json === 'function'
406
+ ? response.json().then((data) => ({ ok: !!(response.ok && data && data.ok !== false), data }))
407
+ : Promise.reject(new Error('HTTP ' + (response ? response.status : '?'))),
408
+ )
409
+ .then(({ ok, data }) => {
345
410
  setBusy(false)
411
+ if (!ok) throw new Error((data && data.error) || 'save rejected')
412
+ setState({ status: 'ready', values: (data && data.values) || effective, writable: (data && data.writable) !== false, error: null })
346
413
  setDraft(null)
347
414
  setMessage({ ok: true, text: typeof t === 'function' ? t('saved') : 'saved' })
348
415
  })
@@ -0,0 +1,22 @@
1
+ # Desktop reminder (dsh-reminder-notify)
2
+
3
+ Adds a `notify_user` tool to DeepSeek Harness: when work is done (`kind=done`) or a decision is needed (`kind=decide`), a reminder card pops in the bottom-right with the matching voice — never stealing focus, auto-dismissing after N seconds.
4
+
5
+ The card host is the bundled `host/ReminderHost.ps1`, drawn with the system PowerShell 5.1 + WinForms at run time, so the package ships no exe and is not blocked by SmartScreen or antivirus.
6
+
7
+ ## Settings
8
+
9
+ Open "Desktop reminder" in the Plugins page; the panel sits right under the description and has four groups:
10
+
11
+ - **Basics**: duration, position, sound on/off
12
+ - **Sounds**: audio directory ("Browse…" picks a directory), the three per-kind file names (wav / mp3). Once a directory is picked the dropdown lists the audio files in it.
13
+ - **Look**: background image, title icon, accent colours, title/message templates (`{title}` `{message}` `{kind}` `{time}`), plus per-kind overrides for background, icon and templates
14
+ - **Host**: script or exe host, script path, PowerShell path
15
+
16
+ Changes apply on "Save" — no restart needed.
17
+
18
+ ## Known limits
19
+
20
+ - Windows only (`os: ["win32"]`): the card host is WinForms.
21
+ - Each card spawns a PowerShell process; `Add-Type` compilation takes about 0.6 s before the card appears.
22
+ - The card lives with the DSH host process; closing DSH closes a card that is still on screen.
@@ -0,0 +1,22 @@
1
+ # 桌面提醒 dsh-reminder-notify
2
+
3
+ 给 DeepSeek Harness 加一个 `notify_user` 工具:模型在任务收尾(`kind=done`)或征求同意之前(`kind=decide`)调用它,屏幕右下角弹出提醒卡片并播放对应语音,不抢焦点、按秒自动关闭。
4
+
5
+ 卡片宿主是包内的 `host/ReminderHost.ps1`——用系统自带的 PowerShell 5.1 + WinForms 在运行期绘制,仓库里没有任何 exe,下载安装不会被 SmartScreen / 杀软拦。
6
+
7
+ ## 设置
8
+
9
+ 在「插件」页打开「桌面提醒」,描述下方就是设置面板,分四组:
10
+
11
+ - **基本**:停留秒数、弹窗位置、是否播放提示音
12
+ - **提示音**:提示音目录(可点「浏览…」选目录)、三档提示音文件名(wav / mp3),选了目录后下拉框会列出目录里的音频
13
+ - **外观**:背景图、标题图标、强调色、标题/正文模板(`{title}` `{message}` `{kind}` `{time}`),以及每档位单独覆盖的背景 / 图标 / 模板
14
+ - **宿主**:脚本模式或 exe 模式、脚本路径、PowerShell 路径
15
+
16
+ 改完点「保存」,立刻生效,不用重启。
17
+
18
+ ## 已知限制
19
+
20
+ - 仅 Windows(`os: ["win32"]`):卡片宿主是 WinForms。
21
+ - 每次弹卡片要起一个 PowerShell 进程,`Add-Type` 编译约 0.6 s 才出现。
22
+ - 卡片随 DSH 宿主进程存活;DSH 关掉时正在显示的卡片也会一起消失。
package/index.js CHANGED
@@ -26,38 +26,45 @@ const z = await import('@deepseek-ai/schemastery')
26
26
 
27
27
  // 插件页的设置表单由这份 schema 渲染(client.js 再在上面做分组面板)。
28
28
  // 每一项的默认值与 settingsOf() 里的兜底一致:空字符串表示「用包内资源」。
29
+ //
30
+ // 为什么每个字段都要 .volatile():宿主 settings.describe() 只把「可按热更新就地改动」
31
+ // 的字段投影进 namespaces(volatileForm 会跳过没有 volatile 标记的字段),而插件页的
32
+ // 设置面板只对 namespaces 里出现过的条目渲染 form。不标 volatile 的话面板会拿到
33
+ // undefined 并显示「这个页面拿不到插件配置」。
34
+ // 标了 volatile 还有个好处:改完立刻生效,不用重启插件 —— notify() 每次调用都会用
35
+ // settingsOf(config) 现读,所以拿到的就是最新值。
29
36
  export const Config = z === null ? undefined : z.object({
30
- hostMode: z.union(['script', 'exe']).default('script').description('宿主模式:script = 包内 PowerShell 脚本(默认),exe = 老的客户端 exe'),
31
- scriptPath: z.string().default('').description('脚本宿主路径,留空 = 包内 host/ReminderHost.ps1'),
32
- powershellPath: z.string().default('powershell.exe').description('调 PowerShell 用的可执行文件'),
33
- clientDir: z.string().default('').description('exe 模式下的客户端目录,留空 = 包内 assets/'),
34
- audioDir: z.string().default('').description('提示音目录,留空 = 包内 assets/提示音导入/'),
35
- seconds: z.number().min(2).max(600).step(1).default(60).description('弹窗停留秒数(2–600)'),
36
- position: z.union(['br', 'center', 'tr']).default('br').description('弹窗位置:br 右下、center 居中、tr 右上'),
37
- sound: z.boolean().default(true).description('是否播放提示音'),
38
- doneAudio: z.string().default('完成提醒语音.wav').description('done 档位的提示音文件名(wav / mp3,在提示音目录下)'),
39
- decideAudio: z.string().default('需要你来决定.wav').description('decide 档位的提示音文件名(wav / mp3)'),
40
- rawAudio: z.string().default('').description('raw 档位的提示音文件名(wav / mp3),留空 = 静音'),
41
- accentDone: z.string().default('#2ECC71').description('done 档位卡片强调色(#RRGGBB)'),
42
- accentDecide: z.string().default('#F5A623').description('decide 档位卡片强调色'),
43
- accentRaw: z.string().default('#4C8DFF').description('raw 档位卡片强调色'),
44
- cooldownMs: z.number().min(0).step(100).default(1500).description('同档位提醒的最小间隔(毫秒)'),
45
- cardBackground: z.string().default('').description('卡片背景图路径(png / jpg),留空 = 纯色背景'),
46
- cardIcon: z.string().default('').description('标题左侧的小图标路径(png / ico),留空 = 不显示'),
47
- doneCardBackground: z.string().default('').description('done 档位单独用的背景图,留空 = 用上面的通用背景'),
48
- decideCardBackground: z.string().default('').description('decide 档位单独用的背景图,留空 = 用通用背景'),
49
- rawCardBackground: z.string().default('').description('raw 档位单独用的背景图,留空 = 用通用背景'),
50
- doneCardIcon: z.string().default('').description('done 档位单独用的标题图标,留空 = 用通用图标'),
51
- decideCardIcon: z.string().default('').description('decide 档位单独用的标题图标,留空 = 用通用图标'),
52
- rawCardIcon: z.string().default('').description('raw 档位单独用的标题图标,留空 = 用通用图标'),
53
- titleTemplate: z.string().default('{title}').description('标题模板,可用占位符 {title} {message} {kind} {time}'),
54
- messageTemplate: z.string().default('{message}').description('正文模板,可用占位符 {title} {message} {kind} {time}'),
55
- doneTitleTemplate: z.string().default('').description('done 档位单独的标题模板,留空 = 用上面的通用模板'),
56
- doneMessageTemplate: z.string().default('').description('done 档位单独的正文模板,留空 = 用通用模板'),
57
- decideTitleTemplate: z.string().default('').description('decide 档位单独的标题模板,留空 = 用通用模板'),
58
- decideMessageTemplate: z.string().default('').description('decide 档位单独的正文模板,留空 = 用通用模板'),
59
- rawTitleTemplate: z.string().default('').description('raw 档位单独的标题模板,留空 = 用通用模板'),
60
- rawMessageTemplate: z.string().default('').description('raw 档位单独的正文模板,留空 = 用通用模板'),
37
+ hostMode: z.union(['script', 'exe']).default('script').description('宿主模式:script = 包内 PowerShell 脚本(默认),exe = 老的客户端 exe').volatile(),
38
+ scriptPath: z.string().default('').description('脚本宿主路径,留空 = 包内 host/ReminderHost.ps1').volatile(),
39
+ powershellPath: z.string().default('powershell.exe').description('调 PowerShell 用的可执行文件').volatile(),
40
+ clientDir: z.string().default('').description('exe 模式下的客户端目录,留空 = 包内 assets/').volatile(),
41
+ audioDir: z.string().default('').description('提示音目录,留空 = 包内 assets/提示音导入/').volatile(),
42
+ seconds: z.number().min(2).max(600).step(1).default(60).description('弹窗停留秒数(2–600)').volatile(),
43
+ position: z.union(['br', 'center', 'tr']).default('br').description('弹窗位置:br 右下、center 居中、tr 右上').volatile(),
44
+ sound: z.boolean().default(true).description('是否播放提示音').volatile(),
45
+ doneAudio: z.string().default('完成提醒语音.wav').description('done 档位的提示音文件名(wav / mp3,在提示音目录下)').volatile(),
46
+ decideAudio: z.string().default('需要你来决定.wav').description('decide 档位的提示音文件名(wav / mp3)').volatile(),
47
+ rawAudio: z.string().default('').description('raw 档位的提示音文件名(wav / mp3),留空 = 静音').volatile(),
48
+ accentDone: z.string().default('#2ECC71').description('done 档位卡片强调色(#RRGGBB)').volatile(),
49
+ accentDecide: z.string().default('#F5A623').description('decide 档位卡片强调色').volatile(),
50
+ accentRaw: z.string().default('#4C8DFF').description('raw 档位卡片强调色').volatile(),
51
+ cooldownMs: z.number().min(0).step(100).default(1500).description('同档位提醒的最小间隔(毫秒)').volatile(),
52
+ cardBackground: z.string().default('').description('卡片背景图路径(png / jpg),留空 = 纯色背景').volatile(),
53
+ cardIcon: z.string().default('').description('标题左侧的小图标路径(png / ico),留空 = 不显示').volatile(),
54
+ doneCardBackground: z.string().default('').description('done 档位单独用的背景图,留空 = 用上面的通用背景').volatile(),
55
+ decideCardBackground: z.string().default('').description('decide 档位单独用的背景图,留空 = 用通用背景').volatile(),
56
+ rawCardBackground: z.string().default('').description('raw 档位单独用的背景图,留空 = 用通用背景').volatile(),
57
+ doneCardIcon: z.string().default('').description('done 档位单独用的标题图标,留空 = 用通用图标').volatile(),
58
+ decideCardIcon: z.string().default('').description('decide 档位单独用的标题图标,留空 = 用通用图标').volatile(),
59
+ rawCardIcon: z.string().default('').description('raw 档位单独用的标题图标,留空 = 用通用图标').volatile(),
60
+ titleTemplate: z.string().default('{title}').description('标题模板,可用占位符 {title} {message} {kind} {time}').volatile(),
61
+ messageTemplate: z.string().default('{message}').description('正文模板,可用占位符 {title} {message} {kind} {time}').volatile(),
62
+ doneTitleTemplate: z.string().default('').description('done 档位单独的标题模板,留空 = 用上面的通用模板').volatile(),
63
+ doneMessageTemplate: z.string().default('').description('done 档位单独的正文模板,留空 = 用通用模板').volatile(),
64
+ decideTitleTemplate: z.string().default('').description('decide 档位单独的标题模板,留空 = 用通用模板').volatile(),
65
+ decideMessageTemplate: z.string().default('').description('decide 档位单独的正文模板,留空 = 用通用模板').volatile(),
66
+ rawTitleTemplate: z.string().default('').description('raw 档位单独的标题模板,留空 = 用通用模板').volatile(),
67
+ rawMessageTemplate: z.string().default('').description('raw 档位单独的正文模板,留空 = 用通用模板').volatile(),
61
68
  })
62
69
 
63
70
  const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)))
@@ -103,8 +110,31 @@ function clamp(value, min, max) {
103
110
  return Math.min(max, Math.max(min, value))
104
111
  }
105
112
 
113
+ // 标了 .volatile() 的字段在运行期是 { get(), [write]() } 包装(schemastery 的热更新句柄),
114
+ // 直接读会把字符串读成 "[object Object]",所以统一在这里解包。
115
+ function unwrapValue(value) {
116
+ if (value !== null && typeof value === 'object' && typeof value.get === 'function') {
117
+ try {
118
+ return value.get()
119
+ } catch {
120
+ return undefined
121
+ }
122
+ }
123
+ return value
124
+ }
125
+
126
+ function configValues(config) {
127
+ const out = {}
128
+ if (config !== null && typeof config === 'object') {
129
+ for (const key of Object.keys(config)) {
130
+ Object.defineProperty(out, key, { value: unwrapValue(config[key]), enumerable: true })
131
+ }
132
+ }
133
+ return out
134
+ }
135
+
106
136
  function settingsOf(config) {
107
- const c = config && typeof config === 'object' ? config : {}
137
+ const c = configValues(config)
108
138
  const position = str(c.position, 'br')
109
139
  const hostMode = str(c.hostMode, 'script').toLowerCase()
110
140
  return {
@@ -404,6 +434,7 @@ function toolDefinition(getSettings) {
404
434
 
405
435
  const AUDIO_EXTENSIONS = ['.wav', '.mp3', '.ogg', '.m4a', '.flac', '.aac', '.wma']
406
436
  const AUDIO_ROUTE = '/dsh-reminder-notify/audio'
437
+ const CONFIG_ROUTE = '/dsh-reminder-notify/config'
407
438
 
408
439
  // 面板要「把音频目录里的文件列成下拉」,但 Client 侧没有任何读文件能力,
409
440
  // 所以由 Host 注册一条只读的 GET 路由,页面用同源 fetch 取这个 JSON。
@@ -457,8 +488,85 @@ function registerAudioRoute(ctx, getSettings) {
457
488
  }, 'dsh-reminder-notify: audio list route')
458
489
  }
459
490
 
491
+ function readJsonBody(req, limit = 256 * 1024) {
492
+ return new Promise((resolve, reject) => {
493
+ let size = 0
494
+ const chunks = []
495
+ req.on('data', (chunk) => {
496
+ size += chunk.length
497
+ if (size > limit) {
498
+ reject(new Error('request body is too large'))
499
+ req.destroy()
500
+ return
501
+ }
502
+ chunks.push(chunk)
503
+ })
504
+ req.on('end', () => {
505
+ const text = Buffer.concat(chunks).toString('utf8').trim()
506
+ if (text === '') return resolve({})
507
+ try {
508
+ resolve(JSON.parse(text))
509
+ } catch (error) {
510
+ reject(error)
511
+ }
512
+ })
513
+ req.on('error', reject)
514
+ })
515
+ }
516
+
517
+ function registerConfigRoute(ctx, getSettings) {
518
+ const web = typeof ctx.get === 'function' ? ctx.get('webServer') : undefined
519
+ if (web === undefined || web === null || typeof web.register !== 'function') {
520
+ ctx.logger?.warn?.('dsh-reminder-notify: webServer is unavailable, the settings panel stays read-only')
521
+ return
522
+ }
523
+ const editable = new Set(Object.keys(settingsOf({})))
524
+ const reply = (res, status, payload) => {
525
+ res.writeHead(status, { 'content-type': 'application/json; charset=utf-8', 'cache-control': 'no-store' })
526
+ res.end(JSON.stringify(payload))
527
+ }
528
+ const route = {
529
+ kind: 'exact',
530
+ path: CONFIG_ROUTE,
531
+ handler: async (req, res) => {
532
+ try {
533
+ if ((req.method ?? 'GET').toUpperCase() === 'GET') {
534
+ return reply(res, 200, { ok: true, writable: true, values: getSettings() })
535
+ }
536
+ const body = await readJsonBody(req)
537
+ const patch = body !== null && typeof body === 'object' && body.values !== null && typeof body.values === 'object'
538
+ ? body.values
539
+ : body
540
+ const entry = ctx.fiber?.entry
541
+ const editor = typeof ctx.get === 'function' ? ctx.get('configEditor') : undefined
542
+ if (entry === undefined || editor === undefined || typeof editor.edit !== 'function') {
543
+ return reply(res, 409, { ok: false, error: 'configuration cannot be saved in this profile' })
544
+ }
545
+ const changes = {}
546
+ for (const [key, value] of Object.entries(patch ?? {})) {
547
+ if (editable.has(key)) changes[key] = value
548
+ }
549
+ if (Object.keys(changes).length === 0) {
550
+ return reply(res, 400, { ok: false, error: 'no editable field in the request' })
551
+ }
552
+ await editor.edit(entry, (current) => ({ ...current, ...changes }))
553
+ return reply(res, 200, { ok: true, writable: true, values: getSettings() })
554
+ } catch (error) {
555
+ return reply(res, 500, { ok: false, error: String(error?.message ?? error) })
556
+ }
557
+ },
558
+ }
559
+ ctx.effect(() => {
560
+ const dispose = web.register(route)
561
+ return () => {
562
+ if (typeof dispose === 'function') dispose()
563
+ }
564
+ }, 'dsh-reminder-notify: settings route')
565
+ }
566
+
460
567
  export function apply(ctx, config) {
461
568
  registerAudioRoute(ctx, () => settingsOf(config))
569
+ registerConfigRoute(ctx, () => settingsOf(config))
462
570
  const tools = typeof ctx.get === 'function' ? ctx.get('tools') : ctx.tools
463
571
  if (tools === undefined || tools === null || typeof tools.register !== 'function') {
464
572
  ctx.logger?.warn?.('dsh-reminder-notify: tools service is unavailable, notify_user was not registered')
package/locale/en.json CHANGED
@@ -2,6 +2,6 @@
2
2
  "meta": {
3
3
  "title": "Desktop reminder",
4
4
  "description": "Pop a floating reminder with voice when work is done or a decision is needed.",
5
- "detail": "Registers the notify_user tool, which pops a bottom-right reminder card with the matching voice — never stealing focus, auto-dismissing after N seconds. The card is drawn by host/ReminderHost.ps1 with the system PowerShell + WinForms at run time, so the package ships no exe and is not blocked by SmartScreen or antivirus. Duration, position, sounds, accent colours and the cooldown live in the plugin Config; hostMode=exe still points at the original client folder on older machines."
5
+ "detail": "docs/detail.en.md"
6
6
  }
7
7
  }
package/locale/zh.json CHANGED
@@ -2,6 +2,6 @@
2
2
  "meta": {
3
3
  "title": "桌面提醒",
4
4
  "description": "工作收尾和需要你拍板时,弹出浮动提醒并播放语音。",
5
- "detail": "把「桌面提醒」包成插件:注册 notify_user 工具,模型在任务收尾(kind=done)或征求同意之前(kind=decide)调用它,右下角弹出提醒卡片并播放对应语音,不抢焦点、按秒自动关闭。卡片宿主是包内的 host/ReminderHost.ps1——用系统自带的 PowerShell + WinForms 在运行期绘制,仓库里没有任何 exe,下载安装不会被 SmartScreen / 杀软拦。停留秒数、位置、提示音、强调色、冷却间隔都在插件 Config 里改;老机器仍可用 hostMode=exe 指向原来的客户端目录。"
5
+ "detail": "docs/detail.zh.md"
6
6
  }
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-reminder-notify",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "DSH 桌面提醒插件:把「完成/需要决定」提醒变成 notify_user 工具(浮动卡片 + 提示音,不抢焦点,纯 PowerShell 源码宿主,仓库零 exe)",
5
5
  "author": "Jiangshuaiye1203",
6
6
  "type": "module",
@@ -48,8 +48,8 @@
48
48
  },
49
49
  "versions": [
50
50
  {
51
- "version": "0.7.0",
52
- "publishTimestamp": 1795081200,
51
+ "version": "0.8.1",
52
+ "publishTimestamp": 1795094364,
53
53
  "source": {
54
54
  "type": "npm"
55
55
  },