Skip to content

Commit 2a392b9

Browse files
authored
Merge pull request #1000 from objectstack-ai/copilot/add-service-ai-plugin
2 parents 4fad379 + d11a880 commit 2a392b9

22 files changed

Lines changed: 2246 additions & 11 deletions

.changeset/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"@objectstack/service-job",
3939
"@objectstack/service-queue",
4040
"@objectstack/service-realtime",
41+
"@objectstack/service-ai",
4142
"@objectstack/service-storage",
4243
"@objectstack/docs",
4344
"create-objectstack",

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11+
- **`@objectstack/service-ai` — Unified AI capability service plugin** — New kernel plugin
12+
providing standardized AI service integration:
13+
- Registers as kernel `'ai'` service conforming to `IAIService` contract
14+
- LLM adapter layer with provider abstraction (`LLMAdapter` interface) and built-in
15+
`MemoryLLMAdapter` for testing/development
16+
- `ToolRegistry` for metadata/business tool registration and execution
17+
- `InMemoryConversationService` implementing `IAIConversationService` for multi-turn
18+
conversation management with message persistence
19+
- REST/SSE route self-registration (`/api/v1/ai/chat`, `/api/v1/ai/chat/stream`,
20+
`/api/v1/ai/complete`, `/api/v1/ai/models`, `/api/v1/ai/conversations`)
21+
- Plugin lifecycle hooks (`ai:ready`, `ai:routes`) for extensibility
22+
- **Expanded `IAIService` contract** — Added streaming (`streamChat`), tool calling protocol
23+
(`AIToolDefinition`, `AIToolCall`, `AIToolResult`, `AIMessageWithTools`,
24+
`AIRequestOptionsWithTools`, `AIStreamEvent`), and conversation management
25+
(`IAIConversationService`, `AIConversation`) to `packages/spec/src/contracts/ai-service.ts`
1126
- **`@objectstack/plugin-setup` — Platform Setup App plugin** — New internal plugin
1227
(`packages/plugins/plugin-setup`) that owns and finalizes the platform Setup App.
1328
Ships four built-in Setup Areas (Administration, Platform, System, AI) as empty

ROADMAP.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -535,13 +535,13 @@ Objects now declare `namespace: 'sys'` and a short `name` (e.g., `name: 'user'`)
535535
| `IAutomationService` | **P2** | `@objectstack/service-automation` | ✅ Plugin-based DAG flow engine + HTTP API + Client SDK (67 tests) |
536536
| `IWorkflowService` | **P2** | `@objectstack/service-workflow` | State machine + approval processes |
537537
| `IGraphQLService` | **P2** | `@objectstack/service-graphql` | Auto-generated GraphQL from objects |
538-
| `IAIService` | **P2** | `@objectstack/service-ai` | LLM integration (OpenAI/Anthropic/local) |
538+
| `IAIService` | **P2** | `@objectstack/service-ai` | LLM adapter layer, ToolRegistry, conversation management, REST/SSE routes, streaming (52 tests) |
539539
| `IAnalyticsService` | **P3** | `@objectstack/service-analytics` | ✅ Multi-driver analytics with strategy pattern (NativeSQL/ObjectQL/InMemory), CubeRegistry, generateSql (34 tests) |
540540

541541
- [x] `service-automation` — Implement `IAutomationService` with plugin-based DAG flow engine (CRUD/Logic/HTTP nodes, fault edges, parallel branches, cycle detection, safe eval, timeout, versioning), HTTP API CRUD (9 routes), Client SDK (10 methods), execution history with step-level logging
542542
- [ ] `service-workflow` — Implement `IWorkflowService` with state machine runtime
543543
- [ ] `service-graphql` — Implement `IGraphQLService` with auto-schema generation
544-
- [ ] `service-ai` — Implement `IAIService` with multi-provider LLM routing
544+
- [x] `service-ai` — Implement `IAIService` with LLM adapter layer, ToolRegistry, InMemoryConversationService, REST/SSE routes (/api/v1/ai/*), streaming support (streamChat), kernel plugin (52 tests)
545545
- [x] `service-analytics` — Implement full `IAnalyticsService` with multi-driver strategy pattern (NativeSQLStrategy P1, ObjectQLStrategy P2, InMemoryStrategy P3), CubeRegistry with auto-inference from object schemas, generateSql dry-run, kernel plugin lifecycle
546546

547547
---
@@ -584,7 +584,7 @@ Objects now declare `namespace: 'sys'` and a short `name` (e.g., `name: 'user'`)
584584
- [x] **Phase A+: Dual Transport** (v3.2) — Remote-only mode via `@libsql/client` (libsql://, https://), auto-detection of transport mode, pre-configured client injection, full CRUD/schema/bulk/transaction support in remote mode
585585
- [ ] **Phase B: Edge & Sync** (v3.2) — Embedded replica sync, WASM build for Cloudflare/Deno, offline write queue
586586
- [x] **Phase C: Multi-Tenancy** (v3.3) — Database-per-tenant router with TTL cache, concurrency dedup, lifecycle callbacks
587-
- [ ] **Phase D: Advanced** (v4.0) — Vector search + `IAIService`, FTS5 + `ISearchService`, ~~better-auth adapter~~ (✅ done in plugin-auth)
587+
- [ ] **Phase D: Advanced** (v4.0) — Vector search + `IAIService` (✅ `service-ai` base implemented), FTS5 + `ISearchService`, ~~better-auth adapter~~ (✅ done in plugin-auth)
588588
- [ ] Driver benchmark suite comparing performance across all drivers
589589

590590
### 6.2 Multi-Tenancy
@@ -644,15 +644,15 @@ Objects now declare `namespace: 'sys'` and a short `name` (e.g., `name: 'user'`)
644644
645645
### 7.1 Core AI Services
646646

647-
- [ ] `service-ai` — Multi-provider LLM service (OpenAI, Anthropic, Gemini, local models)
647+
- [x] `service-ai` — Multi-provider LLM service with adapter pattern, streaming, tool registry, conversation management, REST/SSE routes
648648
- [ ] NLQ (Natural Language Query) runtime — translate natural language to ObjectQL
649649
- [ ] Embedding service for vector search and RAG
650650

651651
### 7.2 Agent Framework
652652

653653
- [ ] Agent runtime — execute AI agents defined in spec schemas
654-
- [ ] Tool registry — connect agents to ObjectQL operations, APIs, and workflows
655-
- [ ] Conversation management — persistent chat with context windows
654+
- [x] Tool registry — connect agents to ObjectQL operations, APIs, and workflows (initial implementation in `service-ai`)
655+
- [x] Conversation management — persistent chat with context windows (initial implementation in `service-ai`)
656656

657657
### 7.3 RAG Pipeline
658658

@@ -870,7 +870,7 @@ Final polish and advanced features.
870870
| 15 | Feed Service | `IFeedService` || `@objectstack/service-feed` | In-memory feed/chatter (comments, reactions, subscriptions) |
871871
| 16 | Search Service | `ISearchService` || `@objectstack/service-search` (planned) | Spec only |
872872
| 17 | Notification Service | `INotificationService` || `@objectstack/service-notification` (planned) | Spec only |
873-
| 18 | AI Service | `IAIService` | | `@objectstack/service-ai` (planned) | Spec only |
873+
| 18 | AI Service | `IAIService` | | `@objectstack/service-ai` | LLM adapter layer, ToolRegistry, conversation management, REST/SSE routes (52 tests) |
874874
| 19 | Automation Service | `IAutomationService` || `@objectstack/service-automation` | DAG engine + HTTP API CRUD + Client SDK + typed returns (67 tests) |
875875
| 20 | Workflow Service | `IWorkflowService` || `@objectstack/service-workflow` (planned) | Spec only |
876876
| 21 | GraphQL Service | `IGraphQLService` || `@objectstack/service-graphql` (planned) | Spec only |
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# @objectstack/service-ai
2+
3+
## 3.3.1
4+
5+
### Patch Changes
6+
7+
- Initial release of AI Service plugin
8+
- LLM adapter layer with provider abstraction (memory adapter included)
9+
- Conversation management service with in-memory persistence
10+
- Tool registry for metadata/business tool registration
11+
- REST/SSE route self-registration (`/api/v1/ai/*`)
12+
- Kernel plugin registering as `'ai'` service conforming to `IAIService` contract
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "@objectstack/service-ai",
3+
"version": "3.3.1",
4+
"license": "Apache-2.0",
5+
"description": "AI Service for ObjectStack — implements IAIService with LLM adapter layer, conversation management, tool registry, and REST/SSE routes",
6+
"type": "module",
7+
"main": "dist/index.js",
8+
"types": "dist/index.d.ts",
9+
"exports": {
10+
".": {
11+
"types": "./dist/index.d.ts",
12+
"import": "./dist/index.js",
13+
"require": "./dist/index.cjs"
14+
}
15+
},
16+
"scripts": {
17+
"build": "tsup --config ../../../tsup.config.ts",
18+
"test": "vitest run"
19+
},
20+
"dependencies": {
21+
"@objectstack/core": "workspace:*",
22+
"@objectstack/spec": "workspace:*"
23+
},
24+
"devDependencies": {
25+
"@types/node": "^25.5.0",
26+
"typescript": "^6.0.2",
27+
"vitest": "^4.1.2"
28+
}
29+
}

0 commit comments

Comments
 (0)