Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -661,10 +661,6 @@ export class AgentManagerProvider implements Disposable {
void this.importer.branches()
return null
}
if (m.type === "agentManager.requestExternalWorktrees") {
void this.importer.external()
return null
}
if (m.type === "agentManager.importFromBranch") {
void this.importer.branch(m.branch)
return null
Expand All @@ -673,14 +669,6 @@ export class AgentManagerProvider implements Disposable {
void this.importer.pr(m.url)
return null
}
if (m.type === "agentManager.importExternalWorktree") {
void this.importer.path(m.path, m.branch)
return null
}
if (m.type === "agentManager.importAllExternalWorktrees") {
void this.importer.all()
return null
}
}

private onDiffMessage(m: AgentManagerInMessage): Record<string, unknown> | null | undefined {
Expand Down Expand Up @@ -868,7 +856,7 @@ export class AgentManagerProvider implements Disposable {
}
}

/** Send worktreeSetup.ready + sessionMeta + pushState after worktree creation. */
/** Send worktreeSetup.ready + pushState after worktree creation. */
private notifyWorktreeReady(sessionId: string, result: CreateWorktreeResult, worktreeId?: string): void {
this.pushState()
this.postToWebview({
Expand All @@ -879,14 +867,6 @@ export class AgentManagerProvider implements Disposable {
branch: result.branch,
worktreeId,
})
this.postToWebview({
type: "agentManager.sessionMeta",
sessionId,
mode: "worktree",
branch: result.branch,
path: result.path,
parentBranch: result.parentBranch,
})
}

private async waitForStateReady(context: string): Promise<void> {
Expand All @@ -907,8 +887,6 @@ export class AgentManagerProvider implements Disposable {
case "agentManager.requestBranches":
case "agentManager.importFromBranch":
case "agentManager.importFromPR":
case "agentManager.importExternalWorktree":
case "agentManager.importAllExternalWorktrees":
case "agentManager.setTabOrder":
case "agentManager.setWorktreeOrder":
case "agentManager.setSessionsCollapsed":
Expand Down
12 changes: 0 additions & 12 deletions packages/kilo-vscode/src/agent-manager/SessionTerminalManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,6 @@ export class SessionTerminalManager {
return true
}

/**
* Check if a session has an active terminal.
*/
hasTerminal(sessionId: string): boolean {
const entry = this.terminals.get(sessionId)
return entry !== undefined && entry.terminal.exitStatus === undefined
}

hasActiveTerminal(): boolean {
return this.host.activeTerminal() !== undefined
}

activeSession(): string | undefined {
const active = this.host.activeTerminal()
if (!active) return undefined
Expand Down
12 changes: 0 additions & 12 deletions packages/kilo-vscode/src/agent-manager/SetupScriptService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,6 @@ export class SetupScriptService {
return this.resolveScript(platform) !== undefined
}

/** Read the setup script content. Returns null if not found or read fails. */
async getScript(platform: NodeJS.Platform = process.platform): Promise<string | null> {
const script = this.resolveScript(platform)
if (!script) return null
try {
return await fs.promises.readFile(script.path, "utf-8")
} catch (error) {
this.log(`Failed to read setup script: ${error}`)
return null
}
}

/** Create a default setup script with helpful comments for the current platform. */
async createDefaultScript(platform: NodeJS.Platform = process.platform): Promise<void> {
if (!fs.existsSync(this.dir)) {
Expand Down
25 changes: 2 additions & 23 deletions packages/kilo-vscode/src/agent-manager/WorktreeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ export interface CreateWorktreeResult {
startPointWarning?: string
}

export interface ExternalWorktreeItem {
path: string
branch: string
}

/**
* Backward compat: split a possibly-prefixed branch like "origin/main" into
* `{ branch: "main", remote: "origin" }`. If no slash is found, returns bare branch.
Expand Down Expand Up @@ -815,7 +810,7 @@ export class WorktreeManager {

// 4. Derived fallback
if (allowFallback) {
const fallbacks = await this.derivedFallbackBranches(branch)
const fallbacks = await this.derivedFallbackBranches()
for (const fallback of fallbacks) {
if (fallback === branch) continue // already tried
try {
Expand Down Expand Up @@ -863,7 +858,7 @@ export class WorktreeManager {
}
}

async derivedFallbackBranches(requested: string): Promise<string[]> {
async derivedFallbackBranches(): Promise<string[]> {
const defaults = []
try {
defaults.push(await this.defaultBranch())
Expand Down Expand Up @@ -1015,22 +1010,6 @@ export class WorktreeManager {
}
}

async listExternalWorktrees(managedPaths: Set<string>): Promise<ExternalWorktreeItem[]> {
try {
const raw = await this.git.raw(["worktree", "list", "--porcelain"])
const normalizedRoot = normalizePath(this.root)
const normalizedManaged = new Set([...managedPaths].map(normalizePath))
return parseWorktreeList(raw)
.filter(
(e) => !e.bare && normalizePath(e.path) !== normalizedRoot && !normalizedManaged.has(normalizePath(e.path)),
)
.map((e) => ({ path: e.path, branch: e.branch }))
} catch (error) {
this.log(`Failed to list external worktrees: ${error}`)
return []
}
}

async createFromPR(url: string): Promise<CreateWorktreeResult> {
return this.withGitLock(() => this.createFromPRImpl(url))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ function createMockHost(): Host {
openFolder: vi.fn(),
createOutput: () => ({ appendLine: vi.fn(), dispose: vi.fn() }) as OutputHandle,
extensionKeybindings: () => [],
serverPort: () => undefined,
capture: vi.fn(),
dispose: vi.fn(),
}
Expand Down
3 changes: 0 additions & 3 deletions packages/kilo-vscode/src/agent-manager/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,6 @@ export interface Host {
/** Read extension keybinding metadata. */
extensionKeybindings(): Array<{ command: string; key?: string; mac?: string }>

/** Get the CLI server port (for webview CSP). */
serverPort(): number | undefined

/** Copy text to the system clipboard. */
copyToClipboard(text: string): void

Expand Down
36 changes: 0 additions & 36 deletions packages/kilo-vscode/src/agent-manager/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import type { Worktree, ManagedSession, Section } from "./WorktreeStateManager"
import type { WorktreeStats, LocalStats } from "./GitStatsPoller"
import type { ApplyConflict } from "./GitOps"
import type { BranchListItem, WorktreeSetupErrorCode } from "./git-import"
import type { ExternalWorktreeItem } from "./WorktreeManager"
import type { RunStatus } from "./run/manager"
import type { TerminalFont } from "./terminal-font"

Expand All @@ -23,8 +22,6 @@ export type { TerminalFont }
// Shared payload types
// ---------------------------------------------------------------------------

type SessionMode = "worktree" | "local"

export type ApplyDiffStatus = "checking" | "applying" | "success" | "conflict" | "error"

export type WorktreeDiffEntry = SnapshotFileDiff & {
Expand Down Expand Up @@ -114,15 +111,6 @@ interface WorktreeSetupMessage {
errorCode?: WorktreeSetupErrorCode
}

interface SessionMetaMessage {
type: "agentManager.sessionMeta"
sessionId: string
mode: SessionMode
branch?: string
path?: string
parentBranch?: string
}

interface StateMessage {
type: "agentManager.state"
worktrees: Worktree[]
Expand Down Expand Up @@ -228,11 +216,6 @@ interface BranchesMessage {
defaultBranch: string
}

interface ExternalWorktreesMessage {
type: "agentManager.externalWorktrees"
worktrees: ExternalWorktreeItem[]
}

interface ImportResultMessage {
type: "agentManager.importResult"
success: boolean
Expand Down Expand Up @@ -307,7 +290,6 @@ export type AgentManagerOutMessage =
| WorktreeStatsMessage
| LocalStatsMessage
| WorktreeSetupMessage
| SessionMetaMessage
| StateMessage
| ErrorOutMessage
| SessionAddedMessage
Expand All @@ -317,7 +299,6 @@ export type AgentManagerOutMessage =
| SetSessionModelMessage
| SendInitialMessage
| BranchesMessage
| ExternalWorktreesMessage
| ImportResultMessage
| KeybindingsMessage
| RepoInfoMessage
Expand Down Expand Up @@ -500,10 +481,6 @@ interface SetDefaultBaseBranchIn {
branch?: string
}

interface RequestExternalWorktreesIn {
type: "agentManager.requestExternalWorktrees"
}

interface ImportFromBranchIn {
type: "agentManager.importFromBranch"
branch: string
Expand All @@ -514,16 +491,6 @@ interface ImportFromPRIn {
url: string
}

interface ImportExternalWorktreeIn {
type: "agentManager.importExternalWorktree"
path: string
branch: string
}

interface ImportAllExternalWorktreesIn {
type: "agentManager.importAllExternalWorktrees"
}

interface RequestWorktreeDiffIn {
type: "agentManager.requestWorktreeDiff"
sessionId: string
Expand Down Expand Up @@ -807,11 +774,8 @@ export type AgentManagerInMessage =
| SetReviewDiffStyleIn
| SetReviewMarkdownRenderIn
| SetDefaultBaseBranchIn
| RequestExternalWorktreesIn
| ImportFromBranchIn
| ImportFromPRIn
| ImportExternalWorktreeIn
| ImportAllExternalWorktreesIn
| RequestWorktreeDiffIn
| RequestWorktreeDiffFileIn
| ApplyWorktreeDiffIn
Expand Down
6 changes: 1 addition & 5 deletions packages/kilo-vscode/src/agent-manager/vscode-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import * as vscode from "vscode"
import type { Host, PanelContext, OutputHandle, SessionProvider, Disposable } from "./host"
import type { Host, PanelContext, OutputHandle, SessionProvider } from "./host"
import type { KiloConnectionService } from "../services/cli-backend"
import { KiloProvider } from "../KiloProvider"
import { PLATFORM, SNAPSHOT_INITIALIZATION } from "./constants"
Expand Down Expand Up @@ -216,10 +216,6 @@ export class VscodeHost implements Host {
return ext?.packageJSON?.contributes?.keybindings ?? []
}

serverPort(): number | undefined {
return this.connectionService.getServerInfo()?.port
}

copyToClipboard(text: string): void {
void vscode.env.clipboard.writeText(text)
}
Expand Down
Loading
Loading