Files
neuron/imprint.el
T
will.anderson bebf1f8c86
Neuron Soul CI / build (pull_request) Failing after 6m5s
fix(soul): address review issues in feat/layer-composition
- 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).
2026-06-11 11:47:45 -05:00

30 lines
1.2 KiB
EmacsLisp

// imprint.el L3 Imprint layer (stub full implementation in feat/layer-imprint)
// Routes the processed input through the active imprint and generates the final reply.
// This stub allows soul.el and routes.el to compile while feat/layer-imprint is pending merge.
//
// Contract for imprint_current() -> String:
// Returns the active imprint ID (node ID from engram), or "none" if no imprint is loaded.
// Used in health checks and to identify which imprint L2/L3 should operate against.
//
// Contract for imprint_respond(input, imprint_id) -> String:
// Generates a reply from the active imprint given the stewardship-aligned input.
// Falls back to handle_chat when no imprint is active (imprint_id = "" or "none").
fn imprint_current() -> String {
let contextual: String = state_get("active_contextual_imprint")
if !str_eq(contextual, "") {
return contextual
}
let user_imp: String = state_get("active_user_imprint")
if !str_eq(user_imp, "") {
return user_imp
}
return "none"
}
fn imprint_respond(input: String, imprint_id: String) -> String {
// Stub: delegate to core chat until feat/layer-imprint is merged
let body: String = "{\"message\":\"" + json_safe(input) + "\"}"
return handle_chat(body)
}