Merge pull request #12244 from Kilo-Org/fix/agent-manager-object-schema

fix(cli): make agent manager schema provider-compatible
This commit is contained in:
Christiaan Arnoldus
2026-07-15 20:26:20 +02:00
committed by GitHub
3 changed files with 37 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@kilocode/cli": patch
---
Fix Agent Manager tool calls through providers that require object-root input schemas without root combinators.
@@ -8,6 +8,7 @@ import * as SandboxInheritance from "@/kilocode/sandbox/inheritance"
import { KiloSessionMessageOrder } from "@/kilocode/session/message-order"
import { Provider } from "@/provider/provider"
import { SessionID } from "@/session/schema"
import * as ToolJsonSchema from "@/tool/json-schema"
import { Tool } from "@/tool/tool"
import { Effect, Schema } from "effect"
import { matchesQuery } from "./model-search"
@@ -76,6 +77,16 @@ const PromptParams = Schema.Struct({
export const Params = Schema.Union([StartParams, ListParams, PromptParams])
const WireParams = Schema.Struct({
mode: Schema.optional(StartParams.fields.mode),
versions: Schema.optional(StartParams.fields.versions),
tasks: Schema.optional(StartParams.fields.tasks),
action: Schema.optional(Schema.Literals(["list", "prompt"])),
filter: Schema.optional(ListParams.fields.filter),
sessionID: Schema.optional(PromptParams.fields.sessionID),
prompt: Schema.optional(PromptParams.fields.prompt),
})
type Input = Schema.Schema.Type<typeof Task>
type Selected = { task?: AgentManagerTask; error?: string }
type Candidate = { providerID: string; model: Provider.Info["models"][string] }
@@ -237,6 +248,7 @@ export const AgentManagerTool = Tool.define<
return {
description: DESCRIPTION,
parameters: Params,
jsonSchema: ToolJsonSchema.fromSchema(WireParams),
execute: (params, ctx) =>
Effect.gen(function* () {
if ("action" in params) {
@@ -8,6 +8,7 @@ import { AgentManagerEvent, type AgentManagerStart } from "../../src/kilocode/ag
import { AgentManager } from "../../src/kilocode/agent-manager/service"
import { Bus } from "../../src/bus"
import { Tool } from "../../src/tool/tool"
import * as ToolJsonSchema from "../../src/tool/json-schema"
import { Truncate } from "../../src/tool/truncate"
import { Agent } from "../../src/agent/agent"
import { Provider } from "../../src/provider/provider"
@@ -149,6 +150,25 @@ function publish(
}
describe("agent_manager tool", () => {
test("uses an object-root input schema without combinators", async () => {
const tool = await init()
const schema = ToolJsonSchema.fromTool(tool)
expect(schema.type).toBe("object")
expect(schema.anyOf).toBeUndefined()
expect(schema.oneOf).toBeUndefined()
expect(schema.allOf).toBeUndefined()
expect(Object.keys(schema.properties ?? {})).toEqual([
"mode",
"versions",
"tasks",
"action",
"filter",
"sessionID",
"prompt",
])
})
test("asks for agent_manager permission", async () => {
const tool = await init()
const calls: unknown[] = []