feat(multimodal-looker): restrict to read-only tool access

Use createAgentToolAllowlist to allow only 'read' tool for multimodal-looker agent.
Previously denied write/edit/bash but allowed other tools.
Now uses wildcard deny pattern (*: deny) with explicit read allow.

- Add createAgentToolAllowlist function for allowlist-based restrictions
- Support legacy fallback for older OpenCode versions
- Add 4 test cases covering both permission systems
This commit is contained in:
justsisyphus
2026-01-16 15:02:55 +09:00
parent 27ef9fa8df
commit ede9abceb3
5 changed files with 150 additions and 23 deletions
+8 -6
View File
@@ -1,11 +1,11 @@
import type { AgentConfig } from "@opencode-ai/sdk"
import { isGptModel } from "./types"
import type { AgentOverrideConfig, CategoryConfig } from "../config/schema"
import {
createAgentToolRestrictions,
migrateAgentConfig,
supportsNewPermissionSystem,
} from "../shared/permission-compat"
import { isGptModel } from "./types"
const SISYPHUS_JUNIOR_PROMPT = `<Role>
Sisyphus-Junior - Focused executor from OhMyOpenCode.
@@ -58,6 +58,7 @@ No todos on multi-step work = INCOMPLETE WORK.
<Verification>
Task NOT complete without:
- lsp_diagnostics clean on changed files
- Build passes (if applicable)
- All todos marked completed
</Verification>
@@ -84,7 +85,7 @@ export const SISYPHUS_JUNIOR_DEFAULTS = {
export function createSisyphusJuniorAgentWithOverrides(
override: AgentOverrideConfig | undefined,
systemDefaultModel?: string,
systemDefaultModel?: string
): AgentConfig {
if (override?.disable) {
override = undefined
@@ -120,8 +121,7 @@ export function createSisyphusJuniorAgentWithOverrides(
}
const base: AgentConfig = {
description:
override?.description ??
description: override?.description ??
"Sisyphus-Junior - Focused task executor. Same discipline, no delegation.",
mode: "subagent" as const,
model,
@@ -148,7 +148,7 @@ export function createSisyphusJuniorAgentWithOverrides(
export function createSisyphusJuniorAgent(
categoryConfig: CategoryConfig,
promptAppend?: string,
promptAppend?: string
): AgentConfig {
const prompt = buildSisyphusJuniorPrompt(promptAppend)
const model = categoryConfig.model
@@ -158,8 +158,10 @@ export function createSisyphusJuniorAgent(
...(categoryConfig.tools ? { tools: categoryConfig.tools } : {}),
})
const base: AgentConfig = {
description: "Sisyphus-Junior - Focused task executor. Same discipline, no delegation.",
description:
"Sisyphus-Junior - Focused task executor. Same discipline, no delegation.",
mode: "subagent" as const,
model,
maxTokens: categoryConfig.maxTokens ?? 64000,