@@ -11,7 +11,6 @@ import path from "path"
1111import os from "os"
1212
1313const CONTEXT_LIMIT = 1000
14- const USED_CONTEXT = 200
1514
1615describe ( "content-size" , ( ) => {
1716 describe ( "calculateMaxAllowedSize" , ( ) => {
@@ -39,31 +38,28 @@ describe("content-size", () => {
3938 describe ( "estimateContentSize" , ( ) => {
4039 it ( "estimates size for string content" , ( ) => {
4140 const content = "Hello world" // 11 bytes
42- const result = estimateContentSize ( content , CONTEXT_LIMIT , USED_CONTEXT )
41+ const result = estimateContentSize ( content , CONTEXT_LIMIT )
4342
4443 expect ( result . bytes ) . to . equal ( 11 )
4544 expect ( result . estimatedTokens ) . to . equal ( 3 )
46- expect ( result . remainingContextSize ) . to . equal ( 800 )
4745 expect ( result . wouldExceedLimit ) . to . equal ( false )
4846 } )
4947
5048 it ( "estimates size for buffer content" , ( ) => {
5149 const content = Buffer . from ( "Hello world" ) // 11 bytes
52- const result = estimateContentSize ( content , CONTEXT_LIMIT , USED_CONTEXT )
50+ const result = estimateContentSize ( content , CONTEXT_LIMIT )
5351
5452 expect ( result . bytes ) . to . equal ( 11 )
5553 expect ( result . estimatedTokens ) . to . equal ( 3 )
56- expect ( result . remainingContextSize ) . to . equal ( 800 )
5754 expect ( result . wouldExceedLimit ) . to . equal ( false )
5855 } )
5956
6057 it ( "detects when content would exceed half of context limit" , ( ) => {
6158 const halfContextLimit = calculateMaxAllowedSize ( CONTEXT_LIMIT ) // 500 tokens
6259 const largeContent = "x" . repeat ( halfContextLimit * 4 + 4 ) // Just over half context limit in tokens
63- const result = estimateContentSize ( largeContent , CONTEXT_LIMIT , USED_CONTEXT )
60+ const result = estimateContentSize ( largeContent , CONTEXT_LIMIT )
6461
6562 expect ( result . wouldExceedLimit ) . to . equal ( true )
66- expect ( result . remainingContextSize ) . to . equal ( 800 ) // This is still contextLimit - usedContext
6763 } )
6864 } )
6965
@@ -80,18 +76,17 @@ describe("content-size", () => {
8076 } )
8177
8278 it ( "estimates size for existing file" , async ( ) => {
83- const result = await estimateFileSize ( tempFilePath , CONTEXT_LIMIT , USED_CONTEXT )
79+ const result = await estimateFileSize ( tempFilePath , CONTEXT_LIMIT )
8480
8581 expect ( result . bytes ) . to . equal ( 11 )
8682 expect ( result . estimatedTokens ) . to . equal ( 3 )
87- expect ( result . remainingContextSize ) . to . equal ( 800 )
8883 expect ( result . wouldExceedLimit ) . to . equal ( false )
8984 } )
9085
9186 it ( "throws error for non-existent file" , async ( ) => {
9287 const nonExistentPath = path . join ( os . tmpdir ( ) , "non-existent.txt" )
9388 try {
94- await estimateFileSize ( nonExistentPath , CONTEXT_LIMIT , USED_CONTEXT )
89+ await estimateFileSize ( nonExistentPath , CONTEXT_LIMIT )
9590 throw new Error ( "Should have thrown error" )
9691 } catch ( error ) {
9792 expect ( error ) . to . be . instanceOf ( Error )
0 commit comments