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:
@@ -1,6 +1,6 @@
|
||||
import type { AgentConfig } from "@opencode-ai/sdk"
|
||||
import type { AgentPromptMetadata } from "./types"
|
||||
import { createAgentToolRestrictions } from "../shared/permission-compat"
|
||||
import { createAgentToolAllowlist } from "../shared/permission-compat"
|
||||
|
||||
const DEFAULT_MODEL = "google/gemini-3-flash"
|
||||
|
||||
@@ -14,11 +14,7 @@ export const MULTIMODAL_LOOKER_PROMPT_METADATA: AgentPromptMetadata = {
|
||||
export function createMultimodalLookerAgent(
|
||||
model: string = DEFAULT_MODEL
|
||||
): AgentConfig {
|
||||
const restrictions = createAgentToolRestrictions([
|
||||
"write",
|
||||
"edit",
|
||||
"bash",
|
||||
])
|
||||
const restrictions = createAgentToolAllowlist(["read"])
|
||||
|
||||
return {
|
||||
description:
|
||||
|
||||
@@ -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,
|
||||
|
||||
+19
-11
@@ -1,18 +1,18 @@
|
||||
import type { AgentConfig } from "@opencode-ai/sdk"
|
||||
import type { AvailableAgent, AvailableSkill, AvailableTool } from "./sisyphus-prompt-builder"
|
||||
import { isGptModel } from "./types"
|
||||
import type { AvailableAgent, AvailableTool, AvailableSkill } from "./sisyphus-prompt-builder"
|
||||
import {
|
||||
buildAntiPatternsSection,
|
||||
buildDelegationTable,
|
||||
buildExploreSection,
|
||||
buildFrontendSection,
|
||||
buildHardBlocksSection,
|
||||
buildKeyTriggersSection,
|
||||
buildLibrarianSection,
|
||||
buildOracleSection,
|
||||
buildToolSelectionTable,
|
||||
buildExploreSection,
|
||||
buildLibrarianSection,
|
||||
buildDelegationTable,
|
||||
buildFrontendSection,
|
||||
buildOracleSection,
|
||||
buildHardBlocksSection,
|
||||
buildAntiPatternsSection,
|
||||
categorizeTools,
|
||||
} from "./sisyphus-prompt-builder"
|
||||
import { isGptModel } from "./types"
|
||||
|
||||
const DEFAULT_MODEL = "anthropic/claude-opus-4-5"
|
||||
|
||||
@@ -336,6 +336,7 @@ When you're mentioned in GitHub issues or asked to "look into" something and "cr
|
||||
2. **Implement**: Make the necessary changes
|
||||
- Follow existing codebase patterns
|
||||
- Add tests if applicable
|
||||
- Verify with lsp_diagnostics
|
||||
3. **Verify**: Ensure everything works
|
||||
- Run build if exists
|
||||
- Run tests if exists
|
||||
@@ -360,12 +361,18 @@ const SISYPHUS_CODE_CHANGES = `### Code Changes:
|
||||
|
||||
### Verification:
|
||||
|
||||
Run \`lsp_diagnostics\` on changed files at:
|
||||
- End of a logical task unit
|
||||
- Before marking a todo item complete
|
||||
- Before reporting completion to user
|
||||
|
||||
If project has build/test commands, run them at task completion.
|
||||
|
||||
### Evidence Requirements (task NOT complete without these):
|
||||
|
||||
| Action | Required Evidence |
|
||||
|--------|-------------------|
|
||||
| File edit | \`lsp_diagnostics\` clean on changed files |
|
||||
| Build command | Exit code 0 |
|
||||
| Test run | Pass (or explicit note of pre-existing failures) |
|
||||
| Delegation | Agent result received and verified |
|
||||
@@ -394,6 +401,7 @@ const SISYPHUS_PHASE3 = `## Phase 3 - Completion
|
||||
|
||||
A task is complete when:
|
||||
- [ ] All planned todo items marked done
|
||||
- [ ] Diagnostics clean on changed files
|
||||
- [ ] Build passes (if applicable)
|
||||
- [ ] User's original request fully addressed
|
||||
|
||||
@@ -517,7 +525,7 @@ const SISYPHUS_SOFT_GUIDELINES = `## Soft Guidelines
|
||||
function buildDynamicSisyphusPrompt(
|
||||
availableAgents: AvailableAgent[],
|
||||
availableTools: AvailableTool[] = [],
|
||||
availableSkills: AvailableSkill[] = [],
|
||||
availableSkills: AvailableSkill[] = []
|
||||
): string {
|
||||
const keyTriggers = buildKeyTriggersSection(availableAgents, availableSkills)
|
||||
const toolSelection = buildToolSelectionTable(availableAgents, availableTools, availableSkills)
|
||||
@@ -602,7 +610,7 @@ export function createSisyphusAgent(
|
||||
model: string = DEFAULT_MODEL,
|
||||
availableAgents?: AvailableAgent[],
|
||||
availableToolNames?: string[],
|
||||
availableSkills?: AvailableSkill[],
|
||||
availableSkills?: AvailableSkill[]
|
||||
): AgentConfig {
|
||||
const tools = availableToolNames ? categorizeTools(availableToolNames) : []
|
||||
const skills = availableSkills ?? []
|
||||
|
||||
Reference in New Issue
Block a user