Commit 78becb3
committed
feat(node-sdk): add HITL confirmation policy support to SessionOptions
Add ConfirmationPolicy configuration to Node.js SDK to enable
Human-in-the-Loop confirmation for tool execution.
Changes:
- Add ConfirmationPolicy type with enabled, defaultTimeoutMs, timeoutAction
- Add confirmation_policy field to SessionOptions
- Import hitl module types (ConfirmationPolicy, TimeoutAction)
- Convert JS ConfirmationPolicy to Rust ConfirmationPolicy in js_session_options_to_rust
- Pass confirmation policy to session via with_confirmation_policy()
This fixes the "Tool requires confirmation but no HITL confirmation manager
is configured" error by allowing users to configure HITL confirmation policy
when creating sessions.
Usage:
```js
agent.session('.', {
confirmationPolicy: {
enabled: true,
defaultTimeoutMs: 30000,
timeoutAction: 'reject'
}
});
```
When enabled, tools that require confirmation will emit ConfirmationRequired
events and wait for user approval before executing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent d00ba33 commit 78becb3
1 file changed
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
| |||
1258 | 1262 | | |
1259 | 1263 | | |
1260 | 1264 | | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
1261 | 1279 | | |
1262 | 1280 | | |
1263 | 1281 | | |
| |||
1377 | 1395 | | |
1378 | 1396 | | |
1379 | 1397 | | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
1380 | 1414 | | |
1381 | 1415 | | |
1382 | 1416 | | |
| |||
1672 | 1706 | | |
1673 | 1707 | | |
1674 | 1708 | | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
1675 | 1733 | | |
1676 | 1734 | | |
1677 | 1735 | | |
| |||
0 commit comments