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,4 +1,4 @@
|
||||
import type { OhMyOpenCodeConfig } from "../../config"
|
||||
import type { OhMyOpenAgentConfig } from "../../config"
|
||||
import { HOOK_NAME } from "./constants"
|
||||
import { log } from "../../shared/logger"
|
||||
import { SessionCategoryRegistry } from "../../shared/session-category-registry"
|
||||
@@ -8,7 +8,7 @@ type ResolveFallbackBootstrapModelOptions = {
|
||||
source: string
|
||||
eventModel?: string
|
||||
resolvedAgent?: string
|
||||
pluginConfig?: OhMyOpenCodeConfig
|
||||
pluginConfig?: OhMyOpenAgentConfig
|
||||
}
|
||||
|
||||
export function resolveFallbackBootstrapModel(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OhMyOpenCodeConfig } from "../../config"
|
||||
import type { OhMyOpenAgentConfig } from "../../config"
|
||||
import { agentPattern } from "./agent-resolver"
|
||||
import { HOOK_NAME } from "./constants"
|
||||
import { log } from "../../shared/logger"
|
||||
@@ -8,7 +8,7 @@ import { normalizeFallbackModels } from "../../shared/model-resolver"
|
||||
export function getFallbackModelsForSession(
|
||||
sessionID: string,
|
||||
agent: string | undefined,
|
||||
pluginConfig: OhMyOpenCodeConfig | undefined
|
||||
pluginConfig: OhMyOpenAgentConfig | undefined
|
||||
): string[] {
|
||||
if (!pluginConfig) return []
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, test, beforeEach, afterEach, spyOn } from "bun:test"
|
||||
import { createRuntimeFallbackHook } from "./index"
|
||||
import type { RuntimeFallbackConfig, OhMyOpenCodeConfig } from "../../config"
|
||||
import type { RuntimeFallbackConfig, OhMyOpenAgentConfig } from "../../config"
|
||||
import * as sharedModule from "../../shared"
|
||||
import { SessionCategoryRegistry } from "../../shared/session-category-registry"
|
||||
|
||||
@@ -62,32 +62,26 @@ describe("runtime-fallback", () => {
|
||||
}
|
||||
}
|
||||
|
||||
function createMockPluginConfigWithCategoryFallback(fallbackModels: string[]): OhMyOpenCodeConfig {
|
||||
return {
|
||||
categories: {
|
||||
test: {
|
||||
fallback_models: fallbackModels,
|
||||
},
|
||||
function createMockPluginConfigWithCategoryFallback(fallbackModels: string[]): OhMyOpenAgentConfig { return {
|
||||
categories: {
|
||||
test: {
|
||||
fallback_models: fallbackModels,
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
} }
|
||||
|
||||
function createMockPluginConfigWithCategoryModel(
|
||||
categoryName: string,
|
||||
model: string,
|
||||
fallbackModels: string[],
|
||||
variant?: string,
|
||||
): OhMyOpenCodeConfig {
|
||||
return {
|
||||
categories: {
|
||||
[categoryName]: {
|
||||
model,
|
||||
fallback_models: fallbackModels,
|
||||
...(variant ? { variant } : {}),
|
||||
},
|
||||
function createMockPluginConfigWithCategoryModel(categoryName: string,
|
||||
model: string,
|
||||
fallbackModels: string[],
|
||||
variant?: string,): OhMyOpenAgentConfig { return {
|
||||
categories: {
|
||||
[categoryName]: {
|
||||
model,
|
||||
fallback_models: fallbackModels,
|
||||
...(variant ? { variant } : {}),
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
} }
|
||||
|
||||
describe("session.error handling", () => {
|
||||
test("should detect retryable error with status code 429", async () => {
|
||||
@@ -2297,15 +2291,13 @@ describe("runtime-fallback", () => {
|
||||
})
|
||||
|
||||
describe("fallback models configuration", () => {
|
||||
function createMockPluginConfigWithAgentFallback(agentName: string, fallbackModels: string[]): OhMyOpenCodeConfig {
|
||||
return {
|
||||
agents: {
|
||||
[agentName]: {
|
||||
fallback_models: fallbackModels,
|
||||
},
|
||||
function createMockPluginConfigWithAgentFallback(agentName: string, fallbackModels: string[]): OhMyOpenAgentConfig { return {
|
||||
agents: {
|
||||
[agentName]: {
|
||||
fallback_models: fallbackModels,
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
} }
|
||||
|
||||
test("should use agent-level fallback_models", async () => {
|
||||
const input = createMockPluginInput()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { RuntimeFallbackConfig, OhMyOpenCodeConfig } from "../../config"
|
||||
import type { RuntimeFallbackConfig, OhMyOpenAgentConfig } from "../../config"
|
||||
|
||||
export interface RuntimeFallbackInterval {
|
||||
unref: () => void
|
||||
@@ -53,7 +53,7 @@ export interface FallbackResult {
|
||||
|
||||
export interface RuntimeFallbackOptions {
|
||||
config?: RuntimeFallbackConfig
|
||||
pluginConfig?: OhMyOpenCodeConfig
|
||||
pluginConfig?: OhMyOpenAgentConfig
|
||||
session_timeout_ms?: number
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ export interface HookDeps {
|
||||
ctx: RuntimeFallbackPluginInput
|
||||
config: Required<RuntimeFallbackConfig>
|
||||
options: RuntimeFallbackOptions | undefined
|
||||
pluginConfig: OhMyOpenCodeConfig | undefined
|
||||
pluginConfig: OhMyOpenAgentConfig | undefined
|
||||
sessionStates: Map<string, FallbackState>
|
||||
sessionLastAccess: Map<string, number>
|
||||
sessionRetryInFlight: Set<string>
|
||||
|
||||
Reference in New Issue
Block a user