feat: wire Layer 2 daemon plugin loader into archied startup
Daemon plugins (Yaegi-interpreted .go files) are now loaded from the configured plugin_dir at startup. Each file must export a 'Plugin' variable using the _Plugin wrapper struct, which bridges Yaegi types to the Go plugin.Plugin interface. Changes: - internal/plugin/pluginextract/ — generated Yaegi symbol table for the plugin package (mirrors wfextract pattern), including the _Plugin interface wrapper that lets interpreted code implement Go interfaces - LoadDir now accepts optional symbol tables via variadic parameter, avoiding an import cycle between plugin and pluginextract - Plugin tests rewritten as behavioral (not structural), verifying actual Yaegi interpretation of valid, invalid, and missing plugins - config.PluginDir field for specifying the plugin directory - daemon.PluginRegistry field for holding loaded plugins - main.go wires plugin loading: LoadDir at startup, register into daemon, log each loaded plugin Why: the Plugin interface and LoadDir existed but weren't connected to the daemon. Skills define workflows; daemon plugins are the extension point for forge resolvers, storage backends, and other core-daemon concerns.
This commit is contained in:
1 parent
8958a82233
commit
f38ba5d515
8 files changed
+256
-35
No files matched your search
+21
-2
@@ -21,6 +21,8 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/events"
|
||||
"github.com/samcharles93/archie-core/internal/forge"
|
||||
"github.com/samcharles93/archie-core/internal/nats"
|
||||
"github.com/samcharles93/archie-core/internal/plugin"
|
||||
"github.com/samcharles93/archie-core/internal/plugin/pluginextract"
|
||||
"github.com/samcharles93/archie-core/internal/store"
|
||||
"github.com/samcharles93/archie-core/internal/webui"
|
||||
"github.com/samcharles93/archie-core/internal/workflow/skillbuild"
|
||||
@@ -176,6 +178,22 @@ func run() int {
|
||||
}
|
||||
log.Info("workflow registry built", "workflows", len(registry))
|
||||
|
||||
// Load daemon plugins from the configured plugin directory (Layer 2).
|
||||
// Failed plugins are skipped — the daemon starts with the remaining set.
|
||||
var pluginReg *plugin.Registry
|
||||
if cfg.PluginDir != "" {
|
||||
plugins, err := plugin.LoadDir(cfg.PluginDir, pluginextract.Symbols)
|
||||
if err != nil {
|
||||
log.Error("plugin load failed", "dir", cfg.PluginDir, "err", err)
|
||||
return 1
|
||||
}
|
||||
pluginReg = &plugin.Registry{}
|
||||
for _, p := range plugins {
|
||||
pluginReg.Register(p)
|
||||
log.Info("daemon plugin loaded", "name", p.Name(), "version", p.Version())
|
||||
}
|
||||
}
|
||||
|
||||
d := &daemon.Daemon{
|
||||
Cfg: cfg,
|
||||
Store: st,
|
||||
@@ -190,8 +208,9 @@ func run() int {
|
||||
},
|
||||
Runtime: llm,
|
||||
Agent: agentRunner,
|
||||
Workflows: registry,
|
||||
Log: log,
|
||||
Workflows: registry,
|
||||
PluginRegistry: pluginReg,
|
||||
Log: log,
|
||||
CustomStages: wfeval.Discover,
|
||||
Nats: natsClient,
|
||||
ContainerPool: containerPool,
|
||||
|
||||
Reference in new issue
Block a user