* 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.
* 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.
Replace legacy "opencode" references with "kilo" in CLI output,
API metadata, SDK error messages, and documentation. Add automatic
labels to GitHub issue templates, expand triage agent with jetbrains
and extension teams, and update the github-triage tool to target the
Kilo-Org/kilocode repository.
Replace raw `Effect.promise` calls across HTTP API handlers with
`EffectBridge.fromPromise` / `EffectBridge.make` to ensure proper error
propagation and context forwarding when bridging imperative async code
into the Effect runtime.
Wrap top-level `makeRuntime` calls in `plan-followup.ts` with `lazy()`
to defer service instantiation until first access, avoiding eager
initialization side-effects during module loading.
Also reorder SDK event union members and type definitions to reflect
updated OpenAPI schema generation output.
Extract `disposeAllInstancesAfterProviderAuthCallback` into a dedicated
module and invoke it from the provider OAuth callback handler instead of
coupling it to the ProviderAuth layer. This removes the InstanceStore
dependency from `ProviderAuth.layer`.
Additional changes:
- Add `--cloud-fork` CLI option to the run command for fetching sessions
from cloud and continuing locally
- Replace the Zod-bridged `Schema.Any` indexing config with a native
Effect `IndexingSchema` definition in kilo-indexing, propagating typed
config through the SDK OpenAPI spec
- Use `optionalOmitUndefined` for `recommendedIndex` to emit clean JSON
- Fix `request.source.signal` access by guarding with `instanceof Request`
- Replace `Effect.catchAllCause` with `Effect.catchCause` in telemetry
- Migrate tests from `BashTool` to `ShellTool`, extract `TestConfig`
fixture, and convert stats-subagent-cost tests to use `testEffect`
- Reorder SDK event union members to match updated OpenAPI schema
- Export `aggregateSessionStats` for Kilo regression test coverage
- Widen `setViewedSessions` input to accept readonly arrays
Move the IndexingStatus Effect schema out of the KiloIndexing namespace into
a dedicated `indexing-event.ts` module so it can be shared between the bus
event system and the HttpApi layer without circular imports.
Additionally fix several OpenAPI spec inconsistencies:
- Inline PermissionReplyBody into the endpoint payload schema
- Make `organizationId` nullable in the organization set endpoint
- Replace opaque string response for `/kilo/fim` with a structured
streaming completion schema
- Register `indexing.status` as a typed SSE event in the global event union
- Add `matchLegacyKiloOpenApi` post-processor for backward-compatible
nullable fields and FIM response shape
- Relocate Kilo-specific bridge tests to `test/kilocode/server/` and trim
duplicated assertions from the core bridge test file
Introduce several new Effect HttpApi endpoints across the kilo-gateway
and experimental API groups to support agent manager workflows and
enhanced gateway proxying.
- Add worktree diff endpoints (diff, diff/summary, diff/file) for
comparing worktree changes against a base branch
- Add FIM completion proxy endpoint with streaming SSE response and
timeout handling
- Add audio transcriptions proxy endpoint forwarding to Kilo Gateway
- Add organization modes endpoint to fetch custom modes config
- Add session/viewed endpoint to track which sessions the user has open
- Extend session list query with projectID and worktrees parameters
- Register all new routes in Hono instance router
- Regenerate SDK types and OpenAPI spec
Move inline cloud-sessions fetch logic from Hono route handler into a
reusable getCloudSessions function in handlers.ts, and introduce new
Effect HttpApi endpoints for fetching and importing individual cloud
sessions.
- Extract getCloudSessions handler from routes.ts inline implementation
- Export fetchCloudSession, fetchCloudSessionForImport, importSessionToDb
from kilo-gateway package
- Add cloudSession (GET /kilo/cloud/session/:id) endpoint for previewing
remote session data
- Add cloudSessionImport (POST /kilo/cloud/session/import) endpoint to
download and persist cloud sessions locally
- Define CloudSession, CloudSessionData, CloudMessage schemas in the
kilo-gateway API group
- Change claw status error response from 500 InternalServerError to
503 ServiceUnavailable
- Register new cloud routes in instance router
- Add test coverage for route disambiguation between import and :id paths
- Regenerate SDK types and OpenAPI spec
Extract shared handler logic from Hono routes into reusable functions in
kilo-gateway/server/handlers.ts and wire up new Effect HttpApi endpoints
for profile, notifications, organization switching, claw status, and
claw chat credentials.
- Add handlers.ts with pure business logic (getProfile, getNotifications,
setOrganization, getClawStatus, getClawChatCredentials)
- Define KiloGatewayApi group with typed schemas for all endpoints
- Implement Effect-based handler layer in httpapi/handlers/kilo-gateway.ts
- Register kilo gateway routes in instance router and HttpApi composition
- Add config/warnings endpoint to config group and handler
- Regenerate SDK types and client methods for new endpoints
- Update OpenAPI spec with /kilo/* and /config/warnings paths
- Export new constants (KILO_CHAT_URL, KILO_EVENT_SERVICE_URL) and
handler utilities from kilo-gateway package index
Reformat code with consistent line breaks, trailing commas, semicolons,
and line-length compliance. No logic changes — purely whitespace,
indentation, and punctuation adjustments driven by the project formatter.
- Break long function signatures and conditionals across multiple lines
- Remove trailing blank lines and stray leading newlines
- Replace string-expression JSX whitespace with literal spaces
- Convert quoted object keys to unquoted where valid
- Remove erroneous shell command prefix from openapi.json
- Deduplicate SessionNetworkWait1 schema and simplify Finite unions to
plain number type in OpenAPI spec
Introduce a structured Effect HttpApi surface for all Kilo-specific
endpoints, replacing inline Hono handler logic with declarative group
definitions, typed schemas, and composable handler layers.
Key changes:
- Add HttpApi group and handler modules for commit-message, enhance-prompt,
indexing, kilocode, network, remote, session-import, suggestion, and
telemetry
- Extract allow-everything permission logic into a reusable Effect function
- Register all Kilo HttpApi groups in InstanceHttpApi and wire route
forwarding in the Hono instance router
- Export Suggestion.RequestSchema and annotate schemas with identifiers
- Use NonNegativeInt for indexing status fields and Schema.Finite for
network wait timestamps
- Add httpapi-bridge test asserting parity between Hono and Effect specs
for all 22 Kilo overlay routes
- Regenerate SDK types and openapi.json to reflect the new endpoints