mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-23 08:31:49 +00:00
f2c2501fa5c93f7aa1089dbea0a08c19476a6458
31
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
73fd091b80 | Cover provider dropdown presentation | ||
|
|
5bb4052f3d | Keep preset model suggestions visible | ||
|
|
36e7e3cb7f | Keep add provider menu inside settings panel | ||
|
|
c9216b32ab | Add domestic AI provider presets | ||
|
|
bb67aa77f5 |
[codex] compact long Catty agent context (#1237)
* feat: compact long Catty agent context * fix: tighten context compaction review issues * fix: preserve tool context during compaction * fix: clear stale model metadata on key edits |
||
|
|
3fc56df111 | refactor(ai): migrate agent backends from ACP to official SDKs (claude/codex/copilot) (#1229) | ||
|
|
53d3e05bb4 |
Per-agent provider switcher chip in the Catty Agent chat input (#1107)
* feat(ai): provider switcher chip in the Catty Agent chat input Catty Agent currently has no model chip in the chat input — modelPresets is empty for the catty agentId so `hasModelPicker` is false. The provider/model the chat ends up using comes from the global `activeProviderId` / `activeModelId`, which means switching providers requires opening Settings → AI → Providers. Closes the gap surfaced in the original feedback on #1101 (problem 2) and partially addresses #986 (per-context model switching) by going per-agent. State layer adds an `agentProviderMap` (`Record<agentId, providerId>`) alongside the existing `agentModelMap`. Both are written together when the user picks from the new dropdown; together they form a per-agent override that beats the global active provider/model when set. Cross- window sync mirrors the agentModelMap pattern. ChatInput grows a `providerSwitcher` prop carrying the enabled ProviderConfigs, the selected (providerId, modelId), and an onSelect callback. When supplied, the model chip switches from the Cpu glyph to the provider's ProviderIconBadge + `providerName · modelId`, and the popover renders a two-column layout — providers on the left (icon + name + default model caption), that provider's known model(s) on the right. ACP agents (Claude/Codex) are untouched because they plumb their provider through the CLI, not the Vercel AI SDK. AIChatSidePanel resolves `effectiveActiveProvider` / `effectiveActiveModelId` for the catty agent from the per-agent map, falling back to the global selection. handleSend now passes those through to sendToCattyAgent so a provider picked in one Catty session applies everywhere Catty runs. For v1, each provider's right column shows just its configured `defaultModel`. The two-level structure is in place to absorb richer listings (cached /models, manual additions) later without UI surgery — left a note in the popover code. Refs #1101, #986. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * polish(ai): flatten provider picker to a single list Two-level dropdown was theatre — each ProviderConfig exposes exactly one model (its `defaultModel`), so the right column ended up showing the same string already captioned on the left row. Picking a provider implicitly picks its model; one click is enough. Also drops the `p.enabled !== false` filter on the picker list. The user's expectation, confirmed by feedback on the first cut, is that the chat-input list mirrors what Settings → AI → Providers shows. The per-provider `enabled` toggle is an "active-ish" flag, not a visibility gate; hiding disabled providers in the picker silently made everything but the one currently active disappear, which is what the reviewer hit. Pares the popover down to a vertical list — provider icon + name + default-model caption (mono if set, italic "configure default model" hint if not) + a Check on the bound row. Removes the `hoveredProviderId` state along with the right-column rendering since it's no longer driving anything. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * polish(ai): tune provider icon sizes in the chat input Chip icon was sitting at sm (20px badge) and crowded the h-6 toolbar chip alongside the truncated label; popover rows used the same sm, so nothing differentiated the picker from the chip visually. Adds an xs size to ProviderIconBadge (16px badge, 10px glyph, 9px letter fallback) and uses it on the chip. Popover rows step up to md (32px badge, 16px glyph) and the row padding grows accordingly so the larger brand mark has room to breathe — the picker now reads like a list of choices, the chip reads like a status line. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(ai): keep per-agent override honest in model fallback + chip label Two codex P1/P2 findings on #1107: P1 — When Catty has a per-agent provider override but no per-agent model (agentModelMap['catty'] empty), cattyAgentModelId fell through to the global `activeModelId`. That id belongs to whichever provider was globally active, not the one Catty is now bound to, so e.g. overriding to DeepSeek without a defaultModel happily sent gpt-4o (global) to DeepSeek and produced a wrong-model error. The fallback is now: stored agent model → override provider's defaultModel → empty. Only the no-override path keeps the activeModelId tail; the no-provider send guard catches the empty case for everyone else. P2 — ChatInput's selectedSwitcherProvider used `?? providers[0]` so the chip always displayed *some* provider even when none was actually bound (selectedProviderId missing). The rest of the pipeline (send guard, agentProviderMap) treats that as "no provider", so the chip was lying. Dropped the fallback; when nothing is bound the chip now shows a generic Cpu glyph + "Select provider" label until the user picks one from the popover. Adds `ai.chat.selectProvider` in en / zh-CN / ru. Refs codex review on #1107. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(ai): purge per-agent binding when the bound provider is deleted Codex local review (round 2) flagged that a saved Catty model id could outlive its provider. The chain: - catty bound to provider A (DeepSeek): agentProviderMap['catty']='A', agentModelMap['catty']='deepseek-v4-flash' - user deletes provider A - cattyAgentProvider falls back to the global active provider (B, OpenAI) - cattyAgentModelId still returned the saved 'deepseek-v4-flash' - send dispatched the DeepSeek model id to OpenAI → wrong-model error Two layers of fix: 1. **Defensive resolution** (AIChatSidePanel) — cattyAgentModelId now looks at the override provider before trusting the stored model id. If the override is stale (provider deleted), the stored model id is treated as orphan and the resolution falls back to the global active selection just like cattyAgentProvider already does. 2. **Cleanup on remove** (useAIState.removeProvider) — when a provider is deleted, any agent whose agentProviderMap entry pointed at it gets both maps cleared (provider override + saved model). Same rationale: that model id is now meaningless against every other provider. Mirrors the existing activeProviderId cleanup. Adds a small agentProviderMapRef so removeProvider can snapshot which agents to clean up without relying on the captured-at-callback-create state (which would be stale). Refs codex local review on #1107. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(ai): include agentProviderMap in settings sync + block empty-model send Codex local review (round 3) found two issues: P2 — `agentProviderMap` was missing from the cross-device sync surface. Added it to the sync key list, the build path, the apply path, and the SyncPayload type alongside the existing `agentModelMap`. Sync tests in `syncPayload.test.ts` now cover the new field on both the build and apply sides. P2 — Provider rows with no `defaultModel` were still clickable in the chat-input picker, so selecting one would save a binding with empty model id; the send path then dispatched an empty model name and the SDK would surface a vague backend error. Two changes: 1. ChatInput disables the row (\`disabled\`, \`aria-disabled\`, dimmed styling, tooltip pointing the user to Settings) when the provider has no \`defaultModel\`. Click is suppressed. 2. AIChatSidePanel \`handleSend\` adds a model-required guard mirroring the existing no-provider guard — surfaces \`ai.chat.noProviderModel\` as an assistant message. Catches stale bindings (e.g. user edited the provider's \`defaultModel\` to empty after binding) before they reach the SDK. Refs codex local review on #1107. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(ai): trim whitespace-only model ids + reconcile orphan bindings on sync Codex local review (round 4) found two more leaks: P2 — Whitespace-only `defaultModel` passed the picker's `disabled` gate (which trims) but every other layer (cattyAgentModelId resolution, the send-guard `!sendActiveModelId` check, the SDK call) compared the raw string. A provider whose default model was " " could still reach the SDK and surface a vague backend error. Normalized: trim at the resolution boundary (catty model fallback chain) and trim before the send-guard's existence check. P2 — Sync apply did not reconcile per-agent bindings against the incoming provider set. A payload could change `providers` without shipping a fresh `agentProviderMap`, leaving local overrides pointing to provider ids the synced set no longer includes — the same ghost- binding bug that `removeProvider` already handles for explicit user deletes. Added `pruneOrphanPerAgentBindings()` that runs after every AI settings apply: it walks `agentProviderMap`, drops any entry whose provider id isn't in the current `providers` list, and clears the saved model id for those agents alongside it (mirroring removeProvider cleanup). A new test in `syncPayload.test.ts` exercises the ghost- binding case end-to-end. Refs codex local review on #1107. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(ai): notify open AI state of cross-device sync apply in the same window Codex local review (round 4) flagged that `applySyncPayload` writes straight to localStorage but `useAIState` only re-reads on browser `storage` events. Those events only fire in *other* windows — the window doing the apply (the one with the active chat panel) keeps showing pre-sync providers and per-agent bindings until reload. Concrete leak: cloud sync swaps in a new provider set, pruning runs, localStorage is correct, but the open Catty chip still references the ghost provider binding until the user reloads. Extracts the existing `AI_STATE_CHANGED_EVENT` constant + `emitAIStateChanged` helper out of `useAIState` and into a new `application/state/aiStateEvents.ts` so non-React call sites (sync apply, future IPC handlers) can fire it without pulling in the hook. After AI settings apply, `syncPayload.ts` walks every AI key it touched (including the agentProviderMap / agentModelMap that the reconcile step may have mutated even when the payload didn't ship them) and emits a same-window nudge. `useAIState`'s existing local listener routes unknown keys back through its storage handler, so each affected piece of React state rehydrates from localStorage. Adds a regression test in `syncPayload.test.ts` that asserts the expected `netcatty:ai-state-changed` keys are dispatched for the providers + per-agent map keys. Refs codex local review on #1107. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
0c4de74c84 |
polish(ai): hint that the provider icon is clickable (#1106)
The icon badge next to the Display Name input opens the icon picker but had no visual cue — users had no reason to suspect it was clickable, and reviewer feedback flagged it as too hidden. Adds a primary-tinted ring on hover/focus plus a small pencil glyph overlaid on the bottom-right corner of the badge (also hover/focus gated). The badge itself doesn't change shape, so the layout stays stable; the affordance is purely additive. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
2a4feea40f |
Customizable provider name, icon, and protocol style (#1105)
* feat(ai): customizable provider name, icon, and protocol style
Issue #1101 reported that the only way to wire DeepSeek through the
Catty Agent was to add an "Anthropic" provider with a DeepSeek base URL,
which (a) wasn't relabelable except on the "custom" providerId and
(b) implicitly conflated wire-protocol style with providerId, locking
"custom" to the OpenAI-compatible client.
ProviderConfig now carries three optional fields — `style`
(anthropic/openai/google), `iconId` (built-in brand glyph key), and
`iconDataUrl` (user upload). createModelFromConfig routes on the
resolved style first, falling back to providerId only for per-vendor
quirks (ollama's throwaway apiKey and openrouter's baseURL). Display
name becomes editable for every provider, not just custom.
The icon picker exposes a curated lobe-icons subset (MIT) covering the
common Anthropic/OpenAI-compatible third parties — DeepSeek, Moonshot,
Kimi, Qwen, Zhipu, Doubao, Mistral, Cohere, Grok, Perplexity, Groq,
Hugging Face — plus the existing six built-ins. Uploads are downsampled
to 64×64 WebP on a canvas so localStorage doesn't blow up. See
public/ai/providers/NOTICE.md for attribution.
Closes part of #1101 (problem 2). PR2 will reuse the new name/icon
plumbing in the Catty Agent chat input to surface a provider switcher.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* polish(ai): bigger labelled icon tiles and auto-fill display name
The first pass shipped the icon picker as an 8-column grid of bare
20px badges. Reviewer feedback: the icons are too small to read at a
glance, every preset should announce its brand name, and a second
click on a selected preset should let the user back out.
Switches the grid to auto-fill 120px tiles with a 32px icon plus a
truncated label so the picker reads like a brand list, not a sprite
sheet. Selecting a preset now also writes the brand's canonical
English display name into the Display Name field — the picker labels
keep their "/ 中文" suffix as a bilingual hint, but a new `name` field
on each catalog entry supplies a clean string for autofill (e.g.
"Qwen / 通义" → "Qwen"). Re-clicking the selected tile clears
iconId/iconDataUrl but leaves the typed name alone, so users who
already edited the name don't lose their edit on accidental toggle.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* polish(ai): add explicit close button to icon picker
The picker only opened via the icon badge above the Display Name field,
which left no obvious affordance to collapse it once a preset was
chosen — users either had to scroll past or click back up to the icon.
Drops a ghost Close button in the bottom-right of the picker's action
row (next to Upload/Reset) so dismissing the panel is one click and
visible without hunting.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(ai): wire model discovery to the resolved provider style
Codex review on #1105 flagged that ModelSelector still derives auth
headers from `providerId` (`x-api-key` only when providerId is the
literal "anthropic"). Now that ProviderConfig lets the user override
`style` independently, the form persists the override but the model
discovery call ignored it — so picking an Anthropic providerId pointed
at an OpenAI-compatible backend (or vice versa) would send the wrong
header and fail to list models even though chat routing already used
the override.
Extracts `buildModelDiscoveryHeaders(style, apiKey)` as a pure helper
in infrastructure/ai/. ModelSelector now resolves the protocol family
via `resolveProviderStyle` with the explicit `style` prop taking
precedence, then asks the helper for headers. ProviderConfigForm
passes the resolved style through. The `needsApiKey = providerId !==
"ollama"` shortcut stays as-is — that's a per-vendor concession, not a
style decision.
Refs codex review on #1105.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(ai): apply per-vendor URL fallbacks across every style override
Codex review on #1105 caught that the openrouter (and ollama) baseURL
fallback was sitting inside the `style === 'openai'` branch, so a user
who picked OpenRouter providerId + Anthropic/Google style with an
empty baseURL would skip the fallback entirely. The SDK then routed
to its own default endpoint (api.anthropic.com /
generativelanguage.googleapis.com) using the user's OpenRouter key —
silent misrouting plus auth failures.
Pulls the per-vendor quirks out into a new pure helper
`resolveProviderEndpoint(config, style, safeApiKey)`. The URL
fallback now fires for every style — the user picked openrouter for a
reason, even if they overrode the wire format. The ollama-only
`'ollama'` literal apiKey swap stays gated on `style === 'openai'`
because Anthropic/Google clients need a real key, not the throwaway
placeholder.
Refs codex review on #1105.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(ai): send x-goog-api-key for google-style model discovery
Codex review on #1105 flagged that buildModelDiscoveryHeaders bucketed
google-style providers with the OpenAI-compat default, so a model
refresh against any google-routed endpoint was sending `Authorization:
Bearer …`. That's the wrong auth header — Google Generative AI
rejects Bearer entirely and expects `x-goog-api-key` (or `?key=`).
The runtime chat path already uses `createGoogleGenerativeAI`, which
authenticates with the Google header family, so discovery was the
odd one out.
Adds an explicit `google` branch returning `{ "x-goog-api-key":
<apiKey> }` and updates the unit test. The default google providerId
never hits this path today (PROVIDER_PRESETS["google"] has no
modelsEndpoint), but the style override surface created in this PR
lets users compose providerId + style pairs where discovery does
fire — e.g. an openai/anthropic-style providerId pointed at a Google
endpoint via baseURL override.
Refs codex review on #1105.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(ai): pick discovery endpoint from resolved provider style
Codex review on #1105 pointed out the lopsided fix in
|
||
|
|
770b06a9ee |
fix(ai): make Claude Code agent diagnosable + configurable (auth) (#1095)
* feat(ai): add Claude auth-presence detection helper Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ai): surface actionable Claude auth errors and reap stuck agent processes Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(ai): add pure helpers for Claude config dir + env editor Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(ai): let users set Claude config dir and env vars in settings Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * polish(ai): harden Claude config env, de-dupe error text, label a11y - buildClaudeEnv: drop managed keys (CLAUDE_CONFIG_DIR/CLAUDE_CODE_EXECUTABLE) if a user types them into the free-text env editor, so they can't clobber the config-dir field or the discovered executable path (+ regression test). - bridge: only append error data fields not already shown as message/code, so the actionable error text doesn't echo the same code/message twice. - ClaudeCodeCard: associate the new config-dir/env labels with their inputs via htmlFor/id. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(ai): make the Claude auth & config section collapsible The optional "Authentication & config" section now has a collapsible header (chevron toggle). Collapsed by default to keep the card tidy, but auto-expanded when the user already has a config directory or env vars set so existing config isn't hidden. Local UI state, not persisted. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(ai): preserve raw env editor text; don't encourage plaintext secrets P1: the env textarea was bound to the persisted value, which is the parsed env re-serialized — so typing a key before its "=" was erased mid-entry (buildClaudeEnv drops lines without "="). Keep the raw typed text in local draft state and only resync from the persisted value on genuine external changes (not our own parse→serialize round-trip). P2: the env editor persists to localStorage in plaintext (no credential encryption). Stop suggesting ANTHROPIC_API_KEY in the placeholder and warn that values are stored in plaintext, steering credentials to the config directory (a `claude` login) — consistent with keeping Claude auth CLI/config-owned (#705). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(ai): expand ~ in Claude config directory before passing to the agent CLAUDE_CONFIG_DIR is handed to the spawned agent as an env var, which is not shell-expanded — so "~/.claude" was treated as a literal "~" directory. Expand a leading ~ at consume time (normalizeAgentEnv + getClaudeConfigDir) rather than on save, so the stored value stays portable across machines (cloud sync) and each device expands to its own home. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(ai): recreate cached Claude provider when its env config changes Claude ACP providers are cached per chat session and reused unless one of the fingerprinted dimensions changes. authFingerprint was null for Claude, so editing the config directory / env vars in Settings didn't take effect on an already-running session. Fingerprint the Claude agent env so a config change invalidates the cached provider and the next turn respawns with it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|
|
7bd5d6465a | fix claude system cli detection (#1033) | ||
|
|
b30696c98b | Clean up dead code and duplicated helpers (#1001) | ||
|
|
ea5320d94a |
Fix #954: unify Tooltip styling + replace native selects (#961)
* Fix #954: unify Tooltip styling + replace native selects Replace native HTML title= tooltips and native <select> dropdowns with the existing Radix-based Tooltip / Select components so they share the app's rounded styling, theme tokens and i18n pipeline. Adds a global TooltipProvider in AppWithProviders so every descendant Tooltip works without a per-file Provider wrapper. Scope (driven by the issue #954 examples and "全部都处理" follow-up): - TerminalLayer toolbar: Add Terminal / Split View / SFTP / Scripts / Theme / AI Chat / Move panel / Close panel. - TopTabs middle bar: quick switcher, more tabs, AI assistant, theme toggle, settings; window-control buttons (min/max/close), tray close and hotkey reset/disable have their native title dropped per the user's explicit opt-out ("可以不用Tooltip,直接全局禁用 原生title 属性"). - AI panels: AIChatSidePanel session history / new chat / delete, ConversationExport, AgentSelector, ChatInput attach / expand / permission, ModelSelector, ProviderCard, ai-elements/tool-call. - SFTP: SftpSidePanel header, SftpBreadcrumb, SftpFileRow, SftpPaneToolbar, SftpTabBar, SftpTransferQueue. - Settings: SettingsPage close, SettingsAppearanceTab theme/accent swatches, SettingsFileAssociationsTab edit/remove, SettingsSystemTab crash-log paths and global hotkey reset. - Host vault: HostDetailsPanel (clear / suggestions / show-password / key path / browse key), GroupDetailsPanel, KnownHostsManager, ConnectionLogsManager, KeychainManager, SyncStatusButton, CloudSyncSettings, LogView, QuickSwitcher, ScriptsSidePanel, Terminal status bar copy-host + broadcast/focus, ZmodemProgressIndicator. - Terminal subcomponents: HostKeywordHighlightPopover, TerminalComposeBar, TerminalConnectionDialog, TerminalSearchBar. - Editor: TextEditorPane (subtitle, search, wrap, promote-to-tab). - TrayPanel session rows and port-forwarding rows. Native <select> migrated to custom Select component: - SerialConnectModal (data bits, stop bits, parity, flow control) - SerialHostDetailsPanel (same four fields) - HostDetailsPanel backspace behavior - GroupDetailsPanel backspace behavior - SettingsTerminalTab local shell picker - terminal/ThemeSidePanel font weight Hardcoded English strings extracted to i18n. New keys for both en and zh-CN: terminal.layer.*, topTabs.*, ai.chat.* (sessionHistory, attach, collapse, expand, enableAgent), zmodem.*, settings.shortcuts. resetToDefault. Inline help text on SnippetsManager package-name input removed because the same hint is already shown in a visible <p> below the input. Existing per-file <TooltipProvider> wrappers (SnippetsManager, ScriptsSidePanel, SelectHostPanel, RuleCard, HostDetailsPanel proxy section) are left in place — they nest harmlessly under the global provider and stay self-sufficient for component tests. Tests: - tsc clean for changed files (pre-existing repo-wide errors unrelated to this PR). - All 802 tests pass (3 skipped pre-existing). - HostDetailsPanel.proxyProfile.test and TextEditorPane.test updated to wrap with TooltipProvider, matching the runtime context now needed by the migrated components. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Fix #954: wrap Settings + Tray windows with TooltipProvider Settings and the tray panel mount as separate Electron windows with their own React root in index.tsx, so they do not inherit the global TooltipProvider added under AppWithProviders. After the unified Tooltip migration, any settings tab that used a Tooltip (Appearance, Application, FileAssociations, System, Shortcuts, Terminal, AI ProviderCard, AI ModelSelector) — and TrayPanel — threw "Tooltip must be used within TooltipProvider" and rendered nothing. Wrap both branches with TooltipProvider at the same level as ToastProvider in index.tsx. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
470d9b5aae | [codex] Improve ACP agent error diagnostics (#880) | ||
|
|
cc2702b825 |
fix: decouple Codex agent auth from netcatty provider list (#705)
Codex agent auth must be determined entirely by ~/.codex/auth.json or ~/.codex/config.toml. Before this change, if the user configured any OpenAI-compatible API provider in netcatty settings (for Catty agent use), useAIChatStreaming would silently hand that provider's apiKey to the Codex agent too, causing aiBridge to spawn codex-acp with authMethodId "codex-api-key" and completely override the user's ChatGPT login. The regression was introduced in PR #702 (v1.0.89) when findManagedAgent Provider started matching generic "custom" providers for Codex. Users who logged into Codex via ChatGPT and also had a netcatty-configured custom provider saw the UI flip to "API mode" on refresh and their ChatGPT session get ignored. Remove the codex branch from the agentProviderId resolver and from findManagedAgentProvider itself. Also drop the now-meaningless hasCompatibleProvider hint on the Codex settings card and its i18n copy. Claude agent behavior is unchanged. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
af2589e60b |
Merge pull request #704 from tces1/MoreSkills
feat: add Netcatty user skills scanning and chat selection flow |
||
|
|
1c9c4fcec3 |
fix: address second-round review feedback
- Extract fail-loud check to shared getCodexCustomConfigPreflightError so
the list-models handler (aiBridge.cjs:2149) enforces the same up-front
error as the stream handler. Previously a user whose config.toml
env_key was unexported would get the targeted message on chat send but
a generic "Missing env var" from model-list probes (once the probe was
rewired for Codex in a future change).
- Wire Settings "Refresh Status" to also invalidate the shell-env cache.
New invalidateShellEnvCache() helper in shellUtils; aiCodexGetIntegration
now accepts an optional { refreshShellEnv } flag; the button passes it
so a user who just exported OPENROUTER_API_KEY in their rc file can
click Refresh instead of having to restart netcatty.
- Declare authHash in CodexCustomProviderConfig (types.ts + global.d.ts)
so renderer TS actually sees the field instead of needing a cast.
- DRY the 360 magic number in ChatInput: extract
MODEL_PICKER_MAX_WIDTH, use it in both the className max-width and the
left-clamp math so the two can't drift.
- Move codexCustomConfigResolved useState declaration next to its
companion codexConfigModel, above the effect that invokes its setter,
and drop the duplicate declaration further down. Pure code-organization
cleanup but removes a use-before-declaration nit.
No functional changes beyond the fail-loud parity and the refresh-shell-env
path. ACP behavior when authMethodId is omitted still requires a
real-world OpenRouter config.toml validation, which the user is running.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
||
|
|
fea8e8b305 |
fix: stop probing codex-acp for models; show config.toml model when custom
Two issues the user flagged with the previous round: 1. Probing codex-acp for available models returned the stock ChatGPT catalog (GPT 5.4, Codex 5.x, o3, o4-mini) regardless of the active provider. For a user with a custom model_provider in ~/.codex/config.toml (OpenRouter + Qwen), those IDs are meaningless on their endpoint. Roll back the managed-Codex probe hook and go back to static CODEX_MODEL_PRESETS for the stock / ChatGPT path. 2. The fixed w-[300px] popover left empty space on the right whenever the longest row was narrower than 300px. Instead of the probe, teach readCodexCustomProviderConfig to also return the top-level `model` from config.toml and expose it on the integration response. In AIChatSidePanel, call aiCodexGetIntegration when Codex is the active agent and, if customConfig.model is present, override agentModelPresets with a single-entry list pinned to that model. Otherwise fall back to the static presets as before — so ChatGPT users see GPT 5.x / Codex 5.x etc. exactly like before, while custom-config users see just the model their provider is actually pinned to. Popover switches from fixed width to `w-max min-w-[160px] max-w-[360px]` so it hugs content (great for short single-model lists) while still capping very long rows. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
18c001e9c5 |
fix: show custom config even when env_key is not exported yet
The first pass required both a custom model_provider in ~/.codex/config.toml
AND the referenced env_key to already be present in the shell environment.
If a user had the config file set up but hadn't (yet) exported the key in
their shell, detection returned null and the UI fell back to "Not
connected" + "Connect ChatGPT" — which is the exact flow they were trying
to avoid.
The config.toml is a strong enough signal of intent on its own. Keep the
integration in the connected_custom_config state regardless of env_key
availability, but expose envKeyPresent on the response so the UI can
explicitly warn "Warning: $MY_KEY is not set in your shell — export it".
Status label and color also flip to amber ("Custom config detected — env
var missing") so the state is easy to spot without dropping back to the
login prompt.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
||
|
|
c2c6b265d4 |
feat: detect user's ~/.codex/config.toml custom provider as ready state
Users who hand-configure ~/.codex/config.toml with a custom model_provider and matching [model_providers.<name>] entry are fully functional from the Codex CLI, but netcatty only looked at codex login status — which reports on ~/.codex/auth.json alone — and would therefore push them into the ChatGPT login flow even though the CLI works for them. Add a minimal TOML parser for the narrow subset we need (top-level keys plus [model_providers.<name>] string tables), and readCodexCustomProvider Config() to detect a usable custom-provider setup: an active model_provider that isn't the built-in openai preset, pointing at a provider entry whose env_key is set in the shell env (or api_key is hardcoded). Surface this as a new integration state "connected_custom_config", add a customConfig summary on the IPC response, and tweak the Codex settings card so it shows the custom-provider name, hides the Connect ChatGPT button, and drops the stale "OpenAI-compatible provider" hint when this path is active. At Codex-ACP spawn time, introduce getCodexAuthOverride() so we only pass authMethodId: "chatgpt" when we truly have no other option. When a netcatty-managed API key is present we still use "codex-api-key"; when the user has a custom config we omit authMethodId entirely so codex-acp resolves auth from the shell env / config.toml itself. Fold the detected custom config (provider name, base url, env key presence) into the provider reuse fingerprint so edits to config.toml invalidate cached ACP instances. Fixes the Codex half of #677 for users who skip Settings → AI providers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
1e50b66407 | fix: finish Codex provider follow-up for #677 | ||
|
|
58bc08a045 | Add user skills injection and picker UI | ||
|
|
d9b51c3a50 | feat: add GitHub Copilot CLI agent support | ||
|
|
e6166a1de3 |
feat: AI Provider 高级参数配置 (#532) (#533)
* feat: expose advanced AI model parameters in provider settings (#532) Add collapsible "Advanced Parameters" section to provider config with optional max_tokens, temperature, top_p, frequency_penalty, and presence_penalty fields. Parameters are merged into streamText() calls only when explicitly set, otherwise provider defaults apply. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use maxOutputTokens instead of maxTokens for ai@6 SDK The streamText CallSettings in ai@6 expects maxOutputTokens, not maxTokens. Without this fix the user's max_tokens setting is silently ignored. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: allow negative penalty input and clamp params on save - Use raw string state for penalty fields so typing "-" is not discarded before the digit is entered - Clamp all parameters to valid ranges on save (temperature 0-2, topP 0-1, penalties -2 to 2) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use raw string state for all numeric advanced param inputs Prevents intermediate text like "0." from being normalized to "0" during keyboard entry of decimal values for temperature, topP, and maxTokens fields. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: clamp max_tokens to minimum of 1 after rounding Prevents Math.round(0.4) = 0 from being persisted and causing streamText to reject with "maxOutputTokens must be >= 1". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: reject non-finite max_tokens before persisting Guard with Number.isFinite to prevent Infinity from being stored and forwarded to streamText. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
b17775307f |
fix: bundle claude-code-acp to prevent crash when binary is missing (#404)
* fix: bundle claude-code-acp to prevent crash when binary is missing (#400) When users select Claude Code in the AI module, the app spawns `claude-code-acp` via ACP. Previously only the `claude` CLI was checked during agent discovery, so if `claude-code-acp` was not on PATH the spawn would fail with ENOENT and crash the Electron main process. - Add `@zed-industries/claude-code-acp` as a bundled dependency - Add `resolveClaudeAcpBinaryPath()` that checks PATH first, then falls back to the npm-bundled binary (mirrors Codex pattern) - Use the resolver in both the primary and fallback ACP provider paths - Update agent discovery to detect agents via bundled ACP binary when the standalone CLI is not installed Closes #400 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: add claude-code-acp and its deps to asarUnpack In packaged Electron builds, files inside app.asar cannot be executed by child_process.spawn. Add claude-code-acp and its runtime dependencies to asarUnpack so the binary is accessible in production. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: migrate from deprecated claude-code-acp to claude-agent-acp The @zed-industries/claude-code-acp package has been renamed to @zed-industries/claude-agent-acp (bin: claude-agent-acp). Update all references across the codebase: - package.json: replace dep with @zed-industries/claude-agent-acp@0.22.2 - electron-builder.config.cjs: update asarUnpack entries, remove stale deps (diff, minimatch) no longer needed by the new package - shellUtils.cjs: update binary name and require.resolve path - aiBridge.cjs: update acpCommand, ALLOWED_AGENT_COMMANDS, isClaudeAgent - settings types, i18n locales: update command references Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
835a1231a6 |
feat: add skip TLS verification option for self-hosted AI providers (#369)
* feat: add skip TLS verification option for AI providers
Self-hosted AI endpoints (vLLM, text-generation-webui, etc.) often use
self-signed TLS certificates which Node.js rejects by default, causing
502 Bad Gateway errors. Add a per-provider "Skip TLS certificate
verification" checkbox that sets rejectUnauthorized=false on both
streaming and non-streaming requests.
Ref #294
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: surface real error message instead of generic 502 Bad Gateway
- Pass the actual bridge error message in statusText so Vercel AI SDK
shows the real cause (e.g. "HTTP is only allowed for localhost",
"URL host is not in the allowed list", TLS errors)
- Show real error details for 5xx provider errors instead of generic
"The AI provider returned a server error" message
Previously all connection-level errors were masked as "Bad Gateway"
making it impossible for users to diagnose configuration issues.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: pass server error body details through to the user
- Read HTTP error response body before resolving (was resolving before
body was read, losing the error detail)
- Parse OpenAI-compatible JSON error format to extract error.message
- Return error Response with body+statusText for non-2xx instead of
empty stream, so Vercel AI SDK shows the real server error
- Now users see e.g. "502 model not loaded" instead of just "Bad Gateway"
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: widen link modifier key dropdown to prevent text wrapping
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Revert "fix: widen link modifier key dropdown to prevent text wrapping"
This reverts commit
|
||
|
|
6727248924 |
feat: add web search & URL fetch tools for AI agent (#365)
* feat: add web search and URL fetch tools for AI agent Add web_search and url_fetch tools to Catty Agent, allowing the AI to search the internet for current information and fetch webpage content. - Support 5 search providers: Tavily, Exa, Bocha, Zhipu, SearXNG - Settings UI with provider selection, API key encryption, and config - web_search is conditional on config; url_fetch is always available - Both tools are read-only and work in all permission modes (incl. observer) - aiFetch skipHostCheck for AI tool requests to arbitrary URLs - System prompt guidelines for when to use search/fetch - i18n support (en + zh-CN) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address code review findings (SSRF, key exposure, state race) - P1: Restore SSRF protection when skipHostCheck is true — still block localhost, RFC1918, link-local, and cloud metadata endpoints; only skip the domain allowlist for public HTTPS hosts - P2: Move web search API key decryption to main process via dedicated IPC handler, matching the existing provider key security model - P2: Use configRef to avoid stale closure in async settings callbacks that could overwrite newer user changes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address second review — DNS rebinding, url_fetch approval, maxResults - P1: url_fetch now requires approval in confirm mode (outbound GET is a side effect that could exfiltrate data via query strings) - P1: Add DNS resolution check when skipHostCheck is set — resolve hostname and reject if any IP is private/loopback/link-local, blocking DNS rebinding attacks against internal services - P2: Slice search results after provider call to enforce maxResults consistently (Zhipu and SearXNG ignore the limit parameter) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address third review — localhost/IPv6 SSRF, API key blur race - P1: Block localhost/loopback when skipHostCheck is enabled — restructure isAllowedFetchUrl to check private hosts first in the skipHostCheck path, preventing access to local services on allowlisted ports - P1: Handle IPv6 private ranges (fc00::/7, fe80::/10, ::ffff: mapped), strip brackets from URL.hostname, block [::1] and fd00:: addresses - P2: Guard handleApiKeyBlur against provider change during async encryption — skip stale write if provider switched while encrypting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address fourth review — main-process key isolation, SearXNG compat - P1: Replace aiWebSearchDecryptKey IPC with __WEB_SEARCH_KEY__ placeholder pattern — renderer never sees plaintext keys; main process replaces placeholder in headers before HTTP request, matching provider key flow - P1: Search API requests use normal allowlist path (not skipHostCheck), so SearXNG on localhost/HTTP/private networks works via aiSyncWebSearch; only url_fetch uses skipHostCheck for arbitrary public HTTPS URLs - P2: Remove needsApproval from url_fetch — treat as read-only like sftp_read_file, consistent with observer mode allowlist Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address fifth review — private LAN providers, maxResults default - P1: Allow private-IP hosts that are explicitly in the provider/search allowlist (e.g. https://192.168.x.x model providers or SearXNG) - P2: Remove .default(5) from web_search maxResults schema so the user's configured maxResults setting is used when the model omits the param Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address sixth review — HTTPS scope, config gate, redirects - P2: Scope HTTP exception to private/LAN IPs only — remote allowlisted hosts still require HTTPS to protect API keys in transit - P2: Gate web_search tool on complete config (API key for providers that require it, apiHost for SearXNG) to avoid advertising a broken tool - P2: Add redirect following (up to 5 hops) to aiFetch for url_fetch — handles 301/302/307 for short links, www canonicalization, etc. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address seventh review — redirect SSRF, decrypt race, HTTPS-only - P1: Revalidate each redirect hop against SSRF guards (allowlist check + DNS resolution) before following, preventing open-redirect SSRF - P2: Add sequence counter to API key decryption effect — stale promise results from a previous provider are discarded on provider switch - P3: Restrict url_fetch to HTTPS-only URLs, matching the skipHostCheck policy that already rejects HTTP in the bridge Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address eighth review — OS resolver, allowlisted HTTP hosts - P1: Use dns.lookup (OS resolver) instead of dns.resolve4/6 for private IP checks — matches what http.request actually connects to, respects /etc/hosts, mDNS, and other local resolver sources - P2: Allow HTTP for any explicitly allowlisted host (not just literal private IPs), so self-hosted SearXNG at http://searxng.lan works Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address ninth review — HTTP scope, blur ordering, decrypt flag - P1: Narrow HTTP exception to web search apiHost only — AI provider endpoints remain HTTPS-only to protect credentials in transit - P2: Add blur sequence counter to prevent out-of-order encryption results from overwriting newer API key saves - P2: Reset isDecrypting flag when cancelling decrypt on provider switch, preventing permanently disabled API key input Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address tenth review — DNS pinning, prompt/tool alignment - P1: Pin validated DNS result to the HTTP request via custom lookup function, preventing TOCTOU/DNS-rebinding between validation and actual connection - P2: Extract isWebSearchReady() helper and use it consistently in both tool registration and system prompt, so the model isn't told web search is available when config is incomplete Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address eleventh review — single DNS lookup, redirect pinning, CGNAT - P1: Combine DNS validation and pinning into a single lookup call, eliminating the TOCTOU window between hasPrivateResolution and pinnedLookup - P1: Pin DNS for redirect targets too — resolve/validate/pin in one step before following each redirect hop - P2: Add 100.64.0.0/10 (CGNAT) to private IP ranges for Tailscale and similar CGNAT-addressed internal services Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address twelfth review — apiHost validation, sync on enable - P2: Validate apiHost is a well-formed URL in isWebSearchReady(), preventing tool exposure when user enters a malformed host - P2: Add webSearchConfig.enabled to sync effect deps so the main process gets updated immediately when the toggle changes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: remove DNS-level SSRF checks that break fakedns/proxy environments DNS resolution validation (dns.lookup + IP pinning) breaks in proxy environments where fakedns resolves all domains to LAN addresses. Revert to hostname-level checks only (blocking localhost, 127.0.0.1, metadata endpoints, etc.) which are sufficient without false positives. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: resolve empty catch block lint warning Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
b3d5785477 |
fix: allow settings window as trusted IPC sender (#354)
* fix: allow settings window as trusted IPC sender The settings window runs in a separate BrowserWindow with its own webContents id. validateSender() only checked the main window id, causing "Unauthorized IPC sender" errors when fetching AI model lists from the settings page. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: add validateSender to all remaining AI IPC handlers 15 handlers in aiBridge were missing sender validation, allowing potential unauthorized IPC calls. Now every netcatty:ai:* handler consistently validates the sender against trusted windows. Affected handlers: chat:cancel, agents:discover, resolve-cli, codex:get-integration, codex:start-login, codex:get-login-session, codex:cancel-login, codex:logout, mcp:update-sessions, mcp:set-command-blocklist, mcp:set-command-timeout, mcp:set-max-iterations, mcp:set-permission-mode, acp:cancel, acp:cleanup. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: scope settings window trust to config-only IPC handlers Per code review feedback: the previous commit allowed the settings window to access ALL AI IPC handlers including high-risk ones like exec, terminal:write, and agent:spawn. Split into two validators: - validateSender(): main window only (exec, terminal, agent, stream) - validateSenderOrSettings(): main + settings (fetch, sync, codex login, MCP config, agent discovery) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: refresh main window id on recreation and allow settings fetch Two fixes from code review: 1. Always resolve mainWebContentsId from windowManager instead of caching it once, so a recreated main window is recognized. 2. Skip static host allowlist for settings window ai:fetch calls, since the settings UI lets users configure custom provider URLs that haven't been synced to providerFetchHosts yet. Basic URL safety (HTTPS-only, no file:// schemes) is still enforced. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: enforce HTTPS/port safety for settings window fetch requests Per review: previous commit skipped isAllowedFetchUrl entirely for settings window, which removed SSRF protection. Now settings window fetches still bypass the static host allowlist (since the user is configuring new providers) but enforce the same safety rules: - Remote hosts must use HTTPS - Localhost must use known ports Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: sync provider config before fetching models in settings Instead of bypassing the URL allowlist for settings window fetches (which weakens SSRF protection), have ModelSelector sync the current provider's baseURL to the backend allowlist before fetching models. This keeps the full URL safety checks intact while allowing settings to test custom provider endpoints. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use dedicated allowlist handler instead of syncing providers Replace the approach of calling aiSyncProviders (which overwrites the shared providerConfigs) with a new lightweight IPC handler netcatty:ai:allowlist:add-host that only adds a host to the fetch allowlist without affecting provider configs or API key resolution. This preserves the SSRF protection while allowing settings to test custom provider URLs that haven't been synced from the main window. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: auto-expire temporary allowlist entries after 30 seconds Temporary hosts added via allowlist:add-host now auto-remove after 30s to prevent permanently expanding the SSRF boundary. Built-in ports and hosts re-added by provider sync are preserved. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: prevent temp allowlist cleanup from removing synced providers The setTimeout cleanup now checks whether the host/port belongs to a currently synced provider config before removing it. This prevents the scenario where a user saves a provider within the 30s TTL window and then loses access when the timer fires. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: preserve temp allowlist entries across provider sync rebuilds rebuildProviderFetchHosts() clears and rebuilds the allowlist from providerConfigs, which would wipe temporary entries added by allowlist:add-host. Now re-adds active temp entries after rebuild to prevent race conditions between settings model listing and provider sync from the main window. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
1816c3d0df |
fix: resolve eslint warnings in AI chat panel components
- Copy abortControllersRef to variable before cleanup - Remove unnecessary useMemo deps (activeTabId, workspaces) - Remove unused Shield import - Add missing deps (t, isCustom) to useMemo/useCallback Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
0b9cb86c4e |
fix: address security and correctness issues from code review
- Add command blocklist check to terminal_send_input (executor + SDK tools) - Add session scope validation to all tools in executor.ts - Fix abort handler to call aiChatCancel instead of aiChatStream - Enforce URL allowlist in fetch proxy to prevent SSRF - Wrap event.sender.send with safeSend for destroyed window check - Filter dangerous env vars (LD_PRELOAD, NODE_OPTIONS, etc.) from agent spawn - Fix stale debouncedPersistSessions closure using sessionsRef - Fix cleanupOrphanedSessions race when sessions load before workspaces - Fix limitConcurrency implementation using Set + finally pattern - Improve command blocklist regex patterns with word boundaries - Add regex validation with error feedback in SafetySettings - Add confirmation dialog for provider removal - Fix React key warning for tool-role messages in ChatMessageList - Remove debug console.warn in TerminalLayer - Remove unused nanoid dependency - Remove redundant platform-specific codex-acp binary from dependencies Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
a55da77471 |
refactor: fix security issues, remove dead code, and split monolithic files
Security: - Fix command injection in 15+ shell interpolation sites with shellQuote() - Add token-based authentication to MCP TCP server - Fix heredoc delimiter collision in SFTP write fallbacks - Add case-insensitive flag to mcpServerBridge command blocklist - Add exhaustive default case to createModelFromConfig Architecture: - Split aiBridge.cjs (1971→1483 lines) into 4 modules: shellUtils, codexHelpers, claudeHelpers, ptyExec - Split SettingsAITab.tsx (1480→520 lines) into 10 sub-components - Extract shared processCattyStream from AIChatSidePanel.tsx (-168 lines) - Consolidate duplicate PTY execution logic into shared ptyExec.cjs - Consolidate duplicate stripAnsi/toUnpackedAsarPath utilities Code quality: - Remove ~33 debug console.log statements from production code - Remove dead code: terminal_read_output stub, checkToolPermission, isCommandAllowed, READ_ONLY_TOOLS - Unify bridge type accessor in useAIState.ts (eliminate 15 unsafe casts) - Add localStorage session pruning (50 sessions / 200 messages cap) - Fix ModelSelector onBlur race condition (setTimeout → preventDefault) - Fix duplicate getShellEnv() calls in Codex helpers - Remove unused _config param from claudeAgentAdapter - Type claudeAgentAdapter bridge parameter directly as ClaudeBridge Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |