feat(shm): InputChannel/OutputChannel lane 基础设施(§13.5/§13.6)

- injectParams 加 TextRef SharedRef(兼容旧 Text 字段)
- resolveText 辅助函数:优先 SharedRef,否则内联 Text
- 核心注入方法待迁移至 resolveText
This commit is contained in:
JianFeeeee
2026-09-10 16:14:17 +08:00
parent 9cfdfc9de8
commit 2bc813be13

View File

@ -559,10 +559,20 @@ func (h *coreHandler) Handle(method string, params json.RawMessage) (interface{}
return nil, fmt.Errorf("未知 method: %s", method)
}
// resolveText 从 injectParams 中提取 text优先使用 TextRefSharedRef
// 否则使用内联 Text。兼容新旧两种协议。
func (h *coreHandler) resolveText(p injectParams) string {
if !p.TextRef.IsZero() {
return string(p.TextRef.Slice(h.host.data))
}
return p.Text
}
type injectParams struct {
Source string `json:"source"`
Channel string `json:"channel"`
Text string `json:"text"`
Source string `json:"source"`
Channel string `json:"channel"`
Text string `json:"text,omitempty"`
TextRef SharedRef `json:"text_ref,omitempty"`
}
// injectMediaParams 是带媒体注入的参数。