refactor: wave 1 - extract leaf modules, rename catch-all files, split index.ts hooks

- Split 25+ index.ts files into hook.ts + extracted modules
- Rename all catch-all utils.ts/helpers.ts to domain-specific names
- Split src/tools/lsp/ into ~15 focused modules
- Split src/tools/delegate-task/ into ~18 focused modules
- Separate shared types from implementation
- 155 files changed, 60+ new files created
- All typecheck clean, 61 tests pass
This commit is contained in:
YeonGyu-Kim
2026-02-08 13:57:26 +09:00
parent 7a15c1f3f9
commit df03300211
156 changed files with 7280 additions and 6771 deletions
@@ -0,0 +1,55 @@
/**
* Agent/model detection utilities for ultrawork message routing.
*
* Routing logic:
* 1. Planner agents (prometheus, plan) → planner.ts
* 2. GPT 5.2 models → gpt5.2.ts
* 3. Everything else (Claude, etc.) → default.ts
*/
/**
* Checks if agent is a planner-type agent.
* Planners don't need ultrawork injection (they ARE the planner).
*/
export function isPlannerAgent(agentName?: string): boolean {
if (!agentName) return false
const lowerName = agentName.toLowerCase()
if (lowerName.includes("prometheus") || lowerName.includes("planner")) return true
const normalized = lowerName.replace(/[_-]+/g, " ")
return /\bplan\b/.test(normalized)
}
/**
* Checks if model is GPT 5.2 series.
* GPT models benefit from specific prompting patterns.
*/
export function isGptModel(modelID?: string): boolean {
if (!modelID) return false
const lowerModel = modelID.toLowerCase()
return lowerModel.includes("gpt")
}
/** Ultrawork message source type */
export type UltraworkSource = "planner" | "gpt" | "default"
/**
* Determines which ultrawork message source to use.
*/
export function getUltraworkSource(
agentName?: string,
modelID?: string
): UltraworkSource {
// Priority 1: Planner agents
if (isPlannerAgent(agentName)) {
return "planner"
}
// Priority 2: GPT 5.2 models
if (isGptModel(modelID)) {
return "gpt"
}
// Default: Claude and other models
return "default"
}