merge: integrate main seahorse context changes

This commit is contained in:
Hoshina committed 2026-04-13 23:02:38 +08:00
commit 69ff6909e1
28 files changed
+445 -80

No files matched your search

+7 -10
View File
@@ -3639,7 +3639,7 @@ func (al *AgentLoop) handleCommand(
return "", false
}
rt := al.buildCommandsRuntime(agent, opts)
rt := al.buildCommandsRuntime(ctx, agent, opts)
executor := commands.NewExecutor(al.cmdRegistry, rt)
var commandReply string
@@ -3762,7 +3762,11 @@ func (al *AgentLoop) applyExplicitSkillCommand(
return true, false, ""
}
func (al *AgentLoop) buildCommandsRuntime(agent *AgentInstance, opts *processOptions) *commands.Runtime {
func (al *AgentLoop) buildCommandsRuntime(
ctx context.Context,
agent *AgentInstance,
opts *processOptions,
) *commands.Runtime {
normalizeProcessOptionsInPlace(opts)
registry := al.GetRegistry()
@@ -3846,14 +3850,7 @@ func (al *AgentLoop) buildCommandsRuntime(agent *AgentInstance, opts *processOpt
if opts == nil {
return fmt.Errorf("process options not available")
}
if agent.Sessions == nil {
return fmt.Errorf("sessions not initialized for agent")
}
agent.Sessions.SetHistory(opts.Dispatch.SessionKey, make([]providers.Message, 0))
agent.Sessions.SetSummary(opts.Dispatch.SessionKey, "")
agent.Sessions.Save(opts.Dispatch.SessionKey)
return nil
return al.contextManager.Clear(ctx, opts.SessionKey)
}
}
return rt