mocode-ai 1.9.0 → 1.9.1
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/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/dist/agent/index.js +18 -1
- package/dist/agent/model-turn.js +19 -5
- package/dist/agent/run-coordinator.js +32 -5
- package/dist/config/index.js +1 -1
- package/dist/headless.js +7 -0
- package/dist/i18n/index.js +4 -0
- package/dist/memory/anchor-backfill.js +227 -0
- package/dist/memory/anchor.js +91 -9
- package/dist/memory/graph.js +54 -6
- package/dist/memory/guard.js +174 -0
- package/dist/memory/health.js +13 -0
- package/dist/memory/index.js +5 -2
- package/dist/memory/reflect.js +130 -7
- package/dist/memory/seed.js +227 -0
- package/dist/memory/store.js +16 -2
- package/dist/memory/tail.js +20 -0
- package/dist/memory/turn-recall.js +149 -0
- package/dist/repl/commands/memory.js +217 -4
- package/dist/repl/runtime.js +34 -7
- package/dist/tools/builtins/memory-graph.js +20 -6
- package/dist/tools/builtins/memory-list.js +3 -1
- package/dist/tools/builtins/memory-save.js +30 -3
- package/dist/tools/builtins/memory-search.js +5 -0
- package/dist/tools/builtins/memory-update.js +13 -3
- package/dist/ui/prompt-internal/editor.js +11 -1
- package/package.json +1 -1
|
@@ -36,6 +36,11 @@ function statusMark(e, st, anchor) {
|
|
|
36
36
|
const why = describeAnchorState(anchor);
|
|
37
37
|
parts.push(`STALE-CODE${why ? ` (${why})` : ''}`);
|
|
38
38
|
}
|
|
39
|
+
// R16.1:来源标记。只在**二手转述**时出现——内容逐字来自工具输出(网页/文件/命令),
|
|
40
|
+
// 模型没经用户确认就记了下来。给的是"引用前先核实"的提示,不是"这条是假的"。
|
|
41
|
+
// 默认路径(模型自己总结的事实)不加标记,保持零噪音。
|
|
42
|
+
if (e.origin === 'tool_output')
|
|
43
|
+
parts.push('UNVERIFIED-ORIGIN');
|
|
39
44
|
return parts.length > 0 ? ` [${parts.join(' | ')}]` : '';
|
|
40
45
|
}
|
|
41
46
|
export const memorySearchTool = {
|
|
@@ -14,8 +14,10 @@ function parseAnchorInputs(raw) {
|
|
|
14
14
|
const p = typeof a.path === 'string' ? a.path.trim() : '';
|
|
15
15
|
if (!p)
|
|
16
16
|
continue;
|
|
17
|
+
// R7.1:非法 kind 按 file 处理(与 memory_save 同口径),不因此丢整条锚点。
|
|
18
|
+
const k = a.kind === 'dir' || a.kind === 'url' ? a.kind : undefined;
|
|
17
19
|
const s = typeof a.symbol === 'string' ? a.symbol.trim() : '';
|
|
18
|
-
out.push({ path: p, ...(s ? { symbol: s } : {}) });
|
|
20
|
+
out.push({ ...(k ? { kind: k } : {}), path: p, ...(s ? { symbol: s } : {}) });
|
|
19
21
|
}
|
|
20
22
|
return out;
|
|
21
23
|
}
|
|
@@ -44,11 +46,19 @@ export const memoryUpdateTool = {
|
|
|
44
46
|
},
|
|
45
47
|
anchors: {
|
|
46
48
|
type: 'array',
|
|
47
|
-
description: '
|
|
49
|
+
description: 'Anchors — REPLACES the whole set (pass [] to clear). kind=file (default) for a file or symbol; dir for a directory (detects added/removed/renamed entries, not edits inside files); url for a web page (provenance only, never fetched so never verified). Pass paths/symbols only; hashes are recomputed at write time. Use this so a later change surfaces the memory as stale instead of silently serving an outdated fact.',
|
|
48
50
|
items: {
|
|
49
51
|
type: 'object',
|
|
50
52
|
properties: {
|
|
51
|
-
|
|
53
|
+
kind: {
|
|
54
|
+
type: 'string',
|
|
55
|
+
enum: ['file', 'dir', 'url'],
|
|
56
|
+
description: 'Default "file". Use "dir" for a directory, "url" for a web page.',
|
|
57
|
+
},
|
|
58
|
+
path: {
|
|
59
|
+
type: 'string',
|
|
60
|
+
description: 'Workspace-relative file/directory path, or an http(s) URL when kind=url',
|
|
61
|
+
},
|
|
52
62
|
symbol: {
|
|
53
63
|
type: 'string',
|
|
54
64
|
description: 'Optional function/class/const name; prefers a fragment over the whole file',
|
|
@@ -529,7 +529,12 @@ export async function promptWithSlashMenu(opts) {
|
|
|
529
529
|
computeFiltered();
|
|
530
530
|
redraw();
|
|
531
531
|
}
|
|
532
|
-
/**
|
|
532
|
+
/**
|
|
533
|
+
* Ctrl+C 分级清空(仿 fish,逐级放弃当前输入,最后一级才退出):
|
|
534
|
+
* 1. 有文本/菜单/粘贴缓冲 → 只清文本(留快照供 Ctrl+Z 还原);
|
|
535
|
+
* 2. 文本已空但有待发图片 → 清附件(Ctrl+Y 刚截的图,避免误清故单独一级);
|
|
536
|
+
* 3. 都空 → 退出(SIGINT)。
|
|
537
|
+
*/
|
|
533
538
|
function onCtrlC() {
|
|
534
539
|
const flat = segs.map((s) => s.text).join('');
|
|
535
540
|
const hasContent = flat.length > 0 || menuOpen || pasteState.pasteParts.length > 0 || pasteState.pasting;
|
|
@@ -537,6 +542,11 @@ export async function promptWithSlashMenu(opts) {
|
|
|
537
542
|
clearInput();
|
|
538
543
|
return;
|
|
539
544
|
}
|
|
545
|
+
if (opts.hasPendingAttachments?.()) {
|
|
546
|
+
opts.clearPendingAttachments?.();
|
|
547
|
+
redraw(); // 脚栏 chip 擦除(sync 已更新 layout state,这里触发重画)
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
540
550
|
cleanup();
|
|
541
551
|
reject(new Error('SIGINT'));
|
|
542
552
|
}
|