Commit Graph
408 Commits
Author SHA1 Message Date
Igor Šćekić 8045e72da2 fix(cli): apply permission rules to workflow and subagent tool calls (#16499)
* fix(cli): apply permission rules to workflow and subagent tool calls

* fix(cli): apply the edit and read permissions to their tool aliases

* fix(cli): keep a path-scoped rule from changing a tool's preapproval

* fix(cli): single-source the tool-to-permission map

The workflow tool gate and the disabled-tool check each carried their own
copy of the map from a tool name to the permission that governs it. The gate
read a local map and the check read two inline arrays, so a new alias, or a
changed one, could apply to only one of them.

Export one resolver from Permission and read it from both places, and extend
the gate test to the resource tools so a drift in their aliases fails.

* test(cli): cover the workflow tool and subagent delegation wiring

The gate and the task permission check had unit tests, but nothing exercised
the session wiring that installs them. Add two test files:

- workflow-attach: reaches the real workflow branch through a provider stub and
  drives the installed executor, so a whole-tool rule, an unoffered name, a
  path-scoped rule and each result shape are asserted against the code that
  runs them.
- named-agent-types: drives a real prompt turn whose message names a subagent,
  and asserts the turn delegates and creates the child session.

Both fail when the corresponding wiring changes.

* test(cli): resolve the session service through the test layer

The named-agent test created its session through the global runtime handle.
Dispose that handle in the test instead and let the compiled layer do the
work, matching the other session tests in this directory.

* test(cli): resolve the session and prompt services in one scope

The named-agent test created its session through a separate runtime, so the
database instance it wrote to was not the one the prompt read. Resolve both
services from the same layer and create the session inside that scope.

* fix(cli): keep the tool-to-permission lookup to its own entries

A name that the map does not define resolved to an inherited built-in
member instead of itself, so the gate handed a non-string to the wildcard
matcher and the call failed with a thrown error rather than the gate's
not-available answer. The map now answers only for the entries it
declares.

Also mark the removed wildcard import in the session runtime and pin the
scoped-rule ordering and the unknown-name answer in tests.

* docs(cli): state what the workflow preapproval list contains

The gate also lists a tool that no rule covers, and one whose matching
rule is scoped to a path. The comment now says that, so a later change
does not narrow the list by mistake.
2026-11-22 16:44:40 +01:00
Igor Šćekić b4b3335dd9 fix(apply_patch): include move destinations in edit approvals and path guards (#16498) 2026-11-22 13:59:33 +01:00
zfralish 8116541a9b fix(cli): skip plugin tools whose args cannot convert to JSON Schema
zodJsonSchema throws for z.custom, z.instanceof, z.symbol, BigInt defaults and
duplicate meta({ id }). The throw escaped both plugin loops and the
ToolRegistry state constructor, so the registry yielded zero tools and every
prompt in the session failed with "Unexpected server error".

Wrap each plugin tool registration in Result.try so a failure is contained to
that tool: it is logged and skipped, every other tool still registers.

v2 already has this boundary (packages/core/src/tool.ts registrationError).
2026-11-06 09:41:50 -06:00
webreflection 2668d93311 feat(cli): let glob search an opt-in allowlist of ignored paths
Replace the includeIgnored tool parameter and boolean setting with experimental.glob_include_ignored, a list of gitignore-style folder or file patterns that glob should search even when ignored or hidden.
2026-10-12 19:32:27 +02:00
webreflection 9a55ea4f0f feat(cli): opt-in includeIgnored param for glob tool behind experimental config
Supersedes #14718. Closes #14717.
2026-10-12 11:21:09 +02:00
marius-kilocode 74140de2f3 Merge remote-tracking branch 'origin/main' into marius-kilocode/kilo-opencode-v1.18.26 2026-09-22 19:44:00 +02:00
Igor Šćekić f330846899 feat(cli): add experimental self-context tools (#14268)
https://github.com/Kilo-Org/kilocode/pull/14268
2026-09-22 13:52:26 +02:00
marius-kilocode af64102498 Merge OpenCode v1.18.21 through v1.18.26
Upstream sync covering v1.18.21, v1.18.22, v1.18.23, v1.18.24, v1.18.25, and
v1.18.26. Conflicts resolved in favor of Kilo behavior where the fork
intentionally diverges:

- Azure plugin keeps Kilo's resource-name/base-url prompts while adopting
  upstream Microsoft Entra ID sign-in through the Azure CLI
- provider request headers keep Kilo's x-kilocode-mode and X-KILOCODE-* set
  alongside upstream's x-parent-session-id
- Bedrock reasoning replay filtering stays gated to Claude models
- retry keeps Kilo's behavior of not surfacing the OpenCode Go upsell
- config keeps Kilo normalization, warnings, and updateGlobal/update
  delegation while adopting upstream V2-compat lowering
- session tool context keeps Kilo's processor.metadata and askPermission

Merge repairs:

- restore the SDK ./permission export and the client ./promise and UI
  ./file-path, ./session-diff, ./pierre subpath exports
- keep the Kilo workspace dependency for @opencode-ai/client in session-ui
- restore the HttpServerRequest import required by Kilo's SSE stream
- keep Kilo-Org repository URLs in packages/http-recorder
- remove the upstream-only SST unlock workflow
- adapt upstream tests that assert upstream behavior for Kilo divergences
2026-09-22 11:31:51 +02:00
marius-kilocode 8995256c88 refactor: kilo compat for v1.18.26 2026-09-22 10:15:20 +02:00
marius-kilocode 2129ab2257 Merge remote-tracking branch 'origin/main' into johnnyeric/kilo-opencode-v1.18.20
# Conflicts:
#	bun.lock
#	packages/opencode/package.json
#	packages/opencode/src/cli/cmd/run.ts
#	packages/opencode/src/server/routes/instance/httpapi/handlers/provider.ts
#	packages/sdk/js/script/build.ts
2026-09-21 15:32:05 +02:00
marius-kilocode 6b5e8a04e4 feat: add Programmatic Tool Calling experimental setting
Add an experimental.code_mode config key that routes MCP tool calls
through the confined CodeMode runtime, exposing a single execute tool
with on-demand tool discovery instead of every MCP tool definition.

Expose it as Programmatic Tool Calling in the VS Code Experimental
settings, alongside the existing KILO_EXPERIMENTAL_CODE_MODE env flag,
and add the setting translations for all locales.
2026-09-17 11:26:49 +02:00
marius-kilocode 02e92bcc6d fix(cli): speed up local recall searches and improve match ranking
Resolve message roles through a covering recall index instead of reading
message rows, pass session ids as one json_each parameter per page, detect
non-ASCII candidates by character against byte length instead of a GLOB
pattern, and cache the per-directory scope check during a search.

Rank whole-word matches above matches inside longer words, return flagged
partial matches with their missing terms when no session contains every
term, and match small typos against session titles only.
2026-09-15 09:47:37 +02:00
Igor Šćekić b7070e5076 feat(cli): add scheduled wakeup and cancel tools (#14094)
https://github.com/Kilo-Org/kilocode/pull/14094
2026-09-14 15:17:38 +02:00
marius-kilocode b5cf426158 fix(cli): remove nonfunctional interactive terminal tool 2026-09-04 15:10:46 +02:00
marius-kilocode c378562a42 fix: keep question defaults visible and ignore invalid labels 2026-09-03 10:31:13 +02:00
marius-kilocode 0a9ce2f0ef fix(cli): close remaining headless drain races
Keep reservations through prompt intake, runner completion, and shell cleanup. Report cancellation after the parent turn has ended without emitting another turn close.

Keep disposal bookkeeping in Kilo-owned code and consolidate regression fixtures without dropping the required coverage.
2026-09-01 14:17:16 +02:00
marius-kilocode ac54cca97b fix(cli): scope and simplify headless session draining
Route drain requests and CLI output through the session owner directory. Simplify notification holds and completion waiters while preserving disposal safety. Cover local, attached, and daemon cross-directory runs.
2026-09-01 10:36:49 +02:00
Josh Lambert a3f4b4674a fix(cli): harden drain lifecycle and update CI fixtures 2026-08-31 14:21:13 -04:00
Josh Lambert 7c845aa0ec fix(cli): drain background work before headless exit 2026-08-31 11:05:12 -04:00
marius-kilocode 95404e99f1 fix(cli): preserve default subagent model and reasoning 2026-08-31 13:13:06 +02:00
marius-kilocode 7929565cad test(cli): refresh task model selection schema snapshot 2026-08-28 16:12:43 +02:00
Johnny Eric Amancio 6a7d6bc002 resolve merge conflicts 2026-08-27 15:13:58 +02:00
Johnny Eric Amancio 9563af96a0 refactor: kilo compat for v1.18.20 2026-08-27 13:50:27 +02:00
maphew bf7848cb48 fix(cli): return the real subagent answer instead of an empty task result
The task tool picked the last text part of the subagent's final message as
its result. Subagents that ran with memory context get a synthetic, ignored,
empty text part (the memory marker) appended after their answer, so findLast
surfaced an empty <task_result> to the parent agent. The extractor now skips
synthetic, ignored, and empty text parts, and background jobs no longer let
an empty run overwrite an earlier non-empty result on extend.

Fixes #13469
2026-08-26 20:44:45 +00:00
Rômulo Rosa Furtado 3452fa1232 Merge branch 'main' into feat/mcp-apps-experimental 2026-08-20 18:19:10 +02:00
rrosa c02134ab43 fix(cli): annotate MCP Apps changes, tighten callTool error handling
- Add kilocode_change markers to all shared upstream files touched
- Log MCP callTool failures instead of silently swallowing them
- Remove redundant type casts on the callTool result
- Make ReadResourcePayload.server required (schema-level validation)
  and drop the now-dead BadRequest guard
- Remove unused meta field from ReadResourceContent schema
2026-08-20 07:39:59 -03:00
rrosa 36c57c12ce feat(cli): add experimental MCP Apps support with resource/tool HTTP endpoints
- Add KILO_EXPERIMENTAL_MCP_APPS runtime flag
- Expose clientName on McpTool interface and populate it during tool listing
- Add POST /experimental/resource/read and POST /experimental/mcp/call-tool HTTP endpoints
- Gate both endpoints behind experimentalMcpApps flag
- Propagate mcpApp UI metadata (resourceUri, serverId) in tool call results
  when tools advertise _meta.ui.resourceUri in their definition
- Add docs/kilo-headless-embedding.md for headless and embedding capabilities
- Fix test fixtures to include clientName in McpTool mocks
2026-08-20 07:28:17 -03:00
marius-kilocode 9701b518b6 Merge main into puzzling-crowberry 2026-08-19 14:53:12 +02:00
marius-kilocode ba658fc8d7 chore: checkpoint before merging main 2026-08-19 14:50:11 +02:00
marius-kilocode 8d717a05d3 fix(cli): remove duplicate skill catalog 2026-08-18 15:05:57 +02:00
marius-kilocode 923cf79ee0 fix(cli): clean truncation files by mtime 2026-08-18 09:54:14 +02:00
Yury Zialionka 2a63bf180e fix(ci): satisfy PR-only checks — typecheck narrowing and kilocode_change markers
- narrow the retry gate to active scenarios (TodoScenario has no reset field)
  and type the retry accumulator as Result; both surfaced only in the PR
  typecheck job because the scenario union changed in the main merge
- annotate every changed line in shared upstream files with kilocode_change
  markers (websearch Env migration, exerciser isolation/retry, pty deadline,
  storage layer-injection tests)
- drop duplicate .inProject({ git: true }) calls on the worktree scenarios
  left behind by the main merge (main and this branch each added one)
2026-08-13 22:04:23 -06:00
Yury Zialionka 2aa10017c0 refactor(tool): resolve websearch config via Env.Service instead of process.env
Closes #12996. Part of #12986.

- websearch resolves KILO_WEBSEARCH_PROVIDER, EXA_API_KEY and
  PARALLEL_API_KEY through Env.Service in the tool body and threads
  them into the pure helpers; selectWebSearchProvider takes the
  override as a parameter.
- mcp-websearch no longer snapshots EXA_API_KEY into a module-level
  URL at import time; exaUrl(key) derives it per call, so BYOK keys
  set or cleared after startup are honored.
- Tool registry provides Env.node.
- kilo-tool-process-env allowlist is now empty; check:architecture
  drops from 15 to 9 classified ratchet sites.
- Transform/model tests confirmed running in-process via plain
  bun test (455 tests, <1s), the other half of #12996.

warpgrep.ts, the third file in the original ratchet, was already
removed on main.
2026-08-13 13:52:17 -06:00
Johnny Eric Amancio 7f36c5044a refactor: kilo compat for v1.18.15 2026-08-07 14:03:32 +02:00
Johnny Eric Amancio d99467fa02 resolve merge conflicts 2026-08-06 14:10:41 +02:00
Johnny Eric Amancio 4174457a0d Merge remote-tracking branch 'origin/main' into johnnyeric/kilo-opencode-v1.18.0
# Conflicts:
#	package.json
2026-08-06 14:02:04 +02:00
Marius 835cebb476 Merge pull request #12937 from Kilo-Org/deadpan-bromine
fix(cli): resume subagents after session fork
2026-08-06 13:43:39 +02:00
marius-kilocode 4ea52f2dd1 fix(cli): resume subagents after session fork 2026-08-06 11:16:17 +02:00
Marius 6bb2a243f6 Merge pull request #12926 from Kilo-Org/encouraging-pantydraco
fix(cli): keep built-in skill examples inert
2026-08-06 10:01:36 +02:00
marius-kilocode 90ac91d501 fix(cli): preserve built-in skill markdown 2026-08-06 08:53:49 +02:00
Johnny Eric Amancio cce22e608f merge: upstream v1.18.13 2026-08-06 00:31:20 +02:00
Johnny Eric Amancio 0fff61fa62 refactor: kilo compat for v1.18.13 2026-08-06 00:00:45 +02:00
Johnny Eric Amancio 25f4b58d93 fix: address post-merge validation findings 2026-08-05 21:08:55 +02:00
Johnny Eric Amancio 88083fb5c5 resolve merge conflicts 2026-08-05 16:01:49 +02:00
Johnny Eric Amancio 76783409bf refactor: kilo compat for v1.18.0 2026-08-05 11:59:08 +02:00
marius-kilocode 9bfbc35c5c fix(cli): safely restore grep signal controls 2026-08-05 09:39:16 +02:00
Johnny Eric Amancio 6c138449d5 Merge remote-tracking branch 'origin/main' into johnnyeric/kilo-opencode-v1.17.13
# Conflicts:
#	package.json
#	packages/core/schema.json
#	packages/core/src/command.ts
#	packages/core/src/config/plugin/command.ts
#	packages/core/src/database/schema.gen.ts
#	packages/core/src/session/sql.ts
#	packages/core/src/v1/session.ts
#	packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/agentmanager/full-screen-diff-with-changes-chromium-linux.png
#	packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/labs-tool-call-lab/search-previews-chromium-linux.png
#	packages/opencode/src/command/index.ts
#	packages/opencode/test/server/httpapi-ui.test.ts
#	packages/sdk/js/src/v2/gen/types.gen.ts
#	packages/sdk/openapi.json
#	packages/tui/src/routes/session/index.tsx
2026-08-04 12:57:20 +02:00
marius-kilocode 9ed716a5b8 revert(cli): restore stable grep behavior 2026-08-04 11:39:59 +02:00
fd60036e4a fix: make tool invalid-arguments errors clearly actionable to the model (#11961)
* fix: make tool invalid-arguments errors clearly actionable to the model

* fix: address kilo-code-bot review on schema error formatting

Return a jargon-free actionable message when the schema formatter yields no issues (instead of the raw SchemaError), and match Effect's missing-key message case-insensitively so it survives library wording changes.

Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>

* Address review: cap rendered issues, isolate Kilo logic, harden the fallbacks

- Move formatter/format/path/reason out of the shared upstream tool.ts into
  packages/opencode/src/kilocode/tool/tool.ts.
- Cap output at 20 issues / 4 KiB with an '...and N more' suffix, since
  validation fails before the normal output truncation.
- Return a readable message when the formatter yields zero issues instead of
  falling back to SchemaError jargon.
- Match missing-key messages with a regex instead of an exact string compare.
- Rewrite the changeset around the user-visible outcome.

* chore: annotate the reformatted decode call with kilocode_change markers

The multi-line reformat left lines 122-125 unannotated in a shared upstream
file. Wrap the whole statement in a start/end block instead of per-line inline
markers, and drop the two now-redundant inline ones. Comments only.

---------

Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Christiaan Arnoldus <christiaan.arnoldus@outlook.com>
2026-08-04 11:13:02 +02:00
Marius 989f7f06a0 feat: add signal-to-noise controls to grep tool (#12811)
* feat: add signal-to-noise controls to grep tool

Add configurable options to reduce noise in grep results:
- context: show N lines before/after each match
- limit: bound maximum matches (default 100) with early termination
- literal: treat pattern as plain text instead of regex
- ignoreCase: case-insensitive matching

These controls help models avoid overwhelming context windows with too
many matches and provide clear guidance when results are truncated.

Implementation preserves upstream ripgrep structure with minimal Kilo
hooks for additive behavior only. Shared-file changes reduced from 183
to 60 lines compared to initial implementation.

* test(core): tolerate PTY event publication race

* fix(cli): count grep matches independently of context
2026-08-03 10:32:40 -04:00