Release 2.7.0: executable handbooks and native user-site workflows
This commit is contained in:
1 parent
aa0c4d0f55
commit
d9aef957f7
562 files changed
+21064
-20387
No files matched your search
+7
-1
@@ -4032,6 +4032,12 @@ pub fn page_file(files: &[PathBuf], rel: &str, vm: &FileViewModel, links: &LinkM
|
||||
"stream",
|
||||
"Streaming in the panel below…".to_string(),
|
||||
)
|
||||
} else if vm.library_document {
|
||||
(
|
||||
"pending",
|
||||
"module",
|
||||
"这是可调用模块,未自动执行。通过 marqdo call 选择函数并提供参数。".to_string(),
|
||||
)
|
||||
} else if vm.ok {
|
||||
(
|
||||
"ok",
|
||||
@@ -4047,7 +4053,7 @@ pub fn page_file(files: &[PathBuf], rel: &str, vm: &FileViewModel, links: &LinkM
|
||||
} else {
|
||||
("fail", "fail", escape(&vm.stderr))
|
||||
};
|
||||
let stdin_panel = if vm.input_prompts.is_empty() {
|
||||
let stdin_panel = if vm.library_document || vm.input_prompts.is_empty() {
|
||||
String::new()
|
||||
} else {
|
||||
let placeholder = vm.input_prompts.join("\n");
|
||||
|
||||
+21
-3
@@ -430,9 +430,18 @@ pub(crate) fn build_file_view_with_exec(
|
||||
Vec::new(),
|
||||
),
|
||||
};
|
||||
// Named tools are readable modules, not failed programs. Preserve actual
|
||||
// execution for main, object entries and Artifact declarations.
|
||||
let library_document = module_opt.as_ref().is_some_and(|module| {
|
||||
!module.functions.is_empty()
|
||||
&& module.functions.iter().all(|f| !f.is_object() && f.name != "main")
|
||||
&& !module.metadata_raw.iter().any(|(key, _)| key == "type" || key == "类型")
|
||||
});
|
||||
let effective = effective_stdin(&source, stdin_lines);
|
||||
let awaiting_input = awaiting_preset_input(&input_prompts, stdin_lines, &source);
|
||||
let show_stream = module_opt.as_ref().map(uses_stream_panel).unwrap_or(false);
|
||||
let awaiting_input = !library_document
|
||||
&& awaiting_preset_input(&input_prompts, stdin_lines, &source);
|
||||
let show_stream = !library_document
|
||||
&& module_opt.as_ref().map(uses_stream_panel).unwrap_or(false);
|
||||
// Live + LLM/agent import + has `input` + stdin ready → stream via client `/api/run`.
|
||||
let auto_stream = live
|
||||
&& show_stream
|
||||
@@ -454,6 +463,14 @@ pub(crate) fn build_file_view_with_exec(
|
||||
Vec::new(),
|
||||
String::from(r#"<p class="vars-skipped">skipped</p>"#),
|
||||
)
|
||||
} else if library_document {
|
||||
(
|
||||
String::new(),
|
||||
String::new(),
|
||||
true,
|
||||
Vec::new(),
|
||||
String::from(r#"<p class="vars-skipped">Choose a named function with marqdo call.</p>"#),
|
||||
)
|
||||
} else if awaiting_input || auto_stream {
|
||||
(
|
||||
String::new(),
|
||||
@@ -481,7 +498,7 @@ pub(crate) fn build_file_view_with_exec(
|
||||
}
|
||||
};
|
||||
// Re-read after run so writeback slots / workbook edits show in Structure.
|
||||
if execute && !awaiting_input && !auto_stream {
|
||||
if execute && !library_document && !awaiting_input && !auto_stream {
|
||||
if let Ok(next) = fs::read_to_string(abs) {
|
||||
source = next;
|
||||
}
|
||||
@@ -579,6 +596,7 @@ pub(crate) fn build_file_view_with_exec(
|
||||
stdout,
|
||||
stderr,
|
||||
ok,
|
||||
library_document,
|
||||
preset_stdin: effective.join("\n"),
|
||||
input_prompts,
|
||||
awaiting_input,
|
||||
|
||||
@@ -30,6 +30,8 @@ pub struct FileViewModel {
|
||||
pub stdout: String,
|
||||
pub stderr: String,
|
||||
pub ok: bool,
|
||||
/// A callable-only module has no automatic program entry.
|
||||
pub library_document: bool,
|
||||
/// Text shown in the live-view preset stdin box.
|
||||
pub preset_stdin: String,
|
||||
/// One entry per `input` / `输入` call (prompt text; may be empty).
|
||||
|
||||
Reference in new issue
Block a user