@muzi3/next-step-waiting

Pi extension: wait_for_condition tool — pause and wait for an external action to complete or ask the user whether to continue, with pluggable detectors (shell command polling or sub-agent judgment).

Packages

Package details

extension

Install @muzi3/next-step-waiting from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@muzi3/next-step-waiting
Package
@muzi3/next-step-waiting
Version
0.1.1
Published
Aug 25, 2026
Downloads
223/mo · 223/wk
Author
muzi3
License
MIT
Types
extension
Size
21.2 KB
Dependencies
0 dependencies · 3 peers
Pi manifest JSON
{
  "extensions": [
    "./extensions"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@muzi3/next-step-waiting

Pi 扩展:wait_for_condition 工具 —— 让 AI 暂停并等待外部动作完成,或向用户确认「是否继续」,检测器可插拔。

安装

pi install npm:@muzi3/next-step-waiting

工具用法

agent 在需要等待外部动作(登录、手动配置、部署、CI、线下联调、用户操作),或想询问用户「要继续吗」时调用 wait_for_condition,它会弹出等待面板并启动检测器,直到:

  1. 检测器判定完成(detected
  2. 用户按回车手动继续(manual
  3. 用户按 Esc 取消(cancelled),或总超时(timeout

参数

参数 类型 必填 说明
instruction string 告诉用户要完成什么外部操作,显示在等待面板
check string shell 检测命令,exit 0 = 完成(适合查文件/进程/日志/接口)
checkPrompt string 需要智能判断时的检测任务描述(交给子 agent)
intervalMs number 检测间隔。命令默认 3000,子 agent 默认 30000
timeoutMs number 总超时。0 = 不限时(默认)

检测器(可插拔)

  • check:周期执行 shell 命令,exit 0 判定完成。单次超时 max(2×间隔, 60s),上限 15min。
  • checkPrompt:spawn 独立 pi --mode json 子进程,用它的工具查证并智能判断(YES/NO)。单次超时 max(2×间隔, 5min),上限 15min。

纯确认模式

checkcheckPrompt 都不提供时,进入纯确认模式:无检测器,仅等待用户按回车继续或 Esc 取消。 适合 AI 想询问用户「要继续吗」的场景——instruction 写清楚要确认的问题即可。

返回 status

  • detected / manual / cancelled / timeout