MCPcopy Index your code
hub / github.com/anomalyco/opencode / addExternalPluginEntries

Function addExternalPluginEntries

packages/opencode/src/plugin/tui/runtime.ts:776–811  ·  view source on GitHub ↗
(state: RuntimeState, ready: PluginLoad[])

Source from the content-addressed store, hash-verified

774}
775
776async function addExternalPluginEntries(state: RuntimeState, ready: PluginLoad[]) {
777 if (!ready.length) return { plugins: [] as PluginEntry[], ok: true }
778
779 const meta = await PluginMeta.touchMany(
780 ready.map((item) => ({
781 spec: item.spec,
782 target: item.target,
783 id: item.id,
784 })),
785 ).catch(() => undefined)
786
787 const plugins: PluginEntry[] = []
788 let ok = true
789 for (let i = 0; i < ready.length; i++) {
790 const entry = ready[i]
791 if (!entry) continue
792 const hit = meta?.[i]
793 const info = createMeta(entry.source, entry.spec, entry.target, hit, entry.id)
794 const themes = hit?.entry.themes ? { ...hit.entry.themes } : {}
795 const plugin: PluginEntry = {
796 id: entry.id,
797 load: entry,
798 meta: info,
799 themes,
800 plugin: entry.module.tui,
801 enabled: true,
802 }
803 if (!addPluginEntry(state, plugin)) {
804 ok = false
805 continue
806 }
807 plugins.push(plugin)
808 }
809
810 return { plugins, ok }
811}
812
813function defaultPluginOrigin(state: RuntimeState, spec: string): ConfigPlugin.Origin {
814 return {

Callers 2

addPluginBySpecFunction · 0.85
loadFunction · 0.85

Calls 3

createMetaFunction · 0.85
addPluginEntryFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected