Files
neuron/neuron-api.elh
T
will.anderson 4bff40fa4a
Neuron Soul CI / build (pull_request) Failing after 14m5s
Neuron Soul CI / deploy (pull_request) Has been skipped
fix(api): bound inspect_graph with relevance-ranked projection; regen soul.c
High-fanout identity anchors (voice, writing-imprint, self-root) have ~670KB
neighborhoods. inspect_graph returned the full traversal, which overflowed the
MCP client's context and socket-closed the wrapper mid self-load -- the soul
could not traverse its own identity graph.

handle_api_inspect_graph gains an opt-in `compact` projection (compact=1|true):
the neighborhood is relevance-ranked, the top K (default 12) keep a UTF-8-safe
content snippet (default snip=600), and the remainder collapse to lightweight
{id,label,node_type,tier,edge,pointer:true} stubs. This bounds the voice node
from 669,799B -> 25,353B (HTTP 200, valid JSON) and the wrapper's soul-load no
longer socket-closes. New helpers: api_compact_neighbors, api_neigh_full,
api_neigh_pointer, api_neigh_rank, api_neigh_better, api_float_or.

The flag is gated: ABSENT it, the response is byte-identical to the old plain
traversal, so the studio app (which never sends it) is unaffected. The MCP
wrapper (mcp-wrapper/src/main.el) appends &compact=1 on its inspectGraph and
fetch-by-id paths.

dist/soul.c is REGENERATED so CI ships the fix: CI compiles the committed
single-TU dist/soul.c directly (running elb/elc on the Linux runner OOM-kills
it), so an .el-only change would build the OLD behavior. Regenerated and verified
on macOS -- compiles with the CI cc line (0 errors) and, on a throwaway soul over
a copy of the live snapshot, serves compact ~25KB / non-compact ~670KB. The regen
also syncs the amalgamation to this branch's .el sources, which had drifted
several self-review commits ahead of the previously-committed soul.c.

Docs: docs/architecture/00-05 added; 01/02/05 corrected so the relevance-ranked
inspect_graph projection reads as committed source, not an in-flight concern.
2026-08-10 10:28:50 -05:00

54 lines
3.3 KiB
Plaintext

// auto-generated by elc --emit-header — do not edit
extern fn is_protected_node(id: String) -> Bool
extern fn api_err_protected(id: String) -> String
extern fn api_json_escape(s: String) -> String
extern fn api_query_param(path: String, key: String) -> String
extern fn api_query_int(path: String, key: String, default_val: Int) -> Int
extern fn api_ok(extra: String) -> String
extern fn api_err(msg: String) -> String
extern fn api_nonempty(s: String) -> Bool
extern fn api_or_empty(s: String) -> String
extern fn api_num_or_zero(obj: String, key: String) -> String
extern fn api_utf8_trunc(s: String, n: Int) -> String
extern fn api_compact_node(node: String, snip: Int) -> String
extern fn api_compact_node_array(raw: String, max_items: Int, snip: Int) -> String
extern fn api_compact_activated(raw: String, max_items: Int, snip: Int) -> String
extern fn api_float_or(obj: String, key: String, dflt: Float) -> Float
extern fn api_neigh_better(a: String, b: String) -> Bool
extern fn api_neigh_rank(raw: String, n: Int, i: Int) -> Int
extern fn api_neigh_full(node: String, edge: String, el: String, snip: Int) -> String
extern fn api_neigh_pointer(node: String, edge: String, el: String) -> String
extern fn api_compact_neighbors(raw: String, k_content: Int, snip: Int) -> String
extern fn api_persisted(id: String) -> Bool
extern fn api_not_persisted(id: String) -> String
extern fn tombstone_node(id: String) -> String
extern fn tombstoned_id_set() -> String
extern fn memory_hide_tombstoned(raw: String, path: String) -> String
extern fn handle_api_begin_session(body: String) -> String
extern fn handle_api_compile_ctx(body: String) -> String
extern fn handle_api_remember(body: String) -> String
extern fn handle_api_node_create(body: String) -> String
extern fn handle_api_node_delete(body: String) -> String
extern fn handle_api_node_update(body: String) -> String
extern fn handle_api_recall(method: String, path: String, body: String) -> String
extern fn handle_api_search_knowledge(method: String, path: String, body: String) -> String
extern fn handle_api_browse_knowledge(path: String, body: String) -> String
extern fn handle_api_capture_knowledge(body: String) -> String
extern fn handle_api_evolve_knowledge(body: String) -> String
extern fn handle_api_promote_knowledge(body: String) -> String
extern fn handle_api_browse_processes(method: String, path: String, body: String) -> String
extern fn handle_api_define_process(body: String) -> String
extern fn handle_api_log_state_event(body: String) -> String
extern fn handle_api_list_state_events(method: String, path: String, body: String) -> String
extern fn handle_api_inspect_config(path: String, body: String) -> String
extern fn handle_api_tune_config(body: String) -> String
extern fn handle_api_inspect_graph(method: String, path: String, body: String) -> String
extern fn handle_api_link_entities(body: String) -> String
extern fn handle_api_forget(body: String) -> String
extern fn handle_api_evolve_memory(body: String) -> String
extern fn handle_api_memory_delete(body: String) -> String
extern fn handle_api_memory_update(body: String) -> String
extern fn handle_api_cultivate(body: String) -> String
extern fn handle_api_list_typed(node_type: String, path: String, body: String) -> String
extern fn handle_api_consolidate(body: String) -> String