Add ext/agent layout framework, ext CLI, and docs catch-up.
Ship ABI agent plugin helpers, marqdo ext list/add/remove, and document the agent development roadmap (compose LLM, match/assign). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
b0c777c480
commit
3a7e11c995
45 files changed
+1632
-204
No files matched your search
@@ -80,6 +80,7 @@ pub enum HostFn {
|
||||
PluginLoad = 69,
|
||||
PluginUnload = 70,
|
||||
PluginList = 71,
|
||||
ExtNativePath = 72,
|
||||
}
|
||||
|
||||
impl HostFn {
|
||||
@@ -156,6 +157,7 @@ impl HostFn {
|
||||
69 => Self::PluginLoad,
|
||||
70 => Self::PluginUnload,
|
||||
71 => Self::PluginList,
|
||||
72 => Self::ExtNativePath,
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
@@ -236,6 +238,7 @@ impl HostFn {
|
||||
"host_plugin_load" | "plugin_load" => Self::PluginLoad,
|
||||
"host_plugin_unload" | "plugin_unload" => Self::PluginUnload,
|
||||
"host_plugin_list" | "plugin_list" => Self::PluginList,
|
||||
"host_ext_native_path" | "ext_native_path" => Self::ExtNativePath,
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
@@ -317,6 +320,7 @@ impl HostFn {
|
||||
Self::PluginLoad => "host_plugin_load",
|
||||
Self::PluginUnload => "host_plugin_unload",
|
||||
Self::PluginList => "host_plugin_list",
|
||||
Self::ExtNativePath => "host_ext_native_path",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,6 +365,7 @@ impl HostFn {
|
||||
Self::ForeignLangs => &[],
|
||||
Self::PluginLoad => &["path"],
|
||||
Self::PluginUnload | Self::PluginList => &[],
|
||||
Self::ExtNativePath => &["name"],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -539,6 +544,17 @@ pub fn call_host(
|
||||
HostFn::PluginLoad => plugin::load(ctx, require(bound, "path")?),
|
||||
HostFn::PluginUnload => plugin::unload(ctx),
|
||||
HostFn::PluginList => plugin::list(ctx),
|
||||
HostFn::ExtNativePath => {
|
||||
let name = require(bound, "name")?;
|
||||
let s = match name {
|
||||
Value::Text(t) => t.as_str(),
|
||||
_ => return Err("name must be text".into()),
|
||||
};
|
||||
Ok(match crate::ext_cli::installed_native_path(s) {
|
||||
Some(p) => Value::Text(p.to_string_lossy().into_owned()),
|
||||
None => Value::None,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+16
-1
@@ -172,7 +172,22 @@ pub fn load(ctx: &mut HostContext, path: &Value) -> Result<Value, String> {
|
||||
return Err("plugin_load denied by host policy".into());
|
||||
}
|
||||
let rel = as_text(path, "path")?;
|
||||
let file = ctx.resolve_path(rel)?;
|
||||
let file = match ctx.resolve_path(rel) {
|
||||
Ok(p) => p,
|
||||
Err(e) => {
|
||||
let p = std::path::Path::new(rel);
|
||||
let abs = if p.is_absolute() {
|
||||
p.to_path_buf()
|
||||
} else {
|
||||
ctx.cwd.join(p)
|
||||
};
|
||||
if abs.is_file() && crate::ext_cli::path_is_trusted_plugin(&abs) {
|
||||
abs
|
||||
} else {
|
||||
return Err(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
if !file.is_file() {
|
||||
return Err(format!("plugin_load: not a file: {}", file.display()));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user