mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-22 14:38:12 +02:00
Lot 46 : outils recall et recall_search exécutés par la façade
Les deux outils qui rappellent un bloc archivé par la compaction ne passent plus par /tool/exec du Go : src/recall.rs porte toolRecall et toolRecallSearch (id tolérant comme recallIDToSeq, mots-clés en minuscules rune par rune comme strings.ToLower, score libellé double et plus récent d'abord, limites, extraits et textes du Go). L'archive reste au Go, seul à tenir la séquence de la base, qui la sert à la façade (GET /internal/v1/recall/block?seq=N et /internal/v1/recall/blocks, blocs chiffrés sous une mémoire verrouillée exclus) ; ses propres outils passent par les mêmes lectures. Go injoignable : l'appel passe par lui. Parité : journal de 41 appels sur une archive de 35 blocs tiré du Go (parity_recall_test.go → tests/parity_recall/recall.json), rejoué par tests/recall.rs ; un tour de la façade qui rappelle et cherche (tests/lot6.rs) ; TestRecallInterneLecture côté Go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016tcGfJWefW5kUGoC2wL8cv
This commit is contained in:
15 files changed
+1416
-25
No files matched your search
@@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"io"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// API interne de l'archive recall (lot 6 de la migration Rust).
|
||||
@@ -16,6 +17,12 @@ import (
|
||||
//
|
||||
// POST /internal/v1/recall/archive {"label":…,"role":…,"content":…}
|
||||
// → 200 {"id":"r7"} · 423 mémoire verrouillée (rien d'écrit en clair)
|
||||
//
|
||||
// Les outils recall et recall_search de la façade (lot 46) lisent l'archive
|
||||
// ici ; le reste (id tolérant, score, mise en forme) est chez elle :
|
||||
//
|
||||
// GET /internal/v1/recall/block?seq=7 → 200 bloc · 404 absent ou illisible
|
||||
// GET /internal/v1/recall/blocks → 200 [blocs lisibles, par séquence]
|
||||
|
||||
const internalRecallMaxBody = 32 << 20
|
||||
|
||||
@@ -46,3 +53,35 @@ func handleInternalRecallArchive(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
sendJSON(w, http.StatusOK, map[string]any{"id": id})
|
||||
}
|
||||
|
||||
func handleInternalRecallBlock(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodGet {
|
||||
w.Header().Set("Allow", http.MethodGet)
|
||||
sendJSON(w, http.StatusMethodNotAllowed, map[string]any{"error": "GET attendu"})
|
||||
return
|
||||
}
|
||||
seq, err := strconv.ParseUint(r.URL.Query().Get("seq"), 10, 64)
|
||||
if err != nil {
|
||||
sendJSON(w, http.StatusBadRequest, map[string]any{"error": "seq illisible"})
|
||||
return
|
||||
}
|
||||
blk, ok := recallGetSeq(seq)
|
||||
if !ok {
|
||||
sendJSON(w, http.StatusNotFound, map[string]any{"error": "bloc introuvable"})
|
||||
return
|
||||
}
|
||||
sendJSON(w, http.StatusOK, blk)
|
||||
}
|
||||
|
||||
func handleInternalRecallBlocks(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodGet {
|
||||
w.Header().Set("Allow", http.MethodGet)
|
||||
sendJSON(w, http.StatusMethodNotAllowed, map[string]any{"error": "GET attendu"})
|
||||
return
|
||||
}
|
||||
blks := recallAll()
|
||||
if blks == nil {
|
||||
blks = []recallBlock{}
|
||||
}
|
||||
sendJSON(w, http.StatusOK, blks)
|
||||
}
|
||||
Reference in new issue
Block a user