managarten/packages/bot-services/package.json
Till JS e2f144962c feat: add unified @manacore/shared-llm package and migrate all backends
Create a shared LLM client package that provides a unified interface
to the mana-llm service, replacing 9 individual fetch-based integrations
with consistent error handling, retry logic, and JSON extraction.

Package (@manacore/shared-llm):
- LlmModule with forRoot/forRootAsync (NestJS dynamic module)
- LlmClientService: chat, json, vision, visionJson, embed, stream
- LlmClient standalone class for non-NestJS consumers
- extractJson utility (consolidates 3 markdown-stripping implementations)
- retryFetch with exponential backoff (429, 5xx, network errors)
- 44 unit tests (json-extractor, retry, llm-client)

Migrated backends:
- mana-core-auth: raw fetch → llm.json()
- planta: raw fetch + vision → llm.visionJson()
- nutriphi: raw fetch + regex → llm.visionJson() + llm.json()
- chat: custom OllamaService (175 LOC) → llm.chatMessages()
- context: raw fetch → llm.chat() (keeps token tracking)
- traces: 2x raw fetch → llm.chat()
- manadeck: @google/genai SDK → llm.json() + llm.visionJson()
- bot-services: raw Ollama API → LlmClient standalone
- matrix-ollama-bot: raw fetch → llm.chatMessages() + llm.vision()

New credit operations:
- AI_PLANT_ANALYSIS (2 credits, planta)
- AI_GUIDE_GENERATION (5 credits, traces)
- AI_CONTEXT_GENERATION (2 credits, context)
- AI_BOT_CHAT (0.1 credits, matrix)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 22:06:30 +01:00

89 lines
2.1 KiB
JSON

{
"name": "@manacore/bot-services",
"version": "0.1.0",
"private": true,
"description": "Shared business logic services for Matrix bots and Gateway",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./todo": {
"types": "./dist/todo/index.d.ts",
"default": "./dist/todo/index.js"
},
"./calendar": {
"types": "./dist/calendar/index.d.ts",
"default": "./dist/calendar/index.js"
},
"./clock": {
"types": "./dist/clock/index.d.ts",
"default": "./dist/clock/index.js"
},
"./ai": {
"types": "./dist/ai/index.d.ts",
"default": "./dist/ai/index.js"
},
"./session": {
"types": "./dist/session/index.d.ts",
"default": "./dist/session/index.js"
},
"./transcription": {
"types": "./dist/transcription/index.d.ts",
"default": "./dist/transcription/index.js"
},
"./credit": {
"types": "./dist/credit/index.d.ts",
"default": "./dist/credit/index.js"
},
"./i18n": {
"types": "./dist/i18n/index.d.ts",
"default": "./dist/i18n/index.js"
},
"./nutrition": {
"types": "./dist/nutrition/index.d.ts",
"default": "./dist/nutrition/index.js"
},
"./quotes": {
"types": "./dist/quotes/index.d.ts",
"default": "./dist/quotes/index.js"
},
"./stats": {
"types": "./dist/stats/index.d.ts",
"default": "./dist/stats/index.js"
},
"./docs": {
"types": "./dist/docs/index.d.ts",
"default": "./dist/docs/index.js"
},
"./shared": {
"types": "./dist/shared/index.d.ts",
"default": "./dist/shared/index.js"
}
},
"scripts": {
"build": "tsc",
"type-check": "tsc --noEmit",
"clean": "rm -rf dist",
"lint": "eslint .",
"prepublishOnly": "pnpm build"
},
"dependencies": {
"@manacore/shared-llm": "workspace:^",
"@nestjs/common": "^11.0.20",
"@nestjs/config": "^4.0.2",
"date-fns": "^4.1.0",
"ioredis": "^5.4.2"
},
"peerDependencies": {
"@nestjs/common": "^10.0.0 || ^11.0.0",
"@nestjs/config": "^3.0.0 || ^4.0.0"
},
"devDependencies": {
"@types/ioredis": "^5.0.0",
"@types/node": "^24.10.1",
"typescript": "^5.9.3"
}
}