dsh-memu-memory 1.4.0 → 1.4.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/AGENTS.md +2 -0
- package/CHANGELOG.md +36 -0
- package/README.md +4 -1
- package/README.zh.md +4 -1
- package/docs/client-conventions.md +3 -0
- package/docs/mcp-porting.md +146 -0
- package/docs/memory-semantics.md +4 -2
- package/docs/troubleshooting.md +40 -0
- package/lib/binding-diagnostics.js +1 -1
- package/lib/client.js +223 -120
- package/lib/consolidation-worker.js +11 -3
- package/lib/curator.js +16 -4
- package/lib/cycle.js +75 -4
- package/lib/engine.js +68 -0
- package/lib/index.js +4 -2
- package/lib/inject.js +142 -8
- package/lib/memory.js +123 -21
- package/lib/port-surface.js +82 -0
- package/lib/private.js +49 -13
- package/lib/prompts/private-consolidation.coding.md +3 -1
- package/lib/prompts/private-consolidation.md +2 -0
- package/lib/prompts/private-consolidation.mixed.md +2 -0
- package/lib/prompts/private-consolidation.rp.md +2 -0
- package/lib/prompts/system-guide.coding.md +8 -2
- package/lib/prompts/system-guide.md +6 -0
- package/lib/prompts/system-guide.mixed.md +11 -0
- package/lib/prompts/system-guide.rp.md +6 -0
- package/lib/rpc.js +19 -5
- package/lib/tools.js +25 -0
- package/lib/turn-log.js +34 -11
- package/lib/worker-pool.js +11 -7
- package/package.json +2 -1
- package/tests/browser.test.mjs +21 -0
- package/tests/client-export.test.mjs +1 -0
- package/tests/client-render.test.mjs +1 -0
- package/tests/consolidation-fork.test.mjs +20 -1
- package/tests/curator-probe.test.mjs +19 -1
- package/tests/engine.test.mjs +60 -0
- package/tests/help-page.test.mjs +1 -0
- package/tests/inject-guide.test.mjs +108 -1
- package/tests/new-session-gate.test.mjs +1 -0
- package/tests/port-surface.test.mjs +138 -0
- package/tests/prompts.test.mjs +30 -0
- package/tests/react-snapshot.test.mjs +1 -0
- package/tests/salience-domain.test.mjs +34 -0
- package/tests/settings-beat.test.mjs +1 -0
- package/tests/sidebar-beat.test.mjs +1 -0
- package/tests/stale-maintenance.test.mjs +131 -0
- package/tests/turn-log.test.mjs +13 -0
- package/tests/webui.test.mjs +8 -1
package/lib/rpc.js
CHANGED
|
@@ -492,7 +492,10 @@ async function mergeLexiconImport(libraryId, member) {
|
|
|
492
492
|
// degrades to the index instead of failing the browser.
|
|
493
493
|
async function privateListView(scope, { limit = null, previewChars = 4000 } = {}) {
|
|
494
494
|
const libraryId = scope.libraryId ?? getSessionBinding(scope.exec ? scope.exec?.agent?.session?.header?.id : null)?.libraryId
|
|
495
|
-
|
|
495
|
+
// 4000 的上限原本是"预览"口径,但浏览库的卡片是可编辑的 textarea:正文一旦
|
|
496
|
+
// 被截断,用户改一个字保存就会把尾部丢掉。列表默认仍是 4000(侧栏轻量预览),
|
|
497
|
+
// 浏览库显式要大值时按真实长度给。
|
|
498
|
+
const contentLimit = Math.max(40, Math.min(200_000, Number(previewChars) || 4000))
|
|
496
499
|
const itemLimit = Number.isInteger(limit) && limit > 0 ? Math.min(500, limit) : null
|
|
497
500
|
const shape = (fileLibraryId, id, e, content, libraryName = null) => ({
|
|
498
501
|
id,
|
|
@@ -538,10 +541,18 @@ async function privateListView(scope, { limit = null, previewChars = 4000 } = {}
|
|
|
538
541
|
createdAt: e?.createdAt || null,
|
|
539
542
|
updatedAt: e?.updatedAt || e?.createdAt || null,
|
|
540
543
|
content: String(content ?? e?.content ?? '').slice(0, contentLimit),
|
|
544
|
+
// 正文被列表口径截断时标出来:浏览页的 textarea 一旦被编辑就会把截断版写回,
|
|
545
|
+
// 客户端据此在聚焦时用 getMemory 补拉全文(§7.4「列表项预览就地截断」)。
|
|
546
|
+
truncated: String(content ?? e?.content ?? '').length > contentLimit,
|
|
541
547
|
})
|
|
548
|
+
// 新到旧:引擎与索引都不保证顺序,界面若自己不排,刚写的记忆就会跑到中间
|
|
549
|
+
// (2026-11-28 现场)。列表、浏览库、侧栏三处共用这一条口径。
|
|
550
|
+
const newestFirst = (a, b) => String(b.updatedAt || b.createdAt || '')
|
|
551
|
+
.localeCompare(String(a.updatedAt || a.createdAt || ''))
|
|
552
|
+
|| String(a.id).localeCompare(String(b.id))
|
|
542
553
|
try {
|
|
543
554
|
const result = await privateList({ ...scope, preferIndex: true })
|
|
544
|
-
const files = (result.files || []).map((f) => shape(f.libraryId || libraryId, f.name, f.entry, f.content, f.libraryName))
|
|
555
|
+
const files = (result.files || []).map((f) => shape(f.libraryId || libraryId, f.name, f.entry, f.content, f.libraryName)).sort(newestFirst)
|
|
545
556
|
return {
|
|
546
557
|
libraryId: result.libraryId,
|
|
547
558
|
...(result.libraries ? { libraries: result.libraries } : {}),
|
|
@@ -554,7 +565,7 @@ async function privateListView(scope, { limit = null, previewChars = 4000 } = {}
|
|
|
554
565
|
return {
|
|
555
566
|
libraryId,
|
|
556
567
|
source: 'index',
|
|
557
|
-
files: Object.entries(index.entries || {}).filter(([, entry]) => !scope.exec || (isMemoryEligible(entry) && visibleToSession(entry, scope.exec?.agent?.session?.header?.id))).map(([id, e]) => shape(libraryId, id, e)),
|
|
568
|
+
files: Object.entries(index.entries || {}).filter(([, entry]) => !scope.exec || (isMemoryEligible(entry) && visibleToSession(entry, scope.exec?.agent?.session?.header?.id))).map(([id, e]) => shape(libraryId, id, e)).sort(newestFirst),
|
|
558
569
|
}
|
|
559
570
|
}
|
|
560
571
|
}
|
|
@@ -1638,8 +1649,11 @@ async function dispatch(ctx, endpoint, payload = {}) {
|
|
|
1638
1649
|
// empty global scope.
|
|
1639
1650
|
try { collect(loadGlobalIndex(), null) } catch { errors.push({ libraryId: null, error: 'global index unavailable' }) }
|
|
1640
1651
|
items.sort((a, b) => String(b.updatedAt || b.createdAt || '').localeCompare(String(a.updatedAt || a.createdAt || '')))
|
|
1641
|
-
|
|
1642
|
-
|
|
1652
|
+
// 分页:记忆墙按 offset 逐批取,不再在 300 条处截断。5000 只是防一次请求
|
|
1653
|
+
// 把整库塞进一个 JSON 的上限(当前最大库 417 条,一条流就能读完)。
|
|
1654
|
+
const limit = Math.max(1, Math.min(5000, Number(payload?.limit) || 300))
|
|
1655
|
+
const offset = Math.max(0, Math.floor(Number(payload?.offset) || 0))
|
|
1656
|
+
return { items: items.slice(offset, offset + limit), total: items.length, offset, domains: [...domains].sort(), libraries, errors }
|
|
1643
1657
|
}
|
|
1644
1658
|
case 'getGraph':
|
|
1645
1659
|
// Reuse the private graph endpoint instead of adding a second read method:
|
package/lib/tools.js
CHANGED
|
@@ -1064,3 +1064,28 @@ export function registerTools(ctx, { only = null } = {}) {
|
|
|
1064
1064
|
disposeAll.requested = wanted
|
|
1065
1065
|
return disposeAll
|
|
1066
1066
|
}
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* 工具规格快照,给无宿主调用方用(MCP server / 移植适配器 / 脚本)。
|
|
1070
|
+
*
|
|
1071
|
+
* 用一个只收集、不注册的假 ctx 跑一遍 `registerTools`,拿到的就是宿主本来会看到
|
|
1072
|
+
* 的那批 defineTool 对象:`name` / `description` / `parameters`(已是 JSON Schema)
|
|
1073
|
+
* / `execute(args, exec)`。MCP 侧把 `parameters` 直接当 `inputSchema`、`execute(args, {})`
|
|
1074
|
+
* 就能跑,不必重写三十个工具。
|
|
1075
|
+
*
|
|
1076
|
+
* 不碰任何既有注册路径;跑完把模块级 `registrationReport` 还原,所以 `memu_status`
|
|
1077
|
+
* 的注册清单不会因为「有人问了一次规格」而变。
|
|
1078
|
+
*/
|
|
1079
|
+
export function collectToolSpecs() {
|
|
1080
|
+
const saved = registrationReport
|
|
1081
|
+
const collected = []
|
|
1082
|
+
try {
|
|
1083
|
+
registerTools({
|
|
1084
|
+
tools: { register: (tool) => { collected.push(tool); return () => {} } },
|
|
1085
|
+
logger: { warn() {} },
|
|
1086
|
+
})
|
|
1087
|
+
} finally {
|
|
1088
|
+
registrationReport = saved
|
|
1089
|
+
}
|
|
1090
|
+
return collected
|
|
1091
|
+
}
|
package/lib/turn-log.js
CHANGED
|
@@ -15,10 +15,27 @@ import { getSettings, getSessionBinding } from './state.js'
|
|
|
15
15
|
|
|
16
16
|
export const TURNLOG_USER_MODEL_CHARS = 2000
|
|
17
17
|
export const TURNLOG_TOOL_LINE_CHARS = 160
|
|
18
|
+
export const TURNLOG_TOOL_ARGS_CHARS = 120
|
|
18
19
|
export const TURNLOG_RECORD_CHARS = 4000
|
|
19
20
|
export const TURNLOG_KEEP_CHARS = 200_000
|
|
20
21
|
export const TURNLOG_GC_DAYS = 30
|
|
21
22
|
|
|
23
|
+
// 编码域的「修改重点」几乎全在工具行里(命令、错误签名、diff 参数),160 字只留得下
|
|
24
|
+
// 开头。给编码域更宽的单项额度,整条记录仍受 4000 字总闸约束(先砍 tools 尾)。
|
|
25
|
+
export const TURNLOG_TOOL_LINE_CHARS_CODING = 600
|
|
26
|
+
export const TURNLOG_TOOL_ARGS_CHARS_CODING = 400
|
|
27
|
+
|
|
28
|
+
const DEFAULT_TOOL_LIMITS = Object.freeze({
|
|
29
|
+
toolLineChars: TURNLOG_TOOL_LINE_CHARS,
|
|
30
|
+
toolArgsChars: TURNLOG_TOOL_ARGS_CHARS,
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
export function turnLogLimits(domain) {
|
|
34
|
+
return String(domain) === 'coding'
|
|
35
|
+
? { toolLineChars: TURNLOG_TOOL_LINE_CHARS_CODING, toolArgsChars: TURNLOG_TOOL_ARGS_CHARS_CODING }
|
|
36
|
+
: DEFAULT_TOOL_LIMITS
|
|
37
|
+
}
|
|
38
|
+
|
|
22
39
|
const TURNLOG_SUFFIX = '.turnlog.jsonl'
|
|
23
40
|
|
|
24
41
|
function truncate(text, max) {
|
|
@@ -77,20 +94,22 @@ function toolCallIdOfResult(event) {
|
|
|
77
94
|
.find((value) => typeof value === 'string' && value) || null
|
|
78
95
|
}
|
|
79
96
|
|
|
80
|
-
function toolLine(name, args, status, errorText) {
|
|
81
|
-
const
|
|
97
|
+
function toolLine(name, args, status, errorText, limits = DEFAULT_TOOL_LIMITS) {
|
|
98
|
+
const lineChars = limits.toolLineChars ?? TURNLOG_TOOL_LINE_CHARS
|
|
99
|
+
const argsChars = limits.toolArgsChars ?? TURNLOG_TOOL_ARGS_CHARS
|
|
100
|
+
const head = `${name || '?'}${args ? `(${truncate(args, argsChars)})` : ''}`
|
|
82
101
|
const tail = status === 'ok' ? ' → 成功'
|
|
83
102
|
: status === 'error' ? ` → 失败: ${firstLine(errorText)}`
|
|
84
103
|
: ' → 无结果'
|
|
85
104
|
// 工具行与对话文本同一待遇:先脱敏再截断(§3.1「记录时应用 redactSecrets」)。
|
|
86
|
-
return truncate(redactSecrets(head + tail),
|
|
105
|
+
return truncate(redactSecrets(head + tail), lineChars)
|
|
87
106
|
}
|
|
88
107
|
|
|
89
108
|
/**
|
|
90
109
|
* 'summary' 档工具行:调用 + 结果按 callId 配对。tool/call 事件是权威侧
|
|
91
110
|
* (assistant 消息里的 tool-call 块是同一次调用的双写,不单独成行——condenseEvents C2 同款)。
|
|
92
111
|
*/
|
|
93
|
-
function summaryToolLines(events) {
|
|
112
|
+
function summaryToolLines(events, limits = DEFAULT_TOOL_LIMITS) {
|
|
94
113
|
const lines = []
|
|
95
114
|
const calls = new Map() // callId -> line entry
|
|
96
115
|
for (const event of events) {
|
|
@@ -116,11 +135,11 @@ function summaryToolLines(events) {
|
|
|
116
135
|
lines.push({ name: '?', args: '', status: isError ? 'error' : 'ok', errorText: text, done: true })
|
|
117
136
|
}
|
|
118
137
|
}
|
|
119
|
-
return lines.map((entry) => toolLine(entry.name, entry.args, entry.status === 'pending' ? 'none' : entry.status, entry.errorText))
|
|
138
|
+
return lines.map((entry) => toolLine(entry.name, entry.args, entry.status === 'pending' ? 'none' : entry.status, entry.errorText, limits))
|
|
120
139
|
}
|
|
121
140
|
|
|
122
141
|
/** 'errors' 档:只收 isError 的工具结果行——失败尝试是漏网事实的最廉价来源(§3.1)。 */
|
|
123
|
-
function errorToolLines(events) {
|
|
142
|
+
function errorToolLines(events, limits = DEFAULT_TOOL_LIMITS) {
|
|
124
143
|
const names = new Map()
|
|
125
144
|
for (const event of events) {
|
|
126
145
|
if (event?.type !== 'tool/call') continue
|
|
@@ -132,7 +151,7 @@ function errorToolLines(events) {
|
|
|
132
151
|
if (event?.type !== 'tool/result' || event?.data?.message?.isError !== true) continue
|
|
133
152
|
const id = toolCallIdOfResult(event)
|
|
134
153
|
const name = (id && names.get(id)) || '?'
|
|
135
|
-
lines.push(toolLine(name, '', 'error', textOfBlocks(event?.data?.message?.content)))
|
|
154
|
+
lines.push(toolLine(name, '', 'error', textOfBlocks(event?.data?.message?.content), limits))
|
|
136
155
|
}
|
|
137
156
|
return lines
|
|
138
157
|
}
|
|
@@ -154,6 +173,10 @@ export function buildTurnRecords(events, options = {}) {
|
|
|
154
173
|
try { toolsMode = getSettings().consolidationTurnLogTools } catch { toolsMode = undefined }
|
|
155
174
|
}
|
|
156
175
|
if (toolsMode !== 'errors' && toolsMode !== 'summary') toolsMode = 'none'
|
|
176
|
+
const limits = {
|
|
177
|
+
toolLineChars: Number(options.toolLineChars) > 0 ? Number(options.toolLineChars) : TURNLOG_TOOL_LINE_CHARS,
|
|
178
|
+
toolArgsChars: Number(options.toolArgsChars) > 0 ? Number(options.toolArgsChars) : TURNLOG_TOOL_ARGS_CHARS,
|
|
179
|
+
}
|
|
157
180
|
|
|
158
181
|
const groups = []
|
|
159
182
|
let current = null
|
|
@@ -204,8 +227,8 @@ export function buildTurnRecords(events, options = {}) {
|
|
|
204
227
|
if (kind && kind !== 'completed') record.interrupted = true
|
|
205
228
|
|
|
206
229
|
let toolLines = []
|
|
207
|
-
if (toolsMode === 'summary') toolLines = summaryToolLines(group)
|
|
208
|
-
else if (toolsMode === 'errors') toolLines = errorToolLines(group)
|
|
230
|
+
if (toolsMode === 'summary') toolLines = summaryToolLines(group, limits)
|
|
231
|
+
else if (toolsMode === 'errors') toolLines = errorToolLines(group, limits)
|
|
209
232
|
if (toolLines.length > 0) record.tools = toolLines
|
|
210
233
|
|
|
211
234
|
// 空回合(纯注入/心跳/无对话无工具)不落行。
|
|
@@ -374,7 +397,7 @@ export function verifyGap(sessionId, fromSeq, throughSeq) {
|
|
|
374
397
|
* 用宿主事件重建 [fromSeq, throughSeq] 的缺失回合(§3.3:绝不假设日志完整)。
|
|
375
398
|
* 只补洞:与现有记录重叠的区间跳过,重复调用幂等。
|
|
376
399
|
*/
|
|
377
|
-
export function rebuildRange(sessionId, fromSeq, throughSeq, events) {
|
|
400
|
+
export function rebuildRange(sessionId, fromSeq, throughSeq, events, options = {}) {
|
|
378
401
|
const from = Number(fromSeq)
|
|
379
402
|
const through = Number(throughSeq)
|
|
380
403
|
if (!Number.isSafeInteger(from) || !Number.isSafeInteger(through) || from > through) {
|
|
@@ -384,7 +407,7 @@ export function rebuildRange(sessionId, fromSeq, throughSeq, events) {
|
|
|
384
407
|
const seq = Number(event?.seq)
|
|
385
408
|
return Number.isSafeInteger(seq) && seq >= from && seq <= through
|
|
386
409
|
})
|
|
387
|
-
const candidates = buildTurnRecords(slice).filter((record) => {
|
|
410
|
+
const candidates = buildTurnRecords(slice, options).filter((record) => {
|
|
388
411
|
const [start, end] = safeSeqRange(record) || [NaN, NaN]
|
|
389
412
|
return start >= from && end <= through
|
|
390
413
|
})
|
package/lib/worker-pool.js
CHANGED
|
@@ -16,8 +16,8 @@ import { record } from './activity-log.js'
|
|
|
16
16
|
import { loadLedger, scopeGenerationOf } from './consolidation-ledger.js'
|
|
17
17
|
import { buildWorkerBrief, CORE_WRITE_TOOLS, WORKER_READ_TOOLS, WORKER_WRITE_TOOLS, WORKER_TOOL_ALLOW } from './consolidation-worker.js'
|
|
18
18
|
import { registerTools } from './tools.js'
|
|
19
|
-
import { tailSlice, readIncrement, rebuildRange, buildTurnRecords } from './turn-log.js'
|
|
20
|
-
import { condenseEvents } from './curator.js'
|
|
19
|
+
import { tailSlice, readIncrement, rebuildRange, buildTurnRecords, turnLogLimits } from './turn-log.js'
|
|
20
|
+
import { condenseEvents, condenseLimitsFor } from './curator.js'
|
|
21
21
|
|
|
22
22
|
// —— epoch 预算分档(§4.5 条件 2/3)————————————————————————————————
|
|
23
23
|
// 按模型 maxContext 自动取档:≤128k 输入窗 → 120k 字符/8 窗;其余(含 ≥1M 旗舰)→ 200k/16。
|
|
@@ -731,9 +731,11 @@ export function loadWorkerIncrement({ sessionId, binding = null, window = null,
|
|
|
731
731
|
const seq = Number(event?.seq)
|
|
732
732
|
return Number.isSafeInteger(seq) && seq >= fromSeq && seq <= throughSeq
|
|
733
733
|
})
|
|
734
|
+
const domain = binding?.domainOverride || binding?.domain || 'general'
|
|
735
|
+
const condenseLimits = condenseLimitsFor(domain)
|
|
734
736
|
const condenseFallback = (why) => {
|
|
735
737
|
let text = ''
|
|
736
|
-
try { text = condenseEvents(eventsInWindow, WORKER_INCREMENT_FALLBACK_CHARS) || '' } catch { text = '' }
|
|
738
|
+
try { text = condenseEvents(eventsInWindow, WORKER_INCREMENT_FALLBACK_CHARS, condenseLimits) || '' } catch { text = '' }
|
|
737
739
|
return { records: [], text: String(text), chars: String(text).length, source: 'fallback', digest: why }
|
|
738
740
|
}
|
|
739
741
|
// A7:off 时不读不写日志,直接现场压缩。
|
|
@@ -743,7 +745,9 @@ export function loadWorkerIncrement({ sessionId, binding = null, window = null,
|
|
|
743
745
|
|
|
744
746
|
const lastSleepSeq = Number(binding?.lastSleepSeq)
|
|
745
747
|
const after = Number.isSafeInteger(lastSleepSeq) && lastSleepSeq >= 0 ? lastSleepSeq : -1
|
|
746
|
-
|
|
748
|
+
// 工具行额度与兜底压缩都跟随领域:编码域的修改重点在工具输出/参数里。
|
|
749
|
+
const limits = turnLogLimits(domain)
|
|
750
|
+
const expected = buildTurnRecords(eventsInWindow, limits)
|
|
747
751
|
const logRows = () => { try { return readIncrement(sessionId, -1).records || [] } catch { return [] } }
|
|
748
752
|
const covers = (rows, rec) => rows.some((row) => {
|
|
749
753
|
const s = Number(row?.seq?.[0])
|
|
@@ -754,7 +758,7 @@ export function loadWorkerIncrement({ sessionId, binding = null, window = null,
|
|
|
754
758
|
let rows = logRows()
|
|
755
759
|
let missing = expected.filter((rec) => !covers(rows, rec))
|
|
756
760
|
if (missing.length > 0) {
|
|
757
|
-
try { rebuildRange(sessionId, fromSeq, throughSeq, events) } catch {}
|
|
761
|
+
try { rebuildRange(sessionId, fromSeq, throughSeq, events, limits) } catch {}
|
|
758
762
|
rows = logRows()
|
|
759
763
|
missing = expected.filter((rec) => !covers(rows, rec))
|
|
760
764
|
if (missing.length > 0) return condenseFallback('现场压缩(turn-log 缺口重建失败)')
|
|
@@ -938,13 +942,13 @@ export function buildIncrementPack({
|
|
|
938
942
|
*/
|
|
939
943
|
export function buildHandoffPack({
|
|
940
944
|
sessionId = null, binding = null, snapshot = null, probe = null, jobId = null,
|
|
941
|
-
reason = 'auto', singleOnly = false, mustCover = [], contract = '',
|
|
945
|
+
reason = 'auto', singleOnly = false, mustCover = [], contract = '', domain = 'general',
|
|
942
946
|
incrementRecords = [], incrementText = null, digest = null,
|
|
943
947
|
catalog = null, sceneTime = null, pendingNote = false, pendingHash = null,
|
|
944
948
|
writtenRows = null, writtenTotal = null,
|
|
945
949
|
lastSleepSeq = null, tailChars = WORKER_HANDOFF_TAIL_CHARS, includeTail = true,
|
|
946
950
|
} = {}) {
|
|
947
|
-
const brief = buildWorkerBrief({ snapshot, probe, contract, reason, jobId, mustCover, autoReceipt: true, singleOnly })
|
|
951
|
+
const brief = buildWorkerBrief({ snapshot, probe, contract, reason, jobId, mustCover, autoReceipt: true, singleOnly, domain })
|
|
948
952
|
const sections = [brief]
|
|
949
953
|
const note = pendingNoteLine(pendingNote, pendingHash)
|
|
950
954
|
if (note) sections.push(note)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-memu-memory",
|
|
3
3
|
"icon": "./assets/icon.png",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.2",
|
|
5
5
|
"description": "面向长篇 RP 与陪伴对话的 DeepSeek Harness 记忆插件:三层记忆、逐轮召回、来源标注、关系图、图片附件与独立 WebUI。",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"deepseek-harness",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
".": "./lib/index.js",
|
|
38
38
|
"./client": "./lib/client.js",
|
|
39
39
|
"./integration": "./lib/inbound.js",
|
|
40
|
+
"./port": "./lib/port-surface.js",
|
|
40
41
|
"./package.json": "./package.json"
|
|
41
42
|
},
|
|
42
43
|
"bin": {
|
package/tests/browser.test.mjs
CHANGED
|
@@ -63,6 +63,27 @@ test('browseLibrary degrades to the index while the engine is missing', async ()
|
|
|
63
63
|
assert.match(item.content, /body of mem-3/)
|
|
64
64
|
})
|
|
65
65
|
|
|
66
|
+
test('browseLibrary lists newest first', async () => {
|
|
67
|
+
const lib = createLibrary({ name: 'browser-order', cwd: path.join(home, 'browser-order') })
|
|
68
|
+
seed(lib.id, 'mem-old', { createdAt: '2026-10-01T00:00:00.000Z', updatedAt: '2026-10-02T00:00:00.000Z' })
|
|
69
|
+
seed(lib.id, 'mem-mid', { createdAt: '2026-10-03T00:00:00.000Z', updatedAt: '2026-10-03T00:00:00.000Z' })
|
|
70
|
+
seed(lib.id, 'mem-new', { createdAt: '2026-10-05T00:00:00.000Z', updatedAt: '2026-10-06T00:00:00.000Z' })
|
|
71
|
+
const view = await dispatch({}, 'browseLibrary', { libraryId: lib.id })
|
|
72
|
+
// 侧栏与浏览库共用同一条口径:新到旧(引擎与索引都不保证顺序)。
|
|
73
|
+
assert.deepEqual(view.files.map((file) => file.id), ['mem-new', 'mem-mid', 'mem-old'])
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
test('browseLibrary flags a truncated body instead of silently shortening it', async () => {
|
|
77
|
+
const lib = createLibrary({ name: 'browser-trunc', cwd: path.join(home, 'browser-trunc') })
|
|
78
|
+
seed(lib.id, 'mem-long', { content: 'x'.repeat(4100) })
|
|
79
|
+
const view = await dispatch({}, 'browseLibrary', { libraryId: lib.id })
|
|
80
|
+
const item = view.files.find((file) => file.id === 'mem-long')
|
|
81
|
+
assert.equal(item.content.length, 4000, 'the list keeps the preview cap')
|
|
82
|
+
assert.equal(item.truncated, true, 'the client must know it can fetch the rest')
|
|
83
|
+
const full = await dispatch({}, 'getMemory', { libraryId: lib.id, id: 'mem-long' })
|
|
84
|
+
assert.equal(full.entry.content.length, 4100, 'getMemory returns the whole body')
|
|
85
|
+
})
|
|
86
|
+
|
|
66
87
|
test('local agent backend writes and recalls memory without an engine', async () => {
|
|
67
88
|
const cwd = path.join(home, 'browser-local')
|
|
68
89
|
const lib = createLibrary({ name: 'browser-local', cwd })
|
|
@@ -17,7 +17,7 @@ const forkModel = await import('../lib/fork-model.js')
|
|
|
17
17
|
const { dataDir, setWarnSink } = await import('../lib/paths.js')
|
|
18
18
|
const { retireWorker } = await import('../lib/worker-pool.js')
|
|
19
19
|
const { CORE_WRITE_TOOLS, WORKER_TOOL_ALLOW } = await import('../lib/consolidation-worker.js')
|
|
20
|
-
const { requestPrivateConsolidation, isConsolidating, consolidationWaitBudget, CONSOLIDATION_WAIT_POLICY, CONSOLIDATION_WINDOW_EVENTS, isEffortRefused, markEffortRefused, effortRefusalOf, compactSeedEvents, selectConsolidationWindow, selectTailTurnWindow, mustCoverCandidates, mergeMustCover, candidateCovered } = await import('../lib/private.js')
|
|
20
|
+
const { requestPrivateConsolidation, isConsolidating, consolidationWaitBudget, CONSOLIDATION_WAIT_POLICY, CONSOLIDATION_WINDOW_EVENTS, isEffortRefused, markEffortRefused, effortRefusalOf, compactSeedEvents, selectConsolidationWindow, selectTailTurnWindow, mustCoverCandidates, mergeMustCover, candidateCovered, seedLimitsFor } = await import('../lib/private.js')
|
|
21
21
|
// 这些用例验证“路由继承”,不是推理强度;默认 medium 由 config 测试单独覆盖。
|
|
22
22
|
state.updateSettings({ consolidationReasoningEffort: 'inherit' })
|
|
23
23
|
|
|
@@ -1518,3 +1518,22 @@ test('missing buildForkSeed only disables fork; worker really completes without
|
|
|
1518
1518
|
child.release()
|
|
1519
1519
|
await child.done
|
|
1520
1520
|
})
|
|
1521
|
+
|
|
1522
|
+
test('coding seeds keep more tool output and arguments than the default caps', () => {
|
|
1523
|
+
const events = [
|
|
1524
|
+
{ seq: 0, type: 'user/message', data: { source: { kind: 'user' }, content: [{ type: 'text', text: '改代码' }] } },
|
|
1525
|
+
{ seq: 1, type: 'tool/call', data: { callId: 'c1', name: 'edit', arguments: '{"patch":"' + 'A'.repeat(1500) + '"}' } },
|
|
1526
|
+
{ seq: 2, type: 'tool/result', data: { message: { callId: 'c1', content: [{ type: 'text', text: 'R'.repeat(3000) }] } } },
|
|
1527
|
+
{ seq: 3, type: 'assistant/message', data: { message: { content: [{ type: 'text', text: '完成' }] } } },
|
|
1528
|
+
]
|
|
1529
|
+
const sizes = (seed) => ({
|
|
1530
|
+
args: String(seed.find((event) => event.type === 'tool/call').data.arguments).length,
|
|
1531
|
+
result: String(seed.find((event) => event.type === 'tool/result').data.message.content[0].text).length,
|
|
1532
|
+
})
|
|
1533
|
+
const plain = sizes(compactSeedEvents(events))
|
|
1534
|
+
const coding = sizes(compactSeedEvents(events, null, seedLimitsFor('coding')))
|
|
1535
|
+
assert.ok(plain.args <= 510, 'the default argument cap is unchanged')
|
|
1536
|
+
assert.ok(coding.args > 1000, 'coding keeps a longer tool-call argument body')
|
|
1537
|
+
assert.ok(plain.result <= 1110, 'the default result cap is unchanged')
|
|
1538
|
+
assert.ok(coding.result > 2100 && coding.result < 2300, 'coding keeps 2200 chars of the tool result')
|
|
1539
|
+
})
|
|
@@ -64,7 +64,7 @@ crypto.randomBytes = (size) => {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
const {
|
|
67
|
-
startGlobalCuration, commitCuratorOutput, getCurationJob, condenseEvents,
|
|
67
|
+
startGlobalCuration, commitCuratorOutput, getCurationJob, condenseEvents, condenseLimitsFor,
|
|
68
68
|
} = await import('../lib/curator.js')
|
|
69
69
|
const { loadGlobalIndex, saveGlobalIndex } = await import('../lib/state.js')
|
|
70
70
|
const { dataDir } = await import('../lib/paths.js')
|
|
@@ -470,3 +470,21 @@ test('condense keeps private prose; redaction only covers credential-shaped stri
|
|
|
470
470
|
assert.match(text, /Bearer \[REDACTED_KEY\]/)
|
|
471
471
|
assert.doesNotMatch(text, /abcdefghijklmnopqrstuvwxyz/)
|
|
472
472
|
})
|
|
473
|
+
|
|
474
|
+
test('condenseLimitsFor widens coding tool caps; the default stays 400/300', () => {
|
|
475
|
+
const events = [
|
|
476
|
+
{ type: 'tool/call', data: { name: 'edit', arguments: '{"patch":"' + 'A'.repeat(1200) + '"}' } },
|
|
477
|
+
{ type: 'tool/result', data: { message: { content: [{ type: 'text', text: 'R'.repeat(3000) }] } } },
|
|
478
|
+
]
|
|
479
|
+
const plain = condenseEvents(events, 200000)
|
|
480
|
+
const coding = condenseEvents(events, 200000, condenseLimitsFor('coding'))
|
|
481
|
+
const plainCall = (plain.match(/Tool call: edit (.*)/) || [])[1] || ''
|
|
482
|
+
const codingCall = (coding.match(/Tool call: edit (.*)/) || [])[1] || ''
|
|
483
|
+
const plainResult = (plain.match(/Tool result: (.*)/) || [])[1] || ''
|
|
484
|
+
const codingResult = (coding.match(/Tool result: (.*)/) || [])[1] || ''
|
|
485
|
+
assert.ok(plainCall.length <= 310, 'the default argument cap is unchanged')
|
|
486
|
+
assert.ok(codingCall.length > 700, 'coding keeps more of the call arguments')
|
|
487
|
+
assert.ok(plainResult.length <= 410, 'the default result cap is unchanged')
|
|
488
|
+
assert.ok(codingResult.length > 1400 && codingResult.length < 1500, 'coding keeps 1400 chars of the result')
|
|
489
|
+
assert.equal(condenseLimitsFor('rp').toolResultChars, 400)
|
|
490
|
+
})
|
package/tests/engine.test.mjs
CHANGED
|
@@ -46,3 +46,63 @@ test('the macOS library-validation dlopen error is recognized for the signing re
|
|
|
46
46
|
assert.equal(engine.isMacOSLibraryValidationError(''), false)
|
|
47
47
|
assert.equal(engine.isMacOSLibraryValidationError(null), false)
|
|
48
48
|
})
|
|
49
|
+
|
|
50
|
+
// ---- 中断安装的自愈(2026-11-28:rc.5 home 卡在 installing 两天) ----
|
|
51
|
+
|
|
52
|
+
function writeEngineState(patch) {
|
|
53
|
+
const dir = path.join(home, 'engine')
|
|
54
|
+
fs.mkdirSync(dir, { recursive: true })
|
|
55
|
+
fs.writeFileSync(path.join(dir, 'state.json'), JSON.stringify(patch), 'utf8')
|
|
56
|
+
return dir
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const DEAD_INSTALL = {
|
|
60
|
+
status: 'installing',
|
|
61
|
+
version: '0.11.0b3',
|
|
62
|
+
step: 'installing-deps:python',
|
|
63
|
+
error: null,
|
|
64
|
+
startedAt: '2026-11-26T06:33:02.636Z',
|
|
65
|
+
updatedAt: '2026-11-26T06:33:05.838Z',
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
test('a dead install becomes failed and its venv.tmp is cleaned up', () => {
|
|
69
|
+
const dir = writeEngineState(DEAD_INSTALL)
|
|
70
|
+
const aborted = path.join(dir, '0.11.0b3', 'venv.tmp-37076-1795674785559')
|
|
71
|
+
const finished = path.join(dir, '0.11.0b3', 'venv-real')
|
|
72
|
+
fs.mkdirSync(aborted, { recursive: true })
|
|
73
|
+
fs.mkdirSync(finished, { recursive: true })
|
|
74
|
+
|
|
75
|
+
const status = engine.engineStatus()
|
|
76
|
+
assert.equal(status.status, 'failed', 'a stale installing state must not stay installing forever')
|
|
77
|
+
assert.equal(status.installed, false)
|
|
78
|
+
assert.equal(status.state.step, 'interrupted')
|
|
79
|
+
assert.match(String(status.state.error), /中断/, 'the reason must be readable in the UI')
|
|
80
|
+
assert.ok(!fs.existsSync(aborted), 'the aborted venv must be removed')
|
|
81
|
+
assert.ok(fs.existsSync(finished), 'a finished venv must never be touched')
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
test('a fresh install is left running', () => {
|
|
85
|
+
const now = new Date().toISOString()
|
|
86
|
+
writeEngineState({ ...DEAD_INSTALL, startedAt: now, updatedAt: now })
|
|
87
|
+
assert.equal(engine.engineStatus().status, 'installing', 'a live install must not be reconciled away')
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
test('a held lock means an install is still in flight', () => {
|
|
91
|
+
const dir = writeEngineState(DEAD_INSTALL)
|
|
92
|
+
fs.writeFileSync(path.join(dir, 'install.lock'), JSON.stringify({ pid: 1, startedAt: DEAD_INSTALL.startedAt }), 'utf8')
|
|
93
|
+
try {
|
|
94
|
+
assert.equal(engine.engineStatus().status, 'installing', 'the cross-process lock must veto reconciliation')
|
|
95
|
+
} finally {
|
|
96
|
+
fs.rmSync(path.join(dir, 'install.lock'), { force: true })
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
test('reconciliation is idempotent and leaves a ready engine alone', () => {
|
|
101
|
+
const dir = writeEngineState({ status: 'ready', version: '0.11.0b3', step: 'ready', error: null, updatedAt: '2026-11-26T06:33:05.838Z' })
|
|
102
|
+
fs.writeFileSync(path.join(dir, 'current.json'), JSON.stringify({ version: '0.11.0b3', venv: 'x', python: 'y' }), 'utf8')
|
|
103
|
+
try {
|
|
104
|
+
assert.equal(engine.engineStatus().status, 'ready', 'a ready engine must never be demoted')
|
|
105
|
+
} finally {
|
|
106
|
+
fs.rmSync(path.join(dir, 'current.json'), { force: true })
|
|
107
|
+
}
|
|
108
|
+
})
|
package/tests/help-page.test.mjs
CHANGED
|
@@ -74,6 +74,7 @@ function makeTurn(sessionId, options = {}) {
|
|
|
74
74
|
turn = 1,
|
|
75
75
|
text = 'please continue with the earlier context of this task',
|
|
76
76
|
history = [],
|
|
77
|
+
sessionCreatedAt = null,
|
|
77
78
|
} = options
|
|
78
79
|
const user = {
|
|
79
80
|
id: sessionId + '-user-' + turn,
|
|
@@ -82,7 +83,9 @@ function makeTurn(sessionId, options = {}) {
|
|
|
82
83
|
content: [{ type: 'text', text }],
|
|
83
84
|
}
|
|
84
85
|
const decision = { kind: 'enter', messages: [...history, user] }
|
|
85
|
-
const
|
|
86
|
+
const session = { header: { id: sessionId, cwd, agentPreset, origin } }
|
|
87
|
+
if (sessionCreatedAt !== null) session.createdAt = sessionCreatedAt
|
|
88
|
+
const agent = { session }
|
|
86
89
|
const payload = { agent, turn, step, signal: { aborted: false } }
|
|
87
90
|
return { user, decision, payload }
|
|
88
91
|
}
|
|
@@ -186,6 +189,78 @@ function textOf(messages) {
|
|
|
186
189
|
return (messages || []).map((message) => String(message?.content?.[0]?.text || '')).join('\n')
|
|
187
190
|
}
|
|
188
191
|
|
|
192
|
+
test('a recreated session object with the same id re-delivers the guide and the anchor', async () => {
|
|
193
|
+
const sessionId = 'guide-incarnation'
|
|
194
|
+
const cwd = path.join(home, 'project-guide-incarnation')
|
|
195
|
+
const binding = state.ensureSession(sessionId, { cwd, agentPreset: 'coding' })
|
|
196
|
+
seedPinned(binding, 'mem-guide-incarnation', '重启后的锚点')
|
|
197
|
+
const mounted = mountGuide()
|
|
198
|
+
|
|
199
|
+
const first = makeTurn(sessionId, { cwd, sessionCreatedAt: 1_700_000_000_000 })
|
|
200
|
+
const firstOut = await mounted.run(first.payload, first.decision)
|
|
201
|
+
assert.equal(guideMessages(firstOut.messages).length, 1)
|
|
202
|
+
assert.equal(state.getSessionBinding(sessionId).sessionStamp, 'created:1700000000000')
|
|
203
|
+
|
|
204
|
+
const next = makeTurn(sessionId, { cwd, turn: 2, sessionCreatedAt: 1_700_000_000_000 })
|
|
205
|
+
const nextOut = await mounted.run(next.payload, next.decision)
|
|
206
|
+
assert.equal(guideMessages(nextOut.messages).length, 0, '同一会话对象不重发')
|
|
207
|
+
|
|
208
|
+
// 通道用确定性 id 重建同名会话:binding 还是旧的,转录从头开始。
|
|
209
|
+
const revived = makeTurn(sessionId, { cwd, turn: 1, sessionCreatedAt: 1_700_000_100_000 })
|
|
210
|
+
const revivedOut = await mounted.run(revived.payload, revived.decision)
|
|
211
|
+
const revivedGuides = guideMessages(revivedOut.messages)
|
|
212
|
+
assert.equal(revivedGuides.length, 1, '新会话对象必须重新拿到规则')
|
|
213
|
+
assert.ok(textOf(revivedOut.messages).includes('[mem-guide-incarnation]'), '锚点也重新投放')
|
|
214
|
+
const stamped = state.getSessionBinding(sessionId)
|
|
215
|
+
assert.equal(stamped.sessionStamp, 'created:1700000100000')
|
|
216
|
+
assert.equal(stamped.guideRulesKey, guideKey(revivedGuides[0]))
|
|
217
|
+
assert.equal(stamped.guideLost, false)
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
test('without a host createdAt, a first turn on a reused id resets one-shots exactly once', async () => {
|
|
221
|
+
const sessionId = 'guide-turn-reset'
|
|
222
|
+
const cwd = path.join(home, 'project-guide-turn-reset')
|
|
223
|
+
state.ensureSession(sessionId, { cwd, agentPreset: 'coding' })
|
|
224
|
+
const mounted = mountGuide()
|
|
225
|
+
|
|
226
|
+
const first = makeTurn(sessionId, { cwd })
|
|
227
|
+
const firstOut = await mounted.run(first.payload, first.decision)
|
|
228
|
+
assert.equal(guideMessages(firstOut.messages).length, 1)
|
|
229
|
+
assert.equal(state.getSessionBinding(sessionId).sessionStamp, `turn1:${first.user.id}`)
|
|
230
|
+
|
|
231
|
+
const later = makeTurn(sessionId, { cwd, turn: 4 })
|
|
232
|
+
const laterOut = await mounted.run(later.payload, later.decision)
|
|
233
|
+
assert.equal(guideMessages(laterOut.messages).length, 0)
|
|
234
|
+
|
|
235
|
+
const revived = makeTurn(sessionId, { cwd, turn: 1, text: 'a brand new conversation' })
|
|
236
|
+
revived.user.id = 'guide-turn-reset-new-user'
|
|
237
|
+
revived.decision.messages = [revived.user]
|
|
238
|
+
const revivedOut = await mounted.run(revived.payload, revived.decision)
|
|
239
|
+
assert.equal(guideMessages(revivedOut.messages).length, 1, '回合号回到 1 → 重新投放')
|
|
240
|
+
|
|
241
|
+
// 宿主对同一首步重入:这一代的戳一致,不再重置、不再追加副本。
|
|
242
|
+
const reentry = makeTurn(sessionId, { cwd, turn: 1, text: 'a brand new conversation' })
|
|
243
|
+
reentry.user.id = 'guide-turn-reset-new-user'
|
|
244
|
+
reentry.decision.messages = [reentry.user]
|
|
245
|
+
const reentryOut = await mounted.run(reentry.payload, reentry.decision)
|
|
246
|
+
assert.equal(guideMessages(reentryOut.messages).length, 0)
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
test('a recall failure cannot swallow the rules message', async () => {
|
|
250
|
+
const sessionId = 'guide-failopen'
|
|
251
|
+
const cwd = path.join(home, 'project-guide-failopen')
|
|
252
|
+
state.ensureSession(sessionId, { cwd, agentPreset: 'coding' })
|
|
253
|
+
const mounted = mountGuide()
|
|
254
|
+
const turn = makeTurn(sessionId, { cwd })
|
|
255
|
+
Object.defineProperty(turn.payload.agent.session.header, 'agentPreset', {
|
|
256
|
+
get() { throw new Error('inject boom') },
|
|
257
|
+
})
|
|
258
|
+
const out = await mounted.run(turn.payload, turn.decision)
|
|
259
|
+
assert.equal(guideMessages(out.messages).length, 1, 'guide 与召回解耦,召回故障时仍然投放')
|
|
260
|
+
assert.ok(mounted.logger.warnings.some((message) => message.includes('pre-step injection failed')))
|
|
261
|
+
assert.match(String(state.getSessionBinding(sessionId).lastRecallError || ''), /inject boom/)
|
|
262
|
+
})
|
|
263
|
+
|
|
189
264
|
test('a domain change replaces the old guide with exactly one current version', async () => {
|
|
190
265
|
const sessionId = 'guide-domain'
|
|
191
266
|
const cwd = path.join(home, 'project-guide-domain')
|
|
@@ -209,6 +284,38 @@ test('a domain change replaces the old guide with exactly one current version',
|
|
|
209
284
|
assert.equal(out.messages.includes(old), false, 'the old version is projected out of the model view')
|
|
210
285
|
})
|
|
211
286
|
|
|
287
|
+
test('switching the memory domain re-delivers the guide and the domain-scoped one-shots', async () => {
|
|
288
|
+
const sessionId = 'guide-domain-switch'
|
|
289
|
+
const cwd = path.join(home, 'project-guide-domain-switch')
|
|
290
|
+
const binding = state.ensureSession(sessionId, { cwd, agentPreset: 'coding' })
|
|
291
|
+
const mounted = mountGuide()
|
|
292
|
+
|
|
293
|
+
const first = makeTurn(sessionId, { cwd })
|
|
294
|
+
const firstOut = await mounted.run(first.payload, first.decision)
|
|
295
|
+
const oldKey = guideKey(guideMessages(firstOut.messages)[0])
|
|
296
|
+
assert.equal(state.getSessionBinding(sessionId).injectedDomain, 'coding')
|
|
297
|
+
|
|
298
|
+
// 这条记忆是上一轮之后才写下的:切域后锚点重投时必须重新出现。
|
|
299
|
+
seedPinned(binding, 'mem-domain-switch', '切域之后写下的记忆')
|
|
300
|
+
state.setSessionBinding(sessionId, {
|
|
301
|
+
anniversariesShown: { 'mem-anniv': '2026-11-26' },
|
|
302
|
+
openLoopRemindedAt: { 'mem-loop': new Date().toISOString() },
|
|
303
|
+
})
|
|
304
|
+
state.setSessionBinding(sessionId, { domainOverride: 'rp' })
|
|
305
|
+
|
|
306
|
+
const next = makeTurn(sessionId, { cwd, turn: 2 })
|
|
307
|
+
const out = await mounted.run(next.payload, next.decision)
|
|
308
|
+
const guides = guideMessages(out.messages)
|
|
309
|
+
assert.equal(guides.length, 1)
|
|
310
|
+
assert.match(String(guides[0].content[0].text), /关于记忆(角色扮演)/)
|
|
311
|
+
assert.notEqual(guideKey(guides[0]), oldKey)
|
|
312
|
+
assert.ok(textOf(out.messages).includes('[mem-domain-switch]'), '锚点随切域重投')
|
|
313
|
+
const after = state.getSessionBinding(sessionId)
|
|
314
|
+
assert.equal(after.injectedDomain, 'rp')
|
|
315
|
+
assert.deepEqual(after.anniversariesShown, {})
|
|
316
|
+
assert.deepEqual(after.openLoopRemindedAt, {})
|
|
317
|
+
})
|
|
318
|
+
|
|
212
319
|
test('a prompt override changes the rendered body and the rules key', async () => {
|
|
213
320
|
const sessionId = 'guide-override'
|
|
214
321
|
const cwd = path.join(home, 'project-guide-override')
|
|
@@ -44,6 +44,7 @@ const React = {
|
|
|
44
44
|
if (hooks[index] === undefined) hooks[index] = typeof initial === 'function' ? initial() : initial
|
|
45
45
|
return [hooks[index], (next) => { hooks[index] = typeof next === 'function' ? next(hooks[index]) : next }]
|
|
46
46
|
},
|
|
47
|
+
memo: (component) => component,
|
|
47
48
|
useCallback(fn, deps) { return React.useMemo(() => fn, deps) },
|
|
48
49
|
useMemo(fn, deps) {
|
|
49
50
|
const index = cursor++
|