Follow-up to the largest-files audit (#125). workers/api/src/agent-do.ts (1298 LOC): DO chat loop, tool execution, storage wiring, repo ingest, and the alarm state machine in one class.
Task (behavior-preserving)
- Extract repo ingest + alarm state machine (
fetching → indexing → summarizing → done) to its own module.
- Move remaining inline chat/tool logic into
agent-think.ts.
- Keep the DO a thin orchestrator.
Constraints
- Keep all api tests green; no change to the internal
https://agent/* route contract.
Follow-up to the largest-files audit (#125).
workers/api/src/agent-do.ts(1298 LOC): DO chat loop, tool execution, storage wiring, repo ingest, and the alarm state machine in one class.Task (behavior-preserving)
fetching → indexing → summarizing → done) to its own module.agent-think.ts.Constraints
https://agent/*route contract.