Commit Graph

14836 Commits

Author SHA1 Message Date
Alex Gold 63df2b7930 docs(kilo-docs): rewrite kiloclaw suggested-configuration as full setup walkthrough 2026-04-01 09:40:02 -04:00
Alex Gold 6f20b0b63f Merge branch 'main' of github.com:Kilo-Org/kilocode 2026-03-31 14:59:23 -04:00
Mark IJbema 4f26507d30 Merge pull request #7503 from Kilo-Org/mark/fix-include-subagent-costs-in-session-total
fix(vscode): include subagent costs in total session cost display
2026-03-31 19:23:45 +02:00
Mark IJbema c419752f25 test(vscode): extract cost breakdown into pure functions with unit tests
Extract buildFamilyCosts, buildFamilyLabels, and buildCostBreakdown
into session-utils.ts as pure functions with no store dependency.
Session.tsx memos now delegate to these functions.

20 new tests covering:
- buildFamilyCosts: empty family, multi-session summing, zero-cost
  filtering, missing messages
- buildFamilyLabels: subagent_type preference, description fallback,
  tool name fallback, label truncation, family boundary, dedup
- buildCostBreakdown: empty costs, root labeling, child labeling,
  session ID fallback for unlabeled children
2026-03-31 19:20:11 +02:00
Mark IJbema 6367d8effc refactor(vscode): split costBreakdown into familyCosts and familyLabels memos
Decouple cost computation (reads store.messages) from label extraction
(reads store.parts) so they recompute independently. Cost updates
(new assistant messages) no longer trigger the parts walk, and part
mutations (tool state changes) no longer re-sum costs.
2026-03-31 19:14:47 +02:00
Mark IJbema a1494e2015 fix(vscode): rename 'Parent session' to 'This session' in cost breakdown
More user-friendly label — users don't think in parent/child terms.
Updated all 18 locale files with translated equivalents.
2026-03-31 19:06:53 +02:00
Imanol Maiztegui d6eeb00b7b Migration error handling (#8010)
* feat(vscode): detect sessions in old extension

* feat(vscode): added session types

* feat(cli): add endpoints for inserting a session

* feat(vscode): use session types from sdk for parsing

* feat(kilo-vscode): parsing session project

* feat(vscode): parse legacy session details

* feat(kilo-vscode): refactoring

* feat(vscode): parse legacy session messages

* feat(vscode): parse legacy session parts

* feat(vscode): added testing files and id creation

* feat(vscode): merge tool parts on imported session

* feat(vscode): session message part refactoring

* feat(vscode): cover provider-specific reasoning parts on session migration

* feat(kilo-vscode): handle completion result parts

* feat: type hardening on session migration

* feat(kilo-vscode): create tool part correctly

* feat(kilo-vscode): adjust session part processing

* feat(vscode): persist migrated session in kilo.db

* feat(vscode): add error handling to session migration

* feat(vscode): add directory field to session migration

* feat(kilo-vscode): display completion check on session migration

* feat(vscode): prevent migrating sessions twice

* feat(cli): use correct project id when inserting migrated session

* feat(kilo-vscode): Use correct project id for session migration

* feat(kilo-vscode): load sessions on migration complete

* feat(kilo-vscode): ignore environment details user part when migrating sessions

* feat(cli): create project details following current backend logic

* feat(kilo-vscode): cleaner messages without environment_details parts

* feat(kilo-vscode): refactoring

* feat(kilo-vscode): refactoring and organization

* feat(kilo-vscode): method renaming to improve clarity

* feat(kilo-vscode): added session migration test strategy

* test(kilo-vscode): implement legacy migration unit tests for all migration modules

Replace todo stubs with full test implementations across messages,
parts, tools, reasoning, parser, migrate, project, and session test
files. Add new project.test.ts and session.test.ts covering project
construction, session metadata, and deterministic ID generation.

* style(kilo-vscode): apply prettier formatting across legacy migration source and test files

* fix(legacy-migration): filter out non-user/assistant entries before parsing messages

Exclude system and other non-conversational roles from the conversation
array prior to mapping, ensuring parentID references remain consistent
across imported messages when skipped entries exist.

* refactor(parts): skip part generation for non-conversational message roles

Entries with roles other than user or assistant should not produce
parts, keeping part output consistent with the messages that are
actually imported during legacy migration.

* fix(ids): use semantic kind strings to prevent part ID collisions for reasoning entries

Replace numeric indices with descriptive kind strings ("reasoning",
"provider-reasoning") in extra part ID generation to avoid collisions
between reasoning parts and regular content parts within the same
message.

Introduce `createExtraPartID` to distinguish reasoning-specific IDs
from standard sequential part IDs produced by `createPartID`.

* refactor(session-import): guard against empty worktree in legacy project import

Prevent silent misattribution of migrated sessions by rejecting empty
worktree paths before resolving the project directory. Without this
check, an empty string would fall back to the current process directory,
causing the imported session to be attached to the wrong project.

* perf(cli): cache MCP listTools results to avoid redundant RPCs per loop step (#7922)

MCP.tools() called client.listTools() for every connected server on
every agent loop iteration. With multiple servers this added hundreds
of milliseconds of overhead per step (measured ~300-750ms for remote
servers like Vercel).

Cache listTools results in a module-level Map and return them on
subsequent calls. The cache is invalidated on:
- ToolListChangedNotification from the MCP server
- Server add/connect/disconnect
- Instance dispose (config change, project switch, shutdown)

* fix(agent-manager): add retries to worktree cleanup for macOS .app bundles (#7921)

* chore: hide non-English localization files in GitHub PR diffs

Mark all non-English i18n locale files as linguist-generated=true so
they are collapsed by default in GitHub PR diffs, reducing noise when
reviewing changes that touch translation files.

* feat(vscode): add Browse Marketplace button to MCP settings

Add a "Browse Marketplace" button to the MCP Servers subtab in Agent
Behaviour settings, guiding users to discover and install MCPs from the
marketplace rather than only configuring them manually.

- Add button above the MCP server list that opens the Marketplace panel
- Add openMarketplacePanel webview message type and handler
- Add translations for all 18 supported languages

* fix(vscode): preserve project directory when opening marketplace from settings

Pass the current panel's project directory through to the marketplace
panel so project-scoped MCP installs work correctly in multi-root
workspaces. Without this, the marketplace panel would fall back to
null project directory since there is no active text editor when
clicking from a webview.

* feat(vscode): add Browse Marketplace button to agents and skills tabs

Add the Browse Marketplace button to the Agents and Skills subtabs in
Agent Behaviour settings, matching the existing button in the MCP
Servers subtab. This lets users discover marketplace items from any
of the three configuration tabs.

- Agents tab: added as a ghost button in the header row alongside
  Import and Create Mode buttons
- Skills tab: added as a secondary button at the top-right, matching
  the MCP tab layout
- Extracted the browse handler to the component scope for reuse

* chore: update kilo-vscode visual regression baselines

* perf(agent-manager): extend slimPart to strip heavy tool metadata for faster session switching (#7927)

Extend slim-metadata.ts to handle apply_patch, multiedit, write, and bash
tools in addition to edit. Previously only edit tool parts had their heavy
metadata stripped before IPC serialization. apply_patch parts carried full
file before/after contents per file, write parts carried the entire written
file, and bash parts carried up to 30KB of output — all serialized on every
session switch.

This reduces session-switch time by ~2x for sessions with many tool calls.

* style(legacy-migration): reformat long reasoning push call for readability

* refactor(legacy-migration): filter non-user/assistant entries before indexing

Move the role filter from inside `parseParts` to `parsePartsFromConversation`
so that message indices are derived only from the filtered list. This ensures
part message IDs stay aligned with the imported messages and skipped entries
(e.g. system role) do not cause index gaps in the generated IDs.

* fix(legacy-migration): add `_migrated_` infix to generated IDs

Prefix all migrated entity IDs (sessions, messages, parts) with a
`_migrated_` segment so they are clearly distinguishable from IDs
produced by the regular runtime. Updates tests to assert the new
prefix format.

* refactor(legacy-migration): consolidate conversation parsing into `parseSession`

Remove the intermediate `createMessages` and `createParts` async
wrappers that each independently read and parsed the conversation
file. The file is now fetched and parsed once in `parseSession`,
with the resulting conversation passed directly to
`parseMessagesFromConversation` and `parsePartsFromConversation`,
eliminating redundant I/O.

* fix(parts-builder): remove `toTextWithinMessage` and use `toText` directly

`toTextWithinMessage` was a duplicate of `toText` with identical
behavior. Replace all call sites with `toText` and delete the
redundant function.

* fix(parts-builder): skip provider-specific reasoning when explicit reasoning entry exists

Guard `isProviderSpecificReasoning` with `!isReasoning` to prevent
duplicate reasoning parts when an entry carries both a `type:
"reasoning"` field and a provider-specific reasoning field (e.g.
`reasoning_content`). The explicit reasoning entry takes precedence.

* test(legacy-migration): add coverage for edge cases in parts and tools parsing

Add unit tests for two previously uncovered scenarios:

- Task block extraction: verify only the content inside `<task>` tags
  is kept when text exists outside the legacy task wrapper
- Empty tool result: verify the tool name is used as fallback output
  when `tool_result` carries no readable text content

Also replace the dynamic `FileType.Directory` workaround with the
direct `vscode.FileType.Directory` enum reference, and harden
`parseFile` to throw on non-array JSON instead of silently returning
an empty array.

* fix(migration): require all items to succeed before marking migration complete

Tighten the completion condition so migration is only marked "completed"
when every item succeeds, not just when at least one does. Introduce a
dedicated "error" phase in the wizard UI so partial failures are surfaced
clearly rather than silently collapsed into the "done" state.

- `handleStartLegacyMigration`: gate `setMigrationStatus("completed")` on
  `!failed && success` instead of `success` alone
- `migrate`: propagate the actual `Error.message` from a failed session
  migration instead of a generic fallback string
- `MigrationWizard`: add `"error"` phase, show per-group error messages
  inline, add a "Continue" button to proceed past the error screen, and
  trigger `loadSessions` on completion
- `migration.css`: add `.migration-wizard__error-text` style using
  `--vscode-errorForeground`

* fix(migration): defer disposeGlobal and loadSessions until after error check

Move `disposeGlobal` call inside the success-only branch so the
extension is not torn down when migration partially fails. Similarly,
defer the `loadSessions` webview message to the "Continue" button on
the error screen so sessions are only reloaded after the user
acknowledges the failure.

- `handleStartLegacyMigration`: move `disposeGlobal` inside the
  `!failed && success` guard to avoid disposing on partial failure
- `MigrationWizard`: skip `loadSessions` post-message when errors are
  present; send it from the "Continue" button instead

* refactor(migration): extract MigrationError component and error selector utilities

Replace inline error text rendering in MigrationWizard with a dedicated
MigrationError component that displays a structured error box with a
copy-to-clipboard action. Extract error parsing logic into reusable
selector functions in a separate module.

- Add `MigrationError` component with header, detail text, and
  preformatted error code block; copy button writes error to clipboard
  and shows a success toast
- Add `error-selectors.ts` with `getMigrationError` (strips error type
  prefix), `getSessionMigrationError`, and `getSessionMigrationErrorDetail`
- Replace `<Show>` + raw `error-text` div in MigrationWizard sessions
  row with `<MigrationError>` using the new selector-derived signals

* feat(migration): introduce view-model module for migration state derivations

Extract `ProgressEntry` type and inline derived-state functions from
`MigrationWizard` into a dedicated `migration-view-model.ts` module,
and update call sites to use the new public API.

- Add `migration-view-model.ts` exporting `ProgressEntry`, `getGroupStatus`,
  `getGroupMessage`, `getSuccessCount`, `getTotalCount`,
  `getCurrentSessionError`, and `getCurrentSessionErrorDetail`
- Remove duplicated logic from `MigrationWizard` and delegate to the
  new module, keeping the component focused on rendering concerns
- Consolidate the `getGroupMessage` resolver used by error selectors so
  it is derived from a single source of truth

* refactor(legacy-migration): split shared types into dedicated modules

Move `MigrationResultItem` out of `legacy-types.ts` into a new
`migration-types.ts` module, and introduce a `MigrationFailure`
typed error structure in `errors/migration-failure.ts`.

- Add `migration-types.ts` exporting `MigrationResultItem` to separate
  runtime migration result types from legacy configuration types
- Add `errors/migration-failure.ts` defining `MigrationFailure` and
  `MigrationFailureKind` for structured error classification
- Remove `MigrationResultItem` from `legacy-types.ts` to eliminate
  the coupling between legacy config shapes and migration output types
- Update `migration-service.ts` import to reference the new module

* feat(errors): add migration error normalization utilities

Introduce `migration-error.ts` with `normalizeMigrationError` and
`getMigrationErrorMessage` to convert arbitrary thrown values into
typed `MigrationFailure` objects.

- Classify errors by kind (`http`, `sdk`, `generic`, `unknown`) based
  on the presence of `status`, `data`, `body`, or `Error` instance
- Extract human-readable message from `message`, `body`, `data`, or
  raw string fallback, defaulting to "Unknown migration error"
- Compose a `detail` string from status code, body, and data fields
  when they differ from the primary message
- Propagate nested `cause` text for additional diagnostic context

* refactor(migrate): wrap migrate return in typed Result and normalize errors

* chore(migration): inline view-model helpers and remove extracted modules

Remove the separately extracted `migration-view-model.ts`, `error-selectors.ts`,
`MigrationError.tsx`, and `MigrationFailure` type in favour of inlined logic
directly in `MigrationWizard` and a simplified `getMigrationErrorMessage`
utility.

- Delete `MigrationFailure` type and `normalizeMigrationError`; replace with
  a flat `getMigrationErrorMessage` function
- Inline `ProgressEntry` interface, group-status logic, and count helpers
  into `MigrationWizard`
- Replace `MigrationError` component with inline clipboard copy handler
  using `showToast`
- Simplify session migrate result shape: drop structured `error` field,
  surface plain `message` string instead

* feat(i18n): add migration error copy-to-clipboard translations across all locales

* style(migration): add error box and copy button styles for migration wizard

Add CSS for the error display box and copy-to-clipboard button in the
migration wizard, including layout, typography, theming via VSCode CSS
variables, hover/active/focus-visible states, and high-contrast border
overrides. Also align wizard items to flex-start for multi-line content.

* fix: merge conflict issues resolved

* fix: formatting

* i18n(migration): add localized strings for session migration progress and errors

* fix:formatting

* feat(session-import): remove temporary test error from project import

* fix(vscode): remove unused migration progress translations

* fix: formatting

* fix(migration): track individual session progress instead of grouping all sessions

Replace the single "Chat sessions" progress item with per-session
tracking, passing the session ID directly to onProgress calls and
mapping each session to its own pending item in the wizard's progress
list.

* fix: formatting

---------

Co-authored-by: Marius <marius@kilocode.ai>
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
Co-authored-by: Mark IJbema <mark@kilocode.ai>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-03-31 19:06:51 +02:00
Mark IJbema 24709aa7ff fix(vscode): return cost breakdown for standalone sessions too
The family.size <= 1 early-return caused costBreakdown to return []
for sessions without subagents, making TaskHeader sum to 0 and hide
the cost badge entirely. Remove the guard so single-session cost is
still reported.
2026-03-31 18:53:20 +02:00
Mark IJbema 07f3d06b6c Merge pull request #8012 from Kilo-Org/docs/prune-migration-plan-completed-items
docs(vscode): prune completed items from migration plan
2026-03-31 18:44:08 +02:00
kiloconnect[bot] 368aef12b5 feat(i18n): add context.stats.parentSession translations across locales
add new i18n key context.stats.parentSession across locales
to display the parent session in the UI across languages
2026-03-31 16:41:27 +00:00
Mark IJbema 7b738b8c67 refactor(vscode): remove totalCost, derive from costBreakdown at callsite
totalCost was a redundant memo that duplicated the same sessionFamily
walk already done by costBreakdown. TaskHeader now sums the breakdown
entries directly, eliminating the extra accessor from the context.
2026-03-31 18:38:27 +02:00
Marius ce2c4ecf8c fix(agent-manager): prevent model comparison popover from dismissing on interaction (#8014)
* fix(agent-manager): prevent model comparison popover from dismissing on interaction

Harden Popover dismiss logic against SolidJS DOM detachment during
reactive updates that caused the multi-model selector to close on every
click (Windows). Disable Kobalte built-in interact/focus-outside
dismissal in favor of custom window-level handlers with isConnected and
relatedTarget guards. Change compare popover placement to top-start with
flip disabled.

Closes #7990

* fix(ui): drop relatedTarget guard that blocked keyboard focus-outside dismiss

The isConnected check already handles SolidJS DOM detachment. The
relatedTarget guard prevented closing when tabbing out because the
element losing focus was still inside the popover.
2026-03-31 18:17:50 +02:00
Marius 6778099552 fix(vscode): wire continueInWorktreeHandler for tab panels (#8013)
Tab KiloProvider instances (Open in Tab and TabPanel deserializer) were
missing setContinueInWorktreeHandler, causing "Continue in Worktree" to
silently no-op and leave the spinner stuck on "Capturing changes..." forever.

Wire the handler for both openKiloInNewTab and the tab deserializer, and
add a defensive error fallback in KiloProvider when the handler is null.
2026-03-31 18:16:59 +02:00
Mark IJbema c0cf8dface fix(vscode): render cost breakdown tooltip as JSX with proper line breaks
- Use <div> per entry instead of newline-joined string (Tooltip value
  prop accepts JSX, not plain text with newlines)
- Prefer subagent_type over description for shorter labels
- Truncate labels longer than 24 chars
- Add white-space: nowrap to prevent wrapping within entries
2026-03-31 17:50:13 +02:00
kiloconnect[bot] bcbd2b423b docs(vscode): prune completed items from migration plan
- Remove Settings Migration, Upgrade Onboarding, and MemoryBank Migration
  docs (all covered by the migration wizard shipped in #7823)
- Remove custom-openai-provider-ui.md (feature shipped)
- Update MCP docs: remove connection status and enable/disable toggle
  (shipped in #7810)
- Update settings-ui.md: remove import/export (shipped in #7794)
- Update opencode-migration-plan.md accordingly
2026-03-31 15:48:20 +00:00
Mark IJbema 0628696c18 feat(vscode): show per-subagent cost breakdown in tooltip
When a session has subagent costs, the cost tooltip in the task header
now shows a line-by-line breakdown (e.g. 'Parent session: $0.12',
'Code review: $0.08'). Labels come from the task tool's input
description or subagent_type. When there's only one session (no
subagents), falls back to the simple 'Session cost' tooltip.
2026-03-31 17:46:06 +02:00
Mark IJbema 39be9f9f1f Merge pull request #8001 from Kilo-Org/fix/skill-directory-precedence
fix(cli): fix global skills overriding project skills (precedence reversed)
2026-03-31 17:37:49 +02:00
Mark IJbema a59c59e66c fix(vscode): use sessionFamily BFS to sum subagent costs correctly
The previous approach searched store.sessions by parentID, but child
sessions are not reliably present in store.sessions (they arrive via
SSE and syncSession, not the initial sessions list). This caused the
totalCost to miss subagent costs entirely—or even show a lower total
than a single subagent's cost.

Switch to sessionFamily() which does a BFS walk through tool parts to
discover all descendant session IDs, then sum costs from their messages
in the store. This is the same proven mechanism used for scoped
permissions, questions, and familyData.
2026-03-31 17:32:33 +02:00
Mark IJbema 46daecebb1 refactor: restrict PR to vscode changes only, revert cli/app/acp changes 2026-03-31 17:25:48 +02:00
Mark IJbema a278926789 Merge branch 'main' into mark/fix-include-subagent-costs-in-session-total 2026-03-31 17:23:22 +02:00
Imanol Maiztegui 80f187ebba feat(kilo-vscode): migrate legacy sessions into new extension (#7924)
* feat(vscode): detect sessions in old extension

* feat(vscode): added session types

* feat(cli): add endpoints for inserting a session

* feat(vscode): use session types from sdk for parsing

* feat(kilo-vscode): parsing session project

* feat(vscode): parse legacy session details

* feat(kilo-vscode): refactoring

* feat(vscode): parse legacy session messages

* feat(vscode): parse legacy session parts

* feat(vscode): added testing files and id creation

* feat(vscode): merge tool parts on imported session

* feat(vscode): session message part refactoring

* feat(vscode): cover provider-specific reasoning parts on session migration

* feat(kilo-vscode): handle completion result parts

* feat: type hardening on session migration

* feat(kilo-vscode): create tool part correctly

* feat(kilo-vscode): adjust session part processing

* feat(vscode): persist migrated session in kilo.db

* feat(vscode): add error handling to session migration

* feat(vscode): add directory field to session migration

* feat(kilo-vscode): display completion check on session migration

* feat(vscode): prevent migrating sessions twice

* feat(cli): use correct project id when inserting migrated session

* feat(kilo-vscode): Use correct project id for session migration

* feat(kilo-vscode): load sessions on migration complete

* feat(kilo-vscode): ignore environment details user part when migrating sessions

* feat(cli): create project details following current backend logic

* feat(kilo-vscode): cleaner messages without environment_details parts

* feat(kilo-vscode): refactoring

* feat(kilo-vscode): refactoring and organization

* feat(kilo-vscode): method renaming to improve clarity

* feat(kilo-vscode): added session migration test strategy

* test(kilo-vscode): implement legacy migration unit tests for all migration modules

Replace todo stubs with full test implementations across messages,
parts, tools, reasoning, parser, migrate, project, and session test
files. Add new project.test.ts and session.test.ts covering project
construction, session metadata, and deterministic ID generation.

* style(kilo-vscode): apply prettier formatting across legacy migration source and test files

* fix(legacy-migration): filter out non-user/assistant entries before parsing messages

Exclude system and other non-conversational roles from the conversation
array prior to mapping, ensuring parentID references remain consistent
across imported messages when skipped entries exist.

* refactor(parts): skip part generation for non-conversational message roles

Entries with roles other than user or assistant should not produce
parts, keeping part output consistent with the messages that are
actually imported during legacy migration.

* fix(ids): use semantic kind strings to prevent part ID collisions for reasoning entries

Replace numeric indices with descriptive kind strings ("reasoning",
"provider-reasoning") in extra part ID generation to avoid collisions
between reasoning parts and regular content parts within the same
message.

Introduce `createExtraPartID` to distinguish reasoning-specific IDs
from standard sequential part IDs produced by `createPartID`.

* refactor(session-import): guard against empty worktree in legacy project import

Prevent silent misattribution of migrated sessions by rejecting empty
worktree paths before resolving the project directory. Without this
check, an empty string would fall back to the current process directory,
causing the imported session to be attached to the wrong project.

* perf(cli): cache MCP listTools results to avoid redundant RPCs per loop step (#7922)

MCP.tools() called client.listTools() for every connected server on
every agent loop iteration. With multiple servers this added hundreds
of milliseconds of overhead per step (measured ~300-750ms for remote
servers like Vercel).

Cache listTools results in a module-level Map and return them on
subsequent calls. The cache is invalidated on:
- ToolListChangedNotification from the MCP server
- Server add/connect/disconnect
- Instance dispose (config change, project switch, shutdown)

* fix(agent-manager): add retries to worktree cleanup for macOS .app bundles (#7921)

* chore: hide non-English localization files in GitHub PR diffs

Mark all non-English i18n locale files as linguist-generated=true so
they are collapsed by default in GitHub PR diffs, reducing noise when
reviewing changes that touch translation files.

* feat(vscode): add Browse Marketplace button to MCP settings

Add a "Browse Marketplace" button to the MCP Servers subtab in Agent
Behaviour settings, guiding users to discover and install MCPs from the
marketplace rather than only configuring them manually.

- Add button above the MCP server list that opens the Marketplace panel
- Add openMarketplacePanel webview message type and handler
- Add translations for all 18 supported languages

* fix(vscode): preserve project directory when opening marketplace from settings

Pass the current panel's project directory through to the marketplace
panel so project-scoped MCP installs work correctly in multi-root
workspaces. Without this, the marketplace panel would fall back to
null project directory since there is no active text editor when
clicking from a webview.

* feat(vscode): add Browse Marketplace button to agents and skills tabs

Add the Browse Marketplace button to the Agents and Skills subtabs in
Agent Behaviour settings, matching the existing button in the MCP
Servers subtab. This lets users discover marketplace items from any
of the three configuration tabs.

- Agents tab: added as a ghost button in the header row alongside
  Import and Create Mode buttons
- Skills tab: added as a secondary button at the top-right, matching
  the MCP tab layout
- Extracted the browse handler to the component scope for reuse

* chore: update kilo-vscode visual regression baselines

* perf(agent-manager): extend slimPart to strip heavy tool metadata for faster session switching (#7927)

Extend slim-metadata.ts to handle apply_patch, multiedit, write, and bash
tools in addition to edit. Previously only edit tool parts had their heavy
metadata stripped before IPC serialization. apply_patch parts carried full
file before/after contents per file, write parts carried the entire written
file, and bash parts carried up to 30KB of output — all serialized on every
session switch.

This reduces session-switch time by ~2x for sessions with many tool calls.

* style(legacy-migration): reformat long reasoning push call for readability

* refactor(legacy-migration): filter non-user/assistant entries before indexing

Move the role filter from inside `parseParts` to `parsePartsFromConversation`
so that message indices are derived only from the filtered list. This ensures
part message IDs stay aligned with the imported messages and skipped entries
(e.g. system role) do not cause index gaps in the generated IDs.

* fix(legacy-migration): add `_migrated_` infix to generated IDs

Prefix all migrated entity IDs (sessions, messages, parts) with a
`_migrated_` segment so they are clearly distinguishable from IDs
produced by the regular runtime. Updates tests to assert the new
prefix format.

* refactor(legacy-migration): consolidate conversation parsing into `parseSession`

Remove the intermediate `createMessages` and `createParts` async
wrappers that each independently read and parsed the conversation
file. The file is now fetched and parsed once in `parseSession`,
with the resulting conversation passed directly to
`parseMessagesFromConversation` and `parsePartsFromConversation`,
eliminating redundant I/O.

* fix(parts-builder): remove `toTextWithinMessage` and use `toText` directly

`toTextWithinMessage` was a duplicate of `toText` with identical
behavior. Replace all call sites with `toText` and delete the
redundant function.

* fix(parts-builder): skip provider-specific reasoning when explicit reasoning entry exists

Guard `isProviderSpecificReasoning` with `!isReasoning` to prevent
duplicate reasoning parts when an entry carries both a `type:
"reasoning"` field and a provider-specific reasoning field (e.g.
`reasoning_content`). The explicit reasoning entry takes precedence.

* test(legacy-migration): add coverage for edge cases in parts and tools parsing

Add unit tests for two previously uncovered scenarios:

- Task block extraction: verify only the content inside `<task>` tags
  is kept when text exists outside the legacy task wrapper
- Empty tool result: verify the tool name is used as fallback output
  when `tool_result` carries no readable text content

Also replace the dynamic `FileType.Directory` workaround with the
direct `vscode.FileType.Directory` enum reference, and harden
`parseFile` to throw on non-array JSON instead of silently returning
an empty array.

* feat(legacy-migration): remove session migration tracking from global state

Drop the `readSessionsToMigrate` filter and the post-migration
`globalState` flag that tracked which sessions had already been
migrated. Detection now returns all sessions found in global storage
without filtering by prior migration status.

* fix(session-import): skip duplicate session imports and child data

Check for an existing session row before inserting and return a
`skipped: true` flag when the session already exists. The migration
client honours this flag to bypass message and part imports, avoiding
redundant work when migration is re-run.

Replace `onConflictDoUpdate` with `onConflictDoNothing` on the session
insert path to align with the new pre-check behaviour. Propagate the
optional `skipped` field through the result types and generated SDK
types for project, session, message, and part responses.

* refactor(parts-builder): mark legacy system error text parts as ignored

Tag text parts whose content begins with `[ERROR]` with `ignored: true`
and a `legacy-system-error` metadata source. Introduces a new
`isLegacySystemErrorText` utility in `parts-util` to encapsulate the
detection logic.

* feat(parts-util): extract feedback text from tool_result content into visible parts

Parse `<feedback>` tags embedded in `tool_result` content and emit a
dedicated text part so user feedback is surfaced as a visible message
rather than buried inside tool result data.

Introduces `getFeedbackText` utility to extract and trim the inner
content of `<feedback>` blocks from arbitrary input.

* fix: formatting

---------

Co-authored-by: Marius <marius@kilocode.ai>
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
Co-authored-by: Mark IJbema <mark@kilocode.ai>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-03-31 17:13:34 +02:00
Christiaan Arnoldus 0d00e41da8 Merge pull request #7994 from Kilo-Org/fix/tool-call-without-tool-input-start
fix(cli): handle tool-call without prior tool-input-start event
2026-03-31 16:21:25 +02:00
Christiaan Arnoldus 52422a8dad Merge branch 'main' into fix/tool-call-without-tool-input-start 2026-03-31 16:19:07 +02:00
Filip Halaxa 154d111999 Fix typo in Linux x64 download link 2026-03-31 16:15:48 +02:00
Marian Alexandru Alecu f6e751a645 Merge pull request #7963 from Kilo-Org/fix/cli-self-config-tips
fix(cli): simplify self-config tips
2026-03-31 17:06:35 +03:00
Mark IJbema ccecf5f18f Merge branch 'main' into fix/skill-directory-precedence 2026-03-31 16:03:46 +02:00
Mark IJbema 512a433415 Merge pull request #7999 from Kilo-Org/fix/source-links-apertis
fix: regenerate source-links.md after Apertis provider addition
2026-03-31 15:58:48 +02:00
Christiaan Arnoldus 69bd0342c3 Merge branch 'main' into fix/tool-call-without-tool-input-start 2026-03-31 15:49:30 +02:00
Christiaan Arnoldus b0aa8acf1c Clarify comment 2026-03-31 15:47:45 +02:00
kiloconnect[bot] df7f48404c fix: narrow apertis lychee exclusion to exact /v1 path 2026-03-31 13:47:21 +00:00
kiloconnect[bot] b284562e1d fix: exclude apertis API base URL from link checker 2026-03-31 13:43:36 +00:00
kiloconnect[bot] f318bc3258 fix(cli): fix global skills overriding project skills in skillDirectories()
Swap order in KilocodePaths.skillDirectories() so global dirs (~/.kilo,
~/.kilocode, VSCode storage) are pushed first, followed by project-level
dirs. Since addSkill uses last-write-wins, project-level skills now
correctly take precedence over global skills.

Fixes #7886
2026-03-31 12:54:15 +00:00
Mark IJbema 6810bdd57a Merge pull request #7432 from Kilo-Org/mark/remove-beta-label
fix(vscode): remove beta label from welcome screen
2026-03-31 14:44:05 +02:00
kiloconnect[bot] 8491f53380 fix: regenerate source-links.md after Apertis provider addition 2026-03-31 12:44:05 +00:00
Mark IJbema 0578a23e99 Merge pull request #7205 from theQuert/feat/apertis-opencode-provider
feat: add Apertis to provider migration mapping
2026-03-31 14:41:48 +02:00
kiloconnect[bot] 7dcb26a76f fix(cli): handle tool-call without prior tool-input-start event
When a provider emits tool-call without a preceding tool-input-start
event, the tool call was silently dropped causing conversation history
corruption and 400 errors on subsequent API requests.

This change creates a fallback tool part in the tool-call handler when
tool-input-start was never emitted, ensuring the tool call is persisted
and included in conversation history.
2026-03-31 12:36:47 +00:00
Marius 8dfb98ea67 fix(sdk): pass duplex in fetch init to survive VS Code proxy-agent wrapper (#7942)
* fix(sdk): pass duplex in fetch init to survive VS Code proxy-agent wrapper

VS Code's vscode-proxy-agent wraps globalThis.fetch and, when proxy or
certificate support is active, calls originalFetch(request, { ...init,
dispatcher }). The previous fix set duplex on the config which propagated
to new Request() construction, but the custom fetch wrapper called
fetch(request) with no init arg. The proxy wrapper then created a new
init without duplex, causing undici to throw on Windows machines with
corporate proxy/cert settings.

Pass { duplex: 'half' } as the explicit init argument in the custom
fetch wrapper so it survives the proxy-agent spread.

Fixes #7847, #7872

* fix(sdk): include timeout in fetch init to preserve Bun timeout override

Address bot review: passing an init arg to fetch() causes Bun to clone
the Request, dropping the req.timeout = false property. Move timeout
into the init object so it survives the clone.
2026-03-31 13:58:16 +02:00
kilo-maintainer[bot] 9fd9ffd8f0 release: v7.1.11 2026-03-31 11:02:44 +00:00
Mark IJbema ccd4574b93 Merge pull request #7978 from Kilo-Org/fix/windows-session-directory-casing
fix(cli): normalize directory path when listing sessions to fix Windows drive letter casing
2026-03-31 12:08:35 +02:00
kiloconnect[bot] 00e6252d38 fix(cli): normalize directory path when listing sessions to fix Windows case mismatch
On Windows, VS Code's uri.fsPath returns lowercase drive letters (e.g. c:\...)
while Filesystem.resolve() canonicalises them to uppercase (C:\...) via
realpathSync.native. Sessions are stored with the resolved path but queried
with the raw fsPath, so SQLite's binary equality check never matches and no
sessions are shown after restart.

Apply Filesystem.resolve() to the directory filter in Session.list and
Session.listGlobal so both sides use the same canonical form.
2026-03-31 09:55:20 +00:00
Mark IJbema b12ab1c11b Merge pull request #7976 from Kilo-Org/fix/translation-notifications-action
fix(i18n): translate notifications.action strings properly
2026-03-31 11:55:12 +02:00
kilo-maintainer[bot] 64f6ca8962 release: v7.1.10 2026-03-31 09:49:05 +00:00
kiloconnect[bot] 4f85474873 fix(i18n): translate notifications.action strings properly 2026-03-31 09:38:24 +00:00
Christiaan Arnoldus 27e6228232 Merge pull request #7971 from Kilo-Org/session/agent_ab4d50f6-2609-4d1d-97fd-d24b2ba5c30d
fix(vscode): show friendly model name in notification "Try model" button
2026-03-31 11:31:47 +02:00
Evgeny Shurakov eb4e5705ac Merge pull request #7941 from Kilo-Org/eshurakov/eshurakov/websocket-hearbeat-monitor
KiloSessions - Add WebSocket activity watchdog with heartbeat ack
2026-03-31 11:13:29 +02:00
Christiaan Arnoldus 86207a723f Do not remove Free 2026-03-31 11:03:23 +02:00
Mark IJbema 85f04045fa Merge pull request #7973 from Kilo-Org/subsequent-lip
chore: enforce LF line endings via .gitattributes
2026-03-31 10:30:14 +02:00
Evgeny Shurakov 227e53bc0d Merge pull request #7954 from Kilo-Org/eshurakov/eshurakov/remote-config
CLI - Add remote_control Config Option
2026-03-31 10:17:29 +02:00
Mark IJbema 2d43901d3a chore: enforce LF line endings via .gitattributes 2026-03-31 10:09:25 +02:00
kiloconnect[bot] 3558f5e84b fix(vscode): show friendly model name in notification "Try model" button
Replace static "Try model" text with "Try <model name>" using the
model catalog display name. The i18n template now uses {{model}}
interpolation across all 18 locales.
2026-03-31 07:47:59 +00:00