fix(agent-kit): separate session cache per agent

Each agent now maintains its own session cache file instead of sharing
a single agent-sessions.json. This prevents session ID conflicts when
multiple agents operate on the same thread+role pair.

Changes:
- getCachePath() now takes agentName parameter
- getCachedSessionId/setCachedSessionId require agentName as first param
- Cache files named <agent>-sessions.json (e.g., hermes-sessions.json)
- Agent wrappers inject their agent name into cache calls
- Add comprehensive tests for session cache isolation
- Handle malformed JSON gracefully (treat as empty cache)

Fixes #461
This commit is contained in:
2026-05-24 09:16:06 +00:00
parent 6e3b32ca34
commit 1d174ee5c9
6 changed files with 290 additions and 18 deletions
@@ -1,7 +1,6 @@
import path from "node:path";
import { defineConfig } from "vitest/config";
// biome-ignore lint/style/noDefaultExport: Vitest loads config from default export.
export default defineConfig({
test: {
environment: "node",