mocode-ai 1.3.8 → 1.3.10

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.
@@ -194,8 +194,13 @@ function finishStandaloneBatch(id, expandSingleEntry) {
194
194
  batch.endBatch(id, layout);
195
195
  if (expandSingleEntry)
196
196
  batch.expandSingleEntryFully(id, layout);
197
- // mutation 独占批收尾:分隔空行由 flushToolBatch 负责(见 subAgentGroupPendingSeparator);
198
- // 不再有 sub-agent 独占批——sub-agent 已合并进组容器批。
197
+ // mutation 独占批收尾:currentBatchId 已置空。若不告知后续正文「刚出工具块」,
198
+ // writeAssistantText inToolBlock 会判 false,LLM 流式前缀的 \n / \n\n 就不会被剥掉,
199
+ // 与 expandSingleEntryFully 已写的 separator 叠成 2 行空白(edit_file 后偶发空两行)。
200
+ // 置位后与 sub-agent 组收口走同一条对称路径;separator 已由 expandSingleEntryFully
201
+ // 内部 commit,后续 flush 由 isLastContentRowBlank 守卫拦住,不会多补一行。
202
+ // 只读批无需此标记:它的 currentBatchId 一直挂到正文到达,inToolBlock 天然为 true。
203
+ subAgentGroupPendingSeparator = true;
199
204
  }
200
205
  /** 将跨 LLM 工具轮次累计的调用写入内容区;正文开始或整个 turn 收尾时才切批。 */
201
206
  function flushToolBatch(expandSingleEntry = false) {
@@ -1561,8 +1561,12 @@ export async function startRepl(initialHistory, sessionId, sandboxRootOverride,
1561
1561
  if (line === '/clear') {
1562
1562
  history.length = 1; // 保留 system 提示
1563
1563
  resetState(); // 同步清空回滚轮次/快照
1564
- currentSessionId = undefined; // 下轮起新会话文件
1565
- setCurrentSessionId(undefined, process.cwd()); // 同步清空 session/state
1564
+ // /clear 立刻换新会话 id:之前延后到 turn 收尾(line 1334)分配,但 runAgent 期间模型
1565
+ // plan_update / note_append 会命中「no active session」——它们写 notes.md 靠
1566
+ // getNotesFilePath(getCurrentSessionId()),而下一个 turn 还没走完。改为与启动对齐
1567
+ // 立即分配(对照 line 1019):notes.md 由写入时按需建文件,这里预分配 id 不触盘。
1568
+ currentSessionId = newSessionId();
1569
+ setCurrentSessionId(currentSessionId, process.cwd()); // 同步到 session/state
1566
1570
  turnCount = 0; // 反思 cadence 重新计数
1567
1571
  contextState.lastUsage = undefined;
1568
1572
  contextState.lifecycleStats = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mocode-ai",
3
- "version": "1.3.8",
3
+ "version": "1.3.10",
4
4
  "description": "终端编码 agent:LLM + tool-call 循环 + 流式输出(含思考)+ 16 个工具,接任意 OpenAI 兼容后端。",
5
5
  "type": "module",
6
6
  "bin": {