Spaces:
Running
Running
Commit History
3 days ago
-
refactor(architecture): deep-module chat-context assembly + lane-parity guard
Z Userimprove-codebase-architecture round (top recommendation, implemented): - NEW api/lib/chatbot-context.ts — the deep module: ONE prompt-assembly recipe (assembleChatContext: signal -> saadat -> cables -> refs -> getSystemPrompt) and ONE citation composition (enforceAllCitations: pinned -> cables -> refs, appendOnly for the stream seam), behind a small named-option interface. The 13-positional-arg getSystemPrompt dance is no longer any caller's problem. - 5 hand-copied assembly sites collapse to one call each: chatbot.ts buildCascadePrompt (keeps its v3.9.2 cablesCrossGate), chatbot-stream.ts pickWorkingModel / vision pass-2 (routingFloor=true, vision=true) / BYOK lane / dynamic-router lane. - 2 hand-copied enforcement sites collapse: chatbot.ts finishSaadatCitation and chatbot-router.ts emitEnforcedCitations (appendOnly). - NEW parity test (25 cases): byte-identical systemPrompt / routingSignal / cablesIntentActive vs a verbatim copy of the historical recipe across…8ed78fa