feat(M3-003): implement OpenAI provider adapter for Codex gpt-5.4
Some checks failed
ci/woodpecker/push/ci Pipeline failed
ci/woodpecker/pr/ci Pipeline failed

Adds OpenAIAdapter implementing IProviderAdapter, replacing the legacy
registerOpenAIProvider() inline registration in ProviderService.

- Creates apps/gateway/src/agent/adapters/openai.adapter.ts with:
  - register(): initialises OpenAI client, registers codex-gpt-5-4 with
    Pi ModelRegistry using openai-completions API; skips gracefully when
    OPENAI_API_KEY is absent
  - listModels(): returns Codex gpt-5.4 ModelInfo (128k context, tools+vision)
  - healthCheck(): lightweight GET /v1/models to verify API key validity
  - createCompletion(): streaming completions via openai SDK
    chat.completions.create({ stream: true }); maps chunks to CompletionEvent
- Installs openai SDK (^6.32.0) as a dependency in apps/gateway
- Registers OpenAIAdapter in ProviderService alongside OllamaAdapter
- Removes legacy registerOpenAIProvider() private method from ProviderService

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-21 16:30:56 -05:00
parent cfdd2b679c
commit 6f104d116b
5 changed files with 229 additions and 27 deletions

View File

@@ -17,13 +17,13 @@
"@mariozechner/pi-coding-agent": "~0.57.1",
"@modelcontextprotocol/sdk": "^1.27.1",
"@mosaic/auth": "workspace:^",
"@mosaic/queue": "workspace:^",
"@mosaic/brain": "workspace:^",
"@mosaic/coord": "workspace:^",
"@mosaic/db": "workspace:^",
"@mosaic/discord-plugin": "workspace:^",
"@mosaic/log": "workspace:^",
"@mosaic/memory": "workspace:^",
"@mosaic/queue": "workspace:^",
"@mosaic/telegram-plugin": "workspace:^",
"@mosaic/types": "workspace:^",
"@nestjs/common": "^11.0.0",
@@ -46,6 +46,7 @@
"dotenv": "^17.3.1",
"fastify": "^5.0.0",
"node-cron": "^4.2.1",
"openai": "^6.32.0",
"reflect-metadata": "^0.2.0",
"rxjs": "^7.8.0",
"socket.io": "^4.8.0",