-
Notifications
You must be signed in to change notification settings - Fork 102
feat(components): follow per-model Cursor config options in composer selectors #345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Tigatron
wants to merge
5
commits into
LodyAI:main
Choose a base branch
from
Tigatron:feat/cursor-acp-composer-per-model-options
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
de9b74a
feat(shared): resolve ACP config options per model
Tigatron be8f415
feat(cli): cache Cursor per-model config options from capability probes
Tigatron 2675f4f
fix(cli): switch the ACP model before applying per-model options
Tigatron a2226d4
feat(components): follow per-model config options in composer selectors
Tigatron 17aa0a7
feat(components): render toggle-shaped thinking options as their own row
Tigatron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| import { beforeEach, describe, expect, it, vi } from 'vitest'; | ||
| import type { SessionId } from '@lody/shared'; | ||
| import type { Logger } from '@/utils/logger'; | ||
|
|
||
| const connectionMocks = vi.hoisted(() => ({ | ||
| initialize: vi.fn(), | ||
| newSession: vi.fn(), | ||
| loadSession: vi.fn(), | ||
| resumeSession: vi.fn(), | ||
| setSessionConfigOption: vi.fn(), | ||
| unstable_forkSession: vi.fn(), | ||
| closeSession: vi.fn(), | ||
| cancel: vi.fn(), | ||
| })); | ||
|
|
||
| vi.mock('@agentclientprotocol/sdk', () => ({ | ||
| PROTOCOL_VERSION: 1, | ||
| ClientSideConnection: class { | ||
| readonly initialize = connectionMocks.initialize; | ||
| readonly newSession = connectionMocks.newSession; | ||
| readonly loadSession = connectionMocks.loadSession; | ||
| readonly resumeSession = connectionMocks.resumeSession; | ||
| readonly setSessionConfigOption = connectionMocks.setSessionConfigOption; | ||
| readonly unstable_forkSession = connectionMocks.unstable_forkSession; | ||
| readonly closeSession = connectionMocks.closeSession; | ||
| readonly cancel = connectionMocks.cancel; | ||
| }, | ||
| })); | ||
|
|
||
| import { AgentClient } from './agent-client'; | ||
|
|
||
| function createLogger(): Logger { | ||
| const logger: Logger = { | ||
| debug: vi.fn(), | ||
| info: vi.fn(), | ||
| warn: vi.fn(), | ||
| error: vi.fn(), | ||
| success: vi.fn(), | ||
| setLevel: vi.fn(), | ||
| setDebug: vi.fn(), | ||
| child: vi.fn(() => logger), | ||
| close: vi.fn(async () => undefined), | ||
| }; | ||
| return logger; | ||
| } | ||
|
|
||
| function readInitializeClientCapabilitiesMeta(): unknown { | ||
| const request = connectionMocks.initialize.mock.calls[0]?.[0] as | ||
| | { clientCapabilities?: { _meta?: unknown } } | ||
| | undefined; | ||
| return request?.clientCapabilities?._meta; | ||
| } | ||
|
|
||
| async function startWithIdentity(identity: { | ||
| cliType: 'builtin' | 'registry' | 'custom'; | ||
| agentType: string; | ||
| }): Promise<void> { | ||
| const client = new AgentClient({ | ||
| logger: createLogger(), | ||
| sessionId: `session-${identity.cliType}-${identity.agentType}` as SessionId, | ||
| terminalManager: {} as never, | ||
| agentConfig: identity, | ||
| onUpdateMessage: vi.fn(), | ||
| onRequestPermission: vi.fn(), | ||
| }); | ||
| await client.startSession({} as never, '/workdir'); | ||
| } | ||
|
|
||
| describe('AgentClient initialize clientCapabilities._meta', () => { | ||
| beforeEach(() => { | ||
| vi.clearAllMocks(); | ||
| connectionMocks.initialize.mockResolvedValue({ agentCapabilities: {} }); | ||
| connectionMocks.newSession.mockResolvedValue({ sessionId: 'acp-session-1' }); | ||
| }); | ||
|
|
||
| it('advertises parameterizedModelPicker for registry Cursor', async () => { | ||
| await startWithIdentity({ cliType: 'registry', agentType: 'cursor' }); | ||
|
|
||
| expect(readInitializeClientCapabilitiesMeta()).toEqual({ | ||
| parameterizedModelPicker: true, | ||
| }); | ||
| }); | ||
|
|
||
| it('omits parameterizedModelPicker for custom Cursor', async () => { | ||
| await startWithIdentity({ cliType: 'custom', agentType: 'cursor' }); | ||
|
|
||
| expect(readInitializeClientCapabilitiesMeta()).toBeUndefined(); | ||
| }); | ||
|
|
||
| it('omits parameterizedModelPicker for a builtin agent', async () => { | ||
| await startWithIdentity({ cliType: 'builtin', agentType: 'claude' }); | ||
|
|
||
| expect(readInitializeClientCapabilitiesMeta()).toBeUndefined(); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When an existing registry Cursor configuration upgrades, its persisted capability entry still has the current
ACP_CAPABILITY_CACHE_VERSION(6) and the same registrysourceVersion, so the selector accepts that entry even though it lacks this newly added field. BecauseconfigOptionsByModelis populated only by an explicit capability refresh and ordinary sessions never fetch it, existing users remain stuck with the probe-time snapshot behavior until they manually test/refresh the provider. Treat Cursor entries without the catalog as stale or bump the capability-cache version when adding this probe-derived field.AGENTS.md reference: apps/cli/src/agent/AGENTS.md:L243-L245
Useful? React with 👍 / 👎.