Skip to content

feat: add Claude Code adapter with Bedrock support#2

Merged
dafzthomas merged 31 commits intomainfrom
feat/merge-claude-adapter
Mar 18, 2026
Merged

feat: add Claude Code adapter with Bedrock support#2
dafzthomas merged 31 commits intomainfrom
feat/merge-claude-adapter

Conversation

@dafzthomas
Copy link
Owner

Summary

  • Merges upstream PR pingdotgg/t3code#179 (codething/648ca884-claude) — the Claude Code adapter using @anthropic-ai/claude-agent-sdk
  • Layers AWS Bedrock support on top for our deployment

What's included

From upstream PR pingdotgg#179:

  • Full claudeAgent provider with ClaudeAdapter.ts using the Agent SDK
  • Claude model catalogs (Opus 4.6, Sonnet 4.6, Haiku 4.5)
  • Effort controls, fast mode, thinking toggles, ultrathink detection
  • Provider picker UI with Claude/Codex traits pickers
  • Provider-model consistency enforcement across threads
  • Comprehensive test coverage (~2,100+ lines of adapter tests)

Merge conflict resolution (4 files):

  • appSettings.ts — kept both textGenerationModel and customClaudeModels
  • ChatView.tsx — took PR's restructured compositor layout
  • composerDraftStore.ts — took PR's modelOptions migration, restored prompt/terminalContexts processing
  • contracts/model.ts — kept both DEFAULT_GIT_TEXT_GENERATION_MODEL and backward compat exports

Post-merge fixes:

  • Added terminalContexts to browser test mock drafts
  • Restored ensureInlineTerminalContextPlaceholders in draft deserialization
  • Added missing terminalContexts/onRemoveTerminalContext props to ComposerPromptEditor
  • Fixed DEFAULT_MODEL_BY_PROVIDER.codexDEFAULT_MODEL_BY_PROVIDER[selectedProvider]
  • Persist provider/model before clearComposerDraftContent to prevent reset

Bedrock support layer:

  • Added useBedrock, awsRegion, awsProfile, and per-tier ARN override fields to ClaudeProviderStartOptions
  • Added resolveBedrockModel() for slug → ARN mapping and buildBedrockEnv() for env injection in ClaudeAdapter.ts
  • Stored bedrockOptions in session context for sendTurn model resolution
  • Wired Bedrock settings through providerOptionsForDispatch in ChatView.tsx
  • Added "Claude Code — AWS Bedrock" settings section with toggle, region, profile, and per-tier ARN inputs
  • Extended desktop syncShellEnvironment to read AWS/Bedrock env vars from login shell

Test plan

  • bun run typecheck — 7/7 packages pass
  • bun run test — all packages pass (112+ test files, 505+ tests)
  • Manual: verify Claude provider appears in picker and can send turns
  • Manual: verify Bedrock settings toggle enables region/profile/ARN fields
  • Manual: verify Bedrock env vars are propagated in desktop app

🤖 Generated with Claude Code

juliusmarminge and others added 29 commits March 16, 2026 10:07
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
- drop `cursor` from provider/model contracts and runtime validation
- remove Cursor-specific UI options, settings, and model normalization paths
- update server/web tests and fixtures to cover Codex + Claude Code only
- Include Claude Code in available provider options in the picker
- Add Cursor as a disabled placeholder provider with icon mapping
- Update session-logic tests to assert provider availability and ordering
- Map Claude reasoning deltas, streamed tool input JSON, and tool results into runtime item/content events
- Classify Agent/read-only Claude tools for correct approval request types
- Add Claude CLI provider health checks and auth-status parsing coverage

Co-authored-by: codex <codex@users.noreply.github.com>
- Reject turn starts that request a provider switch from the thread-bound provider
- Reject models that do not belong to the thread provider and log start failures
- Add shared `inferProviderForModel` helper and tests; reuse it in web store inference
- Use thread provider as the preferred provider during command handling
- Update `ProviderModelPicker` to show direct model choices when provider is locked
- Add browser tests for locked/unlocked picker behavior and widen browser test glob
- derive `defaultModel` from `DEFAULT_MODEL_BY_PROVIDER` using harness provider
- replace hardcoded `gpt-5-codex` in seeded project and thread setup
…ingdotgg#1146)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- keep Ultrathink frame styling without extra wrapper padding toggles
- drop the inline Ultrathink badge row in ChatView
- clean up stray whitespace in ProviderService test
- support `claudeAgent.fastMode` in shared/contracts, provider dispatch, and Claude adapter SDK settings
- gate fast mode to supported Claude models and restart/forward options in orchestration
- unify draft/UI fast mode state (not Codex-only) and add browser/server tests plus SDK probe
- Add dedicated Claude traits picker with model-aware effort, thinking, and fast mode controls
- Treat Claude Ultrathink as a prompt keyword instead of session effort
- Normalize provider model options in composer flow and adapter, with tests for unsupported effort/thinking cases
…esolution

Merge origin/codething/648ca884-claude into main, resolving conflicts in:
- apps/web/src/appSettings.ts (keep both textGenerationModel and customClaudeModels)
- apps/web/src/components/ChatView.tsx (take PR's restructured compositor layout)
- apps/web/src/composerDraftStore.ts (take PR's modelOptions migration, restore prompt/terminalContexts processing)
- packages/contracts/src/model.ts (keep both git text generation model and backward compat exports)

Additional fixes on top of the merge:
- Add terminalContexts to browser test mock drafts (ClaudeTraitsPicker, CodexTraitsPicker, CompactComposerControlsMenu)
- Restore ensureInlineTerminalContextPlaceholders call in draft deserialization
- Add terminalContexts and onRemoveTerminalContext props to ComposerPromptEditor
- Use DEFAULT_MODEL_BY_PROVIDER[selectedProvider] instead of hardcoded .codex
- Persist provider/model before clearComposerDraftContent to prevent reset

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add useBedrock, awsRegion, awsProfile, and per-tier ARN override
  fields to ClaudeProviderStartOptions contract
- Add resolveBedrockModel() and buildBedrockEnv() helpers to
  ClaudeAdapter for model slug → ARN resolution and env injection
- Store bedrockOptions in session context so sendTurn can resolve
  models without receiving providerOptions on each turn
- Wire Bedrock settings from appSettings through providerOptions
  dispatch in ChatView
- Add Bedrock configuration section to settings UI with toggle,
  region, profile, and per-tier ARN override inputs
- Extend desktop syncShellEnvironment to read AWS/Bedrock env vars
  from login shell (AWS_REGION, AWS_PROFILE, credentials, etc.)
- Add tests for AWS env var sync in desktop

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Mar 18, 2026
Display an amber "Bedrock" badge next to the model label in the
provider/model picker when Bedrock is enabled and Claude is the
active provider.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link

💡 Codex Review

context.query.setPermissionMode(context.basePermissionMode ?? "bypassPermissions"),

P1 Badge Preserve approval-required mode on default interaction turns

In sendTurn, the interactionMode === "default" branch restores permission mode with context.basePermissionMode ?? "bypassPermissions", which downgrades approval-required Claude sessions to full-access when no explicit provider permission mode was set at startup. Because thread.turn.start defaults interaction mode to "default", this path runs on normal turns and can silently disable approval prompts for the rest of the session.


const shouldRestartForModelOptionsChange =
currentProvider === "claudeAgent" &&
options?.modelOptions !== undefined &&
!sameModelOptions(previousModelOptions, options.modelOptions);

P2 Badge Handle omitted Claude model options as a settings reset

Claude session restarts for model-option changes only happen when options.modelOptions is present, so clearing traits back to defaults (which sends no modelOptions) never triggers a restart and leaves previous session-level settings active. This makes toggles like Claude fast mode or thinking-off stick unexpectedly after users turn them off, since those options are applied at session creation time.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

- Extend syncShellEnvironment to read ANTHROPIC_MODEL,
  ANTHROPIC_DEFAULT_*_MODEL, ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION,
  CLAUDE_CODE_MAX_OUTPUT_TOKENS, and MAX_THINKING_TOKENS from login shell
- Detect CLAUDE_CODE_USE_BEDROCK=1 in server process.env and build
  BedrockOptions from env vars when UI settings haven't been configured
- Add BedrockEnvironment to ServerConfig contract so the web UI can
  detect env-based Bedrock and show the appropriate badge/banner
- Show "Bedrock detected from environment" banner in settings when
  shell vars are present, with option to override via custom settings
- Show Bedrock badge in model picker when detected from either
  settings or environment

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dafzthomas dafzthomas merged commit 3188c1f into main Mar 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants