Architecture
Adapter Contracts (T15 Foundation)
Alpha
DSAR is currently in alpha. APIs, package surfaces, configuration, and documentation may change as the project evolves.
This document defines the provider-neutral adapter contract foundation for DSAR runtime integrations.
Goals
- Keep DSAR core runnable with zero adapters registered
- Isolate adapter failures so core request handling remains stable
- Normalize provider-specific failures into a consistent contract
- Enable independent child-ticket delivery (
T15B,T15C,T15D)
Contract Modules
packages/backend/src/adapters/contract.ts- capability types:
notifications,storage,inbound - lifecycle hooks:
validateConfig,init,healthCheck,diagnostics - capability-specific invocation surfaces
- capability types:
packages/backend/src/adapters/errors.ts- normalized error model (
AdapterInvocationError) - retriable classification for retry policies
- normalized error model (
packages/backend/src/adapters/registry.ts- adapter registration/resolution
- capability lookups and health summaries
packages/backend/src/adapters/events.ts- operational event contract for adapter failures (
adapter_failure)
- operational event contract for adapter failures (
Runtime Integration
Runtime adapter bindings are transformed into registry entries at dsarInstance construction time. Services resolve adapters via the registry and can still operate with fallback behavior when no adapter is available.
This enforces T15/T09 MVP behavior:
- notification generation is mandatory
- notification delivery is best-effort and may fail independently
- delivery attempts can resolve to
delivered,failed, orskipped(for disabled/unconfigured optional channels)
Error Normalization Matrix
- Timeout/connection/rate-limit patterns map to retriable categories
- Auth/config/validation issues map to non-retriable categories
- Unknown failures are represented explicitly as
unknown
Child Ticket Guidance
T15B(@dsar/storage-s3): implementstoragecontract conformanceT15C(@dsar/outbound-resend): implementnotificationscontract conformanceT15D(@dsar/inbound-resend): reference implementation for inbound contract
All implementations should pass shared tests in:
packages/backend/test/adapters/conformance/contract.test.ts