48ecd83421
- Fix wrong ELP import paths in soul.el, elp-input.el, studio.el (../foundation/elp/src → ../foundation/el/elp/src) - Add missing import "morphology.el" to all 29 language morphology modules - Recompile all affected dist/*.c with correct cross-module declarations - Add dist/elp-c-decls.h: C-level master forward declarations for ELP package (enables elb --force-include to resolve undeclared cross-module calls)
463 lines
20 KiB
C
463 lines
20 KiB
C
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
#include "el_runtime.h"
|
|
|
|
el_val_t tier_working(void);
|
|
el_val_t tier_episodic(void);
|
|
el_val_t tier_canonical(void);
|
|
el_val_t mem_store(el_val_t content, el_val_t label, el_val_t tags);
|
|
el_val_t mem_remember(el_val_t content, el_val_t tags);
|
|
el_val_t mem_recall(el_val_t query, el_val_t depth);
|
|
el_val_t mem_search(el_val_t query, el_val_t limit);
|
|
el_val_t mem_strengthen(el_val_t node_id);
|
|
el_val_t mem_forget(el_val_t node_id);
|
|
el_val_t mem_consolidate(void);
|
|
el_val_t mem_save(el_val_t path);
|
|
el_val_t mem_load(el_val_t path);
|
|
el_val_t mem_boot_count_get(void);
|
|
el_val_t mem_boot_count_inc(void);
|
|
el_val_t mem_emit_state_event(el_val_t trigger, el_val_t kind, el_val_t content);
|
|
el_val_t pulse_count(void);
|
|
el_val_t pulse_inc(void);
|
|
el_val_t make_action(el_val_t kind, el_val_t payload);
|
|
el_val_t perceive(void);
|
|
el_val_t attend(el_val_t node_json);
|
|
el_val_t respond(el_val_t action_json);
|
|
el_val_t record(el_val_t outcome_json);
|
|
el_val_t one_cycle(void);
|
|
el_val_t awareness_run(void);
|
|
el_val_t chat_default_model(void);
|
|
el_val_t engram_compile(el_val_t intent);
|
|
el_val_t json_safe(el_val_t s);
|
|
el_val_t build_system_prompt(el_val_t ctx);
|
|
el_val_t hist_append(el_val_t hist, el_val_t role, el_val_t content);
|
|
el_val_t hist_trim(el_val_t hist);
|
|
el_val_t clean_llm_response(el_val_t s);
|
|
el_val_t conv_history_persist(el_val_t hist);
|
|
el_val_t conv_history_load(void);
|
|
el_val_t handle_chat(el_val_t body);
|
|
el_val_t handle_see(el_val_t body);
|
|
el_val_t studio_tools_json(void);
|
|
el_val_t agentic_api_key(void);
|
|
el_val_t agentic_tools_literal(void);
|
|
el_val_t dispatch_tool(el_val_t tool_name, el_val_t tool_input);
|
|
el_val_t handle_chat_agentic(el_val_t body);
|
|
el_val_t handle_chat_as_soul(el_val_t body);
|
|
el_val_t handle_dharma_room_turn(el_val_t body);
|
|
el_val_t handle_dharma_room_turn_agentic(el_val_t body);
|
|
el_val_t auto_persist(el_val_t req, el_val_t resp);
|
|
el_val_t strengthen_chat_nodes(el_val_t activation_nodes);
|
|
el_val_t auth_headers(el_val_t tok);
|
|
el_val_t axon_get(el_val_t path);
|
|
el_val_t axon_post(el_val_t path, el_val_t body);
|
|
el_val_t handle_conversations(el_val_t method);
|
|
el_val_t handle_config(el_val_t method, el_val_t body);
|
|
el_val_t dharma_registry(void);
|
|
el_val_t dharma_network_state(void);
|
|
el_val_t handle_dharma(el_val_t path, el_val_t method, el_val_t body);
|
|
el_val_t handle_tool(el_val_t path, el_val_t method, el_val_t body);
|
|
el_val_t handle_nlg(el_val_t path, el_val_t method, el_val_t body);
|
|
el_val_t render_studio(void);
|
|
el_val_t elp_extract_topic(el_val_t msg);
|
|
el_val_t elp_detect_predicate(el_val_t msg);
|
|
el_val_t elp_parse(el_val_t msg);
|
|
el_val_t handle_elp_chat(el_val_t body);
|
|
el_val_t api_json_escape(el_val_t s);
|
|
el_val_t api_query_param(el_val_t path, el_val_t key);
|
|
el_val_t api_query_int(el_val_t path, el_val_t key, el_val_t default_val);
|
|
el_val_t api_ok(el_val_t extra);
|
|
el_val_t api_err(el_val_t msg);
|
|
el_val_t api_nonempty(el_val_t s);
|
|
el_val_t api_or_empty(el_val_t s);
|
|
el_val_t handle_api_begin_session(el_val_t body);
|
|
el_val_t handle_api_compile_ctx(el_val_t body);
|
|
el_val_t handle_api_remember(el_val_t body);
|
|
el_val_t handle_api_recall(el_val_t method, el_val_t path, el_val_t body);
|
|
el_val_t handle_api_search_knowledge(el_val_t method, el_val_t path, el_val_t body);
|
|
el_val_t handle_api_browse_knowledge(el_val_t path, el_val_t body);
|
|
el_val_t handle_api_capture_knowledge(el_val_t body);
|
|
el_val_t handle_api_evolve_knowledge(el_val_t body);
|
|
el_val_t handle_api_promote_knowledge(el_val_t body);
|
|
el_val_t handle_api_browse_processes(el_val_t method, el_val_t path, el_val_t body);
|
|
el_val_t handle_api_define_process(el_val_t body);
|
|
el_val_t handle_api_log_state_event(el_val_t body);
|
|
el_val_t handle_api_list_state_events(el_val_t method, el_val_t path, el_val_t body);
|
|
el_val_t handle_api_inspect_config(el_val_t path, el_val_t body);
|
|
el_val_t handle_api_tune_config(el_val_t body);
|
|
el_val_t handle_api_inspect_graph(el_val_t method, el_val_t path, el_val_t body);
|
|
el_val_t handle_api_link_entities(el_val_t body);
|
|
el_val_t handle_api_list_typed(el_val_t node_type, el_val_t path, el_val_t body);
|
|
el_val_t handle_api_consolidate(el_val_t body);
|
|
el_val_t strip_query(el_val_t path);
|
|
el_val_t err_404(el_val_t path);
|
|
el_val_t err_405(el_val_t method, el_val_t path);
|
|
el_val_t route_health(void);
|
|
el_val_t route_lineage(void);
|
|
el_val_t route_imprint_contextual(el_val_t body);
|
|
el_val_t route_imprint_user(el_val_t body);
|
|
el_val_t route_synthesize(el_val_t body);
|
|
el_val_t handle_dharma_recv(el_val_t body);
|
|
el_val_t route_sessions(void);
|
|
el_val_t handle_request(el_val_t method, el_val_t path, el_val_t body);
|
|
|
|
el_val_t strip_query(el_val_t path) {
|
|
el_val_t q = str_index_of(path, EL_STR("?"));
|
|
if (q < 0) {
|
|
return path;
|
|
}
|
|
return str_slice(path, 0, q);
|
|
return 0;
|
|
}
|
|
|
|
el_val_t err_404(el_val_t path) {
|
|
return el_str_concat(el_str_concat(EL_STR("{\"error\":\"not found\",\"path\":\""), path), EL_STR("\"}"));
|
|
return 0;
|
|
}
|
|
|
|
el_val_t err_405(el_val_t method, el_val_t path) {
|
|
return el_str_concat(el_str_concat(el_str_concat(el_str_concat(EL_STR("{\"error\":\"method not allowed\",\"method\":\""), method), EL_STR("\",\"path\":\"")), path), EL_STR("\"}"));
|
|
return 0;
|
|
}
|
|
|
|
el_val_t route_health(void) {
|
|
el_val_t cgi_id = state_get(EL_STR("soul_cgi_id"));
|
|
el_val_t boot = state_get(EL_STR("soul_boot_count"));
|
|
el_val_t boot_num = ({ el_val_t _if_result_1 = 0; if (str_eq(boot, EL_STR(""))) { _if_result_1 = (EL_STR("0")); } else { _if_result_1 = (boot); } _if_result_1; });
|
|
el_val_t node_ct = engram_node_count();
|
|
el_val_t edge_ct = engram_edge_count();
|
|
el_val_t pulse = state_get(EL_STR("soul.pulse"));
|
|
el_val_t pulse_num = ({ el_val_t _if_result_2 = 0; if (str_eq(pulse, EL_STR(""))) { _if_result_2 = (EL_STR("0")); } else { _if_result_2 = (pulse); } _if_result_2; });
|
|
return 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("{\"status\":\"alive\""), EL_STR(",\"cgi_id\":\"")), cgi_id), EL_STR("\"")), EL_STR(",\"boot\":")), boot_num), EL_STR(",\"node_count\":")), int_to_str(node_ct)), EL_STR(",\"edge_count\":")), int_to_str(edge_ct)), EL_STR(",\"pulse\":")), pulse_num), EL_STR("}"));
|
|
return 0;
|
|
}
|
|
|
|
el_val_t route_lineage(void) {
|
|
el_val_t cgi_id = state_get(EL_STR("soul_cgi_id"));
|
|
el_val_t q = el_str_concat(EL_STR("lineage:"), cgi_id);
|
|
el_val_t results = engram_search_json(q, 1);
|
|
el_val_t len = json_array_len(results);
|
|
if (len <= 0) {
|
|
return el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(EL_STR("{\"id\":\""), cgi_id), EL_STR("\"")), EL_STR(",\"tier\":\"citizen\"")), EL_STR(",\"is_founding\":true")), EL_STR(",\"validation_attempts\":0")), EL_STR(",\"training_sessions\":0")), EL_STR(",\"is_sterile\":false}"));
|
|
}
|
|
el_val_t raw = json_get_raw(results, EL_STR("0"));
|
|
return raw;
|
|
return 0;
|
|
}
|
|
|
|
el_val_t route_imprint_contextual(el_val_t body) {
|
|
if (str_eq(body, EL_STR(""))) {
|
|
return EL_STR("{\"ok\":false,\"error\":\"empty body\"}");
|
|
}
|
|
el_val_t tags = EL_STR("[\"imprint\",\"contextual\"]");
|
|
el_val_t id = engram_node_full(body, EL_STR("Entity"), EL_STR("imprint:contextual"), el_from_float(0.7), el_from_float(0.6), el_from_float(0.9), EL_STR("Working"), tags);
|
|
if (str_eq(id, EL_STR(""))) {
|
|
return EL_STR("{\"ok\":false,\"error\":\"engram write failed\"}");
|
|
}
|
|
state_set(EL_STR("active_contextual_imprint"), id);
|
|
return el_str_concat(el_str_concat(EL_STR("{\"ok\":true,\"id\":\""), id), EL_STR("\"}"));
|
|
return 0;
|
|
}
|
|
|
|
el_val_t route_imprint_user(el_val_t body) {
|
|
if (str_eq(body, EL_STR(""))) {
|
|
return EL_STR("{\"ok\":false,\"error\":\"empty body\"}");
|
|
}
|
|
el_val_t tags = EL_STR("[\"imprint\",\"user\"]");
|
|
el_val_t id = engram_node_full(body, EL_STR("Entity"), EL_STR("imprint:user"), el_from_float(0.7), el_from_float(0.6), el_from_float(0.9), EL_STR("Working"), tags);
|
|
if (str_eq(id, EL_STR(""))) {
|
|
return EL_STR("{\"ok\":false,\"error\":\"engram write failed\"}");
|
|
}
|
|
state_set(EL_STR("active_user_imprint"), id);
|
|
return el_str_concat(el_str_concat(EL_STR("{\"ok\":true,\"id\":\""), id), EL_STR("\"}"));
|
|
return 0;
|
|
}
|
|
|
|
el_val_t route_synthesize(el_val_t body) {
|
|
if (str_eq(body, EL_STR(""))) {
|
|
return EL_STR("{\"mechanism\":\"did not engage\"}");
|
|
}
|
|
el_val_t parent_a = json_get(body, EL_STR("parent_a"));
|
|
el_val_t parent_b = json_get(body, EL_STR("parent_b"));
|
|
if (str_eq(parent_a, EL_STR(""))) {
|
|
return EL_STR("{\"mechanism\":\"did not engage\"}");
|
|
}
|
|
if (str_eq(parent_b, EL_STR(""))) {
|
|
return EL_STR("{\"mechanism\":\"did not engage\"}");
|
|
}
|
|
el_val_t req = el_str_concat(el_str_concat(el_str_concat(EL_STR("synthesize "), parent_a), EL_STR(" ")), parent_b);
|
|
el_val_t tags = EL_STR("[\"soul-inbox-pending\",\"synthesis-request\"]");
|
|
engram_node_full(req, EL_STR("Entity"), EL_STR("synthesis-request"), el_from_float(0.8), el_from_float(0.8), el_from_float(0.9), EL_STR("Working"), tags);
|
|
return EL_STR("{\"mechanism\":\"did not engage\"}");
|
|
return 0;
|
|
}
|
|
|
|
el_val_t handle_dharma_recv(el_val_t body) {
|
|
el_val_t content_raw = json_get(body, EL_STR("content"));
|
|
el_val_t from_id = json_get(body, EL_STR("from"));
|
|
el_val_t event_type = json_get(content_raw, EL_STR("event_type"));
|
|
el_val_t payload = json_get(content_raw, EL_STR("payload"));
|
|
el_val_t eff_event = ({ el_val_t _if_result_3 = 0; if (str_eq(event_type, EL_STR(""))) { _if_result_3 = (EL_STR("chat")); } else { _if_result_3 = (event_type); } _if_result_3; });
|
|
el_val_t eff_payload = ({ el_val_t _if_result_4 = 0; if (str_eq(payload, EL_STR(""))) { _if_result_4 = (content_raw); } else { _if_result_4 = (payload); } _if_result_4; });
|
|
if (str_eq(eff_event, EL_STR("chat"))) {
|
|
el_val_t msg = json_get(eff_payload, EL_STR("message"));
|
|
el_val_t chat_body = ({ el_val_t _if_result_5 = 0; if (str_eq(msg, EL_STR(""))) { _if_result_5 = (el_str_concat(el_str_concat(EL_STR("{\"message\":\""), str_replace(str_replace(eff_payload, EL_STR("\\"), EL_STR("\\\\")), EL_STR("\""), EL_STR("\\\""))), EL_STR("\"}"))); } else { _if_result_5 = (eff_payload); } _if_result_5; });
|
|
el_val_t agentic_flag = json_get_bool(eff_payload, EL_STR("agentic"));
|
|
el_val_t reply = ({ el_val_t _if_result_6 = 0; if (agentic_flag) { _if_result_6 = (handle_chat_agentic(chat_body)); } else { _if_result_6 = (handle_chat(chat_body)); } _if_result_6; });
|
|
auto_persist(chat_body, reply);
|
|
return reply;
|
|
}
|
|
if (str_eq(eff_event, EL_STR("memory"))) {
|
|
el_val_t query = json_get(eff_payload, EL_STR("query"));
|
|
el_val_t limit_str = json_get(eff_payload, EL_STR("limit"));
|
|
el_val_t limit = ({ el_val_t _if_result_7 = 0; if (str_eq(limit_str, EL_STR(""))) { _if_result_7 = (20); } else { _if_result_7 = (str_to_int(limit_str)); } _if_result_7; });
|
|
el_val_t q = ({ el_val_t _if_result_8 = 0; if (str_eq(query, EL_STR(""))) { _if_result_8 = (eff_payload); } else { _if_result_8 = (query); } _if_result_8; });
|
|
return engram_search_json(q, limit);
|
|
}
|
|
if (str_eq(eff_event, EL_STR("tool"))) {
|
|
el_val_t path_field = json_get(eff_payload, EL_STR("path"));
|
|
el_val_t method_field = json_get(eff_payload, EL_STR("method"));
|
|
el_val_t tool_body = json_get(eff_payload, EL_STR("body"));
|
|
el_val_t eff_method = ({ el_val_t _if_result_9 = 0; if (str_eq(method_field, EL_STR(""))) { _if_result_9 = (EL_STR("POST")); } else { _if_result_9 = (method_field); } _if_result_9; });
|
|
return handle_tool(path_field, eff_method, tool_body);
|
|
}
|
|
if (str_eq(eff_event, EL_STR("see"))) {
|
|
return handle_see(eff_payload);
|
|
}
|
|
if (str_eq(eff_event, EL_STR("health"))) {
|
|
return route_health();
|
|
}
|
|
if (str_eq(eff_event, EL_STR("dharma_room_turn_agentic"))) {
|
|
return handle_dharma_room_turn_agentic(eff_payload);
|
|
}
|
|
if (str_eq(eff_event, EL_STR("dharma_room_turn"))) {
|
|
return handle_dharma_room_turn(eff_payload);
|
|
}
|
|
if (str_eq(eff_event, EL_STR("chat_as_soul"))) {
|
|
return handle_chat_as_soul(eff_payload);
|
|
}
|
|
if (str_eq(eff_event, EL_STR("elp"))) {
|
|
return handle_elp_chat(eff_payload);
|
|
}
|
|
return el_str_concat(el_str_concat(EL_STR("{\"error\":\"unknown event_type\",\"event_type\":\""), eff_event), EL_STR("\"}"));
|
|
return 0;
|
|
}
|
|
|
|
el_val_t route_sessions(void) {
|
|
el_val_t results = engram_search_json(EL_STR("session-start"), 20);
|
|
if (str_eq(results, EL_STR(""))) {
|
|
return EL_STR("[]");
|
|
}
|
|
if (str_eq(results, EL_STR("[]"))) {
|
|
return EL_STR("[]");
|
|
}
|
|
return results;
|
|
return 0;
|
|
}
|
|
|
|
el_val_t handle_request(el_val_t method, el_val_t path, el_val_t body) {
|
|
el_val_t clean = strip_query(path);
|
|
if (str_eq(method, EL_STR("POST")) && str_eq(clean, EL_STR("/dharma/recv"))) {
|
|
return handle_dharma_recv(body);
|
|
}
|
|
if (str_eq(method, EL_STR("GET"))) {
|
|
if (str_eq(clean, EL_STR("/health"))) {
|
|
return route_health();
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/sessions"))) {
|
|
return route_sessions();
|
|
}
|
|
if (str_eq(clean, EL_STR("/lineage"))) {
|
|
return route_lineage();
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/graph")) || str_eq(clean, EL_STR("/api/graph/nodes"))) {
|
|
return engram_scan_nodes_json(9999, 0);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/graph/edges"))) {
|
|
el_val_t snap_path = el_str_concat(env(EL_STR("HOME")), EL_STR("/.neuron/engram/snapshot.json"));
|
|
engram_save(snap_path);
|
|
el_val_t snap = fs_read(snap_path);
|
|
el_val_t edges_raw = json_get_raw(snap, EL_STR("edges"));
|
|
return ({ el_val_t _if_result_10 = 0; if (str_eq(edges_raw, EL_STR(""))) { _if_result_10 = (EL_STR("[]")); } else { _if_result_10 = (edges_raw); } _if_result_10; });
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/chat"))) {
|
|
return handle_chat(body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/conversations"))) {
|
|
return handle_conversations(method);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/config"))) {
|
|
return handle_config(method, body);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/tools/"))) {
|
|
return handle_tool(clean, method, body);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/dharma"))) {
|
|
return handle_dharma(clean, method, body);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/nlg"))) {
|
|
return handle_nlg(clean, method, body);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/memories"))) {
|
|
return axon_get(clean);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/knowledge"))) {
|
|
return axon_get(clean);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/backlog"))) {
|
|
return axon_get(clean);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/artifacts"))) {
|
|
return axon_get(clean);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/projects"))) {
|
|
return axon_get(clean);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/imprints"))) {
|
|
return axon_get(clean);
|
|
}
|
|
if (str_eq(clean, EL_STR("/"))) {
|
|
return render_studio();
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/neuron/session/begin"))) {
|
|
return handle_api_begin_session(EL_STR(""));
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/neuron/ctx"))) {
|
|
return handle_api_compile_ctx(EL_STR(""));
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/neuron/knowledge/search"))) {
|
|
return handle_api_search_knowledge(method, path, body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/neuron/knowledge"))) {
|
|
return handle_api_browse_knowledge(path, body);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/neuron/processes"))) {
|
|
return handle_api_browse_processes(method, path, body);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/neuron/state-events"))) {
|
|
return handle_api_list_state_events(method, path, body);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/neuron/config"))) {
|
|
return handle_api_inspect_config(path, body);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/neuron/graph"))) {
|
|
return handle_api_inspect_graph(method, path, body);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/neuron/list/"))) {
|
|
el_val_t node_type = str_slice(clean, 16, str_len(clean));
|
|
return handle_api_list_typed(node_type, path, body);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/neuron/recall"))) {
|
|
return handle_api_recall(method, path, body);
|
|
}
|
|
return err_404(clean);
|
|
}
|
|
if (str_eq(method, EL_STR("POST"))) {
|
|
if (str_eq(clean, EL_STR("/imprint/contextual"))) {
|
|
return route_imprint_contextual(body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/imprint/user"))) {
|
|
return route_imprint_user(body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/synthesize"))) {
|
|
return route_synthesize(body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/elp/chat"))) {
|
|
return handle_elp_chat(body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/chat"))) {
|
|
el_val_t agentic_flag = json_get_bool(body, EL_STR("agentic"));
|
|
el_val_t reply = ({ el_val_t _if_result_11 = 0; if (agentic_flag) { _if_result_11 = (handle_chat_agentic(body)); } else { _if_result_11 = (handle_chat(body)); } _if_result_11; });
|
|
auto_persist(body, reply);
|
|
return reply;
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/see"))) {
|
|
return handle_see(body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/conversations"))) {
|
|
return handle_conversations(method);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/config"))) {
|
|
return handle_config(method, body);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/tools/"))) {
|
|
return handle_tool(clean, method, body);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/dharma"))) {
|
|
return handle_dharma(clean, method, body);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/nlg"))) {
|
|
return handle_nlg(clean, method, body);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/memories"))) {
|
|
return axon_post(clean, body);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/knowledge"))) {
|
|
return axon_post(clean, body);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/backlog"))) {
|
|
return axon_post(clean, body);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/artifacts"))) {
|
|
return axon_post(clean, body);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/projects"))) {
|
|
return axon_post(clean, body);
|
|
}
|
|
if (str_starts_with(clean, EL_STR("/api/imprints"))) {
|
|
return axon_post(clean, body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/neuron/session/begin"))) {
|
|
return handle_api_begin_session(body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/neuron/ctx"))) {
|
|
return handle_api_compile_ctx(body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/neuron/knowledge/search"))) {
|
|
return handle_api_search_knowledge(method, path, body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/neuron/knowledge/capture"))) {
|
|
return handle_api_capture_knowledge(body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/neuron/knowledge/evolve"))) {
|
|
return handle_api_evolve_knowledge(body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/neuron/knowledge/promote"))) {
|
|
return handle_api_promote_knowledge(body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/neuron/processes"))) {
|
|
return handle_api_browse_processes(method, path, body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/neuron/processes/define"))) {
|
|
return handle_api_define_process(body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/neuron/state-events"))) {
|
|
return handle_api_log_state_event(body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/neuron/config"))) {
|
|
return handle_api_inspect_config(path, body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/neuron/config/tune"))) {
|
|
return handle_api_tune_config(body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/neuron/graph"))) {
|
|
return handle_api_inspect_graph(method, path, body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/neuron/graph/link"))) {
|
|
return handle_api_link_entities(body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/neuron/memory"))) {
|
|
return handle_api_remember(body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/neuron/recall"))) {
|
|
return handle_api_recall(method, path, body);
|
|
}
|
|
if (str_eq(clean, EL_STR("/api/neuron/consolidate"))) {
|
|
return handle_api_consolidate(body);
|
|
}
|
|
return err_404(clean);
|
|
}
|
|
return err_405(method, clean);
|
|
return 0;
|
|
}
|
|
|