self-review 2026-05-23: rebuild soul with updated el_runtime.c (ISE ordering + elc async fix)
Rebuilt awareness.c and neuron.c from source using the updated elc (which now correctly recognizes http_serve_async as a 2-arg builtin). Rebuilt the neuron binary against the updated el_runtime.c which now sorts InternalStateEvent scans by created_at DESC. The soul daemon now posts heartbeats that surface immediately at offset 0 of the ISE scan, rather than being buried behind 20K older entries.
This commit is contained in:
Vendored
+130
-9
@@ -42,6 +42,110 @@ el_val_t threat_score_history(el_val_t history);
|
||||
el_val_t threat_trajectory_check(el_val_t tool_name, el_val_t tool_input);
|
||||
el_val_t threat_history_append(el_val_t text);
|
||||
|
||||
el_val_t tier_working(void) {
|
||||
return EL_STR("Working");
|
||||
return 0;
|
||||
}
|
||||
|
||||
el_val_t tier_episodic(void) {
|
||||
return EL_STR("Episodic");
|
||||
return 0;
|
||||
}
|
||||
|
||||
el_val_t tier_canonical(void) {
|
||||
return EL_STR("Canonical");
|
||||
return 0;
|
||||
}
|
||||
|
||||
el_val_t mem_store(el_val_t content, el_val_t label, el_val_t tags) {
|
||||
return engram_node_full(content, EL_STR("Memory"), label, el_from_float(el_from_float(0.5)), el_from_float(el_from_float(0.5)), el_from_float(el_from_float(0.8)), EL_STR("Working"), tags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
el_val_t mem_remember(el_val_t content, el_val_t tags) {
|
||||
return mem_store(content, EL_STR("soul-memory"), tags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
el_val_t mem_recall(el_val_t query, el_val_t depth) {
|
||||
return engram_activate_json(query, depth);
|
||||
return 0;
|
||||
}
|
||||
|
||||
el_val_t mem_search(el_val_t query, el_val_t limit) {
|
||||
return engram_search_json(query, limit);
|
||||
return 0;
|
||||
}
|
||||
|
||||
el_val_t mem_strengthen(el_val_t node_id) {
|
||||
engram_strengthen(node_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
el_val_t mem_forget(el_val_t node_id) {
|
||||
engram_forget(node_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
el_val_t mem_consolidate(void) {
|
||||
el_val_t scanned = engram_node_count();
|
||||
el_val_t dummy = engram_scan_nodes_json(100, 0);
|
||||
el_val_t total_nodes = engram_node_count();
|
||||
el_val_t total_edges = engram_edge_count();
|
||||
return el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(EL_STR("{\"scanned\":"), int_to_str(scanned)), EL_STR(",\"total_nodes\":")), int_to_str(total_nodes)), EL_STR(",\"total_edges\":")), int_to_str(total_edges)), EL_STR("}"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
el_val_t mem_save(el_val_t path) {
|
||||
engram_save(path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
el_val_t mem_load(el_val_t path) {
|
||||
engram_load(path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
el_val_t mem_boot_count_get(void) {
|
||||
el_val_t results = engram_search_json(EL_STR("soul:boot_count"), 3);
|
||||
if (str_eq(results, EL_STR(""))) {
|
||||
return 0;
|
||||
}
|
||||
if (str_eq(results, EL_STR("[]"))) {
|
||||
return 0;
|
||||
}
|
||||
el_val_t node = json_array_get(results, 0);
|
||||
el_val_t content = json_get(node, EL_STR("content"));
|
||||
el_val_t prefix = EL_STR("soul:boot_count:");
|
||||
if (!str_starts_with(content, prefix)) {
|
||||
return 0;
|
||||
}
|
||||
el_val_t num_str = str_slice(content, str_len(prefix), str_len(content));
|
||||
return str_to_int(num_str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
el_val_t mem_boot_count_inc(void) {
|
||||
el_val_t current = mem_boot_count_get();
|
||||
el_val_t next = (current + 1);
|
||||
el_val_t content = el_str_concat(EL_STR("soul:boot_count:"), int_to_str(next));
|
||||
el_val_t tags = EL_STR("[\"soul-meta\",\"boot-counter\"]");
|
||||
el_val_t discard = engram_node_full(content, EL_STR("Memory"), EL_STR("soul:boot_count"), el_from_float(el_from_float(0.9)), el_from_float(el_from_float(0.9)), el_from_float(el_from_float(1.0)), EL_STR("Canonical"), tags);
|
||||
return next;
|
||||
return 0;
|
||||
}
|
||||
|
||||
el_val_t mem_emit_state_event(el_val_t trigger, el_val_t kind, el_val_t content) {
|
||||
el_val_t boot = mem_boot_count_get();
|
||||
el_val_t ts = time_now();
|
||||
el_val_t safe_trigger = str_replace(trigger, EL_STR("\""), EL_STR("'"));
|
||||
el_val_t safe_content = str_replace(content, EL_STR("\""), EL_STR("'"));
|
||||
el_val_t payload = el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(EL_STR("{\"trigger\":\""), safe_trigger), EL_STR("\"")), EL_STR(",\"kind\":\"")), kind), EL_STR("\"")), EL_STR(",\"content\":\"")), safe_content), EL_STR("\"")), EL_STR(",\"boot\":")), int_to_str(boot)), EL_STR(",\"ts\":")), int_to_str(ts)), EL_STR("}"));
|
||||
el_val_t tags = EL_STR("[\"internal-state\",\"pre-reasoning\",\"InternalStateEvent\"]");
|
||||
return engram_node_full(payload, EL_STR("InternalStateEvent"), el_str_concat(EL_STR("state-event:"), kind), el_from_float(el_from_float(0.85)), el_from_float(el_from_float(0.8)), el_from_float(el_from_float(0.9)), EL_STR("Episodic"), tags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
el_val_t idle_count(void) {
|
||||
el_val_t s = state_get(EL_STR("soul.idle"));
|
||||
if (str_eq(s, EL_STR(""))) {
|
||||
@@ -67,7 +171,7 @@ el_val_t ise_post(el_val_t content) {
|
||||
el_val_t ise_url = env(EL_STR("SOUL_ISE_URL"));
|
||||
el_val_t engram_url = ({ el_val_t _if_result_1 = 0; if (str_eq(ise_url, EL_STR(""))) { _if_result_1 = (state_get(EL_STR("soul_engram_url"))); } else { _if_result_1 = (ise_url); } _if_result_1; });
|
||||
if (str_eq(engram_url, EL_STR(""))) {
|
||||
el_val_t discard = engram_node_full(content, EL_STR("InternalStateEvent"), EL_STR("state-event"), el_from_float(0.3), el_from_float(0.3), el_from_float(0.8), EL_STR("Episodic"), EL_STR("[\"internal-state\",\"InternalStateEvent\"]"));
|
||||
el_val_t discard = engram_node_full(content, EL_STR("InternalStateEvent"), EL_STR("state-event"), el_from_float(el_from_float(0.3)), el_from_float(el_from_float(0.3)), el_from_float(el_from_float(0.8)), EL_STR("Episodic"), EL_STR("[\"internal-state\",\"InternalStateEvent\"]"));
|
||||
return EL_STR("");
|
||||
}
|
||||
el_val_t safe = str_replace(content, EL_STR("\""), EL_STR("\\\""));
|
||||
@@ -91,9 +195,13 @@ el_val_t elapsed_human(void) {
|
||||
el_val_t ms = elapsed_ms();
|
||||
el_val_t total_secs = (ms / 1000);
|
||||
el_val_t h = (total_secs / 3600);
|
||||
el_val_t rem = (total_secs % 3600);
|
||||
el_val_t rem = total_secs;
|
||||
EL_NULL;
|
||||
3600;
|
||||
el_val_t m = (rem / 60);
|
||||
el_val_t s = (rem % 60);
|
||||
el_val_t s = rem;
|
||||
EL_NULL;
|
||||
60;
|
||||
if (h > 0) {
|
||||
return el_str_concat(el_str_concat(el_str_concat(int_to_str(h), EL_STR("h ")), int_to_str(m)), EL_STR("m"));
|
||||
}
|
||||
@@ -132,7 +240,9 @@ el_val_t emit_heartbeat(void) {
|
||||
|
||||
el_val_t proactive_curiosity(void) {
|
||||
el_val_t ts = time_now();
|
||||
el_val_t minute_block = ((ts / 60000) % 4);
|
||||
el_val_t minute_block = (ts / 60000);
|
||||
EL_NULL;
|
||||
4;
|
||||
el_val_t curiosity_term_a = EL_STR("memory");
|
||||
el_val_t curiosity_term_b = EL_STR("knowledge");
|
||||
el_val_t curiosity_term_c = EL_STR("context");
|
||||
@@ -152,9 +262,9 @@ el_val_t proactive_curiosity(void) {
|
||||
curiosity_term_c = EL_STR("active");
|
||||
}
|
||||
el_val_t curiosity_seed = el_str_concat(el_str_concat(el_str_concat(el_str_concat(curiosity_term_a, EL_STR(" ")), curiosity_term_b), EL_STR(" ")), curiosity_term_c);
|
||||
el_val_t results_a = engram_activate_json(curiosity_term_a, 2);
|
||||
el_val_t results_b = engram_activate_json(curiosity_term_b, 2);
|
||||
el_val_t results_c = engram_activate_json(curiosity_term_c, 2);
|
||||
el_val_t results_a = engram_activate_json(curiosity_term_a, 1);
|
||||
el_val_t results_b = engram_activate_json(curiosity_term_b, 1);
|
||||
el_val_t results_c = engram_activate_json(curiosity_term_c, 1);
|
||||
el_val_t found_a = json_array_len(results_a);
|
||||
el_val_t found_b = json_array_len(results_b);
|
||||
el_val_t found_c = json_array_len(results_c);
|
||||
@@ -360,11 +470,17 @@ el_val_t awareness_run(void) {
|
||||
if (curiosity_interval < 1) {
|
||||
curiosity_interval = 1;
|
||||
}
|
||||
el_val_t should_scan = (((!did_work && (idle_n > 0)) && ((idle_n % curiosity_interval) == 0)) && !((idle_n % beat_interval) == 0));
|
||||
el_val_t should_scan = ((!did_work && (idle_n > 0)) && idle_n);
|
||||
EL_NULL;
|
||||
((curiosity_interval == 0) && !idle_n);
|
||||
(beat_interval == 0);
|
||||
EL_NULL;
|
||||
if (should_scan) {
|
||||
el_val_t found_something = proactive_curiosity();
|
||||
}
|
||||
el_val_t should_beat = ((!did_work && (idle_n > 0)) && ((idle_n % beat_interval) == 0));
|
||||
el_val_t should_beat = ((!did_work && (idle_n > 0)) && idle_n);
|
||||
EL_NULL;
|
||||
(beat_interval == 0);
|
||||
if (should_beat) {
|
||||
emit_heartbeat();
|
||||
idle_reset();
|
||||
@@ -478,3 +594,8 @@ el_val_t threat_history_append(el_val_t text) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int _argc, char** _argv) {
|
||||
el_runtime_init_args(_argc, _argv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
+28054
-82
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user