@restregular/dsh-memory 0.12.6 → 0.12.7
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 -0
- package/lib/client.js +55 -31
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
本项目的版本记录。安装 id 与 npm 版本一一对应。
|
|
4
4
|
|
|
5
|
+
## 0.12.7 — 审计详情滚动与锚定浮窗
|
|
6
|
+
|
|
7
|
+
- **详情底部不再被裁切**:审计页高度收紧到 `100vh - 210px`;详情面板改为 `height:auto` +
|
|
8
|
+
`max-height:calc(100vh - 340px)` + `overflow-y:auto`,并加 20px 底部内边距;「原始结构化事件」
|
|
9
|
+
等底部内容可以完整滚入视口。
|
|
10
|
+
- **浮窗不再跟随鼠标**:浮窗改为根据 ID 气泡的 `getBoundingClientRect()` 固定定位(下方优先,
|
|
11
|
+
空间不足自动翻到上方),不再随 mousemove 移动。
|
|
12
|
+
- **hover 延迟 + 可移入浮窗**:进入 ID 气泡后等待 350ms 才显示;显示后鼠标移到浮窗内不会隐藏,
|
|
13
|
+
离开气泡/浮窗 220ms 后隐藏;不再需要重新 hover 才能看到完整 ID(浮窗标题/内容已含完整 ID)。
|
|
14
|
+
- 浮窗改为 `pointer-events:auto` 且可滚动,长正文可以直接在浮窗内查看/滚动。
|
|
15
|
+
- **点击直接跳转**:点击 ID 气泡或浮窗本身都直接执行跳转(记忆 → 记录页并展开,会话 → 打开会话)。
|
|
16
|
+
- 测试更新:hover 延迟后显示完整 ID、记忆原文/会话标题,点击回调仍正确。
|
|
17
|
+
|
|
5
18
|
## 0.12.6 — 审计详情分类、滚动与关联跳转
|
|
6
19
|
|
|
7
20
|
- **详情完整可滚动**:审计页采用固定视口高度 + `grid-template-rows:minmax(0,1fr)`,详情面板 `height:100%` 独立滚动,长内容可以滚到底部;整页不滚动。
|
package/README.md
CHANGED
|
@@ -415,6 +415,7 @@ npm run verify # 构建到 .verify/,不落 packages/
|
|
|
415
415
|
|
|
416
416
|
## 更新日志
|
|
417
417
|
|
|
418
|
+
- **0.12.7** —— 审计详情可完整滚到底;ID 浮窗改为按气泡位置固定显示,延迟 hover 显示、可移入浮窗,点击气泡或浮窗都直接跳转。
|
|
418
419
|
- **0.12.6** —— 审计详情分类展示选中/新增/标签/省略/去重 ID;记忆与会话 ID 支持 hover 浮窗和点击跳转;详情独立滚动可到底。
|
|
419
420
|
- **0.12.5** —— 审计表头移入滚动容器并 sticky,与行严格对齐;重分配列宽,行内预算改紧凑条。
|
|
420
421
|
- **0.12.4** —— 审计页默认每 0.5 秒自动刷新(可关/可调间隔);移除顶部标题与气泡,整页固定在窗口内,仅列表滚动;新增表头并优化列宽;复制/导出提示就地显示。
|
package/lib/client.js
CHANGED
|
@@ -335,7 +335,7 @@ window.__ModuleLoader__.load({
|
|
|
335
335
|
'.memp .td-rel-text{color:var(--dsw-alias-label-secondary);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-break:break-word}',
|
|
336
336
|
'@media (max-width:620px){.memp .tree-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.memp .tree-toolbar input[type=text]{max-width:none}}',
|
|
337
337
|
// ===== 审计 =====
|
|
338
|
-
'.memp .audit{display:flex;flex-direction:column;gap:10px;min-height:0;height:calc(100vh -
|
|
338
|
+
'.memp .audit{display:flex;flex-direction:column;gap:10px;min-height:0;height:calc(100vh - 210px);max-height:calc(100vh - 210px);overflow:hidden}',
|
|
339
339
|
'.memp .audit-head{display:flex;align-items:flex-start;gap:12px;flex-wrap:wrap}',
|
|
340
340
|
'.memp .audit-title{font-size:16px;font-weight:650;line-height:1.35}',
|
|
341
341
|
'.memp .audit-sub{font-size:11.5px;color:var(--dsw-alias-label-secondary);line-height:1.55;margin-top:2px}',
|
|
@@ -385,7 +385,7 @@ window.__ModuleLoader__.load({
|
|
|
385
385
|
'.memp .audit-pill.bad{color:var(--dsw-alias-label-danger, #e05555);border-color:color-mix(in srgb,var(--dsw-alias-label-danger, #e05555) 42%,var(--dsw-alias-border-l1))}',
|
|
386
386
|
'.memp .audit-pill.mute{color:var(--dsw-alias-label-secondary)}',
|
|
387
387
|
'.memp .audit-empty{border:1px dashed var(--dsw-alias-border-l1);border-radius:10px;padding:26px 16px;text-align:center;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.65}',
|
|
388
|
-
'.memp .audit-detail{border:1px solid var(--dsw-alias-border-l1);border-radius:11px;background:var(--dsw-alias-bg-layer-1);padding:10px 11px;display:flex;flex-direction:column;gap:9px;height:
|
|
388
|
+
'.memp .audit-detail{border:1px solid var(--dsw-alias-border-l1);border-radius:11px;background:var(--dsw-alias-bg-layer-1);padding:10px 11px 20px;box-sizing:border-box;display:flex;flex-direction:column;gap:9px;height:auto;max-height:calc(100vh - 340px);min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}',
|
|
389
389
|
'.memp .audit-detail-head{display:flex;gap:7px;align-items:center}',
|
|
390
390
|
'.memp .audit-detail-head b{font-size:12.5px}',
|
|
391
391
|
'.memp .audit-detail-head .spacer{flex:1}',
|
|
@@ -416,15 +416,15 @@ window.__ModuleLoader__.load({
|
|
|
416
416
|
'.memp .audit-id-group-title{display:flex;align-items:center;gap:6px;font-size:10.5px;color:var(--dsw-alias-label-secondary);letter-spacing:.02em}',
|
|
417
417
|
'.memp .audit-id-group-title b{font-weight:600;color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums}',
|
|
418
418
|
'.memp .audit-id-sub{font-size:9.5px;color:var(--dsw-alias-label-secondary);opacity:.85}',
|
|
419
|
-
'.memp .audit-tip{position:fixed;z-index:120;max-width:min(380px,calc(100vw - 24px));max-height:min(300px,60vh);overflow:
|
|
419
|
+
'.memp .audit-tip{position:fixed;z-index:120;max-width:min(380px,calc(100vw - 24px));max-height:min(300px,60vh);overflow:auto;padding:9px 10px;border:1px solid var(--dsw-alias-border-l2,var(--dsw-alias-border-l1));border-radius:10px;background:color-mix(in srgb,var(--dsw-alias-bg-layer-1) 97%,black 3%);box-shadow:0 14px 36px rgba(0,0,0,.28);pointer-events:auto;cursor:pointer;color:var(--dsw-alias-label-primary)}',
|
|
420
420
|
'.memp .audit-tip-head{display:flex;align-items:center;gap:6px;margin-bottom:5px;font-size:11px;color:var(--dsw-alias-label-secondary)}',
|
|
421
421
|
'.memp .audit-tip-title{font-weight:600;color:var(--dsw-alias-label-primary);font-size:11.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}',
|
|
422
422
|
'.memp .audit-tip-meta{display:flex;flex-wrap:wrap;gap:4px;margin-bottom:5px}',
|
|
423
|
-
'.memp .audit-tip-content{font-size:11px;line-height:1.55;white-space:pre-wrap;word-break:break-word;color:var(--dsw-alias-label-primary);max-height:
|
|
423
|
+
'.memp .audit-tip-content{font-size:11px;line-height:1.55;white-space:pre-wrap;word-break:break-word;color:var(--dsw-alias-label-primary);max-height:none;overflow:visible}',
|
|
424
424
|
'.memp .audit-tip-foot{margin-top:6px;font-size:9.5px;color:var(--dsw-alias-label-secondary)}',
|
|
425
425
|
'.memp .rec.focus{border-color:var(--dsw-alias-brand-primary);box-shadow:0 0 0 1px color-mix(in srgb,var(--dsw-alias-brand-primary) 25%,transparent)}',
|
|
426
426
|
'@media (max-width:900px){.memp .audit-split.has-detail{grid-template-columns:minmax(0,1fr)}.memp .audit-row{grid-template-columns:54px 120px 120px minmax(100px,1fr) 96px 100px 80px}.memp .audit-table-head{grid-template-columns:54px 120px 120px minmax(100px,1fr) 96px 100px 80px}}',
|
|
427
|
-
'@media (max-width:620px){.memp .audit-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.memp .audit-table-head{display:none}.memp .audit-row{display:flex;flex-wrap:wrap;gap:4px 8px}.memp .audit-row .col-trigger,.memp .audit-row .col-budget{display:none}.memp .audit-row .col-nums{margin-left:auto}.memp .audit-row .col-time{order:1}.memp .audit-row .col-channel{order:2}.memp .audit-row .col-delivery{order:3}.memp .audit-row .col-outcome{order:4;margin-left:auto}.memp .audit-filter-row input[type=text],.memp .audit-filter-row input[type=search]{max-width:none;flex:1}.memp .audit{height:calc(100vh -
|
|
427
|
+
'@media (max-width:620px){.memp .audit-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.memp .audit-table-head{display:none}.memp .audit-row{display:flex;flex-wrap:wrap;gap:4px 8px}.memp .audit-row .col-trigger,.memp .audit-row .col-budget{display:none}.memp .audit-row .col-nums{margin-left:auto}.memp .audit-row .col-time{order:1}.memp .audit-row .col-channel{order:2}.memp .audit-row .col-delivery{order:3}.memp .audit-row .col-outcome{order:4;margin-left:auto}.memp .audit-filter-row input[type=text],.memp .audit-filter-row input[type=search]{max-width:none;flex:1}.memp .audit{height:calc(100vh - 150px);max-height:calc(100vh - 150px)}.memp .audit-detail{max-height:calc(100vh - 280px)}}',
|
|
428
428
|
].join('')
|
|
429
429
|
|
|
430
430
|
async function api(method, body) {
|
|
@@ -2173,6 +2173,8 @@ window.__ModuleLoader__.load({
|
|
|
2173
2173
|
const [reloadTick, setReloadTick] = React.useState(0)
|
|
2174
2174
|
const [tip, setTip] = React.useState(null)
|
|
2175
2175
|
const [recordCache, setRecordCache] = React.useState({})
|
|
2176
|
+
const tipTimer = React.useRef(null)
|
|
2177
|
+
const hideTimer = React.useRef(null)
|
|
2176
2178
|
|
|
2177
2179
|
function queryParams(cursorValue) {
|
|
2178
2180
|
const params = new URLSearchParams()
|
|
@@ -2257,32 +2259,55 @@ window.__ModuleLoader__.load({
|
|
|
2257
2259
|
return undefined
|
|
2258
2260
|
}
|
|
2259
2261
|
}
|
|
2260
|
-
const
|
|
2262
|
+
const clearTipTimers = () => {
|
|
2263
|
+
if (tipTimer.current !== null) { clearTimeout(tipTimer.current); tipTimer.current = null }
|
|
2264
|
+
if (hideTimer.current !== null) { clearTimeout(hideTimer.current); hideTimer.current = null }
|
|
2265
|
+
}
|
|
2266
|
+
React.useEffect(() => () => clearTipTimers(), [])
|
|
2267
|
+
const positionForAnchor = (element) => {
|
|
2261
2268
|
const width = typeof window !== 'undefined' ? window.innerWidth : 1200
|
|
2262
2269
|
const height = typeof window !== 'undefined' ? window.innerHeight : 800
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2270
|
+
const rect = element && typeof element.getBoundingClientRect === 'function' ? element.getBoundingClientRect() : null
|
|
2271
|
+
if (rect === null) return { x: 12, y: 12 }
|
|
2272
|
+
const tipWidth = Math.min(380, width - 24)
|
|
2273
|
+
const tipHeight = 240
|
|
2274
|
+
const x = Math.max(12, Math.min(rect.left, width - tipWidth - 12))
|
|
2275
|
+
let y = rect.bottom + 8
|
|
2276
|
+
if (y + tipHeight > height - 12) y = Math.max(12, rect.top - tipHeight - 8)
|
|
2277
|
+
return { x, y }
|
|
2278
|
+
}
|
|
2279
|
+
const scheduleTip = (build, element) => {
|
|
2280
|
+
clearTipTimers()
|
|
2281
|
+
if (tip !== null && tip.id !== build().id) setTip(null)
|
|
2282
|
+
tipTimer.current = setTimeout(() => {
|
|
2283
|
+
tipTimer.current = null
|
|
2284
|
+
setTip({ ...build(), ...positionForAnchor(element) })
|
|
2285
|
+
}, 350)
|
|
2286
|
+
}
|
|
2287
|
+
const cancelHideTip = () => {
|
|
2288
|
+
if (hideTimer.current !== null) { clearTimeout(hideTimer.current); hideTimer.current = null }
|
|
2267
2289
|
}
|
|
2268
|
-
const
|
|
2269
|
-
if (
|
|
2270
|
-
|
|
2290
|
+
const scheduleHideTip = () => {
|
|
2291
|
+
if (tipTimer.current !== null) { clearTimeout(tipTimer.current); tipTimer.current = null }
|
|
2292
|
+
cancelHideTip()
|
|
2293
|
+
hideTimer.current = setTimeout(() => { hideTimer.current = null; setTip(null) }, 220)
|
|
2271
2294
|
}
|
|
2272
|
-
const hideTip = () => setTip(null)
|
|
2273
|
-
const showMemoryTip = (id,
|
|
2274
|
-
const pos = tipPosition(event)
|
|
2295
|
+
const hideTip = () => { clearTipTimers(); setTip(null) }
|
|
2296
|
+
const showMemoryTip = (id, element) => {
|
|
2275
2297
|
const known = findRecord(id)
|
|
2276
|
-
|
|
2298
|
+
const box = { record: known }
|
|
2299
|
+
scheduleTip(() => ({ type: 'memory', id, record: box.record, loading: box.record === undefined }), element)
|
|
2277
2300
|
if (known === undefined) {
|
|
2278
2301
|
fetchRecord(id).then((record) => {
|
|
2279
|
-
if (record
|
|
2302
|
+
if (record === undefined) return
|
|
2303
|
+
box.record = record
|
|
2304
|
+
setTip((prev) => prev !== null && prev.id === id ? { ...prev, record, loading: false } : prev)
|
|
2280
2305
|
})
|
|
2281
2306
|
}
|
|
2282
2307
|
}
|
|
2283
|
-
const showSessionTip = (id,
|
|
2308
|
+
const showSessionTip = (id, element) => {
|
|
2284
2309
|
const summary = typeof sessionInfo === 'function' ? (() => { try { return sessionInfo(id) } catch { return undefined } })() : undefined
|
|
2285
|
-
|
|
2310
|
+
scheduleTip(() => ({ type: 'session', id, summary }), element)
|
|
2286
2311
|
}
|
|
2287
2312
|
const openMemoryId = async (id) => {
|
|
2288
2313
|
const record = findRecord(id) || await fetchRecord(id)
|
|
@@ -2296,10 +2321,9 @@ window.__ModuleLoader__.load({
|
|
|
2296
2321
|
const idChip = (id, tone = '', title = undefined) => h('button', {
|
|
2297
2322
|
key: `${tone}:${id}`,
|
|
2298
2323
|
className: 'audit-id' + (tone ? ` ${tone}` : ''),
|
|
2299
|
-
|
|
2300
|
-
onMouseEnter: (event) => showMemoryTip(id, event),
|
|
2301
|
-
|
|
2302
|
-
onMouseLeave: hideTip,
|
|
2324
|
+
'aria-label': title || id,
|
|
2325
|
+
onMouseEnter: (event) => showMemoryTip(id, event.currentTarget),
|
|
2326
|
+
onMouseLeave: scheduleHideTip,
|
|
2303
2327
|
onClick: () => openMemoryId(id),
|
|
2304
2328
|
}, id.length > 12 ? `${id.slice(0, 8)}…${id.slice(-4)}` : id)
|
|
2305
2329
|
|
|
@@ -2495,10 +2519,9 @@ window.__ModuleLoader__.load({
|
|
|
2495
2519
|
? [h('span', { className: 'k', key: 'k-session' }, '会话'),
|
|
2496
2520
|
h('span', { className: 'v', key: 'v-session' }, h('button', {
|
|
2497
2521
|
className: 'audit-id',
|
|
2498
|
-
|
|
2499
|
-
onMouseEnter: (event) => showSessionTip(selected.sessionId, event),
|
|
2500
|
-
|
|
2501
|
-
onMouseLeave: hideTip,
|
|
2522
|
+
'aria-label': selected.sessionId,
|
|
2523
|
+
onMouseEnter: (event) => showSessionTip(selected.sessionId, event.currentTarget),
|
|
2524
|
+
onMouseLeave: scheduleHideTip,
|
|
2502
2525
|
onClick: () => openSessionId(selected.sessionId),
|
|
2503
2526
|
}, selected.sessionId))]
|
|
2504
2527
|
: null
|
|
@@ -2633,7 +2656,7 @@ window.__ModuleLoader__.load({
|
|
|
2633
2656
|
if (tip.type === 'session') {
|
|
2634
2657
|
const summary = tip.summary || {}
|
|
2635
2658
|
const title = summary.title || summary.name || `会话 ${String(tip.id).slice(0, 8)}`
|
|
2636
|
-
return h('div', { className: 'audit-tip', style: { left: tip.x, top: tip.y } },
|
|
2659
|
+
return h('div', { className: 'audit-tip', style: { left: tip.x, top: tip.y }, onMouseEnter: cancelHideTip, onMouseLeave: hideTip, onClick: () => openSessionId(tip.id) },
|
|
2637
2660
|
h('div', { className: 'audit-tip-head' }, h('span', null, '会话'), h('span', { className: 'audit-tip-title' }, title)),
|
|
2638
2661
|
h('div', { className: 'audit-tip-meta' },
|
|
2639
2662
|
auditPill(String(tip.id).slice(0, 8) + '…', 'mute'),
|
|
@@ -2641,12 +2664,13 @@ window.__ModuleLoader__.load({
|
|
|
2641
2664
|
summary.archived === true ? auditPill('已归档', 'warn') : null,
|
|
2642
2665
|
),
|
|
2643
2666
|
summary.cwd ? h('div', { className: 'audit-tip-content' }, summary.cwd) : null,
|
|
2667
|
+
h('div', { className: 'audit-tip-content' }, `ID ${tip.id}`),
|
|
2644
2668
|
summary.updatedAt ? h('div', { className: 'audit-tip-foot' }, `更新于 ${fmtTime(summary.updatedAt)}`) : null,
|
|
2645
2669
|
h('div', { className: 'audit-tip-foot' }, '点击打开会话'),
|
|
2646
2670
|
)
|
|
2647
2671
|
}
|
|
2648
2672
|
const record = tip.record
|
|
2649
|
-
return h('div', { className: 'audit-tip', style: { left: tip.x, top: tip.y } },
|
|
2673
|
+
return h('div', { className: 'audit-tip', style: { left: tip.x, top: tip.y }, onMouseEnter: cancelHideTip, onMouseLeave: hideTip, onClick: () => openMemoryId(tip.id) },
|
|
2650
2674
|
h('div', { className: 'audit-tip-head' }, h('span', null, '记忆'), h('span', { className: 'audit-tip-title' }, record ? record.id : tip.id)),
|
|
2651
2675
|
record
|
|
2652
2676
|
? h('div', null,
|
|
@@ -2658,7 +2682,7 @@ window.__ModuleLoader__.load({
|
|
|
2658
2682
|
record.tags && record.tags.length > 0
|
|
2659
2683
|
? h('div', { className: 'audit-flat' }, record.tags.map((tag) => h('span', { className: 'tag', key: tag }, tag)))
|
|
2660
2684
|
: null,
|
|
2661
|
-
h('div', { className: 'audit-tip-content' },
|
|
2685
|
+
h('div', { className: 'audit-tip-content' }, String(record.content || '')),
|
|
2662
2686
|
)
|
|
2663
2687
|
: h('div', { className: 'audit-tip-content' }, tip.loading ? '加载记录…' : '记录未找到(可能已删除或不在已加载作用域)'),
|
|
2664
2688
|
h('div', { className: 'audit-tip-foot' }, '点击跳转到「记录」页并展开'),
|