@aletheia-labs/adapters-openai
v0.1.2
Published
OpenAI Responses-compatible LLM adapter for Aletheia authority-governed memory.
Downloads
380
Maintainers
Readme
@aletheia-labs/adapters-openai
OpenAI Responses-compatible adapter for Aletheia authority-governed memory.
Status:
0.1.0public baseline. Reference OpenAI integration is live as a narrow library adapter. It does not own OAuth, API keys, terminal UX, tools, publication, or provider account state.
Requirements
- Node 20+.
- ESM-only. Add
"type": "module"to yourpackage.json, use.mjs, or use a build tool/runtime that handles ESM. CommonJSrequire()is not shipped in0.1.x.
Quickstart
pnpm add @aletheia-labs/core @aletheia-labs/store-sqlite @aletheia-labs/adapters-openai openaiimport OpenAI from 'openai';
import { AletheiaAuthority, staticVisibilityPolicy } from '@aletheia-labs/core';
import { AletheiaOpenAIResponsesBridge } from '@aletheia-labs/adapters-openai';
import { openSqliteStores } from '@aletheia-labs/store-sqlite';
const stores = openSqliteStores('./aletheia.sqlite');
const authority = new AletheiaAuthority({
eventLedger: stores.eventLedger,
memoryStore: stores.memoryStore,
conflictRegistry: stores.conflictRegistry,
visibilityPolicy: staticVisibilityPolicy([{ kind: 'private:user' }]),
});
const bridge = new AletheiaOpenAIResponsesBridge({
client: new OpenAI({ apiKey: process.env.OPENAI_API_KEY }),
authority,
eventLedger: stores.eventLedger,
model: 'gpt-5',
});Hosts own credentials, retries, rate limits, and provider selection. This adapter only receives an already-authenticated client.
What this package does
- Records conversation turns as append-only Aletheia events.
- Asks an OpenAI Responses-compatible client to draft memory proposals as JSON.
- Sends every draft through
AletheiaAuthority.propose()before anything becomes aMemoryAtom. - Recalls memory through
AletheiaAuthority.recall()and re-checks action authority throughtryAct()before calling the model for an answer. - Refuses to call the model when recall/action authority fails closed.
Client contract
The package does not import the OpenAI SDK. It accepts any caller-provided object with responses.create(input):
const bridge = new AletheiaOpenAIResponsesBridge({
client: new OpenAI({ apiKey: process.env.OPENAI_API_KEY }),
authority,
eventLedger: stores.eventLedger,
model: 'gpt-5',
});What this package does NOT do
- No OAuth, device login, refresh-token handling, or ChatGPT subscription plumbing.
- No OpenAI SDK dependency.
- No authority upgrade from model output.
- No tool execution.
- No semantic retrieval, embeddings, vector index, or ranking.
- No bypass around
propose,recall, ortryAct.
Fixture Demo
After building the workspace:
pnpm -r run build
pnpm -F @aletheia-labs/adapters-openai run demo:fixtureThe fixture uses a fake Responses client and should print boundaryViolations: [].
Stability
Public surface for the initial library cycle:
AletheiaOpenAIResponsesBridgeOpenAIResponsesClientConversationIngestionInputAnswerWithRecallInputConversationIngestionResultAnswerWithRecallResult
Everything else is adapter plumbing and may change during the 0.x line.
Development
From the repo root:
pnpm install
pnpm -F @aletheia-labs/adapters-openai typecheck
pnpm -F @aletheia-labs/adapters-openai test
pnpm -F @aletheia-labs/adapters-openai build
pnpm -F @aletheia-labs/adapters-openai run demo:fixture