fix(plugin): retain legacy kv api shape
This commit is contained in:
parent
775fce0177
commit
9db5073eab
3 changed files with 20 additions and 0 deletions
|
|
@ -358,6 +358,13 @@ export type TuiTheme = {
|
||||||
readonly ready: boolean
|
readonly ready: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @deprecated Persistent TUI KV storage is not supported in V2. */
|
||||||
|
export type TuiKV = {
|
||||||
|
get: <Value = unknown>(key: string, fallback?: Value) => Value
|
||||||
|
set: (key: string, value: unknown) => void
|
||||||
|
readonly ready: boolean
|
||||||
|
}
|
||||||
|
|
||||||
export type TuiState = {
|
export type TuiState = {
|
||||||
readonly ready: boolean
|
readonly ready: boolean
|
||||||
readonly config: SdkConfig
|
readonly config: SdkConfig
|
||||||
|
|
@ -623,6 +630,8 @@ export type TuiPluginApi = {
|
||||||
dialog: TuiDialogStack
|
dialog: TuiDialogStack
|
||||||
}
|
}
|
||||||
readonly tuiConfig: Frozen<TuiConfigView>
|
readonly tuiConfig: Frozen<TuiConfigView>
|
||||||
|
/** @deprecated Persistent TUI KV storage is not supported in V2. */
|
||||||
|
kv: TuiKV
|
||||||
state: TuiState
|
state: TuiState
|
||||||
theme: TuiTheme
|
theme: TuiTheme
|
||||||
client: OpencodeClient
|
client: OpencodeClient
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import type {
|
||||||
TuiAttentionNotifyResult,
|
TuiAttentionNotifyResult,
|
||||||
TuiAttentionNotifySkipReason,
|
TuiAttentionNotifySkipReason,
|
||||||
TuiAttentionWhen,
|
TuiAttentionWhen,
|
||||||
|
TuiKV,
|
||||||
TuiAttentionSoundName,
|
TuiAttentionSoundName,
|
||||||
TuiAttentionSoundPack,
|
TuiAttentionSoundPack,
|
||||||
TuiAttentionSoundPackInfo,
|
TuiAttentionSoundPackInfo,
|
||||||
|
|
@ -113,6 +114,8 @@ export function createTuiAttention(input: {
|
||||||
renderer: AttentionRenderer
|
renderer: AttentionRenderer
|
||||||
config: Pick<Config.Resolved, "attention">
|
config: Pick<Config.Resolved, "attention">
|
||||||
update?: Config.Interface["update"]
|
update?: Config.Interface["update"]
|
||||||
|
/** @deprecated Ignored. Sound-pack persistence uses CLI config. */
|
||||||
|
kv?: TuiKV
|
||||||
audio?: Pick<typeof TuiAudio, "loadSoundFile" | "play">
|
audio?: Pick<typeof TuiAudio, "loadSoundFile" | "play">
|
||||||
}): TuiAttentionHost {
|
}): TuiAttentionHost {
|
||||||
let focus: FocusState = "unknown"
|
let focus: FocusState = "unknown"
|
||||||
|
|
|
||||||
|
|
@ -289,6 +289,14 @@ export function createTuiApiAdapters(input: Input): Omit<TuiPluginApi, "lifecycl
|
||||||
get tuiConfig() {
|
get tuiConfig() {
|
||||||
return input.tuiConfig
|
return input.tuiConfig
|
||||||
},
|
},
|
||||||
|
kv: {
|
||||||
|
get(_key, fallback) {
|
||||||
|
if (fallback === undefined) throw new Error("Persistent TUI KV storage is not supported")
|
||||||
|
return fallback
|
||||||
|
},
|
||||||
|
set() {},
|
||||||
|
ready: true,
|
||||||
|
},
|
||||||
state: stateApi(input.sync, input.data),
|
state: stateApi(input.sync, input.data),
|
||||||
get client() {
|
get client() {
|
||||||
return input.sdk.client
|
return input.sdk.client
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue