archivo del paquete→ .shtukbase/packages/harness-claude/adapter.ts
adapter.ts
25 líneas, 1.5 KB.
El archivo tal como está en el paquete: el código y sus comentarios no se traducen.
- // Claude Code: `claude -p` reads the prompt on stdin and prints the answer. Safe defaults: --restricted (no Bash and
- // no code-running tools, file tools confined to the working folder, user and project settings ignored), only the
- // file tools the access allows, no WebFetch/WebSearch unless network: true, nobody to answer a permission prompt.
- import type { Adapter } from '../harness/lib/harness.ts';
- export const adapter: Adapter = {
- id: 'claude', pkg: 'harness-claude', bin: 'claude', title: 'Claude Code', defaultModel: 'haiku',
- install: 'curl -fsSL https://claude.ai/install.sh | bash, then claude and sign in with a subscription',
- build(s) {
- const tools = [...['Read', 'Glob', 'Grep'], ...(s.access === 'write' ? ['Edit', 'Write'] : []), ...(s.network ? ['WebFetch', 'WebSearch'] : [])];
- return {
- exe: 'claude',
- args: [
- '-p', '--model', s.model, '--restricted', '--tools', tools.join(','),
- '--permission-mode', s.access === 'write' ? 'acceptEdits' : 'dontAsk', '--permission-prompts', 'none',
- '--no-session-persistence', '--strict-mcp-config', '--output-format', 'text',
- // In acceptEdits/dontAsk with no prompts the web tools are refused unless allowed by name.
- ...(s.network ? ['--allowedTools', 'WebFetch,WebSearch'] : []),
- ...(s.effort ? ['--effort', s.effort] : []),
- ],
- stdin: s.prompt,
- unset: ['CLAUDECODE', 'CLAUDE_CODE_ENTRYPOINT'], // a run started from inside a Claude Code session is a fresh one
- };
- },
- };