fix: cross-platform browser opening and hook robustness
bin/amc:
- Add cross-platform browser opening: try 'open' (macOS) first,
fall back to 'xdg-open' (Linux) for desktop environments
- Wrap browser opening in conditional to avoid errors on headless systems
bin/amc-hook:
- Fix edge case in question extraction where tool_input.get("questions")
could return None instead of empty list, causing TypeError
This commit is contained in:
5
bin/amc
5
bin/amc
@@ -34,7 +34,12 @@ case "$cmd" in
|
|||||||
echo "AMC started (pid $!)"
|
echo "AMC started (pid $!)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
# Open browser (platform-specific)
|
||||||
|
if command -v open &>/dev/null; then
|
||||||
open "http://127.0.0.1:$PORT"
|
open "http://127.0.0.1:$PORT"
|
||||||
|
elif command -v xdg-open &>/dev/null; then
|
||||||
|
xdg-open "http://127.0.0.1:$PORT"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
if is_running; then
|
if is_running; then
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ def _extract_questions(hook):
|
|||||||
if not isinstance(tool_input, dict):
|
if not isinstance(tool_input, dict):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
questions = tool_input.get("questions", [])
|
questions = tool_input.get("questions") or []
|
||||||
result = []
|
result = []
|
||||||
for q in questions:
|
for q in questions:
|
||||||
entry = {
|
entry = {
|
||||||
|
|||||||
Reference in New Issue
Block a user