memory-eternal 0.3.6 → 0.3.7
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/index.js +6 -4
- package/lib/api.js +12 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -412,8 +412,9 @@ export function apply(ctx, config) {
|
|
|
412
412
|
// 单智能体安装/卸载 MCP:POST {agent, action}
|
|
413
413
|
if (req.method !== 'POST') return json(res, 405, { ok: false, error: '需 POST' })
|
|
414
414
|
try {
|
|
415
|
-
|
|
416
|
-
for await (const chunk of req)
|
|
415
|
+
const chunks = []
|
|
416
|
+
for await (const chunk of req) chunks.push(chunk)
|
|
417
|
+
const raw = Buffer.concat(chunks).toString('utf8')
|
|
417
418
|
const body = JSON.parse(raw || '{}')
|
|
418
419
|
const agent = String(body.agent || '')
|
|
419
420
|
const action = String(body.action || '')
|
|
@@ -452,8 +453,9 @@ export function apply(ctx, config) {
|
|
|
452
453
|
return json(res, 200, { ok: true, config: safe, revision: me?.revision ?? 0, writable: true, readonly: false, schema: me?.schema ?? null, dsh: dshInfo, version: versionRef })
|
|
453
454
|
}
|
|
454
455
|
if (method === 'POST') {
|
|
455
|
-
|
|
456
|
-
for await (const chunk of req)
|
|
456
|
+
const cfgChunks = []
|
|
457
|
+
for await (const chunk of req) cfgChunks.push(chunk)
|
|
458
|
+
const raw = Buffer.concat(cfgChunks).toString('utf8')
|
|
457
459
|
let body = {}
|
|
458
460
|
try { body = JSON.parse(raw || '{}') } catch { return json(res, 400, { ok: false, error: 'JSON 解析失败' }) }
|
|
459
461
|
const patch = body.patch ?? {}
|
package/lib/api.js
CHANGED
|
@@ -147,8 +147,9 @@ export function createApi(deps = {}) {
|
|
|
147
147
|
return
|
|
148
148
|
}
|
|
149
149
|
case '/write': {
|
|
150
|
-
|
|
151
|
-
for await (const chunk of req)
|
|
150
|
+
const chunks = []
|
|
151
|
+
for await (const chunk of req) chunks.push(chunk)
|
|
152
|
+
const raw = Buffer.concat(chunks).toString('utf8')
|
|
152
153
|
let body
|
|
153
154
|
try { body = JSON.parse(raw || '{}') } catch { return json(res, 400, { ok: false, error: 'JSON 解析失败' }) }
|
|
154
155
|
if (!body.body) return json(res, 400, { ok: false, error: '缺少正文' })
|
|
@@ -158,8 +159,9 @@ export function createApi(deps = {}) {
|
|
|
158
159
|
return
|
|
159
160
|
}
|
|
160
161
|
case '/import': {
|
|
161
|
-
|
|
162
|
-
for await (const chunk of req)
|
|
162
|
+
const importChunks = []
|
|
163
|
+
for await (const chunk of req) importChunks.push(chunk)
|
|
164
|
+
const raw = Buffer.concat(importChunks).toString('utf8')
|
|
163
165
|
if (raw.length > 20 * 1024 * 1024) return json(res, 413, { ok: false, error: '文件过大' })
|
|
164
166
|
let payload
|
|
165
167
|
try { payload = JSON.parse(raw || '{}') } catch { return json(res, 400, { ok: false, error: 'JSON 解析失败' }) }
|
|
@@ -238,8 +240,9 @@ export function createApi(deps = {}) {
|
|
|
238
240
|
return
|
|
239
241
|
}
|
|
240
242
|
case '/feedback': {
|
|
241
|
-
|
|
242
|
-
for await (const chunk of req)
|
|
243
|
+
const fbChunks = []
|
|
244
|
+
for await (const chunk of req) fbChunks.push(chunk)
|
|
245
|
+
const raw = Buffer.concat(fbChunks).toString('utf8')
|
|
243
246
|
let rec
|
|
244
247
|
try { rec = JSON.parse(raw || '{}') } catch { return json(res, 400, { ok: false, error: 'JSON 解析失败' }) }
|
|
245
248
|
if (!rec || !rec.path) return json(res, 400, { ok: false, error: '缺少 path' })
|
|
@@ -320,8 +323,9 @@ export function json(res, status, body) {
|
|
|
320
323
|
/** 读请求体(POST body),返回解析后的 JSON 对象或空。 */
|
|
321
324
|
export async function readBody(req) {
|
|
322
325
|
try {
|
|
323
|
-
|
|
324
|
-
for await (const chunk of req)
|
|
326
|
+
const chunks = []
|
|
327
|
+
for await (const chunk of req) chunks.push(chunk)
|
|
328
|
+
const raw = Buffer.concat(chunks).toString('utf8')
|
|
325
329
|
return raw ? JSON.parse(raw) : {}
|
|
326
330
|
} catch { return {} }
|
|
327
331
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "memory-eternal",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"description": "记忆核心(Memory Eternal):自研的 DeepSeek Harness 记忆插件,不移植任何既有记忆框架——对话结束后自动沉淀知识卡到本地 Markdown Vault(自研去重、自研 CJK 检索、可 git 管理),设置页提供图形化知识库(统计 / 搜索 / 知识图谱 + 侧边栏一键弹窗),Agent 通过 memory_recall 工具按需召回历史上下文。零人工干预。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|