func daemonStartTestWithSchedules(t *testing.T, server *ModelFake, bot *TelegramBot, whatsapp *WhatsApp, schedules *Schedules, clock func() time.Time) (string, *Memory) {
t.Helper()
- dir := t.TempDir()
+ dir := socketTestDir(t)
agent, err := openAgent(filepath.Join(dir, daemonAgentDirName))
require.NoError(t, err)
client := newModelClient(server.URL, ModelAPIKey(modelTestKey), agent.CacheKey(), filepath.Join(agent.dir, "usage.jsonl"))
ctx, cancel := context.WithCancel(t.Context())
done := make(chan error)
+ subagents := newTestSubagents(t)
go func() {
done <- daemonServe(ctx, listener, bot, whatsapp, schedules, func(notify func(Event)) (*TurnLoop, error) {
- return newTurnLoop(agent, memory, newTestSubagents(t), whatsapp, schedules, client, clock, discardLog(), notify)
+ return newTurnLoop(agent, memory, subagents, whatsapp, schedules, client, clock, discardLog(), notify)
})
}()