refactor: rename OhMyOpenCode types to OhMyOpenAgent and centralize PACKAGE_NAME
- Rename all PascalCase types: OhMyOpenCodePlugin → OhMyOpenAgentPlugin, etc. - 231 OhMyOpenAgent references across ~60 files - Centralize 4 PACKAGE_NAME constants to import from plugin-identity.ts - Update src/plugin-config.ts to use CONFIG_BASENAME from plugin-identity Wave 3 Tasks 5 & 6 complete.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { describe, expect, test } from "bun:test"
|
||||
import type { OhMyOpenCodeConfig } from "../config"
|
||||
import type { OhMyOpenAgentConfig } from "../config"
|
||||
import { applyAgentVariant, resolveAgentVariant, resolveVariantForModel } from "./agent-variant"
|
||||
|
||||
describe("resolveAgentVariant", () => {
|
||||
test("returns undefined when agent name missing", () => {
|
||||
// given
|
||||
const config = {} as OhMyOpenCodeConfig
|
||||
const config = {} as OhMyOpenAgentConfig
|
||||
|
||||
// when
|
||||
const variant = resolveAgentVariant(config)
|
||||
@@ -20,7 +20,7 @@ describe("resolveAgentVariant", () => {
|
||||
agents: {
|
||||
sisyphus: { variant: "low" },
|
||||
},
|
||||
} as OhMyOpenCodeConfig
|
||||
} as OhMyOpenAgentConfig
|
||||
|
||||
// when
|
||||
const variant = resolveAgentVariant(config, "sisyphus")
|
||||
@@ -38,7 +38,7 @@ describe("resolveAgentVariant", () => {
|
||||
categories: {
|
||||
ultrabrain: { model: "openai/gpt-5.4", variant: "xhigh" },
|
||||
},
|
||||
} as OhMyOpenCodeConfig
|
||||
} as OhMyOpenAgentConfig
|
||||
|
||||
// when
|
||||
const variant = resolveAgentVariant(config, "sisyphus")
|
||||
@@ -55,7 +55,7 @@ describe("applyAgentVariant", () => {
|
||||
agents: {
|
||||
sisyphus: { variant: "low" },
|
||||
},
|
||||
} as OhMyOpenCodeConfig
|
||||
} as OhMyOpenAgentConfig
|
||||
const message: { variant?: string } = {}
|
||||
|
||||
// when
|
||||
@@ -71,7 +71,7 @@ describe("applyAgentVariant", () => {
|
||||
agents: {
|
||||
sisyphus: { variant: "low" },
|
||||
},
|
||||
} as OhMyOpenCodeConfig
|
||||
} as OhMyOpenAgentConfig
|
||||
const message = { variant: "max" }
|
||||
|
||||
// when
|
||||
@@ -90,7 +90,7 @@ describe("resolveVariantForModel", () => {
|
||||
agents: {
|
||||
sisyphus: { variant: "high" },
|
||||
},
|
||||
} as OhMyOpenCodeConfig
|
||||
} as OhMyOpenAgentConfig
|
||||
const model = { providerID: "anthropic", modelID: "claude-opus-4-6" }
|
||||
|
||||
// when
|
||||
@@ -102,7 +102,7 @@ describe("resolveVariantForModel", () => {
|
||||
|
||||
test("returns correct variant for anthropic provider", () => {
|
||||
// given
|
||||
const config = {} as OhMyOpenCodeConfig
|
||||
const config = {} as OhMyOpenAgentConfig
|
||||
const model = { providerID: "anthropic", modelID: "claude-opus-4-6" }
|
||||
|
||||
// when
|
||||
@@ -114,7 +114,7 @@ describe("resolveVariantForModel", () => {
|
||||
|
||||
test("returns correct variant for openai provider (hephaestus agent)", () => {
|
||||
// #given hephaestus has openai/gpt-5.3-codex with variant "medium" in its chain
|
||||
const config = {} as OhMyOpenCodeConfig
|
||||
const config = {} as OhMyOpenAgentConfig
|
||||
const model = { providerID: "openai", modelID: "gpt-5.3-codex" }
|
||||
|
||||
// #when
|
||||
@@ -126,7 +126,7 @@ describe("resolveVariantForModel", () => {
|
||||
|
||||
test("returns medium for openai/gpt-5.4 in sisyphus chain", () => {
|
||||
// #given openai/gpt-5.4 is now in sisyphus fallback chain with variant medium
|
||||
const config = {} as OhMyOpenCodeConfig
|
||||
const config = {} as OhMyOpenAgentConfig
|
||||
const model = { providerID: "openai", modelID: "gpt-5.4" }
|
||||
|
||||
// when
|
||||
@@ -138,7 +138,7 @@ describe("resolveVariantForModel", () => {
|
||||
|
||||
test("returns undefined for provider not in chain", () => {
|
||||
// given
|
||||
const config = {} as OhMyOpenCodeConfig
|
||||
const config = {} as OhMyOpenAgentConfig
|
||||
const model = { providerID: "unknown-provider", modelID: "some-model" }
|
||||
|
||||
// when
|
||||
@@ -150,7 +150,7 @@ describe("resolveVariantForModel", () => {
|
||||
|
||||
test("returns undefined for unknown agent", () => {
|
||||
// given
|
||||
const config = {} as OhMyOpenCodeConfig
|
||||
const config = {} as OhMyOpenAgentConfig
|
||||
const model = { providerID: "anthropic", modelID: "claude-opus-4-6" }
|
||||
|
||||
// when
|
||||
@@ -162,7 +162,7 @@ describe("resolveVariantForModel", () => {
|
||||
|
||||
test("returns variant for zai-coding-plan provider without variant", () => {
|
||||
// given
|
||||
const config = {} as OhMyOpenCodeConfig
|
||||
const config = {} as OhMyOpenAgentConfig
|
||||
const model = { providerID: "zai-coding-plan", modelID: "glm-5" }
|
||||
|
||||
// when
|
||||
@@ -178,7 +178,7 @@ describe("resolveVariantForModel", () => {
|
||||
agents: {
|
||||
"custom-agent": { category: "ultrabrain" },
|
||||
},
|
||||
} as OhMyOpenCodeConfig
|
||||
} as OhMyOpenAgentConfig
|
||||
const model = { providerID: "openai", modelID: "gpt-5.4" }
|
||||
|
||||
// when
|
||||
@@ -190,7 +190,7 @@ describe("resolveVariantForModel", () => {
|
||||
|
||||
test("returns correct variant for oracle agent with openai", () => {
|
||||
// given
|
||||
const config = {} as OhMyOpenCodeConfig
|
||||
const config = {} as OhMyOpenAgentConfig
|
||||
const model = { providerID: "openai", modelID: "gpt-5.4" }
|
||||
|
||||
// when
|
||||
@@ -202,7 +202,7 @@ describe("resolveVariantForModel", () => {
|
||||
|
||||
test("returns correct variant for oracle agent with anthropic", () => {
|
||||
// given
|
||||
const config = {} as OhMyOpenCodeConfig
|
||||
const config = {} as OhMyOpenAgentConfig
|
||||
const model = { providerID: "anthropic", modelID: "claude-opus-4-6" }
|
||||
|
||||
// when
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { OhMyOpenCodeConfig } from "../config"
|
||||
import type { OhMyOpenAgentConfig } from "../config"
|
||||
import { AGENT_MODEL_REQUIREMENTS, CATEGORY_MODEL_REQUIREMENTS } from "./model-requirements"
|
||||
|
||||
export function resolveAgentVariant(
|
||||
config: OhMyOpenCodeConfig,
|
||||
config: OhMyOpenAgentConfig,
|
||||
agentName?: string
|
||||
): string | undefined {
|
||||
if (!agentName) {
|
||||
@@ -33,7 +33,7 @@ export function resolveAgentVariant(
|
||||
}
|
||||
|
||||
export function resolveVariantForModel(
|
||||
config: OhMyOpenCodeConfig,
|
||||
config: OhMyOpenAgentConfig,
|
||||
agentName: string,
|
||||
currentModel: { providerID: string; modelID: string },
|
||||
): string | undefined {
|
||||
@@ -87,7 +87,7 @@ function findVariantInChain(
|
||||
}
|
||||
|
||||
export function applyAgentVariant(
|
||||
config: OhMyOpenCodeConfig,
|
||||
config: OhMyOpenAgentConfig,
|
||||
agentName: string | undefined,
|
||||
message: { variant?: string }
|
||||
): void {
|
||||
|
||||
Reference in New Issue
Block a user