toolsrv: auto-load tools on first use
When an agent calls a tool that exists but isn't loaded, toolsrv now automatically loads it instead of returning an error. This eliminates the round-trip of a separate load call. - Remove Registry.Exists() (superseded by auto-load logic) - Fire OnToolsChanged callback after auto-load so olliesrv can update tool definitions for subsequent turns
This commit is contained in:
parent
b1a59e3e84
commit
4750966048
|
|
@ -275,7 +275,14 @@ func (st *State) NewProc(ctx context.Context, payload string, background bool) (
|
|||
|
||||
info, ok := reg.Lookup(aid, toolName)
|
||||
if !ok {
|
||||
return "", 0, fmt.Errorf("tool not found: %s", toolName)
|
||||
// Auto-load if tool exists
|
||||
if err := reg.Load(aid, toolName); err != nil {
|
||||
return "", 0, err // "tool not found: X"
|
||||
}
|
||||
info, _ = reg.Lookup(aid, toolName)
|
||||
if st.OnToolsChanged != nil {
|
||||
st.OnToolsChanged()
|
||||
}
|
||||
}
|
||||
|
||||
// Create proc context. For background procs, detach from request context
|
||||
|
|
|
|||
Loading…
Reference in New Issue