dsh-aurorix-agentbook 1.8.1 → 1.8.3

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: [
@@ -127,13 +126,13 @@ export function memoryView(state, caps = {}) {
127
126
  { type: 'textField', label: w.writeBody, bind: 'data.draft.body', placeholder: w.writeBodyPlaceholder, multiline: true, maxLines: 6, maxLength: 2000, required: true, minLength: 1 },
128
127
  { type: 'textField', label: w.writeReadWhen, bind: 'data.draft.readWhen', placeholder: w.writeReadWhen, maxLength: 200 },
129
128
  ] },
129
+ { type: 'text', text: b('draftNote'), tone: 'muted' },
130
130
  ] },
131
- { type: 'text', text: b('draftNote'), tone: 'muted' },
132
131
 
133
132
  // 四、保险箱:独立平面,列表只带标识与用途,正文点开才解密
134
- { type: 'divider' },
135
- { type: 'text', text: w.vaultTitle, style: { size: 'subtitle', weight: 'semibold' } },
136
- { type: 'text', text: w.vaultHint, tone: 'muted' },
133
+ { type: 'divider', size: 'S' },
134
+ // 标题和说明原来各占一行,说的是同一件事:合成一行标题「保险箱 · 凭据单独存放」
135
+ { type: 'text', text: `${w.vaultTitle} · ${w.vaultHint}`, style: { size: 'subtitle', weight: 'semibold' } },
137
136
  { type: 'form', submit: 'vault-filter', submitLabel: w.vaultFilterBtn, children: [
138
137
  { type: 'textField', label: w.vaultQueryLabel, bind: 'data.vaultQuery', placeholder: w.vaultQueryPlaceholder, maxLength: 120 },
139
138
  ] },
@@ -145,8 +144,8 @@ export function memoryView(state, caps = {}) {
145
144
  { type: 'textField', label: w.vaultPurpose, bind: 'data.vaultDraft.purpose', placeholder: w.vaultPurposePlaceholder, maxLength: 400, required: true, minLength: 1 },
146
145
  { type: 'textField', label: w.vaultBody, bind: 'data.vaultDraft.body', placeholder: w.vaultBodyPlaceholder, multiline: true, maxLines: 6, maxLength: 2000, required: true, minLength: 1 },
147
146
  ] },
147
+ { type: 'text', text: b('vaultDraftNote'), tone: 'muted' },
148
148
  ] },
149
- { type: 'text', text: b('vaultDraftNote'), tone: 'muted' },
150
149
 
151
150
  { type: 'actions', items: [
152
151
  { label: w.retry, icon: 'refresh', action: 'reload', style: 'plain' },
@@ -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,11 @@ 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
+ .fieldrow{display:flex;gap:9px;align-items:flex-start;margin-bottom:10px}
91
+ .fieldrow .fieldwrap{flex:1 1 auto;margin-bottom:0}
92
+ .fieldrow button{flex:0 0 auto;padding:9px 20px}
93
+ .fieldwrap{position:relative;margin-bottom:10px}
94
+ 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
95
  input:focus,textarea:focus,select:focus{border-color:var(--accent)}
87
96
  textarea{min-height:130px;resize:vertical;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13.5px;line-height:1.65}
88
97
  .cnt{position:absolute;right:11px;bottom:8px;font-size:11.5px;color:var(--muted);font-variant-numeric:tabular-nums;pointer-events:none}
@@ -101,8 +110,8 @@ button:disabled{opacity:.5;cursor:default}
101
110
  .m{color:var(--muted);font-size:12.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-top:2px}
102
111
  .bytes{color:var(--muted);font-size:12.5px;font-variant-numeric:tabular-nums;flex:none}
103
112
  .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}
113
+ details{border:1px solid var(--line);border-radius:12px;padding:0 14px;margin-bottom:16px;background:var(--panel)}
114
+ summary{cursor:pointer;padding:11px 0;font-size:14.5px;list-style:none;display:flex;justify-content:space-between;align-items:center}
106
115
  summary::-webkit-details-marker{display:none}
107
116
  summary::after{content:"▾";color:var(--muted);font-size:12px}
108
117
  details[open] summary::after{transform:rotate(180deg)}
@@ -123,16 +132,16 @@ details .inner{padding:4px 0 16px;border-top:1px solid var(--line)}
123
132
 
124
133
  <section>
125
134
  <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>
135
+ <div class="stat"><b class="big" id="total">0</b><span class="cap" id="planeCount"></span></div>
136
+ <table class="planes"><tbody id="ptable"></tbody></table>
129
137
  </section>
130
138
 
131
139
  <section>
132
140
  <div class="sect">${t.recall}</div>
133
- <label class="lab">${t.keyword}</label>
134
- <div class="fieldwrap"><input id="q" maxlength="120" placeholder="${t.keywordPh}" autocomplete="off"><span class="cnt" id="qcnt">0/120</span></div>
135
- <button class="wide" id="go">${t.go}</button>
141
+ <div class="fieldrow">
142
+ <div class="fieldwrap"><input id="q" maxlength="120" placeholder="${t.keywordPh}" autocomplete="off"><span class="cnt" id="qcnt">0/120</span></div>
143
+ <button id="go">${t.go}</button>
144
+ </div>
136
145
  <div id="results"><div class="hint">${t.none}</div></div>
137
146
  </section>
138
147
 
@@ -149,9 +158,10 @@ details .inner{padding:4px 0 16px;border-top:1px solid var(--line)}
149
158
  <section>
150
159
  <div class="sect">${t.vault}</div>
151
160
  <p class="sub">${t.vaultSub}</p>
152
- <label class="lab">${t.filter}</label>
153
- <div class="fieldwrap"><input id="vq" maxlength="120" placeholder="${t.filterPh}" autocomplete="off"><span class="cnt" id="vcnt">0/120</span></div>
154
- <button class="wide ghost" id="vgo">${t.filterBtn}</button>
161
+ <div class="fieldrow">
162
+ <div class="fieldwrap"><input id="vq" maxlength="120" placeholder="${t.filterPh}" autocomplete="off"><span class="cnt" id="vcnt">0/120</span></div>
163
+ <button class="ghost" id="vgo">${t.filterBtn}</button>
164
+ </div>
155
165
  <div class="hint" id="vcount"></div>
156
166
  <div id="vlist"></div>
157
167
  </section>
@@ -207,9 +217,16 @@ function renderState(planes, total, statsError, hasVault) {
207
217
  planes = planes && typeof planes === 'object' && !Array.isArray(planes) ? planes : {};
208
218
  const count = Number.isFinite(Number(total)) ? Number(total) : 0;
209
219
  $('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>');
220
+ $('planeCount').textContent = statsError ? '' : (ORDER.length + (hasVault ? 1 : 0)) + ${JSON.stringify(zh ? ' 个平面' : ' planes')};
221
+ // 两列并排:一对平面占一行,纵向直接砍半;单数时右半格留空,不补假数据
222
+ const cells = ORDER.map((k) => [esc(PLANE_NAMES[k] || k), statsError ? '—' : String(Number(planes[k]) || 0)]);
223
+ if (hasVault) cells.push([${JSON.stringify(zh ? '凭据库' : 'Vault')}, ${JSON.stringify(zh ? '独立保险箱' : 'separate vault')}]);
224
+ const rows = [];
225
+ for (let i = 0; i < cells.length; i += 2) {
226
+ const a = cells[i], b = cells[i + 1] || ['', ''];
227
+ rows.push('<tr><td class="pn">' + a[0] + '</td><td class="pv">' + a[1] + '</td>'
228
+ + '<td class="pn">' + b[0] + '</td><td class="pv">' + b[1] + '</td></tr>');
229
+ }
213
230
  $('ptable').innerHTML = rows.join('');
214
231
  $('sub').textContent = statsError ? T.fail + statsError : fmtTotal(count);
215
232
  }
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.3",
4
4
  "description": "dsh-aurorix-agentbook:给 dsh-go 接通 Aurorix 记忆库——原生界面(状态条/胶囊/菜单/面板/保险箱)加宿主侧提示词注入、分层快照与四个工具。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",