Commit Graph
3 Commits
Author SHA1 Message Date
arkonandClaude Opus 4.5 1ff89c8251 fix(test): allow timing variance in StaleExpirationMap remaining TTL test
setTimeout isn't exact, so the remaining TTL after 100ms wait may be
slightly more than expected (901ms instead of ≤900ms). Adding 10ms
tolerance to prevent flaky test failures.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 05:20:10 +01:00
arkonandClaude Opus 4.5 596098015f feat: add StaleExpirationMap utility for TTL-based cache expiration
- Automatically removes entries not accessed within TTL
- Periodic cleanup with configurable interval
- Optional onExpire callback for cleanup notifications
- Refresh TTL on get (configurable)
- Touch, peek, getAge, getRemainingTtl methods
- Full iteration support
- Implements Disposable interface

Useful for caching ephemeral data like pending tool calls, subagent activity.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 04:41:49 +01:00
arkonandClaude Opus 4.5 83e5b0b78e feat: add resource management types and utilities for memory optimization
- Add Disposable, BufferConfig, MemoryMetrics, CleanupRegistration types
- Create src/config/buffer-limits.ts with consolidated buffer size constants
- Create src/config/map-limits.ts with Map size limits to prevent unbounded growth
- Implement BufferAccumulator utility with configurable trim and onTrim callback
- Implement LRUMap with automatic eviction and O(1) operations
- Implement CleanupManager for unified resource cleanup with isStopped guard
- Add comprehensive tests for all new utilities

This lays the foundation for memory leak prevention and performance improvements.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 04:35:20 +01:00