Concepts
HITL Integration ✅
State machine for tool confirmations. Approve/reject high-risk ops (bash/delete). Parse yes/no flows.
TL;DR: Detect risky tools -> Request confirm (yes/no). State machine: idle -> awaiting -> executing -> done. 5min expiry.
Table of Contents
Risk Detection
Auto-classify tools: low/medium/high. High-risk (bash/delete) -> confirm.
From confirmation.ts
| Risk | Examples | Confirm? |
|---|---|---|
| high 🔴 | bash, delete, push | ✅ Always |
| medium 🟡 | write, update | Threshold |
| low 🟢 | list, search | ❌ Never |
State Machine
From state-machine.ts
Confirmation Flows
Parse user reply:
Format request confirmation.ts
Code Snippets
HITL Agent integration hitl-agent.ts
Execute approved executions.ts
Error Handling
| Code | Status | Desc |
|---|---|---|
| HITL_001 | 400 | Invalid confirmation |
| EXEC_TIMEOUT | 408 | Tool timeout (30s) |
| CONF_EXPIRED | 410 | 5min expiry |
Quiz: "no because risky" -> ? A: reject + reason ✅
Try It
bun run deploy:telegram- Ask: "Delete all files" -> See confirm!
- Reply "yes" -> Executes (safely).