From b22705afa58dda34c080598b3914b1b7a3f05442 Mon Sep 17 00:00:00 2001 From: Didactyl User Date: Wed, 15 Apr 2026 14:12:44 -0400 Subject: [PATCH] v0.2.41 - Fix adopted-skills cache to select latest kind 10123 event by created_at in agent refresh path --- README.md | 4 ++-- src/agent.c | 17 ++++++++++++++++- src/main.h | 4 ++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a3a7d74..439f07a 100644 --- a/README.md +++ b/README.md @@ -54,11 +54,11 @@ Skills compose by adoption-list order (`10123`) and trigger tags carry runtime e 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.2.40 +## Current Status — v0.2.41 **Active build — this project is barely working. Experiment at your own risk.** -> Last release update: v0.2.40 — Fix adoption list freshness by selecting newest kind 10123 event and temporarily disable periodic relay-backed trigger reconciliation for validation +> Last release update: v0.2.41 — Fix adopted-skills cache to select latest kind 10123 event by created_at in agent refresh path - 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/agent.c b/src/agent.c index 150115a..25dff03 100644 --- a/src/agent.c +++ b/src/agent.c @@ -1449,7 +1449,22 @@ static int refresh_adopted_skills_cache_if_needed(void) { free(adoption_json); if (adoption_events && cJSON_IsArray(adoption_events) && cJSON_GetArraySize(adoption_events) > 0) { - cJSON* list_event = cJSON_GetArrayItem(adoption_events, 0); + cJSON* list_event = NULL; + double list_event_created_at = -1.0; + int adoption_n = cJSON_GetArraySize(adoption_events); + for (int ai = 0; ai < adoption_n; ai++) { + cJSON* ev = cJSON_GetArrayItem(adoption_events, ai); + if (!ev || !cJSON_IsObject(ev)) { + continue; + } + cJSON* created_at = cJSON_GetObjectItemCaseSensitive(ev, "created_at"); + double created = (created_at && cJSON_IsNumber(created_at)) ? created_at->valuedouble : 0.0; + if (!list_event || created > list_event_created_at) { + list_event = ev; + list_event_created_at = created; + } + } + cJSON* list_tags = list_event ? cJSON_GetObjectItemCaseSensitive(list_event, "tags") : NULL; if (list_tags && cJSON_IsArray(list_tags)) { diff --git a/src/main.h b/src/main.h index 0ad6371..0d5b33b 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 2 -#define DIDACTYL_VERSION_PATCH 40 -#define DIDACTYL_VERSION "v0.2.40" +#define DIDACTYL_VERSION_PATCH 41 +#define DIDACTYL_VERSION "v0.2.41" // Agent metadata #define DIDACTYL_NAME "Didactyl"