fix(soul): address review issues in feat/layer-composition
Neuron Soul CI / build (pull_request) Failing after 6m5s
Neuron Soul CI / build (pull_request) Failing after 6m5s
- Add stub implementations of safety.el, stewardship.el, and imprint.el
with their .elh headers so the branch compiles without the dependency
branches (feat/layer-safety, feat/layer-stewardship, feat/layer-imprint).
Each stub documents the layer contract it must satisfy when replaced.
- Fix GET /api/chat bypass: update the GET branch in handle_request to
call layered_cycle() consistently with the POST branch, rather than
calling handle_chat() directly and skipping the consciousness stack.
- Export layered_cycle() from soul.elh (and dist/soul.elh) so routes.el
can resolve the symbol via the header import.
- Fix steward_action else branch: add explicit handling for "block"
(returns safe refusal immediately, skips L3) and "redirect" (uses
redirect_to field). Unknown actions now log a warning and fall back to
the screened input rather than silently passing an empty string to
imprint_respond().
- Document hard_bell path: clarify that omitting auto_persist/history
update is intentional security isolation, and document the safety_validate
second-param sentinel contract ("hard_bell" vs screen_action).
This commit is contained in:
@@ -4,6 +4,7 @@ import "chat.el"
|
||||
import "studio.el"
|
||||
import "elp-input.el"
|
||||
import "neuron-api.el"
|
||||
import "soul.elh"
|
||||
|
||||
fn strip_query(path: String) -> String {
|
||||
let q: Int = str_index_of(path, "?")
|
||||
@@ -234,7 +235,22 @@ fn handle_request(method: String, path: String, body: String) -> String {
|
||||
return if str_eq(edges_raw, "") { "[]" } else { edges_raw }
|
||||
}
|
||||
if str_eq(clean, "/api/chat") {
|
||||
return handle_chat(body)
|
||||
// GET /api/chat: pass through layered_cycle for consistency with POST path.
|
||||
// GET chat is a legacy probe interface; body may be empty for simple pings.
|
||||
let raw_msg: String = json_get(body, "message")
|
||||
let eff_msg: String = if str_eq(raw_msg, "") { body } else { raw_msg }
|
||||
if str_eq(eff_msg, "") {
|
||||
return "{\"error\":\"message required\"}"
|
||||
}
|
||||
let agentic_flag: Bool = json_get_bool(body, "agentic")
|
||||
let reply: String = if agentic_flag {
|
||||
handle_chat_agentic(body)
|
||||
} else {
|
||||
let screened_reply: String = layered_cycle(eff_msg)
|
||||
screened_reply
|
||||
}
|
||||
auto_persist(body, reply)
|
||||
return reply
|
||||
}
|
||||
if str_eq(clean, "/api/conversations") {
|
||||
return handle_conversations(method)
|
||||
|
||||
Reference in New Issue
Block a user