Both webhook registrations (knowledge push + config-PR pull_request) now
use the public hive domain instead of loopback:
https://<HYPERHIVE_HIVE_DOMAIN>/webhook/{knowledge,config-pr}
This routes deliveries through the gateway, bypassing the Forgejo SSRF
guard that blocked loopback delivery and silently broke the config-PR
merge flow since launch.
Changes:
- webhook_secret: new module — auto-generate + persist a 32-byte HMAC
secret to STATE_ROOT/webhook-secret on first startup; verify
X-Hub-Signature-256 on every incoming webhook POST (HMAC-SHA256).
- forge/mod.rs: ensure_config_pr_webhook now takes hive_domain +
webhook_secret; sets secret in Forgejo hook config.
- workers/knowledge.rs: ensure_webhook same update.
- dashboard/webhook.rs: both handlers read raw Bytes first, verify HMAC,
then parse JSON. Returns 401 on signature mismatch.
- dashboard/mod.rs: AppState carries webhook_secret; serve() takes it.
- main.rs: load/generate secret at startup; pass to registration tasks
+ dashboard; add 5-minute config-PR polling fallback task.
- forge/config_pr_poll.rs: new — scan agent-configs/* for open PRs with
no pending MergeConfigPr approval; queue them. Idempotent.
- stores/approvals.rs: has_pending_merge_config_pr() for poll dedup.
- nix/modules/hive-gateway.nix: remove dashboardAuth from /webhook/
location (HMAC replaces basic auth for webhook endpoints; Forgejo
cannot send HTTP Basic credentials with webhook deliveries).
56 lines
1.9 KiB
Rust
56 lines
1.9 KiB
Rust
//! `hive-c0re` library — module surface shared by the `hive-c0re`
|
|
//! daemon binary and the `hivectl` operator CLI.
|
|
//!
|
|
//! `hive-c0re` (daemon) keeps the systemd service shape it always had:
|
|
//! coordinator, broker, axum dashboard, admin/manager/agent unix
|
|
//! sockets, background sweepers. `hivectl` (sibling bin under
|
|
//! `src/bin/hivectl.rs`) reuses a thin subset (`forge`, `matrix`,
|
|
//! `lifecycle`) to expose host-side administration verbs — manually
|
|
//! provisioning forge / matrix users for an agent, etc.
|
|
//!
|
|
//! Every module is re-exported `pub` so anything in the crate is
|
|
//! addressable from either binary; the lib doesn't have a curated
|
|
//! surface beyond "this is where the modules live".
|
|
//!
|
|
//! Cohesive clusters live in directory submodules (`stores`, `stats`,
|
|
//! `agent_config`, `workers`); each of their children is re-exported
|
|
//! at the crate root so pre-existing `crate::broker::…` /
|
|
//! `hive_c0re::broker::…` paths keep compiling unchanged.
|
|
|
|
pub mod actions;
|
|
pub mod agent_config;
|
|
pub mod client;
|
|
pub mod container_view;
|
|
pub mod coordinator;
|
|
pub mod dashboard;
|
|
pub mod dashboard_events;
|
|
pub mod flake_check;
|
|
pub mod forge;
|
|
pub mod gateway_nginx;
|
|
pub mod job_queue;
|
|
pub mod lifecycle;
|
|
pub mod loose_ends;
|
|
pub mod matrix;
|
|
pub mod meta;
|
|
pub mod migrate;
|
|
pub mod paths;
|
|
pub mod priv_client;
|
|
pub mod questions;
|
|
pub mod server;
|
|
pub mod socket_server;
|
|
pub mod stats;
|
|
pub mod stores;
|
|
pub mod webhook_secret;
|
|
pub mod workers;
|
|
|
|
// Root re-exports: keep every pre-grouping `crate::<module>` /
|
|
// `hive_c0re::<module>` path compiling without touching consumers.
|
|
pub use agent_config::{capabilities, limits, tool_groups, topology};
|
|
pub use stats::{container_stats, hive_stats, host_stats, sweep_health, warnings};
|
|
pub use stores::{
|
|
approvals, audit_log, broker, build_logs, db, operator_questions, power, scheduled_prompts,
|
|
};
|
|
pub use workers::{
|
|
agent_sockets, auto_update, crash_watch, knowledge, mcp_sockets, reminder_scheduler,
|
|
scheduled_prompts_worker,
|
|
};
|