From 2d0aef4ef8033a9a6de0262f47c65d1317cc9a7f Mon Sep 17 00:00:00 2001 From: bigmerge Date: Sat, 15 Aug 2026 17:32:58 -0500 Subject: [PATCH] lang: declare the el_runtime.c symbols el_seed.c's wrappers call runtime/el_seed.c does not compile standalone via the exact command tools/install.sh uses (`cc -std=c11 -O2 -I runtime -c runtime/el_seed.c`): 51 of its __-prefixed wrapper functions (http serving, JSON access, key-val state, URL/HTML escaping, and the whole engram_* node/edge/layer/search surface) call unprefixed counterparts that are implemented in el_runtime.c, not in el_seed.c itself, and el_seed.c never declared them -- a toolchain that treats an implicit function declaration as a hard error under C11 fails the compile outright. install.sh already compiles el_seed.c and el_runtime.c as separate objects and archives both into libel.a, so the symbols are always present at link time; el_seed.c alone was just missing the prototypes. A plain `#include "el_runtime.h"` was tried first and rejected: it redefines el_to_float/el_from_float, which el_seed.h already provides -- a real compile error, not a style preference. Added narrow prototypes instead, copied verbatim from el_runtime.h, for exactly the 51 symbols el_seed.c's wrappers reference and nothing else. Verified clean: - `cc -std=c11 -O2 -I runtime -c runtime/el_seed.c` (install.sh's exact per-file compile) -- 0 errors, 0 warnings, even with -ferror-limit=0. - full `tools/install.sh` run -- compiles both objects and archives them into libel.a successfully. Separately (not fixed here, out of scope): AGENTS.md's documented compiler self-rebuild command links elc-new.c against el_seed.c, but elc-new.c's own generated `#include "el_runtime.h"` line and 3 undeclared symbols (el_mem_check, stdout_to_file, stdout_restore -- present in neither el_runtime.c nor el_seed.c) mean that command fails regardless of which runtime file it's linked against; and install.sh's libel.a only archives el_seed.o + el_runtime.o, so any program that calls into the engram_* surface fails to link against it (el_runtime.c's engram_* wrappers need engram_store.c/engram_geometry.c/engram_reason.c/engram_cognition.c/ engram_vindex.c, none of which install.sh compiles in). Both are real, pre-existing, and independent of this fix -- worth their own look. --- lang/runtime/el_seed.c | 76 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/lang/runtime/el_seed.c b/lang/runtime/el_seed.c index aa4305b..339be41 100644 --- a/lang/runtime/el_seed.c +++ b/lang/runtime/el_seed.c @@ -37,6 +37,82 @@ #include #include +/* el_runtime.c bridge prototypes. + * + * A block of __-prefixed wrappers further down in this file (http serving, + * JSON access, key-val state, URL/HTML escaping, and the whole engram_* + * node/edge/layer/search surface -- 51 symbols in total) delegate to + * unprefixed counterparts that are implemented in el_runtime.c, not here. + * Porting them into native el_seed.c or El has not happened yet. + * tools/install.sh compiles el_seed.c and el_runtime.c as separate objects + * and archives both into libel.a, so the symbols are always present at link + * time. el_seed.c alone was just missing the prototypes, which made even a + * standalone -c compile of this one file fail on a toolchain that now treats + * an implicit function declaration as a hard error under C11. + * + * A plain include of el_runtime.h was tried first and rejected: it redefines + * el_to_float and el_from_float, which el_seed.h already provides. Narrow + * prototypes, copied verbatim from el_runtime.h, avoid that collision without + * pulling in the rest of the retiring runtime header. + */ +el_val_t http_response(el_val_t status, el_val_t headers_json, el_val_t body); +void http_serve(el_val_t port, el_val_t handler); +void http_serve_v2(el_val_t port, el_val_t handler); +el_val_t json_get(el_val_t json, el_val_t key); +el_val_t json_get_string(el_val_t json_str, el_val_t key); +el_val_t json_get_int(el_val_t json_str, el_val_t key); +el_val_t json_get_float(el_val_t json_str, el_val_t key); +el_val_t json_get_bool(el_val_t json_str, el_val_t key); +el_val_t json_get_raw(el_val_t json_str, el_val_t key); +el_val_t json_parse(el_val_t s); +el_val_t json_set(el_val_t json_str, el_val_t key, el_val_t value); +el_val_t json_stringify(el_val_t v); +el_val_t json_array_len(el_val_t json_str); +el_val_t json_array_get(el_val_t json_str, el_val_t index); +el_val_t json_array_get_string(el_val_t json_str, el_val_t index); +el_val_t state_set(el_val_t key, el_val_t value); +el_val_t state_get(el_val_t key); +el_val_t state_del(el_val_t key); +el_val_t state_keys(void); +el_val_t url_encode(el_val_t s); +el_val_t url_decode(el_val_t s); +el_val_t el_html_sanitize(el_val_t input_html, el_val_t allowlist_json); +el_val_t engram_node(el_val_t content, el_val_t node_type, el_val_t salience); +el_val_t engram_node_full(el_val_t content, el_val_t node_type, el_val_t label, + el_val_t salience, el_val_t importance, el_val_t confidence, + el_val_t tier, el_val_t tags); +el_val_t engram_node_layered(el_val_t content, el_val_t node_type, el_val_t label, + el_val_t salience, el_val_t certainty, el_val_t confidence, + el_val_t status, el_val_t tags, el_val_t layer_id); +el_val_t engram_add_layer(el_val_t name, el_val_t priority, el_val_t suppressible, + el_val_t transparent, el_val_t injectable); +el_val_t engram_remove_layer(el_val_t layer_id); +el_val_t engram_list_layers(void); +el_val_t engram_list_layers_json(void); +el_val_t engram_get_node(el_val_t id); +el_val_t engram_get_node_json(el_val_t id); +el_val_t engram_get_node_by_label(el_val_t label); +void engram_strengthen(el_val_t node_id); +void engram_forget(el_val_t node_id); +el_val_t engram_node_count(void); +el_val_t engram_edge_count(void); +el_val_t engram_scan_nodes(el_val_t limit, el_val_t offset); +el_val_t engram_scan_nodes_json(el_val_t limit, el_val_t offset); +el_val_t engram_scan_nodes_by_type_json(el_val_t node_type, el_val_t limit, el_val_t offset); +el_val_t engram_search(el_val_t query, el_val_t limit); +el_val_t engram_search_json(el_val_t query, el_val_t limit); +el_val_t engram_activate(el_val_t query, el_val_t depth); +el_val_t engram_activate_json(el_val_t query, el_val_t depth); +el_val_t engram_compile_layered_json(el_val_t intent, el_val_t depth); +el_val_t engram_stats_json(void); +void engram_connect(el_val_t from_id, el_val_t to_id, el_val_t weight, el_val_t relation); +el_val_t engram_edge_between(el_val_t from_id, el_val_t to_id); +el_val_t engram_neighbors(el_val_t node_id); +el_val_t engram_neighbors_filtered(el_val_t node_id, el_val_t max_depth, el_val_t direction); +el_val_t engram_neighbors_json(el_val_t node_id, el_val_t max_depth, el_val_t direction); +el_val_t engram_load(el_val_t path); +el_val_t engram_save(el_val_t path); + /* ── Private allocator ───────────────────────────────────────────────────── */ /* * el_seed.c carries its own arena for per-request allocation tracking.