@a9i5k4/dsh-auto-memory 0.1.12 → 0.1.13
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/client.js +3 -3
- package/lib/index.js +3 -3
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* 3. settings.section — 自动记忆设置页(存储位置、注入、反思风格)
|
|
8
8
|
* Data flows over /api/dsh-auto-memory/* (loopback-only host routes).
|
|
9
9
|
*/
|
|
10
|
-
console.log('[dsh-auto-memory] client v0.1.
|
|
10
|
+
console.log('[dsh-auto-memory] client v0.1.13 fingerprint: drawer-summary-ok')
|
|
11
11
|
window.__ModuleLoader__.load({
|
|
12
|
-
id: '@
|
|
12
|
+
id: '@a9i5k4/dsh-auto-memory',
|
|
13
13
|
factory: (require) => {
|
|
14
14
|
var module = { exports: {} }
|
|
15
15
|
var exports = module.exports
|
|
@@ -389,7 +389,7 @@ window.__ModuleLoader__.load({
|
|
|
389
389
|
if (document.getElementById(STYLE_ID)) return
|
|
390
390
|
var tag = document.createElement('style')
|
|
391
391
|
tag.id = STYLE_ID
|
|
392
|
-
tag.dataset.plugin = '@
|
|
392
|
+
tag.dataset.plugin = '@a9i5k4/dsh-auto-memory'
|
|
393
393
|
tag.textContent = CSS
|
|
394
394
|
document.head.appendChild(tag)
|
|
395
395
|
}
|
package/lib/index.js
CHANGED
|
@@ -106,7 +106,7 @@ const DEFAULT_CONFIG = {
|
|
|
106
106
|
const pad = (n) => String(n).padStart(2, '0')
|
|
107
107
|
const todayStr = () => { const d = new Date(); return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}` }
|
|
108
108
|
const nowHm = () => { const d = new Date(); return `${pad(d.getHours())}:${pad(d.getMinutes())}` }
|
|
109
|
-
|
|
109
|
+
|
|
110
110
|
const dateStrOf = (ts) => { const d = new Date(ts); return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}` }
|
|
111
111
|
const DATE_RE = /^\d{4}-\d{2}-\d{2}$/
|
|
112
112
|
const truncateHead = (s, n) => (s && s.length > n) ? s.slice(0, n) + '\n…(截断,完整内容用 memory_recall 或 GUI 面板)' : (s || '')
|
|
@@ -663,7 +663,7 @@ class MemoryEngine {
|
|
|
663
663
|
lines.push('\n[欢迎回来]')
|
|
664
664
|
lines.push('用户离开已超过 1 小时(暂离/下班后回来)。在本轮回复的开头,先用一句简短温暖的话欢迎用户回来(如"欢迎回来!你离开的这段时间,我已经帮你把日志整理好了。"),然后提示"自动记忆窗口将打开,方便你了解这段时间的状况"(如已由 GUI 弹出概览则不必重复提示)。语气自然,一两句即可,不要长篇大论。')
|
|
665
665
|
}
|
|
666
|
-
lines.push('\n[铭文 · 每轮提醒 ' +
|
|
666
|
+
lines.push('\n[铭文 · 每轮提醒 ' + this.memToday() + ']') // 日期级刷新(秒级时间戳会击穿 DeepSeek 前缀缓存,每步全量重编码)
|
|
667
667
|
lines.push('思维链=本轮推理(用完即焚);铭文=落盘的记忆文件(跨会话永久)。你的记忆更新必须落在铭文层——显式调用工具写盘,不能只"想过"。')
|
|
668
668
|
lines.push('本提醒由框架在每一轮对话开始时重新注入(时间戳即刷新证明,衰减期只有一轮):读写只走工具、路径写死、每轮结束框架自动评估沉淀兜底——记忆无法被绕过,也不依赖自觉。')
|
|
669
669
|
lines.push('\n[记忆写入纪律 — 必须遵守]')
|
|
@@ -2016,7 +2016,7 @@ class ExternalMemory {
|
|
|
2016
2016
|
const src = srcs.find((s) => s.id === sourceId)
|
|
2017
2017
|
if (!src) return '外部源不存在: ' + sourceId
|
|
2018
2018
|
if (src.kind === 'sessions') return '会话类源不支持整体接入,请用 memory_recall 按需检索(' + src.files.length + ' 个会话文件)。'
|
|
2019
|
-
const stamp = '## 来自 ' + src.tool + '(' + src.name + ') — 接入于 ' +
|
|
2019
|
+
const stamp = '## 来自 ' + src.tool + '(' + src.name + ') — 接入于 ' + engine.memToday() // ExternalMemory 类,this 无 memToday,必须用 engine
|
|
2020
2020
|
if (target === 'user') {
|
|
2021
2021
|
const p = await engine.resolvePaths(agent)
|
|
2022
2022
|
const body = await engine.appendText(p.userFile, '\n' + stamp + '\n' + src.content.slice(0, 120000))
|
package/package.json
CHANGED