debug
parent
8b45247d24
commit
7e1d396427
|
|
@ -1,16 +1,19 @@
|
|||
/** @jsxImportSource @opentui/solid */
|
||||
/** @jsxImportSource ../../packages/opencode/node_modules/@opentui/solid */
|
||||
import mytheme from "../themes/mytheme.json" with { type: "json" }
|
||||
|
||||
const slot = (label) => ({
|
||||
id: "workspace-smoke",
|
||||
slots: {
|
||||
home_hint() {
|
||||
console.error(`[workspace-smoke] render home_hint (${label})`)
|
||||
return <text> [plugin:{label}]</text>
|
||||
},
|
||||
home_footer() {
|
||||
console.error(`[workspace-smoke] render home_footer (${label})`)
|
||||
return <text> theme:workspace-plugin-smoke</text>
|
||||
},
|
||||
session_footer(_ctx, props) {
|
||||
console.error(`[workspace-smoke] render session_footer (${props.session_id.slice(0, 8)})`)
|
||||
return <text> session:{props.session_id.slice(0, 8)}</text>
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -160,14 +160,29 @@ export function tui(input: {
|
|||
}
|
||||
|
||||
const renderer = await createCliRenderer(rendererConfig(input.config))
|
||||
const registry = createSolidSlotRegistry<TuiSlotMap, TuiSlotContext>(renderer, {
|
||||
url: input.url,
|
||||
directory: input.directory,
|
||||
})
|
||||
const registry = createSolidSlotRegistry<TuiSlotMap, TuiSlotContext>(
|
||||
renderer,
|
||||
{
|
||||
url: input.url,
|
||||
directory: input.directory,
|
||||
},
|
||||
{
|
||||
onPluginError(event) {
|
||||
console.error("[tui.slot] plugin error", {
|
||||
plugin: event.pluginId,
|
||||
slot: event.slot,
|
||||
phase: event.phase,
|
||||
source: event.source,
|
||||
message: event.error.message,
|
||||
})
|
||||
},
|
||||
},
|
||||
)
|
||||
const Slot = createSlot<TuiSlotMap, TuiSlotContext>(registry)
|
||||
const slot: TuiSlot = (props) => Slot(props)
|
||||
const slots: TuiSlots = {
|
||||
register(plugin) {
|
||||
console.error("[tui.slot] register", plugin.id)
|
||||
return registry.register(plugin as SolidPlugin<TuiSlotMap, TuiSlotContext>)
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ export namespace TuiPlugin {
|
|||
const plugin = slot(entry)
|
||||
if (plugin) {
|
||||
input.slots.register(plugin)
|
||||
log.info("registered tui slot plugin", { id: plugin.id })
|
||||
}
|
||||
|
||||
const tui = (() => {
|
||||
|
|
@ -97,6 +98,7 @@ export namespace TuiPlugin {
|
|||
})()
|
||||
if (!tui) continue
|
||||
await tui(input, Config.pluginOptions(item))
|
||||
log.info("initialized tui plugin module", { path: spec })
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue