mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-28 13:32:23 +00:00
Split monolithic tool handlers into a clean two-layer architecture: - `api/` layer: ~80 files with raw Telegram API calls returning typed `ApiResult<T>` with `fromCache` boolean - `tools/` layer: thinned to validation + formatting wrappers delegating to api/ Key changes: - Add `ApiResult<T>` type and `fromCache` field to `MCPToolResult` - Extract shared helpers (getChatById, formatMessage, etc.) into `api/helpers.ts` - Move `apiResultTypes.ts` and `apiCastHelpers.ts` into `api/` - Delete `telegramApi.ts` (all logic migrated to individual api/ files) - Add `validatePositiveInt` to validation utilities - Auto-infer `fromCache` in server.ts via `isStateOnlyTool()` safety net - Update `bulk.ts` skill to import from new api layer Net reduction of ~2,475 lines across 86 files. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>