Skip to main content

Module storage

Module storage 

Source
Expand description

VS Code storage (SQLite database) operations

Structs§

SessionFormatInfo
Result of session format detection
SessionIssue
A single issue detected during workspace session diagnostics
WorkspaceDiagnosis
Summary of issues found in a single workspace

Enums§

SessionIssueKind
Categories of session issues that can be detected and auto-fixed
SessionSchemaVersion
Session schema version - tracks the internal structure version
VsCodeSessionFormat
VS Code session format version - helps identify which parsing strategy to use

Functions§

add_session_to_index
Add a session to the VS Code index
backup_workspace_sessions
Backup workspace sessions to a timestamped directory
close_vscode_and_wait
Close VS Code gracefully and wait for it to exit. Returns the list of workspace folders that were open (for reopening).
compact_session_jsonl
Compact a JSONL session file by replaying all operations into a single kind:0 snapshot. This works at the raw JSON level, preserving all fields VS Code expects. Returns the path to the compacted file.
convert_skeleton_json_to_jsonl
Convert a skeleton .json file to a valid minimal .jsonl file. Preserves title and timestamp from the index entry if available. The original .json file is renamed to .json.corrupt (non-destructive). Returns the path to the new .jsonl file, or None if conversion was skipped.
count_empty_window_sessions
Count empty window sessions
delete_empty_window_session
Delete an empty window session
detect_session_format
Detect session format and version from content
diagnose_workspace_sessions
Diagnose a workspace for session issues without modifying anything. Returns a structured report of all detected problems.
ensure_vscode_compat_fields
Ensure a JSONL kind:0 snapshot’s v object has all fields required by VS Code’s latest session format (1.109.0+ / version 3). Missing fields are injected with sensible defaults so sessions load reliably after recovery, conversion, or compaction.
fix_cancelled_model_state
Fix cancelled modelState values in a compacted (single-line) JSONL session file.
get_empty_window_session
Get a specific empty window session by ID
get_workspace_storage_db
Get the path to the workspace storage database
is_session_file_extension
Check if a file extension indicates a session file (.json, .jsonl, or .backup)
is_skeleton_json
Detect whether a legacy .json file is a “skeleton” — corrupted to contain only structural characters ({}, [], commas, colons, whitespace) with all actual data stripped. These files parse as valid JSON but contain no useful session content.
is_vscode_running
Check if VS Code is currently running
parse_session_auto
Parse session content with automatic format detection
parse_session_file
Parse a session file, automatically detecting format from content (not just extension)
parse_session_json
Try to parse JSON, sanitizing invalid Unicode if needed
parse_session_jsonl
Parse a JSONL (JSON Lines) session file (VS Code 1.109.0+ format) Each line is a JSON object with ‘kind’ field indicating the type:
read_chat_session_index
Read the chat session index from VS Code storage
read_empty_window_sessions
Read all empty window chat sessions (not tied to any workspace) These appear in VS Code’s “ALL SESSIONS” panel
register_all_sessions_from_directory
Register all sessions from a directory into the VS Code index
remove_session_from_index
Remove a session from the VS Code index
reopen_vscode
Reopen VS Code, optionally at a specific path.
repair_workspace_sessions
Repair workspace sessions: compact large JSONL files and fix the index. Returns (compacted_count, index_fixed_count).
split_concatenated_jsonl
Split concatenated JSON objects in JSONL content that lack newline separators.
sync_session_index
Sync the VS Code index with sessions on disk (remove stale entries, add missing ones) When both .json and .jsonl exist for the same session ID, prefers .jsonl.
trim_session_jsonl
Trim a session JSONL file by keeping only the last keep requests.
write_chat_session_index
Write the chat session index to VS Code storage
write_empty_window_session
Write an empty window session