@fanchao8609/agent_brain_sync 1.5.1 → 1.5.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/package.json +1 -1
- package/src/store.js +11 -5
package/package.json
CHANGED
package/src/store.js
CHANGED
|
@@ -167,8 +167,8 @@ export async function cmdLoad({ dir }) {
|
|
|
167
167
|
'--- Todo 看板 (todo.md) ---',
|
|
168
168
|
todo.trim() || '(todo.md 为空)',
|
|
169
169
|
'',
|
|
170
|
-
'--- 最近动作 (log.md,
|
|
171
|
-
|
|
170
|
+
'--- 最近动作 (log.md, 最新 5 条) ---',
|
|
171
|
+
recentLogLines(log, 5) || '(log.md 为空)',
|
|
172
172
|
];
|
|
173
173
|
if (stranded.length) {
|
|
174
174
|
const rows = stranded.map((t) => {
|
|
@@ -336,9 +336,15 @@ async function readIfExists(p) {
|
|
|
336
336
|
try { return (await fs.readFile(p, 'utf8')).trim(); } catch { return ''; }
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
339
|
+
/** log.md 是"新在上"(cmdLog 把新行插在标题后)——取**最新** n 条,只认 `## [` 条目行。
|
|
340
|
+
* 坑: 曾用 tailLines 取末尾 → 拿到的永远是最旧几条,而标签写着"最近动作",
|
|
341
|
+
* 于是"开机读状态"最该看的一节长期显示两天前的旧记录(今天的新条目从未显示)。 */
|
|
342
|
+
function recentLogLines(text, n) {
|
|
343
|
+
return String(text || '')
|
|
344
|
+
.split('\n')
|
|
345
|
+
.filter((l) => /^##\s*\[/.test(l))
|
|
346
|
+
.slice(0, n)
|
|
347
|
+
.join('\n');
|
|
342
348
|
}
|
|
343
349
|
|
|
344
350
|
// ---------- log: 追加工作成果沉淀摘要(用户/AI 主动 abs log "..." 记, 不收工具动作流水) ----------
|