Tracking issue for an Effect bridge to the Coder AI SDK — a new packages/effect package (@coder/ai-sdk-effect) exposing the three existing packages through Effect-native abstractions.
Architecture
The bridge adapts our imperative SDK surfaces to Effect's service/Layer/Stream model without changing the underlying packages:
LanguageModel service over AI Gateway (@coder/ai-sdk-provider): implement Effect's LanguageModel interface on top of the gateway endpoints, mapping Effect Prompt/Response to the provider's chat-completions/messages calls and HTTP failures to typed AiErrors (auth, quota, provider-unavailable, malformed-response), preserving the centralized vs BYOK auth modes.
- Schema interop: helpers bridging Standard Schema / Effect Schema to the SDK's tool-definition and structured-output surfaces, so Effect users define tools and output schemas in Effect Schema and get correct wire types both directions.
- Scoped resource management for sandboxes (
@coder/ai-sdk-sandbox): ensureCoderWorkspace + session lifecycle as Effect.acquireRelease / scoped Layers, so workspace acquisition, agent-readiness waits, and teardown compose with Effect scopes and interruption.
LanguageModel over CoderAgent/chatd (@coder/ai-sdk-agent): server-side agent loop as an Effect service — TurnTranslator output mapped onto Effect Stream, fiber interruption wired to agent.interrupt(), and the SDK's retryable/terminal error taxonomy (CoderStreamError.isRetryable, timeout vs cancellation) surfaced as tagged errors usable with Effect retry policies.
Roadmap
Phase 1 — Spike (in flight)
Phase 2
Notes
- Spike ships as a private package: no npm publish and no release-please manifest entry until Phase 1 review concludes the API shape is right.
- Effect / @effect/ai are fast-moving; the spike should pin exact versions and record the pinned API surface in the package README.
Generated with mux • Model: anthropic:claude-fable-5 • Thinking: xhigh
Tracking issue for an Effect bridge to the Coder AI SDK — a new
packages/effectpackage (@coder/ai-sdk-effect) exposing the three existing packages through Effect-native abstractions.Architecture
The bridge adapts our imperative SDK surfaces to Effect's service/Layer/Stream model without changing the underlying packages:
LanguageModelservice over AI Gateway (@coder/ai-sdk-provider): implement Effect'sLanguageModelinterface on top of the gateway endpoints, mapping EffectPrompt/Responseto the provider's chat-completions/messages calls and HTTP failures to typedAiErrors (auth, quota, provider-unavailable, malformed-response), preserving the centralized vs BYOK auth modes.@coder/ai-sdk-sandbox):ensureCoderWorkspace+ session lifecycle asEffect.acquireRelease/ scopedLayers, so workspace acquisition, agent-readiness waits, and teardown compose with Effect scopes and interruption.LanguageModelover CoderAgent/chatd (@coder/ai-sdk-agent): server-side agent loop as an Effect service —TurnTranslatoroutput mapped ontoEffect Stream, fiber interruption wired toagent.interrupt(), and the SDK's retryable/terminal error taxonomy (CoderStreamError.isRetryable, timeout vs cancellation) surfaced as tagged errors usable with Effect retry policies.Roadmap
Phase 1 — Spike (in flight)
packages/effectscaffold (private, excluded from release-please until graduation)LanguageModelimplementation over@coder/ai-sdk-provider(AI Gateway): Prompt/Response mapping + typedAiErrorhierarchy for HTTP errorsLayers for workspace sandbox lifecycle (ensureCoderWorkspace+ session asEffect.acquireRelease)Phase 2
LanguageModelimplementation overCoderAgent/chatd:TurnTranslator→Effect Streammappingagent.interrupt()effect/@effect/ai, release-please wiringNotes
Generated with
mux• Model:anthropic:claude-fable-5• Thinking:xhigh