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
7 changes: 1 addition & 6 deletions packages/kilo-vscode/src/KiloProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import { getWorkspaceRoot } from "./review-utils"
import { createMarketplaceRemover, removeAgent, removeMcp } from "./kilo-provider/remove-config-item"
import type { RemoteStatusService } from "./services/RemoteStatusService"
import { resolveProjectDirectory } from "./project-directory"
import { getBusySessionCount, seedSessionStatuses } from "./session-status"
import { seedSessionStatuses } from "./session-status"
import { normalizeEnhancePromptErrorMessage } from "./enhance-prompt-error"
import { retry } from "./services/cli-backend/retry"
import { slimInfo, slimPart, slimParts } from "./kilo-provider/slim-metadata"
Expand Down Expand Up @@ -2372,11 +2372,6 @@ export class KiloProvider implements vscode.WebviewViewProvider, TelemetryProper
this.postMessage(getWorkStylePayload())
}

/** Returns the number of sessions currently in "busy" state. */
private getBusySessionCount(): number {
return getBusySessionCount(this.sessionStatusMap)
}

private async handleUpdateConfig(
partial: Partial<Config>,
project: Partial<Config> = {},
Expand Down
4 changes: 2 additions & 2 deletions packages/kilo-vscode/src/kiloclaw/KiloClawProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ export class KiloClawProvider implements vscode.Disposable {
return false
}

this.attachEventHandlers(events, chat)
this.attachEventHandlers(events)
this.subscribeSandboxContext()
return true
}
Expand Down Expand Up @@ -511,7 +511,7 @@ export class KiloClawProvider implements vscode.Disposable {
this.subscribedConversationContext = null
}

private attachEventHandlers(events: EventServiceClient, _chat: KiloChatClient): void {
private attachEventHandlers(events: EventServiceClient): void {
// Reset on reconnect — the event stream may have missed events while
// disconnected, so refetch authoritative state.
const offReconnect = events.onReconnect(() => {
Expand Down
4 changes: 0 additions & 4 deletions packages/kilo-vscode/src/kiloclaw/kilo-chat-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ export class KiloChatClient {
})
}

getConversation(conversationId: string): Promise<ConversationDetail> {
return this.request(`/v1/conversations/${conversationId}`)
}

createConversation(req: {
sandboxId: string
title?: string
Expand Down
5 changes: 0 additions & 5 deletions packages/kilo-vscode/src/kiloclaw/token-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ export class TokenManager {

constructor(private readonly getClient: () => KiloClient | null) {}

/** Latest resolved token info (may be stale). Used for URL extraction. */
peek(): ChatToken | null {
return this.cached
}

/** Drop the cached token; next `get` will refetch. */
clear(): void {
this.cached = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,37 +257,6 @@ export class AutocompleteServiceManager {
return Date.now() < snoozeUntil
}

/**
* Get remaining snooze time in seconds
*/
public getSnoozeRemainingSeconds(): number {
const snoozeUntil = this.settings?.snoozeUntil
if (!snoozeUntil) {
return 0
}
const remaining = Math.max(0, Math.ceil((snoozeUntil - Date.now()) / 1000))
return remaining
}

/**
* Snooze autocomplete for a specified number of seconds
*/
public async snooze(seconds: number): Promise<void> {
if (this.snoozeTimer) {
clearTimeout(this.snoozeTimer)
this.snoozeTimer = null
}

const snoozeUntil = Date.now() + seconds * 1000
await writeSettings({ snoozeUntil })

this.snoozeTimer = setTimeout(() => {
void this.unsnooze()
}, seconds * 1000)

await this.load()
}

/**
* Cancel snooze and re-enable autocomplete
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ vi.mock("../classic-auto-complete/AutocompleteInlineCompletionProvider", () => {
public setModel(id: string) {
this.modelId = id
}
public getModelId(): string {
return this.modelId
}

constructor(..._args: any[]) {}
}
return { AutocompleteInlineCompletionProvider }
Expand Down Expand Up @@ -317,21 +313,5 @@ describe("AutocompleteServiceManager (less mocked logic)", () => {

expect(manager.isSnoozed()).toBe(true)
})

it("getSnoozeRemainingSeconds() returns 0 when not snoozed", async () => {
const manager = await createManager()
;(manager as any).settings = {}

expect(manager.getSnoozeRemainingSeconds()).toBe(0)
})

it("getSnoozeRemainingSeconds() returns a positive number when snoozed", async () => {
const manager = await createManager()
;(manager as any).settings = { snoozeUntil: Date.now() + 30_000 }

const remaining = manager.getSnoozeRemainingSeconds()
expect(remaining).toBeGreaterThan(0)
expect(remaining).toBeLessThanOrEqual(30)
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,6 @@ export class AutocompleteInlineCompletionProvider implements vscode.InlineComple
this.contextProvider.modelId = modelId
}

public getModelId(): string {
return this.contextProvider.modelId
}

private processSuggestion(
suggestionText: string,
prefix: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,6 @@ export class ErrorBackoff {
return false
}

/**
* Whether a fatal (non-retriable) error is active — credits depleted, auth invalid, etc.
*/
isFatal(): boolean {
return this.fatal !== null
}

/**
* The HTTP status code of the fatal error, or null.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ vi.mock("../../continuedev/core/autocomplete/snippets/getAllSnippets", () => ({
rootPathSnippets: [],
recentlyEditedRangeSnippets: [],
recentlyVisitedRangesSnippets: [],
diffSnippets: [],
clipboardSnippets: [],
ideSnippets: [],
staticSnippet: [],
}),
}))
Expand Down Expand Up @@ -133,9 +131,7 @@ describe("AutocompleteContextProvider", () => {
rootPathSnippets: [],
recentlyEditedRangeSnippets: [],
recentlyVisitedRangesSnippets: [],
diffSnippets: [],
clipboardSnippets: [],
ideSnippets: [],
staticSnippet: [],
})

Expand Down Expand Up @@ -178,9 +174,7 @@ describe("AutocompleteContextProvider", () => {
rootPathSnippets: [],
recentlyEditedRangeSnippets: [],
recentlyVisitedRangesSnippets: [],
diffSnippets: [],
clipboardSnippets: [],
ideSnippets: [],
staticSnippet: [],
})

Expand Down Expand Up @@ -275,9 +269,7 @@ describe("AutocompleteContextProvider", () => {
rootPathSnippets: [],
recentlyEditedRangeSnippets: [],
recentlyVisitedRangesSnippets: [],
diffSnippets: [],
clipboardSnippets: [],
ideSnippets: [],
staticSnippet: [],
})

Expand Down Expand Up @@ -318,27 +310,19 @@ describe("AutocompleteContextProvider", () => {
rootPathSnippets: [],
recentlyEditedRangeSnippets: [],
recentlyVisitedRangesSnippets: [],
diffSnippets: [
{
content: "diff content",
type: AutocompleteSnippetType.Diff,
},
],
clipboardSnippets: [
{
content: "clipboard content",
type: AutocompleteSnippetType.Clipboard,
copiedAt: "2024-01-01",
},
],
ideSnippets: [],
staticSnippet: [],
})

const { getSnippets } = await import("../../continuedev/core/autocomplete/templating/filtering")
;(getSnippets as any).mockImplementation((_helper: any, payload: any) => [
...payload.recentlyOpenedFileSnippets,
...payload.diffSnippets,
...payload.clipboardSnippets,
])

Expand All @@ -357,11 +341,9 @@ describe("AutocompleteContextProvider", () => {
result.snippetsWithUris.some((s) => "filepath" in s && s.filepath && s.filepath.includes("blocked.ts")),
).toBe(false)
// But should contain snippets without file paths
expect(result.snippetsWithUris).toHaveLength(2)
expect(result.snippetsWithUris[0].content).toBe("diff content")
expect(result.snippetsWithUris[0].type).toBe(AutocompleteSnippetType.Diff)
expect(result.snippetsWithUris[1].content).toBe("clipboard content")
expect(result.snippetsWithUris[1].type).toBe(AutocompleteSnippetType.Clipboard)
expect(result.snippetsWithUris).toHaveLength(1)
expect(result.snippetsWithUris[0].content).toBe("clipboard content")
expect(result.snippetsWithUris[0].type).toBe(AutocompleteSnippetType.Clipboard)
})

it("should allow all files when no ignore controller is provided", async () => {
Expand Down Expand Up @@ -389,9 +371,7 @@ describe("AutocompleteContextProvider", () => {
rootPathSnippets: [],
recentlyEditedRangeSnippets: [],
recentlyVisitedRangesSnippets: [],
diffSnippets: [],
clipboardSnippets: [],
ideSnippets: [],
staticSnippet: [],
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { VsCodeIde } from "../continuedev/core/vscode-test-harness/src/VSCodeIde
import { AutocompleteInput } from "../types"
import { HelperVars } from "../continuedev/core/autocomplete/util/HelperVars"
import { getAllSnippetsWithoutRace } from "../continuedev/core/autocomplete/snippets/getAllSnippets"
import { getDefinitionsFromLsp } from "../continuedev/core/vscode-test-harness/src/autocomplete/lsp"
import { DEFAULT_AUTOCOMPLETE_OPTS } from "../continuedev/core/util/parameters"
import { getSnippets } from "../continuedev/core/autocomplete/templating/filtering"
import { FileIgnoreController } from "../shims/FileIgnoreController"
Expand Down Expand Up @@ -97,7 +96,6 @@ export async function getProcessedSnippets(
const snippetPayload = await getAllSnippetsWithoutRace({
helper,
ide,
getDefinitionsFromLsp,
contextRetrievalService: contextService,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import { extractDiffInfo as _extractDiffInfo } from "./visible-code-utils"
const GIT_SCHEMES = ["git", "gitfs", "file", "vscode-remote"]

export class VisibleCodeTracker {
private lastContext: VisibleCodeContext | null = null

constructor(
private workspacePath: string,
private ignoreController: FileIgnoreController | null = null,
Expand Down Expand Up @@ -101,19 +99,10 @@ export class VisibleCodeTracker {
})
}

this.lastContext = {
return {
timestamp: Date.now(),
editors: editorInfos,
}

return this.lastContext
}

/**
* Returns the last captured context, or null if never captured.
*/
public getLastContext(): VisibleCodeContext | null {
return this.lastContext
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import { getUriFileExtension } from "../../util/uri"
import { BracketMatchingService } from "../filtering/BracketMatchingService"
import { CharacterFilter, LineFilter } from "../filtering/streamTransforms/lineStream"

type LineStream = AsyncGenerator<string>
type LineFilter = (args: { lines: LineStream; fullStop: () => void }) => LineStream
type CharacterFilter = (args: {
chars: AsyncGenerator<string>
prefix: string
suffix: string
filepath: string
multiline: boolean
}) => AsyncGenerator<string>

export interface AutocompleteLanguageInfo {
/**
Expand Down
Loading
Loading