dsh-brief-sidebar 0.9.11 → 0.9.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.md +1 -1
- package/dsh.plugin.json +2 -2
- package/lib/client.js +24 -4
- package/lib/client.js.map +1 -1
- package/package.json +4 -4
- package/src/client/memory-viewer/viewer.tsx +35 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-brief-sidebar",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.13",
|
|
4
4
|
"description": "DSH web plugin (dsh-better-sidebar consumer): render the session brief — the todo list (the `todos` projection board) plus the artifact list (a live produced-files feed, codeplan artifacts marked) — as a summary tab in the right sidebar, and shadow the official composer-band todo panel so the board is the single visible carrier. Read-only.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.mjs",
|
|
@@ -63,14 +63,14 @@
|
|
|
63
63
|
},
|
|
64
64
|
"engines": {
|
|
65
65
|
"node": ">=20",
|
|
66
|
-
"dsh": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2"
|
|
66
|
+
"dsh": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"@deepseek-ai/cordis": "^4.0.2 || ^4.0.4",
|
|
70
|
-
"@deepseek-ai/dsh-client-locale": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2",
|
|
70
|
+
"@deepseek-ai/dsh-client-locale": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1",
|
|
71
71
|
"dsh-better-sidebar": ">=0.18.1",
|
|
72
72
|
"react": "^18.2.0",
|
|
73
|
-
"@deepseek-ai/dsh-system-prompt": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2"
|
|
73
|
+
"@deepseek-ai/dsh-system-prompt": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1"
|
|
74
74
|
},
|
|
75
75
|
"peerDependenciesMeta": {
|
|
76
76
|
"@deepseek-ai/dsh-client-locale": {
|
|
@@ -31,6 +31,26 @@ interface Props {
|
|
|
31
31
|
scope: { sessionId?: string }
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/** 宿主 RPC 信封:失败分支的 `error` 是 `{code,message,details}` **对象**,不是字符串。 */
|
|
35
|
+
interface RecordsMetaEnvelope {
|
|
36
|
+
ok?: boolean
|
|
37
|
+
value?: { items?: RecordMeta[] }
|
|
38
|
+
error?: { code?: string; message?: string } | string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 把失败信封说成人话。
|
|
43
|
+
*
|
|
44
|
+
* 直接把 `error` 当字符串拼进模板会得到 `⚠️ [object Object]`——用户看不到原因,
|
|
45
|
+
* 排查只能靠猜。取 `error.message`,拿不到才给兜底文案。
|
|
46
|
+
*/
|
|
47
|
+
function describeEnvelopeError(env: RecordsMetaEnvelope): string {
|
|
48
|
+
const e = env.error
|
|
49
|
+
if (typeof e === 'string' && e.length > 0) return e
|
|
50
|
+
if (e !== null && typeof e === 'object' && typeof e.message === 'string' && e.message.length > 0) return e.message
|
|
51
|
+
return '未找到该记忆'
|
|
52
|
+
}
|
|
53
|
+
|
|
34
54
|
/* ── Styles (all --dsw-alias-* tokens) ── */
|
|
35
55
|
const WRAP: CSSProperties = { padding: '12px 16px', overflow: 'auto', height: '100%', fontSize: 13, lineHeight: 1.6, color: 'var(--dsw-alias-label-primary)' }
|
|
36
56
|
const HEADER: CSSProperties = { marginBottom: 12, paddingBottom: 8, borderBottom: '1px solid var(--dsw-alias-border-secondary)' }
|
|
@@ -95,6 +115,9 @@ export function MemoryViewer(props: Props): ReactNode {
|
|
|
95
115
|
const [error, setError] = useState<string | undefined>(undefined)
|
|
96
116
|
|
|
97
117
|
useEffect(() => {
|
|
118
|
+
// 空 id 不发请求:`{ids:['']}` 会被服务端拒为“ids 过滤后为空”,
|
|
119
|
+
// 把“重启后 tab 先于选择恢复”这个正常空态误报成错误。
|
|
120
|
+
if (memoryId.length === 0) return
|
|
98
121
|
let cancelled = false
|
|
99
122
|
setError(undefined)
|
|
100
123
|
fetch('/dsh-memory/rpc/records-meta', {
|
|
@@ -102,24 +125,28 @@ export function MemoryViewer(props: Props): ReactNode {
|
|
|
102
125
|
headers: { 'Content-Type': 'application/json' },
|
|
103
126
|
body: JSON.stringify({ ids: [memoryId] }),
|
|
104
127
|
})
|
|
105
|
-
.then(r =>
|
|
106
|
-
|
|
128
|
+
.then(async (r) => {
|
|
129
|
+
if (!r.ok) throw new Error(`HTTP ${r.status}`)
|
|
130
|
+
return (await r.json()) as RecordsMetaEnvelope
|
|
131
|
+
})
|
|
132
|
+
.then((env: RecordsMetaEnvelope) => {
|
|
107
133
|
if (cancelled) return
|
|
108
|
-
|
|
109
|
-
|
|
134
|
+
const first = env.ok === true ? env.value?.items?.[0] : undefined
|
|
135
|
+
if (first !== undefined) { setRecord(first); return }
|
|
136
|
+
setError(describeEnvelopeError(env))
|
|
110
137
|
})
|
|
111
138
|
.catch((e: unknown) => { if (!cancelled) setError(e instanceof Error ? e.message : String(e)) })
|
|
112
139
|
return () => { cancelled = true }
|
|
113
140
|
}, [memoryId])
|
|
114
141
|
|
|
115
|
-
if (error !== undefined) {
|
|
116
|
-
return createElement('div', { style: WRAP },
|
|
117
|
-
createElement('div', { style: PLACEHOLDER }, `⚠️ ${error}`))
|
|
118
|
-
}
|
|
119
142
|
if (memoryId.length === 0) {
|
|
120
143
|
return createElement('div', { style: WRAP },
|
|
121
144
|
createElement('div', { style: PLACEHOLDER }, '未在本轮启动周期选择查看的记忆'))
|
|
122
145
|
}
|
|
146
|
+
if (error !== undefined) {
|
|
147
|
+
return createElement('div', { style: WRAP },
|
|
148
|
+
createElement('div', { style: PLACEHOLDER }, `⚠️ ${error}`))
|
|
149
|
+
}
|
|
123
150
|
if (record === undefined) {
|
|
124
151
|
return createElement('div', { style: WRAP },
|
|
125
152
|
createElement('div', { style: PLACEHOLDER }, '加载中…'))
|