date: 2026-06-11 tags: [inbox, project/cli-agent, type/topic] public: true

工具 Prompt 调整

runCommand

  • 工具帮助文案
    • 当前:
      • 还在运行则返回 “shell_id” 与实际行为冲突,已完成也会返回 shell_id
    • 更改为: - 解耦 shell_id 和正在运行含义: - shell_id: session handle - exit_code:表示命令生命周期状态。有 exit_code 说明命令已退出。没有 exit_code 说明命令仍在运行。 - 同步更改格式化方法 packages/prompts/src/prompts/fileSystem/formatCommandResult.ts
  • 工具调用结果文案
    • 30s 内返回的文案:
      • 当前:
        • Command started in background with shell_id: sh-1
      • 更改为:
        • Command completed successfully with shell_id: sh-1.
    • 超过 30s 未返回时文案:
      • 当前:
        • Command started in background with shell_id: sh-1
        • 更改为:
          • tool result 应表达“本轮观察窗口结束,命令仍在运行”。不要写成 background。
          • a. Command is still running after the wait window with shell_id: sh-1.
          • b.
            • Command is still running after the 30s wait window.  
              shell_id: sh-1  
              Use getCommandOutput to continue observing output.  
              Use killCommand only if the command is no longer needed or appears stuck.
              
    • 调用 Guidelines
      • 环境判断:
        • 用户设备 network、compute、storage、proxy、cache 都可能让命令变慢。需要根据运行情况去判断命令运行时间是否合理。
      • 可观察性:
        • 在慢设备上运行长命令要保留可观察进度,不要为了安静输出隐藏进度,防止长期观察不到命令进展。当你认为输出量会过大或已经了解了设备对命令运行的预期时间,你可以用命令的 quiet 模式,否则尽量不要 quiet。
        • 后台判断:
          • 只有当前任务不依赖该命令 output、exit code、生成文件、安装包或副作用的独立下一步时,才设置 run_in_background=true
      • kill 判据:
        • 只有当命令不再需要,或观察到的执行进度明显不符合你对该命令的计划时间时才需要终止。