Vapora/nickel/vapora/contracts.ncl
Jesús Pérez c5f4caa2ab
feat(agents): stable identity + hot-reload for zero learning loss on config change
Introduce stable_id = role on AgentMetadata so learning profiles and KG
  execution records survive process restarts and hot-reloads. Previously
  every Uuid::new_v4() rotation orphaned accumulated expertise.

  - registry: add stable_id field (serde default, backward-compatible),
    stable_id_or_role() fallback helper, drain_role(), list_roles()
  - coordinator: profile lookup and KG writes use stable_id_or_role()
    instead of the ephemeral UUID; drain_role() drops Sender to close
    mpsc channels after in-flight messages drain; registry_arc() accessor
  - executor: agent_id written to KG now uses stable_id_or_role()
  - server: reload_agents() drain-and-respawn function; SIGHUP handler
    via while sighup.recv().await.is_some(); POST /reload endpoint;
    AppState extended with config_path, router, cap_registry
  - fix: SIGHUP recv() spin-loop guard (is_some())
  - fix: io_other_error clippy lint in vapora-agents, vapora-llm-router,
    vapora-workflow-engine (std::io::Error::other instead of Error::new)
  - docs: ADR-0040, CHANGELOG entry, README hot-reload section
2026-03-02 22:54:28 +00:00

68 lines
1.3 KiB
Text

let LogLevel = std.contract.custom (
fun label =>
fun value =>
let valid = ["trace", "debug", "info", "warn", "error"] in
if std.array.any (fun x => x == value) valid then
'Ok value
else
'Error {
message = "Invalid log_level '%{value}'.\nValid values: trace | debug | info | warn | error"
}
) in
let Port = std.contract.custom (
fun label =>
fun value =>
if value >= 1 && value <= 65535 then
'Ok value
else
'Error {
message = "Invalid port '%{std.to_string value}'.\nValid range: 1 - 65535"
}
) in
{
TlsConfig = {
enabled | Bool,
cert_path | String,
key_path | String,
},
ServerConfig = {
host | String,
port | Port,
tls | TlsConfig,
},
DatabaseConfig = {
url | String,
max_connections | Number,
},
NatsConfig = {
url | String,
stream_name | String,
},
AuthConfig = {
jwt_secret | String,
jwt_expiration_hours | Number,
},
LoggingConfig = {
level | LogLevel,
json | Bool,
},
MetricsConfig = {
enabled | Bool,
port | Port,
},
NotificationConfig = {
on_task_done | Array String | default = [],
on_proposal_approved | Array String | default = [],
on_proposal_rejected | Array String | default = [],
on_agent_inactive | Array String | default = [],
},
}