mirror of
https://gitcode.com/JianFeeeee/homeagent-sdk.git
synced 2026-10-15 12:15:11 +00:00
refactor: centralize ABI metadata into meta/meta.go
- meta/meta.go: add ABIVersion, ABIVersionMin, 45 dispatch method IDs - tools/plugindev/cmd_init.go: cabiVersion -> meta.ABIVersion - tools/plugindev/templates.go: C header comments reference meta.go
This commit is contained in:
64
meta/meta.go
64
meta/meta.go
@ -1,5 +1,6 @@
|
|||||||
// Package meta 收集 HomeAgent SDK 的全部元数据。
|
// Package meta 收集 HomeAgent SDK 的全部元数据。
|
||||||
// 版本号应与核心 meta.Version 保持一致。
|
// 版本号应与核心 meta.Version 保持一致。
|
||||||
|
// ABI 版本与 Dispatch Method ID 应与核心仓 internal/meta/meta.go 保持一致。
|
||||||
package meta
|
package meta
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -15,9 +16,72 @@ var (
|
|||||||
|
|
||||||
// SDKName 是 SDK 名称。
|
// SDKName 是 SDK 名称。
|
||||||
SDKName = "HomeAgent SDK"
|
SDKName = "HomeAgent SDK"
|
||||||
|
|
||||||
|
// CoreModule 是核心仓的 Go module path,供 plugindev 生成 go.mod 时使用。
|
||||||
|
CoreModule = "gitcode.com/JianFeeeee/HomeAgent"
|
||||||
|
|
||||||
|
// CoreVersion 是此 SDK 所兼容的最低核心版本。
|
||||||
|
CoreVersion = "0.7.2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FullVersion 返回完整的版本字符串。
|
// FullVersion 返回完整的版本字符串。
|
||||||
func FullVersion() string {
|
func FullVersion() string {
|
||||||
return SDKName + " v" + Version + " (" + Commit + ")"
|
return SDKName + " v" + Version + " (" + Commit + ")"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---- ABI 版本(与核心仓 internal/meta/meta.go 同步) ----
|
||||||
|
// 修改时需确保核心仓与 SDK 仓的值一致。
|
||||||
|
|
||||||
|
const (
|
||||||
|
ABIVersion = 1
|
||||||
|
ABIVersionMin = 1
|
||||||
|
)
|
||||||
|
|
||||||
|
// ---- Dispatch Method IDs(与核心仓 internal/meta/meta.go 同步) ----
|
||||||
|
const (
|
||||||
|
CoreRegisterTool = 1
|
||||||
|
CoreRegisterStage = 2
|
||||||
|
CoreRegisterOutputCh = 3
|
||||||
|
CoreRegisterPluginAPI = 4
|
||||||
|
CoreInjectText = 5
|
||||||
|
CoreInjectInterruptText = 6
|
||||||
|
CoreInjectTextNoMemory = 7
|
||||||
|
CoreSetAutoRestart = 8
|
||||||
|
CoreMemoryRecall = 9
|
||||||
|
CoreMemoryCommit = 10
|
||||||
|
CoreMemoryIntrospect = 11
|
||||||
|
CoreMemoryMerge = 12
|
||||||
|
CoreMemoryPurge = 13
|
||||||
|
CoreDocQuery = 14
|
||||||
|
CoreKnowledgeSearch = 15
|
||||||
|
CoreSettingsGet = 16
|
||||||
|
CoreSettingsSet = 17
|
||||||
|
CoreSettingsRegisterDef = 18
|
||||||
|
CoreLLMListSources = 19
|
||||||
|
CoreLLMSetSource = 20
|
||||||
|
CoreSocialGetPerson = 21
|
||||||
|
CoreSocialGetNetwork = 22
|
||||||
|
CoreSubscribe = 23
|
||||||
|
CoreUnsubscribe = 24
|
||||||
|
CoreFreeString = 25
|
||||||
|
CoreSettingsGetCore = 26
|
||||||
|
CoreSettingsSetCore = 27
|
||||||
|
CoreSettingsListCore = 28
|
||||||
|
CoreSettingsGetPlugin = 29
|
||||||
|
CoreSettingsSetPlugin = 30
|
||||||
|
CoreSettingsListPlugin = 31
|
||||||
|
CoreDocInsert = 32
|
||||||
|
CoreDocRemove = 33
|
||||||
|
CoreDocStats = 34
|
||||||
|
CoreKnowledgeAdd = 35
|
||||||
|
CoreKnowledgeList = 36
|
||||||
|
CoreLLMCurrentSource = 37
|
||||||
|
CoreSocialGetTrait = 38
|
||||||
|
CoreSocialGetRelations = 39
|
||||||
|
CoreSocialListPersons = 40
|
||||||
|
CoreTextMemoryAppend = 41
|
||||||
|
CoreSettingsList = 42
|
||||||
|
CoreSettingsDefs = 43
|
||||||
|
CoreSettingsDump = 44
|
||||||
|
CoreSettingsPlugins = 45
|
||||||
|
)
|
||||||
|
|||||||
@ -6,9 +6,9 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
)
|
|
||||||
|
|
||||||
const cabiVersion = 1
|
"gitcode.com/JianFeeeee/homeagent-sdk/meta"
|
||||||
|
)
|
||||||
|
|
||||||
type PlgConfig struct {
|
type PlgConfig struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
@ -84,7 +84,7 @@ func cmdInit(args []string) {
|
|||||||
Targets: targets,
|
Targets: targets,
|
||||||
},
|
},
|
||||||
IsLua: isLua,
|
IsLua: isLua,
|
||||||
CABIVersion: cabiVersion,
|
CABIVersion: meta.ABIVersion,
|
||||||
CABIHeader: tmplCABIHeader,
|
CABIHeader: tmplCABIHeader,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
module github.com/JianFeeeee/homeagent-sdk/tools/plugindev
|
module github.com/JianFeeeee/homeagent-sdk/tools/plugindev
|
||||||
|
|
||||||
go 1.21
|
go 1.25.0
|
||||||
|
|
||||||
|
require gitcode.com/JianFeeeee/homeagent-sdk v0.0.0
|
||||||
|
|
||||||
|
replace gitcode.com/JianFeeeee/homeagent-sdk => ../../
|
||||||
|
|||||||
@ -279,9 +279,11 @@ func main() {}
|
|||||||
`
|
`
|
||||||
|
|
||||||
// tmplCABIHeader — shared C ABI type definitions for both core and plugin
|
// tmplCABIHeader — shared C ABI type definitions for both core and plugin
|
||||||
|
// 此模板中的常量应与 core/internal/meta/meta.go 保持一致(ABI 版本、dispatch method IDs)。
|
||||||
const tmplCABIHeader = `
|
const tmplCABIHeader = `
|
||||||
#ifndef HOMEAGENT_CABI_H
|
#ifndef HOMEAGENT_CABI_H
|
||||||
#define HOMEAGENT_CABI_H
|
#define HOMEAGENT_CABI_H
|
||||||
|
// HOMEAGENT_ABI_VERSION 与 sdk/meta/meta.go ABIVersion 同步
|
||||||
#define HOMEAGENT_ABI_VERSION 1
|
#define HOMEAGENT_ABI_VERSION 1
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
Reference in New Issue
Block a user