@aidex/adapters
v1.2.0
Published
Aidex Adapters — thin wrappers connecting external frameworks (Express, plain Node) to @aidex/sdk. No AI logic.
Downloads
906
Maintainers
Readme
@aidex/adapters
Installation
pnpm add @aidex/adaptersnpm install @aidex/adaptersAdapters connect application frameworks to the SDK (@aidex/sdk). They
never contain AI logic. An adapter's entire job is: hold an AI instance,
translate one framework's call shape into ai.text(...)/ai.execute(...),
and hand the result back — nothing about prompts, providers, or strategies
is decided here.
Contents
express/ExpressAdapter—new ExpressAdapter(ai). ExposeshandleRequest({ prompt }): Promise<{ result }>, which callsawait ai.text(prompt)and wraps the result. Takes no Express dependency —ExpressAdapterRequest/ExpressAdapterResponseare small, local interfaces ({ prompt: string }/{ result: string }); an application maps a realexpress.Request/Responseonto this shape at the call site.node/NodeAdapter—new NodeAdapter(ai). ExposesexecuteText(prompt): Promise<string>, a one-line delegation toai.text(prompt), for plain Node.js call sites with no framework at all.
Rules this package follows
- No AI logic. Neither adapter builds a
Prompt, inspects aProviderResponse, or makes any decision about what to ask a model — that'sStrategy/Providerterritory, entirely inside@aidex/sdk's reach, never this package's. - No Provider calls, no kernel imports, no strategy imports. Every
import in
src/(excluding tests) comes from@aidex/sdkonly. - Composition only. Each adapter holds an
AIinstance as a private constructor field; neither extends anything, and there is no shared baseAdapterclass. - No singleton, no global mutable state — every adapter instance is
independent and can wrap its own (or a shared)
AI. src/index.tsexportsExpressAdapterandNodeAdapteronly.
Dependency direction
@aidex/adapters depends on @aidex/sdk only. @aidex/providers is a
devDependency used solely by this package's own tests (StubProvider, to
build a real AI via AIBuilder without needing a live model). No
dependency on @aidex/core, @aidex/strategies, @aidex/plugins, or any
vendor SDK.
