Add support for Kiro IDE v1.0 session format - #15
Conversation
- New file server/ide-v2.ts: resolves workspace-hash dirs, parses
session.json + messages.jsonl (JSONL payload-type format)
- Handles user, assistant, tool_call, turn_start/turn_end payloads
- Skips streaming placeholders ('...' content)
- server/cli.ts: integrates IDE V2 reader, updates detectSource()
to check for new-format sessions, adds watchers and cleanup
- server/index.ts: adds ideV2Reader to ServerOptions, merges results
into IDE path with deduplication (new format preferred)
Fresh Kiro IDE 1.0 installs have no workspace-sessions directory (that was the pre-1.0 format). The watcher threw ENOENT on startup. Now only creates the watcher if the directory actually exists.
- 15 tests for createIdeV2Reader: happy path, tool calls, turn boundaries, missing files, malformed data, sorting, path fallback, incomplete sessions, multiple workspaces - 4 tests for resolveIdeV2WorkspaceDirs: non-existent path, empty path, excludes cli directory, ignores non-directory entries
|
@pajaydev , I know the new reader is named v2 in the code files but it is designed to read the "new" JSON(L) files associated with Kiro IDE v1.0 application style. Please let me know if you want me to change anything there if needed. I really appreciate your tool! Especially because from one session to another, Kiro loses all memory of previous work unless it has some how been stored in steering which isn't even always referenced well. Stephen |
|
@saherr1969 Thanks for explaining, Shall we keep the files as ide-legacy.ts ? v2 is confusing |
| @@ -0,0 +1,234 @@ | |||
| import { readdirSync, readFileSync, existsSync } from 'fs'; | |||
There was a problem hiding this comment.
Shall we rename this file to ide-legacy.ts as v2 is confusing here ?
| // Try to load both sources if available | ||
| const idePath = resolveIdePath(userPath); | ||
| const dbPath = resolveDbPath(userPath); | ||
| const hasIde = existsSync(join(idePath, 'workspace-sessions')) || existsSync(join(idePath, 'sessions')); |
There was a problem hiding this comment.
I believe we should also check hasOldIde || hasNewIde logic here?
What changed
server/ide-v2.ts) for the IDE v1.0 session format (~/.kiro/sessions/<workspace-hash>/<session-id>/)session.json+messages.jsonl(JSONL payload-type stream)workspace-sessionsdir)server/ide-v2.test.ts, 19 tests)Files new and modified
server/ide-v2.ts(new)server/ide-v2.test.ts(new — unit tests)server/cli.tsserver/index.tsREADME.mdTest results
Note on CI impact
The new test file adds 19 tests to the test run. This will add a few seconds
to the GitHub Actions build-and-test job (measured ~20ms locally for the new
tests, but CI overhead may vary).