This commit is contained in:
LukeParkerDev 2026-04-08 14:35:16 +10:00
commit f1547de528
57 changed files with 311 additions and 295 deletions

View file

@ -401,7 +401,7 @@ test("blocked permission flow supports allow once", async ({ page, project }) =>
{
id: "per_e2e_once",
sessionID: session.id,
permission: "bash",
permission: "shell",
patterns: ["/tmp/opencode-e2e-perm-once"],
metadata: { description: "Need permission for command" },
},
@ -434,7 +434,7 @@ test("blocked permission flow supports reject", async ({ page, project }) => {
{
id: "per_e2e_reject",
sessionID: session.id,
permission: "bash",
permission: "shell",
patterns: ["/tmp/opencode-e2e-perm-reject"],
},
undefined,
@ -466,7 +466,7 @@ test("blocked permission flow supports allow always", async ({ page, project })
{
id: "per_e2e_always",
sessionID: session.id,
permission: "bash",
permission: "shell",
patterns: ["/tmp/opencode-e2e-perm-always"],
metadata: { description: "Need permission for command" },
},
@ -561,7 +561,7 @@ test("child session permission request blocks parent dock and supports allow onc
{
id: "per_e2e_child",
sessionID: child.id,
permission: "bash",
permission: "shell",
patterns: ["/tmp/opencode-e2e-perm-child"],
metadata: { description: "Need child permission" },
},

View file

@ -18,7 +18,6 @@ const serverLabels = (() => {
export const serverNames = [...new Set(serverLabels)]
export const serverUrls = serverNames.map((name) => `http://${name}`)
const shell = new Set(["bash", "pwsh", "powershell"])
const escape = (value: string) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
@ -34,7 +33,7 @@ export function createSdk(directory?: string, baseUrl = serverUrl) {
export function isShell(part: unknown): part is ToolPart {
if (!part || typeof part !== "object") return false
if (!("type" in part) || part.type !== "tool") return false
if (!("tool" in part) || typeof part.tool !== "string" || !shell.has(part.tool)) return false
if (!("tool" in part) || part.tool !== "shell") return false
return "state" in part
}

View file

@ -14,8 +14,9 @@ export function SessionPermissionDock(props: {
const toolDescription = () => {
const key = `settings.permissions.tool.${props.request.permission}.description`
const fallback = props.request.permission === "shell" ? "settings.permissions.tool.bash.description" : key
const value = language.t(key as Parameters<typeof language.t>[0])
if (value === key) return ""
if (value === key) return fallback === key ? "" : language.t(fallback as Parameters<typeof language.t>[0])
return value
}