diff options
| author | Dax Raad <[email protected]> | 2026-04-14 23:10:07 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2026-04-14 23:10:25 -0400 |
| commit | 627159acac04409d7697a6739e2c572c2a010943 (patch) | |
| tree | 5f87465ea69f41aff0cd96ae5411fe438da480b3 /packages/app/src/testing/model-selection.ts | |
| parent | f44aa02e2677b2b89a1a9f517c0ff8990383deaa (diff) | |
| download | opencode-627159acac04409d7697a6739e2c572c2a010943.tar.gz opencode-627159acac04409d7697a6739e2c572c2a010943.zip | |
delete all e2e tests (#22501)
Cherry-picked from ea463e604cdd2a3e83e1c286e39b789455f0d413
Diffstat (limited to 'packages/app/src/testing/model-selection.ts')
| -rw-r--r-- | packages/app/src/testing/model-selection.ts | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/packages/app/src/testing/model-selection.ts b/packages/app/src/testing/model-selection.ts deleted file mode 100644 index d2770fe28..000000000 --- a/packages/app/src/testing/model-selection.ts +++ /dev/null @@ -1,109 +0,0 @@ -type ModelKey = { - providerID: string - modelID: string -} - -type ModelItem = ModelKey & { - name: string -} - -type AgentItem = { - name: string -} - -type State = { - agent?: string - model?: ModelKey | null - variant?: string | null -} - -export type ModelProbeState = { - dir?: string - sessionID?: string - last?: { - type: "agent" | "model" | "variant" - agent?: string - model?: ModelKey | null - variant?: string | null - } - agent?: string - model?: (ModelKey & { name?: string }) | undefined - variant?: string | null - selected?: string | null - configured?: string - pick?: State - base?: State - current?: string - variants?: string[] - models?: ModelItem[] - agents?: AgentItem[] -} - -export type ModelWindow = Window & { - __opencode_e2e?: { - model?: { - enabled?: boolean - current?: ModelProbeState - controls?: { - setAgent?: (name: string | undefined) => void - setModel?: (value: ModelKey | undefined) => void - setVariant?: (value: string | undefined) => void - } - } - } -} - -const clone = (state?: State) => { - if (!state) return undefined - return { - ...state, - model: state.model ? { ...state.model } : state.model, - } -} - -let active: symbol | undefined - -export const modelEnabled = () => { - if (typeof window === "undefined") return false - return (window as ModelWindow).__opencode_e2e?.model?.enabled === true -} - -const root = () => { - if (!modelEnabled()) return - return (window as ModelWindow).__opencode_e2e?.model -} - -export const modelProbe = { - bind(id: symbol, input: NonNullable<NonNullable<ModelWindow["__opencode_e2e"]>["model"]>["controls"]) { - const state = root() - if (!state) return - active = id - state.controls = input - }, - set(id: symbol, input: ModelProbeState) { - const state = root() - if (!state || active !== id) return - state.current = { - ...input, - model: input.model ? { ...input.model } : undefined, - last: input.last - ? { - ...input.last, - model: input.last.model ? { ...input.last.model } : input.last.model, - } - : undefined, - pick: clone(input.pick), - base: clone(input.base), - variants: input.variants?.slice(), - models: input.models?.map((item) => ({ ...item })), - agents: input.agents?.map((item) => ({ ...item })), - } - }, - clear(id: symbol) { - const state = root() - if (!state || active !== id) return - active = undefined - state.current = undefined - state.controls = undefined - }, -} |
