Commit Graph

58 Commits

Author SHA1 Message Date
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 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
Mark IJbema 1ea9ad2af0 resolve merge conflicts 2026-05-06 21:32:26 +02:00
Mark IJbema a16e0560c7 Merge remote-tracking branch 'origin/main' into markijbema/kilo-opencode-v1.14.29 2026-05-04 10:27:37 +02:00
opencode-agent[bot] 96061222d2 chore: generate 2026-05-02 15:45:21 +00:00
Kit Langton 3b9155714d Delete Instance.dispose and Instance.reload (#25427) 2026-05-02 11:44:16 -04:00
Kit Langton 4c4860fb24 Replace Instance.disposeAll/load with fixture helper (#25418) 2026-05-02 10:56:15 -04:00
Mark IJbema 5d5fab36bb fix(cli): repair broken imports and typecheck after opencode v1.14.29 merge
Fixes 257 typecheck errors surfaced after the upstream merge:

- Update imports to new module paths after upstream PR #24554 removed
  module barrel files (@/config, @/session, @/util, etc.) and PR #24309
  renamed @opencode-ai/shared to @opencode-ai/core.
- Migrate loadMode to use Info.zod.safeParse for consistency with
  loadAgents and ConfigCommand (unblocks KilocodeConfig.handleInvalid).
- Drop removed Npm.outdated mock from tests.
- Add missing Config.defaultLayer to bash-permission-metadata test runtime.
- Fix Tips component signature (kilocode drops upstream's 'connected' prop).
- Fix toast.tsx undefined 'duration' reference (should be toastOptions.duration).
- Move filesystem-containment test from deleted shared package to core.
2026-04-30 17:16:31 +02:00
Mark IJbema 3f7037549e resolve merge conflicts 2026-04-30 16:25:46 +02:00
Marius 80535d4ed6 fix(cli): persist command permission approvals (#9746) 2026-04-30 14:55:02 +02:00
Alex Alecu c05d382c46 style(review): reduce comments 2026-04-28 14:09:32 +03:00
Alex Alecu 72c19f2cf4 Merge remote-tracking branch 'origin/main' into fix/hanging-sessions-v2 2026-04-28 10:44:03 +03:00
Alex Alecu 8d17b76500 chore: fix checks after main merge
Add kilocode_change markers to shared opencode files and provide
missing PermissionContext methods in permission-recovery test.
2026-04-27 12:04:13 +03:00
Dax Raad 1e98167b0e core: move cross-spawn-spawner to root and remove unused types
The cross-spawn-spawner module has been moved from src/effect/ to src/
to simplify the core package structure. The src/types.d.ts file which
contained unused type declarations has also been removed. All imports
throughout the codebase have been updated to reflect the new location.

This change reduces the package's internal complexity by flattening the
module hierarchy and removing dead code, making future maintenance easier.
2026-04-25 14:30:16 -04:00
Dax Raad 3eee2f6afa core: move cross-spawn-spawner from opencode to core package
Moved the cross-spawn-spawner module from packages/opencode to packages/core
to enable code sharing across the monorepo. This consolidates the process
spawning infrastructure into the core package so other packages can use
cross-platform child process spawning without duplicating the implementation.

Updated all import statements across the codebase to reference the new
location (@opencode-ai/core/effect/cross-spawn-spawner). Removed the
local copy from the opencode package along with its tests.
2026-04-25 14:23:17 -04:00
Dax 66f93035b0 fix permission config order (#24222) 2026-04-25 13:18:42 +00:00
Imanol Maiztegui 5e519256d2 resolve merge conflicts 2026-04-24 16:58:05 +02:00
Alex Alecu 2032fe4c4e core: let stale permission prompts clear instead of leaving VS Code approvals stuck
This prevents dead permission buttons and failed settings saves when the same permission was already answered from another panel or worktree.
2026-04-24 07:16:31 +03: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
Kit Langton b0f565b74a refactor(core): migrate ConfigPermission.Info to Effect Schema canonical (#23740) 2026-04-21 17:33:13 -04:00
Imanol Maiztegui d5357f3961 resolve merge conflicts 2026-04-21 18:03:34 +02:00
Aiden Cline 2486621ca1 chore: kill unused tool (#23701) 2026-04-21 11:31:20 -04:00
Kit Langton 80f1f1b5b8 feat: enable type-aware no-floating-promises rule, fix all 177 violations (#22741) 2026-04-15 23:27:32 -04:00
Kit Langton f7d4665e40 fix: resolve oxlint warnings — suppress false positives, remove unused imports (#22687) 2026-04-15 21:33:54 -04:00
Johnny Amancio 915f12c7e2 resolve merge conflicts 2026-04-15 22:51:15 +02:00
Catriel Müller 528ec937ab refactor: fix home test config mocks 2026-04-14 03:06:12 -03:00
Kit Langton d199648aeb refactor(permission): remove async facade exports (#22342) 2026-04-13 19:33:58 -04:00
Johnny Amancio 49cb356d23 refactor: fix type errors after v1.3.0 merge
- Rename PermissionNext → Permission across all remaining src/test files
    (drain.ts, routes.ts, remote-sender.ts, task.ts, and 5 test files)
  - Fix Effect Layer type resolution for makeRunPromise by accepting
    Layer<I, E, any> (Effect 4.x beta type inference limitation)
  - Add missing imports: Bus/BusEvent in server.ts, useToast in sync.tsx
  - Fix OPENCODE_ → KILO_ flag renames missed by merge transforms
    (DISABLE_EXTERNAL_SKILLS in skill/index.ts)
  - Fix isCodex → isOpenaiOauth rename in session/llm.ts
  - Fix PasteEvent.bytes decoding (decodePasteBytes removed from @opentui/core)
  - Fix ProviderID branded type indexing with ProviderID.kilo
  - Remove redundant windowsHide from pr.ts (handled by Process.spawn)
  - Update Skill import paths after skill.ts → index.ts rename
  - Restore Skill.remove and Skill.BUILTIN_LOCATION lost during merge
2026-04-11 14:49:11 +02:00
Johnny Amancio b1811147e2 merge: upstream v1.3.0 2026-04-11 14:06:52 +02:00
Catriel Müller c37f85386f resolve merge conflicts 2026-04-10 17:16:52 -03:00
Johnny Amancio 040d5b8a28 fix: update branded ID types and Server API references after merge with main 2026-04-08 20:42:02 +02:00
Johnny Amancio a1a50cd2be Merge branch 'main' into johnnyamancio/kilo-opencode-v1.2.25 2026-04-08 20:12:58 +02:00
Alex Alecu 21531ce6c6 fix(cli): add missing kilocode_change annotations 2026-04-08 19:11:44 +03:00
Alex Alecu 6d27af6827 fix(cli): scope allow-all approvals to the active session 2026-04-06 19:25:53 +03:00
Johnny Amancio 510ff13cd4 chore: Resolve merge conflicts 2026-03-31 12:45:25 +02:00
Kit Langton 38e0dc9ccd Move service state into InstanceState, flatten service facades (#18483) 2026-03-21 04:51:35 +00:00
Imanol Maiztegui 64442519b4 Improved subagent permissions handling (#7348)
* feat(vscode): handle subagent permissions

* fix(vscode): formatting

* fix(permission): preserve original ruleset in pending requests for drainCovered evaluation

* style(permission): shorten inline comments on kilocode_change markers

* refactor(permission): extract drainCovered into dedicated module
2026-03-20 18:08:11 +01:00
Imanol Maiztegui f336949a08 Save changes on Settings update (#7312)
* feat(vscode): track session status for busy-session warnings

* feat(vscode): warn before saving settings when sessions are running

* feat(vscode): add draft state and save/discard to config context

* feat(vscode): Save button on Settings panel

* fix(vscode): pass remove permission commands correctly to backend

* feat(vscode): handle permission removals

* fix(vscode): detect other sessions in settings panel

* feat(vscode): translations

* feat(vscode): refresh config state on auto-approve tab

* fix(vscode): formatting and unit tests

* fix: reset Config.state cache on no-dispose config write

* fix(vscode): Detect sessions opened before Settings tab is opened

* fix(vscode): Removed previous fix changes
2026-03-19 22:12:09 +01:00
Kit Langton a800583aea refactor(effect): unify service namespaces and align naming (#18093) 2026-03-18 13:34:36 -04:00
Kit Langton 5dfe86dcb1 refactor(truncation): effectify TruncateService, delete Scheduler (#17957) 2026-03-17 21:59:54 -04:00
Ariane Emory 4b4dd2b882 fix: Add apply_patch to EDIT_TOOLS filter (#18009) 2026-03-17 20:11:42 -05:00
Imanol Maiztegui 0adb514da4 Remove allow always button (#7159)
* feat: save permissions to config

* fix: preserve wildcard default in jsonc scalar promotion and skip dispose for permission saves

* fix: update CLI permission hint to reflect permanent persistence

* fix: avoid mutating input in mergeConfig permission normalization

* chore: update kilo-vscode visual regression baselines

* fix(vscode): remove Allow Always button from PermissionDock

* fix(kilo-vscode): removed unreachable onDecide option

* chore: update kilo-vscode visual regression baselines

* fix: scope patchJsonc scalar promotion to permission keys only

* fix: toConfig always uses object format to preserve existing granular rules

* fix: preserve metadata.rules order in saveAlwaysRules for correct precedence

* feat:show non-bash tool permissions on dropdown

* fix: include always patterns in saveAlwaysRules validation loop

* test(kilo-vscode): remove write mixed-decisions screenshot test for single-rule dropdown

* test: updated visual tests

* fix: formatting

* chore: update kilo-vscode visual regression baselines

* fix: use scalar format in toConfig for PermissionAction-only permissions

* fix: serialize scalar-only permissions as scalars for all patterns

* fix: skip non-wildcard patterns for scalar-only permissions in toConfig

* fix: promote doom_loop to PermissionRule for per-tool persistence

* fix: keep doom_loop as PermissionAction and skip non-wildcard scalar-only patterns in toConfig

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-03-17 18:44:04 +01:00
Imanol Maiztegui 28330ea765 Save permission rules to config (#7143)
* feat: save permissions to config

* fix: preserve wildcard default in jsonc scalar promotion and skip dispose for permission saves

* fix: update CLI permission hint to reflect permanent persistence

* fix: avoid mutating input in mergeConfig permission normalization

* chore: update kilo-vscode visual regression baselines

* chore: update kilo-vscode visual regression baselines

* fix: scope patchJsonc scalar promotion to permission keys only

* fix: toConfig always uses object format to preserve existing granular rules

* fix: preserve metadata.rules order in saveAlwaysRules for correct precedence

* fix: remove unnecessary dispose con config global update

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-03-17 15:59:52 +01:00
Kit Langton 9e740d9947 stack: effectify-file-watcher-service (#17827) 2026-03-16 13:18:40 -04:00
Kit Langton 469c3a4204 refactor(instance): move scoped services to LayerMap (#17544) 2026-03-16 12:55:14 -04:00
Imanol Maiztegui 0484318191 Granular bash permission rules (#7091)
* fix: renamed pattern arrays used for permission rules

* fix: rename savePatternRules to saveAlwaysRules

* feat: generate hierarchical always patterns in bash tool

* feat: validate saveAlwaysRules against always array only

* feat: pass always field through extension bridge to webview

* feat: show hierarchical always patterns in PermissionDock dropdown

* fix: rename pattern to rule in PermissionDock translations, styles, and data-slots

* fix(vscode): correct auto-run comment in PermissionDock

* feat(kilo-vscode): strip trailing wildcard from permission rule labels

* fix: deduplicate permission rules and strip wildcards from display labels

* refactor: move hierarchy to metadata.rules, restore always to arity prefix

* feat: pass always field to permission dock for non-bash tool rules

* fix: correct bash test assertion to check metadata.rules and fix indentation

* fix: hide permission rules dropdown for non-bash tools

* fix: align always-rules route descriptions, whitespace, and restore multi-command tests
2026-03-16 17:43:16 +01:00
Kit Langton f015154314 refactor(permission): effectify PermissionNext + fix InstanceState ALS bug (#17511) 2026-03-14 18:28:00 +00:00
Imanol Maiztegui a913731700 Permission toggles per-pattern in permission dock (#6977)
* feat(kilo-vscode): Granular permission layout

* formatting

* chore: update kilo-vscode visual regression baselines

* fix: Make sure pattern permissions are correctly saved

* fix: Only save patterns originally sent

* chore: Moved pattern permission logic to its own endpoint

* tests: Unit tests for pattern permissions handling

* fix: Avoid race conditions on permission reply messages

* fix: Handle missing requestId on pattern permission request

* fix: Return NotFoundError when input.requestID missing

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-03-13 13:56:57 +01:00
Kit Langton 2a4dedc210 feat(id): brand PermissionID, PtyID, QuestionID, and ToolID (#17042) 2026-03-12 01:49:57 +00:00