mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
Merge branch 'main' into fix/gateway-stream-metadata
This commit is contained in:
@@ -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[] = []
|
||||
|
||||
@@ -247,7 +247,7 @@ it.instance(
|
||||
)
|
||||
|
||||
it.instance(
|
||||
"searches every page while respecting worktree scope",
|
||||
"searches every page and batch while respecting worktree scope",
|
||||
() =>
|
||||
Effect.gen(function* () {
|
||||
yield* seedProject
|
||||
@@ -258,12 +258,13 @@ it.instance(
|
||||
yield* add(child.id, "user", { type: "text", text: "archived-child-needle" })
|
||||
|
||||
const broad = yield* sessions.create({ title: "Broad" })
|
||||
for (let index = 0; index < 300; index++) {
|
||||
yield* add(broad.id, "user", { type: "text", text: `page ${index}` })
|
||||
for (let index = 0; index < 1_100; index++) {
|
||||
const text = index === 1_099 ? "page-boundary-needle" : `page ${index}`
|
||||
yield* add(broad.id, "user", { type: "text", text })
|
||||
}
|
||||
for (let index = 0; index < 70; index++) {
|
||||
for (let index = 0; index < 140; index++) {
|
||||
const session = yield* sessions.create({ title: `Batch ${index}` })
|
||||
if (index === 69) yield* add(session.id, "user", { type: "text", text: "last-session-needle" })
|
||||
if (index === 139) yield* add(session.id, "user", { type: "text", text: "last-session-needle" })
|
||||
}
|
||||
|
||||
const outside = yield* sessions.create({ title: "Outside" })
|
||||
@@ -277,10 +278,11 @@ it.instance(
|
||||
.pipe(Effect.orDie)
|
||||
|
||||
expect((yield* run("archived-child-needle")).results.map((item) => item.id)).toEqual([child.id])
|
||||
expect((yield* run("page-boundary-needle")).results.map((item) => item.id)).toEqual([broad.id])
|
||||
const result = yield* run("last-session-needle")
|
||||
expect(result.results).toHaveLength(1)
|
||||
expect(result.sessions).toBe(73)
|
||||
expect(result.parts).toBe(302)
|
||||
expect(result.sessions).toBe(143)
|
||||
expect(result.parts).toBe(1_102)
|
||||
}),
|
||||
{ git: true },
|
||||
)
|
||||
@@ -298,7 +300,7 @@ it.instance(
|
||||
type: "text",
|
||||
text: `terminal ${"x".repeat(20_000)} terminal needle ${"y".repeat(20_000)}`,
|
||||
})
|
||||
for (let index = 0; index < 300; index++) {
|
||||
for (let index = 0; index < 1_100; index++) {
|
||||
yield* add(session.id, "user", { type: "text", text: `noise ${index}` })
|
||||
}
|
||||
|
||||
|
||||
@@ -1040,7 +1040,9 @@ it.live(
|
||||
|
||||
yield* permission.reply({ requestID: pending.id, reply: "always" })
|
||||
expect(
|
||||
Exit.isSuccess(yield* awaitWithTimeout(Fiber.await(first), "first global skill run did not finish")),
|
||||
Exit.isSuccess(
|
||||
yield* awaitWithTimeout(Fiber.await(first), "first global skill run did not finish", "15 seconds"),
|
||||
),
|
||||
).toBe(true)
|
||||
|
||||
yield* llm.push(reply().tool("bash", call), reply().text("second complete").stop())
|
||||
@@ -1052,7 +1054,13 @@ it.live(
|
||||
})
|
||||
const second = yield* prompt.loop({ sessionID: chat.id }).pipe(Effect.forkScoped)
|
||||
expect(
|
||||
Exit.isSuccess(yield* awaitWithTimeout(Fiber.await(second), "trusted global skill prompted a second time")),
|
||||
Exit.isSuccess(
|
||||
yield* awaitWithTimeout(
|
||||
Fiber.await(second),
|
||||
"trusted global skill prompted a second time",
|
||||
"15 seconds",
|
||||
),
|
||||
),
|
||||
).toBe(true)
|
||||
expect(yield* permission.list()).toEqual([])
|
||||
}),
|
||||
@@ -1064,7 +1072,7 @@ it.live(
|
||||
}),
|
||||
},
|
||||
),
|
||||
{ timeout: 15_000 },
|
||||
{ timeout: 30_000 },
|
||||
)
|
||||
|
||||
it.live("active tool calls use permissions changed after model streaming starts", () =>
|
||||
|
||||
@@ -3443,6 +3443,25 @@ describe("ProviderTransform.variants", () => {
|
||||
expect(result.low).toEqual({ reasoningEffort: "low" })
|
||||
expect(result.high).toEqual({ reasoningEffort: "high" })
|
||||
})
|
||||
|
||||
// kilocode_change start
|
||||
test("grok-4.5 uses standard reasoning efforts", () => {
|
||||
const model = createMockModel({
|
||||
id: "xai/grok-4.5",
|
||||
providerID: "xai",
|
||||
api: {
|
||||
id: "grok-4.5",
|
||||
url: "https://api.x.ai",
|
||||
npm: "@ai-sdk/xai",
|
||||
},
|
||||
})
|
||||
|
||||
const result = ProviderTransform.variants(model)
|
||||
|
||||
expect(Object.keys(result)).toEqual(["low", "medium", "high"])
|
||||
expect(result.medium).toEqual({ reasoningEffort: "medium" })
|
||||
})
|
||||
// kilocode_change end
|
||||
})
|
||||
|
||||
describe("@ai-sdk/deepinfra", () => {
|
||||
|
||||
Reference in New Issue
Block a user