mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-29 03:44:06 +08:00
fix(cli): validate notebook_edit before permission prompt
This commit is contained in:
@@ -136,6 +136,7 @@ export const NotebookEditTool = Tool.define<
|
||||
parameters: EditParams,
|
||||
execute: (params, ctx) =>
|
||||
Effect.gen(function* () {
|
||||
const edit = yield* cellEdit(params)
|
||||
yield* ctx.ask({
|
||||
permission: "notebook_edit",
|
||||
patterns: [params.path],
|
||||
@@ -147,7 +148,6 @@ export const NotebookEditTool = Tool.define<
|
||||
expectedRevision: params.expected_revision,
|
||||
},
|
||||
})
|
||||
const edit = yield* cellEdit(params)
|
||||
const result = yield* run(
|
||||
notebook.request({
|
||||
operation: "edit",
|
||||
|
||||
@@ -121,15 +121,17 @@ describe("native notebook tools", () => {
|
||||
)
|
||||
|
||||
it.instance(
|
||||
"rejects insert without kind and source",
|
||||
"rejects insert without kind and source before asking for permission",
|
||||
() =>
|
||||
Effect.gen(function* () {
|
||||
const edit = yield* NotebookEditTool.pipe(Effect.flatMap(Tool.init))
|
||||
const ctx = context([])
|
||||
const asks: Parameters<Tool.Context["ask"]>[0][] = []
|
||||
const ctx = context(asks)
|
||||
const exit = yield* edit
|
||||
.execute({ path: "analysis.ipynb", expected_revision: "content:read", index: 0, action: "insert" }, ctx)
|
||||
.pipe(Effect.exit)
|
||||
expect(exit._tag).toBe("Failure")
|
||||
expect(asks).toEqual([])
|
||||
}),
|
||||
{ git: true },
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user