mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-09-22 09:58:06 +00:00
fix: correct OpenClaw plugin architecture - notifications as sole registration path
- Remove SKILL tool registration with nil handler (was causing nil pointer in StageHost.ExecuteTool) - Rewrite loadOCPlugin: notifications are the only registration path. Synchronously drain all buffered register notifications after waitReady, then start persistent notifyLoop for future registrations. ListTools is verification-only, no longer registers tools. - notifyLoop: persistent via for n := range sp.NotifyChan(), lifecycle bound to sidecar process - StageHost.ExecuteTool: add nil-handler check (defense-in-depth) - Remove unused OCNamedParam, DrainNotify from sidecar.go
This commit is contained in:
@ -50,14 +50,6 @@ type OCNotification struct {
|
||||
Params json.RawMessage `json:"params"`
|
||||
}
|
||||
|
||||
// OCNamedParam 通知参数中至少包含 name 的结构
|
||||
type OCNamedParam struct {
|
||||
Type string `json:"type"`
|
||||
Data *struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
type sidecarProcess struct {
|
||||
name string
|
||||
dir string
|
||||
@ -313,17 +305,6 @@ func (s *sidecarProcess) CallTool(name string, args map[string]interface{}) (str
|
||||
return sb, nil
|
||||
}
|
||||
|
||||
// DrainNotify 排空通知通道
|
||||
func (s *sidecarProcess) DrainNotify() {
|
||||
for {
|
||||
select {
|
||||
case <-s.notifyCh:
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *sidecarProcess) Close() {
|
||||
s.mu.Lock()
|
||||
if s.closed || s.stopped {
|
||||
|
||||
Reference in New Issue
Block a user