feat: Added direct script invocation support for graph-based agents

This commit is contained in:
Dark-Alex-17 committed 2026-05-13 12:35:10 -06:00
1 parent 3535edba79
commit 3cd3ba55ff
3 files changed
+514 -1

No files matched your search

+15 -1
View File
@@ -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);