mirror of
https://github.com/domfelipe/hermes-agent-custom.git
synced 2026-08-07 06:16:39 +00:00
feat: post Mika cron and skill actions back to platform (#5)
* feat: post mika actions back to platform * fix: start hermes gateway for telegram runtime * fix: isolate gateway from runtime api port * fix: enable mika runtime tools in gateway config * fix: prefer mika platform tools over native runtime tools * fix: intercept mika platform actions before llm * fix: route managed cronjobs and skills
This commit is contained in:
parent
11b664b8d5
commit
697825c505
12 changed files with 1077 additions and 38 deletions
|
|
@ -15,6 +15,11 @@ STT_PROVIDER="${HERMES_STT_PROVIDER:-local}"
|
|||
STT_LOCAL_MODEL="${HERMES_STT_LOCAL_MODEL:-base}"
|
||||
STT_OPENAI_MODEL="${HERMES_STT_OPENAI_MODEL:-whisper-1}"
|
||||
TTS_PROVIDER="${HERMES_TTS_PROVIDER:-disabled}"
|
||||
GATEWAY_ENABLED="${HERMES_GATEWAY_ENABLED:-auto}"
|
||||
GATEWAY_ARGS="${HERMES_GATEWAY_ARGS:---replace}"
|
||||
GATEWAY_API_SERVER_ENABLED="${HERMES_GATEWAY_API_SERVER_ENABLED:-false}"
|
||||
HERMES_ALLOW_ROOT_GATEWAY="${HERMES_ALLOW_ROOT_GATEWAY:-1}"
|
||||
export HERMES_ALLOW_ROOT_GATEWAY
|
||||
|
||||
mkdir -p "$HERMES_HOME"
|
||||
|
||||
|
|
@ -27,6 +32,27 @@ data_dir: /opt/data
|
|||
model:
|
||||
provider: "${MODEL_PROVIDER}"
|
||||
default: "${MODEL_DEFAULT}"
|
||||
plugins:
|
||||
enabled:
|
||||
- mika_runtime
|
||||
platform_toolsets:
|
||||
telegram:
|
||||
- web
|
||||
- browser
|
||||
- terminal
|
||||
- file
|
||||
- code_execution
|
||||
- vision
|
||||
- image_gen
|
||||
- tts
|
||||
- todo
|
||||
- memory
|
||||
- session_search
|
||||
- clarify
|
||||
- delegation
|
||||
- messaging
|
||||
- computer_use
|
||||
- mika_integrations
|
||||
EOF
|
||||
|
||||
case "${STT_PROVIDER}" in
|
||||
|
|
@ -83,12 +109,27 @@ echo "[entrypoint] Hermes interno: $INTERNAL_HOST:$INTERNAL_PORT"
|
|||
echo "[entrypoint] Proxy público: $PUBLIC_HOST:$PUBLIC_PORT"
|
||||
echo "[entrypoint] Iniciando Hermes original..."
|
||||
|
||||
PIDS=()
|
||||
|
||||
cleanup() {
|
||||
local status=$?
|
||||
trap - EXIT INT TERM
|
||||
if [ "${#PIDS[@]}" -gt 0 ]; then
|
||||
kill "${PIDS[@]}" 2>/dev/null || true
|
||||
wait "${PIDS[@]}" 2>/dev/null || true
|
||||
fi
|
||||
exit "$status"
|
||||
}
|
||||
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
hermes dashboard \
|
||||
--host "$INTERNAL_HOST" \
|
||||
--port "$INTERNAL_PORT" \
|
||||
--no-open &
|
||||
|
||||
HERMES_PID="$!"
|
||||
PIDS+=("$HERMES_PID")
|
||||
|
||||
echo "[entrypoint] Aguardando Hermes responder em $INTERNAL_HOST:$INTERNAL_PORT..."
|
||||
|
||||
|
|
@ -113,9 +154,55 @@ if ! kill -0 "$HERMES_PID" 2>/dev/null; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
should_start_gateway=false
|
||||
case "$GATEWAY_ENABLED" in
|
||||
true|1|yes|on)
|
||||
should_start_gateway=true
|
||||
;;
|
||||
false|0|no|off)
|
||||
should_start_gateway=false
|
||||
;;
|
||||
auto|"")
|
||||
if [ -n "${TELEGRAM_BOT_TOKEN:-}" ]; then
|
||||
should_start_gateway=true
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "[entrypoint] HERMES_GATEWAY_ENABLED inválido: $GATEWAY_ENABLED"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$should_start_gateway" = "true" ]; then
|
||||
echo "[entrypoint] Iniciando gateway de mensagens Hermes..."
|
||||
if [ "$GATEWAY_API_SERVER_ENABLED" = "true" ]; then
|
||||
# shellcheck disable=SC2086
|
||||
hermes gateway run $GATEWAY_ARGS &
|
||||
else
|
||||
# The public runtime API is served by skills_api.py. Provisioned Mika
|
||||
# instances still receive API_SERVER_KEY for that proxy, so hide it from
|
||||
# the gateway process to avoid starting Hermes' native api_server adapter
|
||||
# on the same public port.
|
||||
# shellcheck disable=SC2086
|
||||
API_SERVER_ENABLED=false API_SERVER_KEY= hermes gateway run $GATEWAY_ARGS &
|
||||
fi
|
||||
GATEWAY_PID="$!"
|
||||
PIDS+=("$GATEWAY_PID")
|
||||
else
|
||||
echo "[entrypoint] Gateway de mensagens desabilitado"
|
||||
fi
|
||||
|
||||
echo "[entrypoint] Iniciando proxy público em $PUBLIC_HOST:$PUBLIC_PORT..."
|
||||
|
||||
exec python /opt/hermes-custom/skills_api.py \
|
||||
python /opt/hermes-custom/skills_api.py \
|
||||
--host "$PUBLIC_HOST" \
|
||||
--port "$PUBLIC_PORT" \
|
||||
--target "http://$INTERNAL_HOST:$INTERNAL_PORT"
|
||||
--target "http://$INTERNAL_HOST:$INTERNAL_PORT" &
|
||||
|
||||
PROXY_PID="$!"
|
||||
PIDS+=("$PROXY_PID")
|
||||
|
||||
wait -n "${PIDS[@]}"
|
||||
EXITED_STATUS=$?
|
||||
echo "[entrypoint] Um processo do runtime encerrou (status=$EXITED_STATUS); finalizando container"
|
||||
exit "$EXITED_STATUS"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue