llm-ports v0.1.0-alpha.26 — API Unification (Canonical Messages Input) #63
baabakk
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
@llm-ports v0.1.0-alpha.26 — API Unification (Canonical Messages Input)
Released 2026-07-02. Install:
pnpm add @llm-ports/core@alpha @llm-ports/adapter-openai@alphatoMessages(instructions, prompt).The unification
Every provider's actual API speaks
messages: Message[]natively. The port's{ instructions, prompt }shape was a defensible compression for single-turn calls but couldn't model multi-turn workloads (chat, interview agents, coaching workflows) without bad workarounds.Alpha.26 unifies. All four generation methods now accept a canonical
messages: LLMMessage[]input, aligning withrunAgent's existing shape and every provider's native protocol:What ships
1. New canonical field:
messages: LLMMessage[]On all four generation methods (
generateText,generateStructured,streamText,streamStructured). Supports arbitrary multi-turn shapes.2. Migration shim + convenience helpers
New exports from
@llm-ports/core:toMessages(instructions?, prompt): LLMMessage[]— one-line migration for the legacy shape.sys(content: string): LLMMessage— idiomatic system message constructor.usr(content: MessageContent): LLMMessage— idiomatic user message constructor.3. Four new errors
MessagesRequiredError— neithermessagesnorpromptsupplied.EmptyMessagesError—messagesarray is empty.MessagesConflictError— bothmessagesAND legacy fields supplied (ambiguity is a caller bug).PromptRequiredError—toMessages()called with no prompt.4. Deprecation warning UX
Single-line
console.warnper method per Registry when the legacy shape is used. Method-only dedup — a consumer with 50 legacy call sites across all four methods gets 4 warnings total (one per method), enough signal to trigger a migration audit without flooding logs.Opt out for mid-migration:
Structured logging:
5. Registry-side dual-population
The
RegistryPortnormalizes both shapes to canonicalmessagesbefore dispatch AND populates the legacyinstructions+promptfields from the resolved messages. This means:messages(adapter-openai in this release) get the full multi-turn path.What's NOT changing
runAgentalready tookmessages. Zero migration impact if you only userunAgent.MessageContenttype (per-turn content:string | ContentBlock[]): unchanged.Timeline
Test coverage
881 total tests pass across the workspace (was 864 at alpha.25; +17; zero regressions).
Adapter status
adapter-openaiadapter-anthropicadapter-googleadapter-ollamaadapter-vercelConsumers using multi-turn
messagestoday should route throughadapter-openai. Other adapters acceptmessagesshape (Registry-normalized) but internally use the last user message; full multi-turn support follows in patch releases per adapter.Alternatives considered and rejected
chatmethod (grows port surface). Rejected.prompttoinputwith union type (runtime discrimination churn). Rejected.MessageContentto includeLLMMessage[](conflates content vs sequence). Rejected.Full release notes | alpha.25 → alpha.26 migration guide | alpha.26 planning discussion
All reactions