feat(session-manager): add version-gated SDK read path for OpenCode beta

- Add SDK client injection via setStorageClient()

- Version-gate getMainSessions(), getAllSessions(), readSessionMessages(), readSessionTodos()

- Add comprehensive tests for SDK path (beta mode)

- Maintain backward compatibility with JSON fallback
This commit is contained in:
YeonGyu-Kim
2026-02-14 18:16:18 +09:00
parent 5eebef953b
commit b0944b7fd1
8 changed files with 720 additions and 10 deletions
+4 -1
View File
@@ -6,7 +6,7 @@ import {
SESSION_SEARCH_DESCRIPTION,
SESSION_INFO_DESCRIPTION,
} from "./constants"
import { getAllSessions, getMainSessions, getSessionInfo, readSessionMessages, readSessionTodos, sessionExists } from "./storage"
import { getAllSessions, getMainSessions, getSessionInfo, readSessionMessages, readSessionTodos, sessionExists, setStorageClient } from "./storage"
import {
filterSessionsByDate,
formatSessionInfo,
@@ -28,6 +28,9 @@ function withTimeout<T>(promise: Promise<T>, ms: number, operation: string): Pro
}
export function createSessionManagerTools(ctx: PluginInput): Record<string, ToolDefinition> {
// Initialize storage client for SDK-based operations (beta mode)
setStorageClient(ctx.client)
const session_list: ToolDefinition = tool({
description: SESSION_LIST_DESCRIPTION,
args: {