@@ -154,10 +154,6 @@ export const ReadTool = Tool.define(
154154 params : Schema . Schema . Type < typeof Parameters > ,
155155 ctx : Tool . Context ,
156156 ) {
157- if ( params . offset !== undefined && params . offset < 1 ) {
158- return yield * Effect . fail ( new Error ( "offset must be greater than or equal to 1" ) )
159- }
160-
161157 const instance = yield * InstanceState . context
162158 let filepath = params . filePath
163159 if ( ! path . isAbsolute ( filepath ) ) {
@@ -192,7 +188,7 @@ export const ReadTool = Tool.define(
192188 if ( stat . type === "Directory" ) {
193189 const items = yield * list ( filepath )
194190 const limit = params . limit ?? DEFAULT_READ_LIMIT
195- const offset = params . offset ?? 1
191+ const offset = params . offset || 1
196192 const start = offset - 1
197193 const sliced = items . slice ( start , start + limit )
198194 const truncated = start + sliced . length < items . length
@@ -249,7 +245,7 @@ export const ReadTool = Tool.define(
249245 }
250246
251247 const file = yield * Effect . promise ( ( ) =>
252- lines ( filepath , { limit : params . limit ?? DEFAULT_READ_LIMIT , offset : params . offset ?? 1 } ) ,
248+ lines ( filepath , { limit : params . limit ?? DEFAULT_READ_LIMIT , offset : params . offset || 1 } ) ,
253249 )
254250 if ( file . count < file . offset && ! ( file . count === 0 && file . offset === 1 ) ) {
255251 return yield * Effect . fail (
0 commit comments