feat(soul): wire consciousness layers — explicit L0→L1→L2→L3→L1 cycle
Neuron Soul CI / build (pull_request) Failing after 6m27s
Neuron Soul CI / build (pull_request) Failing after 6m27s
This commit is contained in:
@@ -34,7 +34,8 @@ fn route_health() -> String {
|
||||
+ ",\"boot\":" + boot_num
|
||||
+ ",\"node_count\":" + int_to_str(node_ct)
|
||||
+ ",\"edge_count\":" + int_to_str(edge_ct)
|
||||
+ ",\"pulse\":" + pulse_num + "}"
|
||||
+ ",\"pulse\":" + pulse_num
|
||||
+ ",\"layers\":{\"l0\":\"core\",\"l1\":\"safety\",\"l2\":\"stewardship\",\"l3\":\"" + imprint_current() + "\"}}"
|
||||
}
|
||||
|
||||
fn route_lineage() -> String {
|
||||
@@ -143,10 +144,12 @@ fn handle_dharma_recv(body: String) -> String {
|
||||
eff_payload
|
||||
}
|
||||
let agentic_flag: Bool = json_get_bool(eff_payload, "agentic")
|
||||
let raw_msg: String = json_get(chat_body, "message")
|
||||
let reply: String = if agentic_flag {
|
||||
handle_chat_agentic(chat_body)
|
||||
} else {
|
||||
handle_chat(chat_body)
|
||||
let screened_reply: String = layered_cycle(raw_msg)
|
||||
screened_reply
|
||||
}
|
||||
auto_persist(chat_body, reply)
|
||||
return reply
|
||||
@@ -319,10 +322,12 @@ fn handle_request(method: String, path: String, body: String) -> String {
|
||||
}
|
||||
if str_eq(clean, "/api/chat") {
|
||||
let agentic_flag: Bool = json_get_bool(body, "agentic")
|
||||
let raw_msg: String = json_get(body, "message")
|
||||
let reply: String = if agentic_flag {
|
||||
handle_chat_agentic(body)
|
||||
} else {
|
||||
handle_chat(body)
|
||||
let screened_reply: String = layered_cycle(raw_msg)
|
||||
screened_reply
|
||||
}
|
||||
auto_persist(body, reply)
|
||||
return reply
|
||||
|
||||
@@ -5,6 +5,9 @@ import "chat.el"
|
||||
import "studio.el"
|
||||
import "elp-input.el"
|
||||
import "routes.el"
|
||||
import "safety.el"
|
||||
import "stewardship.el"
|
||||
import "imprint.el"
|
||||
|
||||
cgi "neuron-soul" {
|
||||
dharma_id: "ntn-genesis@http://localhost:7770",
|
||||
@@ -229,6 +232,40 @@ fn emit_session_start_event() -> Void {
|
||||
println("[soul] session-start event logged (boot=" + boot_num + " nodes=" + int_to_str(node_ct) + " edges=" + int_to_str(edge_ct) + ")")
|
||||
}
|
||||
|
||||
// layered_cycle — routes user-facing requests through the 4-layer consciousness stack.
|
||||
// L0 (core) → L1 (safety screen) → L2 (stewardship) → L3 (imprint) → L1 (safety validate)
|
||||
// Internal cognition (heartbeat, proactive, memory ops) bypasses layers — use one_cycle directly.
|
||||
fn layered_cycle(raw_input: String) -> String {
|
||||
let history: String = state_get("conversation_history")
|
||||
|
||||
// L1 in: safety screen
|
||||
let screen_result: String = safety_screen(raw_input, history)
|
||||
let screen_action: String = json_get(screen_result, "action")
|
||||
|
||||
// Hard bell: bypass all upper layers, log and escalate
|
||||
if str_eq(screen_action, "hard_bell") {
|
||||
safety_log_bell("hard", json_get(screen_result, "reason"), str_slice(raw_input, 0, 80))
|
||||
return safety_validate("", "hard_bell")
|
||||
}
|
||||
|
||||
// L2: stewardship alignment
|
||||
let screened: String = json_get(screen_result, "content")
|
||||
let imprint_id: String = imprint_current()
|
||||
let steward_result: String = steward_align(screened, imprint_id)
|
||||
let steward_action: String = json_get(steward_result, "action")
|
||||
let guided: String = if str_eq(steward_action, "pass") {
|
||||
json_get(steward_result, "content")
|
||||
} else {
|
||||
json_get(steward_result, "redirect_to")
|
||||
}
|
||||
|
||||
// L3: imprint responds
|
||||
let output: String = imprint_respond(guided, imprint_id)
|
||||
|
||||
// L1 out: validate output before delivery
|
||||
return safety_validate(output, screen_action)
|
||||
}
|
||||
|
||||
let soul_cgi_id_raw: String = env("SOUL_CGI_ID")
|
||||
let soul_cgi_id: String = if str_eq(soul_cgi_id_raw, "") { "ntn-genesis" } else { soul_cgi_id_raw }
|
||||
let port_raw: String = env("NEURON_PORT")
|
||||
|
||||
Reference in New Issue
Block a user