dsh-aurorix-agentbook 1.8.1 → 1.8.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 CHANGED
@@ -94,17 +94,16 @@ export function memoryView(state, caps = {}) {
94
94
  type: 'stack',
95
95
  title: w.title,
96
96
  accent: 'teal',
97
- style: { gap: 'L' },
97
+ style: { gap: 'M' },
98
98
  children: [
99
99
  // 一、分层计数
100
- { type: 'row', children: [
101
- { type: 'metric', label: w.total, value: b('total'), tone: 'info' },
102
- { type: 'metric', label: w.planes, value: b('planeCount') },
103
- ] },
104
- { type: 'table', columns: [w.writePlane, w.countOrStatus], rows: { $: 'data.planeRows' } },
100
+ // 一块就够:总数当主数字,平面数做说明;原来两个 metric 各占一整行
101
+ { type: 'metric', label: w.total, value: b('total'), caption: b('planeSummary'), tone: 'info' },
102
+ // 平面计数两列并排:7 行压到 4 行,省下的正是面板最容易铺张的那一段
103
+ { type: 'table', columns: [w.writePlane, w.countOrStatus, w.writePlane, w.countOrStatus], rows: { $: 'data.planeGrid' } },
105
104
 
106
105
  // 二、召回:关键词 + 结果,点一条进详情
107
- { type: 'divider' },
106
+ { type: 'divider', size: 'S' },
108
107
  { type: 'form', label: w.recall, submit: 'recall', submitLabel: w.recallBtn, children: [
109
108
  { type: 'textField', label: w.queryLabel, bind: 'data.query', placeholder: w.recallPlaceholder, maxLength: 120 },
110
109
  ] },
@@ -112,7 +111,7 @@ export function memoryView(state, caps = {}) {
112
111
  { type: 'list', items: { $: 'data.hits' } },
113
112
 
114
113
  // 三、写入普通记忆(默认收起,避免面板太长)
115
- { type: 'divider' },
114
+ { type: 'divider', size: 'S' },
116
115
  { type: 'collapsible', label: w.save, expanded: false, children: [
117
116
  { type: 'form', submit: 'save', submitLabel: w.save, children: [
118
117
  { type: 'select', label: w.writePlane, bind: 'data.draft.plane', options: [
@@ -131,7 +130,7 @@ export function memoryView(state, caps = {}) {
131
130
  { type: 'text', text: b('draftNote'), tone: 'muted' },
132
131
 
133
132
  // 四、保险箱:独立平面,列表只带标识与用途,正文点开才解密
134
- { type: 'divider' },
133
+ { type: 'divider', size: 'S' },
135
134
  { type: 'text', text: w.vaultTitle, style: { size: 'subtitle', weight: 'semibold' } },
136
135
  { type: 'text', text: w.vaultHint, tone: 'muted' },
137
136
  { type: 'form', submit: 'vault-filter', submitLabel: w.vaultFilterBtn, children: [
@@ -218,11 +217,12 @@ function detailView(state, caps) {
218
217
 
219
218
  // 阅读态一律看已落库的正文;草稿只在编辑态出现在输入框里。
220
219
  const shown = pageSlice(d.body ?? '', state.detailPage)
220
+ // 原来先一行「普通记忆」再一行标题,两行说的是同一件事。标题本身够表意,
221
+ // 平面信息已经在下面的元信息表里,这里不再单占一行。
221
222
  const children = [
222
- { type: 'text', text: isVault ? w.detailVaultKind : w.detailMemoryKind, tone: 'muted' },
223
223
  { type: 'text', text: clip(d.title === '' ? '—' : d.title, 200), style: { size: 'title', weight: 'semibold' } },
224
224
  { type: 'keyValue', items: meta },
225
- { type: 'divider' },
225
+ { type: 'divider', size: 'S' },
226
226
  ]
227
227
  if (shown.text === '') children.push({ type: 'callout', text: w.bodyEmpty, tone: 'warn' })
228
228
  else children.push({ type: 'text', text: shown.text })
@@ -260,6 +260,16 @@ export function memoryData(state, caps = {}) {
260
260
  const planeRows = PLANES.map((plane) => [planeLabel(plane, caps?.locale), String(planes[plane] ?? 0)])
261
261
  if (state.hasCredentialPlane === true) planeRows.push([w.credentialPlane, w.credentialStatus])
262
262
  const total = Number(state.total) || 0
263
+ // 两列并排:把 [平面, 条数] 两两配成一行四格,纵向直接砍半。
264
+ // 单数时右半格留空,不补假数据。
265
+ const planeGrid = []
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
+ }
263
273
 
264
274
  const hits = (state.hits ?? []).map((hit) => ({
265
275
  title: clip(hit.title === undefined || hit.title === null ? '' : hit.title, 80),
@@ -301,6 +311,9 @@ export function memoryData(state, caps = {}) {
301
311
  total,
302
312
  planeCount: overviewPlaneCount(state),
303
313
  planeRows,
314
+ planeGrid,
315
+ // 原来单独占一行的「平面数」,现在作为总数的说明文字,信息不减、行数减一
316
+ planeSummary: `${overviewPlaneCount(state)} ${w.planesUnit}`,
304
317
  planePairs: planeRows.map(([label, value]) => ({ label, value })),
305
318
  query: state.query ?? '',
306
319
  hits,
package/lib/web.js CHANGED
@@ -64,15 +64,21 @@ export function pageHtml(locale = 'zh-CN', scriptNonce = randomBytes(18).toStrin
64
64
  body{font:15px/1.6 -apple-system,system-ui,"PingFang SC","Noto Sans CJK SC",sans-serif;-webkit-font-smoothing:antialiased}
65
65
  .wrap{max-width:760px;margin:0 auto;padding:18px 16px 72px}
66
66
  h1{font-size:19px;font-weight:600;margin:0 0 4px}
67
- .sub{color:var(--muted);font-size:13px;margin:0 0 18px}
68
- section{margin-bottom:26px}
67
+ .sub{color:var(--muted);font-size:13px;margin:0 0 14px}
68
+ section{margin-bottom:20px}
69
69
  .hidden{display:none!important}
70
70
  .field-spaced{margin-top:12px}
71
71
  .button-spaced{margin-top:14px}
72
- .sect{font-size:15px;font-weight:600;padding-bottom:10px;border-bottom:1px solid var(--line);margin-bottom:14px}
72
+ .sect{font-size:14.5px;font-weight:600;padding-bottom:8px;border-bottom:1px solid var(--line);margin-bottom:12px}
73
73
  .lab{display:block;font-size:13px;color:var(--muted);margin-bottom:7px}
74
- .rowline{display:flex;justify-content:space-between;align-items:baseline;padding:9px 0}
75
- .rowline span{color:var(--muted);font-size:13.5px}
74
+ .stat{display:flex;align-items:baseline;gap:9px;padding:2px 0 12px}
75
+ .stat .cap{color:var(--muted);font-size:12.5px}
76
+ table.planes{font-size:13px}
77
+ table.planes td{padding:7px 0;border-bottom:1px solid var(--line)}
78
+ table.planes tr:last-child td{border-bottom:0}
79
+ table.planes td.pn{color:var(--muted);width:22%}
80
+ table.planes td.pv{color:var(--ink);text-align:left;width:28%;font-variant-numeric:tabular-nums}
81
+ table.planes td.pn+td.pv{padding-right:14px}
76
82
  .big{font-size:34px;font-weight:600;line-height:1.1;font-variant-numeric:tabular-nums;color:var(--accent);letter-spacing:-.02em}
77
83
  .big.sm{font-size:26px}
78
84
  table{width:100%;border-collapse:collapse;margin-top:12px;font-size:13.5px}
@@ -81,8 +87,8 @@ th:last-child,td:last-child{text-align:right}
81
87
  td{padding:9px 0;border-bottom:1px solid var(--line);color:var(--ink)}
82
88
  td:last-child{color:var(--muted);font-variant-numeric:tabular-nums}
83
89
  tr:last-child td{border-bottom:0}
84
- .fieldwrap{position:relative;margin-bottom:12px}
85
- input,textarea,select{width:100%;background:var(--field);border:1px solid var(--line);border-radius:11px;padding:11px 13px;color:var(--ink);font:inherit;outline:none}
90
+ .fieldwrap{position:relative;margin-bottom:10px}
91
+ input,textarea,select{width:100%;background:var(--field);border:1px solid var(--line);border-radius:11px;padding:9px 12px;color:var(--ink);font:inherit;outline:none}
86
92
  input:focus,textarea:focus,select:focus{border-color:var(--accent)}
87
93
  textarea{min-height:130px;resize:vertical;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13.5px;line-height:1.65}
88
94
  .cnt{position:absolute;right:11px;bottom:8px;font-size:11.5px;color:var(--muted);font-variant-numeric:tabular-nums;pointer-events:none}
@@ -101,8 +107,8 @@ button:disabled{opacity:.5;cursor:default}
101
107
  .m{color:var(--muted);font-size:12.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-top:2px}
102
108
  .bytes{color:var(--muted);font-size:12.5px;font-variant-numeric:tabular-nums;flex:none}
103
109
  .chev{color:var(--muted);font-size:17px;flex:none;opacity:.6}
104
- details{border:1px solid var(--line);border-radius:12px;padding:0 14px;margin-bottom:22px;background:var(--panel)}
105
- summary{cursor:pointer;padding:13px 0;font-size:14.5px;list-style:none;display:flex;justify-content:space-between;align-items:center}
110
+ details{border:1px solid var(--line);border-radius:12px;padding:0 14px;margin-bottom:16px;background:var(--panel)}
111
+ summary{cursor:pointer;padding:11px 0;font-size:14.5px;list-style:none;display:flex;justify-content:space-between;align-items:center}
106
112
  summary::-webkit-details-marker{display:none}
107
113
  summary::after{content:"▾";color:var(--muted);font-size:12px}
108
114
  details[open] summary::after{transform:rotate(180deg)}
@@ -123,9 +129,8 @@ details .inner{padding:4px 0 16px;border-top:1px solid var(--line)}
123
129
 
124
130
  <section>
125
131
  <div class="sect">${t.memories === 'Memories' ? 'Plugin content' : '插件内容'}</div>
126
- <div class="rowline"><span>${t.memories}</span><b class="big" id="total">0</b></div>
127
- <div class="rowline"><span>${t.planes}</span><b class="big sm" id="planeCount">0</b></div>
128
- <table><thead><tr><th>${t.tblHead1}</th><th>${t.tblHead2}</th></tr></thead><tbody id="ptable"></tbody></table>
132
+ <div class="stat"><b class="big" id="total">0</b><span class="cap" id="planeCount"></span></div>
133
+ <table class="planes"><tbody id="ptable"></tbody></table>
129
134
  </section>
130
135
 
131
136
  <section>
@@ -207,9 +212,16 @@ function renderState(planes, total, statsError, hasVault) {
207
212
  planes = planes && typeof planes === 'object' && !Array.isArray(planes) ? planes : {};
208
213
  const count = Number.isFinite(Number(total)) ? Number(total) : 0;
209
214
  $('total').textContent = statsError ? '—' : count;
210
- $('planeCount').textContent = statsError ? '—' : ORDER.length + (hasVault ? 1 : 0);
211
- const rows = ORDER.map((k) => '<tr><td>' + esc(PLANE_NAMES[k] || k) + '</td><td>' + (statsError ? '—' : Number(planes[k]) || 0) + '</td></tr>');
212
- if (hasVault) rows.push('<tr><td>' + ${JSON.stringify(zh ? '凭据库' : 'Vault')} + '</td><td>' + ${JSON.stringify(zh ? '独立保险箱' : 'separate vault')} + '</td></tr>');
215
+ $('planeCount').textContent = statsError ? '' : (ORDER.length + (hasVault ? 1 : 0)) + ${JSON.stringify(zh ? ' 个平面' : ' planes')};
216
+ // 两列并排:一对平面占一行,纵向直接砍半;单数时右半格留空,不补假数据
217
+ const cells = ORDER.map((k) => [esc(PLANE_NAMES[k] || k), statsError ? '—' : String(Number(planes[k]) || 0)]);
218
+ if (hasVault) cells.push([${JSON.stringify(zh ? '凭据库' : 'Vault')}, ${JSON.stringify(zh ? '独立保险箱' : 'separate vault')}]);
219
+ const rows = [];
220
+ for (let i = 0; i < cells.length; i += 2) {
221
+ const a = cells[i], b = cells[i + 1] || ['', ''];
222
+ rows.push('<tr><td class="pn">' + a[0] + '</td><td class="pv">' + a[1] + '</td>'
223
+ + '<td class="pn">' + b[0] + '</td><td class="pv">' + b[1] + '</td></tr>');
224
+ }
213
225
  $('ptable').innerHTML = rows.join('');
214
226
  $('sub').textContent = statsError ? T.fail + statsError : fmtTotal(count);
215
227
  }
package/lib/words.js CHANGED
@@ -3,6 +3,7 @@ export const WORDS = {
3
3
  zh: {
4
4
  title: '记忆库',
5
5
  planes: '平面',
6
+ planesUnit: '个平面',
6
7
  total: '普通记忆',
7
8
  countOrStatus: '条数 / 状态',
8
9
  credentialPlane: '凭据库',
@@ -113,6 +114,7 @@ export const WORDS = {
113
114
  en: {
114
115
  title: 'Memory',
115
116
  planes: 'planes',
117
+ planesUnit: 'planes',
116
118
  total: 'Ordinary records',
117
119
  countOrStatus: 'Count / status',
118
120
  credentialPlane: 'Credentials',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-aurorix-agentbook",
3
- "version": "1.8.1",
3
+ "version": "1.8.2",
4
4
  "description": "dsh-aurorix-agentbook:给 dsh-go 接通 Aurorix 记忆库——原生界面(状态条/胶囊/菜单/面板/保险箱)加宿主侧提示词注入、分层快照与四个工具。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",