anthropics / anthropics/claude-agent-sdk-typescript

SDK missing model aliases and CLAUDE_PERMISSION_MODE passthrough

Aperta
#117 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Shell
Stelle
1.8k
Fork
226
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

## Summary

When using the Claude Agent SDK programmatically, there are two related issues with discoverability and configuration:

### Issue 1: `supportedModels()` doesn't return all available model aliases

When querying available models via `query.supportedModels()`, only a subset of models is returned:

**Returned:** `default`, `sonnet`, `haiku`

**Missing:** `opus`, `opusplan`, `sonnet[1m]`

This means ACP clients that dynamically discover available models cannot present `opus` or `opusplan` as options to users, even though the CLI accepts these values.

#### Expected Behavior

`supportedModels()` should return all model aliases that Claude Code CLI accepts:

| Alias | Description |
|-------|-------------|
| `default` | Account-dependent default model |
| `sonnet` | Sonnet 4.5 |
| `opus` | Opus 4.5 |
| `haiku` | Haiku 4.5 |
| `opusplan` | Hybrid: Opus for planning, Sonnet for execution |
| `sonnet[1m]` | Sonnet with 1M context window |

#### Reproduction

```typescript
const q = query({ prompt: "test" });
const models = await q.supportedModels();
console.log(models.map(m => m.value));
// Output: ["default", "sonnet", "haiku"]
// Missing: "opus", "opusplan", "sonnet[1m]"
```

### Issue 2: Subagents have `allowDangerouslySkipPermissions` hardcoded to `false`

When spawning subagents (via the Task tool or similar), the SDK hardcodes `allowDangerouslySkipPermissions: false` for subagent sessions. This means even when the parent agent is running with `permissionMode: 'bypassPermissions'`, subagents cannot inherit this mode.

**Note:** When running Claude Code directly via the CLI, subagents correctly inherit the parent's permission mode. This issue is specific to the SDK's subagent spawning behavior, which differs from the CLI behavior.

#### Expected Behavior

Subagents should inherit the parent's permission mode by default, matching the behavior of the CLI. When the parent agent is in bypass mode, subagents should also run in bypass mode.

#### Use Case

When running automated pipelines or CI/CD workflows where the top-level agent has been explicitly configured to bypass permissions, subagents spawned by that agent should also be able to run without permission prompts.

### Related Issues

- #54 - BypassPermissions errors with Code 1 (users experiencing issues with `bypassPermissions` mode)

### Impact

- ACP clients cannot offer `opus` as an explicit model choice
- The `opusplan` hybrid mode is completely undiscoverable via the API
- SDK subagents don't inherit parent permission mode (unlike CLI behavior)
- Automated workflows with subagents are blocked by permission prompts

### Environment

- @anthropic-ai/claude-agent-sdk: 0.1.x
- Platform: macOS/Linux

---

*This issue was written by Claude Code (Opus 4.5).*

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.