mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-09-21 17:38:10 +00:00
## WebUI 版本链路修复 问题:handler.go:949 报的是 sdk.SDKVersion,那条链最终指向 SDK 仓 meta.Version 的硬编码值,与 -ldflags 注入的内核版本 完全不相交。构建时间、commit hash 全部丢失。 dashboard.html 兜底值是 '0.1.0'——碰巧版本号相等时不显眼, 一旦不等就报错。 修复: - KernelStatus 新增 BuildStatus 字段(Version/Commit/BuildTime/SDKCompatible/KernelName) 取自 internal/meta(-ldflags 注入点),与接口冻结无关(KernelStatus 只在 internal/sdk) - /api/v1/status 改用 meta.Version,另加 sdk_version 字段暴露 SDK 版本 - dashboard.html 概览卡显示 HomeAgent vX.Y.Z + commit/日期/SDK 兼容版本, 去掉 || '0.1.0' 误导性兜底 ## Windows 交叉编译修复 问题:internal/plugin/dynamic_proc_windows.go(Part 1 的桩,610e9d0)只定义了 tryLoadProc,但平台中立的 registry.go 还在调 loadProc / closeProcHost——这两个 函数只在 dynamic_proc_unix.go 里。Windows 下整个 homed 从 Part 1 起编译不过。 plan.md §12.5 声称「Windows 只做了交叉编译,无真机验证」——实际是连编译都没通过。 修复:dynamic_proc_unix.go / dynamic_proc_windows.go 合并为平台中立的 dynamic_proc.go(文件内无任何平台专属调用,proc 包内部通过 shmalloc_* / evtfd_* / shmpass_* / procattr_* 各自带构建标签处理差异)。 ## 发布脚本三处回归修复 deploy/packaging/build.sh(从 package/build.sh 移到 deploy/packaging/ 后): 1. PROJECT_ROOT 少一层目录(.. → ../..),产物落进 deploy/build/ 而非根目录 2. initconfig 从未被构建,但 installer.nsi 和 package-linux.sh 都引用它 3. GO 兜底路径指向 /home/jianf/go1.26.5(陈旧硬编码)改为 command -v go 4. electron-builder --config package.json 校验整个文件导致 devDependencies 被判为 unknown property,去掉 --config 让它从 build 键读配置 deploy/packaging/package-linux.sh: 1. build_go() 补上 initconfig 构建步骤 2. GO 兜底路径同步修复 知识库 3 条重写 + 1 条新增: - homeagent_identity:v0.9.0 C ABI → v1.0.0 子进程 - homeagent_architecture:全篇重写为子进程架构(三面通信、Supervisor 台账、 崩溃自愈、权限三道闸) - homeagent_recent_updates:在 v0.9.0 前插入 v1.0.0 主线摘要 - changelog_v1.0.0(新建):6 类缺陷消除、架构、实测、已知限制、迁移指引
120 lines
3.5 KiB
Go
120 lines
3.5 KiB
Go
package sdk
|
||
|
||
// StatusAPI provides a snapshot of the kernel runtime status.
|
||
type StatusAPI interface {
|
||
GetKernelStatus() *KernelStatus
|
||
}
|
||
|
||
// KernelStatus is the aggregated runtime snapshot of all kernel subsystems.
|
||
type KernelStatus struct {
|
||
Uptime string `json:"uptime"`
|
||
StartTime string `json:"start_time"`
|
||
|
||
// Build 是内核自身的版本与构建信息。
|
||
//
|
||
// 为何需要:此前 WebUI 展示的“版本”取自 `sdk.SDKVersion`,那是 **SDK 仓
|
||
// meta.Version 的硬编码值**;而 `-ldflags` 注入的是内核的
|
||
// `internal/meta.Version`——两条链完全不相交。于是:
|
||
// - 构建时注入的真实版本号、commit、构建时间全部丢失;
|
||
// - 两仲版本号碰巧相等时看不出问题,一旦不等就报错版本;
|
||
// - 无法回答“现网跑的是哪个 commit 构出来的”。
|
||
Build BuildStatus `json:"build"`
|
||
|
||
AgentID string `json:"agent_id"`
|
||
|
||
Plugins []PluginInfo `json:"plugins"`
|
||
Tools []ToolDef `json:"tools"`
|
||
Channels []ChannelInfo `json:"channels"`
|
||
|
||
Memory MemoryStatus `json:"memory"`
|
||
Knowledge KnowledgeStatus `json:"knowledge"`
|
||
Documents DocumentStatus `json:"documents"`
|
||
TextMemory TextMemoryStatus `json:"text_memory"`
|
||
Social SocialStatus `json:"social"`
|
||
|
||
LLM LLMStatus `json:"llm"`
|
||
|
||
Context ContextStatus `json:"context"`
|
||
|
||
Runtime RuntimeStatus `json:"runtime"`
|
||
|
||
Tracker TrackerStatus `json:"tracker"`
|
||
}
|
||
|
||
type PluginInfo struct {
|
||
Name string `json:"name"`
|
||
Loaded bool `json:"loaded"`
|
||
}
|
||
|
||
type ChannelInfo struct {
|
||
Name string `json:"name"`
|
||
Type string `json:"type"`
|
||
Ready bool `json:"ready"`
|
||
}
|
||
|
||
type MemoryStatus struct {
|
||
Available bool `json:"available"`
|
||
EntityCount int `json:"entity_count"`
|
||
RelationCount int `json:"relation_count"`
|
||
EntityTypes int `json:"entity_types"`
|
||
}
|
||
|
||
type KnowledgeStatus struct {
|
||
Available bool `json:"available"`
|
||
ItemCount int `json:"item_count"`
|
||
Items []string `json:"items,omitempty"`
|
||
}
|
||
|
||
type DocumentStatus struct {
|
||
Available bool `json:"available"`
|
||
DocCount int `json:"doc_count"`
|
||
VectorCount int `json:"vector_count"`
|
||
}
|
||
|
||
type TextMemoryStatus struct {
|
||
Available bool `json:"available"`
|
||
FileCount int `json:"file_count"`
|
||
}
|
||
|
||
type SocialStatus struct {
|
||
Available bool `json:"available"`
|
||
PersonCount int `json:"person_count"`
|
||
}
|
||
|
||
type LLMStatus struct {
|
||
Available bool `json:"available"`
|
||
Provider string `json:"provider,omitempty"`
|
||
Sources int `json:"sources,omitempty"`
|
||
}
|
||
|
||
type ContextStatus struct {
|
||
EventCount int `json:"event_count,omitempty"`
|
||
}
|
||
|
||
type RuntimeStatus struct {
|
||
Goroutines int `json:"goroutines"`
|
||
MemoryMB int64 `json:"memory_mb"`
|
||
GoVersion string `json:"go_version"`
|
||
}
|
||
|
||
// BuildStatus 是内核二进制的构建身份,全部来自 `internal/meta`
|
||
// (由 -ldflags 在构建时注入,未注入时为源码默认值/unknown)。
|
||
type BuildStatus struct {
|
||
// Version 是内核语义版本(如 1.0.0)。
|
||
Version string `json:"version"`
|
||
// Commit 是构建时的 Git 短 hash;未注入为 unknown。
|
||
Commit string `json:"commit"`
|
||
// BuildTime 是 UTC 构建时间;未注入为 unknown。
|
||
BuildTime string `json:"build_time"`
|
||
// SDKCompatible 是本内核可兼容的最高 SDK 版本。
|
||
// 插件用旧 SDK 编译时靠它判断能不能加载。
|
||
SDKCompatible string `json:"sdk_compatible"`
|
||
// KernelName 是内核名(HomeAgent)。
|
||
KernelName string `json:"kernel_name"`
|
||
}
|
||
|
||
type TrackerStatus struct {
|
||
Available bool `json:"available"`
|
||
Dir string `json:"dir,omitempty"`
|
||
}
|