chore: generate
This commit is contained in:
@@ -105,9 +105,9 @@ it.instance("explore agent asks for external directories and allows whitelisted
|
|||||||
expect(explore).toBeDefined()
|
expect(explore).toBeDefined()
|
||||||
expect(Permission.evaluate("external_directory", "/some/other/path", explore!.permission).action).toBe("ask")
|
expect(Permission.evaluate("external_directory", "/some/other/path", explore!.permission).action).toBe("ask")
|
||||||
expect(Permission.evaluate("external_directory", Truncate.GLOB, explore!.permission).action).toBe("allow")
|
expect(Permission.evaluate("external_directory", Truncate.GLOB, explore!.permission).action).toBe("allow")
|
||||||
expect(Permission.evaluate("external_directory", path.join(Global.Path.tmp, "agent-work"), explore!.permission).action).toBe(
|
expect(
|
||||||
"allow",
|
Permission.evaluate("external_directory", path.join(Global.Path.tmp, "agent-work"), explore!.permission).action,
|
||||||
)
|
).toBe("allow")
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -548,9 +548,9 @@ it.instance(
|
|||||||
it.instance("global tmp directory children are allowed for external_directory", () =>
|
it.instance("global tmp directory children are allowed for external_directory", () =>
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const build = yield* load((svc) => svc.get("build"))
|
const build = yield* load((svc) => svc.get("build"))
|
||||||
expect(Permission.evaluate("external_directory", path.join(Global.Path.tmp, "scratch"), build!.permission).action).toBe(
|
expect(
|
||||||
"allow",
|
Permission.evaluate("external_directory", path.join(Global.Path.tmp, "scratch"), build!.permission).action,
|
||||||
)
|
).toBe("allow")
|
||||||
expect(Permission.evaluate("external_directory", "/some/other/path", build!.permission).action).toBe("ask")
|
expect(Permission.evaluate("external_directory", "/some/other/path", build!.permission).action).toBe("ask")
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -107,46 +107,50 @@ describe("tool.assertExternalDirectory", () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
it.instance("normalizes Windows path variants to one glob", () =>
|
it.instance(
|
||||||
Effect.gen(function* () {
|
"normalizes Windows path variants to one glob",
|
||||||
const { requests, ctx } = makeCtx()
|
() =>
|
||||||
|
Effect.gen(function* () {
|
||||||
|
const { requests, ctx } = makeCtx()
|
||||||
|
|
||||||
const outerTmp = yield* tmpdirScoped()
|
const outerTmp = yield* tmpdirScoped()
|
||||||
yield* Effect.promise(() => Bun.write(path.join(outerTmp, "outside.txt"), "x"))
|
yield* Effect.promise(() => Bun.write(path.join(outerTmp, "outside.txt"), "x"))
|
||||||
|
|
||||||
const target = path.join(outerTmp, "outside.txt")
|
const target = path.join(outerTmp, "outside.txt")
|
||||||
const alt = target
|
const alt = target
|
||||||
.replace(/^[A-Za-z]:/, "")
|
.replace(/^[A-Za-z]:/, "")
|
||||||
.replaceAll("\\", "/")
|
.replaceAll("\\", "/")
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
|
|
||||||
yield* assertExternalDirectoryEffect(ctx, alt)
|
yield* assertExternalDirectoryEffect(ctx, alt)
|
||||||
|
|
||||||
const req = requests.find((r) => r.permission === "external_directory")
|
const req = requests.find((r) => r.permission === "external_directory")
|
||||||
const expected = glob(path.join(outerTmp, "*"))
|
const expected = glob(path.join(outerTmp, "*"))
|
||||||
expect(req).toBeDefined()
|
expect(req).toBeDefined()
|
||||||
expect(req!.patterns).toEqual([expected])
|
expect(req!.patterns).toEqual([expected])
|
||||||
expect(req!.always).toEqual([expected])
|
expect(req!.always).toEqual([expected])
|
||||||
}),
|
}),
|
||||||
{ git: true },
|
{ git: true },
|
||||||
)
|
)
|
||||||
|
|
||||||
it.instance("uses drive root glob for root files", () =>
|
it.instance(
|
||||||
Effect.gen(function* () {
|
"uses drive root glob for root files",
|
||||||
const { requests, ctx } = makeCtx()
|
() =>
|
||||||
|
Effect.gen(function* () {
|
||||||
|
const { requests, ctx } = makeCtx()
|
||||||
|
|
||||||
const tmp = yield* TestInstance
|
const tmp = yield* TestInstance
|
||||||
const root = path.parse(tmp.directory).root
|
const root = path.parse(tmp.directory).root
|
||||||
const target = path.join(root, "boot.ini")
|
const target = path.join(root, "boot.ini")
|
||||||
|
|
||||||
yield* assertExternalDirectoryEffect(ctx, target)
|
yield* assertExternalDirectoryEffect(ctx, target)
|
||||||
|
|
||||||
const req = requests.find((r) => r.permission === "external_directory")
|
const req = requests.find((r) => r.permission === "external_directory")
|
||||||
const expected = path.join(root, "*")
|
const expected = path.join(root, "*")
|
||||||
expect(req).toBeDefined()
|
expect(req).toBeDefined()
|
||||||
expect(req!.patterns).toEqual([expected])
|
expect(req!.patterns).toEqual([expected])
|
||||||
expect(req!.always).toEqual([expected])
|
expect(req!.always).toEqual([expected])
|
||||||
}),
|
}),
|
||||||
{ git: true },
|
{ git: true },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user