summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authoraichat-agent <agent@aichat.local>2026-10-01 14:58:06 +0000
committeraichat-agent <agent@aichat.local>2026-10-01 15:54:19 +0000
commit83a2cd1ac24ca0feda34ae877aaf31f41b58b86c (patch)
treecbc83678fa05fe6a82908c448a4e20eae673a9c7 /src/main.rs
parent82976d349ad97ac9aae0655ad631dace5e2a6385 (diff)
downloadaichat-83a2cd1ac24ca0feda34ae877aaf31f41b58b86c.tar.gz
feat: add built-in subquery tool with hierarchical query ids
* Add config options subquery and subquery_max_depth. * Register an internal subquery function that spawns a fresh LLM query with the current model configuration but without the full context. The model selects context numerically (message_indexes) or by text excerpt (excerpts). * Subqueries can use tools, including further nested subqueries up to subquery_max_depth. * Queries and subqueries get hierarchical ids ([0], [0/1], [0/1/2]) that prefix tool-call prints and spinner messages.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 369a282..b30d022 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -195,10 +195,12 @@ async fn run(config: GlobalConfig, cli: Cli, text: Option<String>) -> Result<()>
#[async_recursion::async_recursion]
async fn start_directive(
config: &GlobalConfig,
- input: Input,
+ mut input: Input,
code_mode: bool,
abort_signal: AbortSignal,
) -> Result<()> {
+ let root_id = crate::utils::next_query_id(&[]);
+ input.set_query_path(vec![root_id]);
let client = input.create_client()?;
let extract_code = !*IS_STDOUT_TERMINAL && code_mode;
config.write().before_chat_completion(&input)?;