Commit Graph

134 Commits

Author SHA1 Message Date
Marius 65c5e9d2c0 fix(vscode): sync mode cycling state (#12560) 2026-07-27 14:07:28 +02:00
Josh Lambert 85d65a3137 fix(vscode): preserve active editor pane 2026-07-18 10:35:16 -04:00
marius-kilocode 6ce16e7cae fix(agent-manager): open worktree dialog by default 2026-07-17 09:42:26 +02:00
Sylwester Liljegren 46fe0a91d9 feat(vscode): toggle chat search from Command Palette, jump focus on close, and auto-expand matched blocks 2026-07-14 03:38:59 +02:00
Johnny Eric Amancio b0348cbc01 feat(vscode): integrate project memory into the extension (#11954)
* feat(vscode): integrate project memory into the extension

Wire the kilo-memory system into the VS Code extension host and webview,
building on the shared client helpers and /memory command catalog in
@kilocode/kilo-memory.

Extension host:
- KiloProviderMemory bridges the SDK memory client (status/show/enable/
  disable/configure/rebuild/remember/correct/forget/purge, plus status
  and edit) with serialized operations and a small per-directory cache
- memory.status/updated/error events fan out to the active and tracked
  sessions and refresh the webview
- showMemory / toggleMemory commands, routed through the sidebar provider
  or the Agent Manager panel depending on which is active

Webview:
- MemoryProvider context, memory status controls in the Context settings
  tab, task-header and assistant-message affordances, and the /memory
  prompt command (help/show/operation) driven by the shared catalog
- message types and i18n strings across all locales

* fix(vscode): address memory PR review suggestions

- serialize toggleMemory's status pre-check via KiloProviderMemory.toggle()
  so rapid toggles can't double-apply the same operation
- collapse duplicate enabled/active memos in memory context
- extract shared formatCompactCount util (was triplicated K/M formatter)
- drop dead reject handler in serial() and never-produced member from
  MemoryOperationResultMessage.result union

* fix(memory): audit cleanups: inspect accuracy, shared marker decoder, dead i18n key

* chore: update kilo-vscode visual regression baselines

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-07-07 15:44:24 +02:00
marius-kilocode cef3dc7ae8 feat: add /reload action to reboot the instance from disk
Reboots the per-directory instance, reloading config, skills, agents,
commands, and MCP prompts changed on disk without restarting the
server. Sessions and history are preserved; only the per-directory
instance caches are torn down and rebuilt.

Server: POST /instance/reload wraps the existing atomic
InstanceStore.reload path (the same one project.git.init uses). The
rebuild completes before the 200 response, so clients can refetch with
no race. Returns 409 ConflictError while a session is actively
running. Emits the existing server.instance.disposed SSE event, which
the TUI and extension already use to auto-refetch.

CLI: /reload palette command calls the endpoint; the TUI already
bootstraps on server.instance.disposed.

Extension: /reload slash command, a reload button in the task header
and settings panel, and a Kilo Code: Reload Config and Skills command
palette entry. The handler clears the command cache and reuses
reloadAfterAuthChange to re-fetch config, providers, agents, skills,
and commands. Reload targets the current session's directory so Agent
Manager worktree sessions reload their own worktree instance rather
than the workspace root.

SDK: regenerate so client.instance.reload is available to external
integrations.
2026-07-07 12:38:12 +02:00
Mark IJbema 80ed571bd6 feat(vscode): notify on matching marketplace items
Surface a discardable VS Code notification when a marketplace item's suggest_for metadata matches the current workspace. The notification offers a one-click Install button that opens the marketplace install dialog with project scope preselected, plus a per-suggestion "Don't show again" option persisted via a stable type:id slug.
2026-06-26 10:28:36 +02:00
Mark IJbema c193ee8561 feat(vscode): add native notebook tools 2026-06-25 09:29:24 +02:00
Marius 5dc511b4e9 fix(vscode): silence auto-approved permissions (#11573) 2026-06-23 13:39:39 +03:00
Mark IJbema 47a302f346 Merge pull request #11303 from Kilo-Org/mark/replace-roo-code-session-import
feat(vscode): import sessions from Roo Code
2026-06-18 13:44:59 +02:00
Mark IJbema 464fcb0a66 refactor(vscode): share session migration pipeline 2026-06-17 17:45:12 +02:00
Marius 565f740e1e Merge pull request #11351 from Kilo-Org/humorous-exhaust
fix: sync remote sessions across extension surfaces
2026-06-17 15:49:15 +02:00
Marius 41dcfb6528 Merge pull request #11367 from Kilo-Org/night-saltasaurus
feat(agent-manager): open pull requests with keyboard shortcut
2026-06-17 15:39:17 +02:00
marius-kilocode 1933cf7cab feat(agent-manager): open pull requests with keyboard shortcut 2026-06-17 14:49:27 +02:00
Joshua Lambert 391a313a29 Merge pull request #11317 from Kilo-Org/feat/vscode-switch-deep-links
feat(vscode): support agent switch links
2026-06-17 08:22:56 -04:00
marius-kilocode 94bdfb9f8e fix: sync remote sessions across extension surfaces 2026-06-17 12:34:53 +02:00
Josh Lambert c8bad77f19 refactor(vscode): inline switch link parsing 2026-06-16 19:01:01 -04:00
Josh Lambert a2ccf574a7 feat(vscode): support agent switch links 2026-06-16 12:07:21 -04:00
marius-kilocode c961f66bd4 feat(agent-manager): add worktree and session search 2026-06-16 17:38:39 +02:00
Marius 884c54f4f8 Merge pull request #11098 from Kilo-Org/feat/vscode-attention-notifications
feat(vscode): add attention sounds
2026-06-15 16:12:12 +02:00
Josh Lambert 4c5b17a0e5 refactor(vscode): simplify model deep link handling 2026-06-11 10:33:06 -04:00
marius-kilocode b0ec91cef4 feat(vscode): add attention notifications 2026-06-11 10:06:23 +02:00
Joshua Lambert b06d91de45 Merge branch 'main' into feat/opus-vscode-deep-link 2026-06-11 00:28:56 -04:00
Josh Lambert 54534bd641 fix(vscode): preserve sidebar on window reload 2026-06-05 10:24:18 -04:00
Josh Lambert c6ec517124 Merge remote-tracking branch 'origin/main' into feat/opus-vscode-deep-link 2026-06-04 10:29:02 -04:00
Josh Lambert 235e769fb3 fix(vscode): generalize model deep links 2026-06-03 23:31:59 -04:00
Imanol Maiztegui b89d4ea029 Extract Marketplace logic from KiloProvider (#10850)
* feat(marketplace): extract marketplace into standalone webview panel

* fix(marketplace): correct fetchData directory arg and add error logging

Replace swallowed catch block with console.warn for session status
sync failures, and pass `this.directory()` instead of `project` as the
second positional argument to `fetchMarketplaceData`.
2026-06-03 23:07:11 +02:00
Josh Lambert b06b42d2e3 feat(kilo-vscode): support promoted model deep links 2026-06-02 12:15:24 -04:00
Mark IJbema 21ef12227a fix(vscode): await autocomplete default migration before manager init
The migration cleared pinned default settings before the manager's first
readSettings() call, but firing it as a void promise let the manager's
constructor (which kicks off load() synchronously) race with the migration.
Awaiting the migration in registerAutocompleteProvider ensures the cleared
state is visible when the manager loads.
2026-05-28 13:53:02 +02:00
marius-kilocode f300c6acac feat(vscode): track sidebar title button clicks 2026-05-20 22:41:54 +02:00
marius-kilocode 64bbc1171b Merge remote-tracking branch 'origin/main' into sugared-sense
# Conflicts:
#	packages/kilo-vscode/src/kilo-provider/options.ts
2026-05-15 12:51:31 +02:00
marius-kilocode 3031de6302 fix(agent-manager): continue sessions in worktrees 2026-05-15 09:51:43 +02:00
marius-kilocode 1f3df35576 fix(vscode): address restore review feedback 2026-05-11 10:18:03 +02:00
marius-kilocode b91457673c fix(vscode): restore only previously open Kilo views 2026-05-11 10:13:25 +02:00
Imanol Maiztegui a68fcc255a Select Branch / Unstaged / Staged views on diff viewer (#10065)
* feat(diff-viewer): add base branch picker to workspace diff source

Introduce a UI control that lets users override the comparison base
branch in the diff viewer. The picker lists local and remote branches
sorted by commit date, with a "Default" option that falls back to the
auto-resolved tracking/default branch.

Key changes:
- Add `listBranches` to GitOps for sorted branch enumeration
- Extend DiffSourceCatalog with base branch override state and disposal
- Add `reactivate` method to SourceController for in-place source rebuild
- Create shared BranchSelect component (moved from agent-manager)
- Add BaseBranchPicker component for the diff viewer header
- Wire new webview messages (requestBranches, setBaseBranch, branches)
- Add i18n keys for all supported locales
- Register DiffSourceCatalog as disposable in extension activation

* refactor(diff-sources): extract staged and unstaged git diff sources into standalone modules

Decompose the diff source system by introducing dedicated modules for
staged (index vs HEAD) and unstaged (working tree vs index) views,
alongside shared git-status parsing utilities.

- Create git-status.ts with reusable parseNameStatus, parseNumstat,
  showBlob, readDisk helpers and the summarize builder
- Implement staged.ts source using `git diff --cached` against HEAD
- Implement unstaged.ts source combining tracked diffs with untracked
  file enumeration via `git ls-files --others`
- Register both sources in DiffSourceCatalog when a workspace root exists
- Extend DiffSourceType union with "staged" and "unstaged" variants
- Rename workspace label from "Local Changes" to "Branch" and add
  i18n entries for the new source picker options

* feat(vscode): display current branch in diff viewer base branch picker

Show the currently checked-out branch (HEAD) alongside the base branch
selector with an arrow indicator (current → base), providing clearer
context for which branches are being compared in the diff viewer.

* refactor(diff): replace magic empty string with named INDEX_REF constant and fix disposal

Extract `INDEX_REF` constant in git-status module to clarify intent when
referencing the staging area instead of a commit. Update staged and
unstaged sources to use it. Additionally:

- Clear `baseBranchOverride` on dispose to prevent stale state
- Apply `generatedLike` detection to staged diff source
- Update tests to reflect new disposal semantics

* fix(vscode): move baseBranchOverride state from catalog to provider

Relocate the base branch override from DiffSourceCatalog into
DiffViewerProvider where it belongs as panel-level state. Pass it
through PanelContext so the catalog remains stateless and testable.

- Add `baseBranchOverride` field to PanelContext type
- Thread override via ctx in DiffViewerProvider.openPanel and setBaseBranch
- Remove setBaseBranchOverride/getBaseBranchOverride from catalog
- Accept override as parameter in listWorkspaceBranches
- Simplify catalog dispose and update tests accordingly

* feat(i18n): add staged/unstaged diff source labels and rename workspace to branch

Introduce translated strings for the new "staged" and "unstaged" diff
viewer source options across all 18 locale files. Rename the existing
workspace source label from "Local changes" to "Branch" in each
language to better reflect its scope.

* test(vscode): update diff source catalog tests to include staged and unstaged entries

Align test expectations with the newly added staged/unstaged diff
sources. The listAvailable assertions now verify that both "staged"
and "unstaged" appear alongside "workspace" in the returned source
list.

* fix(vscode): add path traversal protection and size guards to diff sources

Introduce `resolveInside` to reject absolute paths and `..` traversal
that could escape the workspace directory. Replace raw `path.join`
calls in `readDisk`, `fileSize`, and unstaged file lookups with the
safe resolver.

Add `blobSize` and `fileSize` helpers to check content length before
reading, skipping detail fetches for files exceeding MAX_DETAIL_BYTES
in both staged and unstaged sources. Re-export MAX_DETAIL_BYTES from
git-status for shared access.

* fix(diff): resolve override branch refs via remote fallback

When `baseBranchOverride` is a short remote-tracking name (e.g.
`feature` from `refs/remotes/origin/feature`), `git merge-base` fails
because no local branch exists. Add `resolveOverrideRef` that attempts
`rev-parse --verify` on the short name first, then falls back to
`origin/<name>` before giving up entirely and resuming auto-detection.

* fix(vscode): use lstat for symlink-safe working-tree reads

Replace `fs.stat` with `fs.lstat` in `readDisk`, `fileSize`, and
unstaged file enumeration to avoid following symlinks. For symlink
entries, `readDisk` now returns the link target string (matching git's
blob storage) instead of reading the pointed-to file's contents.

This prevents untracked symlinks from leaking arbitrary file contents
(e.g. `~/.aws/credentials`) into the diff viewer, since `resolveInside`
only guards against lexical path traversal, not symlink dereferencing.

* refactor(diff): propagate mtime-based stamps for untracked file cache invalidation

Untracked files always report additions/deletions as 0 since numstat
cannot compute them without an index blob. This made the webview cache
unable to detect edits to untracked files, leaving stale content visible
between polling cycles.

Introduce an optional `stamp` field on `FileEntry` that encodes
size+mtime for untracked entries, and thread it through `summarize()`
and `fetchFile()` so cache keys update whenever the file is modified on
disk. Tracked entries continue using the numstat-derived stamp as before.

* fix(vscode): log for-each-ref failures in listBranches instead of silently swallowing

Replace the empty `.catch(() => "")` with a handler that logs the
error message before returning the fallback empty string, improving
debuggability when branch enumeration fails.
2026-05-08 15:30:19 +02:00
Imanol Maiztegui b4fd1be904 Per-turn diff view with clickable banner (#9999)
* refactor(vscode): replace collapsible diff summary with clickable banner

Replace the expandable accordion-based diff summary in session turns
with a simpler clickable button that opens the dedicated changes view
via a postMessage to the extension host. This removes the inline file
list expansion in favor of the native VS Code changes panel.

- Remove Collapsible/Accordion/StickyAccordionHeader components
- Remove getDirectory/getFilename helpers and expanded state management
- Add openChanges action via useVSCode context
- Style the trigger as a minimal button with hover chevron indicator
- Update story name/description to reflect new behavior

* feat(vscode/diff): simplify DiffSource interface to declarative fetch model

Convert DiffSource from a class-based lifecycle pattern (initialFetch/start/dispose)
to a minimal declarative interface where sources only implement `fetch()` and
optionally `fetchFile`/`revert`/`dispose`. Move all polling, hash-dedup, loading
state, and message posting responsibility into SourceController.

- Replace class-based SessionDiffSource/WorktreeDiffSource with factory functions
- Introduce DiffSourceFetch return type with stopPolling flag for terminal states
- Remove DiffSourcePost/DiffSourceMessage types in favor of controller-owned posting
- SourceController now owns setInterval polling and hash-based dedup logic
- Rename requestFile → fetchFile, revertFile → revert, make dispose optional
- Update all unit tests to match the new declarative source contract

* refactor(vscode): add per-turn diff viewing with hidden picker mode

Introduce a TurnDiffSource that fetches diffs scoped to a single user
message rather than the full session snapshot. The diff viewer can now
open in a fixed, non-switchable mode when invoked from a specific turn.

- Add `turn.ts` source with factory, descriptor, and id helpers
- Extend PanelContext with `hidePicker` flag to suppress source selector
- Thread `turnId` from webview message through sidebar handler to command
- Catalog returns empty descriptors when picker is hidden
- Export `toSessionDiffFile` from session source for reuse in turn source
- Add `turn` to DiffSourceType union
- Add unit tests for turn source fetch behavior and catalog integration

* fix(vscode/diff): always log DiffSource fetch errors

Initial-fetch errors were only posted as a discarded 'error' message and
had no console trace, making them invisible in production. Log on both
initial and polling ticks so Extension Host output captures the failure.

* chore: update kilo-vscode visual regression baselines

* feat(vscode/diff): self-cancel polling when source reports completion

Convert polling callback to async and use runFetch return value to
stop the interval once the diff source signals it is done, avoiding
unnecessary continued fetches after completion.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-05-07 13:41:03 +02:00
Josh Lambert bef0183738 fix(vscode): close runtime telemetry consent gap with the CLI
The previous `watchTelemetryState` fix updated the webview UI in real
time but left the CLI subprocess's PostHog client stuck on its
spawn-time `KILO_TELEMETRY_LEVEL` value. A user who started VS Code
with telemetry off and toggled it on at runtime saw the thumbs UI
appear (good) but every webview event was silently dropped at the
CLI's `Client.capture()` gate (bad).

Add a runtime sync channel:

- New `POST /telemetry/setEnabled` Hono route on the CLI server that
  calls `Telemetry.setEnabled(enabled)` to flip the `posthog-node`
  client's opt state.
- New `TelemetryProxy.setEnabled(enabled)` method that POSTs to it,
  using the same fire-and-forget pattern as `capture`.
- Extension calls `telemetry.setEnabled(vscode.env.isTelemetryEnabled)`
  immediately after `telemetry.configure(...)` on every `connected`
  state change, so a freshly-spawned CLI gets corrected even when its
  spawn-time env var is stale.
- Extension subscribes to `vscode.env.onDidChangeTelemetryEnabled` to
  forward runtime consent changes to the CLI as they happen.

All three changes live in Kilo-owned files (the route is already a
`kilocode_change - new file`, and the extension is Kilo-only). Zero
upstream OpenCode merge surface.

Closes #9872 fully (the previous `d67c5e307c` covered only the webview
UI).
2026-05-06 23:29:55 -04:00
Imanol Maiztegui 9c581d3992 Unified diff view for session changes and workspace changes (#9897)
* feat(vscode): add foundational types and abstractions for unified diff panel

Introduce the core type definitions and abstractions that support the
upcoming session diff viewer:

- PanelSurface: testable abstraction over vscode.WebviewPanel
- DiffSource/DiffSourceDescriptor: contracts for swappable diff providers
- DiffSourceCatalog: stub registry for enumerating and constructing sources
- PanelContext/DiffFile: cross-cutting types shared by manager and webview

* feat(diff): implement worktree diff source with polling and file revert

Add WorktreeDiffSource, a DiffSource implementation that computes diffs
between the local working tree and the base branch. Key behaviors:

- Resolves the diff target from the workspace root via GitOps
- Performs an initial fetch then polls every 2.5s with hash-based dedup
- Supports single-file revert through WorktreeDiffClient
- Posts structured messages (loading, diffs) to the panel via DiffSourcePost

* add(vscode): session diff source and unified patch parser

Introduce two new modules under the diff sources layer:

- patch-to-before-after.ts: reconstructs before/after file content
  from full-context unified diff patches by filtering line prefixes
- session.ts: SessionDiffSource fetches accumulated diffs for a given
  session, converts patches to before/after pairs, and posts results
  to the diff panel without polling or SSE

* feat(diff): wire up diff source catalog with session and worktree builders

Replace stub implementations in DiffSourceCatalog with real logic:

- Inject KiloConnectionService and use it to fetch session diffs
- Populate listAvailable based on PanelContext (workspace root, session)
- Route build() to WorktreeDiffSource or SessionDiffSource by id prefix
- Extract sessionDescriptor() and SESSION_PREFIX from SessionDiffSource
  to decouple descriptor creation from class instantiation
- Export WORKSPACE_DESCRIPTOR from worktree module for catalog reuse

* refactor(vscode): introduce DiffPanelManager and centralize diff panel lifecycle

Extract panel ownership out of DiffViewerProvider into a new
DiffPanelManager class that manages a single global "Changes" webview.
Key changes:

- Add DiffPanelManager with source-swapping, loading pulse, webview
  serialization, and disposable lifecycle management
- Add testable Scheduler abstraction to decouple setTimeout usage
- Extend DiffSourceCatalog with defaultSourceId() resolution logic
  and replace magic "workspace" string with WORKSPACE_SOURCE_ID const
- Extract sessionSourceId() helper in session source module
- Thread sessionId through openChanges command and sidebar context so
  the panel can open directly to the relevant session diff
- Re-register webview panel serializer under DiffPanelManager.viewType

* feat(diff): add source descriptor and capability message types for webview

Introduce new extension-to-webview and webview-to-extension message
interfaces to support multi-source diff panel switching:

- DiffSourceCapabilities, DiffSourceDescriptor for describing available
  diff sources with revert/comments flags and grouping metadata
- SetAvailableSourcesMessage and DiffViewerCapabilitiesMessage for
  pushing source lists and active capabilities to the webview
- SelectSourceRequest for the webview to request a source switch

* refactor(webview): integrate diff source picker into viewer and relocate shared types

Move DiffSourceCapabilities and DiffSourceDescriptor interfaces out of
extension-messages.ts into the shared diff/sources/types module, and
re-export them via import. Add DiffPickerHeader component with a
grouped Select dropdown for switching between multiple diff sources.
Wire source selection state and capability tracking into DiffViewerApp,
handling setAvailableSources and diffViewer.capabilities messages and
conditionally rendering the picker header above the diff view.

* feat(diff-viewer): add canRevert and canComment capability flags to full-screen diff

Introduce two optional boolean props (`canRevert`, `canComment`) on
FullScreenDiffView that allow callers to disable revert actions and
comment creation based on the active diff source's capabilities.

Guard gutter click handlers, keyboard shortcuts, the "Send all" button,
revert buttons, and sidebar revert callbacks behind these flags. In
DiffViewerApp, forward the capability values from the selected source
and reset transient UI state (comments, diff style, reverting set) on
source switches via a reactive effect.

* test(vscode): add unit tests for diff panel manager, source catalog, and patch utilities

Cover DiffPanelManager lifecycle (open, reveal, dispose, deserialized
panel disposal, source switching, comment forwarding), DiffSourceCatalog
listing/defaulting/building logic, SessionDiffSource fetch-and-convert
flow, and patchToBeforeAfter edge cases.

Also refactor DiffPanelManager to decouple panel creation from surface
adoption: the createSurface factory no longer receives a panel argument,
panel construction moves into a private defaultCreateSurface method, and
deserializePanel now disposes stale panels instead of rewiring them.
Extend the vscode mock with a createOutputChannel stub to support the
new test harness.

* refactor(diff): extract command-context assembly into DiffPanelManager.openFromCommand

Move PanelContext construction (workspace root resolution, session ID
lookup, initial source selection) out of the extension command handler
and into a dedicated openFromCommand method on DiffPanelManager. This
eliminates the extension's direct dependency on getWorkspaceRoot and
provider.getCurrentSessionId by accepting a sessionIdProvider callback
through DiffPanelManagerOptions.

Update tests to cover both provider-based and arg-based session ID
resolution paths in openFromCommand.

* feat(vscode): unify changes panel with multi-source diff architecture

Delete the legacy DiffViewerProvider in favor of the new
DiffPanelManager-based architecture. Decompose review-utils into
focused modules under diff/shared/ (client, hash, target) and update
all consumers to import from the new locations.

- Remove DiffViewerProvider and its registration in extension.ts
- Extract WorktreeDiffClient, DiffTarget into diff/shared/client
- Extract hashFileDiffs into diff/shared/hash
- Extract resolveLocalDiffTarget into diff/shared/target
- Slim down review-utils to only VS Code UI helpers
- Add changeset for the unified Changes panel feature

BREAKING CHANGE: DiffViewerProvider is removed; all diff viewing now routes through DiffPanelManager

* refactor(diff): add polling with hash dedup to SessionDiffSource

Upgrade SessionDiffSource from one-shot fetch to periodic polling
(2.5s interval) with hash-based deduplication, matching the pattern
already used by WorktreeDiffSource. Also clean up legacy references
in WorktreeDiffSource doc comments.

- Introduce POLL_INTERVAL_MS constant and start/stop polling lifecycle
- Track lastHash to skip redundant diff posts when content unchanged
- Extract fetchDiffs helper to share between initialFetch and poll
- Guard all post calls against disposed state
- Add comprehensive polling unit tests with scripted fetch helper

* fix(ui): rename worktreeStats() calls to session.summary() in ChatView

Update ChatView component to use the renamed `session.summary()`
accessor instead of the deprecated `session.worktreeStats()` method,
aligning with the unified multi-source diff architecture.

* feat(diff): add snapshots-disabled notice to session diff source

Introduce a `notice` message type in the diff source protocol so that
`SessionDiffSource` can warn users when snapshot tracking is turned off
for their repository. The check queries the workspace config before
fetching diffs; when disabled, polling is skipped entirely and a
warning banner is rendered in the diff viewer webview.

- Add `SnapshotEnabledCheck` callback wired through `DiffSourceCatalog`
- Extend `DiffSourceMessage` and `ExtensionMessage` with `notice` type
- Forward notice messages from `DiffPanelManager` to the webview
- Render warning banner with icon in `DiffViewerApp`
- Add CSS for `.diff-viewer-notice` component
- Cover new behavior with unit tests

* refactor(i18n): replace hardcoded notice strings with typed keys and localized messages

Convert the diff viewer notice system from passing raw English strings
through the message protocol to using well-known typed identifiers that
the webview resolves to translated text at render time.

- Define `DiffSourceNotice` union type in source protocol layer
- Define `DiffViewerNotice` union type in webview message contract
- Change `notice` field from `message: string` to `notice: T | undefined`
- Map notice identifiers to i18n keys in `DiffViewerApp` via lookup table
- Localize `DiffPickerHeader` labels and group names through `useLanguage`
- Add `diffViewer.*` translation keys across all 19 locale files
- Update unit tests to assert typed notice identifiers

* docs(changeset): update unified diff panel description

Clarify feature summary to mention sidebar badge counts and
snapshots-disabled warning alongside the source dropdown.

* feat(vscode): port markdown diff render ahead of main merge

Cherry-picks the user-facing bits of main's #9846 (render markdown diffs) into
this branch so merging main later is trivial for the 5 shared files. Wires the
markdown toggle through the new DiffPanelManager architecture as global state,
persisted via the kilo-code.new.diff.renderMarkdown setting.

* refactor(vscode): replace if-chain message dispatch with handler map

Extract DiffPanelManager.onMessage logic into a declarative
messageHandlers record and a dedicated onWebviewReady method.
Also fix import paths for DiffSourceDescriptor/DiffSourceCapabilities
to reference canonical source types, add explicit generic to Set<string>,
and extend webview tsconfig include to cover diff-viewer and diff-virtual.

* style(ui): add padding to select section headers

* fix: formatting

* fix(vscode): prevent stale source activation after panel teardown

Introduce an epoch counter to guard against race conditions where
activateSource completes its async initialFetch after the panel has
been disposed or the source has been swapped. The epoch is incremented
on every source teardown and checked before starting polling.

* refactor(vscode): scope source post guard to lifecycle epoch

Pass the epoch counter into createSourcePost so that messages emitted
by a source after its lifecycle has ended are silently dropped. This
closes a gap where polling callbacks could still push updates to the
surface after the source was swapped out.

* feat(diff-viewer): rename workspace source to "Local Changes" and add tooltip

Remove the "Workspace" source group, moving the worktree source under
"Git". Rename its label from "Workspace local" to "Local Changes" across
all locales and introduce a tooltip explaining that it covers all branch
changes vs the base (uncommitted files and local commits). The picker
header now renders option tooltips on hover with a delayed open.

* docs(i18n): translate workspace tooltip into all supported locales

Replace the English fallback string for
`diffViewer.source.workspace.tooltip` with native translations in ar,
bs, ja, ko, no, pl, ru, th, tr, uk, zh, and zht locale files.

* style(diff-viewer): rename parameter `d` to `desc` in DiffPickerHeader

Improve readability by expanding the terse single-letter parameter name
to a more descriptive `desc` across helper functions and the render
callback in DiffPickerHeader.

* refactor(diff-sources): replace hardcoded label with type-driven i18n key lookup

Replace the `label` string field in DiffSourceDescriptor with a
`DiffSourceType` discriminant (`"workspace" | "session"`). The webview
now composes i18n keys dynamically from the type, eliminating ad-hoc
id-matching logic in DiffPickerHeader and ensuring every source gets
both a label and a tooltip via the translation dictionaries.

Also adds `diffViewer.source.session.tooltip` translations for all
supported locales and introduces descriptor-type stability tests.

* fix(i18n): shorten session source label by removing "current" qualifier across all locales

* refactor(diff): extract shared polling interval constant into dedicated module

Consolidate the duplicated `POLL_INTERVAL_MS` definitions from
`session.ts`, `worktree.ts`, and the hardcoded literal in
`worktree-diff-controller.ts` into a single `DIFF_POLL_INTERVAL_MS`
export in `diff/polling.ts`. Update all consumers and tests to
reference the new canonical constant.

* feat(diff): replace DiffPanelManager with DiffViewerProvider and SourceController

Remove the `manager/` directory (DiffPanelManager, panel-surface,
scheduler) and introduce two focused replacements:

- `DiffViewerProvider`: owns the webview panel lifecycle, HTML rendering,
  and message routing directly against `vscode.WebviewPanel`
- `SourceController`: manages the active DiffSource with epoch-based
  stale-message filtering, decoupled from any webview abstraction

The PanelSurface and Scheduler indirection layers are eliminated in
favor of direct VS Code API usage in the provider and a simpler
epoch-guarded post function in the controller. Tests are rewritten
to exercise SourceController in isolation without fake surfaces.

BREAKING CHANGE: DiffPanelManager, PanelSurface, and Scheduler exports are removed

* refactor(diff): decouple SourceController from DiffSourceCatalog via dependency injection

Replace the direct DiffSourceCatalog dependency in SourceController with
two injected function callbacks (`build` and `listAvailable`), removing
the tight coupling to the catalog class. DiffViewerProvider now passes
thin wrappers that delegate to the catalog instance.

Update tests to use lightweight inline fakes instead of the FakeCatalog
subclass, and remove redundant polling/lifecycle tests that tested
implementation details rather than behavior.

* feat(diff): add lazy per-file content loading for worktree diffs

Introduce on-demand fetching of full file content (before/after) for
summarized diff entries. The worktree source now polls only a lightweight
summary and resolves detail via `requestFile` when the webview expands a
file.

- Add `requestFile` to `DiffSource` interface and implement in
  `WorktreeDiffSource` using local git operations
- Wire `diffViewer.requestFile` message through DiffViewerProvider to
  SourceController
- Add `diffViewer.diffFile` extension message to deliver single-file
  detail back to the webview
- Webview merges incoming summaries with cached detail, tracks
  per-file loading state, and auto-refreshes stale entries

* refactor(session): replace custom patch parser with shared kilo-ui session-diff utilities

Remove the hand-rolled `patchToBeforeAfter` function and its unit tests
in favor of the `normalize` and `text` helpers exported from
`@kilocode/kilo-ui/session-diff`. This eliminates duplicated parsing
logic and aligns the extension with the canonical diff reconstruction
used across the UI layer.

* test(diff): add hash utility tests and remove obsolete polling specs

Introduce a dedicated test suite for `hashFileDiffs` covering stability,
field sensitivity, and summarized-patch exclusion semantics. Remove the
now-unused polling tests and their helper functions (`scripted`, `wait`,
`modifiedPatchV2`) from the session source spec, reducing test surface
to match the current implementation boundaries.

* style(webview): add spacing for diff picker header component

* fix(diff): prefer workspace over session as default diff source

Change priority order in defaultSourceId so workspace source takes
precedence over session source when both workspaceRoot and sessionId
are present. Update ChatView to use renamed worktreeStats() accessor.

* fix(vscode): correct DiffViewerProvider path, bump max-lines cap, and apply font-size token

Update font-size arch test to reflect DiffViewerProvider's move into
src/diff/, raise KiloProvider max-lines eslint cap to 3500, and
replace hardcoded 12px in banners.css with --kilo-font-size-12.
2026-05-06 16:54:53 +02:00
Marius aec2425f6e Update native tab titles from sessions (#9961)
* feat(vscode): update native tab titles from sessions

* test(vscode): cover native tab title formatting
2026-05-06 11:15:22 +00:00
Marius 8ed0e17855 fix(agent-manager): recover worktrees after restart (#9939) 2026-05-06 10:25:55 +02:00
Marius 614bca7cff fix: exclude generated data from Spotlight indexing (#9833) 2026-05-04 13:39:32 +00:00
Marius bf60cdedd6 Show auto-approve status in VS Code sessions (#9662)
* feat(vscode): show auto-approve session status

* fix(vscode): remove unused auto-approve export
2026-04-29 11:27:18 +02:00
kirillk ce8d7adef3 fix(vscode): wire tab worktree actions 2026-04-27 13:46:38 -04:00
Kirill Kalishev b6ee1e4712 Merge branch 'main' into charmed-saver 2026-04-27 13:03:38 -04:00
Josh Holmer f74d54c431 feat: implement codebase indexing (#6966)
* feat(core): implement codebase indexing

* feat(core): gate indexing behind experimental flag

* fix: improvements to slow provider startups and indexing init blocking the world

* test(cli): stabilize indexing startup tests

* test(cli): avoid indexing startup hang

* test(cli): avoid CI startup leaks

* test(cli): annotate provider test change

* fix(indexing): tighten dependency surface

* refactor(cli): move indexing logic into kilocode paths

* test(cli): skip flaky shell cancel prompt cases

* fix(cli): tolerate slow Windows worktree cleanup

* fix(vscode): authenticate indexing status fetch

---------

Co-authored-by: Marius <marius@kilocode.ai>
2026-04-27 17:43:27 +02:00
kirillk 696ed061e6 fix(vscode): polish sidebar worktree actions 2026-04-24 14:58:33 -04:00
kirillk 18468b8e26 feat(vscode): expose sidebar worktree actions 2026-04-24 12:39:11 -04:00
Marius 48c0553bb7 feat(vscode): xterm.js terminal tabs in agent manager (#9268)
Click the chevron next to the + tab button and pick 'New Terminal' (or hit Cmd+Shift+T / Ctrl+Shift+T) to spawn a real shell inside the selected worktree or Local directory. Each terminal runs via the Kilo CLI's PTY backend, streamed over a direct loopback WebSocket so raw bytes bypass postMessage. Tabs mirror the worktree split-button pattern, support mixed drag-reorder with session tabs, and survive worktree-context switches without losing xterm state (slots are opacity-toggled in a persistent absolute-positioned layer, never unmounted). The legacy Cmd+/ integrated-terminal shortcut and console icon are preserved so existing muscle memory keeps working.
2026-04-22 16:20:40 +00:00
kiloconnect[bot] dca3725814 fix(vscode): prewarm autocomplete backend 2026-04-21 09:36:52 +00:00
Catriel Müller ad75f65b9c Merge branch 'main' into catrielmuller/kiloclaw-vscode 2026-04-20 08:20:04 -03:00