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:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user