MCPcopy
hub / github.com/anomalyco/opencode / createPluginRuntime

Function createPluginRuntime

packages/tui/src/plugin/runtime.tsx:12–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10import { createSlots, type HostSlots } from "./slots"
11
12export function createPluginRuntime() {
13 const [commands, setCommands] = createSignal<PluginRuntimeCommands>(emptyCommands)
14 const [status, setStatus] = createSignal<ReadonlyArray<TuiPluginStatus>>([])
15 const slots = createSlots()
16
17 return {
18 Slot: slots.Slot,
19 routes: createPluginRoutes(),
20 commands,
21 status,
22 update(input: { commands?: PluginRuntimeCommands; status?: ReadonlyArray<TuiPluginStatus> }) {
23 if (input.commands) setCommands(input.commands)
24 if (input.status) setStatus(input.status)
25 },
26 clear() {
27 setCommands(emptyCommands)
28 setStatus([])
29 slots.clear()
30 },
31 setupSlots(api: TuiPluginApi): HostSlots {
32 return slots.setup(api)
33 },
34 }
35}
36
37export type PluginRuntimeCommands = {
38 activate: (id: string) => Promise<boolean>

Callers 3

runtime.test.tsFile · 0.90
app.tsxFile · 0.90
initFunction · 0.90

Calls 2

createSlotsFunction · 0.90
createPluginRoutesFunction · 0.90

Tested by

no test coverage detected