feat: Add transcript-debug page with multi-agent support, hooks approval, and message selection
- Transcript debug: JSONL viewer, parsed chat view, realtime WebSocket updates, session selector - Multi-agent: ejecutor, nucleo000, and claude (global ~/.claude/projects/) with agent switcher - Hooks approval: permission/plan request forwarding via PowerShell hooks, long-poll API, UI modals - Chat features: session ID copy, select mode with checkboxes, multi-select copy, select all/deselect all - File watchers for all agent transcript directories with polling fallback on Windows
This commit is contained in:
31
hooks/approval-plan.ps1
Normal file
31
hooks/approval-plan.ps1
Normal file
@@ -0,0 +1,31 @@
|
||||
# Long-poll hooks-approval for Stop (plan mode) decisions
|
||||
# Only activates when permission_mode is 'plan' and stop_hook_active is false
|
||||
# Returns Stop decision JSON per Claude Code docs:
|
||||
# { "decision": "block", "reason": "..." } to continue implementing
|
||||
# {} or empty to let Claude stop
|
||||
param([string]$agent = "ejecutor")
|
||||
$logFile = "$PSScriptRoot/../.claude-$agent/debug/hooks.log"
|
||||
$ts = Get-Date -Format "HH:mm:ss.fff"
|
||||
$b = [Console]::In.ReadToEnd()
|
||||
Add-Content $logFile "[$ts] [PLAN] Hook fired for agent=$agent stdin_len=$($b.Length)"
|
||||
$j = $b | ConvertFrom-Json
|
||||
Add-Content $logFile "[$ts] [PLAN] permission_mode=$($j.permission_mode) stop_hook_active=$($j.stop_hook_active)"
|
||||
if ($j.permission_mode -ne 'plan' -or $j.stop_hook_active) {
|
||||
Add-Content $logFile "[$ts] [PLAN] Skipping (not plan mode or stop_hook_active)"
|
||||
exit 0
|
||||
}
|
||||
try {
|
||||
Add-Content $logFile "[$ts] [PLAN] POSTing to backend..."
|
||||
$r = Invoke-RestMethod -Uri 'http://localhost:4101/api/hooks-approval/plan' -Method POST -Body $b -ContentType 'application/json' -TimeoutSec 125
|
||||
$ts2 = Get-Date -Format "HH:mm:ss.fff"
|
||||
if ($r -and $r.decision) {
|
||||
$out = $r | ConvertTo-Json -Depth 10 -Compress
|
||||
Add-Content $logFile "[$ts2] [PLAN] Got response: $out"
|
||||
$out
|
||||
} else {
|
||||
Add-Content $logFile "[$ts2] [PLAN] Empty/timeout response (no decision)"
|
||||
}
|
||||
} catch {
|
||||
$ts2 = Get-Date -Format "HH:mm:ss.fff"
|
||||
Add-Content $logFile "[$ts2] [PLAN] ERROR: $($_.Exception.Message)"
|
||||
}
|
||||
Reference in New Issue
Block a user