Repository navigation
refactor: tighten domain boundaries, drop dead code and Manager/Impl names - #1283
Merged
Merged
Conversation
- Delete 17 event types nothing emits since #684 unified background tracking (A2ATask*, A2AToolCallExecuted, ToolCall{Update,Ready}, Subagent*, Shell{Completed,Failed,Cancelled}) with every receiver: the a2acoord package, the conversation-view background-task bar and the chat-handler/tool-coordinator handlers. - Drop test-only interface methods (ImageService, FileService, GitHubSetupService, A2ATaskTracker, ToolService) and the dead workflow templates behind them. - Drop agentdomain.MCPServerEntry (duplicate of config), unused Has* context helpers; unexport the context keys. - plugins.Installer reuses skills' FetchTree/DownloadFile instead of a copy; githubscheduler uses githubsetup.CommandRunner. - One SubagentResultFile writer/reader (0o600, marshal errors checked) and convdomain.LastAssistantText replace the diverged copies. - One ModelSelectedEvent, one AgentNameFromURL. - Judge verdict/input/approver move from agent/domain into the agent package, their only user. - Remove the depguard rule already covered by presentation-is-a-leaf.
…them - A2A task tracking lives in the scheduler context: the A2ATaskTracker port and TaskPollingState move to scheduler/domain, and the A2A, shell and subagent trackers move from platform/utils to scheduler/infrastructure. - agentrunner (a generic `infer headless` subprocess runner) moves to platform/agentrunner together with FormatAgentMessage, its stdout parser. - presentation/headless no longer imports the composition root: cmd/headless passes a constructor for a headless.Services port, and the container owns StartScreenshotServer for chat and headless. - TUI-only state (chat/tool-execution sessions, approval, plan-approval and question prompts, their enums), TUI-only events and ToolFormatter move from agent/domain to presentation/tui; the agent keeps a one-method RetryStatusSink. - conversation/domain gains the PersistentConversationRepository and SessionRollover ports plus the pure BuildAgentMessagesFromEntries and EnsureToolCallsClosed; presentation stops casting to concrete conversation types. - The container injects the tokenizer, rollover, hook provider and plugin instructions into the agent instead of the agent building them. - download takes an explicit progress callback, the container runtime takes a plain session id, the conversation line formatter moves into tui/components, CapInstructions into platform/formatting, ParseCron (one shared parser) into scheduler/domain. - ScheduledJob gets NewScheduledJob and Apply(JobPatch) so schedule validation and timestamps live on the entity.
- Lifecycle owners of external processes become Supervisors: AgentSupervisor, gateway.Supervisor, mcp.Supervisor / MCPSupervisor. - Download/resolve helpers become stores (audio BinaryStore, ModelStore, TTSModelStore; history.Store), the rest are named for what they do: keybinding.Dispatcher, web.Sessions, conversation.SessionRollover, scheduler.TitleBackfill, filewriter ChunkBuffer / Backup, statemanager.Store with StateStore / stateStore consumer interfaces, tui.ViewNavigator, AgentReadiness. - Agent-side state ports: AgentModeState, TodoList, ComputerUsePause. - Drop the Impl suffix from 15 concrete types (agent.Agent, agent.StateMachine, agentapp.A2AClient, FileService, PricingService, the TUI views and selectors; TaskManagerImpl becomes TaskView). - Container getters follow: GetAgentSupervisor, GetMCPSupervisor, GetGatewaySupervisor, GetSessionRollover, GetStateStore, GetTitleBackfill. Files are renamed to match.
- domain-is-pure: a domain/ package may import only stdlib, external types and agent/domain, now documented as the shared kernel. - container-is-the-root: nothing under internal/ (tests aside) imports internal/container; cmd/ builds it and passes ports in. - AGENTS.md describes the shared kernel, <context>/infrastructure and the schedinfra alias.
Contributor
|
🎉 This PR is included in version 0.207.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A DDD / Clean Architecture / over-engineering audit of the domains, followed by fixes. Four commits, one per phase; each passes
task precommit:runon its own. Net −4,183 lines.1. Dead code and duplicates (
050c101f)a2acoordpackage, the conversation-view background-task bar, and the chat-handler/tool-coordinator handlers. The/tasksview already covers A2A tasks, shells and subagents.pluginsnow reusesskills' GitHubFetchTree/DownloadFileinstead of carrying its own copy.CommandRunner, oneModelSelectedEvent, oneAgentNameFromURL.SubagentResultFilewriter and reader. The headless copy wrote 0o644 and ignored marshal errors; the shared one uses 0o600 and checks errors.agent/domaininto the agent package, their only user.2. Misplaced code moved to its owning context (
627b7475)scheduler/domain, and the trackers move fromplatform/utilstoscheduler/infrastructure.agentrunnermoves toplatform/agentrunner, together withFormatAgentMessage, which parses its output.presentation/headlessno longer importsinternal/container.cmd/headlesspasses aServicesport instead, and the container ownsStartScreenshotServerfor both chat and headless.ToolFormattermove fromagent/domaintopresentation/tui. The agent keeps a single-methodRetryStatusSink.conversation/domaingainsPersistentConversationRepositoryandSessionRollover, plus the pureBuildAgentMessagesFromEntries/EnsureToolCallsClosed. The TUI no longer casts to concrete conversation types.downloadtakes an explicit progress callback.CapInstructionsmoves toplatform/formatting.ParseCronmoves toscheduler/domainand uses one shared parser.ScheduledJobgetsNewScheduledJobandApply(JobPatch), so schedule validation and timestamps live on the entity.3. Domain names instead of
Manager/Impl(f83be330)AgentSupervisor,gateway.Supervisor,mcp.Supervisor).BinaryStore/ModelStore/TTSModelStore,history.Store).keybinding.Dispatcher,web.Sessions,conversation.SessionRollover,scheduler.TitleBackfill,statemanager.Store,tui.ViewNavigator.*Impltypes drop the suffix. Container getters and file names follow.gopls rename, so every reference is updated.4. Enforcement (
9cebcd3f)domain-is-pure: adomain/package may import only stdlib, external types andagent/domain, which is now documented as the shared kernel.container-is-the-root: nothing underinternal/(tests excepted) may importinternal/container.Not done (deliberately)
Toolinterface split: every tool already renders its own UI inFormatResult, so splitting the interface would touch ~60 tools without removing any UI code from them.audio.WAVDurationSeconds, so injecting the synthesizer alone would not remove the dependency.platformplatform/rendersitsplatform/modelsImageService/MCPSupervisorinterfacesTest plan
task precommit:run(mod tidy, mocks, fmt, lint, markdownlint) on every commitgo test ./...,task test:race,task test:e2eINFER_GATEWAY_MOCK=true infer headless --model mock/openai/gpt-4o "hi", including--result-file(written 0o600) and the early--formaterror/tasks,/modelswitch,!echo