mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-10-29 18:52:45 +08:00
refactor: improve implementation
This commit is contained in:
@@ -285,7 +285,7 @@ export function createTuiPluginApi(opts: Opts = {}): HostPluginApi {
|
||||
count: opts.state?.session?.count ?? (() => 0),
|
||||
diff: opts.state?.session?.diff ?? (() => []),
|
||||
todo: opts.state?.session?.todo ?? (() => []),
|
||||
processes: opts.state?.session?.processes ?? (() => []),
|
||||
processes: opts.state?.session?.processes ?? (() => []), // kilocode_change
|
||||
messages: opts.state?.session?.messages ?? (() => []),
|
||||
status: opts.state?.session?.status ?? (() => undefined),
|
||||
permission: opts.state?.session?.permission ?? (() => []),
|
||||
|
||||
@@ -89,4 +89,30 @@ describe("BackgroundProcess", () => {
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
||||
it.instance("rejects invalid readiness patterns before launching", () =>
|
||||
Effect.gen(function* () {
|
||||
const test = yield* TestInstance
|
||||
const sessionID = SessionID.descending()
|
||||
|
||||
const err = yield* Effect.promise(async () => {
|
||||
try {
|
||||
await BackgroundProcess.start({
|
||||
sessionID,
|
||||
command: "printf 'ready\n'",
|
||||
cwd: test.directory,
|
||||
ready: { pattern: "[", timeout: 1_000 },
|
||||
})
|
||||
} catch (err) {
|
||||
return err
|
||||
}
|
||||
})
|
||||
|
||||
expect(err).toBeInstanceOf(Error)
|
||||
expect((err as Error).message).toContain("Invalid ready pattern")
|
||||
|
||||
const list = yield* Effect.promise(() => BackgroundProcess.list({ sessionID }))
|
||||
expect(list).toEqual([])
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
@@ -81,7 +81,6 @@ describe("Kilo HttpApi bridge", () => {
|
||||
const effect = new Set(openApiRouteKeys(effectOpenApi()))
|
||||
const kilo = [
|
||||
`GET ${BackgroundProcessPaths.list}`,
|
||||
`POST ${BackgroundProcessPaths.create}`,
|
||||
"GET /background-process/{processID}",
|
||||
"GET /background-process/{processID}/logs",
|
||||
"POST /background-process/{processID}/stop",
|
||||
@@ -119,6 +118,8 @@ describe("Kilo HttpApi bridge", () => {
|
||||
|
||||
expect(kilo.filter((route) => !hono.has(route))).toEqual([])
|
||||
expect(kilo.filter((route) => !effect.has(route))).toEqual([])
|
||||
expect(hono.has("POST /background-process")).toBe(false)
|
||||
expect(effect.has("POST /background-process")).toBe(false)
|
||||
expect(effect.has("GET /indexing/status")).toBe(true)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user