Respect user settings for permission mode and model selection#340
Conversation
4d82563 to
1060ce2
Compare
|
I'm not sure why but CI doesn't seem to be kicking off. I'll do my best to keep an eye open for failures there if/when it runs. |
| import { randomUUID } from "node:crypto"; | ||
| import { fileURLToPath } from "node:url"; | ||
|
|
||
| // SDK has an unresolved rate limit type, reconstructing with the rest for now |
There was a problem hiding this comment.
Hi I assume this might have been unintentional... there is actually an issue in the SDK where they have an unresolved type that makes all SDKMessages resolve to any with typescript, which is why this is here
There was a problem hiding this comment.
Ah I'm sorry about that I missed it in my review. I'll deal with this post-haste.
benbrandt
left a comment
There was a problem hiding this comment.
Given that we are just doing our best to find a model match without a way to do so in the SDK, I think these are mostly fine, but would appreciate if some of the unrelated changes were removed
0337553 to
c501213
Compare
How's that grab your feathers? |
🚀 I'll try to fix the CI failures. |
c501213 to
ccfc88d
Compare
@benbrandt I think you'll need to approve the CI run again? I don't want to bother squashing the commits together until I see CI passing. I also did not fix the TypeScript build warnings again. |
Honor Claude's built-in settings hierarchy for the initial permission mode instead of hardcoding it to "default". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Codex <codex@openai.com>
The CLI persists display strings like "opus[1m]" in settings files, but the SDK model list uses IDs like "claude-opus-4-6-1m". Add tokenized model matching that resolves these aliases against the available models list so the correct model ID is passed to query.setModel() and reported as currentModelId to ACP clients. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Codex <codex@openai.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Prefix destructured `options` with `_` to satisfy @typescript-eslint/no-unused-vars rule. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ccfc88d to
bae9ed6
Compare
|
@benbrandt Build please? 🙏 🙏 🙏 🙇♂️ |
Prettier was failing on .agent-shell/transcripts/ markdown files that aren't part of the project source. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@benbrandt Build please. :) 🙏 🙏 🙏 🙇♂️ |
Most user settings (
env, permission rules likeallow/deny/ask) already work through the SDK'ssettingSourcesor are handled by the CLI subprocess. Two settings require explicit handling by the ACP agent and were not being respected:permissions.defaultMode: Must be passed as thepermissionModeoption toquery(). The SDK defaults to"default"internally and does not read it from settings files. The CLI handles this by reading the setting and passing it to the SDK;createSessionwas hardcoding it to"default"instead.model: The CLI persists display strings like"opus[1m]"in settings, but the SDK model list uses IDs like"claude-opus-4-6-1m". The existing substring matching ingetAvailableModelscouldn't resolve these aliases, so they silently fell back to the first model. Passing the raw alias toquery.setModel()doesn't work either — the CLI's internaldg()function strips[1m]and loses the context hint.Changes:
SDKTaskStartedMessageremoved,SDKMessageTempreplaced with SDK's ownSDKMessage)permissions.defaultModetoClaudeCodeSettings, merge it through the settings hierarchy, and resolve it viaresolvePermissionMode()with case-insensitive aliases, validation, and root-user guardresolveModelPreference) that handles CLI display strings like"opus[1m]"by scoring against the available models listCo-authored-by: Codex codex@openai.com