Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31439652aa | ||
|
|
ad99f74bc0 | ||
|
|
cf9c300fdf | ||
|
|
97585890b9 |
@@ -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.37
|
||||
## Current Status — v0.0.41
|
||||
|
||||
**Active build — this project is barely working. Experiment at your own risk.**
|
||||
|
||||
> Last release update: v0.0.37 — Add relay-pool publish connection-skip and poll latency instrumentation for hang diagnosis
|
||||
> 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
|
||||
|
||||
+1875
File diff suppressed because it is too large
Load Diff
+4
-4
@@ -35,7 +35,7 @@ static pthread_mutex_t g_context_part_names_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
#define AGENT_DEBOUNCE_CACHE_SIZE 256
|
||||
#define AGENT_HISTORY_TURNS 12
|
||||
#define AGENT_HISTORY_QUERY_LIMIT 200
|
||||
#define AGENT_ADOPTED_SKILLS_CACHE_TTL_SECONDS 30
|
||||
#define AGENT_ADOPTED_SKILLS_CACHE_TTL_SECONDS 300
|
||||
#define AGENT_ADOPTED_SKILLS_MAX 24
|
||||
#define AGENT_ADOPTED_SKILL_CONTENT_MAX_CHARS 1800
|
||||
#define AGENT_ADOPTED_SKILLS_TOTAL_MAX_CHARS 7200
|
||||
@@ -1415,7 +1415,7 @@ static int append_recent_admin_dm_history(cJSON* messages, const char* current_m
|
||||
cJSON_AddItemToObject(filter, "authors", authors);
|
||||
cJSON_AddNumberToObject(filter, "limit", AGENT_HISTORY_QUERY_LIMIT);
|
||||
|
||||
char* events_json = nostr_handler_query_json(filter, 8000);
|
||||
char* events_json = nostr_handler_query_json(filter, 1500);
|
||||
cJSON_Delete(filter);
|
||||
if (!events_json) {
|
||||
return 0;
|
||||
@@ -1648,7 +1648,7 @@ static int refresh_adopted_skills_cache_if_needed(void) {
|
||||
cJSON_AddItemToObject(adopt_filter, "authors", authors);
|
||||
cJSON_AddNumberToObject(adopt_filter, "limit", 1);
|
||||
|
||||
char* adoption_json = nostr_handler_query_json(adopt_filter, 8000);
|
||||
char* adoption_json = nostr_handler_query_json(adopt_filter, 2000);
|
||||
cJSON_Delete(adopt_filter);
|
||||
|
||||
cJSON* adoption_events = adoption_json ? cJSON_Parse(adoption_json) : NULL;
|
||||
@@ -1700,7 +1700,7 @@ static int refresh_adopted_skills_cache_if_needed(void) {
|
||||
cJSON_AddItemToObject(skill_filter, "#d", d_values);
|
||||
cJSON_AddNumberToObject(skill_filter, "limit", 1);
|
||||
|
||||
char* skill_json = nostr_handler_query_json(skill_filter, 8000);
|
||||
char* skill_json = nostr_handler_query_json(skill_filter, 2000);
|
||||
cJSON_Delete(skill_filter);
|
||||
if (!skill_json) {
|
||||
continue;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
+2
-2
@@ -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 37
|
||||
#define DIDACTYL_VERSION "v0.0.37"
|
||||
#define DIDACTYL_VERSION_PATCH 41
|
||||
#define DIDACTYL_VERSION "v0.0.41"
|
||||
|
||||
// Agent metadata
|
||||
#define DIDACTYL_NAME "Didactyl"
|
||||
|
||||
+23
-4
@@ -218,10 +218,19 @@ static void log_relay_state_changes(void) {
|
||||
nostr_pool_relay_status_t now = nostr_relay_pool_get_relay_status(g_pool, relay);
|
||||
nostr_pool_relay_status_t prev = g_last_relay_statuses[i];
|
||||
if (now != prev) {
|
||||
DEBUG_INFO("[didactyl] relay state changed: %s %s -> %s",
|
||||
relay,
|
||||
relay_status_str(prev),
|
||||
relay_status_str(now));
|
||||
const char* conn_err = nostr_relay_pool_get_relay_last_connection_error(g_pool, relay);
|
||||
if (conn_err && (now == NOSTR_POOL_RELAY_DISCONNECTED || now == NOSTR_POOL_RELAY_ERROR)) {
|
||||
DEBUG_INFO("[didactyl] relay state changed: %s %s -> %s (cause: %s)",
|
||||
relay,
|
||||
relay_status_str(prev),
|
||||
relay_status_str(now),
|
||||
conn_err);
|
||||
} else {
|
||||
DEBUG_INFO("[didactyl] relay state changed: %s %s -> %s",
|
||||
relay,
|
||||
relay_status_str(prev),
|
||||
relay_status_str(now));
|
||||
}
|
||||
g_last_relay_statuses[i] = now;
|
||||
|
||||
if (now == NOSTR_POOL_RELAY_CONNECTED) {
|
||||
@@ -231,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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -268,7 +268,7 @@ int trigger_manager_load_from_skills(trigger_manager_t* mgr) {
|
||||
cJSON_AddItemToObject(adopt_filter, "authors", authors);
|
||||
cJSON_AddNumberToObject(adopt_filter, "limit", 1);
|
||||
|
||||
char* adoption_json = nostr_handler_query_json(adopt_filter, 8000);
|
||||
char* adoption_json = nostr_handler_query_json(adopt_filter, 2000);
|
||||
cJSON_Delete(adopt_filter);
|
||||
if (!adoption_json) {
|
||||
return 0;
|
||||
@@ -328,7 +328,7 @@ int trigger_manager_load_from_skills(trigger_manager_t* mgr) {
|
||||
cJSON_AddItemToObject(skill_filter, "#d", d_values);
|
||||
cJSON_AddNumberToObject(skill_filter, "limit", 1);
|
||||
|
||||
char* skill_json = nostr_handler_query_json(skill_filter, 8000);
|
||||
char* skill_json = nostr_handler_query_json(skill_filter, 2000);
|
||||
cJSON_Delete(skill_filter);
|
||||
if (!skill_json) {
|
||||
continue;
|
||||
@@ -513,7 +513,7 @@ int trigger_manager_poll(trigger_manager_t* mgr) {
|
||||
}
|
||||
|
||||
time_t now = time(NULL);
|
||||
if (mgr->last_poll_at > 0 && (now - mgr->last_poll_at) < 2) {
|
||||
if (mgr->last_poll_at > 0 && (now - mgr->last_poll_at) < 10) {
|
||||
return 0;
|
||||
}
|
||||
mgr->last_poll_at = now;
|
||||
@@ -538,7 +538,7 @@ int trigger_manager_poll(trigger_manager_t* mgr) {
|
||||
cJSON_AddNumberToObject(filter, "since", (double)since);
|
||||
cJSON_AddNumberToObject(filter, "limit", 8);
|
||||
|
||||
char* events_json = nostr_handler_query_json(filter, 4000);
|
||||
char* events_json = nostr_handler_query_json(filter, 1200);
|
||||
cJSON_Delete(filter);
|
||||
if (!events_json) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user