mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-01 15:32:11 +08:00
test(vscode): exempt sidebar tab context in Agent Manager
This commit is contained in:
@@ -25,7 +25,9 @@ export async function routeEarlyMessage(message: { type: string }, ctx: Ctx): Pr
|
||||
}
|
||||
if (message.type === "sidebar.openSessions") {
|
||||
const input = message as { sessionIDs?: unknown }
|
||||
const ids = Array.isArray(input.sessionIDs) ? input.sessionIDs.filter((id): id is string => typeof id === "string") : []
|
||||
const ids = Array.isArray(input.sessionIDs)
|
||||
? input.sessionIDs.filter((id): id is string => typeof id === "string")
|
||||
: []
|
||||
ctx.openSessions(ids)
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -761,6 +761,9 @@ describe("Agent Manager — provider chain parity with sidebar", () => {
|
||||
// which the agent manager already includes in its provider chain.
|
||||
"LanguageProvider",
|
||||
"DataProvider",
|
||||
// Agent Manager owns its local session tabs and ChatView only reads this
|
||||
// optional context in the standard sidebar/editor webview.
|
||||
"LocalTabsProvider",
|
||||
]
|
||||
|
||||
it("agent manager includes all context providers from sidebar App.tsx", () => {
|
||||
|
||||
@@ -103,22 +103,17 @@ describe("shared close selection", () => {
|
||||
|
||||
describe("tracked tab restore", () => {
|
||||
it("restores durable local sessions when the current list has no real tabs", () => {
|
||||
expect(restoreTrackedTabs(inventory(["s1", "s2"]), [], undefined, trackedPending, identity)).toEqual([
|
||||
"s1",
|
||||
"s2",
|
||||
])
|
||||
expect(restoreTrackedTabs(inventory(["s1", "s2"]), [], undefined, trackedPending, identity)).toEqual(["s1", "s2"])
|
||||
})
|
||||
|
||||
it("skips externally owned sessions while restoring local sessions", () => {
|
||||
expect(
|
||||
restoreTrackedTabs(inventory(["s2"], ["s1", "s3"]), [], undefined, trackedPending, identity),
|
||||
).toEqual(["s2"])
|
||||
expect(restoreTrackedTabs(inventory(["s2"], ["s1", "s3"]), [], undefined, trackedPending, identity)).toEqual(["s2"])
|
||||
})
|
||||
|
||||
it("evicts externally owned sessions already in the current local list", () => {
|
||||
expect(
|
||||
restoreTrackedTabs(inventory(["s1"], ["s2"]), ["s1", "s2"], undefined, trackedPending, identity),
|
||||
).toEqual(["s1"])
|
||||
expect(restoreTrackedTabs(inventory(["s1"], ["s2"]), ["s1", "s2"], undefined, trackedPending, identity)).toEqual([
|
||||
"s1",
|
||||
])
|
||||
})
|
||||
|
||||
it("applies durable ordering and merges sessions missing from stale webview state", () => {
|
||||
@@ -128,7 +123,9 @@ describe("tracked tab restore", () => {
|
||||
})
|
||||
|
||||
it("does not overwrite an already-restored real list without a change", () => {
|
||||
expect(restoreTrackedTabs(inventory(["s1", "s2"]), ["s1", "s2"], undefined, trackedPending, identity)).toBeUndefined()
|
||||
expect(
|
||||
restoreTrackedTabs(inventory(["s1", "s2"]), ["s1", "s2"], undefined, trackedPending, identity),
|
||||
).toBeUndefined()
|
||||
})
|
||||
|
||||
it("restores disk sessions when current tabs are only pending drafts", () => {
|
||||
|
||||
@@ -1,4 +1,14 @@
|
||||
import { createContext, createEffect, createMemo, createSignal, onCleanup, onMount, type Accessor, type ParentComponent, useContext } from "solid-js"
|
||||
import {
|
||||
createContext,
|
||||
createEffect,
|
||||
createMemo,
|
||||
createSignal,
|
||||
onCleanup,
|
||||
onMount,
|
||||
type Accessor,
|
||||
type ParentComponent,
|
||||
useContext,
|
||||
} from "solid-js"
|
||||
import { useServer } from "./server"
|
||||
import { useSession } from "./session"
|
||||
import { useVSCode } from "./vscode"
|
||||
@@ -134,11 +144,7 @@ export const LocalTabsProvider: ParentComponent = (props) => {
|
||||
const before = active()
|
||||
const listed = message.sessions.map((item) => item.id)
|
||||
for (const id of listed) fresh.delete(id)
|
||||
const next = reconcileTabs(
|
||||
current(),
|
||||
[...listed, ...(message.preserveSessionIds ?? []), ...fresh],
|
||||
pending(),
|
||||
)
|
||||
const next = reconcileTabs(current(), [...listed, ...(message.preserveSessionIds ?? []), ...fresh], pending())
|
||||
apply(next)
|
||||
if (before !== next.active) focus(next.active)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user