Phase 1-2 build: Steps 5-6, 8-13
Shoresh Engine (Haskell, Step 5) - 12 modules: Types, Lexicon, Binyanim, Teamim, Gematria, Graph, KetivQere, Smikhut, Havdalah, Kriah, KiTov, Firmware - 33 EUnit tests, 0 failures - Firmware module verifies L1 SHA-256 hash at startup Talmudic Engine (SWI-Prolog, Step 6) - 15 modules: halt, reasoning, specification, interface - 57 PlUnit tests, 0 failures - Three cardinal halt conditions: avodah_zarah, shfichut_damim, gilui_arayot Vav Pipeline (Elixir, Steps 8-11) - 14 modules: BereishitCycle, Shema, Cloud, Manna, L1Reader, Specification, HaltConditions, ShabbatTimer, CycleLog, Chatzotzrot, ShoreshEngineClient, TalmudicEngineClient, Application - 46 ExUnit tests, 0 failures - Nishma-first architecture: hears before it speaks Sanhedrin Framework (Erlang/OTP, Step 12) - 8 modules: sanhedrin_app, sanhedrin_sup, escalation, panel_sup, panel, judge, clerk, halt_monitor - 46 EUnit tests, 0 failures (includes fix: rejected outcome now reachable) - Panel sizes: 1/3/23/71 — unanimous capital guilty → acquit (Sanhedrin 17a) - Minority opinions append-only, never deleted Korban Processor (Python, Step 13) - 6 modules: korban, shechitah, semichah, zerikah, haktarah, router Builder tooling: AGENTS.md, opencode.json, memory/, src/tools/ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
622e814c9e
commit
80ec364da6
86 files changed
+9646
No files matched your search
@@ -0,0 +1,95 @@
|
||||
%% api.pl — JSON API for communication with Elixir.
|
||||
%%
|
||||
%% Construction §3.3: JSON over Unix domain socket
|
||||
%% Protocol: Pipeline sends JSON, engine responds with JSON.
|
||||
%%
|
||||
%% Phase 1: Provides a predicate-based interface.
|
||||
%% Phase 2: Will add the socket listener for the Vav Pipeline.
|
||||
|
||||
:- module(api, [
|
||||
process_request/2,
|
||||
format_interpretation/2,
|
||||
format_resolution/2,
|
||||
format_halt_check/2
|
||||
]).
|
||||
|
||||
:- use_module('../reasoning/interpret').
|
||||
:- use_module('../reasoning/challenge').
|
||||
:- use_module('../reasoning/resolve').
|
||||
:- use_module('../halt/avodah_zarah').
|
||||
:- use_module('../halt/shfichut_damim').
|
||||
:- use_module('../halt/gilui_arayot').
|
||||
|
||||
%% ============================================================
|
||||
%% REQUEST PROCESSING
|
||||
%% ============================================================
|
||||
|
||||
%% Process a request (as a Prolog term matching the JSON schema)
|
||||
%% Actions: interpret, challenge, resolve, halt_check
|
||||
process_request(request(interpret, CaseRef, Domain, Roots, Question), Response) :-
|
||||
Case = case(CaseRef, Domain, Roots, Question),
|
||||
( interpret(Case, Interpretation)
|
||||
-> format_interpretation(Interpretation, Response)
|
||||
; Response = response(error, no_interpretation, CaseRef)
|
||||
).
|
||||
|
||||
process_request(request(resolve, CaseRef, Domain, Roots, Question), Response) :-
|
||||
Case = case(CaseRef, Domain, Roots, Question),
|
||||
( resolve(Case, Resolution)
|
||||
-> format_resolution(Resolution, Response)
|
||||
; Response = response(error, no_resolution, CaseRef)
|
||||
).
|
||||
|
||||
process_request(request(halt_check, Action), Response) :-
|
||||
format_halt_check(Action, Response).
|
||||
|
||||
%% ============================================================
|
||||
%% RESPONSE FORMATTING
|
||||
%% ============================================================
|
||||
|
||||
%% Format an interpretation as a response
|
||||
format_interpretation(interpretation(Ref, Mitzvot, Verses, Reading, Confidence),
|
||||
response(ok, interpreted,
|
||||
result(ref(Ref),
|
||||
mitzvot(Mitzvot),
|
||||
verses(Verses),
|
||||
reading(Reading),
|
||||
confidence(Confidence)))).
|
||||
|
||||
%% Format a resolution as a response
|
||||
format_resolution(accepted(Interpretation), Response) :-
|
||||
format_interpretation(Interpretation, InterpResponse),
|
||||
InterpResponse = response(ok, interpreted, Result),
|
||||
Response = response(ok, resolved_accepted, Result).
|
||||
|
||||
format_resolution(challenged(Interpretation, Kushya),
|
||||
response(ok, resolved_challenged,
|
||||
result(interpretation(Interpretation),
|
||||
challenge(Kushya)))).
|
||||
|
||||
format_resolution(synthesized(CommonMitzvot, Verses, Both),
|
||||
response(ok, resolved_synthesized,
|
||||
result(common(CommonMitzvot),
|
||||
verses(Verses),
|
||||
both_sides(Both)))).
|
||||
|
||||
format_resolution(teiku(Record),
|
||||
response(ok, teiku,
|
||||
result(record(Record)))).
|
||||
|
||||
format_resolution(no_interpretation(Ref),
|
||||
response(ok, no_interpretation,
|
||||
result(ref(Ref)))).
|
||||
|
||||
%% Format halt check results
|
||||
format_halt_check(Action, Response) :-
|
||||
findall(Halt,
|
||||
( halt_check_avodah_zarah(Action, Halt)
|
||||
; halt_check_shfichut_damim(Action, Halt)
|
||||
; halt_check_gilui_arayot(Action, Halt)
|
||||
),
|
||||
Halts),
|
||||
( Halts = []
|
||||
-> Response = response(ok, no_halt, action(Action))
|
||||
; Response = response(halt, violations(Halts), action(Action))
|
||||
).
|
||||
Reference in new issue
Block a user