@restregular/dsh-memory 0.14.4 → 0.14.6
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 +13 -0
- package/README.md +1 -1
- package/lib/client.js +39 -15
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
本项目的版本记录。安装 id 与 npm 版本一一对应。
|
|
4
4
|
|
|
5
|
+
## 0.14.6 — 审计记忆 ID 跳转后自动展开并滚到目标记录
|
|
6
|
+
|
|
7
|
+
- **现象**:在审计详情里点某个记忆 ID,会切到记录页,但目标记录没有展开,看起来像没跳成功。
|
|
8
|
+
- **原因**:`openRecord` 只设置了 `focusRecord`,没有把目标记录滚进可视区;目标记录如果不在当前筛选/已加载结果里,列表里甚至没有这张卡,自然也无法展开。
|
|
9
|
+
- **修复**:`RecordCard` 在 `focus` 时先展开,再用 `scrollIntoView({block:'center'})` 把卡片滚到视口中央;`openRecord` 同时接收记录对象,目标不在当前列表时把它补到列表最前面,保证跳过去一定能看到并展开。
|
|
10
|
+
- 回归测试:带 `focus` 的记录卡自动展开。
|
|
11
|
+
|
|
12
|
+
## 0.14.5 — 修复记忆面板审计「在轨迹中定位」不生效
|
|
13
|
+
|
|
14
|
+
- **根因**:主面板把 `jumpAuditEntryToTrajectory`(签名是 `(entry) => Promise`)当成 `openTrajectory(focus)` 回调传给 `AuditTab`。按钮把 `callId` 字符串传进去,`jumpAuditEntryToTrajectory` 读不到 `entry.sessionId`,直接按 `no_session` 返回,实际什么都没发生;UI 还误报“已定位到轨迹”。
|
|
15
|
+
- **修复**:主面板不再传 `openTrajectory`,`AuditTab` 走模块内的 `jumpAuditEntryToTrajectory(selected)`:先 `openSession`,等 per-session store 可用后 `openView('trajectory', callId)`,Trajectory 会选中该记录并自动打开右侧详情面板。会话内「记忆」视图仍走 `openView` 回调,回调现在返回 `{opened, focused}`,提示文案按真实结果展示。
|
|
16
|
+
- 回归测试:主面板路径断言 `openSession('s1')` + `openView('trajectory','call-9')`。
|
|
17
|
+
|
|
5
18
|
## 0.14.4 — 轨迹行图标同时按 composer 上沿裁剪
|
|
6
19
|
|
|
7
20
|
- **根因**:0.14.3 只用 `_tablePane` 的底边做下界。Trajectory 的表格会一直延伸到浮动 composer 后面,`_tablePane` 的底边在 composer 下方;行滚到底部、被 composer 遮住时,fixed 图标仍在表格底边以内,所以继续显示。
|
package/README.md
CHANGED
|
@@ -377,7 +377,7 @@ DSH 自带的 Trajectory 面板是一个**纯投影**:它只声明 `conversati
|
|
|
377
377
|
|
|
378
378
|
- **轨迹 → 记忆审计**:Trajectory 的选中行带有 `data-trajectory-row-key`。注意它在 DOM 上经过 `encodeURIComponent`(工具行实际是 `tool%00call%00<callId>`),插件会先解码再取 callId。有审计的调用行左侧会显示产品年轮线条图标;选中行右侧另有「记忆 N」徽标,点击按 `op:<callId>` 打开审计。两者都会按轨迹滚动容器(扣除 sticky 表头与底部浮动 composer)裁剪,行滚出可视区后被遮住时不会残留。
|
|
379
379
|
- **轨迹详情页签**:点击轨迹里的任意记录后,右侧详情面板的页签行会多出一个「记忆审计」页签(用 `shell.overlay` 贴着详情面板,不改轨迹的 React 树)。它展示该记录 callId 对应的审计事件,底部按钮直接打开本会话的记忆审计面板;没有 callId 的记录明确提示无法精确过滤。
|
|
380
|
-
- **记忆审计 → 轨迹**:审计详情里的「在轨迹中定位」把条目上的 `operationId`(记忆工具调用、触发召回的工具调用)交给 Trajectory 的 `openView('trajectory', callId)
|
|
380
|
+
- **记忆审计 → 轨迹**:审计详情里的「在轨迹中定位」把条目上的 `operationId`(记忆工具调用、触发召回的工具调用)交给 Trajectory 的 `openView('trajectory', callId)`;主面板会先打开会话,再切换轨迹并选中该记录,右侧详情面板自动打开。没有 `operationId` 的按轮/步事件先请求 `/anchor`,由 Host 从会话事件窗口里找该 turn/step 的第一个 `tool/call`;找不到就只切到轨迹页,不伪造定位。
|
|
381
381
|
- **会话内的「记忆」视图**:与 Chat / 轨迹同一个 view ring,按当前会话展示审计;它直接使用宿主传给每个 view 的 `openView`,因此跳转是官方支持路径。它声明 `data-conversation-composer-overlay` 让壳层压住外层滚动,审计列表在自己的滚动容器里滚动,外层界面不需要跟着滚。主面板不在 view ring 内,通过 `conversation.session` 注册的 per-session store 调同一个 action;拿不到时退化为打开会话/轨迹页。
|
|
382
382
|
- 记忆工具调用(`memory_save/search/list/get/forget`)本身会额外留一条 `stage: tool_call` 的审计锚点:即使自动召回关闭,也能从这条记录精确跳回轨迹里的那次调用。
|
|
383
383
|
|
package/lib/client.js
CHANGED
|
@@ -796,7 +796,18 @@ window.__ModuleLoader__.load({
|
|
|
796
796
|
const [copied, setCopied] = React.useState(false)
|
|
797
797
|
|
|
798
798
|
// 从审计页点 memory ID 跳过来时自动展开目标记录。
|
|
799
|
-
|
|
799
|
+
// 记录列表可能很长,展开后还要把它滚进视口,否则用户看到的是列表顶部。
|
|
800
|
+
const cardRef = React.useRef(null)
|
|
801
|
+
React.useEffect(() => {
|
|
802
|
+
if (!focus) return undefined
|
|
803
|
+
setExpanded(true)
|
|
804
|
+
const node = cardRef.current
|
|
805
|
+
if (node === null || typeof node.scrollIntoView !== 'function') return undefined
|
|
806
|
+
const timer = setTimeout(() => {
|
|
807
|
+
try { node.scrollIntoView({ block: 'center', behavior: 'smooth' }) } catch { /* 滚动失败不影响展开 */ }
|
|
808
|
+
}, 60)
|
|
809
|
+
return () => clearTimeout(timer)
|
|
810
|
+
}, [focus])
|
|
800
811
|
|
|
801
812
|
const copyId = () => {
|
|
802
813
|
try {
|
|
@@ -837,7 +848,7 @@ window.__ModuleLoader__.load({
|
|
|
837
848
|
setTags(rec.tags.join(', ')); setImportance(rec.importance)
|
|
838
849
|
}
|
|
839
850
|
|
|
840
|
-
return h('div', { className: 'rec' + (focus ? ' focus' : '') },
|
|
851
|
+
return h('div', { className: 'rec' + (focus ? ' focus' : ''), ref: cardRef },
|
|
841
852
|
h('div', {
|
|
842
853
|
className: 'rec-head',
|
|
843
854
|
role: 'button',
|
|
@@ -2687,7 +2698,7 @@ window.__ModuleLoader__.load({
|
|
|
2687
2698
|
const openMemoryId = async (id) => {
|
|
2688
2699
|
const record = findRecord(id) || await fetchRecord(id)
|
|
2689
2700
|
hideTip()
|
|
2690
|
-
if (typeof openRecord === 'function') openRecord(record?.id ?? id, record?.scope)
|
|
2701
|
+
if (typeof openRecord === 'function') openRecord(record?.id ?? id, record?.scope, record)
|
|
2691
2702
|
}
|
|
2692
2703
|
const openSessionId = (id) => {
|
|
2693
2704
|
hideTip()
|
|
@@ -2914,8 +2925,11 @@ window.__ModuleLoader__.load({
|
|
|
2914
2925
|
try {
|
|
2915
2926
|
const focus = await resolveAuditFocus(selected)
|
|
2916
2927
|
if (typeof openTrajectory === 'function') {
|
|
2917
|
-
openTrajectory(focus)
|
|
2918
|
-
|
|
2928
|
+
const result = await openTrajectory(focus, selected)
|
|
2929
|
+
if (result && result.focused === true) setFocusNotice('已定位到轨迹')
|
|
2930
|
+
else if (result && result.opened === true) setFocusNotice('已切到轨迹页(未找到精确锚点)')
|
|
2931
|
+
else if (result === undefined) setFocusNotice(focus === undefined ? '已切到轨迹页(这条没有精确锚点)' : '已定位到轨迹')
|
|
2932
|
+
else setFocusNotice('定位失败')
|
|
2919
2933
|
return
|
|
2920
2934
|
}
|
|
2921
2935
|
const result = await jumpAuditEntryToTrajectory(selected)
|
|
@@ -3137,7 +3151,7 @@ window.__ModuleLoader__.load({
|
|
|
3137
3151
|
/** 待嵌入自动刷新:最多 300 次 × 1.5s(后端挂着时不无限轮询)。 */
|
|
3138
3152
|
const PENDING_POLL_LIMIT = 300
|
|
3139
3153
|
|
|
3140
|
-
function MemoryPanel({ openSession, sessionInfo,
|
|
3154
|
+
function MemoryPanel({ openSession, sessionInfo, audience = 'panel', lockSession } = {}) {
|
|
3141
3155
|
const [records, setRecords] = React.useState([])
|
|
3142
3156
|
const [scopes, setScopes] = React.useState([])
|
|
3143
3157
|
const [embedServer, setEmbedServer] = React.useState(null)
|
|
@@ -3152,6 +3166,7 @@ window.__ModuleLoader__.load({
|
|
|
3152
3166
|
const [semantic, setSemantic] = React.useState(false)
|
|
3153
3167
|
const [searchInfo, setSearchInfo] = React.useState(null)
|
|
3154
3168
|
const [focusRecord, setFocusRecord] = React.useState(null)
|
|
3169
|
+
const [focusRecordData, setFocusRecordData] = React.useState(null)
|
|
3155
3170
|
const [loading, setLoading] = React.useState(true)
|
|
3156
3171
|
const [error, setError] = React.useState('')
|
|
3157
3172
|
const [tab, setTab] = React.useState('data')
|
|
@@ -3209,8 +3224,11 @@ window.__ModuleLoader__.load({
|
|
|
3209
3224
|
React.useEffect(() => { load('', '') }, [])
|
|
3210
3225
|
|
|
3211
3226
|
/** 审计里的记忆 ID → 切到「记录」页并展开对应记录。 */
|
|
3212
|
-
const openRecord = (id, scope) => {
|
|
3227
|
+
const openRecord = (id, scope, record = null) => {
|
|
3213
3228
|
setFocusRecord(id)
|
|
3229
|
+
// 目标记录可能不在当前筛选结果里(作用域/搜索/分页),先把它拿在手上,
|
|
3230
|
+
// 列表里没有时补一张卡,保证跳过去一定能展开。
|
|
3231
|
+
setFocusRecordData(record && record.id ? record : null)
|
|
3214
3232
|
setTab('data')
|
|
3215
3233
|
setQ('')
|
|
3216
3234
|
// 语义模式是按查询排名的:跳转要看到那条记录,必须回到普通列表。
|
|
@@ -3565,12 +3583,17 @@ window.__ModuleLoader__.load({
|
|
|
3565
3583
|
})
|
|
3566
3584
|
: null
|
|
3567
3585
|
const emptyText = searchInfo ? '没有语义相关的记忆' : filtering ? '没有匹配的记忆' : '还没有记忆'
|
|
3568
|
-
|
|
3586
|
+
// 从审计跳过来的目标记录如果不在当前加载结果里,先把它补到列表最前面,
|
|
3587
|
+
// 否则跳转后列表里根本没有这张卡,focus 自然也无法展开。
|
|
3588
|
+
const displayRecords = focusRecordData !== null && !records.some((rec) => rec.id === focusRecordData.id)
|
|
3589
|
+
? [focusRecordData, ...records]
|
|
3590
|
+
: records
|
|
3591
|
+
const listBody = !loading && !error && displayRecords.length === 0
|
|
3569
3592
|
? h('div', { className: 'empty' },
|
|
3570
3593
|
emptyText,
|
|
3571
3594
|
searchInfo ? h('div', { className: 'muted' }, '换个说法试试;刚写入的记录可能还没嵌入向量。') : null)
|
|
3572
3595
|
: h('div', { className: 'list' },
|
|
3573
|
-
|
|
3596
|
+
displayRecords.map((rec) => h(RecordCard, { key: rec.id, rec, score: rec.score, focus: focusRecord === rec.id, vectorOn: configured && vectorEnabled, labels: labels, onSaved: () => { setPendingTick(0); load() }, onDeleted: () => { setPendingTick(0); load() } })))
|
|
3574
3597
|
|
|
3575
3598
|
// 服务页底部:一句号召 + 两个外链(Star / issue)。放在内容最后,不打扰上面的状态卡。
|
|
3576
3599
|
const footer = h('div', { className: 'footer' },
|
|
@@ -3625,7 +3648,6 @@ window.__ModuleLoader__.load({
|
|
|
3625
3648
|
sessionInfo,
|
|
3626
3649
|
audience,
|
|
3627
3650
|
lockSession,
|
|
3628
|
-
openTrajectory,
|
|
3629
3651
|
})
|
|
3630
3652
|
: overviewBody,
|
|
3631
3653
|
)
|
|
@@ -3641,8 +3663,12 @@ window.__ModuleLoader__.load({
|
|
|
3641
3663
|
function MemoryAuditView({ sessionId, openView, sessionInfo }) {
|
|
3642
3664
|
const openTrajectory = (focus) => {
|
|
3643
3665
|
try {
|
|
3644
|
-
if (typeof openView === 'function')
|
|
3666
|
+
if (typeof openView === 'function') {
|
|
3667
|
+
openView('trajectory', focus)
|
|
3668
|
+
return { opened: true, focused: focus !== undefined }
|
|
3669
|
+
}
|
|
3645
3670
|
} catch { /* 视图不可用时保持在本页 */ }
|
|
3671
|
+
return { opened: false, focused: false }
|
|
3646
3672
|
}
|
|
3647
3673
|
return h('div', {
|
|
3648
3674
|
className: 'memp mem-view',
|
|
@@ -4148,10 +4174,10 @@ window.__ModuleLoader__.load({
|
|
|
4148
4174
|
const inject = ['slots']
|
|
4149
4175
|
|
|
4150
4176
|
/** 侧栏入口打开的主界面页面(整块可滚动,内容就是面板本体)。 */
|
|
4151
|
-
function MemoryPage({ openSession, sessionInfo
|
|
4177
|
+
function MemoryPage({ openSession, sessionInfo } = {}) {
|
|
4152
4178
|
return h('div', { className: 'mem-page' },
|
|
4153
4179
|
h('div', { className: 'mem-page-head' }, h('h2', null, '记忆系统')),
|
|
4154
|
-
h(MemoryPanel, { openSession, sessionInfo,
|
|
4180
|
+
h(MemoryPanel, { openSession, sessionInfo, audience: 'panel' }),
|
|
4155
4181
|
)
|
|
4156
4182
|
}
|
|
4157
4183
|
|
|
@@ -4232,7 +4258,6 @@ window.__ModuleLoader__.load({
|
|
|
4232
4258
|
openSession,
|
|
4233
4259
|
sessionInfo,
|
|
4234
4260
|
audience: 'panel',
|
|
4235
|
-
openTrajectory: jumpAuditEntryToTrajectory,
|
|
4236
4261
|
}),
|
|
4237
4262
|
))
|
|
4238
4263
|
|
|
@@ -4255,7 +4280,6 @@ window.__ModuleLoader__.load({
|
|
|
4255
4280
|
slots.inject('main', () => slots.register({ name: 'main', key: 'memory' }, () => React.createElement(MemoryPage, {
|
|
4256
4281
|
openSession,
|
|
4257
4282
|
sessionInfo,
|
|
4258
|
-
openTrajectory: jumpAuditEntryToTrajectory,
|
|
4259
4283
|
}))),
|
|
4260
4284
|
slots.inject('sidebar.panellist', () => slots.register(
|
|
4261
4285
|
{ name: 'sidebar.panellist', id: 'memory', order: 20, label: () => NAV_LABEL },
|