Version: 0.9.8.dev.260408
后端:
1.execute 上下文瘦身第一版落地(固定 4 消息骨架 + ReAct 窗口压缩 + JSON 输出约束)
- 新建 prompt/execute_context.go:
execute 阶段改为 message[0..3] 固定结构;
加入历史摘要、当轮 ReAct 绑定展示、同工具 observation 压缩(保留最新)与工具简表返回示例提示
- 更新 prompt/execute.go:
重写 plan/ReAct 执行提示词;
补齐“可做/不可做”约束;
统一严格 JSON 指令;
补充 tool_call.arguments/abort/speak 非空等格式护栏
- 更新 model/execute_contract.go:
新增 ExecuteDecision/ToolCallIntent 自定义 Unmarshal;
兼容空字符串占位与 tool_call.parameters→arguments 回退解析
- 更新 node/correction.go:
为 correction 注入 history kind 标记,避免被当作真实用户输入污染摘要
- 更新 node/execute.go:
补齐 continue/ask_user/confirm 的 speak 兜底;
移除工具结果写入前 3000 字截断
2.工具层微调语义重构(任务视角概览 + 首个空位查询 + 移动权限收紧)
- 更新 tools/read_tools.go:
get_overview 改为任务视角全量输出(课程仅占位统计);
新增 find_first_free(首个命中位 + 当日负载明细);
find_free 保留兼容别名;
list_tasks 增加 status/category 校验与空结果纠偏文案
- 更新 tools/registry.go:
注册 find_first_free;
find_free 改兼容别名;
同步 get_overview/list_tasks/move/batch_move 描述语义
- 更新 tools/write_tools.go:
move/batch_move 仅允许 suggested,existing/pending 明确拒绝并返回可读错误
- 更新 tools/SCHEDULE_TOOLS.md:
同步 get_overview/find_first_free/list_tasks/move/batch_move 的最新入参与返回示例
- 更新 prompt/plan.go:
读工具示例由 find_free 调整为 find_first_free
3.交接文档与阶段说明同步
- 更新 newAgent/HANDOFF_粗排修复与Prompt重构.md:
更新为 2026-04-08;
补充“最新增量交接”章节(当前主矛盾、P0/P1、验证清单)
- 更新 newAgent/阶段3_上下文瘦身设计.md:
同步 existing/suggested 的 move/batch_move 约束口径
- 更新 newAgent/Log.txt:
追加本轮 execute 调试日志快照
前端:无
仓库:无
This commit is contained in:
@@ -92,7 +92,7 @@ func Place(state *ScheduleState, taskID, day, slotStart int) string {
|
||||
// ==================== Move ====================
|
||||
|
||||
// Move 将一个已落位任务移动到新位置。
|
||||
// taskID 允许是 suggested / existing,但不能是真实 pending。
|
||||
// taskID 仅允许 suggested;existing/pending 都不允许移动。
|
||||
func Move(state *ScheduleState, taskID, newDay, newSlotStart int) string {
|
||||
// 1. 查找任务。
|
||||
task := state.TaskByStateID(taskID)
|
||||
@@ -101,8 +101,14 @@ func Move(state *ScheduleState, taskID, newDay, newSlotStart int) string {
|
||||
}
|
||||
|
||||
// 2. 校验状态。
|
||||
if IsPendingTask(*task) {
|
||||
return fmt.Sprintf("移动失败:[%d]%s 当前为待安排状态,请使用 place 放置。", task.StateID, task.Name)
|
||||
if !IsSuggestedTask(*task) {
|
||||
// 2.1 pending 任务尚未落位,应通过 place 安排;
|
||||
// 2.2 existing 任务属于已安排事实层,不允许在 execute 微调里直接 move;
|
||||
// 2.3 仅 suggested 属于“本轮可微调建议落位”。
|
||||
if IsPendingTask(*task) {
|
||||
return fmt.Sprintf("移动失败:[%d]%s 当前为待安排状态,请使用 place 放置。", task.StateID, task.Name)
|
||||
}
|
||||
return fmt.Sprintf("移动失败:[%d]%s 当前为已安排(existing)任务,不允许 move;仅 suggested 任务可移动。", task.StateID, task.Name)
|
||||
}
|
||||
|
||||
// 3. 校验锁定。
|
||||
@@ -248,6 +254,7 @@ func Swap(state *ScheduleState, taskAID, taskBID int) string {
|
||||
// ==================== BatchMove ====================
|
||||
|
||||
// BatchMove 原子性地批量移动多个任务。
|
||||
// moves 中每个 task_id 都必须是 suggested;existing/pending 任一命中都会整批失败。
|
||||
// 全部成功才生效,任一失败则完全回滚。
|
||||
func BatchMove(state *ScheduleState, moves []MoveRequest) string {
|
||||
if len(moves) == 0 {
|
||||
@@ -260,8 +267,14 @@ func BatchMove(state *ScheduleState, moves []MoveRequest) string {
|
||||
if task == nil {
|
||||
return fmt.Sprintf("批量移动失败,全部回滚,无任何变更。\n任务ID %d 不存在(第%d条移动请求)。", m.TaskID, i+1)
|
||||
}
|
||||
if IsPendingTask(*task) {
|
||||
return fmt.Sprintf("批量移动失败,全部回滚,无任何变更。\n[%d]%s 当前为待安排状态,请使用 place(第%d条移动请求)。",
|
||||
if !IsSuggestedTask(*task) {
|
||||
// 1.1 保持与 Move 一致:批量移动仅允许 suggested;
|
||||
// 1.2 pending / existing 任一命中都应整批失败并回滚。
|
||||
if IsPendingTask(*task) {
|
||||
return fmt.Sprintf("批量移动失败,全部回滚,无任何变更。\n[%d]%s 当前为待安排状态,请使用 place(第%d条移动请求)。",
|
||||
task.StateID, task.Name, i+1)
|
||||
}
|
||||
return fmt.Sprintf("批量移动失败,全部回滚,无任何变更。\n[%d]%s 当前为已安排(existing)任务,不允许 move;仅 suggested 任务可移动(第%d条移动请求)。",
|
||||
task.StateID, task.Name, i+1)
|
||||
}
|
||||
if err := checkLocked(*task); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user