deepseek-plastic-memory 3.4.1 → 3.4.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.
Files changed (2) hide show
  1. package/index.js +26 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -217,6 +217,31 @@ function clearClassifyTask() {
217
217
  try { rmSync(CLASSIFY_FILE, { force: true }); return true } catch { return false }
218
218
  }
219
219
 
220
+ function readAllMemoriesText() {
221
+ try {
222
+ const j = JSON.parse(readFileSync(join(ROOT, 'folders.json'), 'utf8').replace(/^\uFEFF/, ''))
223
+ const folders = Array.isArray(j.folders) ? j.folders : []
224
+ const lines = []
225
+ for (const f of folders) {
226
+ const file = join(ROOT, f.k, 'notes.md')
227
+ if (!existsSync(file)) continue
228
+ const rows = readFileSync(file, 'utf8').replace(/^\uFEFF/, '').split('\n').filter(Boolean)
229
+ if (!rows.length) continue
230
+ lines.push('## ' + (f.parent ? f.parent + '>' : '') + f.name + ' (' + f.k + ')')
231
+ for (const row of rows) {
232
+ const [id, , flag, ...rest] = row.split('|')
233
+ const mark = flag === '*' ? ' [重要]' : flag === '✓' ? ' [完成]' : ''
234
+ lines.push((id || '') + mark + ' ' + rest.join('|'))
235
+ }
236
+ lines.push('')
237
+ }
238
+ const txt = lines.join('\n').trim()
239
+ return txt.length > 200000 ? txt.slice(0, 200000) + '\n…(已截断)' : txt
240
+ } catch {
241
+ return ''
242
+ }
243
+ }
244
+
220
245
  function readIdentity() {
221
246
  try {
222
247
  return readFileSync(IDENTITY_FILE, 'utf8').replace(/^\uFEFF/, '').trim()
@@ -246,7 +271,7 @@ export function apply(ctx) {
246
271
 
247
272
  // 全量记忆:每次会话都带上,模型不用再去挑分区
248
273
  try {
249
- const dump = run(['all'])
274
+ const dump = readAllMemoriesText()
250
275
  const sp = ctx.systemPrompt
251
276
  if (sp && typeof sp.section === 'function' && dump && dump !== '(空)') {
252
277
  sp.section({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepseek-plastic-memory",
3
- "version": "3.4.1",
3
+ "version": "3.4.3",
4
4
  "description": "DeepSeek 可塑性记忆:给 DSH 用的分区式长期记忆,带遗忘曲线",
5
5
  "type": "module",
6
6
  "main": "index.js",