ShtukbaseStandard
файл пакета→ .shtukbase/packages/harness-claude/adapter.ts

adapter.ts

25 строк, 1.5 КБ.

Файл как есть в пакете: код и комментарии в нём не переводятся.

  1. // Claude Code: `claude -p` reads the prompt on stdin and prints the answer. Safe defaults: --restricted (no Bash and
  2. // no code-running tools, file tools confined to the working folder, user and project settings ignored), only the
  3. // file tools the access allows, no WebFetch/WebSearch unless network: true, nobody to answer a permission prompt.
  4. import type { Adapter } from '../harness/lib/harness.ts';
  5. export const adapter: Adapter = {
  6. id: 'claude', pkg: 'harness-claude', bin: 'claude', title: 'Claude Code', defaultModel: 'haiku',
  7. install: 'curl -fsSL https://claude.ai/install.sh | bash, then claude and sign in with a subscription',
  8. build(s) {
  9. const tools = [...['Read', 'Glob', 'Grep'], ...(s.access === 'write' ? ['Edit', 'Write'] : []), ...(s.network ? ['WebFetch', 'WebSearch'] : [])];
  10. return {
  11. exe: 'claude',
  12. args: [
  13. '-p', '--model', s.model, '--restricted', '--tools', tools.join(','),
  14. '--permission-mode', s.access === 'write' ? 'acceptEdits' : 'dontAsk', '--permission-prompts', 'none',
  15. '--no-session-persistence', '--strict-mcp-config', '--output-format', 'text',
  16. // In acceptEdits/dontAsk with no prompts the web tools are refused unless allowed by name.
  17. ...(s.network ? ['--allowedTools', 'WebFetch,WebSearch'] : []),
  18. ...(s.effort ? ['--effort', s.effort] : []),
  19. ],
  20. stdin: s.prompt,
  21. unset: ['CLAUDECODE', 'CLAUDE_CODE_ENTRYPOINT'], // a run started from inside a Claude Code session is a fresh one
  22. };
  23. },
  24. };