- CHANGELOG.md:v2.8.0 条目(中英双语); - README.md:版本行 2.7.1→2.8.0 + 愿景第 6 条(知识可证明); - doc/releases/v2.8.0.md:双语发版说明(亮点/用法/已知限制); - skills/marqdo-dev/index.mq.md:新增 prove 任务(路径/目录模式/ require_lean/json;参数用 + 行声明升参,check 与 narrative-ratio 通过); - 设计文档 §12.5 标记已合入;发版链接统一指向 doc/releases/v2.8.0.md。
54 lines
1.8 KiB
Rust
Executable File
54 lines
1.8 KiB
Rust
Executable File
//! Bounded orchestration over existing subtask resources.
|
|
use crate::{
|
|
host::{HostContext, HostFn},
|
|
value::Value,
|
|
};
|
|
use std::collections::HashMap;
|
|
#[cfg(feature = "exec-host")]
|
|
fn arg<'a>(b: &'a HashMap<String, Value>, k: &str) -> Result<&'a Value, String> {
|
|
b.get(k).ok_or_else(|| format!("missing {k}"))
|
|
}
|
|
pub(super) fn call(
|
|
ctx: &mut HostContext,
|
|
id: HostFn,
|
|
b: &HashMap<String, Value>,
|
|
) -> Result<Value, String> {
|
|
#[cfg(feature = "exec-host")]
|
|
{
|
|
fn integer(b: &HashMap<String, Value>, key: &str) -> Result<u64, String> {
|
|
match arg(b, key)? {
|
|
Value::Int(n) if *n >= 0 => Ok(*n as u64),
|
|
_ => Err(format!("{key} must be nonnegative integer")),
|
|
}
|
|
}
|
|
match id {
|
|
HostFn::SubtaskWaitTimeout => {
|
|
let answer = super::subtask::wait_timeout(
|
|
ctx,
|
|
arg(b, "id")?,
|
|
integer(b, "timeout_ms")?,
|
|
matches!(b.get("cancel"), Some(Value::Bool(true))),
|
|
);
|
|
Ok(super::result::capture("subtask.wait_timeout", answer))
|
|
}
|
|
HostFn::SubtaskCancelAll => {
|
|
let count = ctx.subtasks.len();
|
|
super::subtask::kill_all(ctx);
|
|
Ok(Value::Int(count as i64))
|
|
}
|
|
HostFn::SubtaskRunMany => super::subtask::run_many(
|
|
ctx,
|
|
arg(b, "tasks")?,
|
|
integer(b, "limit")? as usize,
|
|
integer(b, "timeout_ms")?,
|
|
),
|
|
_ => Err("not a task operation".into()),
|
|
}
|
|
}
|
|
#[cfg(not(feature = "exec-host"))]
|
|
{
|
|
let _ = (ctx, id, b);
|
|
Err("subtask unavailable in this build".into())
|
|
}
|
|
}
|