feat: Added direct script invocation support for graph-based agents
This commit is contained in:
+15
-1
@@ -50,8 +50,11 @@ enum BinaryType<'a> {
|
||||
Agent,
|
||||
}
|
||||
|
||||
/// Canonical set of script languages that Loki can execute. This is the
|
||||
/// single source of truth for both function-tool scripts and graph script
|
||||
/// nodes.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, AsRefStr)]
|
||||
enum Language {
|
||||
pub enum Language {
|
||||
Bash,
|
||||
Python,
|
||||
TypeScript,
|
||||
@@ -90,6 +93,17 @@ impl Language {
|
||||
}
|
||||
}
|
||||
|
||||
impl Language {
|
||||
pub fn direct_invoker(self) -> Option<(&'static str, &'static [&'static str])> {
|
||||
match self {
|
||||
Language::Bash => Some(("bash", &[])),
|
||||
Language::Python => Some(("python3", &[])),
|
||||
Language::TypeScript => Some(("npx", &["tsx"])),
|
||||
Language::Unsupported => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn extract_shebang_runtime(path: &Path) -> Option<String> {
|
||||
let file = File::open(path).ok()?;
|
||||
let reader = io::BufReader::new(file);
|
||||
|
||||
Reference in New Issue
Block a user