feat(timeline): implement TimelineService for building and formatting timeline items

- Extracted timeline-related functionality from mcp-server.ts to a dedicated TimelineService class.
- Added methods to build, filter, and format timeline items based on observations, sessions, and prompts.
- Introduced interfaces for TimelineItem and TimelineData to standardize data structures.
- Implemented sorting and grouping of timeline items by date, with markdown formatting for output.
- Included utility methods for date and time formatting, as well as token estimation.
This commit is contained in:
Alex Newman
2025-12-07 19:14:18 -05:00
parent 83b4806718
commit c415ff5120
11 changed files with 3578 additions and 20 deletions
+5 -5
View File
@@ -169,16 +169,16 @@ export class WorkerService {
// Initialize database (once, stays open)
await this.dbManager.initialize();
// Connect to MCP search server
const searchServerPath = path.join(__dirname, '..', '..', 'plugin', 'scripts', 'search-server.cjs');
// Connect to MCP server
const mcpServerPath = path.join(__dirname, '..', '..', 'plugin', 'scripts', 'mcp-server.cjs');
const transport = new StdioClientTransport({
command: 'node',
args: [searchServerPath],
args: [mcpServerPath],
env: process.env
});
await this.mcpClient.connect(transport);
logger.success('WORKER', 'Connected to MCP search server');
logger.success('WORKER', 'Connected to MCP server');
}
/**
@@ -188,7 +188,7 @@ export class WorkerService {
// Shutdown all active sessions
await this.sessionManager.shutdownAll();
// Close MCP client connection (terminates search server process)
// Close MCP client connection (terminates MCP server process)
if (this.mcpClient) {
try {
await this.mcpClient.close();