mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-04 09:07:29 +08:00
Add autonomous world runtime
This commit is contained in:
@@ -443,6 +443,7 @@ func NewAgentLoop(cfg *config.Config, msgBus *bus.MessageBus, provider providers
|
||||
loop.model = strings.TrimSpace(primaryModel)
|
||||
}
|
||||
go loop.runAgentDigestTicker()
|
||||
go loop.runWorldTicker()
|
||||
// Initialize provider fallback chain (primary + inferred providers).
|
||||
loop.providerChain = []providerCandidate{}
|
||||
loop.providerPool = map[string]providers.LLMProvider{}
|
||||
@@ -2840,6 +2841,19 @@ func (al *AgentLoop) runAgentDigestTicker() {
|
||||
}
|
||||
}
|
||||
|
||||
func (al *AgentLoop) runWorldTicker() {
|
||||
if al == nil || al.worldRuntime == nil || !al.worldRuntime.Enabled() {
|
||||
return
|
||||
}
|
||||
ticker := time.NewTicker(3 * time.Second)
|
||||
defer ticker.Stop()
|
||||
for range ticker.C {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||
_, _ = al.worldRuntime.AutoTick(ctx, "world_loop")
|
||||
cancel()
|
||||
}
|
||||
}
|
||||
|
||||
func (al *AgentLoop) flushDueAgentDigests(now time.Time) {
|
||||
if al == nil || al.bus == nil {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user