@@ -61,7 +61,7 @@ describe("memory plugin e2e", () => {
6161 expect ( config ) . toBeDefined ( ) ;
6262 expect ( config ?. embedding ?. apiKey ) . toBe ( OPENAI_API_KEY ) ;
6363 expect ( config ?. dbPath ) . toBe ( dbPath ) ;
64- expect ( config ?. captureMaxChars ) . toBe ( 1500 ) ;
64+ expect ( config ?. captureMaxChars ) . toBe ( 500 ) ;
6565 } ) ;
6666
6767 test ( "config schema resolves env vars" , async ( ) => {
@@ -105,6 +105,21 @@ describe("memory plugin e2e", () => {
105105 } ) . toThrow ( "captureMaxChars must be between 100 and 10000" ) ;
106106 } ) ;
107107
108+ test ( "config schema accepts captureMaxChars override" , async ( ) => {
109+ const { default : memoryPlugin } = await import ( "./index.js" ) ;
110+
111+ const config = memoryPlugin . configSchema ?. parse ?.( {
112+ embedding : {
113+ apiKey : OPENAI_API_KEY ,
114+ model : "text-embedding-3-small" ,
115+ } ,
116+ dbPath,
117+ captureMaxChars : 1800 ,
118+ } ) ;
119+
120+ expect ( config ?. captureMaxChars ) . toBe ( 1800 ) ;
121+ } ) ;
122+
108123 test ( "shouldCapture applies real capture rules" , async ( ) => {
109124 const { shouldCapture } = await import ( "./index.js" ) ;
110125
@@ -117,10 +132,14 @@ describe("memory plugin e2e", () => {
117132 expect ( shouldCapture ( "<relevant-memories>injected</relevant-memories>" ) ) . toBe ( false ) ;
118133 expect ( shouldCapture ( "<system>status</system>" ) ) . toBe ( false ) ;
119134 expect ( shouldCapture ( "Here is a short **summary**\n- bullet" ) ) . toBe ( false ) ;
120- const longButAllowed = `I always prefer this style. ${ "x" . repeat ( 1200 ) } ` ;
121- const tooLong = `I always prefer this style. ${ "x" . repeat ( 1600 ) } ` ;
122- expect ( shouldCapture ( longButAllowed , { maxChars : 1500 } ) ) . toBe ( true ) ;
123- expect ( shouldCapture ( tooLong , { maxChars : 1500 } ) ) . toBe ( false ) ;
135+ const defaultAllowed = `I always prefer this style. ${ "x" . repeat ( 400 ) } ` ;
136+ const defaultTooLong = `I always prefer this style. ${ "x" . repeat ( 600 ) } ` ;
137+ expect ( shouldCapture ( defaultAllowed ) ) . toBe ( true ) ;
138+ expect ( shouldCapture ( defaultTooLong ) ) . toBe ( false ) ;
139+ const customAllowed = `I always prefer this style. ${ "x" . repeat ( 1200 ) } ` ;
140+ const customTooLong = `I always prefer this style. ${ "x" . repeat ( 1600 ) } ` ;
141+ expect ( shouldCapture ( customAllowed , { maxChars : 1500 } ) ) . toBe ( true ) ;
142+ expect ( shouldCapture ( customTooLong , { maxChars : 1500 } ) ) . toBe ( false ) ;
124143 } ) ;
125144
126145 test ( "detectCategory classifies using production logic" , async ( ) => {
0 commit comments