Skip to content

Commit a37a410

Browse files
committed
refactor(claude): remove profile subprovider mapping
- Stop synthesizing Claude profile capabilities in the adapter - Drop the obsolete ProviderModelMenu profile-row test
1 parent 84b7e8c commit a37a410

3 files changed

Lines changed: 6 additions & 61 deletions

File tree

src/renderer/components/common/ProviderModelMenu/ProviderModelMenu.test.tsx

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -389,30 +389,6 @@ describe("ProviderModelMenu", () => {
389389
});
390390
});
391391

392-
it("shows Claude profile models under the profile subprovider row", async () => {
393-
const provider = makeNamedProvider("claude:work", "Claude Work", 2);
394-
provider.capabilities.subProviders = [{ id: "claude-profile", label: "Work" }];
395-
provider.capabilities.modelSubProvider = {
396-
"model-1": "claude-profile",
397-
"model-2": "claude-profile",
398-
};
399-
400-
render(
401-
<ProviderModelMenu
402-
providers={[provider]}
403-
currentAgentKind="claude:work"
404-
currentModel="model-1"
405-
onChange={vi.fn<(next: { agentKind: string; model: string }) => void>()}
406-
/>,
407-
);
408-
409-
fireEvent.click(screen.getByRole("button", { name: "Select model" }));
410-
const listbox = await screen.findByRole("listbox", { name: "Models" });
411-
412-
expect(within(listbox).getByText("Work")).toBeInTheDocument();
413-
expect(within(listbox).getByText("Model 2")).toBeInTheDocument();
414-
});
415-
416392
it("resets the window when a long list shrinks so rows do not render blank", async () => {
417393
const { rerender } = render(
418394
<ProviderModelMenu

src/supervisor/agents/claude/claude.test.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,8 @@ describe("createClaudeProfileAdapter", () => {
181181

182182
expect(adapter.kind).toBe("claude:work");
183183
expect(adapter.label).toBe("Claude Work");
184-
expect(adapter.capabilities.subProviders).toContainEqual({
185-
id: "claude-profile",
186-
label: "Work",
187-
});
188-
expect(adapter.capabilities.modelSubProvider?.sonnet).toBe("claude-profile");
184+
expect(adapter.capabilities.subProviders).toBeUndefined();
185+
expect(adapter.capabilities.modelSubProvider).toBeUndefined();
189186

190187
const expectedConfigDir = path.join(homedir(), ".lightcode/claude-profiles/work");
191188
expect(

src/supervisor/agents/claude/index.ts

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@ import { randomUUID } from "node:crypto";
22
import { homedir } from "node:os";
33
import path, { posix as posixPath } from "node:path";
44

5-
import type {
6-
AgentCapability,
7-
AgentInstanceConfig,
8-
ProjectLocation,
9-
PromptSegment,
10-
} from "@/shared/contracts";
5+
import type { AgentInstanceConfig, ProjectLocation, PromptSegment } from "@/shared/contracts";
116
import { claudeProfileKind, parseClaudeProfileInstanceConfig } from "@/shared/contracts";
127
import {
138
brailleSpinnerOscTitleHint,
@@ -45,7 +40,6 @@ warnIfPluginManifestMissing("claude", CLAUDE_PLUGIN_VERSION);
4540
interface ClaudeAdapterOptions {
4641
kind?: string;
4742
label?: string;
48-
profileLabel?: string;
4943
configDir?: string;
5044
}
5145

@@ -70,49 +64,27 @@ function profileEnvForLocation(
7064
return { CLAUDE_CONFIG_DIR: resolveTildePath(configDir, location) };
7165
}
7266

73-
function capabilitiesWithProfile(
74-
capabilities: AgentCapability,
75-
profileLabel: string | undefined,
76-
): AgentCapability {
77-
const label = profileLabel?.trim();
78-
if (!label) return capabilities;
79-
const subProviderId = "claude-profile";
80-
return {
81-
...capabilities,
82-
subProviders: [
83-
...(capabilities.subProviders?.filter((entry) => entry.id !== subProviderId) ?? []),
84-
{ id: subProviderId, label },
85-
],
86-
modelSubProvider: {
87-
...(capabilities.modelSubProvider ?? {}),
88-
...Object.fromEntries(capabilities.models.map((model) => [model.id, subProviderId])),
89-
},
90-
};
91-
}
92-
9367
export function createClaudeProfileAdapter(instance: AgentInstanceConfig): AgentAdapter {
9468
const cfg = parseClaudeProfileInstanceConfig(instance.config);
9569
const profileLabel = instance.displayName ?? instance.id;
9670
return createClaudeAdapter({
9771
kind: claudeProfileKind(instance.id),
9872
label: `Claude ${profileLabel}`,
99-
profileLabel,
10073
configDir: cfg.configDir,
10174
});
10275
}
10376

10477
export function createClaudeAdapter(options: ClaudeAdapterOptions = {}): AgentAdapter {
10578
const kind = options.kind ?? "claude";
10679
const label = options.label ?? "Claude Code";
107-
const baseCapabilities = capabilitiesWithProfile(claudeCapabilities, options.profileLabel);
10880
const profileEnv = (location: ProjectLocation) =>
10981
profileEnvForLocation(options.configDir, location);
11082

11183
return {
11284
kind,
11385
label,
11486
binary: "claude",
115-
capabilities: baseCapabilities,
87+
capabilities: claudeCapabilities,
11688
...(claudeDetectionSpec.update ? { update: claudeDetectionSpec.update } : {}),
11789
// WSL OAuth flows try to open a browser; no-op it so the PTY doesn't hang.
11890
spawnEnv: { wsl: { BROWSER: "/bin/true" } },
@@ -154,7 +126,7 @@ export function createClaudeAdapter(options: ClaudeAdapterOptions = {}): AgentAd
154126
...claudeDetectionSpec,
155127
kind,
156128
label,
157-
capabilities: baseCapabilities,
129+
capabilities: claudeCapabilities,
158130
statusProbe: (probeCtx: DetectProbeCtx) => {
159131
const env = profileEnv(probeCtx.location);
160132
return probeClaudeStatus(probeCtx, env ? { env } : undefined);
@@ -169,7 +141,7 @@ export function createClaudeAdapter(options: ClaudeAdapterOptions = {}): AgentAd
169141
...status,
170142
kind,
171143
label,
172-
capabilities: capabilitiesWithProfile(status.capabilities, options.profileLabel),
144+
capabilities: status.capabilities,
173145
};
174146
},
175147
buildLaunchArgv(location, config, prompt, _sessionRef, _launchOptions) {

0 commit comments

Comments
 (0)