Add ACP-backed role sessions

This commit is contained in:
zenord
2026-08-16 10:08:03 +08:00
parent d59c4a654f
commit a80fe68d57
34 changed files with 1683 additions and 887 deletions
+15 -5
View File
@@ -20,9 +20,10 @@ Commands:
stop Stop background gateway
restart Restart background gateway
status Show gateway status
doctor Check configuration and local agents
doctor Check configuration, roles, and ACP backends
logs Follow gateway log
discover-agents List detected local CLI agents
discover-backends List detected ACP backends
discover-agents Deprecated alias for discover-backends
Environment:
GORI_GATEWAY_CONFIG Config path, default: $CONFIG_FILE
@@ -61,11 +62,20 @@ stop_daemon() {
if ! is_running; then
rm -f "$PID_FILE"
echo "gori-agent is not running"
exit 0
return 0
fi
local pid
pid="$(cat "$PID_FILE")"
kill "$pid"
local waited=0
while kill -0 "$pid" 2>/dev/null && [[ $waited -lt 100 ]]; do
sleep 0.1
waited=$((waited + 1))
done
if kill -0 "$pid" 2>/dev/null; then
echo "gori-agent did not stop gracefully within 10 seconds, pid $pid" >&2
return 1
fi
rm -f "$PID_FILE"
echo "gori-agent stopped, pid $pid"
}
@@ -128,9 +138,9 @@ case "$COMMAND" in
ensure_build
exec node "$ROOT_DIR/dist/cli.js" doctor --config "$CONFIG_FILE"
;;
discover-agents)
discover-backends|discover-agents)
ensure_build
exec node "$ROOT_DIR/dist/cli.js" discover-agents --config "$CONFIG_FILE"
exec node "$ROOT_DIR/dist/cli.js" "$COMMAND" --config "$CONFIG_FILE"
;;
logs)
ensure_state