mocode-ai 1.3.9 → 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.
@@ -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.9",
3
+ "version": "1.3.10",
4
4
  "description": "终端编码 agent:LLM + tool-call 循环 + 流式输出(含思考)+ 16 个工具,接任意 OpenAI 兼容后端。",
5
5
  "type": "module",
6
6
  "bin": {