mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-28 19:11:03 +08:00
refactor(opencode): migrate session types to KiloSession namespace and fix merge artifacts
Replace Session.CloseReason and Session.getPlatformOverride references with KiloSession equivalents from @/kilocode/session, remove duplicate waitForDependencies export introduced by merge, and update SDK client to pass URL string instead of URL object to Request constructor.
This commit is contained in:
@@ -1852,10 +1852,6 @@ export namespace Config {
|
||||
return runPromise((svc) => svc.waitForDependencies())
|
||||
}
|
||||
|
||||
export async function waitForDependencies() {
|
||||
return runPromise((svc) => svc.waitForDependencies())
|
||||
}
|
||||
|
||||
// kilocode_change start
|
||||
export async function warnings() {
|
||||
return runPromise((svc) => svc.warnings())
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ulid } from "ulid"
|
||||
import type * as SDK from "@kilocode/sdk/v2"
|
||||
import type { Session } from "@/session"
|
||||
import type { KiloSession } from "@/kilocode/session"
|
||||
|
||||
export namespace IngestQueue {
|
||||
export type Client = {
|
||||
@@ -8,7 +8,7 @@ export namespace IngestQueue {
|
||||
fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>
|
||||
}
|
||||
|
||||
export type CloseReason = Session.CloseReason
|
||||
export type CloseReason = KiloSession.CloseReason
|
||||
|
||||
export type Data =
|
||||
| {
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Bus } from "@/bus"
|
||||
import { BusEvent } from "@/bus/bus-event"
|
||||
import { Provider } from "@/provider/provider"
|
||||
import { Session } from "@/session"
|
||||
import { KiloSession } from "@/kilocode/session"
|
||||
import { SessionID } from "@/session/schema"
|
||||
import { ModelID, ProviderID } from "@/provider/schema"
|
||||
import { MessageV2 } from "@/session/message-v2"
|
||||
@@ -607,7 +608,7 @@ export namespace KiloSessions {
|
||||
}
|
||||
|
||||
async function meta(sessionId?: string) {
|
||||
const override = sessionId ? Session.getPlatformOverride(sessionId) : undefined
|
||||
const override = sessionId ? KiloSession.getPlatformOverride(sessionId) : undefined
|
||||
const platform = override || process.env["KILO_PLATFORM"] || "cli"
|
||||
const orgId = await getOrgId()
|
||||
const gitBranch = await Vcs.branch().catch(() => undefined)
|
||||
|
||||
@@ -2,6 +2,7 @@ import path from "path"
|
||||
import os from "os"
|
||||
import fs from "fs/promises"
|
||||
import { KiloSessionPrompt } from "@/kilocode/session/prompt" // kilocode_change
|
||||
import { KiloSession } from "@/kilocode/session" // kilocode_change
|
||||
import z from "zod"
|
||||
import { Filesystem } from "../util/filesystem"
|
||||
import { SessionID, MessageID, PartID } from "./schema"
|
||||
@@ -301,7 +302,7 @@ export namespace SessionPrompt {
|
||||
|
||||
// kilocode_change start
|
||||
void Bus.publish(Session.Event.TurnOpen, { sessionID })
|
||||
let closeReason: Session.CloseReason = "completed"
|
||||
let closeReason: KiloSession.CloseReason = "completed"
|
||||
let finished = false
|
||||
await using _ = defer(() => cancel(sessionID))
|
||||
await using _close = defer(async () => {
|
||||
|
||||
@@ -24,7 +24,7 @@ function rewrite(request: Request, directory?: string) {
|
||||
url.searchParams.set("directory", value)
|
||||
}
|
||||
|
||||
const next = new Request(url, request)
|
||||
const next = new Request(url.href, request)
|
||||
next.headers.delete("x-kilo-directory")
|
||||
return next
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user