Skip to content

Commit 9db5073

Browse files
committed
fix(plugin): retain legacy kv api shape
1 parent 775fce0 commit 9db5073

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

packages/plugin/src/tui.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,13 @@ export type TuiTheme = {
358358
readonly ready: boolean
359359
}
360360

361+
/** @deprecated Persistent TUI KV storage is not supported in V2. */
362+
export type TuiKV = {
363+
get: <Value = unknown>(key: string, fallback?: Value) => Value
364+
set: (key: string, value: unknown) => void
365+
readonly ready: boolean
366+
}
367+
361368
export type TuiState = {
362369
readonly ready: boolean
363370
readonly config: SdkConfig
@@ -623,6 +630,8 @@ export type TuiPluginApi = {
623630
dialog: TuiDialogStack
624631
}
625632
readonly tuiConfig: Frozen<TuiConfigView>
633+
/** @deprecated Persistent TUI KV storage is not supported in V2. */
634+
kv: TuiKV
626635
state: TuiState
627636
theme: TuiTheme
628637
client: OpencodeClient

packages/tui/src/attention.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type {
55
TuiAttentionNotifyResult,
66
TuiAttentionNotifySkipReason,
77
TuiAttentionWhen,
8+
TuiKV,
89
TuiAttentionSoundName,
910
TuiAttentionSoundPack,
1011
TuiAttentionSoundPackInfo,
@@ -113,6 +114,8 @@ export function createTuiAttention(input: {
113114
renderer: AttentionRenderer
114115
config: Pick<Config.Resolved, "attention">
115116
update?: Config.Interface["update"]
117+
/** @deprecated Ignored. Sound-pack persistence uses CLI config. */
118+
kv?: TuiKV
116119
audio?: Pick<typeof TuiAudio, "loadSoundFile" | "play">
117120
}): TuiAttentionHost {
118121
let focus: FocusState = "unknown"

packages/tui/src/plugin/adapters.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,14 @@ export function createTuiApiAdapters(input: Input): Omit<TuiPluginApi, "lifecycl
289289
get tuiConfig() {
290290
return input.tuiConfig
291291
},
292+
kv: {
293+
get(_key, fallback) {
294+
if (fallback === undefined) throw new Error("Persistent TUI KV storage is not supported")
295+
return fallback
296+
},
297+
set() {},
298+
ready: true,
299+
},
292300
state: stateApi(input.sync, input.data),
293301
get client() {
294302
return input.sdk.client

0 commit comments

Comments
 (0)