Skip to content

feat(spec): Promote LLMAdapter interface to @objectstack/spec/contracts#1012

Merged
hotlong merged 2 commits into
mainfrom
copilot/add-llm-adapter-interface-to-spec
Mar 31, 2026
Merged

feat(spec): Promote LLMAdapter interface to @objectstack/spec/contracts#1012
hotlong merged 2 commits into
mainfrom
copilot/add-llm-adapter-interface-to-spec

Conversation

Copilot AI commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

LLMAdapter was the only adapter contract defined inside a service package (service-ai) rather than in @objectstack/spec. This forced third-party adapter authors to depend on @objectstack/service-ai for a single interface.

Changes

  • New contract packages/spec/src/contracts/llm-adapter.ts — identical interface, imports AI types from sibling ai-service.ts
  • Re-export for backward compatservice-ai/src/adapters/types.ts now re-exports from spec instead of defining locally
  • Updated imports across ai-service.ts, plugin.ts, memory-adapter.ts, adapters/index.ts, index.ts, and test file to source from @objectstack/spec/contracts
  • Contract type tests — 8 tests covering minimal, full, streaming, embed, and listModels implementations
  • ROADMAP.md / CHANGELOG.md updated
// Third-party adapters can now align on spec alone:
import type { LLMAdapter } from '@objectstack/spec/contracts';

export class MyAdapter implements LLMAdapter {
  readonly name = 'my-provider';
  async chat(messages, options?) { /* ... */ }
  async complete(prompt, options?) { /* ... */ }
}

All 60 service-ai tests and 30 spec contract tests pass.

@vercel

vercel Bot commented Mar 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectstack-play Ready Ready Preview, Comment Mar 31, 2026 7:26am
spec Ready Ready Preview, Comment Mar 31, 2026 7:26am

Request Review

- Created packages/spec/src/contracts/llm-adapter.ts with LLMAdapter interface
- Added llm-adapter.test.ts with comprehensive type verification tests
- Updated contracts/index.ts to export LLMAdapter
- Updated service-ai to import LLMAdapter from @objectstack/spec/contracts
- Re-export from service-ai for backward compatibility
- Updated ROADMAP.md Contract Implementation Matrix
- Updated CHANGELOG.md

Agent-Logs-Url: https://github.com/objectstack-ai/spec/sessions/265b5e7d-7f35-4751-8340-67374fe4ee78

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Add LLMAdapter interface to @objectstack/spec/contracts feat(spec): Promote LLMAdapter interface to @objectstack/spec/contracts Mar 31, 2026
Copilot AI requested a review from hotlong March 31, 2026 07:18
@hotlong
hotlong marked this pull request as ready for review March 31, 2026 07:21
Copilot AI review requested due to automatic review settings March 31, 2026 07:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Promotes the LLMAdapter interface into the canonical protocol layer (@objectstack/spec/contracts) so third-party adapter authors no longer need to depend on @objectstack/service-ai just for the adapter contract.

Changes:

  • Added packages/spec/src/contracts/llm-adapter.ts and exported it via packages/spec/src/contracts/index.ts.
  • Updated @objectstack/service-ai to import/re-export LLMAdapter from @objectstack/spec/contracts (backward-compatible surface).
  • Added contract-level type tests for LLMAdapter and updated roadmap/changelog notes.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
ROADMAP.md Notes that LLMAdapter contract now lives in spec.
packages/spec/src/contracts/llm-adapter.ts New canonical LLMAdapter contract colocated with other spec contracts.
packages/spec/src/contracts/llm-adapter.test.ts Adds contract/type coverage for minimal/full/optional method shapes.
packages/spec/src/contracts/index.ts Re-exports the new contract from the contracts barrel.
packages/services/service-ai/src/plugin.ts Switches LLMAdapter import to @objectstack/spec/contracts.
packages/services/service-ai/src/index.ts Re-exports LLMAdapter type from spec for compatibility.
packages/services/service-ai/src/ai-service.ts Switches LLMAdapter import to @objectstack/spec/contracts.
packages/services/service-ai/src/adapters/types.ts Re-exports LLMAdapter from spec instead of defining it locally.
packages/services/service-ai/src/adapters/memory-adapter.ts Updates LLMAdapter import source to spec.
packages/services/service-ai/src/adapters/index.ts Re-exports LLMAdapter type from spec.
packages/services/service-ai/src/tests/ai-service.test.ts Updates LLMAdapter import source to spec.
CHANGELOG.md Documents the contract promotion and compatibility re-export.

@hotlong
hotlong merged commit f431650 into main Mar 31, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(spec): Promote LLMAdapter interface to @objectstack/spec/contracts

3 participants