mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
refactor(vscode): remove unused Agent Manager refresh
This commit is contained in:
@@ -240,7 +240,7 @@ export class AgentManagerProvider implements Disposable {
|
||||
await this.stateReady
|
||||
return this.state
|
||||
},
|
||||
stats: (refresh) => this.statsPoller.snapshot(refresh),
|
||||
stats: () => this.statsPoller.snapshot(),
|
||||
prs: () => this.prBridge.snapshot(),
|
||||
push: () => this.pushState(),
|
||||
managed: (id) => this.panelSessions.has(id) || !!this.state?.getSession(id),
|
||||
|
||||
@@ -131,13 +131,7 @@ export class GitStatsPoller {
|
||||
this.lastStats = {}
|
||||
}
|
||||
|
||||
async snapshot(refresh = false): Promise<{ worktrees: WorktreeStats[]; local?: LocalStats }> {
|
||||
if (refresh && !this.busy) {
|
||||
this.busy = true
|
||||
await Promise.all([this.fetchWorktreeStats(true), this.fetchLocalStats()]).finally(() => {
|
||||
this.busy = false
|
||||
})
|
||||
}
|
||||
async snapshot(): Promise<{ worktrees: WorktreeStats[]; local?: LocalStats }> {
|
||||
return {
|
||||
worktrees: Object.values(this.lastStats),
|
||||
...(this.lastLocalStats ? { local: this.lastLocalStats } : {}),
|
||||
|
||||
@@ -44,7 +44,7 @@ interface Options {
|
||||
root(): string | undefined
|
||||
ready(): Promise<WorktreeStateManager | undefined>
|
||||
state(): WorktreeStateManager | undefined
|
||||
stats(refresh?: boolean): Promise<{ worktrees: WorktreeStats[]; local?: LocalStats }>
|
||||
stats(): Promise<{ worktrees: WorktreeStats[]; local?: LocalStats }>
|
||||
prs(): Map<string, PRStatus>
|
||||
push(): void
|
||||
managed(sessionID: string): boolean
|
||||
|
||||
@@ -37,7 +37,7 @@ describe("AgentManagerOrchestrationBridge", () => {
|
||||
const replies: unknown[] = []
|
||||
const rejections: unknown[] = []
|
||||
const lists = new Map<string, AgentManagerRequest[]>()
|
||||
const statsCalls: Array<boolean | undefined> = []
|
||||
const statsCalls: number[] = []
|
||||
const handlers: {
|
||||
event?: (event: SSEPayload, directory?: string) => void
|
||||
state?: (state: "connecting" | "connected" | "disconnected" | "error") => void
|
||||
@@ -103,9 +103,8 @@ describe("AgentManagerOrchestrationBridge", () => {
|
||||
root: () => root,
|
||||
ready: async () => state,
|
||||
state: () => state,
|
||||
stats: async (refresh) => {
|
||||
statsCalls.push(refresh)
|
||||
if (refresh) return new Promise(() => undefined)
|
||||
stats: async () => {
|
||||
statsCalls.push(1)
|
||||
return { worktrees: [] }
|
||||
},
|
||||
prs: () => new Map(),
|
||||
@@ -258,7 +257,7 @@ describe("AgentManagerOrchestrationBridge", () => {
|
||||
test.bridge.dispose()
|
||||
})
|
||||
|
||||
it("returns an overview without waiting for a forced git refresh", async () => {
|
||||
it("returns an overview with cached git stats", async () => {
|
||||
const test = harness()
|
||||
test.request({
|
||||
id: "amr_overview",
|
||||
@@ -267,7 +266,7 @@ describe("AgentManagerOrchestrationBridge", () => {
|
||||
})
|
||||
await waitFor(() => test.replies.length === 1)
|
||||
|
||||
expect(test.statsCalls).toEqual([undefined])
|
||||
expect(test.statsCalls).toEqual([1])
|
||||
expect(test.replies[0]).toEqual({
|
||||
requestID: "amr_overview",
|
||||
directory: root,
|
||||
|
||||
Reference in New Issue
Block a user