feat(providers): add Claude CLI provider (OAuth-backed, text-only)#8
Open
arakakileo wants to merge 5 commits into
Open
feat(providers): add Claude CLI provider (OAuth-backed, text-only)#8arakakileo wants to merge 5 commits into
arakakileo wants to merge 5 commits into
Conversation
Rides the local claude CLI's OAuth session (Claude Max/Pro) instead of requiring an Anthropic API key. Implements LanguageModelV1 so it plugs into the same streamText/generateText path as the @ai-sdk/anthropic provider. Text-only: built-in CLI tools are disabled via --tools "" so the spawned claude never executes locally. Callers that pass mode.tools get a warning and proceed without tool calls — workflows that need tools must use anthropic (API key) or openai. - claude-cli.ts: LanguageModelV1 + BaseProvider, stream-json parsing, stdout drained on 'close' to avoid racing with pending data - registry.ts: branch for claudeCli instantiation - config.ts: claudeCli block in defaults, isProviderConfigured skips apiKey check (auth comes from CLI OAuth) - provider-models.ts: opus/sonnet/haiku as preferred model aliases
…uledTask Remove the pre-run channel.send() that emits 'Scheduled task started...' / 'All actions auto-approved for this run.' before every scheduled task execution. Scheduled tasks still enqueue and execute through processInternalPrompt(). The heartbeat reminder notification block is unchanged. Logger.info at task entry preserved for server-side diagnostics. Refs: paperclip task aeae06c7-be9a-4330-bb5b-341701f47f91 (LEOA-860)
7 Vitest cases proving LEOA-859 regression safety: - No-op scheduled task sends zero startup notifications - Actionable task still invokes runtime handler correctly - Task failure propagates error without startup notification - Multiple consecutive no-ops accumulate zero notifications - Skill-based tasks also silent - Prompt construction contains no startup banner strings Refs: LEOA-861
Refs: paperclip task LEOA-861 Co-Authored-By: Paperclip <noreply@paperclip.ing>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ClaudeCliProviderthat rides the localclaudeCLI's OAuth session (Claude Max/Pro) — no Anthropic API key requiredLanguageModelV1so it plugs into the samestreamText/generateTextflow as@ai-sdk/anthropic--tools ""; callers passingmode.toolsget a warning and proceed without tool callsChanges
src/providers/claude-cli.ts— new provider (spawnsclaude -p --output-format stream-json, parses events, drains stdout on'close'to avoid racing pending data, kills child on stream cancel/abort)src/providers/registry.ts— instantiation branch forclaudeClisrc/providers/index.ts— re-exportsrc/utils/config.ts—claudeCliblock in defaults +ProviderName;isProviderConfiguredskips apiKey check (auth comes from CLI OAuth)src/utils/provider-models.ts—opus/sonnet/haikuas preferred aliases for the model pickerpackage-lock.json— resync with optionalbetter-sqlite3+ node 20 engines (follow-up to 2f7e5e6 / af1125c)Limitation (documented in file header)
claude -pdoesn't accept caller-defined tools — only its own built-ins (Bash, Read, Edit, ...). Those are disabled so the adapter is strictly text-generation. Workflows requiring tools (Mercury's scheduled skills) must stay onanthropic/openai.Env
New env vars (all optional, provider disabled by default):
CLAUDE_CLI_ENABLED(defaultfalse)CLAUDE_CLI_PATH(defaultclaude)CLAUDE_CLI_MODEL(defaultopus)Test plan
npm run typecheck— cleannpm run build— tsup ESM buildsnpm test— 20/20 passgenerateText— returned expected output end-to-end against localclaudeOAuth sessionstreamText— same, via'close'-based finish path