provenance: pass directly through thought::dispatch, remove globals

Provenance now flows as a function parameter through the entire tool
dispatch chain: thought::dispatch → memory::dispatch → store methods.

Removed task_local (TASK_AGENT), thread_local (TASK_PHASE), and env
var (POC_PROVENANCE) from the tool dispatch path. The env var remains
only as a fallback for non-tool paths (CLI commands, digest).

Phase names are passed from knowledge.rs → llm.rs → api.rs, and
api.rs updates the provenance string between steps. No globals needed.
This commit is contained in:
ProofOfConcept 2026-03-27 15:44:39 -04:00
parent 36bde60ba0
commit 92ca2bf2c8
7 changed files with 34 additions and 47 deletions

View file

@ -20,7 +20,8 @@ pub(crate) fn call_simple(caller: &str, prompt: &str) -> Result<String, String>
};
let prompts = vec![prompt.to_string()];
super::api::call_api_with_tools_sync(caller, &prompts, None, None, &log)
let phases = vec![];
super::api::call_api_with_tools_sync(caller, &prompts, &phases, None, None, &log)
}
/// Call a model using an agent definition's configuration (multi-step).
@ -28,10 +29,11 @@ pub(crate) fn call_simple(caller: &str, prompt: &str) -> Result<String, String>
pub(crate) fn call_for_def_multi(
def: &super::defs::AgentDef,
prompts: &[String],
phases: &[String],
bail_fn: Option<&(dyn Fn(usize) -> Result<(), String> + Sync)>,
log: &(dyn Fn(&str) + Sync),
) -> Result<String, String> {
super::api::call_api_with_tools_sync(&def.agent, prompts, def.temperature, bail_fn, log)
super::api::call_api_with_tools_sync(&def.agent, prompts, phases, def.temperature, bail_fn, log)
}