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
26 changes: 0 additions & 26 deletions packages/kilo-vscode/tests/unit/task-session.test.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,6 @@
import { describe, expect, it } from "bun:test"
import { childID } from "../../src/kilo-provider/task-session"
import { VisibleTaskStreams } from "../../src/kilo-provider/visible-task-streams"

describe("childID", () => {
it("reads session ID from top-level metadata", () => {
expect(childID({ type: "tool", tool: "task", metadata: { sessionId: "child1" } })).toBe("child1")
})

it("reads session ID from state metadata", () => {
expect(childID({ type: "tool", tool: "task", state: { metadata: { sessionId: "child2" } } })).toBe("child2")
})

it("prefers top-level metadata over state metadata", () => {
expect(
childID({
type: "tool",
tool: "task",
metadata: { sessionId: "top" },
state: { metadata: { sessionId: "nested" } },
}),
).toBe("top")
})

it("ignores non-task tool parts", () => {
expect(childID({ type: "tool", tool: "read", state: { metadata: { sessionId: "child3" } } })).toBeUndefined()
})
})

describe("VisibleTaskStreams", () => {
it("suspends and restores visible child sessions with provider activity", () => {
const sent: Array<[string, boolean]> = []
Expand Down
8 changes: 3 additions & 5 deletions packages/kilo-vscode/webview-ui/src/context/session-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import {
} from "../../../src/shared/browser-feedback"
import type { ReviewCommentEntry, ReviewMessageData } from "../../../src/shared/review-comments"
import { partInjected } from "../../../src/shared/injected-prompt"
import { childID } from "../../../src/kilo-provider/task-session"

export { childID }

export const SNAPSHOT_PROGRESS_TEXT = "Initializing snapshot..."

Expand Down Expand Up @@ -165,11 +168,6 @@ type TaskPart = {
state?: ToolState
}

export function childID(part: TaskPart): string | undefined {
if (part.type !== "tool" || part.tool !== "task") return undefined
return part.metadata?.sessionId ?? part.state?.metadata?.sessionId
}

export function inUse(
family: ReadonlySet<string>,
statuses: Record<string, { type: string }>,
Expand Down
Loading