Why: Allow consumers to download an immutable module revision without nested source checkouts or local path replacements. Evidence: SELF package tests and the prior canonical-path rejection are recorded in the Dev dependency-workspace task card; remote consumption is replayed against the committed candidate. Impact: Change the module identity and its Go imports while preserving API behavior. Existing historical submodule revisions remain buildable. Refs: Versioned dependencies U1/U3; feature/dependency-workspace
66 lines
2.0 KiB
Go
66 lines
2.0 KiB
Go
package runmgr
|
||
|
||
import (
|
||
core "git-ssh.u1680832.nyat.app/weichen/Agent-System-Core.git"
|
||
)
|
||
|
||
// SetGenUIAuto 注入自动建议闸门(组合根装配;nil 关闭)。
|
||
func (m *Manager) SetGenUIAuto(a GenUIAutoTrigger) { m.genuiAuto = a }
|
||
|
||
// genUIAutoReminderText 与 genui.AutoReminder 文案保持同步(runmgr 不得依赖 genui 包)。
|
||
func genUIAutoReminderText() string {
|
||
return "任务语义事件已发生(阶段或材料/工件完成)。若 generative-ui 已启用,请调用一次 generative-ui.present 生成或修订建议页,按当前任务阶段组织信息。不要点击页面 actions,不要改写 plan/todo/任务完成状态;任务事实只能来自真实任务记录。"
|
||
}
|
||
|
||
// maybeGenUIAuto:语义事件钩子入口。仅同步追加 system-reminder,供后续回合消费;
|
||
// 不另起 notice-run(避免与在途 run / 测试拆卸竞态)。材料完成路径在
|
||
// startNoticeRun 内联注入同一文案。
|
||
func (m *Manager) maybeGenUIAuto(owner, convID, reason string) {
|
||
if m == nil || m.genuiAuto == nil {
|
||
return
|
||
}
|
||
ok, _ := m.genuiAuto.Try(owner, convID, reason)
|
||
if !ok {
|
||
return
|
||
}
|
||
text := "<system-reminder>\n" + genUIAutoReminderText() + "\n(trigger=" + reason + ")\n</system-reminder>"
|
||
msg := core.Message{
|
||
ConversationID: convID, Role: core.RoleSystem,
|
||
Parts: []core.Part{{Type: core.PartText, Text: text}},
|
||
}
|
||
_ = m.st.AppendMessage(&msg)
|
||
}
|
||
|
||
func planStageChanged(prev, next core.PlanSnapshot) bool {
|
||
pm := map[string]string{}
|
||
for _, s := range prev.Steps {
|
||
pm[s.ID] = string(s.Status)
|
||
}
|
||
for _, s := range next.Steps {
|
||
if pm[s.ID] != string(s.Status) {
|
||
return true
|
||
}
|
||
}
|
||
// 新增步骤也视为阶段组织变化
|
||
if len(next.Steps) > len(prev.Steps) {
|
||
return true
|
||
}
|
||
return false
|
||
}
|
||
|
||
func todoStageChanged(prev, next core.TodoList) bool {
|
||
pm := map[string]string{}
|
||
for _, t := range prev.Items {
|
||
pm[t.ID] = string(t.Status)
|
||
}
|
||
for _, t := range next.Items {
|
||
if pm[t.ID] != string(t.Status) {
|
||
return true
|
||
}
|
||
}
|
||
if len(next.Items) > len(prev.Items) {
|
||
return true
|
||
}
|
||
return false
|
||
}
|