mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-21 07:32:54 +00:00
0108390d4f02854bbfcd8fbd0e87cea78ca32add
1035
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
0108390d4f |
Pin the host multi-select bar to the top of the page (#793)
The bulk-action bar for multi-select (selected count, Select All / Deselect All / Delete / close) was rendered inside the Hosts section, so it scrolled out of view as soon as the user moved past the first row of cards. Hoist the bar out of the scroll container and render it as a sibling right after the top header. It is now always visible below the header while multi-select is active in the Hosts section, and slims down visually: - Single flat row (no inner pill, no secondary border) - Compact button sizing: h-7, px-2, text-xs, icon-12 - Bottom-only border for separation from the scroll area - Count label forced to h-7 + leading-none so it vertically centers against the buttons Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
e992d51fa6 |
Collapse four terminal toolbar actions behind a More popover (#792)
* Collapse four terminal toolbar actions behind a "More" popover
The terminal status-bar toolbar had seven visible icon buttons
(SFTP, Encoding, Scripts, Theme, Highlight, Compose, Search) plus
the close button. That's a lot of icons for a toolbar that sits
right above the terminal output — it reads as cluttered and pushes
the connection info / host name around on narrow tabs.
Fold the four "opener" actions — SFTP, Encoding, Scripts, Terminal
Settings — behind a single `MoreHorizontal` (⋮) popover. The three
mid-session toggles (Highlight, Compose, Search) stay in the bar
because they're used repeatedly during a session.
- components/terminal/TerminalToolbar.tsx:
* Add MoreHorizontal import, a shared `menuItemClass` style for
popover rows.
* Replace the four inline Buttons with a single Popover whose
content lists each action as an icon + label row.
* Inline the Encoding sub-popover into the same menu: a
Languages-icon section header followed by two `Check`-marked
radio-like rows for UTF-8 / GB18030 — still only rendered when
`isSSHSession && onSetTerminalEncoding`.
* SFTP row respects the existing connected-state: disabled +
50% opacity until the session is connected, and label falls back
to "availableAfterConnect".
- application/i18n/locales/en.ts, zh-CN.ts:
* New `terminal.toolbar.more` key — "More actions" / "更多操作"
— used as the ⋮ button's aria-label and tooltip.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Move terminal overflow menu to end and use vertical dots
The ⋮ overflow trigger was the first icon in the toolbar with a
horizontal-dots glyph. Visually it read as the primary action and
competed with the mid-session toggles next to it.
Move the Popover to the end of the toolbar (just before the close
X when shown), switch the icon to MoreVertical, and flip the
popover alignment to `end` so it opens leftward from the right
edge.
Toolbar order is now: Highlight → Compose → Search → ⋮ → (X).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|
|
7c55381f39 |
Add terminals to workspace + New Workspace from QuickSwitcher (#790)
* Add terminals to workspace + New Workspace from QuickSwitcher
Two entry points share a single multi-select picker that lets the
user add Local Terminal + any combination of hosts into a workspace:
1. Focus-mode sidebar "+" button appends the selected targets to the
active workspace as new panes.
2. QuickSwitcher "New Workspace" button (small inline action next to
the Jump To hint) spins up a brand-new workspace tab populated
with the selected targets.
## Changes
### domain/workspace.ts
- pruneWorkspaceNode now rebalances surviving siblings to EQUAL
sizes after removal, instead of re-normalising the prior skew.
Matches the "auto-redistribute on close" expectation.
- New appendPaneToWorkspaceRoot(root, sessionId, direction='vertical'):
if root already splits in the requested direction, pushes the new
pane onto its children and resets sizes to equal; otherwise wraps
root + new pane in a new 0.5/0.5 split. Flattens long chains of
appends instead of producing degenerate nested trees.
### application/state/useSessionState.ts
- appendHostToWorkspace(workspaceId, host, direction?) — atomic
"build a session for this host and append it to the root", keeps
activeTab on the workspace and focuses the new pane.
- appendLocalTerminalToWorkspace(workspaceId, options?, direction?)
— mirror of the above for local shells.
- createWorkspaceFromTargets(targets, name?) — accepts a mixed list
of {kind:'local',...} / {kind:'host',host} and creates a new
workspace with one pane per target. Defaults viewMode to 'focus'
so the QuickSwitcher flow lands in the sidebar layout.
- All three exported from the hook.
### components/workspace/AddToWorkspaceDialog.tsx (new)
QuickSwitcher-styled multi-select picker:
- Fixed top-center overlay, same chrome as QuickSwitcher (border,
shadow, rounded-xl, borderless search input, bg-primary/15 cursor).
- Two sections: Local Shells (currently just Local Terminal) and
Hosts. Hover follows keyboard cursor.
- Toggle rows with click or Space / Enter; ⌘/Ctrl+Enter submits;
Esc closes. Right-side Check marks visible items.
- Thin footer bar with Cancel + "Add N" button.
### App.tsx
- Root-mounted single instance of AddToWorkspaceDialog with a
discriminated-union state:
{ mode: 'append'; workspaceId } | { mode: 'create' } | null.
- onAdd dispatches based on mode — append loops through the picker
targets calling the two append helpers; create calls
createWorkspaceFromTargets once.
- TerminalLayer's focus "+" now sends an onRequestAddToWorkspace
(workspaceId) up to App instead of owning its own dialog.
- QuickSwitcher's onCreateWorkspace callback repurposed to open the
dialog in create mode (replaces the older CreateWorkspaceDialog
route for this specific flow).
### components/TerminalLayer.tsx
- Dropped the inline AddToWorkspaceDialog + addHostPanelOpen state;
replaced the two append callbacks with a single
onRequestAddToWorkspace prop wired to the "+" button.
- Focus-sidebar header: replaced the "Terminals · N" counter with an
immersive borderless search input (bg-transparent, shadow-none,
termFg color) for filtering the terminal list; "+" and Columns2
buttons moved to the right.
- Session list filtered client-side by the search term across
hostLabel / hostname / username.
### components/QuickSwitcher.tsx
- Re-introduced onCreateWorkspace prop (was removed as unused).
- "New Workspace" inline button (Plus icon + label) sits on the
right of the Jump To hint row: border, rounded, hover bg. Click
fires onCreateWorkspace then closes QS.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Add configurable New Workspace shortcut
Mirrors QuickSwitcher's "+ New Workspace" button via a keyboard
binding so the dialog can open in one keystroke without passing
through QS.
- domain/models.ts: new DEFAULT_KEY_BINDINGS entry id=new-workspace,
action=newWorkspace, default ⌘+Shift+J (Mac) / Ctrl+Shift+J (PC).
Audited the defaults — only quick-switch uses J (⌘+J), so the
shifted combo is free. The binding sits in the 'app' category so
it shows up in Settings → Shortcuts and can be rebound by the user.
- application/state/useGlobalHotkeys.ts: wire newWorkspace into the
HotkeyActions interface, getAppLevelActions() allowlist, and the
global keydown switch so the scheme-driven handler dispatches it.
- App.tsx: handle case 'newWorkspace' inside executeHotkeyAction by
calling setAddToWorkspaceDialog({ mode: 'create' }) — same entry
as QuickSwitcher's button, just without having to open QS first.
- application/i18n/locales/zh-CN.ts: add '新建工作区' translation for
settings.shortcuts.binding.new-workspace. English falls back to
the KeyBinding.label field ("New Workspace"), so no en.ts change.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Address codex P1: don't check setState flag after the updater returns
Codex flagged that appendHostToWorkspace / appendLocalTerminalToWorkspace
were racy: both flipped an `inserted` flag inside setWorkspaces'
updater and then read it synchronously to decide whether to commit
the matching session via setSessions. React does NOT guarantee
updaters run synchronously (concurrent rendering, StrictMode
double-invoke, etc.), so the flag could still be false at the read
site even though the workspace exists. In that case setSessions was
skipped while the queued workspace update could still insert a new
pane referencing newSessionId — leaving a pane with no backing
session in state.
Fix: add a workspacesRef kept in sync with the workspaces state on
every render, and perform the existence check synchronously *before*
queuing any setState. Once we've confirmed the workspace exists on
the latest committed state, both setWorkspaces and setSessions are
called unconditionally, so they can never diverge.
The ref approach also correctly handles the multi-target append
loop path — React batches the updaters and applies them in sequence,
so sibling pane/session writes land in matching order.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Address codex P1+P2: narrow prune rebalance; append in root direction
### P1 — pruneWorkspaceNode over-rebalanced ancestor splits
The equal-sizes rebalance was unconditional during the recursive
walk, so closing a pane deep in one branch also rewrote unrelated
ancestor ratios (e.g., a root 0.8/0.2 vertical split got normalised
to 0.5/0.5 when a grand-child horizontal pane closed).
Now each split level tracks whether it actually lost a DIRECT
child. Only splits where a direct child disappeared get their
siblings reset to equal sizes. Ancestors whose direct children all
survived keep their original ratios (defensively re-normalised in
case a descendant subtree collapsed shape).
### P2 — Append path ignored the root's current direction
onAdd in App.tsx called the two append helpers without a direction,
so both defaulted to 'vertical'. appendPaneToWorkspaceRoot only
flattens into the root split when the directions match; if the
workspace root was horizontal (e.g., user split top/bottom earlier),
each append wrapped the entire existing tree into one side of a new
vertical split — existing panes crammed into one branch, new pane
hoarding half the space.
Read the current root direction out of the target workspace and
pass it down so new panes become peers of the existing root
siblings regardless of horizontal vs vertical.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Address codex P2: allow serial hosts in create-workspace picker
The picker used to filter out every host with protocol='serial'
regardless of mode. That was correct for append mode (the
appendHostToWorkspace helper has no serial path and early-returns)
but a regression for create mode — the old createWorkspaceWithHosts
flow passed serial hosts through and createWorkspaceFromTargets
still builds a SerialConfig-backed session for them, so there was
no reason to block them in the "+ New Workspace" entry.
Move the filter from the dialog up to App.tsx:
- AddToWorkspaceDialog drops the serial filter; selectableHosts is
simply the hosts prop.
- App.tsx passes `hosts.filter(h => h.protocol !== 'serial')` when
mode is 'append', and the full list when mode is 'create'.
Result: users can once again build a workspace from serial hosts
via QuickSwitcher's "+ New Workspace" button or the ⌘/Ctrl+Shift+J
hotkey, while append-to-existing keeps its earlier safe behaviour.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Address codex P2: don't commit session when append target disappears
Follow-up to the earlier ref-based guard. The ref check eliminates
the common "workspace already gone" case but still leaves a small
race: if closeWorkspace runs between the ref read and setWorkspaces'
updater firing, prev.map returns the unchanged workspaces but
setSessions / setActiveTabId still execute — leaving an orphan
session whose workspaceId points at a deleted workspace and jumping
activeTabId to a closed tab.
Nest setSessions + setActiveTabId inside the setWorkspaces updater
so the writes are gated on the same authoritative match used for
the tree update. The setSessions updater also de-dupes by newSessionId
so React 18 StrictMode's dev-time double-invoke of the outer updater
doesn't append the same row twice. Same pattern applied to
appendLocalTerminalToWorkspace.
The existing closeSession already uses the nested-setState shape, so
this matches the codebase convention.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|
|
d582baaf53 |
Match Settings wordmark style with Vault sidebar (#791)
Settings > Application used `text-3xl font-semibold` on
`{appInfo.name}`, which resolved to lowercase "netcatty" (from
electron's app.getName() / package.json). The Vault sidebar already
renders the brand as `text-xl font-black italic tracking-tight`
with mixed-case "Netcatty", so the two brand surfaces didn't
match — same logo, different wordmark weights and capitalization.
Use the Vault's italic/heavy treatment in Settings too (keeping
the hero text-3xl size) and hardcode "Netcatty" mixed-case so the
wordmark is consistent everywhere the app presents its identity.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|
|
8c1657f1ba |
Polish workspace focus-mode sidebar (#788)
* Polish workspace focus-mode sidebar
- Decouple from side panel position: replace flex-row-reverse on the
outer row with order-last on the side panel itself, so the workspace
focus-mode sidebar and terminal area stay in source order (sidebar
on the left) regardless of whether the terminal side panel is
pinned left or right.
- Make the sidebar width user-resizable. New storage key
STORAGE_KEY_WORKSPACE_FOCUS_SIDEBAR_WIDTH with a useStoredNumber
default of 224px (matches the old w-56), clamped 160..480. Drag
handle sits on the right edge using the same pattern as the side
panel; rAF-throttled mousemove, persisted on mouseup.
- Paint the sidebar with resolvedPreviewTheme.colors.background /
.foreground so it reads as one continuous surface with the focused
terminal's output area instead of a distinct tinted panel. The
border-r is kept as a thin separator from the terminal column.
- Session rows swapped from <div> to RippleButton to match the Vault
sidebar's click ripple feel, and restyled to avoid the old
primary-tinted selection:
* selected: bg-foreground/10 text-foreground (soft neutral over
the terminal-theme sidebar bg)
* unselected: bg-transparent text-foreground/75
* font weight upgrades to semibold on selected; font-size is fixed
* hover:text-inherit pins text color on hover so the ghost
variant's hover:text-accent-foreground doesn't flip the title
color when the cursor passes over a row
- Drop the former `border border-primary/30` selection outline and
the primary-tinted row bg entirely.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Address codex P1: use terminal-theme colors for focus sidebar rows
Codex flagged that the session rows were mixing two theme systems:
the sidebar now paints with resolvedPreviewTheme (terminal theme),
but row classes like bg-foreground/10, text-foreground, and
hover:bg-foreground/15 resolve against the app theme CSS vars. With
followAppTerminalTheme off and app/terminal themes diverging (e.g.
light app + dark terminal), row text and selection tint no longer
match the surface and can become low-contrast or invisible.
Derive every row color from resolvedPreviewTheme.colors via
color-mix and apply via inline style:
- selectedBg = foreground 10% over transparent
- selectedHoverBg = foreground 15%
- unselectedHoverBg = foreground 10%
- unselectedFg = foreground 75% mixed toward termBg
- mutedFg = foreground 55% mixed toward termBg (used for
"Terminals · N" counter, switch-to-split icon color, fallback Server
icon, and the username@host secondary line).
- separator = foreground 10% over termBg (right-border and
header bottom-border now use this instead of border-border/50,
which was also app-theme bound).
Hover bg swap goes through onMouseEnter/Leave rather than
hover:bg-* utilities, since Tailwind arbitrary values can't easily
inject color-mix hover variants and we want terminal-theme alpha
either way.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|
|
999ad916e3 |
Make terminal compose bar borderless and immersive (#789)
The old compose bar had a rounded gradient card with an inset box shadow, a bordered inner textarea, and a prominent filled Send button — visually heavy, and sitting on top of the terminal it looked like a separate panel instead of a prompt line. Rework it to sit flush on the terminal-theme background, Claude Code compose-area style: - Outer container uses resolvedBg directly (no gradient, no rounding, no box-shadow); separator from terminal output is a single 8%-alpha hairline border-top. - Textarea is fully borderless and transparent — no bg, no border, no focus ring, no inner shadow. Text sits directly on the terminal bg. - Send button removed entirely; Enter was already the send key, and the filled button was just visual weight. Shift+Enter still inserts a newline, Esc still closes. - Close (X) button shrunk to a minimal 6x6 ghost; transparent at rest, only gains a 10% overlay + full fg on hover. - Placeholder bumped from opacity-40 to opacity-70 so the "press Enter to send" hint is legible against dark and light terminal themes. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
8ca09b1616 |
Add right-click Edit/Delete to sidepanel snippets (#780) (#787)
The terminal-side ScriptsSidePanel was the surface the #780 reporter was actually looking at when they asked for right-click delete/modify on snippets. PR #783 closed the issue by adding a trash icon in the Vault edit panel, but the sidepanel snippet rows were still plain <button>s with no context menu — so the original complaint ("右键可以弹出一个菜单, 可以包含'删除, 修改'等操作") remained unaddressed at the exact spot the screenshot came from. Changes: - ScriptsSidePanel: wrap each snippet row in a ContextMenu with Edit and Delete items. Menu actions dispatch window events instead of threading new callbacks — matches the existing netcatty:snippets:add pattern the + button already uses. - QuickAddSnippetDialog: accept an optional onUpdateSnippet prop and listen for netcatty:snippets:edit. Prefills label/command/package from the dispatched snippet, and on save preserves the snippet's original tags/targets/shortkey/noAutoRun (the dialog only exposes the three quick-edit fields). Title flips to snippets.panel.editTitle in edit mode. - App.tsx: pass onUpdateSnippet wired to updateSnippets(map-replace), and register a window listener for netcatty:snippets:delete that filters the deleted id out of snippets. Delete needs no UI so it doesn't go through a dialog. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
70b05bfaaf |
New app logo + sidebar ripple + manager UI polish (#786)
* Replace app logo across window icon, tray, splash, and in-app brand
- public/logo.svg: new netcatty mark
- public/icon.png: regenerated 1024x1024 from new SVG (source for
electron-builder — .icns/.ico rebuilt automatically at pack time)
- public/dmg-fix-icon.png: regenerated 1024x1024
- public/tray-icon{,@2x}.png: regenerated color 16/32px for Linux/Windows
- public/tray-iconTemplate{,@2x}.png: regenerated monochrome silhouette
for macOS menu bar (background stripped, foreground flattened to
black on transparent so template-image rendering produces a clean
mask)
- components/AppLogo.tsx: render the new logo as a static <img>. The
old hand-coded inline SVG bound fills to the accent CSS variable;
the new mark has a fixed palette, so callers keep their sizing /
rounding classes via className while the asset itself is a single
file served from /public.
- index.html: splash screen now uses the same /logo.svg via <img>,
with border-radius for the rounded-square frame.
* Polish logo: theme the in-app mark, gloss the OS icon, shrink cat
- components/AppLogo.tsx: back to an inline SVG. Background rect fills
with hsl(var(--primary)) so the in-app brand follows the theme
accent (was fixed navy when imported as <img>). Cat scaled to 68%
of the frame and centred so it doesn't crowd the edges at small
sidebar sizes.
- public/logo.svg + regenerated PNGs: polished OS icon variant with a
large rounded-square clip (rx 224 on 1024), top-left spotlight
radial gradient, subtle top sheen + bottom darkening, and an inner
edge vignette for a slight chamfer. The cat is shrunk to the same
68% as the in-app logo for visual consistency.
- Monochrome tray template (macOS menu bar) is rebuilt from the
shrunk-cat path set with all fills flattened to black; keeps a
clean silhouette instead of a filled rounded square.
* Smooth paws, richer gloss on app icon
- Drop the dark toe/claw detail paths from the source illustration
(indices 22-25, 30, 35, 37, 39 — the ones tracing vertical claw
dividers inside the paws). At small sizes those read as teeth/
claws; paws now render as clean rounded blobs.
- public/logo.svg (OS icon source): richer depth pass —
* two-tone navy vertical gradient (lighter top, deeper bottom)
* brighter upper-left spotlight for glassy highlight
* top sheen + bottom darkening for sheen-across-curve effect
* soft elliptical ground shadow beneath the cat to anchor it
* 2% inner edge stroke to crisp the rounded-square chamfer
- components/AppLogo.tsx: regenerated with the same cleaned cat set,
still themed via hsl(var(--primary)). The in-app mark stays flat
(no gloss) because the effect adds nothing at 20-40px sidebar
sizes and would fight theme accents.
- All raster variants (icon.png, dmg-fix-icon.png, tray color + tray
macOS template) rebuilt from the cleaned sources.
* Respect Apple icon safe area; drop gloss, add thin border
macOS icon was rendering to the full 1024x1024 canvas, so it looked
noticeably larger than neighbour apps (VS Code, Ghostty, Zed) in the
Dock. Apple's Big Sur+ convention puts the artwork body inside an
~824x824 safe area centred in a 1024 canvas, which is how those apps
are sized.
- public/logo.svg: artwork body is now 824x824 centred with ~100px
transparent padding. Corner radius 185 (close enough to the macOS
squircle at Dock scale). Cat rescaled so it keeps the same 68%
proportion within the smaller body.
- Gloss layers (spotlight / sheen / ground shadow / vignette) removed
per request — went for a Ghostty-style clean look instead.
- Thin white inner border (stroke 3px, 22% opacity) outlines the
rounded square for definition.
- Tray PNGs for Linux/Windows keep the full-bleed variant (tray slots
expect the icon to fill the space, unlike the Dock safe area).
- components/AppLogo.tsx unchanged conceptually — it still fills its
own bounding box via hsl(var(--primary)); the Apple safe-area rule
is Dock-specific, not relevant to in-app rendering.
* AppLogo: tighten corner radius to match previous (rx 18.75%)
Previous AppLogo used rx=12 on a 64 viewBox (18.75%). The inline
replacement had rx=224 on a 1024 viewBox (21.9%), which combined
with the caller's rounded-xl class read noticeably rounder in the
sidebar. Drop to rx=192 on 1024 viewBox so the in-app mark matches
the old proportions.
* Beef up icon border so it survives Dock downscaling
3 px at 22% opacity disappeared when rasterised down to ~128 px Dock /
Launchpad size. Bumped stroke-width to 8 px and opacity to 40% so the
inner highlight reads as ~1 px at Dock scale. Stroke is inset by
stroke-width/2 so it sits fully inside the rounded-square body (no
anti-alias bleed outside the safe area). Same treatment applied to the
full-bleed tray variant.
* Enlarge cat inside icon tile (68% -> 85% of body)
Dock render had too much navy margin around the mark. Bump the cat's
scale so it fills 85% of the Apple safe-area body while keeping a
visible bezel to the rounded corners and the inner border. Tray color
variant and macOS template (scale 0.9, no border) follow the same
scale-up.
* Add ripple effect on sidebar nav and tidy logo in vault header
- Add RippleButton wrapper + ripple keyframe; use it for the six vault
sidebar nav entries (Hosts, Keychain, Port Forwarding, Snippets,
Known Hosts, Logs) so clicks get a subtle material-style ripple.
- Shrink vault sidebar AppLogo to h-8 w-8 and drop the outer rounded-xl
so the visible corner comes from the SVG's own rx instead of the
container clip.
- Relax AppLogo tile rx/ry to 144 for a more moderate corner radius.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* AppLogo: bump tile corner radius back up to rx 18.75%
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Unify manager toolbars, tighten tabs and vault sidebar title
- Manager toolbars (Keychain, KnownHosts, PortForwarding, Snippets)
normalised to h-14 / h-10 controls with bg-secondary/80 backdrop-blur
and the shared bg-foreground/5 secondary button treatment, so Hosts /
Keychain / Known Hosts / Port Forwarding / Snippets headers size and
tint identically.
- Keychain filter tabs: drop primary tint and cert-count pill; reuse
the same foreground/5 vs foreground/10 active states as other
managers. Search input grown to h-10 to match.
- Known Hosts: removed the leftover text-xs on Scan System / Import
File so they inherit Button's text-sm like every other action.
- TopTabs: drop the 2px active-accent top line and add rounded-t-md +
overflow-hidden so active tabs read as a clean soft tab shape rather
than a banner.
- VaultView sidebar: wordmark grown to text-xl font-black italic with
tightened tracking; logo gap trimmed from 3 to 2.5; outer bg dropped
from secondary/80 to flat secondary to sit flush against the
toolbars.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|
|
e6ab69b516 |
Vault global search spans all groups/packages (#777) (#785)
* Vault global search spans all groups/packages (#777) Search was scoped to the current group (hosts page) or the current package (snippets page), so a host or snippet the user wanted to find could stay hidden unless they first navigated into the right group — especially confusing with the "root only shows ungrouped hosts" setting enabled. When the search box is non-empty: - hosts: skip the selectedGroupPath / showOnlyUngroupedHostsInRoot filters entirely. Each matching card shows a small outline badge with the host's group so cross-group origin is visible. - snippets: skip the current-package filter. Hide the sub-package grid (would be redundant alongside a flat cross-package match list). Each snippet card shows the package path as a small badge. Tree view already followed this "search crosses groups" shape — see `treeViewHosts` — so this aligns the flat grid/list views with it. * Show no-results feedback when snippet search is empty (#777) Addresses Codex P2 review on PR #785. With the package tile grid hidden during search and no matching snippets, the content area was blank and the global empty state did not render (it requires snippets.length === 0). Add a dedicated no-results panel for the "user is searching and nothing matched but there are other snippets" case, with i18n for en and zh-CN. * Drop group/package badges on search results (#777) Search is itself a filter, so decorating each result card with the group/package it came from added visual noise without adding information. Only difference vs. pre-search rendering now is that the result set spans all groups/packages. * Fix snippet no-results empty state with packages present (#777) Addresses Codex P2 on |
||
|
|
487b7adf3e |
Add 'Set to disabled' button to individual keybindings (#781) (#782)
The keybinding recorder couldn't assign the 'Disabled' sentinel — pressing Esc just cancels. Add a Ban-icon button next to 'Reset to default' that writes 'Disabled' for the active scheme, and render the button label using the localized 'Disabled' string instead of the raw sentinel. |
||
|
|
309996bf3c |
Add delete button in snippet edit panel (#780) (#783)
A right-click Delete already exists in the snippet grid's context menu, but users overwhelmingly open snippets by clicking — and the edit panel had no delete affordance, so many concluded the feature was missing. Surface a Trash2 icon next to Save when editing an existing snippet; it calls the existing onDelete and closes the panel. |
||
|
|
51a6b7efaa |
Preload compact history on first turn after app restart (#753 hedge) (#769)
* Preload compact history on first turn after app restart (#753 hedge) Symptom (confirmed on Copilot CLI, originally reported on Codex in #753): after closing and reopening Netcatty, the AI chat UI still shows the prior conversation but the agent responds "this is the beginning of our conversation, no previous records". Earlier context is lost entirely. Root cause: the bridge relied on session/load throwing "not found" to trigger the catch-block fallback that replays compact history. Some ACP agents (Copilot CLI, some Codex builds) silently spawn a new session when handed a stale id instead of erroring. The catch-block never fires → historyReplayFallback stays false → the first turn sends only the latest prompt → agent sees zero context. Fix: when we're creating a new provider process AND telling it to resume an existing session id AND the renderer gave us compact history, preload historyReplayFallback=true as a hedge. If the agent really did reload the session, the replay is ~3KB of redundant context (small waste). If the agent silently started fresh, the replay restores durable constraints + last few raw turns so the first response is coherent. After the first successful streamed turn clears the flag (the round-2 post-stream hook), steady state is back to sending only the latest prompt. Cost is bounded to one replay per app-restart-and-prompt. Test: "replays compact history on the first turn after app restart even when session/load 'succeeds'" — mocks createACPProvider to behave like Copilot CLI (no error thrown, no real resume), asserts the first streamText call carries history+latest (length 2) and the second only latest (length 1). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Fix AI session resume and agent switching * Preserve hidden draft when switching agents --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
30f5346035 |
Classify AI proxy / size-limit errors instead of showing raw Zod output (#765) (#768)
Symptom: when an AI request is proxied through nginx (or any gateway)
and the request body exceeds client_max_body_size, the proxy returns a
413 HTML error page. The Vercel AI SDK then fails to parse the HTML
as a chat completion and surfaces a cryptic Zod validation error like
"Expected 'id' to be a string." through the UI — users have no idea
what's wrong.
Root cause: classifyError only did light sanitization and returned the
raw SDK message. It also string-coerced the error before inspection, so
the structured statusCode / responseBody fields that APICallError
attaches were thrown away.
Fix: classifyError now accepts `unknown` and inspects the full error
shape. Adds explicit branches for:
- HTTP 413 (from statusCode, cause.statusCode, or message text) →
"Request too large — exceeded proxy size limit. Try shorter
message, fewer attachments, or raise client_max_body_size."
- HTTP 502/503/504 → retryable upstream-gateway message
- HTML response body (starts with <!DOCTYPE/<html> or contains such
tags anywhere) → "Server returned HTML error page, likely a proxy
intercept."
- Zod/schema parse shapes ("Expected 'X' to be …", "Invalid JSON
response", "Type validation failed") → "Response could not be
parsed; proxy may have replaced/truncated the body."
In every classified case the raw SDK text is still appended ("Raw: …")
so users can report the underlying error verbatim.
useAIChatStreaming.ts callers now pass the raw error to classifyError
instead of `.message`, so the new structured branches actually fire.
Also wired infrastructure/ai/*.test.ts into the npm test glob.
Closes #765
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|
|
0425841032 |
Fix ACP history replay and compaction (#754)
* Fix ACP history replay and compaction * Fix PR keyword importance matching Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address codex review on #754: preserve short constraints + cancel-clear Two recovery-path regressions flagged by codex review: 1. Compact ACP history dropped short load-bearing user constraints (acpHistory.ts:55). The blanket length<10 rule treated short non-trivial messages like "Use ssh2" or "中文输出" as filler, while longer generic follow-ups still ate the budget. After stale-session recovery the fresh ACP session would resume without constraints that were present in the original chat. Removed the length heuristic; the TRIVIAL_USER_MESSAGE_PATTERNS regex already filters actual filler ("ok", "yes", "继续", "thanks"). 2. historyReplayFallback was only cleared on non-aborted streams (aiBridge.cjs:2837). If the user stopped the first turn after stale-session recovery, the flag stayed set. The next turn would then trigger shouldResetProviderForHistoryReplay, discard the freshly recovered ACP session (resumeSessionId is forced to undefined in that path), and re-spend tokens on another compact replay — breaking the cancel-preserves-session contract. Now we also clear on abort; the empty-but-not-aborted retry path in the if-branch above is unchanged. Tests: - New test in acpHistory.test.ts asserts "Use ssh2" / "中文输出" survive when pushed outside the recent raw window - New test asserts "ok" / "继续" still drop (sanity check that the trivial regex still does its job without the length backstop) - Updated "does not treat pr inside ordinary words as important" to no longer assert that approach/improve/prepare are absent — the test's real intent (priority-2 line still wins) is preserved by the 不要提交 assertion - New test in aiBridge.test.cjs simulates a user cancelling the first turn after recovery and verifies the next turn reuses the recovered session (no extra provider creation, no re-replay) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Address codex re-review: preserve replay flag across orthogonal recreation + keep tool output in raw window Two more P2 regressions flagged on the second review pass: 1. historyReplayFallback was only carried over in the reset-for-replay branch of the provider recreation path. An orthogonal change between an empty recovered turn and its retry — a permission-mode toggle, MCP scope/fingerprint flip, or auth rotation — would flip shouldReuseProvider to false, enter the !shouldReuseProvider branch, and drop the flag because preserveHistoryReplayFallback only covered the shouldResetProviderForHistoryReplay case. The next turn then sent only the latest prompt and lost the recovered conversation. Now the flag is preserved on any recreation where a replay is still pending. 2. Tool messages didn't flow through toRawHistoryMessage at all, so on stale-session recovery they only survived as the 500-char compact summary in summarizeToolMessage. Any follow-up referencing the last tool output ("use that output", "what did cat show?") lost the actual bytes when they exceeded the compact cap. Now tool results travel through the recent raw window up to MAX_RAW_MESSAGE_CHARS (2000), flattened to the "assistant" role since ACP only accepts user/assistant. Tests: - aiBridge.test.cjs: new "preserves history-replay across provider recreation caused by permission-mode / MCP / auth change" — exercises the gap via a permission-mode toggle between an empty recovered turn and its retry. Extends mock to support a dynamic getPermissionMode. - acpHistory.test.ts: new "preserves recent tool results verbatim" — pushes a ~1500-char tool output through the pipeline and asserts the replay still contains enough bytes to exceed the 500-char compact cap. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Address codex round 3: inline tool_call context + bound durable scan Two findings from the third codex review pass, both legitimate: 1. [P2] When the raw window starts mid-tool-interaction, the preceding assistant tool_call message can fall outside the 6-item slice while the tool_result stays in. Without the call's name+arguments, the result was opaque bytes and follow-ups like "use that output" had no provenance. The compact pass only preserved calls that matched IMPORTANT_PATTERNS, so read_file / grep / terminal_exec were silently dropped. Fix: build a toolCallId → { name, arguments } index from every assistant message and inline a `[from <name>(<args>)]` label next to each Tool result line in the raw window. Args are truncated to MAX_TOOL_CALL_LABEL_CHARS (200) so a verbose JSON payload can't eat the entire raw budget. 2. [P3] buildCompactContext scanned messages.entries() over the full transcript for durable-user/assistant candidates, even though MAX_MESSAGES_TO_SCAN (20) suggested the path was meant to be bounded. On a long ACP chat, every send did O(N) regex work plus an O(N log N) sort — the very chat-length-dependent latency the token-compaction PR was meant to address. Fix: introduce MAX_DURABLE_SCAN_MESSAGES (200) and restrict the durable scan to that tail. 200 is large enough to cover realistic sessions (99th-percentile chats are << 200 turns) while giving a constant-time worst case. Constraints older than the window age out of the compact replay; the live ACP provider's own persisted session still carries them when it can resume, which is the common path. Tests: - "inlines tool_call name+args so tool_result is interpretable without the preceding assistant turn" — pushes the tool_call out of the raw window and asserts the result line carries [from <tool>(<args>)]. - "bounds the durable-candidate scan to avoid O(N) work per send on long chats" — builds a 600+ message chat with an ancient priority-2 constraint outside the scan window and a recent one inside; asserts only the recent one survives. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Address codex round 4: preserve short assistant decisions + provenance on older tool results Two P2 findings from the fourth codex pass, both mirror-images of earlier fixes on a different code path: 1. Short assistant decisions dropped from compact replay (acpHistory.ts:75-83). isSubstantiveAssistantMessage required length >= 40 OR a small English keyword match OR a numbered list. Short but load-bearing replies like "Use ssh2", "rebase instead", "中文输出" satisfied none of those and were silently dropped from the durable- assistant compact section. Once they fell outside the 6-item raw window, "do what you suggested earlier" would replay only the user question without the assistant's actual decision. Fix: mirror the user-side loosening — drop the length/keyword gate, rely on TRIVIAL_ASSISTANT_MESSAGE_PATTERNS to filter actual filler ("ok", "ack", "got it", "明白"). 2. Older tool results lost provenance (acpHistory.ts:108-114). The raw-window fix (round 3) only covered the last 6 items. Once a tool result fell into the compact section via summarizeToolMessage, the paired assistant tool_call was usually gone too, so multiple older outputs surfaced as indistinguishable "Tool result (callN): ...". Follow-ups like "use the resolv.conf output" had no way to map to the right call. Fix: plumb the toolCallIndex through summarizeMessage → summarizeToolMessage and inline `[from <name>(<args>)]` labels in the compact section too, the same shape the raw window uses. Tests: - New: preserves short non-trivial assistant decisions that miss the keyword heuristic (Use ssh2 / 中文输出 / rebase instead) - New: still drops trivial assistant filler like 'ack' / 'ok' / '明白' - New: inlines tool_call context on OLDER summarized tool results - Updated earlier raw-window tool regex tests to match the [from X(Y)] shape ([^)] was failing to cross the args JSON's closing paren) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Address codex round 5: de-dup raw ∩ compact + wire userSkills test into npm test [P2] The scanned loop (last 20) overlaps with recentRaw (last 6), so without a raw-window skip in the summarizeMessage path the same last-6 turns were summarized into the compact section AND appended verbatim in the raw section. Important user turns and large tool output paid the budget twice — eating into the 3k compact cap and crowding out older durable context the replay is meant to preserve. Added the same recentRawSourceIds skip the durable-user / durable-assistant passes already use, and a regression test that asserts markers inside the raw window don't surface in compact while still appearing in raw. [P3] electron/bridges/ai/userSkills.test.cjs (added by this PR) sat in a subdirectory that the default "npm test" glob (electron/bridges/*.test.cjs) didn't pick up. The new routing / index-budget regressions would never run locally or in CI until someone noticed. Extended the glob to also match electron/bridges/*/*.test.cjs; the userSkills tests are now included in the 148-test run. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Address codex round 6: cancel+immediate-send race + tool-call id collision Two P2 regressions in the recovery path: 1. If the user clicks Stop and immediately sends the next prompt, the new stream handler's existingRun path unconditionally called cleanupAcpProvider — destroying the fresh ACP session the cancel IPC had just promised to preserve. The round-2 clear-on-abort fix ran too late (in post-stream code) to help, because the new stream can arrive before the aborted stream fully unwinds. In that common timing window the follow-up still started from a bare provider and lost all recovered conversation state. Fix: (a) cancel IPC now synchronously clears historyReplayFallback on the preserved provider entry, so the next stream can't trigger shouldResetProviderForHistoryReplay and tear the session down via that path; (b) the existingRun path skips cleanupAcpProvider when the prior run was already cancelled via the cancel IPC (captured via existingRun.cancelRequested before we overwrite it). True interrupt-and-restart without an explicit cancel still falls back to the old clean-slate behavior. 2. The tool-call provenance index used raw toolCall.id as the key. Nothing in ChatMessage or the ACP event path enforces per-chat unique ids, so a provider reusing "call1" across turns would overwrite the older entry and mis-label older tool results (e.g., an /etc/hosts result annotated as /etc/resolv.conf in the compact summary). That makes stale-session recovery misleading whenever a follow-up refers back to an earlier tool output. Fix: key the index by `${toolResultMessageId}:${toolCallId}` and walk the message stream in order, resolving each tool_result to the most recent preceding assistant tool_call with matching id. Each result keeps its own historically-correct label regardless of later id reuse. Tests: - aiBridge: "preserves recovered ACP session when user cancels then immediately sends the next prompt" — fires the next stream request after cancel but BEFORE releasing the first stream's blocked read, asserts providerCreationArgs.length stays at 2 (no third creation) and the second turn sends only the latest prompt. - acpHistory: "resolves tool_call provenance correctly when tool ids are reused across turns" — two interactions sharing id "call1", asserts each tool_result carries its own call's args label. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Address codex round 7: turn-based scan bound + single-pass history build Two P2 regressions in long-chat / tool-heavy recovery paths: 1. MAX_DURABLE_SCAN_MESSAGES (200) bounded the scan by raw message count. ACP tool interactions store the user turn, assistant tool_call turn, and each tool_result as separate messages, so a tool-heavy chat can produce 5+ messages per logical turn. 200 messages could be only 30-40 user turns — early constraints like "不要提交" from turn 5 fell out of the compact replay long before the turn count justified aging them out. Fix: bound by MAX_DURABLE_SCAN_TURNS (100 user turns) instead. Walk backwards from the end and stop after seeing 100 user messages. Realistic tool-heavy 30-turn chats now keep their early constraints alive, while true 100+ turn chats still benefit from the bound. 2. buildToolCallIndex(messages) and messages.flatMap(...).slice(-6) both walked the entire transcript on every send, even after the bounded compaction window landed. Compaction's stated purpose was to remove chat-length-dependent latency, but these per-send linear passes kept it. Fix: compute the scan start once via computeDurableScanStart, then do all subsequent work over messages.slice(durableScanStart). buildToolCallIndex walks only the window; the raw-6 flatMap also runs over the window. On a 1000-message chat with 100-turn window, send-time cost drops from O(1000) to O(~window_size). Acceptable trade: if a tool_call's matching tool_result straddles the window boundary (result inside, call outside), the single surviving result loses its [from X(Y)] label. Tool_calls and their results are almost always adjacent, so this affects at most the first 1-2 messages of the window. Tests: - "preserves an early constraint in a tool-heavy chat where message count balloons past the raw-count limit" — 35 turns × 6 msgs/turn = 212 messages. The old bound would have dropped the early EARLY_CONSTRAINT_MARKER; with turn-based bound it survives. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
156550f7eb |
Add Close All / Others / To-the-Right tab actions (#748) (#764)
Adds three bulk-close items to the right-click context menu on tabs: - Close Others - Close Tabs to the Right - Close All Anchor is the right-clicked tab (matches VSCode/JetBrains/FinalShell UX), not the active tab. The "to the right" item is disabled when the anchor is already the rightmost tab; "Close Others" is disabled when it's the only tab. To avoid spamming a busy-shell modal per tab, the new closeTabsBatch helper in App.tsx expands workspace ids into their session ids, runs ONE confirmIfBusyLocalTerminal probe across the whole batch, and only proceeds when the user confirms. The probe + close path itself reuses the existing PR #739 plumbing (ptyProcessTree + confirmCloseBusy). Closes #748 Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
a1648adf12 |
Add opt-in setting to preserve mouse selection across keystrokes (#755) (#763)
* Add opt-in setting to preserve mouse selection across keystrokes Closes #755. xterm.js hardcodes a "clear selection on user input" listener (SelectionService.ts: coreService.onUserInput → clearSelection) with no public option to disable. The user-reported workflow this breaks: select a path with the mouse, type a command prefix like `sz `, then middle-click-paste the still-live selection — but the very first keystroke wipes the selection, so there's nothing left to paste. Modern terminals (iTerm2, GNOME Terminal, Windows Terminal) preserve the selection across input by default. We expose this as an opt-in toggle for now since the visual semantics are a behavior change. Implementation is capture-and-restore via xterm.js public APIs (getSelectionPosition / select); xterm clears the selection synchronously, then a queueMicrotask reapplies it on the next tick. A ref (isRestoringSelectionRef) gates copy-on-select so the restore doesn't redundantly rewrite the clipboard and clobber whatever the user copied elsewhere in between. Defaults to false (opt-in); can flip to default-on later if reception is positive. Selection still clears on: - Mouse click in empty space (xterm's mouse-driven path is untouched) - Terminal scroll past the selected rows (existing buffer-trim logic) - Programmatic clearSelection() callers Files: - domain/models.ts — new field, default false - application/syncPayload.ts — added to SYNCABLE_TERMINAL_KEYS - components/terminal/runtime/createXTermRuntime.ts — capture in attachCustomKeyEventHandler, restore via queueMicrotask - components/Terminal.tsx — owns isRestoringSelectionRef, passes it through context, checks in copy-on-select listener - components/settings/tabs/SettingsTerminalTab.tsx — UI toggle - application/i18n/locales/{en,zh-CN}.ts — labels Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Trim verbose i18n descriptions to match neighboring rows Both clearWipesScrollback and preserveSelectionOnInput descriptions were too long. Cut to one sentence each, matching the brevity of adjacent rows like Bracketed paste and OSC-52. Historical context and edge-case caveats belong in the changelog/PR, not the settings UI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
484ac5f463 |
Honor CSI 3 J by default; add toggle to preserve scrollback on clear (#761)
* Honor CSI 3 J by default; add toggle to preserve scrollback on `clear` Default `clear` (ncurses ≥ 2013) emits CSI 2 J + CSI 3 J to wipe both visible screen and scrollback. PR #633 unconditionally intercepted CSI 3 J to keep history across `clear`, which broke POSIX semantics — users running standard `clear` could not wipe scrollback at all (#757). Restore the standard behavior as the default and expose a toggle for the iTerm2-style "preserve history" preference (matches what #622 asked for): - domain/models.ts: add `clearWipesScrollback: boolean` (default true) - createXTermRuntime.ts: CSI 3 J handler now reads the setting and only intercepts when the user opts out - SettingsTerminalTab.tsx + i18n: expose the toggle with a description explaining the tradeoff - The right-click "Clear Buffer" menu action keeps its independent semantics (always preserves scrollback) regardless of this setting, since it goes through `clearTerminalViewport`, not the CSI path Closes #757 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix: include clearWipesScrollback in cloud-sync terminal keys Codex review on PR #761 caught that the new toggle was added to TerminalSettings but not to SYNCABLE_TERMINAL_KEYS, so it would never travel across devices via cloud sync — users disabling it on one device would silently get the default back on another after sync. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
98e3a6b952 |
Let single Tab fall through to shell when only ghost text is shown (#745)
Closes #741. Bash/zsh use Tab for native completion, but our ghost-text accept on single Tab was swallowing the keystroke before it reached the PTY. Ghost text is still accepted with →; Tab in popup-menu mode is unchanged (popup is an explicit UI so intent is clear). Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
f6f3147afb |
Tab bar: duplicate-adjacent insertion + wheel-to-horizontal scroll (#743)
* Improve tab UX: insert duplicated tabs adjacent to source, enable wheel scroll on tab bar Addresses #737. - Duplicating a tab now inserts the new tab immediately after the source in the tab order, instead of appending it to the far right where it was hard to find with many tabs open. - The top tab strip now translates vertical mouse-wheel deltas into horizontal scrolling, so users with many tabs can reach the ends of the strip without dragging. Trackpad gestures that already carry horizontal delta are left alone to preserve native two-finger swiping. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Address Codex review: read source session inside functional updater Codex flagged that reading `session` from the closure broke the atomicity guarantee of the previous implementation — rapid repeated duplicates could miss freshly queued state. - Pre-allocate the new session id outside both setters so it stays stable across StrictMode double-invocations. - Move the source lookup back into `setSessions`' functional updater so it always reads the freshest committed/queued state. - Drop `sessions` from the useCallback dependency list now that we no longer read it. - Fast-path tabOrder insertion when the source is already in tabOrder to avoid re-deriving the full effective order in the common case. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Address Codex review: gate active-tab and tab-order updates on successful create Codex flagged that `setActiveTabId(newSessionId)` and `setTabOrder(...)` ran unconditionally even when `setSessions` bailed out (source tab was closed before the duplicate handler ran). That left activeTabId pointing at an id that was never appended to sessions, putting the terminal layer into an invalid "no matching tab" state. Move both nested setState calls inside the `setSessions` functional updater so they only fire when the source is actually present. Mirrors the original pre-PR pattern; nested updates are idempotent so StrictMode's double-invocation is harmless. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
54b26511a1 |
Cloud sync data-loss prevention (4-layer defense) (#742)
* feat(sync-guard): extend SyncState with BLOCKED + add shrink event variants
* feat(sync-guard): add detectSuspiciousShrink pure function with 12 unit tests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* polish(sync-guard): drop unnecessary cast, sharpen test naming, pin priority invariant
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(test): include domain/*.test.ts in npm test glob
* feat(sync-guard): gate syncToProvider with shrink detection + force-push override
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(sync-guard): reset overrideShrinkOnce before early return for invariant strictness
* fix(sync-guard): extend shrink guard to syncAllProviders (the actual sync entry point)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(sync-guard): apply empty-vault guard uniformly to auto and manual sync
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(sync-guard): preserve merge base on same-account re-auth
Adds providerAccountId persistence; completePKCEAuth and completeGitHubAuth
now only clear syncBase/anchor when the authenticated account id differs from
the previously stored one, preventing zombie-entry resurrection on token
refresh. disconnectProvider clears the stored id so a reconnect starts fresh.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(sync-guard): add i18n strings for sync-blocked banner + force-push modal
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(sync-guard): add SyncBlockedBanner showing shrink findings with restore/force-push actions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(sync-guard): stable subscribeToEvents reference + type-safe finding narrowing
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(sync-guard): force-push confirmation modal + scroll restore button into view
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* ux(local-backups): show version as title, demote reason+timestamp to meta line
* feat(local-backups): record + display sync data version (v5/v6...) on each backup
Each backup now captures the live CloudSyncManager.localVersion at creation
time. UI shows it as title (v5, v6, ...) with timestamp + reason demoted to
the meta line. Backups created before this field existed (or before any
successful cloud sync) fall back to timestamp as title.
Replaces the earlier app-version-transition title which conflated app
version with sync data version.
* fix(sync-guard): consume override flag at sync entry + restore provider status on block
- Snapshot+clear overrideShrinkOnce at top of syncToProvider and
syncAllProviders so an early-return cannot leak the flag to a later
unrelated sync (Codex P1).
- Restore provider status to 'connected' when shrink-block returns from
syncToProvider; previously left provider stuck on 'syncing' in the
UI (Codex P2).
- Process pre-existing check errors before returning from the
shouldBlockAll branch in syncAllProviders so a check-failed provider
isn't dropped from results (Codex P2).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(sync-guard): refactor force-push to parameter passing + add credential-availability guard
The previous design used a one-shot boolean flag on CloudSyncManager set
by forcePushOverrideShrink(). Even with snapshot+clear at sync entry
points, the renderer wrapper's await ensureUnlocked() could throw before
the flag was consumed, leaving it armed for the next unrelated sync.
Fix: pass overrideShrink as a call-time parameter through the chain.
Eliminates the persistent flag and its leak surface.
Also: force-push now runs the same ensureSyncablePayload(...) guard the
other manual sync entry points use, so a vault with encrypted-credential
placeholders won't be uploaded via the force path either.
Addresses the latest two Codex P1/P2 findings on #742.
* fix(sync-guard): backfill account id from in-memory state for upgrade-path re-auth
Users upgrading to this PR have no netcatty.sync.accountId.* persisted yet.
On their first re-auth the guard saw previousId=null and cleared the
merge base anyway, defeating the point of the same-account preservation.
Snapshot the in-memory account id BEFORE overwriting providers[provider]
and use it as a fallback when the persisted id is missing. New users
(no prior connection at all) still get the clear-on-first-auth path.
Addresses Codex P1 on #742.
* fix(sync-guard): inspect force-push results + mark blocked single-provider as error
- Force-push handler now inspects syncNow result entries: applies any
mergedPayload to local state, only clears the banner when all providers
report success, surfaces a toast error otherwise. Previously the banner
cleared unconditionally regardless of network/auth failures (Codex P1).
- syncToProvider shrink-block branches now mark provider status as
'error' with a 'Sync blocked: would delete too much' message instead
of 'connected'. Status aggregators treat 'connected' as healthy, so
the blocked upload was surfacing as 'synced' in the UI (Codex P2).
syncAllProviders already used this pattern; this brings the
single-provider path in line.
* fix(sync-guard): exempt USE_LOCAL conflict + clear post-merge BLOCKED + expose 'blocked' status
- USE_LOCAL conflict resolution now passes { overrideShrink: true }: the
conflict modal already served as user confirmation, and shrink-blocking
it left users with a closed modal and an opaque banner (Review C-1).
- Post-merge round-trip in useAutoSync now detects shrink-blocked results
and resets syncState to IDLE via new manager.clearShrinkBlockedState().
The merged data is already applied locally; the next user-triggered
sync will re-check, and we don't wedge the manager in BLOCKED with no
visible banner outside the Settings tab (Review I-1).
- overallSyncStatus now reports 'blocked' as a distinct value from
'error', so downstream UI (status icon, future badges) can offer
shrink-block-specific affordances (Review I-2).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(sync-guard): stabilize banner subscription dep + map 'blocked' status to error indicator
- The SyncBlockedBanner subscription useEffect depended on [sync] (the
whole hook return object), which gets a new reference every render.
This caused the listener to be unsubscribed+resubscribed on every
render, opening a tiny race window where a SYNC_BLOCKED_SHRINK event
could be missed and the banner would never appear. Destructure
subscribeToEvents (already useCallback-stable) and depend on it
directly, so the effect runs exactly once on mount.
- SyncStatusButton's status mapping had no arm for the new 'blocked'
value, falling through to 'none' (idle). The global status indicator
said healthy while the in-page banner said paused. Map 'blocked' to
the same error indicator used for 'conflict' so the UI is consistent.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(sync-guard): only clear banner on actual success + hydrate from manager state
- Banner subscription now clears only on SYNC_COMPLETED with result.success.
SYNC_STARTED (auto-sync timer ticks) and SYNC_FORCED (fires BEFORE upload)
could clear the banner prematurely, removing the user's recovery affordance
while the underlying issue was unresolved (Codex P2).
- Manager now persists the last shrink finding in state.lastShrinkFinding
alongside the SYNC_BLOCKED_SHRINK emission. New public getter
getShrinkBlockedFinding() returns it when syncState is BLOCKED. Renderer
hydrates the banner on mount so a block that happened off-screen
(auto-sync while user was on another tab) is still visible when they
open Sync Settings (Codex P2).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(sync-guard): unified BLOCKED-cleared event + USE_LOCAL inspects results
- USE_LOCAL conflict resolution now inspects syncNow() results, applies
any mergedPayload to local state, surfaces a toast error and KEEPS the
modal open on failure (so user can switch to USE_REMOTE). Mirrors the
force-push handler pattern. Without this, USE_LOCAL silently 'succeeded'
even when providers failed (Codex CLI P1).
- New SYNC_BLOCKED_CLEARED event emitted on every BLOCKED -> non-BLOCKED
transition via a private exitBlockedState() helper. Banner subscribes to
this single signal instead of guessing from per-provider SYNC_COMPLETED
events. Fixes:
- Multi-provider scenarios where first SYNC_COMPLETED clears the banner
while a later provider was still going to fail (Codex CLI P1).
- clearShrinkBlockedState() (post-merge self-heal) silently leaving
the banner stuck because no event was emitted (Codex CLI P2).
- disconnectProvider() now also exits BLOCKED state. Disconnecting
implicitly resolves any pending shrink-block warning, otherwise the
stale alert carried over to the next-account reconnect (Codex CLI P2).
- All BLOCKED -> non-BLOCKED transitions consolidated through
exitBlockedState() so lastShrinkFinding cleanup + event emission are
always paired (Codex CLI P3 #6 covered).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(sync-guard): only clear BLOCKED on actual success, not on transient ERROR/SYNCING/CONFLICT
Previous patch called exitBlockedState() at every BLOCKED -> non-BLOCKED
transition, but this clears the banner on transitions that don't actually
resolve the shrink concern:
- SYNCING (sync just started — about to try, may fail)
- ERROR (transient transport failure, shrink concern still real)
- CONFLICT (separate concern; doesn't resolve the shrink)
If a user was in BLOCKED then triggered a sync that failed for an unrelated
reason (network, auth), the banner cleared and they lost the warning.
Restrict exitBlockedState() to terminal-success transitions:
- IDLE on successful upload (data made it to cloud — concern resolved)
- explicit clears (disconnectProvider, clearShrinkBlockedState)
- conflict resolution (USE_REMOTE/USE_LOCAL also end in IDLE)
Found by Codex CLI review of commit
|
||
|
|
8ef91e1266 |
Ctrl+W close priority + local shell busy confirmation (#739)
* feat(ctrl-w): add ps-node + windows-process-tree + tsx deps for close-priority feature * fix(ctrl-w): drop ps-node dep and add windows-process-tree to asarUnpack Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(ctrl-w): add ptyProcessTree bridge with per-platform child-process enumeration Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ctrl-w): ptyProcessTree uses args= for full command + warns on pid overwrite - Replace `comm=` with `args=` in defaultListPosix so the full command line is captured on both macOS (BSD ps) and Linux (GNU ps), avoiding the 15-char TASK_COMM_LEN truncation. - Add console.warn in registerPid when the same sessionId is overwritten with a different pid, making the race condition visible in logs. - Add test: registerPid warns exactly once on a pid change, not on a same-pid re-registration. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(ctrl-w): register local PTY pid with ptyProcessTree on spawn/exit Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ctrl-w): unregister pids in cleanupAllSessions to match per-delete invariant Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(ctrl-w): add IPC handlers for pty child processes and confirm-close dialog Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ctrl-w): guard BrowserWindow.fromWebContents null and document dialog dismiss contract Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(ctrl-w): expose ptyGetChildProcesses and confirmCloseBusy on window.netcatty Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(ctrl-w): add i18n strings for close-busy-terminal dialog Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(ctrl-w): add resolveCloseIntent pure function with 8 unit tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(ctrl-w): expose handleCloseSidePanel via ref to App.tsx Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(ctrl-w): wire resolveCloseIntent + local-shell busy confirmation into closeTab hotkey Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(ctrl-w): add re-entrancy guard, aggregate busy count, sync sidebar ref, dedupe intent branches Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(ctrl-w): auto-close workspace when its last session is closed Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ctrl-w): sidebar close wins over focused terminal in priority chain Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ctrl-w): sidebar priority applies to single-session tabs too, not just workspaces Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ctrl-w): compute empty-workspace auto-close outside setSessions updater Addresses Codex P2 on #739: React 18+ does not guarantee updater execution timing under concurrent scheduling. Moving the decision outside the updater makes the microtask queue deterministic. --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|
|
1b23bdcf15 |
[codex] Preserve terminal focus when clicking the toolbar overlay (#734)
* fix terminal toolbar focus loss * restore focus after closing side panels * fix terminal side panel focus helper order |
||
|
|
3a748aa1aa | fix serial duplicate host save (#732) | ||
|
|
4574f1e2b2 |
fix: stabilize scoped AI draft/session transitions (#724)
* fix: correct terminal AI history resume behavior
The previous implementation plan mistakenly treated reopening an old terminal AI session in a fresh or reconnected SSH tab as a scope-retargeting feature.
The intended rule is draft-first:
- a fresh or reconnected terminal opens on a blank draft
- older chats remain available in history for manual access
- selecting history does not imply automatic scope transfer into the new tab
This change is a rule correction, not a conflict between product rules.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: harden ai draft transitions
* fix ai session continuation from history
* fix: clear stale activeSessionIdMap entry when view resolves to draft
Addresses the Codex P2 review on aiPanelViewState.ts:38. When a terminal
scope mounts with a persisted activeSessionIdMap entry but no explicit
panelView and no draft, resolveDisplayedPanelView now returns the
default draft view (terminal fresh-start behavior). The sync effect
that writes into activeSessionIdMap is guarded by `if (!activeSession)
return`, so the old entry stays put. That stale entry then leaks into
activeTerminalTargetIds in every other scope, and
getSessionScopeMatchRank uses it to suppress host-matched history that
is actually resumable — so valid sessions vanish from the history
drawer until another action rewrites the map.
Add a dedicated effect that clears the scope's activeSessionIdMap
entry whenever the resolved panel view is draft but a persisted
session id is still present. This keeps the map an accurate record of
"which session each scope is currently showing" instead of a lagging
snapshot.
Also extend sessionScopeMatch.test.ts to cover the rank=2 exact-match
branch and the scope-type mismatch short-circuit, which were missing
from the original suite.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: track cross-terminal session ownership by session id, not targetId
Addresses the Codex follow-up review on commit
|
||
|
|
081b167172 |
feat(ai-chat): fit-to-content popovers + keyboard nav for @/slash menus (#726)
* feat(ai-chat): fit-to-content popovers and keyboard nav for @/slash menus - Shrink the @ host and /skill popovers to their content width (auto width with min 220px, capped at the input width) instead of always filling the full input width, which left large empty gutters when the list was short. - Add keyboard navigation: ArrowUp/ArrowDown cycle through items, Enter commits the highlighted item, Escape closes the menu. Mouse hover stays in sync with the active index so keyboard and pointer agree on which row is current. Enter does not fall through to submit while a menu is open. - Expose aria-selected / aria-activedescendant for screen readers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * style(ai-chat): tone down popover radius to match other menus The @ and /skill popovers used rounded-[20px]/rounded-[16px] which stood out against every other popover in this file (rounded-lg with rounded-md items). Switch to the shared radii and drop shadow-2xl for the standard shadow-lg so the surface feels consistent. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * style(ai-chat): tighten mention popover spacing - Drop the redundant "Hosts" / "User Skills" header row — the @ or / trigger already makes the popover's purpose obvious, and the header added ~30px of vertical whitespace above a single-line list. - Shrink wrapper and item padding (p-2.5/px-3 py-1.5 -> p-1/px-2 py-1) and remove the mt-0.5 gap between title and subtitle. - Hide the hostname subline when the label already contains the hostname (common case: "Rainyun-114.66.26.174" as label and "114.66.26.174" as hostname — no need to repeat). - Lower minWidth 220 -> 200 so short lists can shrink further. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(ai-chat): address Codex review on PR #726 - Reset active menu index on any change to the *set* of visible items, not just its length. Watching only `.length` let Enter commit a different item when the slash query changed to a same-sized match set. Derive a stable identity key (sessionIds / skill ids) and use that as the effect dep instead. - Clamp the popover's minWidth to the measured panel width so narrow layouts don't end up with minWidth > maxWidth, which CSS resolves by honoring min and clips the menu off-screen. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
5bc5a6c8b2 |
fix: address Codex follow-up review on PR #720 (#723)
* fix: address Codex follow-up review on PR #720 Two issues surfaced by Codex's post-merge review of PR #720: P1 — useAutoSync.ts: startup retry exhaustion wedged auto-sync. The retry effect previously returned at `attempt >= 4` without opening `remoteCheckDoneRef`. A session with persistent inspect failures (long network outage, provider rate-limit loop) left auto-sync silently disabled for the rest of the session until restart or provider/unlock transition. After exhaustion, open the gate: the specific dangers we gate-closed against (empty-push, partial-apply push) are now covered by independent guards (`hasMeaningfulSyncData`, the apply-in-progress sentinel, and `checkProviderConflict`'s inspect-failure throw at upload time). This matches manual sync's existing semantic rather than silently strict-gating auto-sync. P2 — CloudSyncSettings.tsx: restore buttons were per-row disabled, not globally. A user could click Row A, then Row B while A was still applying — two concurrent `applyProtectedSyncPayload` calls in the same window. `withRestoreBarrier` serializes across windows but NOT same-window re-entry, so the second restore's sentinel-clear could mask a still-partial first apply. Disable every restore button while any restore is in flight. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: keep auto-sync gate closed on retry exhaust; open on manual sync Codex's re-review of PR #723 correctly flagged that opening the auto-sync gate after startup retry exhaustion reintroduces the destructive-clobber path the gate was supposed to prevent. Concrete scenario: local vault is partially lost (non-empty, just missing entries), remote has not changed since our last anchor, user edits a field after a long outage → auto-sync pushes the partially-lost vault over the intact remote. `checkProviderConflict` doesn't catch this (anchor matches), `hasMeaningfulSyncData` doesn't catch this (non-empty), and the empty-vault prompt doesn't fire. Revert the retry-exhaust gate-open. The gate now stays closed until either: 1. A startup `checkRemoteVersion` succeeds (normal path), OR 2. A `syncNow` completes successfully. A manual sync from Settings implicitly runs per-provider `checkProviderConflict` — the same inspect the startup path would have done — so a successful manual sync is equivalent to a successful startup reconciliation from the gate's point of view and opens the gate for the rest of the session. This preserves Codex's safety ask (no auto-push without a confirmed remote state) while giving the user a clear escape hatch (manual sync) that doesn't require a restart. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
6c8a39d269 |
feat: add stable CSS hooks to tab components (#714) (#722)
* feat: add stable CSS hooks to tab components (#714) Expose stable attributes on every tab-like element so custom CSS can target them reliably without chaining utility-class selectors or relying on inline-style substring matches: - data-tab-id: already present on session/workspace/logView/sftp tabs; now also added to the side-panel buttons (sftp/scripts/theme/ai) in TerminalLayer.tsx. - data-tab-type: session | workspace | logView | sftp | sidepanel, lets a selector target one tab family without matching the rest. - data-state: active | inactive, mirroring Radix Tabs' convention so users who already style Settings tabs can reuse the same idiom. - .netcatty-tab class: a single, scope-free hook for "every tab, anywhere" — pairs with data-state="active" for the common "style the selected tab" recipe. No visual changes. The existing inline-style / utility-class selectors the issue reporter had to chain ([style*="var(--top-tabs-active-bg"], .app-no-drag.relative.h-7.px-3, etc.) keep working, so no breakage for people who've already written custom CSS. Custom CSS can now be written as: .netcatty-tab[data-state="active"] { ... } [data-tab-type="sftp"][data-state="active"] { ... } [data-tab-id="ai"][data-state="active"] { ... } Closes #714 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add CSS hooks to the root Vaults/SFTP tabs (#714) The fixed-left root tabs ("Vaults" and "SFTP") in TopTabs.tsx were missed in the first pass — they don't go through the session / workspace / logView branches, so their div rendered without the new data-tab-id / data-tab-type / data-state attributes or the .netcatty-tab class. Add them so custom CSS can target the whole root tab row the same way: [data-tab-type="root"][data-state="active"] { ... } [data-tab-id="vault"] { ... } [data-tab-id="sftp"] { ... } No visual change. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
db69d5ac39 |
[codex] Harden sync overwrite protection and add local restore history (#720)
* fix: harden sync overwrite recovery * refactor: separate backup retention settings * refactor: align backup retention controls * refactor: simplify backup retention card * fix: address PR #720 deep-review findings - Close the cross-window restore race by holding a time-bounded barrier in localStorage during every destructive apply; useAutoSync skips pushes while it's set, preventing a pre-restore snapshot from clobbering just-restored cloud data. - Round-trip startup three-way merges so merged-in local additions actually reach the cloud instead of living only on the device that ran the merge until the next edit. - Upgrade sync signatures from a 64-char ciphertext prefix to full SHA-256 (v3), closing the tail-mutation replay weakness. - Harden the vault-backup IPC: payload size cap, enum-validated reason, sanitized version strings, strict maxCount, concurrent-call mutex, monotonic createdAt to avoid same-ms ordering ties. - Extract the anchor-change decision into a pure module with unit tests covering no-anchor, resource-id drift, and signature mismatch paths. - Capture the protective backup from the pre-apply closure snapshot so it reflects what's being replaced rather than what was imported. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address PR #720 follow-up review findings Make protective backup abort-on-failure (was best-effort console.error), preserve nested syncedAt in fingerprint, use UTF-8 byte length for size guard, throw on conflict-inspect failure so stale uploads can't leak through, treat unreadable remote as changed, canonical-JSON signature meta, and hold the version stamp on transient backup failures so the retry path still fires. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address second-pass review findings on PR #720 - Hold version-change stamp when payload is non-meaningful (covers the startup vault-rehydrate race where a transient empty snapshot would permanently skip the upgrade backup). - readBackupRecord stat-checks before readFile so an oversized file in the backup dir cannot OOM the renderer on enumeration. - Reject maxBackups input outside 1..100 instead of silently clamping (matches the i18n error copy and the main-process sanitizer bound). - Wrap USE_LOCAL conflict-resolution push in withRestoreBarrier so a concurrent auto-sync in another window cannot interleave. - sha256Hex throws SyncSignatureUnavailableError on missing WebCrypto subtle; createSyncedFileSignature returns null, forcing the unreadable-remote → three-way-merge path instead of a weak length-only pseudo-signature. - Document that array order in normalizePayloadForHash is an invariant enforced by producers, not the hash function. - Drop three-way-merge completion logs from console.log to console.info. - Comment the implicit restore → store-listener refresh chain so future refactors don't silently break the UI reload path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address third-pass review findings on PR #720 Resolves I-3 through I-8 and related cleanup items identified in the deep review. Highlights: - replace setTimeout(0) post-merge round-trip with a direct syncAllProviders call using the already-computed merged payload, removing the React-commit race - resolve the empty-vault confirmation promise on unmount so a mid-dialog window teardown doesn't leak the resolver - retry the version-change backup as hosts/keys hydrate, instead of latching on the first (possibly empty) snapshot - heartbeat-refresh the cross-window restore barrier so long applies cannot expose a post-60s window to concurrent auto-sync - add a diagnostic warning when connected providers hold divergent bases (multi-account configurations) - surface a user-visible "Sync paused" toast when startup inspect fails, replacing the previous silent gate-open - tie-break backup list sort by id when createdAt collides - extract applyProtectedSyncPayload so the main and settings windows cannot drift on restore-barrier / protective-backup handling Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address deep-review findings on PR #720 Deep re-review surfaced six Important issues that survived the prior four review rounds. All are hardened here: - I1: fsync the protective backup file AND its directory before the rename completes, so a system crash between backup creation and the restore it guards cannot leave a torn/zero-length safety net. - I3: persist an apply-in-progress sentinel across the non-atomic localStorage writes in applySyncPayload. A crash mid-apply now surfaces on the next startup (toast + refuse auto-push) instead of silently pushing the half-applied state over an intact cloud copy. - I2: only open the auto-sync gate (remoteCheckDoneRef) when the startup inspect validated cleanly. Add a bounded exponential-backoff retry so a transient inspect failure self-heals instead of wedging auto-sync until restart. - I5: save the sync base BEFORE advancing the per-provider anchor inside uploadToProvider. A renderer crash between the two writes now degrades to "stale anchor forces re-inspect on next run," which re-merges against the fresh base — eliminating the silent base-drift window where a 3rd-device race could misclassify entries. - I6: main process broadcasts a vaultBackups:changed IPC event on every mutation; useLocalVaultBackups subscribes so protective backups created from the main window show up in the Settings backup list without manual refresh. - I4: update PR description + code comment to match the actual (safer) design: auto-sync gate opens on vault init, with hasMeaningfulSyncData + restore barrier preventing empty-push; the version-change backup is best-effort and retries as data hydrates. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: serialize startup checkRemoteVersion and stabilize its deps Re-review flagged that checkRemoteVersion's useCallback depended on `config` — a fresh object literal from App.tsx on every render — so the retry effect restarted with attempt=0 on every vault edit and could spawn overlapping in-flight inspect+apply runs. Two concurrent commitRemoteInspection + onApplyPayload calls could race on the apply-in-progress sentinel around interleaved writes. Route `buildPayload`, `config.onApplyPayload`, and `config.startupReady` through refs so checkRemoteVersion's identity no longer churns with unrelated App state. Add an in-flight guard that returns early when a previous invocation is still awaiting the network, closing the same-window re-entry gap that withRestoreBarrier intentionally doesn't cover. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: release in-flight lock on no-connected-provider early return Third-pass review caught that `checkRemoteInFlightRef` was acquired before the `!connectedProvider` check, so that early return leaked the lock and every subsequent retry-timer tick silently no-op'd. Move the acquisition past the early return so the only path that takes the lock reaches the finally-release. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
1ca2cd8ec2 |
feat: add "paste selection" terminal command with bindable shortcut
Adds a new terminal action that pastes the terminal's current selection at the cursor without going through the system clipboard — the equivalent of X11 PRIMARY-selection paste. Default shortcut: ⌘ + Shift + X / Ctrl + Shift + X. Also surfaces the action in the terminal right-click menu, disabled when there is no selection. Does not change middle-click paste behavior. Closes #637 |
||
|
|
717d8b718a |
Merge pull request #712 from tces1/dev
feat: scope AI draft and session resume state |
||
|
|
363f03a92d | fix ai draft scope state updates | ||
|
|
75dc3dd72b |
feat: scope AI draft and session resume state
- persist drafts, panel views, and active sessions per terminal/workspace scope - restore scoped AI session selection on reconnect and cold mount - prefer unsent drafts over implicit history fallback - avoid redundant active session map rewrites during scoped cleanup Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> |
||
|
|
ebcfe49ed6 |
fix: clear stale model cache when ACP probe returns empty
Address Codex review feedback on #708: the previous guard silently returned on an empty-but-ok probe response, which left any previously cached runtimeAgentModelPresets[currentAgentId] in place. That kept Claude/Copilot pickers showing stale model IDs (and skipped currentModelId reconciliation) instead of falling back to the hardcoded presets when the backend no longer advertised a catalog. Now we explicitly drop the cache entry so the agentModelPresets memo falls through to getAgentModelPresets(...) via the `?? ` branch. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
bc8ac08b9a |
feat: probe claude-agent-acp for available models instead of hardcoded presets
Claude agents now advertise their real model catalog via the ACP initSession response, just like Copilot already does. Confirmed locally that `claude-agent-acp` returns `models.availableModels` with full ids + names + descriptions (default / sonnet / haiku on subscription; and would return Bedrock/Vertex/custom-proxy ids when the user has configured those). This closes the gap where the Claude picker was stuck on three hardcoded entries from CLAUDE_MODEL_PRESETS regardless of what the underlying CLI actually supports. If the probe fails or returns an empty list, we keep the hardcoded presets as a fallback. Codex keeps its existing path via `aiCodexGetIntegration` (reads ~/.codex/config.toml) — we deliberately do not probe codex-acp, since probing would just return the stock OpenAI model list even when the user has a custom model_provider set. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
11f831d820 |
fix: decouple Claude agent auth from netcatty provider list
Apply the same fix as #706 to the Claude Code agent. The `claude` CLI has its own auth surface (`claude auth login/logout/status`) that manages subscription-based logins (Claude Max / Pro via claude.ai) alongside ANTHROPIC_API_KEY / settings-based configs. Silently forwarding a netcatty-configured provider's API key to claude-agent-acp overrides that login — the user's subscription gets bypassed and charges go to their API balance without their knowledge. Claude's settings card never surfaced the `claude auth status` so this regression was more hidden than the Codex one, but the underlying coupling is the same class of bug. Changes: - Stop forwarding any providerId for managed ACP agents from the renderer; claude-agent-acp now resolves auth purely from its own CLI config / login state / shell env. - Remove ANTHROPIC_API_KEY and ANTHROPIC_BASE_URL injection at all three codex-acp / claude-acp spawn sites in aiBridge. - Drop Claude from the authFingerprint computation (it no longer has any netcatty-side input to hash). - Delete the now-unused `findManagedAgentProvider` helper and its ProviderConfig import from managedAgents.ts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
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 |
||
|
|
59364e0c75 | fix: preserve user skill selections on refresh errors | ||
|
|
ac83c4c27d | fix: keep user skills state in sync | ||
|
|
1f3e531d7b | Fix AI skill selection handling | ||
|
|
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>
|
||
|
|
8f68e24057 |
fix: address review feedback on config.toml detection flow
Round of fixes driven by two parallel reviewers:
- i18n placeholder mismatch (P0). Locale strings used ${envKey} (literal
dollar-sign) but the replace call passed '{envKey}', so the warning
displayed a raw "${envKey}" instead of the real env var name. Align on
the codebase-standard {envKey} form.
- Fingerprint now folds the hash of the actual auth material (P1).
readCodexCustomProviderConfig computes a sha256 over the hardcoded
api_key or the resolved env_key value and returns authHash. The ACP
provider-reuse fingerprint includes it, so rotating the key in
~/.zshrc + restarting netcatty (which refreshes shellEnv) now
invalidates the cached provider instance instead of keeping the stale
key alive. Raw value never crosses the IPC boundary — we only send
the hex digest.
- Fail loud when config.toml's env_key isn't exported (P1). Previously
we'd sail into spawn and let codex-acp fail mid-request with a cryptic
"Missing environment variable". Now the stream handler rejects up
front with a targeted error naming the missing variable and pointing
at ~/.zshrc.
- TOML parser: basic-string escape tracking (P1). findUnquotedHash now
tracks an explicit `escaped` flag (and only honors escapes inside
double-quoted strings, since literal single-quoted strings don't), so
values like "C:\\path\\" close correctly instead of consuming the
trailing `#` as part of the string.
- TOML parser: strip UTF-8 BOM (P2). Windows editors frequently prepend
one and the first-key regex would silently fail to match, dropping
everything before the first section header.
- Picker correctness when config.toml lacks a `model` field (P1).
Instead of silently falling back to CODEX_MODEL_PRESETS (stock
OpenAI IDs the user's custom endpoint can't serve), show an empty
list so the picker disables. Track codexCustomConfigResolved so we
distinguish "still loading" from "not a custom-config session" and
only clear the preset list once the integration probe confirmed
connected_custom_config.
- Logout handler isConnected also considers connected_custom_config
(P2 consistency), matching get-integration.
- Model picker popover clamps its left position so max-w-[360px] can't
push it past the right edge of a narrow AI side panel (P2).
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> |
||
|
|
79a7e460be |
fix: parse model ids that contain '/' correctly in ChatInput
The picker label was being derived by splitting selectedModelId on the
first '/'. That works for Codex's ChatGPT-preset format
("gpt-5.4/high" → model "gpt-5.4" + thinking level "high"), but breaks
for OpenRouter-style ids from config.toml ("qwen/qwen3.6-plus"):
selectedBaseModelId became "qwen", which doesn't match any preset, so
selectedPreset fell back to undefined and the chip displayed the
unrelated app-level modelName (e.g. "gemini-3-flash-preview") instead
of the actually selected Codex model.
Replace the naive split with a two-step lookup: first try a direct id
match; only if that fails, look for a preset whose declared
thinkingLevels make "${preset.id}/${level}" equal to selectedModelId,
and derive the thinking segment from that. Model ids that happen to
contain '/' now round-trip correctly through the picker.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
||
|
|
f48db8ee4e |
fix: drop description from model picker to keep it compact
codex-acp's provider descriptions can be paragraphs ("Latest frontier
model with improvements across a wide range of capabilities..."), which
made each row of the picker feel bloated. The model id and (thinking
sub-menu's) thinking level already convey the relevant distinction —
drop the description render entirely. Keeps the dropdown tight regardless
of how verbose the upstream model catalog is.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
||
|
|
ba2a0389fa |
fix: stack model picker description below name (vertical layout)
Horizontal layout + truncate clipped too much of codex-acp's longer
descriptions ("Latest frontier model with improvements across a..." →
"Latest frontier model w..."). Reorganize each option as
checkmark | name-on-top, wrapped description below | chevron, so the
full description is readable across two lines without pushing the
popover width out. Fix popover to w-[300px] for a consistent column
width. Checkmark and chevron anchor to the first text line (self-start
with small top offset) so they stay visually aligned with the name
when the description wraps.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
||
|
|
6309a49c37 |
fix: cap model picker width and truncate long descriptions
With dynamic models now pulled from codex-acp, preset descriptions can be
arbitrarily long ("Latest frontier model with improvements across a..."
from OpenAI's public model list). The popover had whitespace-nowrap on
each option and no max-w on the container, so long descriptions pushed
the dropdown off-screen.
Cap the popover at max-w-[360px], add min-w-0 + truncate to the name
span so flex children can actually shrink, and cap the description span
at max-w-[160px] with truncate so it ellipses rather than expanding the
row. ChevronRight gets shrink-0 so it can't be pushed out of view.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
||
|
|
b1291d3ee2 |
fix: probe codex-acp for available models instead of using hardcoded preset
AIChatSidePanel gates dynamic model probing behind isCopilotExternalAgent, so Codex always fell back to CODEX_MODEL_PRESETS — a hardcoded list of OpenAI-specific IDs (GPT 5.4, Codex 5.x, o3, o4-mini). That's only correct for the stock ChatGPT/OpenAI path. When the user has a custom model_provider in ~/.codex/config.toml (OpenRouter, local inference, etc.), none of those IDs exist on their endpoint and the model picker is useless. Extend the condition to also trigger the aiAcpListModels probe for the Codex managed agent (detected via matchesManagedAgentConfig). The probe launches codex-acp the same way a real session does, so it now also goes through getCodexAuthOverride and respects the user's config.toml — and whatever availableModels codex-acp returns (typically at least the `model` field from config.toml) shows up in the picker. Claude keeps its curated presets to avoid regressing that path. 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> |