feat: harden chat history and add tests#167
Conversation
…g ENOENT (create .dexter dir)
|
Hi, @virattt, Could you review my PR, Please? |
…erm-chat-history, adopt upstream debugLog in outbound
c426271 to
2aeb499
Compare
|
Hi, @virattt, Could you review my PR, Please? |
|
@virattt, Please review my PR. Thank you |
1 similar comment
|
@virattt, Please review my PR. Thank you |
|
Thanks for the contribution — nice additions, especially the test coverage and the
|
| Issue | Severity |
|---|---|
Default historyLimit halves agent context |
Bug — needs fix |
maxEntries doc/code mismatch |
Minor bug |
save() on corrupt file |
Design choice, worth discussing |
| Semicolons / arrow parens / test dir | Nit |
Summary
Hardens chat history utilities with history limits and adds test coverage for
history-contextandlong-term-chat-history.Changes
buildHistoryContext(history-context.ts)BuildHistoryContextParamsinterface for a clearer APIhistoryLimitparameter (defaultDEFAULT_HISTORY_LIMIT, 10)historyLimit > 0, only the last N entries are used in the prompthistoryLimit <= 0, all entries are included (no trimming)LongTermChatHistory(long-term-chat-history.ts)maxEntries(default 200) to cap stored messagesoptions?: { maxEntries?: number }load(): rewrites file on parse error and trims tomaxEntriesif neededaddUserMessage(): trims messages tomaxEntriesafter adding a new entry.dexter/messages/chat_history.jsonTests
historyLimitoverride, and disabling limit withhistoryLimit <= 0updateAgentResponse, deduplication ingetMessageStrings,maxEntrieson add, and trimming on loadBackward Compatibility
buildHistoryContext({ entries, currentMessage })calls behave as before (default limit of 10)LongTermChatHistory(baseDir)usage is unchanged (defaultmaxEntriesof 200)Testing
bun test