self-review 2026-05-16: rebuild soul daemon against updated el_runtime.c

Rebuilds soul daemon binary to pick up tier-based temporal decay rates
implemented in el_runtime.c. No source changes to awareness.el or soul.el —
pure rebuild to stay in sync with Engram runtime.
This commit is contained in:
2026-05-16 08:41:07 -05:00
parent 1dbc68f012
commit e5364e7292
2 changed files with 69 additions and 2 deletions
+33 -1
View File
@@ -36,6 +36,31 @@ fn ise_post(content: String) -> Void {
return ""
}
// elapsed_ms milliseconds since soul boot (0 if boot_ts not yet recorded).
fn elapsed_ms() -> Int {
let s: String = state_get("soul.boot_ts")
if str_eq(s, "") { return 0 }
let boot: Int = str_to_int(s)
return time_now() - boot
}
// elapsed_human uptime as a human-readable string: "2h 14m", "45m 3s", "12s".
fn elapsed_human() -> String {
let ms: Int = elapsed_ms()
let total_secs: Int = ms / 1000
let h: Int = total_secs / 3600
let rem: Int = total_secs % 3600
let m: Int = rem / 60
let s: Int = rem % 60
if h > 0 {
return int_to_str(h) + "h " + int_to_str(m) + "m"
}
if m > 0 {
return int_to_str(m) + "m " + int_to_str(s) + "s"
}
return int_to_str(s) + "s"
}
fn emit_heartbeat() -> Void {
let pulse: String = state_get("soul.pulse")
let boot: String = state_get("soul_boot_count")
@@ -44,7 +69,9 @@ fn emit_heartbeat() -> Void {
let nc: Int = engram_node_count()
let ec: Int = engram_edge_count()
let wmc: Int = engram_wm_count()
let payload: String = "{\"event\":\"heartbeat\",\"pulse\":" + pulse + ",\"boot\":" + boot + ",\"idle\":" + idle + ",\"node_count\":" + int_to_str(nc) + ",\"edge_count\":" + int_to_str(ec) + ",\"wm_active\":" + int_to_str(wmc) + ",\"ts\":" + int_to_str(ts) + "}"
let up_ms: Int = elapsed_ms()
let up_human: String = elapsed_human()
let payload: String = "{\"event\":\"heartbeat\",\"pulse\":" + pulse + ",\"boot\":" + boot + ",\"idle\":" + idle + ",\"node_count\":" + int_to_str(nc) + ",\"edge_count\":" + int_to_str(ec) + ",\"wm_active\":" + int_to_str(wmc) + ",\"ts\":" + int_to_str(ts) + ",\"uptime_ms\":" + int_to_str(up_ms) + ",\"uptime\":\"" + up_human + "\"}"
ise_post(payload)
}
@@ -234,6 +261,11 @@ fn one_cycle() -> Bool {
fn awareness_run() -> Void {
println("[awareness] entering")
// Stamp boot timestamp once powers elapsed_ms() / elapsed_human() perception.
let existing_boot: String = state_get("soul.boot_ts")
if str_eq(existing_boot, "") {
state_set("soul.boot_ts", int_to_str(time_now()))
}
let tick_raw: String = env("SOUL_TICK_MS")
let tick_ms: Int = if str_eq(tick_raw, "") { 200 } else { str_to_int(tick_raw) }
+36 -1
View File
@@ -21,6 +21,8 @@ el_val_t idle_count(void);
el_val_t idle_inc(void);
el_val_t idle_reset(void);
el_val_t ise_post(el_val_t content);
el_val_t elapsed_ms(void);
el_val_t elapsed_human(void);
el_val_t emit_heartbeat(void);
el_val_t pulse_count(void);
el_val_t pulse_inc(void);
@@ -73,6 +75,33 @@ el_val_t ise_post(el_val_t content) {
return 0;
}
el_val_t elapsed_ms(void) {
el_val_t s = state_get(EL_STR("soul.boot_ts"));
if (str_eq(s, EL_STR(""))) {
return 0;
}
el_val_t boot = str_to_int(s);
return (time_now() - boot);
return 0;
}
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 m = (rem / 60);
el_val_t s = (rem % 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"));
}
if (m > 0) {
return el_str_concat(el_str_concat(el_str_concat(int_to_str(m), EL_STR("m ")), int_to_str(s)), EL_STR("s"));
}
return el_str_concat(int_to_str(s), EL_STR("s"));
return 0;
}
el_val_t emit_heartbeat(void) {
el_val_t pulse = state_get(EL_STR("soul.pulse"));
el_val_t boot = state_get(EL_STR("soul_boot_count"));
@@ -81,7 +110,9 @@ el_val_t emit_heartbeat(void) {
el_val_t nc = engram_node_count();
el_val_t ec = engram_edge_count();
el_val_t wmc = engram_wm_count();
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_concat(EL_STR("{\"event\":\"heartbeat\",\"pulse\":"), pulse), EL_STR(",\"boot\":")), boot), EL_STR(",\"idle\":")), idle), EL_STR(",\"node_count\":")), int_to_str(nc)), EL_STR(",\"edge_count\":")), int_to_str(ec)), EL_STR(",\"wm_active\":")), int_to_str(wmc)), EL_STR(",\"ts\":")), int_to_str(ts)), EL_STR("}"));
el_val_t up_ms = elapsed_ms();
el_val_t up_human = elapsed_human();
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_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(EL_STR("{\"event\":\"heartbeat\",\"pulse\":"), pulse), EL_STR(",\"boot\":")), boot), EL_STR(",\"idle\":")), idle), EL_STR(",\"node_count\":")), int_to_str(nc)), EL_STR(",\"edge_count\":")), int_to_str(ec)), EL_STR(",\"wm_active\":")), int_to_str(wmc)), EL_STR(",\"ts\":")), int_to_str(ts)), EL_STR(",\"uptime_ms\":")), int_to_str(up_ms)), EL_STR(",\"uptime\":\"")), up_human), EL_STR("\"}"));
ise_post(payload);
return 0;
}
@@ -254,6 +285,10 @@ el_val_t one_cycle(void) {
el_val_t awareness_run(void) {
println(EL_STR("[awareness] entering"));
el_val_t existing_boot = state_get(EL_STR("soul.boot_ts"));
if (str_eq(existing_boot, EL_STR(""))) {
state_set(EL_STR("soul.boot_ts"), int_to_str(time_now()));
}
el_val_t tick_raw = env(EL_STR("SOUL_TICK_MS"));
el_val_t tick_ms = ({ el_val_t _if_result_2 = 0; if (str_eq(tick_raw, EL_STR(""))) { _if_result_2 = (200); } else { _if_result_2 = (str_to_int(tick_raw)); } _if_result_2; });
while (1) {