readWindowCoercionNotice function

String? readWindowCoercionNotice({
  1. required bool hasSelector,
  2. required int? offset,
  3. required int? limit,
})

Resolves a read tool call's window when a trailing selector and offset/limit arrive together (UT-4, AC4): the selector pins the window, so offset/limit are ignored with a notice instead of hard-rejecting.

Returns the notice to append to the result, or null when the call was already unambiguous.

Implementation

String? readWindowCoercionNotice({
  required bool hasSelector,
  required int? offset,
  required int? limit,
}) {
  if (!hasSelector || (offset == null && limit == null)) return null;
  return 'Note: offset/limit cannot be combined with a path selector; '
      'the harness honored the selector and IGNORED '
      '${[
        if (offset != null) 'offset',
        if (limit != null) 'limit',
      ].join(' and ')}. $readRemedyExample';
}