dsh-agent-soul 0.9.15 → 0.9.16
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/CHANGELOG.md +19 -0
- package/docs/preview.html +2 -2
- package/lib/client/diary-tab.js +1 -1
- package/lib/client/memory-tab.js +1 -1
- package/lib/client/notes-tab.js +1 -1
- package/lib/client/purpose-tab.js +1 -1
- package/lib/client/styles.js +5 -0
- package/lib/client.js +9 -4
- package/package.json +1 -1
- package/tools/sync-preview.mjs +53 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,25 @@
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## 0.9.16 · 2026-11-09
|
|
11
|
+
|
|
12
|
+
### 变更
|
|
13
|
+
|
|
14
|
+
- **长列表自己滚**:日记「最近日记」、记忆记录、笔记列表、目的「惦记的事」四处
|
|
15
|
+
加 `max-height:min(46vh,420px) + overflow:auto`(跟心情页时间线 `.soul-tl` 同一个套路)。
|
|
16
|
+
条目一多时不再把整页撑长,下面的卡片不用划半天才看得到。
|
|
17
|
+
加 `overscroll-behavior:contain`:内层滚到底不把滚动传给外层,免得整页突然跳走。
|
|
18
|
+
- 新增 `tools/sync-preview.mjs`:把 `styles.js` 的 CSS 一键同步进 `docs/preview.html`。
|
|
19
|
+
R15 的 `preview-css` 门禁能拦住「改了样式忘了同步」,但同步一直是手工的 —— 现在是一条命令。
|
|
20
|
+
- 新增 `tests/ui-scroll.test.js`(10 断言):断言样式规则存在(有界高度 / 可滚 / 不传滚动),
|
|
21
|
+
且四个片段真的挂上了 class —— 只加样式不挂 class 是最常见的「改了等于没改」。
|
|
22
|
+
|
|
23
|
+
### 修复
|
|
24
|
+
|
|
25
|
+
- `docs/preview.html` 的插件 CSS 与 `styles.js` 同步(否则 `preview-css` 契约红)。
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
10
29
|
## 0.9.15 · 2026-11-10
|
|
11
30
|
|
|
12
31
|
### 修复
|
package/docs/preview.html
CHANGED
|
@@ -57,6 +57,7 @@ border:1px solid var(--soul-line);border-radius:14px;overflow:hidden;background:
|
|
|
57
57
|
.soul-badge.fuzzy{background:rgba(255,176,32,.17);color:#8a6a2f}
|
|
58
58
|
.soul-badge.trace{background:rgba(255,92,92,.14);color:#a83a2c}
|
|
59
59
|
.soul-list{display:flex;flex-direction:column;gap:6px;margin-top:8px}
|
|
60
|
+
.soul-list-fixed{max-height:min(46vh,420px);overflow:auto;overscroll-behavior:contain;padding-right:4px}
|
|
60
61
|
.soul-item{display:flex;gap:8px;align-items:flex-start;border:1px solid var(--soul-line-soft);border-radius:8px;padding:9px 10px;background:var(--soul-bg)}
|
|
61
62
|
.soul-item:hover{border-color:var(--soul-line)}
|
|
62
63
|
.soul-item-text{flex:1 1 auto;min-width:0;word-break:break-word}
|
|
@@ -126,8 +127,7 @@ border:1px solid var(--soul-line);border-radius:14px;overflow:hidden;background:
|
|
|
126
127
|
.soul-tl-delta.up{color:#c0392b}
|
|
127
128
|
.soul-tl-delta.down{color:#2f6b46}
|
|
128
129
|
.soul-tl-body{flex:1 1 auto;min-width:0;color:var(--soul-muted);word-break:break-word}
|
|
129
|
-
@supports not (color:var(--dsw-alias-label-primary)){.soul-app{--soul-fg:#241f18;--soul-muted:#6f6558;--soul-faint:#9a9084;--soul-line:#e0d7c8;--soul-line-soft:#ece5d8;--soul-bg:#fffdf8;--soul-bg2:#f6f2ea;--soul-brand:#1f6feb;--soul-ok:#2f6b46;--soul-warn:#8a6a2f;--soul-err:#a83a2c}}
|
|
130
|
-
</style>
|
|
130
|
+
@supports not (color:var(--dsw-alias-label-primary)){.soul-app{--soul-fg:#241f18;--soul-muted:#6f6558;--soul-faint:#9a9084;--soul-line:#e0d7c8;--soul-line-soft:#ece5d8;--soul-bg:#fffdf8;--soul-bg2:#f6f2ea;--soul-brand:#1f6feb;--soul-ok:#2f6b46;--soul-warn:#8a6a2f;--soul-err:#a83a2c}}</style>
|
|
131
131
|
</head>
|
|
132
132
|
<body>
|
|
133
133
|
<div class="pv-wrap">
|
package/lib/client/diary-tab.js
CHANGED
|
@@ -495,7 +495,7 @@
|
|
|
495
495
|
h(Card, { title: '最近日记', meta: '公开日记可直接看,私密日记不出服务器' },
|
|
496
496
|
data === null || data.length === 0
|
|
497
497
|
? h('div', { className: 'soul-empty' }, '还没有写过日记')
|
|
498
|
-
: h('div', { className: 'soul-list' }, data.map(function (item) {
|
|
498
|
+
: h('div', { className: 'soul-list soul-list-fixed' }, data.map(function (item) {
|
|
499
499
|
return h('div', { key: item.date, className: 'soul-item' },
|
|
500
500
|
h('div', { className: 'soul-item-text' },
|
|
501
501
|
h('div', { style: { display: 'flex', gap: 8, alignItems: 'center' } },
|
package/lib/client/memory-tab.js
CHANGED
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
|
|
116
116
|
records.length === 0
|
|
117
117
|
? h('div', { className: 'soul-empty' }, query ? '没搜到' : '还没有记忆。多聊几句,值得记的会自动进来')
|
|
118
|
-
: h('div', { className: 'soul-list' }, records.map(function (r) {
|
|
118
|
+
: h('div', { className: 'soul-list soul-list-fixed' }, records.map(function (r) {
|
|
119
119
|
return h('div', { key: r.id, className: 'soul-item' },
|
|
120
120
|
h(Badge, { clarity: r.clarity }, CLARITY_LABEL[r.clarity] || r.clarity),
|
|
121
121
|
h('div', { className: 'soul-item-text' },
|
package/lib/client/notes-tab.js
CHANGED
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
),
|
|
104
104
|
list.length === 0
|
|
105
105
|
? h('div', { className: 'soul-empty' }, '还没写过东西。等她在对话里想到什么,这里就会长出来')
|
|
106
|
-
: h('div', { className: 'soul-list' }, list.map(function (entry) {
|
|
106
|
+
: h('div', { className: 'soul-list soul-list-fixed' }, list.map(function (entry) {
|
|
107
107
|
return h('div', {
|
|
108
108
|
key: entry.slug,
|
|
109
109
|
className: 'soul-item',
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
h('p', { className: 'soul-note' }, '这些会出现在她的提示词里,但明确写了「不需要每轮都提」——所以不会变成复读。'),
|
|
29
29
|
(purpose.goals || []).length === 0
|
|
30
30
|
? h('div', { className: 'soul-empty' }, '暂时没有。她答应过的事、没弄明白的事会自动长出来')
|
|
31
|
-
: h('div', { className: 'soul-list' }, (purpose.goals || []).map(function (goal) {
|
|
31
|
+
: h('div', { className: 'soul-list soul-list-fixed' }, (purpose.goals || []).map(function (goal) {
|
|
32
32
|
return h('div', { key: goal.id, className: 'soul-item' },
|
|
33
33
|
h('span', { className: 'soul-badge' }, KIND_LABEL[goal.kind] || '想试试'),
|
|
34
34
|
h('div', { className: 'soul-item-text' },
|
package/lib/client/styles.js
CHANGED
|
@@ -61,6 +61,11 @@
|
|
|
61
61
|
'.soul-badge.trace{background:rgba(255,92,92,.14);color:#a83a2c}',
|
|
62
62
|
|
|
63
63
|
'.soul-list{display:flex;flex-direction:column;gap:6px;margin-top:8px}',
|
|
64
|
+
// 长列表自己滚(2026-11-09):日记 / 记忆 / 笔记 / 惦记的事条目一多,
|
|
65
|
+
// 整页被撑得很长,要划半天才能看到下一张卡片。这里给它们一个**有界高度**,
|
|
66
|
+
// 跟心情页时间线(.soul-tl)同样的做法。
|
|
67
|
+
// overscroll-behavior:contain —— 滚到底时不把滚动传给外层,免得整页突然跳走。
|
|
68
|
+
'.soul-list-fixed{max-height:min(46vh,420px);overflow:auto;overscroll-behavior:contain;padding-right:4px}',
|
|
64
69
|
'.soul-item{display:flex;gap:8px;align-items:flex-start;border:1px solid var(--soul-line-soft);border-radius:8px;padding:9px 10px;background:var(--soul-bg)}',
|
|
65
70
|
'.soul-item:hover{border-color:var(--soul-line)}',
|
|
66
71
|
'.soul-item-text{flex:1 1 auto;min-width:0;word-break:break-word}',
|
package/lib/client.js
CHANGED
|
@@ -87,6 +87,11 @@ window.__ModuleLoader__.load({
|
|
|
87
87
|
'.soul-badge.trace{background:rgba(255,92,92,.14);color:#a83a2c}',
|
|
88
88
|
|
|
89
89
|
'.soul-list{display:flex;flex-direction:column;gap:6px;margin-top:8px}',
|
|
90
|
+
// 长列表自己滚(2026-11-09):日记 / 记忆 / 笔记 / 惦记的事条目一多,
|
|
91
|
+
// 整页被撑得很长,要划半天才能看到下一张卡片。这里给它们一个**有界高度**,
|
|
92
|
+
// 跟心情页时间线(.soul-tl)同样的做法。
|
|
93
|
+
// overscroll-behavior:contain —— 滚到底时不把滚动传给外层,免得整页突然跳走。
|
|
94
|
+
'.soul-list-fixed{max-height:min(46vh,420px);overflow:auto;overscroll-behavior:contain;padding-right:4px}',
|
|
90
95
|
'.soul-item{display:flex;gap:8px;align-items:flex-start;border:1px solid var(--soul-line-soft);border-radius:8px;padding:9px 10px;background:var(--soul-bg)}',
|
|
91
96
|
'.soul-item:hover{border-color:var(--soul-line)}',
|
|
92
97
|
'.soul-item-text{flex:1 1 auto;min-width:0;word-break:break-word}',
|
|
@@ -1033,7 +1038,7 @@ window.__ModuleLoader__.load({
|
|
|
1033
1038
|
|
|
1034
1039
|
records.length === 0
|
|
1035
1040
|
? h('div', { className: 'soul-empty' }, query ? '没搜到' : '还没有记忆。多聊几句,值得记的会自动进来')
|
|
1036
|
-
: h('div', { className: 'soul-list' }, records.map(function (r) {
|
|
1041
|
+
: h('div', { className: 'soul-list soul-list-fixed' }, records.map(function (r) {
|
|
1037
1042
|
return h('div', { key: r.id, className: 'soul-item' },
|
|
1038
1043
|
h(Badge, { clarity: r.clarity }, CLARITY_LABEL[r.clarity] || r.clarity),
|
|
1039
1044
|
h('div', { className: 'soul-item-text' },
|
|
@@ -1198,7 +1203,7 @@ window.__ModuleLoader__.load({
|
|
|
1198
1203
|
h('p', { className: 'soul-note' }, '这些会出现在她的提示词里,但明确写了「不需要每轮都提」——所以不会变成复读。'),
|
|
1199
1204
|
(purpose.goals || []).length === 0
|
|
1200
1205
|
? h('div', { className: 'soul-empty' }, '暂时没有。她答应过的事、没弄明白的事会自动长出来')
|
|
1201
|
-
: h('div', { className: 'soul-list' }, (purpose.goals || []).map(function (goal) {
|
|
1206
|
+
: h('div', { className: 'soul-list soul-list-fixed' }, (purpose.goals || []).map(function (goal) {
|
|
1202
1207
|
return h('div', { key: goal.id, className: 'soul-item' },
|
|
1203
1208
|
h('span', { className: 'soul-badge' }, KIND_LABEL[goal.kind] || '想试试'),
|
|
1204
1209
|
h('div', { className: 'soul-item-text' },
|
|
@@ -2040,7 +2045,7 @@ window.__ModuleLoader__.load({
|
|
|
2040
2045
|
h(Card, { title: '最近日记', meta: '公开日记可直接看,私密日记不出服务器' },
|
|
2041
2046
|
data === null || data.length === 0
|
|
2042
2047
|
? h('div', { className: 'soul-empty' }, '还没有写过日记')
|
|
2043
|
-
: h('div', { className: 'soul-list' }, data.map(function (item) {
|
|
2048
|
+
: h('div', { className: 'soul-list soul-list-fixed' }, data.map(function (item) {
|
|
2044
2049
|
return h('div', { key: item.date, className: 'soul-item' },
|
|
2045
2050
|
h('div', { className: 'soul-item-text' },
|
|
2046
2051
|
h('div', { style: { display: 'flex', gap: 8, alignItems: 'center' } },
|
|
@@ -2228,7 +2233,7 @@ window.__ModuleLoader__.load({
|
|
|
2228
2233
|
),
|
|
2229
2234
|
list.length === 0
|
|
2230
2235
|
? h('div', { className: 'soul-empty' }, '还没写过东西。等她在对话里想到什么,这里就会长出来')
|
|
2231
|
-
: h('div', { className: 'soul-list' }, list.map(function (entry) {
|
|
2236
|
+
: h('div', { className: 'soul-list soul-list-fixed' }, list.map(function (entry) {
|
|
2232
2237
|
return h('div', {
|
|
2233
2238
|
key: entry.slug,
|
|
2234
2239
|
className: 'soul-item',
|
package/package.json
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* 把 lib/client/styles.js 的 CSS 同步进 docs/preview.html(2026-11-09)。
|
|
4
|
+
*
|
|
5
|
+
* 为什么需要它:preview.html 里 `.soul-*` 那一段是**手工复制**的样式产物。
|
|
6
|
+
* R15 加了 `tests/preview-css.test.js` 拦住「改了样式忘了同步」——但拦下来之后,
|
|
7
|
+
* 同步这件事仍然是手工的。这个脚本让它是**一条命令**。
|
|
8
|
+
*
|
|
9
|
+
* 用法:node tools/sync-preview.mjs
|
|
10
|
+
*/
|
|
11
|
+
import { readFileSync, writeFileSync } from 'node:fs'
|
|
12
|
+
import { dirname, join } from 'node:path'
|
|
13
|
+
import { fileURLToPath } from 'node:url'
|
|
14
|
+
|
|
15
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
|
|
16
|
+
|
|
17
|
+
// 1. 求值 CSS 数组(只跑数组字面量,不加载整个片段、不碰 DOM)
|
|
18
|
+
const stylesSrc = readFileSync(join(root, 'lib', 'client', 'styles.js'), 'utf8')
|
|
19
|
+
const arr = stylesSrc.match(/var CSS = \[([\s\S]*?)\]\s*\.join\(/)
|
|
20
|
+
if (arr === null) {
|
|
21
|
+
console.error('styles.js 里没找到 CSS 数组(正则失配,样式结构可能变了)')
|
|
22
|
+
process.exit(1)
|
|
23
|
+
}
|
|
24
|
+
// 注意:必须用普通字符串拼 "].join('\\n')" —— 写进模板字符串的话 \n 会变成真换行,
|
|
25
|
+
// 生成的代码就断了(我自己先踩了一次)。
|
|
26
|
+
const generated = new Function(`return [${arr[1]}].join('\\n')`)()
|
|
27
|
+
|
|
28
|
+
// 2. 替换 preview.html 里的插件段(从 .soul-app{ 到 </style> 之前)
|
|
29
|
+
const previewPath = join(root, 'docs', 'preview.html')
|
|
30
|
+
const preview = readFileSync(previewPath, 'utf8')
|
|
31
|
+
const styleStart = preview.indexOf('<style>')
|
|
32
|
+
const styleEnd = preview.indexOf('</style>')
|
|
33
|
+
if (styleStart < 0 || styleEnd <= styleStart) {
|
|
34
|
+
console.error('preview.html 里没找到 <style> 块')
|
|
35
|
+
process.exit(1)
|
|
36
|
+
}
|
|
37
|
+
const soulAt = preview.indexOf('.soul-app{', styleStart)
|
|
38
|
+
if (soulAt <= styleStart) {
|
|
39
|
+
console.error('preview.html 的 style 块里没有插件段(.soul-app{ 起始)')
|
|
40
|
+
process.exit(1)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// 行尾跟随原文件:Windows 检出是 CRLF,别把整份文件改成 LF
|
|
44
|
+
const eol = preview.includes('\r\n') ? '\r\n' : '\n'
|
|
45
|
+
const body = generated.split('\n').join(eol)
|
|
46
|
+
const next = preview.slice(0, soulAt) + body + preview.slice(styleEnd)
|
|
47
|
+
|
|
48
|
+
if (next === preview) {
|
|
49
|
+
console.log('preview.html 已经是最新的(无需改动)')
|
|
50
|
+
process.exit(0)
|
|
51
|
+
}
|
|
52
|
+
writeFileSync(previewPath, next, 'utf8')
|
|
53
|
+
console.log(`preview.html 已同步(插件 CSS 段 ${generated.length} 字符)`)
|