Commit Graph
801 Commits
Author SHA1 Message Date
kerwin2046 dc16ba5de2 feat: enhance remote file upload functionality
- 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.
2026-08-21 17:34:17 +08:00
kerwin2046 e335c6a2f2 feat: enhance remote file and directory download functionality
- 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.
2026-08-21 17:05:33 +08:00
kerwin2046 b4290922c9 feat: add GitHub download mirror support for update service and fix #153
- 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.
2026-08-21 16:32:12 +08:00
kerwin2046 db7e09c670 feat: enhance Git diff and file change handling
- 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.
2026-08-21 16:19:59 +08:00
kerwin2046 e0633b9fa5 feat: implement external file access request functionality
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.
2026-08-21 16:08:22 +08:00
adnaan fec31e8046 chore(release): prepare v1.7.60
Release / get-version (push) Canceled after 0s
Release / build-windows (arm64, windows-11-arm) (push) Canceled after 0s
Release / build-windows (x64, windows-latest) (push) Canceled after 0s
Release / build-macos (arm64, macos-latest) (push) Canceled after 0s
Release / build-macos (x64, macos-15-intel) (push) Canceled after 0s
Release / build-linux (arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Release / build-linux (x64, ubuntu-latest) (push) Canceled after 0s
Release / release (push) Canceled after 0s
Release / sync-to-gitee (push) Canceled after 0s
2026-08-21 00:57:50 +08:00
adnaan 84c38c077b feat: implement piped shell command execution and fallback for terminal integration 2026-08-21 00:52:34 +08:00
adnaan 8fed2eaf1a feat(preview): add local preview probing and webview types
- 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.
2026-08-21 00:20:10 +08:00
adnaan dbc8d035f4 feat: enhance thread message management and optimize serialization for performance 2026-08-21 00:09:16 +08:00
adnaan 9cb3dc7e32 feat: implement caching for message scans to optimize performance in plan projections 2026-08-20 23:35:08 +08:00
adnaan 35919ee490 refactor: optimize metadata signature handling to improve performance and reduce unnecessary serialization 2026-08-20 22:30:18 +08:00
adnaan b88cc0fddc feat: add decorative animations toggle and implement in various components 2026-08-20 18:45:12 +08:00
adnaan 3ead9ec3b9 refactor: optimize animations and IO path resolution for performance 2026-08-20 16:23:38 +08:00
adnaan 0079e3ecd1 chore(release): prepare v1.7.59
Release / get-version (push) Canceled after 0s
Release / build-windows (arm64, windows-11-arm) (push) Canceled after 0s
Release / build-windows (x64, windows-latest) (push) Canceled after 0s
Release / build-macos (arm64, macos-latest) (push) Canceled after 0s
Release / build-macos (x64, macos-15-intel) (push) Canceled after 0s
Release / build-linux (arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Release / build-linux (x64, ubuntu-latest) (push) Canceled after 0s
Release / release (push) Canceled after 0s
Release / sync-to-gitee (push) Canceled after 0s
2026-08-20 13:47:52 +08:00
adnaan 1b27d3f11c perf: remove io and rendering hot-path stalls 2026-08-20 12:30:23 +08:00
adnaan 82c7ea1630 fix(settings): persist extended reasoning capability 2026-08-20 12:10:41 +08:00
adnaan 1092d47325 feat(storage): secure external files and migrate plans 2026-08-20 12:03:31 +08:00
adnaan 0ec7bf996c fix(lsp): persist servers and resolve project runtimes 2026-08-20 11:47:46 +08:00
adnaan c45be128fb feat: enhance auto-reveal functionality and improve scroll behavior in VirtualFileTree 2026-08-20 11:20:45 +08:00
adnaan 8185523273 fix(mcp): handle optional metadata in server fetching logic 2026-08-20 11:17:12 +08:00
adnaan 754abf744c feat: Refactor session storage and persistence mechanisms
- 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.
2026-08-20 11:11:54 +08:00
adnaan c22eb1a021 fix(storage): stop silent truncation from destroying files and sessions
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.
2026-08-19 23:47:56 +08:00
adnaan 92feb67b7d chore(release): bump version to v1.7.58 and update changelog
Release / get-version (push) Canceled after 0s
Release / build-windows (arm64, windows-11-arm) (push) Canceled after 0s
Release / build-windows (x64, windows-latest) (push) Canceled after 0s
Release / build-macos (arm64, macos-latest) (push) Canceled after 0s
Release / build-macos (x64, macos-15-intel) (push) Canceled after 0s
Release / build-linux (arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Release / build-linux (x64, ubuntu-latest) (push) Canceled after 0s
Release / release (push) Canceled after 0s
Release / sync-to-gitee (push) Canceled after 0s
2026-08-18 22:35:53 +08:00
adnaan 4af2e9dacf feat: enhance MCP configuration and skills management
- 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.
2026-08-18 22:27:12 +08:00
adnaan 1397e80a79 feat: enhance plan workflow and tool handling with support for new message formats and improved state management 2026-08-18 21:51:48 +08:00
adnaan ca3f2911ec feat: enhance git ignore functionality with support for .gitignore and .git/info/exclude 2026-08-18 21:43:21 +08:00
adnaan 7ca3320a3f feat: add AI commit message prompt configuration and default prompt 2026-08-18 21:36:42 +08:00
adnaan af30229997 feat: enhance thread creation and plan handling in ConversationSidebar and PlanWorkbench components 2026-08-18 21:26:40 +08:00
adnaan 906a4f14a1 feat: implement search functionality in settings modal with indexed entries 2026-08-18 21:18:06 +08:00
adnaan 731bfafe49 fix: update installing state management to use Set for better handling of multiple installations 2026-08-18 20:52:39 +08:00
adnaan 0595cb0761 fix: resolve shell integration TypeScript errors
Release / get-version (push) Canceled after 0s
Release / build-windows (arm64, windows-11-arm) (push) Canceled after 0s
Release / build-windows (x64, windows-latest) (push) Canceled after 0s
Release / build-macos (arm64, macos-latest) (push) Canceled after 0s
Release / build-macos (x64, macos-15-intel) (push) Canceled after 0s
Release / build-linux (arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Release / build-linux (x64, ubuntu-latest) (push) Canceled after 0s
Release / release (push) Canceled after 0s
Release / sync-to-gitee (push) Canceled after 0s
2026-08-18 00:30:58 +08:00
adnaan 2aa633416c feat: add native shell integration for v1.7.57
- 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
2026-08-18 00:23:22 +08:00
adnaan c49d532987 fix: harden URL and content handling
- 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
2026-08-17 23:45:59 +08:00
adnaan 8779eabbd5 fix: resolve agent workflow and terminal issues
Fixes #138
Fixes #139
Fixes #140
Fixes #141
Fixes #142
Fixes #143
Fixes #144
Fixes #145
Fixes #146
2026-08-17 21:09:00 +08:00
adnaan b88dc87512 chore: prepare v1.7.56 release
Release / get-version (push) Canceled after 0s
Release / build-windows (arm64, windows-11-arm) (push) Canceled after 0s
Release / build-windows (x64, windows-latest) (push) Canceled after 0s
Release / build-macos (arm64, macos-latest) (push) Canceled after 0s
Release / build-macos (x64, macos-15-intel) (push) Canceled after 0s
Release / build-linux (arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Release / build-linux (x64, ubuntu-latest) (push) Canceled after 0s
Release / release (push) Canceled after 0s
Release / sync-to-gitee (push) Canceled after 0s
2026-08-17 00:01:47 +08:00
adnaan 8a78975365 feat: update changelog for version 1.7.56 and enhance secure terminal command execution 2026-08-16 23:55:14 +08:00
adnaan 5e12bce4b3 feat: enhance AI attribution and session file management
- 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.
2026-08-16 23:50:41 +08:00
adnaan 3a10e5d094 feat: upgrade to AI SDK 7 and extend reasoning effort support
- 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.
2026-08-16 22:42:49 +08:00
adnaan f8393dfd57 fix(agent): enable safe tool retry and bound stored message history
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.
2026-08-16 21:40:43 +08:00
adnaan 69dd7d9522 feat(chat): add ReasoningParticleSlider component and integrate prompt optimization functionality 2026-08-16 17:44:19 +08:00
adnaan 7387848042 feat: add PlanWorkbenchProcessing component for displaying processing states
- 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.
2026-08-16 17:20:46 +08:00
adnaan 5441ff710d fix(agent): calibrate token estimates against real provider usage
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.
2026-08-16 15:18:56 +08:00
adnaan 318b403782 Merge branch 'master' of https://github.com/ad-naan/adnify 2026-08-16 00:56:31 +08:00
adnaan 1f1cdc7fe7 fix(agent): stop orphaning thread files on eviction and clearing
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.
2026-08-16 00:50:32 +08:00
adnaan 450622425b fix(agent): restore session persistence, add plan deletion, correct abort ids
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.
2026-08-16 00:32:48 +08:00
adnaan 72ca54c631 fix(agent): make loop detection advisory and stop wasting iterations
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.
2026-08-15 23:49:13 +08:00
adnaan b8c9d19853 fix(agent): make content-cycle loop detection actually fire
`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.
2026-08-15 23:08:11 +08:00
adnaan 3ffea3860b fix: repair typecheck, corrupted prompt text, and phantom tool references
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.
2026-08-15 22:57:19 +08:00
adnaan 4c17206b17 Merge pull request #137 from ad-naan/dev-tss
Implement multiple remote repository support for Git commits
2026-08-15 22:40:49 +08:00
DESKTOP-ONARBH6\Administrator 264e3b5b6b 实现多远程仓库的git提交 2026-08-15 22:38:47 +08:00