Synced from monorepo
Changes: - Stop hooks for session lifecycle - Add x.ai/session/state and x.ai/session/import ACP methods - Deny-and-continue for auto-mode classifier blocks with denial limits - Drop codebase-upload from dhat soak test - scheduler_create upsert via task_id; retire one-shot tasks - Clipboard: copy file fallback + honest toasts for SSH/Apple Terminal - Polarity-safe syntax colors in minimal mode - Auto mode classifies unvetted env prefixes instead of hard-prompting - Add GROK_CLIPBOARD_NO_OSC52 kill switch to force OSC 52 off
This commit is contained in:
parent
7cfcb20d2b
commit
ba76b0a683
143 changed files with 9465 additions and 3419 deletions
24
crates/codegen/xai-grok-hooks/examples/hooks/bin/stop-verify.sh
Executable file
24
crates/codegen/xai-grok-hooks/examples/hooks/bin/stop-verify.sh
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
# stop-verify.sh — keep the agent working until the build passes.
|
||||
#
|
||||
# A Stop hook runs when the agent is about to finish its turn. Emitting a
|
||||
# block decision feeds the reason back to the model and runs another round;
|
||||
# the built-in cap ends the turn after 8 continuations. Set a generous
|
||||
# timeout on the hook (see stop-verify.json), since a timed-out hook fails
|
||||
# open and lets the agent stop.
|
||||
|
||||
INPUT=$(cat)
|
||||
|
||||
# Gate only genuine turn ends, not the observe-only session-end fire.
|
||||
REASON=$(echo "$INPUT" | grep -o '"reason":"[^"]*"' | sed 's/"reason":"//;s/"$//')
|
||||
if [ "$REASON" != "end_turn" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if cargo build --quiet >/dev/null 2>&1; then
|
||||
# Build is green: allow the stop.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Build is red: keep the agent working, with the failure as feedback.
|
||||
echo '{"decision":"block","reason":"cargo build failed; fix the errors before finishing."}'
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"hooks": {
|
||||
"Stop": [
|
||||
{
|
||||
"hooks": [
|
||||
{ "type": "command", "command": "bin/stop-verify.sh", "timeout": 300 }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue