dsh-aurorix-agentbook 1.9.1 → 1.9.2
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/lib/view.js +30 -16
- package/lib/web.js +4 -4
- package/lib/words.js +4 -4
- package/package.json +1 -1
package/lib/view.js
CHANGED
|
@@ -67,6 +67,29 @@ export function joinPages(pages) {
|
|
|
67
67
|
return Array.isArray(pages) ? pages.join('') : ''
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
/**
|
|
71
|
+
* 平面计数的唯一数据源:[名称, 条数] 行。view 与 data 都从它派生,不各算一份。
|
|
72
|
+
* 六个普通平面按固定顺序,末尾追加凭据平面(不在普通计数里,值是文字状态)。
|
|
73
|
+
*/
|
|
74
|
+
function planeRowsOf(state, caps) {
|
|
75
|
+
const w = words(caps?.locale)
|
|
76
|
+
const planes = state?.planes ?? {}
|
|
77
|
+
const rows = PLANES.map((plane) => [planeLabel(plane, caps?.locale), String(planes[plane] ?? 0)])
|
|
78
|
+
if (state?.hasCredentialPlane === true) rows.push([w.credentialPlane, w.credentialStatus])
|
|
79
|
+
return rows
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** grid 的格子:每格是「名称 + 条数」一行,宽度由宿主按内容分配,不会被挤成一个字。 */
|
|
83
|
+
function planeCells(rows) {
|
|
84
|
+
return rows.map(([label, value]) => ({
|
|
85
|
+
type: 'row',
|
|
86
|
+
children: [
|
|
87
|
+
{ type: 'text', text: label, tone: 'muted' },
|
|
88
|
+
{ type: 'text', text: value },
|
|
89
|
+
],
|
|
90
|
+
}))
|
|
91
|
+
}
|
|
92
|
+
|
|
70
93
|
/** 面板视图。分成记忆与保险箱两段;详情打开时整页换成详情。 */
|
|
71
94
|
export function memoryView(state, caps = {}) {
|
|
72
95
|
const w = words(caps?.locale)
|
|
@@ -99,8 +122,9 @@ export function memoryView(state, caps = {}) {
|
|
|
99
122
|
// 一、分层计数
|
|
100
123
|
// 一块就够:总数当主数字,平面数做说明;原来两个 metric 各占一整行
|
|
101
124
|
{ type: 'metric', label: w.total, value: b('total'), caption: b('planeSummary'), tone: 'info' },
|
|
102
|
-
//
|
|
103
|
-
|
|
125
|
+
// 平面计数用 grid 两列:每格自带「名称 + 条数」,宽度由宿主按内容分,
|
|
126
|
+
// 不会被 4 列表格挤成只剩一个字(table 的列宽由渲染器平分,名称列必被压掉)。
|
|
127
|
+
{ type: 'grid', columns: 2, children: planeCells(planeRowsOf(state, caps)) },
|
|
104
128
|
|
|
105
129
|
// 二、召回:关键词 + 结果,点一条进详情
|
|
106
130
|
{ type: 'divider', size: 'S' },
|
|
@@ -256,20 +280,10 @@ function detailView(state, caps) {
|
|
|
256
280
|
*/
|
|
257
281
|
export function memoryData(state, caps = {}) {
|
|
258
282
|
const w = words(caps?.locale)
|
|
259
|
-
const planes = state.planes ?? {}
|
|
260
|
-
const planeRows = PLANES.map((plane) => [planeLabel(plane, caps?.locale), String(planes[plane] ?? 0)])
|
|
261
|
-
if (state.hasCredentialPlane === true) planeRows.push([w.credentialPlane, w.credentialStatus])
|
|
262
283
|
const total = Number(state.total) || 0
|
|
263
|
-
//
|
|
264
|
-
|
|
265
|
-
const
|
|
266
|
-
for (let i = 0; i < planeRows.length; i += 2) {
|
|
267
|
-
const left = planeRows[i]
|
|
268
|
-
const right = planeRows[i + 1]
|
|
269
|
-
planeGrid.push(right === undefined
|
|
270
|
-
? [left[0], left[1], '', '']
|
|
271
|
-
: [left[0], left[1], right[0], right[1]])
|
|
272
|
-
}
|
|
284
|
+
// 与视图同源:行由 planeRowsOf 算,格子由 planeCells 转,避免两处各写一份口径。
|
|
285
|
+
const planeRows = planeRowsOf(state, caps)
|
|
286
|
+
const planeCellList = planeCells(planeRows)
|
|
273
287
|
|
|
274
288
|
const hits = (state.hits ?? []).map((hit) => ({
|
|
275
289
|
title: clip(hit.title === undefined || hit.title === null ? '' : hit.title, 80),
|
|
@@ -311,7 +325,7 @@ export function memoryData(state, caps = {}) {
|
|
|
311
325
|
total,
|
|
312
326
|
planeCount: overviewPlaneCount(state),
|
|
313
327
|
planeRows,
|
|
314
|
-
|
|
328
|
+
planeCells: planeCellList,
|
|
315
329
|
// 原来单独占一行的「平面数」,现在作为总数的说明文字,信息不减、行数减一
|
|
316
330
|
planeSummary: `${overviewPlaneCount(state)} ${w.planesUnit}`,
|
|
317
331
|
planePairs: planeRows.map(([label, value]) => ({ label, value })),
|
package/lib/web.js
CHANGED
|
@@ -17,9 +17,9 @@ export function pageHtml(locale = 'zh-CN', scriptNonce = randomBytes(18).toStrin
|
|
|
17
17
|
const t = zh
|
|
18
18
|
? {
|
|
19
19
|
title:'记忆库', sect:'插件内容', memories:'普通记忆', planes:'平面', tblHead1:'写入平面', tblHead2:'条数 / 状态',
|
|
20
|
-
recall:'召回', keyword:'关键词', keywordPh:'输入关键词…', go:'
|
|
20
|
+
recall:'召回', keyword:'关键词', keywordPh:'输入关键词…', go:'搜索记忆', none:'暂无数据', noHit:'没有匹配的记忆', searchError:'检索失败:', loading:'检索中…', hits:(n,tot)=>`命中 ${n} 条(共 ${tot} 条)`,
|
|
21
21
|
saveMem:'存进记忆', saveVault:'存进保险箱',
|
|
22
|
-
vault:'保险箱', vaultSub:'凭据单独存放,不进普通记忆', filter:'筛选', filterPh:'标识或用途…', filterBtn:'
|
|
22
|
+
vault:'保险箱', vaultSub:'凭据单独存放,不进普通记忆', filter:'筛选', filterPh:'标识或用途…', filterBtn:'筛选凭据',
|
|
23
23
|
vaultCount:(shown,total)=>`共 ${total} 条,显示 ${shown} 条`, vaultEmpty:'保险箱是空的',
|
|
24
24
|
plane:'平面', titleField:'标题', bodyField:'正文', readWhen:'读时机(什么时候该读这条)', purpose:'用途',
|
|
25
25
|
save:'保存', detail:'详情', edit:'编辑', cancel:'取消', back:'返回',
|
|
@@ -29,9 +29,9 @@ export function pageHtml(locale = 'zh-CN', scriptNonce = randomBytes(18).toStrin
|
|
|
29
29
|
}
|
|
30
30
|
: {
|
|
31
31
|
title:'Memory', sect:'Plugin content', memories:'Memories', planes:'Planes', tblHead1:'Plane', tblHead2:'Count / state',
|
|
32
|
-
recall:'Recall', keyword:'Keyword', keywordPh:'type a keyword…', go:'Search', none:'No data', noHit:'No matching memories', searchError:'Search failed: ', loading:'Searching…', hits:(n,tot)=>`${n} hits (of ${tot})`,
|
|
32
|
+
recall:'Recall', keyword:'Keyword', keywordPh:'type a keyword…', go:'Search memory', none:'No data', noHit:'No matching memories', searchError:'Search failed: ', loading:'Searching…', hits:(n,tot)=>`${n} hits (of ${tot})`,
|
|
33
33
|
saveMem:'Save to memory', saveVault:'Save to vault',
|
|
34
|
-
vault:'Vault', vaultSub:'Secrets live apart from ordinary memory', filter:'Filter', filterPh:'ident or purpose…', filterBtn:'Filter',
|
|
34
|
+
vault:'Vault', vaultSub:'Secrets live apart from ordinary memory', filter:'Filter', filterPh:'ident or purpose…', filterBtn:'Filter creds',
|
|
35
35
|
vaultCount:(shown,total)=>`${total} total, ${shown} shown`, vaultEmpty:'Vault is empty',
|
|
36
36
|
plane:'Plane', titleField:'Title', bodyField:'Body', readWhen:'Read when', purpose:'Purpose',
|
|
37
37
|
save:'Save', detail:'Detail', edit:'Edit', cancel:'Cancel', back:'Back',
|
package/lib/words.js
CHANGED
|
@@ -11,7 +11,7 @@ export const WORDS = {
|
|
|
11
11
|
recall: '召回',
|
|
12
12
|
queryLabel: '关键词',
|
|
13
13
|
recallPlaceholder: '输入关键词…',
|
|
14
|
-
recallBtn: '
|
|
14
|
+
recallBtn: '搜索记忆',
|
|
15
15
|
noQuery: '先输入关键词',
|
|
16
16
|
searching: '正在查',
|
|
17
17
|
noHit: '没有匹配的记忆',
|
|
@@ -51,7 +51,7 @@ export const WORDS = {
|
|
|
51
51
|
vaultHint: '凭据单独存放,不进普通记忆',
|
|
52
52
|
vaultQueryLabel: '筛选',
|
|
53
53
|
vaultQueryPlaceholder: '标识或用途…',
|
|
54
|
-
vaultFilterBtn: '
|
|
54
|
+
vaultFilterBtn: '筛选凭据',
|
|
55
55
|
vaultNoMatch: '没有匹配的凭据',
|
|
56
56
|
vaultEmpty: '保险箱是空的',
|
|
57
57
|
vaultUnavailable: '保险箱读不到',
|
|
@@ -123,7 +123,7 @@ export const WORDS = {
|
|
|
123
123
|
recall: 'Recall',
|
|
124
124
|
queryLabel: 'Keywords',
|
|
125
125
|
recallPlaceholder: 'Keywords…',
|
|
126
|
-
recallBtn: 'Search',
|
|
126
|
+
recallBtn: 'Search memory',
|
|
127
127
|
noQuery: 'Enter keywords first',
|
|
128
128
|
searching: 'Searching',
|
|
129
129
|
noHit: 'No matching memories',
|
|
@@ -162,7 +162,7 @@ export const WORDS = {
|
|
|
162
162
|
vaultHint: 'Credentials kept apart, never in ordinary memory',
|
|
163
163
|
vaultQueryLabel: 'Filter',
|
|
164
164
|
vaultQueryPlaceholder: 'Name or purpose…',
|
|
165
|
-
vaultFilterBtn: 'Filter',
|
|
165
|
+
vaultFilterBtn: 'Filter creds',
|
|
166
166
|
vaultNoMatch: 'No matching credentials',
|
|
167
167
|
vaultEmpty: 'The vault is empty',
|
|
168
168
|
vaultUnavailable: 'Vault unreadable',
|
package/package.json
CHANGED