Skip to content

feat(acp): add session store, session manager, and error handling#195

Merged
im10furry merged 3 commits into
mainfrom
feat/acp-session-store-manager
Jun 9, 2026
Merged

feat(acp): add session store, session manager, and error handling#195
im10furry merged 3 commits into
mainfrom
feat/acp-session-store-manager

Conversation

@im10furry

Copy link
Copy Markdown
Collaborator

Summary

Add ACP session infrastructure for managing in-memory and persistent sessions.

New Files

\src/acp/errors.ts\

  • \AcpError\ class with JSON-RPC error codes and structured error data
  • \ oJsonRpcError()\ for safe error type conversion (preserves data across \AcpError\ / \JsonRpcError\ chain)

\src/acp/sessionManager.ts\

  • \AcpSessionManager\ generic session manager
  • LRU eviction when exceeding \maxSessions\ (default 100)
  • TTL-based expiration via \cleanupExpired()\
  • Automatic MCP client lifecycle management (close on eviction/delete)
  • \AbortController\ cleanup on session replacement/removal
  • Time-injectable
    ow\ option for deterministic testing

\src/acp/sessionStore.ts\

  • Atomic disk persistence with temp-file + rename pattern
  • Per-project session directories (~/.kode//acp-sessions/)
  • \cleanupExpiredAcpSessions()\ for TTL-based file cleanup
  • Path sanitization for session ID and project directory

Tests

  • \ ests/unit/acp-jsonrpc-validation.test.ts\ — payload budget rejection, signal listener cleanup, error mapping
  • \ ests/unit/acp-session-store-manager.test.ts\ — atomic persistence, TTL cleanup, session eviction with MCP client close

Verification

  • Prettier format check — pass
  • ACP files typecheck — clean (no errors in new files)
  • Existing main typecheck errors (29) are pre-existing, unrelated to this PR

im10furry added 3 commits June 9, 2026 15:04
- Add AcpSessionManager<T> with LRU eviction, TTL expiry, and MCP client lifecycle
- Add sessionStore for atomic disk persistence with project-scoped directories
- Add AcpError class with JsonRpcError conversion and structured error data
- Add tests for session manager eviction, store persistence/cleanup, and jsonrpc validation
@im10furry im10furry merged commit 15d4df1 into main Jun 9, 2026
3 checks passed
@im10furry im10furry deleted the feat/acp-session-store-manager branch June 9, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant