Merge branch 'main' into jetbrains/release/v7.0.1-rc.4

This commit is contained in:
Kirill Kalishev
2026-05-29 10:55:50 -04:00
committed by GitHub
2 changed files with 5 additions and 4 deletions
@@ -25,9 +25,11 @@ const render = (kind: "markdown" | "code", text: string) => {
return `<${kind}_cell>\n${body}</${kind}_cell>`
}
export async function open(filepath: string): Promise<Readable | undefined> {
if (path.extname(filepath).toLowerCase() !== ".ipynb") return undefined
export function isFile(filepath: string) {
return path.extname(filepath).toLowerCase() === ".ipynb"
}
export async function open(filepath: string): Promise<Readable> {
const raw = (await Encoding.read(filepath)).text
const data = parse(raw)
if (!object(data) || !Array.isArray(data.cells)) return Readable.from([raw])
+1 -2
View File
@@ -359,8 +359,7 @@ export const ReadTool = Tool.define(
// routed through TextStream.withFallback so non-UTF-8 files are decoded via
// iconv. The body otherwise matches upstream.
export async function lines(filepath: string, opts: { limit: number; offset: number }) {
const extracted = await Notebook.open(filepath) // kilocode_change - extract readable notebook cells before paging
if (extracted) return readLines(extracted, opts) // kilocode_change
if (Notebook.isFile(filepath)) return readLines(await Notebook.open(filepath), opts) // kilocode_change - extract readable notebook cells before paging
return TextStream.withFallback(filepath, (stream) => readLines(stream, opts))
}