package file→ .shtukbase/packages/harness-opencode/adapter.ts
adapter.ts
19 lines, 1.2 KB.
- // OpenCode: `opencode run <message>` answers once and exits. Permissions come from inline config
- // (OPENCODE_CONFIG_CONTENT): edits allowed only with access: write, shell denied, web denied unless network: true,
- // folders outside the working folder denied. --pure: no external plugins.
- import type { Adapter } from '../harness/lib/harness.ts';
- export const adapter: Adapter = {
- id: 'opencode', pkg: 'harness-opencode', bin: 'opencode', title: 'OpenCode', defaultModel: 'opencode-go/deepseek-v4.1-flash',
- install: 'curl -fsSL https://opencode.ai/install | bash, then opencode auth login (the OpenCode Go subscription)',
- build(s) {
- const web = s.network ? 'allow' : 'deny';
- const permission = { edit: s.access === 'write' ? 'allow' : 'deny', bash: 'deny', webfetch: web, websearch: web, external_directory: 'deny' };
- return {
- exe: 'opencode',
- args: ['run', '--pure', '--dir', s.cwd, '-m', s.model, ...(s.effort ? ['--variant', s.effort] : []), '--', s.prompt],
- env: { OPENCODE_CONFIG_CONTENT: JSON.stringify({ permission }) },
- notes: ['the shell (bash) of an OpenCode agent is always off: otherwise the file and network rights cannot be held'],
- };
- },
- };