An opt-in gateway middleware for Codex Responses history after a provider or account switch. For a provider whose rule turns historyFilter on, it drops old reasoning items and items typed encrypted_content, removes the optional server id from message and tool items, and sets store false. It keeps text, tool arguments, results and call_id pairing. It rejects previous_response_id, conversation, item_reference, encrypted compaction and /responses/compact with a message, instead of dropping them silently. Every provider passes through unless configured. No network, file, env or child-process access. Run at the reviewed head 96881ead, merged with origin/main: - bun test packages/codex-history: 22 pass, 0 fail. - The same 22 cases.json cases through magpie's own engine (moejs, via internal/middleware Begin/Request in a throwaway test): 22 ran, all equal. - Broke it by hand (reasoning items kept): bun 4 fail, moejs 4 BAD; restored. - Whole repo: bun test 1606 pass, 0 fail; bun scripts/check.mjs exit 0.
5 lines
135 B
JavaScript
5 lines
135 B
JavaScript
import * as mod from "./codex-history.middleware.js"
|
|
import { check } from "../../scripts/middleware.mjs"
|
|
|
|
check(import.meta.dir, mod)
|