mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
329e68e017
* refactor(agent): introduce interfaces for MessageBus and ChannelManager Phase 2 of loop.go refactor — dependency inversion using adapter pattern. - Add interfaces.MessageBus and interfaces.ChannelManager interfaces - Create adapters/messagebus.go wrapping *bus.MessageBus - Create adapters/channelmanager.go wrapping *channels.Manager - Update AgentLoop to use interfaces instead of concrete types - Update registerSharedTools to accept interfaces.MessageBus Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(agent): restructure pipeline and rename loop files Pipeline refactoring: - Split pipeline.go (1400 lines) into focused files: - pipeline_setup.go (~115 lines): SetupTurn method - pipeline_llm.go (~519 lines): CallLLM method - pipeline_execute.go (~693 lines): ExecuteTools method - pipeline_finalize.go (~78 lines): Finalize method - Pipeline struct and NewPipeline remain in pipeline.go (~39 lines) Agent file renaming: - Rename loop_*.go to agent_*.go for consistent naming: - loop.go -> agent.go, loop_message.go -> agent_message.go, etc. - Merge turn.go + turn_exec.go into turn_state.go - Rename loop_turn.go -> turn_coord.go Documentation: - Update docs/pipeline-restructuring-plan.md - Add docs/agent-rename-plan.md Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(agent): code format fixed * refactor(agent): code test file added/renamed * docs(agent): update agent refactor docs * fix(agent): fix agent hardAbortX --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
41 lines
1.2 KiB
Go
41 lines
1.2 KiB
Go
// PicoClaw - Ultra-lightweight personal AI agent
|
|
|
|
package agent
|
|
|
|
import (
|
|
"github.com/sipeed/picoclaw/pkg/agent/interfaces"
|
|
"github.com/sipeed/picoclaw/pkg/config"
|
|
"github.com/sipeed/picoclaw/pkg/media"
|
|
"github.com/sipeed/picoclaw/pkg/providers"
|
|
)
|
|
|
|
// Pipeline holds the runtime dependencies used by Pipeline methods.
|
|
// It is constructed by runTurn via NewPipeline and passed to sub-methods
|
|
// so that the coordinator can delegate phase execution.
|
|
type Pipeline struct {
|
|
Bus interfaces.MessageBus
|
|
Cfg *config.Config
|
|
ContextManager ContextManager
|
|
Hooks *HookManager
|
|
Fallback *providers.FallbackChain
|
|
ChannelManager interfaces.ChannelManager
|
|
MediaStore media.MediaStore
|
|
Steering any // TODO: *Steering
|
|
al *AgentLoop
|
|
}
|
|
|
|
// NewPipeline creates a Pipeline from an AgentLoop instance.
|
|
func NewPipeline(al *AgentLoop) *Pipeline {
|
|
return &Pipeline{
|
|
Bus: al.bus,
|
|
Cfg: al.GetConfig(),
|
|
ContextManager: al.contextManager,
|
|
Hooks: al.hooks,
|
|
Fallback: al.fallback,
|
|
ChannelManager: al.channelManager,
|
|
MediaStore: al.mediaStore,
|
|
Steering: al.steering,
|
|
al: al,
|
|
}
|
|
}
|