Move LLM and agent into ext/ai with host tool catalog and call_fn.

Consolidate official AI extensions under ext/ai/, add agent history/context host APIs, dynamic call_fn, and a first-pass TOOL:name loop so runbooks can list zero-arg tools in a table.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-08-06 15:28:39 +08:00
1 parent c4ffb9473f
commit 92d88fe761
29 files changed
+1019 -558

No files matched your search

+6 -2
View File
@@ -171,7 +171,8 @@ pub fn run_file(path: &Path, opts: &RunOptions) -> Result<i32> {
match opts.backend {
Backend::Tree => {
let host = HostContext::for_run(Some(path), opts.host_caps(), opts.argv.clone());
let mut host = HostContext::for_run(Some(path), opts.host_caps(), opts.argv.clone());
host.set_entry_source(Some(path), &source);
let mut interp = Interpreter::new(Some(path), opts.trace_eval)
.with_stdin(stdin_lines.clone())
.with_host(host);
@@ -190,7 +191,8 @@ pub fn run_file(path: &Path, opts: &RunOptions) -> Result<i32> {
if opts.dump_bytecode {
print!("{}", program.disassemble());
}
let host = HostContext::for_run(Some(path), opts.host_caps(), opts.argv.clone());
let mut host = HostContext::for_run(Some(path), opts.host_caps(), opts.argv.clone());
host.set_entry_source(Some(path), &source);
let mut vm = Vm::new(Some(path))
.with_stdin(stdin_lines)
.with_trace(opts.trace_eval)
@@ -225,6 +227,7 @@ pub fn run_file_capture(path: &Path, opts: &RunOptions) -> Result<RunCapture> {
match opts.backend {
Backend::Tree => {
let mut host = HostContext::for_capture(Some(path), opts.host_caps());
host.set_entry_source(Some(path), &source);
host.argv = opts.argv.clone();
if let Some(root) = &opts.fs_root {
host.fs_root = Some(root.clone());
@@ -246,6 +249,7 @@ pub fn run_file_capture(path: &Path, opts: &RunOptions) -> Result<RunCapture> {
Backend::Bytecode => {
let program = compile_module(Some(path), &module)?;
let mut host = HostContext::for_capture(Some(path), opts.host_caps());
host.set_entry_source(Some(path), &source);
host.argv = opts.argv.clone();
if let Some(root) = &opts.fs_root {
host.fs_root = Some(root.clone());