From 2a71746a0966e407085b2456c81f03c00bde1113 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 5 Mar 2026 15:30:32 -0400 Subject: [PATCH] v0.0.41 - Fix startup relay-state log snapshot before main loop --- README.md | 4 ++-- src/main.c | 2 ++ src/main.h | 4 ++-- src/nostr_handler.c | 10 ++++++++++ src/nostr_handler.h | 1 + 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6e8b25b..150c5d5 100644 --- a/README.md +++ b/README.md @@ -51,11 +51,11 @@ Agents learn capabilities through skills — Nostr events that any agent can di Didactyl will support local inference, which is very privacy preserving. Remote inference does however have it's advantages, and in those cases Didactyl supports using Bitcoin Lightning and eCash inference providers. -## Current Status — v0.0.40 +## Current Status — v0.0.41 **Active build — this project is barely working. Experiment at your own risk.** -> Last release update: v0.0.40 — Reduce query churn and add relay disconnect-cause visibility +> Last release update: v0.0.41 — Fix startup relay-state log snapshot before main loop - Connects to configured relays with auto-reconnect and relay state transition logging - Publishes configured startup events per relay as each relay becomes connected diff --git a/src/main.c b/src/main.c index aa408a4..1d7f819 100644 --- a/src/main.c +++ b/src/main.c @@ -318,6 +318,8 @@ int main(int argc, char** argv) { DEBUG_INFO("[didactyl] HTTP API disabled (set api.enabled=true in config to enable)"); } + nostr_handler_refresh_relay_statuses(); + DEBUG_INFO("[didactyl] entering main poll loop"); DEBUG_INFO("[didactyl] running with pubkey %s", cfg.keys.public_key_hex); diff --git a/src/main.h b/src/main.h index 411cc86..a423826 100644 --- a/src/main.h +++ b/src/main.h @@ -12,8 +12,8 @@ // Using DIDACTYL_ prefix to avoid conflicts with nostr_core_lib VERSION macros #define DIDACTYL_VERSION_MAJOR 0 #define DIDACTYL_VERSION_MINOR 0 -#define DIDACTYL_VERSION_PATCH 40 -#define DIDACTYL_VERSION "v0.0.40" +#define DIDACTYL_VERSION_PATCH 41 +#define DIDACTYL_VERSION "v0.0.41" // Agent metadata #define DIDACTYL_NAME "Didactyl" diff --git a/src/nostr_handler.c b/src/nostr_handler.c index 3a5232f..6946d36 100644 --- a/src/nostr_handler.c +++ b/src/nostr_handler.c @@ -240,6 +240,16 @@ static void log_relay_state_changes(void) { } } +void nostr_handler_refresh_relay_statuses(void) { + if (!g_pool || !g_cfg || !g_last_relay_statuses) { + return; + } + + for (int i = 0; i < g_cfg->relay_count; i++) { + g_last_relay_statuses[i] = nostr_relay_pool_get_relay_status(g_pool, g_cfg->relays[i]); + } +} + static void log_publish_targets(const char* action) { if (!g_cfg) { return; diff --git a/src/nostr_handler.h b/src/nostr_handler.h index 1f6597d..33be6db 100644 --- a/src/nostr_handler.h +++ b/src/nostr_handler.h @@ -37,6 +37,7 @@ void nostr_handler_publish_result_free(nostr_publish_result_t* result); char* nostr_handler_query_json(cJSON* filter, int timeout_ms); int nostr_handler_poll(int timeout_ms); int nostr_handler_reconcile_startup_events(void); +void nostr_handler_refresh_relay_statuses(void); const char* nostr_handler_get_system_context(void); const char* nostr_handler_get_startup_display_name(void); int nostr_handler_connected_relay_count(void);