soul: native cognitive API — port all MCP logic to soul daemon
neuron-api.el is a new first-class El module that implements all Neuron cognitive API handlers natively — no HTTP round-trips, no MCP wrapper, direct engram builtin calls. All capabilities that previously lived in the MCP wrapper adapter now live here in the soul. Handlers: begin_session, compile_ctx, remember, recall, search_knowledge, browse_knowledge, capture_knowledge, evolve_knowledge, promote_knowledge, browse_processes, define_process, log_state_event, list_state_events, inspect_config, tune_config, inspect_graph, link_entities, list_typed, consolidate. Routes wired in routes.el under /api/neuron/* (GET + POST). Also compiles all loop-1/loop-2 .el source changes into dist/*.c and rebuilds the binary. memory.elh and neuron-api.elh updated with new exports.
This commit is contained in:
@@ -3,6 +3,7 @@ import "awareness.el"
|
||||
import "chat.el"
|
||||
import "studio.el"
|
||||
import "elp-input.el"
|
||||
import "neuron-api.el"
|
||||
|
||||
fn strip_query(path: String) -> String {
|
||||
let q: Int = str_index_of(path, "?")
|
||||
@@ -268,6 +269,38 @@ fn handle_request(method: String, path: String, body: String) -> String {
|
||||
if str_eq(clean, "/") {
|
||||
return render_studio()
|
||||
}
|
||||
// Neuron cognitive API — GET endpoints
|
||||
if str_eq(clean, "/api/neuron/session/begin") {
|
||||
return handle_api_begin_session("")
|
||||
}
|
||||
if str_eq(clean, "/api/neuron/ctx") {
|
||||
return handle_api_compile_ctx("")
|
||||
}
|
||||
if str_starts_with(clean, "/api/neuron/knowledge/search") {
|
||||
return handle_api_search_knowledge(method, path, body)
|
||||
}
|
||||
if str_eq(clean, "/api/neuron/knowledge") {
|
||||
return handle_api_browse_knowledge(path, body)
|
||||
}
|
||||
if str_starts_with(clean, "/api/neuron/processes") {
|
||||
return handle_api_browse_processes(method, path, body)
|
||||
}
|
||||
if str_starts_with(clean, "/api/neuron/state-events") {
|
||||
return handle_api_list_state_events(method, path, body)
|
||||
}
|
||||
if str_starts_with(clean, "/api/neuron/config") {
|
||||
return handle_api_inspect_config(path, body)
|
||||
}
|
||||
if str_starts_with(clean, "/api/neuron/graph") {
|
||||
return handle_api_inspect_graph(method, path, body)
|
||||
}
|
||||
if str_starts_with(clean, "/api/neuron/list/") {
|
||||
let node_type: String = str_slice(clean, 16, str_len(clean))
|
||||
return handle_api_list_typed(node_type, path, body)
|
||||
}
|
||||
if str_starts_with(clean, "/api/neuron/recall") {
|
||||
return handle_api_recall(method, path, body)
|
||||
}
|
||||
return err_404(clean)
|
||||
}
|
||||
|
||||
@@ -330,6 +363,55 @@ fn handle_request(method: String, path: String, body: String) -> String {
|
||||
if str_starts_with(clean, "/api/imprints") {
|
||||
return axon_post(clean, body)
|
||||
}
|
||||
// Neuron cognitive API — POST endpoints
|
||||
if str_eq(clean, "/api/neuron/session/begin") {
|
||||
return handle_api_begin_session(body)
|
||||
}
|
||||
if str_eq(clean, "/api/neuron/ctx") {
|
||||
return handle_api_compile_ctx(body)
|
||||
}
|
||||
if str_eq(clean, "/api/neuron/knowledge/search") {
|
||||
return handle_api_search_knowledge(method, path, body)
|
||||
}
|
||||
if str_eq(clean, "/api/neuron/knowledge/capture") {
|
||||
return handle_api_capture_knowledge(body)
|
||||
}
|
||||
if str_eq(clean, "/api/neuron/knowledge/evolve") {
|
||||
return handle_api_evolve_knowledge(body)
|
||||
}
|
||||
if str_eq(clean, "/api/neuron/knowledge/promote") {
|
||||
return handle_api_promote_knowledge(body)
|
||||
}
|
||||
if str_eq(clean, "/api/neuron/processes") {
|
||||
return handle_api_browse_processes(method, path, body)
|
||||
}
|
||||
if str_eq(clean, "/api/neuron/processes/define") {
|
||||
return handle_api_define_process(body)
|
||||
}
|
||||
if str_eq(clean, "/api/neuron/state-events") {
|
||||
return handle_api_log_state_event(body)
|
||||
}
|
||||
if str_eq(clean, "/api/neuron/config") {
|
||||
return handle_api_inspect_config(path, body)
|
||||
}
|
||||
if str_eq(clean, "/api/neuron/config/tune") {
|
||||
return handle_api_tune_config(body)
|
||||
}
|
||||
if str_eq(clean, "/api/neuron/graph") {
|
||||
return handle_api_inspect_graph(method, path, body)
|
||||
}
|
||||
if str_eq(clean, "/api/neuron/graph/link") {
|
||||
return handle_api_link_entities(body)
|
||||
}
|
||||
if str_eq(clean, "/api/neuron/memory") {
|
||||
return handle_api_remember(body)
|
||||
}
|
||||
if str_eq(clean, "/api/neuron/recall") {
|
||||
return handle_api_recall(method, path, body)
|
||||
}
|
||||
if str_eq(clean, "/api/neuron/consolidate") {
|
||||
return handle_api_consolidate(body)
|
||||
}
|
||||
return err_404(clean)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user