- Updated the ElectronAPI to support uploading both files and directories, allowing users to specify the upload mode.
- Enhanced the remoteShell module to handle directory uploads recursively, including tracking uploaded files and skipped symlinks.
- Improved the RemoteFileBrowser component to provide user feedback during uploads and handle different upload modes.
- Added utility functions for building remote upload paths and managing upload statistics.
- Updated relevant tests to ensure new upload functionality is covered and behaves as expected.
- Updated the ElectronAPI to include additional properties in the RemoteShellDownloadResult for better handling of downloads, such as isDirectory, downloadedCount, and skippedSymlinks.
- Implemented directory download support in the remoteShell module, allowing users to download entire directories with progress tracking and symlink handling.
- Enhanced the RemoteFileBrowser component to manage download states and provide user feedback on download progress and results.
- Added utility functions for safe path handling during remote downloads to prevent directory traversal vulnerabilities.
- Updated relevant tests to ensure new functionality is covered and behaves as expected.
- Introduced functionality to use download mirrors for GitHub releases, improving update speed in restricted networks.
- Enhanced UpdateService to resolve download source based on locale and environment variables.
- Updated UpdateIndicator to display mirror usage status and provide relevant hints to users.
- Added utility functions for managing GitHub download mirrors and created unit tests to ensure reliability.
- Modified error messages for manual download and installation to provide clearer instructions.
- Updated the Editor and EditorTabs components to improve file path handling for diffs, including support for commit and stash references.
- Added new translations for Git-related messages in English and Chinese.
- Introduced methods in GitService to retrieve changed files for commits and stashes, enhancing the ability to display file changes.
- Implemented a utility to parse `git --name-status` output for structured file change representation.
- Added unit tests for the new parsing utility to ensure accuracy and reliability and fix#159.
and fix#158
- Added `requestExternalFileAccess` method to the Electron API for requesting access to files outside the workspace.
- Enhanced security handling in `secureFile.ts` to manage external file access requests with user confirmation.
- Updated `resolvePath` function in executors to support external file access under strict workspace mode.
- Modified user file access logic to include 'agent-read' as a valid grant source.
- Improved tests to cover new external file access functionality and ensure proper authorization handling.
- Introduced `previewProbe` and `previewOpenExternal` methods in ElectronAPI for local preview functionality.
- Created `PreviewWebviewElement` interface to define the webview element used in the preview panel.
- Implemented `LocalPreviewOrigin` parsing and normalization logic in `discovery.ts` to handle local URLs.
- Added `PreviewProbeResult` interface to standardize the results of probing local URLs.
- Developed tests for the new preview discovery service and session management to ensure functionality.
- Enhanced existing tests for the BM25 index and thread hydration logic to improve coverage and reliability.
- Introduced BufferedCommitQueue for efficient commit handling.
- Updated workspaceLoadService to hydrate thread messages and branches more effectively.
- Replaced adnifyDirService with workspaceFileRepository in workspaceStateRepository and workspaceStorageRuntime.
- Modified workspaceStateService to stage workspace state persistence.
- Enhanced shellRegistryService to integrate with persistenceCoordinator.
- Added new session persistence types and interfaces for better type safety.
- Implemented tests for agentSessionRepository and BufferedCommitQueue.
- Removed outdated sessionDataLossGuards and sessionFileStore tests.
- Added SQLite session store tests to ensure data integrity and migration handling.
- Updated Vite configuration to include sessionStorage.worker for better build management.
Reads above 5MB returned only the first 10000 bytes, and nothing reported
it. Downstream that was indistinguishable from a short file, so parsers saw
an almost-empty document and read-modify-write callers committed the stub
back over the original.
Measured: a 6.41MB session (3000 messages) loaded as 4 messages; an 8MB
source file opened in the editor and saved shrank to 10000 bytes, losing
99.88%. The 1000-message cap allows ~6.6MB threads, above the 5MB read
limit, so reaching the message cap guaranteed the bug rather than risking it.
Reads
- add readFileSized/full option; report truncation instead of hiding it
- include the truncation mode in the single-flight cache key, so preview and
full callers can no longer share each other's result
- .adnify state always reads in full
- opt every read-modify-write path into full reads (editor buffers, edit_file,
stale-check hashing, workspace restore, git hooks, .gitignore)
- size-check before reading, reviving the editor's >50MB and >5MB guards,
which compared a length the main process had already capped
Sessions
- a failed message read now throws instead of returning []
- refuse to write an empty message list while metadata reports a history,
which is what previously deleted the .jsonl
- quarantine damaged JSONL as .corrupt before anything can overwrite it
- failed hydration sets hydrationFailed and leaves messagesHydrated false,
so the un-hydrated write guard keeps protecting the payload
- unreadable thread metadata is no longer pruned from _meta.json
Performance
- drop the unthrottled per-delta updateMessage({reasoning}): it ran a full
messages.map() plus a threads clone per token, nothing renders the field,
and the settled value is still written on stream end
- replace the full-history stableStringify dirty hash with a tail signature
- stage checkpoint snapshots instead of forcing a full flush per edited file
Tests: 14 added, 540 pass. Verified the new tests fail against the original
truncation behaviour.
- Added support for retrieving multiple global skill directories via `skillsGetGlobalDirs` in Electron API.
- Implemented validation for global resource paths in secure file handling to allow cross-workspace access for skills and configurations.
- Improved error handling and logging in MCP client and registry services, including enhanced runtime argument extraction for various package types.
- Updated the rules and skills services to support additional configuration file formats and directories, ensuring better detection and management of skills.
- Introduced new environment variable handling and command normalization utilities for improved cross-platform compatibility.
- Enhanced the MCP server modal to handle required environment variables more effectively, providing better user feedback and configuration options.
- Add OSC 633 shell integration scripts for Bash, Zsh, Fish, and PowerShell
- Manage agent terminal lifecycle and prompt markers securely
- Update changelog and package version for the v1.7.57 release
- Parse HTTP(S) URLs and match API hosts/pathnames more safely
- Improve HTML/XML entity decoding and script/style stripping
- Constrain GitHub Actions workflow permissions and update dependency overrides
- Add Git ignore status handling with context menu state feedback
- Avoid loading session snapshots before the Adnify directory is initialized
- Introduced caching for commit reports in AiAttributionService to optimize read operations.
- Improved session file handling in SessionFileStore with concurrent read and write capabilities.
- Added utility functions for managing read concurrency and pending operations.
- Updated model routing to support multimodal configurations and fallback mechanisms.
- Enhanced image reading services with dedicated tests for visual analysis and routing.
- Implemented sanitization for tool outputs to ensure clean and safe content delivery.
- Added comprehensive tests for new features and existing functionalities across various services.
- Updated MessageConverter and ToolConverter to use AI SDK 7 standard types.
- Enhanced ProviderCompatibility to support new reasoning effort levels including 'max'.
- Modified various services (EmbeddingService, StreamingService, StructuredService, SyncService) to reflect changes in SDK and reasoning effort handling.
- Updated modelFactory to use the new Google SDK method.
- Adjusted reasoning effort options in ChatInput and ProviderSettings to include 'max' and 'xhigh' based on compatibility.
- Added tests for reasoning effort behavior across different protocols and providers.
Tool retry was structurally impossible. `ToolManager` computes
`envelope.retryable` per execution, but nothing consumed it: `executeSingle`
discarded both `envelope` and `outcome`, and all 39 tools declared
`retryPolicy: { maxAttempts: 1 }`, which makes `inferRetryable` return false
unconditionally. So a transient network failure reached the model as a hard tool
error and burned a turn on manual recovery.
`executeWithRetry` now honours the policy, deliberately narrowly:
- the tool must opt in with maxAttempts > 1 (only web_search and read_url do —
idempotent reads where a flaky network is the expected failure)
- the failure must be classified retryable by the manager (timeout / execution /
dependency — not validation or user rejection)
- the tool must be free of side effects, judged by category and resourceScope.
A failed write may have partially applied, so repeating it can double-apply.
Judging safety by category rather than the `parallel` flag matters: a test
written against the flag immediately caught that `web_search` is
`parallel: false` purely to discourage scattered searches, which would have
silently disabled the retry it was being granted. tests/agent/tools/
toolRetryPolicy.test.ts pins the invariant at config level so a future tool
cannot quietly opt a write into retrying.
Stored message history was unbounded. Only thread COUNT was capped (50 in
`createThread`), so a single long session grew its `<id>.jsonl` without limit —
and that file is rewritten in full on every dirty flush, so persistence cost
scaled with history length. Adds `maxStoredMessagesPerThread` (1000), applied
once per turn in `prepareExecution`. It is deliberately far above
`maxHistoryMessages` (60, the model payload cap) so scrollback stays useful;
trimming only discards messages the model can no longer see.
The cut point advances to the next `user` message rather than slicing blindly:
dropping a `tool` message while keeping the `assistant` message whose
`tool_calls` reference it produces an orphaned tool result that many providers
reject outright. If no later user message exists the tail is left intact.
- Implemented a new component `PlanWorkbenchProcessing` to show the current processing state of the plan, including activity icons and status messages based on the planning state.
- Enhanced `PlanWorkbenchRuntime` to display current model operations and task orchestration details.
- Updated `usePlanWorkbenchController` to include new functions for accepting validation, requesting validation changes, and revising plans.
- Introduced CSS styles for better readability in plan mode and added animations for processing indicators.
- Expanded tool configuration to include AI-authored content for each plan stage.
- Added tests for message compression truncation and plan stage content validation.
- Enhanced plan workflow guard to handle revision requests and prevent duplicate plan creation.
The bundled tokenizer is cl100k_base — OpenAI's — and a comment claimed it also
covered Claude. It does not. Every non-OpenAI provider tokenizes differently, so
the pre-send estimate was wrong by an unknown factor. Since compression escalates
on ratio thresholds (0.85 summary, 0.95 handoff), under-counting means the real
context window can overflow before compression ever escalates.
The obvious fix — a per-family multiplier table keyed on model name — is wrong
here: this app supports custom providers, custom base URLs, local Ollama models
and aggregator gateways that rewrite model names, so the list cannot be
enumerated and any table would be permanently out of date. It would also encode
guessed constants, which reads as precision without being it.
Instead the estimator calibrates itself. Providers already report real prompt
tokens after each response (loop.ts), so dividing that by what we estimated for
the same request yields the model's actual correction factor. It is cached per
model id, exponentially smoothed, and clamped to [0.5, 3] so one anomalous
report (e.g. a cached prefix) cannot distort later estimates. Unknown models
start at exactly 1.0 — the previous behaviour — and converge after one turn, with
no model names hardcoded anywhere.
`setActiveTokenModel` records the turn's model once in AgentExecutor.prepare so
the many counting call sites in context/message assembly pick up the correction
without threading `model` through every signature. `ExecutionConfig.model` is
now populated from `LLMConfig.model`, and `TokenCountOptions.model` — declared
but never used — is superseded.
Scope note: this affects the pre-send estimate and the no-usage fallback only;
compression's main path already used the provider's real numbers.
Two storage-lifecycle defects, both verified to fail before the fix.
FIFO eviction leaked disk data. `createThread` enforces MAX_THREADS=50 by
deleting the oldest entries from the in-memory map, but never called
`agentSessionRepository.deleteThread` — so each evicted thread's `<id>.jsonl`
and metadata stayed on disk forever. `deleteThread` has always cleaned up disk,
so the two removal paths disagreed and the leak was invisible. Plan mode makes
it worse: every plan task creates a thread, so a 20-task parallel plan evicted
20 real conversations and orphaned 20 files. Eviction now deletes disk data and
also drops the evicted thread's `threadMessageVersions` counter, which
previously outlived its thread.
`clearMessages` was nondeterministic and incomplete:
- It never touched the repository, so whether the on-disk `.jsonl` was actually
truncated depended on whether some later flush happened before restart. The
same action could either clear history or silently keep it. It now persists
immediately via `persistCriticalAgentSessionState`.
- It left `branches[threadId]` intact. Branches hold full copies of the
conversation, including the synthetic `__mainline__` snapshot, and are
persisted to _extra.json — so a user who cleared their history still had that
content on disk and could resurrect it by switching branches. Both the branch
list and its `activeBranchId` entry are now cleared with the messages.
`createMessageSlice`'s StateCreator is widened to include BranchSlice, which is
how the slice already reaches other cross-slice state at runtime.
Three independent defects, all verified before changing anything.
1. Session persistence was never scheduled.
`initializeAgentSessionSync` monkey-patched `useAgentStore.setState` to detect
changes to the durable slices. It could never fire: Zustand v5's
`createStoreImpl` passes its *internal* `setState` closure to the slice
initializer, and `Object.assign(useBoundStore, api)` exposes only a copy of that
reference, so every `set(...)` inside a slice bypassed the patch. Confirmed
against zustand/esm/vanilla.mjs and by probe: a slice action triggers the patch
0 times while `subscribe` observes every transition.
The debounced write therefore never ran. Conversations survived only because
Agent.ts flushes after each run and checkpoints flush opportunistically —
anything mutated outside a run (thread rename/delete/switch, todo edits, all
branch mutations) stayed in memory until the next run or app shutdown. Replaced
with `useAgentStore.subscribe`, the supported hook.
2. Plans could not be deleted, and deleting them would not have worked.
`deletePlan` existed with zero callers, and only filtered the in-memory array.
Plans live at `.adnify/plan/<id>.json` with the requirements doc alongside, and
`loadPlansFromDisk` rebuilds the list from that directory on every workspace
open — so a "deleted" plan resurrected on restart. It now deletes both files,
cancels any queued debounced save first (which would otherwise recreate the
file it just removed), and clears `currentTaskId` when the active plan goes.
It also cascades to the plan-task threads the plan spawned. Those are excluded
from the sidebar by `isTopLevelThreadForMode`, so without the cascade they were
unreachable forever, reclaimed only by the 50-thread FIFO eviction.
Exposed in the plan history drawer with a two-step confirm, since a plan delete
also removes its requirements doc and task threads. Entries are routed by type:
plan entries go through `deletePlan`, bare requirements conversations through
`deleteThread`.
3. Plan mode had no route to session history at all.
`ChatPanel` hides its entire header when `chatMode === 'plan'`, and both
triggers for `ConversationSidebar` — the only UI with thread deletion — live in
that header. The sidebar was mounted but unreachable, and is already plan-aware
(it filters by mode and forces the history tab). Added a session-history button
to the workbench, which owns the top-right corner in plan mode.
4. `Agent.abort()` read `runningTasks` after deleting from it.
`this.runningTasks.delete(targetThreadId)` ran five lines before
`this.runningTasks.get(targetThreadId)?.requestId`, so the intended primary
source was always undefined and silently fell through. The requestId is now
captured before the delete. `approvalService.reject()` also received a
*different* id than `api.llm.abort()`; both now use the same resolved value,
because `reject(undefined)` falls back to the most recently registered key,
which can belong to an unrelated thread.
Loop detection now only ever warns. It never terminates a turn.
Previously three rules returned `isLoop: true` (checkExactRepeat's hard
threshold, checkContentChange, checkPatternLoop) and loop.ts responded by
breaking out of the turn. checkPatternLoop was the most aggressive: a 2-call
pattern repeated just twice was enough, so the ordinary long-task rhythm of
edit -> lint -> edit -> lint could kill the run. That contradicted the module's
own stated goal ("treat ... as a warning, not a hard stop") and made long tasks
unfinishable.
All three now return `warning`, which loop.ts already handles the right way:
surface an alert, feed a corrective hint back to the model, and keep going. The
break-on-isLoop branch in loop.ts is removed as dead code. `checkLoop` also had
to be updated to return content/pattern results at all — its early-return
conditions still tested only `isLoop`, so warnings from those two rules were
being swallowed. Message formatting is unaffected: the helpers dispatch on
`details.category`, not `reason`.
Two changes to reduce hitting the tool-call limit in the first place:
- Auto-fix now gives up after 2 attempts on an UNCHANGED lint error set. It
spends an iteration per report, so errors the model cannot fix (generated
files, vendored code, false positives) previously consumed every remaining
iteration and pushed the turn into the limit. Keying on the error signature
means a model making progress keeps its full budget.
- The limit warning now names the actual limit and points at
Settings -> Agent -> Max Loops (adjustable 5-100), and asks the model to
report what remains rather than just "adjust the strategy".
Also fixes the limit check itself: `iteration >= maxIterations` sat outside the
while loop, so a turn that merely finished on its final allowed iteration got a
bogus "limit reached" alert, a SECOND `loop:end` event, and an extra LLM
request. That fired even for `reason: 'aborted'` — a fresh request after the
user pressed stop. It is now gated on `shouldContinue` (true only on the
"run another iteration" path) and on the abort signal, and
completeWithSoftLimitFeedback returns early when already aborted.
Tests assert the contract directly: every rule warns, none reports isLoop, and
the classic edit/lint alternation is not treated as a loop.
`checkContentChange` could never trip, so the most common coding-agent failure
mode — rewriting the same file back and forth between two states — went
completely undetected.
Writers and the reader keyed the same map from opposite directions:
- loop.ts:839 records hashes with `meta.filePath`, an ABSOLUTE path built by
`resolvePath()` in the tool executors (executors.ts:1018).
- checkContentChange looked up `record.target`, the RELATIVE path taken from
the model's `args.path` (LoopDetector.ts:175).
The keys never matched, so the reader always saw an empty list and bailed on
`hashes.length < 2`.
Verified empirically before and after: with identical input and only the hash
key varying, the relative key reported `content_cycle` while the absolute key
returned `{isLoop: false}`.
Both sides now go through `contentHashKey()`, which normalizes separators and
reduces to the trailing two path segments — enough to keep `src/a.ts` distinct
from `tests/a.ts`, while staying independent of the absolute prefix so no
workspace root is needed at this layer.
Adds tests/agent/utils/loopDetectorContentCycle.test.ts covering both key
directions, Windows separators, and two negative cases (content that keeps
changing; alternating hashes split across two same-named files in different
directories). The two absolute-path cases fail without this change.
Restores a green typecheck and removes three classes of defect that were
silently degrading agent behaviour.
Typecheck (CI runs `npx tsc --noEmit`; note `pnpm build` = `vite build` does
NOT typecheck, so these could ship):
- PlanHistoryDrawer rendered <History /> without importing it. The empty-state
branch is only reachable via a search with no matches, so it crashed there
and nowhere else. Tests never render this component, so both gates missed it.
- PlanWorkbench/planWorkbenchProjection accessed `.progress` on union members
that lacked it; annotate the focus literals and toolActivities so the
declared PlanWorkbenchFocus/PlanActivityItem types apply.
- useGlobalShortcuts subscribed to showChangelog but omitted it from
stateRef.current, so the shortcut could never read it.
- ChangelogDialog: drop genuinely unused imports.
- tsconfig: scope out src/main (compiled by tsconfig.main.json with
module: CommonJS, where `import x = require()` is valid and intentional) and
the tests/treeSitterTest.ts scratch script that imports it. Rewriting those
imports would have broken the main build to satisfy the wrong config.
Prompt text sent on every request:
- promptTemplates.ts:263-265 contained mojibake (bytes E9 88 AB 3F) where a
UTF-8 arrow was decoded as GBK, so the model read "change 鈫?use ..." — the
arrow lost and a stray "?" turning each line into a question.
Phantom tools — advertised to the model but with no TOOL_CONFIGS entry, so
BuiltinToolProvider silently drops them while the prompt still taught them:
- Remove read_multiple_files / get_dir_tree / get_file_info from the
CORE_TOOLS and PLAN_EXPLORATION_TOOLS allow-lists.
- Point the prompt and SEARCH_DECISION_GUIDE at the real capability instead:
read_file accepts an array (path=["a.ts","b.ts"]), and list_directory takes
recursive=true.
- ContextBuilder called a non-existent 'get_terminal_output' (real name is
read_terminal_output), so @Terminal context injection always returned
"[No terminal output available]".
Adds tests/agent/plan/planWorkbenchComponents.test.ts: a static guard that
every PascalCase JSX tag in the workbench resolves to an import or local
declaration. Verified to fail when the History import is removed and to pass
once restored.