Commit Graph

181 Commits

Author SHA1 Message Date
marius-kilocode a59b255b31 fix(cli): restore automatic session titles 2026-06-08 13:03:28 +02:00
marius-kilocode aeef0df2f9 resolve merge conflicts 2026-06-02 16:13:31 +02:00
marius-kilocode 4472e6d769 refactor: kilo compat for v1.14.46 2026-06-02 13:51:23 +02:00
marius-kilocode 0f271a39d7 resolve merge conflicts 2026-06-01 15:20:54 +02:00
marius-kilocode 7cc6080646 refactor: kilo compat for v1.14.42 2026-06-01 12:51:31 +02:00
Imanol Maiztegui 39a7305c97 Effect Migration for Kilo callsites (follow-up) (#10587)
* refactor(opencode): migrate ModelCache and Config to effect-native services

Remove legacy async wrapper functions from Config module and convert
ModelCache from a stateful namespace with module-level Maps into a
proper Effect service with Context/Layer semantics.

Key changes:
- Delete Config's `makeRuntime`-based async wrappers (get, getGlobal,
  update, warnings, etc.) — all callsites now use
  `Config.Service.use(...)` through AppRuntime
- Rewrite ModelCache as an Effect service with HttpClient dependency
  injection, replacing imperative Map-based caching with Effect-native
  Ref cells and TTL logic
- Convert KiloSessions.init and KilocodeBootstrap.init into proper
  Effect services with Layer-based dependency injection
- Wire ModelCache.Service into AppLayer, ProviderAuth, ModelsDev, and
  HTTP API handler layers
- Update Permission.layer to depend on Config.Service directly instead
  of calling Config async wrappers
- Add new test files for KiloSessions and ModelCache Effect integration
- Remove stale Config.get spyOn mocks from tests that no longer need
  them (experimental-session-list, recall)
- Fix indexing-auth to use typed IndexingConfig parameter instead of
  untyped record access

* fix(model-cache): resolve race conditions in concurrent fetch and cache invalidation

Introduce versioned cache cells with proper key derivation to prevent
stale responses from overwriting fresher data during concurrent fetches.

- Add version tracking to detect and discard outdated fetch results
- Derive cache keys from provider-specific options (baseURL, token, apiKey)
  to isolate concurrent requests with different credentials
- Make ModelCache.clear async to properly await invalidation across layers
- Update OrganizationDeps.clear signature to allow Promise<void> return
- Add concurrency and ordering tests for fetch/refresh race scenarios
- Rename local variable from `state` to `entry` in kilo-sessions sync loop

* chore(opencode): remove duplicate imports and fix test layer composition

Remove duplicate `AppRuntime` imports introduced during merge and update
kilo-sessions tests to use Effect-native Auth service instead of static
module calls.

- Remove duplicate `AppRuntime` import in index.ts and instance.ts
- Add Auth.defaultLayer to test layer helper
- Refactor test to yield Auth.Service and use instance methods
- Reorder Effect.provide/Effect.ensuring for correct resource cleanup

* style(opencode): normalize kilocode_change marker comments to block format

Standardize inline `// kilocode_change` annotations across source and
test files to use consistent `// kilocode_change start` / `// kilocode_change end`
block delimiters, improving readability and grep-ability of custom
modifications.
2026-05-27 11:43:32 +02:00
Imanol Maiztegui bacfa4ae62 Effect Migration for Kilo callsites (#10572)
* refactor(opencode): migrate agent promise helpers to kilocode module and adopt Effect-based tests

Remove legacy promise-based helpers (`get`, `list`, `defaultAgent`, `remove`)
from the core agent module and update callsites to use the dedicated
`@/kilocode/agent` module directly. Migrate kilocode-specific tests from
`WithInstance.provide` patterns to the `testEffect` helper with Effect
generators for cleaner, more idiomatic test code.

- Remove `makeRuntime` import and exported promise helpers from agent.ts
- Update HTTP API handlers to import from `@/kilocode/agent` instead of
  re-exported `Agent` namespace
- Rewrite agent tests to use `load()` helper or Effect service access
- Convert agent-global-config-dirs and agent-skill-permissions tests to
  `testEffect` pattern
- Reorder SDK type definitions (BackgroundProcessLogs/WorkspaceWarpError)

* chore(auth): remove legacy promise helpers and replace with direct Effect service access

Eliminate the exported promise-based convenience functions (`get`, `all`,
`set`, `remove`) from the Auth module and replace all callsites with
explicit `AppRuntime.runPromise` or `makeRuntime` invocations that access
`Auth.Service` directly through Effect's service pattern.

- Delete `makeRuntime`-backed promise helpers from auth/index.ts
- Update CLI entrypoint, kilo-sessions, indexing, and server instance to
  use `AppRuntime.runPromise(Auth.Service.use(...))` for auth access
- Inject `Auth.Service` as a dependency into the ModelsDev layer and
  consume it via Effect generator instead of promise wrapper
- Create a local `makeRuntime` instance in model-cache.ts for non-Effect
  callsites that still need promise-based auth access
- Rewrite tests to manipulate auth.json directly on disk with proper
  save/restore semantics instead of relying on removed helpers

* refactor(suggestion): convert suggest tool to Effect-native with injected Command dependency

Transform the suggestion tool from async/promise-based implementation to
idiomatic Effect generators with explicit dependency injection of the
Command service rather than importing and calling module-level helpers.

- Convert `resolvePrompt` from async function to Effect generator that
  accepts a `Command.Interface` parameter
- Refactor `SuggestTool` definition to yield `Command.Service` from the
  Effect context and thread it through to `resolvePrompt`
- Add `Command.Service` as a dependency to the tool registry layer and
  provide `Command.defaultLayer` in both production and test wiring
- Remove unused `makeRuntime` import and exported `get` helper from
  command/index.ts
- Add explicit type annotations to Auth delegate in server instance
- Rewrite suggestion tests to use `testEffect` helper with a mock
  `Command.Service` layer instead of spying on module exports

* feat(git): migrate WorktreeFamily to Effect service and wire Git.Service as dependency

Convert WorktreeFamily.list from an async function using legacy promise
helpers to an Effect generator that yields Git.Service from context,
eliminating the need for the removed `run` promise wrapper in git/index.

- Replace `WorktreeFamily.list()` async function with Effect.fn generator
  that obtains Git.Service and InstanceState from the Effect context
- Remove legacy `makeRuntime`/`run`/`runPromise` exports from git module
- Update RecallTool to thread Git.Service through to WorktreeFamily calls
  via EffectBridge
- Add Git.Service as a required dependency in tool registry and HTTP
  server route layers
- Update all test layers to provide Git.defaultLayer

* chore(mcp): replace legacy promise helpers with Effect-native AppRuntime calls

Remove exported promise-based `status`, `connect`, and `disconnect`
helpers from MCP module and convert the network recovery callsite in
SessionNetwork to use AppRuntime.runPromise with Effect.gen directly.

* refactor(auth): adopt makeRuntime helper for Auth service resolution in kilo modules

Replace AppRuntime.runPromise with locally scoped makeRuntime instances
in kilo-sessions and kilocode/indexing modules, removing the dependency
on the global AppRuntime singleton for Auth service access.

* fix(test): simplify cleanup error handling in provider test

Replace try-catch block with promise .catch() for file unlink operation
during test teardown.
2026-05-26 12:51:21 +02:00
Imanol Maiztegui b6523c0d91 resolve merge conflicts 2026-05-22 09:01:40 +02:00
Imanol Maiztegui f7816a9eeb refactor: kilo compat for v1.14.41 2026-05-21 14:48:36 +02:00
Imanol Maiztegui 4523bf99cb feat(opencode): rename InstanceStore to InstanceRuntime and refine model schema
Rename the `InstanceStore` module to `InstanceRuntime` across all consumer
sites to better reflect its role as a runtime lifecycle manager rather than
a persistence layer. Update the kilo-gateway route dependency key from
`InstanceStore` to `Instances` for clarity.

Additional changes:
- Replace `Schema.Number` with `Schema.Finite` for `recommendedIndex` in
  both the provider and models schemas
- Inject `InstanceStore.Service` into the ProviderAuth layer and use its
  `disposeAll()` method instead of escaping to a raw promise
- Remove obsolete `getBootstrapRunEffect` usage from indexing startup tests
- Add missing `warnings` method to the test config fixture
2026-05-19 11:37:49 +02:00
Imanol Maiztegui 128df55d6b fix(opencode): migrate Instance.provide calls to WithInstance.provide
Replace direct `Instance.provide` usage with `WithInstance.provide` across
source modules and test files to decouple runtime context provisioning
from the core Instance singleton.

- Update kilo-sessions, remote-sender, roll-call, and plan-followup source
- Remove unused `Instance` imports where only `WithInstance` is needed
- Drop unnecessary `init` param from indexing-worktree test calls
- Add missing `WithInstance` import in fixture-dependent test files
2026-05-18 18:32:30 +02:00
Imanol Maiztegui e68fd6781d resolve merge conflicts 2026-05-15 13:13:17 +02:00
Imanol Maiztegui b7a7ecf449 refactor: kilo compat for v1.14.34 2026-05-15 09:25:13 +02:00
Christiaan Arnoldus 2d2cf1f708 Merge pull request #8263 from VastCosmic/fix/openai-compat-reasoning-params
fix: gate OpenAI Responses API params for openai-compatible providers
2026-05-07 14:20:50 +02:00
Mark IJbema d2e21c5006 fix(cli): address CI test failures
- InstanceStore: run Instance.provide init inside the ALS context so KilocodeBootstrap (and any forkDetach work it spawns like KiloIndexing.init) can read Instance.directory. Upstream refactor moved init out of the ALS scope; kilo-main's pre-merge Instance.provide wrapped it. Without this, KiloIndexing.init silently fails with "No context found for instance".
- kilocode/agent: thread worktree through planGuard/patchAgents instead of reading Instance.worktree at agent state construction time. Agent state is built inside Effect (no ALS) via InstanceState.make — reading the ALS-backed Instance.worktree there crashed under the new architecture.
- kilocode/agent: drop the "*": "ask" from explore external_directory — defaults already provides it, and redefining here overwrites the tmp/skill allowlist via findLast().
- test/server/httpapi-instance.test.ts: revert the ported Hono-bridge tests. Upstream put the same tests in httpapi-instance.legacy.test.ts (renamed file); the port duplicated them.
- test/server/httpapi-instance.legacy.test.ts: mark the catalog test test.skip with Kilo's original rationale (/agent 500s via the bridge; the bridge is not enabled in any production client).
- test/server/httpapi-ui.test.ts: delete. Tests upstream's proxy-to-app.opencode.ai fallback that Kilo intentionally removed (src/server/routes/ui.ts kilocode_change).
- test/server/httpapi-raw-route-auth.test.ts: basic("opencode", ...) → basic("kilo", ...) to match the Kilo username default.
- test/provider/models.test.ts: skip describe block. Upstream tests assert raw-fixture passthrough but Kilo's ModelsDev.get() filters/injects providers based on Config.get(), which needs an Instance context the test doesn't provide.
2026-05-06 22:25:16 +02:00
Mark IJbema 1ea9ad2af0 resolve merge conflicts 2026-05-06 21:32:26 +02:00
VastCosmic eede3e46c8 fix: minimize OpenAI responses params conflict resolution 2026-05-06 18:36:22 +08:00
Mark IJbema a77843cbab refactor: kilo compat for v1.14.33 2026-05-06 12:13:06 +02:00
VastCosmic 9f81004c2b fix: resolve OpenAI responses params merge conflicts 2026-05-06 18:06:50 +08:00
Mark IJbema 1ba2980cad resolve merge conflicts 2026-05-05 15:11:52 +02:00
Mark IJbema 2701776e21 refactor: kilo compat for v1.14.30 2026-05-05 12:50:48 +02:00
opencode-agent[bot] b3a7513765 chore: generate 2026-05-02 18:00:11 +00:00
Kit Langton f8738c9002 feat(models): effectify ModelsDev as Service (#25434) 2026-05-02 13:59:08 -04:00
Kit Langton 4c4860fb24 Replace Instance.disposeAll/load with fixture helper (#25418) 2026-05-02 10:56:15 -04:00
Kit Langton d99dde6306 Migrate test inits from Promise to Effect (#25377) 2026-05-02 09:07:59 -04:00
Mark IJbema 3f7037549e resolve merge conflicts 2026-04-30 16:25:46 +02:00
Aiden Cline a740d2c667 fix: adjust azure defaults to closer match openai to prevent Item .. of type 'reasoning' was provided without its required following item (#25007) 2026-04-29 16:49:28 -05:00
Ruben De Smet 639e27c3ce feat: add Mistral Medium 3.5 with reasoning support (#24996) 2026-04-29 16:26:24 -05:00
Mark IJbema 7d375b93ee refactor: kilo compat for v1.14.29 2026-04-29 17:24:20 +02:00
Aiden Cline 0acac216ae fix(copilot): ensure available variants sync from api (#24734)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-28 14:58:51 -05:00
Alex Alecu 7d9a4f3316 test(cli): adapt upstream plugin fixture for Kilo 2026-04-28 10:50:36 +03:00
Kit Langton fb9dc874d5 test(provider): avoid plugin dependency install timeout
(cherry picked from commit 179e540ccb556fc48934a5a34bbd0920c8af87b4)
2026-04-28 10:50:32 +03:00
opencode-agent[bot] bb9e445257 chore: generate 2026-04-28 04:45:24 +00:00
Aiden Cline 528fb1d404 fix: sanitize tools for moonshot (#24730) 2026-04-27 23:44:21 -05:00
Dax f25f1485d5 refactor: remove module barrels (#24554) 2026-04-27 14:33:33 -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
Aiden Cline 738b3065dc tweak: make interleaved reasoning_content default to true for openai compat deepseek setups (#24630) 2026-04-27 10:17:38 -05:00
Imanol Maiztegui a63a27a366 Merge branch 'main' into imanolmaiztegui/kilo-opencode-v1.14.22 2026-04-27 11:23:37 +02:00
Marius a5bca011a1 Allow ChatGPT login over OpenAI provider config (#9549)
* fix: allow ChatGPT login over OpenAI provider config

Let users with inherited or globally configured OpenAI API keys sign in with ChatGPT for Codex without first removing their existing provider setup.

* fix: satisfy provider login ci checks

Annotate Kilo-specific shared CLI changes and apply webview formatting so the existing ChatGPT login flow passes CI.
2026-04-27 11:17:04 +02:00
Kit Langton f2d4d816fb test(provider): avoid plugin dependency install timeout (#24416) 2026-04-26 02:11:25 +00:00
Dax Raad 705f792e87 core: move Global module to @opencode-ai/core for centralized path management
Move the Global module from packages/opencode/src/global to packages/core/src/global
to provide a unified location for managing XDG directories and application paths.
This eliminates duplicate path definitions across packages and ensures consistent
access to data, config, cache, state, log, and bin directories throughout the codebase.
2026-04-25 13:52:32 -04:00
Imanol Maiztegui 5e519256d2 resolve merge conflicts 2026-04-24 16:58:05 +02:00
Imanol Maiztegui 7d1c046f10 resolve merge conflicts 2026-04-24 10:06:31 +02:00
Imanol Maiztegui 251ed67347 refactor(opencode): update internal import paths to use barrel re-exports
Migrate all deep import paths across source and test files to
reference barrel index modules instead of direct file paths. This
covers config, provider, storage, util, tool, lsp, project, and
installation modules. Also moves provider promise helpers out of the
namespace block, switches Clipboard to namespace import style, fixes a
duplicate Filesystem import, removes the deleted paste-summary test,
and corrects snapshot cache typing and indentation.
2026-04-22 07:24:09 +02:00
Ruben De Smet 1a20703469 feat: add Mistral Small reasoning variant support (issue #19479) (#23735) 2026-04-21 16:45:06 -04:00
Imanol Maiztegui d5357f3961 resolve merge conflicts 2026-04-21 18:03:34 +02:00
Aiden Cline 78ca49a1bc test: fix bedrock test (#23351) 2026-04-18 17:46:15 -05:00
Kit Langton 68834cfcc3 fix(opencode): normalize provider metadata and tag otel runs (#23140) 2026-04-17 15:22:08 -04:00
Aiden Cline 47e0e2342c tweak: set display 'summarized' by default for opus 4.7 thorugh messages api (#22873) 2026-04-16 14:12:43 -05:00
Aiden Cline c5deeee8c7 fix: ensure azure has store = true by default (#22764) 2026-04-16 12:19:01 -05:00