@ssamurias/dsh-fish 1.0.0 → 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/AGENTS.md +5 -2
- package/CHANGELOG.md +498 -368
- package/README.md +75 -12
- package/RELEASE-NOTES-1.0.0.md +62 -3
- package/RELEASE-NOTES-1.0.1.md +363 -0
- package/THIRD-PARTY-NOTICES.md +13 -3
- package/lib/autobackup.js +384 -0
- package/lib/backup.js +27 -4
- package/lib/bili.js +132 -21
- package/lib/browse.js +22 -11
- package/lib/capture.js +5 -0
- package/lib/client.js +1196 -324
- package/lib/cloudbackup.js +351 -0
- package/lib/cloudcrypto.js +161 -0
- package/lib/clouddrive.js +587 -0
- package/lib/cloudsmtp.js +331 -0
- package/lib/cloudtargets.js +227 -0
- package/lib/comment.js +20 -3
- package/lib/doing.js +316 -0
- package/lib/events.js +22 -4
- package/lib/firstwake.js +74 -0
- package/lib/generator.js +35 -4
- package/lib/identity.js +383 -26
- package/lib/index.js +14 -2
- package/lib/look.js +37 -3
- package/lib/material.js +12 -1
- package/lib/note.js +100 -9
- package/lib/observe.js +364 -35
- package/lib/persona.js +38 -23
- package/lib/proactive.js +12 -5
- package/lib/recall.js +24 -1
- package/lib/report.js +14 -7
- package/lib/scheduler.js +177 -25
- package/lib/selfcheck.js +13 -1
- package/lib/selfpronoun.js +112 -0
- package/lib/settings.js +133 -4
- package/lib/status.js +16 -8
- package/lib/sub.js +42 -5
- package/lib/turnexport.js +123 -0
- package/lib/turns.js +19 -0
- package/lib/voices.js +24 -1
- package/media/principle-drive.svg +131 -0
- package/media/principle-loop.svg +3 -3
- package/media/principle-memory.svg +1 -1
- package/package.json +1 -1
package/lib/material.js
CHANGED
|
@@ -46,11 +46,16 @@ export function isDissent(text) {
|
|
|
46
46
|
* 为什么不多:一次素材里出现两三条反例就够她对照了;给太多,素材会变成
|
|
47
47
|
* 评论区吵架现场,她的注意力会被拽到争论上,而不是那件事本身。
|
|
48
48
|
* 按点赞降序挑,最多 max 条。
|
|
49
|
+
*
|
|
50
|
+
* 2026-11-13(issue #135):传进来的列表来自 `sort=2`,是 B 站**热度序**,
|
|
51
|
+
* 赞数并不单调(实测 30/55/44/348…)。这句「按点赞降序」从 0.9.8 起就写在
|
|
52
|
+
* 注释里,代码却是照顺序取——现在真排一次,挑出来的才是「最多人赞同的那条反例」。
|
|
49
53
|
*/
|
|
50
54
|
export function pickDisputes(comments = [], { max = 2 } = {}) {
|
|
51
55
|
const out = []
|
|
52
56
|
const seen = new Set()
|
|
53
|
-
|
|
57
|
+
const ranked = [...comments].sort((a, b) => (Number(b?.like) || 0) - (Number(a?.like) || 0))
|
|
58
|
+
for (const c of ranked) {
|
|
54
59
|
const text = String(c?.text ?? '').trim()
|
|
55
60
|
if (!text || seen.has(text)) continue
|
|
56
61
|
if (!isDissent(text)) continue
|
|
@@ -94,6 +99,12 @@ export function toMaterial(pack = {}, o = {}) {
|
|
|
94
99
|
const text = String(c?.text ?? '').trim()
|
|
95
100
|
if (text) quotes.push({ by: '评论', kind: 'comment', grade: GRADE.OPINION, text, like: Number(c?.like) || 0 })
|
|
96
101
|
}
|
|
102
|
+
// 置顶评论(2026-11-13,issue #135):B 站单独放在 data.top 里,跟着一条标出来,
|
|
103
|
+
// 否则她读到的评论区和网页上看到的那组不是同一组。
|
|
104
|
+
for (const c of pack.pinned ?? []) {
|
|
105
|
+
const text = String(c?.text ?? '').trim()
|
|
106
|
+
if (text) quotes.push({ by: '评论', kind: 'pinned', grade: GRADE.OPINION, text, like: Number(c?.like) || 0 })
|
|
107
|
+
}
|
|
97
108
|
for (const c of pack.disputes ?? []) {
|
|
98
109
|
const text = String(c?.text ?? '').trim()
|
|
99
110
|
if (text) quotes.push({ by: '评论', kind: 'dissent', grade: GRADE.OPINION, text, like: Number(c?.like) || 0 })
|
package/lib/note.js
CHANGED
|
@@ -17,7 +17,10 @@
|
|
|
17
17
|
* 「没日子的」不再只提一次,也不天天摆:记下满 7 天起,每次醒来最多提一张,
|
|
18
18
|
* 提过就记 `nshow:<id> <dk>`,隔 7 天再提;划掉/放下就不再提(2026-11-12,用户 m01513)。
|
|
19
19
|
* 到期的那几张照旧每次醒来都摆——有日子就有账可算。
|
|
20
|
-
*
|
|
20
|
+
* 2026-11-14(用户 m00209):一件事做了一半,目标会变、也可能只剩最后一段。
|
|
21
|
+
* 所以便条现在能**改写那一句**(update,旧文本覆盖掉、只留 revisedAt 的时间痕迹),
|
|
22
|
+
* 也能**往同一张上记进展**(log,追加不覆盖)。进展落进 `progress` 数组,
|
|
23
|
+
* 醒来那行和回翻那行都只带最近一笔——她是看着这条路走到哪儿,不是看流水账。
|
|
21
24
|
*
|
|
22
25
|
* 三条硬约束(从 letter.js 沿下来的同一条线):
|
|
23
26
|
* 1. **不审批**。记一张纸条不是改自己,不设关卡。
|
|
@@ -48,6 +51,15 @@ export const NOTE_SHOW_MAX = 5
|
|
|
48
51
|
export const NOTE_LIST_MAX = 20
|
|
49
52
|
/** list 能看的几类:open=还没关掉的,due=写了日子的,done/dropped=关掉的,all=全要。 */
|
|
50
53
|
export const NOTE_FILTERS = ['open', 'due', 'done', 'dropped', 'all']
|
|
54
|
+
/**
|
|
55
|
+
* 一张便条最多留几笔进展(2026-11-14,用户 m00209)。
|
|
56
|
+
*
|
|
57
|
+
* 只留最近几笔:她说的是「这件事做到哪儿了」,不是要她把每天的日记抄进便条。
|
|
58
|
+
* 满了丢最旧的一笔——跨天的事靠**最近一笔**说明现在在哪,早期那些已经过去了。
|
|
59
|
+
*/
|
|
60
|
+
export const NOTE_PROGRESS_MAX = 5
|
|
61
|
+
/** 一笔进展最多多少字。比正文短:一句进展是「做到哪」,不是「这件事是什么」。 */
|
|
62
|
+
export const NOTE_PROGRESS_TEXT_MAX = 120
|
|
51
63
|
|
|
52
64
|
export function notesPath(root = rootDir()) {
|
|
53
65
|
return join(root, NOTES_FILE)
|
|
@@ -82,9 +94,30 @@ export function normalizeNote(raw) {
|
|
|
82
94
|
status,
|
|
83
95
|
reason: raw.reason == null ? null : String(raw.reason).slice(0, 200),
|
|
84
96
|
closedAt: raw.closedAt == null ? null : String(raw.closedAt),
|
|
85
|
-
// 只有 update 会写;其余时候是 null
|
|
97
|
+
// 只有 update / log 会写;其余时候是 null。留着它,动过的痕迹至少还在时间上
|
|
86
98
|
revisedAt: raw.revisedAt == null ? null : String(raw.revisedAt),
|
|
99
|
+
// 进展:追加进去的几笔,每笔一句话 + 记下的时刻。坏项直接丢掉,不猜。
|
|
100
|
+
progress: normalizeProgress(raw.progress),
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** 进展数组的规整:只留形如 `{at, text}` 的,超出上限的砍最旧。 */
|
|
105
|
+
export function normalizeProgress(raw) {
|
|
106
|
+
const list = Array.isArray(raw) ? raw : []
|
|
107
|
+
const out = []
|
|
108
|
+
for (const p of list) {
|
|
109
|
+
if (!p || typeof p !== 'object') continue
|
|
110
|
+
const text = String(p.text ?? '').replace(/\s+/g, ' ').trim()
|
|
111
|
+
if (!text) continue
|
|
112
|
+
out.push({ at: String(p.at ?? '') || new Date().toISOString(), text: text.slice(0, NOTE_PROGRESS_TEXT_MAX) })
|
|
87
113
|
}
|
|
114
|
+
return out.slice(-NOTE_PROGRESS_MAX)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** 一张便条最近记下的那一笔进展(没有就是 null)。 */
|
|
118
|
+
export function lastProgress(n) {
|
|
119
|
+
const list = Array.isArray(n?.progress) ? n.progress : []
|
|
120
|
+
return list.length ? list[list.length - 1] : null
|
|
88
121
|
}
|
|
89
122
|
|
|
90
123
|
/** `YYYY-MM-DD` 且真是那一天(2026-02-30 不算)。 */
|
|
@@ -234,7 +267,11 @@ export function renderNotes(notes, now = new Date(), { seen = new Map() } = {})
|
|
|
234
267
|
for (const n of shown) {
|
|
235
268
|
const mmdd = `${n.due.slice(5, 7)}-${n.due.slice(8, 10)}`
|
|
236
269
|
const tail = n.late === 0 ? '就是今天。' : `晚了${cnNum(n.late)}天。`
|
|
237
|
-
|
|
270
|
+
// 有进展的那张,把最近一笔缀在后面:她一眼看见的是「这十天走到哪儿」,
|
|
271
|
+
// 不是又从头读一遍这件事。只给最近一笔,不报条数(那是流水账,也是状态)。
|
|
272
|
+
const last = lastProgress(n)
|
|
273
|
+
const mark = last ? `(最近:${last.text})` : ''
|
|
274
|
+
lines.push(`${mmdd} ${n.text}${mark},${tail}`)
|
|
238
275
|
}
|
|
239
276
|
const rest = due.length - shown.length
|
|
240
277
|
if (rest > 0) lines.push(`还有${cnCount(rest)}条没列出来,都在便条里。`)
|
|
@@ -364,7 +401,10 @@ function listLine(n) {
|
|
|
364
401
|
const at = md(n.closedAt)
|
|
365
402
|
return `✗ ${n.text}${at ? `(${at} 放下)` : ''}${n.reason ? `—— ${n.reason}` : ''}`
|
|
366
403
|
}
|
|
367
|
-
|
|
404
|
+
// 翻到一张做了一半的:把最近一笔缀在后面,才看得出「它不是又摆回来了,是往前走了」。
|
|
405
|
+
const last = lastProgress(n)
|
|
406
|
+
const mark = last ? `(最近:${last.text})` : ''
|
|
407
|
+
return `${n.due ? `${n.due.slice(5)} ` : '(没日子)'}${n.text}${mark}`
|
|
368
408
|
}
|
|
369
409
|
|
|
370
410
|
/** 还没关掉的先按到期日(没日子的排最后),关掉的按关掉的时间倒序。 */
|
|
@@ -480,6 +520,45 @@ export async function updateNote(root, { id, text, newText, due } = {}) {
|
|
|
480
520
|
}
|
|
481
521
|
}
|
|
482
522
|
|
|
523
|
+
/**
|
|
524
|
+
* 在一张便条上记一笔进展(2026-11-14,用户 m00209)。永不抛。
|
|
525
|
+
*
|
|
526
|
+
* 跟 update 是两件事:update 改「这件事是什么」,progress 记「做到哪儿了」。
|
|
527
|
+
* 一件事做了一半发现目标变了——先用 update 把那一句改掉,之前记的进展原样留着:
|
|
528
|
+
* 路是她自己走过来的,新写法不该把走过的脚印擦掉。
|
|
529
|
+
*
|
|
530
|
+
* 只认没关掉的那张:划掉之后就没「进展」可言了,要接着做请重新记一张。
|
|
531
|
+
* @returns {Promise<{ok:boolean, id:string, note:string, echo?:string}>}
|
|
532
|
+
*/
|
|
533
|
+
export async function logProgress(root, { id, text, progress } = {}) {
|
|
534
|
+
const key = String(id ?? '').trim()
|
|
535
|
+
const body = String(text ?? '').replace(/\s+/g, ' ').trim()
|
|
536
|
+
const said = String(progress ?? '').replace(/\s+/g, ' ').trim()
|
|
537
|
+
if (!key && !body) return { ok: false, id: '', note: '要往哪一张上记?把当时记的那句话告诉我。' }
|
|
538
|
+
if (!said) return { ok: false, id: '', note: '记下哪一句?做到哪儿了,一句话就行。' }
|
|
539
|
+
if (said.length > NOTE_PROGRESS_TEXT_MAX) {
|
|
540
|
+
return { ok: false, id: '', note: `一笔进展压到 ${NOTE_PROGRESS_TEXT_MAX} 字以内,说清做到哪儿就够。` }
|
|
541
|
+
}
|
|
542
|
+
try {
|
|
543
|
+
return await mutateNotes(root, async () => {
|
|
544
|
+
const notes = await readNotes(root)
|
|
545
|
+
const hit = locate(notes, { id: key, text: body })
|
|
546
|
+
if (!hit) {
|
|
547
|
+
return { ok: false, id: '', note: '便条里没有这一张。要和当时记的那句话一字不差。' }
|
|
548
|
+
}
|
|
549
|
+
if (hit.status === 'done') return { ok: false, id: '', note: '这张已经划掉了,记不上进展。要接着做就重新记一张。' }
|
|
550
|
+
if (hit.status === 'dropped') return { ok: false, id: '', note: '这张已经放下了,记不上进展。' }
|
|
551
|
+
const at = new Date().toISOString()
|
|
552
|
+
hit.progress = normalizeProgress([...(Array.isArray(hit.progress) ? hit.progress : []), { at, text: said }])
|
|
553
|
+
hit.revisedAt = at
|
|
554
|
+
await writeNotes(root, notes)
|
|
555
|
+
return { ok: true, id: hit.id, note: '记下了。', echo: `记下一笔:${said}` }
|
|
556
|
+
})
|
|
557
|
+
} catch (err) {
|
|
558
|
+
return { ok: false, id: '', note: '这会儿写不进去,等一下再试。' }
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
483
562
|
/**
|
|
484
563
|
* 放下(决定不做,并写一句为什么)。永不抛。
|
|
485
564
|
*
|
|
@@ -519,7 +598,7 @@ export async function dropNote(root, { id, text, reason } = {}) {
|
|
|
519
598
|
/** 这一次是哪件事。没写 action 的按老路走:status=done 或只给 id 是划掉,其余是记一张。 */
|
|
520
599
|
export function noteAction(args = {}) {
|
|
521
600
|
const a = String(args?.action ?? '').trim()
|
|
522
|
-
if (['add', 'list', 'update', 'drop', 'done'].includes(a)) return a
|
|
601
|
+
if (['add', 'list', 'update', 'log', 'drop', 'done'].includes(a)) return a
|
|
523
602
|
return isClosing(args) ? 'done' : 'add'
|
|
524
603
|
}
|
|
525
604
|
|
|
@@ -535,16 +614,18 @@ export function registerNote(ctx, deps = {}) {
|
|
|
535
614
|
defineTool({
|
|
536
615
|
name: 'her_note',
|
|
537
616
|
description:
|
|
538
|
-
'
|
|
617
|
+
'醒来时摆在你最前面的那叠便条:记一张还没做的事、翻一翻有哪些、往一张上面记进展、改那一句、划掉做完的、或者放下决定不做的。' +
|
|
539
618
|
'记的时候给 text(和日子 due,可以不给);划掉把当时记的那句话原样放进 text,再加 status:"done";' +
|
|
540
619
|
'看便条有哪些给 action:"list"(filter 可以选 open / due / done / dropped / all,列不完用 offset 往后翻);' +
|
|
541
|
-
'
|
|
620
|
+
'一件事做了一半,给 action:"log":text 指认是哪一张,progress 写这一回做到哪儿了(只追一笔,不覆盖之前那些);' +
|
|
621
|
+
'事情本身变了(目标改了、只剩最后一段),给 action:"update":text 指认原来那句,newText 写新的;' +
|
|
542
622
|
'放下给 action:"drop"(同样用 text 指认,reason 写一句为什么)。',
|
|
543
623
|
parameters: toJsonSchema({
|
|
544
624
|
action: {
|
|
545
625
|
type: 'string',
|
|
546
|
-
enum: ['add', 'list', 'update', 'drop', 'done'],
|
|
547
|
-
description:
|
|
626
|
+
enum: ['add', 'list', 'update', 'log', 'drop', 'done'],
|
|
627
|
+
description:
|
|
628
|
+
'要做哪件事:记一张(add,不给就是这个)、翻便条(list)、记一笔进展(log)、改一句(update)、放下(drop)、划掉(done)。',
|
|
548
629
|
},
|
|
549
630
|
text: {
|
|
550
631
|
type: 'string',
|
|
@@ -565,6 +646,10 @@ export function registerNote(ctx, deps = {}) {
|
|
|
565
646
|
offset: { type: 'integer', description: 'list 时从第几张往后翻,默认从最前面。' },
|
|
566
647
|
limit: { type: 'integer', description: 'list 时一次最多列几张,默认 20。' },
|
|
567
648
|
newText: { type: 'string', description: 'update 时改成哪句话。' },
|
|
649
|
+
progress: {
|
|
650
|
+
type: 'string',
|
|
651
|
+
description: 'log 时这一回做到哪儿了,一句话(不超过 120 字)。只说这一步,别重述整件事。',
|
|
652
|
+
},
|
|
568
653
|
reason: { type: 'string', description: 'drop 时为什么不做了,必填。' },
|
|
569
654
|
}),
|
|
570
655
|
output: {
|
|
@@ -590,6 +675,9 @@ export function registerNote(ctx, deps = {}) {
|
|
|
590
675
|
if (act === 'update') {
|
|
591
676
|
return [{ type: 'text', text: out.ok ? '[改好了]' : `[没改:${out.note}]` }]
|
|
592
677
|
}
|
|
678
|
+
if (act === 'log') {
|
|
679
|
+
return [{ type: 'text', text: out.ok ? '[记下了]' : `[没记上:${out.note}]` }]
|
|
680
|
+
}
|
|
593
681
|
if (act === 'drop') {
|
|
594
682
|
return [{ type: 'text', text: out.ok ? '[放下了]' : `[没放下:${out.note}]` }]
|
|
595
683
|
}
|
|
@@ -613,6 +701,9 @@ export function registerNote(ctx, deps = {}) {
|
|
|
613
701
|
if (act === 'update') {
|
|
614
702
|
return updateNote(root, { id: args?.id, text: args?.text, newText: args?.newText, due: args?.due })
|
|
615
703
|
}
|
|
704
|
+
if (act === 'log') {
|
|
705
|
+
return logProgress(root, { id: args?.id, text: args?.text, progress: args?.progress })
|
|
706
|
+
}
|
|
616
707
|
if (act === 'drop') {
|
|
617
708
|
return dropNote(root, { id: args?.id, text: args?.text, reason: args?.reason })
|
|
618
709
|
}
|