From b5b479e9a8e9b5c0128806d4e4b15b7e2d36b84f Mon Sep 17 00:00:00 2001 From: Didactyl User Date: Thu, 16 Apr 2026 16:59:50 -0400 Subject: [PATCH] v0.2.43 - Fix /help adopted-skills section to use latest kind 10123 event by created_at in CLI and HTTP views --- README.md | 4 ++-- src/agent.c | 16 +++++++++++++++- src/http_api.c | 16 +++++++++++++++- src/main.h | 4 ++-- 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4771ee7..1ed96f2 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.42 +## Current Status — v0.2.43 **Active build — this project is barely working. Experiment at your own risk.** -> Last release update: v0.2.42 — Make skill_refresh re-query relays and reload self-skill cache before invalidating adopted-skills cache +> Last release update: v0.2.43 — Fix /help adopted-skills section to use latest kind 10123 event by created_at in CLI and HTTP views - 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 25dff03..24dd6ca 100644 --- a/src/agent.c +++ b/src/agent.c @@ -681,7 +681,21 @@ static char* build_slash_help_all_json(void) { int adopted_count = 0; if (adoption_events && cJSON_IsArray(adoption_events) && cJSON_GetArraySize(adoption_events) > 0) { - cJSON* ev0 = cJSON_GetArrayItem(adoption_events, 0); + cJSON* ev0 = NULL; + double best_created = -1.0; + int an = cJSON_GetArraySize(adoption_events); + for (int ai = 0; ai < an; 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 (!ev0 || created > best_created) { + ev0 = ev; + best_created = created; + } + } cJSON* tags = ev0 ? cJSON_GetObjectItemCaseSensitive(ev0, "tags") : NULL; if (tags && cJSON_IsArray(tags)) { int tn = cJSON_GetArraySize(tags); diff --git a/src/http_api.c b/src/http_api.c index 91d6d65..e17f97f 100644 --- a/src/http_api.c +++ b/src/http_api.c @@ -815,7 +815,21 @@ static char* build_slash_help_all_json_local(void) { int adopted_count = 0; if (adoption_events && cJSON_IsArray(adoption_events) && cJSON_GetArraySize(adoption_events) > 0) { - cJSON* ev0 = cJSON_GetArrayItem(adoption_events, 0); + cJSON* ev0 = NULL; + double best_created = -1.0; + int an = cJSON_GetArraySize(adoption_events); + for (int ai = 0; ai < an; 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 (!ev0 || created > best_created) { + ev0 = ev; + best_created = created; + } + } cJSON* tags = ev0 ? cJSON_GetObjectItemCaseSensitive(ev0, "tags") : NULL; if (tags && cJSON_IsArray(tags)) { int tn = cJSON_GetArraySize(tags); diff --git a/src/main.h b/src/main.h index 59cbfdb..cc929d5 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 42 -#define DIDACTYL_VERSION "v0.2.42" +#define DIDACTYL_VERSION_PATCH 43 +#define DIDACTYL_VERSION "v0.2.43" // Agent metadata #define DIDACTYL_NAME "Didactyl"