dsh-notify-tray 0.1.12 → 0.1.13
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.en.md +3 -3
- package/README.md +3 -3
- package/README.zh-CN.md +3 -3
- package/assets/mascot-peeking.prompt.txt +6 -6
- package/assets/notify-icon.png +0 -0
- package/assets/tray-darwin.js +283 -283
- package/cordis.patch.yml +6 -6
- package/lib/ToastActivator.cs +33 -0
- package/lib/catalog.js +448 -448
- package/lib/client.js +18 -90
- package/lib/format.js +284 -284
- package/lib/host/context.js +11 -3
- package/lib/host/notify.js +26 -21
- package/lib/host/routes.js +9 -42
- package/lib/host/spend.js +190 -190
- package/lib/host/tray.js +120 -120
- package/lib/icon.js +159 -159
- package/lib/index.js +2 -7
- package/lib/ledger.js +285 -285
- package/lib/models-dev.json +2684 -2684
- package/lib/notices.js +3 -4
- package/lib/pricing.js +302 -302
- package/lib/quota.js +290 -290
- package/lib/system.js +11 -22
- package/lib/tracker.js +250 -250
- package/lib/tray/index.js +142 -142
- package/lib/tray/linux.js +393 -393
- package/lib/voice.js +76 -76
- package/lib/whale.js +396 -396
- package/lib/windows-toast.js +92 -0
- package/locale/en.json +7 -7
- package/locale/zh.json +7 -7
- package/package.json +2 -1
package/lib/voice.js
CHANGED
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The whale's voice: notification wording in the mascot's own tone — a
|
|
3
|
-
* plump blue whale girl who is cheerful, a little proud, and very fond of
|
|
4
|
-
* you. One line per event type, several variants each; the variant is picked
|
|
5
|
-
* from the event's seq so the same event reads the same on every screen.
|
|
6
|
-
*
|
|
7
|
-
* Returns { title, body }. `title` is the short headline shown in bold by the
|
|
8
|
-
* OS; `body` carries the session name (in 『』) and the question / reason.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
const LINES = {
|
|
12
|
-
completed: [
|
|
13
|
-
{ title: '🐳 搞定啦~', body: '『{s}』做完了!快来验收,本鲸可是很能干的哦' },
|
|
14
|
-
{ title: '🐳 任务完成!', body: '『{s}』已经办妥~ 要不要摸摸鲸鱼头奖励一下?' },
|
|
15
|
-
{ title: '🐳 哗啦~浮出水面', body: '『{s}』收工!结果都整理好了,等你来看' },
|
|
16
|
-
{ title: '🐳 嘿嘿,做完了', body: '『{s}』顺利完成~ 下一个任务也放心交给我吧' },
|
|
17
|
-
],
|
|
18
|
-
choice: [
|
|
19
|
-
{ title: '🐳 该你拍板啦', body: '『{s}』遇到岔路口了:{q} 选一个嘛~' },
|
|
20
|
-
{ title: '🐳 选哪个呀?', body: '『{s}』需要你做个决定:{q}' },
|
|
21
|
-
{ title: '🐳 鲸鱼举棋不定中…', body: '『{s}』有几个方案等你挑:{q}' },
|
|
22
|
-
],
|
|
23
|
-
input: [
|
|
24
|
-
{ title: '🐳 等你说话呢', body: '『{s}』想听听你的想法:{q}' },
|
|
25
|
-
{ title: '🐳 请你写几个字~', body: '『{s}』卡在这里啦:{q}' },
|
|
26
|
-
{ title: '🐳 戳戳,需要你回答', body: '『{s}』有个问题只有你能答:{q}' },
|
|
27
|
-
],
|
|
28
|
-
approval: [
|
|
29
|
-
{ title: '🐳 要不要放行?', body: '『{s}』想执行一个操作,等你点头:{q}' },
|
|
30
|
-
{ title: '🐳 这个可以做吗?', body: '『{s}』在等你的批准:{q}' },
|
|
31
|
-
],
|
|
32
|
-
// Several tasks finished within a few seconds of the first one: one notice for all of them.
|
|
33
|
-
completedMany: [
|
|
34
|
-
{ title: '🐳 又搞定 {n} 个!', body: '{list}也都做完啦,一起来验收吧' },
|
|
35
|
-
{ title: '🐳 连着做完 {n} 个~', body: '{list}都收工了,本鲸今天状态超好' },
|
|
36
|
-
],
|
|
37
|
-
failed: [
|
|
38
|
-
{ title: '🐳 呜…翻车了', body: '『{s}』没做完:{q} 要不要再试一次?' },
|
|
39
|
-
{ title: '🐳 沉下去了一下下', body: '『{s}』出了点状况:{q} 鲸鱼在等你救援' },
|
|
40
|
-
],
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const FALLBACK = { title: '🐳 DeepSeek Harness', body: '『{s}』{q}' }
|
|
44
|
-
/** Session names a merged notice spells out before saying "等 n 个". */
|
|
45
|
-
const LIST_MAX = 3
|
|
46
|
-
|
|
47
|
-
function listOf(sessions, count) {
|
|
48
|
-
const names = sessions.slice(0, LIST_MAX).map(s => `『${s.title || '会话'}』`).join('')
|
|
49
|
-
return sessions.length > LIST_MAX ? `${names}等 ${count} 个任务` : names
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @param {{type: string, seq?: number, title: string, body?: string, count?: number, sessions?: {title: string}[]}} event
|
|
54
|
-
* `count` + `sessions`: a merged notice for several completions (lib/notices.js).
|
|
55
|
-
* @returns {{title: string, body: string}}
|
|
56
|
-
*/
|
|
57
|
-
export function speak(event) {
|
|
58
|
-
if (event.type === 'completed' && event.count > 1 && Array.isArray(event.sessions)) {
|
|
59
|
-
const variants = LINES.completedMany
|
|
60
|
-
const line = variants[Math.abs(event.seq ?? 0) % variants.length]
|
|
61
|
-
return { title: line.title.replace('{n}', event.count), body: line.body.replace('{list}', listOf(event.sessions, event.count)) }
|
|
62
|
-
}
|
|
63
|
-
const variants = LINES[event.type] ?? [FALLBACK]
|
|
64
|
-
const line = variants[Math.abs(event.seq ?? 0) % variants.length]
|
|
65
|
-
const session = event.title || '这个会话'
|
|
66
|
-
const detail = (event.body ?? '').trim()
|
|
67
|
-
const body = line.body.replace('{s}', session).replace('{q}', detail)
|
|
68
|
-
// No detail to show: drop a dangling ":" or " " left behind by the template.
|
|
69
|
-
return { title: line.title, body: body.replace(/[::]\s*$/u, '').replace(/[::]\s* /u, ' ').replace(/\s+$/u, '') }
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/** The same wording as a one-line string (tray tooltips, Windows balloons). */
|
|
73
|
-
export function speakLine(event) {
|
|
74
|
-
const { title, body } = speak(event)
|
|
75
|
-
return `${title} ${body}`
|
|
76
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* The whale's voice: notification wording in the mascot's own tone — a
|
|
3
|
+
* plump blue whale girl who is cheerful, a little proud, and very fond of
|
|
4
|
+
* you. One line per event type, several variants each; the variant is picked
|
|
5
|
+
* from the event's seq so the same event reads the same on every screen.
|
|
6
|
+
*
|
|
7
|
+
* Returns { title, body }. `title` is the short headline shown in bold by the
|
|
8
|
+
* OS; `body` carries the session name (in 『』) and the question / reason.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const LINES = {
|
|
12
|
+
completed: [
|
|
13
|
+
{ title: '🐳 搞定啦~', body: '『{s}』做完了!快来验收,本鲸可是很能干的哦' },
|
|
14
|
+
{ title: '🐳 任务完成!', body: '『{s}』已经办妥~ 要不要摸摸鲸鱼头奖励一下?' },
|
|
15
|
+
{ title: '🐳 哗啦~浮出水面', body: '『{s}』收工!结果都整理好了,等你来看' },
|
|
16
|
+
{ title: '🐳 嘿嘿,做完了', body: '『{s}』顺利完成~ 下一个任务也放心交给我吧' },
|
|
17
|
+
],
|
|
18
|
+
choice: [
|
|
19
|
+
{ title: '🐳 该你拍板啦', body: '『{s}』遇到岔路口了:{q} 选一个嘛~' },
|
|
20
|
+
{ title: '🐳 选哪个呀?', body: '『{s}』需要你做个决定:{q}' },
|
|
21
|
+
{ title: '🐳 鲸鱼举棋不定中…', body: '『{s}』有几个方案等你挑:{q}' },
|
|
22
|
+
],
|
|
23
|
+
input: [
|
|
24
|
+
{ title: '🐳 等你说话呢', body: '『{s}』想听听你的想法:{q}' },
|
|
25
|
+
{ title: '🐳 请你写几个字~', body: '『{s}』卡在这里啦:{q}' },
|
|
26
|
+
{ title: '🐳 戳戳,需要你回答', body: '『{s}』有个问题只有你能答:{q}' },
|
|
27
|
+
],
|
|
28
|
+
approval: [
|
|
29
|
+
{ title: '🐳 要不要放行?', body: '『{s}』想执行一个操作,等你点头:{q}' },
|
|
30
|
+
{ title: '🐳 这个可以做吗?', body: '『{s}』在等你的批准:{q}' },
|
|
31
|
+
],
|
|
32
|
+
// Several tasks finished within a few seconds of the first one: one notice for all of them.
|
|
33
|
+
completedMany: [
|
|
34
|
+
{ title: '🐳 又搞定 {n} 个!', body: '{list}也都做完啦,一起来验收吧' },
|
|
35
|
+
{ title: '🐳 连着做完 {n} 个~', body: '{list}都收工了,本鲸今天状态超好' },
|
|
36
|
+
],
|
|
37
|
+
failed: [
|
|
38
|
+
{ title: '🐳 呜…翻车了', body: '『{s}』没做完:{q} 要不要再试一次?' },
|
|
39
|
+
{ title: '🐳 沉下去了一下下', body: '『{s}』出了点状况:{q} 鲸鱼在等你救援' },
|
|
40
|
+
],
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const FALLBACK = { title: '🐳 DeepSeek Harness', body: '『{s}』{q}' }
|
|
44
|
+
/** Session names a merged notice spells out before saying "等 n 个". */
|
|
45
|
+
const LIST_MAX = 3
|
|
46
|
+
|
|
47
|
+
function listOf(sessions, count) {
|
|
48
|
+
const names = sessions.slice(0, LIST_MAX).map(s => `『${s.title || '会话'}』`).join('')
|
|
49
|
+
return sessions.length > LIST_MAX ? `${names}等 ${count} 个任务` : names
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @param {{type: string, seq?: number, title: string, body?: string, count?: number, sessions?: {title: string}[]}} event
|
|
54
|
+
* `count` + `sessions`: a merged notice for several completions (lib/notices.js).
|
|
55
|
+
* @returns {{title: string, body: string}}
|
|
56
|
+
*/
|
|
57
|
+
export function speak(event) {
|
|
58
|
+
if (event.type === 'completed' && event.count > 1 && Array.isArray(event.sessions)) {
|
|
59
|
+
const variants = LINES.completedMany
|
|
60
|
+
const line = variants[Math.abs(event.seq ?? 0) % variants.length]
|
|
61
|
+
return { title: line.title.replace('{n}', event.count), body: line.body.replace('{list}', listOf(event.sessions, event.count)) }
|
|
62
|
+
}
|
|
63
|
+
const variants = LINES[event.type] ?? [FALLBACK]
|
|
64
|
+
const line = variants[Math.abs(event.seq ?? 0) % variants.length]
|
|
65
|
+
const session = event.title || '这个会话'
|
|
66
|
+
const detail = (event.body ?? '').trim()
|
|
67
|
+
const body = line.body.replace('{s}', session).replace('{q}', detail)
|
|
68
|
+
// No detail to show: drop a dangling ":" or " " left behind by the template.
|
|
69
|
+
return { title: line.title, body: body.replace(/[::]\s*$/u, '').replace(/[::]\s* /u, ' ').replace(/\s+$/u, '') }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** The same wording as a one-line string (tray tooltips, Windows balloons). */
|
|
73
|
+
export function speakLine(event) {
|
|
74
|
+
const { title, body } = speak(event)
|
|
75
|
+
return `${title} ${body}`
|
|
76
|
+
}
|