chore(deadcode): trim runtime plugin selection wrappers · openclaw/openclaw@b47c930
vincentkoc
·
2026-06-22
·
via Recent Commits to openclaw:main
File tree
onboard-non-interactive/local
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | // Codex runtime plugin auto-install/repair helpers for OpenAI model selections. |
2 | 2 | import { modelSelectionShouldEnsureCodexPlugin } from "../agents/openai-routing.js"; |
3 | | -import type { OpenClawConfig } from "../config/types.openclaw.js"; |
4 | | -import { |
5 | | -createRuntimePluginModelSelectionHelpers, |
6 | | -type RuntimePluginInstallResult, |
7 | | -} from "./runtime-plugin-install.js"; |
| 3 | +import { createRuntimePluginModelSelectionHelpers } from "./runtime-plugin-install.js"; |
8 | 4 | |
9 | 5 | export const CODEX_RUNTIME_PLUGIN_ID = "codex"; |
10 | 6 | const CODEX_RUNTIME_PLUGIN_LABEL = "Codex"; |
@@ -16,22 +12,13 @@ const CODEX_RUNTIME_PLUGIN_DESCRIPTOR = {
|
16 | 12 | warningLabel: CODEX_RUNTIME_PLUGIN_LABEL, |
17 | 13 | }; |
18 | 14 | |
19 | | -export type CodexRuntimePluginInstallResult = RuntimePluginInstallResult; |
20 | | - |
21 | | -/** Return true when a selected model requires the Codex runtime plugin to be installed. */ |
22 | | -export function selectedModelShouldEnsureCodexRuntimePlugin(params: { |
23 | | -cfg: OpenClawConfig; |
24 | | -model?: string; |
25 | | -}): boolean { |
26 | | -return modelSelectionShouldEnsureCodexPlugin({ |
27 | | -config: params.cfg, |
28 | | -model: params.model, |
29 | | -}); |
30 | | -} |
31 | | - |
32 | 15 | const codexRuntimePluginInstall = createRuntimePluginModelSelectionHelpers({ |
33 | 16 | descriptor: CODEX_RUNTIME_PLUGIN_DESCRIPTOR, |
34 | | -shouldEnsure: selectedModelShouldEnsureCodexRuntimePlugin, |
| 17 | +shouldEnsure: ({ cfg, model }) => |
| 18 | +modelSelectionShouldEnsureCodexPlugin({ |
| 19 | +config: cfg, |
| 20 | + model, |
| 21 | +}), |
35 | 22 | }); |
36 | 23 | |
37 | 24 | export const ensureCodexRuntimePluginForModelSelection = codexRuntimePluginInstall.ensure; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | // GitHub Copilot runtime plugin auto-install/repair helpers for model selections. |
2 | 2 | import { modelSelectionShouldEnsureCopilotRuntimePlugin } from "../agents/copilot-routing.js"; |
3 | | -import type { OpenClawConfig } from "../config/types.openclaw.js"; |
4 | | -import { |
5 | | -createRuntimePluginModelSelectionHelpers, |
6 | | -type RuntimePluginInstallResult, |
7 | | -} from "./runtime-plugin-install.js"; |
| 3 | +import { createRuntimePluginModelSelectionHelpers } from "./runtime-plugin-install.js"; |
8 | 4 | |
9 | 5 | export const COPILOT_RUNTIME_PLUGIN_ID = "copilot"; |
10 | 6 | const COPILOT_RUNTIME_PLUGIN_LABEL = "GitHub Copilot agent runtime"; |
@@ -16,22 +12,13 @@ const COPILOT_RUNTIME_PLUGIN_DESCRIPTOR = {
|
16 | 12 | warningLabel: "GitHub Copilot", |
17 | 13 | }; |
18 | 14 | |
19 | | -export type CopilotRuntimePluginInstallResult = RuntimePluginInstallResult; |
20 | | - |
21 | | -/** Return true when a selected model requires the Copilot runtime plugin to be installed. */ |
22 | | -export function selectedModelShouldEnsureCopilotRuntimePlugin(params: { |
23 | | -cfg: OpenClawConfig; |
24 | | -model?: string; |
25 | | -}): boolean { |
26 | | -return modelSelectionShouldEnsureCopilotRuntimePlugin({ |
27 | | -config: params.cfg, |
28 | | -model: params.model, |
29 | | -}); |
30 | | -} |
31 | | - |
32 | 15 | const copilotRuntimePluginInstall = createRuntimePluginModelSelectionHelpers({ |
33 | 16 | descriptor: COPILOT_RUNTIME_PLUGIN_DESCRIPTOR, |
34 | | -shouldEnsure: selectedModelShouldEnsureCopilotRuntimePlugin, |
| 17 | +shouldEnsure: ({ cfg, model }) => |
| 18 | +modelSelectionShouldEnsureCopilotRuntimePlugin({ |
| 19 | +config: cfg, |
| 20 | + model, |
| 21 | +}), |
35 | 22 | }); |
36 | 23 | |
37 | 24 | export const ensureCopilotRuntimePluginForModelSelection = copilotRuntimePluginInstall.ensure; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | // Non-interactive plugin provider auth tests cover provider choice setup and runtime plugin install requirements. |
2 | 2 | import { beforeEach, describe, expect, it, vi } from "vitest"; |
3 | 3 | import type { OpenClawConfig } from "../../../config/config.js"; |
4 | | -import type { CodexRuntimePluginInstallResult } from "../../codex-runtime-plugin-install.js"; |
5 | | -import type { CopilotRuntimePluginInstallResult } from "../../copilot-runtime-plugin-install.js"; |
| 4 | +import type { RuntimePluginInstallResult } from "../../runtime-plugin-install.js"; |
6 | 5 | import { applyNonInteractivePluginProviderChoice } from "./auth-choice.plugin-providers.js"; |
7 | 6 | |
8 | 7 | const ensureCodexRuntimePluginForModelSelection = vi.hoisted(() => |
9 | 8 | vi.fn( |
10 | | -async ({ cfg }: { cfg: OpenClawConfig }): Promise<CodexRuntimePluginInstallResult> => ({ |
| 9 | +async ({ cfg }: { cfg: OpenClawConfig }): Promise<RuntimePluginInstallResult> => ({ |
11 | 10 | cfg, |
12 | 11 | required: false, |
13 | 12 | installed: false, |
@@ -20,7 +19,7 @@ vi.mock("../../codex-runtime-plugin-install.js", () => ({
|
20 | 19 | })); |
21 | 20 | const ensureCopilotRuntimePluginForModelSelection = vi.hoisted(() => |
22 | 21 | vi.fn( |
23 | | -async ({ cfg }: { cfg: OpenClawConfig }): Promise<CopilotRuntimePluginInstallResult> => ({ |
| 22 | +async ({ cfg }: { cfg: OpenClawConfig }): Promise<RuntimePluginInstallResult> => ({ |
24 | 23 | cfg, |
25 | 24 | required: false, |
26 | 25 | installed: false, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。