Skip to content

[feat] pi-tui: add PLAN_MODE_BLOCKED errorCode + Windows step wrapper #113

Description

@Zi-Yi-Ming

问题场景(这是为了解决什么问题?)

当前 pi-tui 前端在 plan mode 下拦截写/执行工具时,只返回纯文本拒绝原因,前端无法区分「工具不存在」和「当前模式不允许」。同时 Windows 上 pnpm step 启动 TUI 需要手动处理 Bun/Node 检测,启动门槛高。

期望行为(你希望的方案)

  • 在 pi-tui 的 tool deny 路径增加结构化 errorCode: 'PLAN_MODE_BLOCKED'
  • PiChat.authorizeToolCall 在 plan mode 下返回该 errorCode
  • runTurn 将 errorCode 透传进 preset 与 tool_end 事件
  • 补上 scripts/run-step.mjs,Windows 自动检测 Bun/Node 启动 TUI
  • package.json 增加 step / step:fresh 脚本

已经考虑过的替代方案

  • 仅在 content 文本里嵌入错误码标识:不够结构化,前端解析脆弱
  • 保持纯文本拒绝,Windows wrapper 留给用户手动配置:体验差,不利于推广 step-code 风格终端渲染

相关 issue / PR(可选)

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions