chore: generate

This commit is contained in:
opencode-agent[bot] 2026-06-07 03:28:52 +00:00
commit 155e1f20d6
25 changed files with 492 additions and 329 deletions

View file

@ -480,30 +480,33 @@ function App(props: { onSnapshot?: () => Promise<string[]>; pluginHost: TuiPlugi
const attention = props.host.attention({ renderer, config: tuiConfig, kv })
const platform = useTuiPlatform()
const api = createTuiApi(createTuiApiAdapters({
version: build.version,
tuiConfig,
dialog,
keymap,
kv,
route,
routes: pluginRuntime.routes,
event,
sdk,
sync,
theme: themeState,
toast,
renderer,
attention,
Slot: pluginRuntime.Slot,
}))
const api = createTuiApi(
createTuiApiAdapters({
version: build.version,
tuiConfig,
dialog,
keymap,
kv,
route,
routes: pluginRuntime.routes,
event,
sdk,
sync,
theme: themeState,
toast,
renderer,
attention,
Slot: pluginRuntime.Slot,
}),
)
const [ready, setReady] = createSignal(false)
props.pluginHost.start({
api,
config: tuiConfig,
runtime: pluginRuntime,
dispose: () => attention.dispose(),
})
props.pluginHost
.start({
api,
config: tuiConfig,
runtime: pluginRuntime,
dispose: () => attention.dispose(),
})
.catch((error) => {
console.error("Failed to load TUI plugins", error)
})
@ -529,7 +532,8 @@ function App(props: { onSnapshot?: () => Promise<string[]>; pluginHost: TuiPlugi
renderer.console.onCopySelection = async (text: string) => {
if (!text || text.length === 0) return
await platform.clipboard?.write?.(text)
await platform.clipboard
?.write?.(text)
.then(() => toast.show({ message: "Copied to clipboard", variant: "info" }))
.catch(toast.error)
@ -691,7 +695,8 @@ function App(props: { onSnapshot?: () => Promise<string[]>; pluginHost: TuiPlugi
run: async () => {
const workspace = currentWorktreeWorkspace()
if (!workspace?.directory) return
await platform.clipboard?.write?.(workspace.directory)
await platform.clipboard
?.write?.(workspace.directory)
.then(() => toast.show({ message: "Copied worktree path", variant: "info" }))
.catch(toast.error)
dialog.clear()

View file

@ -16,10 +16,7 @@ export const AttentionSoundName = Schema.Literals([
export type AttentionSoundName = Schema.Schema.Type<typeof AttentionSoundName>
export const PluginOptions = Schema.Record(Schema.String, Schema.Unknown)
export const PluginSpec = Schema.Union([
Schema.String,
Schema.mutable(Schema.Tuple([Schema.String, PluginOptions])),
])
export const PluginSpec = Schema.Union([Schema.String, Schema.mutable(Schema.Tuple([Schema.String, PluginOptions]))])
export const LeaderTimeoutDefault = 2000
export const LeaderTimeout = Schema.Int.check(Schema.isGreaterThan(0)).annotate({

View file

@ -55,7 +55,11 @@ export type SyncDependencies = {
logger: { error(message: string, extra?: Record<string, unknown>): void }
}
export const { context: SyncContext, use: useSync, provider: SyncProvider } = createSimpleContext({
export const {
context: SyncContext,
use: useSync,
provider: SyncProvider,
} = createSimpleContext({
name: "Sync",
init: (dependencies: SyncDependencies) => {
const environment = useTuiEnvironment()

View file

@ -96,14 +96,15 @@ export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
})
function syncCustomThemes() {
return (platform?.themes?.discover() ?? Promise.resolve({})).then((themes) => {
setCustomThemes(
Object.entries(themes).reduce<Record<string, ThemeJson>>((result, [name, theme]) => {
if (isTheme(theme)) result[name] = theme
return result
}, {}),
)
})
return (platform?.themes?.discover() ?? Promise.resolve({}))
.then((themes) => {
setCustomThemes(
Object.entries(themes).reduce<Record<string, ThemeJson>>((result, [name, theme]) => {
if (isTheme(theme)) result[name] = theme
return result
}, {}),
)
})
.catch(() => setStore("active", "opencode"))
}

View file

@ -136,10 +136,12 @@ export function Tips(props: { api: TuiPluginApi; connected?: boolean }) {
}
const tip = createMemo(() => {
if (props.connected === false) return NO_MODELS_TIP
const tips = [...TIPS, environment.capabilities.terminalSuspend ? TERMINAL_SUSPEND_TIP : INPUT_UNDO_TIP].flatMap((item) => {
const value = typeof item === "string" ? item : item(shortcuts)
return value ? [value] : []
})
const tips = [...TIPS, environment.capabilities.terminalSuspend ? TERMINAL_SUSPEND_TIP : INPUT_UNDO_TIP].flatMap(
(item) => {
const value = typeof item === "string" ? item : item(shortcuts)
return value ? [value] : []
},
)
return tips[Math.floor(tipOffset * tips.length)] ?? NO_MODELS_TIP
}, NO_MODELS_TIP)
// Solid can expose a memo's initial value while a pure computation is pending.

View file

@ -211,11 +211,7 @@ export function formatKeyBindings(bindings: Parameters<typeof formatCommandBindi
return formatCommandBindingsExtra(bindings, formatOptions(config))
}
export function registerOpencodeKeymap(
keymap: OpenTuiKeymap,
renderer: CliRenderer,
config: ResolvedKeymapConfig,
) {
export function registerOpencodeKeymap(keymap: OpenTuiKeymap, renderer: CliRenderer, config: ResolvedKeymapConfig) {
const modeStack = createOpencodeModeStack(keymap)
const offCommaBindings = registerCommaBindings(keymap)
const offAliasExpander = registerKeyAliases(keymap)

View file

@ -5,10 +5,7 @@ export function stripPromptPartIDs<Part extends { id: string; messageID: string;
return rest
}
export function expandPastedTextPlaceholders(
text: string,
parts: readonly unknown[],
) {
export function expandPastedTextPlaceholders(text: string, parts: readonly unknown[]) {
return parts.reduce<string>((result, part) => {
if (!isPastedTextPart(part)) return result
return result.replace(part.source.text.value, part.text)

View file

@ -460,7 +460,8 @@ export function Session() {
},
run: async () => {
const copy = (url: string) =>
platform.clipboard?.write?.(url)
platform.clipboard
?.write?.(url)
.then(() => toast.show({ message: "Share URL copied to clipboard!", variant: "success" }))
.catch(() => toast.show({ message: "Failed to copy URL to clipboard", variant: "error" }))
const url = session()?.share?.url
@ -895,7 +896,8 @@ export function Session() {
return
}
platform.clipboard?.write?.(text)
platform.clipboard
?.write?.(text)
.then(() => toast.show({ message: "Message copied to clipboard!", variant: "success" }))
.catch(() => toast.show({ message: "Failed to copy to clipboard", variant: "error" }))
dialog.clear()

View file

@ -30,7 +30,8 @@ export function cliErrorMessage(input: unknown): string | undefined {
}
const provider = configData(input, "ProviderInitError")
if (provider) return `Failed to initialize provider "${field(provider, "providerID")}". Check credentials and configuration.`
if (provider)
return `Failed to initialize provider "${field(provider, "providerID")}". Check credentials and configuration.`
const json = configData(input, "ConfigJsonError")
if (json) {