feat(providers): add proto provider wrapping @protolabsai/sdk#3625
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR integrates the ProtoLabs SDK as a new provider in the agent execution system. It adds the ChangesProtoProvider SDK Integration
Sequence DiagramsequenceDiagram
participant Caller
participant ProtoProvider
participant SDK
participant ErrorHandler
Caller->>ProtoProvider: executeQuery
ProtoProvider->>ProtoProvider: validate model id
ProtoProvider->>ProtoProvider: build QueryOptions
ProtoProvider->>ProtoProvider: normalize prompt
ProtoProvider->>SDK: stream(options)
alt Success
SDK-->>ProtoProvider: messages
ProtoProvider->>ProtoProvider: yield ProviderMessage
ProtoProvider-->>Caller: stream response
else Error
SDK-->>ErrorHandler: error
ErrorHandler->>ErrorHandler: classify and wrap
ErrorHandler-->>Caller: throw with context
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Code Review — ? finding(s)
protoLabs Code Review Report
No findings recorded. |
Programmatic burn-in: ✓ greenBuilt the branch and exercised `ProtoProvider.executeQuery` directly against the gateway. Two passes: 1. Bare query (single-turn, no tools)``` Executing test query through gateway... ✓ Stream complete: 4 messages, last type=result 2. Tool path (read_file)Wrote a temp file with a one-shot token, asked the agent to read it back: ``` tool_use #1: name=read_file input={"file_path":".../secret.txt"} Messages: 7, tool calls: 1, token found in output: true ProtoProvider spawned the SDK, the SDK routed Both tests under 60s. Hooks and MCP servers weren't exercised — those land in PR 2 once Merging. |
Minor bump — the first release since the proto SDK cutover, beads integration, and ~64 commits of fixes / cleanup. Per `npm run release:prepare` (auto-classified from conventional-commit prefixes). Highlights since v0.107.1: - proto SDK is now the primary driver — `@anthropic-ai/claude-agent-sdk` ripped out (#3625-#3629). ProtoProvider wraps `@protolabsai/sdk`, routes through the LiteLLM gateway, default model `protolabs/smart`. - beads (`br`) tracker replaces the in-app TODO surface (#3639) — single source of truth between UI and crew, JSONL is git-friendly. - create-new-project picker trimmed: ai-agent-app, design-system, and browser-extension starters removed (#3638) — 53k LoC deleted. - Fault tolerance round (today): #3635/#3613/#3568/#3594/#3596/#3483 closed — error reasons now reach `feature.statusChangeReason`, merged-PR reconciler has a branch-fallback path, escalation router no longer self-loops, KnowledgeIngestion and LabsService have path containment, branch-name unsafe-char merge gate hard-fails cleanly. - Significant dead-code purge across UI + server (#3577-#3591) — dead routes, services, hooks, view components. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Why
We're cutting over from `@anthropic-ai/claude-agent-sdk` to our own `@protolabsai/sdk` (the protoCLI TypeScript SDK at https://github.com/protoLabsAI/protoCLI/tree/dev/packages/sdk-typescript) so we control the full agent stack — multi-provider routing, gateway auth, tool schemas, hook semantics. The proto SDK is API-compatible enough with the Anthropic one to make this surgical, but the field/shape differences make a one-shot rip-out risky on a load-bearing path. So:
What this PR adds
`apps/server/src/providers/proto-provider.ts` — new `ProtoProvider` class extending `BaseProvider`. Mirrors `ClaudeProvider`'s contract (`executeQuery`, `detectInstallation`, `getAvailableModels`, `supportsFeature`).
Key shape adapters between our `ExecuteOptions` (Claude-shaped) and proto's `QueryOptions`:
Env is built clean (no `process.env` passthrough beyond an allowlist) and routes through the LiteLLM gateway by default — `OPENAI_API_KEY` / `OPENAI_BASE_URL` derived from `GATEWAY_API_KEY` / `GATEWAY_BASE_URL` with a sane default of `https://api.proto-labs.ai/v1\`. Langfuse OTel headers pass through identically to ClaudeProvider so per-turn traces still land in the same dashboards.
`systemPrompt` is honored only in its `string` form for PR 1 — the `SystemPromptPreset` shape in `ExecuteOptions` is Claude-flavored (`preset: 'claude_code'`) and doesn't translate cleanly to proto's `'qwen_code'` preset semantics. PR 2 will surface a first-class preset abstraction at the ExecuteOptions layer.
`apps/server/src/providers/provider-factory.ts` — registers `ProtoProvider` with priority 100 and `isProtoModel` model matcher. Conservative scope: claims only `protolabs/*` model IDs. Existing Claude / Cursor / Codex / OpenCode / Groq / OpenAI-compatible matchers and priorities are untouched, so this is additive.
`apps/server/tests/unit/providers/provider-factory.test.ts` — bumps expected provider count from 6 to 7 and asserts `'proto'` is in the registered set.
`apps/server/package.json` — adds `@protolabsai/sdk@^0.2.0`.
What this PR explicitly does NOT change
Validation
Burn-in plan before PR 2
Summary by CodeRabbit
Release Notes
New Features
Chores