* fix(sftp): use remote cp for fresh same-host copies (Fixes#4207)
Ordinary SFTP tasks were marked resumable, which skipped the existing file and directory cp optimizations. Select the non-resumable route only when creating fresh matching-host copies with eligible encodings, keeping transfer-center rows and recursive children consistent. Existing checkpointed transfers retain their saved resumable path; failed cp attempts retain the download/upload fallback.
* fix(sftp): skip same-host directory cp when auto encoding resolves to non-UTF-8
* fix(sftp): preserve dest mode when same-host cp replaces a file
* fix(sftp): skip same-host cp for symlinks and directory merges
* test(sftp): mock missing dest in same-host cp cache fixture
* fix(sftp): expose lstat on session-backed copy clients
* feat(autocomplete): add zh-CN descriptions for zip, unzip, make, nano
Cover 32 missing Fig descriptions, generate zh-TW, add batch coverage tests, and record source and semantic checks.
* fix(autocomplete): correct zip, unzip, and make semantics
Limit zip -9 to the compression level, warn that unzip -0 is a suspect upstream option, and describe make -N as the Apple/NeXT compatibility extension.
* fix(autocomplete): simplify unzip -0 warning and correct NeXT note
Keep the -O gbk version caveat in the research record and describe Next/NeXT as a capitalization difference.
* feat(autocomplete): complete remaining common command descriptions
Add 177 zh-CN descriptions for python, python3, node, vim, sort, awk, and sed; generate zh-TW, cover the batch with real Fig specs, and record one deferred shared node key.
* fix(autocomplete): correct sed n and sort parallel semantics
Add the automatic-print condition to sed n, remove the universal CPU default from sort --parallel, and remove duplicated adopted-entry sections from the source record.
* fix: repair macOS terminal setup and align autocomplete details
- Read OSC 7 setup payloads through base64 stdin so BSD/macOS works
- Keep the FIDO askpass socket path within the Unix sun_path limit
- Align autocomplete descriptions in a shared fixed column
- Fix an invalid optional-parameter declaration and lint warnings
- Harden macOS-sensitive OSC 7, SFTP, temp-dir and privacy tests
* feat(autocomplete): add zh-CN descriptions for file and text utilities
Cover ln, stat, wc, cut, uniq, tee and xargs with 70 localized
descriptions. Add coverage and localization tests, preload the new common
specs, and record the upstream wc/xargs wording corrections.
* fix(autocomplete): keep popup scrollbars draggable
Panel mousedown handlers no longer preventDefault across the whole box, so the right-side detail scrollbar and the suggestion list scrollbar can be dragged while padding clicks still preserve terminal focus.
* fix(autocomplete): keep detail panel open while selecting text
Delay row hover clearing so the pointer can move into the right-side detail panel, and allow native text selection there without stealing terminal focus on ordinary padding clicks.
* feat(sftp): add a one-click Duplicate action for files and folders
Duplicate copies the selected entries next to their originals in the same
folder, covering files, folders, and multi-selection. It reuses the existing
transfer queue and the transfer pipeline's "(copy)" naming helper, so progress,
cancel, and error reporting behave like Copy to other pane.
The target name is resolved before the transfer starts. Resolving through the
batch conflict defaults instead would re-enter processTransfer for a task that
is still marked in flight and stall the copy.
Adds the action to both the list and tree context menus, plus translations for
en, es, ru, zh-CN, and zh-TW.
Closes#4132
* fix(sftp): keep Duplicate safe around navigation rows and reserved names
Hide and ignore the tree's synthetic ".." row: duplicating it resolved the
source to an ancestor directory and could walk the copy into its own output.
The transfer hook also drops "." / ".." inputs for duplicate batches, and the
same-pane handler filters them defensively.
Pick duplicate names around destinations already reserved by a queued or paused
transfer. Those rows have no file on disk yet, so stat-only naming returned the
same "(copy)" path and the follow-up active-path check turned the second
one-click duplicate into a conflict dialog. The naming helper now accepts an
occupied-path predicate fed from the active transfer set.
* fix(sftp): block stale entry menus on parent navigation
---------
Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com>
Issue #4037 (phase 3 of #4098). An existing member pane can now be
dragged back onto its own workspace to rearrange it, landing with the
same snap-in split semantics an orphan drop gets.
- domain: add pure movePaneInWorkspace(root, sessionId, hint) composing
the existing prune + insert conventions (no-op for unknown/single-pane
self-drops; prune-first keeps target-inside-subtree drops correct).
- state: moveWorkspacePane / moveWorkspacePaneInWorkspaces touch only
workspaces[].root — session ids, tab order, focus fields and every AI
binding (anchorChatId etc.) are untouched by construction.
- drop flow: handleWorkspaceDrop routes same-workspace member drops to
the move op; cross-workspace drops stay rejected (#4098 policy) and
orphan drops are unchanged.
- preview: member panes drag via pointer events, so the split-hint
preview and drop are mirrored on the pointer stream while a member of
the active workspace is dragged; dropping a pane onto itself previews
and drops as a no-op.
Identity guarantee: a move never changes session ids, workspace id,
anchorChatId, focusedSessionId (focus is keyed by session id, so it
visually follows the moved pane), focusSessionOrder or tab order; the
moved tree roundtrips through netcatty_session_restore_v1 unchanged.
Phase 2 of #4098: every remaining positional fallback in the workspace
AI scope is replaced with id-based resolution.
- Workspace gains anchorChatId: pinned by the AI side panel whenever a
chat becomes active in the workspace scope, persisted through the
session restore snapshot, and validated lazily by consumers.
- resolveDisplayedPanelView: the auto-resume fallback now resolves the
anchored chat first, then the most recently updated chat (updatedAt),
else draft; sessions[0] is gone.
- retargetWorkspaceActiveChatAfterMemberLoss: when the focused member
did not survive, the retarget lands on the most-recently-active
survivor by chat recency, not the first positional member.
- plugin keybinding context: focused member, then the terminal member
owning the anchored chat, then the most-recently-active member; a
single-member workspace uses its only member.
- New domain/aiSessionRecency helper shared by all survivor rankings.
- /rebind and session_recover semantics (#4019) are unchanged.
Phase 2 of #4098: the workspace becomes a first-class object that
survives membership changes.
- Close/detach no longer dissolves a workspace at <=1 member. The
workspace entity (and its id) survives with its remaining members,
even at zero, where it keeps an empty split root placeholder that
renders as an empty workspace tab.
- Focus handoff after member loss resolves to the most-recently-active
surviving member (AI chat updatedAt via the AI session store), never
positionally to remainingSessionIds[0]; with no recency signal focus
is cleared and the pane renderer uses its display default.
- session restore: drop the empty-workspace skip. Workspaces closed to
zero members persist an empty root and come back after restart with
the same id, so their AI chats re-link. Roots that prune to null
because their member sessions cannot be restored are still dropped.
- applyCloseSessionToSessions no longer orphans the survivor; the
dissolved-workspace tab-order replacement machinery is removed.
* feat(ai): support xhigh and max reasoning effort levels
The provider-level reasoning default only offered low/medium/high, so models
that document the full graded ladder could not be configured to their top
tiers. DeepSeek V4/V4.1 grade `reasoning_effort` continuously up to `max`, and
Anthropic exposes `max` on 4.6+ plus `xhigh` from 4.7 onward.
Beyond the missing select options, three separate layers silently discarded
the higher values:
- REASONING_RANK stopped at `high`, so the visibility resolver treated
`xhigh`/`max` as stale and fell back to `low`.
- The OpenAI capability check only matched `deepseek-r1`, which left the
DeepSeek V4 family unrecognised and hid the thinking chip entirely.
- The pinned `@ai-sdk/openai@4.0.8` validates provider options against a zod
enum capped at `xhigh`, so `max` on Chat Completions threw
"invalid openai provider options" before any request was made.
Add a shared PROVIDER_REASONING_EFFORT_OPTIONS list used by both the settings
select and its save guard, extend the rank ladder, and teach the per-model
derivation about DeepSeek V4 grading plus the Anthropic effort generations.
Bump `@ai-sdk/openai` to 4.0.11, the first release whose enum accepts `max`;
it keeps 4.0.8's data-URL image fix.
Models whose vocabulary stops at `high` now clamp these levels onto their own
ceiling instead of dropping the setting, so an explicit user choice is never
silently ignored and no unsupported value reaches a provider.
* fix(ai): keep extended effort for explicit custom relay aliases
A custom OpenAI-compatible provider with an explicit reasoning default is the
escape hatch for relay model IDs that match no capability pattern. That branch
still advertised only low/medium/high, so resolveVisibleCattyThinkingLevel
treated a configured `xhigh` or `max` as stale and downgraded it to `high`
before the request was built.
Advertise the full ladder there: the explicit provider default is already the
user's assertion that the alias accepts reasoning_effort, so it should also
carry the ceiling they picked. Unrecognized aliases without a default keep
advertising nothing.
* test(ai): verify max effort with the pinned OpenAI SDK
---------
Co-authored-by: Arcadia <57169358+RayYiHang@users.noreply.github.com>
* fix(theme): broadcast native system theme updates to renderers
nativeTheme.updated only fires for listeners in the main process, so a renderer sitting in system mode never learned that Windows changed the application theme. Forward the resolved preference to every window and let the settings hook re-apply it.
* fix(theme): keep terminal chrome separate from native system policy
refreshActiveChromeThemeSurfaces called setTheme(light|dark), which the main process writes into nativeTheme.themeSource. The stored preference stayed 'system' while Electron was pinned to a fixed color, so Windows application theme changes were ignored.
Only paint the surfaces here. Also re-assert a fixed independent terminal theme when the OS preference changes: the fingerprint short-circuit skipped the refresh, and the hook effect never re-ran while the terminal props stayed stable.
* test(theme): bound the new jsdom chrome tests
A hanging jsdom/React render should fail the test with its name instead of consuming the CI job budget.
* test(theme): provide native theme in bridge registrar fixtures
* test(theme): provide nativeTheme in child-process registrar fixture
The worker tests introduced in #4127 omitted nativeTheme after the system-theme listener registration became part of the production registrar. Provide a real EventEmitter, matching the transfer-limit fixture, so registrar setup succeeds without weakening production behavior.
* ci: retrigger lint-and-test after runner shutdown
The previous ubuntu-latest lint-and-test run was canceled during plugin
contract verification (annotation: "The operation was canceled."). Lint
had already passed; tests never started. Tree is unchanged.
---------
Co-authored-by: HHXXYY123 <117068187+HHXXYY123@users.noreply.github.com>
* fix(ai): persist AI sessions per record in IndexedDB instead of a 2MB localStorage blob
Closes#4123.
The legacy store serialized every session into one localStorage JSON key
under a 2MB byte budget. Each write re-serialized the whole store, and the
degradation ladder dropped whole oldest sessions when the budget was
exceeded — silently destroying capped chats (~1MB each) on every write.
- add aiSessionIdbStorage: db netcatty_ai_sessions, one record per session
(keyPath id) plus a meta store (schemaVersion, lastWriteAt, mirrored
active-session map); BroadcastChannel replaces the localStorage storage
event for cross-window sync
- one-time boot migration from netcatty_ai_sessions_v1; the legacy key
stays untouched for one release as a read-only fallback
- writeSessionsForStorage now diffs against the last persisted set and
writes only changed records through a serialized queue; the 2MB budget
and its degradation ladder are removed (the global re-serialization cost
they defended no longer exists)
- retention becomes a pure session-count cap (raised 50 -> 1000); the
per-session 200-message cap is unchanged
- when the cap evicts sessions, a pre-eviction backup generation is
written before the records are dropped, closing the #4018 mirror blind
spot; explicit deletions and cloud-authoritative removals do not
trigger it
- boot restore chain: IndexedDB -> legacy localStorage (migration) ->
#4018 disk backup generations; a corrupt/unavailable IndexedDB falls
back to legacy localStorage writes
- tests: IDB roundtrip/migration/active-map mirror via a minimal fake
indexedDB, per-record put/delete diffing, count-cap eviction with
pre-eviction generation, explicit-delete suppression, synced-history
no-prune, corrupt-IDB fallback; byte-ladder tests removed with the
ladder
* test(ai): update fork/undo reload tests to the IndexedDB persistence contract
Issue #4123: session persistence moved to IndexedDB per-record writes; the
persisted set no longer lands in the legacy localStorage key (read-only
fallback for one release) and the retention cap is a session count of 1000
instead of 50.
- fork/undo reload tests read the persisted set via
getPersistedAiSessionsSnapshot() instead of parsing localStorage
- cap-boundary assertions (49/50 newer chats) become preservation
assertions (newerCount + 2 records survive; the 1000-cap boundary is
covered by aiStateSnapshots.test.ts)
- the reload step seeds the read-only legacy store with the persisted set,
the stand-in for what the migration persists on a profile without
IndexedDB
* feat(ai): make the per-session message cap user-configurable
* fix(ai): sequence session sync after boot hydration
Cloud-sync collection (collectAiSessionsForSync) could run before the
IndexedDB boot hydration settled and writeSessionsForStorage() the stale
legacy localStorage list over newer per-record IndexedDB data. The
collection now skips the sync round until the boot load settles; the next
auto-sync picks up the hydrated store.
The hydration signal lives in aiStateSnapshots (isAiSessionsHydrationComplete
/ markAiSessionsHydrationComplete) and is shared with useAIState's boot
effect and the cross-window refresh handler.
* fix(ai): make the legacy session migration one-shot via a persisted marker
The migration keyed on 'IndexedDB empty + legacy populated'. Because the
legacy key is intentionally kept for one release as a read-only fallback,
any boot whose store was empty re-ran the migration and resurrected chats
the user had deleted (P1②).
A migrationCompleted marker is now persisted in the meta store after the
migration data is durable. Once present, the legacy key is never consulted
again: an empty store is authoritative. The marker also records a store
that was already populated by a pre-marker build, and an uninitialized
empty store, so 'intentionally empty' is distinguishable from 'uninitialized'.
* fix(ai): harden boot persistence failure paths
Four review findings around the boot load's failure modes:
- P2①: when IndexedDB fails at boot and sessions come from the legacy
store, the diff baseline was seeded even though nothing was persisted,
so a later edit diff-wrote only the edited record and the rest were
lost after recovery. The legacy set is now persisted best-effort (one
re-open retry) before seeding; if that fails the baseline stays unset
so the next edit rewrites every record.
- P2②: the active-pointer validation effect ran against the
initially-empty in-memory session array and nulled every pointer
before the async load finished. It now waits for the hydration signal.
- P2③: when IndexedDB stayed unopenable and the legacy store was
missing/corrupt, the unconditional recheck threw into the swallowing
outer catch and the #4018 disk backup was never applied. The recheck
failure is now contained (one retry already happens inside open()),
the newest backup generation is applied as the recovery source, and
the error is surfaced via console.warn.
- P2④: a cross-window empty getAll (another window deleted the last
chat) hit an early return, kept the deleted session alive locally and
resurrected it on the next edit. After hydration an empty store is
adopted; the early-return only covers the pre-hydration window.
Scenario regression tests live in useAIState.bootHydration.test.ts;
fakeIndexedDb gains failOpenTimes for counted open failures.
* fix(ai): gate session maintenance and migrate legacy overflow history
* fix(ai): skip backup restore of empty IDB and resume failed overflow migration
* ci: retrigger lint-and-test after runner shutdown
The previous Actions runner received a shutdown signal during plugin-contract
verification; lint had already passed and unit tests never started.
---------
Co-authored-by: GOUKI9999 <GOUKI9999@users.noreply.github.com>
Co-authored-by: 陈大猫 <16399091+binaricat@users.noreply.github.com>
When Interface Theme is Follow System, chrome refresh called setTheme(light|dark) and locked nativeTheme.themeSource, so OS appearance flips no longer updated the UI. Keep setTheme('system') on system chrome preference.
Fixes#4130
Gate: GH Codex CLEAN on 2c0c1c77fd (6635017901); CI 41860537287 success; Electron smoke PASS NC_OUT=/workspace/netcatty-smoke-shots/pr-4131-37c0f491a (same tree as prior tip).
* perf(renderer): cut the startup bundle by a third
Every window parsed ~6.1 MB of JavaScript before the first render. The entry
chunk carried all five UI locales, and the whole AI SDK chunk was preloaded
even though the AI panel is lazy.
- i18n: only English stays in the entry; other dictionaries load on demand
(plus their same-base fallback, e.g. zh-TW -> zh-CN). index.tsx awaits the
saved language before the first render, and I18nProvider re-renders when a
runtime switch finishes loading.
- AI runtime: aiStateSnapshots cleaned up chats through getAgentRuntime(),
and the plugin AI/agent hosts created their runtimes on mount, which pulled
the Catty harness and @ai-sdk providers into startup. Cleanup now goes
through a light handle that the runtime registers (the reversible privacy
flag and main-process privacy mapping are still cleared without a runtime),
and both plugin hosts create their runtime on the first request, re-checking
liveness after the async load.
- Chunking: manualChunks' object form also moved Vite's dynamic-import
preload helper into vendor-ai (the AI SDK itself uses import()), so the
entry imported it from there and vendor-ai (649 KB) was preloaded on every
launch. Vendor chunks now use the function form and the helper gets its own
1 KB chunk.
- jsqr is loaded when a QR image is imported instead of with the host editor.
- startupBundle.architecture.test.ts guards these invariants.
Startup JS (index.html): 5.29 MB entry + 649 KB vendor-ai + 138 KB radix ->
3.80 MB entry + 1 KB helper + 174 KB radix (-35%). Startup harness, 2000 hosts,
10 runs, warm p50: loadURL -> renderer entry evaluated 321 -> 207 ms,
loadURL -> renderer ready 481 -> 323 ms.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(i18n): preload locale messages before static rendering
* test(i18n): preload locales in remaining zh-CN UI tests
Non-English dictionaries now load lazily, so I18nProvider can initially render English before its effect finishes loading zh-CN. Explicitly await loadLocaleMessages before rendering these localized UI tests to fix the remaining CI failures without timing-based waits or production changes.
* chore: retrigger CI after locale preload fix
Previous tip 38108ce66 was on the branch but the PR head stayed
stuck on d49ad024e after a GitHub 500 during push. Empty commit
to refresh the PR head and re-queue checks.
* chore: retrigger CI after plugin-contract runner cancel
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Urgent fix for #4123: retain AI chat history past the 2MiB primary localStorage budget via overflow chunks + pre-split disk backup, with disk-only recovery markers, aggregate-quota degradation, import live-state retention, and count-cap marker resolution.
Gate: local Codex CLEAN (no P1) on 084ed813; CI green on acabe0bbc; Electron smoke PASS (pr-4124-acabe0bbc). Residual P2s noted (cross-window reconcile; vault-restore marker clear; retention-cap during pending recovery).
No release.
* perf: add opt-in startup timeline and real-app startup harness
- electron/perfTrace.cjs records first-occurrence startup marks in the main
process when NETCATTY_PERF_TRACE=1 (a no-op otherwise), then writes the
main-window renderer timeline (navigation, paint, netcatty:* marks, JS heap)
and app.getAppMetrics() to JSON after the first renderer-ready signal.
- Marks: main.cjs entry / modules loaded / whenReady, main window creation,
registerBridges and plugin-host start/end, loadURL, did-finish-load,
renderer ready, window shown. The renderer adds three performance.mark()
calls (entry evaluated, App mounted, renderer ready), also visible in
DevTools.
- scripts/perf-startup.live.cjs (npm run perf:startup) launches the built app
N times against a throwaway --user-data-dir profile with ssh:// deep-link
registration disabled, optionally seeds synthetic hosts over CDP, and
reports cold plus warm p50/p90.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* perf(harness): add --profile option to reuse a startup profile
Lets the harness keep one profile across invocations, e.g. to compare warm
V8 code caches across builds.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore: retrigger CI after flaky monitorRuntimeIsolation failure
Previous lint-and-test failed on known-preexisting
`useEffect is not defined` in monitorRuntimeIsolation.test.ts.
* chore: retrigger CI after monitorRuntimeIsolation useEffect flake
Known pre-existing flake: monitor controls test fails with
`useEffect is not defined`. Empty commit to re-run once.
* test(app): bind React hooks in monitorRuntimeIsolation VM sandbox
Extracting component declarations drops their React imports, leaving bare hooks such as useEffect undefined in the VM. Inject common React hooks and APIs while preserving explicit binding overrides to prevent intermittent monitor isolation failures in CI.
Stub the startup performance mark through App test bindings so the mount effect can execute without browser globals. Production components remain unchanged.
Validation: monitorRuntimeIsolation passed five consecutive runs. Plain npm run lint found 17 existing errors in git-ignored scratch files; excluding only _t.mjs and sim-4107.mjs passed with zero errors and eight existing warnings.
* chore: retrigger CI after plugin-contract runner cancel
Lint/schema passed; plugin-contract step cancelled by the runner
(not a test failure). Empty commit to re-queue.
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: binaricat <binaricat@users.noreply.github.com>
* chore: fix outstanding ESLint warnings
- useSftpFollowTerminalCwd: drop activeSessionId/focusedSessionId from the
syncFollowToTerminalCwd deps; the callback reads them through refs and the
only consumer effect already re-runs on those ids.
- useSftpPaneDialogs: list the stable setShowDeleteConfirm callback in the
handleDelete/openDeleteConfirm deps.
- csvProxy: remove the unnecessary `\[` escapes inside character classes
(same matches under the `u` flag).
- Remove unused test imports/variables.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore: retrigger CI after runner SIGTERM cancel
Previous lint-and-test was cancelled by runner shutdown, not a real failure.
* chore: retrigger CI after second runner cancel
Lint had already passed; plugin-contract step was cancelled by the runner.
* chore: retrigger CI after third runner cancel
Lint and schema steps passed; plugin-contract step was cancelled by
the runner again. Empty commit to re-queue lint-and-test.
* chore: retrigger CI after repeated runner cancel
plugin-contract step keeps being cancelled by the Actions runner
(not a test failure). Empty commit to re-queue; Actions rerun API
denied for this PAT.
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: binaricat <binaricat@users.noreply.github.com>
* perf(state): stop handler churn on session updates and repeated JSON work
- Shell handlers: AppSideEffects registers ~58 glue callbacks for the Host
islands. Several close over sessions/workspaces/hosts (split/copy/duplicate,
close tabs, delete host, keyboard-interactive, connect...), so every session
status change and host update (connect bursts, last-connected times)
re-notified the bridge and rebuilt all four shell bags, re-rendering AppView
and TopTabs. They are now registered behind per-key stable wrappers that
call the latest implementation (stabilizeAppHandlers); local callbacks and
their effects are unchanged. All registered entries are actions, setters or
refs, never read during render.
- Session actions: moveFocusInWorkspace, copySession and copyWorkspace read
workspaces / orphan sessions / log views through refs at call time (the same
snapshot the closure captured), so they keep a stable identity. Getters read
during render (isBroadcastEnabled, getOrderedWorkTabs, ...) are untouched.
- AI history: the live store was parsed five times when the AI state root
mounted; parseSessionsStore parses once per call (two parses total).
- AI history writes: the synced branch serializes once and reuses the string
for the disk mirror, and rewriting the same immutable sessions array (save
path, then cloud-sync collection) is skipped while storage still holds that
exact write in the same mode.
- Command history: saving after each Enter parsed the whole store (up to 10k
entries) only to read its clear generation, and every other window parsed it
again on the storage event. The generation is now serialized first and read
from the raw string (full parse only to adopt a peer clear), and the
debounced write runs when the renderer is idle.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore: retrigger CI after cancelled lint-and-test run
Previous lint-and-test was cancelled mid-run.
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: binaricat <binaricat@users.noreply.github.com>
* perf(terminal): stop per-second churn while connecting and while idle
- Connecting sessions: the 200 ms progress animation and 1 s countdown were
Terminal state threaded into the TerminalView ctx, so every connecting
session (hidden tabs and startup restores included) re-rendered Terminal +
TerminalView up to six times a second. Terminal now only publishes the
timeout deadline and real progress events; the connection dialog animates
and counts down locally (connectionTicker.ts). HostConnectionTestDialog
keeps passing progress/timeLeft as before.
- Monitor runtime: polled every second unconditionally and woke every
subscriber each time because takenAt always changes. It now polls at 1 s
only while something is monitored (here or in another window), 10 s
otherwise, and skips notifying for unchanged idle replies.
- Auto-reconnect progress log: capped at the newest 300 lines (it grew by a
few lines every 5 s retry for as long as an outage lasted).
- App Lock: report activity at most once a second instead of an IPC per
keystroke / wheel tick / pointer event.
- Tray/Dock: the renderer resends hosts only when the host list changed, and
the main process rebuilds the macOS Dock menu (sort + one native item per
host) only then, not on every session status change.
Real app, profiling build, main -> this change:
3 SSH sessions connecting (3 s) 14 commits / 35.3 ms -> 8 / 1.7 ms
idle (10 s) 13 commits / 3.1 ms -> 2 / 0.1 ms
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(terminal): update observe-popup reconnect deps assertion for capped progress logs
CI failed because #4118 wrapped setProgressLogs in useCallback to apply
capConnectionProgressLogs and added it to scheduleAutoReconnect deps.
The observe-popup source assertion still expected the old deps list.
The attachExistingSession early-return behavior is unchanged; only the
stale dependency regex needed updating.
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Several everyday interactions re-rendered the entire shell (AppView, TopTabs,
TerminalLayer and every pane) even though nothing they show had changed:
- Clicking or focusing a split pane always replaced the workspaces array
(twice per click: onClick + onFocusCapture), cascading through the whole
app and re-saving the session restore snapshot. setWorkspaceFocusedSession
and moveFocusInWorkspace now keep the same array when focus is unchanged
(domain/workspace.ts setWorkspaceFocusedSessionId).
- Every window focus/visibility change resynced app lock and produced a new
runtime state object even when nothing changed, re-rendering the provider
tree. Equal states keep the current object and useAppLockState's result is
memoized.
- Quick switcher keystrokes went through AppSideEffects state and the
app-local UI store, re-rendering AppSideEffects, every host island, AppShell,
AppView and TopTabs per character. QuickSwitcherOverlay now owns the query
and host results; the overlay unmounts on close, which resets the query
exactly where setQuickSearch('') used to.
- Pressing/releasing Ctrl/Cmd (every ⌘C/⌘V/Ctrl+C) re-rendered the whole tab
bar to toggle shortcut number badges. The held flag now lives in a small
store read only by each tab's TabIconSlot.
- AppView passed fresh inline callbacks that defeated TopTabs' memo comparator
and every open editor tab; TextEditorTabView is now memoized. TopTabs
memoizes per-workspace session lists and hoists the root tab icons.
- Workspace drag previews only update state when the drop hint actually moves.
React commits / render time for 10 repetitions in the real app (profiling
build, 2 split panes, 300 hosts), main -> this change:
window focus 42 / 17.1 ms -> 2 / 0.4 ms
press/release Cmd 50 / 41.9 ms -> 22 / 6.6 ms
click focused pane 42 / 69.6 ms -> 3 / 0.4 ms
quick switcher typing 41 / 61.3 ms -> 16 / 34.8 ms
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(terminal): honor Settings custom shell when Terminal button clicked (#4085)
Vault/host-tree Terminal buttons wired onClick={handler}, so React passed the
MouseEvent as the shell arg and skipped resolveShellSetting(terminalSettings.localShell).
Only treat objects with a string command as explicit shells; wrap onClick sites.
* ci: retrigger after lint-and-test runner cancel (#4085)
* test(terminal): accept wrapped local-shell onClick in host-tree toolbar (#4085)
Codex GH review: source assertion still expected onClick={onCreateLocalTerminal}
after wrappers; update to () => onCreateLocalTerminal() so npm test passes.
Contributor GOUKI9999 session_reconnect/session_recover. Maintainer gate fix: do not report ready while still offline/connecting (pending instead); connected keeps advisory shellReady; regenerate capability tool specs. Unit tests 12/12. Electron smoke PASS (SSH shell path). Residual P2 hung-worker readiness left timeout-bounded. No release.
* fix(sync): keep full history when AI chat sync is enabled
Retain all messages when cloud AI-session sync is enabled; keep the 500-message limit for local-only chats. Cover both settings with a history-retention regression test.
Rebase onto origin/main and retain #4045 preserveActive behavior and its no-cancel regression coverage unchanged. Drop the duplicate wait-before-merge loop, Waiting-for-Agent UI and i18n, sync status and streaming wait helpers, hasActiveTurn, wait-only tests, and docs plan.
Validation: all 23 tests pass across useAIState.historyRetention.test.ts, syncPayload.aiSessions.test.ts, and agentStop.test.ts. Targeted ESLint and git diff --check pass.
* chore: retrigger CI after cancelled lint-and-test
Previous Actions run 40824800880 cancelled mid plugin-contract step; windows jobs were already green. No code change.
* chore: retrigger CI after cancelled lint-and-test (Codex local PASS)
---------
Co-authored-by: 陈大猫 <16399091+binaricat@users.noreply.github.com>
* feat(monitor): 优化磁盘IO展示与系统分区告警 [4030]
* fix(monitor): 修复磁盘监控评审问题 [4030]
* fix(monitor): align Partitions bars with Memory; hide bare / label
Label-above-bar for partition list; single-root `/` hides the label and
centers the bar like Memory/CPU (unchanged). Multi-disk keeps top align +
system alerts. Disk IO adds a spacer row to track usage labels.
Review crops under .github/review/ for PR discussion (drop before merge OK).
* fix(monitor): keep bare-/ align; multi-disk labels stay left
Address Chris density feedback: keep the single root label hidden and vertically centered with Memory, and restore side-by-side labels for multiple disks. Remove the Disk I/O spacer and update the review crops.
* chore(monitor): drop PR #4031 discussion review crops
---------
Co-authored-by: wendeng.dong <wendeng.dong@sailuntire.com>
Co-authored-by: 陈大猫 <16399091+binaricat@users.noreply.github.com>
Move infrequent Tool Access / MCP / privacy / HTTP setup into focused dialogs; keep status and clear actions on the main page. Rebased onto current main after locale/settings conflicts.
Codex CLEAN (gpt-6.1-terra). CI lint-and-test green. Focused privacy/MCP/guidance tests passed on rebase tip. No release.
* fix(ai): keep dropped AI chats recoverable with dangling marking and /rebind
Closing a member terminal or dissolving a workspace used to clear the
chat's active pointer, making it invisible (scope rank 0) and
unrecoverable from the UI even though the record survived in storage.
- orphan cleanup now marks dropped chats `scopeDangling: true` and keeps
record + active pointer intact; the flag clears when the target
returns or the chat is rebound
- `/chats` lists dangling chats with a numbered inline affordance and
hint line
- new `/rebind <n>` panel action rewrites `scope` to the panel's current
scope, clears the marker and restores the active pointer
- i18n keys added for en / zh-CN / zh-TW / es / ru
Stacked on #4018. Refs #4015 (R2).
* fix(workspace): reuse existing workspace id when merging tabs with a workspace
createWorkspaceFromSessions silently no-opped when either merged tab
already belonged to a workspace (e.g. dragging a workspace pane onto a
standalone terminal), and the older dissolve->recreate behavior
regenerated the id that workspace-scoped AI chats bind to.
When one of the merged tabs has a workspace, the orphan tab now joins
that existing workspace (pane inserted next to the anchor session, tab
slot collapsed), so workspace-scoped chat bindings survive. Merging two
standalone tabs still creates a fresh workspace.
Stacked on #4018. Refs #4015 (R3).
* fix(ai): persist cleaned active map on dangling chat rebind
rebindSessionScope was updating React state to drop stale old-scope
pointers, then rebuilding localStorage from the pre-rebind snapshot and
resurrecting them. Persist the same cleaned map via rebindActiveSessionMap.
* fix(ai): persist rebind map inside setState; wire backup actions on terminal panel
- Write cleaned active-session map from inside the rebind updater so a
deferred React setState cannot skip snapshot/localStorage persistence.
- Pass exportSessionsBackup/importSessionsBackup through TerminalLayerSupport
and include them in AI_CHAT_SIDE_PANEL_AI_STATE_KEYS so history-drawer
backup buttons work on the normal terminal path.
* fix(ai): guard backup restore races and use app-wide live targets for /chats
- Skip restore when in-memory sessions already exist; apply snapshot,
storage write, and AI state emit atomically inside the empty-state path
so peer useAIState instances see the restore.
- Thread validAIScopeTargetIds into AIChatSidePanel as liveScopeTargetIds
so /chats does not mark chats bound to other open terminals as dangling.
* fix(ai): open rebound chat in panel view and refresh /chats listing
- rebindSessionScope also sets the panel view to the rebound session so an
existing draft/other chat does not keep hiding the recovery.
- After /rebind, rewrite the stored listing instead of rebuilding from the
stale render so the chat is no longer offered as dangling.
* fix(workspace): invert join split when dragged pane owns workspace; refresh /chats titles
- When merging a workspace-owned dragged pane onto a standalone tab, the
orphan is inserted — invert the drop position so the previewed side matches.
- Compare workspaces in AIChatSidePanel memo so /chats picks up renames.
* fix(ai): validate live sessions array on boot; mark imported orphans dangling
- Reject parseable non-array store values (e.g. {}) via readLiveSessionsArray
so boot restore is not blocked by a corrupt-but-truthy value.
- After manual import, re-run orphan cleanup with the last known live target
set so chats bound to closed scopes become dangling and /rebind-able.
* fix(ai): merge imported sessions before orphan cleanup
Apply import merge to the snapshot/ref synchronously, then run dangling
marking, so a deferred setState cannot let cleanup rewrite over the import.
* fix(ai): mark restored/imported orphans dangling even with no live targets
Restore and import do not change live terminals/workspaces, so the orphan
cleanup effect will not re-run. Always call cleanup against the last known
live target set after those paths — an empty set is a valid observed state
(nothing mounted), not an unavailable snapshot — so chats bound to missing
scopes become dangling and /chats can offer /rebind.
* fix(ai): apply backup restore synchronously before dangling cleanup
Do not gate restore + orphan marking on a setState updater having run.
A deferred updater left didRestore false, skipped cleanup, and could leave
restored chats with missing scopes unmarked and unrebindable from /chats.
* fix(ai): complete /rebind from a partial slash picker selection
Selecting Rebind after typing `/re` left the composer unchanged, so a
following number became `/re 1` and could be sent to the agent. Replace the
slash query with `/rebind ` the same way Rename does.
* fix(ai): replace hostIds on rebind; skip non-array backup generations
- Rebind builds a fresh destination scope (including hostIds from the
panel) instead of spreading the old scope, so history matching follows
the new terminal/workspace host.
- readLatestGeneration treats valid JSON that is not a session array as
unusable and continues to older generations, matching corrupt skips.
* fix(ai): revalidate dangling chat before /rebind from stale /chats listing
Skip rebind when the cached entry is deleted or already bound to a live
scope; drop stale listing entries so a second panel cannot steal the chat.
* fix(ai): reject malformed /rebind numbers
Require the entire trimmed argument to be digits so /rebind 1foo and
/rebind 1.5 show usage instead of silently targeting index 1.
---------
Co-authored-by: binaricat <binaricat@users.noreply.github.com>
Co-authored-by: 陈大猫 <16399091+binaricat@users.noreply.github.com>
* feat(ai): add /rename and /chats slash commands plus a session durability layer
Panel slash commands (#4015 feedback):
- /rename <title> renames the current chat via updateSessionTitle; the
command is intercepted in ChatInput's system-command branch and never
reaches the agent. Empty title shows a usage hint. The history drawer
gains an inline rename affordance.
- /chats renders a dismissible system-style note listing the panel's
visible chats (title / agent backend / workspace-or-terminal scope with
a dangling marker / relative last-active time; current chat marked).
Deliberately not named /resume: session.resume already means
flow-recovery-after-cancel. Listing logic is pure (aiChatsListing.ts)
so a future rebind action can attach per-entry actions.
- i18n keys added for en/es/ru/zh-CN/zh-TW.
Durability layer (additive; cleanup/eviction semantics untouched):
- Every successful store write schedules a debounced (~2s) mirror of the
exact persisted JSON to {userData}/ai-sessions-backup/ through a new
aiSessionsBackupBridge: atomic temp+rename writes, 5 rolling
generations, timestamped names.
- On boot, a missing/empty live store is restored from the newest
parseable backup generation. The asymmetry is deliberate: empty ->
restore, non-empty -> leave alone, so restored data can never
resurrect explicitly deleted chats.
- Manual export/import in the history drawer via real file dialogs
(fixed-path fallback where dialogs are unavailable); import merges by
id with newer updatedAt winning.
Tests: bridge rotation/corruption/rejection, restore decisions, merge
semantics, debounce throttle, mirror-on-write, slash interception and
/chats listing seams. eslint clean; tsc unchanged vs baseline.
* fix(ai): repair sessions backup IPC and restore/import guards
- Forward write/export payloads through preload unchanged so the main
bridge receives a string json (was double-wrapped → invalid-json).
- Restore from disk only when the live store is missing or corrupt;
treat a valid [] as an intentional clear. Flush the debounced mirror
on beforeunload so deletions land before quit.
- Require id + messages[] + finite updatedAt when parsing backup/
import entries so malformed objects cannot reach pruneSessionsForStorage.
Co-authored-by: Netcatty Maintainer <binaricat@users.noreply.github.com>
* fix(ai): complete /rename from partial slash and harden import shape
- Selecting Rename from the slash picker replaces the active slash token
with `/rename ` so a following title is intercepted, not sent to the agent.
- parseBackupSessions also requires title, agentId, and a scope object with
a string type before accepting an imported/backup entry.
Co-authored-by: Netcatty Maintainer <binaricat@users.noreply.github.com>
* fix(ai): validate backup messages and skip prune on synced restore
- Drop backup/import sessions whose messages lack id/role/timestamp.
- When cloud AI-session sync is enabled, restore parsed sessions without
pruneSessionsForStorage so local retention cannot truncate synced history.
Co-authored-by: Netcatty Maintainer <binaricat@users.noreply.github.com>
* fix(ai): export prepareRestoredSessions helper
Missed in the previous commit; required by useAIState boot restore and tests.
Co-authored-by: Netcatty Maintainer <binaricat@users.noreply.github.com>
* fix(ai): require message content on backup import; raise disk cap to 64MB
* fix(ai): normalize corrupt sessions store to [] before boot restore
* fix(ai): skip non-array backup generations when reading latest
* fix(ai): emit sessions change on backup restore; skip unusable gens
* fix(ai): treat empty backup gen as wipe; align gen usability with parser
* fix(ai): seed backup on boot for live store; report durable import count
* fix(ai): emit sessions change after backup import
* docs(ai): clarify sessions backup recovers in-profile store only
---------
Co-authored-by: binaricat <binaricat@users.noreply.github.com>
Merge global Agent host runtime + sandbox Chat sample on top of #4011.
Electron plugin smoke PASS at fb691318c (S0–S4; S5 BLOCKED-FIXTURE). Codex CLEAN. No release.