Plan parent-first decompose, reasoning streaming, TTY input editing.

Reorder non-hit plan pipeline so the parent decomposes before spawning the child, stream DeepSeek thinking (reasoning_content) to TTY, and add Unicode-aware line editing for interactive input to fix CJK backspace corruption.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-08-10 11:45:58 +08:00
1 parent b6bb42e460
commit d1ddb74235
16 files changed
+606 -111

No files matched your search

+1 -1
View File
@@ -58,7 +58,7 @@
- **大模型配置与父智能体一致**(见 §5)
- 正文:总目标叙述 + 子智能体骨架 / 或父模型生成的首版步骤
▼
③ (可选)父模型「分解」:改写工作簿为更细的步骤 / 多智能体
③ 父模型「分解」(非 OKF 命中路径必跑):`phase=decompose`,尚未 spawn;可 `DECISION: RUN` / `CONTINUE`+补丁 / 固化后 `DONE`
▼
④ lib/subtask:spawn path=<工作簿绝对或相对路径>
▼
+2 -2
View File
@@ -111,7 +111,7 @@ Marqdo 的宪法是 **代码即文档、文档即知识库**:
| | |
|---|---|
| **输入** | 复杂目标 |
| **过程** | 父智能体**创建(或续跑)一份工作簿 `.mq.md`** → 子文件大模型配置与父一致 → **`lib/subtask` `spawn path=`** 运行该文件 → 读结果与写回 → **改代码 / 改写回后再执行**(有轮次上限) |
| **过程** | 父智能体**创建(或续跑)工作簿** →(非命中)**父先分解** → **`lib/subtask` spawn** 跑子文件 → 观察写回 → **父修订补丁后再执行**(有轮次上限) |
| **输出** | 汇总 map(含 `result`)+ 磁盘上的工作簿(代码与 `marqdo-out` 均可演化) |
| **适用** | 需分解、多情形、可固化步骤、可复用子成果的任务 |
@@ -346,4 +346,4 @@ lib/subtask:spawn fn=<名> → wait
**智能体框架必须让编排看起来像文档、跑起来像程序、留痕像知识库。**
单步解决原子问题(默认写回);多步让父智能体编写并修订子 Marqdo 工作簿、经子任务执行、把确定步骤固化为代码——详见 [ext-agent-plan.md](ext-agent-plan.md)。
流式:`## step` / `## plan` 支持 `stream=True` / `echo=True`(SSE 增量;返回 map 不变;`plan` 另附 `events`,可选 `trace` 写回)。见 [agent-streaming.md](../roadmap/agent-streaming.md)。
流式:`## step` / `## plan` 支持 `stream=True` / `echo=True`(SSE 增量;返回 map 不变;`plan` 另附 `events`,可选 `trace` 写回)。非命中时先流式父分解再 spawn 子任务。见 [agent-streaming.md](../roadmap/agent-streaming.md)。
+1 -1
View File
@@ -20,7 +20,7 @@ Resolution: `MARQDO_EXT/ai/…`, repo `ext/ai/…`, cwd `ext/ai/…` (see [ext-c
Other official ext: [ext-agent.md](ext-agent.md) / [ext-agent-plan.md](ext-agent-plan.md) (**document-driven agent** — step with default writeback / plan workbook; thin `TOOL:` loop superseded). Installer: [ext-cli.md](ext-cli.md). Native plugins: [ext-abi.md](ext-abi.md).
Streaming: `complete stream=True` returns an event list (`delta` / `done` / `error`); see [agent-streaming.md](../roadmap/agent-streaming.md). Default (`stream=False`) is unchanged (answer string).
Streaming: `complete stream=True` returns an event list (`reasoning` / `delta` / `done` / `error`); `echo=True` prints thinking (`reasoning_content`) and answer tokens as they arrive. See [agent-streaming.md](../roadmap/agent-streaming.md). Default (`stream=False`) is unchanged (answer string).
**Note:** Prefer `marqdo ext add llm`. Import `> ext/ai/llm.mq.md` from repo or install root.
+6 -4
View File
@@ -62,11 +62,12 @@ ext/ai/agent step/plan 订阅事件 → 可选透传或写回「过程槽」
| `type` | 含义 | 主要字段 |
|--------|------|----------|
| `delta` | 模型增量文本 | `text` |
| `reasoning` | 模型思考增量(如 DeepSeek `reasoning_content`) | `text` |
| `delta` | 模型答案增量文本 | `text` |
| `tool_start` / `tool_end` | 工具轮 | `name`, `result?` |
| `round` | plan 轮次边界 | `round`, `workbook`, `exit_code?` |
| `decision` | DONE / CONTINUE | `decision`, `summary?` |
| `done` | 本调用结束 | `result`(与今日返回值对齐) |
| `decision` | DONE / CONTINUE / RUN | `decision`, `summary?` |
| `done` | 本调用结束 | `result`(答案正文;不含 thinking) |
| `error` | 失败 | `message` |
中英键名可在 L1 包装层镜像;插件/wire 先用英文 `type`。
@@ -148,7 +149,8 @@ S3 view 订阅 (待做)
1. `plan` / `多步` 增加 `stream` / `echo` / `trace`(中文 `流式` / `打印增量` / `轨迹`)。
2. 事件挂在返回 map 的 `events`;父 `complete` 只冒泡 `delta`/`error`(嵌套 `done` 不进列表)。
3. `trace=True` → 写回槽 `trace`(与 TTY `echo` 可分立)。
3. `trace=True` → 写回槽 `trace`(与 TTY `echo` 可分立)。
4. **体验(父先子后)**:非命中路径先 `plan:decompose`(父 pre-run 分解,可流式),再 `plan:await`(子 quiet)。修订轮仍是观察后父决策。SSE 本身用 `tests/ext/llm-stream-live.mq.md`。
验收: