Files
HomeAgent/internal/kernelmod/lua/mod.go
JianFeeeee 4e70b8d5d8 refactor(module): 核心仓 Go module 路径改为 github.com/JianFeeeee/HologramAgent
批 1,不含 SDK 仓与目录改名。

- go.mod 第 1 行 module 路径
- 366 个 .go 文件的完整前缀 github.com/JianFeeeee/HomeAgent 机械替换
  (857 处,仅完整前缀;展示名/注释里的 HomeAgent 字样留给批 5)
- 未改:third_party 目录名、SDK 自身 go.mod module、go.mod replace 目标、
  homed/waiter 可执行名、.hmap 后缀
2026-10-21 12:17:19 +08:00

35 lines
1.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Package lua 是 lua 模块:Lua VM(LLM 协议适配)。
//
// 依赖 config:`initLuaVM(cfg)` 读 cfg.Daemon.DataDir(adapter 目录)。
package lua
import (
"log"
"path/filepath"
"github.com/JianFeeeee/HologramAgent/internal/kernelboot"
"github.com/JianFeeeee/HologramAgent/internal/kernelmod"
luapkg "github.com/JianFeeeee/HologramAgent/internal/lua"
)
// Module 提供 Lua 协议适配 VM。
type Module struct{}
func (Module) Name() string { return "lua" }
func (Module) Requires() []string { return []string{kernelmod.FacConfig} }
func (Module) Provides() []string { return []string{kernelmod.FacLua} }
func (Module) Init(ks *kernelboot.KernelState) error {
luaVM := luapkg.NewVM(filepath.Join(ks.Cfg.Daemon.DataDir, "adapters"))
if err := luaVM.Start(); err != nil {
log.Printf("[homed] warning: lua vm init failed: %v", err)
ks.LuaVM = luaVM
return nil // 与原语义一致:起不来只告警,仍交回实例
}
ks.LuaVM = luaVM
ks.AddCloser(luaVM.Stop)
return nil
}
func init() { kernelmod.Register(Module{}) }