Files
oh-my-opencode/src/hooks/keyword-detector/ultrawork/utils.ts
T
YeonGyu-Kim 110b1e3d2d feat(agents): add Hephaestus - autonomous deep worker agent (#1287)
* refactor(keyword-detector): split constants into domain-specific modules

* feat(shared): add requiresAnyModel and isAnyFallbackModelAvailable

* feat(config): add hephaestus to agent schemas

* feat(agents): add Hephaestus autonomous deep worker

* feat(cli): update model-fallback for hephaestus support

* feat(plugin): add hephaestus to config handler with ordering

* test(delegate-task): update tests for hephaestus agent

* docs: update AGENTS.md files for hephaestus

* docs: add hephaestus to READMEs

* chore: regenerate config schema

* fix(delegate-task): bypass requiresModel check when user provides explicit config

* docs(hephaestus): add 4-part context structure for explore/librarian prompts

* docs: fix review comments from cubic (non-breaking changes)

- Move Hephaestus from Primary Agents to Subagents (uses own fallback chain)
- Fix Hephaestus fallback chain documentation (claude-opus-4-5 → gemini-3-pro)
- Add settings.local.json to claude-code-hooks config sources
- Fix delegate_task parameters in ultrawork prompt (agent→subagent_type, background→run_in_background, add load_skills)
- Update line counts in AGENTS.md (index.ts: 788, manager.ts: 1440)

* docs: fix additional documentation inconsistencies from oracle review

- Fix delegate_task parameters in Background Agents example (docs/features.md)
- Fix Hephaestus fallback chain in root AGENTS.md to match model-requirements.ts

* docs: clarify Hephaestus has no fallback (requires gpt-5.2-codex only)

Hephaestus uses requiresModel constraint - it only activates when gpt-5.2-codex
is available. The fallback chain in code is unreachable, so documentation
should not mention fallbacks.

* fix(hephaestus): remove unreachable fallback chain entries

Hephaestus has requiresModel: gpt-5.2-codex which means the agent only
activates when that specific model is available. The fallback entries
(claude-opus-4-5, gemini-3-pro) were unreachable and misleading.

---------

Co-authored-by: justsisyphus <justsisyphus@users.noreply.github.com>
2026-02-01 19:26:57 +09:00

50 lines
1.3 KiB
TypeScript

/**
* 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()
return lowerName.includes("prometheus") || lowerName.includes("planner") || lowerName === "plan"
}
/**
* 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"
}