release: v2.1.4 isolated HTTP execute (ADR 0009)
Default execute/sse-live/stream to Supervisor worker pool; MR-01 gold; /_runtime/*; bump CLI/wasm/ext to 2.1.4. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
58e13ee6d3
commit
3cabe53da2
56 files changed
+4957
-304
No files matched your search
+49
-9
@@ -322,6 +322,42 @@ unsafe extern "C" fn host_query(
|
||||
}
|
||||
};
|
||||
|
||||
let args_owned: Option<String> = if args_json.is_null() {
|
||||
None
|
||||
} else {
|
||||
CStr::from_ptr(args_json)
|
||||
.to_str()
|
||||
.ok()
|
||||
.map(|s| s.to_string())
|
||||
};
|
||||
|
||||
// Control plane (admit/cancel/events) must not take INVOKE_LOCK or require
|
||||
// an evaluating HostContext — otherwise cancel cannot interrupt a busy run.
|
||||
if name == "runtime" {
|
||||
let raw = args_owned.as_deref().unwrap_or("{}");
|
||||
let args: serde_json::Value = match serde_json::from_str(if raw.trim().is_empty() {
|
||||
"{}"
|
||||
} else {
|
||||
raw
|
||||
}) {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
set_err(&format!("runtime args: {e}"));
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
match crate::runtime::host_api::handle(&args) {
|
||||
Ok(j) => {
|
||||
set_out(&j.to_string());
|
||||
return 0;
|
||||
}
|
||||
Err(e) => {
|
||||
set_err(&e);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let ctx_ptr = CURRENT_HOST.with(|c| c.get());
|
||||
let ctx_ptr = if ctx_ptr.is_null() {
|
||||
global_host_slot()
|
||||
@@ -348,15 +384,6 @@ unsafe extern "C" fn host_query(
|
||||
}
|
||||
let ctx = &mut *ctx_ptr;
|
||||
|
||||
let args_owned: Option<String> = if args_json.is_null() {
|
||||
None
|
||||
} else {
|
||||
CStr::from_ptr(args_json)
|
||||
.to_str()
|
||||
.ok()
|
||||
.map(|s| s.to_string())
|
||||
};
|
||||
|
||||
let result = match name {
|
||||
"module_source" => agent_rt::module_source(ctx).and_then(|v| value_to_json(&v)),
|
||||
"call_site" => agent_rt::call_site(ctx, Some(ctx.current_line)).and_then(|v| value_to_json(&v)),
|
||||
@@ -364,6 +391,19 @@ unsafe extern "C" fn host_query(
|
||||
"cwd" => Ok(serde_json::Value::String(
|
||||
ctx.cwd.to_string_lossy().into_owned(),
|
||||
)),
|
||||
"entry_path" => {
|
||||
let path = ctx.entry_path.clone().unwrap_or_else(|| ctx.cwd.clone());
|
||||
let abs = if path.is_absolute() {
|
||||
path
|
||||
} else {
|
||||
std::env::current_dir()
|
||||
.unwrap_or_else(|_| PathBuf::from("."))
|
||||
.join(path)
|
||||
};
|
||||
Ok(serde_json::Value::String(
|
||||
abs.to_string_lossy().into_owned(),
|
||||
))
|
||||
}
|
||||
"entry_dir" => {
|
||||
// Script directory: parent of entry file (for_run also sets ctx.cwd to this).
|
||||
let dir = ctx
|
||||
|
||||
+12
-1
@@ -695,7 +695,9 @@ fn require<'a>(bound: &'a HashMap<String, Value>, key: &str) -> Result<&'a Value
|
||||
.ok_or_else(|| format!("host call missing `{key}`"))
|
||||
}
|
||||
|
||||
/// Propagate run/selection identity when parent has them (api_key stays via process inheritance).
|
||||
/// Propagate run/selection identity onto the *child* Command.env map.
|
||||
/// Reads parent env only as a fallback when an explicit RunContext was not
|
||||
/// applied; never uses parent `setenv`/`set_current_dir` as request state (M-R1).
|
||||
fn apply_run_selection_env(cmd: &mut Command) {
|
||||
for key in [
|
||||
"MARQDO_RUN_ID",
|
||||
@@ -703,6 +705,13 @@ fn apply_run_selection_env(cmd: &mut Command) {
|
||||
"MARQDO_TURN_ID",
|
||||
"MARQDO_WORKSPACE_SCOPE",
|
||||
"MARQDO_CANCEL_TOKEN",
|
||||
"MARQDO_EVENT_FORWARD",
|
||||
"MARQDO_USAGE_SINK",
|
||||
"MARQDO_CREDENTIAL_REF",
|
||||
"MARQDO_WORKSPACE_ID",
|
||||
"MARQDO_SNAPSHOT_ID",
|
||||
"MARQDO_LEASE_ID",
|
||||
"MARQDO_ATTEMPT_ID",
|
||||
"MARQDO_LLM_MODEL",
|
||||
"MARQDO_LLM_BASE_URL",
|
||||
"OPENAI_MODEL",
|
||||
@@ -712,6 +721,8 @@ fn apply_run_selection_env(cmd: &mut Command) {
|
||||
cmd.env(key, v);
|
||||
}
|
||||
}
|
||||
// Do not forward process-global MARQDO_CANCEL into children — request cancel
|
||||
// must use MARQDO_CANCEL_TOKEN so leases stay isolated.
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in new issue
Block a user