agent: add Core.Close() to manage session tmpdir lifecycle

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-04-14 19:29:50 +02:00
parent c03f9386c1
commit 8b3b6bd281
2 changed files with 11 additions and 0 deletions

View File

@ -300,6 +300,13 @@ func NewAgentCore(cfg AgentCoreConfig) Core {
}
}
// Close releases resources for this session, including its tmpdir.
func (s *agentCore) Close() {
if s.sessionID != "" {
os.RemoveAll("/tmp/ollie/" + s.sessionID) //nolint:errcheck
}
}
func (s *agentCore) prompt() string {
return fmt.Sprintf("[%s :: %s] ", s.loopcfg.Backend.Name(), s.agentName)
}

View File

@ -93,6 +93,10 @@ type Core interface {
// SystemPrompt returns the fully rendered system prompt for this session.
SystemPrompt() string
// Close releases resources associated with the session, including its
// temporary directory under /tmp/ollie/.
Close()
}
// PromptFIFO is a simple thread-safe FIFO for queued prompts.