feat(workbench): live selection smoke, F02 agent e2e, DocumentView CLI

Hoist llm.ask prompt binding to avoid elevated `p`; prefer reasoning_content
when content is empty; point live/tests at in-tree MARQDO_EXT; add USTC live
gates and mock agent.step selection+resume evidence; view document --out for
read-only browser embed checks. Design stays Partial (not Verified).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-10-25 23:05:28 +08:00
1 parent 8cf5288481
commit c7c329341b
8 files changed
+467 -5

No files matched your search

+67
View File
@@ -529,6 +529,23 @@ enum ViewAction {
#[arg(short = 'o', long = "out", required = true)]
out: PathBuf,
},
/// Read-only DocumentViewV1 (never executes). JSON to stdout or `--out`.
Document {
/// Project root (defaults to cwd / CLI path)
#[arg(long)]
project: Option<PathBuf>,
/// Document path relative to project
#[arg(long)]
document: String,
#[arg(long)]
json: bool,
/// Optional HTML wrapper for browser inspection (embed fragment only)
#[arg(long, value_name = "FILE")]
out: Option<PathBuf>,
},
}
fn main() -> ExitCode {
@@ -1105,6 +1122,56 @@ fn try_main(cli: Cli) -> Result<i32> {
})?;
Ok(0)
}
Some(ViewAction::Document {
project,
document,
json,
out,
}) => {
let project = project
.or(path)
.unwrap_or_else(|| PathBuf::from("."));
let req = marqdo::workbench::DocumentViewRequest {
project,
document,
revision: None,
generation: None,
node_id: None,
include: vec![
"fragment".into(),
"outline".into(),
"nodes".into(),
"refs".into(),
"diagnostics".into(),
],
};
let view = marqdo::workbench::build_document_view(&req).map_err(|e| {
anyhow::anyhow!("{}", e)
})?;
if let Some(out_path) = out {
let fragment = view
.pointer("/render/fragment")
.and_then(|v| v.as_str())
.unwrap_or("");
let title = view
.pointer("/document/title")
.and_then(|v| v.as_str())
.unwrap_or("DocumentView");
let html = format!(
"<!doctype html><html><head><meta charset=\"utf-8\"/><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"/><title>{title}</title><style>:root{{--mq-bg:#f7f5f0;--mq-text:#1a1a1a;--mq-muted:#5c5c5c;--mq-border:#d0cbc2;--mq-accent:#0b5fff;--mq-font-body:\"Iowan Old Style\",\"Palatino Linotype\",Palatino,serif;--mq-font-code:ui-monospace,Consolas,monospace}}body{{margin:0;background:var(--mq-bg);color:var(--mq-text);font:16px/1.75 var(--mq-font-body)}}.wrap{{max-width:46rem;margin:0 auto;padding:1.5rem}} .mq-document a{{color:var(--mq-accent)}}</style></head><body><div class=\"wrap\">{fragment}</div></body></html>"
);
std::fs::write(&out_path, html)?;
if json {
println!("{}", serde_json::to_string_pretty(&view)?);
} else {
println!("wrote {}", out_path.display());
}
} else {
println!("{}", serde_json::to_string_pretty(&view)?);
}
let _ = json;
Ok(0)
}
None => {
serve(ViewOptions {
path: path.unwrap_or_else(|| PathBuf::from(".")),