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:
1 parent
b6bb42e460
commit
d1ddb74235
16 files changed
+606
-111
No files matched your search
@@ -8,7 +8,7 @@ description: extract_plan_decision/summary; dual skeleton contains research+writ
|
||||
|
||||
# main
|
||||
|
||||
*`samples` = > json.parse text={"done":"DECISION: DONE\nSUMMARY: all good\n","cont":"DECISION: CONTINUE\nPATCH:\n<<<\nFIND\nold\n===\nREPLACE\nnew\n>>>\n","zh":"决定:完成\n汇总:好了\n"} *
|
||||
*`samples` = > json.parse text={"done":"DECISION: DONE\nSUMMARY: all good\n","cont":"DECISION: CONTINUE\nPATCH:\n<<<\nFIND\nold\n===\nREPLACE\nnew\n>>>\n","zh":"决定:完成\n汇总:好了\n","run":"DECISION: RUN\n","zh_run":"决定:运行\n"} *
|
||||
*`d1` = > json.get value=`samples` key=done *
|
||||
*`r1` = > agent.extract_plan_decision reply=`d1` *
|
||||
> print text=`r1`
|
||||
@@ -23,6 +23,14 @@ description: extract_plan_decision/summary; dual skeleton contains research+writ
|
||||
*`r3` = > agent.extract_plan_decision reply=`d3` *
|
||||
> print text=`r3`
|
||||
|
||||
*`d4` = > json.get value=`samples` key=run *
|
||||
*`r4` = > agent.extract_plan_decision reply=`d4` *
|
||||
> print text=`r4`
|
||||
|
||||
*`d5` = > json.get value=`samples` key=zh_run *
|
||||
*`r5` = > agent.extract_plan_decision reply=`d5` *
|
||||
> print text=`r5`
|
||||
|
||||
*`dual` = > agent.render_workbook_skeleton goal=demo skeleton=dual *
|
||||
*`has_r` = > split value=`dual` sep=research *
|
||||
*`n_r` = > len value=`has_r` *
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
---
|
||||
title: ext llm DeepSeek stream live
|
||||
description: Live SSE complete with echo; credentials from tests/ext/.env.
|
||||
> ext/ai/llm.mq.md
|
||||
> lib/json.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
> llm.load_env path=.env
|
||||
|
||||
*`model` = > llm.llm *
|
||||
|
||||
*`events` = > `model`.complete prompt=Reply with exactly one English word: pong stream=True echo=True *
|
||||
*`n` = > len value=`events` *
|
||||
> print text=`n`
|
||||
|
||||
*`answer` = > llm.stream_result events=`events` *
|
||||
> print text=`answer`
|
||||
+42
-1
@@ -1241,7 +1241,7 @@ fn ext_agent_plan_confirm() {
|
||||
fn ext_agent_plan_decision() {
|
||||
assert_out(
|
||||
"tests/ext/agent-plan-decision.mq.md",
|
||||
"DONE\nall good\nCONTINUE\nDONE\ndual-ok\nsolidify-ok\n1\nkeep new keep",
|
||||
"DONE\nall good\nCONTINUE\nDONE\nRUN\nRUN\ndual-ok\nsolidify-ok\n1\nkeep new keep",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1262,6 +1262,33 @@ fn ext_llm_complete_live() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ext_llm_stream_live() {
|
||||
let output = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
||||
.args(["run", "tests/ext/llm-stream-live.mq.md"])
|
||||
.current_dir(env!("CARGO_MANIFEST_DIR"))
|
||||
.output()
|
||||
.expect("run llm-stream-live");
|
||||
let code = output.status.code().unwrap_or(1);
|
||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
assert_eq!(code, 0, "llm-stream-live stderr={stderr}");
|
||||
let lines: Vec<&str> = stdout.trim_end().lines().collect();
|
||||
assert!(
|
||||
lines.len() >= 2,
|
||||
"llm-stream-live expected echo line + count + answer, got {stdout:?}"
|
||||
);
|
||||
let answer = lines.last().unwrap().to_lowercase();
|
||||
assert!(
|
||||
answer.contains("pong"),
|
||||
"expected pong in streamed answer, got {stdout:?}"
|
||||
);
|
||||
let n: usize = lines[lines.len() - 2]
|
||||
.parse()
|
||||
.unwrap_or(0);
|
||||
assert!(n >= 2, "expected at least delta+done events, n={n} stdout={stdout:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ext_agent_run_live() {
|
||||
let status = Command::new("cargo")
|
||||
@@ -1373,6 +1400,20 @@ Hello",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lib_net_openai_sse_reasoning() {
|
||||
assert_out(
|
||||
"tests/lib/net-openai-sse-reasoning.mq.md",
|
||||
"3
|
||||
reasoning
|
||||
think
|
||||
delta
|
||||
Hi
|
||||
done
|
||||
Hi",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ext_llm_stream_offline() {
|
||||
assert_out("tests/ext/llm-stream-offline.mq.md", "Hi!");
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
title: openai SSE reasoning_content offline
|
||||
description: DeepSeek-style thinking streams as type=reasoning; answer stays delta/done.result.
|
||||
> lib/net.mq.md
|
||||
> lib/json.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
*`fixture` = "data: {\"choices\":[{\"delta\":{\"reasoning_content\":\"think\"}}]}\n\ndata: {\"choices\":[{\"delta\":{\"content\":\"Hi\"}}]}\n\ndata: [DONE]\n" *
|
||||
|
||||
*`events` = > net.openai_sse_parse text=`fixture` *
|
||||
*`n` = > len value=`events` *
|
||||
> print text=`n`
|
||||
|
||||
*`e0` = > at value=`events` index=0 *
|
||||
*`t0` = > json.get value=`e0` key=type *
|
||||
*`x0` = > json.get value=`e0` key=text *
|
||||
> print text=`t0`
|
||||
> print text=`x0`
|
||||
|
||||
*`e1` = > at value=`events` index=1 *
|
||||
*`t1` = > json.get value=`e1` key=type *
|
||||
*`x1` = > json.get value=`e1` key=text *
|
||||
> print text=`t1`
|
||||
> print text=`x1`
|
||||
|
||||
*`e2` = > at value=`events` index=2 *
|
||||
*`t2` = > json.get value=`e2` key=type *
|
||||
*`r2` = > json.get value=`e2` key=result *
|
||||
> print text=`t2`
|
||||
> print text=`r2`
|
||||
Reference in new issue
Block a user