mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 21:41:09 +02:00
Introduces a new shared package containing transport-agnostic business logic services for Matrix bots and the Gateway. This enables: - Individual bots to import shared services - A unified Gateway bot to combine all features - Code reuse without duplication Services included: - TodoService: Task management with projects, priorities, dates - CalendarService: Events, calendars, reminders - AiService: Ollama LLM integration, chat sessions, vision - ClockService: Timers, alarms, world clocks (API client) - Placeholder modules for Nutrition, Quotes, Stats, Docs Key features: - Pluggable storage providers (file-based, in-memory, custom) - German natural language input parsing - NestJS module system with dependency injection - Fully testable in isolation https://claude.ai/code/session_015bwcqVRiFmSydYTjvDJGTc
113 lines
2.7 KiB
TypeScript
113 lines
2.7 KiB
TypeScript
/**
|
|
* @manacore/bot-services
|
|
*
|
|
* Shared business logic services for Matrix bots and the Gateway.
|
|
* These services are transport-agnostic and can be used by:
|
|
* - Individual Matrix bots (standalone)
|
|
* - The Gateway bot (all-in-one)
|
|
* - REST APIs
|
|
* - CLI tools
|
|
*
|
|
* @example
|
|
* ```typescript
|
|
* import { TodoModule, TodoService } from '@manacore/bot-services/todo';
|
|
* import { AiModule, AiService } from '@manacore/bot-services/ai';
|
|
*
|
|
* // In NestJS module
|
|
* @Module({
|
|
* imports: [
|
|
* TodoModule.register({ storagePath: './data/todos.json' }),
|
|
* AiModule.register({ baseUrl: 'http://ollama:11434' }),
|
|
* ],
|
|
* })
|
|
* export class AppModule {}
|
|
* ```
|
|
*/
|
|
|
|
// ===== Core Services =====
|
|
|
|
// Todo
|
|
export { TodoModule, TodoModuleOptions, TodoService, TODO_STORAGE_PROVIDER } from './todo';
|
|
export type {
|
|
Task,
|
|
Project,
|
|
TodoData,
|
|
CreateTaskInput,
|
|
UpdateTaskInput,
|
|
TaskFilter,
|
|
TodoStats,
|
|
ParsedTaskInput,
|
|
} from './todo';
|
|
|
|
// Calendar
|
|
export { CalendarModule, CalendarModuleOptions, CalendarService, CALENDAR_STORAGE_PROVIDER } from './calendar';
|
|
export type {
|
|
CalendarEvent,
|
|
Calendar,
|
|
CalendarData,
|
|
CreateEventInput,
|
|
UpdateEventInput,
|
|
EventFilter,
|
|
ParsedEventInput,
|
|
} from './calendar';
|
|
|
|
// AI (Ollama)
|
|
export { AiModule, AiModuleOptions, AiService } from './ai';
|
|
export type {
|
|
OllamaModel,
|
|
ChatMessage,
|
|
ChatOptions,
|
|
ChatResult,
|
|
ChatResponseMeta,
|
|
AiServiceConfig,
|
|
UserAiSession,
|
|
SystemPromptPreset,
|
|
} from './ai';
|
|
export { SYSTEM_PROMPTS, VISION_MODELS, NON_CHAT_MODELS } from './ai';
|
|
|
|
// Clock
|
|
export { ClockModule, ClockModuleOptions, ClockService } from './clock';
|
|
export type {
|
|
Timer,
|
|
Alarm,
|
|
WorldClock,
|
|
TimezoneResult,
|
|
CreateTimerInput,
|
|
CreateAlarmInput,
|
|
CreateWorldClockInput,
|
|
ClockServiceConfig,
|
|
TimeTrackingSummary,
|
|
} from './clock';
|
|
|
|
// ===== Placeholder Services (to be implemented) =====
|
|
|
|
export { NutritionModule } from './nutrition';
|
|
export type { NutritionServiceConfig, Meal, NutritionSummary } from './nutrition';
|
|
|
|
export { QuotesModule } from './quotes';
|
|
export type { QuotesServiceConfig, Quote } from './quotes';
|
|
|
|
export { StatsModule } from './stats';
|
|
export type { StatsServiceConfig, AnalyticsReport } from './stats';
|
|
|
|
export { DocsModule } from './docs';
|
|
export type { DocsServiceConfig, ProjectDoc } from './docs';
|
|
|
|
// ===== Shared Utilities =====
|
|
|
|
export { FileStorageProvider, MemoryStorageProvider } from './shared';
|
|
export type { StorageProvider, BaseEntity, UserEntity, ServiceConfig, Result, PaginationOptions, PaginatedResult, DateRange, Priority, ServiceStats } from './shared';
|
|
export {
|
|
generateId,
|
|
getTodayISO,
|
|
startOfDay,
|
|
endOfDay,
|
|
addDays,
|
|
formatDateDE,
|
|
formatTimeDE,
|
|
isToday,
|
|
isTomorrow,
|
|
parseGermanDateKeyword,
|
|
getRelativeDateLabel,
|
|
} from './shared';
|
|
export { PRIORITY_VALUES } from './shared';
|