mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-10-28 02:42:15 +08:00
refactor(kilo-gateway): extract cloud sessions logic and wire up cloud sync endpoints
Move inline cloud-sessions fetch logic from Hono route handler into a reusable getCloudSessions function in handlers.ts, and introduce new Effect HttpApi endpoints for fetching and importing individual cloud sessions. - Extract getCloudSessions handler from routes.ts inline implementation - Export fetchCloudSession, fetchCloudSessionForImport, importSessionToDb from kilo-gateway package - Add cloudSession (GET /kilo/cloud/session/:id) endpoint for previewing remote session data - Add cloudSessionImport (POST /kilo/cloud/session/import) endpoint to download and persist cloud sessions locally - Define CloudSession, CloudSessionData, CloudMessage schemas in the kilo-gateway API group - Change claw status error response from 500 InternalServerError to 503 ServiceUnavailable - Register new cloud routes in instance router - Add test coverage for route disambiguation between import and :id paths - Regenerate SDK types and OpenAPI spec
This commit is contained in:
@@ -4,6 +4,7 @@ import { Instance } from "../../src/project/instance"
|
||||
import { ControlPaths } from "../../src/server/routes/instance/httpapi/groups/control"
|
||||
import { FilePaths } from "../../src/server/routes/instance/httpapi/groups/file"
|
||||
import { GlobalPaths } from "../../src/server/routes/instance/httpapi/groups/global"
|
||||
import { KiloGatewayPaths } from "../../src/kilocode/server/httpapi/groups/kilo-gateway"
|
||||
import { PublicApi } from "../../src/server/routes/instance/httpapi/public"
|
||||
import { ExperimentalHttpApiServer } from "../../src/server/routes/instance/httpapi/server"
|
||||
import { Server } from "../../src/server/server"
|
||||
@@ -292,10 +293,10 @@ describe("HttpApi server", () => {
|
||||
"POST /kilocode/session-import/session",
|
||||
"POST /kilocode/session-import/message",
|
||||
"POST /kilocode/session-import/part",
|
||||
"GET /indexing/status",
|
||||
]
|
||||
expect(kilo.filter((route) => !hono.has(route))).toEqual([])
|
||||
expect(kilo.filter((route) => !effect.has(route))).toEqual([])
|
||||
expect(effect.has("GET /indexing/status")).toBe(true)
|
||||
})
|
||||
// kilocode_change end
|
||||
|
||||
@@ -334,6 +335,16 @@ describe("HttpApi server", () => {
|
||||
expect(time?.properties?.archived).toEqual({ type: "number" })
|
||||
})
|
||||
|
||||
// kilocode_change start - cloud session literal route must not be swallowed by :id.
|
||||
test("documents cloud session import separately from session id lookup", () => {
|
||||
const effect = effectOpenApi()
|
||||
|
||||
expect(effect.paths["/kilo/cloud/session/import"]?.post).toBeDefined()
|
||||
expect(effect.paths["/kilo/cloud/session/{id}"]?.get).toBeDefined()
|
||||
expect(KiloGatewayPaths.cloudSessionImport).not.toBe(KiloGatewayPaths.cloudSession)
|
||||
})
|
||||
// kilocode_change end
|
||||
|
||||
test("documents event routes as server-sent events", () => {
|
||||
const effect = effectOpenApi()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user