The "magpie1:" mark, Codex's summary prefix and the reading of a magpie compaction as Codex's own local-compaction summary message move from the gateway into internal/codexsummary, so the rollout rewrite that comes next (internal/sessions, which the gateway imports) reads it the same way. The gateway's behaviour is unchanged. Run: go build ./internal/...; go vet ./internal/gateway ./internal/codexsummary; go test ./internal/codexsummary; go test ./internal/gateway -run 'Compact|CodexInput|Rewrite|Native|CallItem|Protection' (ok, 57s).
21 lines
606 B
Go
21 lines
606 B
Go
package codexsummary
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestMessage(t *testing.T) {
|
|
msg, ours := Message(Encrypted("done: a, b\nnext: c"))
|
|
want := UserMessage(Prefix + "\ndone: a, b\nnext: c")
|
|
if !ours || !reflect.DeepEqual(msg, want) {
|
|
t.Fatalf("magpie's compaction read as %v, %v; want %v", msg, ours, want)
|
|
}
|
|
if msg, ours := Message("gAAAAABopaque=="); ours || msg != nil {
|
|
t.Fatalf("OpenAI's own compaction read as magpie's: %v", msg)
|
|
}
|
|
if msg, ours := Message(Mark + "%%%"); !ours || msg != nil {
|
|
t.Fatalf("an unreadable summary of magpie's: %v, %v; want nil, true", msg, ours)
|
|
}
|
|
}
|